@chat21/chat21-web-widget 5.0.55 → 5.0.56-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 (130) hide show
  1. package/.github/workflows/build.yml +1 -0
  2. package/CHANGELOG.md +16 -0
  3. package/angular.json +6 -7
  4. package/package.json +5 -4
  5. package/src/app/app.component.html +1 -11
  6. package/src/app/app.component.scss +12 -13
  7. package/src/app/app.component.spec.ts +0 -2
  8. package/src/app/app.component.ts +29 -35
  9. package/src/app/app.module.ts +4 -5
  10. package/src/app/component/conversation-detail/conversation/conversation.component.html +1 -10
  11. package/src/app/component/conversation-detail/conversation/conversation.component.scss +5 -428
  12. package/src/app/component/conversation-detail/conversation/conversation.component.ts +23 -25
  13. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +7 -66
  14. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.scss +11 -81
  15. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +0 -3
  16. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +6 -6
  17. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +7 -32
  18. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +11 -11
  19. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +8 -8
  20. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html +4 -25
  21. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.scss +5 -5
  22. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.ts +4 -88
  23. package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.html +7 -16
  24. package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.ts +2 -26
  25. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.html +1 -11
  26. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.scss +5 -5
  27. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.ts +2 -19
  28. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.html +10 -42
  29. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.scss +1 -2
  30. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.ts +2 -3
  31. package/src/app/component/form/form-builder/form-builder.component.html +0 -1
  32. package/src/app/component/form/form-builder/form-builder.component.scss +1 -1
  33. package/src/app/component/form/form-builder/form-builder.component.ts +4 -5
  34. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.scss +1 -2
  35. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.ts +2 -3
  36. package/src/app/component/form/inputs/form-label/form-label.component.ts +0 -1
  37. package/src/app/component/form/inputs/form-text/form-text.component.scss +3 -13
  38. package/src/app/component/form/inputs/form-text/form-text.component.ts +1 -2
  39. package/src/app/component/form/inputs/form-textarea/form-textarea.component.html +0 -13
  40. package/src/app/component/form/inputs/form-textarea/form-textarea.component.scss +4 -4
  41. package/src/app/component/form/inputs/form-textarea/form-textarea.component.ts +0 -10
  42. package/src/app/component/form/prechat-form/prechat-form.component.html +0 -2
  43. package/src/app/component/form/prechat-form/prechat-form.component.scss +2 -2
  44. package/src/app/component/form/prechat-form/prechat-form.component.ts +2 -2
  45. package/src/app/component/home/home.component.scss +7 -7
  46. package/src/app/component/home/home.component.ts +1 -4
  47. package/src/app/component/home-conversations/home-conversations.component.scss +7 -7
  48. package/src/app/component/home-conversations/home-conversations.component.ts +9 -12
  49. package/src/app/component/last-message/last-message.component.scss +4 -4
  50. package/src/app/component/last-message/last-message.component.ts +4 -7
  51. package/src/app/component/launcher-button/launcher-button.component.ts +3 -3
  52. package/src/app/component/list-all-conversations/list-all-conversations.component.scss +2 -2
  53. package/src/app/component/list-all-conversations/list-all-conversations.component.ts +3 -3
  54. package/src/app/component/list-conversations/list-conversations.component.html +1 -1
  55. package/src/app/component/list-conversations/list-conversations.component.scss +3 -3
  56. package/src/app/component/list-conversations/list-conversations.component.ts +3 -6
  57. package/src/app/component/menu-options/menu-options.component.html +1 -8
  58. package/src/app/component/menu-options/menu-options.component.scss +4 -4
  59. package/src/app/component/menu-options/menu-options.component.ts +1 -1
  60. package/src/app/component/message/bubble-message/bubble-message.component.html +3 -4
  61. package/src/app/component/message/bubble-message/bubble-message.component.scss +3 -3
  62. package/src/app/component/message/bubble-message/bubble-message.component.spec.ts +0 -2
  63. package/src/app/component/message/bubble-message/bubble-message.component.ts +10 -15
  64. package/src/app/component/message/buttons/action-button/action-button.component.scss +6 -6
  65. package/src/app/component/message/buttons/link-button/link-button.component.scss +7 -7
  66. package/src/app/component/message/buttons/text-button/text-button.component.scss +8 -8
  67. package/src/app/component/message/frame/frame.component.scss +1 -1
  68. package/src/app/component/message/frame/frame.component.ts +1 -1
  69. package/src/app/component/message/html/html.component.scss +4 -4
  70. package/src/app/component/message/html/html.component.ts +1 -2
  71. package/src/app/component/message/image/image.component.scss +1 -1
  72. package/src/app/component/message/image/image.component.ts +2 -3
  73. package/src/app/component/message/info-message/info-message.component.html +2 -1
  74. package/src/app/component/message/info-message/info-message.component.scss +6 -6
  75. package/src/app/component/message/like-unlike/like-unlike.component.scss +1 -1
  76. package/src/app/component/message/like-unlike/like-unlike.component.ts +2 -2
  77. package/src/app/component/message/text/text.component.scss +2 -2
  78. package/src/app/component/message/text/text.component.ts +1 -1
  79. package/src/app/component/message-attachment/message-attachment.component.ts +1 -1
  80. package/src/app/component/selection-department/selection-department.component.scss +6 -6
  81. package/src/app/component/selection-department/selection-department.component.ts +2 -2
  82. package/src/app/component/send-button/send-button.component.ts +1 -2
  83. package/src/app/component/star-rating-widget/star-rating-widget.component.scss +6 -6
  84. package/src/app/component/star-rating-widget/star-rating-widget.component.ts +2 -2
  85. package/src/app/pipe/date-ago.pipe.spec.ts +8 -0
  86. package/src/app/pipe/date-ago.pipe.ts +42 -0
  87. package/src/app/providers/app-config.service.ts +0 -1
  88. package/src/app/providers/global-settings.service.ts +3 -31
  89. package/src/app/providers/star-rating-widget.service.ts +4 -4
  90. package/src/app/providers/translator.service.ts +3 -11
  91. package/src/app/providers/waiting.service.ts +2 -2
  92. package/src/app/sass/_variables.scss +29 -26
  93. package/src/app/utils/globals.ts +4 -34
  94. package/src/app/utils/rules.ts +5 -7
  95. package/src/app/utils/utils.ts +47 -37
  96. package/src/assets/i18n/en.json +0 -2
  97. package/src/assets/i18n/es.json +0 -2
  98. package/src/assets/i18n/fr.json +0 -2
  99. package/src/assets/i18n/it.json +0 -2
  100. package/src/assets/twp/index.html +6 -60
  101. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +15 -23
  102. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +21 -20
  103. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +15 -13
  104. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +16 -23
  105. package/src/chat21-core/providers/firebase/firebase-groups-handler.ts +15 -11
  106. package/src/chat21-core/providers/firebase/firebase-image-repo.ts +13 -4
  107. package/src/chat21-core/providers/firebase/firebase-init-service.ts +3 -3
  108. package/src/chat21-core/providers/firebase/firebase-notifications.ts +11 -9
  109. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +14 -11
  110. package/src/chat21-core/providers/firebase/firebase-typing.service.ts +17 -11
  111. package/src/chat21-core/providers/firebase/firebase-upload.service.ts +12 -9
  112. package/src/chat21-core/providers/localSessionStorage.ts +2 -15
  113. package/src/chat21-core/providers/mqtt/chat-service.ts +12 -2
  114. package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +1 -34
  115. package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +4 -6
  116. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +1 -11
  117. package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +13 -7
  118. package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +3 -3
  119. package/src/chat21-core/providers/mqtt/mqtt-typing.service.ts +3 -3
  120. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +0 -1
  121. package/src/chat21-core/utils/user-typing/user-typing.component.scss +3 -3
  122. package/src/chat21-core/utils/utils.ts +47 -163
  123. package/src/launch.js +42 -12
  124. package/src/models/message.ts +0 -23
  125. package/src/test-new.html +0 -6
  126. package/src/app/providers/settings-saver.service.spec.ts +0 -17
  127. package/src/app/providers/settings-saver.service.ts +0 -56
  128. package/src/app/providers/storage.service.spec.ts +0 -16
  129. package/src/app/providers/storage.service.ts +0 -220
  130. package/src/app/utils/translations.ts +0 -122
@@ -4,6 +4,7 @@ on:
4
4
  branches:
5
5
  - master # The default branch
6
6
  - branch-* # The other branches to be analyzed
7
+ - features/*
7
8
  pull_request:
8
9
  types: [opened, synchronize, reopened]
9
10
  jobs:
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # chat21-web-widget ver 5.0
2
2
 
3
+ ### 5.0.56-rc.2
4
+ - added: firebase laxy loading
5
+ - added: dynamic base herf to load chunk files
6
+ - added: get and set method for chatClient mqtt lib
7
+ - changed: fire initWidget to 'complete' event of document
8
+ - changed: replace moment with dayjs
9
+ - removed: @import for sass/variables constants file
10
+ - removed: unsed directives and imports
11
+ - removed: ngx-moment and moment in favour of dayjs
12
+
13
+ ### 5.0.56-rc.1
14
+ - added: custom colors to senderFullname to better distinguish the user
15
+ - bug-fixed: cannot read text.trim() of undefined if no text is sent with an image
16
+ - bug-fixed: markdown not split work correctly
17
+ - bug-fixed: dispose loader bubbles if wait command message is received
18
+
3
19
  ### 5.0.55 in PROD
4
20
  - added: preflight property to /message API body
5
21
 
package/angular.json CHANGED
@@ -18,19 +18,18 @@
18
18
  "builder": "@angular-devkit/build-angular:browser",
19
19
  "options": {
20
20
  "outputPath": "dist",
21
+ "baseHref":"/",
21
22
  "index": "src/index.html",
22
23
  "main": "src/main.ts",
23
24
  "polyfills": "src/polyfills.ts",
24
25
  "tsConfig": "tsconfig.app.json",
25
26
  "assets": [
26
- "src/favicon.ico",
27
27
  "src/assets",
28
28
  "src/test.html",
29
29
  "src/test-new.html",
30
30
  "src/test-custom-auth.html",
31
31
  "src/tiledesk.js",
32
32
  "src/launch.js",
33
- "src/base_script.html",
34
33
  "src/iframe-style.css",
35
34
  "src/widget-config-template.json",
36
35
  "src/widget-config.json",
@@ -41,8 +40,7 @@
41
40
  "src/environments/real_data/widget-config-native-prod.json"
42
41
  ],
43
42
  "styles": [
44
- "src/app/sass/styles.scss",
45
- "node_modules/@ctrl/ngx-emoji-mart/picker.css"
43
+ "src/app/sass/styles.scss"
46
44
  ],
47
45
  "scripts": [
48
46
  "src/assets/js/mqtt/4.2.6/mqtt.min.js",
@@ -54,8 +52,10 @@
54
52
  "buildOptimizer": false,
55
53
  "allowedCommonJsDependencies": [
56
54
  "rxjs-compat",
57
- "moment",
58
- "idb"
55
+ "idb",
56
+ "accept-language-parser",
57
+ "file-saver",
58
+ "dayjs"
59
59
  ],
60
60
  "sourceMap": true,
61
61
  "optimization": false,
@@ -146,7 +146,6 @@
146
146
  "tsConfig": "tsconfig.spec.json",
147
147
  "karmaConfig": "karma.conf.js",
148
148
  "assets": [
149
- "src/favicon.ico",
150
149
  "src/assets"
151
150
  ],
152
151
  "styles": [
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.55",
4
+ "version": "5.0.56-rc.2",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -14,7 +14,8 @@
14
14
  "build": "ng build",
15
15
  "test": "ng test",
16
16
  "lint": "ng lint",
17
- "e2e": "ng e2e"
17
+ "e2e": "ng e2e",
18
+ "source-map-explorer": "source-map-explorer dist/*.js"
18
19
  },
19
20
  "private": false,
20
21
  "dependencies": {
@@ -35,15 +36,15 @@
35
36
  "@types/marked": "^4.0.3",
36
37
  "accept-language-parser": "^1.5.0",
37
38
  "bootstrap": "^5.1.3",
39
+ "dayjs": "^1.11.7",
38
40
  "file-saver": "^2.0.5",
39
41
  "firebase": "^8.6.7",
40
42
  "humanize-duration-ts": "^2.1.1",
41
43
  "marked": "^4.0.16",
42
- "moment": "^2.29.3",
43
44
  "ngx-logger": "^5.0.11",
44
- "ngx-moment": "^6.0.2",
45
45
  "popper.js": "^1.16.1",
46
46
  "rxjs": "~6.5.1",
47
+ "source-map-explorer": "^2.5.3",
47
48
  "tslib": "^2.0.0",
48
49
  "uuid": "^8.3.2",
49
50
  "zone.js": "~0.11.4"
@@ -1,18 +1,11 @@
1
1
 
2
2
  <div id="tiledesk-container" [class.active]="g.isShown" tabindex="9999">
3
- <!-- [class.active]="isLogged" onFocus="document.querySelector('.btn-new-conversation').focus()" -->
4
- <!--
5
- ****** WINDOW CHAT CONVERSATION ******
6
- [class.active]="g.isOpen" -> su firefox nn funziona bene, aggiunto come style inline
7
- 'background-color':g.themeColor,
8
- -->
9
3
 
10
4
  <div id="chat21-conversations"
11
5
  [ngClass]="{ 'swing-in-bottom-fwd' : g.isOpen === true, 'full-screen-mode' : g.fullscreenMode === true, 'c21-align-left' : g.align === 'left', 'c21-align-right' : g.align !== 'left'}"
12
6
  [ngStyle]="{ 'display': (g.isOpen == true)?'block':'none', 'bottom': g.marginY+'px', 'left':(g.align==='left')?g.marginX+'px':'', 'right':(g.align==='right')?g.marginX+'px':'' }">
13
7
 
14
8
  <div *ngIf="isOpenHome && g.senderId" class="modal-page active">
15
- <!-- [class.active]="true" -->
16
9
  <chat-home
17
10
  [listConversations]="listConversations"
18
11
  [archivedConversations]="archivedConversations"
@@ -29,7 +22,6 @@
29
22
  </div>
30
23
 
31
24
  <div *ngIf="isOpenAllConversation && g.senderId" class="modal-page active">
32
- <!-- [class.active]="true" -->
33
25
  <chat-list-all-conversations
34
26
  [listConversations]="listConversations"
35
27
  [archivedConversations]="archivedConversations"
@@ -67,7 +59,7 @@
67
59
  ****************************************
68
60
  ******* MODALE SELECT DEPARTMENT *******
69
61
  *************** STEP 1 *****************
70
- [class.active]="isOpenSelectionDepartment" -->
62
+ -->
71
63
  <div *ngIf="isOpenSelectionDepartment" class="modal-page selection-department active">
72
64
  <chat-selection-department
73
65
  (onBeforeDepartmentsFormRender)="triggerHandler.triggerOnbeforeDepartmentsFormRender($event)"
@@ -80,7 +72,6 @@
80
72
  *******************************************
81
73
  *********** MODALE PRECHAT FORM ***********
82
74
  **************** STEP 2 *******************
83
- [class.active]="g.isOpenPrechatForm === true"
84
75
  -->
85
76
  <div *ngIf="g.isOpenPrechatForm && g.senderId" class="modal-page prechat-form active">
86
77
  <chat-prechat-form
@@ -94,7 +85,6 @@
94
85
  ****************************************
95
86
  *********** MODALE RATE CHAT ***********
96
87
  ****************************************
97
- [class.active]="g.isOpenStartRating === true"
98
88
  -->
99
89
  <div *ngIf="g.isOpenStartRating" class="modal-page star-rating-widget active">
100
90
  <chat-star-rating-widget
@@ -2,7 +2,6 @@
2
2
  @import url('https://fonts.googleapis.com/css?family=Roboto:400,700,300|Material+Icons');
3
3
  @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,400;0,700;1,300;1,400');
4
4
  @import 'src/app/sass/normalize.scss';
5
- @import 'src/app/sass/variables';
6
5
  @import url('./sass/animations.scss');
7
6
  @import url("./sass/hover.css");
8
7
  @import '@ctrl/ngx-emoji-mart/picker';
@@ -42,8 +41,8 @@ input, select:focus, textarea {
42
41
  // background: #777;
43
42
  // }
44
43
 
45
- :root {
46
- --button-in-msg-background-color: #{$blue};
44
+ :host {
45
+ --button-in-msg-background-color: --black;
47
46
  --button-in-msg-font-size: 15px;
48
47
  }
49
48
 
@@ -172,7 +171,7 @@ body {
172
171
 
173
172
 
174
173
  textarea::placeholder {
175
- color: $gray;
174
+ color: var(--gray);
176
175
  font-weight: 300;
177
176
  }
178
177
 
@@ -269,7 +268,7 @@ chat-root {
269
268
  line-height: 20px!important;
270
269
  outline: none!important;
271
270
  box-shadow:none!important;
272
- border: 0px solid $trasp-light-black!important;
271
+ border: 0px solid var(--trasp-light-black)!important;
273
272
  }
274
273
 
275
274
  // ========= BEGIN: CSS APP.COMPONENT ========= //
@@ -364,7 +363,7 @@ chat-root {
364
363
  .time {
365
364
  display: none;
366
365
  font-size: 1em;
367
- color: $gray;
366
+ color: var(--gray);
368
367
  text-align: left;
369
368
  margin: 0px;
370
369
  padding: 0px 40px;
@@ -380,11 +379,11 @@ chat-root {
380
379
  // === CSS LINKS === //
381
380
  /* .messages.msg_receive a */
382
381
  .msg_receive a {
383
- color: $bck-msg-sent;
382
+ color: var(--bck-msg-sent);
384
383
  }
385
384
 
386
385
  img {
387
- max-width: $max-width-images;
386
+ max-width: var(--max-width-images);
388
387
  }
389
388
 
390
389
  // === CSS BUTTON === //
@@ -398,7 +397,7 @@ chat-root {
398
397
  text-align: center;
399
398
  font-size: 1em;
400
399
  border-radius: 40px;
401
- background-color: $blue;
400
+ background-color: var(--blue);
402
401
  color: #ffffff;
403
402
  border: 0px;
404
403
 
@@ -419,7 +418,7 @@ chat-root {
419
418
  button.c21-button-link {
420
419
  font-weight: 400;
421
420
  font-size: 14px;
422
- color: $blue;
421
+ color: var(--blue);
423
422
  text-decoration: none;
424
423
  background-color: transparent;
425
424
  border: 1px solid transparent;
@@ -441,7 +440,7 @@ chat-root {
441
440
  font-size: 1em;
442
441
  line-height: 1.2em;
443
442
  border-radius: 50%;
444
- background-color: $red;
443
+ background-color: red;
445
444
  color: white;
446
445
  text-align: center;
447
446
  margin-top: -10px;
@@ -500,7 +499,7 @@ chat-root {
500
499
  #chat21-spinner > div {
501
500
  width: 12px;
502
501
  height: 12px;
503
- background-color: $blue;
502
+ background-color: var(--blue);
504
503
  border-radius: 100%;
505
504
  display: inline-block;
506
505
  -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
@@ -517,7 +516,7 @@ chat-root {
517
516
  #chat21-spinner span {
518
517
  display: block;
519
518
  margin: 0.5em 0 0 0;
520
- color: $black;
519
+ color: var(--black);
521
520
  /* text-transform: uppercase; */
522
521
  font-family: 'Roboto', sans-serif;
523
522
  -webkit-animation: pulse 2000ms linear infinite;
@@ -5,7 +5,6 @@ import { AppComponent } from './app.component';
5
5
  import { GlobalSettingsService } from './providers/global-settings.service';
6
6
  import { HttpClientTestingModule } from '@angular/common/http/testing';
7
7
  import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
8
- import { SettingsSaverService } from './providers/settings-saver.service';
9
8
  import { TranslatorService } from './providers/translator.service';
10
9
  import { TranslateModule } from '@ngx-translate/core';
11
10
  import { CustomTranslateService } from '../chat21-core/providers/custom-translate.service';
@@ -43,7 +42,6 @@ describe('AppComponent', () => {
43
42
  GlobalSettingsService,
44
43
  AppStorageService,
45
44
  AppConfigService,
46
- SettingsSaverService,
47
45
  TranslatorService,
48
46
  CustomTranslateService,
49
47
  ChatManager,
@@ -3,7 +3,6 @@ import { TYPE_DIRECT } from './../chat21-core/utils/constants';
3
3
  import { AfterViewInit, Component, ElementRef, HostListener, NgZone, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
4
4
  import { environment } from 'src/environments/environment';
5
5
  import { Subscription } from 'rxjs/internal/Subscription';
6
- import * as moment from 'moment';
7
6
  import { v4 as uuidv4 } from 'uuid';
8
7
  //COMPONENTS
9
8
  import { EyeeyeCatcherCardComponent } from './component/eyeeye-catcher-card/eyeeye-catcher-card.component';
@@ -18,32 +17,32 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
18
17
  import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
19
18
  import { TiledeskRequestsService } from 'src/chat21-core/providers/tiledesk/tiledesk-requests.service';
20
19
  /** CONVERSATIONS - MESSAGE SERVICES */
21
- import { MessagingAuthService } from 'src/chat21-core/providers/abstract/messagingAuth.service';
22
- import { ChatManager } from 'src/chat21-core/providers/chat-manager';
23
- import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
24
- import { Triggerhandler } from 'src/chat21-core/utils/triggerHandler';
25
20
  import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
26
- import { ConversationHandlerBuilderService } from 'src/chat21-core/providers/abstract/conversation-handler-builder.service';
27
21
  import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service';
28
- import { ConversationsHandlerService } from 'src/chat21-core/providers/abstract/conversations-handler.service';
22
+ import { ConversationHandlerBuilderService } from 'src/chat21-core/providers/abstract/conversation-handler-builder.service';
29
23
  import { ConversationHandlerService } from 'src/chat21-core/providers/abstract/conversation-handler.service';
24
+ import { ConversationsHandlerService } from 'src/chat21-core/providers/abstract/conversations-handler.service';
30
25
  import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
31
- import { TypingService } from 'src/chat21-core/providers/abstract/typing.service';
26
+ import { MessagingAuthService } from 'src/chat21-core/providers/abstract/messagingAuth.service';
32
27
  import { PresenceService } from 'src/chat21-core/providers/abstract/presence.service';
28
+ import { TypingService } from 'src/chat21-core/providers/abstract/typing.service';
29
+ import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
30
+ import { ChatManager } from 'src/chat21-core/providers/chat-manager';
33
31
  import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
32
+ import { Triggerhandler } from 'src/chat21-core/utils/triggerHandler';
34
33
  /** OTHERS */
35
34
  import { AppConfigService } from './providers/app-config.service';
36
35
  import { GlobalSettingsService } from './providers/global-settings.service';
37
36
  import { TranslatorService } from './providers/translator.service';
38
- import { SettingsSaverService } from './providers/settings-saver.service';
39
37
  // UTILS
40
- import { Globals } from './utils/globals';
41
- import { UID_SUPPORT_GROUP_MESSAGES } from './utils/constants';
42
- import { supports_html5_storage } from 'src/chat21-core/utils/utils';
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
- import { isInfo, isUserBanned } from 'src/chat21-core/utils/utils-message';
38
+ import * as dayjs from 'dayjs';
45
39
  import { MessageModel } from 'src/chat21-core/models/message';
40
+ import { AUTH_STATE_OFFLINE, AUTH_STATE_ONLINE, TYPE_MSG_FILE, TYPE_MSG_IMAGE, URL_SOUND_LIST_CONVERSATION } from 'src/chat21-core/utils/constants';
41
+ import { supports_html5_storage } from 'src/chat21-core/utils/utils';
42
+ import { UID_SUPPORT_GROUP_MESSAGES } from './utils/constants';
43
+ import { Globals } from './utils/globals';
46
44
  import { Rules } from './utils/rules';
45
+ import { isInfo, isUserBanned } from 'src/chat21-core/utils/utils-message';
47
46
 
48
47
  interface MessageObj {
49
48
  tenant?: string;
@@ -108,10 +107,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
108
107
  private el: ElementRef,
109
108
  private ngZone: NgZone,
110
109
  public g: Globals,
111
- private rules: Rules,
112
110
  public triggerHandler: Triggerhandler,
113
111
  public globalSettingsService: GlobalSettingsService,
114
- private settingsSaverService: SettingsSaverService,
115
112
  public appConfigService: AppConfigService,
116
113
  private appStorageService: AppStorageService,
117
114
  private translatorService: TranslatorService,
@@ -160,9 +157,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
160
157
  if (conversation.attributes && conversation.attributes['subtype'] === 'info') {
161
158
  return;
162
159
  }
163
- if (conversation.is_new && !this.isOpenConversation) {
164
- // this.soundMessage();
165
- }
166
160
 
167
161
  } else {
168
162
  // if(conversation.is_new && isJustRecived(this.g.startedAt.getTime(), conversation.timestamp)){
@@ -278,7 +272,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
278
272
  this.translatorService.initI18n().then((result) => {
279
273
  this.logger.debug('[APP-COMP] »»»» APP-COMPONENT.TS initI18n result', result);
280
274
  const browserLang = this.translatorService.getLanguage();
281
- moment.locale(browserLang)
275
+ // moment.locale(browserLang)
276
+ dayjs.locale(browserLang)
282
277
  this.translatorService.translate(this.g);
283
278
  }).then(() => {
284
279
  /** INIT */
@@ -321,12 +316,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
321
316
  }
322
317
  this.setStyleMap()
323
318
 
324
- /**
325
- * SUBSCRIPTION :
326
- * Subscription to runtime changes in globals
327
- * and save changes in localstorage
328
- */
329
- this.settingsSaverService.initialize();
330
319
  // ------------------------------- //
331
320
 
332
321
  // ------------------------------- //
@@ -350,7 +339,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
350
339
  }
351
340
 
352
341
  // ========= begin:: SUBSCRIPTIONS ============//
353
- private setAuthSubscription(){
342
+ private async setAuthSubscription(){
354
343
  this.logger.debug('[APP-COMP] setLoginSubscription : ');
355
344
  const that = this;
356
345
 
@@ -392,9 +381,16 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
392
381
  that.g.singleConversation? null: that.startUI();
393
382
  that.triggerOnAuthStateChanged(that.stateLoggedUser);
394
383
  that.logger.debug('[APP-COMP] 1 - IMPOSTO STATO CONNESSO UTENTE ', autoStart);
395
- that.typingService.initialize(this.g.tenant);
396
- that.presenceService.initialize(this.g.tenant);
397
- that.presenceService.setPresence(user.uid);
384
+
385
+
386
+
387
+ new Promise(async (resolve, reject)=> {
388
+ that.typingService.initialize(this.g.tenant);
389
+ await that.presenceService.initialize(this.g.tenant);
390
+ }).then(()=>{
391
+ that.presenceService.setPresence(user.uid);
392
+ });
393
+
398
394
  // this.initConversationsHandler(this.g.tenant, that.g.senderId);
399
395
  /* If singleConversation mode is active wait to showWidget: do it later in initConversationsHandler */
400
396
  if (autoStart && !that.g.singleConversation) {
@@ -443,7 +439,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
443
439
  this.g.setParameter('recipientId', null, false)
444
440
  that.hideWidget();
445
441
  // that.g.setParameter('isShown', false, true);
446
- that.g.isLogout = true;
447
442
  that.triggerOnAuthStateChanged('offline');
448
443
  // that.triggerOnLoggedOut()
449
444
  }
@@ -836,7 +831,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
836
831
  }
837
832
 
838
833
 
839
- private initConversationsHandler(tenant: string, senderId: string) {
834
+ private async initConversationsHandler(tenant: string, senderId: string) {
840
835
  this.logger.debug('[APP-COMP] initialize: ListConversationsComponent');
841
836
  const keys = ['YOU'];
842
837
  const translationMap = this.translateService.translateLanguage(keys);
@@ -848,8 +843,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
848
843
  this.logger.debug('[APP-COMP] tenant: ', tenant);
849
844
 
850
845
  // 1 - init chatConversationsHandler and archviedConversationsHandler
851
- this.conversationsHandlerService.initialize(tenant, senderId, translationMap)
852
- this.archivedConversationsService.initialize(tenant, senderId, translationMap)
846
+ await this.conversationsHandlerService.initialize(tenant, senderId, translationMap)
847
+ await this.archivedConversationsService.initialize(tenant, senderId, translationMap)
853
848
  // 2 - get conversations from storage
854
849
  // this.chatConversationsHandler.getConversationsFromStorage();
855
850
  // 3 - get conversation from database with REST Api call if singleConversation mode is active and widget is Opened; otherwize show only widget and start conversation when launcher icon is clicked
@@ -1116,7 +1111,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
1116
1111
  this.hideWidget();
1117
1112
  // that.g.setParameter('isShown', false, true);
1118
1113
  this.appStorageService.removeItem('tiledeskToken');
1119
- this.g.isLogout = true;
1120
1114
  if (this.g.autoStart !== false) {
1121
1115
  this.authenticate();
1122
1116
  this.initAll();
@@ -1,3 +1,4 @@
1
+ import { DateAgoPipe } from './pipe/date-ago.pipe';
1
2
  import { EventsService } from './providers/events.service';
2
3
 
3
4
  // ************** COMPONENTS ************** //
@@ -57,9 +58,9 @@ import { environment } from 'src/environments/environment';
57
58
 
58
59
  //THIRD-PART MODULES
59
60
  import { TranslateModule } from '@ngx-translate/core';
60
- import { MomentModule } from 'ngx-moment';
61
+ // import { MomentModule } from 'ngx-moment';
61
62
  import { PickerModule } from '@ctrl/ngx-emoji-mart';
62
- import { INGXLoggerMetadata, LoggerModule, NGXLogger, NgxLoggerLevel, NGXLoggerServerService, TOKEN_LOGGER_SERVER_SERVICE } from "ngx-logger";
63
+ import { LoggerModule, NGXLogger, NgxLoggerLevel } from "ngx-logger";
63
64
 
64
65
  //DIRECTIVES
65
66
  import { HtmlEntitiesEncodePipe } from './pipe/html-entities-encode.pipe';
@@ -119,7 +120,6 @@ import { CHAT_ENGINE_MQTT, UPLOAD_ENGINE_NATIVE } from 'src/chat21-core/utils/co
119
120
 
120
121
  //STORAGE
121
122
  import { LocalSessionStorage } from 'src/chat21-core/providers/localSessionStorage';
122
- import { SettingsSaverService } from './providers/settings-saver.service';
123
123
 
124
124
  import { Globals } from './utils/globals';
125
125
  import { GlobalSettingsService } from './providers/global-settings.service';
@@ -283,6 +283,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
283
283
  /**DIRECTIVES */
284
284
  HtmlEntitiesEncodePipe,
285
285
  MarkedPipe,
286
+ DateAgoPipe,
286
287
  SafeHtmlPipe,
287
288
  LikeUnlikeComponent,
288
289
  TooltipDirective
@@ -294,7 +295,6 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
294
295
  HttpClientModule,
295
296
  FormsModule,
296
297
  ReactiveFormsModule,
297
- MomentModule,
298
298
  PickerModule,
299
299
  TranslateModule.forRoot(//),
300
300
  {
@@ -319,7 +319,6 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
319
319
  Globals,
320
320
  Rules,
321
321
  GlobalSettingsService,
322
- SettingsSaverService,
323
322
  EventsService,
324
323
  StarRatingWidgetService,
325
324
  {
@@ -131,13 +131,4 @@
131
131
  </div>
132
132
 
133
133
 
134
- </div>
135
- <!--
136
- <div *ngIf="isFileSelected" class="modal-page" [class.active]="true">
137
- <tiledeskwidget-preview-loading-files
138
- [arrayFilesLoad]="arrayFilesLoad"
139
- (eventClose)="returnClose()"
140
- (eventSend)="returnSend()">
141
- </tiledeskwidget-preview-loading-files>
142
- </div>
143
- -->
134
+ </div>