@chat21/chat21-web-widget 5.0.52 → 5.0.53-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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-web-widget",
3
3
  "author": "Tiledesk SRL",
4
- "version": "5.0.52",
4
+ "version": "5.0.53-rc.1",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -43,6 +43,7 @@ import { supports_html5_storage } from 'src/chat21-core/utils/utils';
43
43
  import { AUTH_STATE_OFFLINE, AUTH_STATE_ONLINE, TYPE_MSG_FILE, TYPE_MSG_IMAGE, URL_SOUND_LIST_CONVERSATION } from 'src/chat21-core/utils/constants';
44
44
  import { isInfo, isUserBanned } from 'src/chat21-core/utils/utils-message';
45
45
  import { MessageModel } from 'src/chat21-core/models/message';
46
+ import { Rules } from './utils/rules';
46
47
 
47
48
  interface MessageObj {
48
49
  tenant?: string;
@@ -107,6 +108,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
107
108
  private el: ElementRef,
108
109
  private ngZone: NgZone,
109
110
  public g: Globals,
111
+ private rules: Rules,
110
112
  public triggerHandler: Triggerhandler,
111
113
  public globalSettingsService: GlobalSettingsService,
112
114
  private settingsSaverService: SettingsSaverService,
@@ -127,6 +127,7 @@ import { Triggerhandler } from 'src/chat21-core/utils/triggerHandler';
127
127
  import { WaitingService } from './providers/waiting.service';
128
128
  import { StarRatingWidgetService } from './providers/star-rating-widget.service';
129
129
  import { LikeUnlikeComponent } from './component/message/like-unlike/like-unlike.component';
130
+ import { Rules } from './utils/rules';
130
131
 
131
132
 
132
133
  const appInitializerFn = (appConfig: AppConfigService, logger: NGXLogger) => {
@@ -315,6 +316,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
315
316
  AppConfigService,
316
317
  Chat21Service,
317
318
  Globals,
319
+ Rules,
318
320
  GlobalSettingsService,
319
321
  SettingsSaverService,
320
322
  StarRatingWidgetService,
@@ -37,6 +37,12 @@
37
37
  (onMenuOptionShow)="onMenuOption($event)">
38
38
  </chat-conversation-header>
39
39
 
40
+ <div id="dropZone_container" *ngIf="isHovering">
41
+ <div class="drop">
42
+ drop zone
43
+ </div>
44
+ </div>
45
+
40
46
  <!-- CONTENT -->
41
47
  <chat-conversation-content
42
48
  [messages]="messages"
@@ -55,9 +61,14 @@
55
61
  (onAttachmentButtonClicked)="onAttachmentButtonClicked($event)"
56
62
  (onScrollContent)="onScrollContent($event)"
57
63
  (onMenuOptionShow)="onMenuOption($event)"
58
- (onEmojiiPickerShow)="onEmojiiPickerShow($event)">
64
+ (onEmojiiPickerShow)="onEmojiiPickerShow($event)"
65
+ (drop)="drop($event)"
66
+ (dragover)="allowDrop($event)"
67
+ (dragleave)="drag($event)" >
59
68
  </chat-conversation-content>
60
69
 
70
+
71
+
61
72
  <!-- INTERNAL FRAME FOR SELF ACTION LINK BUTTONS-->
62
73
  <chat-internal-frame *ngIf="isButtonUrl"
63
74
  [button]="buttonClicked"
@@ -105,6 +116,7 @@
105
116
  [isEmojiiPickerShow]="isEmojiiPickerShow"
106
117
  [footerMessagePlaceholder]="footerMessagePlaceholder"
107
118
  [fileUploadAccept]="appConfigService?.getConfig().fileUploadAccept"
119
+ [dropEvent]="dropEvent"
108
120
  [stylesMap]="stylesMap"
109
121
  [translationMap]="translationMapFooter"
110
122
  (onEmojiiPickerShow)="onEmojiiPickerShow($event)"
@@ -468,6 +468,25 @@
468
468
 
469
469
  }
470
470
 
471
+ #dropZone_container{
472
+ position: absolute;
473
+ top: 52px;
474
+ bottom: 56px;
475
+ left: 0;
476
+ right: 0;
477
+ background-color: rgba(240,248,255,0.6);
478
+ .drop{
479
+ position: absolute;
480
+ top: 0;
481
+ bottom: 0;
482
+ left: 0;
483
+ right: 0;
484
+ margin: 5px;
485
+ border: 2px dashed #a4acb3;
486
+ border-radius: 16px;
487
+ }
488
+ }
489
+
471
490
  /* ==================== OPTION MENU CONTAINER ==================== */
472
491
  #c21-options-menu {
473
492
  width: auto;
@@ -139,6 +139,11 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
139
139
  isIE = /msie\s|trident\//i.test(window.navigator.userAgent);
140
140
  firstScroll = true;
141
141
 
142
+ // ========== begin:: DRAG & DROP =======
143
+ isHovering: boolean = false
144
+ dropEvent: Event
145
+ // ========== end:: DRAG & DROP =======
146
+
142
147
  tooltipOptions = {
143
148
  'show-delay': 1500,
144
149
  'tooltip-class': 'chat-tooltip',
@@ -1250,4 +1255,50 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
1250
1255
  }
1251
1256
  // ========= END:: TRIGGER FUNCTIONS ============//
1252
1257
 
1258
+
1259
+ drop(event){
1260
+ event.preventDefault()
1261
+ event.stopPropagation()
1262
+
1263
+ this.logger.log('[CONV-COMP] ----> FILE - DROP ev ', event)
1264
+ const fileList = event.dataTransfer.files
1265
+ this.logger.log('[CONV-COMP] ----> FILE - DROP ev.dataTransfer.files ',fileList)
1266
+ this.isHovering = false
1267
+ if (fileList.length > 0) {
1268
+ const file: File = fileList[0]
1269
+ this.logger.log('[CONV-COMP] ----> FILE - DROP file ', file)
1270
+
1271
+ var mimeType = fileList[0].type
1272
+ this.logger.log('[CONV-COMP] ----> FILE - DROP mimeType files ', mimeType)
1273
+
1274
+ // if (mimeType.startsWith("image") || mimeType.startsWith("application")) {
1275
+ // this.logger.log('[CONV-COMP] ----> FILE - DROP mimeType files: ', this.appConfigProvider.getConfig().fileUploadAccept);
1276
+ // this.checkAcceptedFile(mimeType);
1277
+ // const isAccepted = this.checkAcceptedFile(mimeType)
1278
+ // this.logger.log('[CONV-COMP] > checkAcceptedFile - fileUploadAccept isAcceptFile FILE - DROP',isAccepted)
1279
+ // if (isAccepted === true) {
1280
+ this.dropEvent = event
1281
+ // } else {
1282
+ // this.logger.log( '[CONV-COMP] ----> FILE - DROP mimeType files ', mimeType,'NOT SUPPORTED FILE TYPE')
1283
+ // this.presentToast(this.translationsMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'), 'danger','toast-custom-class', 5000 )
1284
+ // // this.presentToastOnlyImageFilesAreAllowedToDrag()
1285
+ // }
1286
+
1287
+ }
1288
+ }
1289
+
1290
+ allowDrop(event: any) {
1291
+ event.preventDefault()
1292
+ event.stopPropagation()
1293
+ this.logger.log('[CONV-COMP] ----> FILE - (dragover) allowDrop ev ', event)
1294
+ this.isHovering = true
1295
+ }
1296
+
1297
+ drag(event){
1298
+ event.preventDefault()
1299
+ event.stopPropagation()
1300
+ console.log('dragleave-->', event)
1301
+ this.isHovering = false
1302
+ }
1303
+
1253
1304
  }
@@ -37,6 +37,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
37
37
  @Input() fileUploadAccept: string;
38
38
  @Input() stylesMap: Map<string, string>
39
39
  @Input() translationMap: Map< string, string>;
40
+ @Input() dropEvent: Event;
40
41
  @Output() onEmojiiPickerShow = new EventEmitter<boolean>();
41
42
  @Output() onBeforeMessageSent = new EventEmitter();
42
43
  @Output() onAfterSendMessage = new EventEmitter<MessageModel>();
@@ -86,6 +87,11 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
86
87
  if(changes['hideTextReply'] && changes['hideTextReply'].currentValue !== undefined){
87
88
  this.restoreTextArea();
88
89
  }
90
+
91
+ if(changes['dropEvent'] && changes['dropEvent'].currentValue !== undefined){
92
+ this.onDrop(this.dropEvent)
93
+ }
94
+
89
95
  }
90
96
 
91
97
  ngAfterViewInit() {
@@ -573,4 +579,20 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
573
579
  }
574
580
  }
575
581
 
582
+ onDrop(event){
583
+ const items = event.dataTransfer.files;
584
+ let file = null;
585
+ this.logger.debug('[CONV-FOOTER] onDrop items ', items);
586
+ for (const item of items) {
587
+ this.logger.debug('[CONV-FOOTER] onDrop item ', item);
588
+ this.logger.debug('[CONV-FOOTER] onDrop item.type ', item.type);
589
+
590
+ const data = {target: {files: new DataTransfer()}}
591
+ data.target.files = items
592
+ this.logger.debug('[CONV-FOOTER] onDrop data', data);
593
+ this.logger.debug('[CONV-FOOTER] onDrop file ', file);
594
+ this.detectFiles(data)
595
+ }
596
+ }
597
+
576
598
  }
@@ -73,9 +73,6 @@
73
73
  <div id="c21-whatsapp" *ngIf="g?.whatsappNumber && g?.whatsappNumber.trim() !== ''">
74
74
  <button tabindex="1040" aflistconv #aflistconv class="c21-button-primary" (click)="openConversationOnPlatform('whatsapp')">
75
75
  <span class="v-align-center">
76
- <!-- <svg [ngStyle]="{'fill': 'yellow' }" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
77
- <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" [ngStyle]="{'fill': g.themeForegroundColor}"/>
78
- </svg> -->
79
76
  <svg aria-labelledby="altIconTitle" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="28" height="28" viewBox="0 0 1219.547 1225.016">
80
77
  <path fill="#E0E0E0" d="M1041.858 178.02C927.206 63.289 774.753.07 612.325 0 277.617 0 5.232 272.298 5.098 606.991c-.039 106.986 27.915 211.42 81.048 303.476L0 1225.016l321.898-84.406c88.689 48.368 188.547 73.855 290.166 73.896h.258.003c334.654 0 607.08-272.346 607.222-607.023.056-162.208-63.052-314.724-177.689-429.463zm-429.533 933.963h-.197c-90.578-.048-179.402-24.366-256.878-70.339l-18.438-10.93-191.021 50.083 51-186.176-12.013-19.087c-50.525-80.336-77.198-173.175-77.16-268.504.111-278.186 226.507-504.503 504.898-504.503 134.812.056 261.519 52.604 356.814 147.965 95.289 95.36 147.728 222.128 147.688 356.948-.118 278.195-226.522 504.543-504.693 504.543z"/>
81
78
  <linearGradient id="a" gradientUnits="userSpaceOnUse" x1="609.77" y1="1190.114" x2="609.77" y2="21.084">
@@ -87,6 +84,9 @@
87
84
  <path fill="#FFF" d="M1036.898 176.091C923.562 62.677 772.859.185 612.297.114 281.43.114 12.172 269.286 12.039 600.137 12 705.896 39.633 809.13 92.156 900.13L7 1211.067l318.203-83.438c87.672 47.812 186.383 73.008 286.836 73.047h.255.003c330.812 0 600.109-269.219 600.25-600.055.055-160.343-62.328-311.108-175.649-424.53zm-424.601 923.242h-.195c-89.539-.047-177.344-24.086-253.93-69.531l-18.227-10.805-188.828 49.508 50.414-184.039-11.875-18.867c-49.945-79.414-76.312-171.188-76.273-265.422.109-274.992 223.906-498.711 499.102-498.711 133.266.055 258.516 52 352.719 146.266 94.195 94.266 146.031 219.578 145.992 352.852-.118 274.999-223.923 498.749-498.899 498.749z"/>
88
85
  <title id="altIconTitle">Whatsapp</title>
89
86
  </svg>
87
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="28" height="28" focusable="false" viewBox="0 0 448 512" xml:space="preserve">
88
+ <path stroke="#5f6368" stroke-width="8px" fill="#5f6368" d="M380.9,97.1C339,55.1,283.2,32,223.9,32c-122.4,0-222,99.6-222,222c0,39.1,10.2,77.3,29.6,111L0,480l117.7-30.9 c32.4,17.7,68.9,27,106.1,27h0.1c122.3,0,224.1-99.6,224.1-222C448,194.8,422.8,139.1,380.9,97.1z M223.9,438.7 c-33.2,0-65.7-8.9-94-25.7l-6.7-4l-69.8,18.3L72,359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2c0-101.7,82.8-184.5,184.6-184.5 c49.3,0,95.6,19.2,130.4,54.1s56.2,81.2,56.1,130.5C410.5,355.9,325.6,438.7,223.9,438.7z M325.1,300.5c-5.5-2.8-32.8-16.2-37.9-18 c-5.1-1.9-8.8-2.8-12.5,2.8c-3.7,5.6-14.3,18-17.6,21.8c-3.2,3.7-6.5,4.2-12,1.4c-32.6-16.3-54-29.1-75.5-66 c-5.7-9.8,5.7-9.1,16.3-30.3c1.8-3.7,0.9-6.9-0.5-9.7s-12.5-30.1-17.1-41.2c-4.5-10.8-9.1-9.3-12.5-9.5c-3.2-0.2-6.9-0.2-10.6-0.2 c-3.7,0-9.7,1.4-14.8,6.9c-5.1,5.6-19.4,19-19.4,46.3s19.9,53.7,22.6,57.4c2.8,3.7,39.1,59.7,94.8,83.8c35.2,15.2,49,16.5,66.6,13.9 c10.7-1.6,32.8-13.4,37.4-26.4s4.6-24.1,3.2-26.4C334.3,304.6,330.6,303.2,325.1,300.5z"/>
89
+ </svg> -->
90
90
  </span>
91
91
  <div class="clear"></div>
92
92
  </button>
@@ -94,9 +94,6 @@
94
94
  <div id="c21-telegram" *ngIf="g?.telegramUsername && g?.telegramUsername.trim() !== ''">
95
95
  <button tabindex="1040" aflistconv #aflistconv class="c21-button-primary" (click)="openConversationOnPlatform('telegram')">
96
96
  <span class="v-align-center">
97
- <!-- <svg [ngStyle]="{'fill': 'yellow' }" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
98
- <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" [ngStyle]="{'fill': g.themeForegroundColor}"/>
99
- </svg> -->
100
97
  <svg aria-labelledby="altIconTitle" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26" height="26" viewBox="0 0 368 368" style="enable-background:new 0 0 368 368;" xml:space="preserve">
101
98
  <g id="XMLID_1_">
102
99
  <linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="-66.831" y1="-68.1757" x2="-65.3102" y2="-68.1757" gradientTransform="matrix(-60 139.992 -139.992 -60 -13316.416 5324.4634)">
@@ -114,9 +111,8 @@
114
111
  </g>
115
112
  <title id="altIconTitle">Telegram</title>
116
113
  </svg>
117
- <!-- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
118
- <path [ngStyle]="{'fill': g.themeForegroundColor}" d="M13.92,11.22s-1.22-.6-1.44-.68a.76.76,0,0,0-.27-.06.46.46,0,0,0-.4.24c-.12.17-.48.59-.59.72l-.05,0-.25-.1A6.22,6.22,0,0,1,8.54,9.26l0,0s.05-.06.07-.09l.2-.23.1-.11a1.36,1.36,0,0,0,.19-.31l0-.05a.54.54,0,0,0,0-.52c0-.06-.53-1.27-.58-1.4-.13-.31-.3-.45-.54-.45H7.88a3,3,0,0,0-1,.26,2.08,2.08,0,0,0-.77,1.76A3.78,3.78,0,0,0,7,10.17a.09.09,0,0,0,0,.05,7.81,7.81,0,0,0,3.33,2.89,5.37,5.37,0,0,0,2,.51h0l.32,0h.06a2.13,2.13,0,0,0,1.48-1,1.7,1.7,0,0,0,.09-1.08A.72.72,0,0,0,13.92,11.22Z" transform="translate(-1.83 -1.83)"/>
119
- <path [ngStyle]="{'fill': g.themeForegroundColor}" d="M10.14,1.83a8,8,0,0,0-8,8,7.86,7.86,0,0,0,1.1,4L1.85,17.89a.19.19,0,0,0,0,.21.21.21,0,0,0,.15.07h.06l4.24-1.35a8,8,0,0,0,11.82-7A8,8,0,0,0,10.14,1.83Zm0,14.27a6.37,6.37,0,0,1-3.49-1,.19.19,0,0,0-.12,0H6.47l-2.12.68.68-2a.22.22,0,0,0,0-.19A6.22,6.22,0,0,1,3.79,9.8a6.36,6.36,0,1,1,6.35,6.3Z" transform="translate(-1.83 -1.83)"/>
114
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26" height="26" viewBox="0 0 448 512" xml:space="preserve">
115
+ <path fill="#5f6368" d="M446.7,98.6l-67.6,318.8c-5.1,22.5-18.4,28.1-37.3,17.5l-103-75.9l-49.7,47.8c-5.5,5.5-10.1,10.1-20.7,10.1 l7.4-104.9l190.9-172.5c8.3-7.4-1.8-11.5-12.9-4.1L117.8,284L16.2,252.2c-22.1-6.9-22.5-22.1,4.6-32.7L418.2,66.4 C436.6,59.5,452.7,70.5,446.7,98.6z"/>
120
116
  </svg> -->
121
117
  </span>
122
118
  <div class="clear"></div>
@@ -125,9 +121,6 @@
125
121
  <div id="c21-messanger" *ngIf="g?.messangerPageTitle && g?.messangerPageTitle.trim() !== ''">
126
122
  <button tabindex="1040" aflistconv #aflistconv class="c21-button-primary" (click)="openConversationOnPlatform('messanger')">
127
123
  <span class="v-align-center">
128
- <!-- <svg [ngStyle]="{'fill': 'yellow' }" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
129
- <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" [ngStyle]="{'fill': g.themeForegroundColor}"/>
130
- </svg> -->
131
124
  <svg aria-labelledby="altIconTitle" xmlns="http://www.w3.org/2000/svg" width="26" height="26" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 800 800">
132
125
  <radialGradient id="Gradient" cx="101.925" cy="809.0079" r="1.0896" gradientTransform="matrix(800 0 0 -799.9985 -81386 648000.75)" gradientUnits="userSpaceOnUse">
133
126
  <stop offset="0" style="stop-color:#0099FF"/>
@@ -139,9 +132,8 @@
139
132
  <path fill="#FFFFFF" d="M159.8,501.5l117.5-186.4c18.7-29.7,58.7-37,86.8-16l93.5,70.1c8.6,6.4,20.4,6.4,28.9-0.1 l126.2-95.8c16.8-12.8,38.8,7.4,27.6,25.3L522.7,484.9c-18.7,29.7-58.7,37-86.8,16l-93.5-70.1c-8.6-6.4-20.4-6.4-28.9,0.1 l-126.2,95.8C170.5,539.5,148.5,519.4,159.8,501.5z"/>
140
133
  <title id="altIconTitle">Facebook Messanger</title>
141
134
  </svg>
142
- <!-- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
143
- <path [ngStyle]="{'fill': g.themeForegroundColor}" d="M13.92,11.22s-1.22-.6-1.44-.68a.76.76,0,0,0-.27-.06.46.46,0,0,0-.4.24c-.12.17-.48.59-.59.72l-.05,0-.25-.1A6.22,6.22,0,0,1,8.54,9.26l0,0s.05-.06.07-.09l.2-.23.1-.11a1.36,1.36,0,0,0,.19-.31l0-.05a.54.54,0,0,0,0-.52c0-.06-.53-1.27-.58-1.4-.13-.31-.3-.45-.54-.45H7.88a3,3,0,0,0-1,.26,2.08,2.08,0,0,0-.77,1.76A3.78,3.78,0,0,0,7,10.17a.09.09,0,0,0,0,.05,7.81,7.81,0,0,0,3.33,2.89,5.37,5.37,0,0,0,2,.51h0l.32,0h.06a2.13,2.13,0,0,0,1.48-1,1.7,1.7,0,0,0,.09-1.08A.72.72,0,0,0,13.92,11.22Z" transform="translate(-1.83 -1.83)"/>
144
- <path [ngStyle]="{'fill': g.themeForegroundColor}" d="M10.14,1.83a8,8,0,0,0-8,8,7.86,7.86,0,0,0,1.1,4L1.85,17.89a.19.19,0,0,0,0,.21.21.21,0,0,0,.15.07h.06l4.24-1.35a8,8,0,0,0,11.82-7A8,8,0,0,0,10.14,1.83Zm0,14.27a6.37,6.37,0,0,1-3.49-1,.19.19,0,0,0-.12,0H6.47l-2.12.68.68-2a.22.22,0,0,0,0-.19A6.22,6.22,0,0,1,3.79,9.8a6.36,6.36,0,1,1,6.35,6.3Z" transform="translate(-1.83 -1.83)"/>
135
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26" height="26" focusable="false" viewBox="0 0 512 512" xml:space="preserve">
136
+ <path fill="#5f6368" d="M256.5,8C116.5,8,8,110.3,8,248.6c0,72.3,29.7,134.8,78.1,177.9c8.3,7.5,6.6,11.9,8.1,58.2 c0.4,11,9.6,19.6,20.6,19.2c2.5-0.1,5-0.6,7.3-1.7c52.9-23.3,53.6-25.1,62.6-22.7c153.3,42.2,319.4-55.9,319.4-231 C504,110.3,396.6,8,256.5,8z M405.8,193.1l-73,115.6c-11.1,17.4-34.1,22.6-51.6,11.5c-0.8-0.5-1.6-1-2.3-1.6l-58.1-43.5 c-5.3-4-12.7-4-18,0l-78.4,59.4c-10.5,7.9-24.2-4.6-17.1-15.7l73-115.6c11-17.4,34.1-22.6,51.6-11.6c0.8,0.5,1.6,1.1,2.4,1.6 l58.1,43.5c5.3,4,12.7,4,18,0l78.4-59.4C399.1,169.5,412.8,182,405.8,193.1L405.8,193.1z"/>
145
137
  </svg> -->
146
138
  </span>
147
139
  <div class="clear"></div>
@@ -1673,12 +1673,12 @@ export class GlobalSettingsService {
1673
1673
 
1674
1674
  TEMP = getParameterByName(windowContext, 'tiledesk_singleConversation');
1675
1675
  if (TEMP) {
1676
- globals.singleConversation = stringToBoolean(TEMP);;
1676
+ globals.singleConversation = stringToBoolean(TEMP);
1677
1677
  }
1678
1678
 
1679
1679
  TEMP = getParameterByName(windowContext, 'tiledesk_restartConversation');
1680
1680
  if (TEMP) {
1681
- globals.restartConversation = TEMP;
1681
+ globals.restartConversation = stringToBoolean(TEMP);
1682
1682
  }
1683
1683
 
1684
1684
  TEMP = getParameterByName(windowContext, 'tiledesk_nativeRating');
@@ -0,0 +1,13 @@
1
+ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
2
+ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
3
+ export class Rules {
4
+
5
+ private url = window.location
6
+
7
+ private logger: LoggerService = LoggerInstance.getInstance()
8
+ constructor(){}
9
+
10
+ initRules(){
11
+ console.log('locationnnnnnn', this.url)
12
+ }
13
+ }
@@ -0,0 +1,57 @@
1
+ <html lang="en">
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
5
+ <title>Tilechat Widget</title>
6
+ <link rel="icon" type="image/x-icon" href="favicon.ico">
7
+ <script>
8
+ var tiledeskScriptBaseLocation = window.location.href.replace("/base_script.html","");
9
+
10
+ var link_2 = document.createElement('link')
11
+ link_2.setAttribute('rel', 'stylesheet')
12
+ link_2.setAttribute('type', 'text/css')
13
+ link_2.setAttribute('href', tiledeskScriptBaseLocation + '/assets/styles/tiledesk_v1.scss')
14
+ link_2.setAttribute('media','all')
15
+
16
+ var script_1 = document.createElement('script')
17
+ script_1.setAttribute('type','text/javascript')
18
+ script_1.setAttribute('src',tiledeskScriptBaseLocation + '/runtime.js')
19
+ var script_2 = document.createElement('script')
20
+ script_2.setAttribute('type','text/javascript')
21
+ script_2.setAttribute('src',tiledeskScriptBaseLocation + '/polyfills.js')
22
+ var link = document.createElement('link')
23
+ link.setAttribute('type','text/css')
24
+ link.setAttribute('rel','stylesheet')
25
+ link.setAttribute('href',tiledeskScriptBaseLocation + '/styles.css')
26
+ link.setAttribute('media','all')
27
+ var script_4 = document.createElement('script')
28
+ script_4.setAttribute('type','text/javascript')
29
+ script_4.setAttribute('src',tiledeskScriptBaseLocation + '/vendor.js')
30
+ var script_5 = document.createElement('script')
31
+ script_5.setAttribute('type','text/javascript')
32
+ script_5.setAttribute('src',tiledeskScriptBaseLocation + '/main.js')
33
+
34
+
35
+ window.addEventListener("load", (event) => {
36
+
37
+ let head = document.getElementsByTagName('head')[0]
38
+ head.appendChild(link_2)
39
+
40
+ let body = document.getElementsByTagName('body')[0]
41
+ body.appendChild(script_1)
42
+ body.appendChild(script_2)
43
+ body.appendChild(link)
44
+ body.appendChild(script_4)
45
+ body.appendChild(script_5)
46
+ });
47
+ </script>
48
+ </head>
49
+ <body>
50
+ <chat-root></chat-root>
51
+ <!-- <script type="text/javascript" src="http://localhost:4202/runtime.js"></script>
52
+ <script type="text/javascript" src="http://localhost:4202/polyfills.js"></script>
53
+ <script type="text/css" src="http://localhost:4202/styles.css"></script>
54
+ <script type="text/javascript" src="http://localhost:4202/vendor.js"></script>
55
+ <script type="text/javascript" src="http://localhost:4202/main.js"></script> -->
56
+ </body>
57
+ </html>
@@ -9,6 +9,7 @@ export abstract class LoggerService {
9
9
  constructor() { }
10
10
 
11
11
  abstract setLoggerConfig(isLogEnabled: boolean, logLevel: string);
12
+ abstract getLoggerConfig(): {isLogEnabled: boolean, logLevel: number};
12
13
  abstract debug(...message: any[])
13
14
  abstract log(...message: any[])
14
15
  abstract warn(...message: any[])
@@ -23,6 +23,10 @@ export class CustomLogger extends LoggerService{
23
23
  }
24
24
  }
25
25
 
26
+ getLoggerConfig(): {isLogEnabled: boolean, logLevel: number}{
27
+ return {isLogEnabled: this.isLogEnabled, logLevel: this.logLevel}
28
+ }
29
+
26
30
  error(message: any, ...optionalParams: any[]) {
27
31
  if (this.isLogEnabled && this.logLevel >= LogLevel.ERROR) {
28
32
  this.logger.error(message, ...optionalParams)
package/src/launch.js CHANGED
@@ -163,69 +163,12 @@ function loadIframe(tiledeskScriptBaseLocation) {
163
163
 
164
164
  iDiv.appendChild(ifrm);
165
165
 
166
- // buildIframeDOM(ifrm)
167
166
  // ifrm.contentWindow.document.open();
168
- // ifrm.document.srcdoc = srcTileDesk;
169
- // ifrm.srcdoc = srcTileDesk
170
- ifrm.contentWindow.document.open();
171
- ifrm.contentWindow.document.write(srcTileDesk);
172
- ifrm.contentWindow.document.close();
173
-
174
- }
167
+ ifrm.src = tiledeskScriptBaseLocation + '/base_script.html'
168
+ // ifrm.contentWindow.document.open();
169
+ // ifrm.contentWindow.document.write(srcTileDesk);
170
+ // ifrm.contentWindow.document.close();
175
171
 
176
- function buildIframeDOM(iframe){
177
-
178
- var meta = document.createElement('meta');
179
- meta.setAttribute('charset', 'utf-8')
180
- var meta_2 = document.createElement('meta')
181
- meta_2.setAttribute('name', 'viewport')
182
- meta_2.setAttribute('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0')
183
- var title = document.createElement('title')
184
- title.title = 'Tilechat Widget'
185
- var base = document.createElement('base')
186
- base.setAttribute('href', './')
187
- var link_1 = document.createElement('link')
188
- link_1.setAttribute('rel', 'icon')
189
- link_1.setAttribute('type', 'image/x-icon')
190
- link_1.setAttribute('href', 'favicon.ico')
191
- var link_2 = document.createElement('link')
192
- link_2.setAttribute('rel', 'stylesheet')
193
- link_2.setAttribute('type', 'text/css')
194
- link_2.setAttribute('href', tiledeskScriptBaseLocation + '/assets/styles/tiledesk_v1.scss')
195
- link_2.setAttribute('media','all')
196
-
197
-
198
- let head = iframe.contentWindow.document.getElementsByTagName('head')[0]
199
- head.appendChild(meta)
200
- head.appendChild(meta_2)
201
- head.appendChild(title)
202
- head.appendChild(base)
203
- head.appendChild(link_1)
204
- head.appendChild(link_2)
205
-
206
- var script_1 = document.createElement('script')
207
- script_1.setAttribute('type','text/javascript')
208
- script_1.setAttribute('src',tiledeskScriptBaseLocation + '/runtime.js')
209
- var script_2 = document.createElement('script')
210
- script_2.setAttribute('type','text/javascript')
211
- script_2.setAttribute('src',tiledeskScriptBaseLocation + '/polyfills.js')
212
- var script_3 = document.createElement('script')
213
- script_3.setAttribute('type','text/javascript')
214
- script_3.setAttribute('src',tiledeskScriptBaseLocation + '/styles.css')
215
- var script_4 = document.createElement('script')
216
- script_4.setAttribute('type','text/javascript')
217
- script_4.setAttribute('src',tiledeskScriptBaseLocation + '/vendor.js')
218
- var script_5 = document.createElement('script')
219
- script_5.setAttribute('type','text/javascript')
220
- script_5.setAttribute('src',tiledeskScriptBaseLocation + '/main.js')
221
-
222
- let body= iframe.contentWindow.document.getElementsByTagName('body')[0]
223
- body.appendChild(document.createElement('chat-root'))
224
- body.appendChild(script_1)
225
- body.appendChild(script_2)
226
- body.appendChild(script_3)
227
- body.appendChild(script_4)
228
- body.appendChild(script_5)
229
172
  }
230
173
 
231
174
 
@@ -1,95 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>Tilechat Widget</title>
6
- <base href="./">
7
- <link rel="icon" type="image/x-icon" href="favicon.ico">
8
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
- </head>
10
- <body>
11
- <script type="application/javascript">
12
- window.tiledeskSettings =
13
- {
14
- projectid: "5b55e806c93dde00143163dd",
15
- development: true,
16
- calloutTimer: 10,
17
- autoStart:false,
18
- startFromHome: true
19
- };
20
-
21
- (function(d, s, id) {
22
- var js, fjs = d.getElementsByTagName(s)[0];
23
- if (d.getElementById(id)) return;
24
- js = d.createElement(s); js.id = id; //js.async=!0;
25
- js.src = "./tiledesk.js";
26
- fjs.parentNode.insertBefore(js, fjs);
27
- }(document, 'script', 'tiledesk-jssdk'));
28
- </script>
29
-
30
-
31
-
32
- <script type="application/javascript">
33
-
34
- function createCORSRequest(method, url, async) {
35
-
36
- var xhr = new XMLHttpRequest();
37
- if ("withCredentials" in xhr) {
38
-
39
- // Check if the XMLHttpRequest object has a "withCredentials" property.
40
- // "withCredentials" only exists on XMLHTTPRequest2 objects.
41
- xhr.open(method, url, async);
42
- // console.log("xhr12");
43
- } else if (typeof XDomainRequest != "undefined") {
44
-
45
- // Otherwise, check if XDomainRequest.
46
- // XDomainRequest only exists in IE, and is IE's way of making CORS requests.
47
- xhr = new XDomainRequest();
48
- xhr.open(method, url);
49
- // console.log("xhr111");
50
-
51
- } else {
52
-
53
- // Otherwise, CORS is not supported by the browser.
54
- xhr = null;
55
- // console.log("xhrnull");
56
-
57
- }
58
- return xhr;
59
- }
60
-
61
-
62
- window.tileDeskAsyncInit = function() {
63
- window.tiledesk.on('onLoadParams', function(event_data) {
64
- // console.log("window.tiledesk", window.tiledesk);
65
- var httpRequest = createCORSRequest('POST', 'https://demo@f21.it:password@api.tiledesk.com/v1/5b55e806c93dde00143163dd/jwt/generatetestjwt',false); //set async to false because loadParams must return when the get is complete
66
- if (!httpRequest) {
67
- throw new Error('CORS not supported');
68
- }
69
-
70
- // console.log("onreadystatechange1");
71
- httpRequest.onload = function() {
72
- if (httpRequest.readyState === XMLHttpRequest.DONE) {
73
- if (httpRequest.status === 200) {
74
- // alert(httpRequest.responseText);
75
- // console.log("httpRequest.responseText", httpRequest.responseText);
76
- window.tiledesk.signInWithCustomToken(httpRequest.responseText);
77
- return true;
78
- } else {
79
- alert('There was a problem with the request.');
80
- }
81
- }
82
- };
83
-
84
- httpRequest.onerror = function() {
85
- console.error('There was an error!');
86
- };
87
-
88
- httpRequest.send();
89
- return false;
90
- });
91
- }
92
- </script>
93
-
94
- </body>
95
- </html>
@@ -1,49 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>Tilechat Widget</title>
6
- <base href="./">
7
- <link rel="icon" type="image/x-icon" href="favicon.ico">
8
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
- </head>
10
- <body>
11
- <script type="application/javascript">
12
- window.tiledeskSettings =
13
- {
14
- projectid: "5b55e806c93dde00143163dd",
15
- development: true,
16
- calloutTimer: 10,
17
- autoStart:false,
18
- startFromHome: true,
19
- isLogEnabled: true
20
- };
21
-
22
- (function(d, s, id) {
23
- var js, fjs = d.getElementsByTagName(s)[0];
24
- if (d.getElementById(id)) return;
25
- js = d.createElement(s); js.id = id; //js.async=!0;
26
- js.src = "./tiledesk.js";
27
- fjs.parentNode.insertBefore(js, fjs);
28
- }(document, 'script', 'tiledesk-jssdk'));
29
- </script>
30
-
31
-
32
-
33
- <script type="application/javascript">
34
-
35
-
36
-
37
-
38
- window.tileDeskAsyncInit = function() {
39
- window.tiledesk.on('onLoadParams', function(event_data) {
40
- // console.log("onLoadParams", event_data);
41
- // console.log("window.tiledesk", window.tiledesk);
42
-
43
- window.tiledesk.signInWithCustomToken("JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJub21lIjoiQW5kcmVhIiwiY29nbm9tZSI6ImxlbyIsImlhdCI6MTU0MzQyNDU3MCwiZXhwIjoxNTQzNDI0NTczfQ.x1QtbKuVprZjgPv9DaeGa7cnzqtZRivgf5Dhv36qNG8");
44
- });
45
- }
46
- </script>
47
-
48
- </body>
49
- </html>