@chat21/chat21-web-widget 5.0.52 → 5.0.53-rc.2

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 (137) hide show
  1. package/.github/workflows/docker-community-push-latest.yml +1 -0
  2. package/.github/workflows/docker-image-tag-community-tag-push.yml +1 -0
  3. package/CHANGELOG.md +16 -0
  4. package/Dockerfile +2 -2
  5. package/angular.json +4 -21
  6. package/deploy_amazon_beta.sh +1 -1
  7. package/deploy_amazon_prod.sh +1 -1
  8. package/package.json +17 -18
  9. package/src/app/app.component.scss +38 -10
  10. package/src/app/app.component.ts +2 -0
  11. package/src/app/app.module.ts +5 -3
  12. package/src/app/component/conversation-detail/conversation/conversation.component.html +13 -1
  13. package/src/app/component/conversation-detail/conversation/conversation.component.scss +19 -0
  14. package/src/app/component/conversation-detail/conversation/conversation.component.ts +50 -9
  15. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +0 -2
  16. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +0 -10
  17. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +22 -0
  18. package/src/app/component/form/form-builder/form-builder.component.ts +1 -1
  19. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.ts +1 -1
  20. package/src/app/component/form/inputs/form-label/form-label.component.ts +1 -1
  21. package/src/app/component/form/inputs/form-text/form-text.component.ts +2 -2
  22. package/src/app/component/form/inputs/form-textarea/form-textarea.component.ts +2 -2
  23. package/src/app/component/form/prechat-form/prechat-form.component.ts +1 -1
  24. package/src/app/component/home/home.component.html +7 -15
  25. package/src/app/component/message/bubble-message/bubble-message.component.html +1 -4
  26. package/src/app/component/message/bubble-message/bubble-message.component.ts +1 -37
  27. package/src/app/component/message/image/image.component.ts +1 -9
  28. package/src/app/component/message/info-message/info-message.component.html +3 -3
  29. package/src/app/component/message/info-message/info-message.component.ts +0 -10
  30. package/src/app/directives/tooltip.directive.spec.ts +8 -0
  31. package/src/app/directives/tooltip.directive.ts +46 -0
  32. package/src/app/providers/global-settings.service.ts +2 -2
  33. package/src/app/utils/rules.ts +13 -0
  34. package/src/base_script.html +57 -0
  35. package/src/chat21-core/providers/abstract/archivedconversations-handler.service.ts +5 -5
  36. package/src/chat21-core/providers/abstract/conversation-handler.service.ts +6 -6
  37. package/src/chat21-core/providers/abstract/conversations-handler.service.ts +6 -6
  38. package/src/chat21-core/providers/abstract/groups-handler.service.ts +5 -5
  39. package/src/chat21-core/providers/abstract/logger.service.ts +1 -0
  40. package/src/chat21-core/providers/abstract/messagingAuth.service.ts +2 -2
  41. package/src/chat21-core/providers/abstract/presence.service.ts +2 -2
  42. package/src/chat21-core/providers/abstract/typing.service.ts +2 -2
  43. package/src/chat21-core/providers/abstract/upload.service.ts +1 -1
  44. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +1 -1
  45. package/src/chat21-core/providers/firebase/firebase-groups-handler.ts +1 -1
  46. package/src/chat21-core/providers/logger/customLogger.ts +4 -0
  47. package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +1 -1
  48. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +0 -1
  49. package/src/chat21-core/providers/mqtt/mqtt-groups-handler.ts +1 -1
  50. package/src/chat21-core/utils/constants.ts +3 -2
  51. package/src/chat21-core/utils/utils.ts +2 -0
  52. package/src/launch.js +4 -61
  53. package/src/polyfills.ts +0 -10
  54. package/src/test.ts +3 -1
  55. package/tsconfig.json +5 -3
  56. package/dist/3rdpartylicenses.txt +0 -942
  57. package/dist/assets/i18n/en.json +0 -94
  58. package/dist/assets/i18n/es.json +0 -90
  59. package/dist/assets/i18n/fr.json +0 -90
  60. package/dist/assets/i18n/it.json +0 -90
  61. package/dist/assets/images/avatar_bot_tiledesk.svg +0 -1
  62. package/dist/assets/images/chat_human_avatar.svg +0 -12
  63. package/dist/assets/images/f21ico-done.svg +0 -1
  64. package/dist/assets/images/f21ico-done_all.svg +0 -1
  65. package/dist/assets/images/f21ico-schedule.svg +0 -1
  66. package/dist/assets/images/file-alt-solid.png +0 -0
  67. package/dist/assets/images/light_avatar_placeholder.svg +0 -1
  68. package/dist/assets/images/tommy_bot_tiledesk.svg +0 -48
  69. package/dist/assets/images/website_mockup.jpg +0 -0
  70. package/dist/assets/js/chat21client.js +0 -1066
  71. package/dist/assets/js/mqtt/4.1.0/mqtt.min.js +0 -1
  72. package/dist/assets/js/mqtt/4.2.6/mqtt.min.js +0 -1
  73. package/dist/assets/js/mqtt/4.2.8/mqtt.min.js +0 -1
  74. package/dist/assets/sounds/Carme.mp3 +0 -0
  75. package/dist/assets/sounds/justsaying.mp3 +0 -0
  76. package/dist/assets/sounds/pling.mp3 +0 -0
  77. package/dist/assets/styles/tiledesk_v1.scss +0 -22
  78. package/dist/assets/twp/chatbot-panel.html +0 -424
  79. package/dist/assets/twp/index-dev.html +0 -2430
  80. package/dist/assets/twp/index.html +0 -603
  81. package/dist/assets/twp/tiledesk_widget_files/bootstrap.min.css +0 -5
  82. package/dist/assets/twp/tiledesk_widget_files/bootstrap.min.js +0 -7
  83. package/dist/assets/twp/tiledesk_widget_files/facebook.png +0 -0
  84. package/dist/assets/twp/tiledesk_widget_files/font-awesome.min.css +0 -4
  85. package/dist/assets/twp/tiledesk_widget_files/icon +0 -23
  86. package/dist/assets/twp/tiledesk_widget_files/jquery.min.js +0 -2
  87. package/dist/assets/twp/tiledesk_widget_files/linkedin.png +0 -0
  88. package/dist/assets/twp/tiledesk_widget_files/logo-black.png +0 -0
  89. package/dist/assets/twp/tiledesk_widget_files/logo-mobile.png +0 -0
  90. package/dist/assets/twp/tiledesk_widget_files/logo-short.png +0 -0
  91. package/dist/assets/twp/tiledesk_widget_files/logo.png +0 -0
  92. package/dist/assets/twp/tiledesk_widget_files/logo@2x-black.png +0 -0
  93. package/dist/assets/twp/tiledesk_widget_files/telegram.png +0 -0
  94. package/dist/assets/twp/tiledesk_widget_files/twitter.png +0 -0
  95. package/dist/assets/twp/tiledesk_widget_files/website-poly.min.css +0 -5623
  96. package/dist/assets/twp/tiledesk_widget_files/whatsapp.png +0 -0
  97. package/dist/environments/real_data/widget-config-docker.json +0 -28
  98. package/dist/environments/real_data/widget-config-firebase.json +0 -30
  99. package/dist/environments/real_data/widget-config-mqtt.json +0 -27
  100. package/dist/environments/real_data/widget-config-native-mqtt.json +0 -28
  101. package/dist/environments/real_data/widget-config-native-prod.json +0 -27
  102. package/dist/f21ico-done.svg +0 -1
  103. package/dist/f21ico-done_all.svg +0 -1
  104. package/dist/f21ico-schedule.svg +0 -1
  105. package/dist/favicon.ico +0 -0
  106. package/dist/iframe-style.css +0 -189
  107. package/dist/index.html +0 -16
  108. package/dist/launch.js +0 -428
  109. package/dist/main.js +0 -1
  110. package/dist/polyfills-es5.js +0 -1
  111. package/dist/polyfills.js +0 -1
  112. package/dist/runtime.js +0 -1
  113. package/dist/scripts.js +0 -1
  114. package/dist/styles.css +0 -1
  115. package/dist/styles.js +0 -1
  116. package/dist/test-auth-remote.html +0 -95
  117. package/dist/test-auth.html +0 -49
  118. package/dist/test-buttons.html +0 -147
  119. package/dist/test-custom-auth.html +0 -50
  120. package/dist/test-new.html +0 -231
  121. package/dist/test.html +0 -142
  122. package/dist/tiledesk.js +0 -72
  123. package/dist/vendor.js +0 -1
  124. package/dist/widget-config-template.json +0 -29
  125. package/dist/widget-config.json +0 -29
  126. package/e2e/protractor.conf.js +0 -32
  127. package/src/environments/environment.pre.ts +0 -42
  128. package/src/environments/environment.prod.ts +0 -40
  129. package/src/environments/environment.ts +0 -41
  130. package/src/environments/real_data/widget-config-docker.json +0 -28
  131. package/src/environments/real_data/widget-config-firebase.json +0 -30
  132. package/src/environments/real_data/widget-config-mqtt.json +0 -27
  133. package/src/environments/real_data/widget-config-native-mqtt.json +0 -28
  134. package/src/environments/real_data/widget-config-native-prod.json +0 -27
  135. package/src/test-auth-remote.html +0 -95
  136. package/src/test-auth.html +0 -49
  137. package/src/test-buttons.html +0 -147
@@ -19,4 +19,5 @@ jobs:
19
19
  username: ${{ secrets.DOCKERHUB_USERNAME }}
20
20
  password: ${{ secrets.DOCKERHUB_TOKEN }}
21
21
  repository: chat21/chat21-web-widget
22
+ push: true
22
23
  tags: latest
@@ -18,4 +18,5 @@ jobs:
18
18
  username: ${{ secrets.DOCKERHUB_USERNAME }}
19
19
  password: ${{ secrets.DOCKERHUB_TOKEN }}
20
20
  repository: chat21/chat21-web-widget
21
+ push: true
21
22
  tag_with_ref: true
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # chat21-web-widget ver 5.0
2
2
 
3
+ ### 5.0.53-rc.2
4
+ - added: angular 15 engine
5
+ - added: custom tooltip directive
6
+ - changed: buildOptimization ng build parameter to build-optimization
7
+ - removed: ng2-tooltip-directive and ng2-tooltip-directive-ng13fix
8
+ - removed: initializatoin of abstract variables in chat21-core abstract providers
9
+ - removed: enableIvy parameter from tsconfig.json
10
+
11
+ ### 5.0.53-rc.1
12
+ - added: Rules class (work in progress)
13
+ - added: base_script.html to load element inside tiledesk-iframe
14
+ - added: getLoggerConfig to logger service
15
+ - removed: document.write() injection
16
+ - removed: unused html test file
17
+
18
+
3
19
  ### 5.0.52 in PROD
4
20
 
5
21
  ### 5.0.52-rc.4
package/Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
1
  ### STAGE 1: Build ###
2
2
 
3
3
  # We label our stage as ‘builder’
4
- FROM node:12.20.2-alpine as builder
4
+ FROM node:14.21.2-alpine as builder
5
5
 
6
6
  COPY package.json package-lock.json ./
7
7
 
@@ -15,7 +15,7 @@ COPY . .
15
15
 
16
16
  ## Build the angular app in production mode and store the artifacts in dist folder
17
17
 
18
- RUN npm run ng build -- --configuration="prod" --output-path=dist --base-href="./" --output-hashing=none --buildOptimizer=false --vendor-chunk
18
+ RUN npm run ng build -- --configuration="prod" --output-path=dist --base-href="./" --output-hashing=none --build-optimizer=false --vendor-chunk
19
19
 
20
20
 
21
21
  ### STAGE 2: Setup ###
package/angular.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
3
  "version": 1,
4
- "defaultProject": "widget",
5
4
  "newProjectRoot": "projects",
6
5
  "projects": {
7
6
  "widget": {
@@ -27,13 +26,11 @@
27
26
  "src/favicon.ico",
28
27
  "src/assets",
29
28
  "src/test.html",
30
- "src/test-buttons.html",
31
- "src/test-auth.html",
32
- "src/test-auth-remote.html",
33
29
  "src/test-new.html",
34
30
  "src/test-custom-auth.html",
35
31
  "src/tiledesk.js",
36
32
  "src/launch.js",
33
+ "src/base_script.html",
37
34
  "src/iframe-style.css",
38
35
  "src/widget-config-template.json",
39
36
  "src/widget-config.json",
@@ -45,14 +42,13 @@
45
42
  ],
46
43
  "styles": [
47
44
  "src/app/sass/styles.scss",
48
- "node_modules/@ctrl/ngx-emoji-mart/picker.css",
49
- "node_modules/bootstrap/dist/js/bootstrap.min.js",
50
- "node_modules/popper.js/dist/umd/popper.min.js"
45
+ "node_modules/@ctrl/ngx-emoji-mart/picker.css"
51
46
  ],
52
47
  "scripts": [
53
48
  "src/assets/js/mqtt/4.2.6/mqtt.min.js",
54
49
  "node_modules/jquery/dist/jquery.min.js",
55
- "node_modules/bootstrap/dist/js/bootstrap.min.js"
50
+ "node_modules/bootstrap/dist/js/bootstrap.min.js",
51
+ "node_modules/popper.js/dist/umd/popper.min.js"
56
52
  ],
57
53
  "vendorChunk": true,
58
54
  "extractLicenses": false,
@@ -161,19 +157,6 @@
161
157
  "codeCoverage": true
162
158
  }
163
159
  },
164
- "lint": {
165
- "builder": "@angular-devkit/build-angular:tslint",
166
- "options": {
167
- "tsConfig": [
168
- "tsconfig.app.json",
169
- "tsconfig.spec.json",
170
- "e2e/tsconfig.json"
171
- ],
172
- "exclude": [
173
- "**/node_modules/**"
174
- ]
175
- }
176
- },
177
160
  "e2e": {
178
161
  "builder": "@angular-devkit/build-angular:protractor",
179
162
  "options": {
@@ -2,7 +2,7 @@
2
2
  version=`node -e 'console.log(require("./package.json").version)'`
3
3
  echo "version $version"
4
4
 
5
- ng build --configuration="pre" --aot=true --base-href --output-hashing none --buildOptimizer=true
5
+ ng build --configuration="pre" --aot=true --base-href --output-hashing none --build-optimizer=true
6
6
 
7
7
  # ########## --->>>> NATIVE-MQTT folder START <<<<<------ ########## #
8
8
 
@@ -3,7 +3,7 @@ version=`node -e 'console.log(require("./package.json").version)'`
3
3
  echo "version $version"
4
4
 
5
5
  # --build-optimizer=false if localstorage is disabled (webview) appears https://github.com/firebase/angularfire/issues/970
6
- ng build --configuration="prod" --aot=true --base-href --output-hashing none --buildOptimizer=true --vendor-chunk=true
6
+ ng build --configuration="prod" --aot=true --base-href --output-hashing none --build-optimizer=true --vendor-chunk=true
7
7
 
8
8
  cd dist
9
9
  # aws s3 sync . s3://tiledesk-widget/v5/latest/
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.2",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -18,18 +18,18 @@
18
18
  },
19
19
  "private": false,
20
20
  "dependencies": {
21
- "@angular/animations": "^12.2.16",
22
- "@angular/cdk": "^12.2.13",
23
- "@angular/common": "^12.2.16",
24
- "@angular/compiler": "~12.2.16",
25
- "@angular/core": "~12.2.16",
26
- "@angular/forms": "~12.2.16",
27
- "@angular/localize": "^12.2.16",
28
- "@angular/platform-browser": "^12.2.16",
29
- "@angular/platform-browser-dynamic": "~12.2.16",
30
- "@angular/router": "~12.2.16",
21
+ "@angular/animations": "^15.0.4",
22
+ "@angular/cdk": "^15.0.3",
23
+ "@angular/common": "^15.0.4",
24
+ "@angular/compiler": "^15.0.4",
25
+ "@angular/core": "^15.0.4",
26
+ "@angular/forms": "^15.0.4",
27
+ "@angular/localize": "^15.0.4",
28
+ "@angular/platform-browser": "^15.0.4",
29
+ "@angular/platform-browser-dynamic": "^15.0.4",
30
+ "@angular/router": "^15.0.4",
31
31
  "@ctrl/ngx-emoji-mart": "^5.1.2",
32
- "@ngx-translate/core": "^12.1.2",
32
+ "@ngx-translate/core": "^14.0.0",
33
33
  "@ngx-translate/http-loader": "^4.0.0",
34
34
  "@popperjs/core": "^2.11.5",
35
35
  "@types/marked": "^4.0.3",
@@ -41,7 +41,6 @@
41
41
  "jquery": "^3.6.0",
42
42
  "marked": "^4.0.16",
43
43
  "moment": "^2.29.3",
44
- "ng2-tooltip-directive": "^2.10.3",
45
44
  "ngx-logger": "^5.0.11",
46
45
  "ngx-moment": "^6.0.2",
47
46
  "popper.js": "^1.16.1",
@@ -51,10 +50,10 @@
51
50
  "zone.js": "~0.11.4"
52
51
  },
53
52
  "devDependencies": {
54
- "@angular-devkit/build-angular": "~12.2.17",
55
- "@angular/cli": "~12.2.17",
56
- "@angular/compiler-cli": "~12.2.16",
57
- "@angular/language-service": "~12.2.16",
53
+ "@angular-devkit/build-angular": "^15.0.4",
54
+ "@angular/cli": "^15.0.4",
55
+ "@angular/compiler-cli": "^15.0.4",
56
+ "@angular/language-service": "^15.0.4",
58
57
  "@types/jasmine": "^3.6.11",
59
58
  "@types/jasminewd2": "~2.0.3",
60
59
  "@types/node": "^12.11.1",
@@ -69,6 +68,6 @@
69
68
  "protractor": "~7.0.0",
70
69
  "ts-node": "~7.0.0",
71
70
  "tslint": "~6.1.0",
72
- "typescript": "~4.3.5"
71
+ "typescript": "4.8.4"
73
72
  }
74
73
  }
@@ -5,7 +5,7 @@
5
5
  @import 'src/app/sass/variables';
6
6
  @import url('./sass/animations.scss');
7
7
  @import url("./sass/hover.css");
8
- @import '~@ctrl/ngx-emoji-mart/picker';
8
+ @import '@ctrl/ngx-emoji-mart/picker';
9
9
  // @import "~bootstrap/dist/css/bootstrap.css";
10
10
  /** custom scroll bar **/
11
11
  input, select:focus, textarea {
@@ -47,15 +47,6 @@ input, select:focus, textarea {
47
47
  --button-in-msg-font-size: 15px;
48
48
  }
49
49
 
50
- .chat-tooltip {
51
- font-family: 'Roboto','Google Sans', Helvetica, Arial, sans-serif;
52
- font-size: 12px;
53
- font-style: normal;
54
- letter-spacing: normal;
55
- font-stretch: normal;
56
- font-variant: normal;
57
- font-weight: 300;
58
- }
59
50
 
60
51
  body {
61
52
  margin:0px;
@@ -216,7 +207,44 @@ textarea::placeholder {
216
207
  }
217
208
  }
218
209
 
210
+ }
211
+
212
+ .tooltip-container {
213
+ font-family: 'Roboto','Google Sans', Helvetica, Arial, sans-serif;
214
+ font-size: 12px;
215
+ font-style: normal;
216
+ letter-spacing: normal;
217
+ font-stretch: normal;
218
+ font-variant: normal;
219
+ font-weight: 300;
220
+ z-index: 100;
221
+ position: fixed;
222
+ padding: 6px 12px;
223
+ line-height: initial;
224
+ color: black;
225
+ width: auto;
226
+ background:rgb(255, 255, 255);
227
+ border-radius: 10px;
228
+ -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.3);
229
+ box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.3);
230
+ box-sizing: border-box;
231
+ opacity: 0;
232
+ transform: translate(-80%, -70%);
233
+ animation: tooltip-slide 0.18s ease-out 0.5s;
234
+ animation-fill-mode: forwards;
235
+ pointer-events: none;
236
+ }
237
+
238
+ @keyframes tooltip-slide {
239
+ 0% {
240
+ opacity: 0;
241
+ transform: translate(-50%, -70%);
219
242
  }
243
+ 100% {
244
+ opacity: 1;
245
+ transform: translate(-50%, -50%);
246
+ }
247
+ }
220
248
 
221
249
  chat-root {
222
250
  position: absolute;
@@ -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,
@@ -57,7 +57,6 @@ import { environment } from 'src/environments/environment';
57
57
  //THIRD-PART MODULES
58
58
  import { TranslateModule } from '@ngx-translate/core';
59
59
  import { MomentModule } from 'ngx-moment';
60
- import { TooltipModule } from 'ng2-tooltip-directive';
61
60
  import { PickerModule } from '@ctrl/ngx-emoji-mart';
62
61
  import { INGXLoggerMetadata, LoggerModule, NGXLogger, NgxLoggerLevel, NGXLoggerServerService, TOKEN_LOGGER_SERVER_SERVICE } from "ngx-logger";
63
62
 
@@ -127,6 +126,8 @@ import { Triggerhandler } from 'src/chat21-core/utils/triggerHandler';
127
126
  import { WaitingService } from './providers/waiting.service';
128
127
  import { StarRatingWidgetService } from './providers/star-rating-widget.service';
129
128
  import { LikeUnlikeComponent } from './component/message/like-unlike/like-unlike.component';
129
+ import { Rules } from './utils/rules';
130
+ import { TooltipDirective } from 'src/app/directives/tooltip.directive';
130
131
 
131
132
 
132
133
  const appInitializerFn = (appConfig: AppConfigService, logger: NGXLogger) => {
@@ -282,7 +283,8 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
282
283
  HtmlEntitiesEncodePipe,
283
284
  MarkedPipe,
284
285
  SafeHtmlPipe,
285
- LikeUnlikeComponent
286
+ LikeUnlikeComponent,
287
+ TooltipDirective
286
288
  ],
287
289
  imports: [
288
290
  BrowserModule,
@@ -292,7 +294,6 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
292
294
  FormsModule,
293
295
  ReactiveFormsModule,
294
296
  MomentModule,
295
- TooltipModule,
296
297
  PickerModule,
297
298
  TranslateModule.forRoot(//),
298
299
  {
@@ -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,15 +139,10 @@ 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
- tooltipOptions = {
143
- 'show-delay': 1500,
144
- 'tooltip-class': 'chat-tooltip',
145
- 'theme': 'light',
146
- 'shadow': false,
147
- 'hide-delay-mobile': 0,
148
- 'hideDelayAfterClick': 3000,
149
- 'hide-delay': 200
150
- };
142
+ // ========== begin:: DRAG & DROP =======
143
+ isHovering: boolean = false
144
+ dropEvent: Event
145
+ // ========== end:: DRAG & DROP =======
151
146
 
152
147
  translationMapHeader: Map<string, string>;
153
148
  translationMapFooter: Map<string, string>;
@@ -1250,4 +1245,50 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
1250
1245
  }
1251
1246
  // ========= END:: TRIGGER FUNCTIONS ============//
1252
1247
 
1248
+
1249
+ drop(event){
1250
+ event.preventDefault()
1251
+ event.stopPropagation()
1252
+
1253
+ this.logger.log('[CONV-COMP] ----> FILE - DROP ev ', event)
1254
+ const fileList = event.dataTransfer.files
1255
+ this.logger.log('[CONV-COMP] ----> FILE - DROP ev.dataTransfer.files ',fileList)
1256
+ this.isHovering = false
1257
+ if (fileList.length > 0) {
1258
+ const file: File = fileList[0]
1259
+ this.logger.log('[CONV-COMP] ----> FILE - DROP file ', file)
1260
+
1261
+ var mimeType = fileList[0].type
1262
+ this.logger.log('[CONV-COMP] ----> FILE - DROP mimeType files ', mimeType)
1263
+
1264
+ // if (mimeType.startsWith("image") || mimeType.startsWith("application")) {
1265
+ // this.logger.log('[CONV-COMP] ----> FILE - DROP mimeType files: ', this.appConfigProvider.getConfig().fileUploadAccept);
1266
+ // this.checkAcceptedFile(mimeType);
1267
+ // const isAccepted = this.checkAcceptedFile(mimeType)
1268
+ // this.logger.log('[CONV-COMP] > checkAcceptedFile - fileUploadAccept isAcceptFile FILE - DROP',isAccepted)
1269
+ // if (isAccepted === true) {
1270
+ this.dropEvent = event
1271
+ // } else {
1272
+ // this.logger.log( '[CONV-COMP] ----> FILE - DROP mimeType files ', mimeType,'NOT SUPPORTED FILE TYPE')
1273
+ // this.presentToast(this.translationsMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'), 'danger','toast-custom-class', 5000 )
1274
+ // // this.presentToastOnlyImageFilesAreAllowedToDrag()
1275
+ // }
1276
+
1277
+ }
1278
+ }
1279
+
1280
+ allowDrop(event: any) {
1281
+ event.preventDefault()
1282
+ event.stopPropagation()
1283
+ this.logger.log('[CONV-COMP] ----> FILE - (dragover) allowDrop ev ', event)
1284
+ this.isHovering = true
1285
+ }
1286
+
1287
+ drag(event){
1288
+ event.preventDefault()
1289
+ event.stopPropagation()
1290
+ console.log('dragleave-->', event)
1291
+ this.isHovering = false
1292
+ }
1293
+
1253
1294
  }
@@ -1,5 +1,4 @@
1
1
  import { MomentModule } from 'ngx-moment';
2
- import { TooltipModule } from 'ng2-tooltip-directive';
3
2
  import { async, ComponentFixture, TestBed, waitForAsync, inject } from '@angular/core/testing';
4
3
 
5
4
  import { ConversationContentComponent } from './conversation-content.component';
@@ -36,7 +35,6 @@ describe('ConversationContentComponent', () => {
36
35
  HtmlEntitiesEncodePipe,
37
36
  ],
38
37
  imports: [
39
- TooltipModule,
40
38
  MomentModule
41
39
  ],
42
40
  providers: [
@@ -67,16 +67,6 @@ export class ConversationContentComponent implements OnInit {
67
67
  MESSAGE_TYPE_OTHERS = MESSAGE_TYPE_OTHERS;
68
68
  // ========== end:: check message type functions ======= //
69
69
 
70
- tooltipOptions = {
71
- 'show-delay': 1500,
72
- 'tooltip-class': 'chat-tooltip',
73
- 'theme': 'light',
74
- 'shadow': false,
75
- 'hide-delay-mobile': 0,
76
- 'hideDelayAfterClick': 3000,
77
- 'hide-delay': 200
78
- };
79
-
80
70
  urlBOTImage = 'https://s3.eu-west-1.amazonaws.com/tiledesk-widget/dev/2.0.4-beta.7/assets/images/avatar_bot_tiledesk.svg'
81
71
  uploadProgress: number;
82
72
  showUploadProgress: boolean = false;
@@ -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
  }
@@ -52,7 +52,7 @@ export class FormBuilderComponent implements OnInit {
52
52
  }
53
53
  }
54
54
 
55
- buildFormGroup(inputJson: Array<FormArray>): FormGroup {
55
+ buildFormGroup(inputJson: Array<FormArray>): FormGroup<any> {
56
56
  let objectFormBuilder: { [key: string]: FormControl } = {}
57
57
  let restoreDefault = false;
58
58
  let initIndex:number = 1411;
@@ -17,7 +17,7 @@ export class FormCheckboxComponent implements OnInit {
17
17
  @Input() hasSubmitted: boolean;
18
18
  @Output() onKeyEnterPressed = new EventEmitter<any>();
19
19
 
20
- form: FormGroup;
20
+ form: FormGroup<any>;
21
21
  constructor(private rootFormGroup: FormGroupDirective,
22
22
  private elementRef: ElementRef) { }
23
23
 
@@ -14,7 +14,7 @@ export class FormLabelComponent implements OnInit {
14
14
  @Input() controlName: string;
15
15
  @Input() hasSubmitted: boolean;
16
16
 
17
- form: FormGroup;
17
+ form: FormGroup<any>;
18
18
  constructor(private rootFormGroup: FormGroupDirective) { }
19
19
 
20
20
  ngOnInit() {
@@ -18,13 +18,13 @@ export class FormTextComponent implements OnInit {
18
18
  @Output() onKeyEnterPressed = new EventEmitter<any>();
19
19
 
20
20
  @ViewChild('div_input') input: ElementRef;
21
- form: FormGroup;
21
+ form: FormGroup<any>;
22
22
  inputType: string = 'text'
23
23
  constructor(private rootFormGroup: FormGroupDirective,
24
24
  private elementRef: ElementRef) { }
25
25
 
26
26
  ngOnInit() {
27
- this.form = this.rootFormGroup.control as FormGroup;
27
+ this.form = this.rootFormGroup.control as FormGroup<any>;
28
28
  if(this.form && this.form.controls && this.form.controls[this.controlName]){
29
29
  this.form.controls[this.controlName].valueChanges.subscribe((value) => {
30
30
  this.hasSubmitted= false;
@@ -17,12 +17,12 @@ export class FormTextareaComponent implements OnInit {
17
17
  @Input() hasSubmitted: boolean;
18
18
  @Output() onKeyEnterPressed = new EventEmitter<any>();
19
19
  @ViewChild('div_input') input: ElementRef;
20
- form: FormGroup;
20
+ form: FormGroup<any>;
21
21
  constructor(private rootFormGroup: FormGroupDirective,
22
22
  private elementRef: ElementRef) { }
23
23
 
24
24
  ngOnInit() {
25
- this.form = this.rootFormGroup.control as FormGroup;
25
+ this.form = this.rootFormGroup.control as FormGroup<any>;
26
26
  if(this.form && this.form.controls && this.form.controls[this.controlName]){
27
27
  this.form.controls[this.controlName].valueChanges.subscribe((value) => {
28
28
  this.hasSubmitted= false;
@@ -23,7 +23,7 @@ export class PrechatFormComponent implements OnInit, AfterViewInit {
23
23
 
24
24
 
25
25
  // ========= begin:: component variables ======= //
26
- preChatFormGroup: FormGroup;
26
+ preChatFormGroup: FormGroup<any>;
27
27
  userFullname: string;
28
28
  userEmail: string;
29
29
  // ========= end:: component variables ======= //