@nyaruka/temba-components 0.35.3 → 0.37.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/.eslintrc.js +0 -2
- package/.github/workflows/build.yml +1 -0
- package/.github/workflows/publish.yml +2 -3
- package/.github/workflows/stale.yml +26 -0
- package/CHANGELOG.md +31 -0
- package/demo/index.html +1 -3
- package/dist/46adbabc.js +5792 -0
- package/dist/index.js +541 -487
- 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/dist/workbox-919adfb7.js +2 -0
- package/dist/workbox-919adfb7.js.map +1 -0
- package/out-tsc/src/FormElement.js +1 -1
- package/out-tsc/src/FormElement.js.map +1 -1
- package/out-tsc/src/RefreshElement.js +1 -1
- package/out-tsc/src/RefreshElement.js.map +1 -1
- package/out-tsc/src/alert/Alert.js +1 -1
- package/out-tsc/src/alert/Alert.js.map +1 -1
- package/out-tsc/src/aliaseditor/AliasEditor.js +6 -6
- package/out-tsc/src/aliaseditor/AliasEditor.js.map +1 -1
- package/out-tsc/src/anchor/Anchor.js +1 -1
- package/out-tsc/src/anchor/Anchor.js.map +1 -1
- package/out-tsc/src/button/Button.js +1 -1
- package/out-tsc/src/button/Button.js.map +1 -1
- package/out-tsc/src/charcount/CharCount.js +1 -1
- package/out-tsc/src/charcount/CharCount.js.map +1 -1
- package/out-tsc/src/checkbox/Checkbox.js +1 -1
- package/out-tsc/src/checkbox/Checkbox.js.map +1 -1
- package/out-tsc/src/completion/Completion.js +3 -3
- package/out-tsc/src/completion/Completion.js.map +1 -1
- package/out-tsc/src/completion/helpers.js +2 -2
- package/out-tsc/src/completion/helpers.js.map +1 -1
- package/out-tsc/src/contacts/ContactChat.js +184 -156
- package/out-tsc/src/contacts/ContactChat.js.map +1 -1
- package/out-tsc/src/contacts/ContactDetails.js +1 -1
- package/out-tsc/src/contacts/ContactDetails.js.map +1 -1
- package/out-tsc/src/contacts/ContactFieldEditor.js +1 -1
- package/out-tsc/src/contacts/ContactFieldEditor.js.map +1 -1
- package/out-tsc/src/contacts/ContactFields.js +1 -1
- package/out-tsc/src/contacts/ContactFields.js.map +1 -1
- package/out-tsc/src/contacts/ContactHistory.js +1 -1
- package/out-tsc/src/contacts/ContactHistory.js.map +1 -1
- package/out-tsc/src/contacts/ContactName.js +1 -1
- package/out-tsc/src/contacts/ContactName.js.map +1 -1
- package/out-tsc/src/contacts/ContactNameFetch.js +1 -1
- package/out-tsc/src/contacts/ContactNameFetch.js.map +1 -1
- package/out-tsc/src/contacts/ContactPending.js +13 -13
- package/out-tsc/src/contacts/ContactPending.js.map +1 -1
- package/out-tsc/src/contacts/ContactStoreElement.js +1 -1
- package/out-tsc/src/contacts/ContactStoreElement.js.map +1 -1
- package/out-tsc/src/contacts/ContactTickets.js +1 -1
- package/out-tsc/src/contacts/ContactTickets.js.map +1 -1
- package/out-tsc/src/contacts/ContactUrn.js +1 -1
- package/out-tsc/src/contacts/ContactUrn.js.map +1 -1
- package/out-tsc/src/contactsearch/ContactSearch.js +1 -1
- package/out-tsc/src/contactsearch/ContactSearch.js.map +1 -1
- package/out-tsc/src/date/TembaDate.js +1 -1
- package/out-tsc/src/date/TembaDate.js.map +1 -1
- package/out-tsc/src/datepicker/DatePicker.js +8 -8
- package/out-tsc/src/datepicker/DatePicker.js.map +1 -1
- package/out-tsc/src/dialog/Dialog.js +11 -11
- package/out-tsc/src/dialog/Dialog.js.map +1 -1
- package/out-tsc/src/dialog/Modax.js +16 -17
- package/out-tsc/src/dialog/Modax.js.map +1 -1
- package/out-tsc/src/dropdown/Dropdown.js +1 -1
- package/out-tsc/src/dropdown/Dropdown.js.map +1 -1
- package/out-tsc/src/fields/FieldManager.js +1 -1
- package/out-tsc/src/fields/FieldManager.js.map +1 -1
- package/out-tsc/src/flow/FlowStoreElement.js +1 -1
- package/out-tsc/src/flow/FlowStoreElement.js.map +1 -1
- package/out-tsc/src/formfield/FormField.js +1 -1
- package/out-tsc/src/formfield/FormField.js.map +1 -1
- package/out-tsc/src/label/Label.js +2 -2
- package/out-tsc/src/label/Label.js.map +1 -1
- package/out-tsc/src/leafletmap/LeafletMap.js +12 -12
- package/out-tsc/src/leafletmap/LeafletMap.js.map +1 -1
- package/out-tsc/src/list/ContentMenu.js +176 -0
- package/out-tsc/src/list/ContentMenu.js.map +1 -0
- package/out-tsc/src/list/RunList.js +13 -12
- package/out-tsc/src/list/RunList.js.map +1 -1
- package/out-tsc/src/list/SortableList.js +14 -14
- package/out-tsc/src/list/SortableList.js.map +1 -1
- package/out-tsc/src/list/TembaList.js +14 -16
- package/out-tsc/src/list/TembaList.js.map +1 -1
- package/out-tsc/src/list/TembaMenu.js +108 -108
- package/out-tsc/src/list/TembaMenu.js.map +1 -1
- package/out-tsc/src/list/TicketList.js +8 -8
- package/out-tsc/src/list/TicketList.js.map +1 -1
- package/out-tsc/src/loading/Loading.js +2 -2
- package/out-tsc/src/loading/Loading.js.map +1 -1
- package/out-tsc/src/omnibox/Omnibox.js +2 -2
- package/out-tsc/src/omnibox/Omnibox.js.map +1 -1
- package/out-tsc/src/options/Options.js +2 -2
- package/out-tsc/src/options/Options.js.map +1 -1
- package/out-tsc/src/remote/Remote.js +1 -1
- package/out-tsc/src/remote/Remote.js.map +1 -1
- package/out-tsc/src/select/Select.js +2 -2
- package/out-tsc/src/select/Select.js.map +1 -1
- package/out-tsc/src/shadowless/Shadowless.js +1 -1
- package/out-tsc/src/shadowless/Shadowless.js.map +1 -1
- package/out-tsc/src/slider/TembaSlider.js +2 -2
- package/out-tsc/src/slider/TembaSlider.js.map +1 -1
- package/out-tsc/src/store/Store.js +8 -5
- package/out-tsc/src/store/Store.js.map +1 -1
- package/out-tsc/src/store/StoreElement.js +1 -1
- package/out-tsc/src/store/StoreElement.js.map +1 -1
- package/out-tsc/src/tabpane/Tab.js +1 -1
- package/out-tsc/src/tabpane/Tab.js.map +1 -1
- package/out-tsc/src/tabpane/TabPane.js +1 -1
- package/out-tsc/src/tabpane/TabPane.js.map +1 -1
- package/out-tsc/src/textinput/TextInput.js +15 -15
- package/out-tsc/src/textinput/TextInput.js.map +1 -1
- package/out-tsc/src/tip/Tip.js +2 -2
- package/out-tsc/src/tip/Tip.js.map +1 -1
- package/out-tsc/src/utils/index.js +1 -6
- package/out-tsc/src/utils/index.js.map +1 -1
- package/out-tsc/src/vectoricon/VectorIcon.js +9 -9
- package/out-tsc/src/vectoricon/VectorIcon.js.map +1 -1
- package/out-tsc/temba-modules.js +3 -0
- package/out-tsc/temba-modules.js.map +1 -1
- package/out-tsc/test/MouseHelper.js +1 -1
- package/out-tsc/test/MouseHelper.js.map +1 -1
- package/out-tsc/test/temba-contact-chat.test.js +93 -50
- package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
- package/out-tsc/test/temba-contact-history.test.js +1 -1
- package/out-tsc/test/temba-contact-history.test.js.map +1 -1
- package/out-tsc/test/temba-content-menu.test.js +71 -0
- package/out-tsc/test/temba-content-menu.test.js.map +1 -0
- package/out-tsc/test/temba-modax.test.js +18 -19
- package/out-tsc/test/temba-modax.test.js.map +1 -1
- package/out-tsc/test/temba-select.test.js +1 -0
- package/out-tsc/test/temba-select.test.js.map +1 -1
- package/out-tsc/test/temba-tip.test.js +4 -6
- package/out-tsc/test/temba-tip.test.js.map +1 -1
- package/out-tsc/test/utils.test.js +5 -17
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +16 -28
- package/rollup.config.js +13 -7
- package/screenshots/truth/contacts/{contact-active-show-chat-history.png → contact-active-show-chatbox.png} +0 -0
- package/screenshots/truth/contacts/contact-active-ticket-closed-show-reopen-button.png +0 -0
- package/screenshots/truth/contacts/contact-active-ticket-open-show-chatbox.png +0 -0
- package/screenshots/truth/contacts/{contact-archived-hide-chat-msg.png → contact-archived-hide-chatbox.png} +0 -0
- package/screenshots/truth/contacts/contact-archived-ticket-closed-hide-chatbox.png +0 -0
- package/screenshots/truth/contacts/{contact-archived-show-chat-history.png → contact-blocked-hide-chatbox.png} +0 -0
- package/screenshots/truth/contacts/{contact-blocked-hide-chat-msg.png → contact-stopped-hide-chatbox.png} +0 -0
- package/screenshots/truth/content-menu/button-no-items.png +0 -0
- package/screenshots/truth/content-menu/item-no-buttons.png +0 -0
- package/screenshots/truth/content-menu/items-and-buttons.png +0 -0
- package/src/FormElement.ts +1 -1
- package/src/RefreshElement.ts +1 -1
- package/src/alert/Alert.ts +1 -1
- package/src/aliaseditor/AliasEditor.ts +2 -2
- package/src/anchor/Anchor.ts +1 -1
- package/src/button/Button.ts +1 -1
- package/src/charcount/CharCount.ts +1 -1
- package/src/checkbox/Checkbox.ts +1 -1
- package/src/completion/Completion.ts +3 -3
- package/src/completion/helpers.ts +8 -2
- package/src/contacts/ContactChat.ts +185 -157
- package/src/contacts/ContactDetails.ts +1 -1
- package/src/contacts/ContactFieldEditor.ts +1 -1
- package/src/contacts/ContactFields.ts +1 -1
- package/src/contacts/ContactHistory.ts +1 -1
- package/src/contacts/ContactName.ts +1 -1
- package/src/contacts/ContactNameFetch.ts +1 -1
- package/src/contacts/ContactPending.ts +1 -1
- package/src/contacts/ContactStoreElement.ts +1 -1
- package/src/contacts/ContactTickets.ts +1 -1
- package/src/contacts/ContactUrn.ts +1 -1
- package/src/contactsearch/ContactSearch.ts +1 -1
- package/src/date/TembaDate.ts +1 -1
- package/src/datepicker/DatePicker.ts +1 -1
- package/src/dialog/Dialog.ts +2 -2
- package/src/dialog/Modax.ts +17 -24
- package/src/dropdown/Dropdown.ts +1 -1
- package/src/fields/FieldManager.ts +1 -1
- package/src/flow/FlowStoreElement.ts +1 -1
- package/src/formfield/FormField.ts +1 -1
- package/src/label/Label.ts +2 -2
- package/src/leafletmap/LeafletMap.ts +1 -1
- package/src/list/ContentMenu.ts +192 -0
- package/src/list/RunList.ts +4 -3
- package/src/list/SortableList.ts +1 -1
- package/src/list/TembaList.ts +2 -4
- package/src/list/TembaMenu.ts +1 -1
- package/src/list/TicketList.ts +1 -1
- package/src/loading/Loading.ts +2 -2
- package/src/omnibox/Omnibox.ts +2 -2
- package/src/options/Options.ts +2 -2
- package/src/remote/Remote.ts +1 -1
- package/src/select/Select.ts +2 -2
- package/src/shadowless/Shadowless.ts +1 -1
- package/src/slider/TembaSlider.ts +2 -2
- package/src/store/Store.ts +11 -7
- package/src/store/StoreElement.ts +1 -1
- package/src/tabpane/Tab.ts +1 -1
- package/src/tabpane/TabPane.ts +1 -1
- package/src/textinput/TextInput.ts +3 -3
- package/src/tip/Tip.ts +6 -6
- package/src/untyped.d.ts +0 -2
- package/src/utils/index.ts +1 -5
- package/src/vectoricon/VectorIcon.ts +1 -1
- package/temba-modules.ts +3 -0
- package/test/MouseHelper.ts +1 -1
- package/test/temba-contact-chat.test.ts +148 -62
- package/test/temba-contact-history.test.ts +1 -1
- package/test/temba-content-menu.test.ts +100 -0
- package/test/temba-modax.test.ts +25 -21
- package/test/temba-select.test.ts +2 -0
- package/test/temba-tip.test.ts +10 -5
- package/test/utils.test.ts +6 -19
- package/test-assets/contacts/{contact-barak-archived → contact-barack-archived} +1 -1
- package/test-assets/contacts/contact-carter-active +52 -0
- package/test-assets/contacts/contact-michelle-blocked +1 -1
- package/test-assets/contacts/contact-tim-stopped +1 -1
- package/test-assets/list/content-menu-archived-contacts.json +12 -0
- package/test-assets/list/content-menu-contact-read.json +49 -0
- package/test-assets/list/content-menu-new-campaign.json +15 -0
- package/test-assets/tickets/empty.json +6 -0
- package/test-assets/tickets/ticket-barack-closed.json +22 -0
- package/test-assets/tickets/ticket-carter-closed.json +22 -0
- package/test-assets/tickets/ticket-carter-open.json +22 -0
- package/web-test-runner.config.mjs +21 -18
- package/dist/445f048b.js +0 -5738
- package/dist/workbox-80efdfd1.js +0 -2
- package/dist/workbox-80efdfd1.js.map +0 -1
- package/screenshots/truth/contacts/contact-active-show-chat-msg.png +0 -0
- package/screenshots/truth/contacts/contact-blocked-show-chat-history.png +0 -0
- package/screenshots/truth/contacts/contact-stopped-hide-chat-msg.png +0 -0
- package/screenshots/truth/contacts/contact-stopped-show-chat-history.png +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css, html, TemplateResult } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { Contact, CustomEventType, Ticket } from '../interfaces';
|
|
4
4
|
import { COOKIE_KEYS, getCookieBoolean, postJSON, setCookie } from '../utils';
|
|
5
5
|
import { TextInput } from '../textinput/TextInput';
|
|
@@ -194,6 +194,9 @@ export class ContactChat extends ContactStoreElement {
|
|
|
194
194
|
@property({ type: String })
|
|
195
195
|
agent = '';
|
|
196
196
|
|
|
197
|
+
// http promise to monitor for completeness
|
|
198
|
+
public httpComplete: Promise<void>;
|
|
199
|
+
|
|
197
200
|
constructor() {
|
|
198
201
|
super();
|
|
199
202
|
this.showDetails = getCookieBoolean(COOKIE_KEYS.TICKET_SHOW_DETAILS);
|
|
@@ -272,7 +275,7 @@ export class ContactChat extends ContactStoreElement {
|
|
|
272
275
|
this.currentChat = chat.value;
|
|
273
276
|
}
|
|
274
277
|
|
|
275
|
-
private
|
|
278
|
+
private handleTicketReopen() {
|
|
276
279
|
const uuid = this.currentTicket.uuid;
|
|
277
280
|
postJSON(`/api/v2/ticket_actions.json`, {
|
|
278
281
|
tickets: [uuid],
|
|
@@ -321,163 +324,188 @@ export class ContactChat extends ContactStoreElement {
|
|
|
321
324
|
}
|
|
322
325
|
|
|
323
326
|
public render(): TemplateResult {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
style="${this.currentContact.status !== 'active'
|
|
355
|
-
? 'display:none'
|
|
356
|
-
: ''}"
|
|
357
|
-
>
|
|
358
|
-
<temba-completion
|
|
359
|
-
@change=${this.handleChatChange}
|
|
360
|
-
.value=${this.currentChat}
|
|
361
|
-
@keydown=${(e: KeyboardEvent) => {
|
|
362
|
-
if (e.key === 'Enter' && !e.shiftKey) {
|
|
363
|
-
const chat = e.target as Completion;
|
|
364
|
-
if (!chat.hasVisibleOptions()) {
|
|
365
|
-
this.handleSend();
|
|
366
|
-
e.preventDefault();
|
|
367
|
-
e.stopPropagation();
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}}
|
|
371
|
-
textarea
|
|
372
|
-
>
|
|
373
|
-
</temba-completion>
|
|
374
|
-
<temba-button
|
|
375
|
-
id="send-button"
|
|
376
|
-
name="Send"
|
|
377
|
-
@click=${this.handleSend}
|
|
378
|
-
?disabled=${this.currentChat.trim().length === 0}
|
|
379
|
-
></temba-button>
|
|
380
|
-
</div>`
|
|
381
|
-
}
|
|
382
|
-
</div>`
|
|
383
|
-
: null}
|
|
327
|
+
const contactHistory = this.currentContact
|
|
328
|
+
? this.getTembaContactHistory()
|
|
329
|
+
: null;
|
|
330
|
+
const chatbox = this.currentContact ? this.getTembaChatbox() : null;
|
|
331
|
+
|
|
332
|
+
const contactHistoryAndChatbox = html`<div
|
|
333
|
+
style="flex-grow: 1; margin-right: 0em; display:flex; flex-direction:row; min-height: 0;"
|
|
334
|
+
class="left-pane ${this.showDetails ? 'open' : ''}"
|
|
335
|
+
>
|
|
336
|
+
<div class="chat-wrapper">${contactHistory} ${chatbox}</div>
|
|
337
|
+
</div>`;
|
|
338
|
+
|
|
339
|
+
if (this.toolbar) {
|
|
340
|
+
const contactDetails = this.currentContact
|
|
341
|
+
? this.getTembaContactDetails()
|
|
342
|
+
: null;
|
|
343
|
+
const toggleContactDetails = this.currentContact
|
|
344
|
+
? this.getToggleDetailsTembaTip()
|
|
345
|
+
: null;
|
|
346
|
+
const addNoteAndAssignTicketTembaTips =
|
|
347
|
+
this.currentContact && this.currentTicket
|
|
348
|
+
? this.getAddNoteAndAssignTicketTembaTips()
|
|
349
|
+
: null;
|
|
350
|
+
const addNoteAndAssignTicketTembaModaxes = this.currentTicket
|
|
351
|
+
? this.getAddNoteAndAssignTicketTembaModaxes()
|
|
352
|
+
: null;
|
|
353
|
+
|
|
354
|
+
const contactDetailsAndActions = html`${contactDetails}
|
|
355
|
+
<div class="toolbar ${this.showDetails ? '' : 'closed'}">
|
|
356
|
+
${toggleContactDetails} ${addNoteAndAssignTicketTembaTips}
|
|
384
357
|
</div>
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
${this.toolbar
|
|
388
|
-
? html`${
|
|
389
|
-
this.currentContact
|
|
390
|
-
? html`<temba-contact-details
|
|
391
|
-
style="z-index: 10"
|
|
392
|
-
class="${this.showDetails ? '' : 'hidden'}"
|
|
393
|
-
showGroups="true"
|
|
394
|
-
.visible=${this.showDetails}
|
|
395
|
-
.ticket=${this.currentTicket}
|
|
396
|
-
.contact=${this.currentContact}
|
|
397
|
-
></temba-contact-details>`
|
|
398
|
-
: null
|
|
399
|
-
}
|
|
358
|
+
${addNoteAndAssignTicketTembaModaxes}`;
|
|
400
359
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
360
|
+
return html`${contactHistoryAndChatbox} ${contactDetailsAndActions}`;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return html`${contactHistoryAndChatbox}`;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
private getTembaContactHistory(): TemplateResult {
|
|
367
|
+
return html` <temba-contact-history
|
|
368
|
+
.uuid=${this.currentContact.uuid}
|
|
369
|
+
.contact=${this.currentContact}
|
|
370
|
+
.ticket=${this.currentTicket ? this.currentTicket.uuid : null}
|
|
371
|
+
.endDate=${this.currentTicket ? this.currentTicket.closed_on : null}
|
|
372
|
+
.agent=${this.agent}
|
|
373
|
+
>
|
|
374
|
+
</temba-contact-history>`;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
private getTembaChatbox(): TemplateResult {
|
|
378
|
+
if (this.currentTicket) {
|
|
379
|
+
if (this.currentContact && this.currentContact.status !== 'active') {
|
|
380
|
+
//no chatbox for archived, blocked, or stopped contacts
|
|
381
|
+
return null;
|
|
382
|
+
} else {
|
|
383
|
+
if (this.currentTicket.closed_on) {
|
|
384
|
+
//reopen button for active contacts with a closed ticket
|
|
385
|
+
return html` <div class="closed-footer">
|
|
386
|
+
<temba-button
|
|
387
|
+
id="reopen-button"
|
|
388
|
+
name="Reopen"
|
|
389
|
+
@click=${this.handleTicketReopen}
|
|
390
|
+
></temba-button>
|
|
391
|
+
</div>`;
|
|
392
|
+
} else {
|
|
393
|
+
//chatbox for active contacts with an open ticket
|
|
394
|
+
return this.getChatbox();
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (this.currentContact && this.currentContact.status !== 'active') {
|
|
400
|
+
//no chatbox for archived, blocked, or stopped contacts
|
|
401
|
+
return null;
|
|
402
|
+
} else {
|
|
403
|
+
//chatbox for active contacts
|
|
404
|
+
return this.getChatbox();
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
private getChatbox(): TemplateResult {
|
|
409
|
+
return html` <div class="chatbox ${this.toolbar ? 'full' : ''}">
|
|
410
|
+
<temba-completion
|
|
411
|
+
@change=${this.handleChatChange}
|
|
412
|
+
.value=${this.currentChat}
|
|
413
|
+
@keydown=${(e: KeyboardEvent) => {
|
|
414
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
415
|
+
const chat = e.target as Completion;
|
|
416
|
+
if (!chat.hasVisibleOptions()) {
|
|
417
|
+
this.handleSend();
|
|
418
|
+
e.preventDefault();
|
|
419
|
+
e.stopPropagation();
|
|
420
|
+
}
|
|
460
421
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
|
|
422
|
+
}}
|
|
423
|
+
textarea
|
|
424
|
+
>
|
|
425
|
+
</temba-completion>
|
|
426
|
+
<temba-button
|
|
427
|
+
id="send-button"
|
|
428
|
+
name="Send"
|
|
429
|
+
@click=${this.handleSend}
|
|
430
|
+
?disabled=${this.currentChat.trim().length === 0}
|
|
431
|
+
></temba-button>
|
|
432
|
+
</div>`;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
private getTembaContactDetails(): TemplateResult {
|
|
436
|
+
return html` <temba-contact-details
|
|
437
|
+
style="z-index: 10"
|
|
438
|
+
class="${this.showDetails ? '' : 'hidden'}"
|
|
439
|
+
showGroups="true"
|
|
440
|
+
.visible=${this.showDetails}
|
|
441
|
+
.ticket=${this.currentTicket}
|
|
442
|
+
.contact=${this.currentContact}
|
|
443
|
+
>
|
|
444
|
+
</temba-contact-details>`;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
private getToggleDetailsTembaTip(): TemplateResult {
|
|
448
|
+
return html` <temba-tip
|
|
449
|
+
style="margin-top:5px"
|
|
450
|
+
text="${this.showDetails ? 'Hide Details' : 'Show Details'}"
|
|
451
|
+
position="left"
|
|
452
|
+
hideOnChange
|
|
453
|
+
>
|
|
454
|
+
<temba-icon
|
|
455
|
+
id="details-button"
|
|
456
|
+
name="${this.showDetails ? Icon.menu_collapse : 'layout-left'}"
|
|
457
|
+
@click="${this.handleDetailSlider}"
|
|
458
|
+
clickable
|
|
459
|
+
animatechange="spin"
|
|
460
|
+
></temba-icon>
|
|
461
|
+
</temba-tip>`;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
private getAddNoteAndAssignTicketTembaTips(): TemplateResult {
|
|
465
|
+
return html` <temba-tip
|
|
466
|
+
style="margin-top:5px"
|
|
467
|
+
text="Assign"
|
|
468
|
+
position="left"
|
|
469
|
+
>
|
|
470
|
+
<temba-icon
|
|
471
|
+
id="assign-button"
|
|
472
|
+
name="${Icon.users}"
|
|
473
|
+
@click="${() => {
|
|
474
|
+
const modax = this.shadowRoot.getElementById(
|
|
475
|
+
'assign-dialog'
|
|
476
|
+
) as Modax;
|
|
477
|
+
modax.open = true;
|
|
478
|
+
}}"
|
|
479
|
+
clickable
|
|
480
|
+
></temba-icon>
|
|
481
|
+
</temba-tip>
|
|
482
|
+
<temba-tip style="margin-top:5px" text="Add Note" position="left">
|
|
483
|
+
<temba-icon
|
|
484
|
+
id="add-note-button"
|
|
485
|
+
name="${Icon.add_note}"
|
|
486
|
+
@click="${() => {
|
|
487
|
+
const note = this.shadowRoot.getElementById('note-dialog') as Modax;
|
|
488
|
+
note.open = true;
|
|
489
|
+
}}"
|
|
490
|
+
clickable
|
|
491
|
+
></temba-icon>
|
|
492
|
+
</temba-tip>`;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
private getAddNoteAndAssignTicketTembaModaxes(): TemplateResult {
|
|
496
|
+
return html` <temba-modax
|
|
497
|
+
header="Add Note"
|
|
498
|
+
id="note-dialog"
|
|
499
|
+
@temba-submitted=${this.refresh}
|
|
500
|
+
endpoint="/ticket/note/${this.currentTicket.uuid}/"
|
|
501
|
+
>
|
|
502
|
+
</temba-modax>
|
|
503
|
+
<temba-modax
|
|
504
|
+
header="Assign Ticket"
|
|
505
|
+
id="assign-dialog"
|
|
506
|
+
@temba-submitted=${this.handleTicketAssigned}
|
|
507
|
+
endpoint="/ticket/assign/${this.currentTicket.uuid}/"
|
|
508
|
+
>
|
|
509
|
+
</temba-modax>`;
|
|
482
510
|
}
|
|
483
511
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css, html, TemplateResult } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { Contact, Group, Ticket } from '../interfaces';
|
|
4
4
|
import { RapidElement } from '../RapidElement';
|
|
5
5
|
import { isDate, timeSince, truncate } from '../utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css, html, TemplateResult } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { FormElement } from '../FormElement';
|
|
4
4
|
import { CustomEventType } from '../interfaces';
|
|
5
5
|
import { RapidElement } from '../RapidElement';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css, html, PropertyValueMap, TemplateResult } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { postJSON } from '../utils';
|
|
4
4
|
import { ContactFieldEditor } from './ContactFieldEditor';
|
|
5
5
|
import { ContactStoreElement } from './ContactStoreElement';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { html, TemplateResult } from 'lit-html';
|
|
4
4
|
import { Contact, CustomEventType, Ticket } from '../interfaces';
|
|
5
5
|
import { RapidElement } from '../RapidElement';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css, html, PropertyValueMap, TemplateResult } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { Ticket, TicketStatus } from '../interfaces';
|
|
4
4
|
import { StoreElement } from '../store/StoreElement';
|
|
5
5
|
import { Icon } from '../vectoricon';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TemplateResult, html, css } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { getClasses, postJSON, WebResponse } from '../utils';
|
|
4
4
|
import { TextInput } from '../textinput/TextInput';
|
|
5
5
|
import '../alert/Alert';
|
package/src/date/TembaDate.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css, html, PropertyValueMap, TemplateResult } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { RapidElement } from '../RapidElement';
|
|
4
4
|
import { Store } from '../store/Store';
|
|
5
5
|
import { DateTime } from 'luxon';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TemplateResult, html, css, PropertyValueMap } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { FormElement } from '../FormElement';
|
|
4
4
|
import { getClasses } from '../utils';
|
|
5
5
|
import { DateTime } from 'luxon';
|
package/src/dialog/Dialog.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { property } from 'lit/decorators';
|
|
1
|
+
import { property } from 'lit/decorators.js';
|
|
2
2
|
import { TemplateResult, html, css } from 'lit';
|
|
3
3
|
import { Button } from '../button/Button';
|
|
4
4
|
import { RapidElement } from '../RapidElement';
|
|
5
5
|
import { CustomEventType } from '../interfaces';
|
|
6
|
-
import { styleMap } from 'lit-html/directives/style-map';
|
|
6
|
+
import { styleMap } from 'lit-html/directives/style-map.js';
|
|
7
7
|
import { getClasses } from '../utils';
|
|
8
8
|
|
|
9
9
|
export class Dialog extends RapidElement {
|
package/src/dialog/Modax.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TemplateResult, html, css } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
3
|
-
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
4
4
|
|
|
5
5
|
import { RapidElement } from '../RapidElement';
|
|
6
6
|
import { getUrl, serialize, postUrl, WebResponse } from '../utils';
|
|
@@ -10,9 +10,6 @@ import { Dialog } from './Dialog';
|
|
|
10
10
|
export class Modax extends RapidElement {
|
|
11
11
|
static get styles() {
|
|
12
12
|
return css`
|
|
13
|
-
:host {
|
|
14
|
-
}
|
|
15
|
-
|
|
16
13
|
fieldset {
|
|
17
14
|
border: none;
|
|
18
15
|
margin: 0;
|
|
@@ -117,9 +114,6 @@ export class Modax extends RapidElement {
|
|
|
117
114
|
suspendSubmit = false;
|
|
118
115
|
// private cancelToken: CancelTokenSource;
|
|
119
116
|
|
|
120
|
-
// http promise to monitor for completeness
|
|
121
|
-
public httpComplete: Promise<void | WebResponse>;
|
|
122
|
-
|
|
123
117
|
private handleSlotClicked(): void {
|
|
124
118
|
this.open = true;
|
|
125
119
|
}
|
|
@@ -152,22 +146,22 @@ export class Modax extends RapidElement {
|
|
|
152
146
|
return html`<temba-loading units="6" size="8"></temba-loading>`;
|
|
153
147
|
}
|
|
154
148
|
|
|
155
|
-
|
|
149
|
+
public updatePrimaryButton(): void {
|
|
156
150
|
if (!this.noSubmit) {
|
|
157
|
-
|
|
151
|
+
this.updateComplete.then(()=>{
|
|
158
152
|
const submitButton = this.shadowRoot.querySelector(
|
|
159
153
|
"input[type='submit']"
|
|
160
154
|
) as any;
|
|
161
155
|
|
|
162
156
|
if (submitButton) {
|
|
163
157
|
this.primaryName = submitButton.value;
|
|
158
|
+
this.cancelName = 'Cancel';
|
|
164
159
|
} else {
|
|
165
160
|
this.primaryName = null;
|
|
166
161
|
this.cancelName = 'Ok';
|
|
167
162
|
}
|
|
168
|
-
|
|
169
163
|
this.submitting = false;
|
|
170
|
-
}
|
|
164
|
+
});
|
|
171
165
|
}
|
|
172
166
|
}
|
|
173
167
|
|
|
@@ -196,7 +190,7 @@ export class Modax extends RapidElement {
|
|
|
196
190
|
const script = this.ownerDocument.createElement('script');
|
|
197
191
|
const code = scripts[i].innerText;
|
|
198
192
|
|
|
199
|
-
if (scripts[i].src) {
|
|
193
|
+
if (scripts[i].src && scripts[i].src.indexOf("web-dev-server") === -1) {
|
|
200
194
|
script.src = scripts[i].src;
|
|
201
195
|
script.type = 'text/javascript';
|
|
202
196
|
script.async = true;
|
|
@@ -219,12 +213,11 @@ export class Modax extends RapidElement {
|
|
|
219
213
|
this.body = unsafeHTML(div.innerHTML);
|
|
220
214
|
}
|
|
221
215
|
|
|
222
|
-
|
|
216
|
+
this.updateComplete.then(()=>{
|
|
223
217
|
for (const script of toAdd) {
|
|
224
218
|
scriptBlock.appendChild(script);
|
|
225
219
|
}
|
|
226
|
-
}
|
|
227
|
-
|
|
220
|
+
});
|
|
228
221
|
return !scriptOnly;
|
|
229
222
|
}
|
|
230
223
|
|
|
@@ -239,16 +232,16 @@ export class Modax extends RapidElement {
|
|
|
239
232
|
// this.cancelToken = CancelToken.source();
|
|
240
233
|
this.fetching = true;
|
|
241
234
|
this.body = this.getLoading();
|
|
242
|
-
|
|
235
|
+
getUrl(this.endpoint, null, this.getHeaders()).then(
|
|
243
236
|
(response: WebResponse) => {
|
|
244
|
-
this.setBody(response.body);
|
|
245
|
-
this.updatePrimaryButton();
|
|
237
|
+
this.setBody(response.body);
|
|
246
238
|
this.fetching = false;
|
|
247
|
-
|
|
239
|
+
this.updateComplete.then(()=>{
|
|
240
|
+
this.updatePrimaryButton();
|
|
248
241
|
this.fireCustomEvent(CustomEventType.Loaded, {
|
|
249
242
|
body: this.getBody(),
|
|
250
243
|
});
|
|
251
|
-
}
|
|
244
|
+
});
|
|
252
245
|
}
|
|
253
246
|
);
|
|
254
247
|
}
|
|
@@ -258,7 +251,7 @@ export class Modax extends RapidElement {
|
|
|
258
251
|
const form = this.shadowRoot.querySelector('form');
|
|
259
252
|
const postData = form ? serialize(form) : {};
|
|
260
253
|
|
|
261
|
-
|
|
254
|
+
postUrl(
|
|
262
255
|
this.endpoint,
|
|
263
256
|
postData,
|
|
264
257
|
this.getHeaders(),
|
|
@@ -277,10 +270,10 @@ export class Modax extends RapidElement {
|
|
|
277
270
|
|
|
278
271
|
if (redirect) {
|
|
279
272
|
if (redirect === 'hide') {
|
|
280
|
-
|
|
273
|
+
this.updateComplete.then(()=>{
|
|
281
274
|
this.open = false;
|
|
282
275
|
this.fireCustomEvent(CustomEventType.Submitted);
|
|
283
|
-
}
|
|
276
|
+
});
|
|
284
277
|
} else {
|
|
285
278
|
this.fireCustomEvent(CustomEventType.Redirected, {
|
|
286
279
|
url: redirect,
|
package/src/dropdown/Dropdown.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css, html, PropertyValueMap, TemplateResult } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { ContactField, CustomEventType } from '../interfaces';
|
|
4
4
|
|
|
5
5
|
import { SortableList } from '../list/SortableList';
|
package/src/label/Label.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement, TemplateResult, html, css } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { getClasses } from '../utils';
|
|
4
|
-
import { styleMap } from 'lit-html/directives/style-map';
|
|
4
|
+
import { styleMap } from 'lit-html/directives/style-map.js';
|
|
5
5
|
|
|
6
6
|
export default class Label extends LitElement {
|
|
7
7
|
static get styles() {
|