@chat21/chat21-web-widget 5.0.75 → 5.0.77-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 +8 -0
- package/package.json +1 -1
- package/src/app/app.component.scss +5 -0
- package/src/app/app.component.ts +17 -1
- package/src/app/component/message/image/image.component.html +4 -3
- package/src/app/component/message/image/image.component.ts +53 -41
- package/src/app/providers/translator.service.ts +2 -2
- package/src/assets/twp/index-dev.html +18 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,9 +5,17 @@
|
|
|
5
5
|
*Dario De Pascalis*
|
|
6
6
|
### **Copyrigth**: *Tiledesk SRL*
|
|
7
7
|
|
|
8
|
+
### 5.0.77-rc.1
|
|
9
|
+
- added: ability to programmatically open an old conversation by request_id
|
|
10
|
+
|
|
11
|
+
### 5.0.76 in PROD
|
|
12
|
+
|
|
8
13
|
### 5.0.75 in PROD
|
|
9
14
|
- bug-fixed: WELCOME_TITLE and WELCOME_MSG translation labels not rendered
|
|
10
15
|
|
|
16
|
+
### 5.0.75-rc.1
|
|
17
|
+
- added: image preview iframe on image click
|
|
18
|
+
|
|
11
19
|
### 5.0.74 in PROD
|
|
12
20
|
|
|
13
21
|
### 5.0.74-rc.5
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -1383,13 +1383,20 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1383
1383
|
});
|
|
1384
1384
|
};
|
|
1385
1385
|
|
|
1386
|
-
/**
|
|
1386
|
+
/** start new conversation */
|
|
1387
1387
|
windowContext['tiledesk'].startConversation = function (text: string) {
|
|
1388
1388
|
ngZone.run(() => {
|
|
1389
1389
|
windowContext['tiledesk']['angularcomponent'].component.onNewConversation(text);
|
|
1390
1390
|
});
|
|
1391
1391
|
};
|
|
1392
1392
|
|
|
1393
|
+
/** open widget with conversation ID */
|
|
1394
|
+
windowContext['tiledesk'].openConversationById = function (request_id: string) {
|
|
1395
|
+
ngZone.run(() => {
|
|
1396
|
+
windowContext['tiledesk']['angularcomponent'].component.openConversationById(request_id);
|
|
1397
|
+
});
|
|
1398
|
+
};
|
|
1399
|
+
|
|
1393
1400
|
/** set state reinit */
|
|
1394
1401
|
windowContext['tiledesk'].reInit = function () {
|
|
1395
1402
|
ngZone.run(() => {
|
|
@@ -1787,6 +1794,15 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1787
1794
|
return;
|
|
1788
1795
|
}
|
|
1789
1796
|
|
|
1797
|
+
openConversationById(requestId){
|
|
1798
|
+
this.isOpenConversation = true;
|
|
1799
|
+
|
|
1800
|
+
this.g.setParameter('recipientId', requestId);
|
|
1801
|
+
this.appStorageService.setItem('recipientId', requestId)
|
|
1802
|
+
|
|
1803
|
+
this.isConversationArchived = false;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1790
1806
|
/**
|
|
1791
1807
|
* MODAL HOME:
|
|
1792
1808
|
* open all-conversation
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<!-- [ngStyle] = "{ 'max-width': width +'px', 'max-height': height +'px' }" style="position: relative; text-align: center; margin: auto"-->
|
|
2
|
-
<div class="c21-img-container"
|
|
2
|
+
<div class="c21-img-container">
|
|
3
3
|
<img
|
|
4
4
|
class="message-contentX message-content-imageX"
|
|
5
5
|
[alt]="metadata?.name"
|
|
6
6
|
[ngClass]="{'isLoadingImage': loading}"
|
|
7
|
-
[ngStyle] = "{ 'width': width, 'height': height }"
|
|
7
|
+
[ngStyle] = "{ 'width': width + 'px', 'height': height+'px' }"
|
|
8
8
|
[src]="metadata.src"
|
|
9
9
|
(load)="onLoaded($event)"
|
|
10
|
-
(click)="
|
|
10
|
+
(click)="onClickImage()"/>
|
|
11
|
+
<!-- downloadImage(metadata.src, metadata.name); -->
|
|
11
12
|
</div>
|
|
@@ -9,8 +9,8 @@ import { saveAs } from 'file-saver';
|
|
|
9
9
|
export class ImageComponent implements OnInit {
|
|
10
10
|
|
|
11
11
|
@Input() metadata: any;
|
|
12
|
-
@Input() width:
|
|
13
|
-
@Input() height:
|
|
12
|
+
@Input() width: any;
|
|
13
|
+
@Input() height: any;
|
|
14
14
|
@Output() onElementRendered = new EventEmitter<{element: string, status: boolean}>();
|
|
15
15
|
|
|
16
16
|
loading: boolean = true
|
|
@@ -28,8 +28,8 @@ export class ImageComponent implements OnInit {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
downloadImage(url: string, fileName: string) {
|
|
31
|
-
console.log('Image COMP - IMAGE URL ', url)
|
|
32
|
-
console.log('Image COMP - IMAGE FILENAME ', fileName)
|
|
31
|
+
// console.log('Image COMP - IMAGE URL ', url);
|
|
32
|
+
// console.log('Image COMP - IMAGE FILENAME ', fileName);
|
|
33
33
|
fileName? null: fileName = decodeURIComponent(decodeURIComponent(url).split('/').pop())
|
|
34
34
|
// const a: any = document.createElement('a');
|
|
35
35
|
// a.href = this.sanitizer.bypassSecurityTrustUrl(url);
|
|
@@ -43,46 +43,58 @@ export class ImageComponent implements OnInit {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
onClickImage(){
|
|
46
|
+
const that = this;
|
|
47
|
+
var ifrm = document.createElement("iframe");
|
|
48
|
+
ifrm.setAttribute("frameborder", "0");
|
|
49
|
+
// ifrm.setAttribute("border", "0");
|
|
50
|
+
ifrm.setAttribute('id','tiledesk-image-preview');
|
|
51
|
+
ifrm.setAttribute('tiledesk_context','parent');
|
|
52
|
+
ifrm.setAttribute('style', 'width: 100%; height: 100%; position: absolute; z-index: 2147483003;')
|
|
53
|
+
|
|
54
|
+
var iframeContent = '<head>'
|
|
55
|
+
iframeContent += '<style> .tiledesk-popup {position: absolute; inset: 1px; outline-offset: -5px; background-color: rgba(0, 0, 0, 0.35); border-radius:16px; will-change: opacity;}'
|
|
56
|
+
iframeContent += '.tiledesk-popup-content { position: fixed; inset: 0px; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; outline: 0px;}'
|
|
57
|
+
iframeContent += '.tiledesk-popup-button { display: flex; align-items: center; justify-content: center; width: 35px; height: 35px; position: absolute; top: 0px; right: 0px; background-color: transparent; border: none; cursor: pointer; margin: 9px; padding: 0px; }'
|
|
58
|
+
iframeContent += '.tiledesk-popup-image { max-height: 80vh; max-width: 80vw; }'
|
|
59
|
+
iframeContent += '</style>'
|
|
60
|
+
iframeContent += '</head>';
|
|
61
|
+
iframeContent += '<body>'
|
|
62
|
+
iframeContent += '<div class="frame-root" id="frame-root">'
|
|
63
|
+
iframeContent += '<div class="frame-content">'
|
|
64
|
+
iframeContent += '<div class="tiledesk-popup" style="opacity: 1;"></div>'
|
|
65
|
+
iframeContent += '<div role="button" tabindex="-1" class="tiledesk-popup-content">'
|
|
66
|
+
// iframeContent += '<button id="button" type="button" data-testid="closeButton" class="tiledesk-popup-button">'
|
|
67
|
+
// iframeContent += '<svg id="ic_close" fill="#000000" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg>'
|
|
68
|
+
// iframeContent += '</button>'
|
|
69
|
+
iframeContent += '<a href="'+this.metadata.src+'" data-testid="popupImage-wrapper" class="tidio-popup-vgwcqv" style="opacity: 1; transform: translate3d(0px, 0px, 0px);">'
|
|
70
|
+
iframeContent += '<img src="'+this.metadata.src+'" class="tiledesk-popup-image" id="image-popup">'
|
|
71
|
+
iframeContent += '</a>'
|
|
72
|
+
iframeContent += '</div>'
|
|
73
|
+
iframeContent += '</div>'
|
|
74
|
+
iframeContent +='</body>'
|
|
46
75
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// ifrm.setAttribute('id','tiledeskiframe');
|
|
51
|
-
// ifrm.setAttribute('tiledesk_context','parent');
|
|
52
|
-
// ifrm.setAttribute('style', 'width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; z-index: 2147483003; border: 0px;')
|
|
53
|
-
|
|
54
|
-
// var iframeContent = '<html>'
|
|
55
|
-
// iframeContent += '<head></head>'
|
|
56
|
-
// iframeContent += '<body>'
|
|
57
|
-
// iframeContent += '<div class="frame-root">'
|
|
58
|
-
// iframeContent += '<div class="frame-content">'
|
|
59
|
-
// iframeContent += '<div class="tiledesk-popup" style="opacity: 1;"></div>'
|
|
60
|
-
// iframeContent += '<div role="button" tabindex="-1" class="tidio-popup-1y163m9">'
|
|
61
|
-
// iframeContent += '<button type="button" data-testid="closeButton" class="tidio-popup-fru4e5 >'
|
|
62
|
-
// iframeContent += '<svg id="ic_close" fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg>'
|
|
63
|
-
// iframeContent += '</button>'
|
|
64
|
-
// iframeContent += '<a href="#popup" data-testid="popupImage-wrapper" class="tidio-popup-vgwcqv" style="opacity: 1; transform: translate3d(0px, 0px, 0px);">'
|
|
65
|
-
// iframeContent += '<img src="'+this.metadata.src+'" alt="popup" class="tidio-popup-wuejeg">'
|
|
66
|
-
// iframeContent += '</a>'
|
|
67
|
-
// iframeContent += '</div>'
|
|
68
|
-
// iframeContent += '</div>'
|
|
69
|
-
// iframeContent += '</div>'
|
|
70
|
-
// iframeContent +='</body>'
|
|
71
|
-
// iframeContent +='</html>'
|
|
72
|
-
|
|
73
|
-
// var tiledeskdiv = this.globals.windowContext.document.getElementById('tiledeskdiv');
|
|
76
|
+
// ifrm.src = 'data:text/html;charset=utf-8,' + encodeURI(iframeContent);
|
|
77
|
+
ifrm.srcdoc = iframeContent
|
|
78
|
+
window.document.body.appendChild(ifrm)
|
|
74
79
|
|
|
75
|
-
// tiledeskdiv.appendChild(ifrm);
|
|
76
|
-
// ifrm.contentWindow.document.open();
|
|
77
|
-
// ifrm.contentWindow.document.write(iframeContent);
|
|
78
|
-
// ifrm.contentWindow.document.close();
|
|
79
80
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
ifrm.onload = function(ev) {
|
|
82
|
+
var iframe = window.document.getElementById('tiledesk-image-preview')
|
|
83
|
+
// var button = ifrm.contentWindow.document.getElementById("button");
|
|
84
|
+
// button.addEventListener("click", function(event){
|
|
85
|
+
// window.document.body.removeChild(iframe)
|
|
86
|
+
// });
|
|
87
|
+
var div = ifrm.contentWindow.document.getElementById('frame-root')
|
|
88
|
+
div.addEventListener("click", function(event){
|
|
89
|
+
window.document.body.removeChild(iframe)
|
|
90
|
+
});
|
|
91
|
+
// var image = ifrm.contentWindow.document.getElementById('image-popup')
|
|
92
|
+
// image.addEventListener("click", function(event){
|
|
93
|
+
// event.preventDefault();
|
|
94
|
+
// event.stopPropagation();
|
|
95
|
+
// that.downloadImage(that.metadata.src, that.metadata.name)
|
|
96
|
+
// });
|
|
97
|
+
};
|
|
86
98
|
|
|
87
99
|
}
|
|
88
100
|
|
|
@@ -266,7 +266,7 @@ export class TranslatorService {
|
|
|
266
266
|
|
|
267
267
|
|
|
268
268
|
this._translate.get(labels).subscribe(res => {
|
|
269
|
-
console.log('»»»» initI18n »»»»»» »»»»»» GET TRANSLATED LABELS RES ', res);
|
|
269
|
+
// console.log('»»»» initI18n »»»»»» »»»»»» GET TRANSLATED LABELS RES ', res);
|
|
270
270
|
globals.LABEL_PLACEHOLDER = res['LABEL_PLACEHOLDER']
|
|
271
271
|
globals.LABEL_START_NW_CONV = res['LABEL_START_NW_CONV'];
|
|
272
272
|
globals.LABEL_SELECT_TOPIC = res['LABEL_SELECT_TOPIC'];
|
|
@@ -317,7 +317,7 @@ export class TranslatorService {
|
|
|
317
317
|
globals.LABEL_PREVIEW = res['LABEL_PREVIEW']
|
|
318
318
|
globals.LABEL_ERROR_FIELD_REQUIRED= res['LABEL_ERROR_FIELD_REQUIRED']
|
|
319
319
|
|
|
320
|
-
|
|
320
|
+
|
|
321
321
|
if(globals.WELCOME_TITLE === 'WELLCOME_TITLE') globals.WELCOME_TITLE = res['WELCOME_TITLE']
|
|
322
322
|
if (!globals.welcomeTitle) {
|
|
323
323
|
globals.welcomeTitle = globals.WELCOME_TITLE; /** Set the widget welcome message. Value type : string */
|
|
@@ -468,7 +468,7 @@
|
|
|
468
468
|
<meta property="og:locale" content="en">
|
|
469
469
|
|
|
470
470
|
<link rel="icon" type="image/png" href="./tiledesk_widget_files/logo-short.png">
|
|
471
|
-
<link href="https://
|
|
471
|
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" rel="stylesheet">
|
|
472
472
|
<script defer="" src="./tiledesk_widget_files/jquery.min.js"></script>
|
|
473
473
|
<script defer="" src="./tiledesk_widget_files/bootstrap.min.js"></script>
|
|
474
474
|
|
|
@@ -791,6 +791,11 @@
|
|
|
791
791
|
preChatFormTextArea.value = JSON.stringify(preChatFormJSON, null, 4)
|
|
792
792
|
}
|
|
793
793
|
|
|
794
|
+
function onClickOpenConversationById(){
|
|
795
|
+
let request_id = document.getElementById('request_id')
|
|
796
|
+
window.Tiledesk('openConversationById', request_id)
|
|
797
|
+
}
|
|
798
|
+
|
|
794
799
|
// function onClickParameter(elementName){
|
|
795
800
|
// console.log('onClickParameter: ',elementName)
|
|
796
801
|
// const radios = document.getElementsByName(elementName)
|
|
@@ -1753,10 +1758,21 @@
|
|
|
1753
1758
|
<textarea class="form-control" id="preChatFormGet" placeholder="Get preChatForm JSON..." rows="6" cols="60"></textarea>
|
|
1754
1759
|
</div>
|
|
1755
1760
|
<div class="row" style="text-align: right; margin:5px 0px">
|
|
1756
|
-
<button class="btn btn-light" onclick="onClickGetPreChatForm()">Get Form <i class="fa fa-sticky-note
|
|
1761
|
+
<button class="btn btn-light" onclick="onClickGetPreChatForm()">Get Form <i class="fa-regular fa-sticky-note" aria-hidden="true"></i></button>
|
|
1757
1762
|
</div>
|
|
1758
1763
|
|
|
1759
1764
|
</div>
|
|
1765
|
+
<div class="row section">
|
|
1766
|
+
<div><h3 style="line-height: 0.3;">OPEN <em><strong>conversation</strong></em></h3></div>
|
|
1767
|
+
|
|
1768
|
+
<div>Insert an <em><strong>existing</strong></em> request ID </div>
|
|
1769
|
+
<div class="row" style="margin: 0">
|
|
1770
|
+
<textarea class="form-control" id="request_id" placeholder="support-group-UUID" rows="1" cols="60"></textarea>
|
|
1771
|
+
</div>
|
|
1772
|
+
<div class="row" style="text-align: right; margin:5px 0px">
|
|
1773
|
+
<button class="btn btn-light" onclick="onClickOpenConversationById()">Open conversation <i class="fa-regular fa-comment" aria-hidden="true"></i></button>
|
|
1774
|
+
</div>
|
|
1775
|
+
</div>
|
|
1760
1776
|
<div class="row section c21-parameters">
|
|
1761
1777
|
<div><h3 style="line-height: 0.3;">MANAGE <em><strong>widget settings</strong></em></h3></div>
|
|
1762
1778
|
<div class="docs">Select an option for Tiledesk settings parameter</div>
|