@chat21/chat21-ionic 3.0.97-rc.4 → 3.0.97-rc.5

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 (47) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +6 -0
  3. package/package.json +1 -1
  4. package/src/app/app-routing.module.ts +5 -0
  5. package/src/app/app.module.ts +2 -0
  6. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +16 -9
  7. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +42 -1
  8. package/src/app/modals/send-email/send-email.module.ts +0 -10
  9. package/src/app/modals/send-email/send-email.page.html +5 -5
  10. package/src/app/modals/send-email/send-email.page.scss +18 -2
  11. package/src/app/modals/send-email/send-email.page.ts +15 -2
  12. package/src/app/modals/send-whatsapp-template/send-whatsapp-template-routing.module.ts +17 -0
  13. package/src/app/modals/send-whatsapp-template/send-whatsapp-template.module.ts +28 -0
  14. package/src/app/modals/send-whatsapp-template/send-whatsapp-template.page.html +139 -0
  15. package/src/app/modals/send-whatsapp-template/send-whatsapp-template.page.scss +340 -0
  16. package/src/app/modals/send-whatsapp-template/send-whatsapp-template.page.spec.ts +24 -0
  17. package/src/app/modals/send-whatsapp-template/send-whatsapp-template.page.ts +183 -0
  18. package/src/app/pages/contacts-directory/contacts-directory.page.html +8 -0
  19. package/src/app/pages/contacts-directory/contacts-directory.page.scss +80 -0
  20. package/src/app/pages/contacts-directory/contacts-directory.page.ts +1 -0
  21. package/src/app/pages/conversation-detail/conversation-detail.page.html +3 -0
  22. package/src/app/pages/conversation-detail/conversation-detail.page.ts +209 -200
  23. package/src/app/services/templates/templates.service.spec.ts +12 -0
  24. package/src/app/services/templates/templates.service.ts +42 -0
  25. package/src/assets/i18n/ar.json +20 -11
  26. package/src/assets/i18n/az.json +296 -287
  27. package/src/assets/i18n/de.json +20 -11
  28. package/src/assets/i18n/en.json +20 -11
  29. package/src/assets/i18n/es.json +20 -11
  30. package/src/assets/i18n/fr.json +20 -11
  31. package/src/assets/i18n/it.json +20 -11
  32. package/src/assets/i18n/kk.json +296 -287
  33. package/src/assets/i18n/pt.json +20 -11
  34. package/src/assets/i18n/ru.json +20 -11
  35. package/src/assets/i18n/sr.json +20 -11
  36. package/src/assets/i18n/sv.json +296 -287
  37. package/src/assets/i18n/tr.json +27 -18
  38. package/src/assets/i18n/uk.json +296 -287
  39. package/src/assets/i18n/uz.json +296 -287
  40. package/src/assets/images/whatsapp_background.png +0 -0
  41. package/src/chat-config-template.json +3 -1
  42. package/src/chat-config.json +3 -1
  43. package/src/chat-config-mqtt-localhost.json +0 -35
  44. package/src/chat-config-mqtt.json +0 -26
  45. package/src/chat-config-native-mqtt.json +0 -36
  46. package/src/chat-config-native-prod.json +0 -36
  47. package/src/chat-config-pre.json +0 -34
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.97-rc.5
4
+ - added: whatsapp templates section to send an already configured whatsapp templete only in case of a whatsapp conversation channel type
5
+ - added: channel input var in message-text-area component to manage the type of current conversation
6
+ - added: whatsappTemplatesBaseUrl env key to manage whatsapp templates only for whatsapp conversations
7
+ - added: loader on contacts-directory page
8
+ - changed: send-email modal UI form mobile platform
9
+ - bug-fixed: do not show offline message if conversation has channel=whatsapp
10
+ - bug-fixed: do not send automatic offline email if conversation has channel=whatsapp
11
+
3
12
  ### 3.0.97-rc.4
4
13
  - bug-fixed: error getting chat group members
5
14
  - bug-fixed: missing info-conversation accordion label
package/README.md CHANGED
@@ -104,6 +104,8 @@ Use [Docker Compose Tiledesk installation guide](https://github.com/Tiledesk/til
104
104
  "dashboardUrl": "https://<YOUR-DASHBOARD-URL>"
105
105
  "testsiteBaseUrl": "https:<YOUR-WIDGET-URL>/test_widget_page/index.html"
106
106
  "wsUrl": 'ws://' + window.location.hostname + '/ws/',
107
+ "emailSection": true,
108
+ "whatsappTemplatesSection": true
107
109
  }
108
110
  };
109
111
  ```
@@ -126,6 +128,10 @@ Use [Docker Compose Tiledesk installation guide](https://github.com/Tiledesk/til
126
128
 
127
129
  * `archivedButton`: if set to true, it makes the button for viewing archived conversations visible
128
130
 
131
+ * `emailSection`: if set to true, allows agents to send offline emails to users
132
+
133
+ * `whatsappTemplatesSection`: if set to true, allows agents to set and send a whatsapp already configured template to users in an incoming whatsapp conversation
134
+
129
135
  ### Push notification
130
136
  * open `/src/firebase-messaging-sw.js` and replace messagingSenderId: with < your messagingSenderId >
131
137
  More info here : https://angularfirebase.com/lessons/send-push-notifications-in-angular-with-firebase-cloud-messaging/
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.0.97-rc.4",
4
+ "version": "3.0.97-rc.5",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -68,6 +68,10 @@ const routes: Routes = [
68
68
  {
69
69
  path: 'json-message',
70
70
  loadChildren: () => import('./modals/json-message/json-message.module').then( m => m.JsonMessagePageModule)
71
+ },
72
+ {
73
+ path: 'send-whatsapp-template',
74
+ loadChildren: () => import('./modals/send-whatsapp-template/send-whatsapp-template.module').then( m => m.SendWhatsappTemplateModalModule)
71
75
  }
72
76
 
73
77
 
@@ -76,6 +80,7 @@ const routes: Routes = [
76
80
 
77
81
 
78
82
 
83
+
79
84
  // {
80
85
  // path: 'conversation-detail/:IDConv',
81
86
  // loadChildren: () => import('./pages/conversation-detail/conversation-detail.module').then( m => m.ConversationDetailPageModule)
@@ -89,6 +89,7 @@ import { LoaderPreviewPageModule } from './modals/loader-preview/loader-preview.
89
89
  import { CreateTicketPageModule } from './modals/create-ticket/create-ticket.module';
90
90
  import { CreateCannedResponsePageModule } from './modals/create-canned-response/create-canned-response.module';
91
91
  import { SendEmailModalModule } from './modals/send-email/send-email.module';
92
+ import { SendWhatsappTemplateModalModule } from './modals/send-whatsapp-template/send-whatsapp-template.module';
92
93
  import { JsonMessagePageModule } from './modals/json-message/json-message.module';
93
94
  // UTILS
94
95
  import { ScrollbarThemeModule } from './utils/scrollbar-theme.directive';
@@ -291,6 +292,7 @@ const appInitializerFn = (appConfig: AppConfigProvider, logger: NGXLogger) => {
291
292
  ConversationInfoModule,
292
293
  LoaderPreviewPageModule,
293
294
  SendEmailModalModule,
295
+ SendWhatsappTemplateModalModule,
294
296
  CreateTicketPageModule,
295
297
  CreateRequesterPageModule,
296
298
  CreateCannedResponsePageModule,
@@ -15,20 +15,27 @@
15
15
  </ion-button>
16
16
  </div>
17
17
 
18
- <div *ngIf="section==='chat' && messageString && leadInfo?.presence['status']==='offline'" class="section-option offline-lead-tip" >
19
- {{translationMap.get('EMAIL_OFFLINE_TIP')}}
18
+ <div *ngIf="whatsappTemplatesSection" class="section-option" id="template" tooltip="{{translationMap?.get('WHATSAPP.LABEL_WA_TEMPLATES')}}" placement="top">
19
+ <ion-button fill="clear" [class.active]="section==='templates'" (click)="onOpenSection('templates');onOpenTemplateModal()" [disabled]="channel !== CHANNEL_TYPE_WHATSAPP">
20
+ <ion-icon name="logo-whatsapp"></ion-icon>
21
+ {{translationMap?.get('WHATSAPP.LABEL_TEMPLATES')}}
22
+ </ion-button>
23
+ </div>
24
+
25
+ <div *ngIf="section==='chat' && channel !== CHANNEL_TYPE_WHATSAPP && messageString && leadInfo?.presence['status']==='offline'" class="section-option offline-lead-tip" >
26
+ {{translationMap.get('EMAIL.EMAIL_OFFLINE_TIP')}}
20
27
  </div>
21
28
 
22
29
  </div>
23
30
 
24
31
  <ion-row id="message-email" [style.display]="section==='email'? 'flex': 'none'">
25
32
  <ion-col col-auto>
26
- <div *ngIf="leadInfo?.hasEmail" class="placeholder" (click)="onOpenEmailModal()">{{translationMap.get('EMAIL_PLACEHOLDER')}}</div>
27
- <div *ngIf="!leadInfo?.hasEmail" class="placeholder noEmail">{{translationMap.get('EMAIL_NOT_FOUND_PLACEHOLDER')}}</div>
33
+ <div *ngIf="leadInfo?.hasEmail" class="placeholder" (click)="onOpenEmailModal()">{{translationMap.get('EMAIL.EMAIL_PLACEHOLDER')}}</div>
34
+ <div *ngIf="!leadInfo?.hasEmail" class="placeholder noEmail">{{translationMap.get('EMAIL.EMAIL_NOT_FOUND_PLACEHOLDER')}}</div>
28
35
  </ion-col>
29
36
  </ion-row>
30
37
 
31
- <ion-row id="message-text-area" [style.display]="section==='chat'? 'flex': 'none'">
38
+ <ion-row id="message-text-area" [style.display]="section==='chat' || section ==='templates'? 'flex': 'none'">
32
39
 
33
40
  <ion-col col-auto style="display: flex;">
34
41
 
@@ -40,7 +47,7 @@
40
47
  tooltip="{{translationMap?.get('CANNED_RESPONSES')}}" placement="top">
41
48
  <ion-button ion-button fill="clear" class="canned-responses-btn" (click)="openCannedResponses()"
42
49
  [disabled]="!conversationWith?.startsWith(TYPE_SUPPORT_GROUP) || disableTextarea">
43
- <ion-icon slot="icon-only" lazy="true" name="flash-outline" style="font-size: 24px;"></ion-icon>
50
+ <ion-icon slot="icon-only" name="flash-outline" style="font-size: 24px;"></ion-icon>
44
51
  </ion-button>
45
52
  </div>
46
53
  <div *ngIf="conversationWith?.startsWith(TYPE_SUPPORT_GROUP) && tagsCannedCount === 0"
@@ -57,7 +64,7 @@
57
64
  <!-- UPLOAD ATTACHMENT -->
58
65
  <div *ngIf="!IS_ON_MOBILE_DEVICE" class="upload-image-btn-wpr" tooltip="{{translationMap?.get('UPLOAD')}}" placement="top">
59
66
  <ion-button ion-button fill="clear" class="upload-image-btn" [disabled]="disableTextarea">
60
- <ion-icon slot="icon-only" lazy="true" name="attach-outline"
67
+ <ion-icon slot="icon-only" name="attach-outline"
61
68
  style="font-size: 30px;transform: rotate(42deg);"></ion-icon>
62
69
  <input #fileInput type="file" (change)="onFileSelected($event)" capture="camera" id="file-input"
63
70
  [accept]="fileUploadAccept">
@@ -71,8 +78,8 @@
71
78
  <div class="emoji-picker-btn-wpr" *ngIf="!IS_ON_MOBILE_DEVICE">
72
79
  <ion-button ion-button fill="clear" class="emoji-picker-btn" (click)="showEmojiPicker = !showEmojiPicker"
73
80
  [disabled]="disableTextarea">
74
- <!-- <ion-icon slot="icon-only" lazy="true" name="flash-outline" style="font-size: 24px;"></ion-icon> -->
75
- <ion-icon slot="icon-only" lazy="true" name="happy-outline" style="font-size: 24px;"></ion-icon>
81
+ <!-- <ion-icon slot="icon-only" name="flash-outline" style="font-size: 24px;"></ion-icon> -->
82
+ <ion-icon slot="icon-only" name="happy-outline" style="font-size: 24px;"></ion-icon>
76
83
  </ion-button>
77
84
 
78
85
  <!-- <div class="emojiContainer" [style.height]="showEmojiPicker?'300px':'0px'"> -->
@@ -1,5 +1,6 @@
1
1
  import { TiledeskService } from 'src/app/services/tiledesk/tiledesk.service';
2
2
  import { SendEmailModal } from './../../../modals/send-email/send-email.page';
3
+ import { SendWhatsappTemplateModal } from './../../../modals/send-whatsapp-template/send-whatsapp-template.page';
3
4
  import { UserModel } from 'src/chat21-core/models/user';
4
5
  import { Component, OnInit, Output, EventEmitter, Input, AfterViewInit, ViewChild, ElementRef, OnChanges, HostListener, Renderer2, SimpleChange, SimpleChanges } from '@angular/core';
5
6
 
@@ -11,7 +12,7 @@ import { LoaderPreviewPage } from 'src/app/modals/loader-preview/loader-preview.
11
12
  // Services
12
13
  import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
13
14
  // utils
14
- import { TYPE_MSG_EMAIL, TYPE_MSG_TEXT, TYPE_SUPPORT_GROUP } from 'src/chat21-core/utils/constants';
15
+ import { CHANNEL_TYPE_WHATSAPP, TYPE_MSG_EMAIL, TYPE_MSG_TEXT, TYPE_SUPPORT_GROUP } from 'src/chat21-core/utils/constants';
15
16
  // Models
16
17
  import { UploadModel } from 'src/chat21-core/models/upload';
17
18
 
@@ -45,6 +46,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
45
46
  @Input() loggedUser: UserModel;
46
47
  @Input() conversationWith: string;
47
48
  @Input() channelType: string;
49
+ @Input() channel: string;
48
50
  @Input() tagsCannedFilter: any;
49
51
  @Input() tagsCannedCount: number;
50
52
  @Input() areVisibleCAR: boolean;
@@ -52,7 +54,9 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
52
54
  @Input() leadInfo: {lead_id: string, hasEmail: boolean, email: string, projectId: string, presence: {}};
53
55
  @Input() fileUploadAccept: string;
54
56
  @Input() emailSection: boolean;
57
+ @Input() whatsappTemplatesSection: boolean;
55
58
  @Input() isOpenInfoConversation: boolean;
59
+ @Input() stylesMap: Map<string, string>;
56
60
  @Input() translationMap: Map<string, string>;
57
61
  @Input() dropEvent: any;
58
62
  @Input() disableTextarea: boolean;
@@ -72,6 +76,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
72
76
 
73
77
  TYPE_SUPPORT_GROUP = TYPE_SUPPORT_GROUP;
74
78
  TYPE_MSG_TEXT = TYPE_MSG_TEXT;
79
+ CHANNEL_TYPE_WHATSAPP = CHANNEL_TYPE_WHATSAPP;
75
80
  msg: string
76
81
 
77
82
  section: string= 'chat'
@@ -141,6 +146,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
141
146
 
142
147
  }
143
148
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea ngOnChanges in [MSG-TEXT-AREA] this.tagsCannedFilter.length ', this.tagsCannedFilter.length)
149
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea ngOnChanges in [MSG-TEXT-AREA] channel', this.channel )
144
150
 
145
151
  // use case drop
146
152
  if (this.dropEvent) {
@@ -259,6 +265,11 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
259
265
  this.presentEmailModal()
260
266
  }
261
267
 
268
+ onOpenTemplateModal(){
269
+ this.logger.log('[CONVS-DETAIL][MSG-TEXT-AREA] - onOpenTemplateModal');
270
+ this.prensentTemplateModal();
271
+ }
272
+
262
273
 
263
274
  /**
264
275
  *
@@ -412,6 +423,36 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
412
423
  return await modal.present();
413
424
  }
414
425
 
426
+ private async prensentTemplateModal():Promise<any> {
427
+ this.logger.log('[CONVS-DETAIL][MSG-TEXT-AREA] openTemplateModal');
428
+ const attributes = {
429
+ enableBackdropDismiss: false,
430
+ conversationWith: this.conversationWith,
431
+ projectId: this.leadInfo.projectId,
432
+ stylesMap: this.stylesMap,
433
+ translationMap: this.translationMap
434
+ };
435
+ const modal: HTMLIonModalElement =
436
+ await this.modalController.create({
437
+ component: SendWhatsappTemplateModal,
438
+ componentProps: attributes,
439
+ swipeToClose: false,
440
+ backdropDismiss: true
441
+ })
442
+ modal.onDidDismiss().then((detail: any) => {
443
+ this.logger.log('[CONVS-DETAIL][MSG-TEXT-AREA] send template returned-->', detail);
444
+
445
+ if (detail && detail.data) {
446
+ let attributes = {
447
+ attachment: detail.data.attachment
448
+ }
449
+ let msg = "whatsapp template: " + detail.data.attachment.template.name + "\r\n" + detail.data.text;
450
+ this.eventSendMessage.emit({ msg: msg, type: TYPE_MSG_TEXT, metadata: null, attributes: attributes });
451
+ }
452
+ });
453
+ return await modal.present();
454
+ }
455
+
415
456
 
416
457
  ionChange(e: any) {
417
458
  this.logger.log("[CONVS-DETAIL][MSG-TEXT-AREA] ionChange event ", e);
@@ -7,9 +7,6 @@ import { IonicModule } from '@ionic/angular';
7
7
  import { SendEmailPageRoutingModule } from './send-email-routing.module';
8
8
 
9
9
  import { SendEmailModal } from './send-email.page';
10
- import { TranslateModule } from '@ngx-translate/core';
11
- import { createTranslateLoader } from 'src/chat21-core/utils/utils';
12
- import { HttpClient } from '@angular/common/http';
13
10
 
14
11
  @NgModule({
15
12
  imports: [
@@ -17,13 +14,6 @@ import { HttpClient } from '@angular/common/http';
17
14
  FormsModule,
18
15
  IonicModule,
19
16
  SendEmailPageRoutingModule,
20
- TranslateModule.forChild({
21
- loader: {
22
- provide: TranslateModule,
23
- useFactory: (createTranslateLoader),
24
- deps: [HttpClient]
25
- }
26
- }),
27
17
  ReactiveFormsModule
28
18
  ],
29
19
  declarations: [SendEmailModal]
@@ -1,6 +1,6 @@
1
1
  <ion-header no-border class="ion-no-border">
2
2
  <ion-toolbar>
3
- <ion-title>{{'LABEL_EMAIL' | translate}}</ion-title>
3
+ <ion-title>{{translationMap?.get('LABEL_EMAIL')}}</ion-title>
4
4
  <ion-buttons slot="end">
5
5
  <ion-button ion-button fill="clear" (click)="onClose()">
6
6
  <ion-icon slot="icon-only" name="close"></ion-icon>
@@ -10,7 +10,7 @@
10
10
  </ion-header>
11
11
 
12
12
  <ion-content>
13
- <div class="content-container">
13
+ <div class="content-container" [attr.isMobile]="isMobile">
14
14
  <form [formGroup]="emailFormGroup" (ngSubmit)="onSubmit()">
15
15
  <!-- <div class="form-group row">
16
16
  <ion-item lines="none">
@@ -20,17 +20,17 @@
20
20
  </div> -->
21
21
  <div class="field-wrapper" id="div_input_topic" #div_input_topic>
22
22
  <input type="text" formControlName="subject" >
23
- <div class="field-placeholder" (click)="addFocus()"><span>{{translationMap?.get('SUBJECT')}}</span></div>
23
+ <div class="field-placeholder" (click)="addFocus()"><span>{{translationMap?.get('EMAIL.SUBJECT')}}</span></div>
24
24
  </div>
25
25
 
26
- <ion-label class="message-placeholder">{{translationMap?.get('MESSAGE')}}</ion-label>
26
+ <ion-label class="message-placeholder">{{translationMap?.get('EMAIL.MESSAGE')}}</ion-label>
27
27
  <div class="field-wrapper-email">
28
28
  <ion-textarea
29
29
  formControlName="text"
30
30
  autosize="false"
31
31
  auto-grow="true"
32
32
  autofocus="true"
33
- placeholder="{{translationMap?.get('MESSAGE_PLACEHOLDER')}}">
33
+ placeholder="{{translationMap?.get('EMAIL.MESSAGE_PLACEHOLDER')}}">
34
34
  </ion-textarea>
35
35
  <div class="info-wrapper">
36
36
  <ion-label>Powered by</ion-label>
@@ -3,8 +3,24 @@ ion-content{
3
3
 
4
4
  .content-container{
5
5
  padding-top: 40px;
6
- padding-left: 64px;
7
- padding-right: 64px;
6
+ padding-left: 8%;
7
+ padding-right: 8%;
8
+
9
+ }
10
+
11
+ .content-container[isMobile= true]{
12
+ height: 100vh;
13
+ form{
14
+ height: 100%;
15
+ }
16
+ .field-wrapper-email{
17
+ height: 65%;
18
+ ion-textarea{
19
+ min-height: calc(100% - 50px);
20
+ max-height: calc(100% - 50px);
21
+ }
22
+ }
23
+
8
24
  }
9
25
 
10
26
  ion-label + ion-input:focus {
@@ -6,6 +6,7 @@ import { ModalController, ToastController } from '@ionic/angular';
6
6
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
7
7
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
8
8
  import { UserModel } from 'src/chat21-core/models/user';
9
+ import { checkPlatformIsMobile } from 'src/chat21-core/utils/utils';
9
10
 
10
11
  @Component({
11
12
  selector: 'send-email-modal',
@@ -26,6 +27,7 @@ export class SendEmailModal implements OnInit {
26
27
 
27
28
  emailFormGroup: FormGroup;
28
29
  private logger: LoggerService = LoggerInstance.getInstance()
30
+ public isMobile: boolean = false;
29
31
 
30
32
  constructor(
31
33
  public viewCtrl: ModalController,
@@ -36,6 +38,17 @@ export class SendEmailModal implements OnInit {
36
38
  ) { }
37
39
 
38
40
  ngOnInit() {
41
+
42
+ if (checkPlatformIsMobile()) {
43
+ this.isMobile = true
44
+ // this.openInfoConversation = false; // indica se è aperto il box info conversazione
45
+ this.logger.log('[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ', this.isMobile)
46
+ } else {
47
+ this.isMobile = false
48
+ this.logger.log('[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ', this.isMobile)
49
+ // this.openInfoConversation = true;
50
+ }
51
+
39
52
  this.logger.log('[SEND-EMAIL-MODAL] Hello!')
40
53
  this.emailFormGroup = this.buildFormGroup();
41
54
  this.emailFormGroup.valueChanges.subscribe((value)=> {
@@ -74,11 +87,11 @@ export class SendEmailModal implements OnInit {
74
87
  this.logger.debug('[SEND-EMAIL-MODAL] subscribe to sendEmail API response -->', res)
75
88
  if(res && res.queued){
76
89
  this.viewCtrl.dismiss({form: this.emailFormGroup.value})
77
- this.presentToast(this.translationMap.get('SEND_EMAIL_SUCCESS'), 'success')
90
+ this.presentToast(this.translationMap.get('EMAIL.SEND_EMAIL_SUCCESS'), 'success')
78
91
  }
79
92
  },(error)=> {
80
93
  this.logger.error('[SEND-EMAIL-MODAL] subscribe to sendEmail API CALL - ERROR ', error)
81
- this.presentToast(this.translationMap.get('SEND_EMAIL_ERROR'), 'danger')
94
+ this.presentToast(this.translationMap.get('EMAIL.SEND_EMAIL_ERROR'), 'danger')
82
95
  }, ()=> {
83
96
  this.logger.log('[SEND-EMAIL-MODAL] subscribe to sendEmail API CALL /* COMPLETE */')
84
97
  })
@@ -0,0 +1,17 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { Routes, RouterModule } from '@angular/router';
3
+
4
+ import { SendWhatsappTemplateModal } from './send-whatsapp-template.page';
5
+
6
+ const routes: Routes = [
7
+ {
8
+ path: '',
9
+ component: SendWhatsappTemplateModal
10
+ }
11
+ ];
12
+
13
+ @NgModule({
14
+ imports: [RouterModule.forChild(routes)],
15
+ exports: [RouterModule],
16
+ })
17
+ export class SendWhatsappTemplatePageRoutingModule {}
@@ -0,0 +1,28 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { FormsModule } from '@angular/forms';
4
+
5
+ import { IonicModule } from '@ionic/angular';
6
+ import { SendWhatsappTemplatePageRoutingModule } from './send-whatsapp-template-routing.module';
7
+ import { SendWhatsappTemplateModal } from './send-whatsapp-template.page';
8
+ import { TranslateModule } from '@ngx-translate/core';
9
+ import { createTranslateLoader } from 'src/chat21-core/utils/utils';
10
+ import { HttpClient } from '@angular/common/http';
11
+
12
+ @NgModule({
13
+ imports: [
14
+ CommonModule,
15
+ FormsModule,
16
+ IonicModule,
17
+ SendWhatsappTemplatePageRoutingModule,
18
+ TranslateModule.forChild({
19
+ loader: {
20
+ provide: TranslateModule,
21
+ useFactory: (createTranslateLoader),
22
+ deps: [HttpClient]
23
+ }
24
+ })
25
+ ],
26
+ declarations: [SendWhatsappTemplateModal]
27
+ })
28
+ export class SendWhatsappTemplateModalModule {}
@@ -0,0 +1,139 @@
1
+ <ion-header no-border class="ion-no-border">
2
+ <ion-toolbar>
3
+ <ion-title *ngIf="!editTemplateView">{{ 'WHATSAPP.SELECT_MESSAGE_TEMPLATE' | translate }}</ion-title>
4
+ <ion-title *ngIf="editTemplateView">Review and send template</ion-title>
5
+ <ion-buttons slot="end">
6
+ <ion-button ion-button fill="clear" (click)="onClose()">
7
+ <ion-icon slot="icon-only" name="close"></ion-icon>
8
+ </ion-button>
9
+ </ion-buttons>
10
+ </ion-toolbar>
11
+ </ion-header>
12
+
13
+ <ion-content *ngIf="selectionView" class="content-container">
14
+
15
+ <ion-list lines="full">
16
+ <ion-item *ngFor="let template of templates" button detail="true" (click)="selectTemplate(template.id)">
17
+ <ion-label>
18
+ <div class="label-container">
19
+ <p class="template-name">{{ template.name }}</p>
20
+ <div>
21
+ <ion-icon *ngIf="template.status === 'APPROVED'" class="template-status-icon" name="ellipse"
22
+ style="color: green"></ion-icon>
23
+ <ion-icon *ngIf="template.status !== 'APPROVED'" class="template-status-icon" name="ellipse"
24
+ style="color: red"></ion-icon>
25
+ </div>
26
+ <div>
27
+ <p class="template-language">{{ template.language }}</p>
28
+ </div>
29
+ </div>
30
+ <div *ngFor="let comp of template.components">
31
+ <p *ngIf="comp.type === 'BODY'" class="body-preview-subtitle">{{ comp.text }}</p>
32
+ </div>
33
+ </ion-label>
34
+ </ion-item>
35
+
36
+ </ion-list>
37
+
38
+ <div class="loader" *ngIf="display_loader">
39
+ <div class="box">
40
+ <div class="spinner" [ngStyle]="{'border-top-color': stylesMap?.get('themeColor')}"></div>
41
+ <div class="label">{{translationMap.get('LABEL_LOADING')}}</div>
42
+ </div>
43
+ </div>
44
+
45
+ </ion-content>
46
+
47
+ <ion-content *ngIf="editTemplateView" class="content-container">
48
+ <div class="preview-container">
49
+ <div class="title-back">
50
+ <ion-button ion-button fill="clear" (click)="backToSelection()">
51
+ <ion-icon slot="icon-only" name="return-up-back"></ion-icon>
52
+ </ion-button>
53
+ <p class="template-name">{{ selected_template.name }}</p>
54
+ </div>
55
+ <div class="message-preview">
56
+
57
+ <div class="message-cloud">
58
+
59
+ <div class="header-preview">
60
+ <span *ngIf="header_component?.format === 'TEXT'">{{ header_component?.text }}</span>
61
+ <span *ngIf="header_component?.format === 'IMAGE'">
62
+ <img [src]="header_component.example.header_handle[0]" />
63
+ </span>
64
+
65
+ </div>
66
+
67
+ <div class="body-preview">
68
+ <span>{{ body_component?.text }}</span>
69
+ </div>
70
+
71
+ <div class="footer-preview">
72
+ <span>{{ footer_component?.text }}</span>
73
+ </div>
74
+
75
+ </div>
76
+
77
+ <div *ngIf="buttons_component" class="message-cloud-buttons">
78
+ <ion-button *ngFor="let btn of buttons_component.buttons" ion-button fill="clear" class="whatsapp-button">{{
79
+ btn.text }}</ion-button>
80
+ </div>
81
+
82
+ </div>
83
+ </div>
84
+
85
+ <div class="parameters-container">
86
+
87
+
88
+ <div *ngIf="header_component && header_component.example">
89
+ <p class="parameters-title">Header parameters</p>
90
+ <div *ngFor="let hp of header_component.example.header_text; index as i" class="parameter">
91
+ <div class="param-number">
92
+ <span>{{</span> {{ i + 1 }} <span>}}</span>
93
+ </div>
94
+ <div class="field-wrapper">
95
+ <input type="text" placeholder="{{hp}}"
96
+ (input)="onParamHeaderChange($event.target.value, i+1)">
97
+ </div>
98
+
99
+ </div>
100
+ </div>
101
+
102
+ <div *ngIf="body_component.example">
103
+ <p class="parameters-title">Body parameters</p>
104
+ <div *ngFor="let bp of body_component.example.body_text[0]; index as i" class="parameter">
105
+ <div class="param-number">
106
+ <span>{{</span> {{ i + 1 }} <span>}}</span>
107
+ </div>
108
+ <div class="field-wrapper">
109
+ <input type="text" placeholder="{{bp}}"
110
+ (input)="onParamBodyChange($event.target.value, i+1)">
111
+ </div>
112
+ </div>
113
+ </div>
114
+
115
+
116
+ <div *ngIf="!body_component.example">
117
+ <p style="font-style: italic; color: #a3a3a3;">No parameters</p>
118
+ </div>
119
+
120
+
121
+
122
+
123
+
124
+ </div>
125
+ </ion-content>
126
+
127
+ <ion-content *ngIf="displayError" class="content-container">
128
+ <div class="error-container">
129
+ <p class="error-message">{{labelError}}</p>
130
+ </div>
131
+ </ion-content>
132
+
133
+
134
+
135
+ <ion-footer *ngIf="editTemplateView">
136
+ <ion-button [disabled]="sendButtonDisabled" ion-button fill="clear" type="submit" (click)="sendTemplate()"><ion-icon
137
+ name="send-sharp"></ion-icon>{{translationMap?.get('LABEL_SEND')}}
138
+ </ion-button>
139
+ </ion-footer>