@bikdotai/bik-component-library 0.0.655-9 → 0.0.655-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/boxV2.svg.js"),i=require("../../assets/icons/cross.svg.js"),o=require("../../assets/icons/edit.svg.js"),s=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),a=require("../../assets/icons/info.svg.js"),r=require("../../assets/icons/openai.svg.js"),l=require("../../assets/icons/plus.svg.js"),d=require("../../assets/icons/redirect.svg.js"),c=require("../../assets/icons/text_t9.svg.js"),u=require("../../assets/icons/website.svg.js"),p=require("react"),y=require("../../constants/Theme.js"),g=require("../button/Button.js"),C=require("../icon-button/IconButton.js"),T=require("../shimmer/ShimmerComponent/BikShimmer.js"),x=require("../tag/Tag.js"),h=require("../tooltips/Tooltip.js"),O=require("../TypographyStyle.js"),S=require("./DataSourceInfoFooter.js"),I=require("./DataSourcePanel.style.js"),v=require("./model.js");exports.DataSourcePanel=E=>{var j,m;const{appType:f,storeId:L,messageSource:b,setMessageSourcePanel:N,hideCloseButton:R,isSourceInfoFetched:_,allSourceInfoDetail:D,ChecklistType:A,title:w,zeroStateButton:k,editableSources:F,preFillTrainingSourceCount:P,redirect:q,footerButtonOption:U,fetchTrainingSourceCount:B,fetchProductFAQCount:M}=E,{sources:H}=b,K=["blog","article","page","policy"],[Q,G]=p.useState(!1),[Y,W]=p.useState(!1),[$,z]=p.useState(0),[X,V]=p.useState(null!=P?P:{}),Z={};[{key:"GENERIC",type:"neutral",tagText:"Generic"},{key:"STORE_INFORMATION",type:"blue",tagText:"Store information"},{key:"SHIPPING_POLICY",type:"positive",tagText:"Shipping policy"},{key:"RETURN_AND_REFUND",type:"purple",tagText:"Returns & refund policy"},{key:"CONTACT_INFO",type:"warning",tagText:"Contact details"},{key:"STORE_LOCATION",type:"grey",tagText:"Store location"},{key:"SALES_AND_OFFERS",type:"purple",tagText:"Offers & rewards"},{key:"PRODUCT_CUSTOMISATION",type:"blue",tagText:"Product customisation"},{key:"PRODUCT_DETAILS",type:"blue",tagText:"Product details"},{key:"PAYMENT_METHODS",type:"positive",tagText:"Payment methods"},{key:"ORDER_TRACKING",type:"warning",tagText:"Order tracking"},{key:"PRODUCT_SEARCH",type:"neutral",tagText:"Product search"},{key:"PURCHASE",type:"blue",tagText:"Purchase"},{key:"CONNECT_TO_AGENT",type:"purple",tagText:"Talk to a person"},{key:"CHECKOUT_ENQUIRY",type:"purple",tagText:"Checkout enquiry"},{key:"ORDER_CANCELLATION",type:"positive",tagText:"Order cancellation"},{key:"ORDER_ENQUIRY",type:"neutral",tagText:"Order enquiry"},{key:"ORDER_MODIFICATION",type:"blue",tagText:"Order modification"},{key:"SUBSCRIPTION_ENQUIRY",type:"warning",tagText:"Subscription enquiry"},{key:"SALES_AND_OFFERS_ISSUES",type:"grey",tagText:"Offer-related enquiries"},{key:"COLLABORATION",type:"positive",tagText:"Collaboration"},{key:"QUIZ_GENERATION",type:"warning",tagText:"Start the quiz"},{key:"SIMILAR_PRODUCT",type:"blue",tagText:"Similar Product"},{key:"EMAIL_COLLECTION",type:"warning",tagText:"Email Collection"},{key:"ADD_TO_CART_SUCCESS",type:"blue",tagText:"Add to Cart Success"},{key:"ADD_TO_CART_SUCCESS_MESSAGE",type:"blue",tagText:"Add to Cart Success Message"},{key:"FEEDBACK",type:"blue",tagText:"Feedback"},{key:"PHONE_NUMBER_COLLECTION",type:"blue",tagText:"Phone no. collection"}].forEach((t=>{let{key:i,type:o,tagText:s}=t;A[i]&&(Z[A[i]]=e.jsx(x.Tag,{theme:"light",type:o,tagText:s,cursor:"pointer"}))}));const J=p.useMemo((()=>{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=>{A[t]&&(e[A[t]]=A[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[A]);p.useEffect((()=>{var e,t,i,o;if(!(null==b?void 0:b.messageId))return;G(!0),W(!1!==(null===(t=null===(e=b.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=b.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights));const s=b.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(s)).filter((e=>!!e));M(L,n).then((e=>z(e))).then((()=>{P?(V(P),setTimeout((()=>G(!1)),100)):B(L).then((e=>V(e))).then((()=>{setTimeout((()=>G(!1)),100)}))}))}),[M,B,null==b?void 0:b.messageId,b.sources,P,L]);const ee=e=>!(0!==e.length&&!(null==b?void 0:b.isUnsatisfactoryAnswer)),te=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=v.CustomDataType.FILES:K.includes(e)?e=v.CustomDataType.FETCHED_LINKS:"url"==e?e=v.CustomDataType.WEBSITE_LINKS:"text"===e?e=v.CustomDataType.TEXTS:"faq"===e&&(e=v.CustomDataType.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},ie=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return Q||!_?e.jsx(I.SourceInfoDetailsStyle,{children:e.jsx(T.BikShimmer,{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"}]})}):e.jsx(e.Fragment,{children:e.jsx(I.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!w&&e.jsx(O.TitleSmall,{children:w}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(O.BodyCaption,Object.assign({color:y.COLORS.content.secondary},{children:"Intent"})),null!==(j=Z[b.intent])&&void 0!==j?j:Z.GENERIC,!R&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>N(void 0)},{children:e.jsx(i.default,{height:20,width:20,color:y.COLORS.content.secondary})}))]})),ee(H)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,i;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.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(a.default,{width:24,height:24,color:y.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(O.TitleSmall,{children:"Insufficient data"})})),e.jsx(O.BodySecondary,Object.assign({color:y.COLORS.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"})),k&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=k.leadingIcon)&&void 0!==t?t:l.default,buttonText:null!==(i=k.title)&&void 0!==i?i:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{k.onClick()}})}))]}))})()})):e.jsx(x.Tag,{LeadingIcon:a.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:b.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 Manifest.":"Edit the original source and save again to update the response"})]})),!ee(H)&&e.jsx("div",Object.assign({className:"info-container"},{children:e.jsx("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:H.map(((i,a)=>{var l,p,g,T,x,S,I,E,j,m,f,L,b,N,R,_,w;const k=te(i.type||i.subTitle||"OpenAI"),P=te(i.type||i.subTitle||"OpenAI",!0),U=(B=k)?"faq"==B.toLocaleLowerCase()?"FAQ":"openai"==B.toLocaleLowerCase()?"OPENAI":"files"==B.toLocaleLowerCase()?"PDF":"texts"==B.toLocaleLowerCase()?"Custom text":((B=(B=B.charAt(0).toUpperCase()+B.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(B=B.slice(0,-1)),B.replace("Website","Manual")):"";var B;const M=null==F?void 0:F.includes(P),H="Products"===i.subTitle?D[null!==(l=i.productId)&&void 0!==l?l:"Products"]:D[null!==(p=i.docId)&&void 0!==p?p:""],K=P.toLowerCase()===(null===(g=v.CustomDataType.FAQ)||void 0===g?void 0:g.toLowerCase())?"faq"===(null===(T=i.title)||void 0===T?void 0:T.toLowerCase())?i.subTitle:i.title:P.toLowerCase()===(null===(x=v.CustomDataType.FILES)||void 0===x?void 0:x.toLowerCase())||P.toLowerCase()===(null===(S=v.CustomDataType.FETCHED_LINKS)||void 0===S?void 0:S.toLowerCase())||P.toLowerCase()===(null===(I=v.CustomDataType.TEXTS)||void 0===I?void 0:I.toLowerCase())?i.title:P.toLowerCase()===(null===(E=v.CustomDataType.WEBSITE_LINKS)||void 0===E?void 0:E.toLowerCase())?i.title.split("/")[i.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):i.intent===A.EMAIL_COLLECTION?U:i.title,Q="faq"===P.toLowerCase()?null!==(f=null!==(j=null==H?void 0:H.content)&&void 0!==j?j:null===(m=null==H?void 0:H.data)||void 0===m?void 0:m.answer)&&void 0!==f?f:"":P.toLowerCase()===(null===(L=v.CustomDataType.FETCHED_LINKS)||void 0===L?void 0:L.toLowerCase())||P.toLowerCase()===(null===(b=v.CustomDataType.WEBSITE_LINKS)||void 0===b?void 0:b.toLowerCase())||P.toLowerCase()===(null===(N=v.CustomDataType.TEXTS)||void 0===N?void 0:N.toLowerCase())?null!==(w=null!==(R=null==H?void 0:H.content)&&void 0!==R?R:null===(_=null==H?void 0:H.data)||void 0===_?void 0:_.fileContentText)&&void 0!==w?w:"":i.intent===A.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"24px 0px",borderBottom:`1px solid ${y.COLORS.stroke.primary}`}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(h.Tooltip,Object.assign({body:K,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:P==v.CustomDataType.FETCHED_LINKS||P==v.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:y.COLORS.content.primary,className:"clamp-title",onClick:()=>P==v.CustomDataType.FETCHED_LINKS||P==v.CustomDataType.WEBSITE_LINKS?q(i):{}},{children:K}))}))})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[i.intent!==A.EMAIL_COLLECTION&&e.jsxs(e.Fragment,{children:[(G=k,"products"==G||"product"==G?e.jsx(t.default,{height:16,width:16,color:y.COLORS.content.secondary}):"files"==G?e.jsx(s.default,{height:16,width:16,color:y.COLORS.content.secondary}):"website links"==G||"fetched links"==G?e.jsx(u.default,{height:16,width:16,color:y.COLORS.content.secondary}):"faq"==G?e.jsx(n.default,{height:16,width:16,color:y.COLORS.content.secondary}):"texts"==G?e.jsx(c.default,{height:16,width:16,color:y.COLORS.content.secondary}):e.jsx(r.default,{height:16,width:16,color:y.COLORS.content.secondary})),e.jsx(O.BodyCaption,Object.assign({color:y.COLORS.content.secondary},{children:U}))]}),(i.link||i.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:M?e.jsx(C.IconButton,{Icon:o.default,height:16,width:16,bordered:!0,onClick:()=>null==H?void 0:H.onEditClick(H.data,H.type),disabled:!H,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:d.default,height:16,width:16,bordered:!0,disabled:"custom"===i.type&&!H,disabledTooltip:"This source is deleted",onClick:()=>q(i)})}))]}))]})),(null!=Q?Q:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${y.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:y.COLORS.surface.subdued}},{children:e.jsx(O.BodyCaption,Object.assign({color:y.COLORS.content.primary,className:"clamp-description"},{children:ie(null!=Q?Q:"").trim()}))}))]}),`info-${a}`);var G}))}))})),Y&&!ee(H)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(S.default,{appType:f,storeId:L,messageSource:b,sourceIntent:null!==(m=b.intent)&&void 0!==m?m:A.GENERIC,faqCount:$,trainingSourceCount:X,ShowTrainingDataSource:J,ChecklistType:A,footerButtonOption:U})}))]})})})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/boxV2.svg.js"),i=require("../../assets/icons/cross.svg.js"),o=require("../../assets/icons/edit.svg.js"),s=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),a=require("../../assets/icons/info.svg.js"),r=require("../../assets/icons/openai.svg.js"),l=require("../../assets/icons/plus.svg.js"),d=require("../../assets/icons/redirect.svg.js"),c=require("../../assets/icons/text_t9.svg.js"),u=require("../../assets/icons/website.svg.js"),p=require("react"),y=require("../../constants/Theme.js"),g=require("../button/Button.js"),C=require("../icon-button/IconButton.js"),T=require("../shimmer/ShimmerComponent/BikShimmer.js"),x=require("../tag/Tag.js"),h=require("../tooltips/Tooltip.js"),O=require("../TypographyStyle.js"),S=require("./DataSourceInfoFooter.js"),I=require("./DataSourcePanel.style.js"),v=require("./model.js");exports.DataSourcePanel=E=>{var j,m;const{appType:f,storeId:L,messageSource:b,setMessageSourcePanel:N,hideCloseButton:R,isSourceInfoFetched:_,allSourceInfoDetail:D,ChecklistType:A,title:w,zeroStateButton:k,editableSources:F,preFillTrainingSourceCount:P,redirect:q,footerButtonOption:B,fetchTrainingSourceCount:U,fetchProductFAQCount:M}=E,{sources:K}=b,H=["blog","article","page","policy"],[Q,G]=p.useState(!1),[Y,W]=p.useState(!1),[$,z]=p.useState(0),[X,V]=p.useState(null!=P?P:{}),Z={};[{key:"GENERIC",type:"neutral",tagText:"Generic"},{key:"STORE_INFORMATION",type:"blue",tagText:"Store information"},{key:"SHIPPING_POLICY",type:"positive",tagText:"Shipping policy"},{key:"RETURN_AND_REFUND",type:"purple",tagText:"Returns & refund policy"},{key:"CONTACT_INFO",type:"warning",tagText:"Contact details"},{key:"STORE_LOCATION",type:"grey",tagText:"Store location"},{key:"SALES_AND_OFFERS",type:"purple",tagText:"Offers & rewards"},{key:"PRODUCT_CUSTOMISATION",type:"blue",tagText:"Product customisation"},{key:"PRODUCT_DETAILS",type:"blue",tagText:"Product details"},{key:"PAYMENT_METHODS",type:"positive",tagText:"Payment methods"},{key:"ORDER_TRACKING",type:"warning",tagText:"Order tracking"},{key:"PRODUCT_SEARCH",type:"neutral",tagText:"Product search"},{key:"PURCHASE",type:"blue",tagText:"Purchase"},{key:"CONNECT_TO_AGENT",type:"purple",tagText:"Talk to a person"},{key:"CHECKOUT_ENQUIRY",type:"purple",tagText:"Checkout enquiry"},{key:"ORDER_CANCELLATION",type:"positive",tagText:"Order cancellation"},{key:"ORDER_ENQUIRY",type:"neutral",tagText:"Order enquiry"},{key:"ORDER_MODIFICATION",type:"blue",tagText:"Order modification"},{key:"SUBSCRIPTION_ENQUIRY",type:"warning",tagText:"Subscription enquiry"},{key:"SALES_AND_OFFERS_ISSUES",type:"grey",tagText:"Offer-related enquiries"},{key:"COLLABORATION",type:"positive",tagText:"Collaboration"},{key:"QUIZ_GENERATION",type:"warning",tagText:"Start the quiz"},{key:"SIMILAR_PRODUCT",type:"blue",tagText:"Similar Product"},{key:"EMAIL_COLLECTION",type:"warning",tagText:"Email Collection"},{key:"ADD_TO_CART_SUCCESS",type:"blue",tagText:"Add to Cart Success"},{key:"ADD_TO_CART_SUCCESS_MESSAGE",type:"blue",tagText:"Add to Cart Success Message"},{key:"FEEDBACK",type:"blue",tagText:"Feedback"},{key:"PHONE_NUMBER_COLLECTION",type:"blue",tagText:"Phone no. collection"}].forEach((t=>{let{key:i,type:o,tagText:s}=t;A[i]&&(Z[A[i]]=e.jsx(x.Tag,{theme:"light",type:o,tagText:s,cursor:"pointer"}))}));const J=p.useMemo((()=>{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=>{A[t]&&(e[A[t]]=A[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[A]);p.useEffect((()=>{var e,t,i,o;if(!(null==b?void 0:b.messageId))return;G(!0),W(!1!==(null===(t=null===(e=b.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=b.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights));const s=b.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(s)).filter((e=>!!e));M(L,n).then((e=>z(e))).then((()=>{P?(V(P),setTimeout((()=>G(!1)),100)):U(L).then((e=>V(e))).then((()=>{setTimeout((()=>G(!1)),100)}))}))}),[M,U,null==b?void 0:b.messageId,b.sources,P,L]);const ee=e=>!(0!==e.length&&!(null==b?void 0:b.isUnsatisfactoryAnswer)),te=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=v.CustomDataType.FILES:H.includes(e)?e=v.CustomDataType.FETCHED_LINKS:"url"==e?e=v.CustomDataType.WEBSITE_LINKS:"text"===e?e=v.CustomDataType.TEXTS:"faq"===e&&(e=v.CustomDataType.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},ie=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return Q||!_?e.jsx(I.SourceInfoDetailsStyle,{children:e.jsx(T.BikShimmer,{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"}]})}):e.jsx(e.Fragment,{children:e.jsx(I.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!w&&e.jsx(O.TitleSmall,{children:w}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(O.BodyCaption,Object.assign({color:y.COLORS.content.secondary},{children:"Intent"})),null!==(j=Z[b.intent])&&void 0!==j?j:Z.GENERIC,!R&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>N(void 0)},{children:e.jsx(i.default,{height:20,width:20,color:y.COLORS.content.secondary})}))]})),ee(K)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,i;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.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(a.default,{width:24,height:24,color:y.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(O.TitleSmall,{children:"Insufficient data"})})),e.jsx(O.BodySecondary,Object.assign({color:y.COLORS.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"})),k&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=k.leadingIcon)&&void 0!==t?t:l.default,buttonText:null!==(i=k.title)&&void 0!==i?i:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{k.onClick()}})}))]}))})()})):e.jsx(x.Tag,{LeadingIcon:a.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:b.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 ${f===v.AppType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!ee(K)&&e.jsx("div",Object.assign({className:"info-container"},{children:e.jsx("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:K.map(((i,a)=>{var l,p,g,T,x,S,I,E,j,m,f,L,b,N,R,_,w;const k=te(i.type||i.subTitle||"OpenAI"),P=te(i.type||i.subTitle||"OpenAI",!0),B=(U=k)?"faq"==U.toLocaleLowerCase()?"FAQ":"openai"==U.toLocaleLowerCase()?"OPENAI":"files"==U.toLocaleLowerCase()?"PDF":"texts"==U.toLocaleLowerCase()?"Custom text":((U=(U=U.charAt(0).toUpperCase()+U.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(U=U.slice(0,-1)),U.replace("Website","Manual")):"";var U;const M=null==F?void 0:F.includes(P),K="Products"===i.subTitle?D[null!==(l=i.productId)&&void 0!==l?l:"Products"]:D[null!==(p=i.docId)&&void 0!==p?p:""],H=P.toLowerCase()===(null===(g=v.CustomDataType.FAQ)||void 0===g?void 0:g.toLowerCase())?"faq"===(null===(T=i.title)||void 0===T?void 0:T.toLowerCase())?i.subTitle:i.title:P.toLowerCase()===(null===(x=v.CustomDataType.FILES)||void 0===x?void 0:x.toLowerCase())||P.toLowerCase()===(null===(S=v.CustomDataType.FETCHED_LINKS)||void 0===S?void 0:S.toLowerCase())||P.toLowerCase()===(null===(I=v.CustomDataType.TEXTS)||void 0===I?void 0:I.toLowerCase())?i.title:P.toLowerCase()===(null===(E=v.CustomDataType.WEBSITE_LINKS)||void 0===E?void 0:E.toLowerCase())?i.title.split("/")[i.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):i.intent===A.EMAIL_COLLECTION?B:i.title,Q="faq"===P.toLowerCase()?null!==(f=null!==(j=null==K?void 0:K.content)&&void 0!==j?j:null===(m=null==K?void 0:K.data)||void 0===m?void 0:m.answer)&&void 0!==f?f:"":P.toLowerCase()===(null===(L=v.CustomDataType.FETCHED_LINKS)||void 0===L?void 0:L.toLowerCase())||P.toLowerCase()===(null===(b=v.CustomDataType.WEBSITE_LINKS)||void 0===b?void 0:b.toLowerCase())||P.toLowerCase()===(null===(N=v.CustomDataType.TEXTS)||void 0===N?void 0:N.toLowerCase())?null!==(w=null!==(R=null==K?void 0:K.content)&&void 0!==R?R:null===(_=null==K?void 0:K.data)||void 0===_?void 0:_.fileContentText)&&void 0!==w?w:"":i.intent===A.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"24px 0px",borderBottom:`1px solid ${y.COLORS.stroke.primary}`}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(h.Tooltip,Object.assign({body:H,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:P==v.CustomDataType.FETCHED_LINKS||P==v.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:y.COLORS.content.primary,className:"clamp-title",onClick:()=>P==v.CustomDataType.FETCHED_LINKS||P==v.CustomDataType.WEBSITE_LINKS?q(i):{}},{children:H}))}))})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[i.intent!==A.EMAIL_COLLECTION&&e.jsxs(e.Fragment,{children:[(G=k,"products"==G||"product"==G?e.jsx(t.default,{height:16,width:16,color:y.COLORS.content.secondary}):"files"==G?e.jsx(s.default,{height:16,width:16,color:y.COLORS.content.secondary}):"website links"==G||"fetched links"==G?e.jsx(u.default,{height:16,width:16,color:y.COLORS.content.secondary}):"faq"==G?e.jsx(n.default,{height:16,width:16,color:y.COLORS.content.secondary}):"texts"==G?e.jsx(c.default,{height:16,width:16,color:y.COLORS.content.secondary}):e.jsx(r.default,{height:16,width:16,color:y.COLORS.content.secondary})),e.jsx(O.BodyCaption,Object.assign({color:y.COLORS.content.secondary},{children:B}))]}),(i.link||i.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:M?e.jsx(C.IconButton,{Icon:o.default,height:16,width:16,bordered:!0,onClick:()=>null==K?void 0:K.onEditClick(K.data,K.type),disabled:!K,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:d.default,height:16,width:16,bordered:!0,disabled:"custom"===i.type&&!K,disabledTooltip:"This source is deleted",onClick:()=>q(i)})}))]}))]})),(null!=Q?Q:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${y.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:y.COLORS.surface.subdued}},{children:e.jsx(O.BodyCaption,Object.assign({color:y.COLORS.content.primary,className:"clamp-description"},{children:ie(null!=Q?Q:"").trim()}))}))]}),`info-${a}`);var G}))}))})),Y&&!ee(K)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(S.default,{appType:f,storeId:L,messageSource:b,sourceIntent:null!==(m=b.intent)&&void 0!==m?m:A.GENERIC,faqCount:$,trainingSourceCount:X,ShowTrainingDataSource:J,ChecklistType:A,footerButtonOption:B})}))]})})})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/cross.svg.js"),t=require("../../assets/icons/info.svg.js"),n=require("date-fns"),r=require("react"),i=require("../../constants/Theme.js"),a=require("../avatar/Avatar.js"),o=require("../avatar/AvatarHelper.js"),l=require("../button/Button.js"),c=require("../data-source-panel/model.js"),d=require("../states/StateComponent.js");require("../../_virtual/_tslib.js");var u=require("../TypographyStyle.js"),y=require("./UnsatisfactoryCountIntentWiseModal.js"),p=require("./UnsatisfactoryResponseList.style.js");exports.UnsatisfactoryResponseList=h=>{const{storeId:j,appType:f,incorrectMessages:g,onIncorrectMessageBubbleClick:v,setShowIncorrectReplies:x,ChecklistType:I,IntentWiseUnsatisfactoryResponse:b,IntentHeaderTitle:C,redirectToUnsatisfactoryResponse:O,fetchUnsatisfactoryResponseCountIntentWise:S,fetchUnsatisfactoryResponseCount:m}=h,[R,T]=r.useState(""),[A,w]=r.useState((null==g?void 0:g.length)>0),[U,q]=r.useState(!1);return r.useEffect((()=>{!A&&m&&m().then((e=>{e>0&&w(!0),0===e&&x(!1)}))}),[]),e.jsx("div",Object.assign({style:{overflow:"scroll",height:"100%"}},{children:e.jsxs(p.IncorrectRepliesStyle,{children:[f==c.AppType.MANIFEST&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx(u.TitleRegular,{children:"Unsatisfactory responses"}),e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>x(!1)},{children:e.jsx(s.default,{height:16,width:16,color:i.COLORS.content.primary})}))]})),e.jsx(u.BodySecondary,Object.assign({style:{color:i.COLORS.content.secondary}},{children:"Spot unsatisfactory replies, dive deeper, and enhance with relevant data for improved responses."}))]})),!(null==g?void 0:g.length)&&e.jsx("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:e.jsx(d.StateComponent,{states:d.StateInterface.WARNING,heading:"No unsatisfactory responses",subline:"As of now, all responses are correct",isButtonEnabled:!1,width:0,size:o.SIZE.SMALL,icon:e.jsx(a.Avatar,{type:o.AVATAR_TYPES.ICON,size:o.SIZE.MEDIUM,background:o.AVATAR_BACKGROUND.LIGHT,icon:()=>e.jsx(t.default,{width:16,height:16,color:i.COLORS.content.warning})})})})),(null==g?void 0:g.length)&&e.jsxs(e.Fragment,{children:[f==c.AppType.MANIFEST&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%",justifyContent:(null==g?void 0:g.length)?"flex-start":"center"}},{children:e.jsx(l.Button,{buttonText:"Fix all unsatisfactory responses",buttonType:"tertiary",size:"small",onClick:()=>{q(!0)},disabled:!A})})),e.jsx(y.UnsatisfactoryCountIntentWiseModal,{storeId:j,setShowUnsatisfactoryResponseModal:q,showUnsatisfactoryResponseModal:U,ChecklistType:I,UnsatisfactoryResponseIntentList:b,IntentHeaderTitle:C,fetchUnsatisfactoryResponseCountIntentWise:S,viewIntentWiseUnsatisfactoryResponse:O}),!!(null==g?void 0:g.length)&&e.jsx("div",Object.assign({className:"wrapper"},{children:g.map(((s,t)=>e.jsxs("div",Object.assign({className:"bubble",onClick:()=>{v(s.messageId),T(s.messageId)},style:R===s.messageId?{backgroundColor:i.COLORS.surface.hovered}:{}},{children:[e.jsx(u.BodySecondary,Object.assign({style:{color:i.COLORS.content.primary}},{children:s.message})),e.jsx("div",{children:e.jsxs(u.Caption,Object.assign({style:{color:i.COLORS.content.secondary}},{children:[n.format(new Date(null==s?void 0:s.date),"hh:mm a")," |"," ",n.format(new Date(null==s?void 0:s.date),"dd/MM/yyyy")]}))})]}),"incorrect-reply-"+t)))}))]})]})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/cross.svg.js"),t=require("../../assets/icons/info.svg.js"),n=require("date-fns"),r=require("react"),i=require("../../constants/Theme.js"),a=require("../avatar/Avatar.js"),o=require("../avatar/AvatarHelper.js"),l=require("../button/Button.js"),c=require("../data-source-panel/model.js"),d=require("../states/StateComponent.js");require("../../_virtual/_tslib.js");var u=require("../TypographyStyle.js"),y=require("./UnsatisfactoryCountIntentWiseModal.js"),p=require("./UnsatisfactoryResponseList.style.js");exports.UnsatisfactoryResponseList=h=>{const{storeId:j,appType:f,incorrectMessages:g,onIncorrectMessageBubbleClick:v,setShowIncorrectReplies:x,ChecklistType:I,IntentWiseUnsatisfactoryResponse:b,IntentHeaderTitle:C,redirectToUnsatisfactoryResponse:O,fetchUnsatisfactoryResponseCountIntentWise:S,fetchUnsatisfactoryResponseCount:m}=h,[R,T]=r.useState(""),[A,w]=r.useState((null==g?void 0:g.length)>0),[U,q]=r.useState(!1);return r.useEffect((()=>{!A&&m&&m().then((e=>{e>0&&w(!0),0===e&&x(!1)}))}),[]),e.jsx("div",Object.assign({style:{overflow:"scroll",height:"100%"}},{children:e.jsxs(p.IncorrectRepliesStyle,{children:[f==c.AppType.MANIFEST&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx(u.TitleRegular,{children:"Unsatisfactory responses"}),e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>x(!1)},{children:e.jsx(s.default,{height:16,width:16,color:i.COLORS.content.primary})}))]})),e.jsx(u.BodySecondary,Object.assign({style:{color:i.COLORS.content.secondary}},{children:"Spot unsatisfactory replies, dive deeper, and enhance with relevant data for improved responses."}))]})),!(null==g?void 0:g.length)&&e.jsx("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:e.jsx(d.StateComponent,{states:d.StateInterface.WARNING,heading:"No unsatisfactory responses",subline:"As of now, all responses are correct",isButtonEnabled:!1,width:0,size:o.SIZE.SMALL,icon:e.jsx(a.Avatar,{type:o.AVATAR_TYPES.ICON,size:o.SIZE.MEDIUM,background:o.AVATAR_BACKGROUND.LIGHT,icon:()=>e.jsx(t.default,{width:16,height:16,color:i.COLORS.content.warning})})})})),!!(null==g?void 0:g.length)&&e.jsxs(e.Fragment,{children:[f==c.AppType.MANIFEST&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%",justifyContent:(null==g?void 0:g.length)?"flex-start":"center"}},{children:e.jsx(l.Button,{buttonText:"Fix all unsatisfactory responses",buttonType:"tertiary",size:"small",onClick:()=>{q(!0)},disabled:!A})})),e.jsx(y.UnsatisfactoryCountIntentWiseModal,{storeId:j,setShowUnsatisfactoryResponseModal:q,showUnsatisfactoryResponseModal:U,ChecklistType:I,UnsatisfactoryResponseIntentList:b,IntentHeaderTitle:C,fetchUnsatisfactoryResponseCountIntentWise:S,viewIntentWiseUnsatisfactoryResponse:O}),g&&(null==g?void 0:g.length)>0&&e.jsx("div",Object.assign({className:"wrapper"},{children:g.map(((s,t)=>e.jsxs("div",Object.assign({className:"bubble",onClick:()=>{v(s.messageId),T(s.messageId)},style:R===s.messageId?{backgroundColor:i.COLORS.surface.hovered}:{}},{children:[e.jsx(u.BodySecondary,Object.assign({style:{color:i.COLORS.content.primary}},{children:s.message})),e.jsx("div",{children:e.jsxs(u.Caption,Object.assign({style:{color:i.COLORS.content.secondary}},{children:[n.format(new Date(null==s?void 0:s.date),"hh:mm a")," |"," ",n.format(new Date(null==s?void 0:s.date),"dd/MM/yyyy")]}))})]}),"incorrect-reply-"+t)))}))]})]})}))};
@@ -1,11 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("../../constants/Theme.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const l=o(e).default.div`
2
2
  min-width: 100%;
3
3
  padding: 20px;
4
- display: block;
4
+ display: flex;
5
5
  flex-direction: column;
6
6
  gap: 16px;
7
- height: 95vh;
8
- position: absolute;
7
+ height: 100%;
9
8
  overflow-y: scroll;
10
9
  flex: 1 1 0;
11
10
  .wrapper {
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import o from"../../assets/icons/boxV2.svg.js";import n from"../../assets/icons/cross.svg.js";import r from"../../assets/icons/edit.svg.js";import s from"../../assets/icons/filePdf.svg.js";import l from"../../assets/icons/help.svg.js";import a from"../../assets/icons/info.svg.js";import c from"../../assets/icons/openai.svg.js";import d from"../../assets/icons/plus.svg.js";import p from"../../assets/icons/redirect.svg.js";import u from"../../assets/icons/text_t9.svg.js";import g from"../../assets/icons/website.svg.js";import{useState as y,useMemo as h,useEffect as T}from"react";import{COLORS as m}from"../../constants/Theme.js";import{Button as C}from"../button/Button.js";import{IconButton as I}from"../icon-button/IconButton.js";import{BikShimmer as v}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as O}from"../tag/Tag.js";import{Tooltip as f}from"../tooltips/Tooltip.js";import{TitleSmall as E,BodyCaption as x,BodySecondary as S}from"../TypographyStyle.js";import L from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as b}from"./DataSourcePanel.style.js";import{CustomDataType as N}from"./model.js";const _=_=>{var A,w;const{appType:R,storeId:k,messageSource:j,setMessageSourcePanel:D,hideCloseButton:F,isSourceInfoFetched:P,allSourceInfoDetail:U,ChecklistType:B,title:M,zeroStateButton:H,editableSources:K,preFillTrainingSourceCount:Q,redirect:q,footerButtonOption:G,fetchTrainingSourceCount:Y,fetchProductFAQCount:W}=_,{sources:$}=j,z=["blog","article","page","policy"],[X,V]=y(!1),[Z,J]=y(!1),[ee,te]=y(0),[ie,oe]=y(null!=Q?Q:{}),ne={};[{key:"GENERIC",type:"neutral",tagText:"Generic"},{key:"STORE_INFORMATION",type:"blue",tagText:"Store information"},{key:"SHIPPING_POLICY",type:"positive",tagText:"Shipping policy"},{key:"RETURN_AND_REFUND",type:"purple",tagText:"Returns & refund policy"},{key:"CONTACT_INFO",type:"warning",tagText:"Contact details"},{key:"STORE_LOCATION",type:"grey",tagText:"Store location"},{key:"SALES_AND_OFFERS",type:"purple",tagText:"Offers & rewards"},{key:"PRODUCT_CUSTOMISATION",type:"blue",tagText:"Product customisation"},{key:"PRODUCT_DETAILS",type:"blue",tagText:"Product details"},{key:"PAYMENT_METHODS",type:"positive",tagText:"Payment methods"},{key:"ORDER_TRACKING",type:"warning",tagText:"Order tracking"},{key:"PRODUCT_SEARCH",type:"neutral",tagText:"Product search"},{key:"PURCHASE",type:"blue",tagText:"Purchase"},{key:"CONNECT_TO_AGENT",type:"purple",tagText:"Talk to a person"},{key:"CHECKOUT_ENQUIRY",type:"purple",tagText:"Checkout enquiry"},{key:"ORDER_CANCELLATION",type:"positive",tagText:"Order cancellation"},{key:"ORDER_ENQUIRY",type:"neutral",tagText:"Order enquiry"},{key:"ORDER_MODIFICATION",type:"blue",tagText:"Order modification"},{key:"SUBSCRIPTION_ENQUIRY",type:"warning",tagText:"Subscription enquiry"},{key:"SALES_AND_OFFERS_ISSUES",type:"grey",tagText:"Offer-related enquiries"},{key:"COLLABORATION",type:"positive",tagText:"Collaboration"},{key:"QUIZ_GENERATION",type:"warning",tagText:"Start the quiz"},{key:"SIMILAR_PRODUCT",type:"blue",tagText:"Similar Product"},{key:"EMAIL_COLLECTION",type:"warning",tagText:"Email Collection"},{key:"ADD_TO_CART_SUCCESS",type:"blue",tagText:"Add to Cart Success"},{key:"ADD_TO_CART_SUCCESS_MESSAGE",type:"blue",tagText:"Add to Cart Success Message"},{key:"FEEDBACK",type:"blue",tagText:"Feedback"},{key:"PHONE_NUMBER_COLLECTION",type:"blue",tagText:"Phone no. collection"}].forEach((t=>{let{key:i,type:o,tagText:n}=t;B[i]&&(ne[B[i]]=e(O,{theme:"light",type:o,tagText:n,cursor:"pointer"}))}));const re=h((()=>{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=>{B[t]&&(e[B[t]]=B[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[B]);T((()=>{var e,t,i,o;if(!(null==j?void 0:j.messageId))return;V(!0),J(!1!==(null===(t=null===(e=j.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=j.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights));const n=j.sources.filter((e=>!!e.productId)).map((e=>e.productId)),r=Array.from(new Set(n)).filter((e=>!!e));W(k,r).then((e=>te(e))).then((()=>{Q?(oe(Q),setTimeout((()=>V(!1)),100)):Y(k).then((e=>oe(e))).then((()=>{setTimeout((()=>V(!1)),100)}))}))}),[W,Y,null==j?void 0:j.messageId,j.sources,Q,k]);const se=e=>!(0!==e.length&&!(null==j?void 0:j.isUnsatisfactoryAnswer)),le=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=N.FILES:z.includes(e)?e=N.FETCHED_LINKS:"url"==e?e=N.WEBSITE_LINKS:"text"===e?e=N.TEXTS:"faq"===e&&(e=N.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},ae=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return X||!P?e(b,{children:e(v,{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"}]})}):e(t,{children:e(b,{children:i(t,{children:[i("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!M&&e(E,{children:M}),i("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e(x,Object.assign({color:m.content.secondary},{children:"Intent"})),null!==(A=ne[j.intent])&&void 0!==A?A:ne.GENERIC,!F&&e("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>D(void 0)},{children:e(n,{height:20,width:20,color:m.content.secondary})}))]})),se($)?e("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,o;return i("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${m.background.negative.light}`,borderRadius:"100px"}},{children:e(a,{width:24,height:24,color:m.stroke.negative.vibrant})})),e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e(E,{children:"Insufficient data"})})),e(S,Object.assign({color:m.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"})),H&&e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(C,{LeadingIcon:null!==(t=H.leadingIcon)&&void 0!==t?t:d,buttonText:null!==(o=H.title)&&void 0!==o?o:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{H.onClick()}})}))]}))})()})):e(O,{LeadingIcon:a,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:j.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 Manifest.":"Edit the original source and save again to update the response"})]})),!se($)&&e("div",Object.assign({className:"info-container"},{children:e("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:$.map(((n,a)=>{var d,y,h,T,C,v,O,E,L,b,_,A,w,R,k,j,D;const F=le(n.type||n.subTitle||"OpenAI"),P=le(n.type||n.subTitle||"OpenAI",!0),M=(H=F)?"faq"==H.toLocaleLowerCase()?"FAQ":"openai"==H.toLocaleLowerCase()?"OPENAI":"files"==H.toLocaleLowerCase()?"PDF":"texts"==H.toLocaleLowerCase()?"Custom text":((H=(H=H.charAt(0).toUpperCase()+H.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(H=H.slice(0,-1)),H.replace("Website","Manual")):"";var H;const Q=null==K?void 0:K.includes(P),G="Products"===n.subTitle?U[null!==(d=n.productId)&&void 0!==d?d:"Products"]:U[null!==(y=n.docId)&&void 0!==y?y:""],Y=P.toLowerCase()===(null===(h=N.FAQ)||void 0===h?void 0:h.toLowerCase())?"faq"===(null===(T=n.title)||void 0===T?void 0:T.toLowerCase())?n.subTitle:n.title:P.toLowerCase()===(null===(C=N.FILES)||void 0===C?void 0:C.toLowerCase())||P.toLowerCase()===(null===(v=N.FETCHED_LINKS)||void 0===v?void 0:v.toLowerCase())||P.toLowerCase()===(null===(O=N.TEXTS)||void 0===O?void 0:O.toLowerCase())?n.title:P.toLowerCase()===(null===(E=N.WEBSITE_LINKS)||void 0===E?void 0:E.toLowerCase())?n.title.split("/")[n.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):n.intent===B.EMAIL_COLLECTION?M:n.title,W="faq"===P.toLowerCase()?null!==(_=null!==(L=null==G?void 0:G.content)&&void 0!==L?L:null===(b=null==G?void 0:G.data)||void 0===b?void 0:b.answer)&&void 0!==_?_:"":P.toLowerCase()===(null===(A=N.FETCHED_LINKS)||void 0===A?void 0:A.toLowerCase())||P.toLowerCase()===(null===(w=N.WEBSITE_LINKS)||void 0===w?void 0:w.toLowerCase())||P.toLowerCase()===(null===(R=N.TEXTS)||void 0===R?void 0:R.toLowerCase())?null!==(D=null!==(k=null==G?void 0:G.content)&&void 0!==k?k:null===(j=null==G?void 0:G.data)||void 0===j?void 0:j.fileContentText)&&void 0!==D?D:"":n.intent===B.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return i("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"24px 0px",borderBottom:`1px solid ${m.stroke.primary}`}},{children:[i("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e("div",Object.assign({style:{flex:1}},{children:e(f,Object.assign({body:Y,placement:"top"},{children:e(S,Object.assign({style:P==N.FETCHED_LINKS||P==N.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:m.content.primary,className:"clamp-title",onClick:()=>P==N.FETCHED_LINKS||P==N.WEBSITE_LINKS?q(n):{}},{children:Y}))}))})),i("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[n.intent!==B.EMAIL_COLLECTION&&i(t,{children:[($=F,e("products"==$||"product"==$?o:"files"==$?s:"website links"==$||"fetched links"==$?g:"faq"==$?l:"texts"==$?u:c,{height:16,width:16,color:m.content.secondary})),e(x,Object.assign({color:m.content.secondary},{children:M}))]}),(n.link||n.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:e(I,Q?{Icon:r,height:16,width:16,bordered:!0,onClick:()=>null==G?void 0:G.onEditClick(G.data,G.type),disabled:!G,disabledTooltip:"This source is deleted"}:{Icon:p,height:16,width:16,bordered:!0,disabled:"custom"===n.type&&!G,disabledTooltip:"This source is deleted",onClick:()=>q(n)})}))]}))]})),(null!=W?W:"").trim()&&e("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${m.stroke.primary}`,borderRadius:"4px",backgroundColor:m.surface.subdued}},{children:e(x,Object.assign({color:m.content.primary,className:"clamp-description"},{children:ae(null!=W?W:"").trim()}))}))]}),`info-${a}`);var $}))}))})),Z&&!se($)&&e("div",Object.assign({className:"footer"},{children:e(L,{appType:R,storeId:k,messageSource:j,sourceIntent:null!==(w=j.intent)&&void 0!==w?w:B.GENERIC,faqCount:ee,trainingSourceCount:ie,ShowTrainingDataSource:re,ChecklistType:B,footerButtonOption:G})}))]})})})};export{_ as DataSourcePanel};
1
+ import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import o from"../../assets/icons/boxV2.svg.js";import n from"../../assets/icons/cross.svg.js";import r from"../../assets/icons/edit.svg.js";import s from"../../assets/icons/filePdf.svg.js";import l from"../../assets/icons/help.svg.js";import a from"../../assets/icons/info.svg.js";import c from"../../assets/icons/openai.svg.js";import d from"../../assets/icons/plus.svg.js";import p from"../../assets/icons/redirect.svg.js";import u from"../../assets/icons/text_t9.svg.js";import g from"../../assets/icons/website.svg.js";import{useState as y,useMemo as h,useEffect as T}from"react";import{COLORS as m}from"../../constants/Theme.js";import{Button as C}from"../button/Button.js";import{IconButton as I}from"../icon-button/IconButton.js";import{BikShimmer as v}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as O}from"../tag/Tag.js";import{Tooltip as f}from"../tooltips/Tooltip.js";import{TitleSmall as E,BodyCaption as x,BodySecondary as S}from"../TypographyStyle.js";import L from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as b}from"./DataSourcePanel.style.js";import{AppType as N,CustomDataType as _}from"./model.js";const A=A=>{var w,R;const{appType:k,storeId:j,messageSource:D,setMessageSourcePanel:F,hideCloseButton:P,isSourceInfoFetched:U,allSourceInfoDetail:B,ChecklistType:M,title:K,zeroStateButton:H,editableSources:Q,preFillTrainingSourceCount:q,redirect:G,footerButtonOption:Y,fetchTrainingSourceCount:W,fetchProductFAQCount:$}=A,{sources:z}=D,X=["blog","article","page","policy"],[V,Z]=y(!1),[J,ee]=y(!1),[te,ie]=y(0),[oe,ne]=y(null!=q?q:{}),re={};[{key:"GENERIC",type:"neutral",tagText:"Generic"},{key:"STORE_INFORMATION",type:"blue",tagText:"Store information"},{key:"SHIPPING_POLICY",type:"positive",tagText:"Shipping policy"},{key:"RETURN_AND_REFUND",type:"purple",tagText:"Returns & refund policy"},{key:"CONTACT_INFO",type:"warning",tagText:"Contact details"},{key:"STORE_LOCATION",type:"grey",tagText:"Store location"},{key:"SALES_AND_OFFERS",type:"purple",tagText:"Offers & rewards"},{key:"PRODUCT_CUSTOMISATION",type:"blue",tagText:"Product customisation"},{key:"PRODUCT_DETAILS",type:"blue",tagText:"Product details"},{key:"PAYMENT_METHODS",type:"positive",tagText:"Payment methods"},{key:"ORDER_TRACKING",type:"warning",tagText:"Order tracking"},{key:"PRODUCT_SEARCH",type:"neutral",tagText:"Product search"},{key:"PURCHASE",type:"blue",tagText:"Purchase"},{key:"CONNECT_TO_AGENT",type:"purple",tagText:"Talk to a person"},{key:"CHECKOUT_ENQUIRY",type:"purple",tagText:"Checkout enquiry"},{key:"ORDER_CANCELLATION",type:"positive",tagText:"Order cancellation"},{key:"ORDER_ENQUIRY",type:"neutral",tagText:"Order enquiry"},{key:"ORDER_MODIFICATION",type:"blue",tagText:"Order modification"},{key:"SUBSCRIPTION_ENQUIRY",type:"warning",tagText:"Subscription enquiry"},{key:"SALES_AND_OFFERS_ISSUES",type:"grey",tagText:"Offer-related enquiries"},{key:"COLLABORATION",type:"positive",tagText:"Collaboration"},{key:"QUIZ_GENERATION",type:"warning",tagText:"Start the quiz"},{key:"SIMILAR_PRODUCT",type:"blue",tagText:"Similar Product"},{key:"EMAIL_COLLECTION",type:"warning",tagText:"Email Collection"},{key:"ADD_TO_CART_SUCCESS",type:"blue",tagText:"Add to Cart Success"},{key:"ADD_TO_CART_SUCCESS_MESSAGE",type:"blue",tagText:"Add to Cart Success Message"},{key:"FEEDBACK",type:"blue",tagText:"Feedback"},{key:"PHONE_NUMBER_COLLECTION",type:"blue",tagText:"Phone no. collection"}].forEach((t=>{let{key:i,type:o,tagText:n}=t;M[i]&&(re[M[i]]=e(O,{theme:"light",type:o,tagText:n,cursor:"pointer"}))}));const se=h((()=>{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=>{M[t]&&(e[M[t]]=M[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[M]);T((()=>{var e,t,i,o;if(!(null==D?void 0:D.messageId))return;Z(!0),ee(!1!==(null===(t=null===(e=D.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=D.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights));const n=D.sources.filter((e=>!!e.productId)).map((e=>e.productId)),r=Array.from(new Set(n)).filter((e=>!!e));$(j,r).then((e=>ie(e))).then((()=>{q?(ne(q),setTimeout((()=>Z(!1)),100)):W(j).then((e=>ne(e))).then((()=>{setTimeout((()=>Z(!1)),100)}))}))}),[$,W,null==D?void 0:D.messageId,D.sources,q,j]);const le=e=>!(0!==e.length&&!(null==D?void 0:D.isUnsatisfactoryAnswer)),ae=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=_.FILES:X.includes(e)?e=_.FETCHED_LINKS:"url"==e?e=_.WEBSITE_LINKS:"text"===e?e=_.TEXTS:"faq"===e&&(e=_.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},ce=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return V||!U?e(b,{children:e(v,{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"}]})}):e(t,{children:e(b,{children:i(t,{children:[i("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!K&&e(E,{children:K}),i("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e(x,Object.assign({color:m.content.secondary},{children:"Intent"})),null!==(w=re[D.intent])&&void 0!==w?w:re.GENERIC,!P&&e("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>F(void 0)},{children:e(n,{height:20,width:20,color:m.content.secondary})}))]})),le(z)?e("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,o;return i("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${m.background.negative.light}`,borderRadius:"100px"}},{children:e(a,{width:24,height:24,color:m.stroke.negative.vibrant})})),e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e(E,{children:"Insufficient data"})})),e(S,Object.assign({color:m.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"})),H&&e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(C,{LeadingIcon:null!==(t=H.leadingIcon)&&void 0!==t?t:d,buttonText:null!==(o=H.title)&&void 0!==o?o:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{H.onClick()}})}))]}))})()})):e(O,{LeadingIcon:a,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:D.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 ${k===N.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!le(z)&&e("div",Object.assign({className:"info-container"},{children:e("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:z.map(((n,a)=>{var d,y,h,T,C,v,O,E,L,b,N,A,w,R,k,j,D;const F=ae(n.type||n.subTitle||"OpenAI"),P=ae(n.type||n.subTitle||"OpenAI",!0),U=(K=F)?"faq"==K.toLocaleLowerCase()?"FAQ":"openai"==K.toLocaleLowerCase()?"OPENAI":"files"==K.toLocaleLowerCase()?"PDF":"texts"==K.toLocaleLowerCase()?"Custom text":((K=(K=K.charAt(0).toUpperCase()+K.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(K=K.slice(0,-1)),K.replace("Website","Manual")):"";var K;const H=null==Q?void 0:Q.includes(P),q="Products"===n.subTitle?B[null!==(d=n.productId)&&void 0!==d?d:"Products"]:B[null!==(y=n.docId)&&void 0!==y?y:""],Y=P.toLowerCase()===(null===(h=_.FAQ)||void 0===h?void 0:h.toLowerCase())?"faq"===(null===(T=n.title)||void 0===T?void 0:T.toLowerCase())?n.subTitle:n.title:P.toLowerCase()===(null===(C=_.FILES)||void 0===C?void 0:C.toLowerCase())||P.toLowerCase()===(null===(v=_.FETCHED_LINKS)||void 0===v?void 0:v.toLowerCase())||P.toLowerCase()===(null===(O=_.TEXTS)||void 0===O?void 0:O.toLowerCase())?n.title:P.toLowerCase()===(null===(E=_.WEBSITE_LINKS)||void 0===E?void 0:E.toLowerCase())?n.title.split("/")[n.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):n.intent===M.EMAIL_COLLECTION?U:n.title,W="faq"===P.toLowerCase()?null!==(N=null!==(L=null==q?void 0:q.content)&&void 0!==L?L:null===(b=null==q?void 0:q.data)||void 0===b?void 0:b.answer)&&void 0!==N?N:"":P.toLowerCase()===(null===(A=_.FETCHED_LINKS)||void 0===A?void 0:A.toLowerCase())||P.toLowerCase()===(null===(w=_.WEBSITE_LINKS)||void 0===w?void 0:w.toLowerCase())||P.toLowerCase()===(null===(R=_.TEXTS)||void 0===R?void 0:R.toLowerCase())?null!==(D=null!==(k=null==q?void 0:q.content)&&void 0!==k?k:null===(j=null==q?void 0:q.data)||void 0===j?void 0:j.fileContentText)&&void 0!==D?D:"":n.intent===M.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return i("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"24px 0px",borderBottom:`1px solid ${m.stroke.primary}`}},{children:[i("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e("div",Object.assign({style:{flex:1}},{children:e(f,Object.assign({body:Y,placement:"top"},{children:e(S,Object.assign({style:P==_.FETCHED_LINKS||P==_.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:m.content.primary,className:"clamp-title",onClick:()=>P==_.FETCHED_LINKS||P==_.WEBSITE_LINKS?G(n):{}},{children:Y}))}))})),i("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[n.intent!==M.EMAIL_COLLECTION&&i(t,{children:[($=F,e("products"==$||"product"==$?o:"files"==$?s:"website links"==$||"fetched links"==$?g:"faq"==$?l:"texts"==$?u:c,{height:16,width:16,color:m.content.secondary})),e(x,Object.assign({color:m.content.secondary},{children:U}))]}),(n.link||n.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:e(I,H?{Icon:r,height:16,width:16,bordered:!0,onClick:()=>null==q?void 0:q.onEditClick(q.data,q.type),disabled:!q,disabledTooltip:"This source is deleted"}:{Icon:p,height:16,width:16,bordered:!0,disabled:"custom"===n.type&&!q,disabledTooltip:"This source is deleted",onClick:()=>G(n)})}))]}))]})),(null!=W?W:"").trim()&&e("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${m.stroke.primary}`,borderRadius:"4px",backgroundColor:m.surface.subdued}},{children:e(x,Object.assign({color:m.content.primary,className:"clamp-description"},{children:ce(null!=W?W:"").trim()}))}))]}),`info-${a}`);var $}))}))})),J&&!le(z)&&e("div",Object.assign({className:"footer"},{children:e(L,{appType:k,storeId:j,messageSource:D,sourceIntent:null!==(R=D.intent)&&void 0!==R?R:M.GENERIC,faqCount:te,trainingSourceCount:oe,ShowTrainingDataSource:se,ChecklistType:M,footerButtonOption:Y})}))]})})})};export{A as DataSourcePanel};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as s}from"react/jsx-runtime";import n from"../../assets/icons/cross.svg.js";import o from"../../assets/icons/info.svg.js";import{format as i}from"date-fns";import{useState as r,useEffect as a}from"react";import{COLORS as l}from"../../constants/Theme.js";import{Avatar as c}from"../avatar/Avatar.js";import{SIZE as d,AVATAR_TYPES as p,AVATAR_BACKGROUND as y}from"../avatar/AvatarHelper.js";import{Button as h}from"../button/Button.js";import{AppType as m}from"../data-source-panel/model.js";import{StateComponent as f,StateInterface as g}from"../states/StateComponent.js";import"../../_virtual/_tslib.js";import{TitleRegular as u,BodySecondary as v,Caption as j}from"../TypographyStyle.js";import{UnsatisfactoryCountIntentWiseModal as b}from"./UnsatisfactoryCountIntentWiseModal.js";import{IncorrectRepliesStyle as I}from"./UnsatisfactoryResponseList.style.js";const w=w=>{const{storeId:C,appType:T,incorrectMessages:U,onIncorrectMessageBubbleClick:M,setShowIncorrectReplies:O,ChecklistType:R,IntentWiseUnsatisfactoryResponse:x,IntentHeaderTitle:k,redirectToUnsatisfactoryResponse:N,fetchUnsatisfactoryResponseCountIntentWise:S,fetchUnsatisfactoryResponseCount:A}=w,[W,L]=r(""),[D,E]=r((null==U?void 0:U.length)>0),[H,z]=r(!1);return a((()=>{!D&&A&&A().then((e=>{e>0&&E(!0),0===e&&O(!1)}))}),[]),e("div",Object.assign({style:{overflow:"scroll",height:"100%"}},{children:t(I,{children:[T==m.MANIFEST&&t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[t("div",Object.assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[e(u,{children:"Unsatisfactory responses"}),e("div",Object.assign({style:{cursor:"pointer"},onClick:()=>O(!1)},{children:e(n,{height:16,width:16,color:l.content.primary})}))]})),e(v,Object.assign({style:{color:l.content.secondary}},{children:"Spot unsatisfactory replies, dive deeper, and enhance with relevant data for improved responses."}))]})),!(null==U?void 0:U.length)&&e("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:e(f,{states:g.WARNING,heading:"No unsatisfactory responses",subline:"As of now, all responses are correct",isButtonEnabled:!1,width:0,size:d.SMALL,icon:e(c,{type:p.ICON,size:d.MEDIUM,background:y.LIGHT,icon:()=>e(o,{width:16,height:16,color:l.content.warning})})})})),(null==U?void 0:U.length)&&t(s,{children:[T==m.MANIFEST&&e("div",Object.assign({style:{display:"flex",width:"100%",justifyContent:(null==U?void 0:U.length)?"flex-start":"center"}},{children:e(h,{buttonText:"Fix all unsatisfactory responses",buttonType:"tertiary",size:"small",onClick:()=>{z(!0)},disabled:!D})})),e(b,{storeId:C,setShowUnsatisfactoryResponseModal:z,showUnsatisfactoryResponseModal:H,ChecklistType:R,UnsatisfactoryResponseIntentList:x,IntentHeaderTitle:k,fetchUnsatisfactoryResponseCountIntentWise:S,viewIntentWiseUnsatisfactoryResponse:N}),!!(null==U?void 0:U.length)&&e("div",Object.assign({className:"wrapper"},{children:U.map(((s,n)=>t("div",Object.assign({className:"bubble",onClick:()=>{M(s.messageId),L(s.messageId)},style:W===s.messageId?{backgroundColor:l.surface.hovered}:{}},{children:[e(v,Object.assign({style:{color:l.content.primary}},{children:s.message})),e("div",{children:t(j,Object.assign({style:{color:l.content.secondary}},{children:[i(new Date(null==s?void 0:s.date),"hh:mm a")," |"," ",i(new Date(null==s?void 0:s.date),"dd/MM/yyyy")]}))})]}),"incorrect-reply-"+n)))}))]})]})}))};export{w as UnsatisfactoryResponseList};
1
+ import{jsx as e,jsxs as t,Fragment as s}from"react/jsx-runtime";import n from"../../assets/icons/cross.svg.js";import o from"../../assets/icons/info.svg.js";import{format as i}from"date-fns";import{useState as r,useEffect as a}from"react";import{COLORS as l}from"../../constants/Theme.js";import{Avatar as c}from"../avatar/Avatar.js";import{SIZE as d,AVATAR_TYPES as p,AVATAR_BACKGROUND as y}from"../avatar/AvatarHelper.js";import{Button as h}from"../button/Button.js";import{AppType as m}from"../data-source-panel/model.js";import{StateComponent as f,StateInterface as g}from"../states/StateComponent.js";import"../../_virtual/_tslib.js";import{TitleRegular as u,BodySecondary as v,Caption as j}from"../TypographyStyle.js";import{UnsatisfactoryCountIntentWiseModal as b}from"./UnsatisfactoryCountIntentWiseModal.js";import{IncorrectRepliesStyle as I}from"./UnsatisfactoryResponseList.style.js";const w=w=>{const{storeId:C,appType:T,incorrectMessages:U,onIncorrectMessageBubbleClick:M,setShowIncorrectReplies:O,ChecklistType:R,IntentWiseUnsatisfactoryResponse:x,IntentHeaderTitle:k,redirectToUnsatisfactoryResponse:N,fetchUnsatisfactoryResponseCountIntentWise:S,fetchUnsatisfactoryResponseCount:A}=w,[W,L]=r(""),[D,E]=r((null==U?void 0:U.length)>0),[H,z]=r(!1);return a((()=>{!D&&A&&A().then((e=>{e>0&&E(!0),0===e&&O(!1)}))}),[]),e("div",Object.assign({style:{overflow:"scroll",height:"100%"}},{children:t(I,{children:[T==m.MANIFEST&&t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[t("div",Object.assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[e(u,{children:"Unsatisfactory responses"}),e("div",Object.assign({style:{cursor:"pointer"},onClick:()=>O(!1)},{children:e(n,{height:16,width:16,color:l.content.primary})}))]})),e(v,Object.assign({style:{color:l.content.secondary}},{children:"Spot unsatisfactory replies, dive deeper, and enhance with relevant data for improved responses."}))]})),!(null==U?void 0:U.length)&&e("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:e(f,{states:g.WARNING,heading:"No unsatisfactory responses",subline:"As of now, all responses are correct",isButtonEnabled:!1,width:0,size:d.SMALL,icon:e(c,{type:p.ICON,size:d.MEDIUM,background:y.LIGHT,icon:()=>e(o,{width:16,height:16,color:l.content.warning})})})})),!!(null==U?void 0:U.length)&&t(s,{children:[T==m.MANIFEST&&e("div",Object.assign({style:{display:"flex",width:"100%",justifyContent:(null==U?void 0:U.length)?"flex-start":"center"}},{children:e(h,{buttonText:"Fix all unsatisfactory responses",buttonType:"tertiary",size:"small",onClick:()=>{z(!0)},disabled:!D})})),e(b,{storeId:C,setShowUnsatisfactoryResponseModal:z,showUnsatisfactoryResponseModal:H,ChecklistType:R,UnsatisfactoryResponseIntentList:x,IntentHeaderTitle:k,fetchUnsatisfactoryResponseCountIntentWise:S,viewIntentWiseUnsatisfactoryResponse:N}),U&&(null==U?void 0:U.length)>0&&e("div",Object.assign({className:"wrapper"},{children:U.map(((s,n)=>t("div",Object.assign({className:"bubble",onClick:()=>{M(s.messageId),L(s.messageId)},style:W===s.messageId?{backgroundColor:l.surface.hovered}:{}},{children:[e(v,Object.assign({style:{color:l.content.primary}},{children:s.message})),e("div",{children:t(j,Object.assign({style:{color:l.content.secondary}},{children:[i(new Date(null==s?void 0:s.date),"hh:mm a")," |"," ",i(new Date(null==s?void 0:s.date),"dd/MM/yyyy")]}))})]}),"incorrect-reply-"+n)))}))]})]})}))};export{w as UnsatisfactoryResponseList};
@@ -1,11 +1,10 @@
1
1
  import o from"styled-components";import{COLORS as r}from"../../constants/Theme.js";const e=o.div`
2
2
  min-width: 100%;
3
3
  padding: 20px;
4
- display: block;
4
+ display: flex;
5
5
  flex-direction: column;
6
6
  gap: 16px;
7
- height: 95vh;
8
- position: absolute;
7
+ height: 100%;
9
8
  overflow-y: scroll;
10
9
  flex: 1 1 0;
11
10
  .wrapper {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.655-9",
3
+ "version": "0.0.655-beta.12",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",