@bikdotai/bik-component-library 0.0.697-5 → 0.0.697
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.
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.d.ts +2 -1
- package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +2 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.style.js +10 -8
- package/dist/cjs/components/discount-modal/DiscountModal.d.ts +1 -1
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/dropdown/Common.styled.d.ts +0 -1
- package/dist/cjs/components/dropdown/Common.styled.js +3 -3
- package/dist/cjs/components/dropdown/DropdownPopover/index.d.ts +0 -1
- package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/cjs/components/dropdown-button/DropdownButton.js +1 -1
- package/dist/cjs/components/dropdown-button/DropdownButton.style.d.ts +0 -1
- package/dist/cjs/components/dropdown-button/DropdownButton.style.js +3 -16
- package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +1 -1
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/productScreen.d.ts +1 -1
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +1 -1
- package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +1 -1
- package/dist/cjs/components/product-picker-v2/utility.d.ts +1 -1
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +1 -1
- package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/data-source-panel/DataSourceInfoFooter.d.ts +2 -1
- package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +2 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.js +7 -5
- package/dist/esm/components/discount-modal/DiscountModal.d.ts +1 -1
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/dropdown/Common.styled.d.ts +0 -1
- package/dist/esm/components/dropdown/Common.styled.js +4 -4
- package/dist/esm/components/dropdown/DropdownPopover/index.d.ts +0 -1
- package/dist/esm/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/esm/components/dropdown-button/DropdownButton.js +1 -1
- package/dist/esm/components/dropdown-button/DropdownButton.style.d.ts +0 -1
- package/dist/esm/components/dropdown-button/DropdownButton.style.js +4 -17
- package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +1 -1
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/productScreen.d.ts +1 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.d.ts +1 -1
- package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +1 -1
- package/dist/esm/components/product-picker-v2/utility.d.ts +1 -1
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +1 -1
- package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +1 -1
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth/models/bik-store"),o=require("../../assets/icons/search.svg.js"),s=require("react"),r=require("../../constants/Theme.js"),c=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),i=require("../input/Input.js"),l=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),p=require("./productInfoOverlay.js"),x=require("./productScreen.js"),h=require("./rearrangeScreen.js"),j=require("./reducers.js"),m=require("./searchScreen.js"),S=require("./selectedScreen.js"),C=require("./style.js"),g=require("./type.js"),y=require("./utility.js");exports.ProductPickerModal=R=>{const{storeId:b,selectedItems:f,onClose:E,visible:k,zIndex:v,exactLimit:I,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:P,outOfStockAction:T=g.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,hideSelectionCount:N,title:A,width:B,left:w,renderWithoutModal:L,onClickSave:M,pickerType:V,hideProductVariants:z=!1,startupScreen:$=g.ScreenName.Collections,rearrangeEnabled:_,selectSingleItem:H=!1,showProductDetails:K,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:U={},primaryButton:Y,secondaryButton:J,subtitle:Q}=R,X=R.appType||t.ApplicationType.BIK,[Z,ee]=s.useReducer(j.collectionsReducer,{}),[te,oe]=s.useState([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections),[se,re]=s.useState("grid"),[ce,ne]=s.useState(""),[ie,le]=s.useState(""),[ae,de]=s.useState(0),[ue,pe]=s.useState(!1),[xe,he]=s.useState(0),[je,me]=s.useState(""),[Se,Ce]=s.useState(!1),[ge,ye]=s.useState(!1),[Re,be]=s.useReducer(j.searchReducer,{collections:{},products:{}}),[fe,Ee]=s.useReducer(j.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ke=s.useRef(null),[ve,Ie]=s.useState(!1),[Oe,Fe]=s.useState();s.useEffect((()=>{pe(!0),ye(!0),R.collectionFetcher(ae,b,X).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),pe(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),s.useEffect((()=>{let e=0;z?Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s;"-1"!==t&&fe[-1]&&(null===(s=fe[-1].products)||void 0===s?void 0:s[o])||(e+=1)}))})):Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s,r;Object.keys((null===(r=null===(s=fe[t].products)||void 0===s?void 0:s[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Z,fe,z]),s.useEffect((()=>{ie&&(pe(!0),R.productFetcher(ie,b,X).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),pe(!1)})).catch())}),[ie]),s.useEffect((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(je.length||"collections"!==te)&&(je.length?(Ce(!0),R.searchFetcher(b,je,X).then((e=>{"collections"in e&&"products"in e?(be({type:"set",data:e}),ee({type:"searched",data:e.collections}),ee({type:"searched",data:e.products})):(be({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),pe(!1),Ce(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[je]),s.useEffect((()=>{M&&(R.onAdd(fe,xe),Pe())}),[M]),s.useEffect((()=>{H&&Object.keys(fe||{}).length&&xe&&(R.onAdd(fe,xe),Pe())}),[H,fe,xe]);const Pe=()=>{Ee({type:"reset",data:{}})},Te=()=>I&&xe>I?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${I} products`,type:"negative"}):O&&xe>O?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):xe>0?e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>{oe(_?g.ScreenName.RearrangeProducts:g.ScreenName.SelectedProducts)},buttonText:I?`${xe}/${I} products selected`:`${xe} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}):e.jsxRuntimeExports.jsx(n.Button,{disabled:!0,buttonText:I?`${xe}/${I} products selected`:`${xe} products selected`,buttonType:"tertiaryGray"}),De=e=>ue?"Loading...":te===g.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",qe=e.jsxRuntimeExports.jsxs(C.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[R.postHeader&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:R.postHeader})),!R.hideGlobalSearch&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:("collections"===te||"searchProducts"===te)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:L?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsxRuntimeExports.jsx(i.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Se?e.jsxRuntimeExports.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):e.jsxRuntimeExports.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:je,onChangeText:e=>{e.length&&e.trim().length?me(e):me("")}})}))}),e.jsxRuntimeExports.jsxs(C.ScrollContainerStyle,Object.assign({ref:ke,screenName:te},{children:["collections"===te&&e.jsxRuntimeExports.jsx(u.CollectionsScreen,{customCollectionRestriction:R.customCollectionRestriction,dataLoading:ge,collections:Z,selectedCollectionsDispatch:Ee,setCollectionId:ne,setSelectedCollectionId:le,setScreen:oe,selectedCollections:fe,collectionFetcher:R.collectionFetcher,storeId:b,appType:X,collectionsDispatch:ee,setSaveDisabled:pe,pagingControls:{curPage:ae,setCurPage:de},hideCollectionCheckbox:F,renderWithoutModal:L,pickerType:V,scrollContainerRef:ke}),"products"===te&&ce&&e.jsxRuntimeExports.jsx(j.CollectionIdContext.Provider,Object.assign({value:ce},{children:e.jsxRuntimeExports.jsx(x.ProductsScreen,{hideInCollectionSearch:R.hideInCollectionSearch,customCollectionRestriction:R.customCollectionRestriction,productFetcher:R.productFetcher,setScreen:oe,storeId:b,appType:X,data:Z[ce],collectionsDispatch:ee,selectedCollectionsDispatch:Ee,selectedData:fe,setSaveDisabled:pe,searchInCollectionFetcher:R.searchInCollectionFetcher,hideProductCheckbox:P,outOfStockAction:T,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,renderWithoutModal:L,pickerType:V,hideProductVariants:z,fbStatusFetcher:R.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Fe(e)},showProductDetailInfoIcon:K,scrollContainerRef:ke})})),"view"===te&&e.jsxRuntimeExports.jsx(S.SelectedScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,hideProductVariants:z,outOfStockAction:T,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"rearrange"===te&&e.jsxRuntimeExports.jsx(h.RearrangeScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,outOfStockAction:T,rearrangeViewType:"grid"===se?"list":"grid",scrollContainerRef:ke,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"searchProducts"===te&&e.jsxRuntimeExports.jsx(m.SearchScreen,{customCollectionRestriction:R.customCollectionRestriction,selectedCollections:fe||{},searchedCollections:Re||{},searchedCollectionsDispatch:be,selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,onBackPress:()=>{me(""),be({type:"set",data:{collections:{},products:{}}})},pickerType:V,hideProductCheckbox:P,hideProductVariants:z,hideVariantCheckbox:D,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:ne,setSelectedCollectionId:le,renderWithoutModal:L,hideCollectionCheckbox:F,outOfStockAction:T})]}))]}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:L?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[qe,U.renderFooter?e.jsxRuntimeExports.jsxs(C.StyledFooterForNonModal,{children:[Te(),e.jsxRuntimeExports.jsx(n.Button,{buttonText:De(U.primaryButtonText),disabled:!U.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||U.primaryButtonDisabled,isLoading:U.isLoading,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections)}})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),ve&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,outOfStockAction:T,useDynamicInfoImageSize:R.useDynamicInfoImageSize,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}):e.jsxRuntimeExports.jsxs(l.StyledModal,Object.assign({zIndex:v,open:k,onClose:()=>{null==E||E(),Pe()},headingTitle:A||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),headingSubtitle:Q,footerShadow:!0,centralContainerStyles:{width:B||"600px",left:w||"auto"},headerRightCustomElement:G?e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:E},{children:e.jsxRuntimeExports.jsx(c.default,{width:20,height:20,color:r.COLORS.content.secondary})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),footerContainerStyle:R.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:Y?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||e.disabled,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections)}}))(Y):{buttonText:De(),disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{R.onAdd(fe,xe),Pe()}},secondaryButton:J?(e=>Object.assign(Object.assign({},e),{disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{const e=y.updateAllVariantsForSelectedProducts(fe,Z,Re);R.onAdd(e,xe,!0)}}))(J):void 0,wrapperStyle:R.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):Te(),hideCrossButton:ve||G},{children:[qe,ve&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}))})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth"),o=require("../../assets/icons/search.svg.js"),s=require("react"),r=require("../../constants/Theme.js"),c=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),i=require("../input/Input.js"),l=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),p=require("./productInfoOverlay.js"),x=require("./productScreen.js"),h=require("./rearrangeScreen.js"),j=require("./reducers.js"),m=require("./searchScreen.js"),S=require("./selectedScreen.js"),C=require("./style.js"),g=require("./type.js"),y=require("./utility.js");exports.ProductPickerModal=R=>{const{storeId:b,selectedItems:f,onClose:E,visible:v,zIndex:k,exactLimit:I,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:P,outOfStockAction:T=g.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,hideSelectionCount:N,title:A,width:B,left:w,renderWithoutModal:L,onClickSave:M,pickerType:V,hideProductVariants:z=!1,startupScreen:$=g.ScreenName.Collections,rearrangeEnabled:_,selectSingleItem:H=!1,showProductDetails:K,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:U={},primaryButton:Y,secondaryButton:J,subtitle:Q}=R,X=R.appType||t.ApplicationType.BIK,[Z,ee]=s.useReducer(j.collectionsReducer,{}),[te,oe]=s.useState([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections),[se,re]=s.useState("grid"),[ce,ne]=s.useState(""),[ie,le]=s.useState(""),[ae,de]=s.useState(0),[ue,pe]=s.useState(!1),[xe,he]=s.useState(0),[je,me]=s.useState(""),[Se,Ce]=s.useState(!1),[ge,ye]=s.useState(!1),[Re,be]=s.useReducer(j.searchReducer,{collections:{},products:{}}),[fe,Ee]=s.useReducer(j.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ve=s.useRef(null),[ke,Ie]=s.useState(!1),[Oe,Fe]=s.useState();s.useEffect((()=>{pe(!0),ye(!0),R.collectionFetcher(ae,b,X).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),pe(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),s.useEffect((()=>{let e=0;z?Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s;"-1"!==t&&fe[-1]&&(null===(s=fe[-1].products)||void 0===s?void 0:s[o])||(e+=1)}))})):Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s,r;Object.keys((null===(r=null===(s=fe[t].products)||void 0===s?void 0:s[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Z,fe,z]),s.useEffect((()=>{ie&&(pe(!0),R.productFetcher(ie,b,X).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),pe(!1)})).catch())}),[ie]),s.useEffect((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(je.length||"collections"!==te)&&(je.length?(Ce(!0),R.searchFetcher(b,je,X).then((e=>{"collections"in e&&"products"in e?(be({type:"set",data:e}),ee({type:"searched",data:e.collections}),ee({type:"searched",data:e.products})):(be({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),pe(!1),Ce(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[je]),s.useEffect((()=>{M&&(R.onAdd(fe,xe),Pe())}),[M]),s.useEffect((()=>{H&&Object.keys(fe||{}).length&&xe&&(R.onAdd(fe,xe),Pe())}),[H,fe,xe]);const Pe=()=>{Ee({type:"reset",data:{}})},Te=()=>I&&xe>I?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${I} products`,type:"negative"}):O&&xe>O?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):xe>0?e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>{oe(_?g.ScreenName.RearrangeProducts:g.ScreenName.SelectedProducts)},buttonText:I?`${xe}/${I} products selected`:`${xe} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}):e.jsxRuntimeExports.jsx(n.Button,{disabled:!0,buttonText:I?`${xe}/${I} products selected`:`${xe} products selected`,buttonType:"tertiaryGray"}),De=e=>ue?"Loading...":te===g.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",qe=e.jsxRuntimeExports.jsxs(C.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[R.postHeader&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:R.postHeader})),!R.hideGlobalSearch&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:("collections"===te||"searchProducts"===te)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:L?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsxRuntimeExports.jsx(i.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Se?e.jsxRuntimeExports.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):e.jsxRuntimeExports.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:je,onChangeText:e=>{e.length&&e.trim().length?me(e):me("")}})}))}),e.jsxRuntimeExports.jsxs(C.ScrollContainerStyle,Object.assign({ref:ve,screenName:te},{children:["collections"===te&&e.jsxRuntimeExports.jsx(u.CollectionsScreen,{customCollectionRestriction:R.customCollectionRestriction,dataLoading:ge,collections:Z,selectedCollectionsDispatch:Ee,setCollectionId:ne,setSelectedCollectionId:le,setScreen:oe,selectedCollections:fe,collectionFetcher:R.collectionFetcher,storeId:b,appType:X,collectionsDispatch:ee,setSaveDisabled:pe,pagingControls:{curPage:ae,setCurPage:de},hideCollectionCheckbox:F,renderWithoutModal:L,pickerType:V,scrollContainerRef:ve}),"products"===te&&ce&&e.jsxRuntimeExports.jsx(j.CollectionIdContext.Provider,Object.assign({value:ce},{children:e.jsxRuntimeExports.jsx(x.ProductsScreen,{hideInCollectionSearch:R.hideInCollectionSearch,customCollectionRestriction:R.customCollectionRestriction,productFetcher:R.productFetcher,setScreen:oe,storeId:b,appType:X,data:Z[ce],collectionsDispatch:ee,selectedCollectionsDispatch:Ee,selectedData:fe,setSaveDisabled:pe,searchInCollectionFetcher:R.searchInCollectionFetcher,hideProductCheckbox:P,outOfStockAction:T,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,renderWithoutModal:L,pickerType:V,hideProductVariants:z,fbStatusFetcher:R.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Fe(e)},showProductDetailInfoIcon:K,scrollContainerRef:ve})})),"view"===te&&e.jsxRuntimeExports.jsx(S.SelectedScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,hideProductVariants:z,outOfStockAction:T,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"rearrange"===te&&e.jsxRuntimeExports.jsx(h.RearrangeScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,outOfStockAction:T,rearrangeViewType:"grid"===se?"list":"grid",scrollContainerRef:ve,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"searchProducts"===te&&e.jsxRuntimeExports.jsx(m.SearchScreen,{customCollectionRestriction:R.customCollectionRestriction,selectedCollections:fe||{},searchedCollections:Re||{},searchedCollectionsDispatch:be,selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,onBackPress:()=>{me(""),be({type:"set",data:{collections:{},products:{}}})},pickerType:V,hideProductCheckbox:P,hideProductVariants:z,hideVariantCheckbox:D,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:ne,setSelectedCollectionId:le,renderWithoutModal:L,hideCollectionCheckbox:F,outOfStockAction:T})]}))]}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:L?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[qe,U.renderFooter?e.jsxRuntimeExports.jsxs(C.StyledFooterForNonModal,{children:[Te(),e.jsxRuntimeExports.jsx(n.Button,{buttonText:De(U.primaryButtonText),disabled:!U.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||U.primaryButtonDisabled,isLoading:U.isLoading,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections)}})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),ke&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,outOfStockAction:T,useDynamicInfoImageSize:R.useDynamicInfoImageSize,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}):e.jsxRuntimeExports.jsxs(l.StyledModal,Object.assign({zIndex:k,open:v,onClose:()=>{null==E||E(),Pe()},headingTitle:A||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),headingSubtitle:Q,footerShadow:!0,centralContainerStyles:{width:B||"600px",left:w||"auto"},headerRightCustomElement:G?e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:E},{children:e.jsxRuntimeExports.jsx(c.default,{width:20,height:20,color:r.COLORS.content.secondary})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),footerContainerStyle:R.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:Y?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||e.disabled,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections)}}))(Y):{buttonText:De(),disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{R.onAdd(fe,xe),Pe()}},secondaryButton:J?(e=>Object.assign(Object.assign({},e),{disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{const e=y.updateAllVariantsForSelectedProducts(fe,Z,Re);R.onAdd(e,xe,!0)}}))(J):void 0,wrapperStyle:R.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):Te(),hideCrossButton:ke||G},{children:[qe,ke&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}))})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationType } from '@bikdotai/bik-models/growth
|
|
1
|
+
import { ApplicationType } from '@bikdotai/bik-models/growth';
|
|
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';
|
|
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';
|
|
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';
|
|
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';
|
|
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';
|
|
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';
|
|
2
2
|
import { VariableV3 } from "../../../helpers";
|
|
3
3
|
import React, { LegacyRef } from 'react';
|
|
4
4
|
import Slider from 'react-slick';
|
package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth/models/bik-store"),l=require("../../../assets/icons/arrow_back.svg.js"),n=require("../../../assets/icons/chevronLeft.svg.js"),i=require("../../../assets/icons/chevronRight.svg.js"),s=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),d=require("../../icon-button/IconButton.js"),u=require("../../product-picker-v2/modal.js"),c=require("../../product-picker-v2/type.js"),p=require("../Badge/index.js"),m=require("../context/templateModalContext.js"),x=require("./EditWhatsAppTemplateV2.js"),v=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var h=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var g=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var j=require("../../template-preview/helpers/templateMiscHelper.js"),y=require("../../TypographyStyle.js");exports.default=f=>{let{template:b,whatsappSpecificPickerMeta:C,showVariableModal:R,variableListForImage:E,discountCode:O,setDiscountCode:I}=f;var S,k,q,w,P,T,B,L;const{selectedCarouselIndex:M,setTemplate:A,pickerConf:D,isProductCarouselType:F,pod:V,cardCount:W,carouselProducts:N,setCarouselProducts:$,isError:_,cardImages:z,disableEditVariable:G,onDeleteSelectedProducts:H,setSelectedCarouselIndex:K,setVariableCallback:J,setShowVariablePicker:Q,sliderRef:U}=m.useTemplateModalContext(),[X,Y]=r.useState(j.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(k=null===(S=null==b?void 0:b.mapping)||void 0===S?void 0:S.body)||void 0===k?void 0:k.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(w=null===(q=null==b?void 0:b.mapping)||void 0===q?void 0:q.body)||void 0===w?void 0:w.length)?"(Step 2/2)":"")),[Z,ee]=r.useState(!1),[te,le]=r.useState(!1),ne=M===(null!=W?W:-1)-1,ie=(null!=M?M:-1)<1;r.useEffect((()=>{var e,t,l,n;Y(j.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(t=null===(e=null==b?void 0:b.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(l=null==b?void 0:b.mapping)||void 0===l?void 0:l.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[M]);const se=e=>{null==$||$([{name:"variable",productName:e.actualValue}])};return r.useEffect((()=>{-1===M&&j.isRCSChannel(null==b?void 0:b.channel)&&(null==K||K(0))}),[M,null==b?void 0:b.channel]),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!j.isRCSChannel(null==b?void 0:b.channel)&&null!=M&&M>=0&&!!(null===(T=null===(P=null==b?void 0:b.mapping)||void 0===P?void 0:P.body)||void 0===T?void 0:T.length)&&e.jsxRuntimeExports.jsx(d.IconButton,{Icon:l.default,onClick:()=>{null==K||K(-1)}}),e.jsxRuntimeExports.jsx(y.TitleMedium,Object.assign({style:{marginLeft:10}},{children:X}))]})),F&&(null!==(B=null==N?void 0:N.length)&&void 0!==B?B:0)>0&&null!=M&&M>=0&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsxRuntimeExports.jsx(v.ProductBox,{editItem:()=>{1===(null==N?void 0:N.length)&&"variable"===N[0].name?(J((()=>se)),Q(!0)):ee(!Z)},cardBody:1===(null==N?void 0:N.length)&&"variable"===N[0].name?`${N[0].productName}`:`${null==N?void 0:N.length} Products Selected`,hideIcon:1===(null==N?void 0:N.length)&&"variable"===N[0].name,deleteItem:()=>{var e;if(1===(null==N?void 0:N.length)&&"variable"===N[0].name)return void(null==$||$([]));const t=o.cloneDeep(Object.assign({},b));t&&(z&&z.length>0?null==z||z.forEach(((e,l)=>{var n;t.components[1].cards[l].components[0].example.header_handle=[null!==(n=z[l])&&void 0!==n?n:"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==A||A(t)),null==$||$([]),null==H||H()}}),N&&(null==N?void 0:N.length)>0&&"variable"!=N[0].name&&e.jsxRuntimeExports.jsx(a.Button,{disabled:(null!==(L=null==N?void 0:N.length)&&void 0!==L?L:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{le(!0),ee(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!G&&F&&0===(null==N?void 0:N.length)&&null!=M&&M>=0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsxRuntimeExports.jsx(y.TitleRegular,{children:"Product(s)"}),e.jsxRuntimeExports.jsx(y.BodySecondary,{children:`Select ${null!=W?W:1} products`})]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:_?16:12,marginRight:_?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:_?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsxRuntimeExports.jsx(s.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{ee(!0)}}),V===g.POD.CHATBOT&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsxRuntimeExports.jsx(y.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsxRuntimeExports.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:_?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsxRuntimeExports.jsx(s.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{J((()=>se)),Q(!0)}})]})]})),_&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsxRuntimeExports.jsx(p.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!F&&(null!=M?M:-1)>-1&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",background:h.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(d.IconButton,{Icon:n.default,disabled:ie,width:8,height:14,svgStyle:ie?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickPrev(),(null!=M?M:-1)<1||null==K||K((e=>e-1))}}),e.jsxRuntimeExports.jsx(y.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:h.COLORS.content.secondary},{children:`Card ${(null!=M?M:0)+1}/${W}`})),e.jsxRuntimeExports.jsx(d.IconButton,{Icon:i.default,width:8,height:14,disabled:ne,svgStyle:ne?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickNext(),(null!=M?M:-1)>=(null!=W?W:-1)-1||null==K||K((e=>e+1))}})]})),e.jsxRuntimeExports.jsx(x.default,{whatsappSpecificPickerMeta:C,template:b,onTemplateChange:e=>{null==A||A(e)},showVariableModal:R,variableListForImage:E,discountCode:O,setDiscountCode:I}),Z&&D&&e.jsxRuntimeExports.jsx(u.ProductPickerModal,{zIndex:200,startupScreen:te?c.ScreenName.RearrangeProducts:c.ScreenName.Collections,rearrangeEnabled:!0,storeId:D.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,n=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in t[e].products||(t[e].products[n]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[n].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!=N?N:[]),collectionFetcher:D.fetchCollections,productFetcher:D.fetchProducts,onAdd:(e,t)=>{var l,n,i,s,r,a;le(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const o=e[t].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const u=o[e].variants;if(void 0!==u&&Object.keys(u).length)for(const c of Object.keys(u)){const{name:p,image:m,quantity:x,displayOrder:v}=u[c],h={name:p,image:null!==(n=null!=m?m:null===(l=o[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:x,variantId:c,productId:e,displayOrder:v,collectionId:t,productName:null!==(s=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==s?s:"",productImage:null!==(a=null===(r=o[e])||void 0===r?void 0:r.image)&&void 0!==a?a:""};d.push(h)}}}const u=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),c=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},b));p&&(c.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==z?void 0:z[t])&&void 0!==l?l:""]})),null==A||A(p)),null==$||$(u),ee(!1)},searchInCollectionFetcher:D.searchInCollection,searchFetcher:D.searchProducts,visible:Z,onClose:()=>{ee(!1)},exactLimit:null!=W?W:1,appType:D.appType||t.ApplicationType.BIK})]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth"),l=require("../../../assets/icons/arrow_back.svg.js"),n=require("../../../assets/icons/chevronLeft.svg.js"),i=require("../../../assets/icons/chevronRight.svg.js"),s=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),d=require("../../icon-button/IconButton.js"),u=require("../../product-picker-v2/modal.js"),c=require("../../product-picker-v2/type.js"),p=require("../Badge/index.js"),m=require("../context/templateModalContext.js"),x=require("./EditWhatsAppTemplateV2.js"),v=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var h=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var g=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var j=require("../../template-preview/helpers/templateMiscHelper.js"),y=require("../../TypographyStyle.js");exports.default=f=>{let{template:b,whatsappSpecificPickerMeta:C,showVariableModal:R,variableListForImage:E,discountCode:O,setDiscountCode:I}=f;var S,q,k,w,P,T,B,L;const{selectedCarouselIndex:M,setTemplate:A,pickerConf:D,isProductCarouselType:F,pod:V,cardCount:W,carouselProducts:N,setCarouselProducts:$,isError:_,cardImages:z,disableEditVariable:G,onDeleteSelectedProducts:H,setSelectedCarouselIndex:K,setVariableCallback:J,setShowVariablePicker:Q,sliderRef:U}=m.useTemplateModalContext(),[X,Y]=r.useState(j.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(q=null===(S=null==b?void 0:b.mapping)||void 0===S?void 0:S.body)||void 0===q?void 0:q.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(w=null===(k=null==b?void 0:b.mapping)||void 0===k?void 0:k.body)||void 0===w?void 0:w.length)?"(Step 2/2)":"")),[Z,ee]=r.useState(!1),[te,le]=r.useState(!1),ne=M===(null!=W?W:-1)-1,ie=(null!=M?M:-1)<1;r.useEffect((()=>{var e,t,l,n;Y(j.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(t=null===(e=null==b?void 0:b.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(l=null==b?void 0:b.mapping)||void 0===l?void 0:l.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[M]);const se=e=>{null==$||$([{name:"variable",productName:e.actualValue}])};return r.useEffect((()=>{-1===M&&j.isRCSChannel(null==b?void 0:b.channel)&&(null==K||K(0))}),[M,null==b?void 0:b.channel]),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!j.isRCSChannel(null==b?void 0:b.channel)&&null!=M&&M>=0&&!!(null===(T=null===(P=null==b?void 0:b.mapping)||void 0===P?void 0:P.body)||void 0===T?void 0:T.length)&&e.jsxRuntimeExports.jsx(d.IconButton,{Icon:l.default,onClick:()=>{null==K||K(-1)}}),e.jsxRuntimeExports.jsx(y.TitleMedium,Object.assign({style:{marginLeft:10}},{children:X}))]})),F&&(null!==(B=null==N?void 0:N.length)&&void 0!==B?B:0)>0&&null!=M&&M>=0&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsxRuntimeExports.jsx(v.ProductBox,{editItem:()=>{1===(null==N?void 0:N.length)&&"variable"===N[0].name?(J((()=>se)),Q(!0)):ee(!Z)},cardBody:1===(null==N?void 0:N.length)&&"variable"===N[0].name?`${N[0].productName}`:`${null==N?void 0:N.length} Products Selected`,hideIcon:1===(null==N?void 0:N.length)&&"variable"===N[0].name,deleteItem:()=>{var e;if(1===(null==N?void 0:N.length)&&"variable"===N[0].name)return void(null==$||$([]));const t=o.cloneDeep(Object.assign({},b));t&&(z&&z.length>0?null==z||z.forEach(((e,l)=>{var n;t.components[1].cards[l].components[0].example.header_handle=[null!==(n=z[l])&&void 0!==n?n:"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==A||A(t)),null==$||$([]),null==H||H()}}),N&&(null==N?void 0:N.length)>0&&"variable"!=N[0].name&&e.jsxRuntimeExports.jsx(a.Button,{disabled:(null!==(L=null==N?void 0:N.length)&&void 0!==L?L:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{le(!0),ee(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!G&&F&&0===(null==N?void 0:N.length)&&null!=M&&M>=0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsxRuntimeExports.jsx(y.TitleRegular,{children:"Product(s)"}),e.jsxRuntimeExports.jsx(y.BodySecondary,{children:`Select ${null!=W?W:1} products`})]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:_?16:12,marginRight:_?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:_?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsxRuntimeExports.jsx(s.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{ee(!0)}}),V===g.POD.CHATBOT&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsxRuntimeExports.jsx(y.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsxRuntimeExports.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:_?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsxRuntimeExports.jsx(s.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{J((()=>se)),Q(!0)}})]})]})),_&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsxRuntimeExports.jsx(p.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!F&&(null!=M?M:-1)>-1&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",background:h.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(d.IconButton,{Icon:n.default,disabled:ie,width:8,height:14,svgStyle:ie?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickPrev(),(null!=M?M:-1)<1||null==K||K((e=>e-1))}}),e.jsxRuntimeExports.jsx(y.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:h.COLORS.content.secondary},{children:`Card ${(null!=M?M:0)+1}/${W}`})),e.jsxRuntimeExports.jsx(d.IconButton,{Icon:i.default,width:8,height:14,disabled:ne,svgStyle:ne?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickNext(),(null!=M?M:-1)>=(null!=W?W:-1)-1||null==K||K((e=>e+1))}})]})),e.jsxRuntimeExports.jsx(x.default,{whatsappSpecificPickerMeta:C,template:b,onTemplateChange:e=>{null==A||A(e)},showVariableModal:R,variableListForImage:E,discountCode:O,setDiscountCode:I}),Z&&D&&e.jsxRuntimeExports.jsx(u.ProductPickerModal,{zIndex:200,startupScreen:te?c.ScreenName.RearrangeProducts:c.ScreenName.Collections,rearrangeEnabled:!0,storeId:D.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,n=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in t[e].products||(t[e].products[n]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[n].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!=N?N:[]),collectionFetcher:D.fetchCollections,productFetcher:D.fetchProducts,onAdd:(e,t)=>{var l,n,i,s,r,a;le(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const o=e[t].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const u=o[e].variants;if(void 0!==u&&Object.keys(u).length)for(const c of Object.keys(u)){const{name:p,image:m,quantity:x,displayOrder:v}=u[c],h={name:p,image:null!==(n=null!=m?m:null===(l=o[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:x,variantId:c,productId:e,displayOrder:v,collectionId:t,productName:null!==(s=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==s?s:"",productImage:null!==(a=null===(r=o[e])||void 0===r?void 0:r.image)&&void 0!==a?a:""};d.push(h)}}}const u=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),c=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},b));p&&(c.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==z?void 0:z[t])&&void 0!==l?l:""]})),null==A||A(p)),null==$||$(u),ee(!1)},searchInCollectionFetcher:D.searchInCollection,searchFetcher:D.searchProducts,visible:Z,onClose:()=>{ee(!1)},exactLimit:null!=W?W:1,appType:D.appType||t.ApplicationType.BIK})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),s=require("@bikdotai/bik-models/growth
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),s=require("@bikdotai/bik-models/growth"),t=require("../../assets/icons/cross.svg.js"),n=require("../../assets/icons/info.svg.js"),i=require("date-fns"),r=require("react"),o=require("../../constants/Theme.js"),a=require("../avatar/Avatar.js"),l=require("../avatar/AvatarHelper.js"),c=require("../button/Button.js"),d=require("../states/StateComponent.js");require("../../_virtual/_tslib.js");var u=require("../TypographyStyle.js"),p=require("./UnsatisfactoryCountIntentWiseModal.js"),x=require("./UnsatisfactoryResponseList.style.js");exports.UnsatisfactoryResponseList=j=>{const{storeId:y,appType:h,incorrectMessages:m,onIncorrectMessageBubbleClick:R,setShowIncorrectReplies:f,ChecklistType:g,IntentWiseUnsatisfactoryResponse:v,IntentHeaderTitle:E,redirectToUnsatisfactoryResponse:b,fetchUnsatisfactoryResponseCountIntentWise:I,fetchUnsatisfactoryResponseCount:C}=j,[O,S]=r.useState(""),[T,w]=r.useState((null==m?void 0:m.length)>0),[A,U]=r.useState(!1);return r.useEffect((()=>{!T&&C&&C().then((e=>{e>0&&w(!0),0===e&&f(!1)}))}),[]),e.jsxRuntimeExports.jsx("div",Object.assign({style:{overflow:"scroll",height:"100%"}},{children:e.jsxRuntimeExports.jsxs(x.IncorrectRepliesStyle,{children:[h==s.ApplicationType.MANIFEST&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(u.TitleRegular,{children:"Unsatisfactory responses"}),e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>f(!1)},{children:e.jsxRuntimeExports.jsx(t.default,{height:16,width:16,color:o.COLORS.content.primary})}))]})),e.jsxRuntimeExports.jsx(u.BodySecondary,Object.assign({style:{color:o.COLORS.content.secondary}},{children:"Spot unsatisfactory replies, dive deeper, and enhance with relevant data for improved responses."}))]})),!(null==m?void 0:m.length)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:e.jsxRuntimeExports.jsx(d.StateComponent,{states:d.StateInterface.WARNING,heading:"No unsatisfactory responses",subline:"As of now, all responses are correct",isButtonEnabled:!1,width:0,size:l.SIZE.SMALL,icon:e.jsxRuntimeExports.jsx(a.Avatar,{type:l.AVATAR_TYPES.ICON,size:l.SIZE.MEDIUM,background:l.AVATAR_BACKGROUND.LIGHT,icon:()=>e.jsxRuntimeExports.jsx(n.default,{width:16,height:16,color:o.COLORS.content.warning})})})})),!!(null==m?void 0:m.length)&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[h==s.ApplicationType.MANIFEST&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",width:"100%",justifyContent:(null==m?void 0:m.length)?"flex-start":"center"}},{children:e.jsxRuntimeExports.jsx(c.Button,{buttonText:"Fix all unsatisfactory responses",buttonType:"tertiary",size:"small",onClick:()=>{U(!0)},disabled:!T})})),e.jsxRuntimeExports.jsx(p.UnsatisfactoryCountIntentWiseModal,{storeId:y,setShowUnsatisfactoryResponseModal:U,showUnsatisfactoryResponseModal:A,ChecklistType:g,UnsatisfactoryResponseIntentList:v,IntentHeaderTitle:E,fetchUnsatisfactoryResponseCountIntentWise:I,viewIntentWiseUnsatisfactoryResponse:b}),m&&(null==m?void 0:m.length)>0&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"wrapper"},{children:m.map(((s,t)=>e.jsxRuntimeExports.jsxs("div",Object.assign({className:"bubble",onClick:()=>{R(s.messageId),S(s.messageId)},style:O===s.messageId?{backgroundColor:o.COLORS.surface.hovered}:{}},{children:[e.jsxRuntimeExports.jsx(u.BodySecondary,Object.assign({style:{color:o.COLORS.content.primary}},{children:s.message})),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs(u.Caption,Object.assign({style:{color:o.COLORS.content.secondary}},{children:[i.format(new Date(null==s?void 0:s.date),"hh:mm a")," |"," ",i.format(new Date(null==s?void 0:s.date),"dd/MM/yyyy")]}))})]}),s.messageId)))}))]})]})}))};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default EventsTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
3
|
+
import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
|
|
4
|
+
import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
|
|
5
5
|
declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
|
|
6
6
|
cacheKey: string;
|
|
7
7
|
propertyAddBtnText: string;
|
|
@@ -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';
|
|
3
3
|
import { footerButtonOptionModel, MessageSource } from './model';
|
|
4
4
|
interface SourceInfoFooterProps {
|
|
5
5
|
appType: ApplicationType;
|
|
@@ -19,6 +19,7 @@ interface SourceInfoFooterProps {
|
|
|
19
19
|
isFooterLoading?: boolean;
|
|
20
20
|
reasonForAiGeneratedResponse?: string;
|
|
21
21
|
showAiResponseReason?: boolean;
|
|
22
|
+
aiResponseLoading?: boolean;
|
|
22
23
|
}
|
|
23
24
|
declare const SourceInfoFooter: import("react").MemoExoticComponent<(props: SourceInfoFooterProps) => import("react/jsx-runtime").JSX.Element>;
|
|
24
25
|
export default SourceInfoFooter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth
|
|
1
|
+
import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth";import n from"../../assets/icons/alert_triangle.svg.js";import o from"../../assets/icons/plus.svg.js";import{memo as i,useState as s,useMemo as r,useEffect as a}from"react";import{COLORS as d}from"../../constants/Theme.js";import{Button as l}from"../button/Button.js";import{BikShimmer as c}from"../shimmer/ShimmerComponent/BikShimmer.js";import{BodyCaption as u}from"../TypographyStyle.js";import{SourceInfoFooterStyle as h}from"./DataSourcePanel.style.js";const g=i((i=>{const{appType:g,sourceIntent:v,hideHeading:j,messageSource:b,trainingSourceCount:x={},ShowTrainingDataSource:T={},faqCount:y,ChecklistType:A,footerButtonOption:f,isFooterLoading:I,reasonForAiGeneratedResponse:F,showAiResponseReason:O,aiResponseLoading:w}=i,R=T,[N,_]=s(!0),[k,C]=s(!0),E="/bik-ai/training",[S,D]=s({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[P,U]=s({title:"",subTitle:""}),L=r((()=>{const e=(null==x?void 0:x[v])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[x,v]),M=()=>{var e;(null==S?void 0:S.redirectUrl)?window.open(`${window.location.origin}${null==S?void 0:S.redirectUrl}`,"_self"):Object.keys(null!==(e=null==S?void 0:S.addFaqProps)&&void 0!==e?e:{}).length>0?null==f||f.onClick(S):(null==f?void 0:f.navigate)&&(null==f||f.navigate("Training",g==t.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return a((()=>{var e,n,o,i;if(v){if(null===(e=null==b?void 0:b.sources)||void 0===e?void 0:e.length){const e=b.sources[0];if(R[v])v===A.ORDER_ENQUIRY&&C(!1);else{let s=null==e?void 0:e.insights,r="";switch(v){case A.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(s=`${y||"No"} FAQs added for this product`,r="Add product-specific information via FAQs to improve responses",D({buttonTitle:"Add FAQ",addFaqProps:{faqProducts:[{id:null==e?void 0:e.productId,variantId:null==e?void 0:e.variantId,name:null==e?void 0:e.title,imageUrl:null==e?void 0:e.imageUrl}]},redirectUrl:""}));break;case A.ORDER_MODIFICATION:s=(null==x?void 0:x[v])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",s&&D({buttonTitle:g==t.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:g==t.MANIFEST?"/customise?tab=AgentHandover":E,addFaqProps:{}});break;case A.ORDER_CANCELLATION:s=(null==x?void 0:x[v])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",D({buttonTitle:g==t.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:g==t.MANIFEST?"/customise?tab=AgentHandover":E,addFaqProps:{}});break;case A.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;D({buttonTitle:g==t.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:g==t.MANIFEST?"/training/order-management":E,addFaqProps:{}});break;case A.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(i=null===(o=null===(n=null==b?void 0:b.sources)||void 0===n?void 0:n[0])||void 0===o?void 0:o.title)||void 0===i?void 0:i.toLowerCase().indexOf("collection"))){s="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}s="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}U({title:null!=s?s:"",subTitle:r})}}(R[v]||[A.PRODUCT_DETAILS,A.ORDER_MODIFICATION,A.ORDER_CANCELLATION,A.ORDER_TRACKING].includes(v))&&_(!1)}}),[null==b?void 0:b.messageId,x,v,null==b?void 0:b.sources,R,A,y,g,b]),e.jsx(h,{children:I?e.jsx(e.Fragment,{children:e.jsx(c,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}):e.jsx(e.Fragment,{children:!(null==P?void 0:P.title)&&x&&v in x?e.jsxs(e.Fragment,{children:[e.jsx(m,{hideHeading:null!=j&&j}),e.jsx(p,{reason:F||"",showAiResponseReason:null!=O&&O,isLoading:null!=w&&w,appType:g}),e.jsxs("div",Object.assign({className:"source_info_details "+(x[v]>0?"":"no_data_source")},{children:[x[v]>0&&k?e.jsxs(e.Fragment,{children:[e.jsx(u,{children:L}),e.jsx(u,Object.assign({color:d.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):k&&e.jsxs("div",Object.assign({className:"no_data_source_title"},{children:[e.jsx(n,{width:15,height:15,color:d.content.negative,style:{marginTop:2}}),e.jsx(u,{children:"No data sources added to the identified link"})]})),!f||f.hideAddDataButton||N?e.jsx(e.Fragment,{}):e.jsx(l,{size:"small",buttonType:"tertiary",LeadingIcon:o,buttonText:(null==S?void 0:S.buttonTitle.length)>0?null==S?void 0:S.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>M(),style:{backgroundColor:"unset"}})]}))]}):e.jsxs(e.Fragment,{children:[e.jsx(m,{hideHeading:null!=j&&j}),e.jsx(p,{reason:F||"",showAiResponseReason:null!=O&&O,isLoading:null!=w&&w,appType:g}),e.jsxs("div",Object.assign({className:"source_info_details"},{children:[k&&e.jsxs(e.Fragment,{children:[e.jsx(u,{children:null==P?void 0:P.title}),e.jsx(u,Object.assign({color:d.content.secondary},{children:null==P?void 0:P.subTitle}))]}),!f||f.hideAddDataButton||N?e.jsx(e.Fragment,{}):e.jsx(l,{size:"small",buttonType:"tertiary",LeadingIcon:o,buttonText:(null==S?void 0:S.buttonTitle.length)>0?null==S?void 0:S.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>M(),style:{backgroundColor:"unset"}})]}))]})})})})),m=i((t=>t.hideHeading?null:e.jsx(u,Object.assign({color:d.content.secondary},{children:"Training insights"})))),p=i((n=>{const[o,i]=s(!1),r=n.reason&&n.reason.length>150,a=r&&!o?n.reason.substring(0,150)+"...":n.reason;return n.appType!==t.MANIFEST?e.jsx(e.Fragment,{}):e.jsx(e.Fragment,{children:n.isLoading?e.jsx("div",Object.assign({style:{height:70,width:"100%",marginBottom:8}},{children:e.jsx(c,{boxes:[{height:"20px",width:"30%"},{height:"20px",width:"100%"}],direction:"column",gap:"2px",isBrand:!1})})):e.jsxs("div",Object.assign({className:"source_info_details"},{children:[e.jsx(u,Object.assign({color:d.content.primary,className:"why_ai_gave_this_response"},{children:"Here’s why your AI gave this response"})),e.jsxs(u,Object.assign({color:d.content.secondary,className:"clamp-text"},{children:[a||"No reason provided for this response.",r&&e.jsx(u,Object.assign({color:d.content.brand,style:{cursor:"pointer",textDecoration:"underline",marginTop:"4px"},onClick:()=>i(!o)},{children:o?"Show less":"Show more"}))]}))]}))})}));p.displayName="WhyAiGaveThisResponse",m.displayName="TrainingInsightsHeading",g.displayName="SourceInfoFooter";export{g as default};
|
|
@@ -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';
|
|
3
3
|
import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource, ProductSourceData } from './model';
|
|
4
4
|
export interface ProductSearchRuleDB {
|
|
5
5
|
rule_id?: string;
|
|
@@ -37,6 +37,7 @@ export interface DataSourcePanelProps {
|
|
|
37
37
|
productSourceData?: ProductSourceData;
|
|
38
38
|
reasonForAiGeneratedResponse?: string;
|
|
39
39
|
showAiResponseReason?: boolean;
|
|
40
|
+
aiResponseLoading?: boolean;
|
|
40
41
|
productSearchRule?: ProductSearchRuleDB;
|
|
41
42
|
onEditProductSearchRule?: (ruleId: string) => void;
|
|
42
43
|
}
|
|
@@ -1 +1 @@
|
|
|
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 s from"../../assets/icons/box_search.svg.js";import i from"../../assets/icons/boxV2.svg.js";import o from"../../assets/icons/chevronDownOutline.svg.js";import n from"../../assets/icons/chevronUpOutline.svg.js";import r from"../../assets/icons/cross.svg.js";import l from"../../assets/icons/edit.svg.js";import c from"../../assets/icons/filePdf.svg.js";import d from"../../assets/icons/help.svg.js";import a from"../../assets/icons/info.svg.js";import p from"../../assets/icons/openai.svg.js";import u from"../../assets/icons/plus.svg.js";import g from"../../assets/icons/redirect.svg.js";import x from"../../assets/icons/text_t9.svg.js";import h from"../../assets/icons/website.svg.js";import{useState as j,useMemo as m,useEffect as f}from"react";import{COLORS as y}from"../../constants/Theme.js";import{Button as v}from"../button/Button.js";import{IconButton as b}from"../icon-button/IconButton.js";import{BikShimmer as C}from"../shimmer/ShimmerComponent/BikShimmer.js";import{SideModal as I}from"../side-modal/SideModal.js";import{Tag as O}from"../tag/Tag.js";import{Tooltip as T}from"../tooltips/Tooltip.js";import{TitleSmall as E,BodyCaption as w,BodySecondary as S}from"../TypographyStyle.js";import L from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as N}from"./DataSourcePanel.style.js";import{intentConfig as F}from"./IntentConfig.js";import{DescriptionModal as k}from"./Modals/DescriptionModal.js";import{CustomDataType as A}from"./model.js";const _=_=>{var D,R;const{appType:P,storeId:B,messageSource:U,setMessageSourcePanel:K,hideCloseButton:M,isSourceInfoFetched:W,allSourceInfoDetail:$,ChecklistType:H,title:q,zeroStateButton:Q,editableSources:G,preFillTrainingSourceCount:Y,redirect:z,footerButtonOption:X,fetchTrainingSourceCount:V,fetchProductFAQCount:J,productSourceData:Z,reasonForAiGeneratedResponse:ee,showAiResponseReason:te,productSearchRule:se,onEditProductSearchRule:ie}=_,{sources:oe}=U,ne=["blog","article","page","policy"],[re,le]=j(!1),[ce,de]=j(!1),[ae,pe]=j(!1),[ue,ge]=j(0),[xe,he]=j(),[je,me]=j(null!=Y?Y:{}),[fe,ye]=j(!1),[ve,be]=j(!1),Ce={};F.forEach((t=>{let{key:s,type:i,tagText:o}=t;H[s]&&(Ce[H[s]]=e.jsx(O,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const Ie=oe.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Oe=oe.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),Te=m((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{H[t]&&(e[H[t]]=H[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[H]);f((()=>{var e,t,s,i;if(!(null==U?void 0:U.messageId))return;le(!0),de(!0),pe(!1!==(null===(t=null===(e=U.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=U.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=U.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));J(B,n).then((e=>ge(e))).then((()=>{Y?(me(Y),setTimeout((()=>{le(!1),de(!1)}),100)):(setTimeout((()=>le(!1)),100),V(B).then((e=>me(e))).then((()=>setTimeout((()=>{de(!1)}),100))))}))}),[J,V,null==U?void 0:U.messageId,U.sources,Y,B]);const Ee=e=>!!(e&&0===e.length||(null==U?void 0:U.isUnsatisfactoryAnswer)),we=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=A.FILES:ne.includes(e)?e=A.FETCHED_LINKS:"url"==e?e=A.WEBSITE_LINKS:"text"===e?e=A.TEXTS:"faq"===e&&(e=A.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.replace(/_/g," ")},Se=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",Le=t=>"products"==t||"product"==t?e.jsx(i,{height:16,width:16,color:y.content.secondary}):"files"==t?e.jsx(c,{height:16,width:16,color:y.content.secondary}):"website links"==t||"fetched links"==t?e.jsx(h,{height:16,width:16,color:y.content.secondary}):"faq"==t?e.jsx(d,{height:16,width:16,color:y.content.secondary}):"texts"==t?e.jsx(x,{height:16,width:16,color:y.content.secondary}):e.jsx(p,{height:16,width:16,color:y.content.secondary}),Ne=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(re||!W)return e.jsx(N,{children:e.jsx(C,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})});const Fe=s=>{const{title:i,count:r,isExpanded:l,onToggle:c,children:d}=s;return e.jsxs("div",{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:c},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsx(w,Object.assign({style:{fontWeight:"600"}},{children:i})),P===t.MANIFEST?e.jsx("div",Object.assign({style:{backgroundColor:y.surface.subdued,color:y.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:r})):e.jsx(e.Fragment,{})]})),e.jsx(e.Fragment,{children:P===t.BIK?e.jsx(e.Fragment,{}):l?e.jsx(o,{width:20,height:20,color:y.content.primary}):e.jsx(n,{width:20,height:20,color:y.content.primary})})]})),l&&d]})};return e.jsxs(e.Fragment,{children:[e.jsx(N,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",padding:0,paddingBottom:"12px"}},{children:[!!q&&e.jsx(E,{children:q}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(w,Object.assign({color:y.content.secondary},{children:"Intent"})),null!==(D=Ce[U.intent])&&void 0!==D?D:Ce.GENERIC,!M&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>K(void 0)},{children:e.jsx(r,{height:20,width:20,color:y.content.secondary})}))]})),se&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"12px",marginTop:"6px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsx(S,Object.assign({color:y.content.primary},{children:se.rule_name})),ie&&se.rule_id&&e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[e.jsx(s,{width:14,color:y.content.secondary}),e.jsx(w,Object.assign({color:y.content.secondary},{children:"Edit search rule"})),e.jsx(b,{Icon:l,height:16,width:16,bordered:!0,iconColor:y.content.primary,onClick:()=>ie(null==se?void 0:se.rule_id)})]}))]})),se.keywords&&se.keywords.length>0&&e.jsx("div",Object.assign({style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px",backgroundColor:y.surface.subdued,borderRadius:"8px",border:`1px dashed ${y.stroke.primary}`}},{children:se.keywords.map(((t,s)=>e.jsx(O,{tagText:t,theme:"light"},`keyword-${s}`)))}))]})),Ee(oe)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${y.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(a,{width:24,height:24,color:y.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(E,{children:"Insufficient data"})})),e.jsx(S,Object.assign({color:y.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),Q&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(v,{LeadingIcon:null!==(t=Q.leadingIcon)&&void 0!==t?t:u,buttonText:null!==(s=Q.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{Q.onClick()}})}))]}))})()})):!se&&e.jsx(O,{LeadingIcon:a,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:U.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${P===t.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Ee(oe)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsx(e.Fragment,{children:Ie.length>0&&e.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsx(Fe,Object.assign({title:"Product Sources",count:Ie.length,isExpanded:P!==t.MANIFEST||fe,onToggle:()=>ye(!fe)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ie.map(((t,s)=>{var i,o,n,r;const c=we(t.type||t.subTitle||"OpenAI"),d=we(t.type||t.subTitle||"OpenAI",!0),a=Se(c),p=null==G?void 0:G.includes(d),u=$[null!==(i=t.productId)&&void 0!==i?i:"Products"],x=t.title,h=t.productId&&(null==Z?void 0:Z[t.productId]),j=h&&h.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Ie?void 0:Ie.length)?`1px solid ${y.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Le(c),e.jsx(T,Object.assign({body:x,placement:"top"},{children:e.jsx(S,Object.assign({style:d==A.FETCHED_LINKS||d==A.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:y.content.primary,className:"clamp-title",onClick:()=>d==A.FETCHED_LINKS||d==A.WEBSITE_LINKS?z(t):{}},{children:x}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==H.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(w,Object.assign({color:y.content.secondary},{children:a}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(b,{Icon:l,height:16,width:16,iconColor:y.content.secondary,onClick:()=>null==u?void 0:u.onEditClick(u.data,u.type),disabled:!u,disabledTooltip:"This source is deleted"}):e.jsx(b,{Icon:g,height:16,width:16,iconColor:y.content.secondary,disabled:"custom"===t.type&&!u,disabledTooltip:"This source is deleted",onClick:()=>z(t)})}))]}))]})),h&&e.jsxs(w,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;he({title:x,description:Ne(h.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>he(void 0)})}},{children:`${null===(o=h.description)||void 0===o?void 0:o.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>h.onEditFaqClick(h.faqs)},{children:`${null===(n=h.faqs)||void 0===n?void 0:n.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(T,Object.assign({body:j,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(r=h.metafield)||void 0===r?void 0:r.length} metafields`}))}))]})]}),`info-${s}`)}))}))}))}))}),e.jsx(e.Fragment,{children:Oe.length>0&&e.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsx(Fe,Object.assign({title:"Content Sources",count:Oe.length,isExpanded:P!==t.MANIFEST||ve,onToggle:()=>be(!ve)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Oe.map(((t,s)=>{var i,o,n,r,c,d,a,p,u,x,h,j,m,f,v,C,I;const O=we(t.type||t.subTitle||"OpenAI"),E=we(t.type||t.subTitle||"OpenAI",!0),L=Se(O),N=null==G?void 0:G.includes(E),F="Products"===t.subTitle?$[null!==(i=t.productId)&&void 0!==i?i:"Products"]:$[null!==(o=t.docId)&&void 0!==o?o:""],k=E.toLowerCase()===(null===(n=A.FAQ)||void 0===n?void 0:n.toLowerCase())?"faq"===(null===(r=t.title)||void 0===r?void 0:r.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(c=A.FILES)||void 0===c?void 0:c.toLowerCase())||E.toLowerCase()===(null===(d=A.FETCHED_LINKS)||void 0===d?void 0:d.toLowerCase())||E.toLowerCase()===(null===(a=A.TEXTS)||void 0===a?void 0:a.toLowerCase())?t.title:E.toLowerCase()===(null===(p=A.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):t.intent===H.EMAIL_COLLECTION?L:t.title,_="faq"===E.toLowerCase()?null!==(h=null!==(u=null==F?void 0:F.content)&&void 0!==u?u:null===(x=null==F?void 0:F.data)||void 0===x?void 0:x.answer)&&void 0!==h?h:"":E.toLowerCase()===(null===(j=A.FETCHED_LINKS)||void 0===j?void 0:j.toLowerCase())||E.toLowerCase()===(null===(m=A.WEBSITE_LINKS)||void 0===m?void 0:m.toLowerCase())||E.toLowerCase()===(null===(f=A.TEXTS)||void 0===f?void 0:f.toLowerCase())?null!==(I=null!==(v=null==F?void 0:F.content)&&void 0!==v?v:null===(C=null==F?void 0:F.data)||void 0===C?void 0:C.fileContentText)&&void 0!==I?I:"":t.intent===H.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Oe?void 0:Oe.length)?`1px solid ${y.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Le(O),e.jsx(T,Object.assign({body:k,placement:"top"},{children:e.jsx(S,Object.assign({style:E==A.FETCHED_LINKS||E==A.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:y.content.primary,className:"clamp-title",onClick:()=>E==A.FETCHED_LINKS||E==A.WEBSITE_LINKS?z(t):{}},{children:k}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==H.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(w,Object.assign({color:y.content.secondary},{children:L}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:N?e.jsx(b,{Icon:l,height:16,width:16,iconColor:y.content.secondary,onClick:()=>null==F?void 0:F.onEditClick(F.data,F.type),disabled:!F,disabledTooltip:"This source is deleted"}):e.jsx(b,{Icon:g,height:16,width:16,iconColor:y.content.secondary,disabled:"custom"===t.type&&!F,disabledTooltip:"This source is deleted",onClick:()=>z(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${y.stroke.primary}`,borderRadius:"4px",backgroundColor:y.surface.subdued}},{children:e.jsx(w,Object.assign({color:y.content.primary,className:"clamp-description"},{children:Ne(null!=_?_:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]})),ae&&!Ee(oe)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(L,{appType:P,storeId:B,messageSource:U,sourceIntent:null!==(R=U.intent)&&void 0!==R?R:H.GENERIC,faqCount:ue,trainingSourceCount:je,ShowTrainingDataSource:Te,ChecklistType:H,footerButtonOption:X,isFooterLoading:ce,reasonForAiGeneratedResponse:ee,showAiResponseReason:te})}))]})}),xe&&e.jsx(I,Object.assign({header:"Product description",onClose:()=>he(void 0),width:"30%"},{children:e.jsx(k,{title:xe.title,description:xe.description,imageUrl:xe.imageUrl,onClose:xe.onClose})}))]})};export{_ as DataSourcePanel};
|
|
1
|
+
import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth";import s from"../../assets/icons/box_search.svg.js";import i from"../../assets/icons/boxV2.svg.js";import o from"../../assets/icons/chevronDownOutline.svg.js";import n from"../../assets/icons/chevronUpOutline.svg.js";import r from"../../assets/icons/cross.svg.js";import l from"../../assets/icons/edit.svg.js";import a from"../../assets/icons/filePdf.svg.js";import d from"../../assets/icons/help.svg.js";import c from"../../assets/icons/info.svg.js";import p from"../../assets/icons/openai.svg.js";import u from"../../assets/icons/plus.svg.js";import g from"../../assets/icons/redirect.svg.js";import x from"../../assets/icons/text_t9.svg.js";import h from"../../assets/icons/website.svg.js";import{useState as j,useMemo as m,useEffect as f}from"react";import{COLORS as y}from"../../constants/Theme.js";import{Button as v}from"../button/Button.js";import{IconButton as b}from"../icon-button/IconButton.js";import{BikShimmer as C}from"../shimmer/ShimmerComponent/BikShimmer.js";import{SideModal as I}from"../side-modal/SideModal.js";import{Tag as O}from"../tag/Tag.js";import{Tooltip as T}from"../tooltips/Tooltip.js";import{TitleSmall as E,BodyCaption as w,BodySecondary as S}from"../TypographyStyle.js";import L from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as N}from"./DataSourcePanel.style.js";import{intentConfig as F}from"./IntentConfig.js";import{DescriptionModal as k}from"./Modals/DescriptionModal.js";import{CustomDataType as A}from"./model.js";const _=_=>{var D,R;const{appType:P,storeId:B,messageSource:U,setMessageSourcePanel:K,hideCloseButton:M,isSourceInfoFetched:W,allSourceInfoDetail:$,ChecklistType:H,title:q,zeroStateButton:Q,editableSources:G,preFillTrainingSourceCount:Y,redirect:z,footerButtonOption:X,fetchTrainingSourceCount:V,fetchProductFAQCount:J,productSourceData:Z,reasonForAiGeneratedResponse:ee,showAiResponseReason:te,aiResponseLoading:se,productSearchRule:ie,onEditProductSearchRule:oe}=_,{sources:ne}=U,re=["blog","article","page","policy"],[le,ae]=j(!1),[de,ce]=j(!1),[pe,ue]=j(!1),[ge,xe]=j(0),[he,je]=j(),[me,fe]=j(null!=Y?Y:{}),[ye,ve]=j(!1),[be,Ce]=j(!1),Ie={};F.forEach((t=>{let{key:s,type:i,tagText:o}=t;H[s]&&(Ie[H[s]]=e.jsx(O,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const Oe=ne.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Te=ne.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),Ee=m((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{H[t]&&(e[H[t]]=H[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[H]);f((()=>{var e,t,s,i;if(!(null==U?void 0:U.messageId))return;ae(!0),ce(!0),ue(!1!==(null===(t=null===(e=U.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=U.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=U.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));J(B,n).then((e=>xe(e))).then((()=>{Y?(fe(Y),setTimeout((()=>{ae(!1),ce(!1)}),100)):(setTimeout((()=>ae(!1)),100),V(B).then((e=>fe(e))).then((()=>setTimeout((()=>{ce(!1)}),100))))}))}),[J,V,null==U?void 0:U.messageId,U.sources,Y,B]);const we=e=>!!(e&&0===e.length||(null==U?void 0:U.isUnsatisfactoryAnswer)),Se=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=A.FILES:re.includes(e)?e=A.FETCHED_LINKS:"url"==e?e=A.WEBSITE_LINKS:"text"===e?e=A.TEXTS:"faq"===e&&(e=A.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.replace(/_/g," ")},Le=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",Ne=t=>"products"==t||"product"==t?e.jsx(i,{height:16,width:16,color:y.content.secondary}):"files"==t?e.jsx(a,{height:16,width:16,color:y.content.secondary}):"website links"==t||"fetched links"==t?e.jsx(h,{height:16,width:16,color:y.content.secondary}):"faq"==t?e.jsx(d,{height:16,width:16,color:y.content.secondary}):"texts"==t?e.jsx(x,{height:16,width:16,color:y.content.secondary}):e.jsx(p,{height:16,width:16,color:y.content.secondary}),Fe=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(le||!W)return e.jsx(N,{children:e.jsx(C,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})});const ke=s=>{const{title:i,count:r,isExpanded:l,onToggle:a,children:d}=s;return e.jsxs("div",{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:a},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsx(S,{children:i}),P===t.MANIFEST?e.jsx("div",Object.assign({style:{backgroundColor:y.surface.subdued,color:y.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500",border:`1px solid ${y.stroke.primary}`}},{children:r})):e.jsx(e.Fragment,{})]})),e.jsx(e.Fragment,{children:P===t.BIK?e.jsx(e.Fragment,{}):l?e.jsx(n,{width:20,height:20,color:y.content.primary}):e.jsx(o,{width:20,height:20,color:y.content.primary})})]})),l&&d]})};return e.jsxs(e.Fragment,{children:[e.jsx(N,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",padding:0,paddingBottom:"12px"}},{children:[!!q&&e.jsx(E,{children:q}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(w,Object.assign({color:y.content.secondary},{children:"Intent"})),null!==(D=Ie[U.intent])&&void 0!==D?D:Ie.GENERIC,!M&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>K(void 0)},{children:e.jsx(r,{height:20,width:20,color:y.content.secondary})}))]})),ie&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"12px",marginTop:"6px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsx(S,Object.assign({color:y.content.primary},{children:ie.rule_name})),oe&&ie.rule_id&&e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[e.jsx(s,{width:14,color:y.content.secondary}),e.jsx(w,Object.assign({color:y.content.secondary},{children:"Edit search rule"})),e.jsx(b,{Icon:l,height:16,width:16,bordered:!0,iconColor:y.content.primary,onClick:()=>oe(null==ie?void 0:ie.rule_id)})]}))]})),ie.keywords&&ie.keywords.length>0&&e.jsx("div",Object.assign({style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px",backgroundColor:y.surface.subdued,borderRadius:"8px",border:`1px dashed ${y.stroke.primary}`}},{children:ie.keywords.map(((t,s)=>e.jsx(O,{tagText:t,theme:"light"},`keyword-${s}`)))}))]})),we(ne)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${y.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(c,{width:24,height:24,color:y.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(E,{children:"Insufficient data"})})),e.jsx(S,Object.assign({color:y.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),Q&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(v,{LeadingIcon:null!==(t=Q.leadingIcon)&&void 0!==t?t:u,buttonText:null!==(s=Q.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{Q.onClick()}})}))]}))})()})):!ie&&e.jsx(O,{LeadingIcon:c,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:U.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${P===t.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),pe&&!we(ne)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(L,{appType:P,storeId:B,messageSource:U,sourceIntent:null!==(R=U.intent)&&void 0!==R?R:H.GENERIC,faqCount:ge,trainingSourceCount:me,ShowTrainingDataSource:Ee,ChecklistType:H,footerButtonOption:X,isFooterLoading:de,reasonForAiGeneratedResponse:ee,showAiResponseReason:te,aiResponseLoading:se})})),!we(ne)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsx(e.Fragment,{children:Oe.length>0&&e.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsx(ke,Object.assign({title:"Product Sources",count:Oe.length,isExpanded:P!==t.MANIFEST||ye,onToggle:()=>ve(!ye)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Oe.map(((t,s)=>{var i,o,n,r;const a=Se(t.type||t.subTitle||"OpenAI"),d=Se(t.type||t.subTitle||"OpenAI",!0),c=Le(a),p=null==G?void 0:G.includes(d),u=$[null!==(i=t.productId)&&void 0!==i?i:"Products"],x=t.title,h=t.productId&&(null==Z?void 0:Z[t.productId]),j=h&&h.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Oe?void 0:Oe.length)?`1px solid ${y.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Ne(a),e.jsx(T,Object.assign({body:x,placement:"top"},{children:e.jsx(S,Object.assign({style:d==A.FETCHED_LINKS||d==A.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:y.content.primary,className:"clamp-title",onClick:()=>d==A.FETCHED_LINKS||d==A.WEBSITE_LINKS?z(t):{}},{children:x}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==H.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(w,Object.assign({color:y.content.secondary},{children:c}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(b,{Icon:l,height:16,width:16,iconColor:y.content.secondary,onClick:()=>null==u?void 0:u.onEditClick(u.data,u.type),disabled:!u,disabledTooltip:"This source is deleted"}):e.jsx(b,{Icon:g,height:16,width:16,iconColor:y.content.secondary,disabled:"custom"===t.type&&!u,disabledTooltip:"This source is deleted",onClick:()=>z(t)})}))]}))]})),h&&e.jsxs(w,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;je({title:x,description:Fe(h.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>je(void 0)})}},{children:`${null===(o=h.description)||void 0===o?void 0:o.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>h.onEditFaqClick(h.faqs)},{children:`${null===(n=h.faqs)||void 0===n?void 0:n.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(T,Object.assign({body:j,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(r=h.metafield)||void 0===r?void 0:r.length} metafields`}))}))]})]}),`info-${s}`)}))}))}))}))}),e.jsx(e.Fragment,{children:Te.length>0&&e.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsx(ke,Object.assign({title:"Content Sources",count:Te.length,isExpanded:P!==t.MANIFEST||be,onToggle:()=>Ce(!be)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Te.map(((t,s)=>{var i,o,n,r,a,d,c,p,u,x,h,j,m,f,v,C,I;const O=Se(t.type||t.subTitle||"OpenAI"),E=Se(t.type||t.subTitle||"OpenAI",!0),L=Le(O),N=null==G?void 0:G.includes(E),F="Products"===t.subTitle?$[null!==(i=t.productId)&&void 0!==i?i:"Products"]:$[null!==(o=t.docId)&&void 0!==o?o:""],k=E.toLowerCase()===(null===(n=A.FAQ)||void 0===n?void 0:n.toLowerCase())?"faq"===(null===(r=t.title)||void 0===r?void 0:r.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(a=A.FILES)||void 0===a?void 0:a.toLowerCase())||E.toLowerCase()===(null===(d=A.FETCHED_LINKS)||void 0===d?void 0:d.toLowerCase())||E.toLowerCase()===(null===(c=A.TEXTS)||void 0===c?void 0:c.toLowerCase())?t.title:E.toLowerCase()===(null===(p=A.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):t.intent===H.EMAIL_COLLECTION?L:t.title,_="faq"===E.toLowerCase()?null!==(h=null!==(u=null==F?void 0:F.content)&&void 0!==u?u:null===(x=null==F?void 0:F.data)||void 0===x?void 0:x.answer)&&void 0!==h?h:"":E.toLowerCase()===(null===(j=A.FETCHED_LINKS)||void 0===j?void 0:j.toLowerCase())||E.toLowerCase()===(null===(m=A.WEBSITE_LINKS)||void 0===m?void 0:m.toLowerCase())||E.toLowerCase()===(null===(f=A.TEXTS)||void 0===f?void 0:f.toLowerCase())?null!==(I=null!==(v=null==F?void 0:F.content)&&void 0!==v?v:null===(C=null==F?void 0:F.data)||void 0===C?void 0:C.fileContentText)&&void 0!==I?I:"":t.intent===H.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Te?void 0:Te.length)?`1px solid ${y.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Ne(O),e.jsx(T,Object.assign({body:k,placement:"top"},{children:e.jsx(S,Object.assign({style:E==A.FETCHED_LINKS||E==A.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:y.content.primary,className:"clamp-title",onClick:()=>E==A.FETCHED_LINKS||E==A.WEBSITE_LINKS?z(t):{}},{children:k}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==H.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(w,Object.assign({color:y.content.secondary},{children:L}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:N?e.jsx(b,{Icon:l,height:16,width:16,iconColor:y.content.secondary,onClick:()=>null==F?void 0:F.onEditClick(F.data,F.type),disabled:!F,disabledTooltip:"This source is deleted"}):e.jsx(b,{Icon:g,height:16,width:16,iconColor:y.content.secondary,disabled:"custom"===t.type&&!F,disabledTooltip:"This source is deleted",onClick:()=>z(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${y.stroke.primary}`,borderRadius:"4px",backgroundColor:y.surface.subdued}},{children:e.jsx(w,Object.assign({color:y.content.primary,className:"clamp-description"},{children:Fe(null!=_?_:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]}))]})}),he&&e.jsx(I,Object.assign({header:"Product description",onClose:()=>je(void 0),width:"30%"},{children:e.jsx(k,{title:he.title,description:he.description,imageUrl:he.imageUrl,onClose:he.onClose})}))]})};export{_ as DataSourcePanel};
|
|
@@ -9,13 +9,14 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
|
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
border-radius: 8px;
|
|
11
11
|
gap: 12px;
|
|
12
|
+
margin-top: 12px;
|
|
12
13
|
}
|
|
13
14
|
.info-content-source {
|
|
14
15
|
border-radius: 8px;
|
|
15
16
|
display: flex;
|
|
16
17
|
flex-direction: column;
|
|
17
18
|
gap: 8px;
|
|
18
|
-
background-color: ${o.surface.
|
|
19
|
+
background-color: ${o.surface.grey};
|
|
19
20
|
.source {
|
|
20
21
|
border-radius: 12px;
|
|
21
22
|
}
|
|
@@ -25,7 +26,7 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
|
|
|
25
26
|
display: flex;
|
|
26
27
|
flex-direction: column;
|
|
27
28
|
gap: 8px;
|
|
28
|
-
background-color: ${o.surface.
|
|
29
|
+
background-color: ${o.surface.grey};
|
|
29
30
|
|
|
30
31
|
.product-data-text1 {
|
|
31
32
|
padding: 2px;
|
|
@@ -45,7 +46,7 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
.pop-up-header {
|
|
48
|
-
padding: 6px
|
|
49
|
+
padding: 6px 0px;
|
|
49
50
|
background-color: rgba(255, 255, 255, 0.1);
|
|
50
51
|
display: flex;
|
|
51
52
|
flex-direction: column;
|
|
@@ -54,7 +55,7 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
|
|
|
54
55
|
.footer {
|
|
55
56
|
display: flex;
|
|
56
57
|
flex-direction: column;
|
|
57
|
-
margin: 24px
|
|
58
|
+
margin: 24px 0px 0px 0px;
|
|
58
59
|
}
|
|
59
60
|
.clamp-title {
|
|
60
61
|
overflow: hidden;
|
|
@@ -92,6 +93,7 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
|
|
|
92
93
|
background-color: ${o.surface.grey};
|
|
93
94
|
max-height: calc(100vh - 380px);
|
|
94
95
|
overflow-y: scroll;
|
|
96
|
+
margin-top: 12px;
|
|
95
97
|
&::-webkit-scrollbar-thumb {
|
|
96
98
|
background: #888;
|
|
97
99
|
border-radius: 8px;
|
|
@@ -102,7 +104,7 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
|
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
.pop-up-header {
|
|
105
|
-
padding: 6px
|
|
107
|
+
padding: 6px 0px;
|
|
106
108
|
background-color: rgba(255, 255, 255, 0.1);
|
|
107
109
|
display: flex;
|
|
108
110
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationType } from '@bikdotai/bik-models/growth
|
|
1
|
+
import { ApplicationType } from '@bikdotai/bik-models/growth';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ICouponData } from "./type";
|
|
4
4
|
import { Collection, Product } from "../product-picker/type";
|