@nyaruka/temba-components 0.80.1 → 0.81.0
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/CHANGELOG.md +6 -0
- package/dist/temba-components.js +61 -27
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/button/Button.js +0 -1
- package/out-tsc/src/button/Button.js.map +1 -1
- package/out-tsc/src/checkbox/Checkbox.js +0 -1
- package/out-tsc/src/checkbox/Checkbox.js.map +1 -1
- package/out-tsc/src/contacts/ContactName.js +1 -3
- package/out-tsc/src/contacts/ContactName.js.map +1 -1
- package/out-tsc/src/datepicker/DatePicker.js +0 -1
- package/out-tsc/src/datepicker/DatePicker.js.map +1 -1
- package/out-tsc/src/dialog/Dialog.js +0 -1
- package/out-tsc/src/dialog/Dialog.js.map +1 -1
- package/out-tsc/src/dialog/Modax.js +0 -1
- package/out-tsc/src/dialog/Modax.js.map +1 -1
- package/out-tsc/src/list/NotificationList.js +2 -2
- package/out-tsc/src/list/NotificationList.js.map +1 -1
- package/out-tsc/src/list/RunList.js +2 -1
- package/out-tsc/src/list/RunList.js.map +1 -1
- package/out-tsc/src/select/Select.js +0 -3
- package/out-tsc/src/select/Select.js.map +1 -1
- package/out-tsc/src/textinput/TextInput.js +1 -3
- package/out-tsc/src/textinput/TextInput.js.map +1 -1
- package/out-tsc/src/webchat/WebChat.js +64 -15
- package/out-tsc/src/webchat/WebChat.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/checkbox/checkbox-label-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checked.png +0 -0
- package/screenshots/truth/checkbox/default.png +0 -0
- package/screenshots/truth/colorpicker/default.png +0 -0
- package/screenshots/truth/colorpicker/focused.png +0 -0
- package/screenshots/truth/colorpicker/initialized.png +0 -0
- package/screenshots/truth/colorpicker/selected.png +0 -0
- package/screenshots/truth/compose/chatbox-attachments-counter-and-send-button.png +0 -0
- package/screenshots/truth/compose/chatbox-attachments-counter-no-send-button.png +0 -0
- package/screenshots/truth/compose/chatbox-attachments-no-counter-and-send-button.png +0 -0
- package/screenshots/truth/compose/chatbox-attachments-no-counter-no-send-button.png +0 -0
- package/screenshots/truth/compose/chatbox-counter-and-send-button.png +0 -0
- package/screenshots/truth/compose/chatbox-counter-no-send-button.png +0 -0
- package/screenshots/truth/compose/chatbox-no-counter-and-send-button.png +0 -0
- package/screenshots/truth/compose/chatbox-no-counter-no-send-button.png +0 -0
- package/screenshots/truth/compose/chatbox-no-text-attachments-with-all-files-and-click-send.png +0 -0
- package/screenshots/truth/compose/chatbox-no-text-attachments-with-all-files.png +0 -0
- package/screenshots/truth/compose/chatbox-no-text-attachments-with-failure-files.png +0 -0
- package/screenshots/truth/compose/chatbox-no-text-attachments-with-success-files-and-click-send.png +0 -0
- package/screenshots/truth/compose/chatbox-no-text-attachments-with-success-files.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-and-click-send.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-and-hit-enter.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-and-spaces.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-and-url.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-attachments-no-files-and-click-send.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-attachments-no-files-and-hit-enter.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-attachments-no-files.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-attachments-with-all-files-and-click-send.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-attachments-with-all-files-and-hit-enter.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-attachments-with-all-files.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-attachments-with-failure-files.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-attachments-with-success-files-and-click-send.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-attachments-with-success-files-and-hit-enter.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-attachments-with-success-files.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text-no-spaces.png +0 -0
- package/screenshots/truth/compose/chatbox-with-text.png +0 -0
- package/screenshots/truth/contacts/compose-attachments-no-text-failure.png +0 -0
- package/screenshots/truth/contacts/compose-attachments-no-text-success.png +0 -0
- package/screenshots/truth/contacts/compose-text-and-attachments-failure-attachments.png +0 -0
- package/screenshots/truth/contacts/compose-text-and-attachments-failure-generic.png +0 -0
- package/screenshots/truth/contacts/compose-text-and-attachments-failure-text-and-attachments.png +0 -0
- package/screenshots/truth/contacts/compose-text-and-attachments-failure-text.png +0 -0
- package/screenshots/truth/contacts/compose-text-and-attachments-success.png +0 -0
- package/screenshots/truth/contacts/compose-text-no-attachments-failure.png +0 -0
- package/screenshots/truth/contacts/compose-text-no-attachments-success.png +0 -0
- package/screenshots/truth/contacts/contact-active-default.png +0 -0
- package/screenshots/truth/contacts/contact-active-show-chatbox.png +0 -0
- package/screenshots/truth/contacts/contact-archived-hide-chatbox.png +0 -0
- package/screenshots/truth/contacts/contact-blocked-hide-chatbox.png +0 -0
- package/screenshots/truth/contacts/contact-stopped-hide-chatbox.png +0 -0
- package/screenshots/truth/contacts/history.png +0 -0
- package/screenshots/truth/datepicker/date-truncated-time.png +0 -0
- package/screenshots/truth/datepicker/date.png +0 -0
- package/screenshots/truth/datepicker/initial-timezone.png +0 -0
- package/screenshots/truth/datepicker/updated-keyboard-date.png +0 -0
- package/screenshots/truth/dialog/focused.png +0 -0
- package/screenshots/truth/list/fields-dragging.png +0 -0
- package/screenshots/truth/list/fields-filtered.png +0 -0
- package/screenshots/truth/list/fields-hovered.png +0 -0
- package/screenshots/truth/list/fields.png +0 -0
- package/screenshots/truth/menu/menu-focused-with items.png +0 -0
- package/screenshots/truth/menu/menu-refresh-1.png +0 -0
- package/screenshots/truth/menu/menu-refresh-2.png +0 -0
- package/screenshots/truth/menu/menu-submenu.png +0 -0
- package/screenshots/truth/menu/menu-tasks-nextup.png +0 -0
- package/screenshots/truth/menu/menu-tasks.png +0 -0
- package/screenshots/truth/modax/form.png +0 -0
- package/screenshots/truth/modax/simple.png +0 -0
- package/screenshots/truth/select/expressions.png +0 -0
- package/screenshots/truth/select/functions.png +0 -0
- package/screenshots/truth/select/local-options.png +0 -0
- package/screenshots/truth/select/remote-options.png +0 -0
- package/screenshots/truth/select/search-enabled.png +0 -0
- package/screenshots/truth/select/search-multi-no-matches.png +0 -0
- package/screenshots/truth/select/search-selected-focus.png +0 -0
- package/screenshots/truth/select/search-with-selected.png +0 -0
- package/screenshots/truth/select/searching.png +0 -0
- package/screenshots/truth/select/with-placeholder.png +0 -0
- package/screenshots/truth/templates/default.png +0 -0
- package/screenshots/truth/templates/french.png +0 -0
- package/screenshots/truth/textinput/input-disabled.png +0 -0
- package/screenshots/truth/textinput/input-focused.png +0 -0
- package/screenshots/truth/textinput/input-form.png +0 -0
- package/screenshots/truth/textinput/input-inserted.png +0 -0
- package/screenshots/truth/textinput/input-placeholder.png +0 -0
- package/screenshots/truth/textinput/input-updated.png +0 -0
- package/screenshots/truth/textinput/input.png +0 -0
- package/screenshots/truth/textinput/textarea-focused.png +0 -0
- package/screenshots/truth/textinput/textarea.png +0 -0
- package/src/button/Button.ts +0 -1
- package/src/checkbox/Checkbox.ts +0 -1
- package/src/contacts/ContactName.ts +1 -3
- package/src/datepicker/DatePicker.ts +0 -1
- package/src/dialog/Dialog.ts +0 -2
- package/src/dialog/Modax.ts +0 -1
- package/src/list/NotificationList.ts +2 -3
- package/src/list/RunList.ts +2 -1
- package/src/select/Select.ts +0 -3
- package/src/textinput/TextInput.ts +1 -3
- package/src/webchat/WebChat.ts +68 -19
- package/static/css/temba-components.css +0 -5
- package/test-assets/style.css +1 -1
- package/screenshots/truth/datepicker/datetime.png +0 -0
- package/screenshots/truth/datepicker/initial-value.png +0 -0
- package/screenshots/truth/datepicker/updated-keyboard.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,14 @@ 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.81.0](https://github.com/nyaruka/temba-components/compare/v0.80.1...v0.81.0)
|
|
8
|
+
|
|
9
|
+
- Heavier fonts [`#413`](https://github.com/nyaruka/temba-components/pull/413)
|
|
10
|
+
|
|
7
11
|
#### [v0.80.1](https://github.com/nyaruka/temba-components/compare/v0.80.0...v0.80.1)
|
|
8
12
|
|
|
13
|
+
> 10 April 2024
|
|
14
|
+
|
|
9
15
|
- Add beat for temba-option collection [`3406463`](https://github.com/nyaruka/temba-components/commit/3406463dd07490615ec979c21c8701f7694a4f80)
|
|
10
16
|
|
|
11
17
|
#### [v0.80.0](https://github.com/nyaruka/temba-components/compare/v0.77.0...v0.80.0)
|
package/dist/temba-components.js
CHANGED
|
@@ -66,7 +66,6 @@ let rt=class extends w{constructor(){super(...arguments),this.renderOptions={hos
|
|
|
66
66
|
font-family: var(--font-family);
|
|
67
67
|
padding: 0px;
|
|
68
68
|
margin-left: 8px;
|
|
69
|
-
font-weight: 300;
|
|
70
69
|
font-size: 14px;
|
|
71
70
|
line-height: 19px;
|
|
72
71
|
flex-grow: 1;
|
|
@@ -178,7 +177,6 @@ const ve=t=>t??j
|
|
|
178
177
|
line-height: normal;
|
|
179
178
|
cursor: var(--input-cursor);
|
|
180
179
|
resize: none;
|
|
181
|
-
font-weight: 300;
|
|
182
180
|
width: 100%;
|
|
183
181
|
}
|
|
184
182
|
|
|
@@ -191,7 +189,6 @@ const ve=t=>t??j
|
|
|
191
189
|
|
|
192
190
|
.textinput::placeholder {
|
|
193
191
|
color: var(--color-placeholder);
|
|
194
|
-
font-weight: 300;
|
|
195
192
|
}
|
|
196
193
|
|
|
197
194
|
.grow-wrap {
|
|
@@ -213,7 +210,6 @@ const ve=t=>t??j
|
|
|
213
210
|
line-height: normal;
|
|
214
211
|
cursor: text;
|
|
215
212
|
resize: none;
|
|
216
|
-
font-weight: 300;
|
|
217
213
|
width: 100%;
|
|
218
214
|
visibility: hidden;
|
|
219
215
|
word-break: break-word;
|
|
@@ -241,6 +237,7 @@ const ve=t=>t??j
|
|
|
241
237
|
/>`:null;let i=Z`
|
|
242
238
|
<input
|
|
243
239
|
class="textinput"
|
|
240
|
+
autocomplete="off"
|
|
244
241
|
name=${this.name}
|
|
245
242
|
type="${this.password||this.type===$e.Password?"password":this.type}"
|
|
246
243
|
maxlength="${ve(this.maxlength)}"
|
|
@@ -800,7 +797,6 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
800
797
|
}
|
|
801
798
|
|
|
802
799
|
.searchable input {
|
|
803
|
-
font-weight: 300;
|
|
804
800
|
visibility: visible;
|
|
805
801
|
cursor: pointer;
|
|
806
802
|
background: none;
|
|
@@ -829,7 +825,6 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
829
825
|
|
|
830
826
|
.searchbox::placeholder {
|
|
831
827
|
color: var(--color-placeholder);
|
|
832
|
-
font-weight: 300;
|
|
833
828
|
font-size: 1em;
|
|
834
829
|
line-height: var(--temba-select-selected-line-height);
|
|
835
830
|
padding-left: 1px;
|
|
@@ -839,7 +834,6 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
839
834
|
font-size: var(--temba-select-selected-font-size);
|
|
840
835
|
color: var(--color-placeholder);
|
|
841
836
|
display: none;
|
|
842
|
-
font-weight: 300;
|
|
843
837
|
line-height: var(--temba-select-selected-line-height);
|
|
844
838
|
}
|
|
845
839
|
|
|
@@ -1221,7 +1215,6 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
1221
1215
|
align-items: center;
|
|
1222
1216
|
font-size: 20px;
|
|
1223
1217
|
padding: 12px 20px;
|
|
1224
|
-
font-weight: 300;
|
|
1225
1218
|
color: var(--header-text);
|
|
1226
1219
|
background: var(--header-bg);
|
|
1227
1220
|
}
|
|
@@ -1394,7 +1387,6 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
1394
1387
|
padding: 10px;
|
|
1395
1388
|
margin-bottom: 10px;
|
|
1396
1389
|
border-radius: 6px;
|
|
1397
|
-
font-weight: 300;
|
|
1398
1390
|
}
|
|
1399
1391
|
|
|
1400
1392
|
.step-ball {
|
|
@@ -1570,7 +1562,6 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
1570
1562
|
.secondary-button {
|
|
1571
1563
|
background: transparent;
|
|
1572
1564
|
color: var(--color-text);
|
|
1573
|
-
font-weight: 300;
|
|
1574
1565
|
}
|
|
1575
1566
|
|
|
1576
1567
|
.destructive-button {
|
|
@@ -4598,15 +4589,13 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
4598
4589
|
}
|
|
4599
4590
|
|
|
4600
4591
|
.name {
|
|
4601
|
-
font-size: 1.5rem;
|
|
4592
|
+
font-size: var(--contact-name-font-size, 1.5rem);
|
|
4602
4593
|
overflow: hidden;
|
|
4603
4594
|
max-height: 2rem;
|
|
4604
4595
|
line-height: 2rem;
|
|
4605
4596
|
-webkit-box-orient: vertical;
|
|
4606
4597
|
-webkit-line-clamp: 1;
|
|
4607
4598
|
text-overflow: ellipsis;
|
|
4608
|
-
display: -webkit-box;
|
|
4609
|
-
margin: auto;
|
|
4610
4599
|
}
|
|
4611
4600
|
`}render(){const t=this.urn?Z`<temba-urn size=${this.size} urn=${this.urn}></temba-urn>`:null;return Z`
|
|
4612
4601
|
${t}
|
|
@@ -5656,6 +5645,7 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
5656
5645
|
</div>`}}t([pe({type:Boolean})],eh.prototype,"range",void 0),t([pe({type:Number})],eh.prototype,"min",void 0),t([pe({type:Number})],eh.prototype,"max",void 0);const ih="rgb(223, 65, 159)";class oh extends $l{static get styles(){return r`
|
|
5657
5646
|
:host {
|
|
5658
5647
|
overflow-y: auto !important;
|
|
5648
|
+
--contact-name-font-size: 1em;
|
|
5659
5649
|
}
|
|
5660
5650
|
|
|
5661
5651
|
@media only screen and (max-height: 768px) {
|
|
@@ -5687,7 +5677,7 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
5687
5677
|
/>`),e}createRenderOption(){this.renderOption=t=>{let e="";return t.exited_on||(e="font-weight:400;"),t.responded||(e+=""),Z`
|
|
5688
5678
|
<div class="row" style="${e}display:flex;align-items:center">
|
|
5689
5679
|
<div
|
|
5690
|
-
style="width:
|
|
5680
|
+
style="width:16em;white-space:nowrap;overflow: hidden; text-overflow: ellipsis;"
|
|
5691
5681
|
>
|
|
5692
5682
|
<temba-contact-name
|
|
5693
5683
|
name=${t.contact.name||t.contact.anon_display}
|
|
@@ -5911,7 +5901,6 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
5911
5901
|
color: var(--color-widget-text);
|
|
5912
5902
|
border: 0px;
|
|
5913
5903
|
font-family: var(--font-family);
|
|
5914
|
-
font-weight: 300;
|
|
5915
5904
|
outline: none;
|
|
5916
5905
|
width: 100%;
|
|
5917
5906
|
font-size: 13px;
|
|
@@ -6949,6 +6938,36 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
6949
6938
|
--curvature: 0.6em;
|
|
6950
6939
|
--color-primary: hsla(208, 70%, 55%, 1);
|
|
6951
6940
|
font-family: 'Roboto', 'Helvetica Neue', sans-serif;
|
|
6941
|
+
font-weight: 400;
|
|
6942
|
+
font-size: 1.1em;
|
|
6943
|
+
--toggle-speed: 80ms;
|
|
6944
|
+
}
|
|
6945
|
+
|
|
6946
|
+
.header {
|
|
6947
|
+
background: var(--color-primary);
|
|
6948
|
+
height: 3em;
|
|
6949
|
+
display: flex;
|
|
6950
|
+
align-items: center;
|
|
6951
|
+
width: 100%;
|
|
6952
|
+
}
|
|
6953
|
+
|
|
6954
|
+
.header slot {
|
|
6955
|
+
flex-grow: 1;
|
|
6956
|
+
padding: 1em;
|
|
6957
|
+
color: rgba(255, 255, 255, 0.9);
|
|
6958
|
+
font-size: 1.2em;
|
|
6959
|
+
display: block;
|
|
6960
|
+
}
|
|
6961
|
+
|
|
6962
|
+
.header .close-button {
|
|
6963
|
+
margin: 0.5em;
|
|
6964
|
+
color: rgba(255, 255, 255, 0.5);
|
|
6965
|
+
cursor: pointer;
|
|
6966
|
+
}
|
|
6967
|
+
|
|
6968
|
+
.header .close-button:hover {
|
|
6969
|
+
cursor: pointer;
|
|
6970
|
+
color: rgba(255, 255, 255, 1);
|
|
6952
6971
|
}
|
|
6953
6972
|
|
|
6954
6973
|
.block {
|
|
@@ -7006,9 +7025,9 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
7006
7025
|
rgba(0, 0, 0, 0.2) 0px 1px 2px 0px,
|
|
7007
7026
|
inset 0 0 0 0.25em rgba(0, 0, 0, 0.1);
|
|
7008
7027
|
cursor: pointer;
|
|
7009
|
-
transition: box-shadow
|
|
7028
|
+
transition: box-shadow var(--toggle-speed) ease-out;
|
|
7010
7029
|
position: absolute;
|
|
7011
|
-
bottom:
|
|
7030
|
+
bottom: 0.5em;
|
|
7012
7031
|
right: 1em;
|
|
7013
7032
|
}
|
|
7014
7033
|
|
|
@@ -7028,12 +7047,14 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
7028
7047
|
padding-bottom: 0.5em;
|
|
7029
7048
|
background: #fafafa;
|
|
7030
7049
|
border-radius: var(--curvature);
|
|
7050
|
+
max-width: 70%;
|
|
7031
7051
|
}
|
|
7032
7052
|
|
|
7033
7053
|
.bubble .name {
|
|
7034
|
-
font-size: 0.
|
|
7054
|
+
font-size: 0.95em;
|
|
7035
7055
|
font-weight: 400;
|
|
7036
|
-
|
|
7056
|
+
color: #888;
|
|
7057
|
+
margin-bottom: 0.25em;
|
|
7037
7058
|
}
|
|
7038
7059
|
|
|
7039
7060
|
.outgoing .bubble {
|
|
@@ -7044,10 +7065,12 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
7044
7065
|
background: var(--color-primary);
|
|
7045
7066
|
color: white;
|
|
7046
7067
|
border-top-right-radius: 0;
|
|
7068
|
+
text-align: right;
|
|
7047
7069
|
}
|
|
7048
7070
|
|
|
7049
7071
|
.message {
|
|
7050
7072
|
margin-bottom: 0.5em;
|
|
7073
|
+
line-height: 1.2em;
|
|
7051
7074
|
}
|
|
7052
7075
|
|
|
7053
7076
|
.chat {
|
|
@@ -7058,16 +7081,16 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
7058
7081
|
box-shadow: rgba(0, 0, 0, 0.1) 0px 3px 7px 0px,
|
|
7059
7082
|
rgba(0, 0, 0, 0.2) 0px 1px 2px 0px, rgba(0, 0, 0, 0.1) 5em 5em 5em 5em;
|
|
7060
7083
|
position: absolute;
|
|
7061
|
-
bottom:
|
|
7084
|
+
bottom: 3em;
|
|
7062
7085
|
right: 1em;
|
|
7063
|
-
transition: all
|
|
7086
|
+
transition: all var(--toggle-speed) ease-out;
|
|
7064
7087
|
transform: scale(0.9);
|
|
7065
7088
|
pointer-events: none;
|
|
7066
7089
|
opacity: 0;
|
|
7067
7090
|
}
|
|
7068
7091
|
|
|
7069
7092
|
.chat.open {
|
|
7070
|
-
bottom:
|
|
7093
|
+
bottom: 5em;
|
|
7071
7094
|
opacity: 1;
|
|
7072
7095
|
transform: scale(1);
|
|
7073
7096
|
pointer-events: initial;
|
|
@@ -7099,7 +7122,7 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
7099
7122
|
position: absolute;
|
|
7100
7123
|
max-width: 50vw;
|
|
7101
7124
|
width: 28rem;
|
|
7102
|
-
transition: opacity
|
|
7125
|
+
transition: opacity var(--toggle-speed) ease-out;
|
|
7103
7126
|
}
|
|
7104
7127
|
|
|
7105
7128
|
.messages:after {
|
|
@@ -7117,7 +7140,7 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
7117
7140
|
max-width: 50vw;
|
|
7118
7141
|
width: 28rem;
|
|
7119
7142
|
margin-right: 5em;
|
|
7120
|
-
transition: opacity
|
|
7143
|
+
transition: opacity var(--toggle-speed) ease-out;
|
|
7121
7144
|
}
|
|
7122
7145
|
|
|
7123
7146
|
.scroll-at-top .messages:before {
|
|
@@ -7131,6 +7154,8 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
7131
7154
|
.input {
|
|
7132
7155
|
border: none;
|
|
7133
7156
|
flex-grow: 1;
|
|
7157
|
+
color: #333;
|
|
7158
|
+
font-size: 1em;
|
|
7134
7159
|
}
|
|
7135
7160
|
|
|
7136
7161
|
.input:focus {
|
|
@@ -7188,7 +7213,7 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
7188
7213
|
.input:disabled {
|
|
7189
7214
|
background: transparent !important;
|
|
7190
7215
|
}
|
|
7191
|
-
`}constructor(){super(),this.messages=[],this.status=vh.DISCONNECTED,this.open=!1,this.hasPendingText=!1,this.hideTopScroll=!0,this.hideBottomScroll=!0}handleReconnect(){this.openSocket()}openSocket(){if(this.status!==vh.DISCONNECTED)return;this.status=vh.CONNECTING;const t=this;let e=`ws://localhost:8070/start/${this.channel}/`;this.urn&&(e=`${e}?chat_id=${this.urn}`),this.sock=new WebSocket(e),this.sock.onclose=function(e){t.status=vh.DISCONNECTED},this.sock.onmessage=function(e){t.status=vh.CONNECTED;const i=JSON.parse(e.data);"chat_started"===i.type?(t.urn!==i.
|
|
7216
|
+
`}constructor(){super(),this.messages=[],this.status=vh.DISCONNECTED,this.open=!1,this.hasPendingText=!1,this.hideTopScroll=!0,this.hideBottomScroll=!0}handleReconnect(){this.openSocket()}openSocket(){if(this.status!==vh.DISCONNECTED)return;this.status=vh.CONNECTING;const t=this;let e=`ws://localhost:8070/start/${this.channel}/`;this.urn&&(e=`${e}?chat_id=${this.urn}`),this.sock=new WebSocket(e),this.sock.onclose=function(e){console.log("Socket closed",e),t.status=vh.DISCONNECTED},this.sock.onmessage=function(e){console.log(e),t.status=vh.CONNECTED;const i=JSON.parse(e.data);"chat_started"===i.type?(t.urn!==i.chat_id&&(t.messages=[]),t.urn=i.chat_id,t.requestUpdate("messages")):"chat_resumed"===i.type?t.urn=i.chat_id:"msg_out"===i.type&&(i.timestamp=(new Date).getTime(),t.addMessage(i),t.requestUpdate("messages"))}}restoreFromLocal(){const t=JSON.parse(localStorage.getItem("temba-chat")||"{}"),e="urn"in t?t.urn:null;if(e&&!this.urn){this.urn=e;const i="messages"in t?t.messages:[];this.messages.push(...i)}}writeToLocal(){if(this.urn){const t={urn:this.urn,messages:this.messages,version:1};localStorage.setItem("temba-chat",JSON.stringify(t))}}firstUpdated(t){super.firstUpdated(t)}focusInput(){const t=this.shadowRoot.querySelector(".input");t&&t.focus()}updated(t){if(super.updated(t),this.open&&t.has("open")&&void 0!==t.get("open")){const t=this.shadowRoot.querySelector(".scroll"),e=t.scrollHeight>t.clientHeight;this.hideBottomScroll=!0,this.hideTopScroll=!e,this.scrollToBottom(),this.status===vh.DISCONNECTED&&this.openSocket()}t.has("status")&&this.status===vh.CONNECTED&&this.focusInput(),t.has("channel")&&this.restoreFromLocal(),t.has("messages")&&(this.writeToLocal(),this.scrollToBottom())}addMessage(t){let e=this.messages.length>0?this.messages[this.messages.length-1]:[];0===e.length||e[0].origin===t.origin||(e=[]),0===e.length&&this.messages.push(e),e.push(t)}openChat(){this.open=!0}handleKeyUp(t){this.hasPendingText&&"Enter"===t.key&&this.sendPendingMessage(),this.hasPendingText=t.target.value.length>0}sendPendingMessage(){if(this.status===vh.CONNECTED){const t=this.shadowRoot.querySelector(".input"),e=t.value;t.value="";const i={type:"msg_in",text:e,timestamp:(new Date).getTime()};this.addMessage(i),this.sock.send(JSON.stringify(i)),this.requestUpdate("messages"),this.hasPendingText=t.value.length>0}}scrollToBottom(){const t=this.shadowRoot.querySelector(".scroll");t&&(t.scrollTop=t.scrollHeight,this.hideBottomScroll=!0)}renderMessageGroup(t,e,i){let o=null;if(e>0){const t=i[e-1];t&&t.length>0&&(o=t[t.length-1].timestamp)}const n=t[0].timestamp;let s=null;if(n-o>18e5){let t=null;const e=new Date(n);o&&(t=new Date(o));s=!t||e.getDate()!==t.getDate()?Z`<div class="time">
|
|
7192
7217
|
${e.toLocaleDateString(void 0,$h)}
|
|
7193
7218
|
</div>`:Z`<div class="time">
|
|
7194
7219
|
${e.toLocaleTimeString(void 0,Sh)}
|
|
@@ -7210,10 +7235,19 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
|
|
|
7210
7235
|
${t.map((t=>Z`<div class="message">${t.text}</div>`))}
|
|
7211
7236
|
</div>
|
|
7212
7237
|
</div>
|
|
7213
|
-
</div>`}handleScroll(t){this.hideBottomScroll=Math.round(t.target.scrollTop+t.target.clientHeight)>=t.target.scrollHeight,this.hideTopScroll=0===t.target.scrollTop}handleClickInputPanel(t){this.shadowRoot.querySelector(".input").focus()}toggleChat(){this.open=!this.open}render(){return Z`
|
|
7238
|
+
</div>`}handleScroll(t){this.hideBottomScroll=Math.round(t.target.scrollTop+t.target.clientHeight)>=t.target.scrollHeight,this.hideTopScroll=0===t.target.scrollTop}handleClickInputPanel(t){t.preventDefault(),t.stopPropagation();this.shadowRoot.querySelector(".input").focus()}toggleChat(){this.open=!this.open}render(){return Z`
|
|
7214
7239
|
<div
|
|
7215
7240
|
class="chat ${this.status} ${this.hideTopScroll?"scroll-at-top":""} ${this.hideBottomScroll?"scroll-at-bottom":""} ${this.open?"open":""}"
|
|
7216
7241
|
>
|
|
7242
|
+
<div class="header">
|
|
7243
|
+
<slot name="header"></slot>
|
|
7244
|
+
<temba-icon
|
|
7245
|
+
name="close"
|
|
7246
|
+
size="1.3"
|
|
7247
|
+
class="close-button"
|
|
7248
|
+
@click=${this.toggleChat}
|
|
7249
|
+
></temba-icon>
|
|
7250
|
+
</div>
|
|
7217
7251
|
<div class="messages">
|
|
7218
7252
|
<div class="scroll" @scroll=${this.handleScroll}>
|
|
7219
7253
|
${this.messages?this.messages.map(((t,e,i)=>Z`${this.renderMessageGroup(t,e,i)}`)):null}
|
|
@@ -7956,7 +7990,7 @@ background: #ccc;
|
|
|
7956
7990
|
font-weight: normal;
|
|
7957
7991
|
}
|
|
7958
7992
|
`}constructor(){super(),this.reverseRefresh=!1,this.internalFocusDisabled=!0,this.valueKey="target_url",this.renderOption=t=>{let e=null,i=null;return"incident:started"===t.type?"org:flagged"===t.incident.type?(e=ge.incidents,i="Your workspace was flagged, please contact support for assistance."):"org:suspended"===t.incident.type?(e=ge.incidents,i="Your workspace was suspended, please contact support for assistance."):"channel:disconnected"===t.incident.type?(e=ge.channel,i="Your android channel is not connected"):"channel:templates_failed"===t.incident.type?(e=ge.channel,i="Your WhatsApp channel templates failed syncing"):"webhooks:unhealthy"===t.incident.type&&(e=ge.webhook,i="Your webhook calls are not working properly."):"import:finished"===t.type?"contact"===t.import.type&&(e=ge.contact_import,i=`Imported ${t.import.num_records.toLocaleString()} contacts`):"export:finished"===t.type?"contact"===t.export.type?(e=ge.contact_export,i="Exported contacts"):"message"===t.export.type?(e=ge.message_export,i="Exported messages"):"results"===t.export.type?(e=ge.results_export,i="Exported flow results"):"ticket"===t.export.type&&(e=ge.tickets_export,i="Exported tickets"):"tickets:activity"===t.type?(e=ge.tickets,i="New ticket activity"):"tickets:opened"===t.type&&(e=ge.tickets,i="New unassigned ticket"),Z`<div
|
|
7959
|
-
style="color:${"#333"};display:flex;align-items:flex-start;flex-direction:row;font-weight:${t.is_seen?
|
|
7993
|
+
style="color:${"#333"};display:flex;align-items:flex-start;flex-direction:row;font-weight:${t.is_seen?400:500}"
|
|
7960
7994
|
>
|
|
7961
7995
|
${e?Z`<div style="margin-right:0.6em">
|
|
7962
7996
|
<temba-icon name="${e}"></temba-icon>
|