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

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 (27) hide show
  1. package/dist/cjs/assets/icons/aiContentIcon.svg.js +1 -0
  2. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  3. package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.d.ts +0 -2
  4. package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  5. package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +0 -9
  6. package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
  7. package/dist/cjs/components/data-source-panel/DataSourcePanel.style.d.ts +0 -1
  8. package/dist/cjs/components/data-source-panel/DataSourcePanel.style.js +3 -12
  9. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +2 -0
  10. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +3 -0
  11. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  12. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  13. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +1 -0
  14. package/dist/esm/assets/icons/aiContentIcon.svg.js +1 -0
  15. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  16. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.d.ts +0 -2
  17. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  18. package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +0 -9
  19. package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
  20. package/dist/esm/components/data-source-panel/DataSourcePanel.style.d.ts +0 -1
  21. package/dist/esm/components/data-source-panel/DataSourcePanel.style.js +2 -11
  22. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +2 -0
  23. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +3 -0
  24. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  25. package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
  26. package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +1 -0
  27. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var l=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,l.get?l:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,a,l,r=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(e[l]=a[l])}return e},n.apply(this,arguments)}var o=e=>r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48"},e),t||(t=r.createElement("g",{filter:"url(#aiContentIcon_svg__a)"},r.createElement("circle",{cx:24,cy:22,r:16,fill:"url(#aiContentIcon_svg__b)"}))),a||(a=r.createElement("path",{fill:"#fff",d:"M27.99 13.338a.2.2 0 0 1 .354 0l.894 1.676a.2.2 0 0 0 .082.082l1.676.894a.2.2 0 0 1 0 .353l-1.676.894a.2.2 0 0 0-.082.082l-.894 1.676a.2.2 0 0 1-.353 0l-.894-1.676a.2.2 0 0 0-.082-.082l-1.677-.894a.2.2 0 0 1 0-.353l1.677-.894a.2.2 0 0 0 .082-.082l.894-1.676Zm-5.13 6.386a.2.2 0 0 0 .083.082l3.782 2.017a.2.2 0 0 1 0 .353l-3.782 2.018a.2.2 0 0 0-.082.082l-2.017 3.782a.2.2 0 0 1-.353 0l-2.017-3.782a.2.2 0 0 0-.083-.082l-3.782-2.018a.2.2 0 0 1 0-.353l3.782-2.017a.2.2 0 0 0 .083-.082l2.017-3.782a.2.2 0 0 1 .353 0l2.017 3.782Zm.323 2.452a.2.2 0 0 0 0-.353l-1.472-.785a.2.2 0 0 1-.082-.082l-.785-1.472a.2.2 0 0 0-.353 0l-.785 1.472a.2.2 0 0 1-.083.082l-1.472.785a.2.2 0 0 0 0 .353l1.472.786a.2.2 0 0 1 .082.082l.786 1.472a.2.2 0 0 0 .353 0l.785-1.472a.2.2 0 0 1 .082-.082l1.473-.786Zm7.26 3.464a.2.2 0 0 1-.082-.083l-1.184-2.22a.2.2 0 0 0-.353 0l-1.184 2.22a.2.2 0 0 1-.082.083l-2.22 1.183a.2.2 0 0 0 0 .353l2.22 1.184a.2.2 0 0 1 .082.082l1.184 2.22a.2.2 0 0 0 .353 0l1.184-2.22a.2.2 0 0 1 .082-.082l2.22-1.184a.2.2 0 0 0 0-.353l-2.22-1.183Z"})),l||(l=r.createElement("defs",null,r.createElement("linearGradient",{id:"aiContentIcon_svg__b",x1:8,x2:41.305,y1:8.667,y2:10.232,gradientUnits:"userSpaceOnUse"},r.createElement("stop",{stopColor:"#FF166A"}),r.createElement("stop",{offset:1,stopColor:"#FB5F08"})),r.createElement("filter",{id:"aiContentIcon_svg__a",width:48,height:48,x:0,y:0,colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse"},r.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),r.createElement("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),r.createElement("feOffset",{dy:2}),r.createElement("feGaussianBlur",{stdDeviation:4}),r.createElement("feComposite",{in2:"hardAlpha",operator:"out"}),r.createElement("feColorMatrix",{values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0"}),r.createElement("feBlend",{in2:"BackgroundImageFix",result:"effect1_dropShadow_4220_23732"}),r.createElement("feBlend",{in:"SourceGraphic",in2:"effect1_dropShadow_4220_23732",result:"shape"})))));exports.default=o;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -17,8 +17,6 @@ interface SourceInfoFooterProps {
17
17
  ChecklistType: Record<string, string>;
18
18
  footerButtonOption?: footerButtonOptionModel;
19
19
  isFooterLoading?: boolean;
20
- reasonForAiGeneratedResponse?: string;
21
- showAiResponseReason?: boolean;
22
20
  }
23
21
  declare const SourceInfoFooter: import("react").MemoExoticComponent<(props: SourceInfoFooterProps) => import("react/jsx-runtime").JSX.Element>;
24
22
  export default SourceInfoFooter;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/alert_triangle.svg.js"),o=require("../../assets/icons/plus.svg.js"),i=require("react"),n=require("../../constants/Theme.js"),s=require("../button/Button.js"),r=require("../shimmer/ShimmerComponent/BikShimmer.js"),a=require("../TypographyStyle.js"),d=require("./DataSourcePanel.style.js"),l=require("../../_virtual/bik-store.js");const c=i.memo((c=>{const{appType:h,sourceIntent:g,hideHeading:v,messageSource:m,trainingSourceCount:y={},ShowTrainingDataSource:b={},faqCount:T,ChecklistType:j,footerButtonOption:x,isFooterLoading:A,reasonForAiGeneratedResponse:_,showAiResponseReason:O}=c,C=b,[R,S]=i.useState(!0),[f,I]=i.useState(!0),F="/bik-ai/training",[w,N]=i.useState({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[k,E]=i.useState({title:"",subTitle:""}),q=i.useMemo((()=>{const e=(null==y?void 0:y[g])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[y,g]),D=()=>{var e;(null==w?void 0:w.redirectUrl)?window.open(`${window.location.origin}${null==w?void 0:w.redirectUrl}`,"_self"):Object.keys(null!==(e=null==w?void 0:w.addFaqProps)&&void 0!==e?e:{}).length>0?null==x||x.onClick(w):(null==x?void 0:x.navigate)&&(null==x||x.navigate("Training",h==l.__exports.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return i.useEffect((()=>{var e,t,o,i;if(g){if(null===(e=null==m?void 0:m.sources)||void 0===e?void 0:e.length){const e=m.sources[0];if(C[g])g===j.ORDER_ENQUIRY&&I(!1);else{let n=null==e?void 0:e.insights,s="";switch(g){case j.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(n=`${T||"No"} FAQs added for this product`,s="Add product-specific information via FAQs to improve responses",N({buttonTitle:"Add FAQ",addFaqProps:{faqProducts:[{id:null==e?void 0:e.productId,variantId:null==e?void 0:e.variantId,name:null==e?void 0:e.title,imageUrl:null==e?void 0:e.imageUrl}]},redirectUrl:""}));break;case j.ORDER_MODIFICATION:n=(null==y?void 0:y[g])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",n&&N({buttonTitle:h==l.__exports.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:h==l.__exports.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":F,addFaqProps:{}});break;case j.ORDER_CANCELLATION:n=(null==y?void 0:y[g])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",N({buttonTitle:h==l.__exports.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:h==l.__exports.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":F,addFaqProps:{}});break;case j.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;N({buttonTitle:h==l.__exports.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:h==l.__exports.ApplicationType.MANIFEST?"/training/order-management":F,addFaqProps:{}});break;case j.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(i=null===(o=null===(t=null==m?void 0:m.sources)||void 0===t?void 0:t[0])||void 0===o?void 0:o.title)||void 0===i?void 0:i.toLowerCase().indexOf("collection"))){n="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}n="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}E({title:null!=n?n:"",subTitle:s})}}(C[g]||[j.PRODUCT_DETAILS,j.ORDER_MODIFICATION,j.ORDER_CANCELLATION,j.ORDER_TRACKING].includes(g))&&S(!1)}}),[null==m?void 0:m.messageId,y,g,null==m?void 0:m.sources,C,j,T,h,m]),e.jsx(d.SourceInfoFooterStyle,{children:A?e.jsx(e.Fragment,{children:e.jsx(r.BikShimmer,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}):e.jsx(e.Fragment,{children:!(null==k?void 0:k.title)&&y&&g in y?e.jsxs(e.Fragment,{children:[e.jsx(u,{hideHeading:null!=v&&v}),e.jsx(p,{reason:_||"",showAiResponseReason:null!=O&&O}),e.jsxs("div",Object.assign({className:"source_info_details "+(y[g]>0?"":"no_data_source")},{children:[y[g]>0&&f?e.jsxs(e.Fragment,{children:[e.jsx(a.BodyCaption,{children:q}),e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):f&&e.jsxs("div",Object.assign({className:"no_data_source_title"},{children:[e.jsx(t.default,{width:15,height:15,color:n.COLORS.content.negative,style:{marginTop:2}}),e.jsx(a.BodyCaption,{children:"No data sources added to the identified link"})]})),!x||x.hideAddDataButton||R?e.jsx(e.Fragment,{}):e.jsx(s.Button,{size:"small",buttonType:"tertiary",LeadingIcon:o.default,buttonText:(null==w?void 0:w.buttonTitle.length)>0?null==w?void 0:w.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>D(),style:{backgroundColor:"unset"}})]}))]}):e.jsxs(e.Fragment,{children:[e.jsx(u,{hideHeading:null!=v&&v}),e.jsx(p,{reason:_||"",showAiResponseReason:null!=O&&O}),e.jsxs("div",Object.assign({className:"source_info_details"},{children:[f&&e.jsxs(e.Fragment,{children:[e.jsx(a.BodyCaption,{children:null==k?void 0:k.title}),e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:null==k?void 0:k.subTitle}))]}),!x||x.hideAddDataButton||R?e.jsx(e.Fragment,{}):e.jsx(s.Button,{size:"small",buttonType:"tertiary",LeadingIcon:o.default,buttonText:(null==w?void 0:w.buttonTitle.length)>0?null==w?void 0:w.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>D(),style:{backgroundColor:"unset"}})]}))]})})})})),u=i.memo((t=>t.hideHeading?null:e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Training insights"})))),p=i.memo((t=>{const[o,s]=i.useState(!1),r=t.reason&&t.reason.length>50,d=r&&!o?t.reason.substring(0,50)+"...":t.reason;return t.showAiResponseReason?e.jsxs("div",Object.assign({className:"source_info_details"},{children:[e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.primary,className:"why_ai_gave_this_response"},{children:"Here’s why your AI gave this response"})),e.jsxs(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary,className:"clamp-text"},{children:[d||"No reason provided for this response.",r&&e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.brand,style:{cursor:"pointer",textDecoration:"underline",marginTop:"4px"},onClick:()=>s(!o)},{children:o?"Show less":"Show more"}))]}))]})):e.jsx(e.Fragment,{})}));p.displayName="WhyAiGaveThisResponse",u.displayName="TrainingInsightsHeading",c.displayName="SourceInfoFooter",exports.default=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/alert_triangle.svg.js"),i=require("../../assets/icons/plus.svg.js"),o=require("react"),n=require("../../constants/Theme.js"),r=require("../button/Button.js"),d=require("../shimmer/ShimmerComponent/BikShimmer.js"),a=require("../TypographyStyle.js"),s=require("./DataSourcePanel.style.js"),l=require("../../_virtual/bik-store.js");const u=o.memo((u=>{const{appType:p,sourceIntent:v,hideHeading:g,messageSource:h,trainingSourceCount:m={},ShowTrainingDataSource:T={},faqCount:b,ChecklistType:y,footerButtonOption:x,isFooterLoading:j}=u,A=T,[_,O]=o.useState(!0),[C,f]=o.useState(!0),I="/bik-ai/training",[F,S]=o.useState({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[k,R]=o.useState({title:"",subTitle:""}),N=o.useMemo((()=>{const e=(null==m?void 0:m[v])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[m,v]),w=()=>{var e;(null==F?void 0:F.redirectUrl)?window.open(`${window.location.origin}${null==F?void 0:F.redirectUrl}`,"_self"):Object.keys(null!==(e=null==F?void 0:F.addFaqProps)&&void 0!==e?e:{}).length>0?null==x||x.onClick(F):(null==x?void 0:x.navigate)&&(null==x||x.navigate("Training",p==l.__exports.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return o.useEffect((()=>{var e,t,i,o;if(v){if(null===(e=null==h?void 0:h.sources)||void 0===e?void 0:e.length){const e=h.sources[0];if(A[v])v===y.ORDER_ENQUIRY&&f(!1);else{let n=null==e?void 0:e.insights,r="";switch(v){case y.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(n=`${b||"No"} FAQs added for this product`,r="Add product-specific information via FAQs to improve responses",S({buttonTitle:"Add FAQ",addFaqProps:{faqProducts:[{id:null==e?void 0:e.productId,variantId:null==e?void 0:e.variantId,name:null==e?void 0:e.title,imageUrl:null==e?void 0:e.imageUrl}]},redirectUrl:""}));break;case y.ORDER_MODIFICATION:n=(null==m?void 0:m[v])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",n&&S({buttonTitle:p==l.__exports.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:p==l.__exports.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":I,addFaqProps:{}});break;case y.ORDER_CANCELLATION:n=(null==m?void 0:m[v])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",S({buttonTitle:p==l.__exports.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:p==l.__exports.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":I,addFaqProps:{}});break;case y.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;S({buttonTitle:p==l.__exports.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:p==l.__exports.ApplicationType.MANIFEST?"/training/order-management":I,addFaqProps:{}});break;case y.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(o=null===(i=null===(t=null==h?void 0:h.sources)||void 0===t?void 0:t[0])||void 0===i?void 0:i.title)||void 0===o?void 0:o.toLowerCase().indexOf("collection"))){n="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}n="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}R({title:null!=n?n:"",subTitle:r})}}(A[v]||[y.PRODUCT_DETAILS,y.ORDER_MODIFICATION,y.ORDER_CANCELLATION,y.ORDER_TRACKING].includes(v))&&O(!1)}}),[null==h?void 0:h.messageId,m,v,null==h?void 0:h.sources,A,y,b,p,h]),e.jsx(s.SourceInfoFooterStyle,{children:j?e.jsx(e.Fragment,{children:e.jsx(d.BikShimmer,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}):e.jsx(e.Fragment,{children:!(null==k?void 0:k.title)&&m&&v in m?e.jsxs(e.Fragment,{children:[e.jsx(c,{hideHeading:null!=g&&g}),e.jsxs("div",Object.assign({className:"source_info_details "+(m[v]>0?"":"no_data_source")},{children:[m[v]>0&&C?e.jsxs(e.Fragment,{children:[e.jsx(a.BodyCaption,{children:N}),e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):C&&e.jsxs("div",Object.assign({className:"no_data_source_title"},{children:[e.jsx(t.default,{width:15,height:15,color:n.COLORS.content.negative,style:{marginTop:2}}),e.jsx(a.BodyCaption,{children:"No data sources added to the identified link"})]})),!x||x.hideAddDataButton||_?e.jsx(e.Fragment,{}):e.jsx(r.Button,{size:"small",buttonType:"tertiary",LeadingIcon:i.default,buttonText:(null==F?void 0:F.buttonTitle.length)>0?null==F?void 0:F.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>w(),style:{backgroundColor:"unset"}})]}))]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{hideHeading:null!=g&&g}),e.jsxs("div",Object.assign({className:"source_info_details"},{children:[C&&e.jsxs(e.Fragment,{children:[e.jsx(a.BodyCaption,{children:null==k?void 0:k.title}),e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:null==k?void 0:k.subTitle}))]}),!x||x.hideAddDataButton||_?e.jsx(e.Fragment,{}):e.jsx(r.Button,{size:"small",buttonType:"tertiary",LeadingIcon:i.default,buttonText:(null==F?void 0:F.buttonTitle.length)>0?null==F?void 0:F.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>w(),style:{backgroundColor:"unset"}})]}))]})})})})),c=o.memo((t=>t.hideHeading?null:e.jsx(a.BodyCaption,Object.assign({color:n.COLORS.content.secondary},{children:"Training insights"}))));c.displayName="TrainingInsightsHeading",u.displayName="SourceInfoFooter",exports.default=u;
@@ -1,13 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource, ProductSourceData } from './model';
4
- export interface CollapsibleSectionProps {
5
- title: string;
6
- count: number;
7
- isExpanded: boolean;
8
- onToggle: () => void;
9
- children: React.ReactNode;
10
- }
11
4
  export interface DataSourcePanelProps {
12
5
  storeId: string;
13
6
  appType: ApplicationType;
@@ -30,7 +23,5 @@ export interface DataSourcePanelProps {
30
23
  }>;
31
24
  fetchProductFAQCount: (storeId: string, productIds?: string[]) => Promise<number>;
32
25
  productSourceData?: ProductSourceData;
33
- reasonForAiGeneratedResponse?: string;
34
- showAiResponseReason?: boolean;
35
26
  }
36
27
  export declare const DataSourcePanel: React.FC<DataSourcePanelProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/boxV2.svg.js"),s=require("../../assets/icons/chevronDownOutline.svg.js"),i=require("../../assets/icons/chevronUpOutline.svg.js"),o=require("../../assets/icons/cross.svg.js"),n=require("../../assets/icons/edit.svg.js"),l=require("../../assets/icons/filePdf.svg.js"),a=require("../../assets/icons/help.svg.js"),r=require("../../assets/icons/info.svg.js"),d=require("../../assets/icons/openai.svg.js"),c=require("../../assets/icons/plus.svg.js"),u=require("../../assets/icons/redirect.svg.js"),p=require("../../assets/icons/text_t9.svg.js"),g=require("../../assets/icons/website.svg.js"),h=require("react"),x=require("../../constants/Theme.js"),j=require("../button/Button.js"),C=require("../icon-button/IconButton.js"),y=require("../shimmer/ShimmerComponent/BikShimmer.js"),O=require("../side-modal/SideModal.js"),m=require("../tag/Tag.js"),v=require("../tooltips/Tooltip.js"),f=require("../TypographyStyle.js"),S=require("./DataSourceInfoFooter.js"),T=require("./DataSourcePanel.style.js"),I=require("./IntentConfig.js"),b=require("./Modals/DescriptionModal.js"),L=require("./model.js"),E=require("../../_virtual/bik-store.js");exports.DataSourcePanel=w=>{var D,N;const{appType:R,storeId:_,messageSource:A,setMessageSourcePanel:F,hideCloseButton:q,isSourceInfoFetched:B,allSourceInfoDetail:k,ChecklistType:P,title:M,zeroStateButton:U,editableSources:K,preFillTrainingSourceCount:W,redirect:H,footerButtonOption:$,fetchTrainingSourceCount:Q,fetchProductFAQCount:G,productSourceData:Y,reasonForAiGeneratedResponse:z,showAiResponseReason:X}=w,{sources:V}=A,J=["blog","article","page","policy"],[Z,ee]=h.useState(!1),[te,se]=h.useState(!1),[ie,oe]=h.useState(!1),[ne,le]=h.useState(0),[ae,re]=h.useState(),[de,ce]=h.useState(null!=W?W:{}),[ue,pe]=h.useState(!1),[ge,he]=h.useState(!1),xe={};I.intentConfig.forEach((t=>{let{key:s,type:i,tagText:o}=t;P[s]&&(xe[P[s]]=e.jsx(m.Tag,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const je=V.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Ce=V.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),ye=h.useMemo((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{P[t]&&(e[P[t]]=P[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[P]);h.useEffect((()=>{var e,t,s,i;if(!(null==A?void 0:A.messageId))return;ee(!0),se(!0),oe(!1!==(null===(t=null===(e=A.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=A.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=A.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));G(_,n).then((e=>le(e))).then((()=>{W?(ce(W),setTimeout((()=>{ee(!1),se(!1)}),100)):(setTimeout((()=>ee(!1)),100),Q(_).then((e=>ce(e))).then((()=>setTimeout((()=>{se(!1)}),100))))}))}),[G,Q,null==A?void 0:A.messageId,A.sources,W,_]);const Oe=e=>!!(e&&0===e.length||(null==A?void 0:A.isUnsatisfactoryAnswer)),me=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:J.includes(e)?e=L.CustomDataType.FETCHED_LINKS:"url"==e?e=L.CustomDataType.WEBSITE_LINKS:"text"===e?e=L.CustomDataType.TEXTS:"faq"===e&&(e=L.CustomDataType.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.replace(/_/g," ")},ve=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",fe=s=>"products"==s||"product"==s?e.jsx(t.default,{height:16,width:16,color:x.COLORS.content.secondary}):"files"==s?e.jsx(l.default,{height:16,width:16,color:x.COLORS.content.secondary}):"website links"==s||"fetched links"==s?e.jsx(g.default,{height:16,width:16,color:x.COLORS.content.secondary}):"faq"==s?e.jsx(a.default,{height:16,width:16,color:x.COLORS.content.secondary}):"texts"==s?e.jsx(p.default,{height:16,width:16,color:x.COLORS.content.secondary}):e.jsx(d.default,{height:16,width:16,color:x.COLORS.content.secondary}),Se=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(Z||!B)return e.jsx(T.SourceInfoDetailsStyle,{children:e.jsx(y.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})});const Te=t=>{const{title:o,count:n,isExpanded:l,onToggle:a,children:r}=t;return e.jsxs("div",{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:a},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsx(f.BodyCaption,Object.assign({style:{fontWeight:"600"}},{children:o})),R===E.__exports.ApplicationType.MANIFEST?e.jsx("div",Object.assign({style:{backgroundColor:x.COLORS.surface.subdued,color:x.COLORS.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:n})):e.jsx(e.Fragment,{})]})),e.jsx(e.Fragment,{children:R===E.__exports.ApplicationType.BIK?e.jsx(e.Fragment,{}):l?e.jsx(s.default,{width:20,height:20,color:x.COLORS.content.primary}):e.jsx(i.default,{width:20,height:20,color:x.COLORS.content.primary})})]})),l&&r]})};return e.jsxs(e.Fragment,{children:[e.jsx(T.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!M&&e.jsx(f.TitleSmall,{children:M}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:"Intent"})),null!==(D=xe[A.intent])&&void 0!==D?D:xe.GENERIC,!q&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>F(void 0)},{children:e.jsx(o.default,{height:20,width:20,color:x.COLORS.content.secondary})}))]})),Oe(V)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${x.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(r.default,{width:24,height:24,color:x.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(f.TitleSmall,{children:"Insufficient data"})})),e.jsx(f.BodySecondary,Object.assign({color:x.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),U&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(j.Button,{LeadingIcon:null!==(t=U.leadingIcon)&&void 0!==t?t:c.default,buttonText:null!==(s=U.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{U.onClick()}})}))]}))})()})):e.jsx(m.Tag,{LeadingIcon:r.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:A.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${R===E.__exports.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Oe(V)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsx(e.Fragment,{children:je.length>0&&e.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsx(Te,Object.assign({title:"Product Sources",count:je.length,isExpanded:R!==E.__exports.ApplicationType.MANIFEST||ue,onToggle:()=>pe(!ue)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:je.map(((t,s)=>{var i,o,l,a;const r=me(t.type||t.subTitle||"OpenAI"),d=me(t.type||t.subTitle||"OpenAI",!0),c=ve(r),p=null==K?void 0:K.includes(d),g=k[null!==(i=t.productId)&&void 0!==i?i:"Products"],h=t.title,j=t.productId&&(null==Y?void 0:Y[t.productId]),y=j&&j.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==je?void 0:je.length)?`1px solid ${x.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[fe(r),e.jsx(v.Tooltip,Object.assign({body:h,placement:"top"},{children:e.jsx(f.BodySecondary,Object.assign({style:d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.COLORS.content.primary,className:"clamp-title",onClick:()=>d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:h}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==P.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:c}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(C.IconButton,{Icon:n.default,height:16,width:16,iconColor:x.COLORS.content.secondary,onClick:()=>null==g?void 0:g.onEditClick(g.data,g.type),disabled:!g,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:u.default,height:16,width:16,iconColor:x.COLORS.content.secondary,disabled:"custom"===t.type&&!g,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),j&&e.jsxs(f.BodyCaption,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;re({title:h,description:Se(j.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>re(void 0)})}},{children:`${null===(o=j.description)||void 0===o?void 0:o.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>j.onEditFaqClick(j.faqs)},{children:`${null===(l=j.faqs)||void 0===l?void 0:l.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(v.Tooltip,Object.assign({body:y,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(a=j.metafield)||void 0===a?void 0:a.length} metafields`}))}))]})]}),`info-${s}`)}))}))}))}))}),e.jsx(e.Fragment,{children:Ce.length>0&&e.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsx(Te,Object.assign({title:"Content Sources",count:Ce.length,isExpanded:R!==E.__exports.ApplicationType.MANIFEST||ge,onToggle:()=>he(!ge)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ce.map(((t,s)=>{var i,o,l,a,r,d,c,p,g,h,j,y,O,m,S,T,I;const b=me(t.type||t.subTitle||"OpenAI"),E=me(t.type||t.subTitle||"OpenAI",!0),w=ve(b),D=null==K?void 0:K.includes(E),N="Products"===t.subTitle?k[null!==(i=t.productId)&&void 0!==i?i:"Products"]:k[null!==(o=t.docId)&&void 0!==o?o:""],R=E.toLowerCase()===(null===(l=L.CustomDataType.FAQ)||void 0===l?void 0:l.toLowerCase())?"faq"===(null===(a=t.title)||void 0===a?void 0:a.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(r=L.CustomDataType.FILES)||void 0===r?void 0:r.toLowerCase())||E.toLowerCase()===(null===(d=L.CustomDataType.FETCHED_LINKS)||void 0===d?void 0:d.toLowerCase())||E.toLowerCase()===(null===(c=L.CustomDataType.TEXTS)||void 0===c?void 0:c.toLowerCase())?t.title:E.toLowerCase()===(null===(p=L.CustomDataType.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):t.intent===P.EMAIL_COLLECTION?w:t.title,_="faq"===E.toLowerCase()?null!==(j=null!==(g=null==N?void 0:N.content)&&void 0!==g?g:null===(h=null==N?void 0:N.data)||void 0===h?void 0:h.answer)&&void 0!==j?j:"":E.toLowerCase()===(null===(y=L.CustomDataType.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||E.toLowerCase()===(null===(O=L.CustomDataType.WEBSITE_LINKS)||void 0===O?void 0:O.toLowerCase())||E.toLowerCase()===(null===(m=L.CustomDataType.TEXTS)||void 0===m?void 0:m.toLowerCase())?null!==(I=null!==(S=null==N?void 0:N.content)&&void 0!==S?S:null===(T=null==N?void 0:N.data)||void 0===T?void 0:T.fileContentText)&&void 0!==I?I:"":t.intent===P.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Ce?void 0:Ce.length)?`1px solid ${x.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[fe(b),e.jsx(v.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(f.BodySecondary,Object.assign({style:E==L.CustomDataType.FETCHED_LINKS||E==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.COLORS.content.primary,className:"clamp-title",onClick:()=>E==L.CustomDataType.FETCHED_LINKS||E==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:R}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==P.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:w}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:D?e.jsx(C.IconButton,{Icon:n.default,height:16,width:16,iconColor:x.COLORS.content.secondary,onClick:()=>null==N?void 0:N.onEditClick(N.data,N.type),disabled:!N,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:u.default,height:16,width:16,iconColor:x.COLORS.content.secondary,disabled:"custom"===t.type&&!N,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${x.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:x.COLORS.surface.subdued}},{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.primary,className:"clamp-description"},{children:Se(null!=_?_:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]})),ie&&!Oe(V)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(S.default,{appType:R,storeId:_,messageSource:A,sourceIntent:null!==(N=A.intent)&&void 0!==N?N:P.GENERIC,faqCount:ne,trainingSourceCount:de,ShowTrainingDataSource:ye,ChecklistType:P,footerButtonOption:$,isFooterLoading:te,reasonForAiGeneratedResponse:z,showAiResponseReason:X})}))]})}),ae&&e.jsx(O.SideModal,Object.assign({header:"Product description",onClose:()=>re(void 0),width:"30%"},{children:e.jsx(b.DescriptionModal,{title:ae.title,description:ae.description,imageUrl:ae.imageUrl,onClose:ae.onClose})}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/boxV2.svg.js"),i=require("../../assets/icons/cross.svg.js"),s=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),l=require("../../assets/icons/info.svg.js"),a=require("../../assets/icons/openai.svg.js"),r=require("../../assets/icons/plus.svg.js"),d=require("../../assets/icons/redirect.svg.js"),c=require("../../assets/icons/text_t9.svg.js"),u=require("../../assets/icons/website.svg.js"),p=require("react"),h=require("../../constants/Theme.js"),g=require("../button/Button.js"),x=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),j=require("../side-modal/SideModal.js"),y=require("../tag/Tag.js"),m=require("../tooltips/Tooltip.js"),O=require("../TypographyStyle.js"),v=require("./DataSourceInfoFooter.js"),f=require("./DataSourcePanel.style.js"),S=require("./IntentConfig.js"),T=require("./Modals/DescriptionModal.js"),I=require("./model.js"),L=require("../../_virtual/bik-store.js");exports.DataSourcePanel=b=>{var E,w;const{appType:D,storeId:N,messageSource:R,setMessageSourcePanel:_,hideCloseButton:q,isSourceInfoFetched:B,allSourceInfoDetail:A,ChecklistType:k,title:F,zeroStateButton:P,editableSources:M,preFillTrainingSourceCount:U,redirect:K,footerButtonOption:W,fetchTrainingSourceCount:H,fetchProductFAQCount:$,productSourceData:Q}=b,{sources:Y}=R,G=["blog","article","page","policy"],[X,z]=p.useState(!1),[V,J]=p.useState(!1),[Z,ee]=p.useState(!1),[te,ie]=p.useState(0),[se,oe]=p.useState(),[ne,le]=p.useState(null!=U?U:{}),ae={};S.intentConfig.forEach((t=>{let{key:i,type:s,tagText:o}=t;k[i]&&(ae[k[i]]=e.jsx(y.Tag,{theme:"light",type:s,tagText:o,cursor:"pointer"}))}));const re=Y.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),de=Y.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),ce=p.useMemo((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{k[t]&&(e[k[t]]=k[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[k]);p.useEffect((()=>{var e,t,i,s;if(!(null==R?void 0:R.messageId))return;z(!0),J(!0),ee(!1!==(null===(t=null===(e=R.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(s=null===(i=R.sources)||void 0===i?void 0:i[0])||void 0===s?void 0:s.insights));const o=R.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));$(N,n).then((e=>ie(e))).then((()=>{U?(le(U),setTimeout((()=>{z(!1),J(!1)}),100)):(setTimeout((()=>z(!1)),100),H(N).then((e=>le(e))).then((()=>setTimeout((()=>{J(!1)}),100))))}))}),[$,H,null==R?void 0:R.messageId,R.sources,U,N]);const ue=e=>!!(e&&0===e.length||(null==R?void 0:R.isUnsatisfactoryAnswer)),pe=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=I.CustomDataType.FILES:G.includes(e)?e=I.CustomDataType.FETCHED_LINKS:"url"==e?e=I.CustomDataType.WEBSITE_LINKS:"text"===e?e=I.CustomDataType.TEXTS:"faq"===e&&(e=I.CustomDataType.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},he=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",ge=i=>"products"==i||"product"==i?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==i?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==i||"fetched links"==i?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==i?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==i?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary}),xe=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return X||!B?e.jsx(f.SourceInfoDetailsStyle,{children:e.jsx(C.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})}):e.jsxs(e.Fragment,{children:[e.jsx(f.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!F&&e.jsx(O.TitleSmall,{children:F}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(E=ae[R.intent])&&void 0!==E?E:ae.GENERIC,!q&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>_(void 0)},{children:e.jsx(i.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),ue(Y)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,i;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(l.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(O.TitleSmall,{children:"Insufficient data"})})),e.jsx(O.BodySecondary,Object.assign({color:h.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),P&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=P.leadingIcon)&&void 0!==t?t:r.default,buttonText:null!==(i=P.title)&&void 0!==i?i:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{P.onClick()}})}))]}))})()})):e.jsx(y.Tag,{LeadingIcon:l.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:R.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${D===L.__exports.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!ue(Y)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[re.length>0&&e.jsxs("div",Object.assign({className:"info-product-source"},{children:[e.jsx(O.BodyCaption,{children:"Product Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:re.map(((t,i)=>{var o,n,l,a;const r=pe(t.type||t.subTitle||"OpenAI"),c=pe(t.type||t.subTitle||"OpenAI",!0),u=he(r),p=null==M?void 0:M.includes(c),g=A[null!==(o=t.productId)&&void 0!==o?o:"Products"],C=t.title,j=t.productId&&(null==Q?void 0:Q[t.productId]),y=j&&j.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:i+1<(null==re?void 0:re.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[ge(r),e.jsx(m.Tooltip,Object.assign({body:C,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?K(t):{}},{children:C}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==k.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:u}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==g?void 0:g.onEditClick(g.data,g.type),disabled:!g,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!g,disabledTooltip:"This source is deleted",onClick:()=>K(t)})}))]}))]})),j&&e.jsxs(O.BodyCaption,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;oe({title:C,description:xe(j.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>oe(void 0)})}},{children:`${null===(n=j.description)||void 0===n?void 0:n.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>j.onEditFaqClick(j.faqs)},{children:`${null===(l=j.faqs)||void 0===l?void 0:l.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(m.Tooltip,Object.assign({body:y,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(a=j.metafield)||void 0===a?void 0:a.length} metafields`}))}))]})]}),`info-${i}`)}))}))]})),de.length>0&&e.jsxs("div",Object.assign({className:"info-content-source"},{children:[e.jsx(O.BodyCaption,{children:"Content Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:de.map(((t,i)=>{var o,n,l,a,r,c,u,p,g,C,j,y,v,f,S,T,L;const b=pe(t.type||t.subTitle||"OpenAI"),E=pe(t.type||t.subTitle||"OpenAI",!0),w=he(b),D=null==M?void 0:M.includes(E),N="Products"===t.subTitle?A[null!==(o=t.productId)&&void 0!==o?o:"Products"]:A[null!==(n=t.docId)&&void 0!==n?n:""],R=E.toLowerCase()===(null===(l=I.CustomDataType.FAQ)||void 0===l?void 0:l.toLowerCase())?"faq"===(null===(a=t.title)||void 0===a?void 0:a.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(r=I.CustomDataType.FILES)||void 0===r?void 0:r.toLowerCase())||E.toLowerCase()===(null===(c=I.CustomDataType.FETCHED_LINKS)||void 0===c?void 0:c.toLowerCase())||E.toLowerCase()===(null===(u=I.CustomDataType.TEXTS)||void 0===u?void 0:u.toLowerCase())?t.title:E.toLowerCase()===(null===(p=I.CustomDataType.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):t.intent===k.EMAIL_COLLECTION?w:t.title,_="faq"===E.toLowerCase()?null!==(j=null!==(g=null==N?void 0:N.content)&&void 0!==g?g:null===(C=null==N?void 0:N.data)||void 0===C?void 0:C.answer)&&void 0!==j?j:"":E.toLowerCase()===(null===(y=I.CustomDataType.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||E.toLowerCase()===(null===(v=I.CustomDataType.WEBSITE_LINKS)||void 0===v?void 0:v.toLowerCase())||E.toLowerCase()===(null===(f=I.CustomDataType.TEXTS)||void 0===f?void 0:f.toLowerCase())?null!==(L=null!==(S=null==N?void 0:N.content)&&void 0!==S?S:null===(T=null==N?void 0:N.data)||void 0===T?void 0:T.fileContentText)&&void 0!==L?L:"":t.intent===k.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:i+1<(null==de?void 0:de.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[ge(b),e.jsx(m.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?K(t):{}},{children:R}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==k.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:w}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:D?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==N?void 0:N.onEditClick(N.data,N.type),disabled:!N,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!N,disabledTooltip:"This source is deleted",onClick:()=>K(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:xe(null!=_?_:"").trim()}))}))]}),`info-${i}`)}))}))]}))]})),Z&&!ue(Y)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(v.default,{appType:D,storeId:N,messageSource:R,sourceIntent:null!==(w=R.intent)&&void 0!==w?w:k.GENERIC,faqCount:te,trainingSourceCount:ne,ShowTrainingDataSource:ce,ChecklistType:k,footerButtonOption:W,isFooterLoading:V})}))]})}),se&&e.jsx(j.SideModal,Object.assign({header:"Product description",onClose:()=>oe(void 0),width:"30%"},{children:e.jsx(T.DescriptionModal,{title:se.title,description:se.description,imageUrl:se.imageUrl,onClose:se.onClose})}))]})};
@@ -1,4 +1,3 @@
1
1
  export declare const SourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const WithoutContentSourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const SourceInfoFooterStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export declare const DataSourceCountStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -15,9 +15,9 @@
15
15
  display: flex;
16
16
  flex-direction: column;
17
17
  gap: 8px;
18
- background-color: ${o.COLORS.surface.hovered};
19
18
  .source {
20
19
  border-radius: 12px;
20
+ background-color: ${o.COLORS.surface.subdued};
21
21
  }
22
22
  }
23
23
  .info-product-source {
@@ -25,7 +25,6 @@
25
25
  display: flex;
26
26
  flex-direction: column;
27
27
  gap: 8px;
28
- background-color: ${o.COLORS.surface.hovered};
29
28
 
30
29
  .product-data-text1 {
31
30
  padding: 2px;
@@ -42,6 +41,7 @@
42
41
  }
43
42
  .source {
44
43
  border-radius: 12px;
44
+ background-color: ${o.COLORS.surface.subdued};
45
45
  }
46
46
  }
47
47
  .pop-up-header {
@@ -157,13 +157,4 @@
157
157
  display: flex;
158
158
  gap: 8px;
159
159
  }
160
- `;i.default.div`
161
- display: flex;
162
- align-items: center;
163
- justify-content: center;
164
- width: 24px;
165
- height: 24px;
166
- background-color: ${o.COLORS.surface.subdued};
167
- border-radius: 22px;
168
- border: 1px solid ${o.COLORS.stroke.primary};
169
- `,exports.SourceInfoDetailsStyle=l,exports.SourceInfoFooterStyle=p;
160
+ `;exports.SourceInfoDetailsStyle=l,exports.SourceInfoFooterStyle=p;
@@ -1,3 +1,4 @@
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
1
2
  import { VariableListInterfaceV2 } from "../add-variableV2/AddVariableV2";
2
3
  import { CarouselProduct } from "./modalElements/EditWhatsAppCarouselTemplateV2";
3
4
  import { WhatsAppCarouselTemplateVariables } from "../template-preview/models/WhatsappCarouselTemplate";
@@ -45,6 +46,7 @@ export interface TemplateContextMapperProps {
45
46
  fetchCollections: any;
46
47
  fetchProducts: any;
47
48
  storeId: string;
49
+ appType?: ApplicationType;
48
50
  };
49
51
  selectedCarouselProducts?: CarouselProduct[];
50
52
  disableEditExpiry?: boolean;
@@ -1,3 +1,4 @@
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
1
2
  import { VariableV3 } from "../../../helpers";
2
3
  import React, { LegacyRef } from 'react';
3
4
  import Slider from 'react-slick';
@@ -55,6 +56,7 @@ export declare const TemplateModalContext: React.Context<{
55
56
  fetchCollections: any;
56
57
  fetchProducts: any;
57
58
  storeId: string;
59
+ appType?: ApplicationType | undefined;
58
60
  } | undefined;
59
61
  carouselProducts?: CarouselProduct[] | undefined;
60
62
  setCarouselProducts?: React.Dispatch<React.SetStateAction<CarouselProduct[]>> | undefined;
@@ -127,6 +129,7 @@ export declare const useTemplateModalContext: () => {
127
129
  fetchCollections: any;
128
130
  fetchProducts: any;
129
131
  storeId: string;
132
+ appType?: ApplicationType | undefined;
130
133
  } | undefined;
131
134
  carouselProducts?: CarouselProduct[] | undefined;
132
135
  setCarouselProducts?: React.Dispatch<React.SetStateAction<CarouselProduct[]>> | undefined;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("../../../assets/icons/arrow_back.svg.js"),t=require("../../../assets/icons/chevronLeft.svg.js"),n=require("../../../assets/icons/chevronRight.svg.js"),i=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),s=require("../../icon-button/IconButton.js"),d=require("../../product-picker-v2/modal.js"),c=require("../Badge/index.js"),u=require("../context/templateModalContext.js"),p=require("./EditWhatsAppTemplateV2.js"),v=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var h=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var m=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var g=require("../../template-preview/helpers/templateMiscHelper.js"),j=require("../../TypographyStyle.js");exports.default=x=>{let{template:y,whatsappSpecificPickerMeta:f,showVariableModal:b,variableListForImage:C,discountCode:O,setDiscountCode:S}=x;var I,q,w,P,k,T,B,L;const{selectedCarouselIndex:R,setTemplate:E,pickerConf:M,isProductCarouselType:D,pod:A,cardCount:F,carouselProducts:V,setCarouselProducts:W,isError:N,cardImages:$,disableEditVariable:_,onDeleteSelectedProducts:z,setSelectedCarouselIndex:G,setVariableCallback:H,setShowVariablePicker:J,sliderRef:K}=u.useTemplateModalContext(),[Q,U]=r.useState(g.isRCSChannel(null==y?void 0:y.channel)?"Carousel Cards":-1==R?"First Message (Step 1/2)":D?"Product Carousel "+((null===(q=null===(I=null==y?void 0:y.mapping)||void 0===I?void 0:I.body)||void 0===q?void 0:q.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(P=null===(w=null==y?void 0:y.mapping)||void 0===w?void 0:w.body)||void 0===P?void 0:P.length)?"(Step 2/2)":"")),[X,Y]=r.useState(!1),[Z,ee]=r.useState(!1),le=R===(null!=F?F:-1)-1,te=(null!=R?R:-1)<1;r.useEffect((()=>{var e,l,t,n;U(g.isRCSChannel(null==y?void 0:y.channel)?"Carousel Cards":-1==R?"First Message (Step 1/2)":D?"Product Carousel "+((null===(l=null===(e=null==y?void 0:y.mapping)||void 0===e?void 0:e.body)||void 0===l?void 0:l.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(t=null==y?void 0:y.mapping)||void 0===t?void 0:t.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[R]);const ne=e=>{null==W||W([{name:"variable",productName:e.actualValue}])};return r.useEffect((()=>{-1===R&&g.isRCSChannel(null==y?void 0:y.channel)&&(null==G||G(0))}),[R,null==y?void 0:y.channel]),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!g.isRCSChannel(null==y?void 0:y.channel)&&null!=R&&R>=0&&!!(null===(T=null===(k=null==y?void 0:y.mapping)||void 0===k?void 0:k.body)||void 0===T?void 0:T.length)&&e.jsx(s.IconButton,{Icon:l.default,onClick:()=>{null==G||G(-1)}}),e.jsx(j.TitleMedium,Object.assign({style:{marginLeft:10}},{children:Q}))]})),D&&(null!==(B=null==V?void 0:V.length)&&void 0!==B?B:0)>0&&null!=R&&R>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(v.ProductBox,{editItem:()=>{1===(null==V?void 0:V.length)&&"variable"===V[0].name?(H((()=>ne)),J(!0)):Y(!X)},cardBody:1===(null==V?void 0:V.length)&&"variable"===V[0].name?`${V[0].productName}`:`${null==V?void 0:V.length} Products Selected`,hideIcon:1===(null==V?void 0:V.length)&&"variable"===V[0].name,deleteItem:()=>{var e;if(1===(null==V?void 0:V.length)&&"variable"===V[0].name)return void(null==W||W([]));const l=o.cloneDeep(Object.assign({},y));l&&($&&$.length>0?null==$||$.forEach(((e,t)=>{var n;l.components[1].cards[t].components[0].example.header_handle=[null!==(n=$[t])&&void 0!==n?n:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==l?void 0:l.components[1].cards)||void 0===e||e.forEach(((e,t)=>{l.components[1].cards[t].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==E||E(l)),null==W||W([]),null==z||z()}}),V&&(null==V?void 0:V.length)>0&&"variable"!=V[0].name&&e.jsx(a.Button,{disabled:(null!==(L=null==V?void 0:V.length)&&void 0!==L?L:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{ee(!0),Y(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!_&&D&&0===(null==V?void 0:V.length)&&null!=R&&R>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(j.TitleRegular,{children:"Product(s)"}),e.jsx(j.BodySecondary,{children:`Select ${null!=F?F:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:N?16:12,marginRight:N?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:N?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:N?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(i.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{Y(!0)}}),A===m.POD.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsx(j.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:N?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:N?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{H((()=>ne)),J(!0)}})]})]})),N&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(c.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!D&&(null!=R?R:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:h.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(s.IconButton,{Icon:t.default,disabled:te,width:8,height:14,svgStyle:te?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==K?void 0:K.current)||void 0===e||e.slickPrev(),(null!=R?R:-1)<1||null==G||G((e=>e-1))}}),e.jsx(j.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:h.COLORS.content.secondary},{children:`Card ${(null!=R?R:0)+1}/${F}`})),e.jsx(s.IconButton,{Icon:n.default,width:8,height:14,disabled:le,svgStyle:le?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==K?void 0:K.current)||void 0===e||e.slickNext(),(null!=R?R:-1)>=(null!=F?F:-1)-1||null==G||G((e=>e+1))}})]})),e.jsx(p.default,{whatsappSpecificPickerMeta:f,template:y,onTemplateChange:e=>{null==E||E(e)},showVariableModal:b,variableListForImage:C,discountCode:O,setDiscountCode:S}),X&&M&&e.jsx(d.ProductPickerModal,{zIndex:200,startupScreen:Z?d.ScreenName.RearrangeProducts:d.ScreenName.Collections,rearrangeEnabled:!0,storeId:M.storeId,selectedItems:(e=>{if(e.length>0){const l={};for(const t of e){const e=null==t?void 0:t.collectionId,n=t.productId,i=t.variantId;e in l||(l[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in l[e].products||(l[e].products[n]={variants:{},name:(null==t?void 0:t.productName)||"",image:(null==t?void 0:t.productImage)||""}),l[e].products[n].variants[i]={name:(null==t?void 0:t.name)||"",price:"",image:(null==t?void 0:t.image)||"",quantity:t.quantity||0,displayOrder:t.displayOrder}}return l}return{}})(null!=V?V:[]),collectionFetcher:M.fetchCollections,productFetcher:M.fetchProducts,onAdd:(e,l)=>{var t,n,i,r,a,s;ee(!1);const d=[];delete e.isCustom;for(const l of Object.keys(e)){const o=e[l].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const c=o[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:v,quantity:h,displayOrder:m}=c[u],g={name:p,image:null!==(n=null!=v?v:null===(t=o[e])||void 0===t?void 0:t.image)&&void 0!==n?n:"",quantity:h,variantId:u,productId:e,displayOrder:m,collectionId:l,productName:null!==(r=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==r?r:"",productImage:null!==(s=null===(a=o[e])||void 0===a?void 0:a.image)&&void 0!==s?s:""};d.push(g)}}}const c=d.sort(((e,l)=>e.displayOrder-l.displayOrder)),u=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},y));p&&(u.forEach(((e,l)=>{var t;p.components[1].cards[l].components[0].example.header_handle=e?[e]:[null!==(t=null==$?void 0:$[l])&&void 0!==t?t:""]})),null==E||E(p)),null==W||W(c),Y(!1)},searchInCollectionFetcher:M.searchInCollection,searchFetcher:M.searchProducts,visible:X,onClose:()=>{Y(!1)},exactLimit:null!=F?F:1})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../../assets/icons/arrow_back.svg.js"),l=require("../../../assets/icons/chevronLeft.svg.js"),n=require("../../../assets/icons/chevronRight.svg.js"),i=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),s=require("../../icon-button/IconButton.js"),d=require("../../product-picker-v2/modal.js"),c=require("../Badge/index.js"),u=require("../context/templateModalContext.js"),p=require("./EditWhatsAppTemplateV2.js"),v=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var h=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var m=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var g=require("../../template-preview/helpers/templateMiscHelper.js"),y=require("../../TypographyStyle.js"),j=require("../../../_virtual/bik-store.js");exports.default=x=>{let{template:f,whatsappSpecificPickerMeta:b,showVariableModal:C,variableListForImage:O,discountCode:I,setDiscountCode:S}=x;var k,q,w,P,T,B,L,R;const{selectedCarouselIndex:E,setTemplate:M,pickerConf:A,isProductCarouselType:D,pod:F,cardCount:_,carouselProducts:V,setCarouselProducts:W,isError:N,cardImages:$,disableEditVariable:z,onDeleteSelectedProducts:G,setSelectedCarouselIndex:H,setVariableCallback:K,setShowVariablePicker:J,sliderRef:Q}=u.useTemplateModalContext(),[U,X]=r.useState(g.isRCSChannel(null==f?void 0:f.channel)?"Carousel Cards":-1==E?"First Message (Step 1/2)":D?"Product Carousel "+((null===(q=null===(k=null==f?void 0:f.mapping)||void 0===k?void 0:k.body)||void 0===q?void 0:q.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(P=null===(w=null==f?void 0:f.mapping)||void 0===w?void 0:w.body)||void 0===P?void 0:P.length)?"(Step 2/2)":"")),[Y,Z]=r.useState(!1),[ee,te]=r.useState(!1),le=E===(null!=_?_:-1)-1,ne=(null!=E?E:-1)<1;r.useEffect((()=>{var e,t,l,n;X(g.isRCSChannel(null==f?void 0:f.channel)?"Carousel Cards":-1==E?"First Message (Step 1/2)":D?"Product Carousel "+((null===(t=null===(e=null==f?void 0:f.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(l=null==f?void 0:f.mapping)||void 0===l?void 0:l.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[E]);const ie=e=>{null==W||W([{name:"variable",productName:e.actualValue}])};return r.useEffect((()=>{-1===E&&g.isRCSChannel(null==f?void 0:f.channel)&&(null==H||H(0))}),[E,null==f?void 0:f.channel]),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!g.isRCSChannel(null==f?void 0:f.channel)&&null!=E&&E>=0&&!!(null===(B=null===(T=null==f?void 0:f.mapping)||void 0===T?void 0:T.body)||void 0===B?void 0:B.length)&&e.jsx(s.IconButton,{Icon:t.default,onClick:()=>{null==H||H(-1)}}),e.jsx(y.TitleMedium,Object.assign({style:{marginLeft:10}},{children:U}))]})),D&&(null!==(L=null==V?void 0:V.length)&&void 0!==L?L:0)>0&&null!=E&&E>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(v.ProductBox,{editItem:()=>{1===(null==V?void 0:V.length)&&"variable"===V[0].name?(K((()=>ie)),J(!0)):Z(!Y)},cardBody:1===(null==V?void 0:V.length)&&"variable"===V[0].name?`${V[0].productName}`:`${null==V?void 0:V.length} Products Selected`,hideIcon:1===(null==V?void 0:V.length)&&"variable"===V[0].name,deleteItem:()=>{var e;if(1===(null==V?void 0:V.length)&&"variable"===V[0].name)return void(null==W||W([]));const t=o.cloneDeep(Object.assign({},f));t&&($&&$.length>0?null==$||$.forEach(((e,l)=>{var n;t.components[1].cards[l].components[0].example.header_handle=[null!==(n=$[l])&&void 0!==n?n:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==M||M(t)),null==W||W([]),null==G||G()}}),V&&(null==V?void 0:V.length)>0&&"variable"!=V[0].name&&e.jsx(a.Button,{disabled:(null!==(R=null==V?void 0:V.length)&&void 0!==R?R:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{te(!0),Z(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!z&&D&&0===(null==V?void 0:V.length)&&null!=E&&E>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(y.TitleRegular,{children:"Product(s)"}),e.jsx(y.BodySecondary,{children:`Select ${null!=_?_:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:N?16:12,marginRight:N?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:N?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:N?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(i.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{Z(!0)}}),F===m.POD.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsx(y.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:N?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:N?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{K((()=>ie)),J(!0)}})]})]})),N&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(c.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!D&&(null!=E?E:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:h.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(s.IconButton,{Icon:l.default,disabled:ne,width:8,height:14,svgStyle:ne?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==Q?void 0:Q.current)||void 0===e||e.slickPrev(),(null!=E?E:-1)<1||null==H||H((e=>e-1))}}),e.jsx(y.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:h.COLORS.content.secondary},{children:`Card ${(null!=E?E:0)+1}/${_}`})),e.jsx(s.IconButton,{Icon:n.default,width:8,height:14,disabled:le,svgStyle:le?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==Q?void 0:Q.current)||void 0===e||e.slickNext(),(null!=E?E:-1)>=(null!=_?_:-1)-1||null==H||H((e=>e+1))}})]})),e.jsx(p.default,{whatsappSpecificPickerMeta:b,template:f,onTemplateChange:e=>{null==M||M(e)},showVariableModal:C,variableListForImage:O,discountCode:I,setDiscountCode:S}),Y&&A&&e.jsx(d.ProductPickerModal,{zIndex:200,startupScreen:ee?d.ScreenName.RearrangeProducts:d.ScreenName.Collections,rearrangeEnabled:!0,storeId:A.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,n=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in t[e].products||(t[e].products[n]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[n].variants[i]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=V?V:[]),collectionFetcher:A.fetchCollections,productFetcher:A.fetchProducts,onAdd:(e,t)=>{var l,n,i,r,a,s;te(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const o=e[t].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const c=o[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:v,quantity:h,displayOrder:m}=c[u],g={name:p,image:null!==(n=null!=v?v:null===(l=o[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:h,variantId:u,productId:e,displayOrder:m,collectionId:t,productName:null!==(r=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==r?r:"",productImage:null!==(s=null===(a=o[e])||void 0===a?void 0:a.image)&&void 0!==s?s:""};d.push(g)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},f));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==$?void 0:$[t])&&void 0!==l?l:""]})),null==M||M(p)),null==W||W(c),Z(!1)},searchInCollectionFetcher:A.searchInCollection,searchFetcher:A.searchProducts,visible:Y,onClose:()=>{Z(!1)},exactLimit:null!=_?_:1,appType:A.appType||j.__exports.ApplicationType.BIK})]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../template-context-mapper/context/templateModalContext.js"),l=require("../../utils/StringUtils.js"),i=require("../../constants/Theme.js"),a=require("../TypographyStyle.js"),n=require("./EmailTemplateThumbnailPreview.js"),s=require("./models/Channels.js"),r=require("./SmsTemplatePreview.js"),o=require("./webpush/WebpushPreview.js"),d=require("./WhatsAppTemplatePreview.js");const u={WhatsAppWrapper:{backgroundColor:i.COLORS.surface.standard,borderRadius:4,border:`1px solid ${i.COLORS.background.inactive}`,marginTop:16}};exports.TemplatePreview=p=>{let{template:c,channel:m,whatsAppSpecificMeta:v,templateCreationsInfo:h,hideHeader:C,size:j,onlyTemplateContent:S,emailSpecificMeta:b,smsSpecificMeta:g,showSampleValues:x,carouselCardIndex:y,isWhatsappCarousel:T,isPreview:P,applyBorderBottom:w,webPushSpecificMeta:O,hidePointerEvents:E}=p;var H,f;const{setSelectedCarouselIndex:A}=t.useTemplateModalContext();return m===s.CHANNEL_TYPE.SMS?e.jsx("div",Object.assign({style:Object.assign({marginTop:h?16:0,border:h?`1px solid ${i.COLORS.stroke.primary}`:"none",borderRadius:4},null==g?void 0:g.templateContainerStyles)},{children:e.jsx(r.default,{template:c,hideHeader:C,onlyTemplateContent:S,size:null!=j?j:"large",variableStore:null==g?void 0:g.smsVariableStore,display_content:null==g?void 0:g.smsDisplayContent,uniqueId:null==g?void 0:g.uniqueId})})):m===s.CHANNEL_TYPE.EMAIL?e.jsx("div",Object.assign({style:Object.assign({marginTop:h?16:0},null==b?void 0:b.templateContainerStyles)},{children:e.jsx(n.default,{template:c,handleViewTemplate:()=>{var e;null===(e=null==b?void 0:b.handleViewTemplate)||void 0===e||e.call(b)},hideHeader:C,hideViewButton:null==b?void 0:b.hideViewButtonForEmail,containerStyle:null==b?void 0:b.containerStyle,emailDisplayContent:null==b?void 0:b.emailDisplayContent,emailHtmlContainerId:null==b?void 0:b.emailHtmlContainerId,applyBorderBottom:w,hidePointerEvents:E})})):m===s.CHANNEL_TYPE.WHATSAPP||m===s.CHANNEL_TYPE.RCS?e.jsxs("div",Object.assign({style:Object.assign(Object.assign({},null==v?void 0:v.templateContainerStyles),h?u.WhatsAppWrapper:{}),onClick:()=>{var e,t;if(A&&T){if(-1===y&&!(null===(t=null===(e=null==c?void 0:c.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length))return;A(null!=y?y:-1)}}},{children:[h?e.jsx("div",Object.assign({style:{padding:16}},{children:e.jsx(a.TitleRegular,{children:l.default.convertToTitleCase(null!==(H=null==c?void 0:c.label)&&void 0!==H?H:"")})})):e.jsx(e.Fragment,{}),e.jsx(d.default,{showSampleValues:x,showHeader:null==v?void 0:v.showWhatsAppHeader,extras:null==v?void 0:v.whatsAppExtras,template:c,size:h?"small":null!=j?j:"large",containerStyle:Object.assign(Object.assign({borderWidth:h?0:1,borderTopWidth:1},null!==(f=null==v?void 0:v.containerStyle)&&void 0!==f?f:{}),{height:"100%"}),zeroStateComponent:null==v?void 0:v.zeroStateComponent,usePlaceHolderName:null==v?void 0:v.usePlaceHolderName,carouselCardIndex:y,isWhatsappCarousel:T,isPreview:P,channel:m})]})):m==s.CHANNEL_TYPE.WEBPUSH?e.jsx("div",Object.assign({style:Object.assign({},null==O?void 0:O.containerStyle)},{children:e.jsx(o.default,{template:c,extraContainerCss:null==O?void 0:O.extraContainerCss})})):e.jsx(e.Fragment,{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../template-context-mapper/context/templateModalContext.js"),l=require("../../utils/StringUtils.js"),i=require("../../constants/Theme.js"),a=require("../../assets/icons/aiContentIcon.svg.js"),n=require("../TypographyStyle.js"),s=require("./EmailTemplateThumbnailPreview.js"),r=require("./models/Channels.js"),o=require("./SmsTemplatePreview.js"),d=require("./webpush/WebpushPreview.js"),u=require("./WhatsAppTemplatePreview.js");const p={WhatsAppWrapper:{backgroundColor:i.COLORS.surface.standard,borderRadius:4,border:`1px solid ${i.COLORS.background.inactive}`,marginTop:16}};exports.TemplatePreview=c=>{let{template:m,channel:v,whatsAppSpecificMeta:h,templateCreationsInfo:j,hideHeader:C,size:g,onlyTemplateContent:b,emailSpecificMeta:x,smsSpecificMeta:y,showSampleValues:S,carouselCardIndex:T,isWhatsappCarousel:w,isPreview:O,applyBorderBottom:P,webPushSpecificMeta:f,hidePointerEvents:E}=c;var H,A;const{setSelectedCarouselIndex:q}=t.useTemplateModalContext();return v===r.CHANNEL_TYPE.SMS?e.jsx("div",Object.assign({style:Object.assign({marginTop:j?16:0,border:j?`1px solid ${i.COLORS.stroke.primary}`:"none",borderRadius:4},null==y?void 0:y.templateContainerStyles)},{children:e.jsx(o.default,{template:m,hideHeader:C,onlyTemplateContent:b,size:null!=g?g:"large",variableStore:null==y?void 0:y.smsVariableStore,display_content:null==y?void 0:y.smsDisplayContent,uniqueId:null==y?void 0:y.uniqueId})})):v===r.CHANNEL_TYPE.EMAIL?e.jsx("div",Object.assign({style:Object.assign({marginTop:j?16:0},null==x?void 0:x.templateContainerStyles)},{children:e.jsx(s.default,{template:m,handleViewTemplate:()=>{var e;null===(e=null==x?void 0:x.handleViewTemplate)||void 0===e||e.call(x)},hideHeader:C,hideViewButton:null==x?void 0:x.hideViewButtonForEmail,containerStyle:null==x?void 0:x.containerStyle,emailDisplayContent:null==x?void 0:x.emailDisplayContent,emailHtmlContainerId:null==x?void 0:x.emailHtmlContainerId,applyBorderBottom:P,hidePointerEvents:E})})):v===r.CHANNEL_TYPE.WHATSAPP||v===r.CHANNEL_TYPE.RCS?e.jsxs("div",Object.assign({style:Object.assign(Object.assign(Object.assign({},null==h?void 0:h.templateContainerStyles),j?p.WhatsAppWrapper:{}),{position:"relative"}),onClick:()=>{var e,t;if(q&&w){if(-1===T&&!(null===(t=null===(e=null==m?void 0:m.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length))return;q(null!=T?T:-1)}}},{children:[j?e.jsx("div",Object.assign({style:{padding:16}},{children:e.jsx(n.TitleRegular,{children:l.default.convertToTitleCase(null!==(H=null==m?void 0:m.label)&&void 0!==H?H:"")})})):e.jsx(e.Fragment,{}),e.jsx(u.default,{showSampleValues:S,showHeader:null==h?void 0:h.showWhatsAppHeader,extras:null==h?void 0:h.whatsAppExtras,template:m,size:j?"small":null!=g?g:"large",containerStyle:Object.assign(Object.assign({borderWidth:j?0:1,borderTopWidth:1},null!==(A=null==h?void 0:h.containerStyle)&&void 0!==A?A:{}),{height:"100%"}),zeroStateComponent:null==h?void 0:h.zeroStateComponent,usePlaceHolderName:null==h?void 0:h.usePlaceHolderName,carouselCardIndex:T,isWhatsappCarousel:w,isPreview:O,channel:v}),!!(null==m?void 0:m.aiContentConfigId)&&e.jsx("div",Object.assign({style:{position:"absolute",top:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:48,height:48}},{children:e.jsx(a.default,{width:48,height:48})}))]})):v==r.CHANNEL_TYPE.WEBPUSH?e.jsx("div",Object.assign({style:Object.assign({},null==f?void 0:f.containerStyle)},{children:e.jsx(d.default,{template:m,extraContainerCss:null==f?void 0:f.extraContainerCss})})):e.jsx(e.Fragment,{})};
@@ -54,6 +54,7 @@ export type WhatsAppTemplate = {
54
54
  isDraft?: boolean;
55
55
  newQualityScore?: TEMPLATE_QUALITY;
56
56
  previousQualityScore?: TEMPLATE_QUALITY;
57
+ aiContentConfigId?: string;
57
58
  };
58
59
  export type WhatsappTemplateButtonTypes = 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE';
59
60
  export type CreateTemplateType = {
@@ -0,0 +1 @@
1
+ import*as e from"react";var a,t,l;function r(){return r=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},r.apply(this,arguments)}var n=n=>e.createElement("svg",r({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48"},n),a||(a=e.createElement("g",{filter:"url(#aiContentIcon_svg__a)"},e.createElement("circle",{cx:24,cy:22,r:16,fill:"url(#aiContentIcon_svg__b)"}))),t||(t=e.createElement("path",{fill:"#fff",d:"M27.99 13.338a.2.2 0 0 1 .354 0l.894 1.676a.2.2 0 0 0 .082.082l1.676.894a.2.2 0 0 1 0 .353l-1.676.894a.2.2 0 0 0-.082.082l-.894 1.676a.2.2 0 0 1-.353 0l-.894-1.676a.2.2 0 0 0-.082-.082l-1.677-.894a.2.2 0 0 1 0-.353l1.677-.894a.2.2 0 0 0 .082-.082l.894-1.676Zm-5.13 6.386a.2.2 0 0 0 .083.082l3.782 2.017a.2.2 0 0 1 0 .353l-3.782 2.018a.2.2 0 0 0-.082.082l-2.017 3.782a.2.2 0 0 1-.353 0l-2.017-3.782a.2.2 0 0 0-.083-.082l-3.782-2.018a.2.2 0 0 1 0-.353l3.782-2.017a.2.2 0 0 0 .083-.082l2.017-3.782a.2.2 0 0 1 .353 0l2.017 3.782Zm.323 2.452a.2.2 0 0 0 0-.353l-1.472-.785a.2.2 0 0 1-.082-.082l-.785-1.472a.2.2 0 0 0-.353 0l-.785 1.472a.2.2 0 0 1-.083.082l-1.472.785a.2.2 0 0 0 0 .353l1.472.786a.2.2 0 0 1 .082.082l.786 1.472a.2.2 0 0 0 .353 0l.785-1.472a.2.2 0 0 1 .082-.082l1.473-.786Zm7.26 3.464a.2.2 0 0 1-.082-.083l-1.184-2.22a.2.2 0 0 0-.353 0l-1.184 2.22a.2.2 0 0 1-.082.083l-2.22 1.183a.2.2 0 0 0 0 .353l2.22 1.184a.2.2 0 0 1 .082.082l1.184 2.22a.2.2 0 0 0 .353 0l1.184-2.22a.2.2 0 0 1 .082-.082l2.22-1.184a.2.2 0 0 0 0-.353l-2.22-1.183Z"})),l||(l=e.createElement("defs",null,e.createElement("linearGradient",{id:"aiContentIcon_svg__b",x1:8,x2:41.305,y1:8.667,y2:10.232,gradientUnits:"userSpaceOnUse"},e.createElement("stop",{stopColor:"#FF166A"}),e.createElement("stop",{offset:1,stopColor:"#FB5F08"})),e.createElement("filter",{id:"aiContentIcon_svg__a",width:48,height:48,x:0,y:0,colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse"},e.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),e.createElement("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.createElement("feOffset",{dy:2}),e.createElement("feGaussianBlur",{stdDeviation:4}),e.createElement("feComposite",{in2:"hardAlpha",operator:"out"}),e.createElement("feColorMatrix",{values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0"}),e.createElement("feBlend",{in2:"BackgroundImageFix",result:"effect1_dropShadow_4220_23732"}),e.createElement("feBlend",{in:"SourceGraphic",in2:"effect1_dropShadow_4220_23732",result:"shape"})))));export{n as default};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -17,8 +17,6 @@ interface SourceInfoFooterProps {
17
17
  ChecklistType: Record<string, string>;
18
18
  footerButtonOption?: footerButtonOptionModel;
19
19
  isFooterLoading?: boolean;
20
- reasonForAiGeneratedResponse?: string;
21
- showAiResponseReason?: boolean;
22
20
  }
23
21
  declare const SourceInfoFooter: import("react").MemoExoticComponent<(props: SourceInfoFooterProps) => import("react/jsx-runtime").JSX.Element>;
24
22
  export default SourceInfoFooter;
@@ -1 +1 @@
1
- import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import i from"../../assets/icons/alert_triangle.svg.js";import n from"../../assets/icons/plus.svg.js";import{memo as r,useState as a,useMemo as s,useEffect as d}from"react";import{COLORS as l}from"../../constants/Theme.js";import{Button as c}from"../button/Button.js";import{BikShimmer as u}from"../shimmer/ShimmerComponent/BikShimmer.js";import{BodyCaption as p}from"../TypographyStyle.js";import{SourceInfoFooterStyle as h}from"./DataSourcePanel.style.js";import{__exports as m}from"../../_virtual/bik-store.js";const v=r((r=>{const{appType:v,sourceIntent:b,hideHeading:A,messageSource:y,trainingSourceCount:f={},ShowTrainingDataSource:_={},faqCount:I,ChecklistType:R,footerButtonOption:O,isFooterLoading:w,reasonForAiGeneratedResponse:N,showAiResponseReason:k}=r,C=_,[F,j]=a(!0),[D,E]=a(!0),S="/bik-ai/training",[x,P]=a({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[U,M]=a({title:"",subTitle:""}),q=s((()=>{const e=(null==f?void 0:f[b])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[f,b]),L=()=>{var e;(null==x?void 0:x.redirectUrl)?window.open(`${window.location.origin}${null==x?void 0:x.redirectUrl}`,"_self"):Object.keys(null!==(e=null==x?void 0:x.addFaqProps)&&void 0!==e?e:{}).length>0?null==O||O.onClick(x):(null==O?void 0:O.navigate)&&(null==O||O.navigate("Training",v==m.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return d((()=>{var e,o,t,i;if(b){if(null===(e=null==y?void 0:y.sources)||void 0===e?void 0:e.length){const e=y.sources[0];if(C[b])b===R.ORDER_ENQUIRY&&E(!1);else{let n=null==e?void 0:e.insights,r="";switch(b){case R.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(n=`${I||"No"} FAQs added for this product`,r="Add product-specific information via FAQs to improve responses",P({buttonTitle:"Add FAQ",addFaqProps:{faqProducts:[{id:null==e?void 0:e.productId,variantId:null==e?void 0:e.variantId,name:null==e?void 0:e.title,imageUrl:null==e?void 0:e.imageUrl}]},redirectUrl:""}));break;case R.ORDER_MODIFICATION:n=(null==f?void 0:f[b])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",n&&P({buttonTitle:v==m.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:v==m.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":S,addFaqProps:{}});break;case R.ORDER_CANCELLATION:n=(null==f?void 0:f[b])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",P({buttonTitle:v==m.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:v==m.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":S,addFaqProps:{}});break;case R.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;P({buttonTitle:v==m.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:v==m.ApplicationType.MANIFEST?"/training/order-management":S,addFaqProps:{}});break;case R.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(i=null===(t=null===(o=null==y?void 0:y.sources)||void 0===o?void 0:o[0])||void 0===t?void 0:t.title)||void 0===i?void 0:i.toLowerCase().indexOf("collection"))){n="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}n="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}M({title:null!=n?n:"",subTitle:r})}}(C[b]||[R.PRODUCT_DETAILS,R.ORDER_MODIFICATION,R.ORDER_CANCELLATION,R.ORDER_TRACKING].includes(b))&&j(!1)}}),[null==y?void 0:y.messageId,f,b,null==y?void 0:y.sources,C,R,I,v,y]),e(h,{children:e(o,w?{children:e(u,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}:{children:!(null==U?void 0:U.title)&&f&&b in f?t(o,{children:[e(g,{hideHeading:null!=A&&A}),e(T,{reason:N||"",showAiResponseReason:null!=k&&k}),t("div",Object.assign({className:"source_info_details "+(f[b]>0?"":"no_data_source")},{children:[f[b]>0&&D?t(o,{children:[e(p,{children:q}),e(p,Object.assign({color:l.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):D&&t("div",Object.assign({className:"no_data_source_title"},{children:[e(i,{width:15,height:15,color:l.content.negative,style:{marginTop:2}}),e(p,{children:"No data sources added to the identified link"})]})),!O||O.hideAddDataButton||F?e(o,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==x?void 0:x.buttonTitle.length)>0?null==x?void 0:x.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>L(),style:{backgroundColor:"unset"}})]}))]}):t(o,{children:[e(g,{hideHeading:null!=A&&A}),e(T,{reason:N||"",showAiResponseReason:null!=k&&k}),t("div",Object.assign({className:"source_info_details"},{children:[D&&t(o,{children:[e(p,{children:null==U?void 0:U.title}),e(p,Object.assign({color:l.content.secondary},{children:null==U?void 0:U.subTitle}))]}),!O||O.hideAddDataButton||F?e(o,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==x?void 0:x.buttonTitle.length)>0?null==x?void 0:x.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>L(),style:{backgroundColor:"unset"}})]}))]})})})})),g=r((o=>o.hideHeading?null:e(p,Object.assign({color:l.content.secondary},{children:"Training insights"})))),T=r((i=>{const[n,r]=a(!1),s=i.reason&&i.reason.length>50,d=s&&!n?i.reason.substring(0,50)+"...":i.reason;return i.showAiResponseReason?t("div",Object.assign({className:"source_info_details"},{children:[e(p,Object.assign({color:l.content.primary,className:"why_ai_gave_this_response"},{children:"Here’s why your AI gave this response"})),t(p,Object.assign({color:l.content.secondary,className:"clamp-text"},{children:[d||"No reason provided for this response.",s&&e(p,Object.assign({color:l.content.brand,style:{cursor:"pointer",textDecoration:"underline",marginTop:"4px"},onClick:()=>r(!n)},{children:n?"Show less":"Show more"}))]}))]})):e(o,{})}));T.displayName="WhyAiGaveThisResponse",g.displayName="TrainingInsightsHeading",v.displayName="SourceInfoFooter";export{v as default};
1
+ import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import o from"../../assets/icons/alert_triangle.svg.js";import n from"../../assets/icons/plus.svg.js";import{memo as r,useState as d,useMemo as l,useEffect as a}from"react";import{COLORS as s}from"../../constants/Theme.js";import{Button as c}from"../button/Button.js";import{BikShimmer as u}from"../shimmer/ShimmerComponent/BikShimmer.js";import{BodyCaption as p}from"../TypographyStyle.js";import{SourceInfoFooterStyle as v}from"./DataSourcePanel.style.js";import{__exports as h}from"../../_virtual/bik-store.js";const m=r((r=>{const{appType:m,sourceIntent:T,hideHeading:b,messageSource:A,trainingSourceCount:y={},ShowTrainingDataSource:f={},faqCount:I,ChecklistType:O,footerButtonOption:_,isFooterLoading:k}=r,C=f,[N,R]=d(!0),[w,E]=d(!0),F="/bik-ai/training",[D,S]=d({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[j,P]=d({title:"",subTitle:""}),U=l((()=>{const e=(null==y?void 0:y[T])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[y,T]),x=()=>{var e;(null==D?void 0:D.redirectUrl)?window.open(`${window.location.origin}${null==D?void 0:D.redirectUrl}`,"_self"):Object.keys(null!==(e=null==D?void 0:D.addFaqProps)&&void 0!==e?e:{}).length>0?null==_||_.onClick(D):(null==_?void 0:_.navigate)&&(null==_||_.navigate("Training",m==h.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return a((()=>{var e,t,i,o;if(T){if(null===(e=null==A?void 0:A.sources)||void 0===e?void 0:e.length){const e=A.sources[0];if(C[T])T===O.ORDER_ENQUIRY&&E(!1);else{let n=null==e?void 0:e.insights,r="";switch(T){case O.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(n=`${I||"No"} FAQs added for this product`,r="Add product-specific information via FAQs to improve responses",S({buttonTitle:"Add FAQ",addFaqProps:{faqProducts:[{id:null==e?void 0:e.productId,variantId:null==e?void 0:e.variantId,name:null==e?void 0:e.title,imageUrl:null==e?void 0:e.imageUrl}]},redirectUrl:""}));break;case O.ORDER_MODIFICATION:n=(null==y?void 0:y[T])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",n&&S({buttonTitle:m==h.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:m==h.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":F,addFaqProps:{}});break;case O.ORDER_CANCELLATION:n=(null==y?void 0:y[T])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",S({buttonTitle:m==h.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:m==h.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":F,addFaqProps:{}});break;case O.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;S({buttonTitle:m==h.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:m==h.ApplicationType.MANIFEST?"/training/order-management":F,addFaqProps:{}});break;case O.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(o=null===(i=null===(t=null==A?void 0:A.sources)||void 0===t?void 0:t[0])||void 0===i?void 0:i.title)||void 0===o?void 0:o.toLowerCase().indexOf("collection"))){n="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}n="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}P({title:null!=n?n:"",subTitle:r})}}(C[T]||[O.PRODUCT_DETAILS,O.ORDER_MODIFICATION,O.ORDER_CANCELLATION,O.ORDER_TRACKING].includes(T))&&R(!1)}}),[null==A?void 0:A.messageId,y,T,null==A?void 0:A.sources,C,O,I,m,A]),e(v,{children:e(t,k?{children:e(u,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}:{children:!(null==j?void 0:j.title)&&y&&T in y?i(t,{children:[e(g,{hideHeading:null!=b&&b}),i("div",Object.assign({className:"source_info_details "+(y[T]>0?"":"no_data_source")},{children:[y[T]>0&&w?i(t,{children:[e(p,{children:U}),e(p,Object.assign({color:s.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):w&&i("div",Object.assign({className:"no_data_source_title"},{children:[e(o,{width:15,height:15,color:s.content.negative,style:{marginTop:2}}),e(p,{children:"No data sources added to the identified link"})]})),!_||_.hideAddDataButton||N?e(t,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==D?void 0:D.buttonTitle.length)>0?null==D?void 0:D.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>x(),style:{backgroundColor:"unset"}})]}))]}):i(t,{children:[e(g,{hideHeading:null!=b&&b}),i("div",Object.assign({className:"source_info_details"},{children:[w&&i(t,{children:[e(p,{children:null==j?void 0:j.title}),e(p,Object.assign({color:s.content.secondary},{children:null==j?void 0:j.subTitle}))]}),!_||_.hideAddDataButton||N?e(t,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==D?void 0:D.buttonTitle.length)>0?null==D?void 0:D.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>x(),style:{backgroundColor:"unset"}})]}))]})})})})),g=r((t=>t.hideHeading?null:e(p,Object.assign({color:s.content.secondary},{children:"Training insights"}))));g.displayName="TrainingInsightsHeading",m.displayName="SourceInfoFooter";export{m as default};
@@ -1,13 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource, ProductSourceData } from './model';
4
- export interface CollapsibleSectionProps {
5
- title: string;
6
- count: number;
7
- isExpanded: boolean;
8
- onToggle: () => void;
9
- children: React.ReactNode;
10
- }
11
4
  export interface DataSourcePanelProps {
12
5
  storeId: string;
13
6
  appType: ApplicationType;
@@ -30,7 +23,5 @@ export interface DataSourcePanelProps {
30
23
  }>;
31
24
  fetchProductFAQCount: (storeId: string, productIds?: string[]) => Promise<number>;
32
25
  productSourceData?: ProductSourceData;
33
- reasonForAiGeneratedResponse?: string;
34
- showAiResponseReason?: boolean;
35
26
  }
36
27
  export declare const DataSourcePanel: React.FC<DataSourcePanelProps>;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import o from"../../assets/icons/boxV2.svg.js";import n from"../../assets/icons/chevronDownOutline.svg.js";import s from"../../assets/icons/chevronUpOutline.svg.js";import l from"../../assets/icons/cross.svg.js";import r from"../../assets/icons/edit.svg.js";import a from"../../assets/icons/filePdf.svg.js";import c from"../../assets/icons/help.svg.js";import d from"../../assets/icons/info.svg.js";import p from"../../assets/icons/openai.svg.js";import u from"../../assets/icons/plus.svg.js";import g from"../../assets/icons/redirect.svg.js";import h from"../../assets/icons/text_t9.svg.js";import m from"../../assets/icons/website.svg.js";import{useState as f,useMemo as v,useEffect as y}from"react";import{COLORS as x}from"../../constants/Theme.js";import{Button as C}from"../button/Button.js";import{IconButton as I}from"../icon-button/IconButton.js";import{BikShimmer as b}from"../shimmer/ShimmerComponent/BikShimmer.js";import{SideModal as T}from"../side-modal/SideModal.js";import{Tag as j}from"../tag/Tag.js";import{Tooltip as O}from"../tooltips/Tooltip.js";import{TitleSmall as E,BodyCaption as S,BodySecondary as L}from"../TypographyStyle.js";import w from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as N}from"./DataSourcePanel.style.js";import{intentConfig as A}from"./IntentConfig.js";import{DescriptionModal as _}from"./Modals/DescriptionModal.js";import{CustomDataType as D}from"./model.js";import{__exports as k}from"../../_virtual/bik-store.js";const F=F=>{var R,B;const{appType:P,storeId:U,messageSource:K,setMessageSourcePanel:M,hideCloseButton:W,isSourceInfoFetched:H,allSourceInfoDetail:$,ChecklistType:q,title:Q,zeroStateButton:G,editableSources:Y,preFillTrainingSourceCount:z,redirect:X,footerButtonOption:V,fetchTrainingSourceCount:J,fetchProductFAQCount:Z,productSourceData:ee,reasonForAiGeneratedResponse:te,showAiResponseReason:ie}=F,{sources:oe}=K,ne=["blog","article","page","policy"],[se,le]=f(!1),[re,ae]=f(!1),[ce,de]=f(!1),[pe,ue]=f(0),[ge,he]=f(),[me,fe]=f(null!=z?z:{}),[ve,ye]=f(!1),[xe,Ce]=f(!1),Ie={};A.forEach((t=>{let{key:i,type:o,tagText:n}=t;q[i]&&(Ie[q[i]]=e(j,{theme:"light",type:o,tagText:n,cursor:"pointer"}))}));const be=oe.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Te=oe.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),je=v((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{q[t]&&(e[q[t]]=q[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[q]);y((()=>{var e,t,i,o;if(!(null==K?void 0:K.messageId))return;le(!0),ae(!0),de(!1!==(null===(t=null===(e=K.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=K.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights));const n=K.sources.filter((e=>!!e.productId)).map((e=>e.productId)),s=Array.from(new Set(n)).filter((e=>!!e));Z(U,s).then((e=>ue(e))).then((()=>{z?(fe(z),setTimeout((()=>{le(!1),ae(!1)}),100)):(setTimeout((()=>le(!1)),100),J(U).then((e=>fe(e))).then((()=>setTimeout((()=>{ae(!1)}),100))))}))}),[Z,J,null==K?void 0:K.messageId,K.sources,z,U]);const Oe=e=>!!(e&&0===e.length||(null==K?void 0:K.isUnsatisfactoryAnswer)),Ee=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=D.FILES:ne.includes(e)?e=D.FETCHED_LINKS:"url"==e?e=D.WEBSITE_LINKS:"text"===e?e=D.TEXTS:"faq"===e&&(e=D.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},Se=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",Le=t=>e("products"==t||"product"==t?o:"files"==t?a:"website links"==t||"fetched links"==t?m:"faq"==t?c:"texts"==t?h:p,{height:16,width:16,color:x.content.secondary}),we=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};if(se||!H)return e(N,{children:e(b,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})});const Ne=o=>{const{title:l,count:r,isExpanded:a,onToggle:c,children:d}=o;return t("div",{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:c},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e(S,Object.assign({style:{fontWeight:"600"}},{children:l})),P===k.ApplicationType.MANIFEST?e("div",Object.assign({style:{backgroundColor:x.surface.subdued,color:x.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:r})):e(i,{})]})),e(i,{children:P===k.ApplicationType.BIK?e(i,{}):e(a?n:s,{width:20,height:20,color:x.content.primary})})]})),a&&d]})};return t(i,{children:[e(N,{children:t(i,{children:[t("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!Q&&e(E,{children:Q}),t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e(S,Object.assign({color:x.content.secondary},{children:"Intent"})),null!==(R=Ie[K.intent])&&void 0!==R?R:Ie.GENERIC,!W&&e("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>M(void 0)},{children:e(l,{height:20,width:20,color:x.content.secondary})}))]})),Oe(oe)?e("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var i,o;return t("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${x.background.negative.light}`,borderRadius:"100px"}},{children:e(d,{width:24,height:24,color:x.stroke.negative.vibrant})})),e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e(E,{children:"Insufficient data"})})),e(L,Object.assign({color:x.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),G&&e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(C,{LeadingIcon:null!==(i=G.leadingIcon)&&void 0!==i?i:u,buttonText:null!==(o=G.title)&&void 0!==o?o:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{G.onClick()}})}))]}))})()})):e(j,{LeadingIcon:d,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:K.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${P===k.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Oe(oe)&&t("div",Object.assign({className:"info-container"},{children:[e(i,{children:be.length>0&&e("div",Object.assign({className:"info-product-source"},{children:e(Ne,Object.assign({title:"Product Sources",count:be.length,isExpanded:P!==k.ApplicationType.MANIFEST||ve,onToggle:()=>ye(!ve)},{children:e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:be.map(((o,n)=>{var s,l,a,c;const d=Ee(o.type||o.subTitle||"OpenAI"),p=Ee(o.type||o.subTitle||"OpenAI",!0),u=Se(d),h=null==Y?void 0:Y.includes(p),m=$[null!==(s=o.productId)&&void 0!==s?s:"Products"],f=o.title,v=o.productId&&(null==ee?void 0:ee[o.productId]),y=v&&v.metafield.join(", ");return t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:n+1<(null==be?void 0:be.length)?`1px solid ${x.stroke.primary}`:"none"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Le(d),e(O,Object.assign({body:f,placement:"top"},{children:e(L,Object.assign({style:p==D.FETCHED_LINKS||p==D.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.content.primary,className:"clamp-title",onClick:()=>p==D.FETCHED_LINKS||p==D.WEBSITE_LINKS?X(o):{}},{children:f}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==q.EMAIL_COLLECTION&&e(i,{children:e(S,Object.assign({color:x.content.secondary},{children:u}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(I,h?{Icon:r,height:16,width:16,iconColor:x.content.secondary,onClick:()=>null==m?void 0:m.onEditClick(m.data,m.type),disabled:!m,disabledTooltip:"This source is deleted"}:{Icon:g,height:16,width:16,iconColor:x.content.secondary,disabled:"custom"===o.type&&!m,disabledTooltip:"This source is deleted",onClick:()=>X(o)})}))]}))]})),v&&t(S,{children:[e("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;he({title:f,description:we(v.description),imageUrl:null!==(e=o.imageUrl)&&void 0!==e?e:"",onClose:()=>he(void 0)})}},{children:`${null===(l=v.description)||void 0===l?void 0:l.length} characters description,`})),e("span",Object.assign({className:"product-data-text1",onClick:()=>v.onEditFaqClick(v.faqs)},{children:`${null===(a=v.faqs)||void 0===a?void 0:a.length} FAQs, `})),e("span",Object.assign({className:"product-data-text2"},{children:"and"})),e(O,Object.assign({body:y,placement:"top"},{children:e("span",Object.assign({className:"product-data-text1"},{children:`${null===(c=v.metafield)||void 0===c?void 0:c.length} metafields`}))}))]})]}),`info-${n}`)}))}))}))}))}),e(i,{children:Te.length>0&&e("div",Object.assign({className:"info-content-source"},{children:e(Ne,Object.assign({title:"Content Sources",count:Te.length,isExpanded:P!==k.ApplicationType.MANIFEST||xe,onToggle:()=>Ce(!xe)},{children:e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Te.map(((o,n)=>{var s,l,a,c,d,p,u,h,m,f,v,y,C,b,T,j,E;const w=Ee(o.type||o.subTitle||"OpenAI"),N=Ee(o.type||o.subTitle||"OpenAI",!0),A=Se(w),_=null==Y?void 0:Y.includes(N),k="Products"===o.subTitle?$[null!==(s=o.productId)&&void 0!==s?s:"Products"]:$[null!==(l=o.docId)&&void 0!==l?l:""],F=N.toLowerCase()===(null===(a=D.FAQ)||void 0===a?void 0:a.toLowerCase())?"faq"===(null===(c=o.title)||void 0===c?void 0:c.toLowerCase())?o.subTitle:o.title:N.toLowerCase()===(null===(d=D.FILES)||void 0===d?void 0:d.toLowerCase())||N.toLowerCase()===(null===(p=D.FETCHED_LINKS)||void 0===p?void 0:p.toLowerCase())||N.toLowerCase()===(null===(u=D.TEXTS)||void 0===u?void 0:u.toLowerCase())?o.title:N.toLowerCase()===(null===(h=D.WEBSITE_LINKS)||void 0===h?void 0:h.toLowerCase())?o.title.split("/")[o.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):o.intent===q.EMAIL_COLLECTION?A:o.title,R="faq"===N.toLowerCase()?null!==(v=null!==(m=null==k?void 0:k.content)&&void 0!==m?m:null===(f=null==k?void 0:k.data)||void 0===f?void 0:f.answer)&&void 0!==v?v:"":N.toLowerCase()===(null===(y=D.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||N.toLowerCase()===(null===(C=D.WEBSITE_LINKS)||void 0===C?void 0:C.toLowerCase())||N.toLowerCase()===(null===(b=D.TEXTS)||void 0===b?void 0:b.toLowerCase())?null!==(E=null!==(T=null==k?void 0:k.content)&&void 0!==T?T:null===(j=null==k?void 0:k.data)||void 0===j?void 0:j.fileContentText)&&void 0!==E?E:"":o.intent===q.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:n+1<(null==Te?void 0:Te.length)?`1px solid ${x.stroke.primary}`:"none"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Le(w),e(O,Object.assign({body:F,placement:"top"},{children:e(L,Object.assign({style:N==D.FETCHED_LINKS||N==D.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.content.primary,className:"clamp-title",onClick:()=>N==D.FETCHED_LINKS||N==D.WEBSITE_LINKS?X(o):{}},{children:F}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==q.EMAIL_COLLECTION&&e(i,{children:e(S,Object.assign({color:x.content.secondary},{children:A}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(I,_?{Icon:r,height:16,width:16,iconColor:x.content.secondary,onClick:()=>null==k?void 0:k.onEditClick(k.data,k.type),disabled:!k,disabledTooltip:"This source is deleted"}:{Icon:g,height:16,width:16,iconColor:x.content.secondary,disabled:"custom"===o.type&&!k,disabledTooltip:"This source is deleted",onClick:()=>X(o)})}))]}))]})),(null!=R?R:"").trim()&&e("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${x.stroke.primary}`,borderRadius:"4px",backgroundColor:x.surface.subdued}},{children:e(S,Object.assign({color:x.content.primary,className:"clamp-description"},{children:we(null!=R?R:"").trim()}))}))]}),`info-${n}`)}))}))}))}))})]})),ce&&!Oe(oe)&&e("div",Object.assign({className:"footer"},{children:e(w,{appType:P,storeId:U,messageSource:K,sourceIntent:null!==(B=K.intent)&&void 0!==B?B:q.GENERIC,faqCount:pe,trainingSourceCount:me,ShowTrainingDataSource:je,ChecklistType:q,footerButtonOption:V,isFooterLoading:re,reasonForAiGeneratedResponse:te,showAiResponseReason:ie})}))]})}),ge&&e(T,Object.assign({header:"Product description",onClose:()=>he(void 0),width:"30%"},{children:e(_,{title:ge.title,description:ge.description,imageUrl:ge.imageUrl,onClose:ge.onClose})}))]})};export{F as DataSourcePanel};
1
+ import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import o from"../../assets/icons/boxV2.svg.js";import n from"../../assets/icons/cross.svg.js";import s from"../../assets/icons/edit.svg.js";import l from"../../assets/icons/filePdf.svg.js";import r from"../../assets/icons/help.svg.js";import a from"../../assets/icons/info.svg.js";import d from"../../assets/icons/openai.svg.js";import c from"../../assets/icons/plus.svg.js";import p from"../../assets/icons/redirect.svg.js";import u from"../../assets/icons/text_t9.svg.js";import g from"../../assets/icons/website.svg.js";import{useState as h,useMemo as m,useEffect as f}from"react";import{COLORS as v}from"../../constants/Theme.js";import{Button as y}from"../button/Button.js";import{IconButton as C}from"../icon-button/IconButton.js";import{BikShimmer as x}from"../shimmer/ShimmerComponent/BikShimmer.js";import{SideModal as I}from"../side-modal/SideModal.js";import{Tag as b}from"../tag/Tag.js";import{Tooltip as T}from"../tooltips/Tooltip.js";import{TitleSmall as j,BodyCaption as O,BodySecondary as E}from"../TypographyStyle.js";import L from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as S}from"./DataSourcePanel.style.js";import{intentConfig as w}from"./IntentConfig.js";import{DescriptionModal as N}from"./Modals/DescriptionModal.js";import{CustomDataType as _}from"./model.js";import{__exports as A}from"../../_virtual/bik-store.js";const D=D=>{var k,F;const{appType:P,storeId:B,messageSource:R,setMessageSourcePanel:U,hideCloseButton:K,isSourceInfoFetched:M,allSourceInfoDetail:W,ChecklistType:H,title:$,zeroStateButton:q,editableSources:Q,preFillTrainingSourceCount:Y,redirect:G,footerButtonOption:X,fetchTrainingSourceCount:z,fetchProductFAQCount:V,productSourceData:J}=D,{sources:Z}=R,ee=["blog","article","page","policy"],[te,ie]=h(!1),[oe,ne]=h(!1),[se,le]=h(!1),[re,ae]=h(0),[de,ce]=h(),[pe,ue]=h(null!=Y?Y:{}),ge={};w.forEach((t=>{let{key:i,type:o,tagText:n}=t;H[i]&&(ge[H[i]]=e(b,{theme:"light",type:o,tagText:n,cursor:"pointer"}))}));const he=Z.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),me=Z.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),fe=m((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{H[t]&&(e[H[t]]=H[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[H]);f((()=>{var e,t,i,o;if(!(null==R?void 0:R.messageId))return;ie(!0),ne(!0),le(!1!==(null===(t=null===(e=R.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=R.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights));const n=R.sources.filter((e=>!!e.productId)).map((e=>e.productId)),s=Array.from(new Set(n)).filter((e=>!!e));V(B,s).then((e=>ae(e))).then((()=>{Y?(ue(Y),setTimeout((()=>{ie(!1),ne(!1)}),100)):(setTimeout((()=>ie(!1)),100),z(B).then((e=>ue(e))).then((()=>setTimeout((()=>{ne(!1)}),100))))}))}),[V,z,null==R?void 0:R.messageId,R.sources,Y,B]);const ve=e=>!!(e&&0===e.length||(null==R?void 0:R.isUnsatisfactoryAnswer)),ye=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=_.FILES:ee.includes(e)?e=_.FETCHED_LINKS:"url"==e?e=_.WEBSITE_LINKS:"text"===e?e=_.TEXTS:"faq"===e&&(e=_.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},Ce=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",xe=t=>e("products"==t||"product"==t?o:"files"==t?l:"website links"==t||"fetched links"==t?g:"faq"==t?r:"texts"==t?u:d,{height:16,width:16,color:v.content.secondary}),Ie=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return te||!M?e(S,{children:e(x,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})}):t(i,{children:[e(S,{children:t(i,{children:[t("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!$&&e(j,{children:$}),t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e(O,Object.assign({color:v.content.secondary},{children:"Intent"})),null!==(k=ge[R.intent])&&void 0!==k?k:ge.GENERIC,!K&&e("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>U(void 0)},{children:e(n,{height:20,width:20,color:v.content.secondary})}))]})),ve(Z)?e("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var i,o;return t("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${v.background.negative.light}`,borderRadius:"100px"}},{children:e(a,{width:24,height:24,color:v.stroke.negative.vibrant})})),e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e(j,{children:"Insufficient data"})})),e(E,Object.assign({color:v.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),q&&e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(y,{LeadingIcon:null!==(i=q.leadingIcon)&&void 0!==i?i:c,buttonText:null!==(o=q.title)&&void 0!==o?o:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{q.onClick()}})}))]}))})()})):e(b,{LeadingIcon:a,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:R.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${P===A.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!ve(Z)&&t("div",Object.assign({className:"info-container"},{children:[he.length>0&&t("div",Object.assign({className:"info-product-source"},{children:[e(O,{children:"Product Source"}),e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:he.map(((o,n)=>{var l,r,a,d;const c=ye(o.type||o.subTitle||"OpenAI"),u=ye(o.type||o.subTitle||"OpenAI",!0),g=Ce(c),h=null==Q?void 0:Q.includes(u),m=W[null!==(l=o.productId)&&void 0!==l?l:"Products"],f=o.title,y=o.productId&&(null==J?void 0:J[o.productId]),x=y&&y.metafield.join(", ");return t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:n+1<(null==he?void 0:he.length)?`1px solid ${v.stroke.primary}`:"none"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[xe(c),e(T,Object.assign({body:f,placement:"top"},{children:e(E,Object.assign({style:u==_.FETCHED_LINKS||u==_.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:v.content.primary,className:"clamp-title",onClick:()=>u==_.FETCHED_LINKS||u==_.WEBSITE_LINKS?G(o):{}},{children:f}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==H.EMAIL_COLLECTION&&e(i,{children:e(O,Object.assign({color:v.content.secondary},{children:g}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(C,h?{Icon:s,height:16,width:16,iconColor:v.content.secondary,onClick:()=>null==m?void 0:m.onEditClick(m.data,m.type),disabled:!m,disabledTooltip:"This source is deleted"}:{Icon:p,height:16,width:16,iconColor:v.content.secondary,disabled:"custom"===o.type&&!m,disabledTooltip:"This source is deleted",onClick:()=>G(o)})}))]}))]})),y&&t(O,{children:[e("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;ce({title:f,description:Ie(y.description),imageUrl:null!==(e=o.imageUrl)&&void 0!==e?e:"",onClose:()=>ce(void 0)})}},{children:`${null===(r=y.description)||void 0===r?void 0:r.length} characters description,`})),e("span",Object.assign({className:"product-data-text1",onClick:()=>y.onEditFaqClick(y.faqs)},{children:`${null===(a=y.faqs)||void 0===a?void 0:a.length} FAQs, `})),e("span",Object.assign({className:"product-data-text2"},{children:"and"})),e(T,Object.assign({body:x,placement:"top"},{children:e("span",Object.assign({className:"product-data-text1"},{children:`${null===(d=y.metafield)||void 0===d?void 0:d.length} metafields`}))}))]})]}),`info-${n}`)}))}))]})),me.length>0&&t("div",Object.assign({className:"info-content-source"},{children:[e(O,{children:"Content Source"}),e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:me.map(((o,n)=>{var l,r,a,d,c,u,g,h,m,f,y,x,I,b,j,L,S;const w=ye(o.type||o.subTitle||"OpenAI"),N=ye(o.type||o.subTitle||"OpenAI",!0),A=Ce(w),D=null==Q?void 0:Q.includes(N),k="Products"===o.subTitle?W[null!==(l=o.productId)&&void 0!==l?l:"Products"]:W[null!==(r=o.docId)&&void 0!==r?r:""],F=N.toLowerCase()===(null===(a=_.FAQ)||void 0===a?void 0:a.toLowerCase())?"faq"===(null===(d=o.title)||void 0===d?void 0:d.toLowerCase())?o.subTitle:o.title:N.toLowerCase()===(null===(c=_.FILES)||void 0===c?void 0:c.toLowerCase())||N.toLowerCase()===(null===(u=_.FETCHED_LINKS)||void 0===u?void 0:u.toLowerCase())||N.toLowerCase()===(null===(g=_.TEXTS)||void 0===g?void 0:g.toLowerCase())?o.title:N.toLowerCase()===(null===(h=_.WEBSITE_LINKS)||void 0===h?void 0:h.toLowerCase())?o.title.split("/")[o.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):o.intent===H.EMAIL_COLLECTION?A:o.title,P="faq"===N.toLowerCase()?null!==(y=null!==(m=null==k?void 0:k.content)&&void 0!==m?m:null===(f=null==k?void 0:k.data)||void 0===f?void 0:f.answer)&&void 0!==y?y:"":N.toLowerCase()===(null===(x=_.FETCHED_LINKS)||void 0===x?void 0:x.toLowerCase())||N.toLowerCase()===(null===(I=_.WEBSITE_LINKS)||void 0===I?void 0:I.toLowerCase())||N.toLowerCase()===(null===(b=_.TEXTS)||void 0===b?void 0:b.toLowerCase())?null!==(S=null!==(j=null==k?void 0:k.content)&&void 0!==j?j:null===(L=null==k?void 0:k.data)||void 0===L?void 0:L.fileContentText)&&void 0!==S?S:"":o.intent===H.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:n+1<(null==me?void 0:me.length)?`1px solid ${v.stroke.primary}`:"none"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[xe(w),e(T,Object.assign({body:F,placement:"top"},{children:e(E,Object.assign({style:N==_.FETCHED_LINKS||N==_.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:v.content.primary,className:"clamp-title",onClick:()=>N==_.FETCHED_LINKS||N==_.WEBSITE_LINKS?G(o):{}},{children:F}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==H.EMAIL_COLLECTION&&e(i,{children:e(O,Object.assign({color:v.content.secondary},{children:A}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(C,D?{Icon:s,height:16,width:16,iconColor:v.content.secondary,onClick:()=>null==k?void 0:k.onEditClick(k.data,k.type),disabled:!k,disabledTooltip:"This source is deleted"}:{Icon:p,height:16,width:16,iconColor:v.content.secondary,disabled:"custom"===o.type&&!k,disabledTooltip:"This source is deleted",onClick:()=>G(o)})}))]}))]})),(null!=P?P:"").trim()&&e("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${v.stroke.primary}`,borderRadius:"4px",backgroundColor:v.surface.subdued}},{children:e(O,Object.assign({color:v.content.primary,className:"clamp-description"},{children:Ie(null!=P?P:"").trim()}))}))]}),`info-${n}`)}))}))]}))]})),se&&!ve(Z)&&e("div",Object.assign({className:"footer"},{children:e(L,{appType:P,storeId:B,messageSource:R,sourceIntent:null!==(F=R.intent)&&void 0!==F?F:H.GENERIC,faqCount:re,trainingSourceCount:pe,ShowTrainingDataSource:fe,ChecklistType:H,footerButtonOption:X,isFooterLoading:oe})}))]})}),de&&e(I,Object.assign({header:"Product description",onClose:()=>ce(void 0),width:"30%"},{children:e(N,{title:de.title,description:de.description,imageUrl:de.imageUrl,onClose:de.onClose})}))]})};export{D as DataSourcePanel};
@@ -1,4 +1,3 @@
1
1
  export declare const SourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const WithoutContentSourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const SourceInfoFooterStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export declare const DataSourceCountStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -15,9 +15,9 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
15
15
  display: flex;
16
16
  flex-direction: column;
17
17
  gap: 8px;
18
- background-color: ${o.surface.hovered};
19
18
  .source {
20
19
  border-radius: 12px;
20
+ background-color: ${o.surface.subdued};
21
21
  }
22
22
  }
23
23
  .info-product-source {
@@ -25,7 +25,6 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
25
25
  display: flex;
26
26
  flex-direction: column;
27
27
  gap: 8px;
28
- background-color: ${o.surface.hovered};
29
28
 
30
29
  .product-data-text1 {
31
30
  padding: 2px;
@@ -42,6 +41,7 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
42
41
  }
43
42
  .source {
44
43
  border-radius: 12px;
44
+ background-color: ${o.surface.subdued};
45
45
  }
46
46
  }
47
47
  .pop-up-header {
@@ -157,13 +157,4 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
157
157
  display: flex;
158
158
  gap: 8px;
159
159
  }
160
- `;e.div`
161
- display: flex;
162
- align-items: center;
163
- justify-content: center;
164
- width: 24px;
165
- height: 24px;
166
- background-color: ${o.surface.subdued};
167
- border-radius: 22px;
168
- border: 1px solid ${o.stroke.primary};
169
160
  `;export{r as SourceInfoDetailsStyle,i as SourceInfoFooterStyle};
@@ -1,3 +1,4 @@
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
1
2
  import { VariableListInterfaceV2 } from "../add-variableV2/AddVariableV2";
2
3
  import { CarouselProduct } from "./modalElements/EditWhatsAppCarouselTemplateV2";
3
4
  import { WhatsAppCarouselTemplateVariables } from "../template-preview/models/WhatsappCarouselTemplate";
@@ -45,6 +46,7 @@ export interface TemplateContextMapperProps {
45
46
  fetchCollections: any;
46
47
  fetchProducts: any;
47
48
  storeId: string;
49
+ appType?: ApplicationType;
48
50
  };
49
51
  selectedCarouselProducts?: CarouselProduct[];
50
52
  disableEditExpiry?: boolean;
@@ -1,3 +1,4 @@
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
1
2
  import { VariableV3 } from "../../../helpers";
2
3
  import React, { LegacyRef } from 'react';
3
4
  import Slider from 'react-slick';
@@ -55,6 +56,7 @@ export declare const TemplateModalContext: React.Context<{
55
56
  fetchCollections: any;
56
57
  fetchProducts: any;
57
58
  storeId: string;
59
+ appType?: ApplicationType | undefined;
58
60
  } | undefined;
59
61
  carouselProducts?: CarouselProduct[] | undefined;
60
62
  setCarouselProducts?: React.Dispatch<React.SetStateAction<CarouselProduct[]>> | undefined;
@@ -127,6 +129,7 @@ export declare const useTemplateModalContext: () => {
127
129
  fetchCollections: any;
128
130
  fetchProducts: any;
129
131
  storeId: string;
132
+ appType?: ApplicationType | undefined;
130
133
  } | undefined;
131
134
  carouselProducts?: CarouselProduct[] | undefined;
132
135
  setCarouselProducts?: React.Dispatch<React.SetStateAction<CarouselProduct[]>> | undefined;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import o from"../../../assets/icons/arrow_back.svg.js";import n from"../../../assets/icons/chevronLeft.svg.js";import i from"../../../assets/icons/chevronRight.svg.js";import r from"../../../assets/icons/PlusIcon.js";import{cloneDeep as a}from"lodash";import{useState as d,useEffect as s}from"react";import{Button as c}from"../../button/Button.js";import{IconButton as u}from"../../icon-button/IconButton.js";import{ProductPickerModal as p,ScreenName as m}from"../../product-picker-v2/modal.js";import{Badge as v}from"../Badge/index.js";import{useTemplateModalContext as h}from"../context/templateModalContext.js";import g from"./EditWhatsAppTemplateV2.js";import{ProductBox as f}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{COLORS as y}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{POD as b}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";import{isRCSChannel as j}from"../../template-preview/helpers/templateMiscHelper.js";import{TitleMedium as C,TitleRegular as x,BodySecondary as I,BodyCaption as w}from"../../TypographyStyle.js";const k=k=>{let{template:O,whatsappSpecificPickerMeta:P,showVariableModal:T,variableListForImage:S,discountCode:L,setDiscountCode:E}=k;var B,A,M,V,D,F,R,W;const{selectedCarouselIndex:$,setTemplate:q,pickerConf:N,isProductCarouselType:_,pod:z,cardCount:G,carouselProducts:H,setCarouselProducts:J,isError:K,cardImages:Q,disableEditVariable:U,onDeleteSelectedProducts:X,setSelectedCarouselIndex:Y,setVariableCallback:Z,setShowVariablePicker:ee,sliderRef:te}=h(),[le,oe]=d(j(null==O?void 0:O.channel)?"Carousel Cards":-1==$?"First Message (Step 1/2)":_?"Product Carousel "+((null===(A=null===(B=null==O?void 0:O.mapping)||void 0===B?void 0:B.body)||void 0===A?void 0:A.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(V=null===(M=null==O?void 0:O.mapping)||void 0===M?void 0:M.body)||void 0===V?void 0:V.length)?"(Step 2/2)":"")),[ne,ie]=d(!1),[re,ae]=d(!1),de=$===(null!=G?G:-1)-1,se=(null!=$?$:-1)<1;s((()=>{var e,t,l,o;oe(j(null==O?void 0:O.channel)?"Carousel Cards":-1==$?"First Message (Step 1/2)":_?"Product Carousel "+((null===(t=null===(e=null==O?void 0:O.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(o=null===(l=null==O?void 0:O.mapping)||void 0===l?void 0:l.body)||void 0===o?void 0:o.length)?"(Step 2/2)":""))}),[$]);const ce=e=>{null==J||J([{name:"variable",productName:e.actualValue}])};return s((()=>{-1===$&&j(null==O?void 0:O.channel)&&(null==Y||Y(0))}),[$,null==O?void 0:O.channel]),e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!j(null==O?void 0:O.channel)&&null!=$&&$>=0&&!!(null===(F=null===(D=null==O?void 0:O.mapping)||void 0===D?void 0:D.body)||void 0===F?void 0:F.length)&&t(u,{Icon:o,onClick:()=>{null==Y||Y(-1)}}),t(C,Object.assign({style:{marginLeft:10}},{children:le}))]})),_&&(null!==(R=null==H?void 0:H.length)&&void 0!==R?R:0)>0&&null!=$&&$>=0&&e("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[t(f,{editItem:()=>{1===(null==H?void 0:H.length)&&"variable"===H[0].name?(Z((()=>ce)),ee(!0)):ie(!ne)},cardBody:1===(null==H?void 0:H.length)&&"variable"===H[0].name?`${H[0].productName}`:`${null==H?void 0:H.length} Products Selected`,hideIcon:1===(null==H?void 0:H.length)&&"variable"===H[0].name,deleteItem:()=>{var e;if(1===(null==H?void 0:H.length)&&"variable"===H[0].name)return void(null==J||J([]));const t=a(Object.assign({},O));t&&(Q&&Q.length>0?null==Q||Q.forEach(((e,l)=>{var o;t.components[1].cards[l].components[0].example.header_handle=[null!==(o=Q[l])&&void 0!==o?o:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==q||q(t)),null==J||J([]),null==X||X()}}),H&&(null==H?void 0:H.length)>0&&"variable"!=H[0].name&&t(c,{disabled:(null!==(W=null==H?void 0:H.length)&&void 0!==W?W:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{ae(!0),ie(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!U&&_&&0===(null==H?void 0:H.length)&&null!=$&&$>=0&&e(l,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[t(x,{children:"Product(s)"}),t(I,{children:`Select ${null!=G?G:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:K?16:12,marginRight:K?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[t(c,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:K?`2px dashed ${y.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:K?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:t(r,{width:18,height:18,color:y.content.secondary})})),onClick:e=>{ie(!0)}}),z===b.CHATBOT&&e(l,{children:[e("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),t(w,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),t(c,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:K?`2px dashed ${y.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:K?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex"}},{children:t(r,{width:18,height:18,color:y.content.secondary})})),onClick:e=>{Z((()=>ce)),ee(!0)}})]})]})),K&&t("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:t(v,{padding:"8px",errorText:"Please add products"})}))]}),!_&&(null!=$?$:-1)>-1&&e("div",Object.assign({style:{display:"flex",background:y.surface.hovered,alignItems:"center"}},{children:[t(u,{Icon:n,disabled:se,width:8,height:14,svgStyle:se?{}:{color:y.content.secondary},onClick:()=>{var e;null===(e=null==te?void 0:te.current)||void 0===e||e.slickPrev(),(null!=$?$:-1)<1||null==Y||Y((e=>e-1))}}),t(x,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:y.content.secondary},{children:`Card ${(null!=$?$:0)+1}/${G}`})),t(u,{Icon:i,width:8,height:14,disabled:de,svgStyle:de?{}:{color:y.content.secondary},onClick:()=>{var e;null===(e=null==te?void 0:te.current)||void 0===e||e.slickNext(),(null!=$?$:-1)>=(null!=G?G:-1)-1||null==Y||Y((e=>e+1))}})]})),t(g,{whatsappSpecificPickerMeta:P,template:O,onTemplateChange:e=>{null==q||q(e)},showVariableModal:T,variableListForImage:S,discountCode:L,setDiscountCode:E}),ne&&N&&t(p,{zIndex:200,startupScreen:re?m.RearrangeProducts:m.Collections,rearrangeEnabled:!0,storeId:N.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,o=l.productId,n=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),o in t[e].products||(t[e].products[o]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[o].variants[n]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=H?H:[]),collectionFetcher:N.fetchCollections,productFetcher:N.fetchProducts,onAdd:(e,t)=>{var l,o,n,i,r,d;ae(!1);const s=[];delete e.isCustom;for(const t of Object.keys(e)){const a=e[t].products;if(void 0!==a&&Object.keys(a).length)for(const e of Object.keys(a)){const c=a[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:m,quantity:v,displayOrder:h}=c[u],g={name:p,image:null!==(o=null!=m?m:null===(l=a[e])||void 0===l?void 0:l.image)&&void 0!==o?o:"",quantity:v,variantId:u,productId:e,displayOrder:h,collectionId:t,productName:null!==(i=null===(n=a[e])||void 0===n?void 0:n.name)&&void 0!==i?i:"",productImage:null!==(d=null===(r=a[e])||void 0===r?void 0:r.image)&&void 0!==d?d:""};s.push(g)}}}const c=s.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=s.map((e=>e.image)),p=a(Object.assign({},O));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==Q?void 0:Q[t])&&void 0!==l?l:""]})),null==q||q(p)),null==J||J(c),ie(!1)},searchInCollectionFetcher:N.searchInCollection,searchFetcher:N.searchProducts,visible:ne,onClose:()=>{ie(!1)},exactLimit:null!=G?G:1})]}))};export{k as default};
1
+ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import"../../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import o from"../../../assets/icons/arrow_back.svg.js";import i from"../../../assets/icons/chevronLeft.svg.js";import n from"../../../assets/icons/chevronRight.svg.js";import r from"../../../assets/icons/PlusIcon.js";import{cloneDeep as a}from"lodash";import{useState as d,useEffect as s}from"react";import{Button as c}from"../../button/Button.js";import{IconButton as u}from"../../icon-button/IconButton.js";import{ProductPickerModal as p,ScreenName as m}from"../../product-picker-v2/modal.js";import{Badge as v}from"../Badge/index.js";import{useTemplateModalContext as h}from"../context/templateModalContext.js";import g from"./EditWhatsAppTemplateV2.js";import{ProductBox as f}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{COLORS as y}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{POD as b}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";import{isRCSChannel as j}from"../../template-preview/helpers/templateMiscHelper.js";import{TitleMedium as x,TitleRegular as C,BodySecondary as I,BodyCaption as k}from"../../TypographyStyle.js";import{__exports as w}from"../../../_virtual/bik-store.js";const O=O=>{let{template:P,whatsappSpecificPickerMeta:T,showVariableModal:S,variableListForImage:L,discountCode:B,setDiscountCode:E}=O;var A,M,V,D,F,R,W,_;const{selectedCarouselIndex:$,setTemplate:q,pickerConf:N,isProductCarouselType:z,pod:G,cardCount:H,carouselProducts:K,setCarouselProducts:J,isError:Q,cardImages:U,disableEditVariable:X,onDeleteSelectedProducts:Y,setSelectedCarouselIndex:Z,setVariableCallback:ee,setShowVariablePicker:te,sliderRef:le}=h(),[oe,ie]=d(j(null==P?void 0:P.channel)?"Carousel Cards":-1==$?"First Message (Step 1/2)":z?"Product Carousel "+((null===(M=null===(A=null==P?void 0:P.mapping)||void 0===A?void 0:A.body)||void 0===M?void 0:M.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(D=null===(V=null==P?void 0:P.mapping)||void 0===V?void 0:V.body)||void 0===D?void 0:D.length)?"(Step 2/2)":"")),[ne,re]=d(!1),[ae,de]=d(!1),se=$===(null!=H?H:-1)-1,ce=(null!=$?$:-1)<1;s((()=>{var e,t,l,o;ie(j(null==P?void 0:P.channel)?"Carousel Cards":-1==$?"First Message (Step 1/2)":z?"Product Carousel "+((null===(t=null===(e=null==P?void 0:P.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(o=null===(l=null==P?void 0:P.mapping)||void 0===l?void 0:l.body)||void 0===o?void 0:o.length)?"(Step 2/2)":""))}),[$]);const ue=e=>{null==J||J([{name:"variable",productName:e.actualValue}])};return s((()=>{-1===$&&j(null==P?void 0:P.channel)&&(null==Z||Z(0))}),[$,null==P?void 0:P.channel]),e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!j(null==P?void 0:P.channel)&&null!=$&&$>=0&&!!(null===(R=null===(F=null==P?void 0:P.mapping)||void 0===F?void 0:F.body)||void 0===R?void 0:R.length)&&t(u,{Icon:o,onClick:()=>{null==Z||Z(-1)}}),t(x,Object.assign({style:{marginLeft:10}},{children:oe}))]})),z&&(null!==(W=null==K?void 0:K.length)&&void 0!==W?W:0)>0&&null!=$&&$>=0&&e("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[t(f,{editItem:()=>{1===(null==K?void 0:K.length)&&"variable"===K[0].name?(ee((()=>ue)),te(!0)):re(!ne)},cardBody:1===(null==K?void 0:K.length)&&"variable"===K[0].name?`${K[0].productName}`:`${null==K?void 0:K.length} Products Selected`,hideIcon:1===(null==K?void 0:K.length)&&"variable"===K[0].name,deleteItem:()=>{var e;if(1===(null==K?void 0:K.length)&&"variable"===K[0].name)return void(null==J||J([]));const t=a(Object.assign({},P));t&&(U&&U.length>0?null==U||U.forEach(((e,l)=>{var o;t.components[1].cards[l].components[0].example.header_handle=[null!==(o=U[l])&&void 0!==o?o:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==q||q(t)),null==J||J([]),null==Y||Y()}}),K&&(null==K?void 0:K.length)>0&&"variable"!=K[0].name&&t(c,{disabled:(null!==(_=null==K?void 0:K.length)&&void 0!==_?_:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{de(!0),re(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!X&&z&&0===(null==K?void 0:K.length)&&null!=$&&$>=0&&e(l,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[t(C,{children:"Product(s)"}),t(I,{children:`Select ${null!=H?H:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:Q?16:12,marginRight:Q?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[t(c,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:Q?`2px dashed ${y.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:Q?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:t(r,{width:18,height:18,color:y.content.secondary})})),onClick:e=>{re(!0)}}),G===b.CHATBOT&&e(l,{children:[e("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),t(k,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),t(c,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:Q?`2px dashed ${y.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:Q?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex"}},{children:t(r,{width:18,height:18,color:y.content.secondary})})),onClick:e=>{ee((()=>ue)),te(!0)}})]})]})),Q&&t("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:t(v,{padding:"8px",errorText:"Please add products"})}))]}),!z&&(null!=$?$:-1)>-1&&e("div",Object.assign({style:{display:"flex",background:y.surface.hovered,alignItems:"center"}},{children:[t(u,{Icon:i,disabled:ce,width:8,height:14,svgStyle:ce?{}:{color:y.content.secondary},onClick:()=>{var e;null===(e=null==le?void 0:le.current)||void 0===e||e.slickPrev(),(null!=$?$:-1)<1||null==Z||Z((e=>e-1))}}),t(C,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:y.content.secondary},{children:`Card ${(null!=$?$:0)+1}/${H}`})),t(u,{Icon:n,width:8,height:14,disabled:se,svgStyle:se?{}:{color:y.content.secondary},onClick:()=>{var e;null===(e=null==le?void 0:le.current)||void 0===e||e.slickNext(),(null!=$?$:-1)>=(null!=H?H:-1)-1||null==Z||Z((e=>e+1))}})]})),t(g,{whatsappSpecificPickerMeta:T,template:P,onTemplateChange:e=>{null==q||q(e)},showVariableModal:S,variableListForImage:L,discountCode:B,setDiscountCode:E}),ne&&N&&t(p,{zIndex:200,startupScreen:ae?m.RearrangeProducts:m.Collections,rearrangeEnabled:!0,storeId:N.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,o=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),o in t[e].products||(t[e].products[o]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[o].variants[i]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=K?K:[]),collectionFetcher:N.fetchCollections,productFetcher:N.fetchProducts,onAdd:(e,t)=>{var l,o,i,n,r,d;de(!1);const s=[];delete e.isCustom;for(const t of Object.keys(e)){const a=e[t].products;if(void 0!==a&&Object.keys(a).length)for(const e of Object.keys(a)){const c=a[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:m,quantity:v,displayOrder:h}=c[u],g={name:p,image:null!==(o=null!=m?m:null===(l=a[e])||void 0===l?void 0:l.image)&&void 0!==o?o:"",quantity:v,variantId:u,productId:e,displayOrder:h,collectionId:t,productName:null!==(n=null===(i=a[e])||void 0===i?void 0:i.name)&&void 0!==n?n:"",productImage:null!==(d=null===(r=a[e])||void 0===r?void 0:r.image)&&void 0!==d?d:""};s.push(g)}}}const c=s.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=s.map((e=>e.image)),p=a(Object.assign({},P));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==U?void 0:U[t])&&void 0!==l?l:""]})),null==q||q(p)),null==J||J(c),re(!1)},searchInCollectionFetcher:N.searchInCollection,searchFetcher:N.searchProducts,visible:ne,onClose:()=>{re(!1)},exactLimit:null!=H?H:1,appType:N.appType||w.ApplicationType.BIK})]}))};export{O as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{useTemplateModalContext as i}from"../template-context-mapper/context/templateModalContext.js";import a from"../../utils/StringUtils.js";import{COLORS as n}from"../../constants/Theme.js";import{TitleRegular as o}from"../TypographyStyle.js";import r from"./EmailTemplateThumbnailPreview.js";import{CHANNEL_TYPE as s}from"./models/Channels.js";import d from"./SmsTemplatePreview.js";import p from"./webpush/WebpushPreview.js";import m from"./WhatsAppTemplatePreview.js";const u=u=>{let{template:v,channel:h,whatsAppSpecificMeta:b,templateCreationsInfo:C,hideHeader:S,size:y,onlyTemplateContent:g,emailSpecificMeta:j,smsSpecificMeta:f,showSampleValues:w,carouselCardIndex:T,isWhatsappCarousel:x,isPreview:P,applyBorderBottom:W,webPushSpecificMeta:O,hidePointerEvents:H}=u;var A,I;const{setSelectedCarouselIndex:B}=i();return h===s.SMS?e("div",Object.assign({style:Object.assign({marginTop:C?16:0,border:C?`1px solid ${n.stroke.primary}`:"none",borderRadius:4},null==f?void 0:f.templateContainerStyles)},{children:e(d,{template:v,hideHeader:S,onlyTemplateContent:g,size:null!=y?y:"large",variableStore:null==f?void 0:f.smsVariableStore,display_content:null==f?void 0:f.smsDisplayContent,uniqueId:null==f?void 0:f.uniqueId})})):h===s.EMAIL?e("div",Object.assign({style:Object.assign({marginTop:C?16:0},null==j?void 0:j.templateContainerStyles)},{children:e(r,{template:v,handleViewTemplate:()=>{var e;null===(e=null==j?void 0:j.handleViewTemplate)||void 0===e||e.call(j)},hideHeader:S,hideViewButton:null==j?void 0:j.hideViewButtonForEmail,containerStyle:null==j?void 0:j.containerStyle,emailDisplayContent:null==j?void 0:j.emailDisplayContent,emailHtmlContainerId:null==j?void 0:j.emailHtmlContainerId,applyBorderBottom:W,hidePointerEvents:H})})):h===s.WHATSAPP||h===s.RCS?t("div",Object.assign({style:Object.assign(Object.assign({},null==b?void 0:b.templateContainerStyles),C?c.WhatsAppWrapper:{}),onClick:()=>{var e,t;if(B&&x){if(-1===T&&!(null===(t=null===(e=null==v?void 0:v.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length))return;B(null!=T?T:-1)}}},{children:[C?e("div",Object.assign({style:{padding:16}},{children:e(o,{children:a.convertToTitleCase(null!==(A=null==v?void 0:v.label)&&void 0!==A?A:"")})})):e(l,{}),e(m,{showSampleValues:w,showHeader:null==b?void 0:b.showWhatsAppHeader,extras:null==b?void 0:b.whatsAppExtras,template:v,size:C?"small":null!=y?y:"large",containerStyle:Object.assign(Object.assign({borderWidth:C?0:1,borderTopWidth:1},null!==(I=null==b?void 0:b.containerStyle)&&void 0!==I?I:{}),{height:"100%"}),zeroStateComponent:null==b?void 0:b.zeroStateComponent,usePlaceHolderName:null==b?void 0:b.usePlaceHolderName,carouselCardIndex:T,isWhatsappCarousel:x,isPreview:P,channel:h})]})):h==s.WEBPUSH?e("div",Object.assign({style:Object.assign({},null==O?void 0:O.containerStyle)},{children:e(p,{template:v,extraContainerCss:null==O?void 0:O.extraContainerCss})})):e(l,{})},c={WhatsAppWrapper:{backgroundColor:n.surface.standard,borderRadius:4,border:`1px solid ${n.background.inactive}`,marginTop:16}};export{u as TemplatePreview};
1
+ import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{useTemplateModalContext as l}from"../template-context-mapper/context/templateModalContext.js";import n from"../../utils/StringUtils.js";import{COLORS as o}from"../../constants/Theme.js";import a from"../../assets/icons/aiContentIcon.svg.js";import{TitleRegular as s}from"../TypographyStyle.js";import r from"./EmailTemplateThumbnailPreview.js";import{CHANNEL_TYPE as d}from"./models/Channels.js";import p from"./SmsTemplatePreview.js";import m from"./webpush/WebpushPreview.js";import c from"./WhatsAppTemplatePreview.js";const u=u=>{let{template:h,channel:g,whatsAppSpecificMeta:C,templateCreationsInfo:b,hideHeader:y,size:S,onlyTemplateContent:j,emailSpecificMeta:f,smsSpecificMeta:w,showSampleValues:T,carouselCardIndex:x,isWhatsappCarousel:O,isPreview:P,applyBorderBottom:W,webPushSpecificMeta:I,hidePointerEvents:H}=u;var A,B;const{setSelectedCarouselIndex:E}=l();return g===d.SMS?e("div",Object.assign({style:Object.assign({marginTop:b?16:0,border:b?`1px solid ${o.stroke.primary}`:"none",borderRadius:4},null==w?void 0:w.templateContainerStyles)},{children:e(p,{template:h,hideHeader:y,onlyTemplateContent:j,size:null!=S?S:"large",variableStore:null==w?void 0:w.smsVariableStore,display_content:null==w?void 0:w.smsDisplayContent,uniqueId:null==w?void 0:w.uniqueId})})):g===d.EMAIL?e("div",Object.assign({style:Object.assign({marginTop:b?16:0},null==f?void 0:f.templateContainerStyles)},{children:e(r,{template:h,handleViewTemplate:()=>{var e;null===(e=null==f?void 0:f.handleViewTemplate)||void 0===e||e.call(f)},hideHeader:y,hideViewButton:null==f?void 0:f.hideViewButtonForEmail,containerStyle:null==f?void 0:f.containerStyle,emailDisplayContent:null==f?void 0:f.emailDisplayContent,emailHtmlContainerId:null==f?void 0:f.emailHtmlContainerId,applyBorderBottom:W,hidePointerEvents:H})})):g===d.WHATSAPP||g===d.RCS?t("div",Object.assign({style:Object.assign(Object.assign(Object.assign({},null==C?void 0:C.templateContainerStyles),b?v.WhatsAppWrapper:{}),{position:"relative"}),onClick:()=>{var e,t;if(E&&O){if(-1===x&&!(null===(t=null===(e=null==h?void 0:h.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length))return;E(null!=x?x:-1)}}},{children:[b?e("div",Object.assign({style:{padding:16}},{children:e(s,{children:n.convertToTitleCase(null!==(A=null==h?void 0:h.label)&&void 0!==A?A:"")})})):e(i,{}),e(c,{showSampleValues:T,showHeader:null==C?void 0:C.showWhatsAppHeader,extras:null==C?void 0:C.whatsAppExtras,template:h,size:b?"small":null!=S?S:"large",containerStyle:Object.assign(Object.assign({borderWidth:b?0:1,borderTopWidth:1},null!==(B=null==C?void 0:C.containerStyle)&&void 0!==B?B:{}),{height:"100%"}),zeroStateComponent:null==C?void 0:C.zeroStateComponent,usePlaceHolderName:null==C?void 0:C.usePlaceHolderName,carouselCardIndex:x,isWhatsappCarousel:O,isPreview:P,channel:g}),!!(null==h?void 0:h.aiContentConfigId)&&e("div",Object.assign({style:{position:"absolute",top:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:48,height:48}},{children:e(a,{width:48,height:48})}))]})):g==d.WEBPUSH?e("div",Object.assign({style:Object.assign({},null==I?void 0:I.containerStyle)},{children:e(m,{template:h,extraContainerCss:null==I?void 0:I.extraContainerCss})})):e(i,{})},v={WhatsAppWrapper:{backgroundColor:o.surface.standard,borderRadius:4,border:`1px solid ${o.background.inactive}`,marginTop:16}};export{u as TemplatePreview};
@@ -54,6 +54,7 @@ export type WhatsAppTemplate = {
54
54
  isDraft?: boolean;
55
55
  newQualityScore?: TEMPLATE_QUALITY;
56
56
  previousQualityScore?: TEMPLATE_QUALITY;
57
+ aiContentConfigId?: string;
57
58
  };
58
59
  export type WhatsappTemplateButtonTypes = 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE';
59
60
  export type CreateTemplateType = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.683-beta.0",
3
+ "version": "0.0.683-beta.ai-content-1",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",