@nyaruka/temba-components 0.133.0 → 0.134.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/CHANGELOG.md +17 -0
- package/demo/components/webchat/example.html +1 -1
- package/dist/locales/es.js +5 -5
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.js +5 -5
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/locale-codes.js +2 -11
- package/dist/locales/locale-codes.js.map +1 -1
- package/dist/locales/pt.js +5 -5
- package/dist/locales/pt.js.map +1 -1
- package/dist/temba-components.js +307 -259
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/display/Chat.js +223 -90
- package/out-tsc/src/display/Chat.js.map +1 -1
- package/out-tsc/src/display/TembaUser.js +3 -3
- package/out-tsc/src/display/TembaUser.js.map +1 -1
- package/out-tsc/src/events.js.map +1 -1
- package/out-tsc/src/flow/CanvasNode.js +8 -0
- package/out-tsc/src/flow/CanvasNode.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +117 -28
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/utils.js +141 -0
- package/out-tsc/src/flow/utils.js.map +1 -1
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/live/ContactChat.js +122 -170
- package/out-tsc/src/live/ContactChat.js.map +1 -1
- package/out-tsc/src/locales/es.js +5 -5
- package/out-tsc/src/locales/es.js.map +1 -1
- package/out-tsc/src/locales/fr.js +5 -5
- package/out-tsc/src/locales/fr.js.map +1 -1
- package/out-tsc/src/locales/locale-codes.js +2 -11
- package/out-tsc/src/locales/locale-codes.js.map +1 -1
- package/out-tsc/src/locales/pt.js +5 -5
- package/out-tsc/src/locales/pt.js.map +1 -1
- package/out-tsc/src/store/AppState.js +3 -0
- package/out-tsc/src/store/AppState.js.map +1 -1
- package/out-tsc/src/store/Store.js +5 -5
- package/out-tsc/src/store/Store.js.map +1 -1
- package/out-tsc/src/webchat/WebChat.js +22 -9
- package/out-tsc/src/webchat/WebChat.js.map +1 -1
- package/out-tsc/test/actions/send_broadcast.test.js +9 -4
- package/out-tsc/test/actions/send_broadcast.test.js.map +1 -1
- package/out-tsc/test/temba-flow-collision.test.js +673 -0
- package/out-tsc/test/temba-flow-collision.test.js.map +1 -0
- package/out-tsc/test/temba-flow-editor-node.test.js +128 -42
- package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/contacts/chat-failure.png +0 -0
- package/screenshots/truth/contacts/chat-for-archived-contact.png +0 -0
- package/screenshots/truth/contacts/chat-for-blocked-contact.png +0 -0
- package/screenshots/truth/contacts/chat-for-stopped-contact.png +0 -0
- package/screenshots/truth/contacts/chat-sends-attachments-only.png +0 -0
- package/screenshots/truth/contacts/chat-sends-text-and-attachments.png +0 -0
- package/screenshots/truth/contacts/chat-sends-text-only.png +0 -0
- package/src/display/Chat.ts +303 -129
- package/src/display/TembaUser.ts +3 -2
- package/src/events.ts +11 -8
- package/src/flow/CanvasNode.ts +10 -0
- package/src/flow/Editor.ts +156 -28
- package/src/flow/utils.ts +207 -1
- package/src/interfaces.ts +7 -0
- package/src/live/ContactChat.ts +129 -180
- package/src/locales/es.ts +13 -18
- package/src/locales/fr.ts +13 -18
- package/src/locales/locale-codes.ts +2 -11
- package/src/locales/pt.ts +13 -18
- package/src/store/AppState.ts +2 -0
- package/src/store/Store.ts +5 -5
- package/src/webchat/WebChat.ts +24 -10
- package/test/actions/send_broadcast.test.ts +2 -1
- package/test/temba-flow-collision.test.ts +833 -0
- package/test/temba-flow-editor-node.test.ts +142 -47
package/src/webchat/WebChat.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-this-alias */
|
|
2
2
|
import { LitElement, TemplateResult, html, css, PropertyValueMap } from 'lit';
|
|
3
3
|
import { property } from 'lit/decorators.js';
|
|
4
|
-
import { getCookie, setCookie } from '../utils';
|
|
4
|
+
import { generateUUIDv7, getCookie, setCookie } from '../utils';
|
|
5
5
|
import { DEFAULT_AVATAR } from './assets';
|
|
6
|
-
import { Chat,
|
|
6
|
+
import { Chat, MsgEvent } from '../display/Chat';
|
|
7
7
|
|
|
8
8
|
interface User {
|
|
9
9
|
avatar?: string;
|
|
@@ -83,17 +83,24 @@ enum ChatStatus {
|
|
|
83
83
|
CONNECTED = 'connected'
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const sockToChat = function (msg: any):
|
|
87
|
-
const type = msg.msg_in ?
|
|
86
|
+
const sockToChat = function (msg: any): MsgEvent {
|
|
87
|
+
const type = msg.msg_in ? 'msg_created' : 'msg_received';
|
|
88
88
|
const msgContent = msg.msg_in || msg.msg_out;
|
|
89
89
|
|
|
90
90
|
return {
|
|
91
|
-
|
|
91
|
+
uuid: msgContent.id,
|
|
92
92
|
type,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
created_on: new Date(msgContent.time),
|
|
94
|
+
_user: msgContent.user,
|
|
95
|
+
msg: {
|
|
96
|
+
text: msgContent.text,
|
|
97
|
+
channel: undefined,
|
|
98
|
+
quick_replies: [],
|
|
99
|
+
urn: '',
|
|
100
|
+
direction: '',
|
|
101
|
+
type: '',
|
|
102
|
+
attachments: msgContent.attachments
|
|
103
|
+
}
|
|
97
104
|
};
|
|
98
105
|
};
|
|
99
106
|
|
|
@@ -570,7 +577,14 @@ export class WebChat extends LitElement {
|
|
|
570
577
|
const date = new Date();
|
|
571
578
|
|
|
572
579
|
this.chat.addMessages(
|
|
573
|
-
[
|
|
580
|
+
[
|
|
581
|
+
{
|
|
582
|
+
uuid: generateUUIDv7(),
|
|
583
|
+
type: 'msg_received',
|
|
584
|
+
msg: { text },
|
|
585
|
+
created_on: date
|
|
586
|
+
} as MsgEvent
|
|
587
|
+
],
|
|
574
588
|
date,
|
|
575
589
|
true
|
|
576
590
|
);
|
|
@@ -68,6 +68,7 @@ describe('send_broadcast action config', () => {
|
|
|
68
68
|
'multiline-text'
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
+
/* TODO: flaky test having to do with attachment render times
|
|
71
72
|
helper.testAction(
|
|
72
73
|
{
|
|
73
74
|
uuid: 'test-action-5',
|
|
@@ -82,7 +83,7 @@ describe('send_broadcast action config', () => {
|
|
|
82
83
|
} as SendBroadcast,
|
|
83
84
|
'with-attachments',
|
|
84
85
|
true
|
|
85
|
-
)
|
|
86
|
+
);*/
|
|
86
87
|
|
|
87
88
|
helper.testAction(
|
|
88
89
|
{
|