@bikdotai/bik-component-library 0.0.679 → 0.0.680

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.
@@ -16,6 +16,7 @@ interface SourceInfoFooterProps {
16
16
  ShowTrainingDataSource: Record<string, string>;
17
17
  ChecklistType: Record<string, string>;
18
18
  footerButtonOption?: footerButtonOptionModel;
19
+ isFooterLoading?: boolean;
19
20
  }
20
21
  declare const SourceInfoFooter: import("react").MemoExoticComponent<(props: SourceInfoFooterProps) => import("react/jsx-runtime").JSX.Element>;
21
22
  export default SourceInfoFooter;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/alert_triangle.svg.js"),i=require("../../assets/icons/plus.svg.js"),o=require("react"),n=require("../../constants/Theme.js"),r=require("../button/Button.js"),d=require("../TypographyStyle.js"),a=require("./DataSourcePanel.style.js"),s=require("../../_virtual/bik-store.js");const l=o.memo((l=>{const{appType:c,sourceIntent:v,hideHeading:p,messageSource:g,trainingSourceCount:h={},ShowTrainingDataSource:m={},faqCount:T,ChecklistType:b,footerButtonOption:y}=l,A=m,[_,j]=o.useState(!0),[O,x]=o.useState(!0),C="/bik-ai/training",[f,I]=o.useState({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[F,R]=o.useState({title:"",subTitle:""}),S=o.useMemo((()=>{const e=(null==h?void 0:h[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`}),[h,v]),k=()=>{var e;(null==f?void 0:f.redirectUrl)?window.open(`${window.location.origin}${null==f?void 0:f.redirectUrl}`,"_self"):Object.keys(null!==(e=null==f?void 0:f.addFaqProps)&&void 0!==e?e:{}).length>0?null==y||y.onClick(f):(null==y?void 0:y.navigate)&&(null==y||y.navigate("Training",c==s.__exports.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return o.useEffect((()=>{var e,t,i,o;if(v){if(null===(e=null==g?void 0:g.sources)||void 0===e?void 0:e.length){const e=g.sources[0];if(A[v])v===b.ORDER_ENQUIRY&&x(!1);else{let n=null==e?void 0:e.insights,r="";switch(v){case b.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(n=`${T||"No"} FAQs added for this product`,r="Add product-specific information via FAQs to improve responses",I({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 b.ORDER_MODIFICATION:n=(null==h?void 0:h[v])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",n&&I({buttonTitle:c==s.__exports.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:c==s.__exports.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":C,addFaqProps:{}});break;case b.ORDER_CANCELLATION:n=(null==h?void 0:h[v])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",I({buttonTitle:c==s.__exports.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:c==s.__exports.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":C,addFaqProps:{}});break;case b.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;I({buttonTitle:c==s.__exports.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:c==s.__exports.ApplicationType.MANIFEST?"/training/order-management":C,addFaqProps:{}});break;case b.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(o=null===(i=null===(t=null==g?void 0:g.sources)||void 0===t?void 0:t[0])||void 0===i?void 0:i.title)||void 0===o?void 0:o.toLowerCase().indexOf("collection"))){n="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}n="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}R({title:null!=n?n:"",subTitle:r})}}(A[v]||[b.PRODUCT_DETAILS,b.ORDER_MODIFICATION,b.ORDER_CANCELLATION,b.ORDER_TRACKING].includes(v))&&j(!1)}}),[null==g?void 0:g.messageId,h,v,null==g?void 0:g.sources,A,b,T,c,g]),e.jsx(a.SourceInfoFooterStyle,{children:!(null==F?void 0:F.title)&&h&&v in h?e.jsxs(e.Fragment,{children:[e.jsx(u,{hideHeading:null!=p&&p}),e.jsxs("div",Object.assign({className:"source_info_details "+(h[v]>0?"":"no_data_source")},{children:[h[v]>0&&O?e.jsxs(e.Fragment,{children:[e.jsx(d.BodyCaption,{children:S}),e.jsx(d.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):O&&e.jsxs("div",Object.assign({className:"no_data_source_title"},{children:[e.jsx(t.default,{width:15,height:15,color:n.COLORS.content.negative,style:{marginTop:2}}),e.jsx(d.BodyCaption,{children:"No data sources added to the identified link"})]})),!y||y.hideAddDataButton||_?e.jsx(e.Fragment,{}):e.jsx(r.Button,{size:"small",buttonType:"tertiary",LeadingIcon:i.default,buttonText:(null==f?void 0:f.buttonTitle.length)>0?null==f?void 0:f.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>k(),style:{backgroundColor:"unset"}})]}))]}):e.jsxs(e.Fragment,{children:[e.jsx(u,{hideHeading:null!=p&&p}),e.jsxs("div",Object.assign({className:"source_info_details"},{children:[O&&e.jsxs(e.Fragment,{children:[e.jsx(d.BodyCaption,{children:null==F?void 0:F.title}),e.jsx(d.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:null==F?void 0:F.subTitle}))]}),!y||y.hideAddDataButton||_?e.jsx(e.Fragment,{}):e.jsx(r.Button,{size:"small",buttonType:"tertiary",LeadingIcon:i.default,buttonText:(null==f?void 0:f.buttonTitle.length)>0?null==f?void 0:f.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>k(),style:{backgroundColor:"unset"}})]}))]})})})),u=o.memo((t=>t.hideHeading?null:e.jsx(d.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Training insights"}))));u.displayName="TrainingInsightsHeading",l.displayName="SourceInfoFooter",exports.default=l;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/alert_triangle.svg.js"),i=require("../../assets/icons/plus.svg.js"),o=require("react"),n=require("../../constants/Theme.js"),r=require("../button/Button.js"),d=require("../shimmer/ShimmerComponent/BikShimmer.js"),a=require("../TypographyStyle.js"),s=require("./DataSourcePanel.style.js"),l=require("../../_virtual/bik-store.js");const u=o.memo((u=>{const{appType:p,sourceIntent:v,hideHeading:g,messageSource:h,trainingSourceCount:m={},ShowTrainingDataSource:T={},faqCount:b,ChecklistType:y,footerButtonOption:x,isFooterLoading:j}=u,A=T,[_,O]=o.useState(!0),[C,f]=o.useState(!0),I="/bik-ai/training",[F,S]=o.useState({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[k,R]=o.useState({title:"",subTitle:""}),N=o.useMemo((()=>{const e=(null==m?void 0:m[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`}),[m,v]),w=()=>{var e;(null==F?void 0:F.redirectUrl)?window.open(`${window.location.origin}${null==F?void 0:F.redirectUrl}`,"_self"):Object.keys(null!==(e=null==F?void 0:F.addFaqProps)&&void 0!==e?e:{}).length>0?null==x||x.onClick(F):(null==x?void 0:x.navigate)&&(null==x||x.navigate("Training",p==l.__exports.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return o.useEffect((()=>{var e,t,i,o;if(v){if(null===(e=null==h?void 0:h.sources)||void 0===e?void 0:e.length){const e=h.sources[0];if(A[v])v===y.ORDER_ENQUIRY&&f(!1);else{let n=null==e?void 0:e.insights,r="";switch(v){case y.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(n=`${b||"No"} FAQs added for this product`,r="Add product-specific information via FAQs to improve responses",S({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 y.ORDER_MODIFICATION:n=(null==m?void 0:m[v])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",n&&S({buttonTitle:p==l.__exports.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:p==l.__exports.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":I,addFaqProps:{}});break;case y.ORDER_CANCELLATION:n=(null==m?void 0:m[v])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",S({buttonTitle:p==l.__exports.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:p==l.__exports.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":I,addFaqProps:{}});break;case y.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;S({buttonTitle:p==l.__exports.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:p==l.__exports.ApplicationType.MANIFEST?"/training/order-management":I,addFaqProps:{}});break;case y.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(o=null===(i=null===(t=null==h?void 0:h.sources)||void 0===t?void 0:t[0])||void 0===i?void 0:i.title)||void 0===o?void 0:o.toLowerCase().indexOf("collection"))){n="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}n="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}R({title:null!=n?n:"",subTitle:r})}}(A[v]||[y.PRODUCT_DETAILS,y.ORDER_MODIFICATION,y.ORDER_CANCELLATION,y.ORDER_TRACKING].includes(v))&&O(!1)}}),[null==h?void 0:h.messageId,m,v,null==h?void 0:h.sources,A,y,b,p,h]),e.jsx(s.SourceInfoFooterStyle,{children:j?e.jsx(e.Fragment,{children:e.jsx(d.BikShimmer,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}):e.jsx(e.Fragment,{children:!(null==k?void 0:k.title)&&m&&v in m?e.jsxs(e.Fragment,{children:[e.jsx(c,{hideHeading:null!=g&&g}),e.jsxs("div",Object.assign({className:"source_info_details "+(m[v]>0?"":"no_data_source")},{children:[m[v]>0&&C?e.jsxs(e.Fragment,{children:[e.jsx(a.BodyCaption,{children:N}),e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):C&&e.jsxs("div",Object.assign({className:"no_data_source_title"},{children:[e.jsx(t.default,{width:15,height:15,color:n.COLORS.content.negative,style:{marginTop:2}}),e.jsx(a.BodyCaption,{children:"No data sources added to the identified link"})]})),!x||x.hideAddDataButton||_?e.jsx(e.Fragment,{}):e.jsx(r.Button,{size:"small",buttonType:"tertiary",LeadingIcon:i.default,buttonText:(null==F?void 0:F.buttonTitle.length)>0?null==F?void 0:F.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>w(),style:{backgroundColor:"unset"}})]}))]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{hideHeading:null!=g&&g}),e.jsxs("div",Object.assign({className:"source_info_details"},{children:[C&&e.jsxs(e.Fragment,{children:[e.jsx(a.BodyCaption,{children:null==k?void 0:k.title}),e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:null==k?void 0:k.subTitle}))]}),!x||x.hideAddDataButton||_?e.jsx(e.Fragment,{}):e.jsx(r.Button,{size:"small",buttonType:"tertiary",LeadingIcon:i.default,buttonText:(null==F?void 0:F.buttonTitle.length)>0?null==F?void 0:F.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>w(),style:{backgroundColor:"unset"}})]}))]})})})})),c=o.memo((t=>t.hideHeading?null:e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Training insights"}))));c.displayName="TrainingInsightsHeading",u.displayName="SourceInfoFooter",exports.default=u;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/boxV2.svg.js"),i=require("../../assets/icons/cross.svg.js"),s=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),l=require("../../assets/icons/info.svg.js"),a=require("../../assets/icons/openai.svg.js"),r=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"),h=require("../../constants/Theme.js"),g=require("../button/Button.js"),x=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),j=require("../side-modal/SideModal.js"),y=require("../tag/Tag.js"),m=require("../tooltips/Tooltip.js"),O=require("../TypographyStyle.js"),v=require("./DataSourceInfoFooter.js"),f=require("./DataSourcePanel.style.js"),S=require("./IntentConfig.js"),T=require("./Modals/DescriptionModal.js"),I=require("./model.js"),L=require("../../_virtual/bik-store.js");exports.DataSourcePanel=b=>{var E,w;const{appType:D,storeId:N,messageSource:R,setMessageSourcePanel:_,hideCloseButton:q,isSourceInfoFetched:B,allSourceInfoDetail:A,ChecklistType:k,title:F,zeroStateButton:P,editableSources:M,preFillTrainingSourceCount:U,redirect:K,footerButtonOption:W,fetchTrainingSourceCount:H,fetchProductFAQCount:$,productSourceData:Q}=b,{sources:Y}=R,G=["blog","article","page","policy"],[X,z]=p.useState(!1),[V,J]=p.useState(!1),[Z,ee]=p.useState(0),[te,ie]=p.useState(),[se,oe]=p.useState(null!=U?U:{}),ne={};S.intentConfig.forEach((t=>{let{key:i,type:s,tagText:o}=t;k[i]&&(ne[k[i]]=e.jsx(y.Tag,{theme:"light",type:s,tagText:o,cursor:"pointer"}))}));const le=Y.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),ae=Y.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),re=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=>{k[t]&&(e[k[t]]=k[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[k]);p.useEffect((()=>{var e,t,i,s;if(!(null==R?void 0:R.messageId))return;z(!0),J(!1!==(null===(t=null===(e=R.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(s=null===(i=R.sources)||void 0===i?void 0:i[0])||void 0===s?void 0:s.insights));const o=R.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));$(N,n).then((e=>ee(e))).then((()=>{U?(oe(U),setTimeout((()=>z(!1)),100)):H(N).then((e=>oe(e))).then((()=>{setTimeout((()=>z(!1)),100)}))}))}),[$,H,null==R?void 0:R.messageId,R.sources,U,N]);const de=e=>!!(e&&0===e.length||(null==R?void 0:R.isUnsatisfactoryAnswer)),ce=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=I.CustomDataType.FILES:G.includes(e)?e=I.CustomDataType.FETCHED_LINKS:"url"==e?e=I.CustomDataType.WEBSITE_LINKS:"text"===e?e=I.CustomDataType.TEXTS:"faq"===e&&(e=I.CustomDataType.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},ue=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")):"",pe=i=>"products"==i||"product"==i?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==i?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==i||"fetched links"==i?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==i?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==i?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary}),he=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return X||!B?e.jsx(f.SourceInfoDetailsStyle,{children:e.jsx(C.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.jsxs(e.Fragment,{children:[e.jsx(f.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!F&&e.jsx(O.TitleSmall,{children:F}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(E=ne[R.intent])&&void 0!==E?E:ne.GENERIC,!q&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>_(void 0)},{children:e.jsx(i.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),de(Y)?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:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(l.default,{width:24,height:24,color:h.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:h.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"})),P&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=P.leadingIcon)&&void 0!==t?t:r.default,buttonText:null!==(i=P.title)&&void 0!==i?i:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{P.onClick()}})}))]}))})()})):e.jsx(y.Tag,{LeadingIcon:l.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:R.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 ${D===L.__exports.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!de(Y)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[le.length>0&&e.jsxs("div",Object.assign({className:"info-product-source"},{children:[e.jsx(O.BodyCaption,{children:"Product Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:le.map(((t,i)=>{var o,n,l,a;const r=ce(t.type||t.subTitle||"OpenAI"),c=ce(t.type||t.subTitle||"OpenAI",!0),u=ue(r),p=null==M?void 0:M.includes(c),g=A[null!==(o=t.productId)&&void 0!==o?o:"Products"],C=t.title,j=t.productId&&(null==Q?void 0:Q[t.productId]),y=j&&j.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:i+1<(null==le?void 0:le.length)?`1px solid ${h.COLORS.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:[pe(r),e.jsx(m.Tooltip,Object.assign({body:C,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?K(t):{}},{children:C}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==k.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:u}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==g?void 0:g.onEditClick(g.data,g.type),disabled:!g,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!g,disabledTooltip:"This source is deleted",onClick:()=>K(t)})}))]}))]})),j&&e.jsxs(O.BodyCaption,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;ie({title:C,description:he(j.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>ie(void 0)})}},{children:`${null===(n=j.description)||void 0===n?void 0:n.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>j.onEditFaqClick(j.faqs)},{children:`${null===(l=j.faqs)||void 0===l?void 0:l.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(m.Tooltip,Object.assign({body:y,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(a=j.metafield)||void 0===a?void 0:a.length} metafields`}))}))]})]}),`info-${i}`)}))}))]})),ae.length>0&&e.jsxs("div",Object.assign({className:"info-content-source"},{children:[e.jsx(O.BodyCaption,{children:"Content Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:ae.map(((t,i)=>{var o,n,l,a,r,c,u,p,g,C,j,y,v,f,S,T,L;const b=ce(t.type||t.subTitle||"OpenAI"),E=ce(t.type||t.subTitle||"OpenAI",!0),w=ue(b),D=null==M?void 0:M.includes(E),N="Products"===t.subTitle?A[null!==(o=t.productId)&&void 0!==o?o:"Products"]:A[null!==(n=t.docId)&&void 0!==n?n:""],R=E.toLowerCase()===(null===(l=I.CustomDataType.FAQ)||void 0===l?void 0:l.toLowerCase())?"faq"===(null===(a=t.title)||void 0===a?void 0:a.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(r=I.CustomDataType.FILES)||void 0===r?void 0:r.toLowerCase())||E.toLowerCase()===(null===(c=I.CustomDataType.FETCHED_LINKS)||void 0===c?void 0:c.toLowerCase())||E.toLowerCase()===(null===(u=I.CustomDataType.TEXTS)||void 0===u?void 0:u.toLowerCase())?t.title:E.toLowerCase()===(null===(p=I.CustomDataType.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):t.intent===k.EMAIL_COLLECTION?w:t.title,_="faq"===E.toLowerCase()?null!==(j=null!==(g=null==N?void 0:N.content)&&void 0!==g?g:null===(C=null==N?void 0:N.data)||void 0===C?void 0:C.answer)&&void 0!==j?j:"":E.toLowerCase()===(null===(y=I.CustomDataType.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||E.toLowerCase()===(null===(v=I.CustomDataType.WEBSITE_LINKS)||void 0===v?void 0:v.toLowerCase())||E.toLowerCase()===(null===(f=I.CustomDataType.TEXTS)||void 0===f?void 0:f.toLowerCase())?null!==(L=null!==(S=null==N?void 0:N.content)&&void 0!==S?S:null===(T=null==N?void 0:N.data)||void 0===T?void 0:T.fileContentText)&&void 0!==L?L:"":t.intent===k.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:i+1<(null==ae?void 0:ae.length)?`1px solid ${h.COLORS.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:[pe(b),e.jsx(m.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?K(t):{}},{children:R}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==k.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:w}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:D?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==N?void 0:N.onEditClick(N.data,N.type),disabled:!N,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!N,disabledTooltip:"This source is deleted",onClick:()=>K(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:he(null!=_?_:"").trim()}))}))]}),`info-${i}`)}))}))]}))]})),V&&!de(Y)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(v.default,{appType:D,storeId:N,messageSource:R,sourceIntent:null!==(w=R.intent)&&void 0!==w?w:k.GENERIC,faqCount:Z,trainingSourceCount:se,ShowTrainingDataSource:re,ChecklistType:k,footerButtonOption:W})}))]})}),te&&e.jsx(j.SideModal,Object.assign({header:"Product description",onClose:()=>ie(void 0),width:"30%"},{children:e.jsx(T.DescriptionModal,{title:te.title,description:te.description,imageUrl:te.imageUrl,onClose:te.onClose})}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/boxV2.svg.js"),i=require("../../assets/icons/cross.svg.js"),s=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),l=require("../../assets/icons/info.svg.js"),a=require("../../assets/icons/openai.svg.js"),r=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"),h=require("../../constants/Theme.js"),g=require("../button/Button.js"),x=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),j=require("../side-modal/SideModal.js"),y=require("../tag/Tag.js"),m=require("../tooltips/Tooltip.js"),O=require("../TypographyStyle.js"),v=require("./DataSourceInfoFooter.js"),f=require("./DataSourcePanel.style.js"),S=require("./IntentConfig.js"),T=require("./Modals/DescriptionModal.js"),I=require("./model.js"),L=require("../../_virtual/bik-store.js");exports.DataSourcePanel=b=>{var E,w;const{appType:D,storeId:N,messageSource:R,setMessageSourcePanel:_,hideCloseButton:q,isSourceInfoFetched:B,allSourceInfoDetail:A,ChecklistType:k,title:F,zeroStateButton:P,editableSources:M,preFillTrainingSourceCount:U,redirect:K,footerButtonOption:W,fetchTrainingSourceCount:H,fetchProductFAQCount:$,productSourceData:Q}=b,{sources:Y}=R,G=["blog","article","page","policy"],[X,z]=p.useState(!1),[V,J]=p.useState(!1),[Z,ee]=p.useState(!1),[te,ie]=p.useState(0),[se,oe]=p.useState(),[ne,le]=p.useState(null!=U?U:{}),ae={};S.intentConfig.forEach((t=>{let{key:i,type:s,tagText:o}=t;k[i]&&(ae[k[i]]=e.jsx(y.Tag,{theme:"light",type:s,tagText:o,cursor:"pointer"}))}));const re=Y.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),de=Y.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),ce=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=>{k[t]&&(e[k[t]]=k[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[k]);p.useEffect((()=>{var e,t,i,s;if(!(null==R?void 0:R.messageId))return;z(!0),J(!0),ee(!1!==(null===(t=null===(e=R.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(s=null===(i=R.sources)||void 0===i?void 0:i[0])||void 0===s?void 0:s.insights));const o=R.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));$(N,n).then((e=>ie(e))).then((()=>{U?(le(U),setTimeout((()=>{z(!1),J(!1)}),100)):(setTimeout((()=>z(!1)),100),H(N).then((e=>le(e))).then((()=>setTimeout((()=>{J(!1)}),100))))}))}),[$,H,null==R?void 0:R.messageId,R.sources,U,N]);const ue=e=>!!(e&&0===e.length||(null==R?void 0:R.isUnsatisfactoryAnswer)),pe=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=I.CustomDataType.FILES:G.includes(e)?e=I.CustomDataType.FETCHED_LINKS:"url"==e?e=I.CustomDataType.WEBSITE_LINKS:"text"===e?e=I.CustomDataType.TEXTS:"faq"===e&&(e=I.CustomDataType.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},he=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")):"",ge=i=>"products"==i||"product"==i?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==i?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==i||"fetched links"==i?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==i?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==i?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary}),xe=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return X||!B?e.jsx(f.SourceInfoDetailsStyle,{children:e.jsx(C.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.jsxs(e.Fragment,{children:[e.jsx(f.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!F&&e.jsx(O.TitleSmall,{children:F}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(E=ae[R.intent])&&void 0!==E?E:ae.GENERIC,!q&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>_(void 0)},{children:e.jsx(i.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),ue(Y)?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:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(l.default,{width:24,height:24,color:h.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:h.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"})),P&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=P.leadingIcon)&&void 0!==t?t:r.default,buttonText:null!==(i=P.title)&&void 0!==i?i:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{P.onClick()}})}))]}))})()})):e.jsx(y.Tag,{LeadingIcon:l.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:R.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 ${D===L.__exports.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!ue(Y)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[re.length>0&&e.jsxs("div",Object.assign({className:"info-product-source"},{children:[e.jsx(O.BodyCaption,{children:"Product Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:re.map(((t,i)=>{var o,n,l,a;const r=pe(t.type||t.subTitle||"OpenAI"),c=pe(t.type||t.subTitle||"OpenAI",!0),u=he(r),p=null==M?void 0:M.includes(c),g=A[null!==(o=t.productId)&&void 0!==o?o:"Products"],C=t.title,j=t.productId&&(null==Q?void 0:Q[t.productId]),y=j&&j.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:i+1<(null==re?void 0:re.length)?`1px solid ${h.COLORS.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:[ge(r),e.jsx(m.Tooltip,Object.assign({body:C,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?K(t):{}},{children:C}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==k.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:u}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==g?void 0:g.onEditClick(g.data,g.type),disabled:!g,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!g,disabledTooltip:"This source is deleted",onClick:()=>K(t)})}))]}))]})),j&&e.jsxs(O.BodyCaption,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;oe({title:C,description:xe(j.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>oe(void 0)})}},{children:`${null===(n=j.description)||void 0===n?void 0:n.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>j.onEditFaqClick(j.faqs)},{children:`${null===(l=j.faqs)||void 0===l?void 0:l.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(m.Tooltip,Object.assign({body:y,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(a=j.metafield)||void 0===a?void 0:a.length} metafields`}))}))]})]}),`info-${i}`)}))}))]})),de.length>0&&e.jsxs("div",Object.assign({className:"info-content-source"},{children:[e.jsx(O.BodyCaption,{children:"Content Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:de.map(((t,i)=>{var o,n,l,a,r,c,u,p,g,C,j,y,v,f,S,T,L;const b=pe(t.type||t.subTitle||"OpenAI"),E=pe(t.type||t.subTitle||"OpenAI",!0),w=he(b),D=null==M?void 0:M.includes(E),N="Products"===t.subTitle?A[null!==(o=t.productId)&&void 0!==o?o:"Products"]:A[null!==(n=t.docId)&&void 0!==n?n:""],R=E.toLowerCase()===(null===(l=I.CustomDataType.FAQ)||void 0===l?void 0:l.toLowerCase())?"faq"===(null===(a=t.title)||void 0===a?void 0:a.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(r=I.CustomDataType.FILES)||void 0===r?void 0:r.toLowerCase())||E.toLowerCase()===(null===(c=I.CustomDataType.FETCHED_LINKS)||void 0===c?void 0:c.toLowerCase())||E.toLowerCase()===(null===(u=I.CustomDataType.TEXTS)||void 0===u?void 0:u.toLowerCase())?t.title:E.toLowerCase()===(null===(p=I.CustomDataType.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):t.intent===k.EMAIL_COLLECTION?w:t.title,_="faq"===E.toLowerCase()?null!==(j=null!==(g=null==N?void 0:N.content)&&void 0!==g?g:null===(C=null==N?void 0:N.data)||void 0===C?void 0:C.answer)&&void 0!==j?j:"":E.toLowerCase()===(null===(y=I.CustomDataType.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||E.toLowerCase()===(null===(v=I.CustomDataType.WEBSITE_LINKS)||void 0===v?void 0:v.toLowerCase())||E.toLowerCase()===(null===(f=I.CustomDataType.TEXTS)||void 0===f?void 0:f.toLowerCase())?null!==(L=null!==(S=null==N?void 0:N.content)&&void 0!==S?S:null===(T=null==N?void 0:N.data)||void 0===T?void 0:T.fileContentText)&&void 0!==L?L:"":t.intent===k.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:i+1<(null==de?void 0:de.length)?`1px solid ${h.COLORS.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:[ge(b),e.jsx(m.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?K(t):{}},{children:R}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==k.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:w}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:D?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==N?void 0:N.onEditClick(N.data,N.type),disabled:!N,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!N,disabledTooltip:"This source is deleted",onClick:()=>K(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:xe(null!=_?_:"").trim()}))}))]}),`info-${i}`)}))}))]}))]})),Z&&!ue(Y)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(v.default,{appType:D,storeId:N,messageSource:R,sourceIntent:null!==(w=R.intent)&&void 0!==w?w:k.GENERIC,faqCount:te,trainingSourceCount:ne,ShowTrainingDataSource:ce,ChecklistType:k,footerButtonOption:W,isFooterLoading:V})}))]})}),se&&e.jsx(j.SideModal,Object.assign({header:"Product description",onClose:()=>oe(void 0),width:"30%"},{children:e.jsx(T.DescriptionModal,{title:se.title,description:se.description,imageUrl:se.imageUrl,onClose:se.onClose})}))]})};
@@ -16,6 +16,7 @@ interface SourceInfoFooterProps {
16
16
  ShowTrainingDataSource: Record<string, string>;
17
17
  ChecklistType: Record<string, string>;
18
18
  footerButtonOption?: footerButtonOptionModel;
19
+ isFooterLoading?: boolean;
19
20
  }
20
21
  declare const SourceInfoFooter: import("react").MemoExoticComponent<(props: SourceInfoFooterProps) => import("react/jsx-runtime").JSX.Element>;
21
22
  export default SourceInfoFooter;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import o from"../../assets/icons/alert_triangle.svg.js";import n from"../../assets/icons/plus.svg.js";import{memo as d,useState as r,useMemo as a,useEffect as l}from"react";import{COLORS as s}from"../../constants/Theme.js";import{Button as c}from"../button/Button.js";import{BodyCaption as u}from"../TypographyStyle.js";import{SourceInfoFooterStyle as v}from"./DataSourcePanel.style.js";import{__exports as p}from"../../_virtual/bik-store.js";const g=d((d=>{const{appType:g,sourceIntent:m,hideHeading:T,messageSource:b,trainingSourceCount:A={},ShowTrainingDataSource:y={},faqCount:f,ChecklistType:I,footerButtonOption:O}=d,_=y,[k,N]=r(!0),[C,R]=r(!0),E="/bik-ai/training",[w,D]=r({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[F,S]=r({title:"",subTitle:""}),j=a((()=>{const e=(null==A?void 0:A[m])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[A,m]),P=()=>{var e;(null==w?void 0:w.redirectUrl)?window.open(`${window.location.origin}${null==w?void 0:w.redirectUrl}`,"_self"):Object.keys(null!==(e=null==w?void 0:w.addFaqProps)&&void 0!==e?e:{}).length>0?null==O||O.onClick(w):(null==O?void 0:O.navigate)&&(null==O||O.navigate("Training",g==p.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return l((()=>{var e,t,i,o;if(m){if(null===(e=null==b?void 0:b.sources)||void 0===e?void 0:e.length){const e=b.sources[0];if(_[m])m===I.ORDER_ENQUIRY&&R(!1);else{let n=null==e?void 0:e.insights,d="";switch(m){case I.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(n=`${f||"No"} FAQs added for this product`,d="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 I.ORDER_MODIFICATION:n=(null==A?void 0:A[m])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",n&&D({buttonTitle:g==p.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:g==p.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":E,addFaqProps:{}});break;case I.ORDER_CANCELLATION:n=(null==A?void 0:A[m])?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==p.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:g==p.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":E,addFaqProps:{}});break;case I.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;D({buttonTitle:g==p.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:g==p.ApplicationType.MANIFEST?"/training/order-management":E,addFaqProps:{}});break;case I.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(o=null===(i=null===(t=null==b?void 0:b.sources)||void 0===t?void 0:t[0])||void 0===i?void 0:i.title)||void 0===o?void 0:o.toLowerCase().indexOf("collection"))){n="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}n="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}S({title:null!=n?n:"",subTitle:d})}}(_[m]||[I.PRODUCT_DETAILS,I.ORDER_MODIFICATION,I.ORDER_CANCELLATION,I.ORDER_TRACKING].includes(m))&&N(!1)}}),[null==b?void 0:b.messageId,A,m,null==b?void 0:b.sources,_,I,f,g,b]),e(v,{children:!(null==F?void 0:F.title)&&A&&m in A?t(i,{children:[e(h,{hideHeading:null!=T&&T}),t("div",Object.assign({className:"source_info_details "+(A[m]>0?"":"no_data_source")},{children:[A[m]>0&&C?t(i,{children:[e(u,{children:j}),e(u,Object.assign({color:s.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):C&&t("div",Object.assign({className:"no_data_source_title"},{children:[e(o,{width:15,height:15,color:s.content.negative,style:{marginTop:2}}),e(u,{children:"No data sources added to the identified link"})]})),!O||O.hideAddDataButton||k?e(i,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==w?void 0:w.buttonTitle.length)>0?null==w?void 0:w.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>P(),style:{backgroundColor:"unset"}})]}))]}):t(i,{children:[e(h,{hideHeading:null!=T&&T}),t("div",Object.assign({className:"source_info_details"},{children:[C&&t(i,{children:[e(u,{children:null==F?void 0:F.title}),e(u,Object.assign({color:s.content.secondary},{children:null==F?void 0:F.subTitle}))]}),!O||O.hideAddDataButton||k?e(i,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==w?void 0:w.buttonTitle.length)>0?null==w?void 0:w.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>P(),style:{backgroundColor:"unset"}})]}))]})})})),h=d((t=>t.hideHeading?null:e(u,Object.assign({color:s.content.secondary},{children:"Training insights"}))));h.displayName="TrainingInsightsHeading",g.displayName="SourceInfoFooter";export{g as default};
1
+ import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import o from"../../assets/icons/alert_triangle.svg.js";import n from"../../assets/icons/plus.svg.js";import{memo as r,useState as d,useMemo as l,useEffect as a}from"react";import{COLORS as s}from"../../constants/Theme.js";import{Button as c}from"../button/Button.js";import{BikShimmer as u}from"../shimmer/ShimmerComponent/BikShimmer.js";import{BodyCaption as p}from"../TypographyStyle.js";import{SourceInfoFooterStyle as v}from"./DataSourcePanel.style.js";import{__exports as h}from"../../_virtual/bik-store.js";const m=r((r=>{const{appType:m,sourceIntent:T,hideHeading:b,messageSource:A,trainingSourceCount:y={},ShowTrainingDataSource:f={},faqCount:I,ChecklistType:O,footerButtonOption:_,isFooterLoading:k}=r,C=f,[N,R]=d(!0),[w,E]=d(!0),F="/bik-ai/training",[D,S]=d({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[j,P]=d({title:"",subTitle:""}),U=l((()=>{const e=(null==y?void 0:y[T])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[y,T]),x=()=>{var e;(null==D?void 0:D.redirectUrl)?window.open(`${window.location.origin}${null==D?void 0:D.redirectUrl}`,"_self"):Object.keys(null!==(e=null==D?void 0:D.addFaqProps)&&void 0!==e?e:{}).length>0?null==_||_.onClick(D):(null==_?void 0:_.navigate)&&(null==_||_.navigate("Training",m==h.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return a((()=>{var e,t,i,o;if(T){if(null===(e=null==A?void 0:A.sources)||void 0===e?void 0:e.length){const e=A.sources[0];if(C[T])T===O.ORDER_ENQUIRY&&E(!1);else{let n=null==e?void 0:e.insights,r="";switch(T){case O.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(n=`${I||"No"} FAQs added for this product`,r="Add product-specific information via FAQs to improve responses",S({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 O.ORDER_MODIFICATION:n=(null==y?void 0:y[T])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",n&&S({buttonTitle:m==h.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:m==h.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":F,addFaqProps:{}});break;case O.ORDER_CANCELLATION:n=(null==y?void 0:y[T])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",S({buttonTitle:m==h.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:m==h.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":F,addFaqProps:{}});break;case O.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;S({buttonTitle:m==h.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:m==h.ApplicationType.MANIFEST?"/training/order-management":F,addFaqProps:{}});break;case O.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(o=null===(i=null===(t=null==A?void 0:A.sources)||void 0===t?void 0:t[0])||void 0===i?void 0:i.title)||void 0===o?void 0:o.toLowerCase().indexOf("collection"))){n="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}n="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}P({title:null!=n?n:"",subTitle:r})}}(C[T]||[O.PRODUCT_DETAILS,O.ORDER_MODIFICATION,O.ORDER_CANCELLATION,O.ORDER_TRACKING].includes(T))&&R(!1)}}),[null==A?void 0:A.messageId,y,T,null==A?void 0:A.sources,C,O,I,m,A]),e(v,{children:e(t,k?{children:e(u,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}:{children:!(null==j?void 0:j.title)&&y&&T in y?i(t,{children:[e(g,{hideHeading:null!=b&&b}),i("div",Object.assign({className:"source_info_details "+(y[T]>0?"":"no_data_source")},{children:[y[T]>0&&w?i(t,{children:[e(p,{children:U}),e(p,Object.assign({color:s.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):w&&i("div",Object.assign({className:"no_data_source_title"},{children:[e(o,{width:15,height:15,color:s.content.negative,style:{marginTop:2}}),e(p,{children:"No data sources added to the identified link"})]})),!_||_.hideAddDataButton||N?e(t,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==D?void 0:D.buttonTitle.length)>0?null==D?void 0:D.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>x(),style:{backgroundColor:"unset"}})]}))]}):i(t,{children:[e(g,{hideHeading:null!=b&&b}),i("div",Object.assign({className:"source_info_details"},{children:[w&&i(t,{children:[e(p,{children:null==j?void 0:j.title}),e(p,Object.assign({color:s.content.secondary},{children:null==j?void 0:j.subTitle}))]}),!_||_.hideAddDataButton||N?e(t,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==D?void 0:D.buttonTitle.length)>0?null==D?void 0:D.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>x(),style:{backgroundColor:"unset"}})]}))]})})})})),g=r((t=>t.hideHeading?null:e(p,Object.assign({color:s.content.secondary},{children:"Training insights"}))));g.displayName="TrainingInsightsHeading",m.displayName="SourceInfoFooter";export{m as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import o from"../../assets/icons/boxV2.svg.js";import n from"../../assets/icons/cross.svg.js";import s from"../../assets/icons/edit.svg.js";import l from"../../assets/icons/filePdf.svg.js";import r 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 h,useMemo as m,useEffect as f}from"react";import{COLORS as v}from"../../constants/Theme.js";import{Button as y}from"../button/Button.js";import{IconButton as C}from"../icon-button/IconButton.js";import{BikShimmer as x}from"../shimmer/ShimmerComponent/BikShimmer.js";import{SideModal as I}from"../side-modal/SideModal.js";import{Tag as b}from"../tag/Tag.js";import{Tooltip as j}from"../tooltips/Tooltip.js";import{TitleSmall as T,BodyCaption as O,BodySecondary as E}from"../TypographyStyle.js";import L from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as S}from"./DataSourcePanel.style.js";import{intentConfig as w}from"./IntentConfig.js";import{DescriptionModal as N}from"./Modals/DescriptionModal.js";import{CustomDataType as _}from"./model.js";import{__exports as A}from"../../_virtual/bik-store.js";const D=D=>{var k,F;const{appType:P,storeId:B,messageSource:R,setMessageSourcePanel:U,hideCloseButton:K,isSourceInfoFetched:M,allSourceInfoDetail:W,ChecklistType:H,title:$,zeroStateButton:q,editableSources:Q,preFillTrainingSourceCount:Y,redirect:G,footerButtonOption:X,fetchTrainingSourceCount:z,fetchProductFAQCount:V,productSourceData:J}=D,{sources:Z}=R,ee=["blog","article","page","policy"],[te,ie]=h(!1),[oe,ne]=h(!1),[se,le]=h(0),[re,ae]=h(),[ce,de]=h(null!=Y?Y:{}),pe={};w.forEach((t=>{let{key:i,type:o,tagText:n}=t;H[i]&&(pe[H[i]]=e(b,{theme:"light",type:o,tagText:n,cursor:"pointer"}))}));const ue=Z.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),ge=Z.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),he=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,i,o;if(!(null==R?void 0:R.messageId))return;ie(!0),ne(!1!==(null===(t=null===(e=R.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=R.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights));const n=R.sources.filter((e=>!!e.productId)).map((e=>e.productId)),s=Array.from(new Set(n)).filter((e=>!!e));V(B,s).then((e=>le(e))).then((()=>{Y?(de(Y),setTimeout((()=>ie(!1)),100)):z(B).then((e=>de(e))).then((()=>{setTimeout((()=>ie(!1)),100)}))}))}),[V,z,null==R?void 0:R.messageId,R.sources,Y,B]);const me=e=>!!(e&&0===e.length||(null==R?void 0:R.isUnsatisfactoryAnswer)),fe=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=_.FILES:ee.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," ")},ve=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")):"",ye=t=>e("products"==t||"product"==t?o:"files"==t?l:"website links"==t||"fetched links"==t?g:"faq"==t?r:"texts"==t?u:c,{height:16,width:16,color:v.content.secondary}),Ce=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return te||!M?e(S,{children:e(x,{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"}]})}):t(i,{children:[e(S,{children:t(i,{children:[t("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!$&&e(T,{children:$}),t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e(O,Object.assign({color:v.content.secondary},{children:"Intent"})),null!==(k=pe[R.intent])&&void 0!==k?k:pe.GENERIC,!K&&e("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>U(void 0)},{children:e(n,{height:20,width:20,color:v.content.secondary})}))]})),me(Z)?e("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var i,o;return t("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:`${v.background.negative.light}`,borderRadius:"100px"}},{children:e(a,{width:24,height:24,color:v.stroke.negative.vibrant})})),e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e(T,{children:"Insufficient data"})})),e(E,Object.assign({color:v.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("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(y,{LeadingIcon:null!==(i=q.leadingIcon)&&void 0!==i?i:d,buttonText:null!==(o=q.title)&&void 0!==o?o:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{q.onClick()}})}))]}))})()})):e(b,{LeadingIcon:a,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:R.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===A.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!me(Z)&&t("div",Object.assign({className:"info-container"},{children:[ue.length>0&&t("div",Object.assign({className:"info-product-source"},{children:[e(O,{children:"Product Source"}),e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:ue.map(((o,n)=>{var l,r,a,c;const d=fe(o.type||o.subTitle||"OpenAI"),u=fe(o.type||o.subTitle||"OpenAI",!0),g=ve(d),h=null==Q?void 0:Q.includes(u),m=W[null!==(l=o.productId)&&void 0!==l?l:"Products"],f=o.title,y=o.productId&&(null==J?void 0:J[o.productId]),x=y&&y.metafield.join(", ");return t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:n+1<(null==ue?void 0:ue.length)?`1px solid ${v.stroke.primary}`:"none"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[ye(d),e(j,Object.assign({body:f,placement:"top"},{children:e(E,Object.assign({style:u==_.FETCHED_LINKS||u==_.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:v.content.primary,className:"clamp-title",onClick:()=>u==_.FETCHED_LINKS||u==_.WEBSITE_LINKS?G(o):{}},{children:f}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==H.EMAIL_COLLECTION&&e(i,{children:e(O,Object.assign({color:v.content.secondary},{children:g}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(C,h?{Icon:s,height:16,width:16,iconColor:v.content.secondary,onClick:()=>null==m?void 0:m.onEditClick(m.data,m.type),disabled:!m,disabledTooltip:"This source is deleted"}:{Icon:p,height:16,width:16,iconColor:v.content.secondary,disabled:"custom"===o.type&&!m,disabledTooltip:"This source is deleted",onClick:()=>G(o)})}))]}))]})),y&&t(O,{children:[e("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;ae({title:f,description:Ce(y.description),imageUrl:null!==(e=o.imageUrl)&&void 0!==e?e:"",onClose:()=>ae(void 0)})}},{children:`${null===(r=y.description)||void 0===r?void 0:r.length} characters description,`})),e("span",Object.assign({className:"product-data-text1",onClick:()=>y.onEditFaqClick(y.faqs)},{children:`${null===(a=y.faqs)||void 0===a?void 0:a.length} FAQs, `})),e("span",Object.assign({className:"product-data-text2"},{children:"and"})),e(j,Object.assign({body:x,placement:"top"},{children:e("span",Object.assign({className:"product-data-text1"},{children:`${null===(c=y.metafield)||void 0===c?void 0:c.length} metafields`}))}))]})]}),`info-${n}`)}))}))]})),ge.length>0&&t("div",Object.assign({className:"info-content-source"},{children:[e(O,{children:"Content Source"}),e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:ge.map(((o,n)=>{var l,r,a,c,d,u,g,h,m,f,y,x,I,b,T,L,S;const w=fe(o.type||o.subTitle||"OpenAI"),N=fe(o.type||o.subTitle||"OpenAI",!0),A=ve(w),D=null==Q?void 0:Q.includes(N),k="Products"===o.subTitle?W[null!==(l=o.productId)&&void 0!==l?l:"Products"]:W[null!==(r=o.docId)&&void 0!==r?r:""],F=N.toLowerCase()===(null===(a=_.FAQ)||void 0===a?void 0:a.toLowerCase())?"faq"===(null===(c=o.title)||void 0===c?void 0:c.toLowerCase())?o.subTitle:o.title:N.toLowerCase()===(null===(d=_.FILES)||void 0===d?void 0:d.toLowerCase())||N.toLowerCase()===(null===(u=_.FETCHED_LINKS)||void 0===u?void 0:u.toLowerCase())||N.toLowerCase()===(null===(g=_.TEXTS)||void 0===g?void 0:g.toLowerCase())?o.title:N.toLowerCase()===(null===(h=_.WEBSITE_LINKS)||void 0===h?void 0:h.toLowerCase())?o.title.split("/")[o.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):o.intent===H.EMAIL_COLLECTION?A:o.title,P="faq"===N.toLowerCase()?null!==(y=null!==(m=null==k?void 0:k.content)&&void 0!==m?m:null===(f=null==k?void 0:k.data)||void 0===f?void 0:f.answer)&&void 0!==y?y:"":N.toLowerCase()===(null===(x=_.FETCHED_LINKS)||void 0===x?void 0:x.toLowerCase())||N.toLowerCase()===(null===(I=_.WEBSITE_LINKS)||void 0===I?void 0:I.toLowerCase())||N.toLowerCase()===(null===(b=_.TEXTS)||void 0===b?void 0:b.toLowerCase())?null!==(S=null!==(T=null==k?void 0:k.content)&&void 0!==T?T:null===(L=null==k?void 0:k.data)||void 0===L?void 0:L.fileContentText)&&void 0!==S?S:"":o.intent===H.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:n+1<(null==ge?void 0:ge.length)?`1px solid ${v.stroke.primary}`:"none"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[ye(w),e(j,Object.assign({body:F,placement:"top"},{children:e(E,Object.assign({style:N==_.FETCHED_LINKS||N==_.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:v.content.primary,className:"clamp-title",onClick:()=>N==_.FETCHED_LINKS||N==_.WEBSITE_LINKS?G(o):{}},{children:F}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==H.EMAIL_COLLECTION&&e(i,{children:e(O,Object.assign({color:v.content.secondary},{children:A}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(C,D?{Icon:s,height:16,width:16,iconColor:v.content.secondary,onClick:()=>null==k?void 0:k.onEditClick(k.data,k.type),disabled:!k,disabledTooltip:"This source is deleted"}:{Icon:p,height:16,width:16,iconColor:v.content.secondary,disabled:"custom"===o.type&&!k,disabledTooltip:"This source is deleted",onClick:()=>G(o)})}))]}))]})),(null!=P?P:"").trim()&&e("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${v.stroke.primary}`,borderRadius:"4px",backgroundColor:v.surface.subdued}},{children:e(O,Object.assign({color:v.content.primary,className:"clamp-description"},{children:Ce(null!=P?P:"").trim()}))}))]}),`info-${n}`)}))}))]}))]})),oe&&!me(Z)&&e("div",Object.assign({className:"footer"},{children:e(L,{appType:P,storeId:B,messageSource:R,sourceIntent:null!==(F=R.intent)&&void 0!==F?F:H.GENERIC,faqCount:se,trainingSourceCount:ce,ShowTrainingDataSource:he,ChecklistType:H,footerButtonOption:X})}))]})}),re&&e(I,Object.assign({header:"Product description",onClose:()=>ae(void 0),width:"30%"},{children:e(N,{title:re.title,description:re.description,imageUrl:re.imageUrl,onClose:re.onClose})}))]})};export{D as DataSourcePanel};
1
+ import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import o from"../../assets/icons/boxV2.svg.js";import n from"../../assets/icons/cross.svg.js";import s from"../../assets/icons/edit.svg.js";import l from"../../assets/icons/filePdf.svg.js";import r from"../../assets/icons/help.svg.js";import a from"../../assets/icons/info.svg.js";import d from"../../assets/icons/openai.svg.js";import c 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 h,useMemo as m,useEffect as f}from"react";import{COLORS as v}from"../../constants/Theme.js";import{Button as y}from"../button/Button.js";import{IconButton as C}from"../icon-button/IconButton.js";import{BikShimmer as x}from"../shimmer/ShimmerComponent/BikShimmer.js";import{SideModal as I}from"../side-modal/SideModal.js";import{Tag as b}from"../tag/Tag.js";import{Tooltip as T}from"../tooltips/Tooltip.js";import{TitleSmall as j,BodyCaption as O,BodySecondary as E}from"../TypographyStyle.js";import L from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as S}from"./DataSourcePanel.style.js";import{intentConfig as w}from"./IntentConfig.js";import{DescriptionModal as N}from"./Modals/DescriptionModal.js";import{CustomDataType as _}from"./model.js";import{__exports as A}from"../../_virtual/bik-store.js";const D=D=>{var k,F;const{appType:P,storeId:B,messageSource:R,setMessageSourcePanel:U,hideCloseButton:K,isSourceInfoFetched:M,allSourceInfoDetail:W,ChecklistType:H,title:$,zeroStateButton:q,editableSources:Q,preFillTrainingSourceCount:Y,redirect:G,footerButtonOption:X,fetchTrainingSourceCount:z,fetchProductFAQCount:V,productSourceData:J}=D,{sources:Z}=R,ee=["blog","article","page","policy"],[te,ie]=h(!1),[oe,ne]=h(!1),[se,le]=h(!1),[re,ae]=h(0),[de,ce]=h(),[pe,ue]=h(null!=Y?Y:{}),ge={};w.forEach((t=>{let{key:i,type:o,tagText:n}=t;H[i]&&(ge[H[i]]=e(b,{theme:"light",type:o,tagText:n,cursor:"pointer"}))}));const he=Z.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),me=Z.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),fe=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,i,o;if(!(null==R?void 0:R.messageId))return;ie(!0),ne(!0),le(!1!==(null===(t=null===(e=R.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=R.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights));const n=R.sources.filter((e=>!!e.productId)).map((e=>e.productId)),s=Array.from(new Set(n)).filter((e=>!!e));V(B,s).then((e=>ae(e))).then((()=>{Y?(ue(Y),setTimeout((()=>{ie(!1),ne(!1)}),100)):(setTimeout((()=>ie(!1)),100),z(B).then((e=>ue(e))).then((()=>setTimeout((()=>{ne(!1)}),100))))}))}),[V,z,null==R?void 0:R.messageId,R.sources,Y,B]);const ve=e=>!!(e&&0===e.length||(null==R?void 0:R.isUnsatisfactoryAnswer)),ye=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=_.FILES:ee.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=>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")):"",xe=t=>e("products"==t||"product"==t?o:"files"==t?l:"website links"==t||"fetched links"==t?g:"faq"==t?r:"texts"==t?u:d,{height:16,width:16,color:v.content.secondary}),Ie=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return te||!M?e(S,{children:e(x,{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"}]})}):t(i,{children:[e(S,{children:t(i,{children:[t("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!$&&e(j,{children:$}),t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e(O,Object.assign({color:v.content.secondary},{children:"Intent"})),null!==(k=ge[R.intent])&&void 0!==k?k:ge.GENERIC,!K&&e("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>U(void 0)},{children:e(n,{height:20,width:20,color:v.content.secondary})}))]})),ve(Z)?e("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var i,o;return t("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:`${v.background.negative.light}`,borderRadius:"100px"}},{children:e(a,{width:24,height:24,color:v.stroke.negative.vibrant})})),e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e(j,{children:"Insufficient data"})})),e(E,Object.assign({color:v.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("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(y,{LeadingIcon:null!==(i=q.leadingIcon)&&void 0!==i?i:c,buttonText:null!==(o=q.title)&&void 0!==o?o:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{q.onClick()}})}))]}))})()})):e(b,{LeadingIcon:a,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:R.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===A.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!ve(Z)&&t("div",Object.assign({className:"info-container"},{children:[he.length>0&&t("div",Object.assign({className:"info-product-source"},{children:[e(O,{children:"Product Source"}),e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:he.map(((o,n)=>{var l,r,a,d;const c=ye(o.type||o.subTitle||"OpenAI"),u=ye(o.type||o.subTitle||"OpenAI",!0),g=Ce(c),h=null==Q?void 0:Q.includes(u),m=W[null!==(l=o.productId)&&void 0!==l?l:"Products"],f=o.title,y=o.productId&&(null==J?void 0:J[o.productId]),x=y&&y.metafield.join(", ");return t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:n+1<(null==he?void 0:he.length)?`1px solid ${v.stroke.primary}`:"none"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[xe(c),e(T,Object.assign({body:f,placement:"top"},{children:e(E,Object.assign({style:u==_.FETCHED_LINKS||u==_.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:v.content.primary,className:"clamp-title",onClick:()=>u==_.FETCHED_LINKS||u==_.WEBSITE_LINKS?G(o):{}},{children:f}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==H.EMAIL_COLLECTION&&e(i,{children:e(O,Object.assign({color:v.content.secondary},{children:g}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(C,h?{Icon:s,height:16,width:16,iconColor:v.content.secondary,onClick:()=>null==m?void 0:m.onEditClick(m.data,m.type),disabled:!m,disabledTooltip:"This source is deleted"}:{Icon:p,height:16,width:16,iconColor:v.content.secondary,disabled:"custom"===o.type&&!m,disabledTooltip:"This source is deleted",onClick:()=>G(o)})}))]}))]})),y&&t(O,{children:[e("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;ce({title:f,description:Ie(y.description),imageUrl:null!==(e=o.imageUrl)&&void 0!==e?e:"",onClose:()=>ce(void 0)})}},{children:`${null===(r=y.description)||void 0===r?void 0:r.length} characters description,`})),e("span",Object.assign({className:"product-data-text1",onClick:()=>y.onEditFaqClick(y.faqs)},{children:`${null===(a=y.faqs)||void 0===a?void 0:a.length} FAQs, `})),e("span",Object.assign({className:"product-data-text2"},{children:"and"})),e(T,Object.assign({body:x,placement:"top"},{children:e("span",Object.assign({className:"product-data-text1"},{children:`${null===(d=y.metafield)||void 0===d?void 0:d.length} metafields`}))}))]})]}),`info-${n}`)}))}))]})),me.length>0&&t("div",Object.assign({className:"info-content-source"},{children:[e(O,{children:"Content Source"}),e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:me.map(((o,n)=>{var l,r,a,d,c,u,g,h,m,f,y,x,I,b,j,L,S;const w=ye(o.type||o.subTitle||"OpenAI"),N=ye(o.type||o.subTitle||"OpenAI",!0),A=Ce(w),D=null==Q?void 0:Q.includes(N),k="Products"===o.subTitle?W[null!==(l=o.productId)&&void 0!==l?l:"Products"]:W[null!==(r=o.docId)&&void 0!==r?r:""],F=N.toLowerCase()===(null===(a=_.FAQ)||void 0===a?void 0:a.toLowerCase())?"faq"===(null===(d=o.title)||void 0===d?void 0:d.toLowerCase())?o.subTitle:o.title:N.toLowerCase()===(null===(c=_.FILES)||void 0===c?void 0:c.toLowerCase())||N.toLowerCase()===(null===(u=_.FETCHED_LINKS)||void 0===u?void 0:u.toLowerCase())||N.toLowerCase()===(null===(g=_.TEXTS)||void 0===g?void 0:g.toLowerCase())?o.title:N.toLowerCase()===(null===(h=_.WEBSITE_LINKS)||void 0===h?void 0:h.toLowerCase())?o.title.split("/")[o.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):o.intent===H.EMAIL_COLLECTION?A:o.title,P="faq"===N.toLowerCase()?null!==(y=null!==(m=null==k?void 0:k.content)&&void 0!==m?m:null===(f=null==k?void 0:k.data)||void 0===f?void 0:f.answer)&&void 0!==y?y:"":N.toLowerCase()===(null===(x=_.FETCHED_LINKS)||void 0===x?void 0:x.toLowerCase())||N.toLowerCase()===(null===(I=_.WEBSITE_LINKS)||void 0===I?void 0:I.toLowerCase())||N.toLowerCase()===(null===(b=_.TEXTS)||void 0===b?void 0:b.toLowerCase())?null!==(S=null!==(j=null==k?void 0:k.content)&&void 0!==j?j:null===(L=null==k?void 0:k.data)||void 0===L?void 0:L.fileContentText)&&void 0!==S?S:"":o.intent===H.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:n+1<(null==me?void 0:me.length)?`1px solid ${v.stroke.primary}`:"none"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[xe(w),e(T,Object.assign({body:F,placement:"top"},{children:e(E,Object.assign({style:N==_.FETCHED_LINKS||N==_.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:v.content.primary,className:"clamp-title",onClick:()=>N==_.FETCHED_LINKS||N==_.WEBSITE_LINKS?G(o):{}},{children:F}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==H.EMAIL_COLLECTION&&e(i,{children:e(O,Object.assign({color:v.content.secondary},{children:A}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(C,D?{Icon:s,height:16,width:16,iconColor:v.content.secondary,onClick:()=>null==k?void 0:k.onEditClick(k.data,k.type),disabled:!k,disabledTooltip:"This source is deleted"}:{Icon:p,height:16,width:16,iconColor:v.content.secondary,disabled:"custom"===o.type&&!k,disabledTooltip:"This source is deleted",onClick:()=>G(o)})}))]}))]})),(null!=P?P:"").trim()&&e("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${v.stroke.primary}`,borderRadius:"4px",backgroundColor:v.surface.subdued}},{children:e(O,Object.assign({color:v.content.primary,className:"clamp-description"},{children:Ie(null!=P?P:"").trim()}))}))]}),`info-${n}`)}))}))]}))]})),se&&!ve(Z)&&e("div",Object.assign({className:"footer"},{children:e(L,{appType:P,storeId:B,messageSource:R,sourceIntent:null!==(F=R.intent)&&void 0!==F?F:H.GENERIC,faqCount:re,trainingSourceCount:pe,ShowTrainingDataSource:fe,ChecklistType:H,footerButtonOption:X,isFooterLoading:oe})}))]})}),de&&e(I,Object.assign({header:"Product description",onClose:()=>ce(void 0),width:"30%"},{children:e(N,{title:de.title,description:de.description,imageUrl:de.imageUrl,onClose:de.onClose})}))]})};export{D as DataSourcePanel};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.679",
3
+ "version": "0.0.680",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",