@chat21/chat21-web-widget 5.0.46 → 5.0.47-rc.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 +7 -0
- package/dist/assets/twp/index-dev.html +18 -0
- package/dist/launch.js +1 -0
- package/dist/main.js +1 -1
- package/package.json +1 -1
- package/src/app/app.component.scss +3 -1
- package/src/app/app.component.ts +7 -1
- package/src/app/component/conversation-detail/conversation/conversation.component.scss +2 -1
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.scss +2 -1
- package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.scss +2 -1
- package/src/app/component/list-all-conversations/list-all-conversations.component.scss +2 -1
- package/src/app/component/message/return-receipt/return-receipt.component.scss +1 -0
- package/src/app/component/star-rating-widget/star-rating-widget.component.scss +2 -1
- package/src/app/providers/global-settings.service.ts +14 -0
- package/src/app/utils/globals.ts +4 -0
- package/src/assets/twp/index-dev.html +18 -0
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +12 -12
- package/src/chat21-core/utils/utils-message.ts +2 -1
- package/src/launch.js +1 -0
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -602,7 +602,10 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
602
602
|
this.logger.debug('[APP-COMP] ============ idConversation ===============', recipientId, this.g.recipientId);
|
|
603
603
|
// this.g.recipientId = null;
|
|
604
604
|
this.logger.debug('[APP-COMP] singleConversation conv da ...', this.g.recipientId)
|
|
605
|
-
if(this.g.
|
|
605
|
+
if(this.g.restartConversation && this.g.singleConversation){
|
|
606
|
+
this.logger.debug('[APP-COMP] RESTART-CONVERSARION::: start a new conversations...', this.g.restartConversation)
|
|
607
|
+
this.onNewConversation();
|
|
608
|
+
}else if(this.g.recipientId && this.g.singleConversation){
|
|
606
609
|
//start widget from current recipientId conversation
|
|
607
610
|
this.logger.debug('[APP-COMP] singleConversation conv da API', this.g.recipientId)
|
|
608
611
|
this.isOpenHome = false;
|
|
@@ -781,6 +784,9 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
781
784
|
if (location.href) {
|
|
782
785
|
attributes['sourcePage'] = location.href;
|
|
783
786
|
}
|
|
787
|
+
if(document.title){
|
|
788
|
+
attributes['sourceTitle'] = document.title;
|
|
789
|
+
}
|
|
784
790
|
if (projectid) {
|
|
785
791
|
attributes['projectId'] = projectid;
|
|
786
792
|
}
|
|
@@ -962,6 +962,11 @@ export class GlobalSettingsService {
|
|
|
962
962
|
if (TEMP !== undefined) {
|
|
963
963
|
globals.singleConversation = (TEMP === true) ? true : false;
|
|
964
964
|
}
|
|
965
|
+
TEMP = tiledeskSettings['restartConversation'];
|
|
966
|
+
// this.logger.debug('[GLOBAL-SET] setVariablesFromSettings > continueConversationBeforeTime:: ', TEMP]);
|
|
967
|
+
if (TEMP !== undefined) {
|
|
968
|
+
globals.restartConversation = (TEMP === true) ? true : false;
|
|
969
|
+
}
|
|
965
970
|
TEMP = tiledeskSettings['nativeRating'];
|
|
966
971
|
// this.logger.debug('[GLOBAL-SET] setVariablesFromSettings > nativeRating:: ', TEMP]);
|
|
967
972
|
if (TEMP !== undefined) {
|
|
@@ -1226,6 +1231,10 @@ export class GlobalSettingsService {
|
|
|
1226
1231
|
if (TEMP !== null) {
|
|
1227
1232
|
this.globals.singleConversation = (TEMP === true) ? true : false;
|
|
1228
1233
|
}
|
|
1234
|
+
TEMP = el.nativeElement.getAttribute('restartConversation');
|
|
1235
|
+
if (TEMP !== null) {
|
|
1236
|
+
this.globals.restartConversation = (TEMP === true) ? true : false;;
|
|
1237
|
+
}
|
|
1229
1238
|
TEMP = el.nativeElement.getAttribute('nativeRating');
|
|
1230
1239
|
if (TEMP !== null) {
|
|
1231
1240
|
this.globals.nativeRating = (TEMP === true) ? true : false;
|
|
@@ -1653,6 +1662,11 @@ export class GlobalSettingsService {
|
|
|
1653
1662
|
globals.singleConversation = stringToBoolean(TEMP);;
|
|
1654
1663
|
}
|
|
1655
1664
|
|
|
1665
|
+
TEMP = getParameterByName(windowContext, 'tiledesk_restartConversation');
|
|
1666
|
+
if (TEMP) {
|
|
1667
|
+
globals.restartConversation = TEMP;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1656
1670
|
TEMP = getParameterByName(windowContext, 'tiledesk_nativeRating');
|
|
1657
1671
|
if (TEMP) {
|
|
1658
1672
|
globals.nativeRating = stringToBoolean(TEMP);
|
package/src/app/utils/globals.ts
CHANGED
|
@@ -210,6 +210,7 @@ export class Globals {
|
|
|
210
210
|
buttonHoverBackgroundColor: string // ******* new ********
|
|
211
211
|
buttonHoverTextColor: string // ******* new ********
|
|
212
212
|
singleConversation: boolean; // ******* new ********
|
|
213
|
+
restartConversation: boolean; // ******* new ********
|
|
213
214
|
nativeRating: boolean; // ******* new ********
|
|
214
215
|
showInfoMessage: Array<string>; // ******* new ********
|
|
215
216
|
typingLocation: string; // ******* new ********
|
|
@@ -377,6 +378,8 @@ export class Globals {
|
|
|
377
378
|
/** set the text size of attachment-buttons */
|
|
378
379
|
this.singleConversation = false;
|
|
379
380
|
/** set the single conversation mode for the widget */
|
|
381
|
+
this.restartConversation = true;
|
|
382
|
+
/** allow you to always restart a new converazioe */
|
|
380
383
|
this.nativeRating = true;
|
|
381
384
|
/** set if native rating componet has to be shown */
|
|
382
385
|
this.showInfoMessage = 'MEMBER_JOINED_GROUP'.split(',').map(key => { return key.trim()});
|
|
@@ -538,6 +541,7 @@ export class Globals {
|
|
|
538
541
|
'preChatForm': this.preChatForm, 'preChatFormJson': this.preChatFormJson,
|
|
539
542
|
'projectid': this.projectid,
|
|
540
543
|
'recipientId': this.recipientId,
|
|
544
|
+
'restartConversation': this.restartConversation,
|
|
541
545
|
'singleConversation': this.singleConversation,
|
|
542
546
|
'showInfoMessage': this.showInfoMessage, 'showAllConversations': this.showAllConversations,
|
|
543
547
|
'showWaitTime': this.showWaitTime, 'showAvailableAgents': this.showAvailableAgents,
|
|
@@ -801,6 +801,13 @@
|
|
|
801
801
|
window.Tiledesk('restart')
|
|
802
802
|
}
|
|
803
803
|
|
|
804
|
+
function onClickRestartConversation(){
|
|
805
|
+
let status = document.querySelector('input[name="restartConversation"]:checked').value
|
|
806
|
+
window.tiledeskSettings['restart'] = stringToBoolean(status)
|
|
807
|
+
console.log('onClickRestartConversation: status-->',window.tiledeskSettings);
|
|
808
|
+
window.Tiledesk('restart')
|
|
809
|
+
}
|
|
810
|
+
|
|
804
811
|
function onClickHideSettings(){
|
|
805
812
|
let status = document.querySelector('input[name="hideSettings"]:checked').value
|
|
806
813
|
window.tiledeskSettings['hideSettings'] = stringToBoolean(status)
|
|
@@ -1694,6 +1701,17 @@
|
|
|
1694
1701
|
<button class="btn btn-light" onclick="onClickSingleConversation()">Test this setting <i class="fa fa-magic" aria-hidden="true"></i></button>
|
|
1695
1702
|
</div>
|
|
1696
1703
|
</div>
|
|
1704
|
+
<div class="row">
|
|
1705
|
+
<div class="col-md-5 formElement"><span><em><strong>restartConversation</strong></em></span></div>
|
|
1706
|
+
<div class="col-md-5">
|
|
1707
|
+
<input class="form-check-input" type="radio" name="restartConversation" value="true"><label>True</label>
|
|
1708
|
+
<input class="form-check-input" type="radio" name="restartConversation" value="false" checked><label>False</label>
|
|
1709
|
+
</div>
|
|
1710
|
+
<div class="col-md-2">
|
|
1711
|
+
<button class="btn btn-light" onclick="onClickRestartConversation()">Test this setting <i class="fa fa-magic" aria-hidden="true"></i></button>
|
|
1712
|
+
</div>
|
|
1713
|
+
</div>
|
|
1714
|
+
|
|
1697
1715
|
|
|
1698
1716
|
<div class="row">
|
|
1699
1717
|
<div class="col-md-5 formElement"><span><em><strong>hideSettings</strong></em></span></div>
|
|
@@ -272,9 +272,9 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
272
272
|
if (index > -1) {
|
|
273
273
|
this.updateConversationWithSnapshot(this.conversations[index], conversation);
|
|
274
274
|
this.logger.debug('[MQTTConversationsHandler] conversationchanged.isnew', JSON.stringify(conversation))
|
|
275
|
-
this.conversations.sort(compareValues('timestamp', 'desc'));
|
|
276
|
-
this.conversations.splice(index, 1, this.conversations[index])
|
|
277
275
|
this.conversationChanged.next(this.conversations[index]);
|
|
276
|
+
this.conversations.splice(index, 1, this.conversations[index])
|
|
277
|
+
this.conversations.sort(compareValues('timestamp', 'desc'));
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
@@ -282,44 +282,44 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
282
282
|
this.logger.debug('[MQTTConversationsHandler] updating conv', conv, 'with snap', snap)
|
|
283
283
|
Object.keys(snap).forEach(k => {
|
|
284
284
|
if (k === 'is_new') {
|
|
285
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
285
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
286
286
|
conv.is_new = snap[k];
|
|
287
287
|
}
|
|
288
288
|
if (k === 'text') {
|
|
289
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
289
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
290
290
|
conv.last_message_text = snap[k];
|
|
291
291
|
conv.text = snap[k];
|
|
292
292
|
}
|
|
293
293
|
if (k === 'recipient') {
|
|
294
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
294
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
295
295
|
conv.recipient = snap[k];
|
|
296
296
|
}
|
|
297
297
|
if (k === 'recipient_fullname') {
|
|
298
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
298
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
299
299
|
conv.recipient_fullname = snap[k];
|
|
300
300
|
}
|
|
301
301
|
if (k === 'sender') {
|
|
302
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
302
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
303
303
|
conv.sender = snap[k];
|
|
304
304
|
}
|
|
305
305
|
if (k === 'sender_fullname') {
|
|
306
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
306
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
307
307
|
conv.sender_fullname = snap[k];
|
|
308
308
|
}
|
|
309
309
|
if (k === 'attributes') {
|
|
310
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
310
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
311
311
|
conv.attributes = snap[k];
|
|
312
312
|
}
|
|
313
313
|
if (k === 'timestamp') {
|
|
314
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
314
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
315
315
|
conv.timestamp = snap[k];
|
|
316
316
|
}
|
|
317
317
|
if (k === 'status') {
|
|
318
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
318
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
319
319
|
conv.status = this.setStatusConversation(conv.sender, conv.uid);
|
|
320
320
|
}
|
|
321
321
|
if (k === 'type') {
|
|
322
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
322
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
323
323
|
conv.type = snap[k];
|
|
324
324
|
}
|
|
325
325
|
|
|
@@ -146,7 +146,8 @@ export function isEmojii(message: any){
|
|
|
146
146
|
if(!message) return false;
|
|
147
147
|
const onlyEmojis = message.replace(new RegExp('[\u0000-\u1eeff]', 'g'), '')
|
|
148
148
|
const visibleChars = message.replace(new RegExp('[\n\r\s]+|( )+', 'g'), '')
|
|
149
|
-
|
|
149
|
+
const chineseChars = message.replace(new RegExp('[\u4e00-\u9fa5]', 'g'), '')
|
|
150
|
+
if(onlyEmojis === '' || visibleChars == '' || chineseChars=='') return false
|
|
150
151
|
return (onlyEmojis.length === visibleChars.length && onlyEmojis.length <= 2)
|
|
151
152
|
} catch(e) {
|
|
152
153
|
return false
|
package/src/launch.js
CHANGED