@subiz/widget-v4 4.1.114 → 4.1.116
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/assets/less/chatbox.less +1 -1
- package/assets/less/message.less +66 -18
- package/assets/less/order.less +1 -1
- package/assets/less/widget.less +1 -1
- package/assets/less/widget_header.less +2 -2
- package/compiled_src/chatbox/Event.js +40 -5
- package/compiled_src/chatbox/InfoMessage.js +1 -0
- package/compiled_src/chatbox/PoweredBy.js +1 -0
- package/compiled_src/chatbox/TextMessage.js +10 -4
- package/compiled_src/chatbox/Widget.js +16 -11
- package/compiled_src/lib.js +3 -0
- package/compiled_src/store/store.js +10 -0
- package/package.json +2 -2
- package/src/chatbox/Event.js +43 -2
- package/src/chatbox/InfoMessage.js +3 -0
- package/src/chatbox/PoweredBy.js +2 -0
- package/src/chatbox/TextMessage.js +15 -5
- package/src/chatbox/Widget.js +10 -3
- package/src/lib.js +4 -0
- package/src/store/store.js +13 -0
package/assets/less/chatbox.less
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
@font-family-sans-serif: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial,
|
|
38
38
|
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
|
39
39
|
|
|
40
|
-
@font-size-base:
|
|
40
|
+
@font-size-base: 16px; // Assumes the browser default, typically `16px`
|
|
41
41
|
|
|
42
42
|
@text-muted: #6c757d;
|
|
43
43
|
|
package/assets/less/message.less
CHANGED
|
@@ -100,18 +100,24 @@
|
|
|
100
100
|
.message-text--user {
|
|
101
101
|
margin: 5px 0 0;
|
|
102
102
|
display: inline-block;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
font-weight: 500;
|
|
104
|
+
|
|
105
|
+
background-color: @primary-color;
|
|
106
|
+
.color(@text-color);
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
padding: 12px 16px 12px 16px;
|
|
106
110
|
//padding: 12px;
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
.message-text--agent {
|
|
110
114
|
white-space: pre-wrap;
|
|
111
115
|
display: inline-block;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
|
|
117
|
+
background-color: @gray-200;
|
|
118
|
+
.color(@black);
|
|
119
|
+
|
|
120
|
+
padding: 12px 16px 12px 16px;
|
|
115
121
|
}
|
|
116
122
|
.message-agent.message-text--agent {
|
|
117
123
|
max-width: unset;
|
|
@@ -142,7 +148,8 @@
|
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
.message-user {
|
|
145
|
-
border-radius:
|
|
151
|
+
border-radius: 18px;
|
|
152
|
+
border-bottom-right-radius: 4px;
|
|
146
153
|
max-width: 85%;
|
|
147
154
|
align-self: flex-end;
|
|
148
155
|
word-break: break-word;
|
|
@@ -161,7 +168,8 @@
|
|
|
161
168
|
}
|
|
162
169
|
|
|
163
170
|
.message-agent {
|
|
164
|
-
border-radius:
|
|
171
|
+
border-radius: 18px;
|
|
172
|
+
border-bottom-left-radius: 4px;
|
|
165
173
|
max-width: 85%;
|
|
166
174
|
word-break: break-word;
|
|
167
175
|
position: relative;
|
|
@@ -342,7 +350,7 @@ a.message_error {
|
|
|
342
350
|
border-radius: 7px;
|
|
343
351
|
padding: 10px;
|
|
344
352
|
text-align: center;
|
|
345
|
-
font-size:
|
|
353
|
+
font-size: 16px;
|
|
346
354
|
&:hover {
|
|
347
355
|
.color(@text-color);
|
|
348
356
|
}
|
|
@@ -758,6 +766,7 @@ a.product_attachment__title {
|
|
|
758
766
|
.message-event-actions {
|
|
759
767
|
position: absolute;
|
|
760
768
|
bottom: -18px;
|
|
769
|
+
margin-top: 4px;
|
|
761
770
|
left: calc(100% - 40px);
|
|
762
771
|
display: none;
|
|
763
772
|
border: 1px solid #dee2e6;
|
|
@@ -788,10 +797,37 @@ a.product_attachment__title {
|
|
|
788
797
|
background-size: 20px 20px;
|
|
789
798
|
}
|
|
790
799
|
}
|
|
800
|
+
|
|
801
|
+
.message-event-action-btn.message-event-action-btn__dev {
|
|
802
|
+
.color(@gray-600);
|
|
803
|
+
padding-right: 10px;
|
|
804
|
+
border-radius: 5px;
|
|
805
|
+
.message-event-action-btn-svg {
|
|
806
|
+
width: 24px;
|
|
807
|
+
height: 24px;
|
|
808
|
+
background-position: 2px 2px;
|
|
809
|
+
background-size: 20px 20px;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
.message-event-action-btn.message-event-action-btn__dev:hover {
|
|
814
|
+
.color(@black);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
.message-event-action-btn.message-event-action-btn__dev.message-event-action-btn_like.active {
|
|
818
|
+
.color(#34c759);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
.message-event-action-btn.message-event-action-btn__dev.message-event-action-btn_like.active {
|
|
822
|
+
.color(#34c759);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
.message-event-action-btn.message-event-action-btn__dev:hover {
|
|
827
|
+
background-color: unset;
|
|
791
828
|
}
|
|
792
829
|
|
|
793
830
|
.message-event-action-btn {
|
|
794
|
-
width: 24px;
|
|
795
831
|
height: 24px;
|
|
796
832
|
display: flex;
|
|
797
833
|
align-items: center;
|
|
@@ -800,18 +836,30 @@ a.product_attachment__title {
|
|
|
800
836
|
padding: 2px;
|
|
801
837
|
|
|
802
838
|
&:hover {
|
|
839
|
+
background-color: #ececec;
|
|
803
840
|
.message-event-action-btn-svg {
|
|
804
|
-
background-color: #ececec;
|
|
805
841
|
}
|
|
806
842
|
}
|
|
807
843
|
|
|
808
844
|
&.active:hover {
|
|
845
|
+
background-color: #dbfde3;
|
|
809
846
|
.message-event-action-btn-svg {
|
|
810
|
-
background-color: #dbfde3;
|
|
811
847
|
}
|
|
812
848
|
}
|
|
813
849
|
}
|
|
814
850
|
|
|
851
|
+
.message-event-action-btn.message-event-action-btn__dev {
|
|
852
|
+
padding: 0px;
|
|
853
|
+
|
|
854
|
+
&:hover {
|
|
855
|
+
background-color: unset;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
&.active:hover {
|
|
859
|
+
background-color: unset;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
815
863
|
.message-event-action-btn .message-event-action-btn-svg {
|
|
816
864
|
width: 20px;
|
|
817
865
|
height: 20px;
|
|
@@ -823,20 +871,20 @@ a.product_attachment__title {
|
|
|
823
871
|
}
|
|
824
872
|
|
|
825
873
|
.message-event-action-btn-svg.like {
|
|
826
|
-
background-image: url('data:image/svg+xml;base64,
|
|
874
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgd2lkdGg9IjI0IiAgaGVpZ2h0PSIyNCIgIHZpZXdCb3g9IjAgMCAyNCAyNCIgIGZpbGw9Im5vbmUiICBzdHJva2U9IiM2Yzc1N2QiICBzdHJva2Utd2lkdGg9IjIiICBzdHJva2UtbGluZWNhcD0icm91bmQiICBzdHJva2UtbGluZWpvaW49InJvdW5kIiAgY2xhc3M9Imljb24gaWNvbi10YWJsZXIgaWNvbnMtdGFibGVyLW91dGxpbmUgaWNvbi10YWJsZXItdGh1bWItdXAiPjxwYXRoIHN0cm9rZT0ibm9uZSIgZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjxwYXRoIGQ9Ik03IDExdjhhMSAxIDAgMCAxIC0xIDFoLTJhMSAxIDAgMCAxIC0xIC0xdi03YTEgMSAwIDAgMSAxIC0xaDNhNCA0IDAgMCAwIDQgLTR2LTFhMiAyIDAgMCAxIDQgMHY1aDNhMiAyIDAgMCAxIDIgMmwtMSA1YTIgMyAwIDAgMSAtMiAyaC03YTMgMyAwIDAgMSAtMyAtMyIgLz48L3N2Zz4K');
|
|
827
875
|
}
|
|
828
876
|
.message-event-action-btn-svg.dislike {
|
|
829
|
-
background-image: url('data:image/svg+xml;base64,
|
|
877
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgd2lkdGg9IjI0IiAgaGVpZ2h0PSIyNCIgIHZpZXdCb3g9IjAgMCAyNCAyNCIgIGZpbGw9Im5vbmUiICBzdHJva2U9IiM2Yzc1N2QiICBzdHJva2Utd2lkdGg9IjIiICBzdHJva2UtbGluZWNhcD0icm91bmQiICBzdHJva2UtbGluZWpvaW49InJvdW5kIiAgY2xhc3M9Imljb24gaWNvbi10YWJsZXIgaWNvbnMtdGFibGVyLW91dGxpbmUgaWNvbi10YWJsZXItdGh1bWItZG93biI+PHBhdGggc3Ryb2tlPSJub25lIiBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTcgMTN2LThhMSAxIDAgMCAwIC0xIC0xaC0yYTEgMSAwIDAgMCAtMSAxdjdhMSAxIDAgMCAwIDEgMWgzYTQgNCAwIDAgMSA0IDR2MWEyIDIgMCAwIDAgNCAwdi01aDNhMiAyIDAgMCAwIDIgLTJsLTEgLTVhMiAzIDAgMCAwIC0yIC0yaC03YTMgMyAwIDAgMCAtMyAzIiAvPjwvc3ZnPgo=');
|
|
830
878
|
}
|
|
831
879
|
.message-event-action-btn:hover .message-event-action-btn-svg.like {
|
|
832
|
-
background-image: url('data:image/svg+xml;base64,
|
|
880
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgd2lkdGg9IjI0IiAgaGVpZ2h0PSIyNCIgIHZpZXdCb3g9IjAgMCAyNCAyNCIgIGZpbGw9Im5vbmUiICBzdHJva2U9ImJsYWNrIiAgc3Ryb2tlLXdpZHRoPSIyIiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgIGNsYXNzPSJpY29uIGljb24tdGFibGVyIGljb25zLXRhYmxlci1vdXRsaW5lIGljb24tdGFibGVyLXRodW1iLXVwIj48cGF0aCBzdHJva2U9Im5vbmUiIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz48cGF0aCBkPSJNNyAxMXY4YTEgMSAwIDAgMSAtMSAxaC0yYTEgMSAwIDAgMSAtMSAtMXYtN2ExIDEgMCAwIDEgMSAtMWgzYTQgNCAwIDAgMCA0IC00di0xYTIgMiAwIDAgMSA0IDB2NWgzYTIgMiAwIDAgMSAyIDJsLTEgNWEyIDMgMCAwIDEgLTIgMmgtN2EzIDMgMCAwIDEgLTMgLTMiIC8+PC9zdmc+Cg==');
|
|
833
881
|
}
|
|
834
882
|
.message-event-action-btn:hover .message-event-action-btn-svg.dislike {
|
|
835
|
-
background-image: url('data:image/svg+xml;base64,
|
|
883
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgd2lkdGg9IjI0IiAgaGVpZ2h0PSIyNCIgIHZpZXdCb3g9IjAgMCAyNCAyNCIgIGZpbGw9Im5vbmUiICBzdHJva2U9ImJsYWNrIiAgc3Ryb2tlLXdpZHRoPSIyIiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgIGNsYXNzPSJpY29uIGljb24tdGFibGVyIGljb25zLXRhYmxlci1vdXRsaW5lIGljb24tdGFibGVyLXRodW1iLWRvd24iPjxwYXRoIHN0cm9rZT0ibm9uZSIgZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjxwYXRoIGQ9Ik03IDEzdi04YTEgMSAwIDAgMCAtMSAtMWgtMmExIDEgMCAwIDAgLTEgMXY3YTEgMSAwIDAgMCAxIDFoM2E0IDQgMCAwIDEgNCA0djFhMiAyIDAgMCAwIDQgMHYtNWgzYTIgMiAwIDAgMCAyIC0ybC0xIC01YTIgMyAwIDAgMCAtMiAtMmgtN2EzIDMgMCAwIDAgLTMgMyIgLz48L3N2Zz4K');
|
|
836
884
|
}
|
|
837
885
|
.message-event-action-btn.active .message-event-action-btn-svg.like {
|
|
838
|
-
background-image: url('data:image/svg+xml;base64,
|
|
886
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgd2lkdGg9IjI0IiAgaGVpZ2h0PSIyNCIgIHZpZXdCb3g9IjAgMCAyNCAyNCIgIGZpbGw9IiMzNEM3NTkiICBjbGFzcz0iaWNvbiBpY29uLXRhYmxlciBpY29ucy10YWJsZXItZmlsbGVkIGljb24tdGFibGVyLXRodW1iLXVwIj48cGF0aCBzdHJva2U9Im5vbmUiIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz48cGF0aCBkPSJNMTMgM2EzIDMgMCAwIDEgMi45OTUgMi44MjRsLjAwNSAuMTc2djRoMmEzIDMgMCAwIDEgMi45OCAyLjY1bC4wMTUgLjE3NGwuMDA1IC4xNzZsLS4wMiAuMTk2bC0xLjAwNiA1LjAzMmMtLjM4MSAxLjYyNiAtMS41MDIgMi43OTYgLTIuODEgMi43OGwtLjE2NCAtLjAwOGgtOGExIDEgMCAwIDEgLS45OTMgLS44ODNsLS4wMDcgLS4xMTdsLjAwMSAtOS41MzZhMSAxIDAgMCAxIC41IC0uODY1YTIuOTk4IDIuOTk4IDAgMCAwIDEuNDkyIC0yLjM5N2wuMDA3IC0uMjAydi0xYTMgMyAwIDAgMSAzIC0zeiIgLz48cGF0aCBkPSJNNSAxMGExIDEgMCAwIDEgLjk5MyAuODgzbC4wMDcgLjExN3Y5YTEgMSAwIDAgMSAtLjg4MyAuOTkzbC0uMTE3IC4wMDdoLTFhMiAyIDAgMCAxIC0xLjk5NSAtMS44NWwtLjAwNSAtLjE1di03YTIgMiAwIDAgMSAxLjg1IC0xLjk5NWwuMTUgLS4wMDVoMXoiIC8+PC9zdmc+Cg==');
|
|
839
887
|
}
|
|
840
888
|
.message-event-action-btn.active .message-event-action-btn-svg.dislike {
|
|
841
|
-
background-image: url('data:image/svg+xml;base64,
|
|
889
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzI0ODBfOTUpIj4KPHBhdGggZD0iTTEzIDIxLjAwNzlDMTMuNzY1IDIxLjAwOCAxNC41MDEyIDIwLjcxNTcgMTUuMDU3OSAyMC4xOTFDMTUuNjE0NyAxOS42NjYyIDE1Ljk0OTkgMTguOTQ4NiAxNS45OTUgMTguMTg0OUwxNiAxOC4wMDc5VjE0LjAwNzlIMThDMTguNzM1MSAxNC4wMDggMTkuNDQ0NyAxMy43MzgyIDE5Ljk5NCAxMy4yNDk3QzIwLjU0MzQgMTIuNzYxMiAyMC44OTQyIDEyLjA4OCAyMC45OCAxMS4zNTc5TDIwLjk5NSAxMS4xODQ5TDIxIDExLjAwNzlMMjAuOTggMTAuODExOUwxOS45NzQgNS43Nzk5MkMxOS41OTMgNC4xNTQ5MiAxOC40NzIgMi45ODM5MiAxNy4xNjQgMi45OTk5MkwxNyAzLjAwNzkySDlDOC43NTQ5MSAzLjAwNzk4IDguNTE4MzggMy4wOTgwNCA4LjMzNTMzIDMuMjYxMDFDOC4xNTIyNyAzLjQyMzk3IDguMDM1NDMgMy42NDg0OSA4LjAwNyAzLjg5MTkyTDggNC4wMDc5Mkw4LjAwMSAxMy41NDM5QzguMDAxIDEzLjcxOTUgOC4wNDcyMSAxMy44OTE5IDguMTM0OTggMTQuMDQzOUM4LjIyMjc1IDE0LjE5NTkgOC4zNDg5OCAxNC4zMjIyIDguNTAxIDE0LjQwOTlDOC45MjcyOSAxNC42NTYxIDkuMjg2NCAxNS4wMDM1IDkuNTQ2NjEgMTUuNDIxM0M5LjgwNjgyIDE1LjgzOTIgOS45NjAxMyAxNi4zMTQ3IDkuOTkzIDE2LjgwNTlMMTAgMTcuMDA3OVYxOC4wMDc5QzEwIDE4LjgwMzYgMTAuMzE2MSAxOS41NjY2IDEwLjg3ODcgMjAuMTI5MkMxMS40NDEzIDIwLjY5MTggMTIuMjA0NCAyMS4wMDc5IDEzIDIxLjAwNzlaIiBmaWxsPSIjMzMzMzMzIi8+CjxwYXRoIGQ9Ik01IDE0LjAwODFDNS4yNDQ5MyAxNC4wMDggNS40ODEzNCAxMy45MTgxIDUuNjY0MzcgMTMuNzU1M0M1Ljg0NzQxIDEzLjU5MjYgNS45NjQzNCAxMy4zNjgzIDUuOTkzIDEzLjEyNTFMNiAxMy4wMDgxVjQuMDA4MDZDNS45OTk5NyAzLjc2MzEyIDUuOTEwMDQgMy41MjY3MiA1Ljc0NzI4IDMuMzQzNjhDNS41ODQ1MyAzLjE2MDY1IDUuMzYwMjUgMy4wNDM3MSA1LjExNyAzLjAxNTA2TDUgMy4wMDgwNkg0QzMuNDk1MSAzLjAwNzkzIDMuMDA4ODQgMy4xOTg3OCAyLjYzODgxIDMuNTQyMjlDMi4yNjg3OCAzLjg4NTc5IDIuMDQyMzYgNC4zNTY1NCAyLjAwNSA0Ljg2MDA2TDIgNS4wMTAwNlYxMi4wMTAxQzIuMDAwMDkgMTIuNTE0NSAyLjE5MDc3IDEzLjAwMDIgMi41MzM4NCAxMy4zN0MyLjg3NjkgMTMuNzM5NyAzLjM0NzAyIDEzLjk2NjIgMy44NSAxNC4wMDQxTDQgMTQuMDA5MUw1IDE0LjAwODFaIiBmaWxsPSIjMzMzMzMzIi8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iY2xpcDBfMjQ4MF85NSI+CjxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0id2hpdGUiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K');
|
|
842
890
|
}
|
package/assets/less/order.less
CHANGED
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
margin-top: 0px;
|
|
130
130
|
background: #f4f4f4;
|
|
131
131
|
margin-top: 20px;
|
|
132
|
-
width:
|
|
132
|
+
width: 270px;
|
|
133
133
|
box-shadow: 0 0 0 1px hsl(0deg 0% 69% / 20%), 0 15px 35px 0 rgb(49 49 93 / 8%), 0 5px 15px 0 rgb(0 0 0 / 6%);
|
|
134
134
|
border-radius: 6px;
|
|
135
135
|
background-color: #fff;
|
package/assets/less/widget.less
CHANGED
|
@@ -163,6 +163,7 @@ class Event extends _common.Com {
|
|
|
163
163
|
t: this.props.t
|
|
164
164
|
}));
|
|
165
165
|
}
|
|
166
|
+
if (this.props.store.isAIDevMode()) $time = null;
|
|
166
167
|
let t = new _index.default.Date(ev.created).toLocaleString();
|
|
167
168
|
if (_index.default.get(ev, 'by.type') !== 'user') {
|
|
168
169
|
let $sender = null;
|
|
@@ -170,8 +171,7 @@ class Event extends _common.Com {
|
|
|
170
171
|
let innercls = 'agent-convo-event-inner';
|
|
171
172
|
if (this.props.isLast) innercls += ' last';
|
|
172
173
|
return (0, _preact.h)("div", {
|
|
173
|
-
class: "convo-event agent-message"
|
|
174
|
-
title: t
|
|
174
|
+
class: "convo-event agent-message"
|
|
175
175
|
}, $time, $sender, (0, _preact.h)("div", {
|
|
176
176
|
class: "agent-convo-event-wrapper"
|
|
177
177
|
}, (0, _preact.h)("div", {
|
|
@@ -224,7 +224,7 @@ class Event extends _common.Com {
|
|
|
224
224
|
store: this.props.store,
|
|
225
225
|
ev: ev,
|
|
226
226
|
onSelect: e => this.chooseQuickReply(e)
|
|
227
|
-
}), this.renderReactions())));
|
|
227
|
+
}), this.renderReactions(), this.renderAIDevNote())));
|
|
228
228
|
}
|
|
229
229
|
if (_index.default.get(ev, 'data.message.idempotency_key') === ev.id && this.props.store.now() - ev.created < 900) {
|
|
230
230
|
_index.default.setTimeout(() => this.setState({
|
|
@@ -258,8 +258,7 @@ class Event extends _common.Com {
|
|
|
258
258
|
}));
|
|
259
259
|
}
|
|
260
260
|
return (0, _preact.h)("div", {
|
|
261
|
-
class: "convo-event user-message"
|
|
262
|
-
title: t
|
|
261
|
+
class: "convo-event user-message"
|
|
263
262
|
}, $time, $sender, (0, _preact.h)("div", {
|
|
264
263
|
class: "message-user__container"
|
|
265
264
|
}, $dot, (0, _preact.h)(_TextMessage.default, {
|
|
@@ -313,6 +312,16 @@ class Event extends _common.Com {
|
|
|
313
312
|
}
|
|
314
313
|
}
|
|
315
314
|
};
|
|
315
|
+
if (action == 'dislike' && this.props.store.isAIDevMode()) {
|
|
316
|
+
this.props.store.emitConvoEvent({
|
|
317
|
+
type: 'bad_feedbacked',
|
|
318
|
+
data: {
|
|
319
|
+
event: ev,
|
|
320
|
+
id: ev.id,
|
|
321
|
+
conversion_id: cid
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
316
325
|
let {
|
|
317
326
|
pongs
|
|
318
327
|
} = this.state;
|
|
@@ -339,6 +348,7 @@ class Event extends _common.Com {
|
|
|
339
348
|
this._reacting = false;
|
|
340
349
|
}
|
|
341
350
|
renderReactions() {
|
|
351
|
+
if (this.props.store.isAIDevMode()) return null;
|
|
342
352
|
let ev = _index.default.get(this.props.event, 'ev') || {};
|
|
343
353
|
let pongs = _index.default.get(ev, 'data.message.pongs') || [];
|
|
344
354
|
let hasLike = this.hasLike();
|
|
@@ -361,6 +371,31 @@ class Event extends _common.Com {
|
|
|
361
371
|
class: "message-event-action-btn-svg dislike"
|
|
362
372
|
})));
|
|
363
373
|
}
|
|
374
|
+
renderAIDevNote() {
|
|
375
|
+
if (!this.props.isLast) return null;
|
|
376
|
+
if (!this.props.store.isAIDevMode()) return null;
|
|
377
|
+
let ev = _index.default.get(this.props.event, 'ev') || {};
|
|
378
|
+
let pongs = _index.default.get(ev, 'data.message.pongs') || [];
|
|
379
|
+
let hasLike = this.hasLike();
|
|
380
|
+
let hasDislike = this.hasDislike();
|
|
381
|
+
let likecls = 'message-event-action-btn message-event-action-btn__dev message-event-action-btn_like';
|
|
382
|
+
if (hasLike) likecls += ' active';
|
|
383
|
+
let dislikecls = 'message-event-action-btn message-event-action-btn__dev message-event-action-btn_dislike';
|
|
384
|
+
if (hasDislike) dislikecls += ' active';
|
|
385
|
+
return (0, _preact.h)("div", {
|
|
386
|
+
class: "message-event-actions"
|
|
387
|
+
}, (0, _preact.h)("div", {
|
|
388
|
+
class: likecls,
|
|
389
|
+
onClick: () => this.onSendReaction(hasLike ? 'remove_like' : 'like')
|
|
390
|
+
}, (0, _preact.h)("div", {
|
|
391
|
+
class: "message-event-action-btn-svg like"
|
|
392
|
+
}), " Good"), (0, _preact.h)("div", {
|
|
393
|
+
class: dislikecls,
|
|
394
|
+
onClick: () => this.onSendReaction(hasDislike ? 'remove_dislike' : 'dislike')
|
|
395
|
+
}, (0, _preact.h)("div", {
|
|
396
|
+
class: "message-event-action-btn-svg dislike"
|
|
397
|
+
}), " Bad"));
|
|
398
|
+
}
|
|
364
399
|
renderUpdateConvo(ev) {
|
|
365
400
|
var state = _index.default.get(ev, 'data.conversation.state');
|
|
366
401
|
if (state === 'active') return null;
|
|
@@ -8,6 +8,7 @@ var _preact = require("preact");
|
|
|
8
8
|
var logo = require('../../assets/img/subiz-mono.svg');
|
|
9
9
|
function PoweredBy(props) {
|
|
10
10
|
if (props.store.isMobile()) return null;
|
|
11
|
+
if (props.store.isAIDevMode()) return null;
|
|
11
12
|
let user = props.store.matchUser() || {};
|
|
12
13
|
var link = `https://subiz.com.vn/?utm_source=${window.location.host || `id-${user.account_id}`}&utm_medium=widget&utm_campaign=widget_referral`;
|
|
13
14
|
return (0, _preact.h)("div", {
|
|
@@ -21,6 +21,7 @@ class TextMessage extends _common.Com {
|
|
|
21
21
|
var text = _index.default.get(this.props.ev, 'data.message.text');
|
|
22
22
|
text = _index.default.trim(text);
|
|
23
23
|
if (_index.default.size(text) === 0) return null;
|
|
24
|
+
let t = new _index.default.Date(_index.default.get(this.props.ev, 'created')).toLocaleString();
|
|
24
25
|
let byType = _index.default.get(this.props.ev, 'by.type');
|
|
25
26
|
if (byType !== 'user') byType = 'agent';
|
|
26
27
|
var tags = _index.default.extractText(text).map(tag => {
|
|
@@ -49,26 +50,31 @@ class TextMessage extends _common.Com {
|
|
|
49
50
|
});
|
|
50
51
|
if (_index.default.size(tags) === 0) return null;
|
|
51
52
|
if (byType === 'agent') return (0, _preact.h)("div", {
|
|
52
|
-
class: "message-agent message-text--agent"
|
|
53
|
+
class: "message-agent message-text--agent",
|
|
54
|
+
title: t
|
|
53
55
|
}, tags);
|
|
54
56
|
return (0, _preact.h)("div", {
|
|
55
|
-
class: "message-user message-text--user"
|
|
57
|
+
class: "message-user message-text--user",
|
|
58
|
+
title: t
|
|
56
59
|
}, tags);
|
|
57
60
|
}
|
|
58
61
|
renderBlock(block) {
|
|
59
62
|
if (isEmptyBlock(block)) return null;
|
|
63
|
+
let t = new _index.default.Date(_index.default.get(this.props.ev, 'created')).toLocaleString();
|
|
60
64
|
let byType = _index.default.get(this.props.ev, 'by.type');
|
|
61
65
|
if (byType !== 'user') byType = 'agent';
|
|
62
66
|
if (byType === 'agent') {
|
|
63
67
|
return (0, _preact.h)("div", {
|
|
64
|
-
class: "message-agent message-text--agent"
|
|
68
|
+
class: "message-agent message-text--agent",
|
|
69
|
+
title: t
|
|
65
70
|
}, (0, _preact.h)(_block.default, {
|
|
66
71
|
block: block,
|
|
67
72
|
onLink: this.props.onLink
|
|
68
73
|
}));
|
|
69
74
|
}
|
|
70
75
|
return (0, _preact.h)("div", {
|
|
71
|
-
class: "message-user message-text--user"
|
|
76
|
+
class: "message-user message-text--user",
|
|
77
|
+
title: t
|
|
72
78
|
}, (0, _preact.h)(_block.default, {
|
|
73
79
|
block: block,
|
|
74
80
|
onLink: this.props.onLink
|
|
@@ -201,19 +201,24 @@ class Widget extends _common.Com {
|
|
|
201
201
|
let cls = 'widget-container widget-container--' + position;
|
|
202
202
|
if (!this.props.store.isMobile() && _index.default.get(accountSetting, 'window_mode') === 'full') cls += ' widget-container--full';
|
|
203
203
|
if (!this.props.isShow) cls += ' widget-container--hide';
|
|
204
|
+
let hideheader = _index.default.get(accountSetting, 'header.hidden', false);
|
|
205
|
+
var $header;
|
|
206
|
+
if (!hideheader) {
|
|
207
|
+
$header = (0, _preact.h)(_Header.default, {
|
|
208
|
+
t: this.props.t,
|
|
209
|
+
plugin: this.props.plugin,
|
|
210
|
+
store: this.props.store,
|
|
211
|
+
cid: this.props.cid,
|
|
212
|
+
view: this.props.view,
|
|
213
|
+
onClose: this.props.onClose,
|
|
214
|
+
onGotoList: () => this.props.onGo({
|
|
215
|
+
view: 'list'
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
}
|
|
204
219
|
return (0, _preact.h)("div", {
|
|
205
220
|
class: cls
|
|
206
|
-
},
|
|
207
|
-
t: this.props.t,
|
|
208
|
-
plugin: this.props.plugin,
|
|
209
|
-
store: this.props.store,
|
|
210
|
-
cid: this.props.cid,
|
|
211
|
-
view: this.props.view,
|
|
212
|
-
onClose: this.props.onClose,
|
|
213
|
-
onGotoList: () => this.props.onGo({
|
|
214
|
-
view: 'list'
|
|
215
|
-
})
|
|
216
|
-
}), $body);
|
|
221
|
+
}, $header, $body);
|
|
217
222
|
}
|
|
218
223
|
async submitPrechatForm(form, formName) {
|
|
219
224
|
if (this.state.submiting) return;
|
package/compiled_src/lib.js
CHANGED
|
@@ -334,6 +334,15 @@ class Store {
|
|
|
334
334
|
highlight(pluginid, ref) {
|
|
335
335
|
this.pubsub.publish('highlight', pluginid, ref);
|
|
336
336
|
}
|
|
337
|
+
emitConvoEvent(ev) {
|
|
338
|
+
this.pubsub.publish('events', ev);
|
|
339
|
+
}
|
|
340
|
+
setAIDevMode(mode) {
|
|
341
|
+
this.ai_dev_mode = mode;
|
|
342
|
+
}
|
|
343
|
+
isAIDevMode() {
|
|
344
|
+
return this.ai_dev_mode;
|
|
345
|
+
}
|
|
337
346
|
overrideDeviceType(type) {
|
|
338
347
|
this.forceDevice = type;
|
|
339
348
|
this.pubsub.publish('account');
|
|
@@ -768,6 +777,7 @@ class Store {
|
|
|
768
777
|
this._typing(cid);
|
|
769
778
|
}
|
|
770
779
|
async startConvo(req) {
|
|
780
|
+
if (!req) req = {};
|
|
771
781
|
await this.readyGate.entry();
|
|
772
782
|
this.convoGate.close();
|
|
773
783
|
if (!req.source) req.source = document.location.href;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subiz/widget-v4",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.116",
|
|
4
4
|
"main": "./compiled_src/lib.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "npx webpack serve --config webpack.dev.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"babel-plugin-syntax-jsx": "^6.18.0",
|
|
32
32
|
"html-webpack-plugin": "^5.6.3",
|
|
33
33
|
"puppeteer": "^24.6.0",
|
|
34
|
-
"webpack": "^5.
|
|
34
|
+
"webpack": "^5.99.1",
|
|
35
35
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
36
36
|
"webpack-cli": "^6.0.1",
|
|
37
37
|
"webpack-dev-server": "^5.2.1"
|
package/src/chatbox/Event.js
CHANGED
|
@@ -160,6 +160,7 @@ export default class Event extends Com {
|
|
|
160
160
|
</div>
|
|
161
161
|
)
|
|
162
162
|
}
|
|
163
|
+
if (this.props.store.isAIDevMode()) $time = null
|
|
163
164
|
|
|
164
165
|
let t = new sb.Date(ev.created).toLocaleString()
|
|
165
166
|
// message of agent
|
|
@@ -169,7 +170,7 @@ export default class Event extends Com {
|
|
|
169
170
|
let innercls = 'agent-convo-event-inner'
|
|
170
171
|
if (this.props.isLast) innercls += ' last'
|
|
171
172
|
return (
|
|
172
|
-
<div class='convo-event agent-message'
|
|
173
|
+
<div class='convo-event agent-message'>
|
|
173
174
|
{$time}
|
|
174
175
|
{$sender}
|
|
175
176
|
<div class='agent-convo-event-wrapper'>
|
|
@@ -203,6 +204,7 @@ export default class Event extends Com {
|
|
|
203
204
|
<OrderAttachments t={this.props.t} store={this.props.store} ev={ev} />
|
|
204
205
|
<QuickReplies store={this.props.store} ev={ev} onSelect={(e) => this.chooseQuickReply(e)} />
|
|
205
206
|
{this.renderReactions()}
|
|
207
|
+
{this.renderAIDevNote()}
|
|
206
208
|
</div>
|
|
207
209
|
</div>
|
|
208
210
|
</div>
|
|
@@ -236,7 +238,7 @@ export default class Event extends Com {
|
|
|
236
238
|
}
|
|
237
239
|
|
|
238
240
|
return (
|
|
239
|
-
<div class='convo-event user-message'
|
|
241
|
+
<div class='convo-event user-message'>
|
|
240
242
|
{$time}
|
|
241
243
|
{$sender}
|
|
242
244
|
<div class='message-user__container'>
|
|
@@ -274,6 +276,17 @@ export default class Event extends Com {
|
|
|
274
276
|
},
|
|
275
277
|
},
|
|
276
278
|
}
|
|
279
|
+
if (action == 'dislike' && this.props.store.isAIDevMode()) {
|
|
280
|
+
this.props.store.emitConvoEvent({
|
|
281
|
+
type: 'bad_feedbacked',
|
|
282
|
+
data: {
|
|
283
|
+
event: ev,
|
|
284
|
+
id: ev.id,
|
|
285
|
+
conversion_id: cid,
|
|
286
|
+
},
|
|
287
|
+
})
|
|
288
|
+
}
|
|
289
|
+
|
|
277
290
|
let {pongs} = this.state
|
|
278
291
|
if (action === 'like') {
|
|
279
292
|
pongs = pongs.filter((pong) => pong.type !== 'dislike')
|
|
@@ -293,6 +306,8 @@ export default class Event extends Com {
|
|
|
293
306
|
}
|
|
294
307
|
|
|
295
308
|
renderReactions() {
|
|
309
|
+
if (this.props.store.isAIDevMode()) return null
|
|
310
|
+
|
|
296
311
|
let ev = sb.get(this.props.event, 'ev') || {}
|
|
297
312
|
let pongs = sb.get(ev, 'data.message.pongs') || []
|
|
298
313
|
let hasLike = this.hasLike()
|
|
@@ -314,6 +329,32 @@ export default class Event extends Com {
|
|
|
314
329
|
)
|
|
315
330
|
}
|
|
316
331
|
|
|
332
|
+
renderAIDevNote() {
|
|
333
|
+
if (!this.props.isLast) return null
|
|
334
|
+
if (!this.props.store.isAIDevMode()) return null
|
|
335
|
+
|
|
336
|
+
let ev = sb.get(this.props.event, 'ev') || {}
|
|
337
|
+
let pongs = sb.get(ev, 'data.message.pongs') || []
|
|
338
|
+
let hasLike = this.hasLike()
|
|
339
|
+
let hasDislike = this.hasDislike()
|
|
340
|
+
|
|
341
|
+
let likecls = 'message-event-action-btn message-event-action-btn__dev message-event-action-btn_like'
|
|
342
|
+
if (hasLike) likecls += ' active'
|
|
343
|
+
let dislikecls = 'message-event-action-btn message-event-action-btn__dev message-event-action-btn_dislike'
|
|
344
|
+
if (hasDislike) dislikecls += ' active'
|
|
345
|
+
|
|
346
|
+
return (
|
|
347
|
+
<div class='message-event-actions'>
|
|
348
|
+
<div class={likecls} onClick={() => this.onSendReaction(hasLike ? 'remove_like' : 'like')}>
|
|
349
|
+
<div class='message-event-action-btn-svg like' /> Good
|
|
350
|
+
</div>
|
|
351
|
+
<div class={dislikecls} onClick={() => this.onSendReaction(hasDislike ? 'remove_dislike' : 'dislike')}>
|
|
352
|
+
<div class='message-event-action-btn-svg dislike' /> Bad
|
|
353
|
+
</div>
|
|
354
|
+
</div>
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
|
|
317
358
|
renderUpdateConvo(ev) {
|
|
318
359
|
var state = sb.get(ev, 'data.conversation.state')
|
|
319
360
|
if (state === 'active') return null
|
|
@@ -15,6 +15,7 @@ export default class InfoMessage extends Com {
|
|
|
15
15
|
render() {
|
|
16
16
|
let ev = this.props.ev.ev
|
|
17
17
|
var $time = null
|
|
18
|
+
|
|
18
19
|
if (this.props.ev.show_time) {
|
|
19
20
|
$time = (
|
|
20
21
|
<div class='convo-event-time'>
|
|
@@ -23,6 +24,8 @@ export default class InfoMessage extends Com {
|
|
|
23
24
|
)
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
if (this.props.store.isAIDevMode()) $time = null
|
|
28
|
+
|
|
26
29
|
// if (this.ev.type === 'conversation_rating_requested') return <div class="info-message"></div>
|
|
27
30
|
if (ev.type === 'conversation_rated') {
|
|
28
31
|
var rating = sb.get(ev, 'data.conversation.ratings.0', {no_rating: true, rating: 0})
|
package/src/chatbox/PoweredBy.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
var logo = require('../../assets/img/subiz-mono.svg')
|
|
2
2
|
import {h} from 'preact'
|
|
3
|
+
|
|
3
4
|
export default function PoweredBy(props) {
|
|
4
5
|
// dont render on mobile
|
|
5
6
|
if (props.store.isMobile()) return null
|
|
7
|
+
if (props.store.isAIDevMode()) return null
|
|
6
8
|
let user = props.store.matchUser() || {}
|
|
7
9
|
var link = `https://subiz.com.vn/?utm_source=${
|
|
8
10
|
window.location.host || `id-${user.account_id}`
|
|
@@ -16,7 +16,7 @@ export default class TextMessage extends Com {
|
|
|
16
16
|
var text = sb.get(this.props.ev, 'data.message.text')
|
|
17
17
|
text = sb.trim(text)
|
|
18
18
|
if (sb.size(text) === 0) return null
|
|
19
|
-
|
|
19
|
+
let t = new sb.Date(sb.get(this.props.ev, 'created')).toLocaleString()
|
|
20
20
|
let byType = sb.get(this.props.ev, 'by.type')
|
|
21
21
|
if (byType !== 'user') byType = 'agent'
|
|
22
22
|
var tags = sb.extractText(text).map((tag) => {
|
|
@@ -44,23 +44,33 @@ export default class TextMessage extends Com {
|
|
|
44
44
|
})
|
|
45
45
|
|
|
46
46
|
if (sb.size(tags) === 0) return null
|
|
47
|
-
if (byType === 'agent')
|
|
48
|
-
|
|
47
|
+
if (byType === 'agent')
|
|
48
|
+
return (
|
|
49
|
+
<div class='message-agent message-text--agent' title={t}>
|
|
50
|
+
{tags}
|
|
51
|
+
</div>
|
|
52
|
+
)
|
|
53
|
+
return (
|
|
54
|
+
<div class='message-user message-text--user' title={t}>
|
|
55
|
+
{tags}
|
|
56
|
+
</div>
|
|
57
|
+
)
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
renderBlock(block) {
|
|
52
61
|
if (isEmptyBlock(block)) return null
|
|
62
|
+
let t = new sb.Date(sb.get(this.props.ev, 'created')).toLocaleString()
|
|
53
63
|
let byType = sb.get(this.props.ev, 'by.type')
|
|
54
64
|
if (byType !== 'user') byType = 'agent'
|
|
55
65
|
if (byType === 'agent') {
|
|
56
66
|
return (
|
|
57
|
-
<div class='message-agent message-text--agent'>
|
|
67
|
+
<div class='message-agent message-text--agent' title={t}>
|
|
58
68
|
<Block block={block} onLink={this.props.onLink} />
|
|
59
69
|
</div>
|
|
60
70
|
)
|
|
61
71
|
}
|
|
62
72
|
return (
|
|
63
|
-
<div class='message-user message-text--user'>
|
|
73
|
+
<div class='message-user message-text--user' title={t}>
|
|
64
74
|
<Block block={block} onLink={this.props.onLink} />
|
|
65
75
|
</div>
|
|
66
76
|
)
|
package/src/chatbox/Widget.js
CHANGED
|
@@ -130,11 +130,13 @@ export default class Widget extends Com {
|
|
|
130
130
|
let position = sb.get(accountSetting, 'desktop_button.position') || 'right'
|
|
131
131
|
if (this.props.store.isMobile()) position = sb.get(accountSetting, 'mobile_button.position', position)
|
|
132
132
|
let cls = 'widget-container widget-container--' + position
|
|
133
|
-
if (!this.props.store.isMobile() && sb.get(accountSetting, 'window_mode') === 'full')
|
|
133
|
+
if ( !this.props.store.isMobile() && sb.get(accountSetting, 'window_mode') === 'full')
|
|
134
134
|
cls += ' widget-container--full'
|
|
135
135
|
if (!this.props.isShow) cls += ' widget-container--hide'
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
let hideheader = sb.get(accountSetting, 'header.hidden', false)
|
|
137
|
+
var $header
|
|
138
|
+
if (!hideheader) {
|
|
139
|
+
$header = (
|
|
138
140
|
<Header
|
|
139
141
|
t={this.props.t}
|
|
140
142
|
plugin={this.props.plugin}
|
|
@@ -144,6 +146,11 @@ export default class Widget extends Com {
|
|
|
144
146
|
onClose={this.props.onClose}
|
|
145
147
|
onGotoList={() => this.props.onGo({view: 'list'})}
|
|
146
148
|
/>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
return (
|
|
152
|
+
<div class={cls}>
|
|
153
|
+
{$header}
|
|
147
154
|
{$body}
|
|
148
155
|
</div>
|
|
149
156
|
)
|
package/src/lib.js
CHANGED
package/src/store/store.js
CHANGED
|
@@ -210,6 +210,18 @@ export default class Store {
|
|
|
210
210
|
this.pubsub.publish('highlight', pluginid, ref)
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
emitConvoEvent(ev) {
|
|
214
|
+
this.pubsub.publish('events', ev)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
setAIDevMode(mode) {
|
|
218
|
+
this.ai_dev_mode = mode
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
isAIDevMode() {
|
|
222
|
+
return this.ai_dev_mode
|
|
223
|
+
}
|
|
224
|
+
|
|
213
225
|
overrideDeviceType(type) {
|
|
214
226
|
this.forceDevice = type
|
|
215
227
|
this.pubsub.publish('account')
|
|
@@ -912,6 +924,7 @@ export default class Store {
|
|
|
912
924
|
_typing = sb.throttle((convoid) => this.api.sendTyping(convoid), 3000, {trailing: false})
|
|
913
925
|
|
|
914
926
|
async startConvo(req) {
|
|
927
|
+
if (!req) req = {}
|
|
915
928
|
await this.readyGate.entry()
|
|
916
929
|
this.convoGate.close()
|
|
917
930
|
|