@bikdotai/bik-component-library 0.0.696 → 0.0.697-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/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  2. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  3. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  4. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  5. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  6. package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
  7. package/dist/cjs/components/dropdown/Common.styled.js +27 -8
  8. package/dist/cjs/components/dropdown-button/DropdownButton.js +1 -1
  9. package/dist/cjs/components/dropdown-button/DropdownButton.style.d.ts +1 -0
  10. package/dist/cjs/components/dropdown-button/DropdownButton.style.js +13 -2
  11. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +1 -1
  12. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  13. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  14. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  15. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  16. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  17. package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
  18. package/dist/esm/components/dropdown/Common.styled.js +28 -9
  19. package/dist/esm/components/dropdown-button/DropdownButton.js +1 -1
  20. package/dist/esm/components/dropdown-button/DropdownButton.style.d.ts +1 -0
  21. package/dist/esm/components/dropdown-button/DropdownButton.style.js +15 -4
  22. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +1 -1
  23. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default EventsTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default IGTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
3
+ import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
4
+ import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
5
5
  declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
6
6
  cacheKey: string;
7
7
  propertyAddBtnText: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth"),s=require("../../assets/icons/box_search.svg.js"),i=require("../../assets/icons/boxV2.svg.js"),o=require("../../assets/icons/chevronDownOutline.svg.js"),n=require("../../assets/icons/chevronUpOutline.svg.js"),r=require("../../assets/icons/cross.svg.js"),l=require("../../assets/icons/edit.svg.js"),a=require("../../assets/icons/filePdf.svg.js"),d=require("../../assets/icons/help.svg.js"),c=require("../../assets/icons/info.svg.js"),u=require("../../assets/icons/openai.svg.js"),x=require("../../assets/icons/plus.svg.js"),p=require("../../assets/icons/redirect.svg.js"),j=require("../../assets/icons/text_t9.svg.js"),m=require("../../assets/icons/website.svg.js"),g=require("react"),h=require("../../constants/Theme.js"),y=require("../button/Button.js"),E=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),R=require("../side-modal/SideModal.js"),O=require("../tag/Tag.js"),f=require("../tooltips/Tooltip.js"),v=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");exports.DataSourcePanel=w=>{var D,N;const{appType:A,storeId:_,messageSource:F,setMessageSourcePanel:k,hideCloseButton:B,isSourceInfoFetched:q,allSourceInfoDetail:P,ChecklistType:M,title:U,zeroStateButton:K,editableSources:W,preFillTrainingSourceCount:$,redirect:H,footerButtonOption:Q,fetchTrainingSourceCount:G,fetchProductFAQCount:Y,productSourceData:z,reasonForAiGeneratedResponse:X,showAiResponseReason:V,productSearchRule:J,onEditProductSearchRule:Z}=w,{sources:ee}=F,te=["blog","article","page","policy"],[se,ie]=g.useState(!1),[oe,ne]=g.useState(!1),[re,le]=g.useState(!1),[ae,de]=g.useState(0),[ce,ue]=g.useState(),[xe,pe]=g.useState(null!=$?$:{}),[je,me]=g.useState(!1),[ge,he]=g.useState(!1),ye={};I.intentConfig.forEach((t=>{let{key:s,type:i,tagText:o}=t;M[s]&&(ye[M[s]]=e.jsxRuntimeExports.jsx(O.Tag,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const Ee=ee.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Ce=ee.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),Re=g.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=>{M[t]&&(e[M[t]]=M[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[M]);g.useEffect((()=>{var e,t,s,i;if(!(null==F?void 0:F.messageId))return;ie(!0),ne(!0),le(!1!==(null===(t=null===(e=F.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=F.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=F.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));Y(_,n).then((e=>de(e))).then((()=>{$?(pe($),setTimeout((()=>{ie(!1),ne(!1)}),100)):(setTimeout((()=>ie(!1)),100),G(_).then((e=>pe(e))).then((()=>setTimeout((()=>{ne(!1)}),100))))}))}),[Y,G,null==F?void 0:F.messageId,F.sources,$,_]);const Oe=e=>!!(e&&0===e.length||(null==F?void 0:F.isUnsatisfactoryAnswer)),fe=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:te.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")):"",Se=t=>"products"==t||"product"==t?e.jsxRuntimeExports.jsx(i.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==t?e.jsxRuntimeExports.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==t||"fetched links"==t?e.jsxRuntimeExports.jsx(m.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==t?e.jsxRuntimeExports.jsx(d.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==t?e.jsxRuntimeExports.jsx(j.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsxRuntimeExports.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}),Te=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(se||!q)return e.jsxRuntimeExports.jsx(T.SourceInfoDetailsStyle,{children:e.jsxRuntimeExports.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"}]})});const Ie=s=>{const{title:i,count:r,isExpanded:l,onToggle:a,children:d}=s;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:a},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({style:{fontWeight:"600"}},{children:i})),A===t.ApplicationType.MANIFEST?e.jsxRuntimeExports.jsx("div",Object.assign({style:{backgroundColor:h.COLORS.surface.subdued,color:h.COLORS.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:r})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]})),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:A===t.ApplicationType.BIK?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):l?e.jsxRuntimeExports.jsx(o.default,{width:20,height:20,color:h.COLORS.content.primary}):e.jsxRuntimeExports.jsx(n.default,{width:20,height:20,color:h.COLORS.content.primary})})]})),l&&d]})};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(T.SourceInfoDetailsStyle,{children:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!U&&e.jsxRuntimeExports.jsx(v.TitleSmall,{children:U}),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(D=ye[F.intent])&&void 0!==D?D:ye.GENERIC,!B&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>k(void 0)},{children:e.jsxRuntimeExports.jsx(r.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),J&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"12px",marginTop:"6px"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({color:h.COLORS.content.primary},{children:J.rule_name})),Z&&J.rule_id&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[e.jsxRuntimeExports.jsx(s.default,{width:14,color:h.COLORS.content.secondary}),e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Edit search rule"})),e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,bordered:!0,iconColor:h.COLORS.content.primary,onClick:()=>Z(null==J?void 0:J.rule_id)})]}))]})),J.keywords&&J.keywords.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px",backgroundColor:h.COLORS.surface.subdued,borderRadius:"8px",border:`1px dashed ${h.COLORS.stroke.primary}`}},{children:J.keywords.map(((t,s)=>e.jsxRuntimeExports.jsx(O.Tag,{tagText:t,theme:"light"},`keyword-${s}`)))}))]})),Oe(ee)?e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsxRuntimeExports.jsx(c.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsxRuntimeExports.jsx(v.TitleSmall,{children:"Insufficient data"})})),e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({color:h.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),K&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsxRuntimeExports.jsx(y.Button,{LeadingIcon:null!==(t=K.leadingIcon)&&void 0!==t?t:x.default,buttonText:null!==(s=K.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{K.onClick()}})}))]}))})()})):!J&&e.jsxRuntimeExports.jsx(O.Tag,{LeadingIcon:c.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:F.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 ${A===t.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Oe(ee)&&e.jsxRuntimeExports.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Ee.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsxRuntimeExports.jsx(Ie,Object.assign({title:"Product Sources",count:Ee.length,isExpanded:A!==t.ApplicationType.MANIFEST||je,onToggle:()=>me(!je)},{children:e.jsxRuntimeExports.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ee.map(((t,s)=>{var i,o,n,r;const a=fe(t.type||t.subTitle||"OpenAI"),d=fe(t.type||t.subTitle||"OpenAI",!0),c=ve(a),u=null==W?void 0:W.includes(d),x=P[null!==(i=t.productId)&&void 0!==i?i:"Products"],j=t.title,m=t.productId&&(null==z?void 0:z[t.productId]),g=m&&m.metafield.join(", ");return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Ee?void 0:Ee.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Se(a),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:j,placement:"top"},{children:e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({style:d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:j}))}))]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==M.EMAIL_COLLECTION&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:c}))}),(t.link||t.docId)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:u?e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==x?void 0:x.onEditClick(x.data,x.type),disabled:!x,disabledTooltip:"This source is deleted"}):e.jsxRuntimeExports.jsx(E.IconButton,{Icon:p.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!x,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),m&&e.jsxRuntimeExports.jsxs(v.BodyCaption,{children:[e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;ue({title:j,description:Te(m.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>ue(void 0)})}},{children:`${null===(o=m.description)||void 0===o?void 0:o.length} characters description,`})),e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>m.onEditFaqClick(m.faqs)},{children:`${null===(n=m.faqs)||void 0===n?void 0:n.length} FAQs, `})),e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:g,placement:"top"},{children:e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(r=m.metafield)||void 0===r?void 0:r.length} metafields`}))}))]})]}),`info-${s}`)}))}))}))}))}),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Ce.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsxRuntimeExports.jsx(Ie,Object.assign({title:"Content Sources",count:Ce.length,isExpanded:A!==t.ApplicationType.MANIFEST||ge,onToggle:()=>he(!ge)},{children:e.jsxRuntimeExports.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ce.map(((t,s)=>{var i,o,n,r,a,d,c,u,x,j,m,g,y,C,R,O,S;const T=fe(t.type||t.subTitle||"OpenAI"),I=fe(t.type||t.subTitle||"OpenAI",!0),b=ve(T),w=null==W?void 0:W.includes(I),D="Products"===t.subTitle?P[null!==(i=t.productId)&&void 0!==i?i:"Products"]:P[null!==(o=t.docId)&&void 0!==o?o:""],N=I.toLowerCase()===(null===(n=L.CustomDataType.FAQ)||void 0===n?void 0:n.toLowerCase())?"faq"===(null===(r=t.title)||void 0===r?void 0:r.toLowerCase())?t.subTitle:t.title:I.toLowerCase()===(null===(a=L.CustomDataType.FILES)||void 0===a?void 0:a.toLowerCase())||I.toLowerCase()===(null===(d=L.CustomDataType.FETCHED_LINKS)||void 0===d?void 0:d.toLowerCase())||I.toLowerCase()===(null===(c=L.CustomDataType.TEXTS)||void 0===c?void 0:c.toLowerCase())?t.title:I.toLowerCase()===(null===(u=L.CustomDataType.WEBSITE_LINKS)||void 0===u?void 0:u.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):t.intent===M.EMAIL_COLLECTION?b:t.title,A="faq"===I.toLowerCase()?null!==(m=null!==(x=null==D?void 0:D.content)&&void 0!==x?x:null===(j=null==D?void 0:D.data)||void 0===j?void 0:j.answer)&&void 0!==m?m:"":I.toLowerCase()===(null===(g=L.CustomDataType.FETCHED_LINKS)||void 0===g?void 0:g.toLowerCase())||I.toLowerCase()===(null===(y=L.CustomDataType.WEBSITE_LINKS)||void 0===y?void 0:y.toLowerCase())||I.toLowerCase()===(null===(C=L.CustomDataType.TEXTS)||void 0===C?void 0:C.toLowerCase())?null!==(S=null!==(R=null==D?void 0:D.content)&&void 0!==R?R:null===(O=null==D?void 0:D.data)||void 0===O?void 0:O.fileContentText)&&void 0!==S?S:"":t.intent===M.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxRuntimeExports.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 ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Se(T),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:N,placement:"top"},{children:e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({style:I==L.CustomDataType.FETCHED_LINKS||I==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>I==L.CustomDataType.FETCHED_LINKS||I==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:N}))}))]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==M.EMAIL_COLLECTION&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:b}))}),(t.link||t.docId)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:w?e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==D?void 0:D.onEditClick(D.data,D.type),disabled:!D,disabledTooltip:"This source is deleted"}):e.jsxRuntimeExports.jsx(E.IconButton,{Icon:p.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!D,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),(null!=A?A:"").trim()&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:Te(null!=A?A:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]})),re&&!Oe(ee)&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"footer"},{children:e.jsxRuntimeExports.jsx(S.default,{appType:A,storeId:_,messageSource:F,sourceIntent:null!==(N=F.intent)&&void 0!==N?N:M.GENERIC,faqCount:ae,trainingSourceCount:xe,ShowTrainingDataSource:Re,ChecklistType:M,footerButtonOption:Q,isFooterLoading:oe,reasonForAiGeneratedResponse:X,showAiResponseReason:V})}))]})}),ce&&e.jsxRuntimeExports.jsx(R.SideModal,Object.assign({header:"Product description",onClose:()=>ue(void 0),width:"30%"},{children:e.jsxRuntimeExports.jsx(b.DescriptionModal,{title:ce.title,description:ce.description,imageUrl:ce.imageUrl,onClose:ce.onClose})}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth"),s=require("../../assets/icons/box_search.svg.js"),i=require("../../assets/icons/boxV2.svg.js"),o=require("../../assets/icons/chevronDownOutline.svg.js"),n=require("../../assets/icons/chevronUpOutline.svg.js"),r=require("../../assets/icons/cross.svg.js"),l=require("../../assets/icons/edit.svg.js"),a=require("../../assets/icons/filePdf.svg.js"),d=require("../../assets/icons/help.svg.js"),c=require("../../assets/icons/info.svg.js"),u=require("../../assets/icons/openai.svg.js"),x=require("../../assets/icons/plus.svg.js"),p=require("../../assets/icons/redirect.svg.js"),j=require("../../assets/icons/text_t9.svg.js"),m=require("../../assets/icons/website.svg.js"),g=require("react"),h=require("../../constants/Theme.js"),y=require("../button/Button.js"),E=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),R=require("../side-modal/SideModal.js"),O=require("../tag/Tag.js"),f=require("../tooltips/Tooltip.js"),v=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");exports.DataSourcePanel=w=>{var D,N;const{appType:A,storeId:_,messageSource:F,setMessageSourcePanel:k,hideCloseButton:B,isSourceInfoFetched:q,allSourceInfoDetail:P,ChecklistType:M,title:U,zeroStateButton:K,editableSources:W,preFillTrainingSourceCount:$,redirect:H,footerButtonOption:Q,fetchTrainingSourceCount:G,fetchProductFAQCount:Y,productSourceData:z,reasonForAiGeneratedResponse:X,showAiResponseReason:V,productSearchRule:J,onEditProductSearchRule:Z}=w,{sources:ee}=F,te=["blog","article","page","policy"],[se,ie]=g.useState(!1),[oe,ne]=g.useState(!1),[re,le]=g.useState(!1),[ae,de]=g.useState(0),[ce,ue]=g.useState(),[xe,pe]=g.useState(null!=$?$:{}),[je,me]=g.useState(!1),[ge,he]=g.useState(!1),ye={};I.intentConfig.forEach((t=>{let{key:s,type:i,tagText:o}=t;M[s]&&(ye[M[s]]=e.jsxRuntimeExports.jsx(O.Tag,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const Ee=ee.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Ce=ee.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),Re=g.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=>{M[t]&&(e[M[t]]=M[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[M]);g.useEffect((()=>{var e,t,s,i;if(!(null==F?void 0:F.messageId))return;ie(!0),ne(!0),le(!1!==(null===(t=null===(e=F.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=F.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=F.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));Y(_,n).then((e=>de(e))).then((()=>{$?(pe($),setTimeout((()=>{ie(!1),ne(!1)}),100)):(setTimeout((()=>ie(!1)),100),G(_).then((e=>pe(e))).then((()=>setTimeout((()=>{ne(!1)}),100))))}))}),[Y,G,null==F?void 0:F.messageId,F.sources,$,_]);const Oe=e=>!!(e&&0===e.length||(null==F?void 0:F.isUnsatisfactoryAnswer)),fe=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:te.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")):"",Se=t=>"products"==t||"product"==t?e.jsxRuntimeExports.jsx(i.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==t?e.jsxRuntimeExports.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==t||"fetched links"==t?e.jsxRuntimeExports.jsx(m.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==t?e.jsxRuntimeExports.jsx(d.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==t?e.jsxRuntimeExports.jsx(j.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsxRuntimeExports.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}),Te=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(se||!q)return e.jsxRuntimeExports.jsx(T.SourceInfoDetailsStyle,{children:e.jsxRuntimeExports.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"}]})});const Ie=s=>{const{title:i,count:r,isExpanded:l,onToggle:a,children:d}=s;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:a},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({style:{fontWeight:"600"}},{children:i})),A===t.ApplicationType.MANIFEST?e.jsxRuntimeExports.jsx("div",Object.assign({style:{backgroundColor:h.COLORS.surface.subdued,color:h.COLORS.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:r})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]})),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:A===t.ApplicationType.BIK?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):l?e.jsxRuntimeExports.jsx(o.default,{width:20,height:20,color:h.COLORS.content.primary}):e.jsxRuntimeExports.jsx(n.default,{width:20,height:20,color:h.COLORS.content.primary})})]})),l&&d]})};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(T.SourceInfoDetailsStyle,{children:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",padding:0,paddingBottom:"12px"}},{children:[!!U&&e.jsxRuntimeExports.jsx(v.TitleSmall,{children:U}),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(D=ye[F.intent])&&void 0!==D?D:ye.GENERIC,!B&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>k(void 0)},{children:e.jsxRuntimeExports.jsx(r.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),J&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"12px",marginTop:"6px"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({color:h.COLORS.content.primary},{children:J.rule_name})),Z&&J.rule_id&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[e.jsxRuntimeExports.jsx(s.default,{width:14,color:h.COLORS.content.secondary}),e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Edit search rule"})),e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,bordered:!0,iconColor:h.COLORS.content.primary,onClick:()=>Z(null==J?void 0:J.rule_id)})]}))]})),J.keywords&&J.keywords.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px",backgroundColor:h.COLORS.surface.subdued,borderRadius:"8px",border:`1px dashed ${h.COLORS.stroke.primary}`}},{children:J.keywords.map(((t,s)=>e.jsxRuntimeExports.jsx(O.Tag,{tagText:t,theme:"light"},`keyword-${s}`)))}))]})),Oe(ee)?e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsxRuntimeExports.jsx(c.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsxRuntimeExports.jsx(v.TitleSmall,{children:"Insufficient data"})})),e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({color:h.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),K&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsxRuntimeExports.jsx(y.Button,{LeadingIcon:null!==(t=K.leadingIcon)&&void 0!==t?t:x.default,buttonText:null!==(s=K.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{K.onClick()}})}))]}))})()})):!J&&e.jsxRuntimeExports.jsx(O.Tag,{LeadingIcon:c.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:F.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 ${A===t.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Oe(ee)&&e.jsxRuntimeExports.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Ee.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsxRuntimeExports.jsx(Ie,Object.assign({title:"Product Sources",count:Ee.length,isExpanded:A!==t.ApplicationType.MANIFEST||je,onToggle:()=>me(!je)},{children:e.jsxRuntimeExports.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ee.map(((t,s)=>{var i,o,n,r;const a=fe(t.type||t.subTitle||"OpenAI"),d=fe(t.type||t.subTitle||"OpenAI",!0),c=ve(a),u=null==W?void 0:W.includes(d),x=P[null!==(i=t.productId)&&void 0!==i?i:"Products"],j=t.title,m=t.productId&&(null==z?void 0:z[t.productId]),g=m&&m.metafield.join(", ");return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Ee?void 0:Ee.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Se(a),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:j,placement:"top"},{children:e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({style:d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:j}))}))]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==M.EMAIL_COLLECTION&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:c}))}),(t.link||t.docId)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:u?e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==x?void 0:x.onEditClick(x.data,x.type),disabled:!x,disabledTooltip:"This source is deleted"}):e.jsxRuntimeExports.jsx(E.IconButton,{Icon:p.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!x,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),m&&e.jsxRuntimeExports.jsxs(v.BodyCaption,{children:[e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;ue({title:j,description:Te(m.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>ue(void 0)})}},{children:`${null===(o=m.description)||void 0===o?void 0:o.length} characters description,`})),e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>m.onEditFaqClick(m.faqs)},{children:`${null===(n=m.faqs)||void 0===n?void 0:n.length} FAQs, `})),e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:g,placement:"top"},{children:e.jsxRuntimeExports.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(r=m.metafield)||void 0===r?void 0:r.length} metafields`}))}))]})]}),`info-${s}`)}))}))}))}))}),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Ce.length>0&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsxRuntimeExports.jsx(Ie,Object.assign({title:"Content Sources",count:Ce.length,isExpanded:A!==t.ApplicationType.MANIFEST||ge,onToggle:()=>he(!ge)},{children:e.jsxRuntimeExports.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ce.map(((t,s)=>{var i,o,n,r,a,d,c,u,x,j,m,g,y,C,R,O,S;const T=fe(t.type||t.subTitle||"OpenAI"),I=fe(t.type||t.subTitle||"OpenAI",!0),b=ve(T),w=null==W?void 0:W.includes(I),D="Products"===t.subTitle?P[null!==(i=t.productId)&&void 0!==i?i:"Products"]:P[null!==(o=t.docId)&&void 0!==o?o:""],N=I.toLowerCase()===(null===(n=L.CustomDataType.FAQ)||void 0===n?void 0:n.toLowerCase())?"faq"===(null===(r=t.title)||void 0===r?void 0:r.toLowerCase())?t.subTitle:t.title:I.toLowerCase()===(null===(a=L.CustomDataType.FILES)||void 0===a?void 0:a.toLowerCase())||I.toLowerCase()===(null===(d=L.CustomDataType.FETCHED_LINKS)||void 0===d?void 0:d.toLowerCase())||I.toLowerCase()===(null===(c=L.CustomDataType.TEXTS)||void 0===c?void 0:c.toLowerCase())?t.title:I.toLowerCase()===(null===(u=L.CustomDataType.WEBSITE_LINKS)||void 0===u?void 0:u.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):t.intent===M.EMAIL_COLLECTION?b:t.title,A="faq"===I.toLowerCase()?null!==(m=null!==(x=null==D?void 0:D.content)&&void 0!==x?x:null===(j=null==D?void 0:D.data)||void 0===j?void 0:j.answer)&&void 0!==m?m:"":I.toLowerCase()===(null===(g=L.CustomDataType.FETCHED_LINKS)||void 0===g?void 0:g.toLowerCase())||I.toLowerCase()===(null===(y=L.CustomDataType.WEBSITE_LINKS)||void 0===y?void 0:y.toLowerCase())||I.toLowerCase()===(null===(C=L.CustomDataType.TEXTS)||void 0===C?void 0:C.toLowerCase())?null!==(S=null!==(R=null==D?void 0:D.content)&&void 0!==R?R:null===(O=null==D?void 0:D.data)||void 0===O?void 0:O.fileContentText)&&void 0!==S?S:"":t.intent===M.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxRuntimeExports.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 ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Se(T),e.jsxRuntimeExports.jsx(f.Tooltip,Object.assign({body:N,placement:"top"},{children:e.jsxRuntimeExports.jsx(v.BodySecondary,Object.assign({style:I==L.CustomDataType.FETCHED_LINKS||I==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>I==L.CustomDataType.FETCHED_LINKS||I==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:N}))}))]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==M.EMAIL_COLLECTION&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:b}))}),(t.link||t.docId)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:w?e.jsxRuntimeExports.jsx(E.IconButton,{Icon:l.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==D?void 0:D.onEditClick(D.data,D.type),disabled:!D,disabledTooltip:"This source is deleted"}):e.jsxRuntimeExports.jsx(E.IconButton,{Icon:p.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!D,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),(null!=A?A:"").trim()&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsxRuntimeExports.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:Te(null!=A?A:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]})),re&&!Oe(ee)&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"footer"},{children:e.jsxRuntimeExports.jsx(S.default,{appType:A,storeId:_,messageSource:F,sourceIntent:null!==(N=F.intent)&&void 0!==N?N:M.GENERIC,faqCount:ae,trainingSourceCount:xe,ShowTrainingDataSource:Re,ChecklistType:M,footerButtonOption:Q,isFooterLoading:oe,reasonForAiGeneratedResponse:X,showAiResponseReason:V})}))]})}),ce&&e.jsxRuntimeExports.jsx(R.SideModal,Object.assign({header:"Product description",onClose:()=>ue(void 0),width:"30%"},{children:e.jsxRuntimeExports.jsx(b.DescriptionModal,{title:ce.title,description:ce.description,imageUrl:ce.imageUrl,onClose:ce.onClose})}))]})};
@@ -1,17 +1,36 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(e);const o=r.default.div`
2
- position:
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(e);const i=o.default.div`
3
2
  // if allowEvents is true, then position is relative, else position is absolute
4
- ${e=>(null==e?void 0:e.allowEvents)?"relative":"absolute"};
3
+
4
+ position: ${e=>(null==e?void 0:e.allowEvents)?"relative":"absolute"};
5
5
  left: 0px;
6
6
  top: 0px;
7
7
  width: 100%;
8
8
  height: 100%;
9
- z-index: 2;
9
+ z-index: 0;
10
10
  cursor: ${e=>(null==e?void 0:e.disabled)?"not-allowed":"pointer"};
11
- `,n=r.default.div`
11
+
12
+ &::before {
13
+ content: '';
14
+ position: absolute;
15
+ inset: 0;
16
+ width: 100%;
17
+ height: 100%;
18
+ background-color: transparent;
19
+ transition: background-color 0.2s ease;
20
+ pointer-events: none;
21
+ z-index: -1;
22
+ }
23
+
24
+ &:hover::before {
25
+ background-color: ${e=>e.disabled?"transparent":"rgba(0, 0, 0, 0.04)"};
26
+ }
27
+
28
+ /* When allowEvents is true, make this layer non-interactive */
29
+ pointer-events: ${e=>e.allowEvents?"none":"auto"};
30
+ `,n=o.default.div`
12
31
  margin-top: 8px;
13
32
  margin-bottom: 8px;
14
- `;r.default.div`
33
+ `;o.default.div`
15
34
  display: flex;
16
35
  flex-direction: row;
17
36
  align-items: center;
@@ -19,7 +38,7 @@
19
38
  background: ${t.COLORS.surface.hovered};
20
39
  border: 1px solid ${t.COLORS.stroke.primary};
21
40
  border-radius: 4px;
22
- `;const p=r.default.div`
41
+ `;const a=o.default.div`
23
42
  width: 360px;
24
43
  height: 100%;
25
44
  padding: 8px;
@@ -34,4 +53,4 @@
34
53
  flex-wrap: wrap;
35
54
  align-items: center;
36
55
  }
37
- `;exports.ChipInputWrapper=p,exports.OpenDropdownContainer=n,exports.OverLapAbs=o;
56
+ `;exports.ChipInputWrapper=a,exports.OpenDropdownContainer=n,exports.OverLapAbs=i;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),o=require("../dropdown/DropdownPopover/index.js");require("../dropdown/Dropdown.js"),require("../dropdown/ChipDropdown.js"),require("react"),require("../zeroState/ZeroState.js"),require("../TypographyStyle.js"),require("../../constants/Theme.js"),require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js");var r=require("../button/Button.js");require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var t=require("./DropdownButton.style.js");exports.DropdownButton=n=>e.jsxRuntimeExports.jsxs(t.DropdownButtonStyle,Object.assign({type:n.buttonProps.buttonType,disabled:n.buttonProps.disabled},{children:[e.jsxRuntimeExports.jsx(r.Button,Object.assign({},n.buttonProps,{style:{borderRadius:"0px",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:"0px"}})),e.jsxRuntimeExports.jsx("div",{className:"divider"}),e.jsxRuntimeExports.jsx(o.DropdownPopover,Object.assign({},n.dropdownProps,{children:e.jsxRuntimeExports.jsx(r.Button,Object.assign({},n.buttonProps,{buttonText:"",TrailingIcon:n.iconProps,style:{borderRadius:"0px",borderTopRightRadius:"4px",borderBottomRightRadius:"4px"}}))}))]}));
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),o=require("../dropdown/DropdownPopover/index.js");require("../dropdown/Dropdown.js"),require("../dropdown/ChipDropdown.js"),require("react"),require("../zeroState/ZeroState.js"),require("../TypographyStyle.js"),require("../../constants/Theme.js"),require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js");var r=require("../button/Button.js");require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var t=require("../button/themes.js"),n=require("../spinner/Spinner.js"),s=require("./DropdownButton.style.js");exports.DropdownButton=i=>{var p;return e.jsxRuntimeExports.jsxs(s.DropdownButtonStyle,Object.assign({type:i.buttonProps.buttonType,disabled:i.buttonProps.disabled},{children:[(null===(p=i.buttonProps)||void 0===p?void 0:p.isLoading)&&e.jsxRuntimeExports.jsx(s.LoaderContainer,Object.assign({style:{position:"absolute",inset:0}},{children:e.jsxRuntimeExports.jsx(n.Spinner,{className:"spinner",size:"small",color:t.SpinnerColorMap(i.buttonProps.buttonType||"primary",i.buttonProps.inverse)})})),e.jsxRuntimeExports.jsx(r.Button,Object.assign({},i.buttonProps,{isLoading:!1,style:{borderRadius:"0px",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:"0px"}})),e.jsxRuntimeExports.jsx("div",{className:"divider"}),e.jsxRuntimeExports.jsx(o.DropdownPopover,Object.assign({},i.dropdownProps,{children:e.jsxRuntimeExports.jsx(r.Button,Object.assign({},i.buttonProps,{isLoading:!1,buttonText:"",TrailingIcon:i.iconProps,style:{borderRadius:"0px",borderTopRightRadius:"4px",borderBottomRightRadius:"4px"}}))}))]}))};
@@ -3,3 +3,4 @@ export declare const DropdownButtonStyle: import("styled-components").StyledComp
3
3
  type: Type | undefined;
4
4
  disabled: boolean | undefined;
5
5
  }, never>;
6
+ export declare const LoaderContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,9 +1,20 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const n=r(e).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=r(e);const n=i.default.div`
2
2
  display: flex;
3
3
  flex-direction: row;
4
4
  width: max-content;
5
+ position: relative;
5
6
  .divider {
6
7
  width: ${e=>["primary","destructive"].includes(e.type)?"1px":"0px"};
7
8
  background-color: ${e=>{return r=e.type,(null==e?void 0:e.disabled)?t.COLORS.content.inactive:"primary"===r?"#CDA2FC":t.COLORS.content.primaryInverse;var r}};
9
+ height: 100%;
8
10
  }
9
- `;exports.DropdownButtonStyle=n;
11
+ `,o=i.default.div`
12
+ display: flex;
13
+ flex-direction: row;
14
+ align-items: center;
15
+ justify-content: center;
16
+ width: 100%;
17
+ border-radius: 4px;
18
+ background: ${t.BASE_COLORS.brand[50]};
19
+ z-index: 2;
20
+ `;exports.DropdownButtonStyle=n,exports.LoaderContainer=o;
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import { VariableV3 } from "../../../helpers";
3
3
  import React, { LegacyRef } from 'react';
4
4
  import Slider from 'react-slick';
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default EventsTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default IGTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
3
+ import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
4
+ import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
5
5
  declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
6
6
  cacheKey: string;
7
7
  propertyAddBtnText: string;
@@ -1 +1 @@
1
- import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth";import s from"../../assets/icons/box_search.svg.js";import i from"../../assets/icons/boxV2.svg.js";import o from"../../assets/icons/chevronDownOutline.svg.js";import n from"../../assets/icons/chevronUpOutline.svg.js";import r from"../../assets/icons/cross.svg.js";import l from"../../assets/icons/edit.svg.js";import c from"../../assets/icons/filePdf.svg.js";import a 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 x from"../../assets/icons/text_t9.svg.js";import h from"../../assets/icons/website.svg.js";import{useState as j,useMemo as m,useEffect as f}from"react";import{COLORS as y}from"../../constants/Theme.js";import{Button as v}from"../button/Button.js";import{IconButton as b}from"../icon-button/IconButton.js";import{BikShimmer as C}from"../shimmer/ShimmerComponent/BikShimmer.js";import{SideModal as I}from"../side-modal/SideModal.js";import{Tag as O}from"../tag/Tag.js";import{Tooltip as T}from"../tooltips/Tooltip.js";import{TitleSmall as E,BodyCaption as w,BodySecondary as S}from"../TypographyStyle.js";import L from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as N}from"./DataSourcePanel.style.js";import{intentConfig as F}from"./IntentConfig.js";import{DescriptionModal as A}from"./Modals/DescriptionModal.js";import{CustomDataType as _}from"./model.js";const k=k=>{var D,R;const{appType:P,storeId:B,messageSource:U,setMessageSourcePanel:K,hideCloseButton:M,isSourceInfoFetched:W,allSourceInfoDetail:$,ChecklistType:H,title:q,zeroStateButton:Q,editableSources:G,preFillTrainingSourceCount:Y,redirect:z,footerButtonOption:X,fetchTrainingSourceCount:V,fetchProductFAQCount:J,productSourceData:Z,reasonForAiGeneratedResponse:ee,showAiResponseReason:te,productSearchRule:se,onEditProductSearchRule:ie}=k,{sources:oe}=U,ne=["blog","article","page","policy"],[re,le]=j(!1),[ce,ae]=j(!1),[de,pe]=j(!1),[ue,ge]=j(0),[xe,he]=j(),[je,me]=j(null!=Y?Y:{}),[fe,ye]=j(!1),[ve,be]=j(!1),Ce={};F.forEach((t=>{let{key:s,type:i,tagText:o}=t;H[s]&&(Ce[H[s]]=e.jsx(O,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const Ie=oe.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Oe=oe.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),Te=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,s,i;if(!(null==U?void 0:U.messageId))return;le(!0),ae(!0),pe(!1!==(null===(t=null===(e=U.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=U.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=U.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));J(B,n).then((e=>ge(e))).then((()=>{Y?(me(Y),setTimeout((()=>{le(!1),ae(!1)}),100)):(setTimeout((()=>le(!1)),100),V(B).then((e=>me(e))).then((()=>setTimeout((()=>{ae(!1)}),100))))}))}),[J,V,null==U?void 0:U.messageId,U.sources,Y,B]);const Ee=e=>!!(e&&0===e.length||(null==U?void 0:U.isUnsatisfactoryAnswer)),we=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=_.FILES:ne.includes(e)?e=_.FETCHED_LINKS:"url"==e?e=_.WEBSITE_LINKS:"text"===e?e=_.TEXTS:"faq"===e&&(e=_.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.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=>"products"==t||"product"==t?e.jsx(i,{height:16,width:16,color:y.content.secondary}):"files"==t?e.jsx(c,{height:16,width:16,color:y.content.secondary}):"website links"==t||"fetched links"==t?e.jsx(h,{height:16,width:16,color:y.content.secondary}):"faq"==t?e.jsx(a,{height:16,width:16,color:y.content.secondary}):"texts"==t?e.jsx(x,{height:16,width:16,color:y.content.secondary}):e.jsx(p,{height:16,width:16,color:y.content.secondary}),Ne=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(re||!W)return e.jsx(N,{children:e.jsx(C,{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 Fe=s=>{const{title:i,count:r,isExpanded:l,onToggle:c,children:a}=s;return e.jsxs("div",{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:c},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsx(w,Object.assign({style:{fontWeight:"600"}},{children:i})),P===t.MANIFEST?e.jsx("div",Object.assign({style:{backgroundColor:y.surface.subdued,color:y.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:r})):e.jsx(e.Fragment,{})]})),e.jsx(e.Fragment,{children:P===t.BIK?e.jsx(e.Fragment,{}):l?e.jsx(o,{width:20,height:20,color:y.content.primary}):e.jsx(n,{width:20,height:20,color:y.content.primary})})]})),l&&a]})};return e.jsxs(e.Fragment,{children:[e.jsx(N,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!q&&e.jsx(E,{children:q}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(w,Object.assign({color:y.content.secondary},{children:"Intent"})),null!==(D=Ce[U.intent])&&void 0!==D?D:Ce.GENERIC,!M&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>K(void 0)},{children:e.jsx(r,{height:20,width:20,color:y.content.secondary})}))]})),se&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"12px",marginTop:"6px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsx(S,Object.assign({color:y.content.primary},{children:se.rule_name})),ie&&se.rule_id&&e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[e.jsx(s,{width:14,color:y.content.secondary}),e.jsx(w,Object.assign({color:y.content.secondary},{children:"Edit search rule"})),e.jsx(b,{Icon:l,height:16,width:16,bordered:!0,iconColor:y.content.primary,onClick:()=>ie(null==se?void 0:se.rule_id)})]}))]})),se.keywords&&se.keywords.length>0&&e.jsx("div",Object.assign({style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px",backgroundColor:y.surface.subdued,borderRadius:"8px",border:`1px dashed ${y.stroke.primary}`}},{children:se.keywords.map(((t,s)=>e.jsx(O,{tagText:t,theme:"light"},`keyword-${s}`)))}))]})),Ee(oe)?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:`${y.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(d,{width:24,height:24,color:y.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(E,{children:"Insufficient data"})})),e.jsx(S,Object.assign({color:y.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.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(v,{LeadingIcon:null!==(t=Q.leadingIcon)&&void 0!==t?t:u,buttonText:null!==(s=Q.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{Q.onClick()}})}))]}))})()})):!se&&e.jsx(O,{LeadingIcon:d,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:U.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===t.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Ee(oe)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsx(e.Fragment,{children:Ie.length>0&&e.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsx(Fe,Object.assign({title:"Product Sources",count:Ie.length,isExpanded:P!==t.MANIFEST||fe,onToggle:()=>ye(!fe)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ie.map(((t,s)=>{var i,o,n,r;const c=we(t.type||t.subTitle||"OpenAI"),a=we(t.type||t.subTitle||"OpenAI",!0),d=Se(c),p=null==G?void 0:G.includes(a),u=$[null!==(i=t.productId)&&void 0!==i?i:"Products"],x=t.title,h=t.productId&&(null==Z?void 0:Z[t.productId]),j=h&&h.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Ie?void 0:Ie.length)?`1px solid ${y.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:[Le(c),e.jsx(T,Object.assign({body:x,placement:"top"},{children:e.jsx(S,Object.assign({style:a==_.FETCHED_LINKS||a==_.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:y.content.primary,className:"clamp-title",onClick:()=>a==_.FETCHED_LINKS||a==_.WEBSITE_LINKS?z(t):{}},{children:x}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==H.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(w,Object.assign({color:y.content.secondary},{children:d}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(b,{Icon:l,height:16,width:16,iconColor:y.content.secondary,onClick:()=>null==u?void 0:u.onEditClick(u.data,u.type),disabled:!u,disabledTooltip:"This source is deleted"}):e.jsx(b,{Icon:g,height:16,width:16,iconColor:y.content.secondary,disabled:"custom"===t.type&&!u,disabledTooltip:"This source is deleted",onClick:()=>z(t)})}))]}))]})),h&&e.jsxs(w,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;he({title:x,description:Ne(h.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>he(void 0)})}},{children:`${null===(o=h.description)||void 0===o?void 0:o.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>h.onEditFaqClick(h.faqs)},{children:`${null===(n=h.faqs)||void 0===n?void 0:n.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(T,Object.assign({body:j,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(r=h.metafield)||void 0===r?void 0:r.length} metafields`}))}))]})]}),`info-${s}`)}))}))}))}))}),e.jsx(e.Fragment,{children:Oe.length>0&&e.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsx(Fe,Object.assign({title:"Content Sources",count:Oe.length,isExpanded:P!==t.MANIFEST||ve,onToggle:()=>be(!ve)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Oe.map(((t,s)=>{var i,o,n,r,c,a,d,p,u,x,h,j,m,f,v,C,I;const O=we(t.type||t.subTitle||"OpenAI"),E=we(t.type||t.subTitle||"OpenAI",!0),L=Se(O),N=null==G?void 0:G.includes(E),F="Products"===t.subTitle?$[null!==(i=t.productId)&&void 0!==i?i:"Products"]:$[null!==(o=t.docId)&&void 0!==o?o:""],A=E.toLowerCase()===(null===(n=_.FAQ)||void 0===n?void 0:n.toLowerCase())?"faq"===(null===(r=t.title)||void 0===r?void 0:r.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(c=_.FILES)||void 0===c?void 0:c.toLowerCase())||E.toLowerCase()===(null===(a=_.FETCHED_LINKS)||void 0===a?void 0:a.toLowerCase())||E.toLowerCase()===(null===(d=_.TEXTS)||void 0===d?void 0:d.toLowerCase())?t.title:E.toLowerCase()===(null===(p=_.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===H.EMAIL_COLLECTION?L:t.title,k="faq"===E.toLowerCase()?null!==(h=null!==(u=null==F?void 0:F.content)&&void 0!==u?u:null===(x=null==F?void 0:F.data)||void 0===x?void 0:x.answer)&&void 0!==h?h:"":E.toLowerCase()===(null===(j=_.FETCHED_LINKS)||void 0===j?void 0:j.toLowerCase())||E.toLowerCase()===(null===(m=_.WEBSITE_LINKS)||void 0===m?void 0:m.toLowerCase())||E.toLowerCase()===(null===(f=_.TEXTS)||void 0===f?void 0:f.toLowerCase())?null!==(I=null!==(v=null==F?void 0:F.content)&&void 0!==v?v:null===(C=null==F?void 0:F.data)||void 0===C?void 0:C.fileContentText)&&void 0!==I?I:"":t.intent===H.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==Oe?void 0:Oe.length)?`1px solid ${y.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:[Le(O),e.jsx(T,Object.assign({body:A,placement:"top"},{children:e.jsx(S,Object.assign({style:E==_.FETCHED_LINKS||E==_.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:y.content.primary,className:"clamp-title",onClick:()=>E==_.FETCHED_LINKS||E==_.WEBSITE_LINKS?z(t):{}},{children:A}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==H.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(w,Object.assign({color:y.content.secondary},{children:L}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:N?e.jsx(b,{Icon:l,height:16,width:16,iconColor:y.content.secondary,onClick:()=>null==F?void 0:F.onEditClick(F.data,F.type),disabled:!F,disabledTooltip:"This source is deleted"}):e.jsx(b,{Icon:g,height:16,width:16,iconColor:y.content.secondary,disabled:"custom"===t.type&&!F,disabledTooltip:"This source is deleted",onClick:()=>z(t)})}))]}))]})),(null!=k?k:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${y.stroke.primary}`,borderRadius:"4px",backgroundColor:y.surface.subdued}},{children:e.jsx(w,Object.assign({color:y.content.primary,className:"clamp-description"},{children:Ne(null!=k?k:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]})),de&&!Ee(oe)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(L,{appType:P,storeId:B,messageSource:U,sourceIntent:null!==(R=U.intent)&&void 0!==R?R:H.GENERIC,faqCount:ue,trainingSourceCount:je,ShowTrainingDataSource:Te,ChecklistType:H,footerButtonOption:X,isFooterLoading:ce,reasonForAiGeneratedResponse:ee,showAiResponseReason:te})}))]})}),xe&&e.jsx(I,Object.assign({header:"Product description",onClose:()=>he(void 0),width:"30%"},{children:e.jsx(A,{title:xe.title,description:xe.description,imageUrl:xe.imageUrl,onClose:xe.onClose})}))]})};export{k as DataSourcePanel};
1
+ import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth";import s from"../../assets/icons/box_search.svg.js";import i from"../../assets/icons/boxV2.svg.js";import o from"../../assets/icons/chevronDownOutline.svg.js";import n from"../../assets/icons/chevronUpOutline.svg.js";import r from"../../assets/icons/cross.svg.js";import l from"../../assets/icons/edit.svg.js";import c from"../../assets/icons/filePdf.svg.js";import a 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 x from"../../assets/icons/text_t9.svg.js";import h from"../../assets/icons/website.svg.js";import{useState as j,useMemo as m,useEffect as f}from"react";import{COLORS as y}from"../../constants/Theme.js";import{Button as v}from"../button/Button.js";import{IconButton as b}from"../icon-button/IconButton.js";import{BikShimmer as C}from"../shimmer/ShimmerComponent/BikShimmer.js";import{SideModal as I}from"../side-modal/SideModal.js";import{Tag as O}from"../tag/Tag.js";import{Tooltip as T}from"../tooltips/Tooltip.js";import{TitleSmall as E,BodyCaption as w,BodySecondary as S}from"../TypographyStyle.js";import L from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as N}from"./DataSourcePanel.style.js";import{intentConfig as F}from"./IntentConfig.js";import{DescriptionModal as A}from"./Modals/DescriptionModal.js";import{CustomDataType as _}from"./model.js";const k=k=>{var D,R;const{appType:P,storeId:B,messageSource:U,setMessageSourcePanel:K,hideCloseButton:M,isSourceInfoFetched:W,allSourceInfoDetail:$,ChecklistType:H,title:q,zeroStateButton:Q,editableSources:G,preFillTrainingSourceCount:Y,redirect:z,footerButtonOption:X,fetchTrainingSourceCount:V,fetchProductFAQCount:J,productSourceData:Z,reasonForAiGeneratedResponse:ee,showAiResponseReason:te,productSearchRule:se,onEditProductSearchRule:ie}=k,{sources:oe}=U,ne=["blog","article","page","policy"],[re,le]=j(!1),[ce,ae]=j(!1),[de,pe]=j(!1),[ue,ge]=j(0),[xe,he]=j(),[je,me]=j(null!=Y?Y:{}),[fe,ye]=j(!1),[ve,be]=j(!1),Ce={};F.forEach((t=>{let{key:s,type:i,tagText:o}=t;H[s]&&(Ce[H[s]]=e.jsx(O,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const Ie=oe.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Oe=oe.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),Te=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,s,i;if(!(null==U?void 0:U.messageId))return;le(!0),ae(!0),pe(!1!==(null===(t=null===(e=U.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=U.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=U.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));J(B,n).then((e=>ge(e))).then((()=>{Y?(me(Y),setTimeout((()=>{le(!1),ae(!1)}),100)):(setTimeout((()=>le(!1)),100),V(B).then((e=>me(e))).then((()=>setTimeout((()=>{ae(!1)}),100))))}))}),[J,V,null==U?void 0:U.messageId,U.sources,Y,B]);const Ee=e=>!!(e&&0===e.length||(null==U?void 0:U.isUnsatisfactoryAnswer)),we=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=_.FILES:ne.includes(e)?e=_.FETCHED_LINKS:"url"==e?e=_.WEBSITE_LINKS:"text"===e?e=_.TEXTS:"faq"===e&&(e=_.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.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=>"products"==t||"product"==t?e.jsx(i,{height:16,width:16,color:y.content.secondary}):"files"==t?e.jsx(c,{height:16,width:16,color:y.content.secondary}):"website links"==t||"fetched links"==t?e.jsx(h,{height:16,width:16,color:y.content.secondary}):"faq"==t?e.jsx(a,{height:16,width:16,color:y.content.secondary}):"texts"==t?e.jsx(x,{height:16,width:16,color:y.content.secondary}):e.jsx(p,{height:16,width:16,color:y.content.secondary}),Ne=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(re||!W)return e.jsx(N,{children:e.jsx(C,{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 Fe=s=>{const{title:i,count:r,isExpanded:l,onToggle:c,children:a}=s;return e.jsxs("div",{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:c},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsx(w,Object.assign({style:{fontWeight:"600"}},{children:i})),P===t.MANIFEST?e.jsx("div",Object.assign({style:{backgroundColor:y.surface.subdued,color:y.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:r})):e.jsx(e.Fragment,{})]})),e.jsx(e.Fragment,{children:P===t.BIK?e.jsx(e.Fragment,{}):l?e.jsx(o,{width:20,height:20,color:y.content.primary}):e.jsx(n,{width:20,height:20,color:y.content.primary})})]})),l&&a]})};return e.jsxs(e.Fragment,{children:[e.jsx(N,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",padding:0,paddingBottom:"12px"}},{children:[!!q&&e.jsx(E,{children:q}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(w,Object.assign({color:y.content.secondary},{children:"Intent"})),null!==(D=Ce[U.intent])&&void 0!==D?D:Ce.GENERIC,!M&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>K(void 0)},{children:e.jsx(r,{height:20,width:20,color:y.content.secondary})}))]})),se&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"12px",marginTop:"6px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsx(S,Object.assign({color:y.content.primary},{children:se.rule_name})),ie&&se.rule_id&&e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[e.jsx(s,{width:14,color:y.content.secondary}),e.jsx(w,Object.assign({color:y.content.secondary},{children:"Edit search rule"})),e.jsx(b,{Icon:l,height:16,width:16,bordered:!0,iconColor:y.content.primary,onClick:()=>ie(null==se?void 0:se.rule_id)})]}))]})),se.keywords&&se.keywords.length>0&&e.jsx("div",Object.assign({style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px",backgroundColor:y.surface.subdued,borderRadius:"8px",border:`1px dashed ${y.stroke.primary}`}},{children:se.keywords.map(((t,s)=>e.jsx(O,{tagText:t,theme:"light"},`keyword-${s}`)))}))]})),Ee(oe)?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:`${y.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(d,{width:24,height:24,color:y.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(E,{children:"Insufficient data"})})),e.jsx(S,Object.assign({color:y.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.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(v,{LeadingIcon:null!==(t=Q.leadingIcon)&&void 0!==t?t:u,buttonText:null!==(s=Q.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{Q.onClick()}})}))]}))})()})):!se&&e.jsx(O,{LeadingIcon:d,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:U.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===t.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Ee(oe)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsx(e.Fragment,{children:Ie.length>0&&e.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsx(Fe,Object.assign({title:"Product Sources",count:Ie.length,isExpanded:P!==t.MANIFEST||fe,onToggle:()=>ye(!fe)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ie.map(((t,s)=>{var i,o,n,r;const c=we(t.type||t.subTitle||"OpenAI"),a=we(t.type||t.subTitle||"OpenAI",!0),d=Se(c),p=null==G?void 0:G.includes(a),u=$[null!==(i=t.productId)&&void 0!==i?i:"Products"],x=t.title,h=t.productId&&(null==Z?void 0:Z[t.productId]),j=h&&h.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Ie?void 0:Ie.length)?`1px solid ${y.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:[Le(c),e.jsx(T,Object.assign({body:x,placement:"top"},{children:e.jsx(S,Object.assign({style:a==_.FETCHED_LINKS||a==_.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:y.content.primary,className:"clamp-title",onClick:()=>a==_.FETCHED_LINKS||a==_.WEBSITE_LINKS?z(t):{}},{children:x}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==H.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(w,Object.assign({color:y.content.secondary},{children:d}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(b,{Icon:l,height:16,width:16,iconColor:y.content.secondary,onClick:()=>null==u?void 0:u.onEditClick(u.data,u.type),disabled:!u,disabledTooltip:"This source is deleted"}):e.jsx(b,{Icon:g,height:16,width:16,iconColor:y.content.secondary,disabled:"custom"===t.type&&!u,disabledTooltip:"This source is deleted",onClick:()=>z(t)})}))]}))]})),h&&e.jsxs(w,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;he({title:x,description:Ne(h.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>he(void 0)})}},{children:`${null===(o=h.description)||void 0===o?void 0:o.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>h.onEditFaqClick(h.faqs)},{children:`${null===(n=h.faqs)||void 0===n?void 0:n.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(T,Object.assign({body:j,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(r=h.metafield)||void 0===r?void 0:r.length} metafields`}))}))]})]}),`info-${s}`)}))}))}))}))}),e.jsx(e.Fragment,{children:Oe.length>0&&e.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsx(Fe,Object.assign({title:"Content Sources",count:Oe.length,isExpanded:P!==t.MANIFEST||ve,onToggle:()=>be(!ve)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Oe.map(((t,s)=>{var i,o,n,r,c,a,d,p,u,x,h,j,m,f,v,C,I;const O=we(t.type||t.subTitle||"OpenAI"),E=we(t.type||t.subTitle||"OpenAI",!0),L=Se(O),N=null==G?void 0:G.includes(E),F="Products"===t.subTitle?$[null!==(i=t.productId)&&void 0!==i?i:"Products"]:$[null!==(o=t.docId)&&void 0!==o?o:""],A=E.toLowerCase()===(null===(n=_.FAQ)||void 0===n?void 0:n.toLowerCase())?"faq"===(null===(r=t.title)||void 0===r?void 0:r.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(c=_.FILES)||void 0===c?void 0:c.toLowerCase())||E.toLowerCase()===(null===(a=_.FETCHED_LINKS)||void 0===a?void 0:a.toLowerCase())||E.toLowerCase()===(null===(d=_.TEXTS)||void 0===d?void 0:d.toLowerCase())?t.title:E.toLowerCase()===(null===(p=_.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===H.EMAIL_COLLECTION?L:t.title,k="faq"===E.toLowerCase()?null!==(h=null!==(u=null==F?void 0:F.content)&&void 0!==u?u:null===(x=null==F?void 0:F.data)||void 0===x?void 0:x.answer)&&void 0!==h?h:"":E.toLowerCase()===(null===(j=_.FETCHED_LINKS)||void 0===j?void 0:j.toLowerCase())||E.toLowerCase()===(null===(m=_.WEBSITE_LINKS)||void 0===m?void 0:m.toLowerCase())||E.toLowerCase()===(null===(f=_.TEXTS)||void 0===f?void 0:f.toLowerCase())?null!==(I=null!==(v=null==F?void 0:F.content)&&void 0!==v?v:null===(C=null==F?void 0:F.data)||void 0===C?void 0:C.fileContentText)&&void 0!==I?I:"":t.intent===H.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==Oe?void 0:Oe.length)?`1px solid ${y.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:[Le(O),e.jsx(T,Object.assign({body:A,placement:"top"},{children:e.jsx(S,Object.assign({style:E==_.FETCHED_LINKS||E==_.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:y.content.primary,className:"clamp-title",onClick:()=>E==_.FETCHED_LINKS||E==_.WEBSITE_LINKS?z(t):{}},{children:A}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==H.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(w,Object.assign({color:y.content.secondary},{children:L}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:N?e.jsx(b,{Icon:l,height:16,width:16,iconColor:y.content.secondary,onClick:()=>null==F?void 0:F.onEditClick(F.data,F.type),disabled:!F,disabledTooltip:"This source is deleted"}):e.jsx(b,{Icon:g,height:16,width:16,iconColor:y.content.secondary,disabled:"custom"===t.type&&!F,disabledTooltip:"This source is deleted",onClick:()=>z(t)})}))]}))]})),(null!=k?k:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${y.stroke.primary}`,borderRadius:"4px",backgroundColor:y.surface.subdued}},{children:e.jsx(w,Object.assign({color:y.content.primary,className:"clamp-description"},{children:Ne(null!=k?k:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]})),de&&!Ee(oe)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(L,{appType:P,storeId:B,messageSource:U,sourceIntent:null!==(R=U.intent)&&void 0!==R?R:H.GENERIC,faqCount:ue,trainingSourceCount:je,ShowTrainingDataSource:Te,ChecklistType:H,footerButtonOption:X,isFooterLoading:ce,reasonForAiGeneratedResponse:ee,showAiResponseReason:te})}))]})}),xe&&e.jsx(I,Object.assign({header:"Product description",onClose:()=>he(void 0),width:"30%"},{children:e.jsx(A,{title:xe.title,description:xe.description,imageUrl:xe.imageUrl,onClose:xe.onClose})}))]})};export{k as DataSourcePanel};
@@ -1,14 +1,33 @@
1
- import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";const t=e.div`
2
- position:
1
+ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.js";const t=e.div`
3
2
  // if allowEvents is true, then position is relative, else position is absolute
4
- ${e=>(null==e?void 0:e.allowEvents)?"relative":"absolute"};
3
+
4
+ position: ${e=>(null==e?void 0:e.allowEvents)?"relative":"absolute"};
5
5
  left: 0px;
6
6
  top: 0px;
7
7
  width: 100%;
8
8
  height: 100%;
9
- z-index: 2;
9
+ z-index: 0;
10
10
  cursor: ${e=>(null==e?void 0:e.disabled)?"not-allowed":"pointer"};
11
- `,o=e.div`
11
+
12
+ &::before {
13
+ content: '';
14
+ position: absolute;
15
+ inset: 0;
16
+ width: 100%;
17
+ height: 100%;
18
+ background-color: transparent;
19
+ transition: background-color 0.2s ease;
20
+ pointer-events: none;
21
+ z-index: -1;
22
+ }
23
+
24
+ &:hover::before {
25
+ background-color: ${e=>e.disabled?"transparent":"rgba(0, 0, 0, 0.04)"};
26
+ }
27
+
28
+ /* When allowEvents is true, make this layer non-interactive */
29
+ pointer-events: ${e=>e.allowEvents?"none":"auto"};
30
+ `,i=e.div`
12
31
  margin-top: 8px;
13
32
  margin-bottom: 8px;
14
33
  `;e.div`
@@ -16,8 +35,8 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
16
35
  flex-direction: row;
17
36
  align-items: center;
18
37
  padding: 6px 8px;
19
- background: ${i.surface.hovered};
20
- border: 1px solid ${i.stroke.primary};
38
+ background: ${o.surface.hovered};
39
+ border: 1px solid ${o.stroke.primary};
21
40
  border-radius: 4px;
22
41
  `;const r=e.div`
23
42
  width: 360px;
@@ -27,11 +46,11 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
27
46
  justify-content: space-between;
28
47
  align-items: center;
29
48
  border-radius: 4px;
30
- border: ${e=>e.error?`1px solid ${i.stroke.negative.vibrant}`:`1px solid ${i.stroke.primary}`};
49
+ border: ${e=>e.error?`1px solid ${o.stroke.negative.vibrant}`:`1px solid ${o.stroke.primary}`};
31
50
  .chips-container {
32
51
  display: flex;
33
52
  gap: 8px;
34
53
  flex-wrap: wrap;
35
54
  align-items: center;
36
55
  }
37
- `;export{r as ChipInputWrapper,o as OpenDropdownContainer,t as OverLapAbs};
56
+ `;export{r as ChipInputWrapper,i as OpenDropdownContainer,t as OverLapAbs};
@@ -1 +1 @@
1
- import{j as o}from"../../node_modules/react/jsx-runtime.js";import{DropdownPopover as t}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"react";import"../zeroState/ZeroState.js";import"../TypographyStyle.js";import"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import{Button as e}from"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{DropdownButtonStyle as r}from"./DropdownButton.style.js";const n=n=>o.jsxs(r,Object.assign({type:n.buttonProps.buttonType,disabled:n.buttonProps.disabled},{children:[o.jsx(e,Object.assign({},n.buttonProps,{style:{borderRadius:"0px",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:"0px"}})),o.jsx("div",{className:"divider"}),o.jsx(t,Object.assign({},n.dropdownProps,{children:o.jsx(e,Object.assign({},n.buttonProps,{buttonText:"",TrailingIcon:n.iconProps,style:{borderRadius:"0px",borderTopRightRadius:"4px",borderBottomRightRadius:"4px"}}))}))]}));export{n as DropdownButton};
1
+ import{j as o}from"../../node_modules/react/jsx-runtime.js";import{DropdownPopover as t}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"react";import"../zeroState/ZeroState.js";import"../TypographyStyle.js";import"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import{Button as e}from"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{SpinnerColorMap as n}from"../button/themes.js";import{Spinner as r}from"../spinner/Spinner.js";import{DropdownButtonStyle as s,LoaderContainer as p}from"./DropdownButton.style.js";const i=i=>{var d;return o.jsxs(s,Object.assign({type:i.buttonProps.buttonType,disabled:i.buttonProps.disabled},{children:[(null===(d=i.buttonProps)||void 0===d?void 0:d.isLoading)&&o.jsx(p,Object.assign({style:{position:"absolute",inset:0}},{children:o.jsx(r,{className:"spinner",size:"small",color:n(i.buttonProps.buttonType||"primary",i.buttonProps.inverse)})})),o.jsx(e,Object.assign({},i.buttonProps,{isLoading:!1,style:{borderRadius:"0px",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:"0px"}})),o.jsx("div",{className:"divider"}),o.jsx(t,Object.assign({},i.dropdownProps,{children:o.jsx(e,Object.assign({},i.buttonProps,{isLoading:!1,buttonText:"",TrailingIcon:i.iconProps,style:{borderRadius:"0px",borderTopRightRadius:"4px",borderBottomRightRadius:"4px"}}))}))]}))};export{i as DropdownButton};
@@ -3,3 +3,4 @@ export declare const DropdownButtonStyle: import("styled-components").StyledComp
3
3
  type: Type | undefined;
4
4
  disabled: boolean | undefined;
5
5
  }, never>;
6
+ export declare const LoaderContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,9 +1,20 @@
1
- import t from"styled-components";import{COLORS as e}from"../../constants/Theme.js";const r=t.div`
1
+ import e from"styled-components";import{BASE_COLORS as t,COLORS as i}from"../../constants/Theme.js";const r=e.div`
2
2
  display: flex;
3
3
  flex-direction: row;
4
4
  width: max-content;
5
+ position: relative;
5
6
  .divider {
6
- width: ${t=>["primary","destructive"].includes(t.type)?"1px":"0px"};
7
- background-color: ${t=>{return r=t.type,(null==t?void 0:t.disabled)?e.content.inactive:"primary"===r?"#CDA2FC":e.content.primaryInverse;var r}};
7
+ width: ${e=>["primary","destructive"].includes(e.type)?"1px":"0px"};
8
+ background-color: ${e=>{return t=e.type,(null==e?void 0:e.disabled)?i.content.inactive:"primary"===t?"#CDA2FC":i.content.primaryInverse;var t}};
9
+ height: 100%;
8
10
  }
9
- `;export{r as DropdownButtonStyle};
11
+ `,n=e.div`
12
+ display: flex;
13
+ flex-direction: row;
14
+ align-items: center;
15
+ justify-content: center;
16
+ width: 100%;
17
+ border-radius: 4px;
18
+ background: ${t.brand[50]};
19
+ z-index: 2;
20
+ `;export{r as DropdownButtonStyle,n as LoaderContainer};
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import { VariableV3 } from "../../../helpers";
3
3
  import React, { LegacyRef } from 'react';
4
4
  import Slider from 'react-slick';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.696",
3
+ "version": "0.0.697-0",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",