@chat21/chat21-web-widget 5.1.0-rc1 → 5.1.0-rc4

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 (30) hide show
  1. package/CHANGELOG.md +15 -2
  2. package/Dockerfile +2 -2
  3. package/angular.json +21 -17
  4. package/deploy_amazon_beta.sh +6 -11
  5. package/deploy_amazon_prod.sh +4 -11
  6. package/deploy_beta.sh +1 -11
  7. package/deploy_prod.sh +1 -10
  8. package/package.json +18 -20
  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.spec.ts +9 -11
  16. package/src/app/component/star-rating-widget/star-rating-widget.component.spec.ts +10 -11
  17. package/src/app/pipe/date-ago.pipe.ts +2 -2
  18. package/src/app/providers/app-config.service.spec.ts +5 -6
  19. package/src/app/providers/global-settings.service.spec.ts +7 -8
  20. package/src/app/providers/star-rating-widget.service.spec.ts +7 -8
  21. package/src/app/providers/translator.service.spec.ts +7 -9
  22. package/src/app/providers/waiting.service.spec.ts +7 -8
  23. package/src/app/sass/animations.scss +1 -0
  24. package/src/build_launch.js +9 -8
  25. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.spec.ts +8 -7
  26. package/src/chat21-core/providers/tiledesk/tiledesk-requests.service.spec.ts +10 -6
  27. package/src/chat21-core/utils/utils.ts +2 -2
  28. package/src/launch.js +11 -4
  29. package/src/launch_template.js +11 -4
  30. package/tsconfig.json +1 -2
package/CHANGELOG.md CHANGED
@@ -6,8 +6,21 @@
6
6
  ### **Copyrigth**:
7
7
  *Tiledesk SRL*
8
8
 
9
- # 5.1.0-rc1
10
- - **added**: angular v17
9
+ # 5.1.0-rc.4
10
+ - **bug-fixed**: Dockerfile for angular 18
11
+
12
+ # 5.1.0-rc.3
13
+ - **added**: angular 18
14
+
15
+ # 5.1.0-rc.2
16
+ - **added**: angular 17
17
+
18
+ # 5.0.96
19
+
20
+ # 5.0.95
21
+ - **bug-fixed**: first message is fired twice ( from /event and from /messages with hiddenMesage)
22
+
23
+ # 5.0.94
11
24
 
12
25
  # 5.0.94-rc7
13
26
  - **added**: touchstart and touchend events for mobile mic footer button
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:18.20.8-alpine AS builder
4
+ FROM node:18.19.1-alpine3.18 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 --build-optimizer=false --vendor-chunk
18
+ RUN npm run ng build -- --configuration="prod" --output-path=dist --base-href="./" --output-hashing=none
19
19
 
20
20
 
21
21
  ### STAGE 2: Setup ###
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",
@@ -39,7 +43,8 @@
39
43
  "src/environments/real_data/widget-config-mqtt.json",
40
44
  "src/environments/real_data/widget-config-docker.json",
41
45
  "src/environments/real_data/widget-config-native-mqtt.json",
42
- "src/environments/real_data/widget-config-native-prod.json"
46
+ "src/environments/real_data/widget-config-native-prod.json",
47
+ "src/environments/real_data/widget-config-aws-stage.json"
43
48
  ],
44
49
  "styles": [
45
50
  "src/app/sass/styles.scss"
@@ -47,11 +52,8 @@
47
52
  "scripts": [
48
53
  "src/assets/js/mqtt/4.2.6/mqtt.min.js",
49
54
  "node_modules/bootstrap/dist/js/bootstrap.min.js",
50
- "node_modules/popper.js/dist/umd/popper.min.js"
51
55
  ],
52
- "vendorChunk": true,
53
56
  "extractLicenses": false,
54
- "buildOptimizer": false,
55
57
  "allowedCommonJsDependencies": [
56
58
  "rxjs-compat",
57
59
  "idb",
@@ -61,7 +63,13 @@
61
63
  ],
62
64
  "sourceMap": true,
63
65
  "optimization": false,
64
- "namedChunks": true
66
+ "namedChunks": true,
67
+ "browser": "src/main.ts",
68
+ "stylePreprocessorOptions": {
69
+ "includePaths": [
70
+ "."
71
+ ]
72
+ }
65
73
  },
66
74
  "configurations": {
67
75
  "prod": {
@@ -77,8 +85,6 @@
77
85
  "namedChunks": false,
78
86
  "aot": true,
79
87
  "extractLicenses": true,
80
- "vendorChunk": false,
81
- "buildOptimizer": true,
82
88
  "budgets": [
83
89
  {
84
90
  "type": "initial",
@@ -104,8 +110,6 @@
104
110
  "namedChunks": false,
105
111
  "aot": true,
106
112
  "extractLicenses": true,
107
- "vendorChunk": true,
108
- "buildOptimizer": true,
109
113
  "budgets": [
110
114
  {
111
115
  "type": "initial",
@@ -124,13 +128,13 @@
124
128
  },
125
129
  "configurations": {
126
130
  "prod": {
127
- "browserTarget": "widget:build:prod"
131
+ "buildTarget": "widget:build:prod"
128
132
  },
129
133
  "pre": {
130
- "browserTarget": "widget:build:pre"
134
+ "buildTarget": "widget:build:pre"
131
135
  },
132
136
  "development": {
133
- "browserTarget": "widget:build:development"
137
+ "buildTarget": "widget:build:development"
134
138
  }
135
139
  },
136
140
  "defaultConfiguration": "development"
@@ -138,7 +142,7 @@
138
142
  "extract-i18n": {
139
143
  "builder": "@angular-devkit/build-angular:extract-i18n",
140
144
  "options": {
141
- "browserTarget": "widget:build"
145
+ "buildTarget": "widget:build"
142
146
  }
143
147
  },
144
148
  "test": {
@@ -2,14 +2,8 @@
2
2
  version=`node -e 'console.log(require("./package.json").version)'`
3
3
  echo "version $version"
4
4
 
5
- npm i
5
+ ng build --configuration="pre" --aot=true --base-href
6
6
 
7
- ng build --configuration="pre" --aot=true --base-href --build-optimizer=true
8
-
9
- ### SET HASHING : START ###
10
- cp ./src/launch_template.js ./dist/launch.js
11
- node ./src/build_launch.js
12
- ### SET HASHING : END ###
13
7
 
14
8
  # ########## --->>>> NATIVE-MQTT folder START <<<<<------ ########## #
15
9
 
@@ -30,10 +24,11 @@ node ./src/build_launch.js
30
24
 
31
25
  # ########## --->>>> FIREBASE folder START <<<<<------ ########## #
32
26
  cd dist
33
- aws s3 sync . s3://tiledesk-widget-pre/v5/$version/ --cache-control max-age=300 --exclude='launch.js' #7days
34
- aws s3 sync . s3://tiledesk-widget-pre/v5/$version/ --cache-control "no-store,no-cache,private" --exclude='*' --include='launch.js'
35
- aws s3 sync . s3://tiledesk-widget-pre/v5/ --cache-control max-age=300 --exclude='launch.js' #7days
36
- aws s3 sync . s3://tiledesk-widget-pre/v5/ --cache-control "no-store,no-cache,private" --exclude='*' --include='launch.js'
27
+ aws s3 sync . s3://tiledesk-widget-pre/v5/$version/ --cache-control max-age=300
28
+ aws s3 sync . s3://tiledesk-widget-pre/v5/ --cache-control max-age=300
29
+ cd ..
30
+
31
+ #aws cloudfront create-invalidation --distribution-id E3EJDWEHY08CZZ --paths "/*"
37
32
  cd ..
38
33
 
39
34
  aws cloudfront create-invalidation --distribution-id E2V5O0YPR61V8P --paths "/*"
@@ -3,13 +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
7
- ##--base-href='./v5/' --output-hashing none
8
-
9
- ### SET HASHING : START ###
10
- cp ./src/launch_template.js ./dist/launch.js
11
- node ./src/build_launch.js
12
- ### SET HASHING : END ###
6
+ ng build --configuration="prod" --aot=true
13
7
 
14
8
  #### FIREBASE #####
15
9
  # cd dist
@@ -21,12 +15,11 @@ node ./src/build_launch.js
21
15
  # #### MQTT #####
22
16
  cd dist
23
17
  # aws s3 sync . s3://tiledesk-widget/v5/latest/
24
- aws s3 sync . s3://tiledesk-widget/v6/$version/ --cache-control max-age=86400 --exclude='launch.js' #8days
25
- aws s3 sync . s3://tiledesk-widget/v6/$version/ --cache-control "no-store,no-cache,private" --exclude='*' --include='launch.js'
26
- aws s3 sync . s3://tiledesk-widget/v6/ --cache-control max-age=86400 --exclude='launch.js' #8days
27
- aws s3 sync . s3://tiledesk-widget/v6/ --cache-control "no-store,no-cache,private" --exclude='*' --include='launch.js'
18
+ aws s3 sync . s3://tiledesk-widget/v6/$version/ --cache-control max-age=300
19
+ aws s3 sync . s3://tiledesk-widget/v6/ --cache-control max-age=300
28
20
  cd ..
29
21
 
22
+
30
23
  aws cloudfront create-invalidation --distribution-id E3EJDWEHY08CZZ --paths "/*"
31
24
  echo new version deployed $version on s3://tiledesk-widget/v5
32
25
  echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-widget/v5/index.html
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.1.0-rc1",
4
+ "version": "5.1.0-rc4",
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": "^17.3.12",
22
+ "@angular/animations": "^18.2.13",
23
23
  "@angular/cdk": "^17.3.10",
24
- "@angular/common": "^17.3.12",
25
- "@angular/compiler": "^17.3.12",
26
- "@angular/core": "^17.3.12",
27
- "@angular/forms": "^17.3.12",
28
- "@angular/localize": "^17.3.12",
29
- "@angular/platform-browser": "^17.3.12",
30
- "@angular/platform-browser-dynamic": "^17.3.12",
31
- "@angular/router": "^17.3.12",
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",
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
49
  "zone.js": "~0.14.10"
52
50
  },
53
51
  "devDependencies": {
54
- "@angular-devkit/build-angular": "^17.3.17",
55
- "@angular/cli": "^17.3.17",
56
- "@angular/compiler-cli": "^17.3.12",
57
- "@angular/language-service": "^17.3.12",
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",
@@ -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
+ }
@@ -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
 
@@ -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,6 +155,12 @@ 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;
158
+
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;
161
+ if(hiddenMessage){
162
+ return;
163
+ }
157
164
  // console.log(">>>> tiledeskToken >>>> ",event_data.detail.appConfigs.apiUrl+event_data.detail.default_settings.projectid);
158
165
  if(tiledeskToken) {
159
166
  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
@@ -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/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": {