@bcrumbs.net/bc-chat 1.0.71 → 1.0.72
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 +6 -6
- package/build/index.es.js.map +1 -1
- package/build/index.js +5 -5
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -112,7 +112,7 @@ i {
|
|
|
112
112
|
align-items: center;
|
|
113
113
|
gap: 6px;
|
|
114
114
|
${e=>e.isMyMessage?"flex-direction: row;":"flex-direction: row-reverse;"}
|
|
115
|
-
`,
|
|
115
|
+
`,U=d.div`
|
|
116
116
|
width: 32px;
|
|
117
117
|
height: 32px;
|
|
118
118
|
border-radius: 6px;
|
|
@@ -121,7 +121,7 @@ i {
|
|
|
121
121
|
align-items: center;
|
|
122
122
|
justify-content: center;
|
|
123
123
|
padding: 8px;
|
|
124
|
-
`,
|
|
124
|
+
`,V=d.div`
|
|
125
125
|
display: flex;
|
|
126
126
|
flex-direction: column;
|
|
127
127
|
gap: 4px;
|
|
@@ -170,7 +170,7 @@ i {
|
|
|
170
170
|
max-width: 60%;
|
|
171
171
|
`,$=d.span`
|
|
172
172
|
direction: ${e=>"arb"===e.language?"rtl":"ltr"};
|
|
173
|
-
`,_={document:({message:t,config:i,onReply:o})=>{const a=i.isAgent===t.isAgent,[c,d]=r(""),g=s((()=>{try{const e=(t.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[t.content]);l((()=>{let e=!1;const n=t.content;if(n)return fetch(n,{method:"HEAD"}).then((n=>{const t=n.headers.get("content-length");if(!t)return;const i=Number(t);var o;Number.isFinite(i)&&(e||d((o=i)<1024?`${o} B`:o<1048576?`${(o/1024).toFixed(1)}KB`:o<1073741824?`${(o/1048576).toFixed(1)}MB`:`${(o/1073741824).toFixed(1)}GB`))})).catch((()=>{})),()=>{e=!0}}),[t.content]);const p=c?`${c} - ${j[i.language]?.download}`:j[i.language]?.download;return e(z,{isMyMessage:a,createdAt:t.createdAt,message:t,config:i,onReply:o,children:e(G,{href:t.content,target:"_blank",download:g,rel:"noopener noreferrer",isMyMessage:a,children:n(J,{isMyMessage:a,children:[e(V,{children:e(H,{})}),n(U,{children:[e(K,{children:g}),e(Q,{children:p})]})]})})})},image:({message:n,config:t,onReply:i})=>{const o=t.isAgent===n.isAgent;return e(z,{className:"bc-mediaMessage",isMyMessage:o,createdAt:n.createdAt,message:n,config:t,onReply:i,isMedia:!0,children:e("a",{href:n.content,target:"_blank",rel:"noreferrer",children:e("img",{src:n.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:t,config:i,onReply:o})=>{const a=i.isAgent===t.isAgent;return e(z,{isMyMessage:a,createdAt:t.createdAt,message:t,config:i,onReply:o,children:e(W,{href:"https://www.google.com/maps/?q="+t.content,target:"_blank",rel:"noopener noreferrer",children:n(Y,{children:[e(q,{color:"000000"}),e(O,{children:"Open location"})]})})})},text:N,video:P,audio:P,interactive:null,template:({message:t,config:i,onReply:o})=>{const a=s((()=>{try{return JSON.parse(t.content)}catch(e){return void console.log(e.message)}}),[t]),r=i.isAgent===t.isAgent;return n(z,{isMyMessage:r,createdAt:t.createdAt,message:t,config:i,onReply:o,children:[e("b",{children:"Template message:"})," ",a.name," ",a.language?.code?`/ ${a.language.code}`:null]})},note:({message:t})=>{const i=h(t.content);return n(X,{children:[e($,{language:i,children:t.content})," ",e(w,{createdAt:t.createdAt})]})},button:N};function ee(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}ee('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-body-4-size);\n line-height: var(--bc-chat-body-4-lineheight);\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: #ffffff;\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: #ffffff;\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: #ffffff;\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: #ffffff;\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-dark-gray-color) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const ne=d.i`
|
|
173
|
+
`,_={document:({message:t,config:i,onReply:o})=>{const a=i.isAgent===t.isAgent,[c,d]=r(""),g=s((()=>{try{const e=(t.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[t.content]);l((()=>{let e=!1;const n=t.content;if(n){try{new URL(n)}catch{return}return fetch(n,{method:"HEAD"}).then((n=>{if(!n.ok)return;const t=n.headers.get("content-length");if(!t)return;const i=Number(t);var o;!Number.isFinite(i)||i<0||(e||d((o=i)<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}}}),[t.content]);const p=c?`${c} - ${j[i.language]?.download}`:j[i.language]?.download;return e(z,{isMyMessage:a,createdAt:t.createdAt,message:t,config:i,onReply:o,children:e(G,{href:t.content,target:"_blank",download:g,rel:"noopener noreferrer",isMyMessage:a,children:n(J,{isMyMessage:a,children:[e(U,{children:e(H,{})}),n(V,{children:[e(K,{children:g}),e(Q,{children:p})]})]})})})},image:({message:n,config:t,onReply:i})=>{const o=t.isAgent===n.isAgent;return e(z,{className:"bc-mediaMessage",isMyMessage:o,createdAt:n.createdAt,message:n,config:t,onReply:i,isMedia:!0,children:e("a",{href:n.content,target:"_blank",rel:"noreferrer",children:e("img",{src:n.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:t,config:i,onReply:o})=>{const a=i.isAgent===t.isAgent;return e(z,{isMyMessage:a,createdAt:t.createdAt,message:t,config:i,onReply:o,children:e(W,{href:"https://www.google.com/maps/?q="+t.content,target:"_blank",rel:"noopener noreferrer",children:n(Y,{children:[e(q,{color:"000000"}),e(O,{children:"Open location"})]})})})},text:N,video:P,audio:P,interactive:null,template:({message:t,config:i,onReply:o})=>{const a=s((()=>{try{return JSON.parse(t.content)}catch(e){return void console.log(e.message)}}),[t]),r=i.isAgent===t.isAgent;return n(z,{isMyMessage:r,createdAt:t.createdAt,message:t,config:i,onReply:o,children:[e("b",{children:"Template message:"})," ",a.name," ",a.language?.code?`/ ${a.language.code}`:null]})},note:({message:t})=>{const i=h(t.content);return n(X,{children:[e($,{language:i,children:t.content})," ",e(w,{createdAt:t.createdAt})]})},button:N};function ee(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}ee('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-body-4-size);\n line-height: var(--bc-chat-body-4-lineheight);\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: #ffffff;\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: #ffffff;\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: #ffffff;\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: #ffffff;\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-dark-gray-color) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const ne=d.i`
|
|
174
174
|
background-image: url(${e=>e.avatar||f});
|
|
175
175
|
width: 30px;
|
|
176
176
|
height: 30px;
|
|
@@ -335,7 +335,7 @@ i {
|
|
|
335
335
|
margin-top: 6px;
|
|
336
336
|
text-align: center;
|
|
337
337
|
}
|
|
338
|
-
`,
|
|
338
|
+
`,Ue=d.div`
|
|
339
339
|
width: 100%;
|
|
340
340
|
padding: 8px 12px;
|
|
341
341
|
display: flex;
|
|
@@ -345,7 +345,7 @@ i {
|
|
|
345
345
|
gap: 4px;
|
|
346
346
|
flex: 1 0 0;
|
|
347
347
|
border-bottom: 1px solid var(--bc-border-neutral-secondary, #E5E7EB);
|
|
348
|
-
`,
|
|
348
|
+
`,Ve=d.div`
|
|
349
349
|
display: flex;
|
|
350
350
|
align-items: center;
|
|
351
351
|
justify-content: space-between;
|
|
@@ -386,7 +386,7 @@ i {
|
|
|
386
386
|
color: #111827;
|
|
387
387
|
outline: none;
|
|
388
388
|
}
|
|
389
|
-
`,Ye=()=>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"})}),Oe=({config:t,sendMessage:i,setView:a,actionChips:l,noteMode:c,onNoteSend:d,onCloseNoteMode:g,notePlaceholder:p,replyMessageTitle:h,replyMessageContent:u,onCancelReplyMessage:m})=>{const b="AR"===t?.language,[f,x]=r(),[y,v]=r(),[w,M]=r(),[A,L]=r(0),k=s((()=>Boolean(h||u)),[h,u]),I=s((()=>h||("AR"===t?.language?"الرد على رسالة":"TR"===t?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[t?.language,h]),E=s((()=>"AR"===t?.language?"إلغاء":"TR"===t?.language?"İptal":"Cancel"),[t?.language]),R=o((e=>{if(c){const e=(f||"").trim();return d&&d(e),void x("")}const n=e=>{const{fileUrl:n,extension:t}=e;i(C.SupportedImageFormats.indexOf(t)>=0?"image":C.SupportedAudioFormats.indexOf(t)>=0?"audio":"document",n)};e?e.blob&&e.fileUrl.startsWith("blob:")?ue(e.blob,L,((t,i)=>{if(t){try{URL.revokeObjectURL(e.fileUrl)}catch{}n({...e,fileUrl:t,blob:void 0})}else i&&M(i)})):n(e):y?y.blob&&y.fileUrl.startsWith("blob:")?ue(y.blob,L,((e,t)=>{if(e){try{URL.revokeObjectURL(y.fileUrl)}catch{}n({...y,fileUrl:e,blob:void 0}),v(void 0)}else t&&M(t)})):(n(y),v(void 0)):(i(he,f),x(""))}),[y,f,i,c,d]);return n(Je,{isRTL:b,children:[k?n(
|
|
389
|
+
`,Ye=()=>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"})}),Oe=({config:t,sendMessage:i,setView:a,actionChips:l,noteMode:c,onNoteSend:d,onCloseNoteMode:g,notePlaceholder:p,replyMessageTitle:h,replyMessageContent:u,onCancelReplyMessage:m})=>{const b="AR"===t?.language,[f,x]=r(),[y,v]=r(),[w,M]=r(),[A,L]=r(0),k=s((()=>Boolean(h||u)),[h,u]),I=s((()=>h||("AR"===t?.language?"الرد على رسالة":"TR"===t?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[t?.language,h]),E=s((()=>"AR"===t?.language?"إلغاء":"TR"===t?.language?"İptal":"Cancel"),[t?.language]),R=o((e=>{if(c){const e=(f||"").trim();return d&&d(e),void x("")}const n=e=>{const{fileUrl:n,extension:t}=e;i(C.SupportedImageFormats.indexOf(t)>=0?"image":C.SupportedAudioFormats.indexOf(t)>=0?"audio":"document",n)};e?e.blob&&e.fileUrl.startsWith("blob:")?ue(e.blob,L,((t,i)=>{if(t){try{URL.revokeObjectURL(e.fileUrl)}catch{}n({...e,fileUrl:t,blob:void 0})}else i&&M(i)})):n(e):y?y.blob&&y.fileUrl.startsWith("blob:")?ue(y.blob,L,((e,t)=>{if(e){try{URL.revokeObjectURL(y.fileUrl)}catch{}n({...y,fileUrl:e,blob:void 0}),v(void 0)}else t&&M(t)})):(n(y),v(void 0)):(i(he,f),x(""))}),[y,f,i,c,d]);return n(Je,{isRTL:b,children:[k?n(Ue,{isRTL:b,children:[n(Ve,{isRTL:b,children:[I?e(Ke,{children:I}):null,m?e(We,{type:"button",onClick:m,"aria-label":E,title:E,children:e(Ye,{})}):null]}),u?e(Qe,{children:u}):null]}):null,e("div",{className:"bc-InputArea",children:e(we,{config:t,send:R,text:f,setText:x,file:c?void 0:y,isFileSelected:!!y,cancelFileUpload:()=>v(void 0),noteMode:c,onCloseNoteMode:()=>{x(""),g?.()},notePlaceholder:p})}),n("div",{className:"bc-BottomBar "+(b?"bc-RTL":""),children:[void 0!==l?l:null,e("div",{className:"bc-CommandsArea "+(b?"bc-RTL":""),children:c?null:e(Ge,{setView:a,setFile:v,setProgress:L,setError:M,setText:x,text:f,send:R,config:t})})]}),w?e("div",{className:"bc-uploadFileError",children:w}):null]})},qe="bc-chat-header-banner",Xe=390,$e=d.div`
|
|
390
390
|
${e=>e.bannerWidth>Xe?"height: 60px;":"height: 90px;"}
|
|
391
391
|
display: block;
|
|
392
392
|
width: 100%;
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kwEAAA,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
|
@@ -134,14 +134,14 @@ i {
|
|
|
134
134
|
opacity: 0.7;
|
|
135
135
|
font-weight: var(--bc-chat-fontWeight-regular);
|
|
136
136
|
line-height: var(--bc-chat-lineHeight-sm);
|
|
137
|
-
`;const
|
|
137
|
+
`;const U=d.default.a`
|
|
138
138
|
font-size: var(--bc-chat-fontSize-sm);
|
|
139
139
|
color: inherit;
|
|
140
140
|
text-decoration: none;
|
|
141
141
|
&:hover {
|
|
142
142
|
opacity: 0.8;
|
|
143
143
|
}
|
|
144
|
-
`,
|
|
144
|
+
`,V=d.default.div`
|
|
145
145
|
display: flex;
|
|
146
146
|
flex-direction: row;
|
|
147
147
|
align-items: center;
|
|
@@ -170,7 +170,7 @@ i {
|
|
|
170
170
|
max-width: 60%;
|
|
171
171
|
`,Y=d.default.span`
|
|
172
172
|
direction: ${e=>"arb"===e.language?"rtl":"ltr"};
|
|
173
|
-
`,O={document:({message:t,config:i,onReply:a})=>{const o=i.isAgent===t.isAgent,[r,s]=n.useState(""),l=n.useMemo((()=>{try{const e=(t.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[t.content]);n.useEffect((()=>{let e=!1;const n=t.content;if(n)return fetch(n,{method:"HEAD"}).then((n=>{const t=n.headers.get("content-length");if(!t)return;const i=Number(t);var a;Number.isFinite(i)&&(e||s((a=i)<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)}KB`:a<1073741824?`${(a/1048576).toFixed(1)}MB`:`${(a/1073741824).toFixed(1)}GB`))})).catch((()=>{})),()=>{e=!0}}),[t.content]);const c=r?`${r} - ${z[i.language]?.download}`:z[i.language]?.download;return e.jsx(R,{isMyMessage:o,createdAt:t.createdAt,message:t,config:i,onReply:a,children:e.jsx(Z,{href:t.content,target:"_blank",download:l,rel:"noopener noreferrer",isMyMessage:o,children:e.jsxs(T,{isMyMessage:o,children:[e.jsx(P,{children:e.jsx(N,{})}),e.jsxs(H,{children:[e.jsx(G,{children:l}),e.jsx(J,{children:c})]})]})})})},image:({message:n,config:t,onReply:i})=>{const a=t.isAgent===n.isAgent;return e.jsx(R,{className:"bc-mediaMessage",isMyMessage:a,createdAt:n.createdAt,message:n,config:t,onReply:i,isMedia:!0,children:e.jsx("a",{href:n.content,target:"_blank",rel:"noreferrer",children:e.jsx("img",{src:n.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:n,config:t,onReply:i})=>{const a=t.isAgent===n.isAgent;return e.jsx(R,{isMyMessage:a,createdAt:n.createdAt,message:n,config:t,onReply:i,children:e.jsx(V,{href:"https://www.google.com/maps/?q="+n.content,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(U,{children:[e.jsx(Q,{color:"000000"}),e.jsx(K,{children:"Open location"})]})})})},text:S,video:B,audio:B,interactive:null,template:({message:t,config:i,onReply:a})=>{const o=n.useMemo((()=>{try{return JSON.parse(t.content)}catch(e){return void console.log(e.message)}}),[t]),r=i.isAgent===t.isAgent;return e.jsxs(R,{isMyMessage:r,createdAt:t.createdAt,message:t,config:i,onReply:a,children:[e.jsx("b",{children:"Template message:"})," ",o.name," ",o.language?.code?`/ ${o.language.code}`:null]})},note:({message:n})=>{const t=o.franc(n.content);return e.jsxs(W,{children:[e.jsx(Y,{language:t,children:n.content})," ",e.jsx(f,{createdAt:n.createdAt})]})},button:S};function q(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===t&&i.firstChild?i.insertBefore(a,i.firstChild):i.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}q('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-body-4-size);\n line-height: var(--bc-chat-body-4-lineheight);\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: #ffffff;\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: #ffffff;\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: #ffffff;\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: #ffffff;\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-dark-gray-color) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const X=d.default.i`
|
|
173
|
+
`,O={document:({message:t,config:i,onReply:a})=>{const o=i.isAgent===t.isAgent,[r,s]=n.useState(""),l=n.useMemo((()=>{try{const e=(t.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[t.content]);n.useEffect((()=>{let e=!1;const n=t.content;if(n){try{new URL(n)}catch{return}return fetch(n,{method:"HEAD"}).then((n=>{if(!n.ok)return;const t=n.headers.get("content-length");if(!t)return;const i=Number(t);var a;!Number.isFinite(i)||i<0||(e||s((a=i)<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)}KB`:a<1073741824?`${(a/1048576).toFixed(1)}MB`:`${(a/1073741824).toFixed(1)}GB`))})).catch((e=>{console.debug("Failed to fetch file size:",e)})),()=>{e=!0}}}),[t.content]);const c=r?`${r} - ${z[i.language]?.download}`:z[i.language]?.download;return e.jsx(R,{isMyMessage:o,createdAt:t.createdAt,message:t,config:i,onReply:a,children:e.jsx(Z,{href:t.content,target:"_blank",download:l,rel:"noopener noreferrer",isMyMessage:o,children:e.jsxs(T,{isMyMessage:o,children:[e.jsx(P,{children:e.jsx(N,{})}),e.jsxs(H,{children:[e.jsx(G,{children:l}),e.jsx(J,{children:c})]})]})})})},image:({message:n,config:t,onReply:i})=>{const a=t.isAgent===n.isAgent;return e.jsx(R,{className:"bc-mediaMessage",isMyMessage:a,createdAt:n.createdAt,message:n,config:t,onReply:i,isMedia:!0,children:e.jsx("a",{href:n.content,target:"_blank",rel:"noreferrer",children:e.jsx("img",{src:n.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:n,config:t,onReply:i})=>{const a=t.isAgent===n.isAgent;return e.jsx(R,{isMyMessage:a,createdAt:n.createdAt,message:n,config:t,onReply:i,children:e.jsx(U,{href:"https://www.google.com/maps/?q="+n.content,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(V,{children:[e.jsx(Q,{color:"000000"}),e.jsx(K,{children:"Open location"})]})})})},text:S,video:B,audio:B,interactive:null,template:({message:t,config:i,onReply:a})=>{const o=n.useMemo((()=>{try{return JSON.parse(t.content)}catch(e){return void console.log(e.message)}}),[t]),r=i.isAgent===t.isAgent;return e.jsxs(R,{isMyMessage:r,createdAt:t.createdAt,message:t,config:i,onReply:a,children:[e.jsx("b",{children:"Template message:"})," ",o.name," ",o.language?.code?`/ ${o.language.code}`:null]})},note:({message:n})=>{const t=o.franc(n.content);return e.jsxs(W,{children:[e.jsx(Y,{language:t,children:n.content})," ",e.jsx(f,{createdAt:n.createdAt})]})},button:S};function q(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===t&&i.firstChild?i.insertBefore(a,i.firstChild):i.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}q('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-body-4-size);\n line-height: var(--bc-chat-body-4-lineheight);\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: #ffffff;\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: #ffffff;\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: #ffffff;\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: #ffffff;\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-dark-gray-color) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const X=d.default.i`
|
|
174
174
|
background-image: url(${e=>e.avatar||h});
|
|
175
175
|
width: 30px;
|
|
176
176
|
height: 30px;
|
|
@@ -367,7 +367,7 @@ i {
|
|
|
367
367
|
overflow: hidden;
|
|
368
368
|
text-overflow: ellipsis;
|
|
369
369
|
white-space: nowrap;
|
|
370
|
-
`,
|
|
370
|
+
`,Ue=d.default.button`
|
|
371
371
|
border: none;
|
|
372
372
|
background: transparent;
|
|
373
373
|
display: inline-flex;
|
|
@@ -386,7 +386,7 @@ i {
|
|
|
386
386
|
color: #111827;
|
|
387
387
|
outline: none;
|
|
388
388
|
}
|
|
389
|
-
`,
|
|
389
|
+
`,Ve=()=>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"})}),Ke=({config:t,sendMessage:i,setView:a,actionChips:o,noteMode:r,onNoteSend:s,onCloseNoteMode:l,notePlaceholder:c,replyMessageTitle:d,replyMessageContent:g,onCancelReplyMessage:p})=>{const h="AR"===t?.language,[m,b]=n.useState(),[x,f]=n.useState(),[C,y]=n.useState(),[v,w]=n.useState(0),M=n.useMemo((()=>Boolean(d||g)),[d,g]),A=n.useMemo((()=>d||("AR"===t?.language?"الرد على رسالة":"TR"===t?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[t?.language,d]),k=n.useMemo((()=>"AR"===t?.language?"إلغاء":"TR"===t?.language?"İptal":"Cancel"),[t?.language]),L=n.useCallback((e=>{if(r){const e=(m||"").trim();return s&&s(e),void b("")}const n=e=>{const{fileUrl:n,extension:t}=e;i(u.SupportedImageFormats.indexOf(t)>=0?"image":u.SupportedAudioFormats.indexOf(t)>=0?"audio":"document",n)};e?e.blob&&e.fileUrl.startsWith("blob:")?de(e.blob,w,((t,i)=>{if(t){try{URL.revokeObjectURL(e.fileUrl)}catch{}n({...e,fileUrl:t,blob:void 0})}else i&&y(i)})):n(e):x?x.blob&&x.fileUrl.startsWith("blob:")?de(x.blob,w,((e,t)=>{if(e){try{URL.revokeObjectURL(x.fileUrl)}catch{}n({...x,fileUrl:e,blob:void 0}),f(void 0)}else t&&y(t)})):(n(x),f(void 0)):(i(ce,m),b(""))}),[x,m,i,r,s]);return e.jsxs(Te,{isRTL:h,children:[M?e.jsxs(Pe,{isRTL:h,children:[e.jsxs(He,{isRTL:h,children:[A?e.jsx(Ge,{children:A}):null,p?e.jsx(Ue,{type:"button",onClick:p,"aria-label":k,title:k,children:e.jsx(Ve,{})}):null]}),g?e.jsx(Je,{children:g}):null]}):null,e.jsx("div",{className:"bc-InputArea",children:e.jsx(fe,{config:t,send:L,text:m,setText:b,file:r?void 0:x,isFileSelected:!!x,cancelFileUpload:()=>f(void 0),noteMode:r,onCloseNoteMode:()=>{b(""),l?.()},notePlaceholder:c})}),e.jsxs("div",{className:"bc-BottomBar "+(h?"bc-RTL":""),children:[void 0!==o?o:null,e.jsx("div",{className:"bc-CommandsArea "+(h?"bc-RTL":""),children:r?null:e.jsx(Ze,{setView:a,setFile:f,setProgress:w,setError:y,setText:b,text:m,send:L,config:t})})]}),C?e.jsx("div",{className:"bc-uploadFileError",children:C}):null]})},Qe="bc-chat-header-banner",We=390,Ye=d.default.div`
|
|
390
390
|
${e=>e.bannerWidth>We?"height: 60px;":"height: 90px;"}
|
|
391
391
|
display: block;
|
|
392
392
|
width: 100%;
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;o4EAAA,SAASA,EAAYC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|