@nyaruka/temba-components 0.59.0 → 0.60.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/devcontainer.json +8 -1
- package/CHANGELOG.md +13 -0
- package/dist/{a0408c72.js → 196cda88.js} +28 -15
- package/dist/index.js +28 -15
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/templates/components-body.html +1 -1
- package/dist/templates/components-head.html +1 -1
- package/out-tsc/src/compose/Compose.js +60 -24
- package/out-tsc/src/compose/Compose.js.map +1 -1
- package/out-tsc/test/temba-compose.test.js +9 -9
- package/out-tsc/test/temba-compose.test.js.map +1 -1
- package/package.json +1 -1
- package/src/compose/Compose.ts +57 -24
- package/test/temba-compose.test.ts +11 -17
|
@@ -11,7 +11,14 @@
|
|
|
11
11
|
"--hostname=temba-components"
|
|
12
12
|
],
|
|
13
13
|
"remoteUser": "node",
|
|
14
|
-
"postCreateCommand": "sudo chown -R node /workspaces/temba-components/static/svg && sudo chown node /workspaces/temba-components && sudo chown node /workspaces/temba-components/screenshots && yarn install"
|
|
14
|
+
"postCreateCommand": "sudo chown -R node /workspaces/temba-components/static/svg && sudo chown node /workspaces/temba-components && sudo chown node /workspaces/temba-components/screenshots && yarn install",
|
|
15
|
+
"customizations": {
|
|
16
|
+
"vscode": {
|
|
17
|
+
"extensions": [
|
|
18
|
+
"lfs.vscode-emacs-friendly"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
15
22
|
// "features": {},
|
|
16
23
|
// "customizations": {},
|
|
17
24
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,21 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [v0.60.1](https://github.com/nyaruka/temba-components/compare/v0.60.0...v0.60.1)
|
|
8
|
+
|
|
9
|
+
- Fix compose reset [`#369`](https://github.com/nyaruka/temba-components/pull/369)
|
|
10
|
+
|
|
11
|
+
#### [v0.60.0](https://github.com/nyaruka/temba-components/compare/v0.59.0...v0.60.0)
|
|
12
|
+
|
|
13
|
+
> 2 October 2023
|
|
14
|
+
|
|
15
|
+
- Make completion an option on compose [`#368`](https://github.com/nyaruka/temba-components/pull/368)
|
|
16
|
+
- Add emacs keymap to devcontainer [`b6c1d3a`](https://github.com/nyaruka/temba-components/commit/b6c1d3a907dd78bf1d2a8184b7600ec4364c7460)
|
|
17
|
+
|
|
7
18
|
#### [v0.59.0](https://github.com/nyaruka/temba-components/compare/v0.58.8...v0.59.0)
|
|
8
19
|
|
|
20
|
+
> 28 September 2023
|
|
21
|
+
|
|
9
22
|
- Rendering for optin events [`#367`](https://github.com/nyaruka/temba-components/pull/367)
|
|
10
23
|
- Fix reading created_by for msg events [`#364`](https://github.com/nyaruka/temba-components/pull/364)
|
|
11
24
|
- Add logical icon names for optin and optout [`#365`](https://github.com/nyaruka/temba-components/pull/365)
|
|
@@ -5825,7 +5825,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5825
5825
|
.items {
|
|
5826
5826
|
}
|
|
5827
5827
|
|
|
5828
|
-
|
|
5828
|
+
.chatbox {
|
|
5829
5829
|
margin-left: 0.3em;
|
|
5830
5830
|
margin-top: 0.3em;
|
|
5831
5831
|
--color-widget-border: none;
|
|
@@ -5920,7 +5920,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5920
5920
|
color: rgba(250, 0, 0, 0.75);
|
|
5921
5921
|
font-size: var(--help-text-size);
|
|
5922
5922
|
}
|
|
5923
|
-
`}constructor(){super(),this.currentText="",this.accept="",this.endpoint=Jt,this.currentAttachments=[],this.failedAttachments=[],this.buttonName="Send",this.buttonDisabled=!0,this.buttonError="",this.value=""}deserializeComposeValue(){if(this.value){const t=JSON.parse(this.value);this.chatbox&&(this.
|
|
5923
|
+
`}constructor(){super(),this.currentText="",this.initialText="",this.accept="",this.endpoint=Jt,this.currentAttachments=[],this.failedAttachments=[],this.buttonName="Send",this.buttonDisabled=!0,this.buttonError="",this.value=""}deserializeComposeValue(){if(this.value){const t=JSON.parse(this.value);this.chatbox&&(this.initialText=t.text),this.attachments&&(this.currentAttachments=t.attachments)}}serializeComposeValue(){const t={text:this.currentText,attachments:this.currentAttachments};this.value=JSON.stringify(t)}firstUpdated(t){super.firstUpdated(t),this.deserializeComposeValue(),this.setFocusOnChatbox()}updated(t){super.updated(t),(t.has("currentText")||t.has("currentAttachments"))&&(this.toggleButton(),this.serializeComposeValue(),this.fireCustomEvent(Ee.ContentChanged,this.value)),this.setFocusOnChatbox()}setFocusOnChatbox(){if(this.chatbox){const t=this.shadowRoot.querySelector(".chatbox");t&&window.setTimeout((()=>{t.focus()}),0)}}reset(){this.shadowRoot.querySelector(".chatbox").value="",this.initialText="",this.currentText="",this.currentAttachments=[],this.failedAttachments=[],this.buttonError=""}handleContainerClick(t){this.setFocusOnChatbox()}handleChatboxChange(t){const e=t.target;this.currentText=e.value,this.toggleButton(),this.serializeComposeValue(),this.fireCustomEvent(Ee.ContentChanged,this.value)}handleDragEnter(t){this.highlight(t)}handleDragOver(t){this.highlight(t)}handleDragLeave(t){this.unhighlight(t)}handleDrop(t){this.unhighlight(t);const e=t.dataTransfer;if(e){const t=e.files;this.uploadFiles(t)}}preventDefaults(t){t.preventDefault(),t.stopPropagation()}highlight(t){this.pendingDrop=!0,this.preventDefaults(t)}unhighlight(t){this.pendingDrop=!1,this.preventDefaults(t)}handleUploadFileIconClicked(){this.dispatchEvent(new Event("change"))}handleUploadFileInputChanged(t){const e=t.target.files;this.uploadFiles(e)}uploadFiles(t){let e=[];e=this.currentAttachments&&this.currentAttachments.length>0?[...t].filter((t=>{if(-1===this.currentAttachments.findIndex((e=>e.filename===t.name&&e.size===t.size)))return t})):[...t],e.map((t=>{this.uploadFile(t)}))}uploadFile(t){this.uploading=!0;const e=this.endpoint,i=new FormData;i.append("file",t),le(e,i).then((t=>{const e=t.json;e&&this.addCurrentAttachment(e)})).catch((e=>{let i="";i=400===e.status?e.json.file[0]:"Server failure",console.error(i),this.addFailedAttachment(t,i)})).finally((()=>{this.uploading=!1}))}addCurrentAttachment(t){this.currentAttachments.push(t),this.requestUpdate("currentAttachments")}removeCurrentAttachment(t){this.currentAttachments=this.currentAttachments.filter((e=>e!==t)),this.requestUpdate("currentAttachments")}addFailedAttachment(t,e){const i={uuid:Math.random().toString(36).slice(2,6),content_type:t.type,filename:t.name,url:t.name,size:t.size,error:e};this.failedAttachments.push(i),this.requestUpdate("failedAttachments")}removeFailedAttachment(t){this.failedAttachments=this.failedAttachments.filter((e=>e!==t)),this.requestUpdate("failedAttachments")}handleRemoveFileClicked(t){const e=t.target,i=this.currentAttachments.find((({uuid:t})=>t===e.id));i&&this.removeCurrentAttachment(i);const n=this.failedAttachments.find((({uuid:t})=>t===e.id));n&&this.removeFailedAttachment(n)}toggleButton(){if(this.button){this.buttonError="";const t=0===this.currentText.trim().length,e=0===this.currentAttachments.length;this.chatbox&&this.attachments?this.buttonDisabled=t&&e:this.chatbox?this.buttonDisabled=t:this.attachments?this.buttonDisabled=e:this.buttonDisabled=!0}}handleSendClick(t){t.stopPropagation(),this.handleSend()}handleSendEnter(t){if(this.button&&"Enter"===t.key&&!t.shiftKey)if(this.completion){t.target.hasVisibleOptions()||(this.handleSend(),this.preventDefaults(t))}else this.handleSend(),this.preventDefaults(t)}handleSend(){if(!this.buttonDisabled){this.buttonDisabled=!0;const t=this.buttonName;this.fireCustomEvent(Ee.ButtonClicked,{name:t})}}render(){return D`
|
|
5924
5924
|
<temba-field
|
|
5925
5925
|
name=${this.name}
|
|
5926
5926
|
.errors=${this.errors}
|
|
@@ -5937,23 +5937,34 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5937
5937
|
>
|
|
5938
5938
|
<div class="drop-mask"><div>Upload Attachment</div></div>
|
|
5939
5939
|
|
|
5940
|
-
${this.chatbox?D
|
|
5940
|
+
${this.chatbox?D`${this.getChatbox()}`:null}
|
|
5941
5941
|
${this.attachments?D`<div class="items attachments">
|
|
5942
5942
|
${this.getAttachments()}
|
|
5943
5943
|
</div>`:null}
|
|
5944
5944
|
<div class="items actions">${this.getActions()}</div>
|
|
5945
5945
|
</div>
|
|
5946
5946
|
</temba-field>
|
|
5947
|
-
`}getChatbox(){return D` <temba-completion
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5947
|
+
`}getChatbox(){return this.completion?D` <temba-completion
|
|
5948
|
+
class="chatbox"
|
|
5949
|
+
value=${this.initialText}
|
|
5950
|
+
gsm
|
|
5951
|
+
textarea
|
|
5952
|
+
autogrow
|
|
5953
|
+
@change=${this.handleChatboxChange}
|
|
5954
|
+
@keydown=${this.handleSendEnter}
|
|
5955
|
+
placeholder="Write something here"
|
|
5956
|
+
>
|
|
5957
|
+
</temba-completion>`:D` <temba-textinput
|
|
5958
|
+
class="chatbox"
|
|
5959
|
+
gsm
|
|
5960
|
+
textarea
|
|
5961
|
+
autogrow
|
|
5962
|
+
value=${this.initialText}
|
|
5963
|
+
@change=${this.handleChatboxChange}
|
|
5964
|
+
@keydown=${this.handleSendEnter}
|
|
5965
|
+
placeholder="Write something here"
|
|
5966
|
+
>
|
|
5967
|
+
</temba-textinput>`}getAttachments(){return D`
|
|
5957
5968
|
${this.currentAttachments&&this.currentAttachments.length>0||this.failedAttachments&&this.failedAttachments.length>0?D` <div class="attachments-list">
|
|
5958
5969
|
${this.currentAttachments.map((t=>{return D` <div class="attachment-item">
|
|
5959
5970
|
<div
|
|
@@ -6022,12 +6033,14 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
6022
6033
|
@click="${this.handleUploadFileIconClicked}"
|
|
6023
6034
|
clickable
|
|
6024
6035
|
></temba-icon>
|
|
6025
|
-
</label>`}getCounter(){return D`<temba-charcount
|
|
6036
|
+
</label>`}getCounter(){return D`<temba-charcount
|
|
6037
|
+
.text="${this.currentText}"
|
|
6038
|
+
></temba-charcount>`}getButton(){return D` <temba-button
|
|
6026
6039
|
id="send-button"
|
|
6027
6040
|
name=${this.buttonName}
|
|
6028
6041
|
@click=${this.handleSendClick}
|
|
6029
6042
|
?disabled=${this.buttonDisabled}
|
|
6030
|
-
></temba-button>`}}t([ct({type:Boolean})],lh.prototype,"chatbox",void 0),t([ct({type:Boolean})],lh.prototype,"attachments",void 0),t([ct({type:Boolean})],lh.prototype,"counter",void 0),t([ct({type:Boolean})],lh.prototype,"pendingDrop",void 0),t([ct({type:Boolean})],lh.prototype,"button",void 0),t([ct({type:String})],lh.prototype,"currentText",void 0),t([ct({type:String})],lh.prototype,"accept",void 0),t([ct({type:String,attribute:!1})],lh.prototype,"endpoint",void 0),t([ct({type:Boolean,attribute:!1})],lh.prototype,"uploading",void 0),t([ct({type:Array})],lh.prototype,"currentAttachments",void 0),t([ct({type:Array,attribute:!1})],lh.prototype,"failedAttachments",void 0),t([ct({type:String})],lh.prototype,"buttonName",void 0),t([ct({type:Boolean,attribute:!1})],lh.prototype,"buttonDisabled",void 0),t([ct({type:String,attribute:!1})],lh.prototype,"buttonError",void 0),t([ct({type:Boolean,attribute:"widget_only"})],lh.prototype,"widgetOnly",void 0),t([ct({type:Array})],lh.prototype,"errors",void 0),t([ct({type:String})],lh.prototype,"value",void 0);class hh extends lt{constructor(){super(...arguments),this.animationTime=300,this.show=!1,this.zoom=!1,this.zoomPct=.9,this.scale=1,this.xTrans="0px",this.yTrans="0px"}static get styles(){return r`
|
|
6043
|
+
></temba-button>`}}t([ct({type:Boolean})],lh.prototype,"completion",void 0),t([ct({type:Boolean})],lh.prototype,"chatbox",void 0),t([ct({type:Boolean})],lh.prototype,"attachments",void 0),t([ct({type:Boolean})],lh.prototype,"counter",void 0),t([ct({type:Boolean})],lh.prototype,"pendingDrop",void 0),t([ct({type:Boolean})],lh.prototype,"button",void 0),t([ct({type:String})],lh.prototype,"currentText",void 0),t([ct({type:String})],lh.prototype,"initialText",void 0),t([ct({type:String})],lh.prototype,"accept",void 0),t([ct({type:String,attribute:!1})],lh.prototype,"endpoint",void 0),t([ct({type:Boolean,attribute:!1})],lh.prototype,"uploading",void 0),t([ct({type:Array})],lh.prototype,"currentAttachments",void 0),t([ct({type:Array,attribute:!1})],lh.prototype,"failedAttachments",void 0),t([ct({type:String})],lh.prototype,"buttonName",void 0),t([ct({type:Boolean,attribute:!1})],lh.prototype,"buttonDisabled",void 0),t([ct({type:String,attribute:!1})],lh.prototype,"buttonError",void 0),t([ct({type:Boolean,attribute:"widget_only"})],lh.prototype,"widgetOnly",void 0),t([ct({type:Array})],lh.prototype,"errors",void 0),t([ct({type:String})],lh.prototype,"value",void 0);class hh extends lt{constructor(){super(...arguments),this.animationTime=300,this.show=!1,this.zoom=!1,this.zoomPct=.9,this.scale=1,this.xTrans="0px",this.yTrans="0px"}static get styles(){return r`
|
|
6031
6044
|
:host {
|
|
6032
6045
|
position: absolute;
|
|
6033
6046
|
}
|
package/dist/index.js
CHANGED
|
@@ -5825,7 +5825,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5825
5825
|
.items {
|
|
5826
5826
|
}
|
|
5827
5827
|
|
|
5828
|
-
|
|
5828
|
+
.chatbox {
|
|
5829
5829
|
margin-left: 0.3em;
|
|
5830
5830
|
margin-top: 0.3em;
|
|
5831
5831
|
--color-widget-border: none;
|
|
@@ -5920,7 +5920,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5920
5920
|
color: rgba(250, 0, 0, 0.75);
|
|
5921
5921
|
font-size: var(--help-text-size);
|
|
5922
5922
|
}
|
|
5923
|
-
`}constructor(){super(),this.currentText="",this.accept="",this.endpoint=Jt,this.currentAttachments=[],this.failedAttachments=[],this.buttonName="Send",this.buttonDisabled=!0,this.buttonError="",this.value=""}deserializeComposeValue(){if(this.value){const t=JSON.parse(this.value);this.chatbox&&(this.
|
|
5923
|
+
`}constructor(){super(),this.currentText="",this.initialText="",this.accept="",this.endpoint=Jt,this.currentAttachments=[],this.failedAttachments=[],this.buttonName="Send",this.buttonDisabled=!0,this.buttonError="",this.value=""}deserializeComposeValue(){if(this.value){const t=JSON.parse(this.value);this.chatbox&&(this.initialText=t.text),this.attachments&&(this.currentAttachments=t.attachments)}}serializeComposeValue(){const t={text:this.currentText,attachments:this.currentAttachments};this.value=JSON.stringify(t)}firstUpdated(t){super.firstUpdated(t),this.deserializeComposeValue(),this.setFocusOnChatbox()}updated(t){super.updated(t),(t.has("currentText")||t.has("currentAttachments"))&&(this.toggleButton(),this.serializeComposeValue(),this.fireCustomEvent(Ee.ContentChanged,this.value)),this.setFocusOnChatbox()}setFocusOnChatbox(){if(this.chatbox){const t=this.shadowRoot.querySelector(".chatbox");t&&window.setTimeout((()=>{t.focus()}),0)}}reset(){this.shadowRoot.querySelector(".chatbox").value="",this.initialText="",this.currentText="",this.currentAttachments=[],this.failedAttachments=[],this.buttonError=""}handleContainerClick(t){this.setFocusOnChatbox()}handleChatboxChange(t){const e=t.target;this.currentText=e.value,this.toggleButton(),this.serializeComposeValue(),this.fireCustomEvent(Ee.ContentChanged,this.value)}handleDragEnter(t){this.highlight(t)}handleDragOver(t){this.highlight(t)}handleDragLeave(t){this.unhighlight(t)}handleDrop(t){this.unhighlight(t);const e=t.dataTransfer;if(e){const t=e.files;this.uploadFiles(t)}}preventDefaults(t){t.preventDefault(),t.stopPropagation()}highlight(t){this.pendingDrop=!0,this.preventDefaults(t)}unhighlight(t){this.pendingDrop=!1,this.preventDefaults(t)}handleUploadFileIconClicked(){this.dispatchEvent(new Event("change"))}handleUploadFileInputChanged(t){const e=t.target.files;this.uploadFiles(e)}uploadFiles(t){let e=[];e=this.currentAttachments&&this.currentAttachments.length>0?[...t].filter((t=>{if(-1===this.currentAttachments.findIndex((e=>e.filename===t.name&&e.size===t.size)))return t})):[...t],e.map((t=>{this.uploadFile(t)}))}uploadFile(t){this.uploading=!0;const e=this.endpoint,i=new FormData;i.append("file",t),le(e,i).then((t=>{const e=t.json;e&&this.addCurrentAttachment(e)})).catch((e=>{let i="";i=400===e.status?e.json.file[0]:"Server failure",console.error(i),this.addFailedAttachment(t,i)})).finally((()=>{this.uploading=!1}))}addCurrentAttachment(t){this.currentAttachments.push(t),this.requestUpdate("currentAttachments")}removeCurrentAttachment(t){this.currentAttachments=this.currentAttachments.filter((e=>e!==t)),this.requestUpdate("currentAttachments")}addFailedAttachment(t,e){const i={uuid:Math.random().toString(36).slice(2,6),content_type:t.type,filename:t.name,url:t.name,size:t.size,error:e};this.failedAttachments.push(i),this.requestUpdate("failedAttachments")}removeFailedAttachment(t){this.failedAttachments=this.failedAttachments.filter((e=>e!==t)),this.requestUpdate("failedAttachments")}handleRemoveFileClicked(t){const e=t.target,i=this.currentAttachments.find((({uuid:t})=>t===e.id));i&&this.removeCurrentAttachment(i);const n=this.failedAttachments.find((({uuid:t})=>t===e.id));n&&this.removeFailedAttachment(n)}toggleButton(){if(this.button){this.buttonError="";const t=0===this.currentText.trim().length,e=0===this.currentAttachments.length;this.chatbox&&this.attachments?this.buttonDisabled=t&&e:this.chatbox?this.buttonDisabled=t:this.attachments?this.buttonDisabled=e:this.buttonDisabled=!0}}handleSendClick(t){t.stopPropagation(),this.handleSend()}handleSendEnter(t){if(this.button&&"Enter"===t.key&&!t.shiftKey)if(this.completion){t.target.hasVisibleOptions()||(this.handleSend(),this.preventDefaults(t))}else this.handleSend(),this.preventDefaults(t)}handleSend(){if(!this.buttonDisabled){this.buttonDisabled=!0;const t=this.buttonName;this.fireCustomEvent(Ee.ButtonClicked,{name:t})}}render(){return D`
|
|
5924
5924
|
<temba-field
|
|
5925
5925
|
name=${this.name}
|
|
5926
5926
|
.errors=${this.errors}
|
|
@@ -5937,23 +5937,34 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5937
5937
|
>
|
|
5938
5938
|
<div class="drop-mask"><div>Upload Attachment</div></div>
|
|
5939
5939
|
|
|
5940
|
-
${this.chatbox?D
|
|
5940
|
+
${this.chatbox?D`${this.getChatbox()}`:null}
|
|
5941
5941
|
${this.attachments?D`<div class="items attachments">
|
|
5942
5942
|
${this.getAttachments()}
|
|
5943
5943
|
</div>`:null}
|
|
5944
5944
|
<div class="items actions">${this.getActions()}</div>
|
|
5945
5945
|
</div>
|
|
5946
5946
|
</temba-field>
|
|
5947
|
-
`}getChatbox(){return D` <temba-completion
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5947
|
+
`}getChatbox(){return this.completion?D` <temba-completion
|
|
5948
|
+
class="chatbox"
|
|
5949
|
+
value=${this.initialText}
|
|
5950
|
+
gsm
|
|
5951
|
+
textarea
|
|
5952
|
+
autogrow
|
|
5953
|
+
@change=${this.handleChatboxChange}
|
|
5954
|
+
@keydown=${this.handleSendEnter}
|
|
5955
|
+
placeholder="Write something here"
|
|
5956
|
+
>
|
|
5957
|
+
</temba-completion>`:D` <temba-textinput
|
|
5958
|
+
class="chatbox"
|
|
5959
|
+
gsm
|
|
5960
|
+
textarea
|
|
5961
|
+
autogrow
|
|
5962
|
+
value=${this.initialText}
|
|
5963
|
+
@change=${this.handleChatboxChange}
|
|
5964
|
+
@keydown=${this.handleSendEnter}
|
|
5965
|
+
placeholder="Write something here"
|
|
5966
|
+
>
|
|
5967
|
+
</temba-textinput>`}getAttachments(){return D`
|
|
5957
5968
|
${this.currentAttachments&&this.currentAttachments.length>0||this.failedAttachments&&this.failedAttachments.length>0?D` <div class="attachments-list">
|
|
5958
5969
|
${this.currentAttachments.map((t=>{return D` <div class="attachment-item">
|
|
5959
5970
|
<div
|
|
@@ -6022,12 +6033,14 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
6022
6033
|
@click="${this.handleUploadFileIconClicked}"
|
|
6023
6034
|
clickable
|
|
6024
6035
|
></temba-icon>
|
|
6025
|
-
</label>`}getCounter(){return D`<temba-charcount
|
|
6036
|
+
</label>`}getCounter(){return D`<temba-charcount
|
|
6037
|
+
.text="${this.currentText}"
|
|
6038
|
+
></temba-charcount>`}getButton(){return D` <temba-button
|
|
6026
6039
|
id="send-button"
|
|
6027
6040
|
name=${this.buttonName}
|
|
6028
6041
|
@click=${this.handleSendClick}
|
|
6029
6042
|
?disabled=${this.buttonDisabled}
|
|
6030
|
-
></temba-button>`}}t([ct({type:Boolean})],lh.prototype,"chatbox",void 0),t([ct({type:Boolean})],lh.prototype,"attachments",void 0),t([ct({type:Boolean})],lh.prototype,"counter",void 0),t([ct({type:Boolean})],lh.prototype,"pendingDrop",void 0),t([ct({type:Boolean})],lh.prototype,"button",void 0),t([ct({type:String})],lh.prototype,"currentText",void 0),t([ct({type:String})],lh.prototype,"accept",void 0),t([ct({type:String,attribute:!1})],lh.prototype,"endpoint",void 0),t([ct({type:Boolean,attribute:!1})],lh.prototype,"uploading",void 0),t([ct({type:Array})],lh.prototype,"currentAttachments",void 0),t([ct({type:Array,attribute:!1})],lh.prototype,"failedAttachments",void 0),t([ct({type:String})],lh.prototype,"buttonName",void 0),t([ct({type:Boolean,attribute:!1})],lh.prototype,"buttonDisabled",void 0),t([ct({type:String,attribute:!1})],lh.prototype,"buttonError",void 0),t([ct({type:Boolean,attribute:"widget_only"})],lh.prototype,"widgetOnly",void 0),t([ct({type:Array})],lh.prototype,"errors",void 0),t([ct({type:String})],lh.prototype,"value",void 0);class hh extends lt{constructor(){super(...arguments),this.animationTime=300,this.show=!1,this.zoom=!1,this.zoomPct=.9,this.scale=1,this.xTrans="0px",this.yTrans="0px"}static get styles(){return r`
|
|
6043
|
+
></temba-button>`}}t([ct({type:Boolean})],lh.prototype,"completion",void 0),t([ct({type:Boolean})],lh.prototype,"chatbox",void 0),t([ct({type:Boolean})],lh.prototype,"attachments",void 0),t([ct({type:Boolean})],lh.prototype,"counter",void 0),t([ct({type:Boolean})],lh.prototype,"pendingDrop",void 0),t([ct({type:Boolean})],lh.prototype,"button",void 0),t([ct({type:String})],lh.prototype,"currentText",void 0),t([ct({type:String})],lh.prototype,"initialText",void 0),t([ct({type:String})],lh.prototype,"accept",void 0),t([ct({type:String,attribute:!1})],lh.prototype,"endpoint",void 0),t([ct({type:Boolean,attribute:!1})],lh.prototype,"uploading",void 0),t([ct({type:Array})],lh.prototype,"currentAttachments",void 0),t([ct({type:Array,attribute:!1})],lh.prototype,"failedAttachments",void 0),t([ct({type:String})],lh.prototype,"buttonName",void 0),t([ct({type:Boolean,attribute:!1})],lh.prototype,"buttonDisabled",void 0),t([ct({type:String,attribute:!1})],lh.prototype,"buttonError",void 0),t([ct({type:Boolean,attribute:"widget_only"})],lh.prototype,"widgetOnly",void 0),t([ct({type:Array})],lh.prototype,"errors",void 0),t([ct({type:String})],lh.prototype,"value",void 0);class hh extends lt{constructor(){super(...arguments),this.animationTime=300,this.show=!1,this.zoom=!1,this.zoomPct=.9,this.scale=1,this.xTrans="0px",this.yTrans="0px"}static get styles(){return r`
|
|
6031
6044
|
:host {
|
|
6032
6045
|
position: absolute;
|
|
6033
6046
|
}
|
package/dist/sw.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
if(!self.define){let e,t={};const o=(o,n)=>(o=new URL(o+".js",n).href,t[o]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=o,e.onload=t,document.head.appendChild(e)}else e=o,importScripts(o),t()})).then((()=>{let e=t[o];if(!e)throw new Error(`Module ${o} didn’t register its module`);return e})));self.define=(n,s)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(t[i])return;let r={};const
|
|
1
|
+
if(!self.define){let e,t={};const o=(o,n)=>(o=new URL(o+".js",n).href,t[o]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=o,e.onload=t,document.head.appendChild(e)}else e=o,importScripts(o),t()})).then((()=>{let e=t[o];if(!e)throw new Error(`Module ${o} didn’t register its module`);return e})));self.define=(n,s)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(t[i])return;let r={};const l=e=>o(e,i),c={module:{uri:i},exports:r,require:l};t[i]=Promise.all(n.map((e=>c[e]||l(e)))).then((e=>(s(...e),r)))}}define(["./workbox-919adfb7"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"196cda88.js",revision:"01b7b43dc164e7109279c07e6a29e13c"},{url:"templates/components-body.html",revision:"a5e236ef1e371527aa559a02a941e88b"},{url:"templates/components-head.html",revision:"0964163972f7dcd6b8b08a990c7a2c2e"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")}));
|
|
2
2
|
//# sourceMappingURL=sw.js.map
|
package/dist/sw.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sw.js","sources":["../../tmp/
|
|
1
|
+
{"version":3,"file":"sw.js","sources":["../../tmp/5cae798e2c458439a67eb82ff7339ca5/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/workspaces/temba-components/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/workspaces/temba-components/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/workspaces/temba-components/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/workspaces/temba-components/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/workspaces/temba-components/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/workspaces/temba-components/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"196cda88.js\",\n \"revision\": \"01b7b43dc164e7109279c07e6a29e13c\"\n },\n {\n \"url\": \"templates/components-body.html\",\n \"revision\": \"a5e236ef1e371527aa559a02a941e88b\"\n },\n {\n \"url\": \"templates/components-head.html\",\n \"revision\": \"0964163972f7dcd6b8b08a990c7a2c2e\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"0nBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,cACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<script type="module" src="{{STATIC_URL}}@nyaruka/temba-components/dist/
|
|
1
|
+
<script type="module" src="{{STATIC_URL}}@nyaruka/temba-components/dist/196cda88.js"></script><script>window.TEMBA_COMPONENTS_VERSION="0.60.1"</script>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<link rel="modulepreload" href="{{STATIC_URL}}@nyaruka/temba-components/dist/
|
|
1
|
+
<link rel="modulepreload" href="{{STATIC_URL}}@nyaruka/temba-components/dist/196cda88.js" crossorigin="anonymous">
|
|
@@ -61,7 +61,7 @@ export class Compose extends FormElement {
|
|
|
61
61
|
.items {
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
.chatbox {
|
|
65
65
|
margin-left: 0.3em;
|
|
66
66
|
margin-top: 0.3em;
|
|
67
67
|
--color-widget-border: none;
|
|
@@ -161,6 +161,7 @@ export class Compose extends FormElement {
|
|
|
161
161
|
constructor() {
|
|
162
162
|
super();
|
|
163
163
|
this.currentText = '';
|
|
164
|
+
this.initialText = '';
|
|
164
165
|
this.accept = ''; //e.g. ".xls,.xlsx"
|
|
165
166
|
this.endpoint = DEFAULT_MEDIA_ENDPOINT;
|
|
166
167
|
this.currentAttachments = [];
|
|
@@ -174,7 +175,7 @@ export class Compose extends FormElement {
|
|
|
174
175
|
if (this.value) {
|
|
175
176
|
const parsed_value = JSON.parse(this.value);
|
|
176
177
|
if (this.chatbox) {
|
|
177
|
-
this.
|
|
178
|
+
this.initialText = parsed_value.text;
|
|
178
179
|
}
|
|
179
180
|
if (this.attachments) {
|
|
180
181
|
this.currentAttachments = parsed_value.attachments;
|
|
@@ -205,7 +206,7 @@ export class Compose extends FormElement {
|
|
|
205
206
|
}
|
|
206
207
|
setFocusOnChatbox() {
|
|
207
208
|
if (this.chatbox) {
|
|
208
|
-
const completion = this.shadowRoot.querySelector('
|
|
209
|
+
const completion = this.shadowRoot.querySelector('.chatbox');
|
|
209
210
|
if (completion) {
|
|
210
211
|
window.setTimeout(() => {
|
|
211
212
|
completion.focus();
|
|
@@ -214,6 +215,8 @@ export class Compose extends FormElement {
|
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
reset() {
|
|
218
|
+
this.shadowRoot.querySelector('.chatbox').value = '';
|
|
219
|
+
this.initialText = '';
|
|
217
220
|
this.currentText = '';
|
|
218
221
|
this.currentAttachments = [];
|
|
219
222
|
this.failedAttachments = [];
|
|
@@ -223,8 +226,11 @@ export class Compose extends FormElement {
|
|
|
223
226
|
this.setFocusOnChatbox();
|
|
224
227
|
}
|
|
225
228
|
handleChatboxChange(evt) {
|
|
226
|
-
const
|
|
227
|
-
this.currentText =
|
|
229
|
+
const chatbox = evt.target;
|
|
230
|
+
this.currentText = chatbox.value;
|
|
231
|
+
this.toggleButton();
|
|
232
|
+
this.serializeComposeValue();
|
|
233
|
+
this.fireCustomEvent(CustomEventType.ContentChanged, this.value);
|
|
228
234
|
}
|
|
229
235
|
handleDragEnter(evt) {
|
|
230
236
|
this.highlight(evt);
|
|
@@ -367,12 +373,20 @@ export class Compose extends FormElement {
|
|
|
367
373
|
this.handleSend();
|
|
368
374
|
}
|
|
369
375
|
handleSendEnter(evt) {
|
|
370
|
-
if (
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
376
|
+
if (this.button) {
|
|
377
|
+
if (evt.key === 'Enter' && !evt.shiftKey) {
|
|
378
|
+
if (this.completion) {
|
|
379
|
+
const chat = evt.target;
|
|
380
|
+
if (!chat.hasVisibleOptions()) {
|
|
381
|
+
this.handleSend();
|
|
382
|
+
this.preventDefaults(evt);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
this.handleSend();
|
|
387
|
+
this.preventDefaults(evt);
|
|
388
|
+
}
|
|
374
389
|
}
|
|
375
|
-
this.preventDefaults(evt);
|
|
376
390
|
}
|
|
377
391
|
}
|
|
378
392
|
handleSend() {
|
|
@@ -400,9 +414,7 @@ export class Compose extends FormElement {
|
|
|
400
414
|
>
|
|
401
415
|
<div class="drop-mask"><div>Upload Attachment</div></div>
|
|
402
416
|
|
|
403
|
-
${this.chatbox
|
|
404
|
-
? html `<div class="items chatbox">${this.getChatbox()}</div>`
|
|
405
|
-
: null}
|
|
417
|
+
${this.chatbox ? html `${this.getChatbox()}` : null}
|
|
406
418
|
${this.attachments
|
|
407
419
|
? html `<div class="items attachments">
|
|
408
420
|
${this.getAttachments()}
|
|
@@ -414,16 +426,32 @@ export class Compose extends FormElement {
|
|
|
414
426
|
`;
|
|
415
427
|
}
|
|
416
428
|
getChatbox() {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
429
|
+
if (this.completion) {
|
|
430
|
+
return html ` <temba-completion
|
|
431
|
+
class="chatbox"
|
|
432
|
+
value=${this.initialText}
|
|
433
|
+
gsm
|
|
434
|
+
textarea
|
|
435
|
+
autogrow
|
|
436
|
+
@change=${this.handleChatboxChange}
|
|
437
|
+
@keydown=${this.handleSendEnter}
|
|
438
|
+
placeholder="Write something here"
|
|
439
|
+
>
|
|
440
|
+
</temba-completion>`;
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
return html ` <temba-textinput
|
|
444
|
+
class="chatbox"
|
|
445
|
+
gsm
|
|
446
|
+
textarea
|
|
447
|
+
autogrow
|
|
448
|
+
value=${this.initialText}
|
|
449
|
+
@change=${this.handleChatboxChange}
|
|
450
|
+
@keydown=${this.handleSendEnter}
|
|
451
|
+
placeholder="Write something here"
|
|
452
|
+
>
|
|
453
|
+
</temba-textinput>`;
|
|
454
|
+
}
|
|
427
455
|
}
|
|
428
456
|
getAttachments() {
|
|
429
457
|
return html `
|
|
@@ -518,7 +546,9 @@ export class Compose extends FormElement {
|
|
|
518
546
|
}
|
|
519
547
|
}
|
|
520
548
|
getCounter() {
|
|
521
|
-
return html `<temba-charcount
|
|
549
|
+
return html `<temba-charcount
|
|
550
|
+
.text="${this.currentText}"
|
|
551
|
+
></temba-charcount>`;
|
|
522
552
|
}
|
|
523
553
|
getButton() {
|
|
524
554
|
return html ` <temba-button
|
|
@@ -529,6 +559,9 @@ export class Compose extends FormElement {
|
|
|
529
559
|
></temba-button>`;
|
|
530
560
|
}
|
|
531
561
|
}
|
|
562
|
+
__decorate([
|
|
563
|
+
property({ type: Boolean })
|
|
564
|
+
], Compose.prototype, "completion", void 0);
|
|
532
565
|
__decorate([
|
|
533
566
|
property({ type: Boolean })
|
|
534
567
|
], Compose.prototype, "chatbox", void 0);
|
|
@@ -547,6 +580,9 @@ __decorate([
|
|
|
547
580
|
__decorate([
|
|
548
581
|
property({ type: String })
|
|
549
582
|
], Compose.prototype, "currentText", void 0);
|
|
583
|
+
__decorate([
|
|
584
|
+
property({ type: String })
|
|
585
|
+
], Compose.prototype, "initialText", void 0);
|
|
550
586
|
__decorate([
|
|
551
587
|
property({ type: String })
|
|
552
588
|
], Compose.prototype, "accept", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Compose.js","sourceRoot":"","sources":["../../../src/compose/Compose.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,cAAc,EACd,cAAc,EACd,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,sBAAsB,GAEvB,MAAM,UAAU,CAAC;AAYlB,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAChB","sourcesContent":["import { TemplateResult, html, css } from 'lit';\nimport { FormElement } from '../FormElement';\nimport { property } from 'lit/decorators.js';\nimport { Icon } from '../vectoricon';\nimport { CustomEventType } from '../interfaces';\nimport {\n formatFileSize,\n formatFileType,\n getClasses,\n postFormData,\n truncate,\n DEFAULT_MEDIA_ENDPOINT,\n WebResponse,\n} from '../utils';\nimport { Completion } from '../completion/Completion';\n\nexport interface Attachment {\n uuid: string;\n content_type: string;\n url: string;\n filename: string;\n size: number;\n error: string;\n}\n\nexport class Compose extends FormElement {\n static get styles() {\n return css`\n .container {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n position: relative;\n\n border-radius: var(--curvature-widget);\n background: var(--color-widget-bg);\n border: 1px solid var(--color-widget-border);\n transition: all ease-in-out var(--transition-speed);\n box-shadow: var(--widget-box-shadow);\n caret-color: var(--input-caret);\n padding: var(--temba-textinput-padding);\n }\n .container:focus-within {\n border-color: var(--color-focus);\n background: var(--color-widget-bg-focused);\n box-shadow: var(--widget-box-shadow-focused);\n }\n\n .drop-mask {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n z-index: 1;\n height: 100%;\n width: 100%;\n bottom: 0;\n right: 0;\n background: rgba(210, 243, 184, 0.8);\n border-radius: var(--curvature-widget);\n margin: -0.5em;\n padding: 0.5em;\n transition: opacity ease-in-out var(--transition-speed);\n display: flex;\n align-items: center;\n text-align: center;\n }\n\n .highlight .drop-mask {\n opacity: 1;\n }\n\n .drop-mask > div {\n margin: auto;\n border-radius: var(--curvature-widget);\n font-weight: 400;\n color: rgba(0, 0, 0, 0.5);\n }\n\n .items {\n }\n\n temba-completion {\n margin-left: 0.3em;\n margin-top: 0.3em;\n --color-widget-border: none;\n --curvature-widget: none;\n --widget-box-shadow: none;\n --widget-box-shadow-focused: none;\n --temba-textinput-padding: 0;\n }\n\n .attachments {\n display: flex;\n flex-direction: column;\n }\n .attachments-list {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n }\n .attachment-item {\n background: rgba(100, 100, 100, 0.1);\n border-radius: 2px;\n margin: 0.3em;\n display: flex;\n color: var(--color-widget-text);\n }\n .attachment-item.error {\n background: rgba(250, 0, 0, 0.1);\n color: rgba(250, 0, 0, 0.75);\n }\n .remove-item {\n cursor: pointer !important;\n padding: 3px 6px;\n border-right: 1px solid rgba(100, 100, 100, 0.2);\n margin-top: 1px;\n background: rgba(100, 100, 100, 0.05);\n }\n\n .remove-item:hover {\n background: rgba(100, 100, 100, 0.1);\n }\n\n .remove-item.error:hover {\n background: rgba(250, 0, 0, 0.1);\n }\n\n .remove-item.error {\n background: rgba(250, 0, 0, 0.05);\n color: rgba(250, 0, 0, 0.75);\n }\n .attachment-name {\n align-self: center;\n font-size: 12px;\n padding: 2px 8px;\n }\n\n .actions {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-left: 0.25em;\n padding: 0.2em;\n }\n\n #upload-input {\n display: none;\n }\n .upload-label {\n display: flex;\n align-items: center;\n }\n .upload-icon {\n color: rgb(102, 102, 102);\n }\n .actions-right {\n display: flex;\n align-items: center;\n }\n temba-charcount {\n margin-right: 5px;\n overflow: hidden;\n --temba-charcount-counts-margin-top: 0px;\n --temba-charcount-summary-margin-top: 0px;\n --temba-charcount-summary-position: fixed;\n --temba-charcount-summary-right: 105px;\n --temba-charcount-summary-bottom: 105px;\n }\n temba-button {\n --button-y: 1px;\n --button-x: 12px;\n }\n .send-error {\n color: rgba(250, 0, 0, 0.75);\n font-size: var(--help-text-size);\n }\n `;\n }\n\n @property({ type: Boolean })\n chatbox: boolean;\n\n @property({ type: Boolean })\n attachments: boolean;\n\n @property({ type: Boolean })\n counter: boolean;\n\n @property({ type: Boolean })\n pendingDrop: boolean;\n\n @property({ type: Boolean })\n button: boolean;\n\n @property({ type: String })\n currentText = '';\n\n @property({ type: String })\n accept = ''; //e.g. \".xls,.xlsx\"\n\n @property({ type: String, attribute: false })\n endpoint = DEFAULT_MEDIA_ENDPOINT;\n\n @property({ type: Boolean, attribute: false })\n uploading: boolean;\n\n @property({ type: Array })\n currentAttachments: Attachment[] = [];\n\n @property({ type: Array, attribute: false })\n failedAttachments: Attachment[] = [];\n\n @property({ type: String })\n buttonName = 'Send';\n\n @property({ type: Boolean, attribute: false })\n buttonDisabled = true;\n\n @property({ type: String, attribute: false })\n buttonError = '';\n\n @property({ type: Boolean, attribute: 'widget_only' })\n widgetOnly: boolean;\n\n @property({ type: Array })\n errors: string[];\n\n @property({ type: String })\n value = '';\n\n public constructor() {\n super();\n }\n\n private deserializeComposeValue(): void {\n if (this.value) {\n const parsed_value = JSON.parse(this.value);\n if (this.chatbox) {\n this.currentText = parsed_value.text;\n }\n if (this.attachments) {\n this.currentAttachments = parsed_value.attachments;\n }\n }\n }\n\n private serializeComposeValue(): void {\n const composeValue = {\n text: this.currentText,\n attachments: this.currentAttachments,\n };\n // update this.value...\n this.value = JSON.stringify(composeValue);\n }\n\n public firstUpdated(changes: Map<string, any>): void {\n super.firstUpdated(changes);\n\n this.deserializeComposeValue();\n this.setFocusOnChatbox();\n }\n\n public updated(changes: Map<string, any>): void {\n super.updated(changes);\n\n if (changes.has('currentText') || changes.has('currentAttachments')) {\n this.toggleButton();\n this.serializeComposeValue();\n this.fireCustomEvent(CustomEventType.ContentChanged, this.value);\n }\n\n this.setFocusOnChatbox();\n }\n\n private setFocusOnChatbox(): void {\n if (this.chatbox) {\n const completion = this.shadowRoot.querySelector(\n 'temba-completion'\n ) as Completion;\n if (completion) {\n window.setTimeout(() => {\n completion.focus();\n }, 0);\n }\n }\n }\n\n public reset(): void {\n this.currentText = '';\n this.currentAttachments = [];\n this.failedAttachments = [];\n this.buttonError = '';\n }\n\n private handleContainerClick(evt: Event) {\n this.setFocusOnChatbox();\n }\n\n private handleChatboxChange(evt: Event) {\n const completion = evt.target as Completion;\n this.currentText = completion.value;\n }\n\n private handleDragEnter(evt: DragEvent): void {\n this.highlight(evt);\n }\n\n private handleDragOver(evt: DragEvent): void {\n this.highlight(evt);\n }\n\n private handleDragLeave(evt: DragEvent): void {\n this.unhighlight(evt);\n }\n\n private handleDrop(evt: DragEvent): void {\n this.unhighlight(evt);\n\n const dt = evt.dataTransfer;\n if (dt) {\n const files = dt.files;\n this.uploadFiles(files);\n }\n }\n\n private preventDefaults(evt: Event): void {\n evt.preventDefault();\n evt.stopPropagation();\n }\n\n private highlight(evt: DragEvent): void {\n this.pendingDrop = true;\n this.preventDefaults(evt);\n }\n\n private unhighlight(evt: DragEvent): void {\n this.pendingDrop = false;\n this.preventDefaults(evt);\n }\n\n private handleUploadFileIconClicked(): void {\n this.dispatchEvent(new Event('change'));\n }\n\n private handleUploadFileInputChanged(evt: Event): void {\n const target = evt.target as HTMLInputElement;\n const files = target.files;\n this.uploadFiles(files);\n }\n\n public uploadFiles(files: FileList): void {\n let filesToUpload = [];\n if (this.currentAttachments && this.currentAttachments.length > 0) {\n //remove duplicate files that have already been uploaded\n filesToUpload = [...files].filter(file => {\n const index = this.currentAttachments.findIndex(\n value => value.filename === file.name && value.size === file.size\n );\n if (index === -1) {\n return file;\n }\n });\n } else {\n filesToUpload = [...files];\n }\n filesToUpload.map(fileToUpload => {\n this.uploadFile(fileToUpload);\n });\n }\n\n private uploadFile(file: File): void {\n this.uploading = true;\n\n const url = this.endpoint;\n const payload = new FormData();\n payload.append('file', file);\n postFormData(url, payload)\n .then((response: WebResponse) => {\n const attachment = response.json as Attachment;\n if (attachment) {\n this.addCurrentAttachment(attachment);\n }\n })\n .catch((error: WebResponse) => {\n let uploadError = '';\n if (error.status === 400) {\n uploadError = error.json.file[0];\n } else {\n uploadError = 'Server failure';\n }\n console.error(uploadError);\n this.addFailedAttachment(file, uploadError);\n })\n .finally(() => {\n this.uploading = false;\n });\n }\n\n private addCurrentAttachment(attachmentToAdd: any) {\n this.currentAttachments.push(attachmentToAdd);\n this.requestUpdate('currentAttachments');\n }\n private removeCurrentAttachment(attachmentToRemove: any) {\n this.currentAttachments = this.currentAttachments.filter(\n currentAttachment => currentAttachment !== attachmentToRemove\n );\n this.requestUpdate('currentAttachments');\n }\n\n private addFailedAttachment(file: File, error: string) {\n const failedAttachment = {\n uuid: Math.random().toString(36).slice(2, 6),\n content_type: file.type,\n filename: file.name,\n url: file.name,\n size: file.size,\n error: error,\n } as Attachment;\n this.failedAttachments.push(failedAttachment);\n this.requestUpdate('failedAttachments');\n }\n private removeFailedAttachment(attachmentToRemove: any) {\n this.failedAttachments = this.failedAttachments.filter(\n (failedAttachment: any) => failedAttachment !== attachmentToRemove\n );\n this.requestUpdate('failedAttachments');\n }\n\n private handleRemoveFileClicked(evt: Event): void {\n const target = evt.target as HTMLDivElement;\n\n const currentAttachmentToRemove = this.currentAttachments.find(\n ({ uuid }) => uuid === target.id\n );\n if (currentAttachmentToRemove) {\n this.removeCurrentAttachment(currentAttachmentToRemove);\n }\n\n const failedAttachmentToRemove = this.failedAttachments.find(\n ({ uuid }) => uuid === target.id\n );\n if (failedAttachmentToRemove) {\n this.removeFailedAttachment(failedAttachmentToRemove);\n }\n }\n\n public toggleButton() {\n if (this.button) {\n this.buttonError = '';\n const chatboxEmpty = this.currentText.trim().length === 0;\n const attachmentsEmpty = this.currentAttachments.length === 0;\n if (this.chatbox && this.attachments) {\n this.buttonDisabled = chatboxEmpty && attachmentsEmpty;\n } else if (this.chatbox) {\n this.buttonDisabled = chatboxEmpty;\n } else if (this.attachments) {\n this.buttonDisabled = attachmentsEmpty;\n } else {\n this.buttonDisabled = true;\n }\n }\n }\n\n private handleSendClick(evt: Event) {\n evt.stopPropagation();\n this.handleSend();\n }\n\n private handleSendEnter(evt: KeyboardEvent) {\n if (evt.key === 'Enter' && !evt.shiftKey) {\n const chat = evt.target as Completion;\n if (!chat.hasVisibleOptions()) {\n this.handleSend();\n }\n this.preventDefaults(evt);\n }\n }\n\n private handleSend() {\n if (!this.buttonDisabled) {\n this.buttonDisabled = true;\n const name = this.buttonName;\n this.fireCustomEvent(CustomEventType.ButtonClicked, { name });\n }\n }\n\n public render(): TemplateResult {\n return html`\n <temba-field\n name=${this.name}\n .errors=${this.errors}\n .widgetOnly=${this.widgetOnly}\n value=${this.value}\n >\n <div\n class=${getClasses({ container: true, highlight: this.pendingDrop })}\n @click=\"${this.handleContainerClick}\"\n @dragenter=\"${this.handleDragEnter}\"\n @dragover=\"${this.handleDragOver}\"\n @dragleave=\"${this.handleDragLeave}\"\n @drop=\"${this.handleDrop}\"\n >\n <div class=\"drop-mask\"><div>Upload Attachment</div></div>\n\n ${this.chatbox\n ? html`<div class=\"items chatbox\">${this.getChatbox()}</div>`\n : null}\n ${this.attachments\n ? html`<div class=\"items attachments\">\n ${this.getAttachments()}\n </div>`\n : null}\n <div class=\"items actions\">${this.getActions()}</div>\n </div>\n </temba-field>\n `;\n }\n\n private getChatbox(): TemplateResult {\n return html` <temba-completion\n value=${this.currentText}\n gsm\n textarea\n autogrow\n @change=${this.handleChatboxChange}\n @keydown=${this.handleSendEnter}\n placeholder=\"Write something here\"\n >\n </temba-completion>`;\n }\n\n private getAttachments(): TemplateResult {\n return html`\n ${(this.currentAttachments && this.currentAttachments.length > 0) ||\n (this.failedAttachments && this.failedAttachments.length > 0)\n ? html` <div class=\"attachments-list\">\n ${this.currentAttachments.map(validAttachment => {\n return html` <div class=\"attachment-item\">\n <div\n class=\"remove-item\"\n @click=\"${this.handleRemoveFileClicked}\"\n >\n <temba-icon\n id=\"${validAttachment.uuid}\"\n name=\"${Icon.delete_small}\"\n ></temba-icon>\n </div>\n <div class=\"attachment-name\">\n <span\n title=\"${validAttachment.filename} (${formatFileSize(\n validAttachment.size,\n 2\n )}) ${validAttachment.content_type}\"\n >${truncate(validAttachment.filename, 25)}\n (${formatFileSize(validAttachment.size, 0)})\n ${formatFileType(validAttachment.content_type)}</span\n >\n </div>\n </div>`;\n })}\n ${this.failedAttachments.map(invalidAttachment => {\n return html` <div class=\"attachment-item error\">\n <div\n class=\"remove-item error\"\n @click=\"${this.handleRemoveFileClicked}\"\n >\n <temba-icon\n id=\"${invalidAttachment.uuid}\"\n name=\"${Icon.delete_small}\"\n ></temba-icon>\n </div>\n <div class=\"attachment-name\">\n <span\n title=\"${invalidAttachment.filename} (${formatFileSize(\n 0,\n 0\n )}) - Attachment failed - ${invalidAttachment.error}\"\n >${truncate(invalidAttachment.filename, 25)}\n (${formatFileSize(0, 0)}) - Attachment failed</span\n >\n </div>\n </div>`;\n })}\n </div>`\n : null}\n `;\n }\n\n private getActions(): TemplateResult {\n return html`\n <div class=\"actions-left\">\n ${this.attachments ? this.getUploader() : null}\n </div>\n <div class=\"actions-center\"></div>\n <div class=\"actions-right\">\n ${this.buttonError\n ? html`<div class=\"send-error\">${this.buttonError}</div>`\n : null}\n ${this.counter ? this.getCounter() : null}\n ${this.button ? this.getButton() : null}\n </div>\n `;\n }\n\n private getUploader(): TemplateResult {\n if (this.uploading) {\n return html`<temba-loading units=\"3\" size=\"12\"></temba-loading>`;\n } else {\n return html` <input\n type=\"file\"\n id=\"upload-input\"\n multiple\n accept=\"${this.accept}\"\n @change=\"${this.handleUploadFileInputChanged}\"\n />\n <label\n id=\"upload-label\"\n class=\"actions-left upload-label\"\n for=\"upload-input\"\n >\n <temba-icon\n id=\"upload-icon\"\n class=\"upload-icon\"\n name=\"${Icon.attachment}\"\n @click=\"${this.handleUploadFileIconClicked}\"\n clickable\n ></temba-icon>\n </label>`;\n }\n }\n\n private getCounter(): TemplateResult {\n return html`<temba-charcount text=\"${this.currentText}\"></temba-charcount>`;\n }\n\n private getButton(): TemplateResult {\n return html` <temba-button\n id=\"send-button\"\n name=${this.buttonName}\n @click=${this.handleSendClick}\n ?disabled=${this.buttonDisabled}\n ></temba-button>`;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Compose.js","sourceRoot":"","sources":["../../../src/compose/Compose.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,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C,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAChB","sourcesContent":["import { TemplateResult, html, css } from 'lit';\nimport { FormElement } from '../FormElement';\nimport { property } from 'lit/decorators.js';\nimport { Icon } from '../vectoricon';\nimport { CustomEventType } from '../interfaces';\nimport {\n formatFileSize,\n formatFileType,\n getClasses,\n postFormData,\n truncate,\n DEFAULT_MEDIA_ENDPOINT,\n WebResponse,\n} from '../utils';\nimport { Completion } from '../completion/Completion';\n\nexport interface Attachment {\n uuid: string;\n content_type: string;\n url: string;\n filename: string;\n size: number;\n error: string;\n}\n\nexport class Compose extends FormElement {\n static get styles() {\n return css`\n .container {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n position: relative;\n\n border-radius: var(--curvature-widget);\n background: var(--color-widget-bg);\n border: 1px solid var(--color-widget-border);\n transition: all ease-in-out var(--transition-speed);\n box-shadow: var(--widget-box-shadow);\n caret-color: var(--input-caret);\n padding: var(--temba-textinput-padding);\n }\n .container:focus-within {\n border-color: var(--color-focus);\n background: var(--color-widget-bg-focused);\n box-shadow: var(--widget-box-shadow-focused);\n }\n\n .drop-mask {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n z-index: 1;\n height: 100%;\n width: 100%;\n bottom: 0;\n right: 0;\n background: rgba(210, 243, 184, 0.8);\n border-radius: var(--curvature-widget);\n margin: -0.5em;\n padding: 0.5em;\n transition: opacity ease-in-out var(--transition-speed);\n display: flex;\n align-items: center;\n text-align: center;\n }\n\n .highlight .drop-mask {\n opacity: 1;\n }\n\n .drop-mask > div {\n margin: auto;\n border-radius: var(--curvature-widget);\n font-weight: 400;\n color: rgba(0, 0, 0, 0.5);\n }\n\n .items {\n }\n\n .chatbox {\n margin-left: 0.3em;\n margin-top: 0.3em;\n --color-widget-border: none;\n --curvature-widget: none;\n --widget-box-shadow: none;\n --widget-box-shadow-focused: none;\n --temba-textinput-padding: 0;\n }\n\n .attachments {\n display: flex;\n flex-direction: column;\n }\n .attachments-list {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n }\n .attachment-item {\n background: rgba(100, 100, 100, 0.1);\n border-radius: 2px;\n margin: 0.3em;\n display: flex;\n color: var(--color-widget-text);\n }\n .attachment-item.error {\n background: rgba(250, 0, 0, 0.1);\n color: rgba(250, 0, 0, 0.75);\n }\n .remove-item {\n cursor: pointer !important;\n padding: 3px 6px;\n border-right: 1px solid rgba(100, 100, 100, 0.2);\n margin-top: 1px;\n background: rgba(100, 100, 100, 0.05);\n }\n\n .remove-item:hover {\n background: rgba(100, 100, 100, 0.1);\n }\n\n .remove-item.error:hover {\n background: rgba(250, 0, 0, 0.1);\n }\n\n .remove-item.error {\n background: rgba(250, 0, 0, 0.05);\n color: rgba(250, 0, 0, 0.75);\n }\n .attachment-name {\n align-self: center;\n font-size: 12px;\n padding: 2px 8px;\n }\n\n .actions {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-left: 0.25em;\n padding: 0.2em;\n }\n\n #upload-input {\n display: none;\n }\n .upload-label {\n display: flex;\n align-items: center;\n }\n .upload-icon {\n color: rgb(102, 102, 102);\n }\n .actions-right {\n display: flex;\n align-items: center;\n }\n temba-charcount {\n margin-right: 5px;\n overflow: hidden;\n --temba-charcount-counts-margin-top: 0px;\n --temba-charcount-summary-margin-top: 0px;\n --temba-charcount-summary-position: fixed;\n --temba-charcount-summary-right: 105px;\n --temba-charcount-summary-bottom: 105px;\n }\n temba-button {\n --button-y: 1px;\n --button-x: 12px;\n }\n .send-error {\n color: rgba(250, 0, 0, 0.75);\n font-size: var(--help-text-size);\n }\n `;\n }\n\n @property({ type: Boolean })\n completion: boolean;\n\n @property({ type: Boolean })\n chatbox: boolean;\n\n @property({ type: Boolean })\n attachments: boolean;\n\n @property({ type: Boolean })\n counter: boolean;\n\n @property({ type: Boolean })\n pendingDrop: boolean;\n\n @property({ type: Boolean })\n button: boolean;\n\n @property({ type: String })\n currentText = '';\n\n @property({ type: String })\n initialText = '';\n\n @property({ type: String })\n accept = ''; //e.g. \".xls,.xlsx\"\n\n @property({ type: String, attribute: false })\n endpoint = DEFAULT_MEDIA_ENDPOINT;\n\n @property({ type: Boolean, attribute: false })\n uploading: boolean;\n\n @property({ type: Array })\n currentAttachments: Attachment[] = [];\n\n @property({ type: Array, attribute: false })\n failedAttachments: Attachment[] = [];\n\n @property({ type: String })\n buttonName = 'Send';\n\n @property({ type: Boolean, attribute: false })\n buttonDisabled = true;\n\n @property({ type: String, attribute: false })\n buttonError = '';\n\n @property({ type: Boolean, attribute: 'widget_only' })\n widgetOnly: boolean;\n\n @property({ type: Array })\n errors: string[];\n\n @property({ type: String })\n value = '';\n\n public constructor() {\n super();\n }\n\n private deserializeComposeValue(): void {\n if (this.value) {\n const parsed_value = JSON.parse(this.value);\n if (this.chatbox) {\n this.initialText = parsed_value.text;\n }\n if (this.attachments) {\n this.currentAttachments = parsed_value.attachments;\n }\n }\n }\n\n private serializeComposeValue(): void {\n const composeValue = {\n text: this.currentText,\n attachments: this.currentAttachments,\n };\n // update this.value...\n this.value = JSON.stringify(composeValue);\n }\n\n public firstUpdated(changes: Map<string, any>): void {\n super.firstUpdated(changes);\n\n this.deserializeComposeValue();\n this.setFocusOnChatbox();\n }\n\n public updated(changes: Map<string, any>): void {\n super.updated(changes);\n\n if (changes.has('currentText') || changes.has('currentAttachments')) {\n this.toggleButton();\n this.serializeComposeValue();\n this.fireCustomEvent(CustomEventType.ContentChanged, this.value);\n }\n\n this.setFocusOnChatbox();\n }\n\n private setFocusOnChatbox(): void {\n if (this.chatbox) {\n const completion = this.shadowRoot.querySelector(\n '.chatbox'\n ) as Completion;\n if (completion) {\n window.setTimeout(() => {\n completion.focus();\n }, 0);\n }\n }\n }\n\n public reset(): void {\n (this.shadowRoot.querySelector('.chatbox') as HTMLInputElement).value = '';\n this.initialText = '';\n this.currentText = '';\n this.currentAttachments = [];\n this.failedAttachments = [];\n this.buttonError = '';\n }\n\n private handleContainerClick(evt: Event) {\n this.setFocusOnChatbox();\n }\n\n private handleChatboxChange(evt: Event) {\n const chatbox = evt.target as HTMLInputElement;\n this.currentText = chatbox.value;\n this.toggleButton();\n this.serializeComposeValue();\n this.fireCustomEvent(CustomEventType.ContentChanged, this.value);\n }\n\n private handleDragEnter(evt: DragEvent): void {\n this.highlight(evt);\n }\n\n private handleDragOver(evt: DragEvent): void {\n this.highlight(evt);\n }\n\n private handleDragLeave(evt: DragEvent): void {\n this.unhighlight(evt);\n }\n\n private handleDrop(evt: DragEvent): void {\n this.unhighlight(evt);\n\n const dt = evt.dataTransfer;\n if (dt) {\n const files = dt.files;\n this.uploadFiles(files);\n }\n }\n\n private preventDefaults(evt: Event): void {\n evt.preventDefault();\n evt.stopPropagation();\n }\n\n private highlight(evt: DragEvent): void {\n this.pendingDrop = true;\n this.preventDefaults(evt);\n }\n\n private unhighlight(evt: DragEvent): void {\n this.pendingDrop = false;\n this.preventDefaults(evt);\n }\n\n private handleUploadFileIconClicked(): void {\n this.dispatchEvent(new Event('change'));\n }\n\n private handleUploadFileInputChanged(evt: Event): void {\n const target = evt.target as HTMLInputElement;\n const files = target.files;\n this.uploadFiles(files);\n }\n\n public uploadFiles(files: FileList): void {\n let filesToUpload = [];\n if (this.currentAttachments && this.currentAttachments.length > 0) {\n //remove duplicate files that have already been uploaded\n filesToUpload = [...files].filter(file => {\n const index = this.currentAttachments.findIndex(\n value => value.filename === file.name && value.size === file.size\n );\n if (index === -1) {\n return file;\n }\n });\n } else {\n filesToUpload = [...files];\n }\n filesToUpload.map(fileToUpload => {\n this.uploadFile(fileToUpload);\n });\n }\n\n private uploadFile(file: File): void {\n this.uploading = true;\n\n const url = this.endpoint;\n const payload = new FormData();\n payload.append('file', file);\n postFormData(url, payload)\n .then((response: WebResponse) => {\n const attachment = response.json as Attachment;\n if (attachment) {\n this.addCurrentAttachment(attachment);\n }\n })\n .catch((error: WebResponse) => {\n let uploadError = '';\n if (error.status === 400) {\n uploadError = error.json.file[0];\n } else {\n uploadError = 'Server failure';\n }\n console.error(uploadError);\n this.addFailedAttachment(file, uploadError);\n })\n .finally(() => {\n this.uploading = false;\n });\n }\n\n private addCurrentAttachment(attachmentToAdd: any) {\n this.currentAttachments.push(attachmentToAdd);\n this.requestUpdate('currentAttachments');\n }\n private removeCurrentAttachment(attachmentToRemove: any) {\n this.currentAttachments = this.currentAttachments.filter(\n currentAttachment => currentAttachment !== attachmentToRemove\n );\n this.requestUpdate('currentAttachments');\n }\n\n private addFailedAttachment(file: File, error: string) {\n const failedAttachment = {\n uuid: Math.random().toString(36).slice(2, 6),\n content_type: file.type,\n filename: file.name,\n url: file.name,\n size: file.size,\n error: error,\n } as Attachment;\n this.failedAttachments.push(failedAttachment);\n this.requestUpdate('failedAttachments');\n }\n private removeFailedAttachment(attachmentToRemove: any) {\n this.failedAttachments = this.failedAttachments.filter(\n (failedAttachment: any) => failedAttachment !== attachmentToRemove\n );\n this.requestUpdate('failedAttachments');\n }\n\n private handleRemoveFileClicked(evt: Event): void {\n const target = evt.target as HTMLDivElement;\n\n const currentAttachmentToRemove = this.currentAttachments.find(\n ({ uuid }) => uuid === target.id\n );\n if (currentAttachmentToRemove) {\n this.removeCurrentAttachment(currentAttachmentToRemove);\n }\n\n const failedAttachmentToRemove = this.failedAttachments.find(\n ({ uuid }) => uuid === target.id\n );\n if (failedAttachmentToRemove) {\n this.removeFailedAttachment(failedAttachmentToRemove);\n }\n }\n\n public toggleButton() {\n if (this.button) {\n this.buttonError = '';\n const chatboxEmpty = this.currentText.trim().length === 0;\n const attachmentsEmpty = this.currentAttachments.length === 0;\n if (this.chatbox && this.attachments) {\n this.buttonDisabled = chatboxEmpty && attachmentsEmpty;\n } else if (this.chatbox) {\n this.buttonDisabled = chatboxEmpty;\n } else if (this.attachments) {\n this.buttonDisabled = attachmentsEmpty;\n } else {\n this.buttonDisabled = true;\n }\n }\n }\n\n private handleSendClick(evt: Event) {\n evt.stopPropagation();\n this.handleSend();\n }\n\n private handleSendEnter(evt: KeyboardEvent) {\n if (this.button) {\n if (evt.key === 'Enter' && !evt.shiftKey) {\n if (this.completion) {\n const chat = evt.target as Completion;\n if (!chat.hasVisibleOptions()) {\n this.handleSend();\n this.preventDefaults(evt);\n }\n } else {\n this.handleSend();\n this.preventDefaults(evt);\n }\n }\n }\n }\n\n private handleSend() {\n if (!this.buttonDisabled) {\n this.buttonDisabled = true;\n const name = this.buttonName;\n this.fireCustomEvent(CustomEventType.ButtonClicked, { name });\n }\n }\n\n public render(): TemplateResult {\n return html`\n <temba-field\n name=${this.name}\n .errors=${this.errors}\n .widgetOnly=${this.widgetOnly}\n value=${this.value}\n >\n <div\n class=${getClasses({ container: true, highlight: this.pendingDrop })}\n @click=\"${this.handleContainerClick}\"\n @dragenter=\"${this.handleDragEnter}\"\n @dragover=\"${this.handleDragOver}\"\n @dragleave=\"${this.handleDragLeave}\"\n @drop=\"${this.handleDrop}\"\n >\n <div class=\"drop-mask\"><div>Upload Attachment</div></div>\n\n ${this.chatbox ? html`${this.getChatbox()}` : null}\n ${this.attachments\n ? html`<div class=\"items attachments\">\n ${this.getAttachments()}\n </div>`\n : null}\n <div class=\"items actions\">${this.getActions()}</div>\n </div>\n </temba-field>\n `;\n }\n\n private getChatbox(): TemplateResult {\n if (this.completion) {\n return html` <temba-completion\n class=\"chatbox\"\n value=${this.initialText}\n gsm\n textarea\n autogrow\n @change=${this.handleChatboxChange}\n @keydown=${this.handleSendEnter}\n placeholder=\"Write something here\"\n >\n </temba-completion>`;\n } else {\n return html` <temba-textinput\n class=\"chatbox\"\n gsm\n textarea\n autogrow\n value=${this.initialText}\n @change=${this.handleChatboxChange}\n @keydown=${this.handleSendEnter}\n placeholder=\"Write something here\"\n >\n </temba-textinput>`;\n }\n }\n\n private getAttachments(): TemplateResult {\n return html`\n ${(this.currentAttachments && this.currentAttachments.length > 0) ||\n (this.failedAttachments && this.failedAttachments.length > 0)\n ? html` <div class=\"attachments-list\">\n ${this.currentAttachments.map(validAttachment => {\n return html` <div class=\"attachment-item\">\n <div\n class=\"remove-item\"\n @click=\"${this.handleRemoveFileClicked}\"\n >\n <temba-icon\n id=\"${validAttachment.uuid}\"\n name=\"${Icon.delete_small}\"\n ></temba-icon>\n </div>\n <div class=\"attachment-name\">\n <span\n title=\"${validAttachment.filename} (${formatFileSize(\n validAttachment.size,\n 2\n )}) ${validAttachment.content_type}\"\n >${truncate(validAttachment.filename, 25)}\n (${formatFileSize(validAttachment.size, 0)})\n ${formatFileType(validAttachment.content_type)}</span\n >\n </div>\n </div>`;\n })}\n ${this.failedAttachments.map(invalidAttachment => {\n return html` <div class=\"attachment-item error\">\n <div\n class=\"remove-item error\"\n @click=\"${this.handleRemoveFileClicked}\"\n >\n <temba-icon\n id=\"${invalidAttachment.uuid}\"\n name=\"${Icon.delete_small}\"\n ></temba-icon>\n </div>\n <div class=\"attachment-name\">\n <span\n title=\"${invalidAttachment.filename} (${formatFileSize(\n 0,\n 0\n )}) - Attachment failed - ${invalidAttachment.error}\"\n >${truncate(invalidAttachment.filename, 25)}\n (${formatFileSize(0, 0)}) - Attachment failed</span\n >\n </div>\n </div>`;\n })}\n </div>`\n : null}\n `;\n }\n\n private getActions(): TemplateResult {\n return html`\n <div class=\"actions-left\">\n ${this.attachments ? this.getUploader() : null}\n </div>\n <div class=\"actions-center\"></div>\n <div class=\"actions-right\">\n ${this.buttonError\n ? html`<div class=\"send-error\">${this.buttonError}</div>`\n : null}\n ${this.counter ? this.getCounter() : null}\n ${this.button ? this.getButton() : null}\n </div>\n `;\n }\n\n private getUploader(): TemplateResult {\n if (this.uploading) {\n return html`<temba-loading units=\"3\" size=\"12\"></temba-loading>`;\n } else {\n return html` <input\n type=\"file\"\n id=\"upload-input\"\n multiple\n accept=\"${this.accept}\"\n @change=\"${this.handleUploadFileInputChanged}\"\n />\n <label\n id=\"upload-label\"\n class=\"actions-left upload-label\"\n for=\"upload-input\"\n >\n <temba-icon\n id=\"upload-icon\"\n class=\"upload-icon\"\n name=\"${Icon.attachment}\"\n @click=\"${this.handleUploadFileIconClicked}\"\n clickable\n ></temba-icon>\n </label>`;\n }\n }\n\n private getCounter(): TemplateResult {\n return html`<temba-charcount\n .text=\"${this.currentText}\"\n ></temba-charcount>`;\n }\n\n private getButton(): TemplateResult {\n return html` <temba-button\n id=\"send-button\"\n name=${this.buttonName}\n @click=${this.handleSendClick}\n ?disabled=${this.buttonDisabled}\n ></temba-button>`;\n }\n}\n"]}
|
|
@@ -8,7 +8,7 @@ const getCompose = async (attrs = {}, width = 500, height = 500) => {
|
|
|
8
8
|
return compose;
|
|
9
9
|
};
|
|
10
10
|
export const updateComponent = async (compose, text, attachments, errorAttachments) => {
|
|
11
|
-
compose.
|
|
11
|
+
compose.initialText = text ? text : '';
|
|
12
12
|
compose.currentAttachments = attachments ? attachments : [];
|
|
13
13
|
compose.failedAttachments = errorAttachments ? errorAttachments : [];
|
|
14
14
|
await compose.updateComplete;
|
|
@@ -213,8 +213,8 @@ describe('temba-compose chatbox', () => {
|
|
|
213
213
|
button: true,
|
|
214
214
|
});
|
|
215
215
|
await updateComponent(compose, getValidText());
|
|
216
|
-
const
|
|
217
|
-
|
|
216
|
+
const chatbox = compose.shadowRoot.querySelector('.chatbox');
|
|
217
|
+
chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
218
218
|
await assertScreenshot('compose/chatbox-with-text-and-hit-enter', getClip(compose));
|
|
219
219
|
});
|
|
220
220
|
});
|
|
@@ -403,8 +403,8 @@ describe('temba-compose chatbox with text and attachments no files', () => {
|
|
|
403
403
|
button: true,
|
|
404
404
|
});
|
|
405
405
|
await updateComponent(compose, getValidText());
|
|
406
|
-
const
|
|
407
|
-
|
|
406
|
+
const chatbox = compose.shadowRoot.querySelector('.chatbox');
|
|
407
|
+
chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
408
408
|
await assertScreenshot('compose/chatbox-with-text-attachments-no-files-and-hit-enter', getClip(compose));
|
|
409
409
|
});
|
|
410
410
|
});
|
|
@@ -546,8 +546,8 @@ describe('temba-compose chatbox with text and attachments with files', () => {
|
|
|
546
546
|
button: true,
|
|
547
547
|
});
|
|
548
548
|
await updateComponent(compose, getValidText(), getValidAttachments());
|
|
549
|
-
const
|
|
550
|
-
|
|
549
|
+
const chatbox = compose.shadowRoot.querySelector('.chatbox');
|
|
550
|
+
chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
551
551
|
await assertScreenshot('compose/chatbox-with-text-attachments-with-success-files-and-hit-enter', getClip(compose));
|
|
552
552
|
});
|
|
553
553
|
it('chatbox with text, attachments with success and failure uploaded files, and hit enter', async () => {
|
|
@@ -557,8 +557,8 @@ describe('temba-compose chatbox with text and attachments with files', () => {
|
|
|
557
557
|
button: true,
|
|
558
558
|
});
|
|
559
559
|
await updateComponent(compose, getValidText(), getValidAttachments(), getInvalidAttachments());
|
|
560
|
-
const
|
|
561
|
-
|
|
560
|
+
const chatbox = compose.shadowRoot.querySelector('.chatbox');
|
|
561
|
+
chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
562
562
|
const newClip = getClip(compose);
|
|
563
563
|
await assertScreenshot('compose/chatbox-with-text-attachments-with-all-files-and-hit-enter', newClip);
|
|
564
564
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temba-compose.test.js","sourceRoot":"","sources":["../../test/temba-compose.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAc,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,GAAG,GAAG,eAAe,CAAC;AAC5B,MAAM,UAAU,GAAG,KAAK,EAAE,QAAa,EAAE,EAAE,KAAK,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,EAAE;IACtE,M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,EAAE,CAAC,uFAAuF,EAAE,KAAK,IAAI,EAAE;QACrG,MAAM,OAAO,GAAY,MAAM,UAAU,CAAC;YACxC,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QACH,MAAM,eAAe,CACnB,OAAO,EACP,YAAY,EAAE,EACd,mBAAmB,EAAE,EACrB,qBAAqB,EAAE,CACxB,CAAC;QACF,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CACjD,kBAAkB,CACL,CAAC;QAChB,UAAU,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QACzE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,gBAAgB,CACpB,oEAAoE,EACpE,OAAO,CACR,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { assert, expect } from '@open-wc/testing';\nimport { Attachment, Compose } from '../src/compose/Compose';\nimport { assertScreenshot, getClip, getComponent } from './utils.test';\nimport { Button } from '../src/button/Button';\nimport { Completion } from '../src/completion/Completion';\nimport { DEFAULT_MEDIA_ENDPOINT } from '../src/utils';\n\nconst TAG = 'temba-compose';\nconst getCompose = async (attrs: any = {}, width = 500, height = 500) => {\n const compose = (await getComponent(\n TAG,\n attrs,\n '',\n width,\n height,\n 'display:flex;flex-direction:column;flex-grow:1;'\n )) as Compose;\n return compose;\n};\n\nexport const updateComponent = async (\n compose: Compose,\n text?: string,\n attachments?: Attachment[],\n errorAttachments?: Attachment[]\n): Promise<void> => {\n compose.currentText = text ? text : '';\n compose.currentAttachments = attachments ? attachments : [];\n compose.failedAttachments = errorAttachments ? errorAttachments : [];\n await compose.updateComplete;\n};\n\nconst getInitialValue = (text?: string, attachments?: Attachment[]): any => {\n const composeValue = {\n text: text ? text : '',\n attachments: attachments ? attachments : [],\n };\n return composeValue;\n};\nconst getComposeValue = (value: any): string => {\n return JSON.stringify(value);\n};\nconst getComposeValues = (value: any): any[] => {\n return [value];\n};\n\nexport const getValidText = () => {\n return 'sà-wàd-dee!';\n};\n// for a server limit of 640 chars, return a string that is 640+ chars\nexport const getInvalidText = () => {\n return \"p}h<r0P<?SCIbV1+pwW1Hj8g^J&=Sm2f)K=5LjFFUZ№5@ybpoLZ7DJ(27qdWxQMaO)I1nB4(D%d3c(H)QXOF6F?4>&d{lhd5?0`Lio!yAGMO№*AxN5{z5s.IO*dy?tm}vXJ#Lf-HlD;xmNp}0<P42=w#ll9)B-e9>Q#'{~Vp<dl:xC9`T^lhh@TosCZ^:(H<Ji<E(~PojvYk^rPB+poYy^Ne~Su1:9?IgH'4S5Q9v0g№FEIUc~!{S7;746j'Sd@Nfu3=x?CsuR;YLP4j+AOzDARZG?0(Ji(NMg=r%n0Fq?R1?E%Yf`bcoVZAJ^bl0J'^@;lH>T.HmxYxwS;1?(bfrh?pRdd73:iMxrfx5luQ(}<dCD1b3g'G0CtkB№;8KkbL=>krG{RO%Va4wwr%P>jE*+n(E11}Ju9#<.f^)<MTH09^b{RQv7~H`#@Hda6{MV&H@xdyEKq#M@nZng8WTU66!F@*!)w*EpQ+65XKuQCaESgq=PHmtqi@l;F?PHvl^g@Z:+}}Xyr`IC2=3?20^I'qSU*tkyinM^JF.ZI>}~XzRQJn№v3o-w?Vy&gC:c.l(&9{`M#-'N}{T#7lw8(4:iY621'>C^.&hVZn:R!G}Ek){D#'KkiJWawq#7~GLBN*?V!ncw)d%&(tXj\";\n};\n\n// valid = attachments that are uploaded sent to the server when the user clicks send\nexport const getValidAttachments = (numFiles = 2): Attachment[] => {\n const attachments = [];\n let index = 1;\n while (index <= numFiles) {\n const s = 's' + index;\n const attachment = {\n uuid: s,\n content_type: 'image/png',\n type: 'image/png',\n filename: 'name_' + s,\n url: 'url_' + s,\n size: 1024,\n error: null,\n } as Attachment;\n attachments.push(attachment);\n index++;\n }\n return attachments;\n};\n// invalid = attachments that are not uploaded and are not sent to the server when the user clicks send\nexport const getInvalidAttachments = (): Attachment[] => {\n const f1 = 'f1';\n const fail1 = {\n uuid: f1,\n content_type: 'image/png',\n type: 'image/png',\n filename: 'name_' + f1,\n url: 'url_' + f1,\n size: 26624,\n error: 'Limit for file uploads is 25.0 MB',\n } as Attachment;\n const f2 = 'f2';\n const fail2 = {\n uuid: f2,\n content_type: 'application/octet-stream',\n type: 'application/octet-stream',\n filename: 'name_' + f2,\n url: 'url_' + f2,\n size: 1024,\n error: 'Unsupported file type',\n } as Attachment;\n\n return [fail1, fail2];\n};\n\n// for a test width of 500, return a string that is 60+ chars with spaces\n// to test that line breaks / word wrapping works as expected\nconst getValidText_Long_WithSpaces = () => {\n return 'bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb ';\n};\nconst getValidText_Long_WithNoSpaces = () => {\n return 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb';\n};\nconst getValidText_Long_WithUrl = () => {\n return 'http://www.yourmomyourmomyourmomyourmomyourmomyourmomyourmomyourmomyourmomyourmomyourmom.com';\n};\n\ndescribe('temba-compose chatbox', () => {\n it('can be created', async () => {\n const compose: Compose = await getCompose();\n assert.instanceOf(compose, Compose);\n expect(compose.endpoint).equals(DEFAULT_MEDIA_ENDPOINT);\n });\n\n it('cannot be created with a different endpoint', async () => {\n const compose: Compose = await getCompose({\n endpoint: '/schmsgmedia/schmupload/',\n });\n assert.instanceOf(compose, Compose);\n expect(compose.endpoint).equals(DEFAULT_MEDIA_ENDPOINT);\n });\n\n it('chatbox no counter no send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n });\n await assertScreenshot(\n 'compose/chatbox-no-counter-no-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox no counter and send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n button: true,\n });\n await assertScreenshot(\n 'compose/chatbox-no-counter-and-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox counter no send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n });\n await assertScreenshot(\n 'compose/chatbox-counter-no-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox counter and send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await assertScreenshot(\n 'compose/chatbox-counter-and-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox counter and send button deserialize and serialize', async () => {\n const initialValue = getInitialValue();\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal('');\n expect(compose.currentAttachments).to.deep.equal([]);\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('chatbox with text', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText());\n await assertScreenshot('compose/chatbox-with-text', getClip(compose));\n });\n\n it('chatbox with text deserialize and serialize', async () => {\n const initialValue = getInitialValue(getValidText());\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal(getValidText());\n expect(compose.currentAttachments).to.deep.equal([]);\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('chatbox with text and spaces', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText_Long_WithSpaces());\n await assertScreenshot(\n 'compose/chatbox-with-text-and-spaces',\n getClip(compose)\n );\n });\n\n it('chatbox with text and no spaces', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText_Long_WithNoSpaces());\n await assertScreenshot(\n 'compose/chatbox-with-text-no-spaces',\n getClip(compose)\n );\n });\n\n it('chatbox with text and url', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText_Long_WithUrl());\n await assertScreenshot(\n 'compose/chatbox-with-text-and-url',\n getClip(compose)\n );\n });\n\n it('chatbox with text and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText());\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-with-text-and-click-send',\n getClip(compose)\n );\n });\n\n it('chatbox with text and hit enter', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText());\n const completion = compose.shadowRoot.querySelector(\n 'temba-completion'\n ) as Completion;\n completion.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));\n await assertScreenshot(\n 'compose/chatbox-with-text-and-hit-enter',\n getClip(compose)\n );\n });\n});\n\ndescribe('temba-compose attachments', () => {\n it('attachments no send button', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n });\n await assertScreenshot(\n 'compose/attachments-no-send-button',\n getClip(compose)\n );\n });\n\n it('attachments and send button', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await assertScreenshot(\n 'compose/attachments-and-send-button',\n getClip(compose)\n );\n });\n\n it('attachments and send button deserialize and serialize', async () => {\n const initialValue = getInitialValue();\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal('');\n expect(compose.currentAttachments).to.deep.equal([]);\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('attachments with success uploaded files', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, getValidAttachments());\n await assertScreenshot(\n 'compose/attachments-with-success-files',\n getClip(compose)\n );\n });\n\n it('attachments with success uploaded files deserialize and serialize', async () => {\n const initialValue = getInitialValue(null, getValidAttachments());\n const composeValue = getComposeValue(initialValue);\n const composeValues = getComposeValues(initialValue);\n\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal('');\n expect(compose.currentAttachments).to.deep.equal(getValidAttachments());\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('attachments with failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, null, getInvalidAttachments());\n await assertScreenshot(\n 'compose/attachments-with-failure-files',\n getClip(compose)\n );\n });\n\n it('attachments with success and failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n null,\n getValidAttachments(),\n getInvalidAttachments()\n );\n await assertScreenshot(\n 'compose/attachments-with-all-files',\n getClip(compose)\n );\n });\n\n it('attachments with success uploaded files and click send', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, getValidAttachments());\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/attachments-with-success-files-and-click-send',\n getClip(compose)\n );\n });\n\n it('attachments with success and failure uploaded files and click send', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n null,\n getValidAttachments(),\n getInvalidAttachments()\n );\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/attachments-with-all-files-and-click-send',\n getClip(compose)\n );\n });\n});\n\ndescribe('temba-compose chatbox and attachments', () => {\n it('chatbox and attachments no counter no send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n });\n await assertScreenshot(\n 'compose/chatbox-attachments-no-counter-no-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox and attachments no counter and send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await assertScreenshot(\n 'compose/chatbox-attachments-no-counter-and-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox and attachments counter no send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n });\n await assertScreenshot(\n 'compose/chatbox-attachments-counter-no-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox and attachments counter and send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n });\n await assertScreenshot(\n 'compose/chatbox-attachments-counter-and-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox and attachments counter and send button deserialize and serialize', async () => {\n const initialValue = getInitialValue();\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal('');\n expect(compose.currentAttachments).to.deep.equal([]);\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n});\n\ndescribe('temba-compose chatbox with text and attachments no files', () => {\n it('chatbox with text, attachments no files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n });\n updateComponent(compose, getValidText());\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-no-files',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments no files deserialize and serialize', async () => {\n const initialValue = getInitialValue(getValidText());\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal(getValidText());\n expect(compose.currentAttachments).to.deep.equal([]);\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('chatbox with text, attachments no files, and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n });\n updateComponent(compose, getValidText());\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-no-files-and-click-send',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments no files, and hit enter', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText());\n const completion = compose.shadowRoot.querySelector(\n 'temba-completion'\n ) as Completion;\n completion.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-no-files-and-hit-enter',\n getClip(compose)\n );\n });\n});\n\ndescribe('temba-compose chatbox no text and attachments with files', () => {\n it('chatbox no text, attachments with success uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, getValidAttachments());\n await assertScreenshot(\n 'compose/chatbox-no-text-attachments-with-success-files',\n getClip(compose)\n );\n });\n\n it('chatbox no text, attachments with success uploaded files deserialize and serialize', async () => {\n const initialValue = getInitialValue(null, getValidAttachments());\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal('');\n expect(compose.currentAttachments).to.deep.equal(getValidAttachments());\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('chatbox no text, attachments with failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, null, getInvalidAttachments());\n await assertScreenshot(\n 'compose/chatbox-no-text-attachments-with-failure-files',\n getClip(compose)\n );\n });\n\n it('chatbox no text, attachments with success and failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n null,\n getValidAttachments(),\n getInvalidAttachments()\n );\n await assertScreenshot(\n 'compose/chatbox-no-text-attachments-with-all-files',\n getClip(compose)\n );\n });\n\n it('chatbox no text, attachments with success uploaded files, and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, getValidAttachments());\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-no-text-attachments-with-success-files-and-click-send',\n getClip(compose)\n );\n });\n\n it('chatbox no text, attachments with success and failure uploaded files, and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n null,\n getValidAttachments(),\n getInvalidAttachments()\n );\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-no-text-attachments-with-all-files-and-click-send',\n getClip(compose)\n );\n });\n});\n\ndescribe('temba-compose chatbox with text and attachments with files', () => {\n it('chatbox with text, attachments with success uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, getValidText(), getValidAttachments());\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-success-files',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success uploaded files deserialize and serialize', async () => {\n const initialValue = getInitialValue(getValidText(), getValidAttachments());\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal(getValidText());\n expect(compose.currentAttachments).to.deep.equal(getValidAttachments());\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('chatbox with text, attachments with failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n getValidText(),\n null,\n getInvalidAttachments()\n );\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-failure-files',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success and failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n getValidText(),\n getValidAttachments(),\n getInvalidAttachments()\n );\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-all-files',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success uploaded files, and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, getValidText(), getValidAttachments());\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-success-files-and-click-send',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success and failure uploaded files, and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n getValidText(),\n getValidAttachments(),\n getInvalidAttachments()\n );\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-all-files-and-click-send',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success uploaded files, and hit enter', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, getValidText(), getValidAttachments());\n const completion = compose.shadowRoot.querySelector(\n 'temba-completion'\n ) as Completion;\n completion.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-success-files-and-hit-enter',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success and failure uploaded files, and hit enter', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n getValidText(),\n getValidAttachments(),\n getInvalidAttachments()\n );\n const completion = compose.shadowRoot.querySelector(\n 'temba-completion'\n ) as Completion;\n completion.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));\n const newClip = getClip(compose);\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-all-files-and-hit-enter',\n newClip\n );\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"temba-compose.test.js","sourceRoot":"","sources":["../../test/temba-compose.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAc,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,GAAG,GAAG,eAAe,CAAC;AAC5B,MAAM,UAAU,GAAG,KAAK,EAAE,QAAa,EAAE,EAAE,KAAK,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,EAAE;IACtE,MAAM,OAAO,GAAG,CAAC,MAAM,YAAY,CACjC,GAAG,EACH,KAAK,EACL,EAAE,EACF,KAAK,EACL,MAAM,EACN,iDAAiD,CAClD,CAAY,CAAC;IACd,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,OAAgB,EAChB,IAAa,EACb,WAA0B,EAC1B,gBAA+B,EAChB,EAAE;IACjB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,OAAO,CAAC,kBAAkB,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,OAAO,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,MAAM,OAAO,CAAC,cAAc,CAAC;A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C,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { assert, expect } from '@open-wc/testing';\nimport { Attachment, Compose } from '../src/compose/Compose';\nimport { assertScreenshot, getClip, getComponent } from './utils.test';\nimport { Button } from '../src/button/Button';\nimport { Completion } from '../src/completion/Completion';\nimport { DEFAULT_MEDIA_ENDPOINT } from '../src/utils';\n\nconst TAG = 'temba-compose';\nconst getCompose = async (attrs: any = {}, width = 500, height = 500) => {\n const compose = (await getComponent(\n TAG,\n attrs,\n '',\n width,\n height,\n 'display:flex;flex-direction:column;flex-grow:1;'\n )) as Compose;\n return compose;\n};\n\nexport const updateComponent = async (\n compose: Compose,\n text?: string,\n attachments?: Attachment[],\n errorAttachments?: Attachment[]\n): Promise<void> => {\n compose.initialText = text ? text : '';\n compose.currentAttachments = attachments ? attachments : [];\n compose.failedAttachments = errorAttachments ? errorAttachments : [];\n await compose.updateComplete;\n};\n\nconst getInitialValue = (text?: string, attachments?: Attachment[]): any => {\n const composeValue = {\n text: text ? text : '',\n attachments: attachments ? attachments : [],\n };\n return composeValue;\n};\nconst getComposeValue = (value: any): string => {\n return JSON.stringify(value);\n};\nconst getComposeValues = (value: any): any[] => {\n return [value];\n};\n\nexport const getValidText = () => {\n return 'sà-wàd-dee!';\n};\n// for a server limit of 640 chars, return a string that is 640+ chars\nexport const getInvalidText = () => {\n return \"p}h<r0P<?SCIbV1+pwW1Hj8g^J&=Sm2f)K=5LjFFUZ№5@ybpoLZ7DJ(27qdWxQMaO)I1nB4(D%d3c(H)QXOF6F?4>&d{lhd5?0`Lio!yAGMO№*AxN5{z5s.IO*dy?tm}vXJ#Lf-HlD;xmNp}0<P42=w#ll9)B-e9>Q#'{~Vp<dl:xC9`T^lhh@TosCZ^:(H<Ji<E(~PojvYk^rPB+poYy^Ne~Su1:9?IgH'4S5Q9v0g№FEIUc~!{S7;746j'Sd@Nfu3=x?CsuR;YLP4j+AOzDARZG?0(Ji(NMg=r%n0Fq?R1?E%Yf`bcoVZAJ^bl0J'^@;lH>T.HmxYxwS;1?(bfrh?pRdd73:iMxrfx5luQ(}<dCD1b3g'G0CtkB№;8KkbL=>krG{RO%Va4wwr%P>jE*+n(E11}Ju9#<.f^)<MTH09^b{RQv7~H`#@Hda6{MV&H@xdyEKq#M@nZng8WTU66!F@*!)w*EpQ+65XKuQCaESgq=PHmtqi@l;F?PHvl^g@Z:+}}Xyr`IC2=3?20^I'qSU*tkyinM^JF.ZI>}~XzRQJn№v3o-w?Vy&gC:c.l(&9{`M#-'N}{T#7lw8(4:iY621'>C^.&hVZn:R!G}Ek){D#'KkiJWawq#7~GLBN*?V!ncw)d%&(tXj\";\n};\n\n// valid = attachments that are uploaded sent to the server when the user clicks send\nexport const getValidAttachments = (numFiles = 2): Attachment[] => {\n const attachments = [];\n let index = 1;\n while (index <= numFiles) {\n const s = 's' + index;\n const attachment = {\n uuid: s,\n content_type: 'image/png',\n type: 'image/png',\n filename: 'name_' + s,\n url: 'url_' + s,\n size: 1024,\n error: null,\n } as Attachment;\n attachments.push(attachment);\n index++;\n }\n return attachments;\n};\n// invalid = attachments that are not uploaded and are not sent to the server when the user clicks send\nexport const getInvalidAttachments = (): Attachment[] => {\n const f1 = 'f1';\n const fail1 = {\n uuid: f1,\n content_type: 'image/png',\n type: 'image/png',\n filename: 'name_' + f1,\n url: 'url_' + f1,\n size: 26624,\n error: 'Limit for file uploads is 25.0 MB',\n } as Attachment;\n const f2 = 'f2';\n const fail2 = {\n uuid: f2,\n content_type: 'application/octet-stream',\n type: 'application/octet-stream',\n filename: 'name_' + f2,\n url: 'url_' + f2,\n size: 1024,\n error: 'Unsupported file type',\n } as Attachment;\n\n return [fail1, fail2];\n};\n\n// for a test width of 500, return a string that is 60+ chars with spaces\n// to test that line breaks / word wrapping works as expected\nconst getValidText_Long_WithSpaces = () => {\n return 'bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb ';\n};\nconst getValidText_Long_WithNoSpaces = () => {\n return 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb';\n};\nconst getValidText_Long_WithUrl = () => {\n return 'http://www.yourmomyourmomyourmomyourmomyourmomyourmomyourmomyourmomyourmomyourmomyourmom.com';\n};\n\ndescribe('temba-compose chatbox', () => {\n it('can be created', async () => {\n const compose: Compose = await getCompose();\n assert.instanceOf(compose, Compose);\n expect(compose.endpoint).equals(DEFAULT_MEDIA_ENDPOINT);\n });\n\n it('cannot be created with a different endpoint', async () => {\n const compose: Compose = await getCompose({\n endpoint: '/schmsgmedia/schmupload/',\n });\n assert.instanceOf(compose, Compose);\n expect(compose.endpoint).equals(DEFAULT_MEDIA_ENDPOINT);\n });\n\n it('chatbox no counter no send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n });\n await assertScreenshot(\n 'compose/chatbox-no-counter-no-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox no counter and send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n button: true,\n });\n await assertScreenshot(\n 'compose/chatbox-no-counter-and-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox counter no send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n });\n await assertScreenshot(\n 'compose/chatbox-counter-no-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox counter and send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await assertScreenshot(\n 'compose/chatbox-counter-and-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox counter and send button deserialize and serialize', async () => {\n const initialValue = getInitialValue();\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal('');\n expect(compose.currentAttachments).to.deep.equal([]);\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('chatbox with text', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText());\n await assertScreenshot('compose/chatbox-with-text', getClip(compose));\n });\n\n it('chatbox with text deserialize and serialize', async () => {\n const initialValue = getInitialValue(getValidText());\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal(getValidText());\n expect(compose.currentAttachments).to.deep.equal([]);\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('chatbox with text and spaces', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText_Long_WithSpaces());\n await assertScreenshot(\n 'compose/chatbox-with-text-and-spaces',\n getClip(compose)\n );\n });\n\n it('chatbox with text and no spaces', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText_Long_WithNoSpaces());\n await assertScreenshot(\n 'compose/chatbox-with-text-no-spaces',\n getClip(compose)\n );\n });\n\n it('chatbox with text and url', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText_Long_WithUrl());\n await assertScreenshot(\n 'compose/chatbox-with-text-and-url',\n getClip(compose)\n );\n });\n\n it('chatbox with text and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText());\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-with-text-and-click-send',\n getClip(compose)\n );\n });\n\n it('chatbox with text and hit enter', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText());\n const chatbox = compose.shadowRoot.querySelector('.chatbox') as Completion;\n chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));\n await assertScreenshot(\n 'compose/chatbox-with-text-and-hit-enter',\n getClip(compose)\n );\n });\n});\n\ndescribe('temba-compose attachments', () => {\n it('attachments no send button', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n });\n await assertScreenshot(\n 'compose/attachments-no-send-button',\n getClip(compose)\n );\n });\n\n it('attachments and send button', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await assertScreenshot(\n 'compose/attachments-and-send-button',\n getClip(compose)\n );\n });\n\n it('attachments and send button deserialize and serialize', async () => {\n const initialValue = getInitialValue();\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal('');\n expect(compose.currentAttachments).to.deep.equal([]);\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('attachments with success uploaded files', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, getValidAttachments());\n await assertScreenshot(\n 'compose/attachments-with-success-files',\n getClip(compose)\n );\n });\n\n it('attachments with success uploaded files deserialize and serialize', async () => {\n const initialValue = getInitialValue(null, getValidAttachments());\n const composeValue = getComposeValue(initialValue);\n const composeValues = getComposeValues(initialValue);\n\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal('');\n expect(compose.currentAttachments).to.deep.equal(getValidAttachments());\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('attachments with failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, null, getInvalidAttachments());\n await assertScreenshot(\n 'compose/attachments-with-failure-files',\n getClip(compose)\n );\n });\n\n it('attachments with success and failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n null,\n getValidAttachments(),\n getInvalidAttachments()\n );\n await assertScreenshot(\n 'compose/attachments-with-all-files',\n getClip(compose)\n );\n });\n\n it('attachments with success uploaded files and click send', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, getValidAttachments());\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/attachments-with-success-files-and-click-send',\n getClip(compose)\n );\n });\n\n it('attachments with success and failure uploaded files and click send', async () => {\n const compose: Compose = await getCompose({\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n null,\n getValidAttachments(),\n getInvalidAttachments()\n );\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/attachments-with-all-files-and-click-send',\n getClip(compose)\n );\n });\n});\n\ndescribe('temba-compose chatbox and attachments', () => {\n it('chatbox and attachments no counter no send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n });\n await assertScreenshot(\n 'compose/chatbox-attachments-no-counter-no-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox and attachments no counter and send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await assertScreenshot(\n 'compose/chatbox-attachments-no-counter-and-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox and attachments counter no send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n });\n await assertScreenshot(\n 'compose/chatbox-attachments-counter-no-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox and attachments counter and send button', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n });\n await assertScreenshot(\n 'compose/chatbox-attachments-counter-and-send-button',\n getClip(compose)\n );\n });\n\n it('chatbox and attachments counter and send button deserialize and serialize', async () => {\n const initialValue = getInitialValue();\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal('');\n expect(compose.currentAttachments).to.deep.equal([]);\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n});\n\ndescribe('temba-compose chatbox with text and attachments no files', () => {\n it('chatbox with text, attachments no files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n });\n updateComponent(compose, getValidText());\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-no-files',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments no files deserialize and serialize', async () => {\n const initialValue = getInitialValue(getValidText());\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal(getValidText());\n expect(compose.currentAttachments).to.deep.equal([]);\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('chatbox with text, attachments no files, and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n });\n updateComponent(compose, getValidText());\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-no-files-and-click-send',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments no files, and hit enter', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n counter: true,\n button: true,\n });\n await updateComponent(compose, getValidText());\n const chatbox = compose.shadowRoot.querySelector('.chatbox') as HTMLElement;\n chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-no-files-and-hit-enter',\n getClip(compose)\n );\n });\n});\n\ndescribe('temba-compose chatbox no text and attachments with files', () => {\n it('chatbox no text, attachments with success uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, getValidAttachments());\n await assertScreenshot(\n 'compose/chatbox-no-text-attachments-with-success-files',\n getClip(compose)\n );\n });\n\n it('chatbox no text, attachments with success uploaded files deserialize and serialize', async () => {\n const initialValue = getInitialValue(null, getValidAttachments());\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal('');\n expect(compose.currentAttachments).to.deep.equal(getValidAttachments());\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('chatbox no text, attachments with failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, null, getInvalidAttachments());\n await assertScreenshot(\n 'compose/chatbox-no-text-attachments-with-failure-files',\n getClip(compose)\n );\n });\n\n it('chatbox no text, attachments with success and failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n null,\n getValidAttachments(),\n getInvalidAttachments()\n );\n await assertScreenshot(\n 'compose/chatbox-no-text-attachments-with-all-files',\n getClip(compose)\n );\n });\n\n it('chatbox no text, attachments with success uploaded files, and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, null, getValidAttachments());\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-no-text-attachments-with-success-files-and-click-send',\n getClip(compose)\n );\n });\n\n it('chatbox no text, attachments with success and failure uploaded files, and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n null,\n getValidAttachments(),\n getInvalidAttachments()\n );\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-no-text-attachments-with-all-files-and-click-send',\n getClip(compose)\n );\n });\n});\n\ndescribe('temba-compose chatbox with text and attachments with files', () => {\n it('chatbox with text, attachments with success uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, getValidText(), getValidAttachments());\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-success-files',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success uploaded files deserialize and serialize', async () => {\n const initialValue = getInitialValue(getValidText(), getValidAttachments());\n const composeValue = getComposeValue(initialValue);\n\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n value: composeValue,\n });\n // deserialize\n expect(compose.currentText).to.equal(getValidText());\n expect(compose.currentAttachments).to.deep.equal(getValidAttachments());\n // serialize\n expect(compose.value).to.equal(composeValue);\n });\n\n it('chatbox with text, attachments with failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n getValidText(),\n null,\n getInvalidAttachments()\n );\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-failure-files',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success and failure uploaded files', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n getValidText(),\n getValidAttachments(),\n getInvalidAttachments()\n );\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-all-files',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success uploaded files, and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, getValidText(), getValidAttachments());\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-success-files-and-click-send',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success and failure uploaded files, and click send', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n getValidText(),\n getValidAttachments(),\n getInvalidAttachments()\n );\n const send = compose.shadowRoot.querySelector(\n 'temba-button#send-button'\n ) as Button;\n send.click();\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-all-files-and-click-send',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success uploaded files, and hit enter', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(compose, getValidText(), getValidAttachments());\n const chatbox = compose.shadowRoot.querySelector('.chatbox') as HTMLElement;\n chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-success-files-and-hit-enter',\n getClip(compose)\n );\n });\n\n it('chatbox with text, attachments with success and failure uploaded files, and hit enter', async () => {\n const compose: Compose = await getCompose({\n chatbox: true,\n attachments: true,\n button: true,\n });\n await updateComponent(\n compose,\n getValidText(),\n getValidAttachments(),\n getInvalidAttachments()\n );\n const chatbox = compose.shadowRoot.querySelector(\n '.chatbox'\n ) as HTMLInputElement;\n chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));\n const newClip = getClip(compose);\n await assertScreenshot(\n 'compose/chatbox-with-text-attachments-with-all-files-and-hit-enter',\n newClip\n );\n });\n});\n"]}
|
package/package.json
CHANGED
package/src/compose/Compose.ts
CHANGED
|
@@ -79,7 +79,7 @@ export class Compose extends FormElement {
|
|
|
79
79
|
.items {
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
.chatbox {
|
|
83
83
|
margin-left: 0.3em;
|
|
84
84
|
margin-top: 0.3em;
|
|
85
85
|
--color-widget-border: none;
|
|
@@ -177,6 +177,9 @@ export class Compose extends FormElement {
|
|
|
177
177
|
`;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
@property({ type: Boolean })
|
|
181
|
+
completion: boolean;
|
|
182
|
+
|
|
180
183
|
@property({ type: Boolean })
|
|
181
184
|
chatbox: boolean;
|
|
182
185
|
|
|
@@ -195,6 +198,9 @@ export class Compose extends FormElement {
|
|
|
195
198
|
@property({ type: String })
|
|
196
199
|
currentText = '';
|
|
197
200
|
|
|
201
|
+
@property({ type: String })
|
|
202
|
+
initialText = '';
|
|
203
|
+
|
|
198
204
|
@property({ type: String })
|
|
199
205
|
accept = ''; //e.g. ".xls,.xlsx"
|
|
200
206
|
|
|
@@ -236,7 +242,7 @@ export class Compose extends FormElement {
|
|
|
236
242
|
if (this.value) {
|
|
237
243
|
const parsed_value = JSON.parse(this.value);
|
|
238
244
|
if (this.chatbox) {
|
|
239
|
-
this.
|
|
245
|
+
this.initialText = parsed_value.text;
|
|
240
246
|
}
|
|
241
247
|
if (this.attachments) {
|
|
242
248
|
this.currentAttachments = parsed_value.attachments;
|
|
@@ -275,7 +281,7 @@ export class Compose extends FormElement {
|
|
|
275
281
|
private setFocusOnChatbox(): void {
|
|
276
282
|
if (this.chatbox) {
|
|
277
283
|
const completion = this.shadowRoot.querySelector(
|
|
278
|
-
'
|
|
284
|
+
'.chatbox'
|
|
279
285
|
) as Completion;
|
|
280
286
|
if (completion) {
|
|
281
287
|
window.setTimeout(() => {
|
|
@@ -286,6 +292,8 @@ export class Compose extends FormElement {
|
|
|
286
292
|
}
|
|
287
293
|
|
|
288
294
|
public reset(): void {
|
|
295
|
+
(this.shadowRoot.querySelector('.chatbox') as HTMLInputElement).value = '';
|
|
296
|
+
this.initialText = '';
|
|
289
297
|
this.currentText = '';
|
|
290
298
|
this.currentAttachments = [];
|
|
291
299
|
this.failedAttachments = [];
|
|
@@ -297,8 +305,11 @@ export class Compose extends FormElement {
|
|
|
297
305
|
}
|
|
298
306
|
|
|
299
307
|
private handleChatboxChange(evt: Event) {
|
|
300
|
-
const
|
|
301
|
-
this.currentText =
|
|
308
|
+
const chatbox = evt.target as HTMLInputElement;
|
|
309
|
+
this.currentText = chatbox.value;
|
|
310
|
+
this.toggleButton();
|
|
311
|
+
this.serializeComposeValue();
|
|
312
|
+
this.fireCustomEvent(CustomEventType.ContentChanged, this.value);
|
|
302
313
|
}
|
|
303
314
|
|
|
304
315
|
private handleDragEnter(evt: DragEvent): void {
|
|
@@ -467,12 +478,19 @@ export class Compose extends FormElement {
|
|
|
467
478
|
}
|
|
468
479
|
|
|
469
480
|
private handleSendEnter(evt: KeyboardEvent) {
|
|
470
|
-
if (
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
481
|
+
if (this.button) {
|
|
482
|
+
if (evt.key === 'Enter' && !evt.shiftKey) {
|
|
483
|
+
if (this.completion) {
|
|
484
|
+
const chat = evt.target as Completion;
|
|
485
|
+
if (!chat.hasVisibleOptions()) {
|
|
486
|
+
this.handleSend();
|
|
487
|
+
this.preventDefaults(evt);
|
|
488
|
+
}
|
|
489
|
+
} else {
|
|
490
|
+
this.handleSend();
|
|
491
|
+
this.preventDefaults(evt);
|
|
492
|
+
}
|
|
474
493
|
}
|
|
475
|
-
this.preventDefaults(evt);
|
|
476
494
|
}
|
|
477
495
|
}
|
|
478
496
|
|
|
@@ -502,9 +520,7 @@ export class Compose extends FormElement {
|
|
|
502
520
|
>
|
|
503
521
|
<div class="drop-mask"><div>Upload Attachment</div></div>
|
|
504
522
|
|
|
505
|
-
${this.chatbox
|
|
506
|
-
? html`<div class="items chatbox">${this.getChatbox()}</div>`
|
|
507
|
-
: null}
|
|
523
|
+
${this.chatbox ? html`${this.getChatbox()}` : null}
|
|
508
524
|
${this.attachments
|
|
509
525
|
? html`<div class="items attachments">
|
|
510
526
|
${this.getAttachments()}
|
|
@@ -517,16 +533,31 @@ export class Compose extends FormElement {
|
|
|
517
533
|
}
|
|
518
534
|
|
|
519
535
|
private getChatbox(): TemplateResult {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
536
|
+
if (this.completion) {
|
|
537
|
+
return html` <temba-completion
|
|
538
|
+
class="chatbox"
|
|
539
|
+
value=${this.initialText}
|
|
540
|
+
gsm
|
|
541
|
+
textarea
|
|
542
|
+
autogrow
|
|
543
|
+
@change=${this.handleChatboxChange}
|
|
544
|
+
@keydown=${this.handleSendEnter}
|
|
545
|
+
placeholder="Write something here"
|
|
546
|
+
>
|
|
547
|
+
</temba-completion>`;
|
|
548
|
+
} else {
|
|
549
|
+
return html` <temba-textinput
|
|
550
|
+
class="chatbox"
|
|
551
|
+
gsm
|
|
552
|
+
textarea
|
|
553
|
+
autogrow
|
|
554
|
+
value=${this.initialText}
|
|
555
|
+
@change=${this.handleChatboxChange}
|
|
556
|
+
@keydown=${this.handleSendEnter}
|
|
557
|
+
placeholder="Write something here"
|
|
558
|
+
>
|
|
559
|
+
</temba-textinput>`;
|
|
560
|
+
}
|
|
530
561
|
}
|
|
531
562
|
|
|
532
563
|
private getAttachments(): TemplateResult {
|
|
@@ -630,7 +661,9 @@ export class Compose extends FormElement {
|
|
|
630
661
|
}
|
|
631
662
|
|
|
632
663
|
private getCounter(): TemplateResult {
|
|
633
|
-
return html`<temba-charcount
|
|
664
|
+
return html`<temba-charcount
|
|
665
|
+
.text="${this.currentText}"
|
|
666
|
+
></temba-charcount>`;
|
|
634
667
|
}
|
|
635
668
|
|
|
636
669
|
private getButton(): TemplateResult {
|
|
@@ -24,7 +24,7 @@ export const updateComponent = async (
|
|
|
24
24
|
attachments?: Attachment[],
|
|
25
25
|
errorAttachments?: Attachment[]
|
|
26
26
|
): Promise<void> => {
|
|
27
|
-
compose.
|
|
27
|
+
compose.initialText = text ? text : '';
|
|
28
28
|
compose.currentAttachments = attachments ? attachments : [];
|
|
29
29
|
compose.failedAttachments = errorAttachments ? errorAttachments : [];
|
|
30
30
|
await compose.updateComplete;
|
|
@@ -276,10 +276,8 @@ describe('temba-compose chatbox', () => {
|
|
|
276
276
|
button: true,
|
|
277
277
|
});
|
|
278
278
|
await updateComponent(compose, getValidText());
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
) as Completion;
|
|
282
|
-
completion.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
279
|
+
const chatbox = compose.shadowRoot.querySelector('.chatbox') as Completion;
|
|
280
|
+
chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
283
281
|
await assertScreenshot(
|
|
284
282
|
'compose/chatbox-with-text-and-hit-enter',
|
|
285
283
|
getClip(compose)
|
|
@@ -548,10 +546,8 @@ describe('temba-compose chatbox with text and attachments no files', () => {
|
|
|
548
546
|
button: true,
|
|
549
547
|
});
|
|
550
548
|
await updateComponent(compose, getValidText());
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
) as Completion;
|
|
554
|
-
completion.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
549
|
+
const chatbox = compose.shadowRoot.querySelector('.chatbox') as HTMLElement;
|
|
550
|
+
chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
555
551
|
await assertScreenshot(
|
|
556
552
|
'compose/chatbox-with-text-attachments-no-files-and-hit-enter',
|
|
557
553
|
getClip(compose)
|
|
@@ -774,10 +770,8 @@ describe('temba-compose chatbox with text and attachments with files', () => {
|
|
|
774
770
|
button: true,
|
|
775
771
|
});
|
|
776
772
|
await updateComponent(compose, getValidText(), getValidAttachments());
|
|
777
|
-
const
|
|
778
|
-
|
|
779
|
-
) as Completion;
|
|
780
|
-
completion.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
773
|
+
const chatbox = compose.shadowRoot.querySelector('.chatbox') as HTMLElement;
|
|
774
|
+
chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
781
775
|
await assertScreenshot(
|
|
782
776
|
'compose/chatbox-with-text-attachments-with-success-files-and-hit-enter',
|
|
783
777
|
getClip(compose)
|
|
@@ -796,10 +790,10 @@ describe('temba-compose chatbox with text and attachments with files', () => {
|
|
|
796
790
|
getValidAttachments(),
|
|
797
791
|
getInvalidAttachments()
|
|
798
792
|
);
|
|
799
|
-
const
|
|
800
|
-
'
|
|
801
|
-
) as
|
|
802
|
-
|
|
793
|
+
const chatbox = compose.shadowRoot.querySelector(
|
|
794
|
+
'.chatbox'
|
|
795
|
+
) as HTMLInputElement;
|
|
796
|
+
chatbox.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
803
797
|
const newClip = getClip(compose);
|
|
804
798
|
await assertScreenshot(
|
|
805
799
|
'compose/chatbox-with-text-attachments-with-all-files-and-hit-enter',
|