@bikdotai/bik-component-library 0.0.641-2 → 0.0.641-4

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.
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var l=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,l.get?l:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=e(require("react"));function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e},l.apply(this,arguments)}var n=e=>r.createElement("svg",l({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},e),t||(t=r.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.502 1.403a3 3 0 0 1 2.996 0l.002.001 7 4a3 3 0 0 1 .937.848 1 1 0 0 1 .249.414A3 3 0 0 1 22 7.999v8.002a3 3 0 0 1-1.5 2.595l-.004.002-6.996 3.998-.002.001a3.001 3.001 0 0 1-1.023.363.996.996 0 0 1-.95 0 2.999 2.999 0 0 1-1.023-.363H10.5l-6.996-3.999-.004-.002A3 3 0 0 1 2 16.001V8a3 3 0 0 1 .314-1.333 1.003 1.003 0 0 1 .249-.414 3 3 0 0 1 .937-.848l.004-.002 6.998-4ZM13 20.578l6.5-3.714h.002a1.001 1.001 0 0 0 .498-.865V8.538l-7 4.049v7.991Zm-2-7.991v7.991l-6.5-3.714h-.002A1 1 0 0 1 4 15.998V8.538l7 4.049Zm1.504-9.449 6.457 3.69L12 10.855 5.039 6.828l6.457-3.69.004-.002a1 1 0 0 1 1 0l.004.002Z",clipRule:"evenodd"})));exports.default=n;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { AllSourceInfoDetailsCustomDataModel, MessageSource } from './model';
2
+ import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, MessageSource } from './model';
3
3
  export interface DataSourcePanelProps {
4
4
  storeId: string;
5
5
  messageSource: MessageSource;
@@ -9,6 +9,8 @@ export interface DataSourcePanelProps {
9
9
  allSourceInfoDetail: AllSourceInfoDetailsCustomDataModel;
10
10
  isSourceInfoFetched?: boolean;
11
11
  faqCount: number;
12
+ editableSources: CustomDataType[];
13
+ zeroStateButton: DataSourcePanelZeroState;
12
14
  ChecklistType: Record<string, string>;
13
15
  IntentComponentMap: Record<string, JSX.Element>;
14
16
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/box.svg.js"),s=require("../../assets/icons/cross.svg.js"),i=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),a=require("../../assets/icons/info.svg.js"),l=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"),y=require("../tag/Tag.js"),j=require("../tooltips/Tooltip.js"),v=require("../TypographyStyle.js"),m=require("./DataSourceInfoFooter.js"),f=require("./DataSourcePanel.style.js"),L=require("./model.js");exports.DataSourcePanel=O=>{var T,I;const{storeId:S,messageSource:b,setMessageSourcePanel:w,hideCloseButton:E,faqCount:D,isSourceInfoFetched:q,allSourceInfoDetail:N,ChecklistType:B,IntentComponentMap:F,title:R}=O,{sources:_}=b,k=["blog","article","page","policy"],[A,K]=p.useState(!1),[P,W]=p.useState(!1);p.useEffect((()=>{var e,t,s,i;(null==b?void 0:b.messageId)&&(K(!0),setTimeout((()=>K(!1)),200),W(!1!==(null===(t=null===(e=b.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=b.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights)))}),[null==b?void 0:b.messageId]);const M=e=>!(0!==e.length&&!(null==b?void 0:b.isUnsatisfactoryAnswer)),H=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:k.includes(e)?e=L.CustomDataType.FETCHED_LINKS:"url"==e?e=L.CustomDataType.WEBSITE_LINKS:"text"===e?e=L.CustomDataType.TEXTS:"faq"===e&&(e=L.CustomDataType.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.replace(/_/g," ")};return A||!q?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.jsx(e.Fragment,{children:e.jsx(f.SourceInfoDetailsStyle,{children:!!(null==_?void 0:_.length)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!R&&e.jsx(v.TitleSmall,{children:R}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(T=F[b.intent])&&void 0!==T?T:F.GENERIC,!E&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>w(void 0)},{children:e.jsx(s.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),M(_)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children: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(a.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(v.TitleSmall,{children:"Insufficient data"})})),e.jsx(v.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"})),e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:r.default,buttonText:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{}})}))]}))})):e.jsx(y.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"})]})),!M(_)&&e.jsx("div",Object.assign({className:"info-container"},{children:e.jsx("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:_.map(((s,a)=>{var r,p,g,C,y,m,f,O,T,I,S,b,w,E;const D=H(s.type||s.subTitle||"OpenAI"),q=H(s.type||s.subTitle||"OpenAI",!0),F=(R=D)?"faq"==R.toLocaleLowerCase()?"FAQ":"openai"==R.toLocaleLowerCase()?"OPENAI":"files"==R.toLocaleLowerCase()?"PDF":"texts"==R.toLocaleLowerCase()?"Custom text":((R=(R=R.charAt(0).toUpperCase()+R.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(R=R.slice(0,-1)),R.replace("Website","Manual")):"";var R;const _=q===L.CustomDataType.FAQ||q===L.CustomDataType.WEBSITE_LINKS||q===L.CustomDataType.TEXTS||q===L.CustomDataType.FETCHED_LINKS,k="Products"===s.subTitle?N[null!==(r=s.productId)&&void 0!==r?r:"Products"]:N[null!==(p=s.docId)&&void 0!==p?p:""],A=q.toLowerCase()===(null===(g=L.CustomDataType.FAQ)||void 0===g?void 0:g.toLowerCase())?"faq"===(null===(C=s.title)||void 0===C?void 0:C.toLowerCase())?s.subTitle:s.title:q.toLowerCase()===(null===(y=L.CustomDataType.FILES)||void 0===y?void 0:y.toLowerCase())||q.toLowerCase()===(null===(m=L.CustomDataType.FETCHED_LINKS)||void 0===m?void 0:m.toLowerCase())||q.toLowerCase()===(null===(f=L.CustomDataType.TEXTS)||void 0===f?void 0:f.toLowerCase())?s.title:q.toLowerCase()===(null===(O=L.CustomDataType.WEBSITE_LINKS)||void 0===O?void 0:O.toLowerCase())?s.title.split("/")[s.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):s.intent===B.EMAIL_COLLECTION?F:s.title,K="faq"===q.toLowerCase()?null===(T=null==k?void 0:k.data)||void 0===T?void 0:T.answer:q.toLowerCase()===(null===(I=L.CustomDataType.FETCHED_LINKS)||void 0===I?void 0:I.toLowerCase())||q.toLowerCase()===(null===(S=L.CustomDataType.WEBSITE_LINKS)||void 0===S?void 0:S.toLowerCase())||q.toLowerCase()===(null===(b=L.CustomDataType.TEXTS)||void 0===b?void 0:b.toLowerCase())?null!==(E=null===(w=null==k?void 0:k.data)||void 0===w?void 0:w.fileContentText)&&void 0!==E?E:"":s.intent===B.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 ${h.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(j.Tooltip,Object.assign({body:A,placement:"top"},{children:e.jsx(v.BodySecondary,Object.assign({style:q==L.CustomDataType.FETCHED_LINKS||q==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>(q==L.CustomDataType.FETCHED_LINKS||L.CustomDataType.WEBSITE_LINKS,{})},{children:A}))}))})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[s.intent!==B.EMAIL_COLLECTION&&e.jsxs(e.Fragment,{children:[(W=D,"products"==W?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==W?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==W||"fetched links"==W?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==W?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==W?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(l.default,{height:16,width:16,color:h.COLORS.content.secondary})),e.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:F}))]}),(s.link||s.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:_?e.jsx(x.IconButton,{Icon:i.default,height:16,width:16,bordered:!0,onClick:()=>null==k?void 0:k.onEditClick(k.data,"CustomDataFaqModel"),disabled:!k,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,bordered:!0,disabled:"custom"===s.type&&!k,disabledTooltip:"This source is deleted",onClick:()=>{}})}))]}))]})),(null!=K?K:"").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(v.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:(P=null!=K?K:"",P.replace(/(<([^>]+)>)/gi,"")).trim()}))}))]}),`info-${a}`);var P,W}))}))})),P&&!M(_)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(m.SourceInfoFooter,{storeId:S,messageSource:b,sourceIntent:null!==(I=b.intent)&&void 0!==I?I:B.GENERIC,faqCount:D})}))]})})})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/boxV2.svg.js"),s=require("../../assets/icons/cross.svg.js"),i=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),a=require("../../assets/icons/info.svg.js"),l=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"),v=require("../tag/Tag.js"),y=require("../tooltips/Tooltip.js"),j=require("../TypographyStyle.js"),m=require("./DataSourceInfoFooter.js"),f=require("./DataSourcePanel.style.js"),L=require("./model.js");exports.DataSourcePanel=O=>{var I,S;const{storeId:b,messageSource:T,setMessageSourcePanel:w,hideCloseButton:E,faqCount:D,isSourceInfoFetched:q,allSourceInfoDetail:B,ChecklistType:N,IntentComponentMap:R,title:k,zeroStateButton:F,editableSources:_}=O,{sources:A}=T,P=["blog","article","page","policy"],[K,W]=p.useState(!1),[M,H]=p.useState(!1);p.useEffect((()=>{var e,t,s,i;(null==T?void 0:T.messageId)&&(W(!0),setTimeout((()=>W(!1)),200),H(!1!==(null===(t=null===(e=T.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=T.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights)))}),[null==T?void 0:T.messageId]);const Q=e=>!(0!==e.length&&!(null==T?void 0:T.isUnsatisfactoryAnswer)),$=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:P.includes(e)?e=L.CustomDataType.FETCHED_LINKS:"url"==e?e=L.CustomDataType.WEBSITE_LINKS:"text"===e?e=L.CustomDataType.TEXTS:"faq"===e&&(e=L.CustomDataType.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.replace(/_/g," ")};return K||!q?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.jsx(e.Fragment,{children:e.jsx(f.SourceInfoDetailsStyle,{children:!!(null==A?void 0:A.length)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!k&&e.jsx(j.TitleSmall,{children:k}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(j.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(I=R[T.intent])&&void 0!==I?I:R.GENERIC,!E&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>w(void 0)},{children:e.jsx(s.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),Q(A)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(a.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(j.TitleSmall,{children:"Insufficient data"})})),e.jsx(j.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"})),F&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=F.leadingIcon)&&void 0!==t?t:r.default,buttonText:null!==(s=F.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{F.onClick()}})}))]}))})()})):e.jsx(v.Tag,{LeadingIcon:a.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:T.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"})]})),!Q(A)&&e.jsx("div",Object.assign({className:"info-container"},{children:e.jsx("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:A.map(((s,a)=>{var r,p,g,C,v,m,f,O,I,S,b,T,w,E;const D=$(s.type||s.subTitle||"OpenAI"),q=$(s.type||s.subTitle||"OpenAI",!0),R=(k=D)?"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 F=null==_?void 0:_.includes(q),A="Products"===s.subTitle?B[null!==(r=s.productId)&&void 0!==r?r:"Products"]:B[null!==(p=s.docId)&&void 0!==p?p:""],P=q.toLowerCase()===(null===(g=L.CustomDataType.FAQ)||void 0===g?void 0:g.toLowerCase())?"faq"===(null===(C=s.title)||void 0===C?void 0:C.toLowerCase())?s.subTitle:s.title:q.toLowerCase()===(null===(v=L.CustomDataType.FILES)||void 0===v?void 0:v.toLowerCase())||q.toLowerCase()===(null===(m=L.CustomDataType.FETCHED_LINKS)||void 0===m?void 0:m.toLowerCase())||q.toLowerCase()===(null===(f=L.CustomDataType.TEXTS)||void 0===f?void 0:f.toLowerCase())?s.title:q.toLowerCase()===(null===(O=L.CustomDataType.WEBSITE_LINKS)||void 0===O?void 0:O.toLowerCase())?s.title.split("/")[s.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):s.intent===N.EMAIL_COLLECTION?R:s.title,K="faq"===q.toLowerCase()?null===(I=null==A?void 0:A.data)||void 0===I?void 0:I.answer:q.toLowerCase()===(null===(S=L.CustomDataType.FETCHED_LINKS)||void 0===S?void 0:S.toLowerCase())||q.toLowerCase()===(null===(b=L.CustomDataType.WEBSITE_LINKS)||void 0===b?void 0:b.toLowerCase())||q.toLowerCase()===(null===(T=L.CustomDataType.TEXTS)||void 0===T?void 0:T.toLowerCase())?null!==(E=null===(w=null==A?void 0:A.data)||void 0===w?void 0:w.fileContentText)&&void 0!==E?E:"":s.intent===N.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 ${h.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(y.Tooltip,Object.assign({body:P,placement:"top"},{children:e.jsx(j.BodySecondary,Object.assign({style:q==L.CustomDataType.FETCHED_LINKS||q==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>q==L.CustomDataType.FETCHED_LINKS||q==L.CustomDataType.WEBSITE_LINKS?(null==A?void 0:A.redirect)&&(null==A?void 0:A.redirect(s)):{}},{children:P}))}))})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[s.intent!==N.EMAIL_COLLECTION&&e.jsxs(e.Fragment,{children:[(M=D,"products"==M?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==M?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==M||"fetched links"==M?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==M?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==M?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(l.default,{height:16,width:16,color:h.COLORS.content.secondary})),e.jsx(j.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:R}))]}),(s.link||s.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:F?e.jsx(x.IconButton,{Icon:i.default,height:16,width:16,bordered:!0,onClick:()=>null==A?void 0:A.onEditClick(A.data,A.type),disabled:!A,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,bordered:!0,disabled:"custom"===s.type&&!A,disabledTooltip:"This source is deleted",onClick:()=>(null==A?void 0:A.redirect)&&(null==A?void 0:A.redirect(s))})}))]}))]})),(null!=K?K:"").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(j.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:(W=null!=K?K:"",W.replace(/(<([^>]+)>)/gi,"")).trim()}))}))]}),`info-${a}`);var W,M}))}))})),M&&!Q(A)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(m.SourceInfoFooter,{storeId:b,messageSource:T,sourceIntent:null!==(S=T.intent)&&void 0!==S?S:N.GENERIC,faqCount:D})}))]})})})};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface MessageSource {
2
3
  sources: InfoContent[];
3
4
  intent: string;
@@ -20,6 +21,11 @@ export interface InfoContent {
20
21
  subIntent?: string;
21
22
  insights?: string;
22
23
  }
24
+ export interface DataSourcePanelZeroState {
25
+ title: string;
26
+ leadingIcon: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
27
+ onClick: () => void;
28
+ }
23
29
  export interface AllSourceInfoDetailsCustomDataModel {
24
30
  [keys: string]: SourceInfoDetailsCustomDataModel;
25
31
  }
@@ -30,6 +36,7 @@ export interface SourceInfoDetailsCustomDataModel {
30
36
  content?: string;
31
37
  docId: string;
32
38
  onEditClick: (item: FileMetaData | CustomDataDocument | CustomDataFaqModel, type: string) => void;
39
+ redirect?: (source: InfoContent) => void;
33
40
  }
34
41
  export declare enum CustomDataCategories {
35
42
  PAGE = "page",
@@ -0,0 +1 @@
1
+ import*as e from"react";var l;function a(){return a=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var a=arguments[l];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},a.apply(this,arguments)}var r=r=>e.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},r),l||(l=e.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.502 1.403a3 3 0 0 1 2.996 0l.002.001 7 4a3 3 0 0 1 .937.848 1 1 0 0 1 .249.414A3 3 0 0 1 22 7.999v8.002a3 3 0 0 1-1.5 2.595l-.004.002-6.996 3.998-.002.001a3.001 3.001 0 0 1-1.023.363.996.996 0 0 1-.95 0 2.999 2.999 0 0 1-1.023-.363H10.5l-6.996-3.999-.004-.002A3 3 0 0 1 2 16.001V8a3 3 0 0 1 .314-1.333 1.003 1.003 0 0 1 .249-.414 3 3 0 0 1 .937-.848l.004-.002 6.998-4ZM13 20.578l6.5-3.714h.002a1.001 1.001 0 0 0 .498-.865V8.538l-7 4.049v7.991Zm-2-7.991v7.991l-6.5-3.714h-.002A1 1 0 0 1 4 15.998V8.538l7 4.049Zm1.504-9.449 6.457 3.69L12 10.855 5.039 6.828l6.457-3.69.004-.002a1 1 0 0 1 1 0l.004.002Z",clipRule:"evenodd"})));export{r as default};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { AllSourceInfoDetailsCustomDataModel, MessageSource } from './model';
2
+ import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, MessageSource } from './model';
3
3
  export interface DataSourcePanelProps {
4
4
  storeId: string;
5
5
  messageSource: MessageSource;
@@ -9,6 +9,8 @@ export interface DataSourcePanelProps {
9
9
  allSourceInfoDetail: AllSourceInfoDetailsCustomDataModel;
10
10
  isSourceInfoFetched?: boolean;
11
11
  faqCount: number;
12
+ editableSources: CustomDataType[];
13
+ zeroStateButton: DataSourcePanelZeroState;
12
14
  ChecklistType: Record<string, string>;
13
15
  IntentComponentMap: Record<string, JSX.Element>;
14
16
  }
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import o from"../../assets/icons/box.svg.js";import s from"../../assets/icons/cross.svg.js";import n from"../../assets/icons/edit.svg.js";import r from"../../assets/icons/filePdf.svg.js";import l 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,useEffect as m}from"react";import{COLORS as v}from"../../constants/Theme.js";import{Button as f}from"../button/Button.js";import{IconButton as y}from"../icon-button/IconButton.js";import{BikShimmer as x}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as C}from"../tag/Tag.js";import{Tooltip as I}from"../tooltips/Tooltip.js";import{TitleSmall as b,BodyCaption as L,BodySecondary as j}from"../TypographyStyle.js";import{SourceInfoFooter as w}from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as E}from"./DataSourcePanel.style.js";import{CustomDataType as T}from"./model.js";const S=S=>{var O,N;const{storeId:k,messageSource:A,setMessageSourcePanel:D,hideCloseButton:F,faqCount:_,isSourceInfoFetched:B,allSourceInfoDetail:K,ChecklistType:W,IntentComponentMap:q,title:P}=S,{sources:M}=A,H=["blog","article","page","policy"],[Q,$]=h(!1),[R,X]=h(!1);m((()=>{var e,t,i,o;(null==A?void 0:A.messageId)&&($(!0),setTimeout((()=>$(!1)),200),X(!1!==(null===(t=null===(e=A.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=A.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights)))}),[null==A?void 0:A.messageId]);const U=e=>!(0!==e.length&&!(null==A?void 0:A.isUnsatisfactoryAnswer)),G=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=T.FILES:H.includes(e)?e=T.FETCHED_LINKS:"url"==e?e=T.WEBSITE_LINKS:"text"===e?e=T.TEXTS:"faq"===e&&(e=T.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")};return Q||!B?e(E,{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"}]})}):e(t,{children:e(E,{children:!!(null==M?void 0:M.length)&&i(t,{children:[i("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!P&&e(b,{children:P}),i("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e(L,Object.assign({color:v.content.secondary},{children:"Intent"})),null!==(O=q[A.intent])&&void 0!==O?O:q.GENERIC,!F&&e("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>D(void 0)},{children:e(s,{height:20,width:20,color:v.content.secondary})}))]})),U(M)?e("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children: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:`${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(b,{children:"Insufficient data"})})),e(j,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"})),e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(f,{LeadingIcon:c,buttonText:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{}})}))]}))})):e(C,{LeadingIcon:a,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:A.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"})]})),!U(M)&&e("div",Object.assign({className:"info-container"},{children:e("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:M.map(((s,a)=>{var c,h,m,f,x,C,b,w,E,S,O,N,k,A;const D=G(s.type||s.subTitle||"OpenAI"),F=G(s.type||s.subTitle||"OpenAI",!0),_=(B=D)?"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 q=F===T.FAQ||F===T.WEBSITE_LINKS||F===T.TEXTS||F===T.FETCHED_LINKS,P="Products"===s.subTitle?K[null!==(c=s.productId)&&void 0!==c?c:"Products"]:K[null!==(h=s.docId)&&void 0!==h?h:""],M=F.toLowerCase()===(null===(m=T.FAQ)||void 0===m?void 0:m.toLowerCase())?"faq"===(null===(f=s.title)||void 0===f?void 0:f.toLowerCase())?s.subTitle:s.title:F.toLowerCase()===(null===(x=T.FILES)||void 0===x?void 0:x.toLowerCase())||F.toLowerCase()===(null===(C=T.FETCHED_LINKS)||void 0===C?void 0:C.toLowerCase())||F.toLowerCase()===(null===(b=T.TEXTS)||void 0===b?void 0:b.toLowerCase())?s.title:F.toLowerCase()===(null===(w=T.WEBSITE_LINKS)||void 0===w?void 0:w.toLowerCase())?s.title.split("/")[s.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):s.intent===W.EMAIL_COLLECTION?_:s.title,H="faq"===F.toLowerCase()?null===(E=null==P?void 0:P.data)||void 0===E?void 0:E.answer:F.toLowerCase()===(null===(S=T.FETCHED_LINKS)||void 0===S?void 0:S.toLowerCase())||F.toLowerCase()===(null===(O=T.WEBSITE_LINKS)||void 0===O?void 0:O.toLowerCase())||F.toLowerCase()===(null===(N=T.TEXTS)||void 0===N?void 0:N.toLowerCase())?null!==(A=null===(k=null==P?void 0:P.data)||void 0===k?void 0:k.fileContentText)&&void 0!==A?A:"":s.intent===W.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 ${v.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(I,Object.assign({body:M,placement:"top"},{children:e(j,Object.assign({style:F==T.FETCHED_LINKS||F==T.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:v.content.primary,className:"clamp-title",onClick:()=>(F==T.FETCHED_LINKS||T.WEBSITE_LINKS,{})},{children:M}))}))})),i("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[s.intent!==W.EMAIL_COLLECTION&&i(t,{children:[($=D,e("products"==$?o:"files"==$?r:"website links"==$||"fetched links"==$?g:"faq"==$?l:"texts"==$?u:d,{height:16,width:16,color:v.content.secondary})),e(L,Object.assign({color:v.content.secondary},{children:_}))]}),(s.link||s.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:e(y,q?{Icon:n,height:16,width:16,bordered:!0,onClick:()=>null==P?void 0:P.onEditClick(P.data,"CustomDataFaqModel"),disabled:!P,disabledTooltip:"This source is deleted"}:{Icon:p,height:16,width:16,bordered:!0,disabled:"custom"===s.type&&!P,disabledTooltip:"This source is deleted",onClick:()=>{}})}))]}))]})),(null!=H?H:"").trim()&&e("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${v.stroke.primary}`,borderRadius:"4px",backgroundColor:v.surface.subdued}},{children:e(L,Object.assign({color:v.content.primary,className:"clamp-description"},{children:(Q=null!=H?H:"",Q.replace(/(<([^>]+)>)/gi,"")).trim()}))}))]}),`info-${a}`);var Q,$}))}))})),R&&!U(M)&&e("div",Object.assign({className:"footer"},{children:e(w,{storeId:k,messageSource:A,sourceIntent:null!==(N=A.intent)&&void 0!==N?N:W.GENERIC,faqCount:_})}))]})})})};export{S 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 s from"../../assets/icons/cross.svg.js";import n 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,useEffect as m}from"react";import{COLORS as v}from"../../constants/Theme.js";import{Button as f}from"../button/Button.js";import{IconButton as y}from"../icon-button/IconButton.js";import{BikShimmer as x}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as C}from"../tag/Tag.js";import{Tooltip as b}from"../tooltips/Tooltip.js";import{TitleSmall as I,BodyCaption as L,BodySecondary as j}from"../TypographyStyle.js";import{SourceInfoFooter as w}from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as E}from"./DataSourcePanel.style.js";import{CustomDataType as T}from"./model.js";const O=O=>{var S,N;const{storeId:k,messageSource:A,setMessageSourcePanel:D,hideCloseButton:_,faqCount:F,isSourceInfoFetched:B,allSourceInfoDetail:K,ChecklistType:P,IntentComponentMap:W,title:q,zeroStateButton:M,editableSources:H}=O,{sources:Q}=A,$=["blog","article","page","policy"],[R,U]=h(!1),[X,z]=h(!1);m((()=>{var e,t,i,o;(null==A?void 0:A.messageId)&&(U(!0),setTimeout((()=>U(!1)),200),z(!1!==(null===(t=null===(e=A.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=A.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights)))}),[null==A?void 0:A.messageId]);const G=e=>!(0!==e.length&&!(null==A?void 0:A.isUnsatisfactoryAnswer)),V=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=T.FILES:$.includes(e)?e=T.FETCHED_LINKS:"url"==e?e=T.WEBSITE_LINKS:"text"===e?e=T.TEXTS:"faq"===e&&(e=T.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")};return R||!B?e(E,{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"}]})}):e(t,{children:e(E,{children:!!(null==Q?void 0:Q.length)&&i(t,{children:[i("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!q&&e(I,{children:q}),i("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e(L,Object.assign({color:v.content.secondary},{children:"Intent"})),null!==(S=W[A.intent])&&void 0!==S?S:W.GENERIC,!_&&e("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>D(void 0)},{children:e(s,{height:20,width:20,color:v.content.secondary})}))]})),G(Q)?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:`${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(I,{children:"Insufficient data"})})),e(j,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"})),M&&e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(f,{LeadingIcon:null!==(t=M.leadingIcon)&&void 0!==t?t:c,buttonText:null!==(o=M.title)&&void 0!==o?o:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{M.onClick()}})}))]}))})()})):e(C,{LeadingIcon:a,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:A.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"})]})),!G(Q)&&e("div",Object.assign({className:"info-container"},{children:e("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:Q.map(((s,a)=>{var c,h,m,f,x,C,I,w,E,O,S,N,k,A;const D=V(s.type||s.subTitle||"OpenAI"),_=V(s.type||s.subTitle||"OpenAI",!0),F=(B=D)?"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 W=null==H?void 0:H.includes(_),q="Products"===s.subTitle?K[null!==(c=s.productId)&&void 0!==c?c:"Products"]:K[null!==(h=s.docId)&&void 0!==h?h:""],M=_.toLowerCase()===(null===(m=T.FAQ)||void 0===m?void 0:m.toLowerCase())?"faq"===(null===(f=s.title)||void 0===f?void 0:f.toLowerCase())?s.subTitle:s.title:_.toLowerCase()===(null===(x=T.FILES)||void 0===x?void 0:x.toLowerCase())||_.toLowerCase()===(null===(C=T.FETCHED_LINKS)||void 0===C?void 0:C.toLowerCase())||_.toLowerCase()===(null===(I=T.TEXTS)||void 0===I?void 0:I.toLowerCase())?s.title:_.toLowerCase()===(null===(w=T.WEBSITE_LINKS)||void 0===w?void 0:w.toLowerCase())?s.title.split("/")[s.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):s.intent===P.EMAIL_COLLECTION?F:s.title,Q="faq"===_.toLowerCase()?null===(E=null==q?void 0:q.data)||void 0===E?void 0:E.answer:_.toLowerCase()===(null===(O=T.FETCHED_LINKS)||void 0===O?void 0:O.toLowerCase())||_.toLowerCase()===(null===(S=T.WEBSITE_LINKS)||void 0===S?void 0:S.toLowerCase())||_.toLowerCase()===(null===(N=T.TEXTS)||void 0===N?void 0:N.toLowerCase())?null!==(A=null===(k=null==q?void 0:q.data)||void 0===k?void 0:k.fileContentText)&&void 0!==A?A:"":s.intent===P.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 ${v.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(b,Object.assign({body:M,placement:"top"},{children:e(j,Object.assign({style:_==T.FETCHED_LINKS||_==T.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:v.content.primary,className:"clamp-title",onClick:()=>_==T.FETCHED_LINKS||_==T.WEBSITE_LINKS?(null==q?void 0:q.redirect)&&(null==q?void 0:q.redirect(s)):{}},{children:M}))}))})),i("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[s.intent!==P.EMAIL_COLLECTION&&i(t,{children:[(R=D,e("products"==R?o:"files"==R?l:"website links"==R||"fetched links"==R?g:"faq"==R?r:"texts"==R?u:d,{height:16,width:16,color:v.content.secondary})),e(L,Object.assign({color:v.content.secondary},{children:F}))]}),(s.link||s.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:e(y,W?{Icon:n,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"===s.type&&!q,disabledTooltip:"This source is deleted",onClick:()=>(null==q?void 0:q.redirect)&&(null==q?void 0:q.redirect(s))})}))]}))]})),(null!=Q?Q:"").trim()&&e("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${v.stroke.primary}`,borderRadius:"4px",backgroundColor:v.surface.subdued}},{children:e(L,Object.assign({color:v.content.primary,className:"clamp-description"},{children:($=null!=Q?Q:"",$.replace(/(<([^>]+)>)/gi,"")).trim()}))}))]}),`info-${a}`);var $,R}))}))})),X&&!G(Q)&&e("div",Object.assign({className:"footer"},{children:e(w,{storeId:k,messageSource:A,sourceIntent:null!==(N=A.intent)&&void 0!==N?N:P.GENERIC,faqCount:F})}))]})})})};export{O as DataSourcePanel};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface MessageSource {
2
3
  sources: InfoContent[];
3
4
  intent: string;
@@ -20,6 +21,11 @@ export interface InfoContent {
20
21
  subIntent?: string;
21
22
  insights?: string;
22
23
  }
24
+ export interface DataSourcePanelZeroState {
25
+ title: string;
26
+ leadingIcon: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
27
+ onClick: () => void;
28
+ }
23
29
  export interface AllSourceInfoDetailsCustomDataModel {
24
30
  [keys: string]: SourceInfoDetailsCustomDataModel;
25
31
  }
@@ -30,6 +36,7 @@ export interface SourceInfoDetailsCustomDataModel {
30
36
  content?: string;
31
37
  docId: string;
32
38
  onEditClick: (item: FileMetaData | CustomDataDocument | CustomDataFaqModel, type: string) => void;
39
+ redirect?: (source: InfoContent) => void;
33
40
  }
34
41
  export declare enum CustomDataCategories {
35
42
  PAGE = "page",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.641-2",
3
+ "version": "0.0.641-4",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",