@chat21/chat21-web-widget 5.1.26-rc1 → 5.1.27-rc1

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/docs/changelog/this-branch.md +36 -0
  3. package/package.json +1 -1
  4. package/src/app/app.component.html +1 -1
  5. package/src/app/app.component.ts +67 -7
  6. package/src/app/component/conversation-detail/conversation/conversation.component.html +13 -2
  7. package/src/app/component/conversation-detail/conversation/conversation.component.scss +30 -2
  8. package/src/app/component/conversation-detail/conversation/conversation.component.ts +172 -1
  9. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +12 -9
  10. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.scss +15 -1
  11. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +1 -1
  12. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +103 -80
  13. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +15 -13
  14. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +6 -0
  15. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html +4 -4
  16. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.ts +1 -0
  17. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.ts +0 -18
  18. package/src/app/component/home/home.component.html +3 -3
  19. package/src/app/providers/global-settings.service.ts +38 -0
  20. package/src/app/sass/_variables.scss +1 -0
  21. package/src/app/utils/globals.ts +7 -1
  22. package/src/assets/i18n/en.json +1 -0
  23. package/src/assets/i18n/es.json +1 -0
  24. package/src/assets/i18n/fr.json +1 -0
  25. package/src/assets/i18n/it.json +1 -0
  26. package/src/launch.js +61 -6
  27. package/src/launch_template.js +61 -6
package/src/launch.js CHANGED
@@ -217,13 +217,68 @@ function loadIframe(tiledeskScriptBaseLocation) {
217
217
 
218
218
  iDiv.appendChild(ifrm);
219
219
 
220
- if(tiledeskScriptBaseLocation.includes('localhost')){
221
- ifrm.contentWindow.document.open();
222
- ifrm.contentWindow.document.write(srcTileDesk);
223
- ifrm.contentWindow.document.close();
224
- }else {
225
- ifrm.srcdoc = srcTileDesk
220
+ // Funzione helper per caricare iframe con fallback per compatibilità CSP (Wix, etc.)
221
+ // Usa Blob URL come metodo principale (più compatibile con CSP) con fallback a srcdoc e document.write
222
+ function loadIframeContent(iframe, htmlContent, baseLocation) {
223
+ var isLocalhost = baseLocation.includes('localhost');
224
+ var blobUrl = null;
225
+
226
+ // Metodo 1: Blob URL (più compatibile con CSP di Wix e altre piattaforme)
227
+ // Usa Blob URL come metodo principale perché è meno spesso bloccato da CSP rispetto a srcdoc
228
+ if (typeof Blob !== 'undefined' && typeof URL !== 'undefined' && URL.createObjectURL) {
229
+ try {
230
+ var blob = new Blob([htmlContent], { type: 'text/html;charset=utf-8' });
231
+ blobUrl = URL.createObjectURL(blob);
232
+ iframe.src = blobUrl;
233
+
234
+ // Cleanup del blob URL dopo il caricamento per liberare memoria
235
+ var originalOnload = iframe.onload;
236
+ iframe.onload = function() {
237
+ // Revoca il blob URL dopo un delay per assicurarsi che tutto sia caricato
238
+ setTimeout(function() {
239
+ if (blobUrl) {
240
+ try {
241
+ URL.revokeObjectURL(blobUrl);
242
+ blobUrl = null;
243
+ } catch(e) {
244
+ console.warn('Error revoking blob URL:', e);
245
+ }
246
+ }
247
+ }, 1000);
248
+ if (originalOnload) originalOnload.call(this);
249
+ };
250
+ return; // Blob URL impostato con successo
251
+ } catch(e) {
252
+ console.warn('Blob URL not available, trying srcdoc:', e);
253
+ }
254
+ }
255
+
256
+ // Metodo 2: srcdoc (fallback se Blob URL non disponibile)
257
+ // Skip per localhost (usa document.write per compatibilità sviluppo)
258
+ if (!isLocalhost && 'srcdoc' in iframe) {
259
+ try {
260
+ iframe.srcdoc = htmlContent;
261
+ return; // srcdoc impostato
262
+ } catch(e) {
263
+ console.warn('srcdoc not allowed, trying document.write:', e);
264
+ }
265
+ }
266
+
267
+ // Metodo 3: document.write (fallback finale, funziona su localhost e browser vecchi)
268
+ if (isLocalhost || (iframe.contentWindow && iframe.contentWindow.document)) {
269
+ try {
270
+ iframe.contentWindow.document.open();
271
+ iframe.contentWindow.document.write(htmlContent);
272
+ iframe.contentWindow.document.close();
273
+ return; // document.write completato
274
+ } catch(e) {
275
+ console.error('All iframe loading methods failed:', e);
276
+ }
277
+ }
226
278
  }
279
+
280
+ // Carica il contenuto dell'iframe con fallback automatico
281
+ loadIframeContent(ifrm, srcTileDesk, tiledeskScriptBaseLocation);
227
282
 
228
283
 
229
284
  }
@@ -218,13 +218,68 @@ function loadIframe(tiledeskScriptBaseLocation) {
218
218
 
219
219
  iDiv.appendChild(ifrm);
220
220
 
221
- if(tiledeskScriptBaseLocation.includes('localhost')){
222
- ifrm.contentWindow.document.open();
223
- ifrm.contentWindow.document.write(srcTileDesk);
224
- ifrm.contentWindow.document.close();
225
- }else {
226
- ifrm.srcdoc = srcTileDesk
221
+ // Funzione helper per caricare iframe con fallback per compatibilità CSP (Wix, etc.)
222
+ // Usa Blob URL come metodo principale (più compatibile con CSP) con fallback a srcdoc e document.write
223
+ function loadIframeContent(iframe, htmlContent, baseLocation) {
224
+ var isLocalhost = baseLocation.includes('localhost');
225
+ var blobUrl = null;
226
+
227
+ // Metodo 1: Blob URL (più compatibile con CSP di Wix e altre piattaforme)
228
+ // Usa Blob URL come metodo principale perché è meno spesso bloccato da CSP rispetto a srcdoc
229
+ if (typeof Blob !== 'undefined' && typeof URL !== 'undefined' && URL.createObjectURL) {
230
+ try {
231
+ var blob = new Blob([htmlContent], { type: 'text/html;charset=utf-8' });
232
+ blobUrl = URL.createObjectURL(blob);
233
+ iframe.src = blobUrl;
234
+
235
+ // Cleanup del blob URL dopo il caricamento per liberare memoria
236
+ var originalOnload = iframe.onload;
237
+ iframe.onload = function() {
238
+ // Revoca il blob URL dopo un delay per assicurarsi che tutto sia caricato
239
+ setTimeout(function() {
240
+ if (blobUrl) {
241
+ try {
242
+ URL.revokeObjectURL(blobUrl);
243
+ blobUrl = null;
244
+ } catch(e) {
245
+ console.warn('Error revoking blob URL:', e);
246
+ }
247
+ }
248
+ }, 1000);
249
+ if (originalOnload) originalOnload.call(this);
250
+ };
251
+ return; // Blob URL impostato con successo
252
+ } catch(e) {
253
+ console.warn('Blob URL not available, trying srcdoc:', e);
254
+ }
255
+ }
256
+
257
+ // Metodo 2: srcdoc (fallback se Blob URL non disponibile)
258
+ // Skip per localhost (usa document.write per compatibilità sviluppo)
259
+ if (!isLocalhost && 'srcdoc' in iframe) {
260
+ try {
261
+ iframe.srcdoc = htmlContent;
262
+ return; // srcdoc impostato
263
+ } catch(e) {
264
+ console.warn('srcdoc not allowed, trying document.write:', e);
265
+ }
266
+ }
267
+
268
+ // Metodo 3: document.write (fallback finale, funziona su localhost e browser vecchi)
269
+ if (isLocalhost || (iframe.contentWindow && iframe.contentWindow.document)) {
270
+ try {
271
+ iframe.contentWindow.document.open();
272
+ iframe.contentWindow.document.write(htmlContent);
273
+ iframe.contentWindow.document.close();
274
+ return; // document.write completato
275
+ } catch(e) {
276
+ console.error('All iframe loading methods failed:', e);
277
+ }
278
+ }
227
279
  }
280
+
281
+ // Carica il contenuto dell'iframe con fallback automatico
282
+ loadIframeContent(ifrm, srcTileDesk, tiledeskScriptBaseLocation);
228
283
 
229
284
 
230
285
  }