@flusys/ng-email 4.0.0-rc → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Email Package Guide
2
2
 
3
3
  > **Package:** `@flusys/ng-email`
4
- > **Version:** 4.0.0-rc
4
+ > **Version:** 4.0.2
5
5
  > **Type:** Email management with configurations, templates, and sending
6
6
 
7
7
  ---
@@ -27,8 +27,12 @@ class TemplateFormComponent {
27
27
  templateService = inject(EmailTemplateApiService);
28
28
  messageService = inject(MessageService);
29
29
  appConfig = inject(APP_CONFIG);
30
- companyContext = inject(LAYOUT_AUTH_STATE, { optional: true });
31
- translateAdapter = inject(TRANSLATE_ADAPTER, { optional: true });
30
+ companyContext = inject(LAYOUT_AUTH_STATE, {
31
+ optional: true,
32
+ });
33
+ translateAdapter = inject(TRANSLATE_ADAPTER, {
34
+ optional: true,
35
+ });
32
36
  state = inject(EmailBuilderStateService);
33
37
  // Route params as signal
34
38
  routeParams = toSignal(this.route.paramMap);
@@ -116,13 +120,19 @@ class TemplateFormComponent {
116
120
  if (currentMode === 'text' && mode === 'html') {
117
121
  // Switching from text to html - convert text to basic HTML if htmlContent is empty
118
122
  if (!model.htmlContent && model.textContent) {
119
- this.formModel.update((m) => ({ ...m, htmlContent: this.textToHtml(m.textContent) }));
123
+ this.formModel.update((m) => ({
124
+ ...m,
125
+ htmlContent: this.textToHtml(m.textContent),
126
+ }));
120
127
  }
121
128
  }
122
129
  else if (currentMode === 'html' && mode === 'text') {
123
130
  // Switching from html to text - generate text from HTML if textContent is empty
124
131
  if (!model.textContent && model.htmlContent) {
125
- this.formModel.update((m) => ({ ...m, textContent: this.htmlToPlainText(m.htmlContent) }));
132
+ this.formModel.update((m) => ({
133
+ ...m,
134
+ textContent: this.htmlToPlainText(m.htmlContent),
135
+ }));
126
136
  }
127
137
  }
128
138
  this.editorMode.set(mode);
@@ -188,7 +198,8 @@ class TemplateFormComponent {
188
198
  name: model.name,
189
199
  subject: model.subject,
190
200
  },
191
- htmlContent: model.htmlContent || `<p>${this.translate('email.template.default.content')}</p>`,
201
+ htmlContent: model.htmlContent ||
202
+ `<p>${this.translate('email.template.default.content')}</p>`,
192
203
  textContent: textContent || undefined,
193
204
  isActive: model.isActive,
194
205
  isHtml: model.isHtml,
@@ -202,7 +213,9 @@ class TemplateFormComponent {
202
213
  this.messageService.add({
203
214
  severity: 'success',
204
215
  summary: this.translate('common.success'),
205
- detail: this.translate(this.isEditMode() ? 'email.template.updated' : 'email.template.created'),
216
+ detail: this.translate(this.isEditMode()
217
+ ? 'email.template.updated'
218
+ : 'email.template.created'),
206
219
  });
207
220
  this.router.navigate(['../'], { relativeTo: this.route });
208
221
  }
@@ -220,10 +233,17 @@ class TemplateFormComponent {
220
233
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: TemplateFormComponent, isStandalone: true, selector: "lib-template-form", providers: [MessageService, EmailBuilderStateService], ngImport: i0, template: `
221
234
  <div class="card mb-4">
222
235
  <!-- Header -->
223
- <div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4">
236
+ <div
237
+ class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4"
238
+ >
224
239
  <div>
225
240
  <h3 class="text-lg sm:text-xl font-semibold m-0">
226
- {{ (isEditMode() ? 'email.template.edit.title' : 'email.template.new.title') | translate }}
241
+ {{
242
+ (isEditMode()
243
+ ? 'email.template.edit.title'
244
+ : 'email.template.new.title'
245
+ ) | translate
246
+ }}
227
247
  </h3>
228
248
  @if (showCompanyInfo()) {
229
249
  <p class="text-sm text-muted-color mt-1">
@@ -236,7 +256,9 @@ class TemplateFormComponent {
236
256
  <!-- Form Fields -->
237
257
  <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
238
258
  <div class="field">
239
- <label for="name" class="block font-medium mb-2">{{ 'email.template.name' | translate }} *</label>
259
+ <label for="name" class="block font-medium mb-2"
260
+ >{{ 'email.template.name' | translate }} *</label
261
+ >
240
262
  <input
241
263
  pInputText
242
264
  id="name"
@@ -247,7 +269,9 @@ class TemplateFormComponent {
247
269
  </div>
248
270
 
249
271
  <div class="field">
250
- <label for="slug" class="block font-medium mb-2">{{ 'email.template.slug' | translate }} *</label>
272
+ <label for="slug" class="block font-medium mb-2"
273
+ >{{ 'email.template.slug' | translate }} *</label
274
+ >
251
275
  <input
252
276
  pInputText
253
277
  id="slug"
@@ -258,7 +282,9 @@ class TemplateFormComponent {
258
282
  </div>
259
283
 
260
284
  <div class="field md:col-span-2">
261
- <label for="subject" class="block font-medium mb-2">{{ 'email.template.subject' | translate }} *</label>
285
+ <label for="subject" class="block font-medium mb-2"
286
+ >{{ 'email.template.subject' | translate }} *</label
287
+ >
262
288
  <input
263
289
  pInputText
264
290
  id="subject"
@@ -266,11 +292,15 @@ class TemplateFormComponent {
266
292
  class="w-full"
267
293
  [placeholder]="'email.template.subject.example' | translate"
268
294
  />
269
- <small class="text-muted-color">{{ 'email.template.variable.hint' | translate }}</small>
295
+ <small class="text-muted-color">{{
296
+ 'email.template.variable.hint' | translate
297
+ }}</small>
270
298
  </div>
271
299
 
272
300
  <div class="field">
273
- <label for="description" class="block font-medium mb-2">{{ 'common.description' | translate }}</label>
301
+ <label for="description" class="block font-medium mb-2">{{
302
+ 'common.description' | translate
303
+ }}</label>
274
304
  <input
275
305
  pInputText
276
306
  id="description"
@@ -287,11 +317,16 @@ class TemplateFormComponent {
287
317
  </div>
288
318
 
289
319
  <!-- Content Editor & Preview -->
290
- <div class="grid grid-cols-1 gap-4" [class.lg:grid-cols-2]="editorMode() === 'html'">
320
+ <div
321
+ class="grid grid-cols-1 gap-4"
322
+ [class.lg:grid-cols-2]="editorMode() === 'html'"
323
+ >
291
324
  <!-- Editor Panel -->
292
325
  <div class="card">
293
326
  <div class="flex justify-between items-center mb-3">
294
- <h3 class="font-semibold">{{ 'email.template.content' | translate }}</h3>
327
+ <h3 class="font-semibold">
328
+ {{ 'email.template.content' | translate }}
329
+ </h3>
295
330
  <div class="flex gap-1">
296
331
  <p-button
297
332
  [label]="'email.template.html' | translate"
@@ -343,10 +378,15 @@ class TemplateFormComponent {
343
378
  @if (editorMode() === 'html') {
344
379
  <div class="card">
345
380
  <div class="flex flex-wrap justify-between items-center gap-2 mb-3">
346
- <h3 class="font-semibold m-0">{{ 'email.template.preview' | translate }}</h3>
347
- <p-tag [value]="'email.template.live.preview' | translate" severity="info" />
381
+ <h3 class="font-semibold m-0">
382
+ {{ 'email.template.preview' | translate }}
383
+ </h3>
384
+ <p-tag
385
+ [value]="'email.template.live.preview' | translate"
386
+ severity="info"
387
+ />
348
388
  </div>
349
- <div class="border border-surface rounded bg-surface-0 dark:bg-surface-900 h-[400px] overflow-auto">
389
+ <div class="border border-surface rounded h-[400px] overflow-auto">
350
390
  @if (formModel().htmlContent) {
351
391
  <iframe
352
392
  [srcdoc]="getPreviewHtml()"
@@ -354,10 +394,14 @@ class TemplateFormComponent {
354
394
  sandbox="allow-same-origin"
355
395
  ></iframe>
356
396
  } @else {
357
- <div class="flex items-center justify-center h-full text-muted-color">
397
+ <div
398
+ class="flex items-center justify-center h-full text-muted-color"
399
+ >
358
400
  <div class="text-center p-4">
359
401
  <i class="pi pi-eye text-4xl mb-2"></i>
360
- <p class="m-0">{{ 'email.template.enter.html.preview' | translate }}</p>
402
+ <p class="m-0">
403
+ {{ 'email.template.enter.html.preview' | translate }}
404
+ </p>
361
405
  </div>
362
406
  </div>
363
407
  }
@@ -375,7 +419,9 @@ class TemplateFormComponent {
375
419
  routerLink="../"
376
420
  />
377
421
  <p-button
378
- [label]="(isEditMode() ? 'common.update' : 'common.create') | translate"
422
+ [label]="
423
+ (isEditMode() ? 'common.update' : 'common.create') | translate
424
+ "
379
425
  icon="pi pi-save"
380
426
  [loading]="isLoading()"
381
427
  [disabled]="!isFormValid()"
@@ -396,10 +442,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
396
442
  template: `
397
443
  <div class="card mb-4">
398
444
  <!-- Header -->
399
- <div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4">
445
+ <div
446
+ class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4"
447
+ >
400
448
  <div>
401
449
  <h3 class="text-lg sm:text-xl font-semibold m-0">
402
- {{ (isEditMode() ? 'email.template.edit.title' : 'email.template.new.title') | translate }}
450
+ {{
451
+ (isEditMode()
452
+ ? 'email.template.edit.title'
453
+ : 'email.template.new.title'
454
+ ) | translate
455
+ }}
403
456
  </h3>
404
457
  @if (showCompanyInfo()) {
405
458
  <p class="text-sm text-muted-color mt-1">
@@ -412,7 +465,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
412
465
  <!-- Form Fields -->
413
466
  <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
414
467
  <div class="field">
415
- <label for="name" class="block font-medium mb-2">{{ 'email.template.name' | translate }} *</label>
468
+ <label for="name" class="block font-medium mb-2"
469
+ >{{ 'email.template.name' | translate }} *</label
470
+ >
416
471
  <input
417
472
  pInputText
418
473
  id="name"
@@ -423,7 +478,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
423
478
  </div>
424
479
 
425
480
  <div class="field">
426
- <label for="slug" class="block font-medium mb-2">{{ 'email.template.slug' | translate }} *</label>
481
+ <label for="slug" class="block font-medium mb-2"
482
+ >{{ 'email.template.slug' | translate }} *</label
483
+ >
427
484
  <input
428
485
  pInputText
429
486
  id="slug"
@@ -434,7 +491,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
434
491
  </div>
435
492
 
436
493
  <div class="field md:col-span-2">
437
- <label for="subject" class="block font-medium mb-2">{{ 'email.template.subject' | translate }} *</label>
494
+ <label for="subject" class="block font-medium mb-2"
495
+ >{{ 'email.template.subject' | translate }} *</label
496
+ >
438
497
  <input
439
498
  pInputText
440
499
  id="subject"
@@ -442,11 +501,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
442
501
  class="w-full"
443
502
  [placeholder]="'email.template.subject.example' | translate"
444
503
  />
445
- <small class="text-muted-color">{{ 'email.template.variable.hint' | translate }}</small>
504
+ <small class="text-muted-color">{{
505
+ 'email.template.variable.hint' | translate
506
+ }}</small>
446
507
  </div>
447
508
 
448
509
  <div class="field">
449
- <label for="description" class="block font-medium mb-2">{{ 'common.description' | translate }}</label>
510
+ <label for="description" class="block font-medium mb-2">{{
511
+ 'common.description' | translate
512
+ }}</label>
450
513
  <input
451
514
  pInputText
452
515
  id="description"
@@ -463,11 +526,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
463
526
  </div>
464
527
 
465
528
  <!-- Content Editor & Preview -->
466
- <div class="grid grid-cols-1 gap-4" [class.lg:grid-cols-2]="editorMode() === 'html'">
529
+ <div
530
+ class="grid grid-cols-1 gap-4"
531
+ [class.lg:grid-cols-2]="editorMode() === 'html'"
532
+ >
467
533
  <!-- Editor Panel -->
468
534
  <div class="card">
469
535
  <div class="flex justify-between items-center mb-3">
470
- <h3 class="font-semibold">{{ 'email.template.content' | translate }}</h3>
536
+ <h3 class="font-semibold">
537
+ {{ 'email.template.content' | translate }}
538
+ </h3>
471
539
  <div class="flex gap-1">
472
540
  <p-button
473
541
  [label]="'email.template.html' | translate"
@@ -519,10 +587,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
519
587
  @if (editorMode() === 'html') {
520
588
  <div class="card">
521
589
  <div class="flex flex-wrap justify-between items-center gap-2 mb-3">
522
- <h3 class="font-semibold m-0">{{ 'email.template.preview' | translate }}</h3>
523
- <p-tag [value]="'email.template.live.preview' | translate" severity="info" />
590
+ <h3 class="font-semibold m-0">
591
+ {{ 'email.template.preview' | translate }}
592
+ </h3>
593
+ <p-tag
594
+ [value]="'email.template.live.preview' | translate"
595
+ severity="info"
596
+ />
524
597
  </div>
525
- <div class="border border-surface rounded bg-surface-0 dark:bg-surface-900 h-[400px] overflow-auto">
598
+ <div class="border border-surface rounded h-[400px] overflow-auto">
526
599
  @if (formModel().htmlContent) {
527
600
  <iframe
528
601
  [srcdoc]="getPreviewHtml()"
@@ -530,10 +603,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
530
603
  sandbox="allow-same-origin"
531
604
  ></iframe>
532
605
  } @else {
533
- <div class="flex items-center justify-center h-full text-muted-color">
606
+ <div
607
+ class="flex items-center justify-center h-full text-muted-color"
608
+ >
534
609
  <div class="text-center p-4">
535
610
  <i class="pi pi-eye text-4xl mb-2"></i>
536
- <p class="m-0">{{ 'email.template.enter.html.preview' | translate }}</p>
611
+ <p class="m-0">
612
+ {{ 'email.template.enter.html.preview' | translate }}
613
+ </p>
537
614
  </div>
538
615
  </div>
539
616
  }
@@ -551,7 +628,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
551
628
  routerLink="../"
552
629
  />
553
630
  <p-button
554
- [label]="(isEditMode() ? 'common.update' : 'common.create') | translate"
631
+ [label]="
632
+ (isEditMode() ? 'common.update' : 'common.create') | translate
633
+ "
555
634
  icon="pi pi-save"
556
635
  [loading]="isLoading()"
557
636
  [disabled]="!isFormValid()"
@@ -566,4 +645,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
566
645
  }], ctorParameters: () => [] });
567
646
 
568
647
  export { TemplateFormComponent };
569
- //# sourceMappingURL=flusys-ng-email-template-form.component-CgJZiMCa.mjs.map
648
+ //# sourceMappingURL=flusys-ng-email-template-form.component-B2vIO6ow.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flusys-ng-email-template-form.component-B2vIO6ow.mjs","sources":["../../../projects/ng-email/pages/template/template-form.component.ts"],"sourcesContent":["import { Component, computed, effect, inject, signal } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { form, FormField, required } from '@angular/forms/signals';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport {\n APP_CONFIG,\n DEFAULT_APP_NAME,\n TRANSLATE_ADAPTER,\n} from '@flusys/ng-core';\nimport { LAYOUT_AUTH_STATE } from '@flusys/ng-layout';\nimport { AngularModule, PrimeModule, TranslatePipe } from '@flusys/ng-shared';\nimport { MessageService } from 'primeng/api';\nimport { IEmailTemplate } from '../../interfaces/email-template.interface';\nimport { EmailBuilderStateService } from '../../services/email-builder-state.service';\nimport { EmailTemplateApiService } from '../../services/email-template-api.service';\n\n/** Form model interface for email template */\ninterface IEmailTemplateFormModel {\n id: string;\n name: string;\n slug: string;\n description: string;\n subject: string;\n htmlContent: string;\n textContent: string;\n isActive: boolean;\n isHtml: boolean;\n}\n\n/**\n * Email template form component (create/edit)\n * Uses Angular Signal Forms for reactive form handling\n */\n@Component({\n selector: 'lib-template-form',\n imports: [AngularModule, PrimeModule, FormField, TranslatePipe],\n providers: [MessageService, EmailBuilderStateService],\n template: `\n <div class=\"card mb-4\">\n <!-- Header -->\n <div\n class=\"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4\"\n >\n <div>\n <h3 class=\"text-lg sm:text-xl font-semibold m-0\">\n {{\n (isEditMode()\n ? 'email.template.edit.title'\n : 'email.template.new.title'\n ) | translate\n }}\n </h3>\n @if (showCompanyInfo()) {\n <p class=\"text-sm text-muted-color mt-1\">\n {{ 'common.company' | translate }}: {{ currentCompanyName() }}\n </p>\n }\n </div>\n </div>\n\n <!-- Form Fields -->\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <div class=\"field\">\n <label for=\"name\" class=\"block font-medium mb-2\"\n >{{ 'email.template.name' | translate }} *</label\n >\n <input\n pInputText\n id=\"name\"\n [formField]=\"templateForm.name\"\n class=\"w-full\"\n [placeholder]=\"'email.template.name.example' | translate\"\n />\n </div>\n\n <div class=\"field\">\n <label for=\"slug\" class=\"block font-medium mb-2\"\n >{{ 'email.template.slug' | translate }} *</label\n >\n <input\n pInputText\n id=\"slug\"\n [formField]=\"templateForm.slug\"\n class=\"w-full\"\n [placeholder]=\"'email.template.slug.example' | translate\"\n />\n </div>\n\n <div class=\"field md:col-span-2\">\n <label for=\"subject\" class=\"block font-medium mb-2\"\n >{{ 'email.template.subject' | translate }} *</label\n >\n <input\n pInputText\n id=\"subject\"\n [formField]=\"templateForm.subject\"\n class=\"w-full\"\n [placeholder]=\"'email.template.subject.example' | translate\"\n />\n <small class=\"text-muted-color\">{{\n 'email.template.variable.hint' | translate\n }}</small>\n </div>\n\n <div class=\"field\">\n <label for=\"description\" class=\"block font-medium mb-2\">{{\n 'common.description' | translate\n }}</label>\n <input\n pInputText\n id=\"description\"\n [formField]=\"templateForm.description\"\n class=\"w-full\"\n [placeholder]=\"'email.template.desc.placeholder' | translate\"\n />\n </div>\n\n <div class=\"field flex items-center gap-2\">\n <p-toggleswitch [formField]=\"templateForm.isActive\" />\n <label>{{ 'common.active' | translate }}</label>\n </div>\n </div>\n\n <!-- Content Editor & Preview -->\n <div\n class=\"grid grid-cols-1 gap-4\"\n [class.lg:grid-cols-2]=\"editorMode() === 'html'\"\n >\n <!-- Editor Panel -->\n <div class=\"card\">\n <div class=\"flex justify-between items-center mb-3\">\n <h3 class=\"font-semibold\">\n {{ 'email.template.content' | translate }}\n </h3>\n <div class=\"flex gap-1\">\n <p-button\n [label]=\"'email.template.html' | translate\"\n [outlined]=\"editorMode() !== 'html'\"\n [severity]=\"editorMode() === 'html' ? 'primary' : 'secondary'\"\n size=\"small\"\n (onClick)=\"setEditorMode('html')\"\n />\n <p-button\n [label]=\"'email.template.plain.text' | translate\"\n [outlined]=\"editorMode() !== 'text'\"\n [severity]=\"editorMode() === 'text' ? 'primary' : 'secondary'\"\n size=\"small\"\n (onClick)=\"setEditorMode('text')\"\n />\n </div>\n </div>\n\n <div class=\"h-[400px]\">\n @if (editorMode() === 'html') {\n <textarea\n pTextarea\n [ngModel]=\"formModel().htmlContent\"\n (ngModelChange)=\"updateFormField('htmlContent', $event)\"\n class=\"w-full h-full font-mono text-sm resize-none overflow-auto border border-surface rounded\"\n [placeholder]=\"'email.template.html.placeholder' | translate\"\n wrap=\"off\"\n ></textarea>\n } @else {\n <textarea\n pTextarea\n [ngModel]=\"formModel().textContent\"\n (ngModelChange)=\"updateFormField('textContent', $event)\"\n class=\"w-full h-full font-mono text-sm resize-none overflow-auto border border-surface rounded\"\n [placeholder]=\"'email.template.text.placeholder' | translate\"\n wrap=\"off\"\n ></textarea>\n }\n </div>\n @if (editorMode() === 'text') {\n <small class=\"text-muted-color mt-2 block\">\n <i class=\"pi pi-info-circle mr-1\"></i>\n {{ 'email.template.plain.text.hint' | translate }}\n </small>\n }\n </div>\n\n <!-- Preview Panel (HTML mode only) -->\n @if (editorMode() === 'html') {\n <div class=\"card\">\n <div class=\"flex flex-wrap justify-between items-center gap-2 mb-3\">\n <h3 class=\"font-semibold m-0\">\n {{ 'email.template.preview' | translate }}\n </h3>\n <p-tag\n [value]=\"'email.template.live.preview' | translate\"\n severity=\"info\"\n />\n </div>\n <div class=\"border border-surface rounded h-[400px] overflow-auto\">\n @if (formModel().htmlContent) {\n <iframe\n [srcdoc]=\"getPreviewHtml()\"\n class=\"w-full h-full border-0\"\n sandbox=\"allow-same-origin\"\n ></iframe>\n } @else {\n <div\n class=\"flex items-center justify-center h-full text-muted-color\"\n >\n <div class=\"text-center p-4\">\n <i class=\"pi pi-eye text-4xl mb-2\"></i>\n <p class=\"m-0\">\n {{ 'email.template.enter.html.preview' | translate }}\n </p>\n </div>\n </div>\n }\n </div>\n </div>\n }\n </div>\n\n <!-- Form Actions -->\n <div class=\"flex justify-end gap-2 mt-6 pt-4 border-t border-surface\">\n <p-button\n [label]=\"'common.cancel' | translate\"\n severity=\"secondary\"\n [outlined]=\"true\"\n routerLink=\"../\"\n />\n <p-button\n [label]=\"\n (isEditMode() ? 'common.update' : 'common.create') | translate\n \"\n icon=\"pi pi-save\"\n [loading]=\"isLoading()\"\n [disabled]=\"!isFormValid()\"\n (onClick)=\"onSave()\"\n />\n </div>\n </div>\n\n <p-toast />\n `,\n})\nexport class TemplateFormComponent {\n private readonly route = inject(ActivatedRoute);\n private readonly router = inject(Router);\n private readonly templateService = inject(EmailTemplateApiService);\n private readonly messageService = inject(MessageService);\n private readonly appConfig = inject(APP_CONFIG);\n private readonly companyContext = inject(LAYOUT_AUTH_STATE, {\n optional: true,\n });\n private readonly translateAdapter = inject(TRANSLATE_ADAPTER, {\n optional: true,\n });\n readonly state = inject(EmailBuilderStateService);\n\n // Route params as signal\n private readonly routeParams = toSignal(this.route.paramMap);\n\n readonly isLoading = signal(false);\n readonly existingTemplate = signal<IEmailTemplate | null>(null);\n readonly isEditMode = computed(() => !!this.existingTemplate());\n readonly editorMode = signal<'html' | 'text'>('html');\n\n readonly showCompanyInfo = computed(\n () => this.appConfig.enableCompanyFeature && !!this.companyContext,\n );\n readonly currentCompanyName = computed(\n () => this.companyContext?.currentCompanyInfo()?.name ?? DEFAULT_APP_NAME,\n );\n\n /** Form model using signal */\n readonly formModel = signal<IEmailTemplateFormModel>({\n id: '',\n name: '',\n slug: '',\n description: '',\n subject: '',\n htmlContent: '',\n textContent: '',\n isActive: true,\n isHtml: true,\n });\n\n /** Form with validation using Angular Signal Forms */\n readonly templateForm = form(this.formModel, (f) => {\n required(f.name);\n required(f.slug);\n required(f.subject);\n });\n\n /** Check if form is valid */\n readonly isFormValid = computed(() => {\n const model = this.formModel();\n return (\n model.name.trim().length > 0 &&\n model.slug.trim().length > 0 &&\n model.subject.trim().length > 0\n );\n });\n\n /** Update a single form field */\n updateFormField<K extends keyof IEmailTemplateFormModel>(\n field: K,\n value: IEmailTemplateFormModel[K],\n ): void {\n this.formModel.update((m) => ({ ...m, [field]: value }));\n }\n\n constructor() {\n // Effect to handle route-based initialization\n effect(() => {\n const params = this.routeParams();\n if (!params) return;\n\n const id = params.get('id');\n if (id) {\n this.loadTemplate(id);\n }\n });\n }\n\n async loadTemplate(id: string): Promise<void> {\n this.isLoading.set(true);\n try {\n const response = await this.templateService.findByIdAsync(id);\n if (response.success && response.data) {\n const template = response.data;\n this.existingTemplate.set(template);\n this.formModel.set({\n id: template.id,\n name: template.name,\n slug: template.slug,\n description: template.description || '',\n subject: template.subject,\n htmlContent: template.htmlContent,\n textContent: template.textContent || '',\n isActive: template.isActive,\n isHtml: template.isHtml ?? true,\n });\n // Set editor mode based on saved template type\n this.editorMode.set(template.isHtml ? 'html' : 'text');\n this.state.loadSchema(template.schema);\n }\n } catch {\n // Error toast handled by global interceptor\n } finally {\n this.isLoading.set(false);\n }\n }\n\n setEditorMode(mode: 'html' | 'text'): void {\n const currentMode = this.editorMode();\n const model = this.formModel();\n\n // Sync content when switching modes\n if (currentMode === 'text' && mode === 'html') {\n // Switching from text to html - convert text to basic HTML if htmlContent is empty\n if (!model.htmlContent && model.textContent) {\n this.formModel.update((m) => ({\n ...m,\n htmlContent: this.textToHtml(m.textContent),\n }));\n }\n } else if (currentMode === 'html' && mode === 'text') {\n // Switching from html to text - generate text from HTML if textContent is empty\n if (!model.textContent && model.htmlContent) {\n this.formModel.update((m) => ({\n ...m,\n textContent: this.htmlToPlainText(m.htmlContent),\n }));\n }\n }\n\n this.editorMode.set(mode);\n this.formModel.update((m) => ({ ...m, isHtml: mode === 'html' }));\n }\n\n /** Convert plain text to basic HTML */\n private textToHtml(text: string): string {\n if (!text) return '';\n // Convert line breaks to paragraphs\n return text\n .split(/\\n\\n+/)\n .map((p) => `<p>${p.replace(/\\n/g, '<br>')}</p>`)\n .join('\\n');\n }\n\n /** Convert HTML to plain text (using DOMParser for safe parsing) */\n private htmlToPlainText(html: string): string {\n if (!html) return '';\n // Use DOMParser for safe HTML parsing (prevents XSS)\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, 'text/html');\n // Get text content and clean up whitespace\n return (doc.body.textContent || '').replace(/\\s+/g, ' ').trim();\n }\n\n /** Get HTML for preview iframe */\n getPreviewHtml(): string {\n const baseStyles = `\n <style>\n body {\n font-family: Arial, sans-serif;\n margin: 16px;\n background-color: #ffffff;\n color: #333333;\n }\n img { max-width: 100%; height: auto; }\n </style>\n `;\n return baseStyles + (this.formModel().htmlContent || '');\n }\n\n async onSave(): Promise<void> {\n if (!this.isFormValid()) {\n this.messageService.add({\n severity: 'warn',\n summary: this.translate('common.validation'),\n detail: this.translate('common.fill.required.fields'),\n });\n return;\n }\n\n this.isLoading.set(true);\n try {\n const model = this.formModel();\n const schema = this.state.schema();\n // Use user-provided plain text, or auto-generate from HTML if empty\n const textContent =\n model.textContent || this.htmlToPlainText(model.htmlContent);\n\n const data = {\n name: model.name,\n slug: model.slug,\n description: model.description || undefined,\n subject: model.subject,\n schema: {\n ...schema,\n name: model.name,\n subject: model.subject,\n },\n htmlContent:\n model.htmlContent ||\n `<p>${this.translate('email.template.default.content')}</p>`,\n textContent: textContent || undefined,\n isActive: model.isActive,\n isHtml: model.isHtml,\n };\n\n if (this.isEditMode()) {\n await this.templateService.updateAsync({ id: model.id, ...data });\n } else {\n await this.templateService.insertAsync(data);\n }\n\n this.messageService.add({\n severity: 'success',\n summary: this.translate('common.success'),\n detail: this.translate(\n this.isEditMode()\n ? 'email.template.updated'\n : 'email.template.created',\n ),\n });\n\n this.router.navigate(['../'], { relativeTo: this.route });\n } catch {\n // Error toast handled by global interceptor\n } finally {\n this.isLoading.set(false);\n }\n }\n\n private translate(\n key: string,\n variables?: Record<string, string | number>,\n ): string {\n return this.translateAdapter?.translate(key, variables) ?? key;\n }\n}\n"],"names":["i3","i4","i5","i7","i8"],"mappings":";;;;;;;;;;;;;;;;;;;AA6BA;;;AAGG;MAgNU,qBAAqB,CAAA;AACf,IAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;AAC9B,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,eAAe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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyMT,EAAA,CAAA;AACF,iBAAA;;;;;"}
@@ -1,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, signal, computed, Component } from '@angular/core';
3
3
  import { Router } from '@angular/router';
4
- import { firstValueFrom } from 'rxjs';
5
4
  import { APP_CONFIG, TRANSLATE_ADAPTER, DEFAULT_APP_NAME } from '@flusys/ng-core';
6
5
  import { LAYOUT_AUTH_STATE } from '@flusys/ng-layout';
7
6
  import { EMAIL_TEMPLATE_PERMISSIONS, AngularModule, PrimeModule, HasPermissionDirective, TranslatePipe } from '@flusys/ng-shared';
8
7
  import { ConfirmationService, MessageService } from 'primeng/api';
8
+ import { firstValueFrom } from 'rxjs';
9
9
  import { EmailTemplateApiService, EmailConfigApiService, EmailSendService } from './flusys-ng-email.mjs';
10
10
  import * as i1 from '@angular/forms';
11
11
  import * as i2 from 'primeng/button';
@@ -32,8 +32,12 @@ class TemplateListComponent {
32
32
  confirmationService = inject(ConfirmationService);
33
33
  messageService = inject(MessageService);
34
34
  appConfig = inject(APP_CONFIG);
35
- companyContext = inject(LAYOUT_AUTH_STATE, { optional: true });
36
- translateAdapter = inject(TRANSLATE_ADAPTER, { optional: true });
35
+ companyContext = inject(LAYOUT_AUTH_STATE, {
36
+ optional: true,
37
+ });
38
+ translateAdapter = inject(TRANSLATE_ADAPTER, {
39
+ optional: true,
40
+ });
37
41
  isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
38
42
  templates = signal([], ...(ngDevMode ? [{ debugName: "templates" }] : []));
39
43
  totalRecords = signal(0, ...(ngDevMode ? [{ debugName: "totalRecords" }] : []));
@@ -177,7 +181,9 @@ class TemplateListComponent {
177
181
  this.messageService.add({
178
182
  severity: 'success',
179
183
  summary: this.translate('common.success'),
180
- detail: this.translate('email.template.test.sent.success', { messageId: response.data.messageId ?? '' }),
184
+ detail: this.translate('email.template.test.sent.success', {
185
+ messageId: response.data.messageId ?? '',
186
+ }),
181
187
  });
182
188
  this.showTestDialog.set(false);
183
189
  }
@@ -185,7 +191,8 @@ class TemplateListComponent {
185
191
  this.messageService.add({
186
192
  severity: 'error',
187
193
  summary: this.translate('common.error'),
188
- detail: response.data?.error || this.translate('email.template.test.sent.failed'),
194
+ detail: response.data?.error ||
195
+ this.translate('email.template.test.sent.failed'),
189
196
  });
190
197
  }
191
198
  }
@@ -198,13 +205,18 @@ class TemplateListComponent {
198
205
  }
199
206
  onDelete(template) {
200
207
  this.confirmationService.confirm({
201
- message: this.translate('email.template.delete.confirm', { name: template.name }),
208
+ message: this.translate('email.template.delete.confirm', {
209
+ name: template.name,
210
+ }),
202
211
  header: this.translate('email.template.delete.title'),
203
212
  icon: 'pi pi-exclamation-triangle',
204
213
  acceptButtonStyleClass: 'p-button-danger',
205
214
  accept: async () => {
206
215
  try {
207
- await this.templateService.deleteAsync({ id: template.id, type: 'delete' });
216
+ await this.templateService.deleteAsync({
217
+ id: template.id,
218
+ type: 'delete',
219
+ });
208
220
  this.messageService.add({
209
221
  severity: 'success',
210
222
  summary: this.translate('common.success'),
@@ -225,9 +237,13 @@ class TemplateListComponent {
225
237
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: TemplateListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
226
238
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: TemplateListComponent, isStandalone: true, selector: "lib-template-list", providers: [ConfirmationService, MessageService], ngImport: i0, template: `
227
239
  <div class="card">
228
- <div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4">
240
+ <div
241
+ class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4"
242
+ >
229
243
  <div>
230
- <h3 class="text-lg sm:text-xl font-semibold m-0">{{ 'email.template.title' | translate }}</h3>
244
+ <h3 class="text-lg sm:text-xl font-semibold m-0">
245
+ {{ 'email.template.title' | translate }}
246
+ </h3>
231
247
  @if (showCompanyInfo()) {
232
248
  <p class="text-sm text-muted-color mt-1">
233
249
  {{ 'common.company' | translate }}: {{ currentCompanyName() }}
@@ -260,11 +276,17 @@ class TemplateListComponent {
260
276
  <ng-template #header>
261
277
  <tr>
262
278
  <th>{{ 'common.name' | translate }}</th>
263
- <th class="hidden md:table-cell">{{ 'email.template.slug' | translate }}</th>
264
- <th class="hidden lg:table-cell">{{ 'email.template.subject' | translate }}</th>
279
+ <th class="hidden md:table-cell">
280
+ {{ 'email.template.slug' | translate }}
281
+ </th>
282
+ <th class="hidden lg:table-cell">
283
+ {{ 'email.template.subject' | translate }}
284
+ </th>
265
285
  <th>{{ 'common.type' | translate }}</th>
266
286
  <th>{{ 'common.status' | translate }}</th>
267
- <th class="hidden xl:table-cell">{{ 'common.created' | translate }}</th>
287
+ <th class="hidden xl:table-cell">
288
+ {{ 'common.created' | translate }}
289
+ </th>
268
290
  <th class="w-[120px]">{{ 'common.actions' | translate }}</th>
269
291
  </tr>
270
292
  </ng-template>
@@ -276,22 +298,34 @@ class TemplateListComponent {
276
298
  {{ template.name }}
277
299
  </td>
278
300
  <td class="hidden md:table-cell">
279
- <code class="text-sm bg-surface-100 dark:bg-surface-700 px-2 py-1 rounded">{{ template.slug }}</code>
301
+ <code class="text-sm px-2 py-1 rounded text-text-color">{{
302
+ template.slug
303
+ }}</code>
280
304
  </td>
281
305
  <td class="hidden lg:table-cell">{{ template.subject }}</td>
282
306
  <td>
283
307
  <p-tag
284
- [value]="(template.isHtml ? 'email.template.html' : 'email.template.text') | translate"
308
+ [value]="
309
+ (template.isHtml
310
+ ? 'email.template.html'
311
+ : 'email.template.text'
312
+ ) | translate
313
+ "
285
314
  [severity]="template.isHtml ? 'info' : 'secondary'"
286
315
  />
287
316
  </td>
288
317
  <td>
289
318
  <p-tag
290
- [value]="(template.isActive ? 'common.active' : 'common.inactive') | translate"
319
+ [value]="
320
+ (template.isActive ? 'common.active' : 'common.inactive')
321
+ | translate
322
+ "
291
323
  [severity]="template.isActive ? 'success' : 'secondary'"
292
324
  />
293
325
  </td>
294
- <td class="hidden xl:table-cell">{{ template.createdAt | date: 'short' }}</td>
326
+ <td class="hidden xl:table-cell">
327
+ {{ template.createdAt | date: 'short' }}
328
+ </td>
295
329
  <td>
296
330
  <div class="flex gap-1">
297
331
  <p-button
@@ -347,7 +381,9 @@ class TemplateListComponent {
347
381
  >
348
382
  <div class="flex flex-col gap-4">
349
383
  <div class="field">
350
- <label class="block font-medium mb-2">{{ 'email.template.template' | translate }}</label>
384
+ <label class="block font-medium mb-2">{{
385
+ 'email.template.template' | translate
386
+ }}</label>
351
387
  <input
352
388
  pInputText
353
389
  [value]="selectedTemplate()?.name || ''"
@@ -357,7 +393,9 @@ class TemplateListComponent {
357
393
  </div>
358
394
 
359
395
  <div class="field">
360
- <label class="block font-medium mb-2">{{ 'email.template.email.config' | translate }} *</label>
396
+ <label class="block font-medium mb-2"
397
+ >{{ 'email.template.email.config' | translate }} *</label
398
+ >
361
399
  <p-select
362
400
  [ngModel]="testSendModel.configId"
363
401
  (ngModelChange)="updateTestSendModel('configId', $event)"
@@ -371,7 +409,9 @@ class TemplateListComponent {
371
409
  </div>
372
410
 
373
411
  <div class="field">
374
- <label class="block font-medium mb-2">{{ 'email.config.recipient.email' | translate }} *</label>
412
+ <label class="block font-medium mb-2"
413
+ >{{ 'email.config.recipient.email' | translate }} *</label
414
+ >
375
415
  <input
376
416
  pInputText
377
417
  [ngModel]="testSendModel.recipient"
@@ -392,14 +432,21 @@ class TemplateListComponent {
392
432
  @for (variable of templateVariables(); track variable) {
393
433
  <div class="field">
394
434
  <label class="block text-sm font-medium mb-1">
395
- <code class="text-primary bg-surface-100 dark:bg-surface-700 px-1 rounded">{{ '{{' + variable + '}}' }}</code>
435
+ <code
436
+ class="text-primary bg-surface-100 dark:bg-surface-700 px-1 rounded"
437
+ >{{ '{{' + variable + '}}' }}</code
438
+ >
396
439
  </label>
397
440
  <input
398
441
  pInputText
399
442
  [ngModel]="variableValues[variable] || ''"
400
443
  (ngModelChange)="updateVariableValue(variable, $event)"
401
444
  class="w-full"
402
- [placeholder]="translate('email.template.enter.value.for', { variable: variable })"
445
+ [placeholder]="
446
+ translate('email.template.enter.value.for', {
447
+ variable: variable,
448
+ })
449
+ "
403
450
  />
404
451
  </div>
405
452
  }
@@ -436,9 +483,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
436
483
  providers: [ConfirmationService, MessageService],
437
484
  template: `
438
485
  <div class="card">
439
- <div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4">
486
+ <div
487
+ class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4"
488
+ >
440
489
  <div>
441
- <h3 class="text-lg sm:text-xl font-semibold m-0">{{ 'email.template.title' | translate }}</h3>
490
+ <h3 class="text-lg sm:text-xl font-semibold m-0">
491
+ {{ 'email.template.title' | translate }}
492
+ </h3>
442
493
  @if (showCompanyInfo()) {
443
494
  <p class="text-sm text-muted-color mt-1">
444
495
  {{ 'common.company' | translate }}: {{ currentCompanyName() }}
@@ -471,11 +522,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
471
522
  <ng-template #header>
472
523
  <tr>
473
524
  <th>{{ 'common.name' | translate }}</th>
474
- <th class="hidden md:table-cell">{{ 'email.template.slug' | translate }}</th>
475
- <th class="hidden lg:table-cell">{{ 'email.template.subject' | translate }}</th>
525
+ <th class="hidden md:table-cell">
526
+ {{ 'email.template.slug' | translate }}
527
+ </th>
528
+ <th class="hidden lg:table-cell">
529
+ {{ 'email.template.subject' | translate }}
530
+ </th>
476
531
  <th>{{ 'common.type' | translate }}</th>
477
532
  <th>{{ 'common.status' | translate }}</th>
478
- <th class="hidden xl:table-cell">{{ 'common.created' | translate }}</th>
533
+ <th class="hidden xl:table-cell">
534
+ {{ 'common.created' | translate }}
535
+ </th>
479
536
  <th class="w-[120px]">{{ 'common.actions' | translate }}</th>
480
537
  </tr>
481
538
  </ng-template>
@@ -487,22 +544,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
487
544
  {{ template.name }}
488
545
  </td>
489
546
  <td class="hidden md:table-cell">
490
- <code class="text-sm bg-surface-100 dark:bg-surface-700 px-2 py-1 rounded">{{ template.slug }}</code>
547
+ <code class="text-sm px-2 py-1 rounded text-text-color">{{
548
+ template.slug
549
+ }}</code>
491
550
  </td>
492
551
  <td class="hidden lg:table-cell">{{ template.subject }}</td>
493
552
  <td>
494
553
  <p-tag
495
- [value]="(template.isHtml ? 'email.template.html' : 'email.template.text') | translate"
554
+ [value]="
555
+ (template.isHtml
556
+ ? 'email.template.html'
557
+ : 'email.template.text'
558
+ ) | translate
559
+ "
496
560
  [severity]="template.isHtml ? 'info' : 'secondary'"
497
561
  />
498
562
  </td>
499
563
  <td>
500
564
  <p-tag
501
- [value]="(template.isActive ? 'common.active' : 'common.inactive') | translate"
565
+ [value]="
566
+ (template.isActive ? 'common.active' : 'common.inactive')
567
+ | translate
568
+ "
502
569
  [severity]="template.isActive ? 'success' : 'secondary'"
503
570
  />
504
571
  </td>
505
- <td class="hidden xl:table-cell">{{ template.createdAt | date: 'short' }}</td>
572
+ <td class="hidden xl:table-cell">
573
+ {{ template.createdAt | date: 'short' }}
574
+ </td>
506
575
  <td>
507
576
  <div class="flex gap-1">
508
577
  <p-button
@@ -558,7 +627,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
558
627
  >
559
628
  <div class="flex flex-col gap-4">
560
629
  <div class="field">
561
- <label class="block font-medium mb-2">{{ 'email.template.template' | translate }}</label>
630
+ <label class="block font-medium mb-2">{{
631
+ 'email.template.template' | translate
632
+ }}</label>
562
633
  <input
563
634
  pInputText
564
635
  [value]="selectedTemplate()?.name || ''"
@@ -568,7 +639,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
568
639
  </div>
569
640
 
570
641
  <div class="field">
571
- <label class="block font-medium mb-2">{{ 'email.template.email.config' | translate }} *</label>
642
+ <label class="block font-medium mb-2"
643
+ >{{ 'email.template.email.config' | translate }} *</label
644
+ >
572
645
  <p-select
573
646
  [ngModel]="testSendModel.configId"
574
647
  (ngModelChange)="updateTestSendModel('configId', $event)"
@@ -582,7 +655,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
582
655
  </div>
583
656
 
584
657
  <div class="field">
585
- <label class="block font-medium mb-2">{{ 'email.config.recipient.email' | translate }} *</label>
658
+ <label class="block font-medium mb-2"
659
+ >{{ 'email.config.recipient.email' | translate }} *</label
660
+ >
586
661
  <input
587
662
  pInputText
588
663
  [ngModel]="testSendModel.recipient"
@@ -603,14 +678,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
603
678
  @for (variable of templateVariables(); track variable) {
604
679
  <div class="field">
605
680
  <label class="block text-sm font-medium mb-1">
606
- <code class="text-primary bg-surface-100 dark:bg-surface-700 px-1 rounded">{{ '{{' + variable + '}}' }}</code>
681
+ <code
682
+ class="text-primary bg-surface-100 dark:bg-surface-700 px-1 rounded"
683
+ >{{ '{{' + variable + '}}' }}</code
684
+ >
607
685
  </label>
608
686
  <input
609
687
  pInputText
610
688
  [ngModel]="variableValues[variable] || ''"
611
689
  (ngModelChange)="updateVariableValue(variable, $event)"
612
690
  class="w-full"
613
- [placeholder]="translate('email.template.enter.value.for', { variable: variable })"
691
+ [placeholder]="
692
+ translate('email.template.enter.value.for', {
693
+ variable: variable,
694
+ })
695
+ "
614
696
  />
615
697
  </div>
616
698
  }
@@ -642,4 +724,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
642
724
  }] });
643
725
 
644
726
  export { TemplateListComponent };
645
- //# sourceMappingURL=flusys-ng-email-template-list.component-DHnuMTpB.mjs.map
727
+ //# sourceMappingURL=flusys-ng-email-template-list.component-0PJxS33a.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flusys-ng-email-template-list.component-0PJxS33a.mjs","sources":["../../../projects/ng-email/pages/template/template-list.component.ts"],"sourcesContent":["import { Component, computed, inject, signal } from '@angular/core';\nimport { Router } from '@angular/router';\nimport {\n APP_CONFIG,\n DEFAULT_APP_NAME,\n TRANSLATE_ADAPTER,\n} from '@flusys/ng-core';\nimport { LAYOUT_AUTH_STATE } from '@flusys/ng-layout';\nimport {\n AngularModule,\n EMAIL_TEMPLATE_PERMISSIONS,\n HasPermissionDirective,\n PrimeModule,\n TranslatePipe,\n} from '@flusys/ng-shared';\nimport { ConfirmationService, MessageService } from 'primeng/api';\nimport { firstValueFrom } from 'rxjs';\nimport { IEmailConfig } from '../../interfaces/email-config.interface';\nimport { IEmailTemplate } from '../../interfaces/email-template.interface';\nimport { EmailConfigApiService } from '../../services/email-config-api.service';\nimport { EmailSendService } from '../../services/email-send.service';\nimport { EmailTemplateApiService } from '../../services/email-template-api.service';\n\n/**\n * Email template list component\n */\n@Component({\n selector: 'lib-template-list',\n imports: [AngularModule, PrimeModule, HasPermissionDirective, TranslatePipe],\n providers: [ConfirmationService, MessageService],\n template: `\n <div class=\"card\">\n <div\n class=\"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4\"\n >\n <div>\n <h3 class=\"text-lg sm:text-xl font-semibold m-0\">\n {{ 'email.template.title' | translate }}\n </h3>\n @if (showCompanyInfo()) {\n <p class=\"text-sm text-muted-color mt-1\">\n {{ 'common.company' | translate }}: {{ currentCompanyName() }}\n </p>\n }\n </div>\n <p-button\n *hasPermission=\"EMAIL_TEMPLATE_PERMISSIONS.CREATE\"\n [label]=\"'email.template.new' | translate\"\n icon=\"pi pi-plus\"\n (onClick)=\"onCreate()\"\n styleClass=\"w-full sm:w-auto\"\n />\n </div>\n\n <div class=\"overflow-x-auto -mx-4 sm:mx-0\">\n <p-table\n [value]=\"templates()\"\n [loading]=\"isLoading()\"\n [paginator]=\"totalRecords() > 0\"\n [rows]=\"pageSize()\"\n [first]=\"first()\"\n [totalRecords]=\"totalRecords()\"\n [lazy]=\"true\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [rowsPerPageOptions]=\"[10, 25, 50]\"\n styleClass=\"p-datatable-sm\"\n [tableStyle]=\"{ 'min-width': '50rem' }\"\n >\n <ng-template #header>\n <tr>\n <th>{{ 'common.name' | translate }}</th>\n <th class=\"hidden md:table-cell\">\n {{ 'email.template.slug' | translate }}\n </th>\n <th class=\"hidden lg:table-cell\">\n {{ 'email.template.subject' | translate }}\n </th>\n <th>{{ 'common.type' | translate }}</th>\n <th>{{ 'common.status' | translate }}</th>\n <th class=\"hidden xl:table-cell\">\n {{ 'common.created' | translate }}\n </th>\n <th class=\"w-[120px]\">{{ 'common.actions' | translate }}</th>\n </tr>\n </ng-template>\n\n <ng-template #body let-template>\n <tr>\n <td>\n <i class=\"pi pi-envelope mr-2 text-muted-color\"></i>\n {{ template.name }}\n </td>\n <td class=\"hidden md:table-cell\">\n <code class=\"text-sm px-2 py-1 rounded text-text-color\">{{\n template.slug\n }}</code>\n </td>\n <td class=\"hidden lg:table-cell\">{{ template.subject }}</td>\n <td>\n <p-tag\n [value]=\"\n (template.isHtml\n ? 'email.template.html'\n : 'email.template.text'\n ) | translate\n \"\n [severity]=\"template.isHtml ? 'info' : 'secondary'\"\n />\n </td>\n <td>\n <p-tag\n [value]=\"\n (template.isActive ? 'common.active' : 'common.inactive')\n | translate\n \"\n [severity]=\"template.isActive ? 'success' : 'secondary'\"\n />\n </td>\n <td class=\"hidden xl:table-cell\">\n {{ template.createdAt | date: 'short' }}\n </td>\n <td>\n <div class=\"flex gap-1\">\n <p-button\n *hasPermission=\"EMAIL_TEMPLATE_PERMISSIONS.UPDATE\"\n icon=\"pi pi-send\"\n [text]=\"true\"\n size=\"small\"\n [pTooltip]=\"'email.template.test.send' | translate\"\n (onClick)=\"onTestSend(template)\"\n />\n <p-button\n *hasPermission=\"EMAIL_TEMPLATE_PERMISSIONS.UPDATE\"\n icon=\"pi pi-pencil\"\n [text]=\"true\"\n severity=\"secondary\"\n size=\"small\"\n [pTooltip]=\"'common.edit' | translate\"\n (onClick)=\"onEdit(template.id)\"\n />\n <p-button\n *hasPermission=\"EMAIL_TEMPLATE_PERMISSIONS.DELETE\"\n icon=\"pi pi-trash\"\n [text]=\"true\"\n severity=\"danger\"\n size=\"small\"\n [pTooltip]=\"'common.delete' | translate\"\n (onClick)=\"onDelete(template)\"\n />\n </div>\n </td>\n </tr>\n </ng-template>\n\n <ng-template #emptymessage>\n <tr>\n <td colspan=\"7\" class=\"text-center py-4 text-muted-color\">\n {{ 'email.template.empty' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n\n <!-- Test Send Dialog -->\n <p-dialog\n [header]=\"'email.template.test.dialog.title' | translate\"\n [visible]=\"showTestDialog()\"\n (visibleChange)=\"showTestDialog.set($event)\"\n [modal]=\"true\"\n [style]=\"{ width: '95vw', maxWidth: '500px', maxHeight: '80vh' }\"\n [breakpoints]=\"{ '575px': '95vw' }\"\n >\n <div class=\"flex flex-col gap-4\">\n <div class=\"field\">\n <label class=\"block font-medium mb-2\">{{\n 'email.template.template' | translate\n }}</label>\n <input\n pInputText\n [value]=\"selectedTemplate()?.name || ''\"\n class=\"w-full\"\n [disabled]=\"true\"\n />\n </div>\n\n <div class=\"field\">\n <label class=\"block font-medium mb-2\"\n >{{ 'email.template.email.config' | translate }} *</label\n >\n <p-select\n [ngModel]=\"testSendModel.configId\"\n (ngModelChange)=\"updateTestSendModel('configId', $event)\"\n [options]=\"configOptions()\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'email.template.select.config' | translate\"\n class=\"w-full\"\n [loading]=\"isLoadingConfigs()\"\n />\n </div>\n\n <div class=\"field\">\n <label class=\"block font-medium mb-2\"\n >{{ 'email.config.recipient.email' | translate }} *</label\n >\n <input\n pInputText\n [ngModel]=\"testSendModel.recipient\"\n (ngModelChange)=\"updateTestSendModel('recipient', $event)\"\n class=\"w-full\"\n [placeholder]=\"'email.recipient.example' | translate\"\n />\n </div>\n\n <!-- Dynamic Variables -->\n @if (templateVariables().length > 0) {\n <div class=\"border-t border-surface pt-4 mt-2\">\n <h4 class=\"font-medium mb-3 flex items-center gap-2\">\n <i class=\"pi pi-code text-muted-color\"></i>\n {{ 'email.template.variables' | translate }}\n </h4>\n <div class=\"flex flex-col gap-3\">\n @for (variable of templateVariables(); track variable) {\n <div class=\"field\">\n <label class=\"block text-sm font-medium mb-1\">\n <code\n class=\"text-primary bg-surface-100 dark:bg-surface-700 px-1 rounded\"\n >{{ '{{' + variable + '}}' }}</code\n >\n </label>\n <input\n pInputText\n [ngModel]=\"variableValues[variable] || ''\"\n (ngModelChange)=\"updateVariableValue(variable, $event)\"\n class=\"w-full\"\n [placeholder]=\"\n translate('email.template.enter.value.for', {\n variable: variable,\n })\n \"\n />\n </div>\n }\n </div>\n </div>\n }\n </div>\n\n <ng-template #footer>\n <p-button\n [label]=\"'common.cancel' | translate\"\n severity=\"secondary\"\n [outlined]=\"true\"\n (onClick)=\"showTestDialog.set(false)\"\n />\n <p-button\n [label]=\"'email.template.send.test' | translate\"\n icon=\"pi pi-send\"\n [loading]=\"isSendingTest()\"\n (onClick)=\"sendTestEmail()\"\n />\n </ng-template>\n </p-dialog>\n\n <p-confirmDialog />\n <p-toast />\n `,\n})\nexport class TemplateListComponent {\n // Permission constants for template\n readonly EMAIL_TEMPLATE_PERMISSIONS = EMAIL_TEMPLATE_PERMISSIONS;\n\n private readonly router = inject(Router);\n private readonly templateService = inject(EmailTemplateApiService);\n private readonly configService = inject(EmailConfigApiService);\n private readonly emailSendService = inject(EmailSendService);\n private readonly confirmationService = inject(ConfirmationService);\n private readonly messageService = inject(MessageService);\n private readonly appConfig = inject(APP_CONFIG);\n private readonly companyContext = inject(LAYOUT_AUTH_STATE, {\n optional: true,\n });\n private readonly translateAdapter = inject(TRANSLATE_ADAPTER, {\n optional: true,\n });\n\n readonly isLoading = signal(false);\n readonly templates = signal<IEmailTemplate[]>([]);\n readonly totalRecords = signal(0);\n readonly pageSize = signal(10);\n readonly first = signal(0);\n\n readonly showCompanyInfo = computed(\n () => this.appConfig.enableCompanyFeature && !!this.companyContext,\n );\n readonly currentCompanyName = computed(\n () => this.companyContext?.currentCompanyInfo()?.name ?? DEFAULT_APP_NAME,\n );\n // Test send dialog (signals for zoneless change detection)\n readonly showTestDialog = signal(false);\n readonly selectedTemplate = signal<IEmailTemplate | null>(null);\n readonly configs = signal<IEmailConfig[]>([]);\n readonly isLoadingConfigs = signal(false);\n readonly isSendingTest = signal(false);\n\n // Form-bound properties as signals for zoneless change detection\n private readonly _testSendModel = signal({ configId: '', recipient: '' });\n private readonly _variableValues = signal<Record<string, string>>({});\n\n get testSendModel() {\n return this._testSendModel();\n }\n\n get variableValues() {\n return this._variableValues();\n }\n\n updateTestSendModel<K extends 'configId' | 'recipient'>(\n field: K,\n value: string,\n ): void {\n this._testSendModel.update((m) => ({ ...m, [field]: value }));\n }\n\n updateVariableValue(key: string, value: string): void {\n this._variableValues.update((v) => ({ ...v, [key]: value }));\n }\n\n readonly configOptions = computed(() =>\n this.configs().map((c) => ({\n label: `${c.name} (${this.translate(`email.providers.${c.provider}`)})`,\n value: c.id,\n })),\n );\n\n /** Extract variables from template content */\n readonly templateVariables = computed(() => {\n const template = this.selectedTemplate();\n if (!template) return [];\n\n // Combine all content sources to extract variables\n const content = [\n template.subject,\n template.htmlContent,\n template.textContent || '',\n ].join(' ');\n\n // Find all {{variableName}} patterns\n const matches = content.matchAll(/\\{\\{(\\w+)\\}\\}/g);\n const variables = new Set<string>();\n\n for (const match of matches) {\n variables.add(match[1]);\n }\n\n return Array.from(variables).sort();\n });\n\n onCreate(): void {\n this.router.navigate(['/email/templates/new']);\n }\n\n onEdit(templateId: string): void {\n this.router.navigate(['/email/templates', templateId]);\n }\n\n async loadTemplates(): Promise<void> {\n this.isLoading.set(true);\n try {\n const response = await firstValueFrom(\n this.templateService.getAll('', {\n pagination: {\n currentPage: Math.floor(this.first() / this.pageSize()),\n pageSize: this.pageSize(),\n },\n filter: {},\n select: [],\n sort: {},\n }),\n );\n\n if (response.success) {\n this.templates.set(response.data ?? []);\n this.totalRecords.set(response.meta?.total ?? 0);\n }\n } catch {\n // Error toast handled by global interceptor\n } finally {\n this.isLoading.set(false);\n }\n }\n\n onLazyLoad(event: { first?: number | null; rows?: number | null }): void {\n this.first.set(event.first ?? 0);\n this.pageSize.set(event.rows ?? 10);\n this.loadTemplates();\n }\n\n async onTestSend(template: IEmailTemplate): Promise<void> {\n this.selectedTemplate.set(template);\n this._testSendModel.set({ configId: '', recipient: '' });\n this._variableValues.set({}); // Reset variable values\n this.showTestDialog.set(true);\n await this.loadConfigs();\n }\n\n async loadConfigs(): Promise<void> {\n this.isLoadingConfigs.set(true);\n try {\n const response = await firstValueFrom(\n this.configService.getAll('', {\n pagination: { currentPage: 0, pageSize: 100 },\n filter: { isActive: true },\n select: [],\n sort: {},\n }),\n );\n if (response.success) {\n this.configs.set(response.data ?? []);\n }\n } catch {\n // Error toast handled by global interceptor\n } finally {\n this.isLoadingConfigs.set(false);\n }\n }\n\n async sendTestEmail(): Promise<void> {\n const template = this.selectedTemplate();\n const model = this.testSendModel;\n if (!template || !model.configId || !model.recipient) {\n this.messageService.add({\n severity: 'warn',\n summary: this.translate('common.validation'),\n detail: this.translate('email.template.select.config.and.recipient'),\n });\n return;\n }\n\n this.isSendingTest.set(true);\n try {\n // Build variables object (only include non-empty values)\n const variables: Record<string, string> = {};\n for (const [key, value] of Object.entries(this.variableValues)) {\n if (value) {\n variables[key] = value;\n }\n }\n\n const response = await firstValueFrom(\n this.emailSendService.sendTemplate({\n templateId: template.id,\n to: model.recipient,\n emailConfigId: model.configId,\n variables: Object.keys(variables).length > 0 ? variables : undefined,\n }),\n );\n\n if (response.data?.success) {\n this.messageService.add({\n severity: 'success',\n summary: this.translate('common.success'),\n detail: this.translate('email.template.test.sent.success', {\n messageId: response.data.messageId ?? '',\n }),\n });\n this.showTestDialog.set(false);\n } else {\n this.messageService.add({\n severity: 'error',\n summary: this.translate('common.error'),\n detail:\n response.data?.error ||\n this.translate('email.template.test.sent.failed'),\n });\n }\n } catch {\n // Error toast handled by global interceptor\n } finally {\n this.isSendingTest.set(false);\n }\n }\n\n onDelete(template: IEmailTemplate): void {\n this.confirmationService.confirm({\n message: this.translate('email.template.delete.confirm', {\n name: template.name,\n }),\n header: this.translate('email.template.delete.title'),\n icon: 'pi pi-exclamation-triangle',\n acceptButtonStyleClass: 'p-button-danger',\n accept: async () => {\n try {\n await this.templateService.deleteAsync({\n id: template.id,\n type: 'delete',\n });\n this.messageService.add({\n severity: 'success',\n summary: this.translate('common.success'),\n detail: this.translate('email.template.deleted'),\n });\n this.loadTemplates();\n } catch {\n // Error toast handled by global interceptor\n }\n },\n });\n }\n\n /** Translate helper - public for template usage with dynamic variables */\n translate(key: string, variables?: Record<string, string | number>): string {\n return this.translateAdapter?.translate(key, variables) ?? key;\n }\n}\n"],"names":["i9"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA;;AAEG;MAqPU,qBAAqB,CAAA;;IAEvB,0BAA0B,GAAG,0BAA0B;AAE/C,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,eAAe,GAAG,MAAM,CAAC,uBAAuB,CAAC;AACjD,IAAA,aAAa,GAAG,MAAM,CAAC,qBAAqB,CAAC;AAC7C,IAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAC3C,IAAA,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACjD,IAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AACvC,IAAA,SAAS,GAAG,MAAM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sBAAsB,EAAE,aAAa,CAAC;AAC5E,oBAAA,SAAS,EAAE,CAAC,mBAAmB,EAAE,cAAc,CAAC;AAChD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8OT,EAAA,CAAA;AACF,iBAAA;;;;;"}
@@ -681,17 +681,17 @@ const EMAIL_ROUTES = [
681
681
  children: [
682
682
  {
683
683
  path: '',
684
- loadComponent: () => import('./flusys-ng-email-template-list.component-DHnuMTpB.mjs').then((m) => m.TemplateListComponent),
684
+ loadComponent: () => import('./flusys-ng-email-template-list.component-0PJxS33a.mjs').then((m) => m.TemplateListComponent),
685
685
  },
686
686
  {
687
687
  path: 'new',
688
688
  canActivate: [permissionGuard(EMAIL_TEMPLATE_PERMISSIONS.CREATE)],
689
- loadComponent: () => import('./flusys-ng-email-template-form.component-CgJZiMCa.mjs').then((m) => m.TemplateFormComponent),
689
+ loadComponent: () => import('./flusys-ng-email-template-form.component-B2vIO6ow.mjs').then((m) => m.TemplateFormComponent),
690
690
  },
691
691
  {
692
692
  path: ':id',
693
693
  canActivate: [permissionGuard(EMAIL_TEMPLATE_PERMISSIONS.UPDATE)],
694
- loadComponent: () => import('./flusys-ng-email-template-form.component-CgJZiMCa.mjs').then((m) => m.TemplateFormComponent),
694
+ loadComponent: () => import('./flusys-ng-email-template-form.component-B2vIO6ow.mjs').then((m) => m.TemplateFormComponent),
695
695
  },
696
696
  ],
697
697
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flusys/ng-email",
3
- "version": "4.0.0-rc",
3
+ "version": "4.0.2",
4
4
  "description": "Email management module for FLUSYS Angular applications",
5
5
  "license": "MIT",
6
6
  "peerDependencies": {
@@ -8,12 +8,13 @@
8
8
  "@angular/core": ">=21.0.0",
9
9
  "@angular/forms": ">=21.0.0",
10
10
  "@angular/router": ">=21.0.0",
11
- "@flusys/ng-core": ">=4.0.0-rc",
12
- "@flusys/ng-layout": ">=4.0.0-rc",
13
- "@flusys/ng-shared": ">=4.0.0-rc",
11
+ "@flusys/ng-core": ">=4.0.2",
12
+ "@flusys/ng-layout": ">=4.0.2",
13
+ "@flusys/ng-shared": ">=4.0.2",
14
14
  "@primeuix/themes": ">=1.0.0",
15
15
  "primeicons": ">=7.0.0",
16
- "primeng": ">=21.0.0"
16
+ "primeng": ">=21.0.0",
17
+ "rxjs": "^7.8.0"
17
18
  },
18
19
  "sideEffects": false,
19
20
  "module": "fesm2022/flusys-ng-email.mjs",
@@ -1 +0,0 @@
1
- {"version":3,"file":"flusys-ng-email-template-form.component-CgJZiMCa.mjs","sources":["../../../projects/ng-email/pages/template/template-form.component.ts"],"sourcesContent":["import {\n Component,\n computed,\n effect,\n inject,\n signal,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { form, FormField, required } from '@angular/forms/signals';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { APP_CONFIG, DEFAULT_APP_NAME, TRANSLATE_ADAPTER } from '@flusys/ng-core';\nimport { LAYOUT_AUTH_STATE } from '@flusys/ng-layout';\nimport { AngularModule, PrimeModule, TranslatePipe } from '@flusys/ng-shared';\nimport { MessageService } from 'primeng/api';\nimport { EmailTemplateApiService } from '../../services/email-template-api.service';\nimport { EmailBuilderStateService } from '../../services/email-builder-state.service';\nimport { IEmailTemplate } from '../../interfaces/email-template.interface';\n\n/** Form model interface for email template */\ninterface IEmailTemplateFormModel {\n id: string;\n name: string;\n slug: string;\n description: string;\n subject: string;\n htmlContent: string;\n textContent: string;\n isActive: boolean;\n isHtml: boolean;\n}\n\n/**\n * Email template form component (create/edit)\n * Uses Angular Signal Forms for reactive form handling\n */\n@Component({\n selector: 'lib-template-form',\n imports: [AngularModule, PrimeModule, FormField, TranslatePipe],\n providers: [MessageService, EmailBuilderStateService],\n template: `\n <div class=\"card mb-4\">\n <!-- Header -->\n <div class=\"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4\">\n <div>\n <h3 class=\"text-lg sm:text-xl font-semibold m-0\">\n {{ (isEditMode() ? 'email.template.edit.title' : 'email.template.new.title') | translate }}\n </h3>\n @if (showCompanyInfo()) {\n <p class=\"text-sm text-muted-color mt-1\">\n {{ 'common.company' | translate }}: {{ currentCompanyName() }}\n </p>\n }\n </div>\n </div>\n\n <!-- Form Fields -->\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <div class=\"field\">\n <label for=\"name\" class=\"block font-medium mb-2\">{{ 'email.template.name' | translate }} *</label>\n <input\n pInputText\n id=\"name\"\n [formField]=\"templateForm.name\"\n class=\"w-full\"\n [placeholder]=\"'email.template.name.example' | translate\"\n />\n </div>\n\n <div class=\"field\">\n <label for=\"slug\" class=\"block font-medium mb-2\">{{ 'email.template.slug' | translate }} *</label>\n <input\n pInputText\n id=\"slug\"\n [formField]=\"templateForm.slug\"\n class=\"w-full\"\n [placeholder]=\"'email.template.slug.example' | translate\"\n />\n </div>\n\n <div class=\"field md:col-span-2\">\n <label for=\"subject\" class=\"block font-medium mb-2\">{{ 'email.template.subject' | translate }} *</label>\n <input\n pInputText\n id=\"subject\"\n [formField]=\"templateForm.subject\"\n class=\"w-full\"\n [placeholder]=\"'email.template.subject.example' | translate\"\n />\n <small class=\"text-muted-color\">{{ 'email.template.variable.hint' | translate }}</small>\n </div>\n\n <div class=\"field\">\n <label for=\"description\" class=\"block font-medium mb-2\">{{ 'common.description' | translate }}</label>\n <input\n pInputText\n id=\"description\"\n [formField]=\"templateForm.description\"\n class=\"w-full\"\n [placeholder]=\"'email.template.desc.placeholder' | translate\"\n />\n </div>\n\n <div class=\"field flex items-center gap-2\">\n <p-toggleswitch [formField]=\"templateForm.isActive\" />\n <label>{{ 'common.active' | translate }}</label>\n </div>\n </div>\n\n <!-- Content Editor & Preview -->\n <div class=\"grid grid-cols-1 gap-4\" [class.lg:grid-cols-2]=\"editorMode() === 'html'\">\n <!-- Editor Panel -->\n <div class=\"card\">\n <div class=\"flex justify-between items-center mb-3\">\n <h3 class=\"font-semibold\">{{ 'email.template.content' | translate }}</h3>\n <div class=\"flex gap-1\">\n <p-button\n [label]=\"'email.template.html' | translate\"\n [outlined]=\"editorMode() !== 'html'\"\n [severity]=\"editorMode() === 'html' ? 'primary' : 'secondary'\"\n size=\"small\"\n (onClick)=\"setEditorMode('html')\"\n />\n <p-button\n [label]=\"'email.template.plain.text' | translate\"\n [outlined]=\"editorMode() !== 'text'\"\n [severity]=\"editorMode() === 'text' ? 'primary' : 'secondary'\"\n size=\"small\"\n (onClick)=\"setEditorMode('text')\"\n />\n </div>\n </div>\n\n <div class=\"h-[400px]\">\n @if (editorMode() === 'html') {\n <textarea\n pTextarea\n [ngModel]=\"formModel().htmlContent\"\n (ngModelChange)=\"updateFormField('htmlContent', $event)\"\n class=\"w-full h-full font-mono text-sm resize-none overflow-auto border border-surface rounded\"\n [placeholder]=\"'email.template.html.placeholder' | translate\"\n wrap=\"off\"\n ></textarea>\n } @else {\n <textarea\n pTextarea\n [ngModel]=\"formModel().textContent\"\n (ngModelChange)=\"updateFormField('textContent', $event)\"\n class=\"w-full h-full font-mono text-sm resize-none overflow-auto border border-surface rounded\"\n [placeholder]=\"'email.template.text.placeholder' | translate\"\n wrap=\"off\"\n ></textarea>\n }\n </div>\n @if (editorMode() === 'text') {\n <small class=\"text-muted-color mt-2 block\">\n <i class=\"pi pi-info-circle mr-1\"></i>\n {{ 'email.template.plain.text.hint' | translate }}\n </small>\n }\n </div>\n\n <!-- Preview Panel (HTML mode only) -->\n @if (editorMode() === 'html') {\n <div class=\"card\">\n <div class=\"flex flex-wrap justify-between items-center gap-2 mb-3\">\n <h3 class=\"font-semibold m-0\">{{ 'email.template.preview' | translate }}</h3>\n <p-tag [value]=\"'email.template.live.preview' | translate\" severity=\"info\" />\n </div>\n <div class=\"border border-surface rounded bg-surface-0 dark:bg-surface-900 h-[400px] overflow-auto\">\n @if (formModel().htmlContent) {\n <iframe\n [srcdoc]=\"getPreviewHtml()\"\n class=\"w-full h-full border-0\"\n sandbox=\"allow-same-origin\"\n ></iframe>\n } @else {\n <div class=\"flex items-center justify-center h-full text-muted-color\">\n <div class=\"text-center p-4\">\n <i class=\"pi pi-eye text-4xl mb-2\"></i>\n <p class=\"m-0\">{{ 'email.template.enter.html.preview' | translate }}</p>\n </div>\n </div>\n }\n </div>\n </div>\n }\n </div>\n\n <!-- Form Actions -->\n <div class=\"flex justify-end gap-2 mt-6 pt-4 border-t border-surface\">\n <p-button\n [label]=\"'common.cancel' | translate\"\n severity=\"secondary\"\n [outlined]=\"true\"\n routerLink=\"../\"\n />\n <p-button\n [label]=\"(isEditMode() ? 'common.update' : 'common.create') | translate\"\n icon=\"pi pi-save\"\n [loading]=\"isLoading()\"\n [disabled]=\"!isFormValid()\"\n (onClick)=\"onSave()\"\n />\n </div>\n </div>\n\n <p-toast />\n `,\n})\nexport class TemplateFormComponent {\n private readonly route = inject(ActivatedRoute);\n private readonly router = inject(Router);\n private readonly templateService = inject(EmailTemplateApiService);\n private readonly messageService = inject(MessageService);\n private readonly appConfig = inject(APP_CONFIG);\n private readonly companyContext = inject(LAYOUT_AUTH_STATE, { optional: true });\n private readonly translateAdapter = inject(TRANSLATE_ADAPTER, { optional: true });\n readonly state = inject(EmailBuilderStateService);\n\n // Route params as signal\n private readonly routeParams = toSignal(this.route.paramMap);\n\n readonly isLoading = signal(false);\n readonly existingTemplate = signal<IEmailTemplate | null>(null);\n readonly isEditMode = computed(() => !!this.existingTemplate());\n readonly editorMode = signal<'html' | 'text'>('html');\n\n readonly showCompanyInfo = computed(\n () => this.appConfig.enableCompanyFeature && !!this.companyContext,\n );\n readonly currentCompanyName = computed(\n () => this.companyContext?.currentCompanyInfo()?.name ?? DEFAULT_APP_NAME,\n );\n\n /** Form model using signal */\n readonly formModel = signal<IEmailTemplateFormModel>({\n id: '',\n name: '',\n slug: '',\n description: '',\n subject: '',\n htmlContent: '',\n textContent: '',\n isActive: true,\n isHtml: true,\n });\n\n /** Form with validation using Angular Signal Forms */\n readonly templateForm = form(this.formModel, (f) => {\n required(f.name);\n required(f.slug);\n required(f.subject);\n });\n\n /** Check if form is valid */\n readonly isFormValid = computed(() => {\n const model = this.formModel();\n return (\n model.name.trim().length > 0 &&\n model.slug.trim().length > 0 &&\n model.subject.trim().length > 0\n );\n });\n\n /** Update a single form field */\n updateFormField<K extends keyof IEmailTemplateFormModel>(\n field: K,\n value: IEmailTemplateFormModel[K],\n ): void {\n this.formModel.update((m) => ({ ...m, [field]: value }));\n }\n\n constructor() {\n // Effect to handle route-based initialization\n effect(() => {\n const params = this.routeParams();\n if (!params) return;\n\n const id = params.get('id');\n if (id) {\n this.loadTemplate(id);\n }\n });\n }\n\n async loadTemplate(id: string): Promise<void> {\n this.isLoading.set(true);\n try {\n const response = await this.templateService.findByIdAsync(id);\n if (response.success && response.data) {\n const template = response.data;\n this.existingTemplate.set(template);\n this.formModel.set({\n id: template.id,\n name: template.name,\n slug: template.slug,\n description: template.description || '',\n subject: template.subject,\n htmlContent: template.htmlContent,\n textContent: template.textContent || '',\n isActive: template.isActive,\n isHtml: template.isHtml ?? true,\n });\n // Set editor mode based on saved template type\n this.editorMode.set(template.isHtml ? 'html' : 'text');\n this.state.loadSchema(template.schema);\n }\n } catch {\n // Error toast handled by global interceptor\n } finally {\n this.isLoading.set(false);\n }\n }\n\n setEditorMode(mode: 'html' | 'text'): void {\n const currentMode = this.editorMode();\n const model = this.formModel();\n\n // Sync content when switching modes\n if (currentMode === 'text' && mode === 'html') {\n // Switching from text to html - convert text to basic HTML if htmlContent is empty\n if (!model.htmlContent && model.textContent) {\n this.formModel.update((m) => ({ ...m, htmlContent: this.textToHtml(m.textContent) }));\n }\n } else if (currentMode === 'html' && mode === 'text') {\n // Switching from html to text - generate text from HTML if textContent is empty\n if (!model.textContent && model.htmlContent) {\n this.formModel.update((m) => ({ ...m, textContent: this.htmlToPlainText(m.htmlContent) }));\n }\n }\n\n this.editorMode.set(mode);\n this.formModel.update((m) => ({ ...m, isHtml: mode === 'html' }));\n }\n\n /** Convert plain text to basic HTML */\n private textToHtml(text: string): string {\n if (!text) return '';\n // Convert line breaks to paragraphs\n return text\n .split(/\\n\\n+/)\n .map((p) => `<p>${p.replace(/\\n/g, '<br>')}</p>`)\n .join('\\n');\n }\n\n /** Convert HTML to plain text (using DOMParser for safe parsing) */\n private htmlToPlainText(html: string): string {\n if (!html) return '';\n // Use DOMParser for safe HTML parsing (prevents XSS)\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, 'text/html');\n // Get text content and clean up whitespace\n return (doc.body.textContent || '').replace(/\\s+/g, ' ').trim();\n }\n\n /** Get HTML for preview iframe */\n getPreviewHtml(): string {\n const baseStyles = `\n <style>\n body {\n font-family: Arial, sans-serif;\n margin: 16px;\n background-color: #ffffff;\n color: #333333;\n }\n img { max-width: 100%; height: auto; }\n </style>\n `;\n return baseStyles + (this.formModel().htmlContent || '');\n }\n\n async onSave(): Promise<void> {\n if (!this.isFormValid()) {\n this.messageService.add({\n severity: 'warn',\n summary: this.translate('common.validation'),\n detail: this.translate('common.fill.required.fields'),\n });\n return;\n }\n\n this.isLoading.set(true);\n try {\n const model = this.formModel();\n const schema = this.state.schema();\n // Use user-provided plain text, or auto-generate from HTML if empty\n const textContent = model.textContent || this.htmlToPlainText(model.htmlContent);\n\n const data = {\n name: model.name,\n slug: model.slug,\n description: model.description || undefined,\n subject: model.subject,\n schema: {\n ...schema,\n name: model.name,\n subject: model.subject,\n },\n htmlContent: model.htmlContent || `<p>${this.translate('email.template.default.content')}</p>`,\n textContent: textContent || undefined,\n isActive: model.isActive,\n isHtml: model.isHtml,\n };\n\n if (this.isEditMode()) {\n await this.templateService.updateAsync({ id: model.id, ...data });\n } else {\n await this.templateService.insertAsync(data);\n }\n\n this.messageService.add({\n severity: 'success',\n summary: this.translate('common.success'),\n detail: this.translate(this.isEditMode() ? 'email.template.updated' : 'email.template.created'),\n });\n\n this.router.navigate(['../'], { relativeTo: this.route });\n } catch {\n // Error toast handled by global interceptor\n } finally {\n this.isLoading.set(false);\n }\n }\n\n private translate(key: string, variables?: Record<string, string | number>): string {\n return this.translateAdapter?.translate(key, variables) ?? key;\n }\n}\n"],"names":["i3","i4","i5","i7","i8"],"mappings":";;;;;;;;;;;;;;;;;;;AA+BA;;;AAGG;MA+KU,qBAAqB,CAAA;AACf,IAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;AAC9B,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,eAAe,GAAG,MAAM,CAAC,uBAAuB,CAAC;AACjD,IAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AACvC,IAAA,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC;IAC9B,cAAc,GAAG,MAAM,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC9D,gBAAgB,GAAG,MAAM,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACxE,IAAA,KAAK,GAAG,MAAM,CAAC,wBAAwB,CAAC;;IAGhC,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;AAEnD,IAAA,SAAS,GAAG,MAAM,CAAC,KAAK,qDAAC;AACzB,IAAA,gBAAgB,GAAG,MAAM,CAAwB,IAAI,4DAAC;AACtD,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,gBAAgB,EAAE,sDAAC;AACtD,IAAA,UAAU,GAAG,MAAM,CAAkB,MAAM,sDAAC;AAE5C,IAAA,eAAe,GAAG,QAAQ,CAC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AS,0EAAE,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,CAAA;;2FA4KnD,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBA9KjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;oBAC7B,OAAO,EAAE,CAAC,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,CAAC;AAC/D,oBAAA,SAAS,EAAE,CAAC,cAAc,EAAE,wBAAwB,CAAC;AACrD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwKT,EAAA,CAAA;AACF,iBAAA;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"flusys-ng-email-template-list.component-DHnuMTpB.mjs","sources":["../../../projects/ng-email/pages/template/template-list.component.ts"],"sourcesContent":["import {\n Component,\n computed,\n inject,\n signal,\n} from '@angular/core';\nimport { Router } from '@angular/router';\nimport { firstValueFrom } from 'rxjs';\nimport { APP_CONFIG, DEFAULT_APP_NAME, TRANSLATE_ADAPTER } from '@flusys/ng-core';\nimport { LAYOUT_AUTH_STATE } from '@flusys/ng-layout';\nimport { AngularModule, EMAIL_TEMPLATE_PERMISSIONS, HasPermissionDirective, PrimeModule, TranslatePipe } from '@flusys/ng-shared';\nimport { ConfirmationService, MessageService } from 'primeng/api';\nimport { IEmailConfig } from '../../interfaces/email-config.interface';\nimport { IEmailTemplate } from '../../interfaces/email-template.interface';\nimport { EmailConfigApiService } from '../../services/email-config-api.service';\nimport { EmailSendService } from '../../services/email-send.service';\nimport { EmailTemplateApiService } from '../../services/email-template-api.service';\n\n/**\n * Email template list component\n */\n@Component({\n selector: 'lib-template-list',\n imports: [AngularModule, PrimeModule, HasPermissionDirective, TranslatePipe],\n providers: [ConfirmationService, MessageService],\n template: `\n <div class=\"card\">\n <div class=\"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4\">\n <div>\n <h3 class=\"text-lg sm:text-xl font-semibold m-0\">{{ 'email.template.title' | translate }}</h3>\n @if (showCompanyInfo()) {\n <p class=\"text-sm text-muted-color mt-1\">\n {{ 'common.company' | translate }}: {{ currentCompanyName() }}\n </p>\n }\n </div>\n <p-button\n *hasPermission=\"EMAIL_TEMPLATE_PERMISSIONS.CREATE\"\n [label]=\"'email.template.new' | translate\"\n icon=\"pi pi-plus\"\n (onClick)=\"onCreate()\"\n styleClass=\"w-full sm:w-auto\"\n />\n </div>\n\n <div class=\"overflow-x-auto -mx-4 sm:mx-0\">\n <p-table\n [value]=\"templates()\"\n [loading]=\"isLoading()\"\n [paginator]=\"totalRecords() > 0\"\n [rows]=\"pageSize()\"\n [first]=\"first()\"\n [totalRecords]=\"totalRecords()\"\n [lazy]=\"true\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [rowsPerPageOptions]=\"[10, 25, 50]\"\n styleClass=\"p-datatable-sm\"\n [tableStyle]=\"{ 'min-width': '50rem' }\"\n >\n <ng-template #header>\n <tr>\n <th>{{ 'common.name' | translate }}</th>\n <th class=\"hidden md:table-cell\">{{ 'email.template.slug' | translate }}</th>\n <th class=\"hidden lg:table-cell\">{{ 'email.template.subject' | translate }}</th>\n <th>{{ 'common.type' | translate }}</th>\n <th>{{ 'common.status' | translate }}</th>\n <th class=\"hidden xl:table-cell\">{{ 'common.created' | translate }}</th>\n <th class=\"w-[120px]\">{{ 'common.actions' | translate }}</th>\n </tr>\n </ng-template>\n\n <ng-template #body let-template>\n <tr>\n <td>\n <i class=\"pi pi-envelope mr-2 text-muted-color\"></i>\n {{ template.name }}\n </td>\n <td class=\"hidden md:table-cell\">\n <code class=\"text-sm bg-surface-100 dark:bg-surface-700 px-2 py-1 rounded\">{{ template.slug }}</code>\n </td>\n <td class=\"hidden lg:table-cell\">{{ template.subject }}</td>\n <td>\n <p-tag\n [value]=\"(template.isHtml ? 'email.template.html' : 'email.template.text') | translate\"\n [severity]=\"template.isHtml ? 'info' : 'secondary'\"\n />\n </td>\n <td>\n <p-tag\n [value]=\"(template.isActive ? 'common.active' : 'common.inactive') | translate\"\n [severity]=\"template.isActive ? 'success' : 'secondary'\"\n />\n </td>\n <td class=\"hidden xl:table-cell\">{{ template.createdAt | date: 'short' }}</td>\n <td>\n <div class=\"flex gap-1\">\n <p-button\n *hasPermission=\"EMAIL_TEMPLATE_PERMISSIONS.UPDATE\"\n icon=\"pi pi-send\"\n [text]=\"true\"\n size=\"small\"\n [pTooltip]=\"'email.template.test.send' | translate\"\n (onClick)=\"onTestSend(template)\"\n />\n <p-button\n *hasPermission=\"EMAIL_TEMPLATE_PERMISSIONS.UPDATE\"\n icon=\"pi pi-pencil\"\n [text]=\"true\"\n severity=\"secondary\"\n size=\"small\"\n [pTooltip]=\"'common.edit' | translate\"\n (onClick)=\"onEdit(template.id)\"\n />\n <p-button\n *hasPermission=\"EMAIL_TEMPLATE_PERMISSIONS.DELETE\"\n icon=\"pi pi-trash\"\n [text]=\"true\"\n severity=\"danger\"\n size=\"small\"\n [pTooltip]=\"'common.delete' | translate\"\n (onClick)=\"onDelete(template)\"\n />\n </div>\n </td>\n </tr>\n </ng-template>\n\n <ng-template #emptymessage>\n <tr>\n <td colspan=\"7\" class=\"text-center py-4 text-muted-color\">\n {{ 'email.template.empty' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n\n <!-- Test Send Dialog -->\n <p-dialog\n [header]=\"'email.template.test.dialog.title' | translate\"\n [visible]=\"showTestDialog()\"\n (visibleChange)=\"showTestDialog.set($event)\"\n [modal]=\"true\"\n [style]=\"{ width: '95vw', maxWidth: '500px', maxHeight: '80vh' }\"\n [breakpoints]=\"{ '575px': '95vw' }\"\n >\n <div class=\"flex flex-col gap-4\">\n <div class=\"field\">\n <label class=\"block font-medium mb-2\">{{ 'email.template.template' | translate }}</label>\n <input\n pInputText\n [value]=\"selectedTemplate()?.name || ''\"\n class=\"w-full\"\n [disabled]=\"true\"\n />\n </div>\n\n <div class=\"field\">\n <label class=\"block font-medium mb-2\">{{ 'email.template.email.config' | translate }} *</label>\n <p-select\n [ngModel]=\"testSendModel.configId\"\n (ngModelChange)=\"updateTestSendModel('configId', $event)\"\n [options]=\"configOptions()\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'email.template.select.config' | translate\"\n class=\"w-full\"\n [loading]=\"isLoadingConfigs()\"\n />\n </div>\n\n <div class=\"field\">\n <label class=\"block font-medium mb-2\">{{ 'email.config.recipient.email' | translate }} *</label>\n <input\n pInputText\n [ngModel]=\"testSendModel.recipient\"\n (ngModelChange)=\"updateTestSendModel('recipient', $event)\"\n class=\"w-full\"\n [placeholder]=\"'email.recipient.example' | translate\"\n />\n </div>\n\n <!-- Dynamic Variables -->\n @if (templateVariables().length > 0) {\n <div class=\"border-t border-surface pt-4 mt-2\">\n <h4 class=\"font-medium mb-3 flex items-center gap-2\">\n <i class=\"pi pi-code text-muted-color\"></i>\n {{ 'email.template.variables' | translate }}\n </h4>\n <div class=\"flex flex-col gap-3\">\n @for (variable of templateVariables(); track variable) {\n <div class=\"field\">\n <label class=\"block text-sm font-medium mb-1\">\n <code class=\"text-primary bg-surface-100 dark:bg-surface-700 px-1 rounded\">{{ '{{' + variable + '}}' }}</code>\n </label>\n <input\n pInputText\n [ngModel]=\"variableValues[variable] || ''\"\n (ngModelChange)=\"updateVariableValue(variable, $event)\"\n class=\"w-full\"\n [placeholder]=\"translate('email.template.enter.value.for', { variable: variable })\"\n />\n </div>\n }\n </div>\n </div>\n }\n </div>\n\n <ng-template #footer>\n <p-button\n [label]=\"'common.cancel' | translate\"\n severity=\"secondary\"\n [outlined]=\"true\"\n (onClick)=\"showTestDialog.set(false)\"\n />\n <p-button\n [label]=\"'email.template.send.test' | translate\"\n icon=\"pi pi-send\"\n [loading]=\"isSendingTest()\"\n (onClick)=\"sendTestEmail()\"\n />\n </ng-template>\n </p-dialog>\n\n <p-confirmDialog />\n <p-toast />\n `,\n})\nexport class TemplateListComponent {\n // Permission constants for template\n readonly EMAIL_TEMPLATE_PERMISSIONS = EMAIL_TEMPLATE_PERMISSIONS;\n\n private readonly router = inject(Router);\n private readonly templateService = inject(EmailTemplateApiService);\n private readonly configService = inject(EmailConfigApiService);\n private readonly emailSendService = inject(EmailSendService);\n private readonly confirmationService = inject(ConfirmationService);\n private readonly messageService = inject(MessageService);\n private readonly appConfig = inject(APP_CONFIG);\n private readonly companyContext = inject(LAYOUT_AUTH_STATE, { optional: true });\n private readonly translateAdapter = inject(TRANSLATE_ADAPTER, { optional: true });\n\n readonly isLoading = signal(false);\n readonly templates = signal<IEmailTemplate[]>([]);\n readonly totalRecords = signal(0);\n readonly pageSize = signal(10);\n readonly first = signal(0);\n\n readonly showCompanyInfo = computed(\n () => this.appConfig.enableCompanyFeature && !!this.companyContext,\n );\n readonly currentCompanyName = computed(\n () => this.companyContext?.currentCompanyInfo()?.name ?? DEFAULT_APP_NAME,\n );\n // Test send dialog (signals for zoneless change detection)\n readonly showTestDialog = signal(false);\n readonly selectedTemplate = signal<IEmailTemplate | null>(null);\n readonly configs = signal<IEmailConfig[]>([]);\n readonly isLoadingConfigs = signal(false);\n readonly isSendingTest = signal(false);\n\n // Form-bound properties as signals for zoneless change detection\n private readonly _testSendModel = signal({ configId: '', recipient: '' });\n private readonly _variableValues = signal<Record<string, string>>({});\n\n get testSendModel() {\n return this._testSendModel();\n }\n\n get variableValues() {\n return this._variableValues();\n }\n\n updateTestSendModel<K extends 'configId' | 'recipient'>(field: K, value: string): void {\n this._testSendModel.update((m) => ({ ...m, [field]: value }));\n }\n\n updateVariableValue(key: string, value: string): void {\n this._variableValues.update((v) => ({ ...v, [key]: value }));\n }\n\n readonly configOptions = computed(() =>\n this.configs().map((c) => ({\n label: `${c.name} (${this.translate(`email.providers.${c.provider}`)})`,\n value: c.id,\n })),\n );\n\n /** Extract variables from template content */\n readonly templateVariables = computed(() => {\n const template = this.selectedTemplate();\n if (!template) return [];\n\n // Combine all content sources to extract variables\n const content = [\n template.subject,\n template.htmlContent,\n template.textContent || '',\n ].join(' ');\n\n // Find all {{variableName}} patterns\n const matches = content.matchAll(/\\{\\{(\\w+)\\}\\}/g);\n const variables = new Set<string>();\n\n for (const match of matches) {\n variables.add(match[1]);\n }\n\n return Array.from(variables).sort();\n });\n\n onCreate(): void {\n this.router.navigate(['/email/templates/new']);\n }\n\n onEdit(templateId: string): void {\n this.router.navigate(['/email/templates', templateId]);\n }\n\n async loadTemplates(): Promise<void> {\n this.isLoading.set(true);\n try {\n const response = await firstValueFrom(\n this.templateService.getAll('', {\n pagination: {\n currentPage: Math.floor(this.first() / this.pageSize()),\n pageSize: this.pageSize(),\n },\n filter: {},\n select: [],\n sort: {},\n }),\n );\n\n if (response.success) {\n this.templates.set(response.data ?? []);\n this.totalRecords.set(response.meta?.total ?? 0);\n }\n } catch {\n // Error toast handled by global interceptor\n } finally {\n this.isLoading.set(false);\n }\n }\n\n onLazyLoad(event: { first?: number | null; rows?: number | null }): void {\n this.first.set(event.first ?? 0);\n this.pageSize.set(event.rows ?? 10);\n this.loadTemplates();\n }\n\n async onTestSend(template: IEmailTemplate): Promise<void> {\n this.selectedTemplate.set(template);\n this._testSendModel.set({ configId: '', recipient: '' });\n this._variableValues.set({}); // Reset variable values\n this.showTestDialog.set(true);\n await this.loadConfigs();\n }\n\n async loadConfigs(): Promise<void> {\n this.isLoadingConfigs.set(true);\n try {\n const response = await firstValueFrom(\n this.configService.getAll('', {\n pagination: { currentPage: 0, pageSize: 100 },\n filter: { isActive: true },\n select: [],\n sort: {},\n }),\n );\n if (response.success) {\n this.configs.set(response.data ?? []);\n }\n } catch {\n // Error toast handled by global interceptor\n } finally {\n this.isLoadingConfigs.set(false);\n }\n }\n\n async sendTestEmail(): Promise<void> {\n const template = this.selectedTemplate();\n const model = this.testSendModel;\n if (!template || !model.configId || !model.recipient) {\n this.messageService.add({\n severity: 'warn',\n summary: this.translate('common.validation'),\n detail: this.translate('email.template.select.config.and.recipient'),\n });\n return;\n }\n\n this.isSendingTest.set(true);\n try {\n // Build variables object (only include non-empty values)\n const variables: Record<string, string> = {};\n for (const [key, value] of Object.entries(this.variableValues)) {\n if (value) {\n variables[key] = value;\n }\n }\n\n const response = await firstValueFrom(\n this.emailSendService.sendTemplate({\n templateId: template.id,\n to: model.recipient,\n emailConfigId: model.configId,\n variables: Object.keys(variables).length > 0 ? variables : undefined,\n }),\n );\n\n if (response.data?.success) {\n this.messageService.add({\n severity: 'success',\n summary: this.translate('common.success'),\n detail: this.translate('email.template.test.sent.success', { messageId: response.data.messageId ?? '' }),\n });\n this.showTestDialog.set(false);\n } else {\n this.messageService.add({\n severity: 'error',\n summary: this.translate('common.error'),\n detail: response.data?.error || this.translate('email.template.test.sent.failed'),\n });\n }\n } catch {\n // Error toast handled by global interceptor\n } finally {\n this.isSendingTest.set(false);\n }\n }\n\n onDelete(template: IEmailTemplate): void {\n this.confirmationService.confirm({\n message: this.translate('email.template.delete.confirm', { name: template.name }),\n header: this.translate('email.template.delete.title'),\n icon: 'pi pi-exclamation-triangle',\n acceptButtonStyleClass: 'p-button-danger',\n accept: async () => {\n try {\n await this.templateService.deleteAsync({ id: template.id, type: 'delete' });\n this.messageService.add({\n severity: 'success',\n summary: this.translate('common.success'),\n detail: this.translate('email.template.deleted'),\n });\n this.loadTemplates();\n } catch {\n // Error toast handled by global interceptor\n }\n },\n });\n }\n\n /** Translate helper - public for template usage with dynamic variables */\n translate(key: string, variables?: Record<string, string | number>): string {\n return this.translateAdapter?.translate(key, variables) ?? key;\n }\n}\n"],"names":["i9"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkBA;;AAEG;MAkNU,qBAAqB,CAAA;;IAEvB,0BAA0B,GAAG,0BAA0B;AAE/C,IAAA,MAAM,GAAG,MAAM,CAAC,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