@bikdotai/bik-component-library 0.0.764-beta.1 → 0.0.764-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@bikdotai/bik-models/growth/models/bik-store"),i=require("../../assets/icons/alert_triangle.svg.js"),n=require("../../assets/icons/plus.svg.js"),o=require("react"),s=require("../../constants/Theme.js"),a=require("../button/Button.js"),r=require("../markdown/MarkdownRender.js"),d=require("../shimmer/ShimmerComponent/BikShimmer.js"),l=require("../TypographyStyle.js"),c=require("./DataSourcePanel.style.js");const u=o.memo((r=>{const{appType:u,sourceIntent:g,hideHeading:v,messageSource:m,trainingSourceCount:y={},ShowTrainingDataSource:T={},faqCount:j,ChecklistType:b,footerButtonOption:x,isFooterLoading:A,reasonForAiGeneratedResponse:O,showAiResponseReason:C,aiResponseLoading:R}=r,f=T,[I,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@bikdotai/bik-models/growth/models/bik-store"),i=require("../../assets/icons/alert_triangle.svg.js"),n=require("../../assets/icons/plus.svg.js"),o=require("react"),s=require("../../constants/Theme.js"),a=require("../button/Button.js"),r=require("../markdown/MarkdownRender.js"),d=require("../shimmer/ShimmerComponent/BikShimmer.js"),l=require("../TypographyStyle.js"),c=require("./DataSourcePanel.style.js");const u=o.memo((r=>{const{appType:u,sourceIntent:g,hideHeading:v,messageSource:m,trainingSourceCount:y={},ShowTrainingDataSource:T={},faqCount:j,ChecklistType:b,footerButtonOption:x,isFooterLoading:A,reasonForAiGeneratedResponse:O,showAiResponseReason:C,aiResponseLoading:R}=r,f=T,[I,S]=o.useState(!0),[F,k]=o.useState(!0),w="/bik-ai/training",[N,_]=o.useState({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[E,q]=o.useState({title:"",subTitle:""}),D=o.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]),L=()=>{var e;(null==N?void 0:N.redirectUrl)?window.open(`${window.location.origin}${null==N?void 0:N.redirectUrl}`,"_self"):Object.keys(null!==(e=null==N?void 0:N.addFaqProps)&&void 0!==e?e:{}).length>0?null==x||x.onClick(N):(null==x?void 0:x.navigate)&&(null==x||x.navigate(u==t.ApplicationType.MANIFEST?"Skill Data sources":"Training",{},{},!0))};return o.useEffect((()=>{var e,i,n,o;if(g){if(null===(e=null==m?void 0:m.sources)||void 0===e?void 0:e.length){const e=m.sources[0];if(f[g])g===b.ORDER_ENQUIRY&&k(!1);else{let s=null==e?void 0:e.insights,a="";switch(g){case b.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(s=`${j||"No"} FAQs added for this product`,a="Add product-specific information via FAQs to improve responses",_({buttonTitle:"Add FAQ",addFaqProps:{faqProducts:[{id:null==e?void 0:e.productId,variantId:null==e?void 0:e.variantId,name:null==e?void 0:e.title,imageUrl:null==e?void 0:e.imageUrl}]},redirectUrl:""}));break;case b.ORDER_MODIFICATION:s=(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.",s&&_({buttonTitle:u==t.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:u==t.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":w,addFaqProps:{}});break;case b.ORDER_CANCELLATION:s=(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.",_({buttonTitle:u==t.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:u==t.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":w,addFaqProps:{}});break;case b.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;_({buttonTitle:u==t.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:u==t.ApplicationType.MANIFEST?"/skills/order-handling-settings":w,addFaqProps:{}});break;case b.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(o=null===(n=null===(i=null==m?void 0:m.sources)||void 0===i?void 0:i[0])||void 0===n?void 0:n.title)||void 0===o?void 0:o.toLowerCase().indexOf("collection"))){s="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}s="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}q({title:null!=s?s:"",subTitle:a})}}(f[g]||[b.PRODUCT_DETAILS,b.ORDER_MODIFICATION,b.ORDER_CANCELLATION,b.ORDER_TRACKING].includes(g))&&S(!1)}}),[null==m?void 0:m.messageId,y,g,null==m?void 0:m.sources,f,b,j,u,m]),e.jsx(c.SourceInfoFooterStyle,{children:A?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==E?void 0:E.title)&&y&&g in y?e.jsxs(e.Fragment,{children:[e.jsx(p,{hideHeading:null!=v&&v}),e.jsx(h,{reason:O||"",showAiResponseReason:null!=C&&C,isLoading:null!=R&&R,appType:u}),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(l.BodyCaption,{children:D}),e.jsx(l.BodyCaption,Object.assign({color:s.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(i.default,{width:15,height:15,color:s.COLORS.content.negative,style:{marginTop:2}}),e.jsx(l.BodyCaption,{children:"No data sources added to the identified link"})]})),!x||x.hideAddDataButton||I?e.jsx(e.Fragment,{}):e.jsx(a.Button,{size:"small",buttonType:"tertiary",LeadingIcon:n.default,buttonText:(null==N?void 0:N.buttonTitle.length)>0?null==N?void 0:N.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>L(),style:{backgroundColor:"unset"}})]}))]}):e.jsxs(e.Fragment,{children:[e.jsx(p,{hideHeading:null!=v&&v}),e.jsx(h,{reason:O||"",showAiResponseReason:null!=C&&C,isLoading:null!=R&&R,appType:u}),e.jsxs("div",Object.assign({className:"source_info_details"},{children:[F&&e.jsxs(e.Fragment,{children:[e.jsx(l.BodyCaption,{children:null==E?void 0:E.title}),e.jsx(l.BodyCaption,Object.assign({color:s.COLORS.content.secondary},{children:null==E?void 0:E.subTitle}))]}),!x||x.hideAddDataButton||I?e.jsx(e.Fragment,{}):e.jsx(a.Button,{size:"small",buttonType:"tertiary",LeadingIcon:n.default,buttonText:(null==N?void 0:N.buttonTitle.length)>0?null==N?void 0:N.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>L(),style:{backgroundColor:"unset"}})]}))]})})})})),p=o.memo((t=>t.hideHeading?null:e.jsx(l.BodyCaption,Object.assign({color:s.COLORS.content.secondary},{children:"Training insights"})))),h=o.memo((i=>i.appType!==t.ApplicationType.MANIFEST?e.jsx(e.Fragment,{}):e.jsx(e.Fragment,{children:i.isLoading?e.jsx("div",Object.assign({style:{height:70,width:"100%",marginBottom:8}},{children:e.jsx(d.BikShimmer,{boxes:[{height:"20px",width:"30%"},{height:"20px",width:"100%"}],direction:"column",gap:"2px",isBrand:!1})})):e.jsxs("div",Object.assign({className:"source_info_details"},{children:[e.jsx(l.BodyCaption,Object.assign({color:s.COLORS.content.primary,className:"why_ai_gave_this_response"},{children:"Here’s why your AI gave this response"})),e.jsx(l.BodyCaption,Object.assign({color:s.COLORS.content.secondary,className:"clamp-text"},{children:e.jsx(r.default,{text:i.reason||"No reason provided for this response."})}))]}))})));h.displayName="WhyAiGaveThisResponse",p.displayName="TrainingInsightsHeading",u.displayName="SourceInfoFooter",exports.default=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as i,jsxs as t}from"react/jsx-runtime";import{ApplicationType as o}from"@bikdotai/bik-models/growth/models/bik-store";import n from"../../assets/icons/alert_triangle.svg.js";import r from"../../assets/icons/plus.svg.js";import{memo as d,useState as
|
|
1
|
+
import{jsx as e,Fragment as i,jsxs as t}from"react/jsx-runtime";import{ApplicationType as o}from"@bikdotai/bik-models/growth/models/bik-store";import n from"../../assets/icons/alert_triangle.svg.js";import r from"../../assets/icons/plus.svg.js";import{memo as d,useState as a,useMemo as s,useEffect as l}from"react";import{COLORS as c}from"../../constants/Theme.js";import{Button as u}from"../button/Button.js";import h from"../markdown/MarkdownRender.js";import{BikShimmer as g}from"../shimmer/ShimmerComponent/BikShimmer.js";import{BodyCaption as p}from"../TypographyStyle.js";import{SourceInfoFooterStyle as m}from"./DataSourcePanel.style.js";const v=d((d=>{const{appType:h,sourceIntent:v,hideHeading:A,messageSource:y,trainingSourceCount:f={},ShowTrainingDataSource:I={},faqCount:R,ChecklistType:w,footerButtonOption:O,isFooterLoading:N,reasonForAiGeneratedResponse:k,showAiResponseReason:_,aiResponseLoading:C}=d,F=I,[E,D]=a(!0),[S,j]=a(!0),x="/bik-ai/training",[P,U]=a({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[L,M]=a({title:"",subTitle:""}),q=s((()=>{const e=(null==f?void 0:f[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`}),[f,v]),H=()=>{var e;(null==P?void 0:P.redirectUrl)?window.open(`${window.location.origin}${null==P?void 0:P.redirectUrl}`,"_self"):Object.keys(null!==(e=null==P?void 0:P.addFaqProps)&&void 0!==e?e:{}).length>0?null==O||O.onClick(P):(null==O?void 0:O.navigate)&&(null==O||O.navigate(h==o.MANIFEST?"Skill Data sources":"Training",{},{},!0))};return l((()=>{var e,i,t,n;if(v){if(null===(e=null==y?void 0:y.sources)||void 0===e?void 0:e.length){const e=y.sources[0];if(F[v])v===w.ORDER_ENQUIRY&&j(!1);else{let r=null==e?void 0:e.insights,d="";switch(v){case w.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(r=`${R||"No"} FAQs added for this product`,d="Add product-specific information via FAQs to improve responses",U({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 w.ORDER_MODIFICATION:r=(null==f?void 0:f[v])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",r&&U({buttonTitle:h==o.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:h==o.MANIFEST?"/customise?tab=AgentHandover":x,addFaqProps:{}});break;case w.ORDER_CANCELLATION:r=(null==f?void 0:f[v])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",U({buttonTitle:h==o.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:h==o.MANIFEST?"/customise?tab=AgentHandover":x,addFaqProps:{}});break;case w.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;U({buttonTitle:h==o.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:h==o.MANIFEST?"/skills/order-handling-settings":x,addFaqProps:{}});break;case w.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(n=null===(t=null===(i=null==y?void 0:y.sources)||void 0===i?void 0:i[0])||void 0===t?void 0:t.title)||void 0===n?void 0:n.toLowerCase().indexOf("collection"))){r="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}r="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!=r?r:"",subTitle:d})}}(F[v]||[w.PRODUCT_DETAILS,w.ORDER_MODIFICATION,w.ORDER_CANCELLATION,w.ORDER_TRACKING].includes(v))&&D(!1)}}),[null==y?void 0:y.messageId,f,v,null==y?void 0:y.sources,F,w,R,h,y]),e(m,{children:e(i,N?{children:e(g,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}:{children:!(null==L?void 0:L.title)&&f&&v in f?t(i,{children:[e(b,{hideHeading:null!=A&&A}),e(T,{reason:k||"",showAiResponseReason:null!=_&&_,isLoading:null!=C&&C,appType:h}),t("div",Object.assign({className:"source_info_details "+(f[v]>0?"":"no_data_source")},{children:[f[v]>0&&S?t(i,{children:[e(p,{children:q}),e(p,Object.assign({color:c.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):S&&t("div",Object.assign({className:"no_data_source_title"},{children:[e(n,{width:15,height:15,color:c.content.negative,style:{marginTop:2}}),e(p,{children:"No data sources added to the identified link"})]})),!O||O.hideAddDataButton||E?e(i,{}):e(u,{size:"small",buttonType:"tertiary",LeadingIcon:r,buttonText:(null==P?void 0:P.buttonTitle.length)>0?null==P?void 0:P.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>H(),style:{backgroundColor:"unset"}})]}))]}):t(i,{children:[e(b,{hideHeading:null!=A&&A}),e(T,{reason:k||"",showAiResponseReason:null!=_&&_,isLoading:null!=C&&C,appType:h}),t("div",Object.assign({className:"source_info_details"},{children:[S&&t(i,{children:[e(p,{children:null==L?void 0:L.title}),e(p,Object.assign({color:c.content.secondary},{children:null==L?void 0:L.subTitle}))]}),!O||O.hideAddDataButton||E?e(i,{}):e(u,{size:"small",buttonType:"tertiary",LeadingIcon:r,buttonText:(null==P?void 0:P.buttonTitle.length)>0?null==P?void 0:P.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>H(),style:{backgroundColor:"unset"}})]}))]})})})})),b=d((i=>i.hideHeading?null:e(p,Object.assign({color:c.content.secondary},{children:"Training insights"})))),T=d((n=>n.appType!==o.MANIFEST?e(i,{}):e(i,{children:n.isLoading?e("div",Object.assign({style:{height:70,width:"100%",marginBottom:8}},{children:e(g,{boxes:[{height:"20px",width:"30%"},{height:"20px",width:"100%"}],direction:"column",gap:"2px",isBrand:!1})})):t("div",Object.assign({className:"source_info_details"},{children:[e(p,Object.assign({color:c.content.primary,className:"why_ai_gave_this_response"},{children:"Here’s why your AI gave this response"})),e(p,Object.assign({color:c.content.secondary,className:"clamp-text"},{children:e(h,{text:n.reason||"No reason provided for this response."})}))]}))})));T.displayName="WhyAiGaveThisResponse",b.displayName="TrainingInsightsHeading",v.displayName="SourceInfoFooter";export{v as default};
|