@firestitch/app-message 13.0.1 → 13.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.
Files changed (72) hide show
  1. package/app/modules/message-queues/components/queue/queue.component.d.ts +5 -5
  2. package/app/modules/message-queues/pipes/linkify.pipe.d.ts +1 -1
  3. package/{esm2015/app/modules/app-message/app-message.module.js → esm2020/app/modules/app-message/app-message.module.mjs} +5 -5
  4. package/esm2020/app/modules/message-preview/components/preview/preview.component.mjs +26 -0
  5. package/{esm2015/app/modules/message-preview/message-preview.module.js → esm2020/app/modules/message-preview/message-preview.module.mjs} +5 -5
  6. package/esm2020/app/modules/message-queues/components/queue/queue.component.mjs +210 -0
  7. package/esm2020/app/modules/message-queues/components/queues/queues.component.mjs +157 -0
  8. package/esm2020/app/modules/message-queues/components/recipient/recipient.component.mjs +26 -0
  9. package/{esm2015/app/modules/message-queues/message-queues.module.js → esm2020/app/modules/message-queues/message-queues.module.mjs} +5 -5
  10. package/esm2020/app/modules/message-queues/pipes/linkify.pipe.mjs +22 -0
  11. package/{esm2015/app/modules/message-queues/pipes/truncate.pipe.js → esm2020/app/modules/message-queues/pipes/truncate.pipe.mjs} +4 -4
  12. package/esm2020/app/modules/message-queues/services/message-queue.service.mjs +29 -0
  13. package/esm2020/app/modules/message-templates/components/template/template.component.mjs +81 -0
  14. package/{esm2015/app/modules/message-templates/components/templates/templates.component.js → esm2020/app/modules/message-templates/components/templates/templates.component.mjs} +5 -8
  15. package/{esm2015/app/modules/message-templates/message-templates.module.js → esm2020/app/modules/message-templates/message-templates.module.mjs} +5 -5
  16. package/esm2020/app/modules/messages/components/attachments/attachments.component.mjs +81 -0
  17. package/esm2020/app/modules/messages/components/message/message.component.mjs +129 -0
  18. package/esm2020/app/modules/messages/components/messages/messages.component.mjs +72 -0
  19. package/{esm2015/app/modules/messages/messages.module.js → esm2020/app/modules/messages/messages.module.mjs} +5 -5
  20. package/esm2020/app/modules/webhooks/components/webhooks/webhooks.component.mjs +61 -0
  21. package/{esm2015/app/modules/webhooks/webhooks.module.js → esm2020/app/modules/webhooks/webhooks.module.mjs} +5 -5
  22. package/fesm2015/firestitch-app-message.mjs +1286 -0
  23. package/fesm2015/firestitch-app-message.mjs.map +1 -0
  24. package/fesm2020/firestitch-app-message.mjs +1289 -0
  25. package/fesm2020/firestitch-app-message.mjs.map +1 -0
  26. package/package.json +22 -9
  27. package/bundles/firestitch-app-message.umd.js +0 -1861
  28. package/bundles/firestitch-app-message.umd.js.map +0 -1
  29. package/esm2015/app/modules/message-preview/components/preview/preview.component.js +0 -29
  30. package/esm2015/app/modules/message-queues/components/queue/queue.component.js +0 -214
  31. package/esm2015/app/modules/message-queues/components/queues/queues.component.js +0 -148
  32. package/esm2015/app/modules/message-queues/components/recipient/recipient.component.js +0 -31
  33. package/esm2015/app/modules/message-queues/pipes/linkify.pipe.js +0 -22
  34. package/esm2015/app/modules/message-queues/services/message-queue.service.js +0 -25
  35. package/esm2015/app/modules/message-templates/components/template/template.component.js +0 -84
  36. package/esm2015/app/modules/messages/components/attachments/attachments.component.js +0 -85
  37. package/esm2015/app/modules/messages/components/message/message.component.js +0 -133
  38. package/esm2015/app/modules/messages/components/messages/messages.component.js +0 -75
  39. package/esm2015/app/modules/webhooks/components/webhooks/webhooks.component.js +0 -65
  40. package/fesm2015/firestitch-app-message.js +0 -1308
  41. package/fesm2015/firestitch-app-message.js.map +0 -1
  42. /package/{esm2015/app/helpers/index-name-value.js → esm2020/app/helpers/index-name-value.mjs} +0 -0
  43. /package/{esm2015/app/helpers/index.js → esm2020/app/helpers/index.mjs} +0 -0
  44. /package/{esm2015/app/modules/app-message/injectors/app-message-config.injector.js → esm2020/app/modules/app-message/injectors/app-message-config.injector.mjs} +0 -0
  45. /package/{esm2015/app/modules/app-message/injectors/index.js → esm2020/app/modules/app-message/injectors/index.mjs} +0 -0
  46. /package/{esm2015/app/modules/app-message/interfaces/app-message-config.js → esm2020/app/modules/app-message/interfaces/app-message-config.mjs} +0 -0
  47. /package/{esm2015/app/modules/app-message/interfaces/index.js → esm2020/app/modules/app-message/interfaces/index.mjs} +0 -0
  48. /package/{esm2015/app/modules/app-message/types/index.js → esm2020/app/modules/app-message/types/index.mjs} +0 -0
  49. /package/{esm2015/app/modules/app-message/types/types.type.js → esm2020/app/modules/app-message/types/types.type.mjs} +0 -0
  50. /package/{esm2015/app/modules/message-preview/components/index.js → esm2020/app/modules/message-preview/components/index.mjs} +0 -0
  51. /package/{esm2015/app/modules/message-preview/components/preview/index.js → esm2020/app/modules/message-preview/components/preview/index.mjs} +0 -0
  52. /package/{esm2015/app/modules/message-queues/consts/index.js → esm2020/app/modules/message-queues/consts/index.mjs} +0 -0
  53. /package/{esm2015/app/modules/message-queues/consts/message-queue-event-type.const.js → esm2020/app/modules/message-queues/consts/message-queue-event-type.const.mjs} +0 -0
  54. /package/{esm2015/app/modules/message-queues/consts/message-queue-states.const.js → esm2020/app/modules/message-queues/consts/message-queue-states.const.mjs} +0 -0
  55. /package/{esm2015/app/modules/message-queues/enums/email-message-queue-format.enum.js → esm2020/app/modules/message-queues/enums/email-message-queue-format.enum.mjs} +0 -0
  56. /package/{esm2015/app/modules/message-queues/enums/index.js → esm2020/app/modules/message-queues/enums/index.mjs} +0 -0
  57. /package/{esm2015/app/modules/message-queues/enums/message-queue-event-type.enum.js → esm2020/app/modules/message-queues/enums/message-queue-event-type.enum.mjs} +0 -0
  58. /package/{esm2015/app/modules/message-queues/enums/message-queue-state.enum.js → esm2020/app/modules/message-queues/enums/message-queue-state.enum.mjs} +0 -0
  59. /package/{esm2015/app/modules/message-queues/enums/message-queue-type.enum.js → esm2020/app/modules/message-queues/enums/message-queue-type.enum.mjs} +0 -0
  60. /package/{esm2015/app/modules/message-templates/components/index.js → esm2020/app/modules/message-templates/components/index.mjs} +0 -0
  61. /package/{esm2015/app/modules/message-templates/components/template/index.js → esm2020/app/modules/message-templates/components/template/index.mjs} +0 -0
  62. /package/{esm2015/app/modules/message-templates/components/templates/index.js → esm2020/app/modules/message-templates/components/templates/index.mjs} +0 -0
  63. /package/{esm2015/app/modules/messages/components/attachments/index.js → esm2020/app/modules/messages/components/attachments/index.mjs} +0 -0
  64. /package/{esm2015/app/modules/messages/components/index.js → esm2020/app/modules/messages/components/index.mjs} +0 -0
  65. /package/{esm2015/app/modules/messages/components/message/index.js → esm2020/app/modules/messages/components/message/index.mjs} +0 -0
  66. /package/{esm2015/app/modules/messages/components/messages/index.js → esm2020/app/modules/messages/components/messages/index.mjs} +0 -0
  67. /package/{esm2015/app/modules/messages/consts/email-message-formats.const.js → esm2020/app/modules/messages/consts/email-message-formats.const.mjs} +0 -0
  68. /package/{esm2015/app/modules/messages/consts/index.js → esm2020/app/modules/messages/consts/index.mjs} +0 -0
  69. /package/{esm2015/app/modules/messages/enums/email-message-format.enum.js → esm2020/app/modules/messages/enums/email-message-format.enum.mjs} +0 -0
  70. /package/{esm2015/app/modules/messages/enums/index.js → esm2020/app/modules/messages/enums/index.mjs} +0 -0
  71. /package/{esm2015/firestitch-app-message.js → esm2020/firestitch-app-message.mjs} +0 -0
  72. /package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
@@ -0,0 +1,1289 @@
1
+ import * as i0 from '@angular/core';
2
+ import { NgModule, Component, Inject, InjectionToken, ChangeDetectionStrategy, ViewChild, Input, Injectable, Pipe } from '@angular/core';
3
+ import * as i17 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i15 from '@angular/forms';
6
+ import { FormsModule } from '@angular/forms';
7
+ import { RouterModule } from '@angular/router';
8
+ import * as i3 from '@angular/material/button';
9
+ import { MatButtonModule } from '@angular/material/button';
10
+ import * as i1 from '@angular/material/dialog';
11
+ import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
12
+ import * as i1$3 from '@angular/material/icon';
13
+ import { MatIconModule } from '@angular/material/icon';
14
+ import * as i5 from '@angular/material/tabs';
15
+ import { MatTabsModule } from '@angular/material/tabs';
16
+ import * as i3$2 from '@angular/material/tooltip';
17
+ import { MatTooltipModule } from '@angular/material/tooltip';
18
+ import * as i10$1 from '@firestitch/date';
19
+ import { FsDateModule } from '@firestitch/date';
20
+ import * as i4 from '@firestitch/dialog';
21
+ import { FsDialogModule } from '@firestitch/dialog';
22
+ import * as i16 from '@firestitch/form';
23
+ import { FsFormModule } from '@firestitch/form';
24
+ import * as i2 from '@firestitch/iframe';
25
+ import { FsIFrameModule } from '@firestitch/iframe';
26
+ import * as i6$1 from '@firestitch/label';
27
+ import { FsLabelModule } from '@firestitch/label';
28
+ import * as i2$1 from '@firestitch/list';
29
+ import { FsListComponent, FsListModule } from '@firestitch/list';
30
+ import * as i1$2 from '@firestitch/prompt';
31
+ import { FsPromptInputModule } from '@firestitch/prompt';
32
+ import * as i14 from '@firestitch/skeleton';
33
+ import { FsSkeletonModule } from '@firestitch/skeleton';
34
+ import { MatCheckboxModule } from '@angular/material/checkbox';
35
+ import * as i9 from '@angular/material/core';
36
+ import { MatOptionModule } from '@angular/material/core';
37
+ import * as i6 from '@angular/material/form-field';
38
+ import { MatFormFieldModule } from '@angular/material/form-field';
39
+ import * as i19 from '@angular/material/input';
40
+ import { MatInputModule } from '@angular/material/input';
41
+ import * as i8 from '@angular/material/select';
42
+ import { MatSelectModule } from '@angular/material/select';
43
+ import * as i3$1 from '@firestitch/common';
44
+ import { FsCommonModule } from '@firestitch/common';
45
+ import * as i11 from '@firestitch/html-editor';
46
+ import { FsHtmlEditorModule, FsHtmlRendererModule } from '@firestitch/html-editor';
47
+ import * as i18 from '@firestitch/tabs';
48
+ import { FsTabsModule } from '@firestitch/tabs';
49
+ import * as i10 from '@firestitch/text-editor';
50
+ import { FsTextEditorModule } from '@firestitch/text-editor';
51
+ import * as i1$1 from '@firestitch/message';
52
+ import { tap, switchMap, map, takeUntil } from 'rxjs/operators';
53
+ import { Subject, of } from 'rxjs';
54
+ import { ActionMode, ItemType } from '@firestitch/filter';
55
+ import anchorme from 'anchorme';
56
+ import { SelectionActionType } from '@firestitch/selection';
57
+ import { isAfter } from 'date-fns';
58
+
59
+ class FsAppMessageModule {
60
+ static forRoot() {
61
+ return {
62
+ ngModule: FsAppMessageModule,
63
+ };
64
+ }
65
+ }
66
+ FsAppMessageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
67
+ FsAppMessageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageModule });
68
+ FsAppMessageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageModule });
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageModule, decorators: [{
70
+ type: NgModule,
71
+ args: [{}]
72
+ }] });
73
+
74
+ class PreviewComponent {
75
+ constructor(_data) {
76
+ this._data = _data;
77
+ this.html = _data.html;
78
+ this.styles = _data.styles;
79
+ }
80
+ ngOnInit() {
81
+ }
82
+ }
83
+ PreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: PreviewComponent, deps: [{ token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
84
+ PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: PreviewComponent, selector: "ng-component", ngImport: i0, template: "<fs-dialog>\n <div mat-dialog-title>Preview</div>\n <mat-dialog-content>\n <fs-iframe\n [html]=\"html\"\n [width]=\"'100%'\"\n [styles]=\"styles\">\n </fs-iframe>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button [mat-dialog-close]=\"null\" color=\"primary\" type=\"button\">Done</button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: [""], components: [{ type: i4.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }, { type: i2.FsIFrameComponent, selector: "fs-iframe", inputs: ["html", "src", "styles", "width", "height"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] });
85
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: PreviewComponent, decorators: [{
86
+ type: Component,
87
+ args: [{ template: "<fs-dialog>\n <div mat-dialog-title>Preview</div>\n <mat-dialog-content>\n <fs-iframe\n [html]=\"html\"\n [width]=\"'100%'\"\n [styles]=\"styles\">\n </fs-iframe>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button [mat-dialog-close]=\"null\" color=\"primary\" type=\"button\">Done</button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: [""] }]
88
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
89
+ type: Inject,
90
+ args: [MAT_DIALOG_DATA]
91
+ }] }]; } });
92
+
93
+ class FsAppMessagePreviewModule {
94
+ }
95
+ FsAppMessagePreviewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagePreviewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
96
+ FsAppMessagePreviewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagePreviewModule, declarations: [PreviewComponent], imports: [MatDialogModule,
97
+ MatButtonModule,
98
+ FsDialogModule,
99
+ FsIFrameModule], exports: [PreviewComponent] });
100
+ FsAppMessagePreviewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagePreviewModule, imports: [[
101
+ MatDialogModule,
102
+ MatButtonModule,
103
+ FsDialogModule,
104
+ FsIFrameModule,
105
+ ]] });
106
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagePreviewModule, decorators: [{
107
+ type: NgModule,
108
+ args: [{
109
+ imports: [
110
+ MatDialogModule,
111
+ MatButtonModule,
112
+ FsDialogModule,
113
+ FsIFrameModule,
114
+ ],
115
+ declarations: [
116
+ PreviewComponent,
117
+ ],
118
+ exports: [
119
+ PreviewComponent,
120
+ ]
121
+ }]
122
+ }] });
123
+
124
+ const FS_APP_MESSAGE_ROOT_CONFIG = new InjectionToken('fs-app-message-root-config');
125
+ const FS_APP_MESSAGE_CONFIG = new InjectionToken('fs-app-message-config');
126
+
127
+ var EmailMessageFormat;
128
+ (function (EmailMessageFormat) {
129
+ EmailMessageFormat["Text"] = "T";
130
+ EmailMessageFormat["HTML"] = "H";
131
+ EmailMessageFormat["RichText"] = "R";
132
+ })(EmailMessageFormat || (EmailMessageFormat = {}));
133
+
134
+ const EmailMessageFormats = [
135
+ { name: 'Text', value: EmailMessageFormat.Text },
136
+ { name: 'HTML', value: EmailMessageFormat.HTML },
137
+ { name: 'Rich Text', value: EmailMessageFormat.RichText }
138
+ ];
139
+
140
+ class AttachmentsComponent {
141
+ constructor(_config, _message) {
142
+ this._config = _config;
143
+ this._message = _message;
144
+ this.list = null;
145
+ this.config = null;
146
+ this._destroy$ = new Subject();
147
+ }
148
+ ngOnInit() {
149
+ this.config = {
150
+ rowActions: [],
151
+ actions: [
152
+ {
153
+ label: 'Upload',
154
+ mode: ActionMode.File,
155
+ select: (fsFile) => {
156
+ this._config.uploadMessageAttachment(this.message, fsFile)
157
+ .subscribe(() => {
158
+ this._message.success('Saved attachment');
159
+ this.list.reload();
160
+ });
161
+ }
162
+ }
163
+ ],
164
+ fetch: query => {
165
+ return this._config.loadMessageAttachments(this.message, query);
166
+ }
167
+ };
168
+ if (this._config.downloadMessageAttachment) {
169
+ this.config.rowActions
170
+ .push({
171
+ click: data => {
172
+ return this._config.downloadMessageAttachment(data);
173
+ },
174
+ label: 'Download',
175
+ });
176
+ }
177
+ if (this._config.deleteMessageAttachment) {
178
+ this.config.rowActions
179
+ .push({
180
+ click: data => {
181
+ return this._config.deleteMessageAttachment(data);
182
+ },
183
+ remove: {
184
+ title: 'Confirm',
185
+ template: 'Are you sure you would like to delete this template?',
186
+ },
187
+ label: 'Delete',
188
+ });
189
+ }
190
+ }
191
+ ngOnDestroy() {
192
+ this._destroy$.next();
193
+ this._destroy$.complete();
194
+ }
195
+ }
196
+ AttachmentsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AttachmentsComponent, deps: [{ token: FS_APP_MESSAGE_CONFIG }, { token: i1$1.FsMessage }], target: i0.ɵɵFactoryTarget.Component });
197
+ AttachmentsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: AttachmentsComponent, selector: "fs-app-message-attachments", inputs: { message: "message" }, viewQueries: [{ propertyName: "list", first: true, predicate: FsListComponent, descendants: true, static: true }], ngImport: i0, template: "<fs-list [config]=\"config\">\n <fs-list-column title=\"File Name\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.filename}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"File Size\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.size | fsFormatBytes}}\n </ng-template>\n </fs-list-column>\n</fs-list>", components: [{ type: i2$1.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }], directives: [{ type: i2$1.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i2$1.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }], pipes: { "fsFormatBytes": i3$1.FsFormatBytesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
198
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AttachmentsComponent, decorators: [{
199
+ type: Component,
200
+ args: [{ selector: 'fs-app-message-attachments', changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-list [config]=\"config\">\n <fs-list-column title=\"File Name\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.filename}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"File Size\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.size | fsFormatBytes}}\n </ng-template>\n </fs-list-column>\n</fs-list>" }]
201
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
202
+ type: Inject,
203
+ args: [FS_APP_MESSAGE_CONFIG]
204
+ }] }, { type: i1$1.FsMessage }]; }, propDecorators: { list: [{
205
+ type: ViewChild,
206
+ args: [FsListComponent, { static: true }]
207
+ }], message: [{
208
+ type: Input
209
+ }] } });
210
+
211
+ class MessageComponent {
212
+ constructor(_config, _data, _prompt, _message, _dialog, _cdRef) {
213
+ this._config = _config;
214
+ this._data = _data;
215
+ this._prompt = _prompt;
216
+ this._message = _message;
217
+ this._dialog = _dialog;
218
+ this._cdRef = _cdRef;
219
+ this.tab = 'general';
220
+ this.messageTemplates = [];
221
+ this.emailMessageFormats = EmailMessageFormats;
222
+ this.emailMessageFormat = EmailMessageFormat;
223
+ this.save = () => {
224
+ return this._config.saveMessage(this.message)
225
+ .pipe(tap(() => {
226
+ this._message.success('Saved Changes');
227
+ }));
228
+ };
229
+ }
230
+ ngOnInit() {
231
+ this._config.loadMessage(this._data.message)
232
+ .subscribe((message) => {
233
+ this.message = message;
234
+ if (this.message.emailMessage && this.message.emailMessage.customize === undefined) {
235
+ this.message.emailMessage.customize = true;
236
+ }
237
+ if (this.message.smsMessage && this.message.smsMessage.customize === undefined) {
238
+ this.message.smsMessage.customize = true;
239
+ }
240
+ this.message.reference = String(message.tag)
241
+ .toLocaleLowerCase()
242
+ .split('_')
243
+ .map((item) => item.charAt(0).toUpperCase() + item.slice(1))
244
+ .join('');
245
+ this._cdRef.markForCheck();
246
+ });
247
+ this._config.loadMessageTemplates()
248
+ .subscribe((data) => {
249
+ this.messageTemplates = data.data;
250
+ this._cdRef.markForCheck();
251
+ });
252
+ }
253
+ openPreview() {
254
+ const emailMessage = this.message.emailMessage;
255
+ let html = emailMessage.customize ? emailMessage.body : this.message.defaultEmailBody;
256
+ let styles = emailMessage.styles || '';
257
+ if (emailMessage.messageTemplateId) {
258
+ const messageTemplate = this.messageTemplates
259
+ .find((item) => {
260
+ return emailMessage.messageTemplateId === item.id;
261
+ });
262
+ if (messageTemplate) {
263
+ html = messageTemplate.content.replace('{$content}', html);
264
+ styles = `${messageTemplate.styles || ''}\n\n${styles}`;
265
+ }
266
+ }
267
+ this._dialog.open(PreviewComponent, {
268
+ data: {
269
+ styles,
270
+ html,
271
+ },
272
+ width: '95%'
273
+ });
274
+ }
275
+ sendTest(type) {
276
+ of(true)
277
+ .pipe(switchMap(() => {
278
+ return type === 'email' ? this._config.getTestEmail() : of('');
279
+ }), switchMap((default_) => {
280
+ const typeName = type === 'email' ? 'an email' : 'phone number';
281
+ return this._prompt.input({
282
+ label: `Please enter ${typeName} to send test to`,
283
+ title: 'Send Test',
284
+ commitLabel: 'Send',
285
+ default: default_,
286
+ required: true
287
+ });
288
+ }))
289
+ .subscribe((value) => {
290
+ this._config.testMessage(this.message, value, type)
291
+ .subscribe(() => {
292
+ this._message.success('Test Sent');
293
+ });
294
+ });
295
+ }
296
+ }
297
+ MessageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MessageComponent, deps: [{ token: FS_APP_MESSAGE_CONFIG }, { token: MAT_DIALOG_DATA }, { token: i1$2.FsPrompt }, { token: i1$1.FsMessage }, { token: i1.MatDialog }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
298
+ MessageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: MessageComponent, selector: "ng-component", ngImport: i0, template: "<form\n fsForm\n [submit]=\"save\"\n #form=\"ngForm\"\n *fsSkeleton=\"message\"\n [confirmTabs]=\"false\">\n <fs-dialog *ngIf=\"message\">\n <div mat-dialog-title>Edit Message</div>\n <mat-dialog-content>\n <mat-tab-group \n fsTabs \n [(selected)]=\"tab\">\n <mat-tab label=\"General\" name=\"general\">\n <ng-template matTabContent>\n <div class=\"fs-column\">\n <mat-form-field>\n <input\n matInput\n placeholder=\"Name\"\n [(ngModel)]=\"message.name\"\n name=\"Name\"\n required>\n </mat-form-field>\n <fs-label-field>\n <fs-label>Reference</fs-label>\n {{message.reference}}\n </fs-label-field>\n <mat-form-field>\n <input\n matInput\n placeholder=\"Description\"\n [(ngModel)]=\"message.description\"\n name=\"description\">\n </mat-form-field>\n\n <div class=\"fs-row.gap-small.wrap\">\n <mat-form-field>\n <input\n matInput\n placeholder=\"From Email\"\n [(ngModel)]=\"message.emailMessage.fromEmail\"\n name=\"from_email\">\n </mat-form-field>\n <mat-form-field>\n <input\n matInput\n placeholder=\"From Name\"\n [(ngModel)]=\"message.emailMessage.fromName\"\n name=\"from_name\">\n </mat-form-field>\n <mat-form-field>\n <input\n matInput\n placeholder=\"Reply To\"\n [(ngModel)]=\"message.emailMessage.replyTo\"\n name=\"reply_to\">\n </mat-form-field>\n </div>\n\n <div class=\"fs-row.gap-small.wrap\">\n <mat-form-field>\n <input\n matInput\n placeholder=\"To\"\n [(ngModel)]=\"message.emailMessage.toRecipients\"\n name=\"to\">\n </mat-form-field>\n <mat-form-field>\n <input\n matInput\n placeholder=\"CC\"\n [(ngModel)]=\"message.emailMessage.ccRecipients\"\n name=\"cc\">\n </mat-form-field>\n <mat-form-field>\n <input\n matInput\n placeholder=\"BCC\"\n [(ngModel)]=\"message.emailMessage.bccRecipients\"\n name=\"bcc\">\n </mat-form-field>\n </div>\n </div>\n </ng-template>\n </mat-tab>\n <mat-tab label=\"Email Message\" *ngIf=\"message.emailMessage\" name=\"email\">\n <ng-template matTabContent>\n <div class=\"fs-column\">\n <div class=\"fs-row.gap-small\">\n <mat-form-field>\n <mat-select\n required\n placeholder=\"Customize Message\"\n [(ngModel)]=\"message.emailMessage.customize\"\n name=\"customizeEmail\">\n <mat-option [value]=\"true\">Yes</mat-option>\n <mat-option [value]=\"false\">No</mat-option>\n </mat-select>\n </mat-form-field>\n <mat-form-field>\n <mat-select\n required\n placeholder=\"Format\"\n [(ngModel)]=\"message.emailMessage.format\"\n name=\"format\">\n <mat-option *ngFor=\"let item of emailMessageFormats\" [value]=\"item.value\">\n {{item.name}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n <mat-form-field>\n <mat-select\n placeholder=\"Template\"\n [(ngModel)]=\"message.emailMessage.messageTemplateId\"\n name=\"template\">\n <mat-option [value]=\"null\">None</mat-option>\n <mat-option *ngFor=\"let item of messageTemplates\" [value]=\"item.id\">\n {{item.name}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <ng-container *ngIf=\"message.emailMessage.customize\">\n <mat-form-field>\n <input\n matInput\n placeholder=\"Subject\"\n [(ngModel)]=\"message.emailMessage.subject\"\n name=\"name\"\n required>\n </mat-form-field>\n\n <div [@.disabled]=\"true\">\n <mat-tab-group [dynamicHeight]=\"false\">\n <mat-tab label=\"Content\">\n <ng-template matTabContent>\n <ng-container *ngIf=\"message.emailMessage.format===emailMessageFormat.HTML\">\n <fs-text-editor \n [(ngModel)]=\"message.emailMessage.body\"\n name=\"body\"\n [config]=\"{ language: 'html '}\">\n </fs-text-editor>\n </ng-container>\n\n <ng-container *ngIf=\"message.emailMessage.format===emailMessageFormat.RichText\">\n <fs-html-editor \n [(ngModel)]=\"message.emailMessage.body\"\n name=\"body\">\n </fs-html-editor>\n </ng-container>\n\n <ng-container *ngIf=\"message.emailMessage.format===emailMessageFormat.Text\">\n <fs-text-editor \n [(ngModel)]=\"message.emailMessage.body\"\n name=\"emailMessageBody\"\n [config]=\"{ language: 'text' }\">\n </fs-text-editor>\n </ng-container>\n </ng-template>\n </mat-tab>\n <mat-tab\n *ngIf=\"message.emailMessage.format===emailMessageFormat.HTML || message.emailMessage.format===emailMessageFormat.RichText\"\n label=\"Styles\">\n <ng-template matTabContent>\n <fs-text-editor\n [(ngModel)]=\"message.emailMessage.styles\"\n name=\"styles\"\n [config]=\"{ language: 'scss' }\">\n </fs-text-editor>\n </ng-template>\n </mat-tab>\n </mat-tab-group>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!message.emailMessage.customize\">\n <fs-label-field>\n <fs-label>Subject</fs-label>\n {{message.defaultEmailSubject}}\n </fs-label-field>\n <div>\n <fs-label-field>\n <fs-label>Content</fs-label>\n <div class=\"email-body-html-default\">\n <fs-html-renderer\n *ngIf=\"message.emailMessage.format===emailMessageFormat.RichText || message.emailMessage.format===emailMessageFormat.HTML\"\n [html]=\"message.defaultEmailBody\">\n </fs-html-renderer>\n </div>\n <div\n class=\"email-body-text-default\"\n *ngIf=\"message.emailMessage.format===emailMessageFormat.Text\">\n {{message.defaultEmailBody}}\n </div>\n </fs-label-field>\n </div>\n </ng-container>\n </div>\n </ng-template>\n </mat-tab>\n\n <ng-container *ngIf=\"!!message.smsMessage\">\n <mat-tab label=\"SMS Message\" name=\"sms\">\n <ng-template matTabContent>\n <mat-form-field>\n <mat-select\n required\n placeholder=\"Customize Message\"\n [(ngModel)]=\"message.smsMessage.customize\"\n name=\"customizeSms\">\n <mat-option [value]=\"true\">Yes</mat-option>\n <mat-option [value]=\"false\">No</mat-option>\n </mat-select>\n </mat-form-field>\n <div\n *ngIf=\"message.smsMessage.customize\"\n [@.disabled]=\"true\">\n <mat-tab-group [dynamicHeight]=\"false\">\n <mat-tab label=\"Content\">\n <ng-template matTabContent>\n <fs-text-editor\n [(ngModel)]=\"message.smsMessage.message\"\n name=\"smsMessageMessage\"\n [config]=\"{ language: 'text '}\">\n </fs-text-editor>\n </ng-template>\n </mat-tab>\n </mat-tab-group>\n </div>\n <fs-label-field *ngIf=\"!message.smsMessage.customize\">\n <fs-label>Message</fs-label>\n {{message.defaultSmsMessage}}\n </fs-label-field>\n </ng-template>\n </mat-tab>\n </ng-container>\n\n <mat-tab label=\"Attachments\" *ngIf=\"message.emailMessage\" name=\"attachments\">\n <ng-template matTabContent>\n <fs-app-message-attachments \n [message]=\"message\">\n </fs-app-message-attachments>\n </ng-template>\n </mat-tab>\n\n <mat-tab label=\"Variables\" *ngIf=\"message.variables\">\n <ng-template matTabContent>\n <div *ngFor=\"let variable of message.variables\" class=\"variable\">\n {{variable.name}}\n </div>\n </ng-template>\n </mat-tab>\n\n <mat-tab label=\"Defaults\">\n <ng-template matTabContent>\n <ng-container *ngIf=\"message.emailMessage\">\n <h2 *ngIf=\"message.emailMessage && message.smsMessage\">Email</h2>\n <fs-label-field>\n <fs-label>Subject</fs-label>\n <div class=\"content\">{{message.defaultEmailSubject}}</div>\n </fs-label-field>\n <fs-label-field>\n <fs-label>Content</fs-label>\n <div class=\"content\">{{message.defaultEmailBody}}</div>\n </fs-label-field>\n </ng-container>\n <ng-container *ngIf=\"message.smsMessage\">\n <h2 *ngIf=\"message.emailMessage && message.smsMessage\">SMS</h2>\n <fs-label-field>\n <fs-label>Content</fs-label>\n <div class=\"content\">{{message.defaultSmsMessage}}</div>\n </fs-label-field>\n </ng-container>\n </ng-template>\n </mat-tab>\n </mat-tab-group>\n\n </mat-dialog-content>\n <mat-dialog-actions>\n <ng-container *ngIf=\"tab==='email' || tab==='sms' || tab==='general'; else done\">\n <button \n mat-button \n color=\"primary\">\n Save\n </button> \n <ng-container *ngIf=\"tab==='email'\">\n <button \n mat-button\n type=\"button\"\n (click)=\"openPreview()\"\n type=\"button\">\n Preview\n </button>\n <button\n mat-button\n type=\"button\"\n (click)=\"sendTest('email')\"\n type=\"button\">\n Send Test Email\n </button>\n </ng-container>\n <ng-container *ngIf=\"tab==='sms'\">\n <button \n mat-button\n type=\"button\"\n (click)=\"sendTest('sms')\"\n type=\"button\">\n Send Test SMS\n </button>\n </ng-container>\n <button \n mat-button \n [mat-dialog-close]=\"null\" \n type=\"button\">\n Cancel\n </button>\n </ng-container> \n <ng-template #done>\n <button \n mat-button \n color=\"primary\"\n [mat-dialog-close]=\"null\" \n type=\"button\">\n Close\n </button>\n </ng-template>\n </mat-dialog-actions>\n </fs-dialog>\n</form>\n", styles: ["fs-label-field .content{white-space:pre-wrap}:host ::ng-deep .mat-tab-body-content,:host ::ng-deep .mat-tab-body{overflow:visible}:host ::ng-deep .sms-message{width:100%}:host ::ng-deep .email-body-text-default{white-space:pre-line}.fs-column .mat-form-field{flex:1}.email-body-text{width:100%}.variable{margin-bottom:4px}\n"], components: [{ type: i4.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }, { type: i5.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple"], exportAs: ["matTabGroup"] }, { type: i5.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i6$1.FsLabelFieldComponent, selector: "fs-label-field", inputs: ["bottomMargin", "topMargin", "labelMargin"] }, { type: i6$1.FsLabelComponent, selector: "fs-label" }, { type: i8.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i9.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i10.FsTextEditorComponent, selector: "fs-text-editor", inputs: ["config", "scrollable"], outputs: ["ready", "blur"] }, { type: i11.FsHtmlEditorComponent, selector: "fs-html-editor", inputs: ["config", "hint", "disabled"] }, { type: i11.FsHtmlRendererComponent, selector: "fs-html-renderer", inputs: ["html"] }, { type: AttachmentsComponent, selector: "fs-app-message-attachments", inputs: ["message"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i14.FsSkeletonContentDirective, selector: "[fsSkeleton]", inputs: ["fsSkeleton", "fsSkeletonPattern"] }, { type: i15.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i15.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i15.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i16.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup", "deactivationGuard"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"], exportAs: ["fsForm"] }, { type: i17.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i18.FsTabsHeaderTabGroupDirective, selector: "mat-tab-group, matTabGroup, [matTabGroup]", inputs: ["orientation", "selected", "selectedData"], outputs: ["selectedChange", "selectedDataChange"], exportAs: ["fsTabsHeaderTabGroup"] }, { type: i18.FsTabsTabDirective, selector: "mat-tab,matTab", inputs: ["name", "data"], exportAs: ["fsTabsTab"] }, { type: i5.MatTabContent, selector: "[matTabContent]" }, { type: i19.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i15.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i15.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i15.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i15.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i16.FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: ["fsFormRequired", "required", "fsFormRequiredMessage"] }, { type: i16.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i17.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i16.FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit", "form"] }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
299
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MessageComponent, decorators: [{
300
+ type: Component,
301
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<form\n fsForm\n [submit]=\"save\"\n #form=\"ngForm\"\n *fsSkeleton=\"message\"\n [confirmTabs]=\"false\">\n <fs-dialog *ngIf=\"message\">\n <div mat-dialog-title>Edit Message</div>\n <mat-dialog-content>\n <mat-tab-group \n fsTabs \n [(selected)]=\"tab\">\n <mat-tab label=\"General\" name=\"general\">\n <ng-template matTabContent>\n <div class=\"fs-column\">\n <mat-form-field>\n <input\n matInput\n placeholder=\"Name\"\n [(ngModel)]=\"message.name\"\n name=\"Name\"\n required>\n </mat-form-field>\n <fs-label-field>\n <fs-label>Reference</fs-label>\n {{message.reference}}\n </fs-label-field>\n <mat-form-field>\n <input\n matInput\n placeholder=\"Description\"\n [(ngModel)]=\"message.description\"\n name=\"description\">\n </mat-form-field>\n\n <div class=\"fs-row.gap-small.wrap\">\n <mat-form-field>\n <input\n matInput\n placeholder=\"From Email\"\n [(ngModel)]=\"message.emailMessage.fromEmail\"\n name=\"from_email\">\n </mat-form-field>\n <mat-form-field>\n <input\n matInput\n placeholder=\"From Name\"\n [(ngModel)]=\"message.emailMessage.fromName\"\n name=\"from_name\">\n </mat-form-field>\n <mat-form-field>\n <input\n matInput\n placeholder=\"Reply To\"\n [(ngModel)]=\"message.emailMessage.replyTo\"\n name=\"reply_to\">\n </mat-form-field>\n </div>\n\n <div class=\"fs-row.gap-small.wrap\">\n <mat-form-field>\n <input\n matInput\n placeholder=\"To\"\n [(ngModel)]=\"message.emailMessage.toRecipients\"\n name=\"to\">\n </mat-form-field>\n <mat-form-field>\n <input\n matInput\n placeholder=\"CC\"\n [(ngModel)]=\"message.emailMessage.ccRecipients\"\n name=\"cc\">\n </mat-form-field>\n <mat-form-field>\n <input\n matInput\n placeholder=\"BCC\"\n [(ngModel)]=\"message.emailMessage.bccRecipients\"\n name=\"bcc\">\n </mat-form-field>\n </div>\n </div>\n </ng-template>\n </mat-tab>\n <mat-tab label=\"Email Message\" *ngIf=\"message.emailMessage\" name=\"email\">\n <ng-template matTabContent>\n <div class=\"fs-column\">\n <div class=\"fs-row.gap-small\">\n <mat-form-field>\n <mat-select\n required\n placeholder=\"Customize Message\"\n [(ngModel)]=\"message.emailMessage.customize\"\n name=\"customizeEmail\">\n <mat-option [value]=\"true\">Yes</mat-option>\n <mat-option [value]=\"false\">No</mat-option>\n </mat-select>\n </mat-form-field>\n <mat-form-field>\n <mat-select\n required\n placeholder=\"Format\"\n [(ngModel)]=\"message.emailMessage.format\"\n name=\"format\">\n <mat-option *ngFor=\"let item of emailMessageFormats\" [value]=\"item.value\">\n {{item.name}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n <mat-form-field>\n <mat-select\n placeholder=\"Template\"\n [(ngModel)]=\"message.emailMessage.messageTemplateId\"\n name=\"template\">\n <mat-option [value]=\"null\">None</mat-option>\n <mat-option *ngFor=\"let item of messageTemplates\" [value]=\"item.id\">\n {{item.name}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <ng-container *ngIf=\"message.emailMessage.customize\">\n <mat-form-field>\n <input\n matInput\n placeholder=\"Subject\"\n [(ngModel)]=\"message.emailMessage.subject\"\n name=\"name\"\n required>\n </mat-form-field>\n\n <div [@.disabled]=\"true\">\n <mat-tab-group [dynamicHeight]=\"false\">\n <mat-tab label=\"Content\">\n <ng-template matTabContent>\n <ng-container *ngIf=\"message.emailMessage.format===emailMessageFormat.HTML\">\n <fs-text-editor \n [(ngModel)]=\"message.emailMessage.body\"\n name=\"body\"\n [config]=\"{ language: 'html '}\">\n </fs-text-editor>\n </ng-container>\n\n <ng-container *ngIf=\"message.emailMessage.format===emailMessageFormat.RichText\">\n <fs-html-editor \n [(ngModel)]=\"message.emailMessage.body\"\n name=\"body\">\n </fs-html-editor>\n </ng-container>\n\n <ng-container *ngIf=\"message.emailMessage.format===emailMessageFormat.Text\">\n <fs-text-editor \n [(ngModel)]=\"message.emailMessage.body\"\n name=\"emailMessageBody\"\n [config]=\"{ language: 'text' }\">\n </fs-text-editor>\n </ng-container>\n </ng-template>\n </mat-tab>\n <mat-tab\n *ngIf=\"message.emailMessage.format===emailMessageFormat.HTML || message.emailMessage.format===emailMessageFormat.RichText\"\n label=\"Styles\">\n <ng-template matTabContent>\n <fs-text-editor\n [(ngModel)]=\"message.emailMessage.styles\"\n name=\"styles\"\n [config]=\"{ language: 'scss' }\">\n </fs-text-editor>\n </ng-template>\n </mat-tab>\n </mat-tab-group>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!message.emailMessage.customize\">\n <fs-label-field>\n <fs-label>Subject</fs-label>\n {{message.defaultEmailSubject}}\n </fs-label-field>\n <div>\n <fs-label-field>\n <fs-label>Content</fs-label>\n <div class=\"email-body-html-default\">\n <fs-html-renderer\n *ngIf=\"message.emailMessage.format===emailMessageFormat.RichText || message.emailMessage.format===emailMessageFormat.HTML\"\n [html]=\"message.defaultEmailBody\">\n </fs-html-renderer>\n </div>\n <div\n class=\"email-body-text-default\"\n *ngIf=\"message.emailMessage.format===emailMessageFormat.Text\">\n {{message.defaultEmailBody}}\n </div>\n </fs-label-field>\n </div>\n </ng-container>\n </div>\n </ng-template>\n </mat-tab>\n\n <ng-container *ngIf=\"!!message.smsMessage\">\n <mat-tab label=\"SMS Message\" name=\"sms\">\n <ng-template matTabContent>\n <mat-form-field>\n <mat-select\n required\n placeholder=\"Customize Message\"\n [(ngModel)]=\"message.smsMessage.customize\"\n name=\"customizeSms\">\n <mat-option [value]=\"true\">Yes</mat-option>\n <mat-option [value]=\"false\">No</mat-option>\n </mat-select>\n </mat-form-field>\n <div\n *ngIf=\"message.smsMessage.customize\"\n [@.disabled]=\"true\">\n <mat-tab-group [dynamicHeight]=\"false\">\n <mat-tab label=\"Content\">\n <ng-template matTabContent>\n <fs-text-editor\n [(ngModel)]=\"message.smsMessage.message\"\n name=\"smsMessageMessage\"\n [config]=\"{ language: 'text '}\">\n </fs-text-editor>\n </ng-template>\n </mat-tab>\n </mat-tab-group>\n </div>\n <fs-label-field *ngIf=\"!message.smsMessage.customize\">\n <fs-label>Message</fs-label>\n {{message.defaultSmsMessage}}\n </fs-label-field>\n </ng-template>\n </mat-tab>\n </ng-container>\n\n <mat-tab label=\"Attachments\" *ngIf=\"message.emailMessage\" name=\"attachments\">\n <ng-template matTabContent>\n <fs-app-message-attachments \n [message]=\"message\">\n </fs-app-message-attachments>\n </ng-template>\n </mat-tab>\n\n <mat-tab label=\"Variables\" *ngIf=\"message.variables\">\n <ng-template matTabContent>\n <div *ngFor=\"let variable of message.variables\" class=\"variable\">\n {{variable.name}}\n </div>\n </ng-template>\n </mat-tab>\n\n <mat-tab label=\"Defaults\">\n <ng-template matTabContent>\n <ng-container *ngIf=\"message.emailMessage\">\n <h2 *ngIf=\"message.emailMessage && message.smsMessage\">Email</h2>\n <fs-label-field>\n <fs-label>Subject</fs-label>\n <div class=\"content\">{{message.defaultEmailSubject}}</div>\n </fs-label-field>\n <fs-label-field>\n <fs-label>Content</fs-label>\n <div class=\"content\">{{message.defaultEmailBody}}</div>\n </fs-label-field>\n </ng-container>\n <ng-container *ngIf=\"message.smsMessage\">\n <h2 *ngIf=\"message.emailMessage && message.smsMessage\">SMS</h2>\n <fs-label-field>\n <fs-label>Content</fs-label>\n <div class=\"content\">{{message.defaultSmsMessage}}</div>\n </fs-label-field>\n </ng-container>\n </ng-template>\n </mat-tab>\n </mat-tab-group>\n\n </mat-dialog-content>\n <mat-dialog-actions>\n <ng-container *ngIf=\"tab==='email' || tab==='sms' || tab==='general'; else done\">\n <button \n mat-button \n color=\"primary\">\n Save\n </button> \n <ng-container *ngIf=\"tab==='email'\">\n <button \n mat-button\n type=\"button\"\n (click)=\"openPreview()\"\n type=\"button\">\n Preview\n </button>\n <button\n mat-button\n type=\"button\"\n (click)=\"sendTest('email')\"\n type=\"button\">\n Send Test Email\n </button>\n </ng-container>\n <ng-container *ngIf=\"tab==='sms'\">\n <button \n mat-button\n type=\"button\"\n (click)=\"sendTest('sms')\"\n type=\"button\">\n Send Test SMS\n </button>\n </ng-container>\n <button \n mat-button \n [mat-dialog-close]=\"null\" \n type=\"button\">\n Cancel\n </button>\n </ng-container> \n <ng-template #done>\n <button \n mat-button \n color=\"primary\"\n [mat-dialog-close]=\"null\" \n type=\"button\">\n Close\n </button>\n </ng-template>\n </mat-dialog-actions>\n </fs-dialog>\n</form>\n", styles: ["fs-label-field .content{white-space:pre-wrap}:host ::ng-deep .mat-tab-body-content,:host ::ng-deep .mat-tab-body{overflow:visible}:host ::ng-deep .sms-message{width:100%}:host ::ng-deep .email-body-text-default{white-space:pre-line}.fs-column .mat-form-field{flex:1}.email-body-text{width:100%}.variable{margin-bottom:4px}\n"] }]
302
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
303
+ type: Inject,
304
+ args: [FS_APP_MESSAGE_CONFIG]
305
+ }] }, { type: undefined, decorators: [{
306
+ type: Inject,
307
+ args: [MAT_DIALOG_DATA]
308
+ }] }, { type: i1$2.FsPrompt }, { type: i1$1.FsMessage }, { type: i1.MatDialog }, { type: i0.ChangeDetectorRef }]; } });
309
+
310
+ function indexNameValue(arry) {
311
+ const obj = {};
312
+ arry.forEach(item => {
313
+ obj[item.value] = item.name;
314
+ });
315
+ return obj;
316
+ }
317
+
318
+ class MessagesComponent {
319
+ constructor(_config, _dialog) {
320
+ this._config = _config;
321
+ this._dialog = _dialog;
322
+ this.list = null;
323
+ this.config = null;
324
+ this.emailMessageFormats = {};
325
+ this._destroy$ = new Subject();
326
+ }
327
+ ngOnInit() {
328
+ this.emailMessageFormats = indexNameValue(EmailMessageFormats);
329
+ this.config = {
330
+ filters: [
331
+ {
332
+ name: 'keyword',
333
+ type: ItemType.Keyword,
334
+ label: 'Search'
335
+ }
336
+ ],
337
+ fetch: query => {
338
+ return this._config.loadMessages(query)
339
+ .pipe(map(response => {
340
+ return ({ data: response.data, paging: response.paging });
341
+ }));
342
+ }
343
+ };
344
+ }
345
+ open(message) {
346
+ const dialogRef = this._dialog.open(MessageComponent, {
347
+ data: {
348
+ message: message,
349
+ },
350
+ width: '85%'
351
+ });
352
+ dialogRef.afterClosed()
353
+ .pipe(takeUntil(this._destroy$))
354
+ .subscribe(() => {
355
+ this.list.reload();
356
+ });
357
+ }
358
+ ngOnDestroy() {
359
+ this._destroy$.next();
360
+ this._destroy$.complete();
361
+ }
362
+ }
363
+ MessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MessagesComponent, deps: [{ token: FS_APP_MESSAGE_CONFIG }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
364
+ MessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: MessagesComponent, selector: "fs-app-messages", viewQueries: [{ propertyName: "list", first: true, predicate: FsListComponent, descendants: true, static: true }], ngImport: i0, template: "<fs-list [config]=\"config\">\n <fs-list-column title=\"Name\" name=\"name\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <a (click)=\"open(row)\">{{row.name}}</a>\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Email Format\">\n <ng-template fs-list-cell let-row=\"row\">\n {{emailMessageFormats[row.emailMessage.format]}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Email Message Template\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.emailMessage.messageTemplate?.name || 'None'}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Customized Message\">\n <ng-template fs-list-cell let-row=\"row\">\n <ng-container *ngIf=\"row.emailMessage?.customize || row.smsMessage?.customize; else noCustomize\">\n <ng-container *ngIf=\"row.emailMessage?.customize\">\n {{row.emailMessage.customize ? 'Email' : ''}}\n </ng-container> \n <ng-container *ngIf=\"row.smsMessage?.customize\">\n {{row.smsMessage.customize ? 'SMS' : ''}}\n </ng-container> \n </ng-container>\n <ng-template #noCustomize>\n None\n </ng-template>\n </ng-template>\n </fs-list-column>\n</fs-list>\n", components: [{ type: i2$1.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }], directives: [{ type: i2$1.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i2$1.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }, { type: i17.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MessagesComponent, decorators: [{
366
+ type: Component,
367
+ args: [{ selector: 'fs-app-messages', template: "<fs-list [config]=\"config\">\n <fs-list-column title=\"Name\" name=\"name\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <a (click)=\"open(row)\">{{row.name}}</a>\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Email Format\">\n <ng-template fs-list-cell let-row=\"row\">\n {{emailMessageFormats[row.emailMessage.format]}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Email Message Template\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.emailMessage.messageTemplate?.name || 'None'}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Customized Message\">\n <ng-template fs-list-cell let-row=\"row\">\n <ng-container *ngIf=\"row.emailMessage?.customize || row.smsMessage?.customize; else noCustomize\">\n <ng-container *ngIf=\"row.emailMessage?.customize\">\n {{row.emailMessage.customize ? 'Email' : ''}}\n </ng-container> \n <ng-container *ngIf=\"row.smsMessage?.customize\">\n {{row.smsMessage.customize ? 'SMS' : ''}}\n </ng-container> \n </ng-container>\n <ng-template #noCustomize>\n None\n </ng-template>\n </ng-template>\n </fs-list-column>\n</fs-list>\n" }]
368
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
369
+ type: Inject,
370
+ args: [FS_APP_MESSAGE_CONFIG]
371
+ }] }, { type: i1.MatDialog }]; }, propDecorators: { list: [{
372
+ type: ViewChild,
373
+ args: [FsListComponent, { static: true }]
374
+ }] } });
375
+
376
+ class FsAppMessagesModule {
377
+ }
378
+ FsAppMessagesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
379
+ FsAppMessagesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagesModule, declarations: [MessagesComponent,
380
+ MessageComponent,
381
+ AttachmentsComponent], imports: [RouterModule,
382
+ CommonModule,
383
+ FormsModule,
384
+ MatDialogModule,
385
+ MatButtonModule,
386
+ MatTabsModule,
387
+ MatFormFieldModule,
388
+ MatInputModule,
389
+ MatOptionModule,
390
+ MatSelectModule,
391
+ MatTooltipModule,
392
+ MatCheckboxModule,
393
+ FsDialogModule,
394
+ FsListModule,
395
+ FsLabelModule,
396
+ FsSkeletonModule,
397
+ FsFormModule,
398
+ FsTextEditorModule,
399
+ FsHtmlEditorModule,
400
+ FsHtmlRendererModule,
401
+ FsCommonModule,
402
+ FsTabsModule,
403
+ FsAppMessagePreviewModule], exports: [MessagesComponent,
404
+ MessageComponent] });
405
+ FsAppMessagesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagesModule, imports: [[
406
+ RouterModule,
407
+ CommonModule,
408
+ FormsModule,
409
+ MatDialogModule,
410
+ MatButtonModule,
411
+ MatTabsModule,
412
+ MatFormFieldModule,
413
+ MatInputModule,
414
+ MatOptionModule,
415
+ MatSelectModule,
416
+ MatTooltipModule,
417
+ MatCheckboxModule,
418
+ FsDialogModule,
419
+ FsListModule,
420
+ FsLabelModule,
421
+ FsSkeletonModule,
422
+ FsFormModule,
423
+ FsTextEditorModule,
424
+ FsHtmlEditorModule,
425
+ FsHtmlRendererModule,
426
+ FsCommonModule,
427
+ FsTabsModule,
428
+ FsAppMessagePreviewModule,
429
+ ]] });
430
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagesModule, decorators: [{
431
+ type: NgModule,
432
+ args: [{
433
+ imports: [
434
+ RouterModule,
435
+ CommonModule,
436
+ FormsModule,
437
+ MatDialogModule,
438
+ MatButtonModule,
439
+ MatTabsModule,
440
+ MatFormFieldModule,
441
+ MatInputModule,
442
+ MatOptionModule,
443
+ MatSelectModule,
444
+ MatTooltipModule,
445
+ MatCheckboxModule,
446
+ FsDialogModule,
447
+ FsListModule,
448
+ FsLabelModule,
449
+ FsSkeletonModule,
450
+ FsFormModule,
451
+ FsTextEditorModule,
452
+ FsHtmlEditorModule,
453
+ FsHtmlRendererModule,
454
+ FsCommonModule,
455
+ FsTabsModule,
456
+ FsAppMessagePreviewModule,
457
+ ],
458
+ declarations: [
459
+ MessagesComponent,
460
+ MessageComponent,
461
+ AttachmentsComponent,
462
+ ],
463
+ exports: [
464
+ MessagesComponent,
465
+ MessageComponent,
466
+ ],
467
+ }]
468
+ }] });
469
+
470
+ var MessageQueueState;
471
+ (function (MessageQueueState) {
472
+ MessageQueueState["Sent"] = "S";
473
+ MessageQueueState["PartiallySent"] = "P";
474
+ MessageQueueState["Sending"] = "E";
475
+ MessageQueueState["Queued"] = "Q";
476
+ MessageQueueState["Canceled"] = "C";
477
+ MessageQueueState["InvalidRecipients"] = "I";
478
+ MessageQueueState["Failed"] = "F";
479
+ })(MessageQueueState || (MessageQueueState = {}));
480
+
481
+ const MessageQueueStates = [
482
+ { name: 'Sent', value: MessageQueueState.Sent },
483
+ { name: 'Partially Sent', value: MessageQueueState.PartiallySent },
484
+ { name: 'Sending', value: MessageQueueState.Sending },
485
+ { name: 'Queued', value: MessageQueueState.Queued },
486
+ { name: 'Canceled', value: MessageQueueState.Canceled },
487
+ { name: 'Invalid Recipients', value: MessageQueueState.InvalidRecipients },
488
+ { name: 'Failed', value: MessageQueueState.Failed }
489
+ ];
490
+
491
+ var EmailMessageQueueFormat;
492
+ (function (EmailMessageQueueFormat) {
493
+ EmailMessageQueueFormat["Text"] = "T";
494
+ EmailMessageQueueFormat["HTML"] = "H";
495
+ EmailMessageQueueFormat["RichText"] = "R";
496
+ })(EmailMessageQueueFormat || (EmailMessageQueueFormat = {}));
497
+
498
+ var MessageQueueType;
499
+ (function (MessageQueueType) {
500
+ MessageQueueType["Sms"] = "S";
501
+ MessageQueueType["Email"] = "E";
502
+ })(MessageQueueType || (MessageQueueType = {}));
503
+
504
+ var MessageQueueEventType;
505
+ (function (MessageQueueEventType) {
506
+ MessageQueueEventType["Click"] = "click";
507
+ MessageQueueEventType["Open"] = "open";
508
+ })(MessageQueueEventType || (MessageQueueEventType = {}));
509
+
510
+ const MessageQueueEventTypes = [
511
+ { name: 'Open', value: MessageQueueEventType.Open },
512
+ { name: 'Click', value: MessageQueueEventType.Click },
513
+ ];
514
+
515
+ class RecipientComponent {
516
+ ngOnInit() {
517
+ const icons = {
518
+ 'S': { name: 'check_circle', tooltip: 'Sent' },
519
+ 'E': { name: 'offline_bolt', tooltip: 'Sending' },
520
+ 'F': { name: 'info', tooltip: 'Failed' },
521
+ };
522
+ this.icon = icons[this.state];
523
+ }
524
+ }
525
+ RecipientComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: RecipientComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
526
+ RecipientComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: RecipientComponent, selector: "app-recipient", inputs: { name: "name", state: "state" }, ngImport: i0, template: "<span class=\"recipient\">\n <span class=\"name\">{{name}}</span>\n <mat-icon *ngIf=\"icon\" [class]=\"'state-' + state\" [matTooltip]=\"icon.tooltip\">{{icon.name}}</mat-icon>\n</span>", styles: ["mat-icon{font-size:14px;width:14px;height:14px;line-height:normal;margin-left:2px}mat-icon.state-S{color:#5fa099}mat-icon.state-E{color:#fbbc04}mat-icon.state-F{color:#d8524e}.recipient{display:inline-flex;align-items:center}\n"], components: [{ type: i1$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i17.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$2.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
527
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: RecipientComponent, decorators: [{
528
+ type: Component,
529
+ args: [{ selector: 'app-recipient', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span class=\"recipient\">\n <span class=\"name\">{{name}}</span>\n <mat-icon *ngIf=\"icon\" [class]=\"'state-' + state\" [matTooltip]=\"icon.tooltip\">{{icon.name}}</mat-icon>\n</span>", styles: ["mat-icon{font-size:14px;width:14px;height:14px;line-height:normal;margin-left:2px}mat-icon.state-S{color:#5fa099}mat-icon.state-E{color:#fbbc04}mat-icon.state-F{color:#d8524e}.recipient{display:inline-flex;align-items:center}\n"] }]
530
+ }], propDecorators: { name: [{
531
+ type: Input
532
+ }], state: [{
533
+ type: Input
534
+ }] } });
535
+
536
+ class QueueComponent {
537
+ constructor(_config, _data, _message, _prompt, _dialog, _cdRef) {
538
+ this._config = _config;
539
+ this._data = _data;
540
+ this._message = _message;
541
+ this._prompt = _prompt;
542
+ this._dialog = _dialog;
543
+ this._cdRef = _cdRef;
544
+ this.messageQueueRecipients = {};
545
+ this.emailMessageQueueFormat = EmailMessageQueueFormat;
546
+ this.MessageQueueEventTypes = indexNameValue(MessageQueueEventTypes);
547
+ this.MessageQueueEventType = MessageQueueEventType;
548
+ this._destroy$ = new Subject();
549
+ }
550
+ ngOnInit() {
551
+ this.messageQueueStates = indexNameValue(MessageQueueStates);
552
+ this.resendMessageQueue = this._config.resendMessageQueue;
553
+ this.forwardMessageQueue = this._config.forwardMessageQueue;
554
+ this._config.loadMessageQueue(this._data.messageQueueId)
555
+ .subscribe((messageQueue) => {
556
+ this.messageQueue = messageQueue;
557
+ if (this.messageQueue.emailMessageQueue) {
558
+ let body = this.messageQueue.emailMessageQueue.body;
559
+ if (this.messageQueue.emailMessageQueue.format === EmailMessageQueueFormat.HTML) {
560
+ try {
561
+ const doc = new DOMParser().parseFromString(body, 'text/html');
562
+ doc.querySelectorAll('a').forEach((el) => {
563
+ el.setAttribute('target', '_blank');
564
+ });
565
+ body = doc.documentElement.innerHTML;
566
+ }
567
+ catch (e) {
568
+ }
569
+ }
570
+ else {
571
+ body = this.anchorMe(body);
572
+ }
573
+ this.messageQueue.emailMessageQueue.body = body;
574
+ }
575
+ if (this.messageQueue.smsMessageQueue) {
576
+ this.messageQueue.smsMessageQueue.body = this.anchorMe(this.messageQueue.smsMessageQueue.body);
577
+ }
578
+ this.messageQueueRecipients = this.messageQueue.messageQueueRecipients
579
+ .reduce((accum, messageQueueRecipient) => {
580
+ accum[messageQueueRecipient.recipient] = messageQueueRecipient.state;
581
+ return accum;
582
+ }, {});
583
+ this._setLogsConfig(messageQueue);
584
+ this._setAttachmentsConfig(messageQueue);
585
+ this._setEventsConfig(messageQueue);
586
+ this._cdRef.markForCheck();
587
+ });
588
+ }
589
+ anchorMe(input) {
590
+ return anchorme({
591
+ input,
592
+ options: {
593
+ attributes: {
594
+ target: "_blank",
595
+ }
596
+ }
597
+ });
598
+ }
599
+ openMessage(message) {
600
+ this._dialog.open(MessageComponent, {
601
+ data: {
602
+ message: message,
603
+ },
604
+ width: '85%'
605
+ });
606
+ }
607
+ resend() {
608
+ this._prompt.confirm({
609
+ title: 'Confirm',
610
+ template: 'Are you sure you would like to resend this message?'
611
+ }).subscribe(() => {
612
+ this.resendMessageQueue(this.messageQueue)
613
+ .subscribe(messageQueue => {
614
+ Object.assign(this.messageQueue, messageQueue);
615
+ this._cdRef.markForCheck();
616
+ this._message.success('Successfully resent');
617
+ if (this.logList) {
618
+ this.logList.reload();
619
+ }
620
+ });
621
+ });
622
+ }
623
+ forward() {
624
+ const typeName = this.messageQueue.type === MessageQueueType.Email ? 'an email' : 'a phone number';
625
+ this._prompt.input({
626
+ label: `Please enter ${typeName} to forward to`,
627
+ title: 'Forward Message',
628
+ commitLabel: 'Forward',
629
+ required: true
630
+ }).subscribe((value) => {
631
+ if (value) {
632
+ this.forwardMessageQueue(this.messageQueue, value)
633
+ .subscribe(messageQueue => {
634
+ this.messageQueue = {
635
+ ...this.messageQueue,
636
+ messageQueue,
637
+ };
638
+ this._message.success('Successfully forwarded');
639
+ this._cdRef.markForCheck();
640
+ if (this.logList) {
641
+ this.logList.reload();
642
+ }
643
+ });
644
+ }
645
+ });
646
+ }
647
+ ngOnDestroy() {
648
+ this._destroy$.next();
649
+ this._destroy$.complete();
650
+ }
651
+ _setLogsConfig(messageQueue) {
652
+ this.logConfig = {
653
+ loadMore: true,
654
+ queryParam: false,
655
+ fetch: query => {
656
+ return this._config.loadLogs(messageQueue, query);
657
+ }
658
+ };
659
+ }
660
+ _setEventsConfig(messageQueue) {
661
+ this.eventConfig = {
662
+ loadMore: true,
663
+ queryParam: false,
664
+ fetch: (query) => {
665
+ return this._config.loadMessageQueueEvents(messageQueue, query);
666
+ }
667
+ };
668
+ }
669
+ _setAttachmentsConfig(messageQueue) {
670
+ this.attachmentConfig = {
671
+ queryParam: false,
672
+ fetch: query => {
673
+ return this._config.loadMessageQueueAttachments(messageQueue, query)
674
+ .pipe(map(response => ({
675
+ data: response.data.map(value => {
676
+ value.prettyFilesize = this._prettyFilesize(value.filesize);
677
+ return value;
678
+ }), paging: response.paging
679
+ })));
680
+ }
681
+ };
682
+ if (this._config.downloadMessageQueueAttachment) {
683
+ this.attachmentConfig.rowActions = [
684
+ {
685
+ click: (messageAttachment) => {
686
+ this._config.downloadMessageQueueAttachment(messageAttachment, this.messageQueue);
687
+ },
688
+ label: 'Download',
689
+ }
690
+ ];
691
+ }
692
+ }
693
+ _prettyFilesize(bytes) {
694
+ if (bytes === 0) {
695
+ return '0.00 B';
696
+ }
697
+ const e = Math.floor(Math.log(bytes) / Math.log(1024));
698
+ return (bytes / Math.pow(1024, e)).toFixed(2) + ' ' + ' KMGTP'.charAt(e) + 'B';
699
+ }
700
+ }
701
+ QueueComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: QueueComponent, deps: [{ token: FS_APP_MESSAGE_CONFIG }, { token: MAT_DIALOG_DATA }, { token: i1$1.FsMessage }, { token: i1$2.FsPrompt }, { token: i1.MatDialog }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
702
+ QueueComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: QueueComponent, selector: "ng-component", viewQueries: [{ propertyName: "logList", first: true, predicate: ["logList"], descendants: true }], ngImport: i0, template: "<fs-dialog *fsSkeleton=\"messageQueue\">\n <div mat-dialog-title>Message Queue</div>\n <mat-dialog-content>\n <mat-tab-group>\n <mat-tab label=\"Overview\">\n <ng-template matTabContent>\n <div class=\"fs-row.gap-large.wrap\">\n <ng-container *ngIf=\"messageQueue.emailMessageQueue\">\n <fs-label-field>\n <fs-label>\n To Recipients\n </fs-label>\n <app-recipient \n *ngFor=\"let recipient of messageQueue.emailMessageQueue.toRecipients\"\n [state]=\"messageQueueRecipients[recipient]\"\n [name]=\"recipient\">\n </app-recipient>\n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.emailMessageQueue.ccRecipients.length\">\n <fs-label>\n CC\n </fs-label>\n <app-recipient \n *ngFor=\"let recipient of messageQueue.emailMessageQueue.ccRecipients\"\n [state]=\"messageQueueRecipients[recipient]\"\n [name]=\"recipient\">\n </app-recipient> \n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.emailMessageQueue.bccRecipients.length\">\n <fs-label>\n BCC\n </fs-label>\n <app-recipient \n *ngFor=\"let recipient of messageQueue.emailMessageQueue.bccRecipients\"\n [state]=\"messageQueueRecipients[recipient]\"\n [name]=\"recipient\">\n </app-recipient> \n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.emailMessageQueue.fromName || messageQueue.emailMessageQueue.fromEmail\">\n <fs-label>\n From\n </fs-label>\n <ng-container *ngIf=\"messageQueue.emailMessageQueue.fromName === messageQueue.emailMessageQueue.fromEmail; else fromEmailName\">\n {{messageQueue.emailMessageQueue.fromName}}\n </ng-container>\n\n <ng-template #fromEmailName>\n {{messageQueue.emailMessageQueue.fromName}}\n <ng-container *ngIf=\"messageQueue.emailMessageQueue.fromEmail\">\n ({{messageQueue.emailMessageQueue.fromEmail}})\n </ng-container>\n </ng-template>\n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.emailMessageQueue.replyEmail && messageQueue.emailMessageQueue.replyEmail.length\">\n <fs-label>\n Reply To\n </fs-label>\n {{messageQueue.emailMessageQueue.replyEmail.join(', ')}}\n </fs-label-field>\n </ng-container>\n\n <ng-container *ngIf=\"messageQueue.smsMessageQueue\">\n <fs-label-field>\n <fs-label>\n To Number\n </fs-label>\n <app-recipient \n [state]=\"messageQueue.state\"\n [name]=\"messageQueue.smsMessageQueue.toNumber\">\n </app-recipient> \n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.smsMessageQueue.fromNumber\">\n <fs-label>\n From Number\n </fs-label>\n {{messageQueue.smsMessageQueue.fromNumber}}\n </fs-label-field>\n </ng-container>\n \n <fs-label-field>\n <fs-label>\n Date\n </fs-label>\n {{messageQueue.scheduledDate | fsDateFormat: 'full-date-time'}}\n </fs-label-field>\n\n <fs-label-field>\n <fs-label>\n Status\n </fs-label>\n {{messageQueueStates[messageQueue.state]}}\n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.message\">\n <fs-label>\n Message Type\n </fs-label>\n <a\n (click)=\"openMessage(messageQueue.message)\"\n *ngIf=\"loadMessage; else elseMessage\">\n {{messageQueue.message.name}}\n </a>\n <ng-template #elseMessage>\n {{messageQueue.message.name}}\n </ng-template>\n </fs-label-field>\n </div>\n\n <ng-container *ngIf=\"messageQueue.emailMessageQueue\">\n <fs-label-field class=\"subject\">\n <fs-label>\n Subject\n </fs-label>\n {{messageQueue.emailMessageQueue.subject}}\n </fs-label-field>\n\n <fs-label-field class=\"body\">\n <fs-label>\n Body\n </fs-label>\n <div\n *ngIf=\"messageQueue.emailMessageQueue.format===emailMessageQueueFormat.Text\"\n class=\"format-text\"\n [innerHTML]=\"messageQueue.emailMessageQueue.body\">\n </div>\n <fs-iframe\n *ngIf=\"messageQueue.emailMessageQueue.format===emailMessageQueueFormat.HTML || messageQueue.emailMessageQueue.format===emailMessageQueueFormat.RichText\"\n [html]=\"messageQueue.emailMessageQueue.body\"\n [width]=\"'100%'\">\n </fs-iframe>\n </fs-label-field>\n </ng-container>\n\n <ng-container *ngIf=\"messageQueue.smsMessageQueue\">\n <fs-label-field>\n <fs-label>\n Message\n </fs-label>\n <div\n class=\"format-text\"\n [innerHTML]=\"messageQueue.smsMessageQueue.body\">\n </div>\n </fs-label-field>\n </ng-container>\n\n </ng-template>\n </mat-tab>\n <mat-tab label=\"Logs\">\n <ng-template matTabContent>\n <fs-list [config]=\"logConfig\" #logList>\n <fs-list-column title=\"Message\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.message}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Date\">\n <ng-template fs-list-cell let-row=\"row\">\n <fs-date-ago [date]=\"row.createdDate\"></fs-date-ago>\n </ng-template>\n </fs-list-column>\n </fs-list>\n </ng-template>\n </mat-tab>\n <mat-tab label=\"Attachments\">\n <ng-template matTabContent>\n <fs-list [config]=\"attachmentConfig\">\n <fs-list-column title=\"File Name\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.filename}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"File Size\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.prettyFilesize}}\n </ng-template>\n </fs-list-column>\n </fs-list>\n </ng-template>\n </mat-tab>\n <mat-tab label=\"Events\">\n <ng-template matTabContent>\n <fs-list [config]=\"eventConfig\">\n <fs-list-column title=\"Recipient\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.messageQueueRecipient.recipient}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Event\">\n <ng-template fs-list-cell let-row=\"row\">\n {{MessageQueueEventTypes[row.type]}}\n <div class=\"small\" *ngIf=\"row.type === MessageQueueEventType.Click\">\n <a [href]=\"row.meta?.url\" target=\"_blank\">{{row.meta?.url}}</a>\n </div>\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Date\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.createDate | fsDateFormat: 'date-time-yearless'}}\n </ng-template>\n </fs-list-column>\n </fs-list>\n </ng-template>\n </mat-tab>\n </mat-tab-group>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n mat-button\n [mat-dialog-close]=\"null\"\n color=\"primary\">\n Done\n </button>\n <button\n mat-button\n *ngIf=\"resendMessageQueue\"\n type=\"button\"\n (click)=\"resend()\"\n type=\"button\">\n Resend\n </button>\n <button\n mat-button\n *ngIf=\"forwardMessageQueue\"\n type=\"button\"\n (click)=\"forward()\"\n type=\"button\">\n Forward\n </button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: [".subject,.body{display:block;margin-top:15px}.body .format-text{white-space:pre-wrap}.body .body-frame{border:0}.body ::ng-deep .field-label{margin-bottom:10px}app-recipient{display:block}[hidden]{display:none!important}\n"], components: [{ type: i4.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }, { type: i5.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple"], exportAs: ["matTabGroup"] }, { type: i5.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { type: i6$1.FsLabelFieldComponent, selector: "fs-label-field", inputs: ["bottomMargin", "topMargin", "labelMargin"] }, { type: i6$1.FsLabelComponent, selector: "fs-label" }, { type: RecipientComponent, selector: "app-recipient", inputs: ["name", "state"] }, { type: i2.FsIFrameComponent, selector: "fs-iframe", inputs: ["html", "src", "styles", "width", "height"] }, { type: i2$1.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }, { type: i10$1.FsDateAgoComponent, selector: "fs-date-ago", inputs: ["date", "showTime", "format", "showTooltip", "tooltipDateFormat"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i14.FsSkeletonContentDirective, selector: "[fsSkeleton]", inputs: ["fsSkeleton", "fsSkeletonPattern"] }, { type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i5.MatTabContent, selector: "[matTabContent]" }, { type: i17.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i17.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i2$1.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i16.FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit", "form"] }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }], pipes: { "fsDateFormat": i10$1.FsDateFormatPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
703
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: QueueComponent, decorators: [{
704
+ type: Component,
705
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-dialog *fsSkeleton=\"messageQueue\">\n <div mat-dialog-title>Message Queue</div>\n <mat-dialog-content>\n <mat-tab-group>\n <mat-tab label=\"Overview\">\n <ng-template matTabContent>\n <div class=\"fs-row.gap-large.wrap\">\n <ng-container *ngIf=\"messageQueue.emailMessageQueue\">\n <fs-label-field>\n <fs-label>\n To Recipients\n </fs-label>\n <app-recipient \n *ngFor=\"let recipient of messageQueue.emailMessageQueue.toRecipients\"\n [state]=\"messageQueueRecipients[recipient]\"\n [name]=\"recipient\">\n </app-recipient>\n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.emailMessageQueue.ccRecipients.length\">\n <fs-label>\n CC\n </fs-label>\n <app-recipient \n *ngFor=\"let recipient of messageQueue.emailMessageQueue.ccRecipients\"\n [state]=\"messageQueueRecipients[recipient]\"\n [name]=\"recipient\">\n </app-recipient> \n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.emailMessageQueue.bccRecipients.length\">\n <fs-label>\n BCC\n </fs-label>\n <app-recipient \n *ngFor=\"let recipient of messageQueue.emailMessageQueue.bccRecipients\"\n [state]=\"messageQueueRecipients[recipient]\"\n [name]=\"recipient\">\n </app-recipient> \n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.emailMessageQueue.fromName || messageQueue.emailMessageQueue.fromEmail\">\n <fs-label>\n From\n </fs-label>\n <ng-container *ngIf=\"messageQueue.emailMessageQueue.fromName === messageQueue.emailMessageQueue.fromEmail; else fromEmailName\">\n {{messageQueue.emailMessageQueue.fromName}}\n </ng-container>\n\n <ng-template #fromEmailName>\n {{messageQueue.emailMessageQueue.fromName}}\n <ng-container *ngIf=\"messageQueue.emailMessageQueue.fromEmail\">\n ({{messageQueue.emailMessageQueue.fromEmail}})\n </ng-container>\n </ng-template>\n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.emailMessageQueue.replyEmail && messageQueue.emailMessageQueue.replyEmail.length\">\n <fs-label>\n Reply To\n </fs-label>\n {{messageQueue.emailMessageQueue.replyEmail.join(', ')}}\n </fs-label-field>\n </ng-container>\n\n <ng-container *ngIf=\"messageQueue.smsMessageQueue\">\n <fs-label-field>\n <fs-label>\n To Number\n </fs-label>\n <app-recipient \n [state]=\"messageQueue.state\"\n [name]=\"messageQueue.smsMessageQueue.toNumber\">\n </app-recipient> \n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.smsMessageQueue.fromNumber\">\n <fs-label>\n From Number\n </fs-label>\n {{messageQueue.smsMessageQueue.fromNumber}}\n </fs-label-field>\n </ng-container>\n \n <fs-label-field>\n <fs-label>\n Date\n </fs-label>\n {{messageQueue.scheduledDate | fsDateFormat: 'full-date-time'}}\n </fs-label-field>\n\n <fs-label-field>\n <fs-label>\n Status\n </fs-label>\n {{messageQueueStates[messageQueue.state]}}\n </fs-label-field>\n\n <fs-label-field *ngIf=\"messageQueue.message\">\n <fs-label>\n Message Type\n </fs-label>\n <a\n (click)=\"openMessage(messageQueue.message)\"\n *ngIf=\"loadMessage; else elseMessage\">\n {{messageQueue.message.name}}\n </a>\n <ng-template #elseMessage>\n {{messageQueue.message.name}}\n </ng-template>\n </fs-label-field>\n </div>\n\n <ng-container *ngIf=\"messageQueue.emailMessageQueue\">\n <fs-label-field class=\"subject\">\n <fs-label>\n Subject\n </fs-label>\n {{messageQueue.emailMessageQueue.subject}}\n </fs-label-field>\n\n <fs-label-field class=\"body\">\n <fs-label>\n Body\n </fs-label>\n <div\n *ngIf=\"messageQueue.emailMessageQueue.format===emailMessageQueueFormat.Text\"\n class=\"format-text\"\n [innerHTML]=\"messageQueue.emailMessageQueue.body\">\n </div>\n <fs-iframe\n *ngIf=\"messageQueue.emailMessageQueue.format===emailMessageQueueFormat.HTML || messageQueue.emailMessageQueue.format===emailMessageQueueFormat.RichText\"\n [html]=\"messageQueue.emailMessageQueue.body\"\n [width]=\"'100%'\">\n </fs-iframe>\n </fs-label-field>\n </ng-container>\n\n <ng-container *ngIf=\"messageQueue.smsMessageQueue\">\n <fs-label-field>\n <fs-label>\n Message\n </fs-label>\n <div\n class=\"format-text\"\n [innerHTML]=\"messageQueue.smsMessageQueue.body\">\n </div>\n </fs-label-field>\n </ng-container>\n\n </ng-template>\n </mat-tab>\n <mat-tab label=\"Logs\">\n <ng-template matTabContent>\n <fs-list [config]=\"logConfig\" #logList>\n <fs-list-column title=\"Message\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.message}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Date\">\n <ng-template fs-list-cell let-row=\"row\">\n <fs-date-ago [date]=\"row.createdDate\"></fs-date-ago>\n </ng-template>\n </fs-list-column>\n </fs-list>\n </ng-template>\n </mat-tab>\n <mat-tab label=\"Attachments\">\n <ng-template matTabContent>\n <fs-list [config]=\"attachmentConfig\">\n <fs-list-column title=\"File Name\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.filename}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"File Size\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.prettyFilesize}}\n </ng-template>\n </fs-list-column>\n </fs-list>\n </ng-template>\n </mat-tab>\n <mat-tab label=\"Events\">\n <ng-template matTabContent>\n <fs-list [config]=\"eventConfig\">\n <fs-list-column title=\"Recipient\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.messageQueueRecipient.recipient}}\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Event\">\n <ng-template fs-list-cell let-row=\"row\">\n {{MessageQueueEventTypes[row.type]}}\n <div class=\"small\" *ngIf=\"row.type === MessageQueueEventType.Click\">\n <a [href]=\"row.meta?.url\" target=\"_blank\">{{row.meta?.url}}</a>\n </div>\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Date\">\n <ng-template fs-list-cell let-row=\"row\">\n {{row.createDate | fsDateFormat: 'date-time-yearless'}}\n </ng-template>\n </fs-list-column>\n </fs-list>\n </ng-template>\n </mat-tab>\n </mat-tab-group>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n mat-button\n [mat-dialog-close]=\"null\"\n color=\"primary\">\n Done\n </button>\n <button\n mat-button\n *ngIf=\"resendMessageQueue\"\n type=\"button\"\n (click)=\"resend()\"\n type=\"button\">\n Resend\n </button>\n <button\n mat-button\n *ngIf=\"forwardMessageQueue\"\n type=\"button\"\n (click)=\"forward()\"\n type=\"button\">\n Forward\n </button>\n </mat-dialog-actions>\n</fs-dialog>\n", styles: [".subject,.body{display:block;margin-top:15px}.body .format-text{white-space:pre-wrap}.body .body-frame{border:0}.body ::ng-deep .field-label{margin-bottom:10px}app-recipient{display:block}[hidden]{display:none!important}\n"] }]
706
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
707
+ type: Inject,
708
+ args: [FS_APP_MESSAGE_CONFIG]
709
+ }] }, { type: undefined, decorators: [{
710
+ type: Inject,
711
+ args: [MAT_DIALOG_DATA]
712
+ }] }, { type: i1$1.FsMessage }, { type: i1$2.FsPrompt }, { type: i1.MatDialog }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { logList: [{
713
+ type: ViewChild,
714
+ args: ['logList']
715
+ }] } });
716
+
717
+ class FsMessageQueueService {
718
+ constructor(_dialog) {
719
+ this._dialog = _dialog;
720
+ }
721
+ openMessageQueue(messageQueueId, options = {}) {
722
+ return this._dialog.open(QueueComponent, {
723
+ ...options,
724
+ data: {
725
+ messageQueueId,
726
+ },
727
+ width: options.width || '85%',
728
+ })
729
+ .afterClosed();
730
+ }
731
+ }
732
+ FsMessageQueueService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMessageQueueService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
733
+ FsMessageQueueService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMessageQueueService, providedIn: 'root' });
734
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMessageQueueService, decorators: [{
735
+ type: Injectable,
736
+ args: [{
737
+ providedIn: 'root',
738
+ }]
739
+ }], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
740
+
741
+ class TruncatePipe {
742
+ transform(value, limit = 25, completeWords = false, ellipsis = '...') {
743
+ if (value.length < limit) {
744
+ return `${value.substr(0, limit)}`;
745
+ }
746
+ if (completeWords) {
747
+ limit = value.substr(0, limit).lastIndexOf(' ');
748
+ }
749
+ return `${value.substr(0, limit)}${ellipsis}`;
750
+ }
751
+ }
752
+ TruncatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TruncatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
753
+ TruncatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TruncatePipe, name: "truncate" });
754
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TruncatePipe, decorators: [{
755
+ type: Pipe,
756
+ args: [{
757
+ name: 'truncate'
758
+ }]
759
+ }] });
760
+
761
+ class QueuesComponent {
762
+ constructor(_config, _messageQueueService) {
763
+ this._config = _config;
764
+ this._messageQueueService = _messageQueueService;
765
+ this.list = null;
766
+ this.query = {};
767
+ this.config = null;
768
+ this.messageQueueStates = {};
769
+ this.MessageQueueState = MessageQueueState;
770
+ this._destroy$ = new Subject();
771
+ }
772
+ ngOnInit() {
773
+ this.messageQueueStates = indexNameValue(MessageQueueStates);
774
+ this.config = {
775
+ filters: [
776
+ {
777
+ name: 'keyword',
778
+ type: ItemType.Keyword,
779
+ label: 'Search',
780
+ },
781
+ {
782
+ name: 'state',
783
+ type: ItemType.Select,
784
+ label: 'Status',
785
+ values: () => {
786
+ return MessageQueueStates;
787
+ },
788
+ },
789
+ {
790
+ name: 'date',
791
+ type: ItemType.DateRange,
792
+ label: ['From Date', 'To Date'],
793
+ },
794
+ ],
795
+ sort: { value: 'created_date', direction: 'desc' },
796
+ fetch: (query) => {
797
+ query = {
798
+ ...query,
799
+ ...this.query,
800
+ messageQueueAttachmentCounts: true,
801
+ emailMessageQueues: true,
802
+ emailMessageQueueBodies: false,
803
+ smsMessageQueues: true,
804
+ };
805
+ return this._config.loadMessageQueues(query)
806
+ .pipe(map((response) => ({
807
+ data: response.data
808
+ .map((messageQueue) => {
809
+ return {
810
+ ...messageQueue,
811
+ scheduled: messageQueue.state === MessageQueueState.Queued && isAfter(messageQueue.scheduledDate, new Date()),
812
+ messageQueueRecipients: messageQueue.messageQueueRecipients
813
+ .reduce((accum, messageQueueRecipient) => {
814
+ accum[messageQueueRecipient.recipient] = messageQueueRecipient.state;
815
+ return accum;
816
+ }, {}),
817
+ };
818
+ }), paging: response.paging,
819
+ })));
820
+ },
821
+ };
822
+ if (this._config.bulkMessageQueues) {
823
+ this.config.selection = {
824
+ selectAll: false,
825
+ actions: [
826
+ {
827
+ type: SelectionActionType.Action,
828
+ name: 'queue',
829
+ label: 'Queue',
830
+ },
831
+ {
832
+ type: SelectionActionType.Action,
833
+ name: 'resend',
834
+ label: 'Resend',
835
+ },
836
+ {
837
+ type: SelectionActionType.Action,
838
+ name: 'cancel',
839
+ label: 'Cancel',
840
+ },
841
+ ],
842
+ actionSelected: (actionSelected) => {
843
+ return this._config.bulkMessageQueues(actionSelected.action.name, actionSelected.selected)
844
+ .pipe(tap(() => {
845
+ this.list.reload();
846
+ }));
847
+ },
848
+ };
849
+ }
850
+ this.config.filters.push({
851
+ name: 'message_id',
852
+ type: ItemType.Select,
853
+ label: 'Message Type',
854
+ values: (query) => {
855
+ query = {
856
+ ...query,
857
+ limit: 50,
858
+ };
859
+ return this._config.loadMessages(query)
860
+ .pipe(map((response) => {
861
+ return [
862
+ { value: null, name: 'All' },
863
+ ...response.data
864
+ .map((item) => ({ name: item.name, value: item.id })),
865
+ ];
866
+ }));
867
+ },
868
+ });
869
+ }
870
+ open(messageQueue) {
871
+ this._messageQueueService.openMessageQueue(messageQueue.id)
872
+ .pipe(takeUntil(this._destroy$))
873
+ .subscribe(() => {
874
+ this.list.reload();
875
+ });
876
+ }
877
+ ngOnDestroy() {
878
+ this._destroy$.next();
879
+ this._destroy$.complete();
880
+ }
881
+ }
882
+ QueuesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: QueuesComponent, deps: [{ token: FS_APP_MESSAGE_CONFIG }, { token: FsMessageQueueService }], target: i0.ɵɵFactoryTarget.Component });
883
+ QueuesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: QueuesComponent, selector: "fs-app-message-queues", inputs: { query: "query" }, viewQueries: [{ propertyName: "list", first: true, predicate: FsListComponent, descendants: true, static: true }], ngImport: i0, template: "<fs-list [config]=\"config\" #list>\n <fs-list-column title=\"Message\" name=\"subject\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <ng-container *ngIf=\"row.emailMessageQueue\">\n <div class=\"fs-row.gap-tiny\">\n <a (click)=\"open(row)\">{{row.emailMessageQueue.subject|truncate:100}}</a>\n <mat-icon *ngIf=\"row.messageQueueAttachmentCount\" [matTooltip]=\"row.messageQueueAttachmentCount + ' Attachment(s)'\">attach_file</mat-icon>\n </div>\n </ng-container>\n <ng-container *ngIf=\"row.smsMessageQueue\">\n <a (click)=\"open(row)\">{{row.smsMessageQueue.body|truncate:100}}</a>\n </ng-container>\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Recipients\" class=\"col-recipients\">\n <ng-template fs-list-cell let-row=\"row\">\n <ng-container *ngIf=\"row.emailMessageQueue\">\n <ng-container *ngIf=\"row.emailMessageQueue.toRecipients.length; else unspecified\">\n <div class=\"small\" *ngFor=\"let recipient of row.emailMessageQueue.toRecipients\">\n <app-recipient \n [state]=\"row.messageQueueRecipients[recipient] || row.state\"\n [name]=\"recipient\">\n </app-recipient>\n </div>\n </ng-container>\n <div class=\"small\" *ngFor=\"let recipient of row.emailMessageQueue.ccRecipients\">\n <app-recipient \n [state]=\"row.messageQueueRecipients[recipient] || row.state\"\n [name]=\"recipient\">\n </app-recipient>\n </div>\n <div class=\"small\" *ngFor=\"let recipient of row.emailMessageQueue.bccRecipients\">\n <app-recipient \n [state]=\"row.messageQueueRecipients[recipient] || row.state\"\n [name]=\"recipient\">\n </app-recipient>\n </div>\n </ng-container>\n <ng-container *ngIf=\"row.smsMessageQueue\">\n <ng-container *ngIf=\"row.smsMessageQueue.toNumber; else unspecified\">\n <app-recipient \n class=\"small\"\n [state]=\"row.state\"\n [name]=\"row.smsMessageQueue.toNumber\">\n </app-recipient>\n </ng-container>\n </ng-container>\n </ng-template>\n </fs-list-column> \n <fs-list-column title=\"Status\" class=\"col-state\">\n <ng-template fs-list-cell let-row=\"row\"> \n <ng-container *ngIf=\"row.scheduled; else state\">\n Scheduled\n <div class=\"small\">\n {{row.scheduledDate | fsDateFormat: 'date-time' }}\n </div>\n </ng-container>\n <ng-template #state>\n <span [class]=\"'state-' + row.state\">{{messageQueueStates[row.state]}}</span>\n </ng-template>\n </ng-template>\n </fs-list-column> \n <fs-list-column title=\"Date\" name=\"created_date\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n {{ row.createdDate | fsDateFormat: 'date-time-yeardiff' }}\n </ng-template>\n </fs-list-column>\n</fs-list>\n\n<ng-template #unspecified>\n <app-recipient \n class=\"small\"\n [state]=\"MessageQueueState.Failed\"\n name=\"Unspecified\">\n </app-recipient>\n</ng-template>", styles: [":host ::ng-deep .col-recipients small+small:before{content:\", \"}:host ::ng-deep .col-state .state-F,:host ::ng-deep .col-state .state-P{color:#d8524e}\n"], components: [{ type: i2$1.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }, { type: i1$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: RecipientComponent, selector: "app-recipient", inputs: ["name", "state"] }], directives: [{ type: i2$1.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i2$1.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }, { type: i17.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$2.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i17.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "truncate": TruncatePipe, "fsDateFormat": i10$1.FsDateFormatPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
884
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: QueuesComponent, decorators: [{
885
+ type: Component,
886
+ args: [{ selector: 'fs-app-message-queues', changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-list [config]=\"config\" #list>\n <fs-list-column title=\"Message\" name=\"subject\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n <ng-container *ngIf=\"row.emailMessageQueue\">\n <div class=\"fs-row.gap-tiny\">\n <a (click)=\"open(row)\">{{row.emailMessageQueue.subject|truncate:100}}</a>\n <mat-icon *ngIf=\"row.messageQueueAttachmentCount\" [matTooltip]=\"row.messageQueueAttachmentCount + ' Attachment(s)'\">attach_file</mat-icon>\n </div>\n </ng-container>\n <ng-container *ngIf=\"row.smsMessageQueue\">\n <a (click)=\"open(row)\">{{row.smsMessageQueue.body|truncate:100}}</a>\n </ng-container>\n </ng-template>\n </fs-list-column>\n <fs-list-column title=\"Recipients\" class=\"col-recipients\">\n <ng-template fs-list-cell let-row=\"row\">\n <ng-container *ngIf=\"row.emailMessageQueue\">\n <ng-container *ngIf=\"row.emailMessageQueue.toRecipients.length; else unspecified\">\n <div class=\"small\" *ngFor=\"let recipient of row.emailMessageQueue.toRecipients\">\n <app-recipient \n [state]=\"row.messageQueueRecipients[recipient] || row.state\"\n [name]=\"recipient\">\n </app-recipient>\n </div>\n </ng-container>\n <div class=\"small\" *ngFor=\"let recipient of row.emailMessageQueue.ccRecipients\">\n <app-recipient \n [state]=\"row.messageQueueRecipients[recipient] || row.state\"\n [name]=\"recipient\">\n </app-recipient>\n </div>\n <div class=\"small\" *ngFor=\"let recipient of row.emailMessageQueue.bccRecipients\">\n <app-recipient \n [state]=\"row.messageQueueRecipients[recipient] || row.state\"\n [name]=\"recipient\">\n </app-recipient>\n </div>\n </ng-container>\n <ng-container *ngIf=\"row.smsMessageQueue\">\n <ng-container *ngIf=\"row.smsMessageQueue.toNumber; else unspecified\">\n <app-recipient \n class=\"small\"\n [state]=\"row.state\"\n [name]=\"row.smsMessageQueue.toNumber\">\n </app-recipient>\n </ng-container>\n </ng-container>\n </ng-template>\n </fs-list-column> \n <fs-list-column title=\"Status\" class=\"col-state\">\n <ng-template fs-list-cell let-row=\"row\"> \n <ng-container *ngIf=\"row.scheduled; else state\">\n Scheduled\n <div class=\"small\">\n {{row.scheduledDate | fsDateFormat: 'date-time' }}\n </div>\n </ng-container>\n <ng-template #state>\n <span [class]=\"'state-' + row.state\">{{messageQueueStates[row.state]}}</span>\n </ng-template>\n </ng-template>\n </fs-list-column> \n <fs-list-column title=\"Date\" name=\"created_date\" [sortable]=\"true\">\n <ng-template fs-list-cell let-row=\"row\">\n {{ row.createdDate | fsDateFormat: 'date-time-yeardiff' }}\n </ng-template>\n </fs-list-column>\n</fs-list>\n\n<ng-template #unspecified>\n <app-recipient \n class=\"small\"\n [state]=\"MessageQueueState.Failed\"\n name=\"Unspecified\">\n </app-recipient>\n</ng-template>", styles: [":host ::ng-deep .col-recipients small+small:before{content:\", \"}:host ::ng-deep .col-state .state-F,:host ::ng-deep .col-state .state-P{color:#d8524e}\n"] }]
887
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
888
+ type: Inject,
889
+ args: [FS_APP_MESSAGE_CONFIG]
890
+ }] }, { type: FsMessageQueueService }]; }, propDecorators: { list: [{
891
+ type: ViewChild,
892
+ args: [FsListComponent, { static: true }]
893
+ }], query: [{
894
+ type: Input
895
+ }] } });
896
+
897
+ class LinkifyPipe {
898
+ transform(input) {
899
+ return anchorme({
900
+ input,
901
+ options: {
902
+ attributes: {
903
+ target: "_blank",
904
+ }
905
+ }
906
+ });
907
+ }
908
+ }
909
+ LinkifyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: LinkifyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
910
+ LinkifyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: LinkifyPipe, name: "linkify" });
911
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: LinkifyPipe, decorators: [{
912
+ type: Pipe,
913
+ args: [{ name: 'linkify' }]
914
+ }] });
915
+
916
+ class FsAppMessageQueuesModule {
917
+ }
918
+ FsAppMessageQueuesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
919
+ FsAppMessageQueuesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, declarations: [QueuesComponent,
920
+ QueueComponent,
921
+ LinkifyPipe,
922
+ TruncatePipe,
923
+ RecipientComponent], imports: [RouterModule,
924
+ FormsModule,
925
+ CommonModule,
926
+ MatTooltipModule,
927
+ MatDialogModule,
928
+ MatButtonModule,
929
+ MatIconModule,
930
+ MatTabsModule,
931
+ FsListModule,
932
+ FsDialogModule,
933
+ FsLabelModule,
934
+ FsDateModule,
935
+ FsSkeletonModule,
936
+ FsAppMessagesModule,
937
+ FsFormModule,
938
+ FsPromptInputModule,
939
+ FsIFrameModule], exports: [QueuesComponent,
940
+ QueueComponent] });
941
+ FsAppMessageQueuesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, providers: [
942
+ FsMessageQueueService,
943
+ ], imports: [[
944
+ RouterModule,
945
+ FormsModule,
946
+ CommonModule,
947
+ MatTooltipModule,
948
+ MatDialogModule,
949
+ MatButtonModule,
950
+ MatIconModule,
951
+ MatTabsModule,
952
+ FsListModule,
953
+ FsDialogModule,
954
+ FsLabelModule,
955
+ FsDateModule,
956
+ FsSkeletonModule,
957
+ FsAppMessagesModule,
958
+ FsFormModule,
959
+ FsPromptInputModule,
960
+ FsIFrameModule,
961
+ ]] });
962
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, decorators: [{
963
+ type: NgModule,
964
+ args: [{
965
+ imports: [
966
+ RouterModule,
967
+ FormsModule,
968
+ CommonModule,
969
+ MatTooltipModule,
970
+ MatDialogModule,
971
+ MatButtonModule,
972
+ MatIconModule,
973
+ MatTabsModule,
974
+ FsListModule,
975
+ FsDialogModule,
976
+ FsLabelModule,
977
+ FsDateModule,
978
+ FsSkeletonModule,
979
+ FsAppMessagesModule,
980
+ FsFormModule,
981
+ FsPromptInputModule,
982
+ FsIFrameModule,
983
+ ],
984
+ declarations: [
985
+ QueuesComponent,
986
+ QueueComponent,
987
+ LinkifyPipe,
988
+ TruncatePipe,
989
+ RecipientComponent,
990
+ ],
991
+ exports: [
992
+ QueuesComponent,
993
+ QueueComponent,
994
+ ],
995
+ providers: [
996
+ FsMessageQueueService,
997
+ ],
998
+ }]
999
+ }] });
1000
+
1001
+ class TemplateComponent {
1002
+ constructor(_data, _config, _dialogRef, _message, _dialog) {
1003
+ this._data = _data;
1004
+ this._config = _config;
1005
+ this._dialogRef = _dialogRef;
1006
+ this._message = _message;
1007
+ this._dialog = _dialog;
1008
+ this.htmlEditorconfig = {
1009
+ language: 'html',
1010
+ insertSpaces: true,
1011
+ tabSize: 2,
1012
+ };
1013
+ this.cssEditorconfig = {
1014
+ language: 'scss',
1015
+ insertSpaces: true,
1016
+ tabSize: 2,
1017
+ };
1018
+ this.save = (event) => {
1019
+ return this._config.saveMessageTemplate(this.messageTemplate)
1020
+ .pipe(tap((messageTemplate) => {
1021
+ this._message.success('Saved Changes');
1022
+ if (event.submitter === 'save-close') {
1023
+ this._dialogRef.close(messageTemplate);
1024
+ }
1025
+ }));
1026
+ };
1027
+ }
1028
+ ngOnInit() {
1029
+ if (this._data.messageTemplate.id) {
1030
+ this._config.loadMessageTemplate(this._data.messageTemplate)
1031
+ .subscribe(messageTemplate => {
1032
+ this.messageTemplate = messageTemplate;
1033
+ });
1034
+ }
1035
+ else {
1036
+ this.messageTemplate = {};
1037
+ }
1038
+ }
1039
+ openPreview() {
1040
+ this._dialog.open(PreviewComponent, {
1041
+ data: {
1042
+ styles: this.messageTemplate.styles,
1043
+ html: this.messageTemplate.content,
1044
+ },
1045
+ width: '95%',
1046
+ });
1047
+ }
1048
+ }
1049
+ TemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TemplateComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: FS_APP_MESSAGE_CONFIG }, { token: i1.MatDialogRef }, { token: i1$1.FsMessage }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
1050
+ TemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: TemplateComponent, selector: "ng-component", ngImport: i0, template: "<form\n fsForm\n [submit]=\"save\"\n #form=\"ngForm\"\n *fsSkeleton=\"messageTemplate\"\n [confirmTabs]=\"false\">\n <fs-dialog *ngIf=\"messageTemplate\">\n <div mat-dialog-title>Message Template</div>\n <mat-dialog-content>\n <mat-form-field class=\"name\">\n <input\n matInput\n placeholder=\"Name\"\n [(ngModel)]=\"messageTemplate.name\"\n name=\"name\"\n >\n </mat-form-field>\n <div [@.disabled]=\"true\">\n <mat-tab-group\n mat-align-tabs=\"start\"\n [dynamicHeight]=\"false\">\n <mat-tab label=\"Content\">\n <ng-template matTabContent>\n <div class=\"content\">\n <fs-label-field>\n <fs-text-editor\n [(ngModel)]=\"messageTemplate.content\"\n name=\"body\"\n [config]=\"htmlEditorconfig\">\n </fs-text-editor>\n <fs-label-message>\n &#123;$content&#125; will be replaced with the message content.\n </fs-label-message>\n </fs-label-field>\n </div>\n </ng-template>\n </mat-tab>\n <mat-tab label=\"Styles\">\n <ng-template matTabContent>\n <div class=\"styles\">\n <fs-text-editor\n [(ngModel)]=\"messageTemplate.styles\"\n name=\"styles\"\n [config]=\"cssEditorconfig\">\n </fs-text-editor>\n </div>\n </ng-template>\n </mat-tab>\n </mat-tab-group>\n </div>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button type=\"submit\" color=\"primary\" name=\"close\">Save</button>\n <button mat-button type=\"submit\" name=\"save-close\">Save & Close</button>\n <button mat-button (click)=\"openPreview()\" type=\"button\">Preview</button>\n <button mat-button [mat-dialog-close]=\"null\" type=\"button\">Cancel</button>\n </mat-dialog-actions>\n </fs-dialog>\n</form>\n", styles: [".name{width:100%}:host ::ng-deep .mat-tab-body-content,:host ::ng-deep .mat-tab-body{overflow:visible}\n"], components: [{ type: i4.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }, { type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i5.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple"], exportAs: ["matTabGroup"] }, { type: i5.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { type: i6$1.FsLabelFieldComponent, selector: "fs-label-field", inputs: ["bottomMargin", "topMargin", "labelMargin"] }, { type: i10.FsTextEditorComponent, selector: "fs-text-editor", inputs: ["config", "scrollable"], outputs: ["ready", "blur"] }, { type: i6$1.FsLabelMessageComponent, selector: "fs-label-message" }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i14.FsSkeletonContentDirective, selector: "[fsSkeleton]", inputs: ["fsSkeleton", "fsSkeletonPattern"] }, { type: i15.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i15.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i15.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i16.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup", "deactivationGuard"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"], exportAs: ["fsForm"] }, { type: i17.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i19.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i15.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i15.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i15.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i16.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i5.MatTabContent, selector: "[matTabContent]" }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i16.FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit", "form"] }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] });
1051
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TemplateComponent, decorators: [{
1052
+ type: Component,
1053
+ args: [{ template: "<form\n fsForm\n [submit]=\"save\"\n #form=\"ngForm\"\n *fsSkeleton=\"messageTemplate\"\n [confirmTabs]=\"false\">\n <fs-dialog *ngIf=\"messageTemplate\">\n <div mat-dialog-title>Message Template</div>\n <mat-dialog-content>\n <mat-form-field class=\"name\">\n <input\n matInput\n placeholder=\"Name\"\n [(ngModel)]=\"messageTemplate.name\"\n name=\"name\"\n >\n </mat-form-field>\n <div [@.disabled]=\"true\">\n <mat-tab-group\n mat-align-tabs=\"start\"\n [dynamicHeight]=\"false\">\n <mat-tab label=\"Content\">\n <ng-template matTabContent>\n <div class=\"content\">\n <fs-label-field>\n <fs-text-editor\n [(ngModel)]=\"messageTemplate.content\"\n name=\"body\"\n [config]=\"htmlEditorconfig\">\n </fs-text-editor>\n <fs-label-message>\n &#123;$content&#125; will be replaced with the message content.\n </fs-label-message>\n </fs-label-field>\n </div>\n </ng-template>\n </mat-tab>\n <mat-tab label=\"Styles\">\n <ng-template matTabContent>\n <div class=\"styles\">\n <fs-text-editor\n [(ngModel)]=\"messageTemplate.styles\"\n name=\"styles\"\n [config]=\"cssEditorconfig\">\n </fs-text-editor>\n </div>\n </ng-template>\n </mat-tab>\n </mat-tab-group>\n </div>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button mat-button type=\"submit\" color=\"primary\" name=\"close\">Save</button>\n <button mat-button type=\"submit\" name=\"save-close\">Save & Close</button>\n <button mat-button (click)=\"openPreview()\" type=\"button\">Preview</button>\n <button mat-button [mat-dialog-close]=\"null\" type=\"button\">Cancel</button>\n </mat-dialog-actions>\n </fs-dialog>\n</form>\n", styles: [".name{width:100%}:host ::ng-deep .mat-tab-body-content,:host ::ng-deep .mat-tab-body{overflow:visible}\n"] }]
1054
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1055
+ type: Inject,
1056
+ args: [MAT_DIALOG_DATA]
1057
+ }] }, { type: undefined, decorators: [{
1058
+ type: Inject,
1059
+ args: [FS_APP_MESSAGE_CONFIG]
1060
+ }] }, { type: i1.MatDialogRef }, { type: i1$1.FsMessage }, { type: i1.MatDialog }]; } });
1061
+
1062
+ class TemplatesComponent {
1063
+ constructor(_config, _dialog) {
1064
+ this._config = _config;
1065
+ this._dialog = _dialog;
1066
+ this.list = null;
1067
+ this.config = null;
1068
+ this.messageQueueStates = [];
1069
+ this._destroy$ = new Subject();
1070
+ }
1071
+ ngOnInit() {
1072
+ this.config = {
1073
+ actions: [
1074
+ {
1075
+ label: 'Create',
1076
+ click: () => {
1077
+ this.open({});
1078
+ }
1079
+ }
1080
+ ],
1081
+ status: false,
1082
+ fetch: query => {
1083
+ return this._config.loadMessageTemplates(query);
1084
+ }
1085
+ };
1086
+ if (this._config.deleteMessageTemplate) {
1087
+ this.config.rowActions = [
1088
+ {
1089
+ click: data => {
1090
+ return this._config.deleteMessageTemplate(data);
1091
+ },
1092
+ remove: {
1093
+ title: 'Confirm',
1094
+ template: 'Are you sure you would like to delete this template?',
1095
+ },
1096
+ menu: true,
1097
+ label: 'Delete',
1098
+ },
1099
+ ];
1100
+ }
1101
+ }
1102
+ open(messageTemplate) {
1103
+ const dialogRef = this._dialog.open(TemplateComponent, {
1104
+ data: {
1105
+ messageTemplate,
1106
+ },
1107
+ width: '85%',
1108
+ });
1109
+ dialogRef.afterClosed()
1110
+ .pipe(takeUntil(this._destroy$))
1111
+ .subscribe(() => {
1112
+ this.list.reload();
1113
+ });
1114
+ }
1115
+ ngOnDestroy() {
1116
+ this._destroy$.next();
1117
+ this._destroy$.complete();
1118
+ }
1119
+ }
1120
+ TemplatesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TemplatesComponent, deps: [{ token: FS_APP_MESSAGE_CONFIG }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
1121
+ TemplatesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: TemplatesComponent, selector: "fs-app-message-templates", viewQueries: [{ propertyName: "list", first: true, predicate: FsListComponent, descendants: true, static: true }], ngImport: i0, template: "<fs-list [config]=\"config\">\n <fs-list-column title=\"Name\">\n <ng-template fs-list-cell let-row=\"row\">\n <a (click)=\"open(row)\">{{row.name}}</a>\n </ng-template>\n </fs-list-column>\n</fs-list>", components: [{ type: i2$1.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }], directives: [{ type: i2$1.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i2$1.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }] });
1122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TemplatesComponent, decorators: [{
1123
+ type: Component,
1124
+ args: [{ selector: 'fs-app-message-templates', template: "<fs-list [config]=\"config\">\n <fs-list-column title=\"Name\">\n <ng-template fs-list-cell let-row=\"row\">\n <a (click)=\"open(row)\">{{row.name}}</a>\n </ng-template>\n </fs-list-column>\n</fs-list>" }]
1125
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1126
+ type: Inject,
1127
+ args: [FS_APP_MESSAGE_CONFIG]
1128
+ }] }, { type: i1.MatDialog }]; }, propDecorators: { list: [{
1129
+ type: ViewChild,
1130
+ args: [FsListComponent, { static: true }]
1131
+ }] } });
1132
+
1133
+ class FsAppMessageTemplatesModule {
1134
+ }
1135
+ FsAppMessageTemplatesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1136
+ FsAppMessageTemplatesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, declarations: [TemplatesComponent,
1137
+ TemplateComponent], imports: [RouterModule,
1138
+ CommonModule,
1139
+ FormsModule,
1140
+ MatTooltipModule,
1141
+ MatDialogModule,
1142
+ MatButtonModule,
1143
+ MatTabsModule,
1144
+ MatFormFieldModule,
1145
+ MatFormFieldModule,
1146
+ MatInputModule,
1147
+ FsListModule,
1148
+ FsDialogModule,
1149
+ FsLabelModule,
1150
+ FsSkeletonModule,
1151
+ FsFormModule,
1152
+ FsTextEditorModule,
1153
+ FsAppMessagePreviewModule], exports: [TemplatesComponent,
1154
+ TemplateComponent] });
1155
+ FsAppMessageTemplatesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, imports: [[
1156
+ RouterModule,
1157
+ CommonModule,
1158
+ FormsModule,
1159
+ MatTooltipModule,
1160
+ MatDialogModule,
1161
+ MatButtonModule,
1162
+ MatTabsModule,
1163
+ MatFormFieldModule,
1164
+ MatFormFieldModule,
1165
+ MatInputModule,
1166
+ FsListModule,
1167
+ FsDialogModule,
1168
+ FsLabelModule,
1169
+ FsSkeletonModule,
1170
+ FsFormModule,
1171
+ FsTextEditorModule,
1172
+ FsAppMessagePreviewModule,
1173
+ ]] });
1174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, decorators: [{
1175
+ type: NgModule,
1176
+ args: [{
1177
+ imports: [
1178
+ RouterModule,
1179
+ CommonModule,
1180
+ FormsModule,
1181
+ MatTooltipModule,
1182
+ MatDialogModule,
1183
+ MatButtonModule,
1184
+ MatTabsModule,
1185
+ MatFormFieldModule,
1186
+ MatFormFieldModule,
1187
+ MatInputModule,
1188
+ FsListModule,
1189
+ FsDialogModule,
1190
+ FsLabelModule,
1191
+ FsSkeletonModule,
1192
+ FsFormModule,
1193
+ FsTextEditorModule,
1194
+ FsAppMessagePreviewModule,
1195
+ ],
1196
+ declarations: [
1197
+ TemplatesComponent,
1198
+ TemplateComponent,
1199
+ ],
1200
+ exports: [
1201
+ TemplatesComponent,
1202
+ TemplateComponent,
1203
+ ],
1204
+ }]
1205
+ }] });
1206
+
1207
+ class WebhooksComponent {
1208
+ constructor(_config, _message) {
1209
+ this._config = _config;
1210
+ this._message = _message;
1211
+ }
1212
+ ngOnInit() {
1213
+ this.listConfig = {
1214
+ paging: false,
1215
+ actions: [
1216
+ {
1217
+ click: () => {
1218
+ this._config.createWebhook()
1219
+ .subscribe(() => {
1220
+ this._message.success('Created webhook');
1221
+ this.list.reload();
1222
+ });
1223
+ },
1224
+ label: 'Create',
1225
+ },
1226
+ ],
1227
+ rowActions: [
1228
+ {
1229
+ click: (webhook) => {
1230
+ this._config.deleteWebhook(webhook)
1231
+ .subscribe(() => {
1232
+ this._message.success('Deleted webhook');
1233
+ this.list.reload();
1234
+ });
1235
+ },
1236
+ label: 'Delete',
1237
+ },
1238
+ ],
1239
+ fetch: () => {
1240
+ return this._config.loadWebhooks()
1241
+ .pipe(map((webhooks) => ({ data: webhooks })));
1242
+ },
1243
+ };
1244
+ }
1245
+ }
1246
+ WebhooksComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: WebhooksComponent, deps: [{ token: FS_APP_MESSAGE_CONFIG }, { token: i1$1.FsMessage }], target: i0.ɵɵFactoryTarget.Component });
1247
+ WebhooksComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: WebhooksComponent, selector: "fs-app-message-webhooks", viewQueries: [{ propertyName: "list", first: true, predicate: FsListComponent, descendants: true }], ngImport: i0, template: "<fs-list [config]=\"listConfig\">\r\n <fs-list-column title=\"URL\">\r\n <ng-template fs-list-cell let-row=\"row\">\r\n {{row.url}}\r\n </ng-template>\r\n </fs-list-column>\r\n <fs-list-column title=\"Created\">\r\n <ng-template fs-list-cell let-row=\"row\">\r\n {{row.createDate | fsDate}}\r\n </ng-template>\r\n </fs-list-column>\r\n</fs-list>", components: [{ type: i2$1.FsListComponent, selector: "fs-list", inputs: ["config", "loaderLines"], outputs: ["filtersReady"] }], directives: [{ type: i2$1.FsListColumnDirective, selector: "fs-list-column", inputs: ["show", "title", "name", "customize", "sortable", "sortableDefault", "direction", "align", "width", "class"] }, { type: i2$1.FsListCellDirective, selector: "[fs-list-cell]", inputs: ["colspan", "align", "class"] }], pipes: { "fsDate": i10$1.FsDatePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: WebhooksComponent, decorators: [{
1249
+ type: Component,
1250
+ args: [{ selector: 'fs-app-message-webhooks', changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-list [config]=\"listConfig\">\r\n <fs-list-column title=\"URL\">\r\n <ng-template fs-list-cell let-row=\"row\">\r\n {{row.url}}\r\n </ng-template>\r\n </fs-list-column>\r\n <fs-list-column title=\"Created\">\r\n <ng-template fs-list-cell let-row=\"row\">\r\n {{row.createDate | fsDate}}\r\n </ng-template>\r\n </fs-list-column>\r\n</fs-list>" }]
1251
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1252
+ type: Inject,
1253
+ args: [FS_APP_MESSAGE_CONFIG]
1254
+ }] }, { type: i1$1.FsMessage }]; }, propDecorators: { list: [{
1255
+ type: ViewChild,
1256
+ args: [FsListComponent]
1257
+ }] } });
1258
+
1259
+ class FsAppMessageWebhooksModule {
1260
+ }
1261
+ FsAppMessageWebhooksModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1262
+ FsAppMessageWebhooksModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, declarations: [WebhooksComponent], imports: [FsListModule,
1263
+ FsDateModule], exports: [WebhooksComponent] });
1264
+ FsAppMessageWebhooksModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, imports: [[
1265
+ FsListModule,
1266
+ FsDateModule,
1267
+ ]] });
1268
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, decorators: [{
1269
+ type: NgModule,
1270
+ args: [{
1271
+ imports: [
1272
+ FsListModule,
1273
+ FsDateModule,
1274
+ ],
1275
+ declarations: [
1276
+ WebhooksComponent,
1277
+ ],
1278
+ exports: [
1279
+ WebhooksComponent,
1280
+ ],
1281
+ }]
1282
+ }] });
1283
+
1284
+ /**
1285
+ * Generated bundle index. Do not edit.
1286
+ */
1287
+
1288
+ export { FS_APP_MESSAGE_CONFIG, FsAppMessageModule, FsAppMessageQueuesModule, FsAppMessageTemplatesModule, FsAppMessageWebhooksModule, FsAppMessagesModule, FsMessageQueueService, MessageComponent, MessagesComponent, QueueComponent, QueuesComponent, TemplateComponent, TemplatesComponent, WebhooksComponent };
1289
+ //# sourceMappingURL=firestitch-app-message.mjs.map