@bcrumbs.net/bc-chat 1.0.83 → 1.0.84
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.
- package/build/index.es.js +62 -39
- package/build/index.es.js.map +1 -1
- package/build/index.js +68 -45
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -138,7 +138,7 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo a
|
|
|
138
138
|
background-color: rgba(22, 97, 108, 0.12);
|
|
139
139
|
outline: none;
|
|
140
140
|
}
|
|
141
|
-
`,Q=()=>e("svg",{width:"15",height:"16",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.2232 8.33921C6.85992 8.33921 5.54564 8.35033 5.54564 8.35033V11.3333L1.29228 6.67275L5.54564 2.00666V5.01186C5.54564 5.01186 6.93435 4.99519 7.2232 5.0063C11.146 5.1285 13.8701 9.59462 13.8879 11.6832C12.6892 10.1445 9.53958 8.33921 7.2232 8.33921ZM6.65828 3.90089V0.623508C6.67716 0.456862 6.63217 0.290241 6.50552 0.162479C6.28554 -0.0541598 5.92892 -0.0541598 5.70895 0.162479L0.160208 6.25058C0.0430006 6.36723 -0.00699451 6.51722 0.000782283 6.67275C-0.00699451 6.82273 0.0430006 6.97827 0.160208 7.09493L5.6784 13.1442C5.78061 13.2719 5.92892 13.3553 6.10168 13.3553C6.25944 13.3553 6.39997 13.2886 6.50107 13.183C6.50218 13.183 6.50441 13.183 6.50552 13.1775C6.63217 13.0553 6.67716 12.8831 6.65828 12.722C6.65828 12.722 6.66772 9.63904 6.66772 9.45018C10.3339 9.45018 13.6496 12.0887 14.3079 15.5661C14.7511 14.544 15 13.4219 15 12.2387C15 7.63375 11.2649 3.90089 6.65828 3.90089Z",fill:"#161616"})}),Y=({isMyMessage:n,createdAt:o,children:a,className:r,message:l,config:s,style:c,onReply:d,isMedia:g})=>{const h=p(l.content),u="AR"===s.language,m=l?.messageId,C=Boolean(d&&m),b=i((()=>{m&&d?.(m)}),[m,d]),f=o||l&&s&&s.isAgent===l.isAgent?t(K,{isMedia:g,isMyMessage:n,children:[l&&s&&s.isAgent===l.isAgent&&e(A,{message:l,config:s}),o&&e(y,{createdAt:o})]}):null;return t(V,{isMyMessage:n,language:s.language,className:r,style:c,children:[C?e(W,{className:"bc-replyButton",type:"button",onClick:b,isRTL:u,isMyMessage:n,children:e(Q,{})}):null,l.context&&l.context.replyToId?e(U,{context:l.context,isMyMessage:n,language:h}):null,"template"===l.type?e(H,{messageContent:l.content,isMyMessage:n,configLanguage:s.language}):null,t(G,{isMyMessage:n,isMedia:g,children:[t(J,{language:h,children:[a,g&&f]}),!g&&f]})]})},O=({message:t,config:n,searchPattern:o,onReply:i})=>{const a=n.isAgent===t.isAgent;return e(Y,{className:"bc-textMessage",isMyMessage:a,createdAt:t.createdAt,message:t,config:n,onReply:i,children:(t.content&&t.content.indexOf("\n")>-1?t.content.split("\n"):[t.content]).map(((n,i)=>{const a=o&&o.trim()?function(e,t){const n=(o=t.trim(),o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));var o;if(!n)return e;const i=new RegExp(`(${n})`,"gi");return e.replace(i,'<span style="background-color: var(--bc-chat-message-highlight-color, yellow); padding: 3px 0;">$1</span>')}(n,o):n;return e(d,{rehypePlugins:[g],skipHtml:!1,children:a},`${t.messageId}-${i}`)}))})};function q(e){if(!isFinite(e)||e<0)return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}function X({src:n}){const s=a(null),[c,d]=r(!1),[g,p]=r(!0),[h,u]=r(0),[m,C]=r(0),b=o((()=>{const e=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return()=>{t+=1831565813;let e=Math.imul(t^t>>>15,1|t);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n),t=[];for(let n=0;n<82;n++){const o=.6*Math.sin(n/82*Math.PI)+.2,i=.25*(e()-.5),a=Math.min(1,Math.max(.15,o+i));t.push(a)}return t}),[n]);l((()=>{const e=s.current;if(!e)return;const t=()=>{u(e.duration),p(!1)},n=()=>C(e.currentTime),o=()=>d(!1),i=()=>{document.querySelectorAll("video, audio").forEach((t=>{t!==e&&t.pause()})),d(!0)},a=()=>d(!1);return e.addEventListener("loadedmetadata",t),e.addEventListener("timeupdate",n),e.addEventListener("ended",o),e.addEventListener("play",i),e.addEventListener("pause",a),()=>{e.removeEventListener("loadedmetadata",t),e.removeEventListener("timeupdate",n),e.removeEventListener("ended",o),e.removeEventListener("play",i),e.removeEventListener("pause",a)}}),[n]);const f=i((()=>{const e=s.current;e&&(e.paused?e.play():e.pause())}),[]),x=i((e=>{const t=s.current;if(!t||!h)return;const n=e.currentTarget.getBoundingClientRect(),o=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width));t.currentTime=o*h,C(t.currentTime)}),[h]),v=h?Math.min(1,m/h):0;return t("div",{className:"bc-audioPlayer",role:"group","aria-label":"Audio message player",children:[e("button",{type:"button",className:"bc-audioPlayer__button "+(c?"pause":"play"),onClick:f,"aria-label":c?"Pause audio":"Play audio"}),t("div",{className:"bc-audioPlayer__wave",onClick:x,children:[e("div",{className:"bc-audioPlayer__wave--future",children:b.map(((t,n)=>e("span",{style:{height:`${Math.round(18*t)}px`}},`f-${n}`)))}),e("div",{className:"bc-audioPlayer__wave--past",style:{width:100*v+"%"},children:b.map(((t,n)=>e("span",{style:{height:`${Math.round(18*t)}px`}},`p-${n}`)))})]}),e("div",{className:"bc-audioPlayer__time","aria-live":"polite",children:g?"--:--":q(h)}),e("audio",{ref:s,src:n,preload:"metadata"})]})}const _=({message:n,config:o,onReply:s})=>{const[c,d]=r(!1),[g,p]=r(!0),h=a(null),u=i((()=>{const e=h.current;e&&console.error("Media playback error:",{src:e.src,error:e.error,networkState:e.networkState,readyState:e.readyState,messageType:n.type}),d(!0),p(!1)}),[n.type]),m=i((()=>{console.log("Media loaded successfully:",n.content),p(!1)}),[n.content]),C=i((()=>{console.log("Media can play:",n.content),p(!1)}),[n.content]),b=i((()=>{console.log("Media load started:",n.content)}),[n.content]);l((()=>{const e=()=>{document.querySelectorAll("video, audio").forEach((e=>{e!==h.current&&e.pause()}))},t=h.current;if(t){t.addEventListener("play",e),t.addEventListener("loadeddata",m),t.addEventListener("canplay",C),t.addEventListener("error",u),t.addEventListener("loadstart",b);const o=setTimeout((()=>{console.log("Loading timeout reached for:",n.content),p(!1)}),5e3);return()=>{t&&(t.removeEventListener("play",e),t.removeEventListener("loadeddata",m),t.removeEventListener("canplay",C),t.removeEventListener("error",u),t.removeEventListener("loadstart",b)),clearTimeout(o)}}}),[C,b,u,m,n.content,n.type]);const f=o.isAgent===n.isAgent;return c?t(Y,{className:"bc-mediaMessage"+("audio"===n.type?" audio":""),isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,onReply:s,children:[t("p",{style:{margin:0,color:"#666"},children:["Unable to load ","audio"===n.type?"audio":"video"," file."]}),t("a",{href:n.content,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff",textDecoration:"none"},children:["Open ","audio"===n.type?"audio":"video"," in new tab"]})]}):"audio"===n.type?e(Y,{className:"bc-mediaMessage audio",isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,style:{position:"relative"},onReply:s,children:e(X,{src:n.content})}):t(Y,{className:"bc-mediaMessage",isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,style:{position:"relative"},onReply:s,children:[e("video",{ref:h,src:n.content,controls:!0,preload:"metadata",playsInline:!0,onError:u,onLoadedData:m,onCanPlay:C,onLoadStart:b}),g&&e("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",zIndex:1},children:"Loading video..."})]})};var $={EN:{share_my_location:"Share My Location",share_my_current_location:"Share My Current Location",placeholder:"Message...",notePlaceholder:"Add your note",see_your_location:"See Your Location",location_permission:"Please give location permission",download:"Download",template_message:"Template Message",message:"Message",add_contact:"Add Contact"},AR:{share_my_location:"مشاركة موقعي",share_my_current_location:"مشاركة موقعي الحالي",placeholder:"الرسالة...",notePlaceholder:"أضف ملاحظتك",see_your_location:"رؤية موقعك",location_permission:"يرجى منح إذن الموقع",download:"تحميل",template_message:"رسالة قالب",message:"أرسل رسالة",add_contact:"إضافة جهة اتصال"},TR:{share_my_location:"Konumumu paylaş",share_my_current_location:"Güncel konumumu paylaş",placeholder:"Mesajınızı yazın",notePlaceholder:"Notunuzu ekleyin",see_your_location:"Konumunuzu Görüntüleyin",location_permission:"Lütfen konum paylaşımı için izin verin",download:"İndir",template_message:"Şablon Mesajı",message:"Mesaj",add_contact:"Kişi Ekle"}};const ee=()=>e("svg",{width:"18",height:"22",viewBox:"0 0 18 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8.56055 0.249878C9.16365 0.249377 9.64011 0.249415 10.0869 0.407104C10.1792 0.439689 10.2701 0.477175 10.3584 0.519409C10.7858 0.723899 11.1227 1.06135 11.5488 1.48816L16.4443 6.38367C16.9387 6.87712 17.3304 7.26784 17.541 7.77625C17.7515 8.28461 17.7507 8.83754 17.75 9.53601V13.0565C17.75 14.8942 17.7498 16.3499 17.5967 17.4891C17.439 18.6615 17.1067 19.61 16.3584 20.3583C15.6101 21.1066 14.6616 21.4389 13.4893 21.5966C12.3501 21.7497 10.8943 21.7499 9.05664 21.7499H8.94336C7.10571 21.7499 5.64991 21.7497 4.51074 21.5966C3.33844 21.4389 2.38991 21.1066 1.6416 20.3583C0.893309 19.61 0.560952 18.6615 0.40332 17.4891C0.25016 16.3499 0.249984 14.8942 0.25 13.0565V8.4071C0.249988 6.82577 0.250388 5.57298 0.366211 4.58093C0.485107 3.56261 0.733898 2.72281 1.30176 2.01843C1.51427 1.75486 1.755 1.51514 2.01855 1.30261C2.72296 0.734673 3.56267 0.484993 4.58105 0.366089C5.57311 0.250277 6.8259 0.249866 8.40723 0.249878H8.56055ZM8.45605 1.74988C6.81549 1.74988 5.6499 1.75086 4.75488 1.85535C3.87608 1.95795 3.35453 2.15151 2.95996 2.4696C2.77959 2.61504 2.61516 2.77947 2.46973 2.95984C2.15159 3.35441 1.95808 3.87589 1.85547 4.75476C1.75097 5.64979 1.75 6.8153 1.75 8.45593V12.9999C1.75 14.9066 1.75151 16.2613 1.88965 17.2889C2.02491 18.295 2.27897 18.8745 2.70215 19.2977C3.12536 19.7209 3.70485 19.975 4.71094 20.1102C5.73859 20.2484 7.09323 20.2499 9 20.2499C10.9068 20.2499 12.2614 20.2484 13.2891 20.1102C14.2952 19.975 14.8746 19.7209 15.2979 19.2977C15.721 18.8745 15.9751 18.295 16.1104 17.2889C16.2485 16.2613 16.25 14.9066 16.25 12.9999V9.6571C16.25 9.21922 16.2468 8.94195 16.2334 8.74988H15.9453C14.5778 8.7499 13.4753 8.7502 12.6084 8.63367C11.7083 8.51265 10.9505 8.25316 10.3486 7.65125C9.74676 7.04934 9.48722 6.29156 9.36621 5.39148C9.24969 4.52456 9.24998 3.422 9.25 2.05457V1.76355C9.08319 1.75292 8.84192 1.74988 8.45605 1.74988ZM13 15.2499C13.4142 15.2499 13.75 15.5857 13.75 15.9999C13.75 16.4141 13.4142 16.7499 13 16.7499H5C4.58579 16.7499 4.25 16.4141 4.25 15.9999C4.25 15.5857 4.58579 15.2499 5 15.2499H13ZM9 11.2499C9.41421 11.2499 9.75 11.5857 9.75 11.9999C9.75 12.4141 9.41421 12.7499 9 12.7499H5C4.58579 12.7499 4.25 12.4141 4.25 11.9999C4.25 11.5857 4.58579 11.2499 5 11.2499H9ZM10.751 2.8114C10.7546 3.82629 10.7723 4.58818 10.8535 5.19226C10.9522 5.92571 11.1325 6.31399 11.4092 6.5907C11.6859 6.86746 12.0748 7.04771 12.8086 7.14636C13.4126 7.22753 14.1738 7.24524 15.1885 7.2489L10.751 2.8114Z",fill:"#16616C"})}),te=c.a`
|
|
141
|
+
`,Q=()=>e("svg",{width:"15",height:"16",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.2232 8.33921C6.85992 8.33921 5.54564 8.35033 5.54564 8.35033V11.3333L1.29228 6.67275L5.54564 2.00666V5.01186C5.54564 5.01186 6.93435 4.99519 7.2232 5.0063C11.146 5.1285 13.8701 9.59462 13.8879 11.6832C12.6892 10.1445 9.53958 8.33921 7.2232 8.33921ZM6.65828 3.90089V0.623508C6.67716 0.456862 6.63217 0.290241 6.50552 0.162479C6.28554 -0.0541598 5.92892 -0.0541598 5.70895 0.162479L0.160208 6.25058C0.0430006 6.36723 -0.00699451 6.51722 0.000782283 6.67275C-0.00699451 6.82273 0.0430006 6.97827 0.160208 7.09493L5.6784 13.1442C5.78061 13.2719 5.92892 13.3553 6.10168 13.3553C6.25944 13.3553 6.39997 13.2886 6.50107 13.183C6.50218 13.183 6.50441 13.183 6.50552 13.1775C6.63217 13.0553 6.67716 12.8831 6.65828 12.722C6.65828 12.722 6.66772 9.63904 6.66772 9.45018C10.3339 9.45018 13.6496 12.0887 14.3079 15.5661C14.7511 14.544 15 13.4219 15 12.2387C15 7.63375 11.2649 3.90089 6.65828 3.90089Z",fill:"#161616"})}),Y=({isMyMessage:n,createdAt:o,children:a,className:r,message:l,config:s,style:c,onReply:d,isMedia:g})=>{const h=p(l.content),u="AR"===s.language,m=l?.messageId,C=Boolean(d&&m),b=i((()=>{m&&d?.(m)}),[m,d]),f=o||l&&s&&s.isAgent===l.isAgent?t(K,{isMedia:g,isMyMessage:n,children:[l&&s&&s.isAgent===l.isAgent&&e(A,{message:l,config:s}),o&&e(y,{createdAt:o})]}):null;return t(V,{isMyMessage:n,language:s.language,className:r,style:c,children:[C?e(W,{className:"bc-replyButton",type:"button",onClick:b,isRTL:u,isMyMessage:n,children:e(Q,{})}):null,l.context&&l.context.replyToId?e(U,{context:l.context,isMyMessage:n,language:h}):null,"template"===l.type?e(H,{messageContent:l.content,isMyMessage:n,configLanguage:s.language}):null,t(G,{isMyMessage:n,isMedia:g,children:[t(J,{language:h,children:[a,g&&f]}),!g&&f]})]})},O=({message:t,config:n,searchPattern:o,onReply:i})=>{const a=n.isAgent===t.isAgent;return e(Y,{className:"bc-textMessage",isMyMessage:a,createdAt:t.createdAt,message:t,config:n,onReply:i,children:(t.content&&t.content.indexOf("\n")>-1?t.content.split("\n"):[t.content]).map(((n,i)=>{const a=o&&o.trim()?function(e,t){const n=(o=t.trim(),o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));var o;if(!n)return e;const i=new RegExp(`(${n})`,"gi");return e.replace(i,'<span style="background-color: var(--bc-chat-message-highlight-color, yellow); padding: 3px 0;">$1</span>')}(n,o):n;return e(d,{rehypePlugins:[g],skipHtml:!1,children:a},`${t.messageId}-${i}`)}))})};function q(e){if(!isFinite(e)||e<0)return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}function X({src:n}){const s=a(null),[c,d]=r(!1),[g,p]=r(!0),[h,u]=r(0),[m,C]=r(0),b=o((()=>{const e=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return()=>{t+=1831565813;let e=Math.imul(t^t>>>15,1|t);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n),t=[];for(let n=0;n<82;n++){const o=.6*Math.sin(n/82*Math.PI)+.2,i=.25*(e()-.5),a=Math.min(1,Math.max(.15,o+i));t.push(a)}return t}),[n]);l((()=>{const e=s.current;if(!e)return;const t=()=>{u(e.duration),p(!1)},n=()=>C(e.currentTime),o=()=>d(!1),i=()=>{document.querySelectorAll("video, audio").forEach((t=>{t!==e&&t.pause()})),d(!0)},a=()=>d(!1);return e.addEventListener("loadedmetadata",t),e.addEventListener("timeupdate",n),e.addEventListener("ended",o),e.addEventListener("play",i),e.addEventListener("pause",a),()=>{e.removeEventListener("loadedmetadata",t),e.removeEventListener("timeupdate",n),e.removeEventListener("ended",o),e.removeEventListener("play",i),e.removeEventListener("pause",a)}}),[n]);const f=i((()=>{const e=s.current;e&&(e.paused?e.play():e.pause())}),[]),x=i((e=>{const t=s.current;if(!t||!h)return;const n=e.currentTarget.getBoundingClientRect(),o=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width));t.currentTime=o*h,C(t.currentTime)}),[h]),v=h?Math.min(1,m/h):0;return t("div",{className:"bc-audioPlayer",role:"group","aria-label":"Audio message player",children:[e("button",{type:"button",className:"bc-audioPlayer__button "+(c?"pause":"play"),onClick:f,"aria-label":c?"Pause audio":"Play audio"}),t("div",{className:"bc-audioPlayer__wave",onClick:x,children:[e("div",{className:"bc-audioPlayer__wave--future",children:b.map(((t,n)=>e("span",{style:{height:`${Math.round(18*t)}px`}},`f-${n}`)))}),e("div",{className:"bc-audioPlayer__wave--past",style:{width:100*v+"%"},children:b.map(((t,n)=>e("span",{style:{height:`${Math.round(18*t)}px`}},`p-${n}`)))})]}),e("div",{className:"bc-audioPlayer__time","aria-live":"polite",children:g?"--:--":q(h)}),e("audio",{ref:s,src:n,preload:"metadata"})]})}const _=({message:n,config:o,onReply:s})=>{const[c,d]=r(!1),[g,p]=r(!0),h=a(null),u=i((()=>{const e=h.current;e&&console.error("Media playback error:",{src:e.src,error:e.error,networkState:e.networkState,readyState:e.readyState,messageType:n.type}),d(!0),p(!1)}),[n.type]),m=i((()=>{console.log("Media loaded successfully:",n.content),p(!1)}),[n.content]),C=i((()=>{console.log("Media can play:",n.content),p(!1)}),[n.content]),b=i((()=>{console.log("Media load started:",n.content)}),[n.content]);l((()=>{const e=()=>{document.querySelectorAll("video, audio").forEach((e=>{e!==h.current&&e.pause()}))},t=h.current;if(t){t.addEventListener("play",e),t.addEventListener("loadeddata",m),t.addEventListener("canplay",C),t.addEventListener("error",u),t.addEventListener("loadstart",b);const o=setTimeout((()=>{console.log("Loading timeout reached for:",n.content),p(!1)}),5e3);return()=>{t&&(t.removeEventListener("play",e),t.removeEventListener("loadeddata",m),t.removeEventListener("canplay",C),t.removeEventListener("error",u),t.removeEventListener("loadstart",b)),clearTimeout(o)}}}),[C,b,u,m,n.content,n.type]);const f=o.isAgent===n.isAgent;return c?t(Y,{className:"bc-mediaMessage"+("audio"===n.type?" audio":""),isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,onReply:s,children:[t("p",{style:{margin:0,color:"#666"},children:["Unable to load ","audio"===n.type?"audio":"video"," file."]}),t("a",{href:n.content,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff",textDecoration:"none"},children:["Open ","audio"===n.type?"audio":"video"," in new tab"]})]}):"audio"===n.type?e(Y,{className:"bc-mediaMessage audio",isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,style:{position:"relative"},onReply:s,children:e(X,{src:n.content})}):t(Y,{className:"bc-mediaMessage",isMyMessage:f,isMedia:!0,createdAt:n.createdAt,message:n,config:o,style:{position:"relative"},onReply:s,children:[e("video",{ref:h,src:n.content,controls:!0,preload:"metadata",playsInline:!0,onError:u,onLoadedData:m,onCanPlay:C,onLoadStart:b}),g&&e("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",zIndex:1},children:"Loading video..."})]})};var $={EN:{share_my_location:"Share My Location",share_my_current_location:"Share My Current Location",placeholder:"Message...",notePlaceholder:"Add your note",see_your_location:"See Your Location",location_permission:"Please give location permission",download:"Download",template_message:"Template Message",message:"Message",add_contact:"Add Contact",autoCompleteAcceptHint:"Press Tab or the Right arrow key to insert the full suggestion."},AR:{share_my_location:"مشاركة موقعي",share_my_current_location:"مشاركة موقعي الحالي",placeholder:"الرسالة...",notePlaceholder:"أضف ملاحظتك",see_your_location:"رؤية موقعك",location_permission:"يرجى منح إذن الموقع",download:"تحميل",template_message:"رسالة قالب",message:"أرسل رسالة",add_contact:"إضافة جهة اتصال",autoCompleteAcceptHint:"اضغط Tab أو مفتاح السهم الأيمن لإدراج الاقتراح كاملًا."},TR:{share_my_location:"Konumumu paylaş",share_my_current_location:"Güncel konumumu paylaş",placeholder:"Mesajınızı yazın",notePlaceholder:"Notunuzu ekleyin",see_your_location:"Konumunuzu Görüntüleyin",location_permission:"Lütfen konum paylaşımı için izin verin",download:"İndir",template_message:"Şablon Mesajı",message:"Mesaj",add_contact:"Kişi Ekle",autoCompleteAcceptHint:"Tam öneriyi eklemek için Tab veya Sağ ok tuşuna basın."}};const ee=()=>e("svg",{width:"18",height:"22",viewBox:"0 0 18 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8.56055 0.249878C9.16365 0.249377 9.64011 0.249415 10.0869 0.407104C10.1792 0.439689 10.2701 0.477175 10.3584 0.519409C10.7858 0.723899 11.1227 1.06135 11.5488 1.48816L16.4443 6.38367C16.9387 6.87712 17.3304 7.26784 17.541 7.77625C17.7515 8.28461 17.7507 8.83754 17.75 9.53601V13.0565C17.75 14.8942 17.7498 16.3499 17.5967 17.4891C17.439 18.6615 17.1067 19.61 16.3584 20.3583C15.6101 21.1066 14.6616 21.4389 13.4893 21.5966C12.3501 21.7497 10.8943 21.7499 9.05664 21.7499H8.94336C7.10571 21.7499 5.64991 21.7497 4.51074 21.5966C3.33844 21.4389 2.38991 21.1066 1.6416 20.3583C0.893309 19.61 0.560952 18.6615 0.40332 17.4891C0.25016 16.3499 0.249984 14.8942 0.25 13.0565V8.4071C0.249988 6.82577 0.250388 5.57298 0.366211 4.58093C0.485107 3.56261 0.733898 2.72281 1.30176 2.01843C1.51427 1.75486 1.755 1.51514 2.01855 1.30261C2.72296 0.734673 3.56267 0.484993 4.58105 0.366089C5.57311 0.250277 6.8259 0.249866 8.40723 0.249878H8.56055ZM8.45605 1.74988C6.81549 1.74988 5.6499 1.75086 4.75488 1.85535C3.87608 1.95795 3.35453 2.15151 2.95996 2.4696C2.77959 2.61504 2.61516 2.77947 2.46973 2.95984C2.15159 3.35441 1.95808 3.87589 1.85547 4.75476C1.75097 5.64979 1.75 6.8153 1.75 8.45593V12.9999C1.75 14.9066 1.75151 16.2613 1.88965 17.2889C2.02491 18.295 2.27897 18.8745 2.70215 19.2977C3.12536 19.7209 3.70485 19.975 4.71094 20.1102C5.73859 20.2484 7.09323 20.2499 9 20.2499C10.9068 20.2499 12.2614 20.2484 13.2891 20.1102C14.2952 19.975 14.8746 19.7209 15.2979 19.2977C15.721 18.8745 15.9751 18.295 16.1104 17.2889C16.2485 16.2613 16.25 14.9066 16.25 12.9999V9.6571C16.25 9.21922 16.2468 8.94195 16.2334 8.74988H15.9453C14.5778 8.7499 13.4753 8.7502 12.6084 8.63367C11.7083 8.51265 10.9505 8.25316 10.3486 7.65125C9.74676 7.04934 9.48722 6.29156 9.36621 5.39148C9.24969 4.52456 9.24998 3.422 9.25 2.05457V1.76355C9.08319 1.75292 8.84192 1.74988 8.45605 1.74988ZM13 15.2499C13.4142 15.2499 13.75 15.5857 13.75 15.9999C13.75 16.4141 13.4142 16.7499 13 16.7499H5C4.58579 16.7499 4.25 16.4141 4.25 15.9999C4.25 15.5857 4.58579 15.2499 5 15.2499H13ZM9 11.2499C9.41421 11.2499 9.75 11.5857 9.75 11.9999C9.75 12.4141 9.41421 12.7499 9 12.7499H5C4.58579 12.7499 4.25 12.4141 4.25 11.9999C4.25 11.5857 4.58579 11.2499 5 11.2499H9ZM10.751 2.8114C10.7546 3.82629 10.7723 4.58818 10.8535 5.19226C10.9522 5.92571 11.1325 6.31399 11.4092 6.5907C11.6859 6.86746 12.0748 7.04771 12.8086 7.14636C13.4126 7.22753 14.1738 7.24524 15.1885 7.2489L10.751 2.8114Z",fill:"#16616C"})}),te=c.a`
|
|
142
142
|
${e=>e.isMyMessage?"flex-direction: row;":"flex-direction: row-reverse;"}
|
|
143
143
|
min-width: 300px;
|
|
144
144
|
display: flex;
|
|
@@ -419,11 +419,8 @@ i {
|
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
.bc-autoCompleteOverlay {
|
|
422
|
-
position:
|
|
423
|
-
|
|
424
|
-
left: 0;
|
|
425
|
-
right: 0;
|
|
426
|
-
bottom: 0;
|
|
422
|
+
position: absolute;
|
|
423
|
+
inset: 0;
|
|
427
424
|
pointer-events: none;
|
|
428
425
|
padding: 10px 0;
|
|
429
426
|
font-family: var(--bc-chat-font-stack);
|
|
@@ -444,14 +441,40 @@ i {
|
|
|
444
441
|
direction: rtl;
|
|
445
442
|
}
|
|
446
443
|
}
|
|
447
|
-
`,tt=
|
|
448
|
-
|
|
444
|
+
`,tt=c.div`
|
|
445
|
+
position: relative;
|
|
446
|
+
width: 100%;
|
|
447
|
+
`,nt=()=>e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:e("path",{d:"M15 18l-6-6 6-6v4h8v4h-8v4zM5 6v12h2V6H5z",fill:"currentColor"})}),ot=c.div`
|
|
448
|
+
display: flex;
|
|
449
|
+
align-items: center;
|
|
450
|
+
gap: 6px;
|
|
451
|
+
margin-top: 4px;
|
|
452
|
+
padding-inline-end: 4px;
|
|
453
|
+
max-width: 100%;
|
|
454
|
+
color: #b0b8c1;
|
|
455
|
+
pointer-events: none;
|
|
456
|
+
`,it=c.span`
|
|
457
|
+
font-family: var(--bc-chat-font-stack);
|
|
458
|
+
font-size: 11px;
|
|
459
|
+
font-weight: 400;
|
|
460
|
+
line-height: 1.35;
|
|
461
|
+
color: #b0b8c1;
|
|
462
|
+
flex: 1;
|
|
463
|
+
min-width: 0;
|
|
464
|
+
`,at=c.span`
|
|
465
|
+
flex-shrink: 0;
|
|
466
|
+
display: flex;
|
|
467
|
+
align-items: center;
|
|
468
|
+
justify-content: center;
|
|
469
|
+
color: #c5cdd6;
|
|
470
|
+
`,rt=({text:n,setText:o,config:r,send:s,placeholder:c,autoCompleteEnabled:d,autoCompleteSuggestion:g,onInputChange:p,onAutoCompleteMutate:h})=>{const u=a(null),m="AR"===r?.language,C=i((()=>{const e=u.current;if(!e)return;e.style.height="20px";const t=e.scrollHeight;t!==e.offsetHeight&&(e.style.height=t+"px")}),[]);l((()=>{n||(C(),u.current?.focus())}),[C,n]),l((()=>{d&&u.current&&u.current.focus()}),[d,g]);const b=Boolean(d&&g),f=$[r.language]?.autoCompleteAcceptHint??$.EN.autoCompleteAcceptHint;return t(et,{isRTL:m,children:[t(tt,{children:[e("textarea",{ref:u,value:n,className:"bc-messageInputTextArea",id:"textInput",placeholder:c,maxLength:1024,dir:m?"rtl":"ltr",onKeyDown:e=>{if(d&&g&&("Tab"===e.key||"ArrowRight"===e.key&&!e.shiftKey)){e.preventDefault();const t=(n||"")+g;return o(t),C(),p?.(t),void h?.(null)}if("Enter"===e.key&&(e.shiftKey||e.ctrlKey||e.altKey)){e.preventDefault();const t=u.current?.selectionStart||0,i=n.slice(0,t)+"\n"+n.slice(t);return o(i),C(),void p?.(i)}"Enter"===e.key&&(e.preventDefault(),s(),C())},onChange:e=>{const t=e.target.value,i=n||"";if(o(t),C(),p?.(t),d&&g&&h){const e=i+g;if(t&&e.toLowerCase().startsWith(t.toLowerCase())){const n=e.slice(t.length);n.length>0?h(n):h(null)}else h(null)}},style:{color:b?"transparent":void 0}}),b&&t("div",{className:"bc-autoCompleteOverlay",children:[n,e("span",{className:"bc-suggestion",children:g})]})]}),b&&t(ot,{children:[e(at,{children:e(nt,{})}),e(it,{children:f})]})]})},lt=({config:n,send:o,file:i,isFileSelected:a,text:r,setText:l,cancelFileUpload:s,noteMode:c,onCloseNoteMode:d,notePlaceholder:g,autoCompleteEnabled:p,autoCompleteSuggestion:h,onInputChange:u,onAutoCompleteMutate:m})=>{const C="AR"===n?.language,b=Array.isArray(i)?i:i?[i]:[],f=b.length>0;return t("div",{className:"bc-messageInput "+(C?"bc-RTL":""),children:[c?e(Ye,{onClick:d,isRTL:C,children:e(Xe,{})}):null,f?e(_e,{children:b.map(((t,o)=>e($e,{file:t,isFileSelected:a,cancelFileUpload:s,config:n},`${t.fileName}-${o}-${t.fileUrl}`)))}):null,f?null:e(rt,{text:r||"",setText:l,config:n,send:o,placeholder:c?g||$[n.language]?.notePlaceholder:n.inputPlaceholder||$[n.language]?.placeholder,autoCompleteEnabled:p,autoCompleteSuggestion:h,onInputChange:u,onAutoCompleteMutate:m}),e(Qe,{onClick:()=>o(),isRTL:C,children:r||f?e(Oe,{}):null})]})},st=(e,t)=>`\n &:hover {\n background-image: ${e.replaceAll("%23a3a3a3",t.activeColor)};\n }\n background-image: ${t.isActive?e.replaceAll("%23a3a3a3",t.activeColor):e};\n`,ct="\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: 4px;\nborder-radius: 8px;\nborder: 1px solid #D2D6DB;\nbackground: #FFF;\ntransition: background-color 0.2s ease, border-color 0.2s ease;\ncursor: pointer;\nfont-size: 14px;\n&:hover {\n background: #f7f7f7;\n border-color: #dcdcdc;\n}\n&:active {\n background: #f0f0f0;\n}\n";c.button`
|
|
471
|
+
${ct}
|
|
449
472
|
height: 32px;
|
|
450
473
|
min-height: 32px;
|
|
451
474
|
max-height: 32px;
|
|
452
475
|
padding: 0 12px;
|
|
453
|
-
`;const
|
|
454
|
-
${
|
|
476
|
+
`;const dt=c.label`
|
|
477
|
+
${ct}
|
|
455
478
|
width: 32px;
|
|
456
479
|
height: 32px;
|
|
457
480
|
min-width: 32px;
|
|
@@ -459,30 +482,30 @@ i {
|
|
|
459
482
|
min-height: 32px;
|
|
460
483
|
max-height: 32px;
|
|
461
484
|
padding: 0;
|
|
462
|
-
`,
|
|
463
|
-
${e=>
|
|
464
|
-
`,
|
|
485
|
+
`,gt=c.i`
|
|
486
|
+
${e=>st('url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2218%22%20viewBox%3D%220%200%2016%2018%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M14.667%207.54199C15.012%207.54217%2015.292%207.82192%2015.292%208.16699C15.2918%2011.9834%2012.3594%2015.1146%208.625%2015.4316V16.708H10.5C10.8451%2016.708%2011.1248%2016.988%2011.125%2017.333C11.125%2017.6782%2010.8452%2017.958%2010.5%2017.958H5.5C5.15482%2017.958%204.875%2017.6782%204.875%2017.333C4.87518%2016.988%205.15493%2016.708%205.5%2016.708H7.375V15.4316C3.64062%2015.1146%200.708174%2011.9834%200.708008%208.16699C0.708008%207.82192%200.98798%207.54217%201.33301%207.54199C1.67819%207.54199%201.95801%207.82181%201.95801%208.16699C1.95818%2011.5036%204.66339%2014.208%208%2014.208C11.3366%2014.208%2014.0418%2011.5036%2014.042%208.16699C14.042%207.82181%2014.3218%207.54199%2014.667%207.54199ZM8%200.0419922C10.6463%200.0419922%2012.7918%202.18679%2012.792%204.83301V8.16699C12.7918%2010.8132%2010.6463%2012.958%208%2012.958C5.35374%2012.958%203.20818%2010.8132%203.20801%208.16699V4.83301C3.20818%202.18679%205.35374%200.0419924%208%200.0419922ZM8%201.29199C6.0441%201.29199%204.45818%202.87715%204.45801%204.83301V8.16699C4.45818%2010.1229%206.0441%2011.708%208%2011.708C9.74256%2011.708%2011.1899%2010.4496%2011.4854%208.79199H9.66699C9.32192%208.79199%209.04217%208.51202%209.04199%208.16699C9.04199%207.82181%209.32181%207.54199%209.66699%207.54199H11.542V5.45801H9.66699C9.32181%205.45801%209.04199%205.17819%209.04199%204.83301C9.04217%204.48798%209.32192%204.20801%209.66699%204.20801H11.4854C11.1899%202.55035%209.74256%201.29199%208%201.29199Z%22%20fill%3D%22%23161616%22%2F%3E%3C%2Fsvg%3E");',e)}
|
|
487
|
+
`,pt=c.div`
|
|
465
488
|
${e=>e.isRecording&&`\n &:before {\n transform: scale(${1+e.audioLevel/255});\n opacity: ${.6+e.audioLevel/255*.4};\n }\n `}
|
|
466
|
-
`,
|
|
489
|
+
`,ht=c.span`
|
|
467
490
|
display: inline-flex;
|
|
468
491
|
align-items: center;
|
|
469
492
|
justify-content: center;
|
|
470
493
|
|
|
471
494
|
${e=>e.isRTL&&"\n svg {\n transform: scaleX(-1);\n }\n "}
|
|
472
|
-
`,
|
|
495
|
+
`,ut=({isRTL:t})=>e(ht,{isRTL:t,children:e("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M1.20308 1.04312C1.00481 0.954998 0.772341 1.0048 0.627577 1.16641C0.482813 1.32802 0.458794 1.56455 0.568117 1.75196L3.92115 7.50002L0.568117 13.2481C0.458794 13.4355 0.482813 13.672 0.627577 13.8336C0.772341 13.9952 1.00481 14.045 1.20308 13.9569L14.7031 7.95693C14.8836 7.87668 15 7.69762 15 7.50002C15 7.30243 14.8836 7.12337 14.7031 7.04312L1.20308 1.04312ZM4.84553 7.10002L2.21234 2.586L13.2689 7.50002L2.21234 12.414L4.84552 7.90002H9C9.22092 7.90002 9.4 7.72094 9.4 7.50002C9.4 7.27911 9.22092 7.10002 9 7.10002H4.84553Z",fill:"#666",fillRule:"evenodd",clipRule:"evenodd"})})}),mt=()=>e("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M12.8536 2.85355C13.0488 2.65829 13.0488 2.34171 12.8536 2.14645C12.6583 1.95118 12.3417 1.95118 12.1464 2.14645L7.5 6.79289L2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.79289 7.5L2.14645 12.1464C1.95118 12.3417 1.95118 12.6583 2.14645 12.8536C2.34171 13.0488 2.65829 13.0488 2.85355 12.8536L7.5 8.20711L12.1464 12.8536C12.3417 13.0488 12.6583 13.0488 12.8536 12.8536C13.0488 12.6583 13.0488 12.3417 12.8536 12.1464L8.20711 7.5L12.8536 2.85355Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),Ct={sampleRate:48e3,channelCount:1,sampleSize:128,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,googEchoCancellation:!0,googAutoGainControl:!0,googNoiseSuppression:!0,googHighpassFilter:!0,googTypingNoiseDetection:!0,googAudioMirroring:!1},bt=c.div`
|
|
473
496
|
display: flex;
|
|
474
497
|
align-items: center;
|
|
475
498
|
gap: 5px;
|
|
476
499
|
direction: ${e=>e.isRTL?"rtl":"ltr"};
|
|
477
|
-
`,
|
|
478
|
-
${e=>
|
|
479
|
-
`,
|
|
500
|
+
`,ft=({setProgress:o,setError:s,setFile:c,onActiveChange:d,config:g})=>{const p="AR"===g?.language,[h,u]=r(!1),[m,C]=r(0),b=a(null),f=a(null),x=a(null),v=a(null),y=a(null),w=a(null);l((()=>{const e=document.createElement("script");return e.src="https://unpkg.com/mic-recorder-to-mp3",e.async=!0,e.onload=()=>console.log("Voice recording library loaded successfully"),e.onerror=()=>{console.error("Failed to load voice recording library"),s("Failed to load voice recording library. Please refresh the page.")},document.body.appendChild(e),()=>{document.body.contains(e)&&document.body.removeChild(e)}}),[s]);const M=i((e=>{try{if(!e.active)return void navigator.mediaDevices.getUserMedia({audio:Ct}).then((e=>{f.current=e,M(e)})).catch((e=>{console.error("Failed to get fresh stream:",e)}));x.current=new(window.AudioContext||window.webkitAudioContext),"suspended"===x.current.state&&x.current.resume().then((()=>{}));const t=x.current.createMediaStreamSource(e);v.current=x.current.createAnalyser(),v.current.fftSize=256,v.current.smoothingTimeConstant=.8,v.current.minDecibels=-90,v.current.maxDecibels=-10,t.connect(v.current);const n=v.current.frequencyBinCount;y.current=new Uint8Array(n);const o=()=>{if(!v.current)return;v.current.getByteFrequencyData(y.current);let e=0;for(let t=0;t<n;t++)e+=y.current[t]*y.current[t];const t=Math.sqrt(e/n),i=Math.min(255,2*t);C(i),w.current=requestAnimationFrame(o)};o()}catch(e){console.error("Audio level monitoring error:",e)}}),[]),A=i((()=>{w.current&&(cancelAnimationFrame(w.current),w.current=null),x.current&&(x.current.close(),x.current=null),C(0)}),[]),k=i((()=>{f.current&&(f.current.getTracks().forEach((e=>{e.stop()})),f.current=null)}),[]);l((()=>()=>{b.current&&h&&b.current.stop(),k(),A()}),[h,A,k]);const L=i((()=>{if(!b.current){if("function"!=typeof MicRecorder)return void s("Please wait a little until voice library is loaded");b.current=new MicRecorder({bitRate:128,sampleRate:48e3})}s(void 0),h?b.current.stop().getMp3().then((([e,t])=>{if(u(!1),A(),k(),d&&d(!0),t.size<1e3)return void s("Recording seems too short. Please try again.");if(!t||0===t.size)return void s("Invalid audio recording. Please try again.");const n=(new Date).toISOString().replace(/[:.]/g,"-"),o=new File([t],`recording-${n}.mp3`,{type:"audio/mpeg"}),i=URL.createObjectURL(o);c({fileUrl:i,fileName:`recording-${n}.mp3`,extension:"mp3",blob:o}),d&&d(!1)})).catch((e=>{u(!1),A(),k(),s(`Recording failed: ${e.message}`),d&&d(!1)})):navigator.mediaDevices.getUserMedia({audio:Ct}).then((e=>{f.current=e,b.current.start().then((()=>{u(!0),d&&d(!0),setTimeout((()=>{x.current&&"suspended"===x.current.state?x.current.resume().then((()=>{M(e)})).catch((t=>{console.error("Failed to resume audio context:",t),M(e)})):M(e)}),100)})).catch((t=>{s(`Failed to start recording: ${t.message}`),e.getTracks().forEach((e=>e.stop())),d&&d(!1)}))})).catch((e=>{"NotAllowedError"===e.name?s("Microphone access denied. Please allow microphone access and try again."):"NotFoundError"===e.name?s("No microphone found. Please connect a microphone and try again."):s(`Microphone error: ${e.message}`),d&&d(!1)}))}),[h,s,c,M,A,k,d]),I=i((()=>{b.current&&h&&b.current.stop(),u(!1),A(),k(),s(void 0),d&&d(!1)}),[h,A,k,s,d]);return t(bt,{isRTL:p&&h,children:[h?e(dt,{onClick:I,children:e(mt,{})}):null,e(dt,{onClick:L,id:"voiceRecorderIcon",className:"mic-container",children:h?t(n,{children:[e(ut,{isRTL:p}),e(pt,{className:"circle "+(h?"active":""),isRecording:h,audioLevel:m})]}):e(gt,{activeColor:"var(--bc-chat-text-secondary-dark)"})})]})};const xt=c.i`
|
|
501
|
+
${e=>st('url("data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M10%2019.084C15.0163%2019.0838%2019.0838%2015.0163%2019.084%2010C19.0838%204.98367%2015.0163%200.917168%2010%200.916992C4.98367%200.917168%200.917168%204.98367%200.916992%2010C0.917168%2015.0163%204.98367%2019.0838%2010%2019.084ZM10%2017.584C5.8121%2017.5838%202.41717%2014.1879%202.41699%2010C2.41717%205.8121%205.8121%202.41717%2010%202.41699C14.1879%202.41717%2017.5838%205.8121%2017.584%2010C17.5838%2014.1879%2014.1879%2017.5838%2010%2017.584ZM6.6748%208.5C7.22679%208.49964%207.6748%208.05206%207.6748%207.5C7.6748%206.94794%207.22679%206.50036%206.6748%206.5H6.66699C6.11471%206.5%205.66699%206.94771%205.66699%207.5C5.66699%208.05229%206.11471%208.5%206.66699%208.5H6.6748ZM13.334%208.5C13.886%208.49965%2014.334%208.05207%2014.334%207.5C14.334%206.94793%2013.886%206.50035%2013.334%206.5H13.3262C12.7739%206.50001%2012.3262%206.94772%2012.3262%207.5C12.3262%208.05228%2012.7739%208.49999%2013.3262%208.5H13.334ZM10%2014.917C11.6088%2014.9169%2013.038%2014.1426%2013.9336%2012.9502C14.1819%2012.6191%2014.115%2012.1491%2013.7842%2011.9004C13.453%2011.6517%2012.9832%2011.7188%2012.7344%2012.0498C12.1099%2012.8813%2011.117%2013.4169%2010%2013.417C8.88307%2013.4169%207.89111%2012.8811%207.2666%2012.0498C7.01792%2011.7187%206.54798%2011.6519%206.2168%2011.9004C5.88563%2012.1491%205.81871%2012.619%206.06738%2012.9502C6.96298%2014.1425%208.39126%2014.9169%2010%2014.917Z%22%20fill%3D%22%23161616%22%2F%3E%3C%2Fsvg%3E");',e)}
|
|
502
|
+
`,vt=c.span`
|
|
480
503
|
margin: 8px;
|
|
481
504
|
cursor: pointer;
|
|
482
505
|
font-size: var(--bc-chat-fontSize-xl);
|
|
483
|
-
`,
|
|
484
|
-
${e=>
|
|
485
|
-
`,
|
|
506
|
+
`,yt=({onClick:t})=>e("div",{id:"emojiIcon",children:e(dt,{children:e(xt,{onClick:t,activeColor:"var(--bc-chat-text-secondary-dark)"})})}),wt=({text:t,setText:n,onClick:o})=>{const r=function(e){const t=a(null);return l((()=>{const n=n=>{t.current&&!t.current.contains(n.target)&&e()};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}}),[e]),t}(o),s=i((e=>{n(t+e)}),[n,t]),c=f.map(((t,n)=>e(vt,{className:"emoji",onClick:e=>s(e.target.innerText),children:t},"emoji"+n)));return e("div",{ref:r,children:e("div",{className:"bc-emojiPicker",id:"emojiPicker",children:c})})},Mt=c.i`
|
|
507
|
+
${e=>st('url("data:image/svg+xml,%3Csvg%20width%3D%2214%22%20height%3D%2218%22%20viewBox%3D%220%200%2014%2018%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.91667%202.12488C2.96066%202.12488%201.375%203.71054%201.375%205.66655L1.375%2010.2499C1.375%2013.3565%203.8934%2015.8749%207%2015.8749C10.1066%2015.8749%2012.625%2013.3565%2012.625%2010.2499V8.99993C12.625%208.65475%2012.9048%208.37493%2013.25%208.37493C13.5952%208.37493%2013.875%208.65475%2013.875%208.99993V10.2499C13.875%2014.0469%2010.797%2017.1249%207%2017.1249C3.20304%2017.1249%200.125%2014.0469%200.125%2010.2499L0.125%205.66655C0.125%203.02018%202.2703%200.874878%204.91667%200.874878C7.56303%200.874878%209.70833%203.02018%209.70833%205.66654V10.2499C9.70833%2011.7456%208.49577%2012.9582%207%2012.9582C5.50423%2012.9582%204.29167%2011.7456%204.29167%2010.2499L4.29167%206.91654C4.29167%206.57137%204.57149%206.29154%204.91667%206.29154C5.26184%206.29154%205.54167%206.57137%205.54167%206.91654L5.54167%2010.2499C5.54167%2011.0553%206.19458%2011.7082%207%2011.7082C7.80542%2011.7082%208.45833%2011.0553%208.45833%2010.2499V5.66654C8.45833%203.71054%206.87267%202.12488%204.91667%202.12488Z%22%20fill%3D%22%23161616%22%2F%3E%3C%2Fsvg%3E");',e)}
|
|
508
|
+
`,At=({setProgress:n,setFile:o,setError:a})=>{const r=i((e=>{a(void 0);const t=Array.from(e.target.files);if(e.target.value="",t.length<1)return;const i=[];for(const e of t){const{name:t,size:n}=e,o=t.substring(t.lastIndexOf(".")+1).toLowerCase();if(C.SupportedFormats.indexOf(o)<0){a(`File "${t}" type is not valid.`);continue}if(n>C.MaxFileSize){a(`File "${t}" exceeds maximum limit of 20 MBs.`);continue}const r={fileUrl:URL.createObjectURL(e),fileName:t,extension:o,blob:e};i.push({file:e,bcFile:r})}if(0===i.length)return;o((e=>[...e,...i.map((({bcFile:e})=>e))]));let r=0;const l=[];i.forEach((({file:e,bcFile:t})=>{We(e,n,((e,s)=>{if(r++,e){try{URL.revokeObjectURL(t.fileUrl)}catch{}const n={...t,fileUrl:e,blob:void 0};l.push(n),o((e=>e.map((e=>e.fileName===t.fileName&&e.fileUrl===t.fileUrl?n:e))))}else s&&(o((e=>{const n=e.filter((e=>!(e.fileName===t.fileName&&e.fileUrl===t.fileUrl)));try{URL.revokeObjectURL(t.fileUrl)}catch{}return n})),a(`Failed to upload "${t.fileName}": ${s}`));r===i.length&&n(0)}))}))}),[n,o,a]),l=i((()=>{a(void 0)}),[a]);return t("div",{id:"attachIcon",children:[e(dt,{htmlFor:"fileInput",onClick:l,children:e(Mt,{activeColor:"var(--bc-chat-text-secondary-dark)"})}),e("input",{type:"file",className:"bc-fileUpload",id:"fileInput",multiple:!0,onChange:r,onClick:l})]})},kt=c.div`
|
|
486
509
|
padding: 0px 0px 0px 10px;
|
|
487
510
|
margin: 0px;
|
|
488
511
|
width: fit-content;
|
|
@@ -501,7 +524,7 @@ i {
|
|
|
501
524
|
cursor: pointer;
|
|
502
525
|
display: block;
|
|
503
526
|
}
|
|
504
|
-
`,
|
|
527
|
+
`,Lt=({setView:o,setFile:i,setProgress:a,setError:l,text:s,setText:c,send:d,config:g})=>{const[p,h]=r(!1),[u,m]=r(!1);return t("div",{className:"bc-inputActions",id:"bc-inputActions",children:[t(kt,{id:"iconsContainer",isRTL:"AR"===g?.language,children:[u?null:t(n,{children:[e(At,{setFile:i,setProgress:a,setError:l}),e(yt,{onClick:()=>h(!0)})]}),e(ft,{setFile:i,setError:l,setProgress:a,onActiveChange:e=>{m(e),e&&h(!1)},config:g})]}),p?e(wt,{text:s,setText:c,onClick:()=>h(!1)}):null]})};Re('.bc-trademark {\n height: 40px;\n width: 100%;\n box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.1);\n background-color: #fff;\n overflow-y: hidden;\n border-bottom-left-radius: 15px;\n border-bottom-right-radius: 15px;\n padding: 15px 0;\n}\n\n.bc-messageInput {\n min-height: 30px;\n max-height: 100%;\n background-color: #fff;\n overflow-y: hidden;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.bc-messageInput .bc-messageInputTextArea {\n color: var(--bc-chat-text-secondary-dark);\n display: block;\n min-height: 36px;\n background-color: #fff;\n box-sizing: border-box;\n font-family: var(--bc-chat-font-stack);\n font-size: var(--bc-chat-fontSize-md);\n padding: 10px 0;\n resize: none;\n overflow: auto;\n border-width: 0;\n width: calc(100% - 20px);\n word-wrap: break-word;\n border: none;\n overflow: hidden;\n outline: none;\n -webkit-box-shadow: none;\n -moz-box-shadow: none;\n box-shadow: none;\n}\n.bc-messageInput.bc-RTL {\n direction: rtl;\n}\n\n.bc-inputActions {\n display: flex;\n align-items: center;\n position: relative;\n width: fit-content;\n height: 36px;\n margin-left: auto;\n}\n.bc-inputActions .bc-fileUpload {\n display: none;\n}\n.bc-inputActions i {\n display: block;\n margin: 0 5px;\n}\n.bc-inputActions.bc-RTL {\n direction: rtl;\n}\n\n.bc-ActionChips {\n display: flex;\n gap: 10px;\n}\n\n.bc-BottomBar {\n width: 100%;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-top: 8px;\n}\n.bc-BottomBar.bc-RTL {\n direction: rtl;\n}\n\n.bc-CommandsArea {\n margin-left: auto;\n display: flex;\n align-items: center;\n}\n.bc-CommandsArea.bc-RTL {\n margin-left: 0;\n margin-right: auto;\n direction: rtl;\n}\n\n.bc-emojiPicker {\n position: absolute;\n bottom: 40px;\n right: 0;\n width: 200px;\n background: var(--bc-chat-white-color) 0% 0% no-repeat padding-box;\n box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1019607843);\n border-radius: 10px;\n opacity: 1;\n padding: 10px;\n z-index: 10;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n}\n[dir=rtl] .bc-emojiPicker, .bc-RTL .bc-emojiPicker {\n right: auto;\n left: 0;\n}\n\n.bc-uploadFileDetails {\n background-color: transparent;\n display: flex;\n align-items: center;\n width: calc(100% - 60px);\n height: 40px;\n padding: 4px 10px;\n}\n.bc-uploadFileDetails.bc-RTL {\n direction: rtl;\n}\n.bc-uploadFileDetails audio {\n width: 260px;\n}\n.bc-uploadFileDetails .bc-uploadedFile {\n max-width: 32px;\n max-height: 32px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-imageFile {\n max-width: 100%;\n max-height: 100%;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-documentFile {\n max-width: 100%;\n max-height: 100%;\n margin-top: 4px;\n min-width: 25px;\n min-height: 25px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName span {\n padding: 10px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileCancel {\n cursor: pointer;\n margin-bottom: -6px;\n margin-left: 6px;\n color: var(--bc-chat-danger-color);\n}\n[dir=rtl] .bc-uploadFileDetails .bc-uploadFileCancel, .bc-RTL .bc-uploadFileDetails .bc-uploadFileCancel {\n margin-left: 0;\n margin-right: 6px;\n}\n\n.mic-container {\n position: relative;\n}\n.mic-container svg {\n z-index: 5;\n}\n.mic-container i {\n transition: 0.9s;\n z-index: 10;\n position: relative;\n}\n.mic-container .circle {\n z-index: 4;\n top: 3px;\n left: 3px;\n position: absolute;\n background-color: transparent;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1;\n transition: 0.5s;\n}\n.mic-container .circle:before {\n content: "";\n width: 36px;\n height: 36px;\n border-radius: 50%;\n opacity: 0.5;\n z-index: 3;\n position: absolute;\n}\n.mic-container .circle.active {\n background-color: #A8E6A3;\n}\n.mic-container .circle.active:before {\n background: #A8E6A3;\n}\n\n@keyframes bounce {\n 0% {\n transform: scale(1);\n }\n 25% {\n transform: scale(1.4);\n }\n 75% {\n transform: scale(1);\n }\n 100% {\n transform: scale(1.3);\n }\n}');const It=c.div`
|
|
505
528
|
display: flex;
|
|
506
529
|
padding: 8px 16px 16px 16px;
|
|
507
530
|
flex-direction: column;
|
|
@@ -525,7 +548,7 @@ i {
|
|
|
525
548
|
margin-top: 6px;
|
|
526
549
|
text-align: center;
|
|
527
550
|
}
|
|
528
|
-
`,
|
|
551
|
+
`,Et=c.div`
|
|
529
552
|
width: 100%;
|
|
530
553
|
padding: 8px 12px;
|
|
531
554
|
display: flex;
|
|
@@ -535,14 +558,14 @@ i {
|
|
|
535
558
|
gap: 4px;
|
|
536
559
|
flex: 1 0 0;
|
|
537
560
|
border-bottom: 1px solid var(--bc-border-neutral-secondary, #E5E7EB);
|
|
538
|
-
`,
|
|
561
|
+
`,Rt=c.div`
|
|
539
562
|
display: flex;
|
|
540
563
|
align-items: center;
|
|
541
564
|
justify-content: space-between;
|
|
542
565
|
gap: 8px;
|
|
543
566
|
direction: ${({isRTL:e})=>e?"rtl":"ltr"};
|
|
544
567
|
|
|
545
|
-
`,
|
|
568
|
+
`,St=c.span`
|
|
546
569
|
font-weight: 500;
|
|
547
570
|
font-size: var(--bc-chat-fontSize-sm);
|
|
548
571
|
line-height: var(--bc-chat-lineHeight-sm);
|
|
@@ -550,14 +573,14 @@ i {
|
|
|
550
573
|
text-overflow: ellipsis;
|
|
551
574
|
white-space: nowrap;
|
|
552
575
|
color: var(--bc-text-primary, #16616C);
|
|
553
|
-
`,
|
|
576
|
+
`,Ft=c.span`
|
|
554
577
|
color: #4b5563;
|
|
555
578
|
font-size: var(--bc-chat-fontSize-xs);
|
|
556
579
|
line-height: var(--bc-chat-lineHeight-xs);
|
|
557
580
|
overflow: hidden;
|
|
558
581
|
text-overflow: ellipsis;
|
|
559
582
|
white-space: nowrap;
|
|
560
|
-
`,
|
|
583
|
+
`,Dt=c.button`
|
|
561
584
|
border: none;
|
|
562
585
|
background: transparent;
|
|
563
586
|
display: inline-flex;
|
|
@@ -576,26 +599,26 @@ i {
|
|
|
576
599
|
color: #111827;
|
|
577
600
|
outline: none;
|
|
578
601
|
}
|
|
579
|
-
`,
|
|
580
|
-
${e=>e.bannerWidth>
|
|
602
|
+
`,Bt=()=>e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),zt=({config:n,sendMessage:a,setView:s,actionChips:c,noteMode:d,onNoteSend:g,onCloseNoteMode:p,notePlaceholder:h,replyMessageTitle:u,replyMessageContent:m,onCancelReplyMessage:b,autoCompleteEnabled:f,autoCompleteSuggestion:x,onInputChange:v,onAutoCompleteMutate:y})=>{const w="AR"===n?.language,[M,A]=r(),[k,L]=r([]),[I,E]=r(),[R,S]=r(0),F=o((()=>Boolean(u||m)),[u,m]),D=o((()=>u||("AR"===n?.language?"الرد على رسالة":"TR"===n?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[n?.language,u]),B=o((()=>"AR"===n?.language?"إلغاء":"TR"===n?.language?"İptal":"Cancel"),[n?.language]);l((()=>{I&&M&&M.trim().length>0&&E(void 0)}),[I,M]),l((()=>{const e=Array.isArray(k)?k:k?[k]:[];I&&e.length>0&&E(void 0)}),[k,I]);const z=i((e=>{if(d){const e=(M||"").trim();return g&&g(e),void A("")}const t=e=>{const{fileUrl:t,extension:n}=e;a(C.SupportedImageFormats.indexOf(n)>=0?"image":C.SupportedAudioFormats.indexOf(n)>=0?"audio":"document",t)};if(e)return void(e.blob&&e.fileUrl.startsWith("blob:")?We(e.blob,S,((n,o)=>{if(n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else o&&E(o)})):t(e));const n=Array.isArray(k)?k:k?[k]:[];if(n.length>0){const e=n.filter((e=>e.blob&&e.fileUrl.startsWith("blob:"))),o=n.filter((e=>!e.blob||!e.fileUrl.startsWith("blob:")));let i=o.length+e.length,a=0;o.forEach((e=>{t(e),a++})),e.length>0?e.forEach((e=>{We(e.blob,S,((n,o)=>{if(a++,n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else o&&E(`Failed to upload "${e.fileName}": ${o}`);a===i&&(L([]),S(0))}))})):L([])}else a(Ke,M),A("")}),[k,M,a,d,g,L,E,S]);return t(It,{isRTL:w,children:[F?t(Et,{isRTL:w,children:[t(Rt,{isRTL:w,children:[D?e(St,{children:D}):null,b?e(Dt,{type:"button",onClick:b,"aria-label":B,title:B,children:e(Bt,{})}):null]}),m?e(Ft,{children:m}):null]}):null,e("div",{className:"bc-InputArea",children:e(lt,{config:n,send:z,text:M,setText:A,file:d?void 0:k,isFileSelected:Array.isArray(k)?k.length>0:!!k,cancelFileUpload:e=>{L(e?t=>{const n=(Array.isArray(t)?t:t?[t]:[]).filter((t=>!(t.fileName===e.fileName&&t.fileUrl===e.fileUrl)));if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}return n}:e=>((Array.isArray(e)?e:e?[e]:[]).forEach((e=>{if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}})),[]))},noteMode:d,onCloseNoteMode:()=>{A(""),p?.()},notePlaceholder:h,autoCompleteEnabled:f,autoCompleteSuggestion:x,onInputChange:v,onAutoCompleteMutate:y})}),t("div",{className:"bc-BottomBar "+(w?"bc-RTL":""),children:[void 0!==c?c:null,e("div",{className:"bc-CommandsArea "+(w?"bc-RTL":""),children:d?null:e(Lt,{setView:s,setFile:L,setProgress:S,setError:E,setText:A,text:M,send:z,config:n})})]}),I?e("div",{className:"bc-uploadFileError",children:I}):null]})},Nt="bc-chat-header-banner",Zt=390,Tt=c.div`
|
|
603
|
+
${e=>e.bannerWidth>Zt?"height: 60px;":"height: 90px;"}
|
|
581
604
|
display: block;
|
|
582
605
|
width: 100%;
|
|
583
606
|
background-color: transparent;
|
|
584
607
|
z-index: 10;
|
|
585
608
|
border-top-left-radius: 15px;
|
|
586
609
|
border-top-right-radius: 15px;
|
|
587
|
-
`,
|
|
610
|
+
`,Ht=c.div`
|
|
588
611
|
width: 100%;
|
|
589
612
|
display: flex;
|
|
590
613
|
align-items: center;
|
|
591
614
|
background-image: ${e=>`linear-gradient(103deg, ${e.startColor},${e.endColor})`};
|
|
592
|
-
${e=>e.bannerWidth<=
|
|
593
|
-
`,
|
|
615
|
+
${e=>e.bannerWidth<=Zt?'\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMzkwIiBoZWlnaHQ9Ijg4LjM1NCIgdmlld0JveD0iMCAwIDM5MCA4OC4zNTQiPgogIDxkZWZzPgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQiIHgyPSIxIiB5Mj0iMSIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM2NjJkOTEiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZWUyYTdiIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8cGF0aCBpZD0iUGF0aF84NzgiIGRhdGEtbmFtZT0iUGF0aCA4NzgiIGQ9Ik0xMCwwSDM4MGExMCwxMCwwLDAsMSwxMCwxMFY3MHMtNzUuMDYtNy44ODYtMTk5LjYxNywxMS44NjJTMCw3MCwwLDcwVjEwQTEwLDEwLDAsMCwxLDEwLDAiIGZpbGw9InVybCgjbGluZWFyLWdyYWRpZW50KSIvPgo8L3N2Zz4K");\n mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMzkwIiBoZWlnaHQ9Ijg4LjM1NCIgdmlld0JveD0iMCAwIDM5MCA4OC4zNTQiPgogIDxkZWZzPgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQiIHgyPSIxIiB5Mj0iMSIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM2NjJkOTEiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZWUyYTdiIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8cGF0aCBpZD0iUGF0aF84NzgiIGRhdGEtbmFtZT0iUGF0aCA4NzgiIGQ9Ik0xMCwwSDM4MGExMCwxMCwwLDAsMSwxMCwxMFY3MHMtNzUuMDYtNy44ODYtMTk5LjYxNywxMS44NjJTMCw3MCwwLDcwVjEwQTEwLDEwLDAsMCwxLDEwLDAiIGZpbGw9InVybCgjbGluZWFyLWdyYWRpZW50KSIvPgo8L3N2Zz4K");\n mask-repeat: no-repeat;\n mask-size: auto;\n -webkit-mask-size: auto;\n -webkit-mask-repeat: no-repeat;\n height: 90px;\n ':"height: 60px;"}
|
|
616
|
+
`,jt=c.div`
|
|
594
617
|
width: 100%;
|
|
595
618
|
height: 100%;
|
|
596
619
|
display: flex;
|
|
597
|
-
`,
|
|
598
|
-
${e=>e.bannerWidth>
|
|
620
|
+
`,Pt=c.div`
|
|
621
|
+
${e=>e.bannerWidth>Zt?"padding-bottom: 0 !important;":""}
|
|
599
622
|
display: flex;
|
|
600
623
|
gap: 10px;
|
|
601
624
|
align-items: center;
|
|
@@ -616,8 +639,8 @@ i {
|
|
|
616
639
|
color: #fff;
|
|
617
640
|
font-style: normal;
|
|
618
641
|
}
|
|
619
|
-
`,
|
|
620
|
-
${e=>e.bannerWidth>
|
|
642
|
+
`,Ut=c.div`
|
|
643
|
+
${e=>e.bannerWidth>Zt?"padding-bottom: 0 !important;":""}
|
|
621
644
|
display: flex;
|
|
622
645
|
flex-direction: row-reverse;
|
|
623
646
|
gap: 10px;
|
|
@@ -632,9 +655,9 @@ i {
|
|
|
632
655
|
cursor: pointer;
|
|
633
656
|
display: block;
|
|
634
657
|
}
|
|
635
|
-
`,
|
|
658
|
+
`,Vt=c.i`
|
|
636
659
|
background-image: url("data:image/svg+xml;base64,PHN2ZyBpZD0ibWluaW1pemUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxLjgxNyIgdmlld0JveD0iMCAwIDE2IDEuODE3Ij4KICA8ZGVmcz4KICAgIDxjbGlwUGF0aCBpZD0iY2xpcC1wYXRoIj4KICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZV82OCIgZGF0YS1uYW1lPSJSZWN0YW5nbGUgNjgiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxLjgxNyIgZmlsbD0iIzAwMCIvPgogICAgPC9jbGlwUGF0aD4KICA8L2RlZnM+CiAgPGcgaWQ9Ikdyb3VwXzMwMSIgZGF0YS1uYW1lPSJHcm91cCAzMDEiIGNsaXAtcGF0aD0idXJsKCNjbGlwLXBhdGgpIj4KICAgIDxwYXRoIGlkPSJQYXRoXzgwNCIgZGF0YS1uYW1lPSJQYXRoIDgwNCIgZD0iTTE1LjM5NCwyLjIxMUguNjA2QS42MDYuNjA2LDAsMSwxLC42MDYsMUgxNS4zOTRhLjYwNi42MDYsMCwwLDEsMCwxLjIxMSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAtMC4zOTQpIiBmaWxsPSIjZmZmIi8+CiAgPC9nPgo8L3N2Zz4K");
|
|
637
|
-
`,
|
|
660
|
+
`,Gt=({config:n,minimize:o})=>{const[i,a]=r();return l((()=>{new ResizeObserver((()=>{const e=document.getElementById(Nt)?.offsetWidth;e&&e>50&&e!==i&&a(e)})).observe(document.getElementById(Nt))}),[]),e(Tt,{bannerWidth:i,className:"bc-header",children:e(Ht,{className:"bc-banner",id:Nt,startColor:"#065A60",endColor:"#006466",bannerWidth:i,children:t(jt,{className:"bc-bannerContents",children:[t(Pt,{className:"bc-companyInfo",bannerWidth:i,logo:n.brandLogo||b,children:[e("i",{}),e("span",{children:n.brandName||"BreadCrumbs"})]}),e(Ut,{className:"bc-bannerActions",bannerWidth:i,children:o?e(Vt,{className:"bc-flow-minimize",onClick:()=>o()}):null})]})})})};Re('@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");\n/* Chat constants - we should use html to allow portal overrides those values if it needs to be different */\nhtml {\n --bc-chat-font-stack: "Poppins", "Montserrat", sans-serif;\n --bc-chat-fontSize-xs: 10px;\n --bc-chat-fontSize-sm: 12px;\n --bc-chat-fontSize-md: 16px;\n --bc-chat-fontSize-lg: 18px;\n --bc-chat-fontSize-xl: 22px;\n --bc-chat-fontWeight-light: 100;\n --bc-chat-fontWeight-regular: 400;\n --bc-chat-fontWeight-medium: 500;\n --bc-chat-fontWeight-bold: 700;\n --bc-chat-lineHeight-xs: 18px;\n --bc-chat-lineHeight-sm: 22px;\n --bc-chat-lineHeight-md: 28px;\n --bc-chat-radius: 5px;\n --bc-chat-other-message-border-color: #E5E7EB;\n --bc-chat-other-message-separator-color: #D2D6DB;\n --bc-chat-other-message-background-start-color: #E5E7EB;\n --bc-chat-other-message-background-end-color: #E5E7EB;\n --bc-chat-other-message-text-color: #161616;\n --bc-chat-my-message-border-color: #258694;\n --bc-chat-my-message-background-start-color: #258694;\n --bc-chat-my-message-background-end-color: #258694;\n --bc-chat-my-message-text-color: #fff;\n --bc-chat-text-secondary: #6C737F;\n --bc-chat-text-secondary-dark: #4d4d4d;\n --bc-chat-text-secondary-darkest: #1F2A37;\n --bc-chat-message-highlight-color: #EBC10466;\n --bc-chat-danger-color: #B42318;\n --bc-chat-success-color: #58aa18;\n --bc-chat-white-color: #fff;\n --bc-background-primary-50: #F3FBFC;\n --bc-border-primary: #16616C;\n --bc-border-neutral-secondary: #E5E7EB;\n}');const Jt=c.div`
|
|
638
661
|
position: relative;
|
|
639
662
|
height: 100%;
|
|
640
663
|
display: flex;
|
|
@@ -653,5 +676,5 @@ i {
|
|
|
653
676
|
font-style: normal;
|
|
654
677
|
line-height: var(--bc-chat-lineHeight-xs);
|
|
655
678
|
color: var(--bc-chat-text-secondary-dark);
|
|
656
|
-
`,
|
|
679
|
+
`,Kt=({config:n={language:"EN",backgroundColor:"#F3F4F6"},messages:o=[],sendMessage:i,debug:a,minimize:l,onReachingUp:s,agentsIdsAvatarsMap:c,actionChips:d,noteMode:g,onNoteSend:p,onCloseNoteMode:h,searchPattern:u,notePlaceholder:m,searchMatchNo:C=1,onSearchMatchCount:b,onMessageReply:f,replyMessageTitle:x,replyMessageContent:v,onCancelReplyMessage:y,errorMessage:w,autoCompleteEnabled:M,autoCompleteSuggestion:A,onInputChange:k,onAutoCompleteMutate:L,onContactMessage:I,onContactAddContact:E})=>{const[R,S]=r("MESSAGE_LIST");return t(Jt,{className:"bc-chat",children:[n.hideHeader?null:e(Gt,{config:n,minimize:l}),"MESSAGE_LIST"===R?e(Je,{messages:o,sendMessage:i,debug:a,config:n,onReachingUp:s,agentsIdsAvatarsMap:c,searchPattern:u,searchMatchNo:C,onSearchMatchCount:b,onMessageReply:f,errorMessage:w,onContactMessage:I,onContactAddContact:E},"message-list"):null,n.inputDisabled?null:e(zt,{sendMessage:i,setView:S,config:n,actionChips:d,noteMode:g,onCloseNoteMode:h,onNoteSend:p,notePlaceholder:m,replyMessageTitle:x,replyMessageContent:v,onCancelReplyMessage:y,autoCompleteEnabled:M,autoCompleteSuggestion:A,onInputChange:k,onAutoCompleteMutate:L},"message-input")]})};export{Kt as BCChat};
|
|
657
680
|
//# sourceMappingURL=index.es.js.map
|
package/build/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8kFAAA,SAASA,GAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8kFAAA,SAASA,GAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/index.js
CHANGED
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
direction: ${e=>"arb"===e.language?"rtl":"ltr"};
|
|
20
20
|
`,w=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8.02979 0.833008C9.2539 0.833002 10.2137 0.833568 10.9751 0.916016C11.7521 1.00019 12.3819 1.17495 12.9194 1.56543C13.2448 1.80185 13.5316 2.08768 13.7681 2.41309C14.1586 2.95061 14.3333 3.58045 14.4175 4.35742C14.5 5.11878 14.4995 6.07853 14.4995 7.30273V8.69629C14.4995 9.92064 14.5 10.8812 14.4175 11.6426C14.3333 12.4192 14.1583 13.0486 13.7681 13.5859C13.5316 13.9114 13.2449 14.1981 12.9194 14.4346C12.3819 14.825 11.752 14.9998 10.9751 15.084C10.2138 15.1664 9.25388 15.167 8.02979 15.167H7.96924C6.74512 15.167 5.78525 15.1665 5.02393 15.084C4.24704 14.9998 3.61707 14.8251 3.07959 14.4346C2.75426 14.1982 2.46831 13.9113 2.23193 13.5859C1.84161 13.0485 1.6667 12.4193 1.58252 11.6426C1.50002 10.8812 1.49951 9.92065 1.49951 8.69629V7.30273C1.49951 6.07853 1.50003 5.11878 1.58252 4.35742C1.66671 3.58046 1.8414 2.9506 2.23193 2.41309C2.46826 2.08784 2.75436 1.80178 3.07959 1.56543C3.61707 1.17493 4.24705 1.00021 5.02393 0.916016C5.78535 0.83352 6.74586 0.833002 7.97021 0.833008H8.02979ZM7.99951 1.83301C6.73888 1.83301 5.8335 1.83422 5.13232 1.91016C4.44038 1.98512 4.00615 2.12797 3.66748 2.37402C3.42698 2.54877 3.21527 2.76047 3.04053 3.00098C2.79457 3.33956 2.65163 3.77322 2.57666 4.46484C2.50068 5.1661 2.49951 6.07207 2.49951 7.33301V8.66699C2.49951 9.92761 2.50072 10.833 2.57666 11.5342C2.65163 12.2261 2.79447 12.6604 3.04053 12.999C3.21517 13.2394 3.42714 13.4503 3.66748 13.625C4.00615 13.8711 4.44038 14.0149 5.13232 14.0898C5.8335 14.1658 6.7389 14.167 7.99951 14.167C9.26045 14.167 10.1664 14.1658 10.8677 14.0898C11.5596 14.0149 11.9929 13.871 12.3315 13.625C12.5719 13.4503 12.7838 13.2394 12.9585 12.999C13.2046 12.6604 13.3484 12.2261 13.4233 11.5342C13.4993 10.833 13.4995 9.9276 13.4995 8.66699V7.33301C13.4995 6.07207 13.4993 5.1661 13.4233 4.46484C13.3484 3.77313 13.2045 3.33958 12.9585 3.00098C12.7838 2.76055 12.572 2.54872 12.3315 2.37402C11.9929 2.12815 11.5593 1.98509 10.8677 1.91016C10.1664 1.83419 9.26046 1.83301 7.99951 1.83301ZM8.99951 7.5C9.27565 7.5 9.49951 7.72386 9.49951 8C9.49945 8.27609 9.27562 8.5 8.99951 8.5H6.99951C6.72358 8.49979 6.49957 8.27596 6.49951 8C6.49951 7.72399 6.72355 7.50021 6.99951 7.5H8.99951ZM10.6665 4.16699C10.9426 4.16699 11.1665 4.39085 11.1665 4.66699C11.1663 4.94293 10.9425 5.16699 10.6665 5.16699H5.3335C5.0575 5.16699 4.83373 4.94293 4.8335 4.66699C4.8335 4.39085 5.05735 4.16699 5.3335 4.16699H10.6665Z",fill:"#384250"})}),M=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8.03833 1.16626C9.49865 1.16625 10.6457 1.16695 11.5413 1.28735C12.4589 1.41074 13.1869 1.66846 13.759 2.24048C14.3311 2.81255 14.5897 3.54061 14.7131 4.45825C14.8335 5.35386 14.8333 6.50169 14.8333 7.96216V8.03833C14.8333 9.49865 14.8335 10.6457 14.7131 11.5413C14.5897 12.459 14.3312 13.1869 13.759 13.759C13.1869 14.3312 12.459 14.5897 11.5413 14.7131C10.6457 14.8335 9.49865 14.8333 8.03833 14.8333H7.96216C6.50169 14.8333 5.35386 14.8335 4.45825 14.7131C3.54061 14.5897 2.81255 14.3311 2.24048 13.759C1.66846 13.1869 1.41074 12.4589 1.28735 11.5413C1.16695 10.6457 1.16625 9.49865 1.16626 8.03833V7.96216C1.16625 6.50169 1.16694 5.35386 1.28735 4.45825C1.41076 3.54065 1.66842 2.81253 2.24048 2.24048C2.81253 1.66842 3.54065 1.41076 4.45825 1.28735C5.35386 1.16694 6.50169 1.16625 7.96216 1.16626H8.03833ZM8.00024 2.16626C6.4935 2.16626 5.41327 2.16721 4.59204 2.27759C3.78516 2.38607 3.30287 2.59215 2.94751 2.94751C2.59215 3.30287 2.38607 3.78516 2.27759 4.59204C2.16721 5.41327 2.16626 6.4935 2.16626 8.00024C2.16626 9.50698 2.16718 10.5872 2.27759 11.4084C2.38607 12.215 2.59229 12.6967 2.94751 13.052C3.30287 13.4074 3.78516 13.6134 4.59204 13.7219C5.41328 13.8323 6.49347 13.8333 8.00024 13.8333C9.50698 13.8333 10.5872 13.8323 11.4084 13.7219C12.2151 13.6134 12.6967 13.4073 13.052 13.052C13.4073 12.6967 13.6134 12.2151 13.7219 11.4084C13.8323 10.5872 13.8333 9.50698 13.8333 8.00024C13.8333 6.49347 13.8323 5.41328 13.7219 4.59204C13.6134 3.78516 13.4074 3.30287 13.052 2.94751C12.6967 2.59229 12.215 2.38607 11.4084 2.27759C10.5872 2.16718 9.50698 2.16626 8.00024 2.16626ZM7.66626 4.16626C7.9423 4.16626 8.1661 4.39025 8.16626 4.66626V5.08618H11.3333C11.6094 5.0862 11.8333 5.31005 11.8333 5.58618C11.8332 5.86228 11.6094 6.08617 11.3333 6.08618H10.0354C9.67594 7.15336 9.07458 8.15266 8.39868 9.04321L9.38403 10.0667C9.57541 10.2656 9.56919 10.5822 9.37036 10.7737C9.17135 10.9651 8.85477 10.959 8.66333 10.76L7.76489 9.82642C7.15169 10.5388 6.50925 11.1723 5.93384 11.7014C5.73061 11.8883 5.41373 11.8753 5.22681 11.6721C5.03989 11.4689 5.05381 11.152 5.25708 10.9651C5.84141 10.4278 6.48626 9.78887 7.09009 9.07642C6.93782 8.88517 6.78036 8.67798 6.63599 8.47778C6.41136 8.16628 6.19307 7.83617 6.08521 7.60474C5.96867 7.35457 6.07637 7.05741 6.32642 6.94067C6.57671 6.82402 6.8748 6.93257 6.99146 7.18286C7.05513 7.31933 7.2223 7.58051 7.44751 7.89282C7.53777 8.01799 7.63329 8.14593 7.72876 8.26978C8.23685 7.57834 8.67347 6.84354 8.97095 6.08618H4.66626C4.39028 6.08602 4.1663 5.86219 4.16626 5.58618C4.16626 5.31014 4.39025 5.08634 4.66626 5.08618H7.16626V4.66626C7.16642 4.39035 7.39035 4.16642 7.66626 4.16626Z",fill:"#384250"})}),A=c.default(y)`
|
|
21
21
|
min-width: 160px;
|
|
22
|
-
`,
|
|
22
|
+
`,j=c.default.div`
|
|
23
23
|
display: flex;
|
|
24
24
|
flex-direction: column;
|
|
25
25
|
gap: 6px;
|
|
26
|
-
`,
|
|
26
|
+
`,k=c.default.div`
|
|
27
27
|
display: flex;
|
|
28
28
|
align-items: center;
|
|
29
29
|
gap: 6px;
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
display: flex;
|
|
60
60
|
flex-direction: column;
|
|
61
61
|
gap: 4px;
|
|
62
|
-
`,D={en:"English",en_US:"English",en_GB:"English",ar:"Arabic",ar_SA:"Arabic",tr:"Turkish",tr_TR:"Turkish",es:"Spanish",es_ES:"Spanish",fr:"French",fr_FR:"French",de:"German",de_DE:"German",it:"Italian",it_IT:"Italian",pt:"Portuguese",pt_BR:"Portuguese",pt_PT:"Portuguese",ru:"Russian",ru_RU:"Russian",zh:"Chinese",zh_CN:"Chinese",ja:"Japanese",ja_JP:"Japanese",ko:"Korean",ko_KR:"Korean",hi:"Hindi",hi_IN:"Hindi"},B=({messageContent:n,isMyMessage:a,configLanguage:o})=>{const i=t.useMemo((()=>{try{return JSON.parse(n)}catch(e){return void console.log(e.message)}}),[n]),r="string"==typeof i?.language?i.language:i?.language?.code,s=t.useMemo((()=>(e=>{if(!e)return;if(D[e])return D[e];const t=e.split("_")[0].toLowerCase();return D[t]?D[t]:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})(r)),[r]),l=t.useMemo((()=>{if(!i)return[];const e=[];if(i.templateComponents){let t=[];try{"string"==typeof i.templateComponents?t=JSON.parse(i.templateComponents):Array.isArray(i.templateComponents)&&(t=i.templateComponents)}catch(t){return console.log("Error parsing templateComponents:",t.message),e}t.forEach(((t,n)=>{if(!t||"object"!=typeof t)return;const a=t.type||"unknown",o=t.parameters||[];if("body"===a)o.forEach(((t,n)=>{if(t&&"object"==typeof t){const a=t.text||t.value||JSON.stringify(t),i=o.length>1?`Body Parameter ${n+1}`:"Body";e.push({label:i,value:String(a)})}}));else if("button"===a){const a=void 0!==t.index?t.index:n,i=t.sub_type||t.subType||"";o.forEach(((t,n)=>{if(t&&"object"==typeof t){const r=t.text||t.value||JSON.stringify(t),s=i?`Button ${a} (${i})`:`Button ${a}`,l=o.length>1?`${s} - Parameter ${n+1}`:s;e.push({label:l,value:String(r)})}}))}else o.forEach(((t,n)=>{if(t&&"object"==typeof t){const i=t.text||t.value||JSON.stringify(t),r=a.charAt(0).toUpperCase()+a.slice(1),s=o.length>1?`${r} Parameter ${n+1}`:r;e.push({label:s,value:String(i)})}}))}))}return e}),[i]);return i?e.jsx(F,{children:e.jsxs(A,{isMyMessage:a,language:o,children:[e.jsxs(
|
|
62
|
+
`,D={en:"English",en_US:"English",en_GB:"English",ar:"Arabic",ar_SA:"Arabic",tr:"Turkish",tr_TR:"Turkish",es:"Spanish",es_ES:"Spanish",fr:"French",fr_FR:"French",de:"German",de_DE:"German",it:"Italian",it_IT:"Italian",pt:"Portuguese",pt_BR:"Portuguese",pt_PT:"Portuguese",ru:"Russian",ru_RU:"Russian",zh:"Chinese",zh_CN:"Chinese",ja:"Japanese",ja_JP:"Japanese",ko:"Korean",ko_KR:"Korean",hi:"Hindi",hi_IN:"Hindi"},B=({messageContent:n,isMyMessage:a,configLanguage:o})=>{const i=t.useMemo((()=>{try{return JSON.parse(n)}catch(e){return void console.log(e.message)}}),[n]),r="string"==typeof i?.language?i.language:i?.language?.code,s=t.useMemo((()=>(e=>{if(!e)return;if(D[e])return D[e];const t=e.split("_")[0].toLowerCase();return D[t]?D[t]:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})(r)),[r]),l=t.useMemo((()=>{if(!i)return[];const e=[];if(i.templateComponents){let t=[];try{"string"==typeof i.templateComponents?t=JSON.parse(i.templateComponents):Array.isArray(i.templateComponents)&&(t=i.templateComponents)}catch(t){return console.log("Error parsing templateComponents:",t.message),e}t.forEach(((t,n)=>{if(!t||"object"!=typeof t)return;const a=t.type||"unknown",o=t.parameters||[];if("body"===a)o.forEach(((t,n)=>{if(t&&"object"==typeof t){const a=t.text||t.value||JSON.stringify(t),i=o.length>1?`Body Parameter ${n+1}`:"Body";e.push({label:i,value:String(a)})}}));else if("button"===a){const a=void 0!==t.index?t.index:n,i=t.sub_type||t.subType||"";o.forEach(((t,n)=>{if(t&&"object"==typeof t){const r=t.text||t.value||JSON.stringify(t),s=i?`Button ${a} (${i})`:`Button ${a}`,l=o.length>1?`${s} - Parameter ${n+1}`:s;e.push({label:l,value:String(r)})}}))}else o.forEach(((t,n)=>{if(t&&"object"==typeof t){const i=t.text||t.value||JSON.stringify(t),r=a.charAt(0).toUpperCase()+a.slice(1),s=o.length>1?`${r} Parameter ${n+1}`:r;e.push({label:s,value:String(i)})}}))}))}return e}),[i]);return i?e.jsx(F,{children:e.jsxs(A,{isMyMessage:a,language:o,children:[e.jsxs(j,{children:[e.jsxs(k,{children:[e.jsx(w,{}),e.jsx(E,{children:i.name||"Template"})]}),s&&e.jsxs(k,{children:[e.jsx(M,{}),e.jsx(E,{children:s})]})]}),l.length>0&&e.jsx(L,{children:l.map(((t,n)=>e.jsxs(I,{children:[e.jsx(R,{children:t.label}),e.jsx(S,{children:t.value})]},n)))})]})}):null},z=c.default(y)`
|
|
63
63
|
overflow: hidden;
|
|
64
64
|
text-overflow: ellipsis;
|
|
65
65
|
white-space: nowrap;
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
background-color: rgba(22, 97, 108, 0.12);
|
|
139
139
|
outline: none;
|
|
140
140
|
}
|
|
141
|
-
`,G=()=>e.jsx("svg",{width:"15",height:"16",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.2232 8.33921C6.85992 8.33921 5.54564 8.35033 5.54564 8.35033V11.3333L1.29228 6.67275L5.54564 2.00666V5.01186C5.54564 5.01186 6.93435 4.99519 7.2232 5.0063C11.146 5.1285 13.8701 9.59462 13.8879 11.6832C12.6892 10.1445 9.53958 8.33921 7.2232 8.33921ZM6.65828 3.90089V0.623508C6.67716 0.456862 6.63217 0.290241 6.50552 0.162479C6.28554 -0.0541598 5.92892 -0.0541598 5.70895 0.162479L0.160208 6.25058C0.0430006 6.36723 -0.00699451 6.51722 0.000782283 6.67275C-0.00699451 6.82273 0.0430006 6.97827 0.160208 7.09493L5.6784 13.1442C5.78061 13.2719 5.92892 13.3553 6.10168 13.3553C6.25944 13.3553 6.39997 13.2886 6.50107 13.183C6.50218 13.183 6.50441 13.183 6.50552 13.1775C6.63217 13.0553 6.67716 12.8831 6.65828 12.722C6.65828 12.722 6.66772 9.63904 6.66772 9.45018C10.3339 9.45018 13.6496 12.0887 14.3079 15.5661C14.7511 14.544 15 13.4219 15 12.2387C15 7.63375 11.2649 3.90089 6.65828 3.90089Z",fill:"#161616"})}),J=({isMyMessage:n,createdAt:a,children:o,className:r,message:s,config:l,style:c,onReply:d,isMedia:g})=>{const p=i.franc(s.content),u="AR"===l.language,h=s?.messageId,m=Boolean(d&&h),C=t.useCallback((()=>{h&&d?.(h)}),[h,d]),b=a||s&&l&&l.isAgent===s.isAgent?e.jsxs(U,{isMedia:g,isMyMessage:n,children:[s&&l&&l.isAgent===s.isAgent&&e.jsx(v,{message:s,config:l}),a&&e.jsx(x,{createdAt:a})]}):null;return e.jsxs(T,{isMyMessage:n,language:l.language,className:r,style:c,children:[m?e.jsx(V,{className:"bc-replyButton",type:"button",onClick:C,isRTL:u,isMyMessage:n,children:e.jsx(G,{})}):null,s.context&&s.context.replyToId?e.jsx(Z,{context:s.context,isMyMessage:n,language:p}):null,"template"===s.type?e.jsx(B,{messageContent:s.content,isMyMessage:n,configLanguage:l.language}):null,e.jsxs(H,{isMyMessage:n,isMedia:g,children:[e.jsxs(P,{language:p,children:[o,g&&b]}),!g&&b]})]})},K=({message:t,config:n,searchPattern:a,onReply:o})=>{const i=n.isAgent===t.isAgent;return e.jsx(J,{className:"bc-textMessage",isMyMessage:i,createdAt:t.createdAt,message:t,config:n,onReply:o,children:(t.content&&t.content.indexOf("\n")>-1?t.content.split("\n"):[t.content]).map(((n,o)=>{const i=a&&a.trim()?function(e,t){const n=(a=t.trim(),a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));var a;if(!n)return e;const o=new RegExp(`(${n})`,"gi");return e.replace(o,'<span style="background-color: var(--bc-chat-message-highlight-color, yellow); padding: 3px 0;">$1</span>')}(n,a):n;return e.jsx(d.default,{rehypePlugins:[g.default],skipHtml:!1,children:i},`${t.messageId}-${o}`)}))})};function W(e){if(!isFinite(e)||e<0)return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}function Q({src:n}){const a=t.useRef(null),[o,i]=t.useState(!1),[r,s]=t.useState(!0),[l,c]=t.useState(0),[d,g]=t.useState(0),p=t.useMemo((()=>{const e=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return()=>{t+=1831565813;let e=Math.imul(t^t>>>15,1|t);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n),t=[];for(let n=0;n<82;n++){const a=.6*Math.sin(n/82*Math.PI)+.2,o=.25*(e()-.5),i=Math.min(1,Math.max(.15,a+o));t.push(i)}return t}),[n]);t.useEffect((()=>{const e=a.current;if(!e)return;const t=()=>{c(e.duration),s(!1)},n=()=>g(e.currentTime),o=()=>i(!1),r=()=>{document.querySelectorAll("video, audio").forEach((t=>{t!==e&&t.pause()})),i(!0)},l=()=>i(!1);return e.addEventListener("loadedmetadata",t),e.addEventListener("timeupdate",n),e.addEventListener("ended",o),e.addEventListener("play",r),e.addEventListener("pause",l),()=>{e.removeEventListener("loadedmetadata",t),e.removeEventListener("timeupdate",n),e.removeEventListener("ended",o),e.removeEventListener("play",r),e.removeEventListener("pause",l)}}),[n]);const u=t.useCallback((()=>{const e=a.current;e&&(e.paused?e.play():e.pause())}),[]),h=t.useCallback((e=>{const t=a.current;if(!t||!l)return;const n=e.currentTarget.getBoundingClientRect(),o=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width));t.currentTime=o*l,g(t.currentTime)}),[l]),m=l?Math.min(1,d/l):0;return e.jsxs("div",{className:"bc-audioPlayer",role:"group","aria-label":"Audio message player",children:[e.jsx("button",{type:"button",className:"bc-audioPlayer__button "+(o?"pause":"play"),onClick:u,"aria-label":o?"Pause audio":"Play audio"}),e.jsxs("div",{className:"bc-audioPlayer__wave",onClick:h,children:[e.jsx("div",{className:"bc-audioPlayer__wave--future",children:p.map(((t,n)=>e.jsx("span",{style:{height:`${Math.round(18*t)}px`}},`f-${n}`)))}),e.jsx("div",{className:"bc-audioPlayer__wave--past",style:{width:100*m+"%"},children:p.map(((t,n)=>e.jsx("span",{style:{height:`${Math.round(18*t)}px`}},`p-${n}`)))})]}),e.jsx("div",{className:"bc-audioPlayer__time","aria-live":"polite",children:r?"--:--":W(l)}),e.jsx("audio",{ref:a,src:n,preload:"metadata"})]})}const Y=({message:n,config:a,onReply:o})=>{const[i,r]=t.useState(!1),[s,l]=t.useState(!0),c=t.useRef(null),d=t.useCallback((()=>{const e=c.current;e&&console.error("Media playback error:",{src:e.src,error:e.error,networkState:e.networkState,readyState:e.readyState,messageType:n.type}),r(!0),l(!1)}),[n.type]),g=t.useCallback((()=>{console.log("Media loaded successfully:",n.content),l(!1)}),[n.content]),p=t.useCallback((()=>{console.log("Media can play:",n.content),l(!1)}),[n.content]),u=t.useCallback((()=>{console.log("Media load started:",n.content)}),[n.content]);t.useEffect((()=>{const e=()=>{document.querySelectorAll("video, audio").forEach((e=>{e!==c.current&&e.pause()}))},t=c.current;if(t){t.addEventListener("play",e),t.addEventListener("loadeddata",g),t.addEventListener("canplay",p),t.addEventListener("error",d),t.addEventListener("loadstart",u);const a=setTimeout((()=>{console.log("Loading timeout reached for:",n.content),l(!1)}),5e3);return()=>{t&&(t.removeEventListener("play",e),t.removeEventListener("loadeddata",g),t.removeEventListener("canplay",p),t.removeEventListener("error",d),t.removeEventListener("loadstart",u)),clearTimeout(a)}}}),[p,u,d,g,n.content,n.type]);const h=a.isAgent===n.isAgent;return i?e.jsxs(J,{className:"bc-mediaMessage"+("audio"===n.type?" audio":""),isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,onReply:o,children:[e.jsxs("p",{style:{margin:0,color:"#666"},children:["Unable to load ","audio"===n.type?"audio":"video"," file."]}),e.jsxs("a",{href:n.content,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff",textDecoration:"none"},children:["Open ","audio"===n.type?"audio":"video"," in new tab"]})]}):"audio"===n.type?e.jsx(J,{className:"bc-mediaMessage audio",isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,style:{position:"relative"},onReply:o,children:e.jsx(Q,{src:n.content})}):e.jsxs(J,{className:"bc-mediaMessage",isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,style:{position:"relative"},onReply:o,children:[e.jsx("video",{ref:c,src:n.content,controls:!0,preload:"metadata",playsInline:!0,onError:d,onLoadedData:g,onCanPlay:p,onLoadStart:u}),s&&e.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",zIndex:1},children:"Loading video..."})]})};var O={EN:{share_my_location:"Share My Location",share_my_current_location:"Share My Current Location",placeholder:"Message...",notePlaceholder:"Add your note",see_your_location:"See Your Location",location_permission:"Please give location permission",download:"Download",template_message:"Template Message",message:"Message",add_contact:"Add Contact"},AR:{share_my_location:"مشاركة موقعي",share_my_current_location:"مشاركة موقعي الحالي",placeholder:"الرسالة...",notePlaceholder:"أضف ملاحظتك",see_your_location:"رؤية موقعك",location_permission:"يرجى منح إذن الموقع",download:"تحميل",template_message:"رسالة قالب",message:"أرسل رسالة",add_contact:"إضافة جهة اتصال"},TR:{share_my_location:"Konumumu paylaş",share_my_current_location:"Güncel konumumu paylaş",placeholder:"Mesajınızı yazın",notePlaceholder:"Notunuzu ekleyin",see_your_location:"Konumunuzu Görüntüleyin",location_permission:"Lütfen konum paylaşımı için izin verin",download:"İndir",template_message:"Şablon Mesajı",message:"Mesaj",add_contact:"Kişi Ekle"}};const q=()=>e.jsx("svg",{width:"18",height:"22",viewBox:"0 0 18 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8.56055 0.249878C9.16365 0.249377 9.64011 0.249415 10.0869 0.407104C10.1792 0.439689 10.2701 0.477175 10.3584 0.519409C10.7858 0.723899 11.1227 1.06135 11.5488 1.48816L16.4443 6.38367C16.9387 6.87712 17.3304 7.26784 17.541 7.77625C17.7515 8.28461 17.7507 8.83754 17.75 9.53601V13.0565C17.75 14.8942 17.7498 16.3499 17.5967 17.4891C17.439 18.6615 17.1067 19.61 16.3584 20.3583C15.6101 21.1066 14.6616 21.4389 13.4893 21.5966C12.3501 21.7497 10.8943 21.7499 9.05664 21.7499H8.94336C7.10571 21.7499 5.64991 21.7497 4.51074 21.5966C3.33844 21.4389 2.38991 21.1066 1.6416 20.3583C0.893309 19.61 0.560952 18.6615 0.40332 17.4891C0.25016 16.3499 0.249984 14.8942 0.25 13.0565V8.4071C0.249988 6.82577 0.250388 5.57298 0.366211 4.58093C0.485107 3.56261 0.733898 2.72281 1.30176 2.01843C1.51427 1.75486 1.755 1.51514 2.01855 1.30261C2.72296 0.734673 3.56267 0.484993 4.58105 0.366089C5.57311 0.250277 6.8259 0.249866 8.40723 0.249878H8.56055ZM8.45605 1.74988C6.81549 1.74988 5.6499 1.75086 4.75488 1.85535C3.87608 1.95795 3.35453 2.15151 2.95996 2.4696C2.77959 2.61504 2.61516 2.77947 2.46973 2.95984C2.15159 3.35441 1.95808 3.87589 1.85547 4.75476C1.75097 5.64979 1.75 6.8153 1.75 8.45593V12.9999C1.75 14.9066 1.75151 16.2613 1.88965 17.2889C2.02491 18.295 2.27897 18.8745 2.70215 19.2977C3.12536 19.7209 3.70485 19.975 4.71094 20.1102C5.73859 20.2484 7.09323 20.2499 9 20.2499C10.9068 20.2499 12.2614 20.2484 13.2891 20.1102C14.2952 19.975 14.8746 19.7209 15.2979 19.2977C15.721 18.8745 15.9751 18.295 16.1104 17.2889C16.2485 16.2613 16.25 14.9066 16.25 12.9999V9.6571C16.25 9.21922 16.2468 8.94195 16.2334 8.74988H15.9453C14.5778 8.7499 13.4753 8.7502 12.6084 8.63367C11.7083 8.51265 10.9505 8.25316 10.3486 7.65125C9.74676 7.04934 9.48722 6.29156 9.36621 5.39148C9.24969 4.52456 9.24998 3.422 9.25 2.05457V1.76355C9.08319 1.75292 8.84192 1.74988 8.45605 1.74988ZM13 15.2499C13.4142 15.2499 13.75 15.5857 13.75 15.9999C13.75 16.4141 13.4142 16.7499 13 16.7499H5C4.58579 16.7499 4.25 16.4141 4.25 15.9999C4.25 15.5857 4.58579 15.2499 5 15.2499H13ZM9 11.2499C9.41421 11.2499 9.75 11.5857 9.75 11.9999C9.75 12.4141 9.41421 12.7499 9 12.7499H5C4.58579 12.7499 4.25 12.4141 4.25 11.9999C4.25 11.5857 4.58579 11.2499 5 11.2499H9ZM10.751 2.8114C10.7546 3.82629 10.7723 4.58818 10.8535 5.19226C10.9522 5.92571 11.1325 6.31399 11.4092 6.5907C11.6859 6.86746 12.0748 7.04771 12.8086 7.14636C13.4126 7.22753 14.1738 7.24524 15.1885 7.2489L10.751 2.8114Z",fill:"#16616C"})}),X=c.default.a`
|
|
141
|
+
`,G=()=>e.jsx("svg",{width:"15",height:"16",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.2232 8.33921C6.85992 8.33921 5.54564 8.35033 5.54564 8.35033V11.3333L1.29228 6.67275L5.54564 2.00666V5.01186C5.54564 5.01186 6.93435 4.99519 7.2232 5.0063C11.146 5.1285 13.8701 9.59462 13.8879 11.6832C12.6892 10.1445 9.53958 8.33921 7.2232 8.33921ZM6.65828 3.90089V0.623508C6.67716 0.456862 6.63217 0.290241 6.50552 0.162479C6.28554 -0.0541598 5.92892 -0.0541598 5.70895 0.162479L0.160208 6.25058C0.0430006 6.36723 -0.00699451 6.51722 0.000782283 6.67275C-0.00699451 6.82273 0.0430006 6.97827 0.160208 7.09493L5.6784 13.1442C5.78061 13.2719 5.92892 13.3553 6.10168 13.3553C6.25944 13.3553 6.39997 13.2886 6.50107 13.183C6.50218 13.183 6.50441 13.183 6.50552 13.1775C6.63217 13.0553 6.67716 12.8831 6.65828 12.722C6.65828 12.722 6.66772 9.63904 6.66772 9.45018C10.3339 9.45018 13.6496 12.0887 14.3079 15.5661C14.7511 14.544 15 13.4219 15 12.2387C15 7.63375 11.2649 3.90089 6.65828 3.90089Z",fill:"#161616"})}),J=({isMyMessage:n,createdAt:a,children:o,className:r,message:s,config:l,style:c,onReply:d,isMedia:g})=>{const p=i.franc(s.content),u="AR"===l.language,h=s?.messageId,m=Boolean(d&&h),C=t.useCallback((()=>{h&&d?.(h)}),[h,d]),b=a||s&&l&&l.isAgent===s.isAgent?e.jsxs(U,{isMedia:g,isMyMessage:n,children:[s&&l&&l.isAgent===s.isAgent&&e.jsx(v,{message:s,config:l}),a&&e.jsx(x,{createdAt:a})]}):null;return e.jsxs(T,{isMyMessage:n,language:l.language,className:r,style:c,children:[m?e.jsx(V,{className:"bc-replyButton",type:"button",onClick:C,isRTL:u,isMyMessage:n,children:e.jsx(G,{})}):null,s.context&&s.context.replyToId?e.jsx(Z,{context:s.context,isMyMessage:n,language:p}):null,"template"===s.type?e.jsx(B,{messageContent:s.content,isMyMessage:n,configLanguage:l.language}):null,e.jsxs(H,{isMyMessage:n,isMedia:g,children:[e.jsxs(P,{language:p,children:[o,g&&b]}),!g&&b]})]})},K=({message:t,config:n,searchPattern:a,onReply:o})=>{const i=n.isAgent===t.isAgent;return e.jsx(J,{className:"bc-textMessage",isMyMessage:i,createdAt:t.createdAt,message:t,config:n,onReply:o,children:(t.content&&t.content.indexOf("\n")>-1?t.content.split("\n"):[t.content]).map(((n,o)=>{const i=a&&a.trim()?function(e,t){const n=(a=t.trim(),a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));var a;if(!n)return e;const o=new RegExp(`(${n})`,"gi");return e.replace(o,'<span style="background-color: var(--bc-chat-message-highlight-color, yellow); padding: 3px 0;">$1</span>')}(n,a):n;return e.jsx(d.default,{rehypePlugins:[g.default],skipHtml:!1,children:i},`${t.messageId}-${o}`)}))})};function W(e){if(!isFinite(e)||e<0)return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}function Q({src:n}){const a=t.useRef(null),[o,i]=t.useState(!1),[r,s]=t.useState(!0),[l,c]=t.useState(0),[d,g]=t.useState(0),p=t.useMemo((()=>{const e=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return()=>{t+=1831565813;let e=Math.imul(t^t>>>15,1|t);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n),t=[];for(let n=0;n<82;n++){const a=.6*Math.sin(n/82*Math.PI)+.2,o=.25*(e()-.5),i=Math.min(1,Math.max(.15,a+o));t.push(i)}return t}),[n]);t.useEffect((()=>{const e=a.current;if(!e)return;const t=()=>{c(e.duration),s(!1)},n=()=>g(e.currentTime),o=()=>i(!1),r=()=>{document.querySelectorAll("video, audio").forEach((t=>{t!==e&&t.pause()})),i(!0)},l=()=>i(!1);return e.addEventListener("loadedmetadata",t),e.addEventListener("timeupdate",n),e.addEventListener("ended",o),e.addEventListener("play",r),e.addEventListener("pause",l),()=>{e.removeEventListener("loadedmetadata",t),e.removeEventListener("timeupdate",n),e.removeEventListener("ended",o),e.removeEventListener("play",r),e.removeEventListener("pause",l)}}),[n]);const u=t.useCallback((()=>{const e=a.current;e&&(e.paused?e.play():e.pause())}),[]),h=t.useCallback((e=>{const t=a.current;if(!t||!l)return;const n=e.currentTarget.getBoundingClientRect(),o=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width));t.currentTime=o*l,g(t.currentTime)}),[l]),m=l?Math.min(1,d/l):0;return e.jsxs("div",{className:"bc-audioPlayer",role:"group","aria-label":"Audio message player",children:[e.jsx("button",{type:"button",className:"bc-audioPlayer__button "+(o?"pause":"play"),onClick:u,"aria-label":o?"Pause audio":"Play audio"}),e.jsxs("div",{className:"bc-audioPlayer__wave",onClick:h,children:[e.jsx("div",{className:"bc-audioPlayer__wave--future",children:p.map(((t,n)=>e.jsx("span",{style:{height:`${Math.round(18*t)}px`}},`f-${n}`)))}),e.jsx("div",{className:"bc-audioPlayer__wave--past",style:{width:100*m+"%"},children:p.map(((t,n)=>e.jsx("span",{style:{height:`${Math.round(18*t)}px`}},`p-${n}`)))})]}),e.jsx("div",{className:"bc-audioPlayer__time","aria-live":"polite",children:r?"--:--":W(l)}),e.jsx("audio",{ref:a,src:n,preload:"metadata"})]})}const Y=({message:n,config:a,onReply:o})=>{const[i,r]=t.useState(!1),[s,l]=t.useState(!0),c=t.useRef(null),d=t.useCallback((()=>{const e=c.current;e&&console.error("Media playback error:",{src:e.src,error:e.error,networkState:e.networkState,readyState:e.readyState,messageType:n.type}),r(!0),l(!1)}),[n.type]),g=t.useCallback((()=>{console.log("Media loaded successfully:",n.content),l(!1)}),[n.content]),p=t.useCallback((()=>{console.log("Media can play:",n.content),l(!1)}),[n.content]),u=t.useCallback((()=>{console.log("Media load started:",n.content)}),[n.content]);t.useEffect((()=>{const e=()=>{document.querySelectorAll("video, audio").forEach((e=>{e!==c.current&&e.pause()}))},t=c.current;if(t){t.addEventListener("play",e),t.addEventListener("loadeddata",g),t.addEventListener("canplay",p),t.addEventListener("error",d),t.addEventListener("loadstart",u);const a=setTimeout((()=>{console.log("Loading timeout reached for:",n.content),l(!1)}),5e3);return()=>{t&&(t.removeEventListener("play",e),t.removeEventListener("loadeddata",g),t.removeEventListener("canplay",p),t.removeEventListener("error",d),t.removeEventListener("loadstart",u)),clearTimeout(a)}}}),[p,u,d,g,n.content,n.type]);const h=a.isAgent===n.isAgent;return i?e.jsxs(J,{className:"bc-mediaMessage"+("audio"===n.type?" audio":""),isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,onReply:o,children:[e.jsxs("p",{style:{margin:0,color:"#666"},children:["Unable to load ","audio"===n.type?"audio":"video"," file."]}),e.jsxs("a",{href:n.content,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff",textDecoration:"none"},children:["Open ","audio"===n.type?"audio":"video"," in new tab"]})]}):"audio"===n.type?e.jsx(J,{className:"bc-mediaMessage audio",isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,style:{position:"relative"},onReply:o,children:e.jsx(Q,{src:n.content})}):e.jsxs(J,{className:"bc-mediaMessage",isMyMessage:h,isMedia:!0,createdAt:n.createdAt,message:n,config:a,style:{position:"relative"},onReply:o,children:[e.jsx("video",{ref:c,src:n.content,controls:!0,preload:"metadata",playsInline:!0,onError:d,onLoadedData:g,onCanPlay:p,onLoadStart:u}),s&&e.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",zIndex:1},children:"Loading video..."})]})};var O={EN:{share_my_location:"Share My Location",share_my_current_location:"Share My Current Location",placeholder:"Message...",notePlaceholder:"Add your note",see_your_location:"See Your Location",location_permission:"Please give location permission",download:"Download",template_message:"Template Message",message:"Message",add_contact:"Add Contact",autoCompleteAcceptHint:"Press Tab or the Right arrow key to insert the full suggestion."},AR:{share_my_location:"مشاركة موقعي",share_my_current_location:"مشاركة موقعي الحالي",placeholder:"الرسالة...",notePlaceholder:"أضف ملاحظتك",see_your_location:"رؤية موقعك",location_permission:"يرجى منح إذن الموقع",download:"تحميل",template_message:"رسالة قالب",message:"أرسل رسالة",add_contact:"إضافة جهة اتصال",autoCompleteAcceptHint:"اضغط Tab أو مفتاح السهم الأيمن لإدراج الاقتراح كاملًا."},TR:{share_my_location:"Konumumu paylaş",share_my_current_location:"Güncel konumumu paylaş",placeholder:"Mesajınızı yazın",notePlaceholder:"Notunuzu ekleyin",see_your_location:"Konumunuzu Görüntüleyin",location_permission:"Lütfen konum paylaşımı için izin verin",download:"İndir",template_message:"Şablon Mesajı",message:"Mesaj",add_contact:"Kişi Ekle",autoCompleteAcceptHint:"Tam öneriyi eklemek için Tab veya Sağ ok tuşuna basın."}};const q=()=>e.jsx("svg",{width:"18",height:"22",viewBox:"0 0 18 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8.56055 0.249878C9.16365 0.249377 9.64011 0.249415 10.0869 0.407104C10.1792 0.439689 10.2701 0.477175 10.3584 0.519409C10.7858 0.723899 11.1227 1.06135 11.5488 1.48816L16.4443 6.38367C16.9387 6.87712 17.3304 7.26784 17.541 7.77625C17.7515 8.28461 17.7507 8.83754 17.75 9.53601V13.0565C17.75 14.8942 17.7498 16.3499 17.5967 17.4891C17.439 18.6615 17.1067 19.61 16.3584 20.3583C15.6101 21.1066 14.6616 21.4389 13.4893 21.5966C12.3501 21.7497 10.8943 21.7499 9.05664 21.7499H8.94336C7.10571 21.7499 5.64991 21.7497 4.51074 21.5966C3.33844 21.4389 2.38991 21.1066 1.6416 20.3583C0.893309 19.61 0.560952 18.6615 0.40332 17.4891C0.25016 16.3499 0.249984 14.8942 0.25 13.0565V8.4071C0.249988 6.82577 0.250388 5.57298 0.366211 4.58093C0.485107 3.56261 0.733898 2.72281 1.30176 2.01843C1.51427 1.75486 1.755 1.51514 2.01855 1.30261C2.72296 0.734673 3.56267 0.484993 4.58105 0.366089C5.57311 0.250277 6.8259 0.249866 8.40723 0.249878H8.56055ZM8.45605 1.74988C6.81549 1.74988 5.6499 1.75086 4.75488 1.85535C3.87608 1.95795 3.35453 2.15151 2.95996 2.4696C2.77959 2.61504 2.61516 2.77947 2.46973 2.95984C2.15159 3.35441 1.95808 3.87589 1.85547 4.75476C1.75097 5.64979 1.75 6.8153 1.75 8.45593V12.9999C1.75 14.9066 1.75151 16.2613 1.88965 17.2889C2.02491 18.295 2.27897 18.8745 2.70215 19.2977C3.12536 19.7209 3.70485 19.975 4.71094 20.1102C5.73859 20.2484 7.09323 20.2499 9 20.2499C10.9068 20.2499 12.2614 20.2484 13.2891 20.1102C14.2952 19.975 14.8746 19.7209 15.2979 19.2977C15.721 18.8745 15.9751 18.295 16.1104 17.2889C16.2485 16.2613 16.25 14.9066 16.25 12.9999V9.6571C16.25 9.21922 16.2468 8.94195 16.2334 8.74988H15.9453C14.5778 8.7499 13.4753 8.7502 12.6084 8.63367C11.7083 8.51265 10.9505 8.25316 10.3486 7.65125C9.74676 7.04934 9.48722 6.29156 9.36621 5.39148C9.24969 4.52456 9.24998 3.422 9.25 2.05457V1.76355C9.08319 1.75292 8.84192 1.74988 8.45605 1.74988ZM13 15.2499C13.4142 15.2499 13.75 15.5857 13.75 15.9999C13.75 16.4141 13.4142 16.7499 13 16.7499H5C4.58579 16.7499 4.25 16.4141 4.25 15.9999C4.25 15.5857 4.58579 15.2499 5 15.2499H13ZM9 11.2499C9.41421 11.2499 9.75 11.5857 9.75 11.9999C9.75 12.4141 9.41421 12.7499 9 12.7499H5C4.58579 12.7499 4.25 12.4141 4.25 11.9999C4.25 11.5857 4.58579 11.2499 5 11.2499H9ZM10.751 2.8114C10.7546 3.82629 10.7723 4.58818 10.8535 5.19226C10.9522 5.92571 11.1325 6.31399 11.4092 6.5907C11.6859 6.86746 12.0748 7.04771 12.8086 7.14636C13.4126 7.22753 14.1738 7.24524 15.1885 7.2489L10.751 2.8114Z",fill:"#16616C"})}),X=c.default.a`
|
|
142
142
|
${e=>e.isMyMessage?"flex-direction: row;":"flex-direction: row-reverse;"}
|
|
143
143
|
min-width: 300px;
|
|
144
144
|
display: flex;
|
|
@@ -296,7 +296,7 @@ i {
|
|
|
296
296
|
display: flex;
|
|
297
297
|
flex-direction: column;
|
|
298
298
|
gap: 8px;
|
|
299
|
-
`,Ae={document:({message:n,config:a,onReply:o})=>{const i=a.isAgent===n.isAgent,[r,s]=t.useState(""),l=t.useMemo((()=>{try{const e=(n.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[n.content]);t.useEffect((()=>{let e=!1;const t=n.content;if(t){try{new URL(t)}catch{return}return fetch(t,{method:"HEAD"}).then((t=>{if(!t.ok)return;const n=t.headers.get("content-length");if(!n)return;const a=Number(n);var o;!Number.isFinite(a)||a<0||(e||s((o=a)<1024?`${o} B`:o<1048576?`${(o/1024).toFixed(1)}KB`:o<1073741824?`${(o/1048576).toFixed(1)}MB`:`${(o/1073741824).toFixed(1)}GB`))})).catch((e=>{console.debug("Failed to fetch file size:",e)})),()=>{e=!0}}}),[n.content]);const c=r?`${r} - ${O[a.language]?.download}`:O[a.language]?.download;return e.jsx(J,{isMyMessage:i,createdAt:n.createdAt,message:n,config:a,onReply:o,children:e.jsx(X,{href:n.content,target:"_blank",download:l,rel:"noopener noreferrer",isMyMessage:i,children:e.jsxs(_,{isMyMessage:i,children:[e.jsx($,{children:e.jsx(q,{})}),e.jsxs(ee,{children:[e.jsx(te,{children:l}),e.jsx(ne,{children:c})]})]})})})},image:({message:t,config:n,onReply:a})=>{const o=n.isAgent===t.isAgent;return e.jsx(J,{className:"bc-mediaMessage",isMyMessage:o,createdAt:t.createdAt,message:t,config:n,onReply:a,isMedia:!0,children:e.jsx("a",{href:t.content,target:"_blank",rel:"noreferrer",children:e.jsx("img",{src:t.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:t,config:n,onReply:a})=>{const o=n.isAgent===t.isAgent;return e.jsx(J,{isMyMessage:o,createdAt:t.createdAt,message:t,config:n,onReply:a,children:e.jsx(ae,{href:"https://www.google.com/maps/?q="+t.content,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(oe,{children:[e.jsx(re,{color:"000000"}),e.jsx(ie,{children:"Open location"})]})})})},text:K,video:Y,audio:Y,interactive:null,template:({message:t,config:n,onReply:a})=>{const o=n.isAgent===t.isAgent;return e.jsxs(J,{isMyMessage:o,createdAt:t.createdAt,message:t,config:n,onReply:a,children:[e.jsx(ce,{})," ",e.jsx(de,{children:O[n.language]?.template_message||"Template Message"})]})},note:({message:t})=>{const n=i.franc(t.content);return e.jsxs(se,{children:[e.jsx(le,{language:n,children:t.content})," ",e.jsx(x,{createdAt:t.createdAt})]})},button:K,contacts:({message:n,config:a,onContactMessage:o,onContactAddContact:i})=>{const r=t.useMemo((()=>{try{const e=JSON.parse(n.content||"[]");return Array.isArray(e)?e:[e]}catch{return[]}}),[n.content]),s=t.useCallback((e=>{o&&o(e)}),[o]),l=t.useCallback((e=>{i&&i(e)}),[i]);return 0===r.length?null:e.jsx(Me,{children:r.map(((t,o)=>e.jsx(we,{contact:t,createdAt:0===o?n.createdAt:void 0,language:a.language,onMessage:()=>s(t),onAddContact:()=>l(t)},`${t.phone||o}`)))})}};function ke(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}ke('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-fontSize-sm);\n line-height: var(--bc-chat-lineHeight-sm);\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 12px;\n}\n.bc-otherMessage div p,\n.bc-myMessage div p {\n padding: 0;\n margin: 0;\n}\n\n/* Styles for agent messages */\n.bc-otherMessage {\n justify-content: flex-start;\n}\n.bc-otherMessage:first-child {\n flex: 1 0 50%;\n}\n.bc-otherMessage > :nth-child(2) {\n flex: 0 1 auto;\n max-width: 85%;\n}\n\n/* Styles for other messages */\n.bc-note {\n text-align: center;\n gap: 5px;\n}\n\n.bc-myMessage {\n justify-content: flex-end;\n}\n.bc-myMessage > div:not(.bc-debugCon),\n.bc-myMessage .bc-locationMessage,\n.bc-myMessage audio {\n color: #fff;\n}\n.bc-myMessage svg path:nth-child(2) {\n fill: #fff;\n}\n\n.bc-mediaMessage {\n position: relative;\n max-width: 300px !important;\n}\n.bc-mediaMessage audio,\n.bc-mediaMessage video,\n.bc-mediaMessage img {\n max-width: 100%;\n}\n.bc-mediaMessage audio {\n -webkit-appearance: none;\n -webkit-border-radius: 0;\n border-radius: 0;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n color: inherit;\n}\n.bc-mediaMessage audio {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n height: 40px !important;\n width: 100% !important;\n max-width: 400px !important;\n position: static !important;\n -webkit-appearance: none !important;\n -webkit-border-radius: 0 !important;\n border-radius: 0 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls {\n display: flex !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n display: flex !important;\n visibility: visible !important;\n background-color: #f0f0f0 !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-volume-slider {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n display: block !important;\n visibility: visible !important;\n color: #000 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-mute-button {\n display: block !important;\n visibility: visible !important;\n}\n\n.bc-mediaMessage.audio {\n width: 320px;\n height: 64px !important;\n}\n\n/* Custom audio player */\n.bc-audioPlayer {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 300px;\n position: relative;\n height: 50px;\n justify-self: flex-start;\n}\n\n.bc-audioPlayer audio {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.bc-audioPlayer__button {\n flex: 0 0 auto;\n width: 40px;\n height: 40px;\n border: none;\n border-radius: 50%;\n background: var(--bc-chat-white-color);\n position: relative;\n cursor: pointer;\n}\n\n.bc-otherMessage .bc-audioPlayer__button {\n background: #16616C;\n}\n\n.bc-audioPlayer__button.play::before {\n content: "";\n position: absolute;\n left: 12px;\n top: 12px;\n width: 16px;\n height: 16px;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%2316616C%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-otherMessage .bc-audioPlayer__button.play::before {\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-audioPlayer__button.pause::before,\n.bc-audioPlayer__button.pause::after {\n content: "";\n position: absolute;\n top: 14px;\n width: 3px;\n height: 12px;\n background: #16616C;\n}\n\n.bc-otherMessage .bc-audioPlayer__button.pause::before,\n.bc-otherMessage .bc-audioPlayer__button.pause::after {\n background: var(--bc-chat-white-color);\n}\n\n.bc-audioPlayer__button.pause::before {\n left: 16px;\n}\n\n.bc-audioPlayer__button.pause::after {\n right: 16px;\n}\n\n.bc-audioPlayer__wave {\n position: relative;\n flex: 1 1 auto;\n height: 22px;\n cursor: pointer;\n}\n\n.bc-audioPlayer__wave--future,\n.bc-audioPlayer__wave--past {\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n height: 22px;\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 2px;\n column-gap: 1px;\n align-items: end;\n width: 100%;\n pointer-events: none;\n}\n\n.bc-audioPlayer__wave--future span {\n display: block;\n width: 2px;\n background: rgba(255, 255, 255, 0.6);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--future span {\n background: #16616C;\n opacity: 0.6;\n}\n\n.bc-audioPlayer__wave--past {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.bc-audioPlayer__wave--past span {\n display: inline-block;\n width: 2px;\n margin-right: 3px;\n background: var(--bc-chat-white-color);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--past span {\n background: #16616C;\n}\n\n.bc-otherMessage:hover .bc-replyButton, .bc-otherMessage:active .bc-replyButton, .bc-myMessage:hover .bc-replyButton, .bc-myMessage:active .bc-replyButton {\n display: block;\n}\n\n.bc-audioPlayer__time {\n color: var(--bc-chat-white-color);\n font-weight: 400;\n opacity: 0.95;\n position: absolute;\n top: 46px;\n left: 80px;\n font-size: 10px;\n}\n\n.bc-otherMessage .bc-audioPlayer__time {\n color: #16616C;\n}\n\n.bc-selectionContainer {\n display: flex;\n align-items: flex-start;\n flex-wrap: wrap;\n}\n\n.bc-selectionContainer:first-child {\n flex: 1 0 50%;\n}\n\n.status-icon {\n color: var(--bc-chat-my-message-text-color) !important;\n opacity: 0.7;\n}\n.status-icon.read {\n color: #33C1FF !important;\n}\n.status-icon.failed {\n color: var(--bc-chat-danger-color) !important;\n}\n.status-icon.failed .resend {\n color: var(--bc-chat-text-secondary-dark) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const je=c.default.i`
|
|
299
|
+
`,Ae={document:({message:n,config:a,onReply:o})=>{const i=a.isAgent===n.isAgent,[r,s]=t.useState(""),l=t.useMemo((()=>{try{const e=(n.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[n.content]);t.useEffect((()=>{let e=!1;const t=n.content;if(t){try{new URL(t)}catch{return}return fetch(t,{method:"HEAD"}).then((t=>{if(!t.ok)return;const n=t.headers.get("content-length");if(!n)return;const a=Number(n);var o;!Number.isFinite(a)||a<0||(e||s((o=a)<1024?`${o} B`:o<1048576?`${(o/1024).toFixed(1)}KB`:o<1073741824?`${(o/1048576).toFixed(1)}MB`:`${(o/1073741824).toFixed(1)}GB`))})).catch((e=>{console.debug("Failed to fetch file size:",e)})),()=>{e=!0}}}),[n.content]);const c=r?`${r} - ${O[a.language]?.download}`:O[a.language]?.download;return e.jsx(J,{isMyMessage:i,createdAt:n.createdAt,message:n,config:a,onReply:o,children:e.jsx(X,{href:n.content,target:"_blank",download:l,rel:"noopener noreferrer",isMyMessage:i,children:e.jsxs(_,{isMyMessage:i,children:[e.jsx($,{children:e.jsx(q,{})}),e.jsxs(ee,{children:[e.jsx(te,{children:l}),e.jsx(ne,{children:c})]})]})})})},image:({message:t,config:n,onReply:a})=>{const o=n.isAgent===t.isAgent;return e.jsx(J,{className:"bc-mediaMessage",isMyMessage:o,createdAt:t.createdAt,message:t,config:n,onReply:a,isMedia:!0,children:e.jsx("a",{href:t.content,target:"_blank",rel:"noreferrer",children:e.jsx("img",{src:t.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:t,config:n,onReply:a})=>{const o=n.isAgent===t.isAgent;return e.jsx(J,{isMyMessage:o,createdAt:t.createdAt,message:t,config:n,onReply:a,children:e.jsx(ae,{href:"https://www.google.com/maps/?q="+t.content,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(oe,{children:[e.jsx(re,{color:"000000"}),e.jsx(ie,{children:"Open location"})]})})})},text:K,video:Y,audio:Y,interactive:null,template:({message:t,config:n,onReply:a})=>{const o=n.isAgent===t.isAgent;return e.jsxs(J,{isMyMessage:o,createdAt:t.createdAt,message:t,config:n,onReply:a,children:[e.jsx(ce,{})," ",e.jsx(de,{children:O[n.language]?.template_message||"Template Message"})]})},note:({message:t})=>{const n=i.franc(t.content);return e.jsxs(se,{children:[e.jsx(le,{language:n,children:t.content})," ",e.jsx(x,{createdAt:t.createdAt})]})},button:K,contacts:({message:n,config:a,onContactMessage:o,onContactAddContact:i})=>{const r=t.useMemo((()=>{try{const e=JSON.parse(n.content||"[]");return Array.isArray(e)?e:[e]}catch{return[]}}),[n.content]),s=t.useCallback((e=>{o&&o(e)}),[o]),l=t.useCallback((e=>{i&&i(e)}),[i]);return 0===r.length?null:e.jsx(Me,{children:r.map(((t,o)=>e.jsx(we,{contact:t,createdAt:0===o?n.createdAt:void 0,language:a.language,onMessage:()=>s(t),onAddContact:()=>l(t)},`${t.phone||o}`)))})}};function je(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}je('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-fontSize-sm);\n line-height: var(--bc-chat-lineHeight-sm);\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 12px;\n}\n.bc-otherMessage div p,\n.bc-myMessage div p {\n padding: 0;\n margin: 0;\n}\n\n/* Styles for agent messages */\n.bc-otherMessage {\n justify-content: flex-start;\n}\n.bc-otherMessage:first-child {\n flex: 1 0 50%;\n}\n.bc-otherMessage > :nth-child(2) {\n flex: 0 1 auto;\n max-width: 85%;\n}\n\n/* Styles for other messages */\n.bc-note {\n text-align: center;\n gap: 5px;\n}\n\n.bc-myMessage {\n justify-content: flex-end;\n}\n.bc-myMessage > div:not(.bc-debugCon),\n.bc-myMessage .bc-locationMessage,\n.bc-myMessage audio {\n color: #fff;\n}\n.bc-myMessage svg path:nth-child(2) {\n fill: #fff;\n}\n\n.bc-mediaMessage {\n position: relative;\n max-width: 300px !important;\n}\n.bc-mediaMessage audio,\n.bc-mediaMessage video,\n.bc-mediaMessage img {\n max-width: 100%;\n}\n.bc-mediaMessage audio {\n -webkit-appearance: none;\n -webkit-border-radius: 0;\n border-radius: 0;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n color: inherit;\n}\n.bc-mediaMessage audio {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n height: 40px !important;\n width: 100% !important;\n max-width: 400px !important;\n position: static !important;\n -webkit-appearance: none !important;\n -webkit-border-radius: 0 !important;\n border-radius: 0 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls {\n display: flex !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n display: flex !important;\n visibility: visible !important;\n background-color: #f0f0f0 !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-volume-slider {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n display: block !important;\n visibility: visible !important;\n color: #000 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-mute-button {\n display: block !important;\n visibility: visible !important;\n}\n\n.bc-mediaMessage.audio {\n width: 320px;\n height: 64px !important;\n}\n\n/* Custom audio player */\n.bc-audioPlayer {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 300px;\n position: relative;\n height: 50px;\n justify-self: flex-start;\n}\n\n.bc-audioPlayer audio {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.bc-audioPlayer__button {\n flex: 0 0 auto;\n width: 40px;\n height: 40px;\n border: none;\n border-radius: 50%;\n background: var(--bc-chat-white-color);\n position: relative;\n cursor: pointer;\n}\n\n.bc-otherMessage .bc-audioPlayer__button {\n background: #16616C;\n}\n\n.bc-audioPlayer__button.play::before {\n content: "";\n position: absolute;\n left: 12px;\n top: 12px;\n width: 16px;\n height: 16px;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%2316616C%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-otherMessage .bc-audioPlayer__button.play::before {\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-audioPlayer__button.pause::before,\n.bc-audioPlayer__button.pause::after {\n content: "";\n position: absolute;\n top: 14px;\n width: 3px;\n height: 12px;\n background: #16616C;\n}\n\n.bc-otherMessage .bc-audioPlayer__button.pause::before,\n.bc-otherMessage .bc-audioPlayer__button.pause::after {\n background: var(--bc-chat-white-color);\n}\n\n.bc-audioPlayer__button.pause::before {\n left: 16px;\n}\n\n.bc-audioPlayer__button.pause::after {\n right: 16px;\n}\n\n.bc-audioPlayer__wave {\n position: relative;\n flex: 1 1 auto;\n height: 22px;\n cursor: pointer;\n}\n\n.bc-audioPlayer__wave--future,\n.bc-audioPlayer__wave--past {\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n height: 22px;\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 2px;\n column-gap: 1px;\n align-items: end;\n width: 100%;\n pointer-events: none;\n}\n\n.bc-audioPlayer__wave--future span {\n display: block;\n width: 2px;\n background: rgba(255, 255, 255, 0.6);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--future span {\n background: #16616C;\n opacity: 0.6;\n}\n\n.bc-audioPlayer__wave--past {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.bc-audioPlayer__wave--past span {\n display: inline-block;\n width: 2px;\n margin-right: 3px;\n background: var(--bc-chat-white-color);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--past span {\n background: #16616C;\n}\n\n.bc-otherMessage:hover .bc-replyButton, .bc-otherMessage:active .bc-replyButton, .bc-myMessage:hover .bc-replyButton, .bc-myMessage:active .bc-replyButton {\n display: block;\n}\n\n.bc-audioPlayer__time {\n color: var(--bc-chat-white-color);\n font-weight: 400;\n opacity: 0.95;\n position: absolute;\n top: 46px;\n left: 80px;\n font-size: 10px;\n}\n\n.bc-otherMessage .bc-audioPlayer__time {\n color: #16616C;\n}\n\n.bc-selectionContainer {\n display: flex;\n align-items: flex-start;\n flex-wrap: wrap;\n}\n\n.bc-selectionContainer:first-child {\n flex: 1 0 50%;\n}\n\n.status-icon {\n color: var(--bc-chat-my-message-text-color) !important;\n opacity: 0.7;\n}\n.status-icon.read {\n color: #33C1FF !important;\n}\n.status-icon.failed {\n color: var(--bc-chat-danger-color) !important;\n}\n.status-icon.failed .resend {\n color: var(--bc-chat-text-secondary-dark) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const ke=c.default.i`
|
|
300
300
|
background-image: url(${e=>e.avatar||u});
|
|
301
301
|
width: 30px;
|
|
302
302
|
height: 30px;
|
|
@@ -305,7 +305,7 @@ i {
|
|
|
305
305
|
display: inline-block;
|
|
306
306
|
border-radius: 50%;
|
|
307
307
|
background-repeat: no-repeat;
|
|
308
|
-
`;function Le(e,t,n){return"note"===e?"bc-note":n.isAgent?t?"bc-myMessage":"bc-otherMessage":t?"bc-otherMessage":"bc-myMessage"}const Ee=t=>{const{type:n,isAgent:a}=t.message,o=t.message.isAgent&&t.message.agentId&&t.agentsIdsAvatarsMap?.[t.message.agentId]||t.config?.brandLogo,i=Ae[n]??null;return i?e.jsxs("div",{className:Le(n,a,t.config),id:t.message.messageId,style:{flexDirection:"AR"===t.config.language?"row-reverse":"row",alignItems:"flex-end"},children:[e.jsx(i,{message:t.message,config:t.config,searchPattern:t.searchPattern,onReply:t.onMessageReply,onContactMessage:t.onContactMessage,onContactAddContact:t.onContactAddContact}),t.config.isAgent&&a&&"note"!==n?e.jsx(
|
|
308
|
+
`;function Le(e,t,n){return"note"===e?"bc-note":n.isAgent?t?"bc-myMessage":"bc-otherMessage":t?"bc-otherMessage":"bc-myMessage"}const Ee=t=>{const{type:n,isAgent:a}=t.message,o=t.message.isAgent&&t.message.agentId&&t.agentsIdsAvatarsMap?.[t.message.agentId]||t.config?.brandLogo,i=Ae[n]??null;return i?e.jsxs("div",{className:Le(n,a,t.config),id:t.message.messageId,style:{flexDirection:"AR"===t.config.language?"row-reverse":"row",alignItems:"flex-end"},children:[e.jsx(i,{message:t.message,config:t.config,searchPattern:t.searchPattern,onReply:t.onMessageReply,onContactMessage:t.onContactMessage,onContactAddContact:t.onContactAddContact}),t.config.isAgent&&a&&"note"!==n?e.jsx(ke,{avatar:o}):null]}):null},Ie=c.default.div`
|
|
309
309
|
width: 90%;
|
|
310
310
|
display: flex;
|
|
311
311
|
align-items: center;
|
|
@@ -379,7 +379,7 @@ i {
|
|
|
379
379
|
font-size: var(--bc-chat-fontSize-sm);
|
|
380
380
|
line-height: var(--bc-chat-lineHeight-sm);
|
|
381
381
|
color: inherit;
|
|
382
|
-
`,Ze=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.95833 16.6667C4.70114 16.6667 1.25 13.2155 1.25 8.95833C1.25 4.70114 4.70114 1.25 8.95833 1.25C13.2155 1.25 16.6667 4.70114 16.6667 8.95833C16.6667 13.2155 13.2155 16.6667 8.95833 16.6667ZM0 8.95833C0 13.9059 4.01078 17.9167 8.95833 17.9167C13.9059 17.9167 17.9167 13.9059 17.9167 8.95833C17.9167 4.01078 13.9059 0 8.95833 0C4.01078 0 0 4.01078 0 8.95833ZM8.53419 8.75097C8.47632 8.75004 8.40939 8.75001 8.32682 8.75001C7.98164 8.75001 7.70182 8.47019 7.70182 8.12501C7.70182 7.77984 7.98164 7.50001 8.32682 7.50001L8.35553 7.50001C8.52646 7.49994 8.71128 7.49987 8.8673 7.52084C9.05007 7.54541 9.28356 7.60861 9.48006 7.80511C9.67656 8.00161 9.73975 8.2351 9.76433 8.41787C9.7853 8.57388 9.78523 8.75871 9.78516 8.92964V8.92964L9.78516 8.95835V13.125C9.78516 13.4702 9.50533 13.75 9.16016 13.75C8.81498 13.75 8.53516 13.4702 8.53516 13.125V8.95835C8.53516 8.87578 8.53513 8.80885 8.53419 8.75097ZM8.95182 4.79167C8.49159 4.79167 8.11849 5.16476 8.11849 5.625C8.11849 6.08524 8.49159 6.45833 8.95182 6.45833H8.95931C9.41955 6.45833 9.79264 6.08524 9.79264 5.625C9.79264 5.16476 9.41955 4.79167 8.95931 4.79167H8.95182Z",fill:"#6C737F"})});function Te(e){return new Date(e).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"})}function He(e){if(!e)return null;const t=e.querySelectorAll("[data-message-date]");if(0===t.length)return null;const n=e.getBoundingClientRect(),a=n.top+50;let o=null,i=null;for(const e of t){const t=e.getAttribute("data-message-date");if(!t)continue;const r=e.getBoundingClientRect();r.top<n.bottom&&r.bottom>n.top&&(!o||r.top<o.top)&&(o={date:t,top:r.top}),r.bottom<=a&&(!i||r.bottom>i.bottom)&&(i={date:t,bottom:r.bottom})}return o?o.date:i?i.date:t[0]?.getAttribute("data-message-date")??null}const Pe=({sendMessage:n,debug:a,config:o,messages:i,onReachingUp:r,agentsIdsAvatarsMap:s,searchPattern:l,searchMatchNo:c,onSearchMatchCount:d,onMessageReply:g,errorMessage:p,onContactMessage:u,onContactAddContact:h})=>{const C=t.useRef(null),x=t.useRef(0),[b,f]=t.useState(null),[v,y]=t.useState(!0),[w,M]=t.useState(null),A=p?.trim(),
|
|
382
|
+
`,Ze=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.95833 16.6667C4.70114 16.6667 1.25 13.2155 1.25 8.95833C1.25 4.70114 4.70114 1.25 8.95833 1.25C13.2155 1.25 16.6667 4.70114 16.6667 8.95833C16.6667 13.2155 13.2155 16.6667 8.95833 16.6667ZM0 8.95833C0 13.9059 4.01078 17.9167 8.95833 17.9167C13.9059 17.9167 17.9167 13.9059 17.9167 8.95833C17.9167 4.01078 13.9059 0 8.95833 0C4.01078 0 0 4.01078 0 8.95833ZM8.53419 8.75097C8.47632 8.75004 8.40939 8.75001 8.32682 8.75001C7.98164 8.75001 7.70182 8.47019 7.70182 8.12501C7.70182 7.77984 7.98164 7.50001 8.32682 7.50001L8.35553 7.50001C8.52646 7.49994 8.71128 7.49987 8.8673 7.52084C9.05007 7.54541 9.28356 7.60861 9.48006 7.80511C9.67656 8.00161 9.73975 8.2351 9.76433 8.41787C9.7853 8.57388 9.78523 8.75871 9.78516 8.92964V8.92964L9.78516 8.95835V13.125C9.78516 13.4702 9.50533 13.75 9.16016 13.75C8.81498 13.75 8.53516 13.4702 8.53516 13.125V8.95835C8.53516 8.87578 8.53513 8.80885 8.53419 8.75097ZM8.95182 4.79167C8.49159 4.79167 8.11849 5.16476 8.11849 5.625C8.11849 6.08524 8.49159 6.45833 8.95182 6.45833H8.95931C9.41955 6.45833 9.79264 6.08524 9.79264 5.625C9.79264 5.16476 9.41955 4.79167 8.95931 4.79167H8.95182Z",fill:"#6C737F"})});function Te(e){return new Date(e).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"})}function He(e){if(!e)return null;const t=e.querySelectorAll("[data-message-date]");if(0===t.length)return null;const n=e.getBoundingClientRect(),a=n.top+50;let o=null,i=null;for(const e of t){const t=e.getAttribute("data-message-date");if(!t)continue;const r=e.getBoundingClientRect();r.top<n.bottom&&r.bottom>n.top&&(!o||r.top<o.top)&&(o={date:t,top:r.top}),r.bottom<=a&&(!i||r.bottom>i.bottom)&&(i={date:t,bottom:r.bottom})}return o?o.date:i?i.date:t[0]?.getAttribute("data-message-date")??null}const Pe=({sendMessage:n,debug:a,config:o,messages:i,onReachingUp:r,agentsIdsAvatarsMap:s,searchPattern:l,searchMatchNo:c,onSearchMatchCount:d,onMessageReply:g,errorMessage:p,onContactMessage:u,onContactAddContact:h})=>{const C=t.useRef(null),x=t.useRef(0),[b,f]=t.useState(null),[v,y]=t.useState(!0),[w,M]=t.useState(null),A=p?.trim(),j=i.find((e=>"seperator"!==e.type)),k=j?.createdAt?Te(j.createdAt):null;t.useEffect((()=>{const e=document.getElementById(m);if(!e)return;x.current=e.scrollHeight;const t=()=>{0===e.scrollTop&&r?.();const t=e.scrollHeight-e.scrollTop-e.clientHeight<=4;y(t);const n=He(e);M((e=>n!==e?n:e))};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}}),[r]),t.useLayoutEffect((()=>{const e=C.current;if(!e)return;const t=x.current;if(e.scrollHeight-e.scrollTop<=e.clientHeight+200){const t=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,t),y(!0)}else{const n=e.scrollHeight-t;e.style.scrollBehavior="auto",e.scrollTop=e.scrollTop+n;const a=4,o=e.scrollHeight-e.scrollTop-e.clientHeight<=a;y(o)}x.current=e.scrollHeight;const n=He(e);M(n)}),[i,A]),t.useEffect((()=>{if(!l||!l.trim())return f(null),void d?.(0);const e=l.toLowerCase(),t=[];for(const n of i){const a=n&&n.content,o=n&&n.messageId;o&&a&&(String(a).toLowerCase().includes(e)&&t.push(o))}if(d?.(t.length),0===t.length)return void f(null);const n=t[Math.min(Math.max((c??1)-1,0),t.length-1)];f(n);const a=C.current,o=n?document.getElementById(n):null;a&&o&&(a.style.scrollBehavior="smooth",o.scrollIntoView())}),[l,c,i,d]);const L=w??k??null;return e.jsxs(Se,{ref:C,id:m,config:o,children:[L&&e.jsx(Fe,{children:e.jsx("span",{className:"sticky-date-pill-inner",children:L})}),i?.map(((t,r)=>"seperator"===t.type?e.jsx(Re,{data:t,config:o}):e.jsx("div",{"data-message-date":t.createdAt?Te(t.createdAt):void 0,children:e.jsx(Ee,{message:t,index:r,sendMessage:n,messageActionsEnabled:i.length-1===r,debug:a,config:o,agentsIdsAvatarsMap:s,highlighted:b===t.messageId,searchPattern:l,onMessageReply:g,onContactMessage:u,onContactAddContact:h})},t.messageId?t.messageId:"message"+r))),A&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{data:{type:"seperator"},config:o}),e.jsxs(Be,{role:"alert","aria-live":"assertive","data-testid":"chat-error-message",children:[e.jsx(ze,{children:e.jsx(Ze,{})}),e.jsx(Ne,{children:A})]})]}),!v&&e.jsx(De,{"aria-label":"Scroll to latest message",onClick:()=>{const e=C.current;if(!e)return;const t=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,t),y(!0)},children:e.jsx("svg",{width:"14",height:"8",viewBox:"0 0 14 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1.60372 0.555285C1.7256 0.716659 2.08951 1.1984 2.30624 1.47611C2.74031 2.03233 3.33342 2.77142 3.97323 3.50831C4.61627 4.24893 5.29178 4.97022 5.89189 5.50046C6.19281 5.76634 6.45714 5.96837 6.67527 6.09987C6.88042 6.22355 7.00161 6.24927 7.00161 6.24927C7.00161 6.24927 7.11923 6.22355 7.32437 6.09988C7.5425 5.96838 7.80684 5.76635 8.10775 5.50047C8.70786 4.97022 9.38337 4.24892 10.0264 3.5083C10.6662 2.7714 11.2593 2.0323 11.6934 1.47608C11.9101 1.19837 12.2735 0.717304 12.3954 0.555928C12.6411 0.222405 13.1111 0.150469 13.4446 0.396102C13.7781 0.641734 13.8494 1.11123 13.6037 1.44476L13.6018 1.4473C13.474 1.61655 13.0971 2.11556 12.8759 2.39892C12.4321 2.9677 11.8216 3.72861 11.1591 4.49171C10.4997 5.25109 9.77408 6.02979 9.10096 6.62454C8.76526 6.92116 8.42497 7.18788 8.0988 7.3845C7.79322 7.56872 7.40633 7.75 6.99982 7.75C6.59331 7.75 6.20642 7.56871 5.90084 7.3845C5.57468 7.18787 5.23439 6.92116 4.89869 6.62454C4.22557 6.02979 3.4999 5.2511 2.84058 4.49173C2.17803 3.72863 1.5676 2.96774 1.12372 2.39896C0.902432 2.11541 0.525506 1.61637 0.397929 1.44747L0.396279 1.44528C0.150645 1.11176 0.22154 0.641787 0.555062 0.396152C0.888572 0.150526 1.35808 0.221792 1.60372 0.555285Z",fill:"white"})})})]},m)},Ue="text";async function Ve(e,t,n){const a=new s.BlobServiceClient("https://bcuserres.blob.core.windows.net?sv=2024-11-04&ss=b&srt=o&sp=rc&se=2027-12-31T19:19:59Z&st=2026-01-02T11:04:59Z&spr=https&sig=OqvZvcz%2FmvmhVS8gWqPpMBxDZXHbEZ%2BTQRpCT3bE3G0%3D",new s.AnonymousCredential).getContainerClient("anonymous"),o=new Date,i=`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}`,l=a.getBlockBlobClient(`${i}/${r.v4()}`);try{await l.uploadBrowserData(e,{onProgress:n=>{const a=Math.round(n.loadedBytes/e.size*100);t(a)},blockSize:4194304,concurrency:20,blobHTTPHeaders:{blobContentType:e.type}});n(l.url.split("?")[0])}catch(e){n(void 0,"Error uploading file:"+e.message)}}const Ge=c.default.span`
|
|
383
383
|
cursor: pointer;
|
|
384
384
|
width: 20px;
|
|
385
385
|
height: 20px;
|
|
@@ -419,11 +419,8 @@ i {
|
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
.bc-autoCompleteOverlay {
|
|
422
|
-
position:
|
|
423
|
-
|
|
424
|
-
left: 0;
|
|
425
|
-
right: 0;
|
|
426
|
-
bottom: 0;
|
|
422
|
+
position: absolute;
|
|
423
|
+
inset: 0;
|
|
427
424
|
pointer-events: none;
|
|
428
425
|
padding: 10px 0;
|
|
429
426
|
font-family: var(--bc-chat-font-stack);
|
|
@@ -444,14 +441,40 @@ i {
|
|
|
444
441
|
direction: rtl;
|
|
445
442
|
}
|
|
446
443
|
}
|
|
447
|
-
`,Xe=
|
|
448
|
-
|
|
444
|
+
`,Xe=c.default.div`
|
|
445
|
+
position: relative;
|
|
446
|
+
width: 100%;
|
|
447
|
+
`,_e=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:e.jsx("path",{d:"M15 18l-6-6 6-6v4h8v4h-8v4zM5 6v12h2V6H5z",fill:"currentColor"})}),$e=c.default.div`
|
|
448
|
+
display: flex;
|
|
449
|
+
align-items: center;
|
|
450
|
+
gap: 6px;
|
|
451
|
+
margin-top: 4px;
|
|
452
|
+
padding-inline-end: 4px;
|
|
453
|
+
max-width: 100%;
|
|
454
|
+
color: #b0b8c1;
|
|
455
|
+
pointer-events: none;
|
|
456
|
+
`,et=c.default.span`
|
|
457
|
+
font-family: var(--bc-chat-font-stack);
|
|
458
|
+
font-size: 11px;
|
|
459
|
+
font-weight: 400;
|
|
460
|
+
line-height: 1.35;
|
|
461
|
+
color: #b0b8c1;
|
|
462
|
+
flex: 1;
|
|
463
|
+
min-width: 0;
|
|
464
|
+
`,tt=c.default.span`
|
|
465
|
+
flex-shrink: 0;
|
|
466
|
+
display: flex;
|
|
467
|
+
align-items: center;
|
|
468
|
+
justify-content: center;
|
|
469
|
+
color: #c5cdd6;
|
|
470
|
+
`,nt=({text:n,setText:a,config:o,send:i,placeholder:r,autoCompleteEnabled:s,autoCompleteSuggestion:l,onInputChange:c,onAutoCompleteMutate:d})=>{const g=t.useRef(null),p="AR"===o?.language,u=t.useCallback((()=>{const e=g.current;if(!e)return;e.style.height="20px";const t=e.scrollHeight;t!==e.offsetHeight&&(e.style.height=t+"px")}),[]);t.useEffect((()=>{n||(u(),g.current?.focus())}),[u,n]),t.useEffect((()=>{s&&g.current&&g.current.focus()}),[s,l]);const h=Boolean(s&&l),m=O[o.language]?.autoCompleteAcceptHint??O.EN.autoCompleteAcceptHint;return e.jsxs(qe,{isRTL:p,children:[e.jsxs(Xe,{children:[e.jsx("textarea",{ref:g,value:n,className:"bc-messageInputTextArea",id:"textInput",placeholder:r,maxLength:1024,dir:p?"rtl":"ltr",onKeyDown:e=>{if(s&&l&&("Tab"===e.key||"ArrowRight"===e.key&&!e.shiftKey)){e.preventDefault();const t=(n||"")+l;return a(t),u(),c?.(t),void d?.(null)}if("Enter"===e.key&&(e.shiftKey||e.ctrlKey||e.altKey)){e.preventDefault();const t=g.current?.selectionStart||0,o=n.slice(0,t)+"\n"+n.slice(t);return a(o),u(),void c?.(o)}"Enter"===e.key&&(e.preventDefault(),i(),u())},onChange:e=>{const t=e.target.value,o=n||"";if(a(t),u(),c?.(t),s&&l&&d){const e=o+l;if(t&&e.toLowerCase().startsWith(t.toLowerCase())){const n=e.slice(t.length);n.length>0?d(n):d(null)}else d(null)}},style:{color:h?"transparent":void 0}}),h&&e.jsxs("div",{className:"bc-autoCompleteOverlay",children:[n,e.jsx("span",{className:"bc-suggestion",children:l})]})]}),h&&e.jsxs($e,{children:[e.jsx(tt,{children:e.jsx(_e,{})}),e.jsx(et,{children:m})]})]})},at=({config:t,send:n,file:a,isFileSelected:o,text:i,setText:r,cancelFileUpload:s,noteMode:l,onCloseNoteMode:c,notePlaceholder:d,autoCompleteEnabled:g,autoCompleteSuggestion:p,onInputChange:u,onAutoCompleteMutate:h})=>{const m="AR"===t?.language,C=Array.isArray(a)?a:a?[a]:[],x=C.length>0;return e.jsxs("div",{className:"bc-messageInput "+(m?"bc-RTL":""),children:[l?e.jsx(Je,{onClick:c,isRTL:m,children:e.jsx(Qe,{})}):null,x?e.jsx(Ye,{children:C.map(((n,a)=>e.jsx(Oe,{file:n,isFileSelected:o,cancelFileUpload:s,config:t},`${n.fileName}-${a}-${n.fileUrl}`)))}):null,x?null:e.jsx(nt,{text:i||"",setText:r,config:t,send:n,placeholder:l?d||O[t.language]?.notePlaceholder:t.inputPlaceholder||O[t.language]?.placeholder,autoCompleteEnabled:g,autoCompleteSuggestion:p,onInputChange:u,onAutoCompleteMutate:h}),e.jsx(Ge,{onClick:()=>n(),isRTL:m,children:i||x?e.jsx(Ke,{}):null})]})},ot=(e,t)=>`\n &:hover {\n background-image: ${e.replaceAll("%23a3a3a3",t.activeColor)};\n }\n background-image: ${t.isActive?e.replaceAll("%23a3a3a3",t.activeColor):e};\n`,it="\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: 4px;\nborder-radius: 8px;\nborder: 1px solid #D2D6DB;\nbackground: #FFF;\ntransition: background-color 0.2s ease, border-color 0.2s ease;\ncursor: pointer;\nfont-size: 14px;\n&:hover {\n background: #f7f7f7;\n border-color: #dcdcdc;\n}\n&:active {\n background: #f0f0f0;\n}\n";c.default.button`
|
|
471
|
+
${it}
|
|
449
472
|
height: 32px;
|
|
450
473
|
min-height: 32px;
|
|
451
474
|
max-height: 32px;
|
|
452
475
|
padding: 0 12px;
|
|
453
|
-
`;const
|
|
454
|
-
${
|
|
476
|
+
`;const rt=c.default.label`
|
|
477
|
+
${it}
|
|
455
478
|
width: 32px;
|
|
456
479
|
height: 32px;
|
|
457
480
|
min-width: 32px;
|
|
@@ -459,30 +482,30 @@ i {
|
|
|
459
482
|
min-height: 32px;
|
|
460
483
|
max-height: 32px;
|
|
461
484
|
padding: 0;
|
|
462
|
-
`,
|
|
463
|
-
${e
|
|
464
|
-
`,
|
|
485
|
+
`,st=c.default.i`
|
|
486
|
+
${e=>ot('url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2218%22%20viewBox%3D%220%200%2016%2018%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M14.667%207.54199C15.012%207.54217%2015.292%207.82192%2015.292%208.16699C15.2918%2011.9834%2012.3594%2015.1146%208.625%2015.4316V16.708H10.5C10.8451%2016.708%2011.1248%2016.988%2011.125%2017.333C11.125%2017.6782%2010.8452%2017.958%2010.5%2017.958H5.5C5.15482%2017.958%204.875%2017.6782%204.875%2017.333C4.87518%2016.988%205.15493%2016.708%205.5%2016.708H7.375V15.4316C3.64062%2015.1146%200.708174%2011.9834%200.708008%208.16699C0.708008%207.82192%200.98798%207.54217%201.33301%207.54199C1.67819%207.54199%201.95801%207.82181%201.95801%208.16699C1.95818%2011.5036%204.66339%2014.208%208%2014.208C11.3366%2014.208%2014.0418%2011.5036%2014.042%208.16699C14.042%207.82181%2014.3218%207.54199%2014.667%207.54199ZM8%200.0419922C10.6463%200.0419922%2012.7918%202.18679%2012.792%204.83301V8.16699C12.7918%2010.8132%2010.6463%2012.958%208%2012.958C5.35374%2012.958%203.20818%2010.8132%203.20801%208.16699V4.83301C3.20818%202.18679%205.35374%200.0419924%208%200.0419922ZM8%201.29199C6.0441%201.29199%204.45818%202.87715%204.45801%204.83301V8.16699C4.45818%2010.1229%206.0441%2011.708%208%2011.708C9.74256%2011.708%2011.1899%2010.4496%2011.4854%208.79199H9.66699C9.32192%208.79199%209.04217%208.51202%209.04199%208.16699C9.04199%207.82181%209.32181%207.54199%209.66699%207.54199H11.542V5.45801H9.66699C9.32181%205.45801%209.04199%205.17819%209.04199%204.83301C9.04217%204.48798%209.32192%204.20801%209.66699%204.20801H11.4854C11.1899%202.55035%209.74256%201.29199%208%201.29199Z%22%20fill%3D%22%23161616%22%2F%3E%3C%2Fsvg%3E");',e)}
|
|
487
|
+
`,lt=c.default.div`
|
|
465
488
|
${e=>e.isRecording&&`\n &:before {\n transform: scale(${1+e.audioLevel/255});\n opacity: ${.6+e.audioLevel/255*.4};\n }\n `}
|
|
466
|
-
`,
|
|
489
|
+
`,ct=c.default.span`
|
|
467
490
|
display: inline-flex;
|
|
468
491
|
align-items: center;
|
|
469
492
|
justify-content: center;
|
|
470
493
|
|
|
471
494
|
${e=>e.isRTL&&"\n svg {\n transform: scaleX(-1);\n }\n "}
|
|
472
|
-
`,
|
|
495
|
+
`,dt=({isRTL:t})=>e.jsx(ct,{isRTL:t,children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1.20308 1.04312C1.00481 0.954998 0.772341 1.0048 0.627577 1.16641C0.482813 1.32802 0.458794 1.56455 0.568117 1.75196L3.92115 7.50002L0.568117 13.2481C0.458794 13.4355 0.482813 13.672 0.627577 13.8336C0.772341 13.9952 1.00481 14.045 1.20308 13.9569L14.7031 7.95693C14.8836 7.87668 15 7.69762 15 7.50002C15 7.30243 14.8836 7.12337 14.7031 7.04312L1.20308 1.04312ZM4.84553 7.10002L2.21234 2.586L13.2689 7.50002L2.21234 12.414L4.84552 7.90002H9C9.22092 7.90002 9.4 7.72094 9.4 7.50002C9.4 7.27911 9.22092 7.10002 9 7.10002H4.84553Z",fill:"#666",fillRule:"evenodd",clipRule:"evenodd"})})}),gt=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M12.8536 2.85355C13.0488 2.65829 13.0488 2.34171 12.8536 2.14645C12.6583 1.95118 12.3417 1.95118 12.1464 2.14645L7.5 6.79289L2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.79289 7.5L2.14645 12.1464C1.95118 12.3417 1.95118 12.6583 2.14645 12.8536C2.34171 13.0488 2.65829 13.0488 2.85355 12.8536L7.5 8.20711L12.1464 12.8536C12.3417 13.0488 12.6583 13.0488 12.8536 12.8536C13.0488 12.6583 13.0488 12.3417 12.8536 12.1464L8.20711 7.5L12.8536 2.85355Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),pt={sampleRate:48e3,channelCount:1,sampleSize:128,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,googEchoCancellation:!0,googAutoGainControl:!0,googNoiseSuppression:!0,googHighpassFilter:!0,googTypingNoiseDetection:!0,googAudioMirroring:!1},ut=c.default.div`
|
|
473
496
|
display: flex;
|
|
474
497
|
align-items: center;
|
|
475
498
|
gap: 5px;
|
|
476
499
|
direction: ${e=>e.isRTL?"rtl":"ltr"};
|
|
477
|
-
`,
|
|
478
|
-
${e
|
|
479
|
-
`,
|
|
500
|
+
`,ht=({setProgress:n,setError:a,setFile:o,onActiveChange:i,config:r})=>{const s="AR"===r?.language,[l,c]=t.useState(!1),[d,g]=t.useState(0),p=t.useRef(null),u=t.useRef(null),h=t.useRef(null),m=t.useRef(null),C=t.useRef(null),x=t.useRef(null);t.useEffect((()=>{const e=document.createElement("script");return e.src="https://unpkg.com/mic-recorder-to-mp3",e.async=!0,e.onload=()=>console.log("Voice recording library loaded successfully"),e.onerror=()=>{console.error("Failed to load voice recording library"),a("Failed to load voice recording library. Please refresh the page.")},document.body.appendChild(e),()=>{document.body.contains(e)&&document.body.removeChild(e)}}),[a]);const b=t.useCallback((e=>{try{if(!e.active)return void navigator.mediaDevices.getUserMedia({audio:pt}).then((e=>{u.current=e,b(e)})).catch((e=>{console.error("Failed to get fresh stream:",e)}));h.current=new(window.AudioContext||window.webkitAudioContext),"suspended"===h.current.state&&h.current.resume().then((()=>{}));const t=h.current.createMediaStreamSource(e);m.current=h.current.createAnalyser(),m.current.fftSize=256,m.current.smoothingTimeConstant=.8,m.current.minDecibels=-90,m.current.maxDecibels=-10,t.connect(m.current);const n=m.current.frequencyBinCount;C.current=new Uint8Array(n);const a=()=>{if(!m.current)return;m.current.getByteFrequencyData(C.current);let e=0;for(let t=0;t<n;t++)e+=C.current[t]*C.current[t];const t=Math.sqrt(e/n),o=Math.min(255,2*t);g(o),x.current=requestAnimationFrame(a)};a()}catch(e){console.error("Audio level monitoring error:",e)}}),[]),f=t.useCallback((()=>{x.current&&(cancelAnimationFrame(x.current),x.current=null),h.current&&(h.current.close(),h.current=null),g(0)}),[]),v=t.useCallback((()=>{u.current&&(u.current.getTracks().forEach((e=>{e.stop()})),u.current=null)}),[]);t.useEffect((()=>()=>{p.current&&l&&p.current.stop(),v(),f()}),[l,f,v]);const y=t.useCallback((()=>{if(!p.current){if("function"!=typeof MicRecorder)return void a("Please wait a little until voice library is loaded");p.current=new MicRecorder({bitRate:128,sampleRate:48e3})}a(void 0),l?p.current.stop().getMp3().then((([e,t])=>{if(c(!1),f(),v(),i&&i(!0),t.size<1e3)return void a("Recording seems too short. Please try again.");if(!t||0===t.size)return void a("Invalid audio recording. Please try again.");const n=(new Date).toISOString().replace(/[:.]/g,"-"),r=new File([t],`recording-${n}.mp3`,{type:"audio/mpeg"}),s=URL.createObjectURL(r);o({fileUrl:s,fileName:`recording-${n}.mp3`,extension:"mp3",blob:r}),i&&i(!1)})).catch((e=>{c(!1),f(),v(),a(`Recording failed: ${e.message}`),i&&i(!1)})):navigator.mediaDevices.getUserMedia({audio:pt}).then((e=>{u.current=e,p.current.start().then((()=>{c(!0),i&&i(!0),setTimeout((()=>{h.current&&"suspended"===h.current.state?h.current.resume().then((()=>{b(e)})).catch((t=>{console.error("Failed to resume audio context:",t),b(e)})):b(e)}),100)})).catch((t=>{a(`Failed to start recording: ${t.message}`),e.getTracks().forEach((e=>e.stop())),i&&i(!1)}))})).catch((e=>{"NotAllowedError"===e.name?a("Microphone access denied. Please allow microphone access and try again."):"NotFoundError"===e.name?a("No microphone found. Please connect a microphone and try again."):a(`Microphone error: ${e.message}`),i&&i(!1)}))}),[l,a,o,b,f,v,i]),w=t.useCallback((()=>{p.current&&l&&p.current.stop(),c(!1),f(),v(),a(void 0),i&&i(!1)}),[l,f,v,a,i]);return e.jsxs(ut,{isRTL:s&&l,children:[l?e.jsx(rt,{onClick:w,children:e.jsx(gt,{})}):null,e.jsx(rt,{onClick:y,id:"voiceRecorderIcon",className:"mic-container",children:l?e.jsxs(e.Fragment,{children:[e.jsx(dt,{isRTL:s}),e.jsx(lt,{className:"circle "+(l?"active":""),isRecording:l,audioLevel:d})]}):e.jsx(st,{activeColor:"var(--bc-chat-text-secondary-dark)"})})]})};const mt=c.default.i`
|
|
501
|
+
${e=>ot('url("data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M10%2019.084C15.0163%2019.0838%2019.0838%2015.0163%2019.084%2010C19.0838%204.98367%2015.0163%200.917168%2010%200.916992C4.98367%200.917168%200.917168%204.98367%200.916992%2010C0.917168%2015.0163%204.98367%2019.0838%2010%2019.084ZM10%2017.584C5.8121%2017.5838%202.41717%2014.1879%202.41699%2010C2.41717%205.8121%205.8121%202.41717%2010%202.41699C14.1879%202.41717%2017.5838%205.8121%2017.584%2010C17.5838%2014.1879%2014.1879%2017.5838%2010%2017.584ZM6.6748%208.5C7.22679%208.49964%207.6748%208.05206%207.6748%207.5C7.6748%206.94794%207.22679%206.50036%206.6748%206.5H6.66699C6.11471%206.5%205.66699%206.94771%205.66699%207.5C5.66699%208.05229%206.11471%208.5%206.66699%208.5H6.6748ZM13.334%208.5C13.886%208.49965%2014.334%208.05207%2014.334%207.5C14.334%206.94793%2013.886%206.50035%2013.334%206.5H13.3262C12.7739%206.50001%2012.3262%206.94772%2012.3262%207.5C12.3262%208.05228%2012.7739%208.49999%2013.3262%208.5H13.334ZM10%2014.917C11.6088%2014.9169%2013.038%2014.1426%2013.9336%2012.9502C14.1819%2012.6191%2014.115%2012.1491%2013.7842%2011.9004C13.453%2011.6517%2012.9832%2011.7188%2012.7344%2012.0498C12.1099%2012.8813%2011.117%2013.4169%2010%2013.417C8.88307%2013.4169%207.89111%2012.8811%207.2666%2012.0498C7.01792%2011.7187%206.54798%2011.6519%206.2168%2011.9004C5.88563%2012.1491%205.81871%2012.619%206.06738%2012.9502C6.96298%2014.1425%208.39126%2014.9169%2010%2014.917Z%22%20fill%3D%22%23161616%22%2F%3E%3C%2Fsvg%3E");',e)}
|
|
502
|
+
`,Ct=c.default.span`
|
|
480
503
|
margin: 8px;
|
|
481
504
|
cursor: pointer;
|
|
482
505
|
font-size: var(--bc-chat-fontSize-xl);
|
|
483
|
-
`,
|
|
484
|
-
${e
|
|
485
|
-
`,
|
|
506
|
+
`,xt=({onClick:t})=>e.jsx("div",{id:"emojiIcon",children:e.jsx(rt,{children:e.jsx(mt,{onClick:t,activeColor:"var(--bc-chat-text-secondary-dark)"})})}),bt=({text:n,setText:a,onClick:o})=>{const i=function(e){const n=t.useRef(null);return t.useEffect((()=>{const t=t=>{n.current&&!n.current.contains(t.target)&&e()};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}),[e]),n}(o),r=t.useCallback((e=>{a(n+e)}),[a,n]),s=h.map(((t,n)=>e.jsx(Ct,{className:"emoji",onClick:e=>r(e.target.innerText),children:t},"emoji"+n)));return e.jsx("div",{ref:i,children:e.jsx("div",{className:"bc-emojiPicker",id:"emojiPicker",children:s})})},ft=c.default.i`
|
|
507
|
+
${e=>ot('url("data:image/svg+xml,%3Csvg%20width%3D%2214%22%20height%3D%2218%22%20viewBox%3D%220%200%2014%2018%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.91667%202.12488C2.96066%202.12488%201.375%203.71054%201.375%205.66655L1.375%2010.2499C1.375%2013.3565%203.8934%2015.8749%207%2015.8749C10.1066%2015.8749%2012.625%2013.3565%2012.625%2010.2499V8.99993C12.625%208.65475%2012.9048%208.37493%2013.25%208.37493C13.5952%208.37493%2013.875%208.65475%2013.875%208.99993V10.2499C13.875%2014.0469%2010.797%2017.1249%207%2017.1249C3.20304%2017.1249%200.125%2014.0469%200.125%2010.2499L0.125%205.66655C0.125%203.02018%202.2703%200.874878%204.91667%200.874878C7.56303%200.874878%209.70833%203.02018%209.70833%205.66654V10.2499C9.70833%2011.7456%208.49577%2012.9582%207%2012.9582C5.50423%2012.9582%204.29167%2011.7456%204.29167%2010.2499L4.29167%206.91654C4.29167%206.57137%204.57149%206.29154%204.91667%206.29154C5.26184%206.29154%205.54167%206.57137%205.54167%206.91654L5.54167%2010.2499C5.54167%2011.0553%206.19458%2011.7082%207%2011.7082C7.80542%2011.7082%208.45833%2011.0553%208.45833%2010.2499V5.66654C8.45833%203.71054%206.87267%202.12488%204.91667%202.12488Z%22%20fill%3D%22%23161616%22%2F%3E%3C%2Fsvg%3E");',e)}
|
|
508
|
+
`,vt=({setProgress:n,setFile:a,setError:o})=>{const i=t.useCallback((e=>{o(void 0);const t=Array.from(e.target.files);if(e.target.value="",t.length<1)return;const i=[];for(const e of t){const{name:t,size:n}=e,a=t.substring(t.lastIndexOf(".")+1).toLowerCase();if(p.SupportedFormats.indexOf(a)<0){o(`File "${t}" type is not valid.`);continue}if(n>p.MaxFileSize){o(`File "${t}" exceeds maximum limit of 20 MBs.`);continue}const r={fileUrl:URL.createObjectURL(e),fileName:t,extension:a,blob:e};i.push({file:e,bcFile:r})}if(0===i.length)return;a((e=>[...e,...i.map((({bcFile:e})=>e))]));let r=0;const s=[];i.forEach((({file:e,bcFile:t})=>{Ve(e,n,((e,l)=>{if(r++,e){try{URL.revokeObjectURL(t.fileUrl)}catch{}const n={...t,fileUrl:e,blob:void 0};s.push(n),a((e=>e.map((e=>e.fileName===t.fileName&&e.fileUrl===t.fileUrl?n:e))))}else l&&(a((e=>{const n=e.filter((e=>!(e.fileName===t.fileName&&e.fileUrl===t.fileUrl)));try{URL.revokeObjectURL(t.fileUrl)}catch{}return n})),o(`Failed to upload "${t.fileName}": ${l}`));r===i.length&&n(0)}))}))}),[n,a,o]),r=t.useCallback((()=>{o(void 0)}),[o]);return e.jsxs("div",{id:"attachIcon",children:[e.jsx(rt,{htmlFor:"fileInput",onClick:r,children:e.jsx(ft,{activeColor:"var(--bc-chat-text-secondary-dark)"})}),e.jsx("input",{type:"file",className:"bc-fileUpload",id:"fileInput",multiple:!0,onChange:i,onClick:r})]})},yt=c.default.div`
|
|
486
509
|
padding: 0px 0px 0px 10px;
|
|
487
510
|
margin: 0px;
|
|
488
511
|
width: fit-content;
|
|
@@ -501,7 +524,7 @@ i {
|
|
|
501
524
|
cursor: pointer;
|
|
502
525
|
display: block;
|
|
503
526
|
}
|
|
504
|
-
`,
|
|
527
|
+
`,wt=({setView:n,setFile:a,setProgress:o,setError:i,text:r,setText:s,send:l,config:c})=>{const[d,g]=t.useState(!1),[p,u]=t.useState(!1),h="AR"===c?.language;return e.jsxs("div",{className:"bc-inputActions",id:"bc-inputActions",children:[e.jsxs(yt,{id:"iconsContainer",isRTL:h,children:[p?null:e.jsxs(e.Fragment,{children:[e.jsx(vt,{setFile:a,setProgress:o,setError:i}),e.jsx(xt,{onClick:()=>g(!0)})]}),e.jsx(ht,{setFile:a,setError:i,setProgress:o,onActiveChange:e=>{u(e),e&&g(!1)},config:c})]}),d?e.jsx(bt,{text:r,setText:s,onClick:()=>g(!1)}):null]})};je('.bc-trademark {\n height: 40px;\n width: 100%;\n box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.1);\n background-color: #fff;\n overflow-y: hidden;\n border-bottom-left-radius: 15px;\n border-bottom-right-radius: 15px;\n padding: 15px 0;\n}\n\n.bc-messageInput {\n min-height: 30px;\n max-height: 100%;\n background-color: #fff;\n overflow-y: hidden;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.bc-messageInput .bc-messageInputTextArea {\n color: var(--bc-chat-text-secondary-dark);\n display: block;\n min-height: 36px;\n background-color: #fff;\n box-sizing: border-box;\n font-family: var(--bc-chat-font-stack);\n font-size: var(--bc-chat-fontSize-md);\n padding: 10px 0;\n resize: none;\n overflow: auto;\n border-width: 0;\n width: calc(100% - 20px);\n word-wrap: break-word;\n border: none;\n overflow: hidden;\n outline: none;\n -webkit-box-shadow: none;\n -moz-box-shadow: none;\n box-shadow: none;\n}\n.bc-messageInput.bc-RTL {\n direction: rtl;\n}\n\n.bc-inputActions {\n display: flex;\n align-items: center;\n position: relative;\n width: fit-content;\n height: 36px;\n margin-left: auto;\n}\n.bc-inputActions .bc-fileUpload {\n display: none;\n}\n.bc-inputActions i {\n display: block;\n margin: 0 5px;\n}\n.bc-inputActions.bc-RTL {\n direction: rtl;\n}\n\n.bc-ActionChips {\n display: flex;\n gap: 10px;\n}\n\n.bc-BottomBar {\n width: 100%;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-top: 8px;\n}\n.bc-BottomBar.bc-RTL {\n direction: rtl;\n}\n\n.bc-CommandsArea {\n margin-left: auto;\n display: flex;\n align-items: center;\n}\n.bc-CommandsArea.bc-RTL {\n margin-left: 0;\n margin-right: auto;\n direction: rtl;\n}\n\n.bc-emojiPicker {\n position: absolute;\n bottom: 40px;\n right: 0;\n width: 200px;\n background: var(--bc-chat-white-color) 0% 0% no-repeat padding-box;\n box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1019607843);\n border-radius: 10px;\n opacity: 1;\n padding: 10px;\n z-index: 10;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n}\n[dir=rtl] .bc-emojiPicker, .bc-RTL .bc-emojiPicker {\n right: auto;\n left: 0;\n}\n\n.bc-uploadFileDetails {\n background-color: transparent;\n display: flex;\n align-items: center;\n width: calc(100% - 60px);\n height: 40px;\n padding: 4px 10px;\n}\n.bc-uploadFileDetails.bc-RTL {\n direction: rtl;\n}\n.bc-uploadFileDetails audio {\n width: 260px;\n}\n.bc-uploadFileDetails .bc-uploadedFile {\n max-width: 32px;\n max-height: 32px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-imageFile {\n max-width: 100%;\n max-height: 100%;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-documentFile {\n max-width: 100%;\n max-height: 100%;\n margin-top: 4px;\n min-width: 25px;\n min-height: 25px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName span {\n padding: 10px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileCancel {\n cursor: pointer;\n margin-bottom: -6px;\n margin-left: 6px;\n color: var(--bc-chat-danger-color);\n}\n[dir=rtl] .bc-uploadFileDetails .bc-uploadFileCancel, .bc-RTL .bc-uploadFileDetails .bc-uploadFileCancel {\n margin-left: 0;\n margin-right: 6px;\n}\n\n.mic-container {\n position: relative;\n}\n.mic-container svg {\n z-index: 5;\n}\n.mic-container i {\n transition: 0.9s;\n z-index: 10;\n position: relative;\n}\n.mic-container .circle {\n z-index: 4;\n top: 3px;\n left: 3px;\n position: absolute;\n background-color: transparent;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1;\n transition: 0.5s;\n}\n.mic-container .circle:before {\n content: "";\n width: 36px;\n height: 36px;\n border-radius: 50%;\n opacity: 0.5;\n z-index: 3;\n position: absolute;\n}\n.mic-container .circle.active {\n background-color: #A8E6A3;\n}\n.mic-container .circle.active:before {\n background: #A8E6A3;\n}\n\n@keyframes bounce {\n 0% {\n transform: scale(1);\n }\n 25% {\n transform: scale(1.4);\n }\n 75% {\n transform: scale(1);\n }\n 100% {\n transform: scale(1.3);\n }\n}');const Mt=c.default.div`
|
|
505
528
|
display: flex;
|
|
506
529
|
padding: 8px 16px 16px 16px;
|
|
507
530
|
flex-direction: column;
|
|
@@ -525,7 +548,7 @@ i {
|
|
|
525
548
|
margin-top: 6px;
|
|
526
549
|
text-align: center;
|
|
527
550
|
}
|
|
528
|
-
`,
|
|
551
|
+
`,At=c.default.div`
|
|
529
552
|
width: 100%;
|
|
530
553
|
padding: 8px 12px;
|
|
531
554
|
display: flex;
|
|
@@ -535,14 +558,14 @@ i {
|
|
|
535
558
|
gap: 4px;
|
|
536
559
|
flex: 1 0 0;
|
|
537
560
|
border-bottom: 1px solid var(--bc-border-neutral-secondary, #E5E7EB);
|
|
538
|
-
`,
|
|
561
|
+
`,jt=c.default.div`
|
|
539
562
|
display: flex;
|
|
540
563
|
align-items: center;
|
|
541
564
|
justify-content: space-between;
|
|
542
565
|
gap: 8px;
|
|
543
566
|
direction: ${({isRTL:e})=>e?"rtl":"ltr"};
|
|
544
567
|
|
|
545
|
-
`,
|
|
568
|
+
`,kt=c.default.span`
|
|
546
569
|
font-weight: 500;
|
|
547
570
|
font-size: var(--bc-chat-fontSize-sm);
|
|
548
571
|
line-height: var(--bc-chat-lineHeight-sm);
|
|
@@ -550,14 +573,14 @@ i {
|
|
|
550
573
|
text-overflow: ellipsis;
|
|
551
574
|
white-space: nowrap;
|
|
552
575
|
color: var(--bc-text-primary, #16616C);
|
|
553
|
-
`,
|
|
576
|
+
`,Lt=c.default.span`
|
|
554
577
|
color: #4b5563;
|
|
555
578
|
font-size: var(--bc-chat-fontSize-xs);
|
|
556
579
|
line-height: var(--bc-chat-lineHeight-xs);
|
|
557
580
|
overflow: hidden;
|
|
558
581
|
text-overflow: ellipsis;
|
|
559
582
|
white-space: nowrap;
|
|
560
|
-
`,
|
|
583
|
+
`,Et=c.default.button`
|
|
561
584
|
border: none;
|
|
562
585
|
background: transparent;
|
|
563
586
|
display: inline-flex;
|
|
@@ -576,26 +599,26 @@ i {
|
|
|
576
599
|
color: #111827;
|
|
577
600
|
outline: none;
|
|
578
601
|
}
|
|
579
|
-
`,
|
|
580
|
-
${e=>e.bannerWidth>
|
|
602
|
+
`,It=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),Rt=({config:n,sendMessage:a,setView:o,actionChips:i,noteMode:r,onNoteSend:s,onCloseNoteMode:l,notePlaceholder:c,replyMessageTitle:d,replyMessageContent:g,onCancelReplyMessage:u,autoCompleteEnabled:h,autoCompleteSuggestion:m,onInputChange:C,onAutoCompleteMutate:x})=>{const b="AR"===n?.language,[f,v]=t.useState(),[y,w]=t.useState([]),[M,A]=t.useState(),[j,k]=t.useState(0),L=t.useMemo((()=>Boolean(d||g)),[d,g]),E=t.useMemo((()=>d||("AR"===n?.language?"الرد على رسالة":"TR"===n?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[n?.language,d]),I=t.useMemo((()=>"AR"===n?.language?"إلغاء":"TR"===n?.language?"İptal":"Cancel"),[n?.language]);t.useEffect((()=>{M&&f&&f.trim().length>0&&A(void 0)}),[M,f]),t.useEffect((()=>{const e=Array.isArray(y)?y:y?[y]:[];M&&e.length>0&&A(void 0)}),[y,M]);const R=t.useCallback((e=>{if(r){const e=(f||"").trim();return s&&s(e),void v("")}const t=e=>{const{fileUrl:t,extension:n}=e;a(p.SupportedImageFormats.indexOf(n)>=0?"image":p.SupportedAudioFormats.indexOf(n)>=0?"audio":"document",t)};if(e)return void(e.blob&&e.fileUrl.startsWith("blob:")?Ve(e.blob,k,((n,a)=>{if(n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else a&&A(a)})):t(e));const n=Array.isArray(y)?y:y?[y]:[];if(n.length>0){const e=n.filter((e=>e.blob&&e.fileUrl.startsWith("blob:"))),a=n.filter((e=>!e.blob||!e.fileUrl.startsWith("blob:")));let o=a.length+e.length,i=0;a.forEach((e=>{t(e),i++})),e.length>0?e.forEach((e=>{Ve(e.blob,k,((n,a)=>{if(i++,n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else a&&A(`Failed to upload "${e.fileName}": ${a}`);i===o&&(w([]),k(0))}))})):w([])}else a(Ue,f),v("")}),[y,f,a,r,s,w,A,k]);return e.jsxs(Mt,{isRTL:b,children:[L?e.jsxs(At,{isRTL:b,children:[e.jsxs(jt,{isRTL:b,children:[E?e.jsx(kt,{children:E}):null,u?e.jsx(Et,{type:"button",onClick:u,"aria-label":I,title:I,children:e.jsx(It,{})}):null]}),g?e.jsx(Lt,{children:g}):null]}):null,e.jsx("div",{className:"bc-InputArea",children:e.jsx(at,{config:n,send:R,text:f,setText:v,file:r?void 0:y,isFileSelected:Array.isArray(y)?y.length>0:!!y,cancelFileUpload:e=>{w(e?t=>{const n=(Array.isArray(t)?t:t?[t]:[]).filter((t=>!(t.fileName===e.fileName&&t.fileUrl===e.fileUrl)));if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}return n}:e=>((Array.isArray(e)?e:e?[e]:[]).forEach((e=>{if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}})),[]))},noteMode:r,onCloseNoteMode:()=>{v(""),l?.()},notePlaceholder:c,autoCompleteEnabled:h,autoCompleteSuggestion:m,onInputChange:C,onAutoCompleteMutate:x})}),e.jsxs("div",{className:"bc-BottomBar "+(b?"bc-RTL":""),children:[void 0!==i?i:null,e.jsx("div",{className:"bc-CommandsArea "+(b?"bc-RTL":""),children:r?null:e.jsx(wt,{setView:o,setFile:w,setProgress:k,setError:A,setText:v,text:f,send:R,config:n})})]}),M?e.jsx("div",{className:"bc-uploadFileError",children:M}):null]})},St="bc-chat-header-banner",Ft=390,Dt=c.default.div`
|
|
603
|
+
${e=>e.bannerWidth>Ft?"height: 60px;":"height: 90px;"}
|
|
581
604
|
display: block;
|
|
582
605
|
width: 100%;
|
|
583
606
|
background-color: transparent;
|
|
584
607
|
z-index: 10;
|
|
585
608
|
border-top-left-radius: 15px;
|
|
586
609
|
border-top-right-radius: 15px;
|
|
587
|
-
`,
|
|
610
|
+
`,Bt=c.default.div`
|
|
588
611
|
width: 100%;
|
|
589
612
|
display: flex;
|
|
590
613
|
align-items: center;
|
|
591
614
|
background-image: ${e=>`linear-gradient(103deg, ${e.startColor},${e.endColor})`};
|
|
592
|
-
${e=>e.bannerWidth<=
|
|
593
|
-
`,
|
|
615
|
+
${e=>e.bannerWidth<=Ft?'\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMzkwIiBoZWlnaHQ9Ijg4LjM1NCIgdmlld0JveD0iMCAwIDM5MCA4OC4zNTQiPgogIDxkZWZzPgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQiIHgyPSIxIiB5Mj0iMSIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM2NjJkOTEiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZWUyYTdiIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8cGF0aCBpZD0iUGF0aF84NzgiIGRhdGEtbmFtZT0iUGF0aCA4NzgiIGQ9Ik0xMCwwSDM4MGExMCwxMCwwLDAsMSwxMCwxMFY3MHMtNzUuMDYtNy44ODYtMTk5LjYxNywxMS44NjJTMCw3MCwwLDcwVjEwQTEwLDEwLDAsMCwxLDEwLDAiIGZpbGw9InVybCgjbGluZWFyLWdyYWRpZW50KSIvPgo8L3N2Zz4K");\n mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMzkwIiBoZWlnaHQ9Ijg4LjM1NCIgdmlld0JveD0iMCAwIDM5MCA4OC4zNTQiPgogIDxkZWZzPgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQiIHgyPSIxIiB5Mj0iMSIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM2NjJkOTEiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZWUyYTdiIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8cGF0aCBpZD0iUGF0aF84NzgiIGRhdGEtbmFtZT0iUGF0aCA4NzgiIGQ9Ik0xMCwwSDM4MGExMCwxMCwwLDAsMSwxMCwxMFY3MHMtNzUuMDYtNy44ODYtMTk5LjYxNywxMS44NjJTMCw3MCwwLDcwVjEwQTEwLDEwLDAsMCwxLDEwLDAiIGZpbGw9InVybCgjbGluZWFyLWdyYWRpZW50KSIvPgo8L3N2Zz4K");\n mask-repeat: no-repeat;\n mask-size: auto;\n -webkit-mask-size: auto;\n -webkit-mask-repeat: no-repeat;\n height: 90px;\n ':"height: 60px;"}
|
|
616
|
+
`,zt=c.default.div`
|
|
594
617
|
width: 100%;
|
|
595
618
|
height: 100%;
|
|
596
619
|
display: flex;
|
|
597
|
-
`,
|
|
598
|
-
${e=>e.bannerWidth>
|
|
620
|
+
`,Nt=c.default.div`
|
|
621
|
+
${e=>e.bannerWidth>Ft?"padding-bottom: 0 !important;":""}
|
|
599
622
|
display: flex;
|
|
600
623
|
gap: 10px;
|
|
601
624
|
align-items: center;
|
|
@@ -616,8 +639,8 @@ i {
|
|
|
616
639
|
color: #fff;
|
|
617
640
|
font-style: normal;
|
|
618
641
|
}
|
|
619
|
-
`,
|
|
620
|
-
${e=>e.bannerWidth>
|
|
642
|
+
`,Zt=c.default.div`
|
|
643
|
+
${e=>e.bannerWidth>Ft?"padding-bottom: 0 !important;":""}
|
|
621
644
|
display: flex;
|
|
622
645
|
flex-direction: row-reverse;
|
|
623
646
|
gap: 10px;
|
|
@@ -632,9 +655,9 @@ i {
|
|
|
632
655
|
cursor: pointer;
|
|
633
656
|
display: block;
|
|
634
657
|
}
|
|
635
|
-
`,
|
|
658
|
+
`,Tt=c.default.i`
|
|
636
659
|
background-image: url("data:image/svg+xml;base64,PHN2ZyBpZD0ibWluaW1pemUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxLjgxNyIgdmlld0JveD0iMCAwIDE2IDEuODE3Ij4KICA8ZGVmcz4KICAgIDxjbGlwUGF0aCBpZD0iY2xpcC1wYXRoIj4KICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZV82OCIgZGF0YS1uYW1lPSJSZWN0YW5nbGUgNjgiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxLjgxNyIgZmlsbD0iIzAwMCIvPgogICAgPC9jbGlwUGF0aD4KICA8L2RlZnM+CiAgPGcgaWQ9Ikdyb3VwXzMwMSIgZGF0YS1uYW1lPSJHcm91cCAzMDEiIGNsaXAtcGF0aD0idXJsKCNjbGlwLXBhdGgpIj4KICAgIDxwYXRoIGlkPSJQYXRoXzgwNCIgZGF0YS1uYW1lPSJQYXRoIDgwNCIgZD0iTTE1LjM5NCwyLjIxMUguNjA2QS42MDYuNjA2LDAsMSwxLC42MDYsMUgxNS4zOTRhLjYwNi42MDYsMCwwLDEsMCwxLjIxMSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAtMC4zOTQpIiBmaWxsPSIjZmZmIi8+CiAgPC9nPgo8L3N2Zz4K");
|
|
637
|
-
`,
|
|
660
|
+
`,Ht=({config:n,minimize:a})=>{const[o,i]=t.useState();return t.useEffect((()=>{new ResizeObserver((()=>{const e=document.getElementById(St)?.offsetWidth;e&&e>50&&e!==o&&i(e)})).observe(document.getElementById(St))}),[]),e.jsx(Dt,{bannerWidth:o,className:"bc-header",children:e.jsx(Bt,{className:"bc-banner",id:St,startColor:"#065A60",endColor:"#006466",bannerWidth:o,children:e.jsxs(zt,{className:"bc-bannerContents",children:[e.jsxs(Nt,{className:"bc-companyInfo",bannerWidth:o,logo:n.brandLogo||u,children:[e.jsx("i",{}),e.jsx("span",{children:n.brandName||"BreadCrumbs"})]}),e.jsx(Zt,{className:"bc-bannerActions",bannerWidth:o,children:a?e.jsx(Tt,{className:"bc-flow-minimize",onClick:()=>a()}):null})]})})})};je('@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");\n/* Chat constants - we should use html to allow portal overrides those values if it needs to be different */\nhtml {\n --bc-chat-font-stack: "Poppins", "Montserrat", sans-serif;\n --bc-chat-fontSize-xs: 10px;\n --bc-chat-fontSize-sm: 12px;\n --bc-chat-fontSize-md: 16px;\n --bc-chat-fontSize-lg: 18px;\n --bc-chat-fontSize-xl: 22px;\n --bc-chat-fontWeight-light: 100;\n --bc-chat-fontWeight-regular: 400;\n --bc-chat-fontWeight-medium: 500;\n --bc-chat-fontWeight-bold: 700;\n --bc-chat-lineHeight-xs: 18px;\n --bc-chat-lineHeight-sm: 22px;\n --bc-chat-lineHeight-md: 28px;\n --bc-chat-radius: 5px;\n --bc-chat-other-message-border-color: #E5E7EB;\n --bc-chat-other-message-separator-color: #D2D6DB;\n --bc-chat-other-message-background-start-color: #E5E7EB;\n --bc-chat-other-message-background-end-color: #E5E7EB;\n --bc-chat-other-message-text-color: #161616;\n --bc-chat-my-message-border-color: #258694;\n --bc-chat-my-message-background-start-color: #258694;\n --bc-chat-my-message-background-end-color: #258694;\n --bc-chat-my-message-text-color: #fff;\n --bc-chat-text-secondary: #6C737F;\n --bc-chat-text-secondary-dark: #4d4d4d;\n --bc-chat-text-secondary-darkest: #1F2A37;\n --bc-chat-message-highlight-color: #EBC10466;\n --bc-chat-danger-color: #B42318;\n --bc-chat-success-color: #58aa18;\n --bc-chat-white-color: #fff;\n --bc-background-primary-50: #F3FBFC;\n --bc-border-primary: #16616C;\n --bc-border-neutral-secondary: #E5E7EB;\n}');const Pt=c.default.div`
|
|
638
661
|
position: relative;
|
|
639
662
|
height: 100%;
|
|
640
663
|
display: flex;
|
|
@@ -653,5 +676,5 @@ i {
|
|
|
653
676
|
font-style: normal;
|
|
654
677
|
line-height: var(--bc-chat-lineHeight-xs);
|
|
655
678
|
color: var(--bc-chat-text-secondary-dark);
|
|
656
|
-
`;exports.BCChat=({config:n={language:"EN",backgroundColor:"#F3F4F6"},messages:a=[],sendMessage:o,debug:i,minimize:r,onReachingUp:s,agentsIdsAvatarsMap:l,actionChips:c,noteMode:d,onNoteSend:g,onCloseNoteMode:p,searchPattern:u,notePlaceholder:h,searchMatchNo:m=1,onSearchMatchCount:C,onMessageReply:x,replyMessageTitle:b,replyMessageContent:f,onCancelReplyMessage:v,errorMessage:y,autoCompleteEnabled:w,autoCompleteSuggestion:M,onInputChange:A,onAutoCompleteMutate:
|
|
679
|
+
`;exports.BCChat=({config:n={language:"EN",backgroundColor:"#F3F4F6"},messages:a=[],sendMessage:o,debug:i,minimize:r,onReachingUp:s,agentsIdsAvatarsMap:l,actionChips:c,noteMode:d,onNoteSend:g,onCloseNoteMode:p,searchPattern:u,notePlaceholder:h,searchMatchNo:m=1,onSearchMatchCount:C,onMessageReply:x,replyMessageTitle:b,replyMessageContent:f,onCancelReplyMessage:v,errorMessage:y,autoCompleteEnabled:w,autoCompleteSuggestion:M,onInputChange:A,onAutoCompleteMutate:j,onContactMessage:k,onContactAddContact:L})=>{const[E,I]=t.useState("MESSAGE_LIST");return e.jsxs(Pt,{className:"bc-chat",children:[n.hideHeader?null:e.jsx(Ht,{config:n,minimize:r}),"MESSAGE_LIST"===E?e.jsx(Pe,{messages:a,sendMessage:o,debug:i,config:n,onReachingUp:s,agentsIdsAvatarsMap:l,searchPattern:u,searchMatchNo:m,onSearchMatchCount:C,onMessageReply:x,errorMessage:y,onContactMessage:k,onContactAddContact:L},"message-list"):null,n.inputDisabled?null:e.jsx(Rt,{sendMessage:o,setView:I,config:n,actionChips:c,noteMode:d,onCloseNoteMode:p,onNoteSend:g,notePlaceholder:h,replyMessageTitle:b,replyMessageContent:f,onCancelReplyMessage:v,autoCompleteEnabled:w,autoCompleteSuggestion:M,onInputChange:A,onAutoCompleteMutate:j},"message-input")]})};
|
|
657
680
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gvFAAA,SAASA,GAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gvFAAA,SAASA,GAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|