@chat21/chat21-web-widget 5.0.95 → 5.1.0-rc.3

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 (33) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/Dockerfile +1 -1
  3. package/angular.json +19 -16
  4. package/deploy_amazon_beta.sh +1 -1
  5. package/deploy_amazon_prod.sh +1 -1
  6. package/deploy_beta.sh +1 -11
  7. package/deploy_prod.sh +1 -10
  8. package/package.json +21 -23
  9. package/src/app/app.component.spec.ts +13 -13
  10. package/src/app/app.module.ts +11 -13
  11. package/src/app/component/conversation-detail/conversation/conversation.component.spec.ts +11 -13
  12. package/src/app/component/conversation-detail/conversation/conversation.component.ts +1 -1
  13. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.spec.ts +10 -11
  14. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.ts +5 -1
  15. package/src/app/component/home-conversations/home-conversations.component.html +1 -1
  16. package/src/app/component/home-conversations/home-conversations.component.spec.ts +9 -11
  17. package/src/app/component/home-conversations/home-conversations.component.ts +1 -1
  18. package/src/app/component/star-rating-widget/star-rating-widget.component.spec.ts +10 -11
  19. package/src/app/pipe/date-ago.pipe.ts +2 -2
  20. package/src/app/providers/app-config.service.spec.ts +5 -6
  21. package/src/app/providers/global-settings.service.spec.ts +7 -8
  22. package/src/app/providers/star-rating-widget.service.spec.ts +7 -8
  23. package/src/app/providers/translator.service.spec.ts +7 -9
  24. package/src/app/providers/waiting.service.spec.ts +7 -8
  25. package/src/app/sass/animations.scss +1 -0
  26. package/src/build_launch.js +9 -8
  27. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.spec.ts +8 -7
  28. package/src/chat21-core/providers/tiledesk/tiledesk-requests.service.spec.ts +10 -6
  29. package/src/chat21-core/utils/utils.ts +2 -2
  30. package/src/launch.js +6 -5
  31. package/src/launch_template.js +11 -4
  32. package/src/polyfills.ts +1 -1
  33. package/tsconfig.json +1 -2
package/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@
6
6
  ### **Copyrigth**:
7
7
  *Tiledesk SRL*
8
8
 
9
+ # 5.1.0-rc.3
10
+ - **added**: angular 18
11
+
12
+ # 5.1.0-rc.2
13
+ - **added**: angular 17
14
+
15
+ # 5.0.96
16
+
9
17
  # 5.0.95
10
18
  - **bug-fixed**: first message is fired twice ( from /event and from /messages with hiddenMesage)
11
19
 
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:16.20.2-alpine3.18 as builder
4
+ FROM node:18.19.1-alpine3.18 as builder
5
5
 
6
6
  COPY package.json package-lock.json ./
7
7
 
package/angular.json CHANGED
@@ -15,13 +15,17 @@
15
15
  },
16
16
  "architect": {
17
17
  "build": {
18
- "builder": "@angular-devkit/build-angular:browser",
18
+ "builder": "@angular-devkit/build-angular:application",
19
19
  "options": {
20
- "outputPath": "dist",
20
+ "outputPath": {
21
+ "base": "dist"
22
+ },
21
23
  "baseHref":"/",
22
24
  "index": "src/index.html",
23
- "main": "src/main.ts",
24
- "polyfills": "src/polyfills.ts",
25
+ "polyfills": [
26
+ "src/polyfills.ts",
27
+ "@angular/localize/init",
28
+ ],
25
29
  "tsConfig": "tsconfig.app.json",
26
30
  "assets": [
27
31
  "src/assets",
@@ -48,11 +52,8 @@
48
52
  "scripts": [
49
53
  "src/assets/js/mqtt/4.2.6/mqtt.min.js",
50
54
  "node_modules/bootstrap/dist/js/bootstrap.min.js",
51
- "node_modules/popper.js/dist/umd/popper.min.js"
52
55
  ],
53
- "vendorChunk": true,
54
56
  "extractLicenses": false,
55
- "buildOptimizer": false,
56
57
  "allowedCommonJsDependencies": [
57
58
  "rxjs-compat",
58
59
  "idb",
@@ -62,7 +63,13 @@
62
63
  ],
63
64
  "sourceMap": true,
64
65
  "optimization": false,
65
- "namedChunks": true
66
+ "namedChunks": true,
67
+ "browser": "src/main.ts",
68
+ "stylePreprocessorOptions": {
69
+ "includePaths": [
70
+ "."
71
+ ]
72
+ }
66
73
  },
67
74
  "configurations": {
68
75
  "prod": {
@@ -78,8 +85,6 @@
78
85
  "namedChunks": false,
79
86
  "aot": true,
80
87
  "extractLicenses": true,
81
- "vendorChunk": false,
82
- "buildOptimizer": true,
83
88
  "budgets": [
84
89
  {
85
90
  "type": "initial",
@@ -105,8 +110,6 @@
105
110
  "namedChunks": false,
106
111
  "aot": true,
107
112
  "extractLicenses": true,
108
- "vendorChunk": true,
109
- "buildOptimizer": true,
110
113
  "budgets": [
111
114
  {
112
115
  "type": "initial",
@@ -125,13 +128,13 @@
125
128
  },
126
129
  "configurations": {
127
130
  "prod": {
128
- "browserTarget": "widget:build:prod"
131
+ "buildTarget": "widget:build:prod"
129
132
  },
130
133
  "pre": {
131
- "browserTarget": "widget:build:pre"
134
+ "buildTarget": "widget:build:pre"
132
135
  },
133
136
  "development": {
134
- "browserTarget": "widget:build:development"
137
+ "buildTarget": "widget:build:development"
135
138
  }
136
139
  },
137
140
  "defaultConfiguration": "development"
@@ -139,7 +142,7 @@
139
142
  "extract-i18n": {
140
143
  "builder": "@angular-devkit/build-angular:extract-i18n",
141
144
  "options": {
142
- "browserTarget": "widget:build"
145
+ "buildTarget": "widget:build"
143
146
  }
144
147
  },
145
148
  "test": {
@@ -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 --build-optimizer=true
5
+ ng build --configuration="pre" --aot=true --base-href
6
6
 
7
7
 
8
8
  # ########## --->>>> NATIVE-MQTT folder START <<<<<------ ########## #
@@ -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 --build-optimizer=true --vendor-chunk=true
6
+ ng build --configuration="prod" --aot=true
7
7
 
8
8
  #### FIREBASE #####
9
9
  # cd dist
package/deploy_beta.sh CHANGED
@@ -2,19 +2,9 @@
2
2
  version=`node -e 'console.log(require("./package.json").version)'`
3
3
  echo "version $version"
4
4
 
5
-
6
- # Get curent branch name
7
- current_branch=$(git rev-parse --abbrev-ref HEAD)
8
- remote_name=$(git config --get branch.$current_branch.remote)
9
-
10
- ## Push commit to git
11
- git add .
12
- git commit -m "version added: ### $version"
13
- git push "$remote_name" "$current_branch"
14
-
15
5
  if [ "$version" != "" ]; then
16
6
  git tag -a "$version" -m "`git log -1 --format=%s`"
17
7
  echo "Created a new tag, $version"
18
- git push --tags
8
+ git push remoteTiledesk --tags
19
9
  npm publish
20
10
  fi
package/deploy_prod.sh CHANGED
@@ -4,18 +4,9 @@ ECHO "____________WIDGET-V5______________"
4
4
  echo "CREATING TAG ON GIT FOR version: $version"
5
5
  # echo "version $version"
6
6
 
7
- # Get curent branch name
8
- current_branch=$(git rev-parse --abbrev-ref HEAD)
9
- remote_name=$(git config --get branch.$current_branch.remote)
10
-
11
- ## Push commit to git
12
- git add .
13
- git commit -m "version added: ### $version"
14
- git push "$remote_name" "$current_branch"
15
-
16
7
  if [ "$version" != "" ]; then
17
8
  git tag -a "$version" -m "`git log -1 --format=%s`"
18
9
  echo "Created a new tag, $version"
19
- git push --tags
10
+ git push remoteTiledesk --tags
20
11
  npm publish
21
12
  fi
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.95",
4
+ "version": "5.1.0-rc.3",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -19,20 +19,19 @@
19
19
  },
20
20
  "private": false,
21
21
  "dependencies": {
22
- "@angular/animations": "^15.0.4",
23
- "@angular/cdk": "^15.0.3",
24
- "@angular/common": "^15.0.4",
25
- "@angular/compiler": "^15.0.4",
26
- "@angular/core": "^15.0.4",
27
- "@angular/forms": "^15.0.4",
28
- "@angular/localize": "^15.0.4",
29
- "@angular/platform-browser": "^15.0.4",
30
- "@angular/platform-browser-dynamic": "^15.0.4",
31
- "@angular/router": "^15.0.4",
32
- "@ctrl/ngx-emoji-mart": "^7.1.0",
33
- "@ngx-translate/core": "^14.0.0",
34
- "@ngx-translate/http-loader": "^4.0.0",
35
- "@popperjs/core": "^2.11.5",
22
+ "@angular/animations": "^18.2.13",
23
+ "@angular/cdk": "^17.3.10",
24
+ "@angular/common": "^18.2.13",
25
+ "@angular/compiler": "^18.2.13",
26
+ "@angular/core": "^18.2.13",
27
+ "@angular/forms": "^18.2.13",
28
+ "@angular/localize": "^18.2.13",
29
+ "@angular/platform-browser": "^18.2.13",
30
+ "@angular/platform-browser-dynamic": "^18.2.13",
31
+ "@angular/router": "^18.2.13",
32
+ "@ctrl/ngx-emoji-mart": "^9.2.0",
33
+ "@ngx-translate/core": "^16.0.4",
34
+ "@ngx-translate/http-loader": "^16.0.1",
36
35
  "@types/marked": "^4.0.3",
37
36
  "accept-language-parser": "^1.5.0",
38
37
  "bootstrap": "^5.1.3",
@@ -42,19 +41,18 @@
42
41
  "humanize-duration-ts": "^2.1.1",
43
42
  "marked": "^4.0.16",
44
43
  "ngx-logger": "^5.0.11",
45
- "popper.js": "^1.16.1",
46
44
  "replace": "^1.2.2",
47
- "rxjs": "~6.5.1",
45
+ "rxjs": "^7.8.2",
48
46
  "source-map-explorer": "^2.5.3",
49
47
  "tslib": "^2.0.0",
50
48
  "uuid": "^8.3.2",
51
- "zone.js": "~0.11.4"
49
+ "zone.js": "~0.14.10"
52
50
  },
53
51
  "devDependencies": {
54
- "@angular-devkit/build-angular": "^15.0.4",
55
- "@angular/cli": "^15.0.4",
56
- "@angular/compiler-cli": "^15.0.4",
57
- "@angular/language-service": "^15.0.4",
52
+ "@angular-devkit/build-angular": "^18.2.19",
53
+ "@angular/cli": "^18.2.19",
54
+ "@angular/compiler-cli": "^18.2.13",
55
+ "@angular/language-service": "^18.2.13",
58
56
  "@types/jasmine": "^3.6.11",
59
57
  "@types/jasminewd2": "~2.0.3",
60
58
  "@types/node": "^12.11.1",
@@ -70,6 +68,6 @@
70
68
  "protractor": "~7.0.0",
71
69
  "ts-node": "~7.0.0",
72
70
  "tslint": "~6.1.0",
73
- "typescript": "^4.8.4"
71
+ "typescript": "~5.4"
74
72
  }
75
73
  }
@@ -3,7 +3,7 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
3
3
  import { RouterTestingModule } from '@angular/router/testing';
4
4
  import { AppComponent } from './app.component';
5
5
  import { GlobalSettingsService } from './providers/global-settings.service';
6
- import { HttpClientTestingModule } from '@angular/common/http/testing';
6
+ import { provideHttpClientTesting } from '@angular/common/http/testing';
7
7
  import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
8
8
  import { TranslatorService } from './providers/translator.service';
9
9
  import { TranslateModule } from '@ngx-translate/core';
@@ -23,6 +23,7 @@ import { ChatManager } from 'src/chat21-core/providers/chat-manager';
23
23
  import { NGXLogger } from 'ngx-logger';
24
24
  import { CustomLogger } from 'src/chat21-core/providers/logger/customLogger';
25
25
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
26
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
26
27
 
27
28
  describe('AppComponent', () => {
28
29
  let component: AppComponent;
@@ -32,12 +33,12 @@ describe('AppComponent', () => {
32
33
 
33
34
  beforeEach(waitForAsync(() => {
34
35
  TestBed.configureTestingModule({
35
- imports: [
36
- RouterTestingModule,
37
- HttpClientTestingModule,
38
- TranslateModule.forRoot(),
39
- ],
40
- providers:[
36
+ declarations: [
37
+ AppComponent
38
+ ],
39
+ imports: [RouterTestingModule,
40
+ TranslateModule.forRoot()],
41
+ providers: [
41
42
  Triggerhandler,
42
43
  GlobalSettingsService,
43
44
  AppStorageService,
@@ -54,12 +55,11 @@ describe('AppComponent', () => {
54
55
  ImageRepoService,
55
56
  TypingService,
56
57
  PresenceService,
57
- UploadService
58
- ],
59
- declarations: [
60
- AppComponent
61
- ],
62
- }).compileComponents();
58
+ UploadService,
59
+ provideHttpClient(withInterceptorsFromDi()),
60
+ provideHttpClientTesting()
61
+ ]
62
+ }).compileComponents();
63
63
  }));
64
64
 
65
65
  beforeEach(() => {
@@ -54,7 +54,7 @@ import { AppConfigService } from './providers/app-config.service';
54
54
  import { BrowserModule } from '@angular/platform-browser';
55
55
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
56
56
  import { APP_INITIALIZER, NgModule } from '@angular/core';
57
- import { HttpClient, HttpClientModule } from '@angular/common/http';
57
+ import { HttpClient, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
58
58
  import { FormsModule, ReactiveFormsModule } from '@angular/forms';
59
59
  import { environment } from 'src/environments/environment';
60
60
 
@@ -303,21 +303,18 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
303
303
  NetworkOfflineComponent,
304
304
  ConfirmCloseComponent
305
305
  ],
306
- imports: [
307
- BrowserModule,
306
+ imports: [BrowserModule,
308
307
  BrowserAnimationsModule,
309
- // AppRoutingModule,
310
- HttpClientModule,
311
308
  FormsModule,
312
309
  ReactiveFormsModule,
313
310
  PickerModule,
314
311
  TranslateModule.forRoot(//),
315
312
  {
316
- // loader: {
317
- // provide: TranslateLoader,
318
- // useFactory: (createTranslateLoader),
319
- // deps: [HttpClient]
320
- // }
313
+ // loader: {
314
+ // provide: TranslateLoader,
315
+ // useFactory: (createTranslateLoader),
316
+ // deps: [HttpClient]
317
+ // }
321
318
  }),
322
319
  LoggerModule.forRoot({
323
320
  level: NgxLoggerLevel.DEBUG,
@@ -349,7 +346,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
349
346
  {
350
347
  provide: MessagingAuthService,
351
348
  useFactory: authenticationFactory,
352
- deps: [HttpClient, AppConfigService, Chat21Service, AppStorageService ]
349
+ deps: [HttpClient, AppConfigService, Chat21Service, AppStorageService]
353
350
  },
354
351
  {
355
352
  provide: ConversationsHandlerService,
@@ -389,7 +386,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
389
386
  {
390
387
  provide: UploadService,
391
388
  useFactory: uploadFactory,
392
- deps: [HttpClient, AppConfigService, AppStorageService ]
389
+ deps: [HttpClient, AppConfigService, AppStorageService]
393
390
  },
394
391
  TiledeskAuthService,
395
392
  TiledeskRequestsService,
@@ -398,7 +395,8 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
398
395
  Triggerhandler,
399
396
  WaitingService,
400
397
  ScriptService,
401
- BrandService
398
+ BrandService,
399
+ provideHttpClient(withInterceptorsFromDi())
402
400
  ],
403
401
  bootstrap: [AppComponent]
404
402
  })
@@ -1,7 +1,7 @@
1
1
  import { TiledeskRequestsService } from './../../../../chat21-core/providers/tiledesk/tiledesk-requests.service';
2
2
  import { StarRatingWidgetService } from './../../../providers/star-rating-widget.service';
3
3
  import { StarRatingWidgetComponent } from './../../star-rating-widget/star-rating-widget.component';
4
- import { HttpClientTestingModule } from '@angular/common/http/testing';
4
+ import { provideHttpClientTesting } from '@angular/common/http/testing';
5
5
 
6
6
  import { Triggerhandler } from './../../../../chat21-core/utils/triggerHandler';
7
7
  import { AppComponent } from './../../../app.component';
@@ -13,7 +13,6 @@ import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
13
13
 
14
14
  import { ConversationComponent } from './conversation.component';
15
15
  import { GlobalSettingsService } from '../../../providers/global-settings.service';
16
- import { SettingsSaverService } from '../../../providers/settings-saver.service';
17
16
  import { TranslatorService } from '../../../providers/translator.service';
18
17
 
19
18
  import { AppStorageService } from '../../../../chat21-core/providers/abstract/app-storage.service';
@@ -33,6 +32,7 @@ import { TranslateModule } from '@ngx-translate/core';
33
32
  import { NGXLogger } from 'ngx-logger';
34
33
  import { CustomLogger } from 'src/chat21-core/providers/logger/customLogger';
35
34
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
35
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
36
36
 
37
37
  describe('ConversationComponent', () => {
38
38
  let component: ConversationComponent;
@@ -43,18 +43,15 @@ describe('ConversationComponent', () => {
43
43
 
44
44
  beforeEach(waitForAsync(() => {
45
45
  TestBed.configureTestingModule({
46
- declarations: [ ConversationComponent ],
47
- imports: [
48
- HttpClientTestingModule,
49
- TranslateModule.forRoot(),
50
- ],
51
- providers: [
46
+ declarations: [ConversationComponent],
47
+ schemas: [NO_ERRORS_SCHEMA],
48
+ imports: [TranslateModule.forRoot()],
49
+ providers: [
52
50
  Globals,
53
51
  AppConfigService,
54
52
  AppComponent,
55
53
  { provide: ElementRef, useClass: MockElementRef },
56
54
  GlobalSettingsService,
57
- SettingsSaverService,
58
55
  Triggerhandler,
59
56
  TranslatorService,
60
57
  AppConfigService,
@@ -72,10 +69,11 @@ describe('ConversationComponent', () => {
72
69
  UploadService,
73
70
  StarRatingWidgetService,
74
71
  TiledeskRequestsService,
75
- NGXLogger
76
- ],
77
- schemas: [NO_ERRORS_SCHEMA]
78
- })
72
+ NGXLogger,
73
+ provideHttpClient(withInterceptorsFromDi()),
74
+ provideHttpClientTesting()
75
+ ]
76
+ })
79
77
  .compileComponents();
80
78
  }));
81
79
 
@@ -118,7 +118,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
118
118
 
119
119
  // devo inserirle nel globals
120
120
  subscriptions: Array<any> = [];
121
- private unsubscribe$: Subject<any> = new Subject<any>();
121
+ private unsubscribe$: Subject<void> = new Subject<void>();
122
122
  showMessageWelcome: boolean;
123
123
 
124
124
  // ========= begin::agent availability
@@ -1,8 +1,8 @@
1
- import { HttpClientModule } from '@angular/common/http';
1
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
2
2
  import { AppConfigService } from './../../../providers/app-config.service';
3
3
  import { Globals } from './../../../utils/globals';
4
4
  import { NO_ERRORS_SCHEMA } from '@angular/core';
5
- import { async, ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
5
+ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
6
6
 
7
7
  import { ConversationHeaderComponent } from './conversation-header.component';
8
8
  import { TypingService } from '../../../../chat21-core/providers/abstract/typing.service';
@@ -18,17 +18,16 @@ describe('ConversationHeaderComponent', () => {
18
18
 
19
19
  beforeEach(waitForAsync(() => {
20
20
  TestBed.configureTestingModule({
21
- declarations: [ ConversationHeaderComponent ],
22
- imports: [
23
- HttpClientModule
24
- ],
25
- providers: [
21
+ declarations: [ConversationHeaderComponent],
22
+ schemas: [NO_ERRORS_SCHEMA],
23
+ imports: [],
24
+ providers: [
26
25
  Globals,
27
26
  TypingService,
28
- AppConfigService
29
- ],
30
- schemas: [NO_ERRORS_SCHEMA],
31
- })
27
+ AppConfigService,
28
+ provideHttpClient(withInterceptorsFromDi())
29
+ ]
30
+ })
32
31
  .compileComponents();
33
32
  }));
34
33
 
@@ -96,7 +96,6 @@ export class EyeeyeCatcherCardComponent implements OnInit {
96
96
  title = this.g.calloutTitle.trim();
97
97
  }
98
98
  this.title = title;
99
- const emojiRegex = require('emoji-regex');
100
99
  const regex = emojiRegex();
101
100
  let match: any;
102
101
  // this.logger.debug('[EYEEYE-CATCHER-CARD]-->regex, emojiRegex', regex, emojiRegex)
@@ -163,3 +162,8 @@ export class EyeeyeCatcherCardComponent implements OnInit {
163
162
  // this.displayEyeCatcherCardCloseBtnIsMobileWrapper = 'none';
164
163
  // }
165
164
  }
165
+
166
+
167
+ export default function emojiRegex(): RegExp {
168
+ return /(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u2700-\u27BF])|(?:\u24C2)|(?:[\u1F680-\u1F6FF])/g;
169
+ }
@@ -36,7 +36,7 @@
36
36
 
37
37
 
38
38
  <!--CASE: no conversations EXIST - >1 agents is available -->
39
- <div *ngIf="(!listConversations || listConversations.length == 0) && availableAgents && availableAgents.length > 1 && g.showAvailableAgents === true" style="margin: 20px 30px;">
39
+ <div *ngIf="(!listConversations || listConversations.length == 0) && availableAgents && availableAgents.length > 1 && g.showAvailableAgents === true" style="display: flex; margin: 20px 30px;">
40
40
  <div *ngFor="let agent of availableAgents" class="c21-pallozzo">
41
41
  <div class="c21-ball" [ngStyle] = "{ 'background-color':setColorFromString(agent.firstname) }" >
42
42
  <span class="c21-ball-label">{{avatarPlaceholder(agent.firstname)}}</span>
@@ -1,6 +1,6 @@
1
1
  import { CustomTranslateService } from './../../../chat21-core/providers/custom-translate.service';
2
2
  import { TranslatorService } from './../../providers/translator.service';
3
- import { HttpClientModule } from '@angular/common/http';
3
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
4
4
  import { AppConfigService } from './../../providers/app-config.service';
5
5
  import { WaitingService } from './../../providers/waiting.service';
6
6
  import { ChatManager } from './../../../chat21-core/providers/chat-manager';
@@ -25,12 +25,10 @@ describe('HomeConversationsComponent', () => {
25
25
 
26
26
  beforeEach(waitForAsync(() => {
27
27
  TestBed.configureTestingModule({
28
- declarations: [ HomeConversationsComponent ],
29
- imports: [
30
- HttpClientModule,
31
- TranslateModule.forRoot()
32
- ],
33
- providers: [
28
+ declarations: [HomeConversationsComponent],
29
+ schemas: [NO_ERRORS_SCHEMA],
30
+ imports: [TranslateModule.forRoot()],
31
+ providers: [
34
32
  Globals,
35
33
  ImageRepoService,
36
34
  ChatManager,
@@ -39,10 +37,10 @@ describe('HomeConversationsComponent', () => {
39
37
  WaitingService,
40
38
  AppConfigService,
41
39
  TranslatorService,
42
- CustomTranslateService
43
- ],
44
- schemas: [NO_ERRORS_SCHEMA]
45
- })
40
+ CustomTranslateService,
41
+ provideHttpClient(withInterceptorsFromDi())
42
+ ]
43
+ })
46
44
  .compileComponents();
47
45
  }));
48
46
 
@@ -67,7 +67,7 @@ export class HomeConversationsComponent implements OnInit, OnDestroy {
67
67
  availableAgents: Array<UserAgent> = [];
68
68
  // ========= end:: variabili del componente ======== //
69
69
 
70
- waitingTime: Number;
70
+ waitingTime: number;
71
71
  langService: HumanizeDurationLanguage = new HumanizeDurationLanguage();
72
72
  humanizer: HumanizeDuration;
73
73
  humanWaitingTime: string;
@@ -1,27 +1,26 @@
1
1
  import { AppConfigService } from './../../providers/app-config.service';
2
2
  import { StarRatingWidgetService } from './../../providers/star-rating-widget.service';
3
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
3
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
4
4
 
5
5
  import { StarRatingWidgetComponent } from './star-rating-widget.component';
6
6
  import { Globals } from '../../utils/globals';
7
- import { HttpClientModule } from '@angular/common/http';
7
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
8
8
 
9
9
  describe('StarRatingWidgetComponent', () => {
10
10
  let component: StarRatingWidgetComponent;
11
11
  let fixture: ComponentFixture<StarRatingWidgetComponent>;
12
12
 
13
- beforeEach(async(() => {
13
+ beforeEach((() => {
14
14
  TestBed.configureTestingModule({
15
- declarations: [ StarRatingWidgetComponent ],
16
- imports: [
17
- HttpClientModule
18
- ],
19
- providers: [
15
+ declarations: [StarRatingWidgetComponent],
16
+ imports: [],
17
+ providers: [
20
18
  Globals,
21
19
  AppConfigService,
22
- StarRatingWidgetService
23
- ]
24
- })
20
+ StarRatingWidgetService,
21
+ provideHttpClient(withInterceptorsFromDi())
22
+ ]
23
+ })
25
24
  .compileComponents();
26
25
  }));
27
26
 
@@ -1,7 +1,7 @@
1
1
  import { Pipe, PipeTransform } from '@angular/core';
2
2
 
3
- import * as dayjs from 'dayjs'
4
- import * as relativeTime from 'dayjs/plugin/relativeTime'
3
+ import dayjs from 'dayjs';
4
+ import relativeTime from 'dayjs/plugin/relativeTime';
5
5
  dayjs.extend(relativeTime)
6
6
 
7
7
  @Pipe({
@@ -1,4 +1,4 @@
1
- import { HttpClientModule } from '@angular/common/http';
1
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
2
2
  import { TestBed } from '@angular/core/testing';
3
3
  import { Globals } from '../utils/globals';
4
4
 
@@ -6,13 +6,12 @@ import { AppConfigService } from './app-config.service';
6
6
 
7
7
  describe('AppConfigService', () => {
8
8
  beforeEach(() => TestBed.configureTestingModule({
9
- imports: [
10
- HttpClientModule,
11
- ],
9
+ imports: [],
12
10
  providers: [
13
- Globals
11
+ Globals,
12
+ provideHttpClient(withInterceptorsFromDi())
14
13
  ]
15
- }));
14
+ }));
16
15
 
17
16
  it('should be created', () => {
18
17
  const service: AppConfigService = TestBed.get(AppConfigService);
@@ -1,5 +1,5 @@
1
1
  import { Globals } from './../utils/globals';
2
- import { HttpClientModule } from '@angular/common/http';
2
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
3
3
  import { TestBed, inject } from '@angular/core/testing';
4
4
  import { AppStorageService } from '../../chat21-core/providers/abstract/app-storage.service';
5
5
  import { AppConfigService } from './app-config.service';
@@ -9,16 +9,15 @@ import { GlobalSettingsService } from './global-settings.service';
9
9
  describe('GlobalSettingsService', () => {
10
10
  beforeEach(() => {
11
11
  TestBed.configureTestingModule({
12
- imports: [
13
- HttpClientModule,
14
- ],
15
- providers: [
12
+ imports: [],
13
+ providers: [
16
14
  GlobalSettingsService,
17
15
  AppStorageService,
18
16
  AppConfigService,
19
- Globals
20
- ]
21
- });
17
+ Globals,
18
+ provideHttpClient(withInterceptorsFromDi())
19
+ ]
20
+ });
22
21
  });
23
22
 
24
23
  it('should be created', inject([GlobalSettingsService], (service: GlobalSettingsService) => {
@@ -3,20 +3,19 @@ import { Globals } from '../utils/globals';
3
3
  import { TestBed, inject } from '@angular/core/testing';
4
4
 
5
5
  import { StarRatingWidgetService } from './star-rating-widget.service';
6
- import { HttpClientModule } from '@angular/common/http';
6
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
7
7
 
8
8
  describe('StarRatingWidgetService', () => {
9
9
  beforeEach(() => {
10
10
  TestBed.configureTestingModule({
11
- imports: [
12
- HttpClientModule
13
- ],
14
- providers: [
11
+ imports: [],
12
+ providers: [
15
13
  StarRatingWidgetService,
16
14
  Globals,
17
- AppConfigService
18
- ]
19
- });
15
+ AppConfigService,
16
+ provideHttpClient(withInterceptorsFromDi())
17
+ ]
18
+ });
20
19
  });
21
20
 
22
21
  it('should be created', inject([StarRatingWidgetService], (service: StarRatingWidgetService) => {
@@ -1,4 +1,4 @@
1
- import { HttpClientModule } from '@angular/common/http';
1
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
2
2
  import { AppConfigService } from './app-config.service';
3
3
  import { Globals } from './../utils/globals';
4
4
  import { TranslateModule, TranslateService } from '@ngx-translate/core';
@@ -9,16 +9,14 @@ import { TranslatorService } from './translator.service';
9
9
  describe('TranslatorService', () => {
10
10
  beforeEach(() => {
11
11
  TestBed.configureTestingModule({
12
- imports: [
13
- HttpClientModule,
14
- TranslateModule.forRoot(),
15
- ],
16
- providers: [
12
+ imports: [TranslateModule.forRoot()],
13
+ providers: [
17
14
  TranslatorService,
18
15
  Globals,
19
- AppConfigService
20
- ]
21
- });
16
+ AppConfigService,
17
+ provideHttpClient(withInterceptorsFromDi())
18
+ ]
19
+ });
22
20
  });
23
21
 
24
22
  it('should be created', inject([TranslatorService], (service: TranslatorService) => {
@@ -1,4 +1,4 @@
1
- import { HttpClientModule } from '@angular/common/http';
1
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
2
2
  import { AppConfigService } from './app-config.service';
3
3
  import { Globals } from './../utils/globals';
4
4
  import { TestBed, inject } from '@angular/core/testing';
@@ -8,15 +8,14 @@ import { WaitingService } from './waiting.service';
8
8
  describe('WaitingService', () => {
9
9
  beforeEach(() => {
10
10
  TestBed.configureTestingModule({
11
- imports: [
12
- HttpClientModule
13
- ],
14
- providers: [
11
+ imports: [],
12
+ providers: [
15
13
  WaitingService,
16
14
  Globals,
17
- AppConfigService
18
- ]
19
- });
15
+ AppConfigService,
16
+ provideHttpClient(withInterceptorsFromDi())
17
+ ]
18
+ });
20
19
  });
21
20
 
22
21
  it('should be created', inject([WaitingService], (service: WaitingService) => {
@@ -1,3 +1,4 @@
1
+ @import 'variables';
1
2
 
2
3
  /**
3
4
  * ----------------------------------------
@@ -7,11 +7,12 @@ initReplacement()
7
7
  function initReplacement(){
8
8
  console.log('init replacement HEREEE')
9
9
  fileToBeReplaced = {
10
- 'main' : {name: 'main', extension: '.js', regex: /(?<=\/main\.)(.+?)(?=\.js|$)/},
11
- 'runtime' : {name: 'runtime', extension: '.js', regex: /(?<=\/runtime\.)(.+?)(?=\.js|$)/},
12
- 'polyfills' : {name: 'polyfills', extension: '.js', regex: /(?<=\/polyfills\.)(.+?)(?=\.js|$)/},
13
- 'vendor' : {name: 'vendor', extension: '.js', regex: /(?<=\/vendor\.)(.+?)(?=\.js|$)/},
14
- 'styles' : {name: 'styles', extension: '.css', regex: /(?<=\/styles\.)(.+?)(?=\.css|$)/},
10
+ 'main' : {name: 'main', extension: '.js', regex: /(?<=\/main-)(.+?)(?=\.js|$)/},
11
+ 'scripts' : {name: 'scripts', extension: '.js', regex: /(?<=\/scripts-)(.+?)(?=\.js|$)/},
12
+ // 'runtime' : {name: 'runtime', extension: '.js', regex: /(?<=\/runtime\.)(.+?)(?=\.js|$)/},
13
+ 'polyfills' : {name: 'polyfills', extension: '.js', regex: /(?<=\/polyfills-)(.+?)(?=\.js|$)/},
14
+ // 'vendor' : {name: 'vendor', extension: '.js', regex: /(?<=\/vendor\.)(.+?)(?=\.js|$)/},
15
+ 'styles' : {name: 'styles', extension: '.css', regex: /(?<=\/styles-)(.+?)(?=\.css|$)/},
15
16
  }
16
17
 
17
18
  Object.keys(fileToBeReplaced).forEach(key => {
@@ -46,7 +47,7 @@ function initReplacement(){
46
47
 
47
48
  function replaceFile(name, element){
48
49
  let hashCode = ''
49
- glob("./dist/"+name+"*", function (er, files) {
50
+ glob("./dist/browser/"+name+"*", function (er, files) {
50
51
  // files is an array of filenames.
51
52
  // If the `nonull` option is set, and nothing
52
53
  // was found, then files is ["**/*.js"]
@@ -56,8 +57,8 @@ function replaceFile(name, element){
56
57
  console.log('hashhh',hashCode ,name )
57
58
  replace({
58
59
  regex: '{{'+ name + '}}'+ element.extension,
59
- replacement: name + "." + hashCode + element.extension ,
60
- paths: [ './dist/launch.js' ],
60
+ replacement: name + "-" + hashCode + element.extension ,
61
+ paths: [ './dist/browser/launch.js' ],
61
62
  recursive: true,
62
63
  silent: false,
63
64
  }, (error,changedFiles)=>{
@@ -1,7 +1,7 @@
1
- import { HttpClient, HttpHeaders } from '@angular/common/http';
1
+ import { HttpClient, HttpHeaders, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
2
2
  import { TestBed } from '@angular/core/testing';
3
3
  import { AppStorageService } from '../abstract/app-storage.service';
4
- import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
4
+ import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
5
5
  import { TiledeskAuthService } from './tiledesk-auth.service';
6
6
  import { NGXLogger } from 'ngx-logger';
7
7
  import { CustomLogger } from '../logger/customLogger';
@@ -17,13 +17,14 @@ describe('TiledeskAuthService', () => {
17
17
 
18
18
  beforeEach(() => {
19
19
  TestBed.configureTestingModule({
20
- providers: [
20
+ imports: [],
21
+ providers: [
21
22
  TiledeskAuthService,
22
23
  AppStorageService,
23
- // {provide: HttpClient, useValue: httpClientMock}
24
- ],
25
- imports: [HttpClientTestingModule]
26
- })
24
+ provideHttpClient(withInterceptorsFromDi()),
25
+ provideHttpClientTesting(),
26
+ ]
27
+ })
27
28
 
28
29
  // httpClientMock = jasmine.createSpyObj(['getAllObjects']);
29
30
  httpMock = TestBed.inject(HttpTestingController);
@@ -1,17 +1,21 @@
1
- import { HttpClientTestingModule } from '@angular/common/http/testing';
1
+ import { provideHttpClientTesting } from '@angular/common/http/testing';
2
2
  import { TestBed, inject } from '@angular/core/testing';
3
3
  import { AppStorageService } from '../abstract/app-storage.service';
4
4
 
5
5
  import { TiledeskRequestsService } from './tiledesk-requests.service';
6
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
6
7
 
7
8
  describe('TiledeskRequestsService', () => {
8
9
  beforeEach(() => {
9
10
  TestBed.configureTestingModule({
10
- providers: [
11
- TiledeskRequestsService,
12
- AppStorageService],
13
- imports: [HttpClientTestingModule]
14
- });
11
+ imports: [],
12
+ providers: [
13
+ TiledeskRequestsService,
14
+ AppStorageService,
15
+ provideHttpClient(withInterceptorsFromDi()),
16
+ provideHttpClientTesting()
17
+ ]
18
+ });
15
19
  });
16
20
 
17
21
  it('should be created', inject([TiledeskRequestsService], (service: TiledeskRequestsService) => {
@@ -1,5 +1,5 @@
1
- import * as dayjs from 'dayjs'
2
- import * as duration from 'dayjs/plugin/duration'
1
+ import dayjs from 'dayjs';
2
+ import duration from 'dayjs/plugin/duration'
3
3
  dayjs.extend(duration)
4
4
  // tslint:disable-next-line:max-line-length
5
5
 
package/src/launch.js CHANGED
@@ -79,10 +79,11 @@ function loadIframe(tiledeskScriptBaseLocation) {
79
79
  srcTileDesk += '</head>';
80
80
  srcTileDesk += '<body>';
81
81
  srcTileDesk += '<chat-root></chat-root>';
82
- srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/runtime.js"></script>';
83
- srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/polyfills.js"></script>';
84
- srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/vendor.js"></script>';
85
- srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/main.js"></script>';
82
+ // srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/runtime.js"></script>';
83
+ srcTileDesk += '<script type="module" async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/polyfills.js"></script>';
84
+ // srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/vendor.js"></script>';
85
+ srcTileDesk += '<script type="module" async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/main.js"></script>';
86
+ srcTileDesk += '<script type="module" async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/scripts.js"></script>';
86
87
  srcTileDesk += '<link type="text/css" rel="stylesheet" href="'+tiledeskScriptBaseLocation+'/styles.css" media="all"></link>';
87
88
  srcTileDesk += '</body>';
88
89
  srcTileDesk += '</html>';
@@ -154,9 +155,9 @@ function loadIframe(tiledeskScriptBaseLocation) {
154
155
  window.tiledesk.on('onNewConversation', function(event_data) {
155
156
  // console.log("test-custom-auth.html onNewConversation >>>",event_data);
156
157
  const tiledeskToken = window.tiledesk.angularcomponent.component.g.tiledeskToken;
157
- const hiddenMessage = window.tiledesk.angularcomponent.component.g.hiddenMessage;
158
158
 
159
159
  // if hiddenMessage is present, do not call /events endpoint because conversation is created by /messages endpoint
160
+ const hiddenMessage = window.tiledesk.angularcomponent.component.g.hiddenMessage;
160
161
  if(hiddenMessage){
161
162
  return;
162
163
  }
@@ -80,10 +80,11 @@ function loadIframe(tiledeskScriptBaseLocation) {
80
80
  srcTileDesk += '</head>';
81
81
  srcTileDesk += '<body>';
82
82
  srcTileDesk += '<chat-root></chat-root>';
83
- srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/{{runtime}}.js"></script>';
84
- srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/{{polyfills}}.js"></script>';
85
- srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/{{vendor}}.js"></script>';
86
- srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/{{main}}.js"></script>';
83
+ // srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/{{runtime}}.js"></script>';
84
+ srcTileDesk += '<script type="module" async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/{{polyfills}}.js"></script>';
85
+ // srcTileDesk += '<script async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/{{vendor}}.js"></script>';
86
+ srcTileDesk += '<script type="module" async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/{{main}}.js"></script>';
87
+ srcTileDesk += '<script type="module" async type="text/javascript" src="'+tiledeskScriptBaseLocation+'/{{scripts}}.js"></script>';
87
88
  srcTileDesk += '<link type="text/css" rel="stylesheet" href="'+tiledeskScriptBaseLocation+'/{{styles}}.css" media="all"></link>';
88
89
  srcTileDesk += '</body>';
89
90
  srcTileDesk += '</html>';
@@ -155,6 +156,12 @@ function loadIframe(tiledeskScriptBaseLocation) {
155
156
  window.tiledesk.on('onNewConversation', function(event_data) {
156
157
  // console.log("test-custom-auth.html onNewConversation >>>",event_data);
157
158
  const tiledeskToken = window.tiledesk.angularcomponent.component.g.tiledeskToken;
159
+
160
+ // if hiddenMessage is present, do not call /events endpoint because conversation is created by /messages endpoint
161
+ const hiddenMessage = window.tiledesk.angularcomponent.component.g.hiddenMessage;
162
+ if(hiddenMessage){
163
+ return;
164
+ }
158
165
  // console.log(">>>> tiledeskToken >>>> ",event_data.detail.appConfigs.apiUrl+event_data.detail.default_settings.projectid);
159
166
  if(tiledeskToken) {
160
167
  var httpRequest = createCORSRequest('POST', event_data.detail.appConfigs.apiUrl+event_data.detail.default_settings.projectid+'/events',true); //set async to false because loadParams must return when the get is complete
package/src/polyfills.ts CHANGED
@@ -46,7 +46,7 @@
46
46
  * Zone JS is required by default for Angular itself.
47
47
  */
48
48
  // import './zone-flag';
49
- import 'zone.js/dist/zone'; // Included with Angular CLI.
49
+ import 'zone.js'; // Included with Angular CLI.
50
50
 
51
51
 
52
52
  /***************************************************************************************************
package/tsconfig.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "outDir": "./dist/out-tsc",
6
6
  "sourceMap": true,
7
7
  "declaration": false,
8
- "downlevelIteration": true,
8
+ "esModuleInterop": true,
9
9
  "experimentalDecorators": true,
10
10
  "module": "es2020",
11
11
  "moduleResolution": "node",
@@ -23,7 +23,6 @@
23
23
  "dom"
24
24
  ],
25
25
  "resolveJsonModule": true,
26
- "allowSyntheticDefaultImports": true,
27
26
  },
28
27
  "skipLibCheck": true,
29
28
  "angularCompilerOptions": {