@talkjs/react-components 0.0.8
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/LICENSE.md +1 -0
- package/README.md +42 -0
- package/base.css +1 -0
- package/default.css +1 -0
- package/default.d.ts +442 -0
- package/default.js +911 -0
- package/globalConstants.js +3 -0
- package/package.json +68 -0
- package/theming.d.ts +544 -0
- package/theming.js +3 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This is proprietary software. See Terms & Conditions here: https://talkjs.com/terms
|
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# React Components for TalkJS
|
|
2
|
+
|
|
3
|
+
The `@talkjs/react-components` library provides React chat UI components for [TalkJS](https://talkjs.com).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
To use this package, you will need a [TalkJS account](https://talkjs.com/dashboard/login). TalkJS provides a ready-to-use chat client for your application. Your account gives you access to TalkJS's free development environment.
|
|
8
|
+
|
|
9
|
+
## Examples
|
|
10
|
+
|
|
11
|
+
Install [`@talkjs/react-components`](https://www.npmjs.com/package/@talkjs/react-components):
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install @talkjs/react-components
|
|
15
|
+
# or
|
|
16
|
+
yarn add @talkjs/react-components
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Import the `Chatbox` component and the related styling into the component where you want to have your chat UI:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import { Chatbox } from "@talkjs/react-components";
|
|
23
|
+
import "@talkjs/react-components/default.css";
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then add the `Chatbox` component:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
<Chatbox
|
|
30
|
+
appId="<APP_ID>"
|
|
31
|
+
userId="sample_user_alice"
|
|
32
|
+
conversationId="sample_conversation"
|
|
33
|
+
/>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Replace the `<APP_ID>` with your TalkJS app ID, which you can find in the **Settings** tab of the TalkJS dashboard.
|
|
37
|
+
|
|
38
|
+
For more details, see our [React getting started guide](https://talkjs.com/docs/Reference/Components/Guides/React/).
|
|
39
|
+
|
|
40
|
+
## Support
|
|
41
|
+
|
|
42
|
+
If you encounter any problems with `@talkjs/react-components`, please open a [chat with support](https://talkjs.com/?chat). TalkJS support is staffed by engineers.
|
package/base.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import"https://cdn.talkjs.com/fonts/Inter.css";.t-message-list{width:100%;height:100%;display:flex;flex-direction:column-reverse;overflow-x:hidden;overflow-y:auto;padding:16px;scrollbar-color:rgba(0,0,0,.2) transparent}.t-message-list:hover{scrollbar-color:rgba(0,0,0,.4) transparent}.t-message-list:active{scrollbar-color:rgba(0,0,0,.6) transparent}.t-message-group{display:flex;flex-direction:column-reverse}.t-chatbox .t-panel{display:flex;justify-content:center;align-items:center;flex-direction:column;width:100%;height:100%;text-align:center;padding:25px;-webkit-font-smoothing:subpixel-antialiased;overflow-x:hidden;font-size:.95em;font-family:Open Sans,Helvetica,sans-serif}.t-chatbox .t-error-panel{background-color:#f7f7f7}:is(.t-chatbox .t-error-panel) .t-heading{font-size:2em}.t-loading-icon{animation:spin 1.2s cubic-bezier(.42,0,.58,1) infinite;display:block;margin:auto;width:4em;height:4em}.t-attach-overlay{z-index:2;width:100%;height:100%;padding:16px;background-color:#64646480;display:flex;justify-content:center;align-items:center}.t-upload-preview .t-preview{position:relative;background-color:#fff;border-radius:1rem;max-width:750px;width:100%;display:inline-block;overflow:auto;padding:.5rem}@media screen and (max-width: 500px){.t-upload-preview .t-preview{width:85%}}:is(.t-upload-preview .t-preview) .t-img-container{text-align:center;background-color:#0000001a}:is(.t-upload-preview .t-preview) img{display:block;max-width:100%;max-height:400px;margin-left:auto;margin-right:auto}:is(.t-upload-preview .t-preview) video{width:100%;height:100%;object-fit:fill}:is(.t-upload-preview .t-preview) .t-location-upload-preview{width:100%;background-color:#0000001a;padding-bottom:calc((400 / 600) * 100%);display:block}.t-upload-preview .t-cancel-row{text-align:right;position:sticky;top:8px;padding-right:8px;z-index:2;margin-bottom:-38px}.t-upload-preview .t-filename-row{white-space:pre-wrap;word-break:break-all;padding:.5rem 1rem 0}.t-is-file:is(.t-upload-preview .t-filename-row){display:flex;justify-content:center;align-items:center;min-height:250px;padding-top:32px;padding-bottom:32px;text-align:center;background-color:#0000001a;border-radius:1rem;margin-bottom:1rem}:is(.t-upload-preview .t-filename-row) .t-file-block{background-color:#fff;padding:16px 32px;border-radius:8px;display:inline-block}.t-upload-preview .t-error-row{border-width:.125rem;border-radius:1rem;padding:1rem;background-color:#fec8c866;border-color:transparent;color:#ef4444;white-space:normal}.t-upload-preview .t-send-row{position:sticky;bottom:0;padding:1rem;display:flex;justify-content:space-between}.t-upload-preview .t-cancel{border:0;border-radius:.5rem;padding:.75rem 1rem;cursor:pointer;color:currentColor}.t-upload-preview .t-confirm-send{margin-left:auto;border:0;border-radius:.5rem;padding:.75rem 1rem;cursor:pointer}.t-upload-preview .t-loading{height:80px;width:100%;display:flex;align-items:center;justify-content:center;color:#1e60e1}.t-upload-preview .t-preview,.t-upload-preview .t-send-row{background:#fff}.t-upload-preview .t-confirm-send{background-color:#007df9;color:#fff}.t-chatbox-content{flex-direction:column;margin:0;position:relative;width:100%;height:100%;display:flex;overflow-y:hidden}.t-chatbox-content>.t-attach-overlay{position:absolute;width:100%;height:100%;top:0;left:0}.t-chatbox-content>.t-drop-overlay{pointer-events:none}:is(.t-chatbox-content>.t-drop-overlay) .t-theme-icon{color:#1e1e1e80;width:300px;height:300px}:root{--reach-menu-button: 1}[data-reach-menu]{position:relative}[data-reach-menu-popover]{display:block;position:absolute}[data-reach-menu-popover][hidden]{display:none}[data-reach-menu-list],[data-reach-menu-items]{display:block;white-space:nowrap;border:solid 1px hsla(0,0%,0%,.25);background:#fffffffc;outline:none;padding:1rem 0;font-size:85%}[data-reach-menu-item]{display:block;user-select:none}[data-reach-menu-item]{cursor:pointer;display:block;color:inherit;font:inherit;text-decoration:initial;padding:5px 20px}[data-reach-menu-item][data-selected]{background:#1159a6;color:#fff;outline:none}[data-reach-menu-item][aria-disabled]{opacity:.5;cursor:not-allowed}.t-audio-player{width:100%;height:auto;display:flex;flex-direction:row;align-items:center;column-gap:10px;padding:1.5em 1em 0}.t-audio-player .t-waveform{flex-grow:1;z-index:0}.t-audio-player button{background:transparent;border:none;color:inherit;padding:0;cursor:pointer}.t-audio-player .t-playback-speed{width:4em}.t-audio-player .t-play-pause-icon{width:30px;height:30px}.t-audio-player .t-up-down-icon{width:1em;height:1em}.t-audio-player .t-up-down svg{margin-top:-2px}.t-audio-player .t-playback-heading{opacity:.5;padding:.5em 1em}.t-audio-player .t-playback-checkmark{display:inline-block;width:1em}:is(.t-text-input .empty-node):before{position:absolute;color:currentColor;cursor:text;opacity:.5}:is(.t-text-input .empty-node):first-child:before{content:attr(data-placeholder)}.t-editor .ProseMirror{position:relative}.t-editor .ProseMirror{word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:"liga" 0}.t-editor .ProseMirror pre{white-space:pre-wrap}.t-editor .ProseMirror li{position:relative}.t-editor .ProseMirror-hideselection *::selection{background:transparent}.t-editor .ProseMirror-hideselection *::-moz-selection{background:transparent}.t-editor .ProseMirror-hideselection{caret-color:transparent}.t-editor .ProseMirror [draggable][contenteditable=false]{user-select:text}.t-editor .ProseMirror-selectednode{outline:2px solid #8cf}.t-editor li.ProseMirror-selectednode{outline:none}.t-editor li.ProseMirror-selectednode:after{content:"";position:absolute;inset:-2px -2px -2px -32px;border:2px solid #8cf;pointer-events:none}.t-editor img.ProseMirror-separator{display:inline!important;border:none!important;margin:0!important}.t-chatbox{--default-chat-width: 420px;font-family:Twemoji Country Flags,Inter,sans-serif;cursor:initial;text-align:initial;text-transform:initial;text-indent:initial;visibility:initial;white-space:initial;font-size:14px;font-weight:400;line-height:1.37;color:#111;letter-spacing:normal;margin:0;position:relative;width:100%;height:100%;overflow:hidden;background-color:#fff;border:1px solid #d4d4d4;border-radius:.75em;box-shadow:none}.t-chatbox button{font-family:inherit;font-size:1em}.t-chatbox *,.t-chatbox *:before,.t-chatbox *:after{box-sizing:border-box}.t-chatbox svg{fill:currentColor}.t-chatbox em{font-style:italic}.t-chatbox strong{font-weight:700}.t-chatbox del{text-decoration:line-through}.t-chatbox code{font-family:Cascadia Code,Droid Sans Mono,Menlo,Consolas,Lucida Console,Monaco,monospace;font-variant-ligatures:none}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|
package/default.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import"https://cdn.talkjs.com/fonts/Inter.css";.t-theme-audio-block{display:contents;width:100%;min-width:25ch}.t-theme-audio-block .t-audio-player{margin-bottom:.5em}.t-theme-audio-block .t-attachment-icon{width:1em;height:1em;margin-right:.2em}.t-theme-audio-block .t-filesize{font-size:.8em}.t-theme-avatar{display:block;overflow:hidden;background-color:#ececec;background-size:cover;background-repeat:no-repeat;background-position:center center;border-style:solid;border-radius:50%;border-width:2px;border-color:#fff;flex-shrink:0;align-self:flex-start;width:3em;height:3em}.t-theme-chat-header button[data-action]{border-radius:.375em;font-size:inherit;margin:1px;padding:.25em .325em;cursor:pointer;transition:color .2s ease-in-out,background-color .2s ease-in-out,border .2s ease-in-out;color:#111;background-color:transparent;border:1px solid #525252}.t-theme-chat-header button[data-action]:hover{color:#fff;background-color:#111;border:1px solid #111}.t-theme-chat-header button[data-action]:active{color:#fff;background-color:#404040;border:1px solid #404040}.t-theme-chat-header button[data-action]:focus-visible{outline:#525252 solid 2px;outline-offset:2px}.t-theme-chat-header{display:flex;align-items:center;height:4.5em;background-color:#ececec;border-bottom:1px solid #d4d4d4;flex-shrink:0}.t-theme-chat-header .t-inner{flex-grow:1;flex-basis:0;display:flex;align-items:center;padding-left:1em;padding-right:1em;min-width:0}.t-theme-chat-header .t-content{flex-grow:1;display:flex;align-items:center;min-width:0}.t-theme-chat-header .t-image{width:45px;text-align:center;margin-right:.75em;flex-shrink:0}.t-theme-chat-header .t-info{flex-grow:1;flex-basis:0;min-width:0}.t-theme-chat-header .t-title{font-weight:600;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;padding:3px}.t-theme-chat-header .t-subtitle{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:85%;margin-left:4px}.t-theme-chat-header .t-user{display:inline-block;vertical-align:middle}.t-message-divider{width:100%;margin:1.3em .5em 0;display:grid;grid-template-columns:1fr max-content 1fr;color:#95a7b1}.t-message-divider span{vertical-align:top;white-space:nowrap;height:1.3em;padding:0 20px}.t-message-divider .t-line[t-side=right]{display:grid;grid-template-columns:1fr max-content;gap:10px;grid-column:3}.t-message-divider .t-line hr{height:0;width:100%;margin-top:10px;border:none;border-bottom:1px solid #95a7b1}.t-message-divider .t-line .t-unread-marker{position:relative;top:-4px;height:28px;padding:3px 10px;border-radius:100px;border:1px solid #95a7b1;vertical-align:middle}.t-theme-file-block{display:contents}.t-theme-file-block a{word-break:break-all;text-decoration:none}.t-theme-file-block .t-filename{text-decoration:underline}.t-theme-file-block .t-attachment-icon{width:1em;height:1em;margin-right:.2em}.t-theme-file-block .t-filesize{white-space:nowrap;font-size:75%}.t-theme-file-block .t-loading-spinner{animation:spin 1.2s cubic-bezier(.42,0,.58,1) infinite;display:block;margin:auto;width:4em;height:4em}.t-theme-group-chat-image{display:block;overflow:hidden;position:relative;width:44px;height:44px;flex-shrink:0}.t-theme-group-chat-image .t-mini-avatar{border-radius:50%;border-width:2px;border-color:#fff;border-style:solid;box-shadow:0 1px 1px #8899a626;width:30px;height:30px;position:absolute;background-color:#f7f7f7;background-position:center;background-size:cover}.t-theme-group-chat-image .t-mini-avatar:nth-child(1){right:0;top:14px}.t-theme-group-chat-image .t-mini-avatar:nth-child(2){left:0;top:0}.t-theme-group-chat-image .t-counter{border-radius:50%;border:2px solid #fff;font-weight:600;position:absolute;min-width:18px;min-height:18px;max-width:22px;max-height:22px;left:0;bottom:0;display:flex;justify-content:center;align-items:center;color:#111;padding:0}.t-theme-group-chat-image .t-group{border-style:none;color:#ececec}.t-theme-icon{display:inline-block;vertical-align:middle;overflow:hidden}.t-theme-image-block{display:contents;min-height:100px;max-height:500px}.t-theme-image-block .download-icon{width:1em;height:1em;margin-right:.2em}.t-theme-image-block .t-root{position:relative;display:flex;justify-content:center;align-items:center;min-height:inherit;max-height:inherit;height:100%;overflow:hidden;margin:0 -1em .5em}.t-theme-image-block .t-image{min-width:0;min-height:0;max-height:inherit;width:100%;height:auto}.t-theme-image-block .t-filesize{font-size:.8em}.t-theme-location-block{display:contents;min-height:100px;max-height:500px}.t-theme-location-block .t-root{display:block;height:200px;margin:0 -1em .5em}.t-theme-message{display:block;margin-top:.35em}.t-theme-message:last-child{margin-top:1.35em}.t-theme-message[t-sender=currentUser]:not(:last-child){margin-right:3em}.t-theme-message[t-sender=other]:not(:last-child){margin-left:3em}.t-theme-message:not(:last-child) .t-theme-avatar{display:none}.t-theme-message:last-child .t-theme-avatar{display:block}.t-theme-message[t-sender=system]{margin-top:1.35em}.t-theme-message[t-sender=system]+.t-theme-message[t-sender=system]{margin-top:.5em}.t-theme-message:has(.t-reactions):has(+.t-theme-message){margin-bottom:.75em}.t-theme-message .t-message-row{display:flex;align-items:center}.t-theme-message[t-sender=currentUser] .t-message-row{flex-direction:row-reverse}.t-theme-message .t-message-body{white-space:normal;overflow:hidden;border-radius:.75em;border-width:1px;border-style:solid;word-wrap:break-word;position:relative;display:inline-block;max-width:calc(100% - 6.5em);border-color:#ececec;background-color:#f7f7f7;color:#111;padding:.75em 1em}.t-theme-message .t-message-body .t-theme-referenced-message{border-left:solid 2px;margin-bottom:.4em;font-size:93%;padding:0 .55em}.t-theme-message[t-sender=currentUser] .t-message-body{border-color:#007df9;background-color:#007df9;color:#fff;margin-right:.5em}.t-theme-message[t-sender=other] .t-message-body{margin-left:.5em}.t-theme-message .t-message-body .t-message-content{display:contents;margin-top:.75em}.t-theme-message .t-message-body:has(.t-theme-audio-block,.t-theme-voice-block,.t-theme-image-block,.t-theme-video-block,.t-theme-location-block){width:100%}.t-theme-message .t-message-body:not(:has(.t-message-sender-name,.t-theme-referenced-message,.t-theme-text-block:first-child,.t-theme-file-block:first-child)){padding-top:0}.t-theme-message .t-message-body:not(:has(.t-theme-text-block:first-child,.t-theme-file-block:first-child)) .t-message-sender-name{margin-bottom:.75em}.t-theme-message button[data-action]{border-radius:.375em;font-size:inherit;margin:1px 0;padding:.25em .325em;cursor:pointer;transition:color .2s ease-in-out,background-color .2s ease-in-out,border .2s ease-in-out}.t-theme-message[t-sender=currentUser] button[data-action]{color:#0761d1;background-color:#fff;border:1px solid white}.t-theme-message[t-sender=currentUser]:enabled button[data-action]:hover,.t-theme-message[t-sender=currentUser]:enabled button[data-action]:active{color:inherit;background-color:transparent}.t-theme-message[t-sender=currentUser] button[data-action]:focus-visible{outline:white solid 2px;outline-offset:2px}.t-theme-message[t-sender=other] button[data-action]{color:#111;background-color:transparent;border:1px solid #525252}.t-theme-message[t-sender=other]:enabled button[data-action]:hover{color:#fff;background-color:#111;border:1px solid #111}.t-theme-message[t-sender=other]:enabled button[data-action]:active{color:#fff;background-color:#404040;border:1px solid #404040}.t-theme-message[t-sender=other] button[data-action]:focus-visible{outline:#525252 solid 2px;outline-offset:2px}.t-theme-message[t-sender=system] button[data-action]{color:#fff;background-color:#007df9;border:1px solid #007df9}.t-theme-message[t-sender=system]:enabled button[data-action]:hover{color:#fff;background-color:#0761d1;border:1px solid #0761d1}.t-theme-message[t-sender=system]:enabled button[data-action]:active{color:#fff;background-color:#3291ff;border:1px solid #3291ff}.t-theme-message[t-sender=system] button[data-action]:focus-visible{outline:#007df9 solid 2px;outline-offset:2px}.t-theme-message button[data-action]:disabled{background-color:gray;border-color:gray}.t-theme-message .t-message-sender-name{font-size:75%;font-weight:700}.t-theme-message .t-reactions{margin-top:.25em;display:flex;flex-wrap:wrap;gap:.25em}.t-theme-message[t-sender=currentUser] .t-reactions{justify-content:flex-end;margin-right:.75em}.t-theme-message[t-sender=other] .t-reactions{margin-left:3.75em}.t-theme-message[t-sender=system] .t-message-body{background:transparent;width:100%;max-width:none;border:none}.t-theme-message[t-sender=system] .t-message-row{white-space:normal;border-radius:.75em;overflow:hidden;white-space:pre-wrap;background-color:transparent;color:#111;border:1px solid #d4d4d4}.t-theme-message .t-message-action-menu-trigger{border:none;color:inherit;cursor:pointer;position:absolute;top:.58em;right:.58em;margin:-.08em;z-index:1;font-size:120%;background:inherit;visibility:hidden}.t-theme-message .t-message-row:hover .t-message-action-menu-trigger{visibility:visible}.t-theme-message .t-action-menu-icon{width:1.143em;height:1.143em}.t-theme-message .t-message-content a{color:currentColor}.t-theme-message .t-message-status{display:inline-flex;font-size:75%;float:right;margin-left:2em;margin-top:.6em;opacity:75%;min-width:3.5ch;text-align:right}.t-theme-message .t-message-loading-spinner{animation:spin 1.2s cubic-bezier(.42,0,.58,1) infinite;width:1em;height:1em}.t-theme-message .t-status-icon{margin-left:.25em;letter-spacing:-.3rem;min-width:1em}.t-theme-message-action-menu{display:flex;flex-direction:column;background-color:#fff;color:#111;border:1px solid #d4d4d4;border-radius:.75em;box-shadow:0 8px 24px #73737333;padding:.35em}.t-theme-message-action-menu [t-action]{padding:.45em .65em;cursor:pointer;background:none;border:none;border-radius:.5em;text-align:left}.t-theme-message-action-menu [t-action]:hover{background-color:#007df9;color:#fff}.t-theme-message-action-menu [t-action=delete]{color:#ef4444}.t-theme-message-action-menu [t-action=delete]:hover{background-color:#fec8c866;color:#ef4444}.t-theme-message-field .t-wrapper{flex-shrink:0;position:relative;order:2;padding:16px;color:#111;font-size:16px;background-color:#ececec;border-top:#d4d4d4 solid 1px;max-width:100%;width:100%;margin:0 auto}.t-theme-referenced-message{display:flex;flex-direction:column}.t-theme-referenced-message .t-sender-name{font-weight:600;margin-bottom:2px}.t-theme-referenced-message .t-content{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:.165em 0}.t-theme-referenced-message .t-content ul{list-style:inside;margin:0;padding:0}.t-theme-referenced-message .t-content li{display:inline list-item;margin-right:1em}.t-theme-referenced-message .t-content li::marker{content:"• "}.t-theme-reply-bar{height:4.286em;display:flex;align-items:center;background-color:#ececec;padding:.714em;color:#262626;order:1;border-top:#d4d4d4 solid 1px}.t-theme-reply-bar .t-content{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.t-theme-reply-bar .t-close-button{width:2.571em;height:2.571em;padding:.571em;border:0;border-radius:9999px;cursor:pointer;display:inline-flex;align-items:center;background:transparent;opacity:.75;transition:.15s ease-out}.t-theme-reply-bar .t-close-button:hover{background-color:#2626260d;color:#007df9;opacity:1}.t-theme-reply-bar .t-body{flex-grow:1;padding:0 1em;overflow:hidden}.t-theme-reply-bar .t-close-icon,.t-theme-reply-bar .t-reply-icon{width:1.428em;height:1.428em;min-width:1.428em;min-height:1.428em}.t-theme-text-block{display:contents}.t-theme-text-block .t-text .t-emoji{height:1.15em;width:1.15em;margin:0 .1em .1em;vertical-align:middle}.t-theme-text-block .t-text{white-space:pre-wrap}.t-theme-text-block ul{padding-left:0;margin:0}.t-theme-text-block ul li{margin-left:1em;margin-bottom:.5em}.t-theme-text-form{width:100%;max-width:100%;margin:0 auto;display:flex}.t-theme-text-form .t-editor .t-text-input{min-height:3.143em;max-height:9em;border-radius:.65em;border:1px solid white;background-color:#fff;display:block;resize:none;overflow-x:hidden;overflow-y:auto;word-break:break-word;white-space:pre-wrap;padding:0 1em;transition:box-shadow .15s ease-out}.t-theme-text-form .t-editor .t-text-input:focus-visible{border-color:#fff;outline:#a3a3a3 solid 1px}.t-theme-text-form .t-editor .t-text-input p{margin:.875em 0;padding:0;border:0;outline:0}@supports not selector(:focus-visible){.t-theme-text-form .t-editor .t-text-input:focus{border-color:#fff;outline:#a3a3a3 solid 1px}}.t-theme-text-form .t-send-column{flex-grow:0;flex-shrink:0;white-space:nowrap;align-self:center;display:flex}.t-theme-text-form .t-textbox-column{position:relative;flex-grow:1;margin-right:.28em}.t-theme-text-form .t-send-button{width:2.571em;height:2.571em;padding:.571em;border:0;border-radius:9999px;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;background:transparent;color:currentColor;opacity:.75;transition:.15s ease-out}.t-theme-text-form .t-send-button:hover,.t-theme-text-form .t-send-button:focus{background-color:#2626260d}.t-theme-text-form .t-send-button:focus-visible{outline:0;box-shadow:0 0 0 2px rgba(#007df9,50%)}.t-theme-text-form .t-send-button{display:flex}.t-theme-text-form .t-send-button[disabled]{color:currentColor}.t-theme-text-form .t-readonly{opacity:.5;user-select:none}.t-theme-text-form .t-button-overlay{position:absolute;right:0;top:0;bottom:0;margin-right:8px;display:flex;align-items:center}.t-theme-text-form [t-kind=icon-button]{width:36px;height:36px;padding:8px;border:0;border-radius:9999px;cursor:pointer;display:inline-flex;justify-content:center;align-items:center;background:transparent;color:currentColor;opacity:.75;transition:.15s ease-out}.t-theme-text-form [t-kind=icon-button]:hover,.t-theme-text-form [t-kind=icon-button]:focus{background-color:rgba(#262626,5%);opacity:1}.t-theme-text-form [t-kind=icon-button]:focus-visible{outline:0;box-shadow:0 0 0 2px rgba(#007DF9,50%)}.t-theme-video-block{display:contents;min-height:100px;max-height:500px}.t-theme-video-block .download-icon{width:1em;height:1em;margin-right:.2em}.t-theme-video-block .t-root{position:relative;display:flex;justify-content:center;align-items:center;min-height:inherit;max-height:inherit;height:100%;overflow:hidden;margin:0 -1em .5em}.t-theme-video-block .t-video{min-width:0;min-height:0;max-height:inherit}.t-theme-video-block .t-filesize{font-size:.8em}.t-theme-message-list-footer{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:.5em;margin-top:1.35em}.t-theme-message-list-footer .t-typing-avatars{display:flex;flex-direction:row;align-items:left;justify-content:center;width:fit-content}.t-theme-message-list-footer .t-typing-avatars>.t-theme-avatar{width:2.6em;height:2.6em;display:flex;align-items:center;justify-content:center;color:#111;line-height:2.6em;vertical-align:text-top;font-size:.75em}.t-theme-message-list-footer .t-typing-avatars>.t-theme-avatar:not(:last-child){margin-right:-.66em}.t-theme-message-list-footer .t-typing-bubble{display:flex;flex-direction:row;justify-content:center;align-items:center;border-radius:1em;background-color:#f7f7f7;border:1px solid #ececec;color:#111;padding:0 1em;font-size:.75em}.t-theme-message-list-footer .t-typing-animation{display:flex;flex-direction:row;align-items:center;gap:4px;height:2.6em;line-height:2.6em}.t-theme-message-list-footer .t-typing-animation span{height:6px;width:6px;background-color:#737373;display:inline-block;border-radius:50%;opacity:.4}.t-theme-message-list-footer .t-typing-animation span:nth-of-type(1){animation:1s blink infinite .3333s}.t-theme-message-list-footer .t-typing-animation span:nth-of-type(2){animation:1s blink infinite .6666s}.t-theme-message-list-footer .t-typing-animation span:nth-of-type(3){animation:1s blink infinite .9999s}@keyframes blink{50%{opacity:1}}.t-message-list{width:100%;height:100%;display:flex;flex-direction:column-reverse;overflow-x:hidden;overflow-y:auto;padding:16px;scrollbar-color:rgba(0,0,0,.2) transparent}.t-message-list:hover{scrollbar-color:rgba(0,0,0,.4) transparent}.t-message-list:active{scrollbar-color:rgba(0,0,0,.6) transparent}.t-message-group{display:flex;flex-direction:column-reverse}.t-chatbox .t-panel{display:flex;justify-content:center;align-items:center;flex-direction:column;width:100%;height:100%;text-align:center;padding:25px;-webkit-font-smoothing:subpixel-antialiased;overflow-x:hidden;font-size:.95em;font-family:Open Sans,Helvetica,sans-serif}.t-chatbox .t-error-panel{background-color:#f7f7f7}:is(.t-chatbox .t-error-panel) .t-heading{font-size:2em}.t-loading-icon{animation:spin 1.2s cubic-bezier(.42,0,.58,1) infinite;display:block;margin:auto;width:4em;height:4em}.t-attach-overlay{z-index:2;width:100%;height:100%;padding:16px;background-color:#64646480;display:flex;justify-content:center;align-items:center}.t-upload-preview .t-preview{position:relative;background-color:#fff;border-radius:1rem;max-width:750px;width:100%;display:inline-block;overflow:auto;padding:.5rem}@media screen and (max-width: 500px){.t-upload-preview .t-preview{width:85%}}:is(.t-upload-preview .t-preview) .t-img-container{text-align:center;background-color:#0000001a}:is(.t-upload-preview .t-preview) img{display:block;max-width:100%;max-height:400px;margin-left:auto;margin-right:auto}:is(.t-upload-preview .t-preview) video{width:100%;height:100%;object-fit:fill}:is(.t-upload-preview .t-preview) .t-location-upload-preview{width:100%;background-color:#0000001a;padding-bottom:calc((400 / 600) * 100%);display:block}.t-upload-preview .t-cancel-row{text-align:right;position:sticky;top:8px;padding-right:8px;z-index:2;margin-bottom:-38px}.t-upload-preview .t-filename-row{white-space:pre-wrap;word-break:break-all;padding:.5rem 1rem 0}.t-is-file:is(.t-upload-preview .t-filename-row){display:flex;justify-content:center;align-items:center;min-height:250px;padding-top:32px;padding-bottom:32px;text-align:center;background-color:#0000001a;border-radius:1rem;margin-bottom:1rem}:is(.t-upload-preview .t-filename-row) .t-file-block{background-color:#fff;padding:16px 32px;border-radius:8px;display:inline-block}.t-upload-preview .t-error-row{border-width:.125rem;border-radius:1rem;padding:1rem;background-color:#fec8c866;border-color:transparent;color:#ef4444;white-space:normal}.t-upload-preview .t-send-row{position:sticky;bottom:0;padding:1rem;display:flex;justify-content:space-between}.t-upload-preview .t-cancel{border:0;border-radius:.5rem;padding:.75rem 1rem;cursor:pointer;color:currentColor}.t-upload-preview .t-confirm-send{margin-left:auto;border:0;border-radius:.5rem;padding:.75rem 1rem;cursor:pointer}.t-upload-preview .t-loading{height:80px;width:100%;display:flex;align-items:center;justify-content:center;color:#1e60e1}.t-upload-preview .t-preview,.t-upload-preview .t-send-row{background:#fff}.t-upload-preview .t-confirm-send{background-color:#007df9;color:#fff}.t-chatbox-content{flex-direction:column;margin:0;position:relative;width:100%;height:100%;display:flex;overflow-y:hidden}.t-chatbox-content>.t-attach-overlay{position:absolute;width:100%;height:100%;top:0;left:0}.t-chatbox-content>.t-drop-overlay{pointer-events:none}:is(.t-chatbox-content>.t-drop-overlay) .t-theme-icon{color:#1e1e1e80;width:300px;height:300px}:root{--reach-menu-button: 1}[data-reach-menu]{position:relative}[data-reach-menu-popover]{display:block;position:absolute}[data-reach-menu-popover][hidden]{display:none}[data-reach-menu-list],[data-reach-menu-items]{display:block;white-space:nowrap;border:solid 1px hsla(0,0%,0%,.25);background:#fffffffc;outline:none;padding:1rem 0;font-size:85%}[data-reach-menu-item]{display:block;user-select:none}[data-reach-menu-item]{cursor:pointer;display:block;color:inherit;font:inherit;text-decoration:initial;padding:5px 20px}[data-reach-menu-item][data-selected]{background:#1159a6;color:#fff;outline:none}[data-reach-menu-item][aria-disabled]{opacity:.5;cursor:not-allowed}.t-audio-player{width:100%;height:auto;display:flex;flex-direction:row;align-items:center;column-gap:10px;padding:1.5em 1em 0}.t-audio-player .t-waveform{flex-grow:1;z-index:0}.t-audio-player button{background:transparent;border:none;color:inherit;padding:0;cursor:pointer}.t-audio-player .t-playback-speed{width:4em}.t-audio-player .t-play-pause-icon{width:30px;height:30px}.t-audio-player .t-up-down-icon{width:1em;height:1em}.t-audio-player .t-up-down svg{margin-top:-2px}.t-audio-player .t-playback-heading{opacity:.5;padding:.5em 1em}.t-audio-player .t-playback-checkmark{display:inline-block;width:1em}:is(.t-text-input .empty-node):before{position:absolute;color:currentColor;cursor:text;opacity:.5}:is(.t-text-input .empty-node):first-child:before{content:attr(data-placeholder)}.t-editor .ProseMirror{position:relative}.t-editor .ProseMirror{word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:"liga" 0}.t-editor .ProseMirror pre{white-space:pre-wrap}.t-editor .ProseMirror li{position:relative}.t-editor .ProseMirror-hideselection *::selection{background:transparent}.t-editor .ProseMirror-hideselection *::-moz-selection{background:transparent}.t-editor .ProseMirror-hideselection{caret-color:transparent}.t-editor .ProseMirror [draggable][contenteditable=false]{user-select:text}.t-editor .ProseMirror-selectednode{outline:2px solid #8cf}.t-editor li.ProseMirror-selectednode{outline:none}.t-editor li.ProseMirror-selectednode:after{content:"";position:absolute;inset:-2px -2px -2px -32px;border:2px solid #8cf;pointer-events:none}.t-editor img.ProseMirror-separator{display:inline!important;border:none!important;margin:0!important}.t-chatbox{--default-chat-width: 420px;font-family:Twemoji Country Flags,Inter,sans-serif;cursor:initial;text-align:initial;text-transform:initial;text-indent:initial;visibility:initial;white-space:initial;font-size:14px;font-weight:400;line-height:1.37;color:#111;letter-spacing:normal;margin:0;position:relative;width:100%;height:100%;overflow:hidden;background-color:#fff;border:1px solid #d4d4d4;border-radius:.75em;box-shadow:none}.t-chatbox button{font-family:inherit;font-size:1em}.t-chatbox *,.t-chatbox *:before,.t-chatbox *:after{box-sizing:border-box}.t-chatbox svg{fill:currentColor}.t-chatbox em{font-style:italic}.t-chatbox strong{font-weight:700}.t-chatbox del{text-decoration:line-through}.t-chatbox code{font-family:Cascadia Code,Droid Sans Mono,Menlo,Consolas,Lucida Console,Monaco,monospace;font-variant-ligatures:none}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|
package/default.d.ts
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { AudioBlock } from '@talkjs/core';
|
|
2
|
+
import { ConversationSnapshot } from '@talkjs/core';
|
|
3
|
+
import { FileBlock } from '@talkjs/core';
|
|
4
|
+
import { FileToken } from '@talkjs/core';
|
|
5
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
6
|
+
import { ImageBlock } from '@talkjs/core';
|
|
7
|
+
import { LocationBlock } from '@talkjs/core';
|
|
8
|
+
import { MessageSnapshot } from '@talkjs/core';
|
|
9
|
+
import { ParticipantSnapshot } from '@talkjs/core';
|
|
10
|
+
import type * as React_2 from 'react';
|
|
11
|
+
import { RefAttributes } from 'react';
|
|
12
|
+
import { TextBlock } from '@talkjs/core';
|
|
13
|
+
import { TypingSnapshot } from '@talkjs/core';
|
|
14
|
+
import { UserSnapshot } from '@talkjs/core';
|
|
15
|
+
import { VideoBlock } from '@talkjs/core';
|
|
16
|
+
import { VoiceBlock } from '@talkjs/core';
|
|
17
|
+
|
|
18
|
+
declare type AppId = Brand<string, "App ID">;
|
|
19
|
+
|
|
20
|
+
declare interface AppMetadata {
|
|
21
|
+
id: AppId;
|
|
22
|
+
name: string;
|
|
23
|
+
defaultLocale: string;
|
|
24
|
+
custom: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare interface AudioBlockProps extends ContentBlockProps {
|
|
28
|
+
block: AudioBlock;
|
|
29
|
+
downloadUrl?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Brands a base type `T`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* type UserId = Brand<string, "UserId">;
|
|
38
|
+
* type MessageId = Brand<string, "MessageId">;
|
|
39
|
+
*
|
|
40
|
+
* const a: UserId = "abc" as UserId; // works
|
|
41
|
+
* const b: UserId = "abc"; // error
|
|
42
|
+
* const c: UserId = "abc" as MessageId; // error
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare type Brand<T, B extends string> = T & Branding<B>;
|
|
46
|
+
|
|
47
|
+
declare interface Branding<B extends string> {
|
|
48
|
+
__tag: Record<B, true>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @public
|
|
53
|
+
*
|
|
54
|
+
* A string that is one of `"notifications" | "microphone" | "geolocation"`.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* Note that more possible values may be added in the future, so make sure your
|
|
58
|
+
* handler can deal with unknown permission types gracefully.
|
|
59
|
+
*/
|
|
60
|
+
declare type BrowserPermission = "notifications" | "microphone" | "geolocation";
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Passed to `chatbox.beforeBrowserPermissionPrompt` when a browser permission
|
|
64
|
+
* dialog needs to be shown to the user.
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
declare interface BrowserPermissionRequest {
|
|
69
|
+
/**
|
|
70
|
+
* The type of permission requested.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* Note that more possible values may be added in the future, so make sure your
|
|
74
|
+
* handler can deal with unknown permission types gracefully.
|
|
75
|
+
*/
|
|
76
|
+
type: BrowserPermission;
|
|
77
|
+
/**
|
|
78
|
+
* Cancel whatever user action caused the permission to be requested.
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* For example, if a user wants to share their location for the first time so
|
|
82
|
+
* that this event is triggered, then if you call `cancel()`, no permission
|
|
83
|
+
* will be requested from the browser, the location sharing will be cancelled,
|
|
84
|
+
* and TalkJS will continue as if the location sharing button had not been
|
|
85
|
+
* clicked at all.
|
|
86
|
+
*
|
|
87
|
+
* This may be useful if you're using this event to show custom UI elements
|
|
88
|
+
* that nudge users towards granting permission, and this UI has a "cancel"
|
|
89
|
+
* button.
|
|
90
|
+
*/
|
|
91
|
+
cancel(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Show the browser permission prompt that lets the user allow or deny this
|
|
94
|
+
* permission.
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* When the user clicks "Allow", then the user action that triggered the
|
|
98
|
+
* browser permission request will proceed and the return value resolves to
|
|
99
|
+
* `"granted"`.
|
|
100
|
+
*
|
|
101
|
+
* When the user clicks "Deny", then the user action is cancelled, the
|
|
102
|
+
* `onMissingBrowserPermission` event is triggered, and the return value
|
|
103
|
+
* resolves to `"denied"`.
|
|
104
|
+
*/
|
|
105
|
+
showPrompt(): Promise<"granted" | "denied">;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export declare const Chatbox: typeof Chatbox_2;
|
|
109
|
+
|
|
110
|
+
declare const Chatbox_2: ForwardRefExoticComponent<ChatboxProps & RefAttributes<ChatboxRef>>;
|
|
111
|
+
|
|
112
|
+
export declare interface ChatboxProps {
|
|
113
|
+
appId: string;
|
|
114
|
+
userId: string;
|
|
115
|
+
conversationId: string;
|
|
116
|
+
token?: string;
|
|
117
|
+
tokenFetcher?: () => string | Promise<string>;
|
|
118
|
+
theme?: Theme;
|
|
119
|
+
enterSendsMessage?: boolean;
|
|
120
|
+
chatHeaderVisible?: boolean;
|
|
121
|
+
messageFieldVisible?: boolean;
|
|
122
|
+
messageFieldSpellcheck?: boolean;
|
|
123
|
+
messageFieldPlaceholder?: string;
|
|
124
|
+
onDeleteMessage?: (e: DeleteMessageEvent) => void;
|
|
125
|
+
onSendMessage?: (e: SendMessageEvent) => void;
|
|
126
|
+
beforeBrowserPermissionPrompt?: (request: BrowserPermissionRequest) => void;
|
|
127
|
+
onMissingBrowserPermission?: (e: MissingBrowserPermissionEvent) => void;
|
|
128
|
+
themeCustom?: any;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export declare interface ChatboxRef {
|
|
132
|
+
deleteMessage(messageId: string): Promise<void>;
|
|
133
|
+
editMessage(messageId: string, text: string): Promise<void>;
|
|
134
|
+
sendMessage(message: {
|
|
135
|
+
text: string;
|
|
136
|
+
custom?: Record<string, string>;
|
|
137
|
+
referencedMessageId?: string;
|
|
138
|
+
}): Promise<void>;
|
|
139
|
+
sendFileMessage(message: {
|
|
140
|
+
fileToken: FileToken;
|
|
141
|
+
custom?: Record<string, string>;
|
|
142
|
+
}): Promise<void>;
|
|
143
|
+
sendLocationMessage(message: {
|
|
144
|
+
location: Coordinates;
|
|
145
|
+
custom?: Record<string, string>;
|
|
146
|
+
}): Promise<void>;
|
|
147
|
+
setReferencedMessage(messageId: string | null): void;
|
|
148
|
+
openMessageActionMenu(messageId: string): void;
|
|
149
|
+
closeMessageActionMenu(): void;
|
|
150
|
+
getMessageFieldText: () => string;
|
|
151
|
+
setMessageFieldText: (text: string) => void;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare interface ChatHeaderProps {
|
|
155
|
+
conversation: ConversationSnapshot;
|
|
156
|
+
participants: ParticipantSnapshot[];
|
|
157
|
+
currentUser: UserSnapshot;
|
|
158
|
+
t: Translation;
|
|
159
|
+
chatbox: ChatboxRef;
|
|
160
|
+
themeCustom: any;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
declare interface ContentBlockProps {
|
|
164
|
+
message: MessageSnapshot;
|
|
165
|
+
currentUser: UserSnapshot;
|
|
166
|
+
t: Translation;
|
|
167
|
+
themeCustom: any;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
declare interface Coordinates {
|
|
171
|
+
latitude: number;
|
|
172
|
+
longitude: number;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
declare interface DeleteMessageEvent {
|
|
176
|
+
currentUser: UserSnapshot;
|
|
177
|
+
message: MessageSnapshot;
|
|
178
|
+
conversation: ConversationSnapshot;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare interface EditorState {
|
|
182
|
+
isTyping: boolean;
|
|
183
|
+
atTextLimit: boolean;
|
|
184
|
+
isEmpty: boolean;
|
|
185
|
+
characterCount: number;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
declare interface FileBlockProps extends ContentBlockProps {
|
|
189
|
+
block: FileBlock;
|
|
190
|
+
downloadUrl?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare interface IconProps {
|
|
194
|
+
type: "attach" | "chevronLeft" | "left" | "chevronUp" | "up" | "chevronDown" | "down" | "close" | "emoji" | "locationPin" | "more" | "plus" | "search" | "send" | "spinner" | "play" | "pause" | "updown" | "addEmoji" | "microphone" | "mic" | "stop" | "download" | "location" | "email" | "movie" | "image" | "attachment" | "horizontalDots" | "verticalDots" | "reply" | "back";
|
|
195
|
+
className?: string;
|
|
196
|
+
themeCustom: any;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
declare interface IEditorController extends EditorState {
|
|
200
|
+
send(): void;
|
|
201
|
+
shareLocation(): void;
|
|
202
|
+
attachFile(): void;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
declare interface ImageBlockProps extends ContentBlockProps {
|
|
206
|
+
block: ImageBlock;
|
|
207
|
+
downloadUrl?: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
declare interface LocationBlockProps extends ContentBlockProps {
|
|
211
|
+
block: LocationBlock;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
declare interface MessageActionMenuProps {
|
|
215
|
+
currentUser: UserSnapshot;
|
|
216
|
+
permissions: MessagePermissions;
|
|
217
|
+
conversation: ConversationSnapshot;
|
|
218
|
+
message: MessageSnapshot;
|
|
219
|
+
chatbox: ChatboxRef;
|
|
220
|
+
t: Translation;
|
|
221
|
+
themeCustom: any;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
declare interface MessageDividerProps {
|
|
225
|
+
isReadMarker: boolean;
|
|
226
|
+
isDayMarker: boolean;
|
|
227
|
+
timestamp?: number;
|
|
228
|
+
currentUser: UserSnapshot;
|
|
229
|
+
conversation: ConversationSnapshot;
|
|
230
|
+
app: AppMetadata;
|
|
231
|
+
t: Translation;
|
|
232
|
+
themeCustom: any;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
declare interface MessageFieldProps {
|
|
236
|
+
conversation: ConversationSnapshot;
|
|
237
|
+
participants: ParticipantSnapshot[];
|
|
238
|
+
referencedMessage: MessageSnapshot;
|
|
239
|
+
currentUser: UserSnapshot;
|
|
240
|
+
permissions: UserPermissions;
|
|
241
|
+
t: Translation;
|
|
242
|
+
chatbox: ChatboxRef;
|
|
243
|
+
editor?: IEditorController;
|
|
244
|
+
themeCustom: any;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
declare interface MessageListFooterProps {
|
|
248
|
+
typing: TypingSnapshot;
|
|
249
|
+
conversation: ConversationSnapshot;
|
|
250
|
+
participants: ParticipantSnapshot[];
|
|
251
|
+
currentUser: UserSnapshot;
|
|
252
|
+
t: Translation;
|
|
253
|
+
chatbox: ChatboxRef;
|
|
254
|
+
themeCustom: any;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
declare interface MessagePermissions extends UserPermissions {
|
|
258
|
+
canDeleteMessage: boolean;
|
|
259
|
+
canReplyToMessage: boolean;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
declare interface MessageProps {
|
|
263
|
+
app: AppMetadata;
|
|
264
|
+
currentUser: UserSnapshot;
|
|
265
|
+
message: MessageSnapshot;
|
|
266
|
+
messageStatus: MessageStatus;
|
|
267
|
+
conversation: ConversationSnapshot;
|
|
268
|
+
participants: ParticipantSnapshot[];
|
|
269
|
+
permissions: MessagePermissions;
|
|
270
|
+
t: Translation;
|
|
271
|
+
chatbox: ChatboxRef;
|
|
272
|
+
messageActionMenuAnchorRef: React_2.RefObject<HTMLElement | undefined>;
|
|
273
|
+
themeCustom: any;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
declare type MessageStatus = "sending" | "sent" | "everyoneRead";
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Sent by `onMissingBrowserPermission` when the user tried to do an action that
|
|
280
|
+
* require explicit browser permission, but that permission has been denied.
|
|
281
|
+
*
|
|
282
|
+
* @remarks
|
|
283
|
+
* This event is meant to let you show a message to the user if an action (eg
|
|
284
|
+
* sharing a location, or enabling notifications) can't proceed because the
|
|
285
|
+
* browser permission for that has been denied.
|
|
286
|
+
*
|
|
287
|
+
* If you want to control when to show the browser permissions prompt, use
|
|
288
|
+
* `beforeBrowserPermissionPrompt`.
|
|
289
|
+
*
|
|
290
|
+
* This event is emitted both when the user has denied this permission in the
|
|
291
|
+
* past, and when a user action just triggered a browser permissions prompt
|
|
292
|
+
* which the user then denied. If you need to differentiate between these two
|
|
293
|
+
* cases, use `beforeBrowserPermissionPrompt`, and inspect the return value of
|
|
294
|
+
* {@link BrowserPermissionRequest.showPrompt}.
|
|
295
|
+
*
|
|
296
|
+
* @public
|
|
297
|
+
*/
|
|
298
|
+
declare interface MissingBrowserPermissionEvent {
|
|
299
|
+
/**
|
|
300
|
+
* The type of permission that was denied.
|
|
301
|
+
*
|
|
302
|
+
* @remarks
|
|
303
|
+
* Note that more possible values may be added in the future, so make sure your
|
|
304
|
+
* handler can deal with unknown permission types gracefully.
|
|
305
|
+
*/
|
|
306
|
+
type: BrowserPermission;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
declare interface SendMessageEvent {
|
|
310
|
+
currentUser: UserSnapshot;
|
|
311
|
+
message: MessageSnapshot;
|
|
312
|
+
conversation: ConversationSnapshot;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
declare interface TextBlockProps extends ContentBlockProps {
|
|
316
|
+
block: TextBlock;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
declare interface Theme {
|
|
320
|
+
ChatHeader: React_2.ComponentType<ChatHeaderProps>;
|
|
321
|
+
Message: React_2.ComponentType<MessageProps>;
|
|
322
|
+
MessageField: React_2.ComponentType<MessageFieldProps>;
|
|
323
|
+
MessageActionMenu: React_2.ComponentType<MessageActionMenuProps>;
|
|
324
|
+
Icon: React_2.ComponentType<IconProps>;
|
|
325
|
+
MessageDivider: React_2.ComponentType<MessageDividerProps>;
|
|
326
|
+
MessageListFooter: React_2.ComponentType<MessageListFooterProps>;
|
|
327
|
+
TextBlock: React_2.ComponentType<TextBlockProps>;
|
|
328
|
+
FileBlock: React_2.ComponentType<FileBlockProps>;
|
|
329
|
+
LocationBlock: React_2.ComponentType<LocationBlockProps>;
|
|
330
|
+
ImageBlock: React_2.ComponentType<ImageBlockProps>;
|
|
331
|
+
AudioBlock: React_2.ComponentType<AudioBlockProps>;
|
|
332
|
+
VoiceBlock: React_2.ComponentType<VoiceBlockProps>;
|
|
333
|
+
VideoBlock: React_2.ComponentType<VideoBlockProps>;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export declare const theme: Theme;
|
|
337
|
+
|
|
338
|
+
declare type Translation = TranslationData & TranslationStrings;
|
|
339
|
+
|
|
340
|
+
declare interface TranslationData {
|
|
341
|
+
locale: string;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
declare interface TranslationStrings {
|
|
345
|
+
YESTERDAY: string;
|
|
346
|
+
TODAY: string;
|
|
347
|
+
DAYS: string;
|
|
348
|
+
HOURS: string;
|
|
349
|
+
MINUTES: string;
|
|
350
|
+
JUST_NOW: string;
|
|
351
|
+
LOCATION: string;
|
|
352
|
+
CANCEL: string;
|
|
353
|
+
INBOX: string;
|
|
354
|
+
DESKTOP_NOTIFICATIONS: string;
|
|
355
|
+
DESKTOP_NOTIFICATIONS_ERROR: string;
|
|
356
|
+
DESKTOP_NOTIFICATIONS_DEMO_TITLE: (appName: string) => string;
|
|
357
|
+
DESKTOP_NOTIFICATIONS_DEMO_BODY: string;
|
|
358
|
+
SEND_BUTTON_TEXT: string;
|
|
359
|
+
ENTRYBOX_TEXT_LIMIT: string;
|
|
360
|
+
ENTRYBOX_PLACEHOLDER: string;
|
|
361
|
+
ENTRYBOX_PLACEHOLDER_CHAT_CLOSED: string;
|
|
362
|
+
ENTRYBOX_PLACEHOLDER_CHAT_READONLY: string;
|
|
363
|
+
MESSAGELIST_LOADING_OLDER: string;
|
|
364
|
+
MESSAGELIST_SHOW_OLDER: string;
|
|
365
|
+
MESSAGELIST_NEW_MARKER: string;
|
|
366
|
+
MESSAGE_SENT_VIA_EMAIL: string;
|
|
367
|
+
YOU_MARKER: string;
|
|
368
|
+
UPLOAD_IN_PROGRESS: string;
|
|
369
|
+
UPLOAD_SEND_FILE: string;
|
|
370
|
+
UPLOAD_SHARE_LOCATION: string;
|
|
371
|
+
UPLOAD_ERROR: string;
|
|
372
|
+
SHARE_LOCATION_ERROR: string;
|
|
373
|
+
LOADING: string;
|
|
374
|
+
HUB_EMPTY: string;
|
|
375
|
+
HUB_SHOW_EARLIER: string;
|
|
376
|
+
INBOX_NO_CHATS_TITLE: string;
|
|
377
|
+
INBOX_NO_CHATS_BODY: string;
|
|
378
|
+
ENABLE_TRANSLATION: string;
|
|
379
|
+
DISABLE_TRANSLATION: string;
|
|
380
|
+
SEARCH_PLACEHOLDER_TEXT: string;
|
|
381
|
+
SEARCH_SEARCHING: string;
|
|
382
|
+
SEARCH_NO_RESULTS: string;
|
|
383
|
+
SEARCH_NO_MORE_RESULTS: string;
|
|
384
|
+
CHAT_NOT_FOUND: string;
|
|
385
|
+
DELETE_MESSAGE: string;
|
|
386
|
+
DELETION_EXPLANATION: string;
|
|
387
|
+
EDIT_MESSAGE: string;
|
|
388
|
+
SAVE: string;
|
|
389
|
+
EDITED_INDICATOR: string;
|
|
390
|
+
REPLY_TO_MESSAGE: string;
|
|
391
|
+
REPLY_TO_ARIA_LABEL: (senderName: string, content: string) => string;
|
|
392
|
+
REPLY_MODE_LEAVE_ARIA_LABEL: string;
|
|
393
|
+
ADD_REACTION: string;
|
|
394
|
+
AUTH_EXPIRED_OVERLAY_TITLE: string;
|
|
395
|
+
AUTH_EXPIRED_OVERLAY_DESCRIPTION: string;
|
|
396
|
+
VOICE_MESSAGE: string;
|
|
397
|
+
LEAVE_CONVERSATION: string;
|
|
398
|
+
MARK_CONVERSATION_AS_UNREAD: string;
|
|
399
|
+
STATUS_INDICATOR_ONLINE: string;
|
|
400
|
+
STATUS_INDICATOR_OFFLINE: string;
|
|
401
|
+
CONTACT_INFORMATION_HIDDEN: string;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
declare interface UserPermissions {
|
|
405
|
+
showTypingIndicator: boolean;
|
|
406
|
+
canShareFile: boolean;
|
|
407
|
+
canShareLocation: boolean;
|
|
408
|
+
canMention: boolean;
|
|
409
|
+
showOnlineStatus: boolean;
|
|
410
|
+
canSendVoiceMessage: boolean;
|
|
411
|
+
canLeaveConversation: boolean;
|
|
412
|
+
canMarkConversationAsUnread: boolean;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
declare interface VideoBlockProps extends ContentBlockProps {
|
|
416
|
+
block: VideoBlock;
|
|
417
|
+
downloadUrl?: string;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
declare interface VoiceBlockProps extends ContentBlockProps {
|
|
421
|
+
block: VoiceBlock;
|
|
422
|
+
downloadUrl?: string;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export { }
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
declare global {
|
|
429
|
+
interface HTMLElementTagNameMap {
|
|
430
|
+
"t-chatbox": ChatboxHTMLElement;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
declare global {
|
|
436
|
+
namespace JSX {
|
|
437
|
+
interface IntrinsicElements {
|
|
438
|
+
"t-chatbox": typeof Chatbox;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|