@bikdotai/bik-component-library 0.0.683-1 → 0.0.683-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/cjs/components/button/Button.js +1 -1
  2. package/dist/cjs/components/button/model.d.ts +0 -5
  3. package/dist/cjs/components/carousel-preview/CarouselPreview.style.js +1 -1
  4. package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.d.ts +2 -0
  5. package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  6. package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +9 -0
  7. package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
  8. package/dist/cjs/components/data-source-panel/DataSourcePanel.style.d.ts +1 -0
  9. package/dist/cjs/components/data-source-panel/DataSourcePanel.style.js +12 -3
  10. package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js +8 -8
  11. package/dist/cjs/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +1 -1
  12. package/dist/esm/components/button/Button.js +1 -1
  13. package/dist/esm/components/button/model.d.ts +0 -5
  14. package/dist/esm/components/carousel-preview/CarouselPreview.style.js +1 -1
  15. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.d.ts +2 -0
  16. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  17. package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +9 -0
  18. package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
  19. package/dist/esm/components/data-source-panel/DataSourcePanel.style.d.ts +1 -0
  20. package/dist/esm/components/data-source-panel/DataSourcePanel.style.js +11 -2
  21. package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js +4 -4
  22. package/dist/esm/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +3 -3
  23. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),s=require("../spinner/Spinner.js"),o=require("./Button.styled.js"),i=require("./themes.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(n);const c=n.forwardRef(((n,r)=>{var{version:c,id:l,buttonType:d="primary",size:u="small",buttonText:b,disabled:m,IconComponent:j,LeadingIcon:g,TrailingIcon:x,isLoading:h,inverse:p,onClick:v,matchParentWidth:y,subtitle:C,darkMode:I,activated:f,error:N,buttonTextColor:O,buttonFontSize:T,customIconColor:z,buttonColor:B,LeadingIconStyles:S}=n,k=e.__rest(n,["version","id","buttonType","size","buttonText","disabled","IconComponent","LeadingIcon","TrailingIcon","isLoading","inverse","onClick","matchParentWidth","subtitle","darkMode","activated","error","buttonTextColor","buttonFontSize","customIconColor","buttonColor","LeadingIconStyles"]);const L=i.GetButtonTextComponent(u,d,m),q=i.getButtonIconColor(u,d,p,m,h,I),_="chip"===u?16:20,M={height:_,width:_,color:z||q,style:{display:"block"},className:"icon"};return t.jsx(o.Button,Object.assign({"data-test":k["data-test"],version:c,onClick:h?()=>{}:v,ref:r,id:l,disabled:m,size:u,buttonType:d,isLoading:h,inverse:p,matchParentWidth:y,darkMode:I,activated:f,error:N,buttonColor:B},k,{children:t.jsxs("div",Object.assign({className:"button-container"},{children:[d.startsWith("dash")&&t.jsx(o.ButtonCustomDashedBorder,{}),t.jsx("div",Object.assign({className:"overlay-container"},{children:h&&t.jsx(s.Spinner,{className:"spinner",size:"small",color:i.SpinnerColorMap(d,p)})})),j&&t.jsx("div",Object.assign({className:"icon-component"},{children:a.default.createElement(j,M)})),g&&t.jsx("div",Object.assign({className:"icon-leading",style:Object.assign({zIndex:1},S)},{children:a.default.createElement(g,M)})),b?t.jsxs(L,Object.assign({className:"text",style:{color:O,fontSize:T}},{children:[b,t.jsx("div",Object.assign({className:"text-subtitle"},{children:C}))]})):t.jsx(t.Fragment,{}),x&&t.jsx("div",Object.assign({className:"icon-trailing",style:{zIndex:1}},{children:a.default.createElement(x,M)}))]}))}))}));c.displayName="Button",exports.Button=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),o=require("../spinner/Spinner.js"),s=require("./Button.styled.js"),i=require("./themes.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(n);const c=n.forwardRef(((n,r)=>{var{version:c,id:l,buttonType:d="primary",size:u="small",buttonText:b,disabled:m,IconComponent:j,LeadingIcon:x,TrailingIcon:h,isLoading:p,inverse:v,onClick:g,matchParentWidth:C,subtitle:y,darkMode:f,activated:I,error:N,buttonTextColor:T,buttonFontSize:z,customIconColor:O,buttonColor:B}=n,k=e.__rest(n,["version","id","buttonType","size","buttonText","disabled","IconComponent","LeadingIcon","TrailingIcon","isLoading","inverse","onClick","matchParentWidth","subtitle","darkMode","activated","error","buttonTextColor","buttonFontSize","customIconColor","buttonColor"]);const q=i.GetButtonTextComponent(u,d,m),S=i.getButtonIconColor(u,d,v,m,p,f),_="chip"===u?16:20,L={height:_,width:_,color:O||S,style:{display:"block"},className:"icon"};return t.jsx(s.Button,Object.assign({"data-test":k["data-test"],version:c,onClick:p?()=>{}:g,ref:r,id:l,disabled:m,size:u,buttonType:d,isLoading:p,inverse:v,matchParentWidth:C,darkMode:f,activated:I,error:N,buttonColor:B},k,{children:t.jsxs("div",Object.assign({className:"button-container"},{children:[d.startsWith("dash")&&t.jsx(s.ButtonCustomDashedBorder,{}),t.jsx("div",Object.assign({className:"overlay-container"},{children:p&&t.jsx(o.Spinner,{className:"spinner",size:"small",color:i.SpinnerColorMap(d,v)})})),j&&t.jsx("div",Object.assign({className:"icon-component"},{children:a.default.createElement(j,L)})),x&&t.jsx("div",Object.assign({className:"icon-leading",style:{zIndex:1}},{children:a.default.createElement(x,L)})),b?t.jsxs(q,Object.assign({className:"text",style:{color:T,fontSize:z}},{children:[b,t.jsx("div",Object.assign({className:"text-subtitle"},{children:y}))]})):t.jsx(t.Fragment,{}),h&&t.jsx("div",Object.assign({className:"icon-trailing",style:{zIndex:1}},{children:a.default.createElement(h,L)}))]}))}))}));c.displayName="Button",exports.Button=c;
@@ -35,11 +35,6 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
35
35
  * @default undefined
36
36
  */
37
37
  LeadingIcon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
38
- /**
39
- * Custom styles to be applied to the LeadingIcon
40
- * @default undefined
41
- */
42
- LeadingIconStyles?: React.CSSProperties;
43
38
  /**
44
39
  * The icon component that is the left of the buttonText
45
40
  * Referred to https://ozzie.sh/passing-icons-as-props-in-a-consistent-way-using-react
@@ -9,7 +9,7 @@
9
9
  background-position: center;
10
10
  background-size: cover;
11
11
  position: relative;
12
- height: 100%;
12
+ height: 500px;
13
13
  overflow-y: auto;
14
14
  border-radius: ${e=>{var r;return null!==(r=e.borderRadius)&&void 0!==r?r:"0px"}};
15
15
  `,d=o.default.div`
@@ -17,6 +17,8 @@ interface SourceInfoFooterProps {
17
17
  ChecklistType: Record<string, string>;
18
18
  footerButtonOption?: footerButtonOptionModel;
19
19
  isFooterLoading?: boolean;
20
+ reasonForAiGeneratedResponse?: string;
21
+ showAiResponseReason?: boolean;
20
22
  }
21
23
  declare const SourceInfoFooter: import("react").MemoExoticComponent<(props: SourceInfoFooterProps) => import("react/jsx-runtime").JSX.Element>;
22
24
  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("../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
+ "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"),o=require("../../assets/icons/plus.svg.js"),i=require("react"),n=require("../../constants/Theme.js"),s=require("../button/Button.js"),r=require("../shimmer/ShimmerComponent/BikShimmer.js"),a=require("../TypographyStyle.js"),d=require("./DataSourcePanel.style.js"),l=require("../../_virtual/bik-store.js");const c=i.memo((c=>{const{appType:h,sourceIntent:g,hideHeading:v,messageSource:m,trainingSourceCount:y={},ShowTrainingDataSource:b={},faqCount:T,ChecklistType:j,footerButtonOption:x,isFooterLoading:A,reasonForAiGeneratedResponse:_,showAiResponseReason:O}=c,C=b,[R,S]=i.useState(!0),[f,I]=i.useState(!0),F="/bik-ai/training",[w,N]=i.useState({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[k,E]=i.useState({title:"",subTitle:""}),q=i.useMemo((()=>{const e=(null==y?void 0:y[g])||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,g]),D=()=>{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==x||x.onClick(w):(null==x?void 0:x.navigate)&&(null==x||x.navigate("Training",h==l.__exports.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return i.useEffect((()=>{var e,t,o,i;if(g){if(null===(e=null==m?void 0:m.sources)||void 0===e?void 0:e.length){const e=m.sources[0];if(C[g])g===j.ORDER_ENQUIRY&&I(!1);else{let n=null==e?void 0:e.insights,s="";switch(g){case j.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(n=`${T||"No"} FAQs added for this product`,s="Add product-specific information via FAQs to improve responses",N({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 j.ORDER_MODIFICATION:n=(null==y?void 0:y[g])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",n&&N({buttonTitle:h==l.__exports.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:h==l.__exports.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":F,addFaqProps:{}});break;case j.ORDER_CANCELLATION:n=(null==y?void 0:y[g])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",N({buttonTitle:h==l.__exports.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:h==l.__exports.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":F,addFaqProps:{}});break;case j.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;N({buttonTitle:h==l.__exports.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:h==l.__exports.ApplicationType.MANIFEST?"/training/order-management":F,addFaqProps:{}});break;case j.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(i=null===(o=null===(t=null==m?void 0:m.sources)||void 0===t?void 0:t[0])||void 0===o?void 0:o.title)||void 0===i?void 0:i.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."}E({title:null!=n?n:"",subTitle:s})}}(C[g]||[j.PRODUCT_DETAILS,j.ORDER_MODIFICATION,j.ORDER_CANCELLATION,j.ORDER_TRACKING].includes(g))&&S(!1)}}),[null==m?void 0:m.messageId,y,g,null==m?void 0:m.sources,C,j,T,h,m]),e.jsx(d.SourceInfoFooterStyle,{children:A?e.jsx(e.Fragment,{children:e.jsx(r.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)&&y&&g in y?e.jsxs(e.Fragment,{children:[e.jsx(u,{hideHeading:null!=v&&v}),e.jsx(p,{reason:_||"",showAiResponseReason:null!=O&&O}),e.jsxs("div",Object.assign({className:"source_info_details "+(y[g]>0?"":"no_data_source")},{children:[y[g]>0&&f?e.jsxs(e.Fragment,{children:[e.jsx(a.BodyCaption,{children:q}),e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):f&&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||R?e.jsx(e.Fragment,{}):e.jsx(s.Button,{size:"small",buttonType:"tertiary",LeadingIcon:o.default,buttonText:(null==w?void 0:w.buttonTitle.length)>0?null==w?void 0:w.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>D(),style:{backgroundColor:"unset"}})]}))]}):e.jsxs(e.Fragment,{children:[e.jsx(u,{hideHeading:null!=v&&v}),e.jsx(p,{reason:_||"",showAiResponseReason:null!=O&&O}),e.jsxs("div",Object.assign({className:"source_info_details"},{children:[f&&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||R?e.jsx(e.Fragment,{}):e.jsx(s.Button,{size:"small",buttonType:"tertiary",LeadingIcon:o.default,buttonText:(null==w?void 0:w.buttonTitle.length)>0?null==w?void 0:w.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>D(),style:{backgroundColor:"unset"}})]}))]})})})})),u=i.memo((t=>t.hideHeading?null:e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Training insights"})))),p=i.memo((t=>{const[o,s]=i.useState(!1),r=t.reason&&t.reason.length>50,d=r&&!o?t.reason.substring(0,50)+"...":t.reason;return t.showAiResponseReason?e.jsxs("div",Object.assign({className:"source_info_details"},{children:[e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.primary,className:"why_ai_gave_this_response"},{children:"Here’s why your AI gave this response"})),e.jsxs(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary,className:"clamp-text"},{children:[d||"No reason provided for this response.",r&&e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.brand,style:{cursor:"pointer",textDecoration:"underline",marginTop:"4px"},onClick:()=>s(!o)},{children:o?"Show less":"Show more"}))]}))]})):e.jsx(e.Fragment,{})}));p.displayName="WhyAiGaveThisResponse",u.displayName="TrainingInsightsHeading",c.displayName="SourceInfoFooter",exports.default=c;
@@ -1,6 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource, ProductSourceData } from './model';
4
+ export interface CollapsibleSectionProps {
5
+ title: string;
6
+ count: number;
7
+ isExpanded: boolean;
8
+ onToggle: () => void;
9
+ children: React.ReactNode;
10
+ }
4
11
  export interface DataSourcePanelProps {
5
12
  storeId: string;
6
13
  appType: ApplicationType;
@@ -23,5 +30,7 @@ export interface DataSourcePanelProps {
23
30
  }>;
24
31
  fetchProductFAQCount: (storeId: string, productIds?: string[]) => Promise<number>;
25
32
  productSourceData?: ProductSourceData;
33
+ reasonForAiGeneratedResponse?: string;
34
+ showAiResponseReason?: boolean;
26
35
  }
27
36
  export declare const DataSourcePanel: React.FC<DataSourcePanelProps>;
@@ -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(!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})}))]})};
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"),s=require("../../assets/icons/chevronDownOutline.svg.js"),i=require("../../assets/icons/chevronUpOutline.svg.js"),o=require("../../assets/icons/cross.svg.js"),n=require("../../assets/icons/edit.svg.js"),l=require("../../assets/icons/filePdf.svg.js"),a=require("../../assets/icons/help.svg.js"),r=require("../../assets/icons/info.svg.js"),d=require("../../assets/icons/openai.svg.js"),c=require("../../assets/icons/plus.svg.js"),u=require("../../assets/icons/redirect.svg.js"),p=require("../../assets/icons/text_t9.svg.js"),g=require("../../assets/icons/website.svg.js"),h=require("react"),x=require("../../constants/Theme.js"),j=require("../button/Button.js"),C=require("../icon-button/IconButton.js"),y=require("../shimmer/ShimmerComponent/BikShimmer.js"),O=require("../side-modal/SideModal.js"),m=require("../tag/Tag.js"),v=require("../tooltips/Tooltip.js"),f=require("../TypographyStyle.js"),S=require("./DataSourceInfoFooter.js"),T=require("./DataSourcePanel.style.js"),I=require("./IntentConfig.js"),b=require("./Modals/DescriptionModal.js"),L=require("./model.js"),E=require("../../_virtual/bik-store.js");exports.DataSourcePanel=w=>{var D,N;const{appType:R,storeId:_,messageSource:A,setMessageSourcePanel:F,hideCloseButton:q,isSourceInfoFetched:B,allSourceInfoDetail:k,ChecklistType:P,title:M,zeroStateButton:U,editableSources:K,preFillTrainingSourceCount:W,redirect:H,footerButtonOption:$,fetchTrainingSourceCount:Q,fetchProductFAQCount:G,productSourceData:Y,reasonForAiGeneratedResponse:z,showAiResponseReason:X}=w,{sources:V}=A,J=["blog","article","page","policy"],[Z,ee]=h.useState(!1),[te,se]=h.useState(!1),[ie,oe]=h.useState(!1),[ne,le]=h.useState(0),[ae,re]=h.useState(),[de,ce]=h.useState(null!=W?W:{}),[ue,pe]=h.useState(!1),[ge,he]=h.useState(!1),xe={};I.intentConfig.forEach((t=>{let{key:s,type:i,tagText:o}=t;P[s]&&(xe[P[s]]=e.jsx(m.Tag,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const je=V.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Ce=V.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),ye=h.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=>{P[t]&&(e[P[t]]=P[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[P]);h.useEffect((()=>{var e,t,s,i;if(!(null==A?void 0:A.messageId))return;ee(!0),se(!0),oe(!1!==(null===(t=null===(e=A.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=A.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=A.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));G(_,n).then((e=>le(e))).then((()=>{W?(ce(W),setTimeout((()=>{ee(!1),se(!1)}),100)):(setTimeout((()=>ee(!1)),100),Q(_).then((e=>ce(e))).then((()=>setTimeout((()=>{se(!1)}),100))))}))}),[G,Q,null==A?void 0:A.messageId,A.sources,W,_]);const Oe=e=>!!(e&&0===e.length||(null==A?void 0:A.isUnsatisfactoryAnswer)),me=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:J.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," ")},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")):"",fe=s=>"products"==s||"product"==s?e.jsx(t.default,{height:16,width:16,color:x.COLORS.content.secondary}):"files"==s?e.jsx(l.default,{height:16,width:16,color:x.COLORS.content.secondary}):"website links"==s||"fetched links"==s?e.jsx(g.default,{height:16,width:16,color:x.COLORS.content.secondary}):"faq"==s?e.jsx(a.default,{height:16,width:16,color:x.COLORS.content.secondary}):"texts"==s?e.jsx(p.default,{height:16,width:16,color:x.COLORS.content.secondary}):e.jsx(d.default,{height:16,width:16,color:x.COLORS.content.secondary}),Se=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(Z||!B)return e.jsx(T.SourceInfoDetailsStyle,{children:e.jsx(y.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"}]})});const Te=t=>{const{title:o,count:n,isExpanded:l,onToggle:a,children:r}=t;return e.jsxs("div",{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:a},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsx(f.BodyCaption,Object.assign({style:{fontWeight:"600"}},{children:o})),R===E.__exports.ApplicationType.MANIFEST?e.jsx("div",Object.assign({style:{backgroundColor:x.COLORS.surface.subdued,color:x.COLORS.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:n})):e.jsx(e.Fragment,{})]})),e.jsx(e.Fragment,{children:R===E.__exports.ApplicationType.BIK?e.jsx(e.Fragment,{}):l?e.jsx(s.default,{width:20,height:20,color:x.COLORS.content.primary}):e.jsx(i.default,{width:20,height:20,color:x.COLORS.content.primary})})]})),l&&r]})};return e.jsxs(e.Fragment,{children:[e.jsx(T.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!M&&e.jsx(f.TitleSmall,{children:M}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:"Intent"})),null!==(D=xe[A.intent])&&void 0!==D?D:xe.GENERIC,!q&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>F(void 0)},{children:e.jsx(o.default,{height:20,width:20,color:x.COLORS.content.secondary})}))]})),Oe(V)?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:`${x.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(r.default,{width:24,height:24,color:x.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(f.TitleSmall,{children:"Insufficient data"})})),e.jsx(f.BodySecondary,Object.assign({color:x.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"})),U&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(j.Button,{LeadingIcon:null!==(t=U.leadingIcon)&&void 0!==t?t:c.default,buttonText:null!==(s=U.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{U.onClick()}})}))]}))})()})):e.jsx(m.Tag,{LeadingIcon:r.default,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 ${R===E.__exports.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Oe(V)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsx(e.Fragment,{children:je.length>0&&e.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsx(Te,Object.assign({title:"Product Sources",count:je.length,isExpanded:R!==E.__exports.ApplicationType.MANIFEST||ue,onToggle:()=>pe(!ue)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:je.map(((t,s)=>{var i,o,l,a;const r=me(t.type||t.subTitle||"OpenAI"),d=me(t.type||t.subTitle||"OpenAI",!0),c=ve(r),p=null==K?void 0:K.includes(d),g=k[null!==(i=t.productId)&&void 0!==i?i:"Products"],h=t.title,j=t.productId&&(null==Y?void 0:Y[t.productId]),y=j&&j.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==je?void 0:je.length)?`1px solid ${x.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:[fe(r),e.jsx(v.Tooltip,Object.assign({body:h,placement:"top"},{children:e.jsx(f.BodySecondary,Object.assign({style:d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.COLORS.content.primary,className:"clamp-title",onClick:()=>d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:h}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==P.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:c}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(C.IconButton,{Icon:n.default,height:16,width:16,iconColor:x.COLORS.content.secondary,onClick:()=>null==g?void 0:g.onEditClick(g.data,g.type),disabled:!g,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:u.default,height:16,width:16,iconColor:x.COLORS.content.secondary,disabled:"custom"===t.type&&!g,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),j&&e.jsxs(f.BodyCaption,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;re({title:h,description:Se(j.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>re(void 0)})}},{children:`${null===(o=j.description)||void 0===o?void 0:o.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(v.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-${s}`)}))}))}))}))}),e.jsx(e.Fragment,{children:Ce.length>0&&e.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsx(Te,Object.assign({title:"Content Sources",count:Ce.length,isExpanded:R!==E.__exports.ApplicationType.MANIFEST||ge,onToggle:()=>he(!ge)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ce.map(((t,s)=>{var i,o,l,a,r,d,c,p,g,h,j,y,O,m,S,T,I;const b=me(t.type||t.subTitle||"OpenAI"),E=me(t.type||t.subTitle||"OpenAI",!0),w=ve(b),D=null==K?void 0:K.includes(E),N="Products"===t.subTitle?k[null!==(i=t.productId)&&void 0!==i?i:"Products"]:k[null!==(o=t.docId)&&void 0!==o?o:""],R=E.toLowerCase()===(null===(l=L.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=L.CustomDataType.FILES)||void 0===r?void 0:r.toLowerCase())||E.toLowerCase()===(null===(d=L.CustomDataType.FETCHED_LINKS)||void 0===d?void 0:d.toLowerCase())||E.toLowerCase()===(null===(c=L.CustomDataType.TEXTS)||void 0===c?void 0:c.toLowerCase())?t.title:E.toLowerCase()===(null===(p=L.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,s)=>t.toUpperCase()+s)):t.intent===P.EMAIL_COLLECTION?w:t.title,_="faq"===E.toLowerCase()?null!==(j=null!==(g=null==N?void 0:N.content)&&void 0!==g?g:null===(h=null==N?void 0:N.data)||void 0===h?void 0:h.answer)&&void 0!==j?j:"":E.toLowerCase()===(null===(y=L.CustomDataType.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||E.toLowerCase()===(null===(O=L.CustomDataType.WEBSITE_LINKS)||void 0===O?void 0:O.toLowerCase())||E.toLowerCase()===(null===(m=L.CustomDataType.TEXTS)||void 0===m?void 0:m.toLowerCase())?null!==(I=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!==I?I:"":t.intent===P.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Ce?void 0:Ce.length)?`1px solid ${x.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:[fe(b),e.jsx(v.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(f.BodySecondary,Object.assign({style:E==L.CustomDataType.FETCHED_LINKS||E==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.COLORS.content.primary,className:"clamp-title",onClick:()=>E==L.CustomDataType.FETCHED_LINKS||E==L.CustomDataType.WEBSITE_LINKS?H(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!==P.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:w}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:D?e.jsx(C.IconButton,{Icon:n.default,height:16,width:16,iconColor:x.COLORS.content.secondary,onClick:()=>null==N?void 0:N.onEditClick(N.data,N.type),disabled:!N,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:u.default,height:16,width:16,iconColor:x.COLORS.content.secondary,disabled:"custom"===t.type&&!N,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${x.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:x.COLORS.surface.subdued}},{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.primary,className:"clamp-description"},{children:Se(null!=_?_:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]})),ie&&!Oe(V)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(S.default,{appType:R,storeId:_,messageSource:A,sourceIntent:null!==(N=A.intent)&&void 0!==N?N:P.GENERIC,faqCount:ne,trainingSourceCount:de,ShowTrainingDataSource:ye,ChecklistType:P,footerButtonOption:$,isFooterLoading:te,reasonForAiGeneratedResponse:z,showAiResponseReason:X})}))]})}),ae&&e.jsx(O.SideModal,Object.assign({header:"Product description",onClose:()=>re(void 0),width:"30%"},{children:e.jsx(b.DescriptionModal,{title:ae.title,description:ae.description,imageUrl:ae.imageUrl,onClose:ae.onClose})}))]})};
@@ -1,3 +1,4 @@
1
1
  export declare const SourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const WithoutContentSourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const SourceInfoFooterStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const DataSourceCountStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -15,9 +15,9 @@
15
15
  display: flex;
16
16
  flex-direction: column;
17
17
  gap: 8px;
18
+ background-color: ${o.COLORS.surface.hovered};
18
19
  .source {
19
20
  border-radius: 12px;
20
- background-color: ${o.COLORS.surface.subdued};
21
21
  }
22
22
  }
23
23
  .info-product-source {
@@ -25,6 +25,7 @@
25
25
  display: flex;
26
26
  flex-direction: column;
27
27
  gap: 8px;
28
+ background-color: ${o.COLORS.surface.hovered};
28
29
 
29
30
  .product-data-text1 {
30
31
  padding: 2px;
@@ -41,7 +42,6 @@
41
42
  }
42
43
  .source {
43
44
  border-radius: 12px;
44
- background-color: ${o.COLORS.surface.subdued};
45
45
  }
46
46
  }
47
47
  .pop-up-header {
@@ -157,4 +157,13 @@
157
157
  display: flex;
158
158
  gap: 8px;
159
159
  }
160
- `;exports.SourceInfoDetailsStyle=l,exports.SourceInfoFooterStyle=p;
160
+ `;i.default.div`
161
+ display: flex;
162
+ align-items: center;
163
+ justify-content: center;
164
+ width: 24px;
165
+ height: 24px;
166
+ background-color: ${o.COLORS.surface.subdued};
167
+ border-radius: 22px;
168
+ border: 1px solid ${o.COLORS.stroke.primary};
169
+ `,exports.SourceInfoDetailsStyle=l,exports.SourceInfoFooterStyle=p;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../TypographyStyle.js"),r=require("../../../constants/Theme.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(e);const a=i.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../TypographyStyle.js"),r=require("../../../constants/Theme.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(e);const d=i.default.div`
2
2
  background: ${r.COLORS.surface.standard};
3
3
  border-top-left-radius: ${e=>e.isCarouselCard?"12px":"0px"};
4
4
  border-top-right-radius: 12px;
@@ -9,7 +9,7 @@
9
9
  border: 2px solid
10
10
  ${e=>e.hasError?`${r.COLORS.content.negative}`:e.showBorder?`${r.COLORS.stroke.brand}`:`${r.COLORS.stroke.primary}`};
11
11
  border: ${e=>e.showDashedBorder&&`2px dashed ${r.COLORS.content.brand}`};
12
- height: ${e=>e.isWhatsappCarousel?"100%":"auto"};
12
+ height: 100%;
13
13
  display: flex;
14
14
  flex-direction: column;
15
15
  :hover {
@@ -18,16 +18,16 @@
18
18
  ${r.COLORS.stroke.brand};
19
19
  box-shadow: ${e=>!e.isPreview&&"4px 4px 12px rgba(0, 0, 0, 0.25)"};
20
20
  }
21
- `,d=i.default(t.Caption)`
21
+ `,a=i.default(t.Caption)`
22
22
  color: ${r.COLORS.content.secondary};
23
23
  max-width: 80px;
24
24
  text-overflow: ellipsis;
25
25
  white-space: nowrap;
26
26
  overflow: hidden;
27
27
  text-wrap: wrap;
28
- `,s=i.default(d)`
28
+ `,s=i.default(a)`
29
29
  max-width: 200px;
30
- `,p=i.default.div`
30
+ `,n=i.default.div`
31
31
  border-radius: 8px;
32
32
  display: flex;
33
33
  flex-direction: column;
@@ -36,14 +36,14 @@
36
36
  min-height: 152px;
37
37
  margin-bottom: 4px;
38
38
  margin: 0px 8px;
39
- `,n=i.default.div`
39
+ `,p=i.default.div`
40
40
  padding: 12px;
41
41
  display: flex;
42
42
  flex-direction: row;
43
43
  justify-content: center;
44
44
  align-items: center;
45
45
  border-top: 1px solid ${r.COLORS.stroke.primary};
46
- `,l=i.default.div`
46
+ `,x=i.default.div`
47
47
  display: flex;
48
48
  flex-direction: row;
49
49
  justify-content: space-between;
@@ -66,4 +66,4 @@
66
66
  position: absolute;
67
67
  top: 16px;
68
68
  right: 16px;
69
- `,exports.ChatBtnContainer=n,exports.Container=a,exports.FooterText=s,exports.FooterWrapper=l,exports.MediaContainer=p,exports.TimeStamp=d;
69
+ `,exports.ChatBtnContainer=p,exports.Container=d,exports.FooterText=s,exports.FooterWrapper=x,exports.MediaContainer=n,exports.TimeStamp=a;
@@ -8,4 +8,4 @@
8
8
  height: ${e=>e.isWhatsappCarousel?"100%":"auto"};
9
9
  `,c=u.default(a.TitleRegular)`
10
10
  color: ${i.COLORS.content.primary};
11
- `;exports.WhatsappLikePreviewV2=t=>{const{hideDeviceContainerInPreview:s}=r.useTemplateModalContext();return 3===o.getPreviewPropLen(t)?e.jsx(e.Fragment,{children:t.zeroStateComponent}):s?e.jsx(p.ChatUIV2,Object.assign({showHeader:t.showHeader},t)):e.jsx(e.Fragment,{children:e.jsxs(d,Object.assign({style:t.containerStyle,showHeader:t.showHeader,isWhatsappCarousel:t.isWhatsappCarousel},{children:[t.showHeader&&e.jsx(n.default,{}),e.jsxs("div",Object.assign({style:{padding:"small"===t.size?"12px 32px 12px 12px":`16px ${t.isWhatsappCarousel?"0px":"56px"} ${t.isWhatsappCarousel?"2px":"16px"} 16px`,height:"100%",overflowY:"auto"}},{children:[!t.hidePreviewText&&e.jsx("div",Object.assign({style:{marginBottom:16}},{children:e.jsx(c,{children:"Preview"})})),e.jsx(p.ChatUIV2,Object.assign({showHeader:t.showHeader},t))]}))]}))})};
11
+ `;exports.WhatsappLikePreviewV2=t=>{const{hideDeviceContainerInPreview:s}=r.useTemplateModalContext();return 3===o.getPreviewPropLen(t)?e.jsx(e.Fragment,{children:t.zeroStateComponent}):s?e.jsx(p.ChatUIV2,Object.assign({showHeader:t.showHeader},t)):e.jsx(e.Fragment,{children:e.jsxs(d,Object.assign({style:t.containerStyle,showHeader:t.showHeader,isWhatsappCarousel:t.isWhatsappCarousel},{children:[t.showHeader&&e.jsx(n.default,{}),e.jsxs("div",Object.assign({style:{padding:"small"===t.size?"12px 32px 12px 12px":`16px ${t.isWhatsappCarousel?"0px":"56px"} ${t.isWhatsappCarousel?"2px":"16px"} 16px`,height:t.isWhatsappCarousel?"100%":"auto"}},{children:[!t.hidePreviewText&&e.jsx("div",Object.assign({style:{marginBottom:16}},{children:e.jsx(c,{children:"Preview"})})),e.jsx(p.ChatUIV2,Object.assign({showHeader:t.showHeader},t))]}))]}))})};
@@ -1 +1 @@
1
- import{__rest as t}from"../../_virtual/_tslib.js";import{jsx as e,jsxs as n,Fragment as i}from"react/jsx-runtime";import o,{forwardRef as s}from"react";import{Spinner as a}from"../spinner/Spinner.js";import{Button as r,ButtonCustomDashedBorder as c}from"./Button.styled.js";import{getButtonIconColor as l,SpinnerColorMap as d,GetButtonTextComponent as m}from"./themes.js";const b=s(((s,b)=>{var{version:u,id:g,buttonType:h="primary",size:p="small",buttonText:v,disabled:j,IconComponent:y,LeadingIcon:C,TrailingIcon:I,isLoading:x,inverse:N,onClick:z,matchParentWidth:O,subtitle:T,darkMode:f,activated:k,error:L,buttonTextColor:S,buttonFontSize:W,customIconColor:B,buttonColor:E,LeadingIconStyles:M}=s,P=t(s,["version","id","buttonType","size","buttonText","disabled","IconComponent","LeadingIcon","TrailingIcon","isLoading","inverse","onClick","matchParentWidth","subtitle","darkMode","activated","error","buttonTextColor","buttonFontSize","customIconColor","buttonColor","LeadingIconStyles"]);const F=m(p,h,j),_=l(p,h,N,j,x,f),w="chip"===p?16:20,q={height:w,width:w,color:B||_,style:{display:"block"},className:"icon"};return e(r,Object.assign({"data-test":P["data-test"],version:u,onClick:x?()=>{}:z,ref:b,id:g,disabled:j,size:p,buttonType:h,isLoading:x,inverse:N,matchParentWidth:O,darkMode:f,activated:k,error:L,buttonColor:E},P,{children:n("div",Object.assign({className:"button-container"},{children:[h.startsWith("dash")&&e(c,{}),e("div",Object.assign({className:"overlay-container"},{children:x&&e(a,{className:"spinner",size:"small",color:d(h,N)})})),y&&e("div",Object.assign({className:"icon-component"},{children:o.createElement(y,q)})),C&&e("div",Object.assign({className:"icon-leading",style:Object.assign({zIndex:1},M)},{children:o.createElement(C,q)})),v?n(F,Object.assign({className:"text",style:{color:S,fontSize:W}},{children:[v,e("div",Object.assign({className:"text-subtitle"},{children:T}))]})):e(i,{}),I&&e("div",Object.assign({className:"icon-trailing",style:{zIndex:1}},{children:o.createElement(I,q)}))]}))}))}));b.displayName="Button";export{b as Button};
1
+ import{__rest as t}from"../../_virtual/_tslib.js";import{jsx as e,jsxs as i,Fragment as n}from"react/jsx-runtime";import o,{forwardRef as s}from"react";import{Spinner as a}from"../spinner/Spinner.js";import{Button as r,ButtonCustomDashedBorder as c}from"./Button.styled.js";import{getButtonIconColor as l,SpinnerColorMap as d,GetButtonTextComponent as m}from"./themes.js";const b=s(((s,b)=>{var{version:u,id:h,buttonType:p="primary",size:g="small",buttonText:v,disabled:j,IconComponent:y,LeadingIcon:C,TrailingIcon:x,isLoading:I,inverse:N,onClick:z,matchParentWidth:T,subtitle:f,darkMode:O,activated:k,error:L,buttonTextColor:S,buttonFontSize:W,customIconColor:B,buttonColor:E}=s,M=t(s,["version","id","buttonType","size","buttonText","disabled","IconComponent","LeadingIcon","TrailingIcon","isLoading","inverse","onClick","matchParentWidth","subtitle","darkMode","activated","error","buttonTextColor","buttonFontSize","customIconColor","buttonColor"]);const P=m(g,p,j),F=l(g,p,N,j,I,O),_="chip"===g?16:20,w={height:_,width:_,color:B||F,style:{display:"block"},className:"icon"};return e(r,Object.assign({"data-test":M["data-test"],version:u,onClick:I?()=>{}:z,ref:b,id:h,disabled:j,size:g,buttonType:p,isLoading:I,inverse:N,matchParentWidth:T,darkMode:O,activated:k,error:L,buttonColor:E},M,{children:i("div",Object.assign({className:"button-container"},{children:[p.startsWith("dash")&&e(c,{}),e("div",Object.assign({className:"overlay-container"},{children:I&&e(a,{className:"spinner",size:"small",color:d(p,N)})})),y&&e("div",Object.assign({className:"icon-component"},{children:o.createElement(y,w)})),C&&e("div",Object.assign({className:"icon-leading",style:{zIndex:1}},{children:o.createElement(C,w)})),v?i(P,Object.assign({className:"text",style:{color:S,fontSize:W}},{children:[v,e("div",Object.assign({className:"text-subtitle"},{children:f}))]})):e(n,{}),x&&e("div",Object.assign({className:"icon-trailing",style:{zIndex:1}},{children:o.createElement(x,w)}))]}))}))}));b.displayName="Button";export{b as Button};
@@ -35,11 +35,6 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
35
35
  * @default undefined
36
36
  */
37
37
  LeadingIcon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
38
- /**
39
- * Custom styles to be applied to the LeadingIcon
40
- * @default undefined
41
- */
42
- LeadingIconStyles?: React.CSSProperties;
43
38
  /**
44
39
  * The icon component that is the left of the buttonText
45
40
  * Referred to https://ozzie.sh/passing-icons-as-props-in-a-consistent-way-using-react
@@ -9,7 +9,7 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
9
9
  background-position: center;
10
10
  background-size: cover;
11
11
  position: relative;
12
- height: 100%;
12
+ height: 500px;
13
13
  overflow-y: auto;
14
14
  border-radius: ${e=>{var o;return null!==(o=e.borderRadius)&&void 0!==o?o:"0px"}};
15
15
  `,t=e.div`
@@ -17,6 +17,8 @@ interface SourceInfoFooterProps {
17
17
  ChecklistType: Record<string, string>;
18
18
  footerButtonOption?: footerButtonOptionModel;
19
19
  isFooterLoading?: boolean;
20
+ reasonForAiGeneratedResponse?: string;
21
+ showAiResponseReason?: boolean;
20
22
  }
21
23
  declare const SourceInfoFooter: import("react").MemoExoticComponent<(props: SourceInfoFooterProps) => import("react/jsx-runtime").JSX.Element>;
22
24
  export default SourceInfoFooter;
@@ -1 +1 @@
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
+ import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import i from"../../assets/icons/alert_triangle.svg.js";import n from"../../assets/icons/plus.svg.js";import{memo as r,useState as a,useMemo as s,useEffect as d}from"react";import{COLORS as l}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 h}from"./DataSourcePanel.style.js";import{__exports as m}from"../../_virtual/bik-store.js";const v=r((r=>{const{appType:v,sourceIntent:b,hideHeading:A,messageSource:y,trainingSourceCount:f={},ShowTrainingDataSource:_={},faqCount:I,ChecklistType:R,footerButtonOption:O,isFooterLoading:w,reasonForAiGeneratedResponse:N,showAiResponseReason:k}=r,C=_,[F,j]=a(!0),[D,E]=a(!0),S="/bik-ai/training",[x,P]=a({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[U,M]=a({title:"",subTitle:""}),q=s((()=>{const e=(null==f?void 0:f[b])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[f,b]),L=()=>{var e;(null==x?void 0:x.redirectUrl)?window.open(`${window.location.origin}${null==x?void 0:x.redirectUrl}`,"_self"):Object.keys(null!==(e=null==x?void 0:x.addFaqProps)&&void 0!==e?e:{}).length>0?null==O||O.onClick(x):(null==O?void 0:O.navigate)&&(null==O||O.navigate("Training",v==m.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return d((()=>{var e,o,t,i;if(b){if(null===(e=null==y?void 0:y.sources)||void 0===e?void 0:e.length){const e=y.sources[0];if(C[b])b===R.ORDER_ENQUIRY&&E(!1);else{let n=null==e?void 0:e.insights,r="";switch(b){case R.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",P({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 R.ORDER_MODIFICATION:n=(null==f?void 0:f[b])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",n&&P({buttonTitle:v==m.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:v==m.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":S,addFaqProps:{}});break;case R.ORDER_CANCELLATION:n=(null==f?void 0:f[b])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",P({buttonTitle:v==m.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:v==m.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":S,addFaqProps:{}});break;case R.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;P({buttonTitle:v==m.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:v==m.ApplicationType.MANIFEST?"/training/order-management":S,addFaqProps:{}});break;case R.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(i=null===(t=null===(o=null==y?void 0:y.sources)||void 0===o?void 0:o[0])||void 0===t?void 0:t.title)||void 0===i?void 0:i.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."}M({title:null!=n?n:"",subTitle:r})}}(C[b]||[R.PRODUCT_DETAILS,R.ORDER_MODIFICATION,R.ORDER_CANCELLATION,R.ORDER_TRACKING].includes(b))&&j(!1)}}),[null==y?void 0:y.messageId,f,b,null==y?void 0:y.sources,C,R,I,v,y]),e(h,{children:e(o,w?{children:e(u,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}:{children:!(null==U?void 0:U.title)&&f&&b in f?t(o,{children:[e(g,{hideHeading:null!=A&&A}),e(T,{reason:N||"",showAiResponseReason:null!=k&&k}),t("div",Object.assign({className:"source_info_details "+(f[b]>0?"":"no_data_source")},{children:[f[b]>0&&D?t(o,{children:[e(p,{children:q}),e(p,Object.assign({color:l.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):D&&t("div",Object.assign({className:"no_data_source_title"},{children:[e(i,{width:15,height:15,color:l.content.negative,style:{marginTop:2}}),e(p,{children:"No data sources added to the identified link"})]})),!O||O.hideAddDataButton||F?e(o,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==x?void 0:x.buttonTitle.length)>0?null==x?void 0:x.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>L(),style:{backgroundColor:"unset"}})]}))]}):t(o,{children:[e(g,{hideHeading:null!=A&&A}),e(T,{reason:N||"",showAiResponseReason:null!=k&&k}),t("div",Object.assign({className:"source_info_details"},{children:[D&&t(o,{children:[e(p,{children:null==U?void 0:U.title}),e(p,Object.assign({color:l.content.secondary},{children:null==U?void 0:U.subTitle}))]}),!O||O.hideAddDataButton||F?e(o,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==x?void 0:x.buttonTitle.length)>0?null==x?void 0:x.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>L(),style:{backgroundColor:"unset"}})]}))]})})})})),g=r((o=>o.hideHeading?null:e(p,Object.assign({color:l.content.secondary},{children:"Training insights"})))),T=r((i=>{const[n,r]=a(!1),s=i.reason&&i.reason.length>50,d=s&&!n?i.reason.substring(0,50)+"...":i.reason;return i.showAiResponseReason?t("div",Object.assign({className:"source_info_details"},{children:[e(p,Object.assign({color:l.content.primary,className:"why_ai_gave_this_response"},{children:"Here’s why your AI gave this response"})),t(p,Object.assign({color:l.content.secondary,className:"clamp-text"},{children:[d||"No reason provided for this response.",s&&e(p,Object.assign({color:l.content.brand,style:{cursor:"pointer",textDecoration:"underline",marginTop:"4px"},onClick:()=>r(!n)},{children:n?"Show less":"Show more"}))]}))]})):e(o,{})}));T.displayName="WhyAiGaveThisResponse",g.displayName="TrainingInsightsHeading",v.displayName="SourceInfoFooter";export{v as default};
@@ -1,6 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource, ProductSourceData } from './model';
4
+ export interface CollapsibleSectionProps {
5
+ title: string;
6
+ count: number;
7
+ isExpanded: boolean;
8
+ onToggle: () => void;
9
+ children: React.ReactNode;
10
+ }
4
11
  export interface DataSourcePanelProps {
5
12
  storeId: string;
6
13
  appType: ApplicationType;
@@ -23,5 +30,7 @@ export interface DataSourcePanelProps {
23
30
  }>;
24
31
  fetchProductFAQCount: (storeId: string, productIds?: string[]) => Promise<number>;
25
32
  productSourceData?: ProductSourceData;
33
+ reasonForAiGeneratedResponse?: string;
34
+ showAiResponseReason?: boolean;
26
35
  }
27
36
  export declare const DataSourcePanel: React.FC<DataSourcePanelProps>;
@@ -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 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};
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/chevronDownOutline.svg.js";import s from"../../assets/icons/chevronUpOutline.svg.js";import l from"../../assets/icons/cross.svg.js";import r from"../../assets/icons/edit.svg.js";import a from"../../assets/icons/filePdf.svg.js";import c from"../../assets/icons/help.svg.js";import d from"../../assets/icons/info.svg.js";import p from"../../assets/icons/openai.svg.js";import u from"../../assets/icons/plus.svg.js";import g from"../../assets/icons/redirect.svg.js";import h from"../../assets/icons/text_t9.svg.js";import m from"../../assets/icons/website.svg.js";import{useState as f,useMemo as v,useEffect as y}from"react";import{COLORS as x}from"../../constants/Theme.js";import{Button as C}from"../button/Button.js";import{IconButton as I}from"../icon-button/IconButton.js";import{BikShimmer as b}from"../shimmer/ShimmerComponent/BikShimmer.js";import{SideModal as T}from"../side-modal/SideModal.js";import{Tag as j}from"../tag/Tag.js";import{Tooltip as O}from"../tooltips/Tooltip.js";import{TitleSmall as E,BodyCaption as S,BodySecondary as L}from"../TypographyStyle.js";import w from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as N}from"./DataSourcePanel.style.js";import{intentConfig as A}from"./IntentConfig.js";import{DescriptionModal as _}from"./Modals/DescriptionModal.js";import{CustomDataType as D}from"./model.js";import{__exports as k}from"../../_virtual/bik-store.js";const F=F=>{var R,B;const{appType:P,storeId:U,messageSource:K,setMessageSourcePanel:M,hideCloseButton:W,isSourceInfoFetched:H,allSourceInfoDetail:$,ChecklistType:q,title:Q,zeroStateButton:G,editableSources:Y,preFillTrainingSourceCount:z,redirect:X,footerButtonOption:V,fetchTrainingSourceCount:J,fetchProductFAQCount:Z,productSourceData:ee,reasonForAiGeneratedResponse:te,showAiResponseReason:ie}=F,{sources:oe}=K,ne=["blog","article","page","policy"],[se,le]=f(!1),[re,ae]=f(!1),[ce,de]=f(!1),[pe,ue]=f(0),[ge,he]=f(),[me,fe]=f(null!=z?z:{}),[ve,ye]=f(!1),[xe,Ce]=f(!1),Ie={};A.forEach((t=>{let{key:i,type:o,tagText:n}=t;q[i]&&(Ie[q[i]]=e(j,{theme:"light",type:o,tagText:n,cursor:"pointer"}))}));const be=oe.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Te=oe.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),je=v((()=>{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=>{q[t]&&(e[q[t]]=q[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[q]);y((()=>{var e,t,i,o;if(!(null==K?void 0:K.messageId))return;le(!0),ae(!0),de(!1!==(null===(t=null===(e=K.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=K.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights));const n=K.sources.filter((e=>!!e.productId)).map((e=>e.productId)),s=Array.from(new Set(n)).filter((e=>!!e));Z(U,s).then((e=>ue(e))).then((()=>{z?(fe(z),setTimeout((()=>{le(!1),ae(!1)}),100)):(setTimeout((()=>le(!1)),100),J(U).then((e=>fe(e))).then((()=>setTimeout((()=>{ae(!1)}),100))))}))}),[Z,J,null==K?void 0:K.messageId,K.sources,z,U]);const Oe=e=>!!(e&&0===e.length||(null==K?void 0:K.isUnsatisfactoryAnswer)),Ee=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=D.FILES:ne.includes(e)?e=D.FETCHED_LINKS:"url"==e?e=D.WEBSITE_LINKS:"text"===e?e=D.TEXTS:"faq"===e&&(e=D.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},Se=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",Le=t=>e("products"==t||"product"==t?o:"files"==t?a:"website links"==t||"fetched links"==t?m:"faq"==t?c:"texts"==t?h:p,{height:16,width:16,color:x.content.secondary}),we=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};if(se||!H)return e(N,{children:e(b,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})});const Ne=o=>{const{title:l,count:r,isExpanded:a,onToggle:c,children:d}=o;return t("div",{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:c},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e(S,Object.assign({style:{fontWeight:"600"}},{children:l})),P===k.ApplicationType.MANIFEST?e("div",Object.assign({style:{backgroundColor:x.surface.subdued,color:x.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:r})):e(i,{})]})),e(i,{children:P===k.ApplicationType.BIK?e(i,{}):e(a?n:s,{width:20,height:20,color:x.content.primary})})]})),a&&d]})};return t(i,{children:[e(N,{children:t(i,{children:[t("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!Q&&e(E,{children:Q}),t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e(S,Object.assign({color:x.content.secondary},{children:"Intent"})),null!==(R=Ie[K.intent])&&void 0!==R?R:Ie.GENERIC,!W&&e("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>M(void 0)},{children:e(l,{height:20,width:20,color:x.content.secondary})}))]})),Oe(oe)?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:`${x.background.negative.light}`,borderRadius:"100px"}},{children:e(d,{width:24,height:24,color:x.stroke.negative.vibrant})})),e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e(E,{children:"Insufficient data"})})),e(L,Object.assign({color:x.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"})),G&&e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(C,{LeadingIcon:null!==(i=G.leadingIcon)&&void 0!==i?i:u,buttonText:null!==(o=G.title)&&void 0!==o?o:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{G.onClick()}})}))]}))})()})):e(j,{LeadingIcon:d,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:K.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===k.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Oe(oe)&&t("div",Object.assign({className:"info-container"},{children:[e(i,{children:be.length>0&&e("div",Object.assign({className:"info-product-source"},{children:e(Ne,Object.assign({title:"Product Sources",count:be.length,isExpanded:P!==k.ApplicationType.MANIFEST||ve,onToggle:()=>ye(!ve)},{children:e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:be.map(((o,n)=>{var s,l,a,c;const d=Ee(o.type||o.subTitle||"OpenAI"),p=Ee(o.type||o.subTitle||"OpenAI",!0),u=Se(d),h=null==Y?void 0:Y.includes(p),m=$[null!==(s=o.productId)&&void 0!==s?s:"Products"],f=o.title,v=o.productId&&(null==ee?void 0:ee[o.productId]),y=v&&v.metafield.join(", ");return t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:n+1<(null==be?void 0:be.length)?`1px solid ${x.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:[Le(d),e(O,Object.assign({body:f,placement:"top"},{children:e(L,Object.assign({style:p==D.FETCHED_LINKS||p==D.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.content.primary,className:"clamp-title",onClick:()=>p==D.FETCHED_LINKS||p==D.WEBSITE_LINKS?X(o):{}},{children:f}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==q.EMAIL_COLLECTION&&e(i,{children:e(S,Object.assign({color:x.content.secondary},{children:u}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(I,h?{Icon:r,height:16,width:16,iconColor:x.content.secondary,onClick:()=>null==m?void 0:m.onEditClick(m.data,m.type),disabled:!m,disabledTooltip:"This source is deleted"}:{Icon:g,height:16,width:16,iconColor:x.content.secondary,disabled:"custom"===o.type&&!m,disabledTooltip:"This source is deleted",onClick:()=>X(o)})}))]}))]})),v&&t(S,{children:[e("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;he({title:f,description:we(v.description),imageUrl:null!==(e=o.imageUrl)&&void 0!==e?e:"",onClose:()=>he(void 0)})}},{children:`${null===(l=v.description)||void 0===l?void 0:l.length} characters description,`})),e("span",Object.assign({className:"product-data-text1",onClick:()=>v.onEditFaqClick(v.faqs)},{children:`${null===(a=v.faqs)||void 0===a?void 0:a.length} FAQs, `})),e("span",Object.assign({className:"product-data-text2"},{children:"and"})),e(O,Object.assign({body:y,placement:"top"},{children:e("span",Object.assign({className:"product-data-text1"},{children:`${null===(c=v.metafield)||void 0===c?void 0:c.length} metafields`}))}))]})]}),`info-${n}`)}))}))}))}))}),e(i,{children:Te.length>0&&e("div",Object.assign({className:"info-content-source"},{children:e(Ne,Object.assign({title:"Content Sources",count:Te.length,isExpanded:P!==k.ApplicationType.MANIFEST||xe,onToggle:()=>Ce(!xe)},{children:e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Te.map(((o,n)=>{var s,l,a,c,d,p,u,h,m,f,v,y,C,b,T,j,E;const w=Ee(o.type||o.subTitle||"OpenAI"),N=Ee(o.type||o.subTitle||"OpenAI",!0),A=Se(w),_=null==Y?void 0:Y.includes(N),k="Products"===o.subTitle?$[null!==(s=o.productId)&&void 0!==s?s:"Products"]:$[null!==(l=o.docId)&&void 0!==l?l:""],F=N.toLowerCase()===(null===(a=D.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=D.FILES)||void 0===d?void 0:d.toLowerCase())||N.toLowerCase()===(null===(p=D.FETCHED_LINKS)||void 0===p?void 0:p.toLowerCase())||N.toLowerCase()===(null===(u=D.TEXTS)||void 0===u?void 0:u.toLowerCase())?o.title:N.toLowerCase()===(null===(h=D.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===q.EMAIL_COLLECTION?A:o.title,R="faq"===N.toLowerCase()?null!==(v=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!==v?v:"":N.toLowerCase()===(null===(y=D.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||N.toLowerCase()===(null===(C=D.WEBSITE_LINKS)||void 0===C?void 0:C.toLowerCase())||N.toLowerCase()===(null===(b=D.TEXTS)||void 0===b?void 0:b.toLowerCase())?null!==(E=null!==(T=null==k?void 0:k.content)&&void 0!==T?T:null===(j=null==k?void 0:k.data)||void 0===j?void 0:j.fileContentText)&&void 0!==E?E:"":o.intent===q.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==Te?void 0:Te.length)?`1px solid ${x.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:[Le(w),e(O,Object.assign({body:F,placement:"top"},{children:e(L,Object.assign({style:N==D.FETCHED_LINKS||N==D.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.content.primary,className:"clamp-title",onClick:()=>N==D.FETCHED_LINKS||N==D.WEBSITE_LINKS?X(o):{}},{children:F}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==q.EMAIL_COLLECTION&&e(i,{children:e(S,Object.assign({color:x.content.secondary},{children:A}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(I,_?{Icon:r,height:16,width:16,iconColor:x.content.secondary,onClick:()=>null==k?void 0:k.onEditClick(k.data,k.type),disabled:!k,disabledTooltip:"This source is deleted"}:{Icon:g,height:16,width:16,iconColor:x.content.secondary,disabled:"custom"===o.type&&!k,disabledTooltip:"This source is deleted",onClick:()=>X(o)})}))]}))]})),(null!=R?R:"").trim()&&e("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${x.stroke.primary}`,borderRadius:"4px",backgroundColor:x.surface.subdued}},{children:e(S,Object.assign({color:x.content.primary,className:"clamp-description"},{children:we(null!=R?R:"").trim()}))}))]}),`info-${n}`)}))}))}))}))})]})),ce&&!Oe(oe)&&e("div",Object.assign({className:"footer"},{children:e(w,{appType:P,storeId:U,messageSource:K,sourceIntent:null!==(B=K.intent)&&void 0!==B?B:q.GENERIC,faqCount:pe,trainingSourceCount:me,ShowTrainingDataSource:je,ChecklistType:q,footerButtonOption:V,isFooterLoading:re,reasonForAiGeneratedResponse:te,showAiResponseReason:ie})}))]})}),ge&&e(T,Object.assign({header:"Product description",onClose:()=>he(void 0),width:"30%"},{children:e(_,{title:ge.title,description:ge.description,imageUrl:ge.imageUrl,onClose:ge.onClose})}))]})};export{F as DataSourcePanel};
@@ -1,3 +1,4 @@
1
1
  export declare const SourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const WithoutContentSourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const SourceInfoFooterStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const DataSourceCountStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -15,9 +15,9 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
15
15
  display: flex;
16
16
  flex-direction: column;
17
17
  gap: 8px;
18
+ background-color: ${o.surface.hovered};
18
19
  .source {
19
20
  border-radius: 12px;
20
- background-color: ${o.surface.subdued};
21
21
  }
22
22
  }
23
23
  .info-product-source {
@@ -25,6 +25,7 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
25
25
  display: flex;
26
26
  flex-direction: column;
27
27
  gap: 8px;
28
+ background-color: ${o.surface.hovered};
28
29
 
29
30
  .product-data-text1 {
30
31
  padding: 2px;
@@ -41,7 +42,6 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
41
42
  }
42
43
  .source {
43
44
  border-radius: 12px;
44
- background-color: ${o.surface.subdued};
45
45
  }
46
46
  }
47
47
  .pop-up-header {
@@ -157,4 +157,13 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
157
157
  display: flex;
158
158
  gap: 8px;
159
159
  }
160
+ `;e.div`
161
+ display: flex;
162
+ align-items: center;
163
+ justify-content: center;
164
+ width: 24px;
165
+ height: 24px;
166
+ background-color: ${o.surface.subdued};
167
+ border-radius: 22px;
168
+ border: 1px solid ${o.stroke.primary};
160
169
  `;export{r as SourceInfoDetailsStyle,i as SourceInfoFooterStyle};
@@ -9,7 +9,7 @@ import e from"styled-components";import{Caption as r}from"../../TypographyStyle.
9
9
  border: 2px solid
10
10
  ${e=>e.hasError?`${o.content.negative}`:e.showBorder?`${o.stroke.brand}`:`${o.stroke.primary}`};
11
11
  border: ${e=>e.showDashedBorder&&`2px dashed ${o.content.brand}`};
12
- height: ${e=>e.isWhatsappCarousel?"100%":"auto"};
12
+ height: 100%;
13
13
  display: flex;
14
14
  flex-direction: column;
15
15
  :hover {
@@ -36,14 +36,14 @@ import e from"styled-components";import{Caption as r}from"../../TypographyStyle.
36
36
  min-height: 152px;
37
37
  margin-bottom: 4px;
38
38
  margin: 0px 8px;
39
- `,a=e.div`
39
+ `,p=e.div`
40
40
  padding: 12px;
41
41
  display: flex;
42
42
  flex-direction: row;
43
43
  justify-content: center;
44
44
  align-items: center;
45
45
  border-top: 1px solid ${o.stroke.primary};
46
- `,p=e.div`
46
+ `,a=e.div`
47
47
  display: flex;
48
48
  flex-direction: row;
49
49
  justify-content: space-between;
@@ -66,4 +66,4 @@ import e from"styled-components";import{Caption as r}from"../../TypographyStyle.
66
66
  position: absolute;
67
67
  top: 16px;
68
68
  right: 16px;
69
- `;export{a as ChatBtnContainer,t as Container,d as FooterText,p as FooterWrapper,s as MediaContainer,i as TimeStamp};
69
+ `;export{p as ChatBtnContainer,t as Container,d as FooterText,a as FooterWrapper,s as MediaContainer,i as TimeStamp};
@@ -1,4 +1,4 @@
1
- import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import o from"styled-components";import{useTemplateModalContext as s}from"../../template-context-mapper/context/templateModalContext.js";import{BACKGROUND_PREVIEW_IMAGE as a}from"../../template-context-mapper/utils/constants.js";import{TitleRegular as i}from"../../TypographyStyle.js";import{COLORS as p}from"../../../constants/Theme.js";import{getPreviewPropLen as n}from"../utils/getPreviewPropLen.js";import m from"./ChatHeader.js";import{ChatUIV2 as c}from"./ChatUiV2.js";const l=o.div`
1
+ import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import o from"styled-components";import{useTemplateModalContext as s}from"../../template-context-mapper/context/templateModalContext.js";import{BACKGROUND_PREVIEW_IMAGE as a}from"../../template-context-mapper/utils/constants.js";import{TitleRegular as i}from"../../TypographyStyle.js";import{COLORS as p}from"../../../constants/Theme.js";import{getPreviewPropLen as n}from"../utils/getPreviewPropLen.js";import m from"./ChatHeader.js";import{ChatUIV2 as c}from"./ChatUiV2.js";const h=o.div`
2
2
  background-image: ${e=>e.isWhatsappCarousel?"none":`url(${a})`};
3
3
  border-radius: 4px;
4
4
  background-repeat: no-repeat;
@@ -6,6 +6,6 @@ import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import o from"st
6
6
  background-size: cover;
7
7
  position: relative;
8
8
  height: ${e=>e.isWhatsappCarousel?"100%":"auto"};
9
- `,d=o(i)`
9
+ `,l=o(i)`
10
10
  color: ${p.content.primary};
11
- `,h=o=>{const{hideDeviceContainerInPreview:a}=s();return 3===n(o)?e(t,{children:o.zeroStateComponent}):a?e(c,Object.assign({showHeader:o.showHeader},o)):e(t,{children:r(l,Object.assign({style:o.containerStyle,showHeader:o.showHeader,isWhatsappCarousel:o.isWhatsappCarousel},{children:[o.showHeader&&e(m,{}),r("div",Object.assign({style:{padding:"small"===o.size?"12px 32px 12px 12px":`16px ${o.isWhatsappCarousel?"0px":"56px"} ${o.isWhatsappCarousel?"2px":"16px"} 16px`,height:"100%",overflowY:"auto"}},{children:[!o.hidePreviewText&&e("div",Object.assign({style:{marginBottom:16}},{children:e(d,{children:"Preview"})})),e(c,Object.assign({showHeader:o.showHeader},o))]}))]}))})};export{h as WhatsappLikePreviewV2};
11
+ `,d=o=>{const{hideDeviceContainerInPreview:a}=s();return 3===n(o)?e(t,{children:o.zeroStateComponent}):a?e(c,Object.assign({showHeader:o.showHeader},o)):e(t,{children:r(h,Object.assign({style:o.containerStyle,showHeader:o.showHeader,isWhatsappCarousel:o.isWhatsappCarousel},{children:[o.showHeader&&e(m,{}),r("div",Object.assign({style:{padding:"small"===o.size?"12px 32px 12px 12px":`16px ${o.isWhatsappCarousel?"0px":"56px"} ${o.isWhatsappCarousel?"2px":"16px"} 16px`,height:o.isWhatsappCarousel?"100%":"auto"}},{children:[!o.hidePreviewText&&e("div",Object.assign({style:{marginBottom:16}},{children:e(l,{children:"Preview"})})),e(c,Object.assign({showHeader:o.showHeader},o))]}))]}))})};export{d as WhatsappLikePreviewV2};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.683-1",
3
+ "version": "0.0.683-beta.0",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",