@firestitch/app-message 13.0.0 → 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,1286 @@
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 { tap, switchMap, map, takeUntil } from 'rxjs/operators';
52
+ import { Subject, of } from 'rxjs';
53
+ import * as i1$1 from '@firestitch/message';
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 () {
89
+ return [{ type: undefined, decorators: [{
90
+ type: Inject,
91
+ args: [MAT_DIALOG_DATA]
92
+ }] }];
93
+ } });
94
+
95
+ class FsAppMessagePreviewModule {
96
+ }
97
+ FsAppMessagePreviewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagePreviewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
98
+ FsAppMessagePreviewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagePreviewModule, declarations: [PreviewComponent], imports: [MatDialogModule,
99
+ MatButtonModule,
100
+ FsDialogModule,
101
+ FsIFrameModule], exports: [PreviewComponent] });
102
+ FsAppMessagePreviewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagePreviewModule, imports: [[
103
+ MatDialogModule,
104
+ MatButtonModule,
105
+ FsDialogModule,
106
+ FsIFrameModule,
107
+ ]] });
108
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagePreviewModule, decorators: [{
109
+ type: NgModule,
110
+ args: [{
111
+ imports: [
112
+ MatDialogModule,
113
+ MatButtonModule,
114
+ FsDialogModule,
115
+ FsIFrameModule,
116
+ ],
117
+ declarations: [
118
+ PreviewComponent,
119
+ ],
120
+ exports: [
121
+ PreviewComponent,
122
+ ]
123
+ }]
124
+ }] });
125
+
126
+ const FS_APP_MESSAGE_ROOT_CONFIG = new InjectionToken('fs-app-message-root-config');
127
+ const FS_APP_MESSAGE_CONFIG = new InjectionToken('fs-app-message-config');
128
+
129
+ var EmailMessageFormat;
130
+ (function (EmailMessageFormat) {
131
+ EmailMessageFormat["Text"] = "T";
132
+ EmailMessageFormat["HTML"] = "H";
133
+ EmailMessageFormat["RichText"] = "R";
134
+ })(EmailMessageFormat || (EmailMessageFormat = {}));
135
+
136
+ const EmailMessageFormats = [
137
+ { name: 'Text', value: EmailMessageFormat.Text },
138
+ { name: 'HTML', value: EmailMessageFormat.HTML },
139
+ { name: 'Rich Text', value: EmailMessageFormat.RichText }
140
+ ];
141
+
142
+ class AttachmentsComponent {
143
+ constructor(_config, _message) {
144
+ this._config = _config;
145
+ this._message = _message;
146
+ this.list = null;
147
+ this.config = null;
148
+ this._destroy$ = new Subject();
149
+ }
150
+ ngOnInit() {
151
+ this.config = {
152
+ rowActions: [],
153
+ actions: [
154
+ {
155
+ label: 'Upload',
156
+ mode: ActionMode.File,
157
+ select: (fsFile) => {
158
+ this._config.uploadMessageAttachment(this.message, fsFile)
159
+ .subscribe(() => {
160
+ this._message.success('Saved attachment');
161
+ this.list.reload();
162
+ });
163
+ }
164
+ }
165
+ ],
166
+ fetch: query => {
167
+ return this._config.loadMessageAttachments(this.message, query);
168
+ }
169
+ };
170
+ if (this._config.downloadMessageAttachment) {
171
+ this.config.rowActions
172
+ .push({
173
+ click: data => {
174
+ return this._config.downloadMessageAttachment(data);
175
+ },
176
+ label: 'Download',
177
+ });
178
+ }
179
+ if (this._config.deleteMessageAttachment) {
180
+ this.config.rowActions
181
+ .push({
182
+ click: data => {
183
+ return this._config.deleteMessageAttachment(data);
184
+ },
185
+ remove: {
186
+ title: 'Confirm',
187
+ template: 'Are you sure you would like to delete this template?',
188
+ },
189
+ label: 'Delete',
190
+ });
191
+ }
192
+ }
193
+ ngOnDestroy() {
194
+ this._destroy$.next();
195
+ this._destroy$.complete();
196
+ }
197
+ }
198
+ 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 });
199
+ 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 });
200
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AttachmentsComponent, decorators: [{
201
+ type: Component,
202
+ 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>" }]
203
+ }], ctorParameters: function () {
204
+ return [{ type: undefined, decorators: [{
205
+ type: Inject,
206
+ args: [FS_APP_MESSAGE_CONFIG]
207
+ }] }, { type: i1$1.FsMessage }];
208
+ }, propDecorators: { list: [{
209
+ type: ViewChild,
210
+ args: [FsListComponent, { static: true }]
211
+ }], message: [{
212
+ type: Input
213
+ }] } });
214
+
215
+ class MessageComponent {
216
+ constructor(_config, _data, _prompt, _message, _dialog, _cdRef) {
217
+ this._config = _config;
218
+ this._data = _data;
219
+ this._prompt = _prompt;
220
+ this._message = _message;
221
+ this._dialog = _dialog;
222
+ this._cdRef = _cdRef;
223
+ this.tab = 'general';
224
+ this.messageTemplates = [];
225
+ this.emailMessageFormats = EmailMessageFormats;
226
+ this.emailMessageFormat = EmailMessageFormat;
227
+ this.save = () => {
228
+ return this._config.saveMessage(this.message)
229
+ .pipe(tap(() => {
230
+ this._message.success('Saved Changes');
231
+ }));
232
+ };
233
+ }
234
+ ngOnInit() {
235
+ this._config.loadMessage(this._data.message)
236
+ .subscribe((message) => {
237
+ this.message = message;
238
+ if (this.message.emailMessage && this.message.emailMessage.customize === undefined) {
239
+ this.message.emailMessage.customize = true;
240
+ }
241
+ if (this.message.smsMessage && this.message.smsMessage.customize === undefined) {
242
+ this.message.smsMessage.customize = true;
243
+ }
244
+ this.message.reference = String(message.tag)
245
+ .toLocaleLowerCase()
246
+ .split('_')
247
+ .map((item) => item.charAt(0).toUpperCase() + item.slice(1))
248
+ .join('');
249
+ this._cdRef.markForCheck();
250
+ });
251
+ this._config.loadMessageTemplates()
252
+ .subscribe((data) => {
253
+ this.messageTemplates = data.data;
254
+ this._cdRef.markForCheck();
255
+ });
256
+ }
257
+ openPreview() {
258
+ const emailMessage = this.message.emailMessage;
259
+ let html = emailMessage.customize ? emailMessage.body : this.message.defaultEmailBody;
260
+ let styles = emailMessage.styles || '';
261
+ if (emailMessage.messageTemplateId) {
262
+ const messageTemplate = this.messageTemplates
263
+ .find((item) => {
264
+ return emailMessage.messageTemplateId === item.id;
265
+ });
266
+ if (messageTemplate) {
267
+ html = messageTemplate.content.replace('{$content}', html);
268
+ styles = `${messageTemplate.styles || ''}\n\n${styles}`;
269
+ }
270
+ }
271
+ this._dialog.open(PreviewComponent, {
272
+ data: {
273
+ styles,
274
+ html,
275
+ },
276
+ width: '95%'
277
+ });
278
+ }
279
+ sendTest(type) {
280
+ of(true)
281
+ .pipe(switchMap(() => {
282
+ return type === 'email' ? this._config.getTestEmail() : of('');
283
+ }), switchMap((default_) => {
284
+ const typeName = type === 'email' ? 'an email' : 'phone number';
285
+ return this._prompt.input({
286
+ label: `Please enter ${typeName} to send test to`,
287
+ title: 'Send Test',
288
+ commitLabel: 'Send',
289
+ default: default_,
290
+ required: true
291
+ });
292
+ }))
293
+ .subscribe((value) => {
294
+ this._config.testMessage(this.message, value, type)
295
+ .subscribe(() => {
296
+ this._message.success('Test Sent');
297
+ });
298
+ });
299
+ }
300
+ }
301
+ 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 });
302
+ 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 });
303
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MessageComponent, decorators: [{
304
+ type: Component,
305
+ 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"] }]
306
+ }], ctorParameters: function () {
307
+ return [{ type: undefined, decorators: [{
308
+ type: Inject,
309
+ args: [FS_APP_MESSAGE_CONFIG]
310
+ }] }, { type: undefined, decorators: [{
311
+ type: Inject,
312
+ args: [MAT_DIALOG_DATA]
313
+ }] }, { type: i1$2.FsPrompt }, { type: i1$1.FsMessage }, { type: i1.MatDialog }, { type: i0.ChangeDetectorRef }];
314
+ } });
315
+
316
+ function indexNameValue(arry) {
317
+ const obj = {};
318
+ arry.forEach(item => {
319
+ obj[item.value] = item.name;
320
+ });
321
+ return obj;
322
+ }
323
+
324
+ class MessagesComponent {
325
+ constructor(_config, _dialog) {
326
+ this._config = _config;
327
+ this._dialog = _dialog;
328
+ this.list = null;
329
+ this.config = null;
330
+ this.emailMessageFormats = {};
331
+ this._destroy$ = new Subject();
332
+ }
333
+ ngOnInit() {
334
+ this.emailMessageFormats = indexNameValue(EmailMessageFormats);
335
+ this.config = {
336
+ filters: [
337
+ {
338
+ name: 'keyword',
339
+ type: ItemType.Keyword,
340
+ label: 'Search'
341
+ }
342
+ ],
343
+ fetch: query => {
344
+ return this._config.loadMessages(query)
345
+ .pipe(map(response => {
346
+ return ({ data: response.data, paging: response.paging });
347
+ }));
348
+ }
349
+ };
350
+ }
351
+ open(message) {
352
+ const dialogRef = this._dialog.open(MessageComponent, {
353
+ data: {
354
+ message: message,
355
+ },
356
+ width: '85%'
357
+ });
358
+ dialogRef.afterClosed()
359
+ .pipe(takeUntil(this._destroy$))
360
+ .subscribe(() => {
361
+ this.list.reload();
362
+ });
363
+ }
364
+ ngOnDestroy() {
365
+ this._destroy$.next();
366
+ this._destroy$.complete();
367
+ }
368
+ }
369
+ 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 });
370
+ 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"] }] });
371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: MessagesComponent, decorators: [{
372
+ type: Component,
373
+ 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" }]
374
+ }], ctorParameters: function () {
375
+ return [{ type: undefined, decorators: [{
376
+ type: Inject,
377
+ args: [FS_APP_MESSAGE_CONFIG]
378
+ }] }, { type: i1.MatDialog }];
379
+ }, propDecorators: { list: [{
380
+ type: ViewChild,
381
+ args: [FsListComponent, { static: true }]
382
+ }] } });
383
+
384
+ class FsAppMessagesModule {
385
+ }
386
+ FsAppMessagesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
387
+ FsAppMessagesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagesModule, declarations: [MessagesComponent,
388
+ MessageComponent,
389
+ AttachmentsComponent], imports: [RouterModule,
390
+ CommonModule,
391
+ FormsModule,
392
+ MatDialogModule,
393
+ MatButtonModule,
394
+ MatTabsModule,
395
+ MatFormFieldModule,
396
+ MatInputModule,
397
+ MatOptionModule,
398
+ MatSelectModule,
399
+ MatTooltipModule,
400
+ MatCheckboxModule,
401
+ FsDialogModule,
402
+ FsListModule,
403
+ FsLabelModule,
404
+ FsSkeletonModule,
405
+ FsFormModule,
406
+ FsTextEditorModule,
407
+ FsHtmlEditorModule,
408
+ FsHtmlRendererModule,
409
+ FsCommonModule,
410
+ FsTabsModule,
411
+ FsAppMessagePreviewModule], exports: [MessagesComponent,
412
+ MessageComponent] });
413
+ FsAppMessagesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagesModule, imports: [[
414
+ RouterModule,
415
+ CommonModule,
416
+ FormsModule,
417
+ MatDialogModule,
418
+ MatButtonModule,
419
+ MatTabsModule,
420
+ MatFormFieldModule,
421
+ MatInputModule,
422
+ MatOptionModule,
423
+ MatSelectModule,
424
+ MatTooltipModule,
425
+ MatCheckboxModule,
426
+ FsDialogModule,
427
+ FsListModule,
428
+ FsLabelModule,
429
+ FsSkeletonModule,
430
+ FsFormModule,
431
+ FsTextEditorModule,
432
+ FsHtmlEditorModule,
433
+ FsHtmlRendererModule,
434
+ FsCommonModule,
435
+ FsTabsModule,
436
+ FsAppMessagePreviewModule,
437
+ ]] });
438
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessagesModule, decorators: [{
439
+ type: NgModule,
440
+ args: [{
441
+ imports: [
442
+ RouterModule,
443
+ CommonModule,
444
+ FormsModule,
445
+ MatDialogModule,
446
+ MatButtonModule,
447
+ MatTabsModule,
448
+ MatFormFieldModule,
449
+ MatInputModule,
450
+ MatOptionModule,
451
+ MatSelectModule,
452
+ MatTooltipModule,
453
+ MatCheckboxModule,
454
+ FsDialogModule,
455
+ FsListModule,
456
+ FsLabelModule,
457
+ FsSkeletonModule,
458
+ FsFormModule,
459
+ FsTextEditorModule,
460
+ FsHtmlEditorModule,
461
+ FsHtmlRendererModule,
462
+ FsCommonModule,
463
+ FsTabsModule,
464
+ FsAppMessagePreviewModule,
465
+ ],
466
+ declarations: [
467
+ MessagesComponent,
468
+ MessageComponent,
469
+ AttachmentsComponent,
470
+ ],
471
+ exports: [
472
+ MessagesComponent,
473
+ MessageComponent,
474
+ ],
475
+ }]
476
+ }] });
477
+
478
+ var MessageQueueState;
479
+ (function (MessageQueueState) {
480
+ MessageQueueState["Sent"] = "S";
481
+ MessageQueueState["PartiallySent"] = "P";
482
+ MessageQueueState["Sending"] = "E";
483
+ MessageQueueState["Queued"] = "Q";
484
+ MessageQueueState["Canceled"] = "C";
485
+ MessageQueueState["InvalidRecipients"] = "I";
486
+ MessageQueueState["Failed"] = "F";
487
+ })(MessageQueueState || (MessageQueueState = {}));
488
+
489
+ const MessageQueueStates = [
490
+ { name: 'Sent', value: MessageQueueState.Sent },
491
+ { name: 'Partially Sent', value: MessageQueueState.PartiallySent },
492
+ { name: 'Sending', value: MessageQueueState.Sending },
493
+ { name: 'Queued', value: MessageQueueState.Queued },
494
+ { name: 'Canceled', value: MessageQueueState.Canceled },
495
+ { name: 'Invalid Recipients', value: MessageQueueState.InvalidRecipients },
496
+ { name: 'Failed', value: MessageQueueState.Failed }
497
+ ];
498
+
499
+ var EmailMessageQueueFormat;
500
+ (function (EmailMessageQueueFormat) {
501
+ EmailMessageQueueFormat["Text"] = "T";
502
+ EmailMessageQueueFormat["HTML"] = "H";
503
+ EmailMessageQueueFormat["RichText"] = "R";
504
+ })(EmailMessageQueueFormat || (EmailMessageQueueFormat = {}));
505
+
506
+ var MessageQueueType;
507
+ (function (MessageQueueType) {
508
+ MessageQueueType["Sms"] = "S";
509
+ MessageQueueType["Email"] = "E";
510
+ })(MessageQueueType || (MessageQueueType = {}));
511
+
512
+ var MessageQueueEventType;
513
+ (function (MessageQueueEventType) {
514
+ MessageQueueEventType["Click"] = "click";
515
+ MessageQueueEventType["Open"] = "open";
516
+ })(MessageQueueEventType || (MessageQueueEventType = {}));
517
+
518
+ const MessageQueueEventTypes = [
519
+ { name: 'Open', value: MessageQueueEventType.Open },
520
+ { name: 'Click', value: MessageQueueEventType.Click },
521
+ ];
522
+
523
+ class RecipientComponent {
524
+ ngOnInit() {
525
+ const icons = {
526
+ 'S': { name: 'check_circle', tooltip: 'Sent' },
527
+ 'E': { name: 'offline_bolt', tooltip: 'Sending' },
528
+ 'F': { name: 'info', tooltip: 'Failed' },
529
+ };
530
+ this.icon = icons[this.state];
531
+ }
532
+ }
533
+ RecipientComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: RecipientComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
534
+ 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 });
535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: RecipientComponent, decorators: [{
536
+ type: Component,
537
+ 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"] }]
538
+ }], propDecorators: { name: [{
539
+ type: Input
540
+ }], state: [{
541
+ type: Input
542
+ }] } });
543
+
544
+ class QueueComponent {
545
+ constructor(_config, _data, _message, _prompt, _dialog, _cdRef) {
546
+ this._config = _config;
547
+ this._data = _data;
548
+ this._message = _message;
549
+ this._prompt = _prompt;
550
+ this._dialog = _dialog;
551
+ this._cdRef = _cdRef;
552
+ this.messageQueueRecipients = {};
553
+ this.emailMessageQueueFormat = EmailMessageQueueFormat;
554
+ this.MessageQueueEventTypes = indexNameValue(MessageQueueEventTypes);
555
+ this.MessageQueueEventType = MessageQueueEventType;
556
+ this._destroy$ = new Subject();
557
+ }
558
+ ngOnInit() {
559
+ this.messageQueueStates = indexNameValue(MessageQueueStates);
560
+ this.resendMessageQueue = this._config.resendMessageQueue;
561
+ this.forwardMessageQueue = this._config.forwardMessageQueue;
562
+ this._config.loadMessageQueue(this._data.messageQueueId)
563
+ .subscribe((messageQueue) => {
564
+ this.messageQueue = messageQueue;
565
+ if (this.messageQueue.emailMessageQueue) {
566
+ let body = this.messageQueue.emailMessageQueue.body;
567
+ if (this.messageQueue.emailMessageQueue.format === EmailMessageQueueFormat.HTML) {
568
+ try {
569
+ const doc = new DOMParser().parseFromString(body, 'text/html');
570
+ doc.querySelectorAll('a').forEach((el) => {
571
+ el.setAttribute('target', '_blank');
572
+ });
573
+ body = doc.documentElement.innerHTML;
574
+ }
575
+ catch (e) {
576
+ }
577
+ }
578
+ else {
579
+ body = this.anchorMe(body);
580
+ }
581
+ this.messageQueue.emailMessageQueue.body = body;
582
+ }
583
+ if (this.messageQueue.smsMessageQueue) {
584
+ this.messageQueue.smsMessageQueue.body = this.anchorMe(this.messageQueue.smsMessageQueue.body);
585
+ }
586
+ this.messageQueueRecipients = this.messageQueue.messageQueueRecipients
587
+ .reduce((accum, messageQueueRecipient) => {
588
+ accum[messageQueueRecipient.recipient] = messageQueueRecipient.state;
589
+ return accum;
590
+ }, {});
591
+ this._setLogsConfig(messageQueue);
592
+ this._setAttachmentsConfig(messageQueue);
593
+ this._setEventsConfig(messageQueue);
594
+ this._cdRef.markForCheck();
595
+ });
596
+ }
597
+ anchorMe(input) {
598
+ return anchorme({
599
+ input,
600
+ options: {
601
+ attributes: {
602
+ target: "_blank",
603
+ }
604
+ }
605
+ });
606
+ }
607
+ openMessage(message) {
608
+ this._dialog.open(MessageComponent, {
609
+ data: {
610
+ message: message,
611
+ },
612
+ width: '85%'
613
+ });
614
+ }
615
+ resend() {
616
+ this._prompt.confirm({
617
+ title: 'Confirm',
618
+ template: 'Are you sure you would like to resend this message?'
619
+ }).subscribe(() => {
620
+ this.resendMessageQueue(this.messageQueue)
621
+ .subscribe(messageQueue => {
622
+ Object.assign(this.messageQueue, messageQueue);
623
+ this._cdRef.markForCheck();
624
+ this._message.success('Successfully resent');
625
+ if (this.logList) {
626
+ this.logList.reload();
627
+ }
628
+ });
629
+ });
630
+ }
631
+ forward() {
632
+ const typeName = this.messageQueue.type === MessageQueueType.Email ? 'an email' : 'a phone number';
633
+ this._prompt.input({
634
+ label: `Please enter ${typeName} to forward to`,
635
+ title: 'Forward Message',
636
+ commitLabel: 'Forward',
637
+ required: true
638
+ }).subscribe((value) => {
639
+ if (value) {
640
+ this.forwardMessageQueue(this.messageQueue, value)
641
+ .subscribe(messageQueue => {
642
+ this.messageQueue = Object.assign(Object.assign({}, this.messageQueue), { messageQueue });
643
+ this._message.success('Successfully forwarded');
644
+ this._cdRef.markForCheck();
645
+ if (this.logList) {
646
+ this.logList.reload();
647
+ }
648
+ });
649
+ }
650
+ });
651
+ }
652
+ ngOnDestroy() {
653
+ this._destroy$.next();
654
+ this._destroy$.complete();
655
+ }
656
+ _setLogsConfig(messageQueue) {
657
+ this.logConfig = {
658
+ loadMore: true,
659
+ queryParam: false,
660
+ fetch: query => {
661
+ return this._config.loadLogs(messageQueue, query);
662
+ }
663
+ };
664
+ }
665
+ _setEventsConfig(messageQueue) {
666
+ this.eventConfig = {
667
+ loadMore: true,
668
+ queryParam: false,
669
+ fetch: (query) => {
670
+ return this._config.loadMessageQueueEvents(messageQueue, query);
671
+ }
672
+ };
673
+ }
674
+ _setAttachmentsConfig(messageQueue) {
675
+ this.attachmentConfig = {
676
+ queryParam: false,
677
+ fetch: query => {
678
+ return this._config.loadMessageQueueAttachments(messageQueue, query)
679
+ .pipe(map(response => ({
680
+ data: response.data.map(value => {
681
+ value.prettyFilesize = this._prettyFilesize(value.filesize);
682
+ return value;
683
+ }), paging: response.paging
684
+ })));
685
+ }
686
+ };
687
+ if (this._config.downloadMessageQueueAttachment) {
688
+ this.attachmentConfig.rowActions = [
689
+ {
690
+ click: (messageAttachment) => {
691
+ this._config.downloadMessageQueueAttachment(messageAttachment, this.messageQueue);
692
+ },
693
+ label: 'Download',
694
+ }
695
+ ];
696
+ }
697
+ }
698
+ _prettyFilesize(bytes) {
699
+ if (bytes === 0) {
700
+ return '0.00 B';
701
+ }
702
+ const e = Math.floor(Math.log(bytes) / Math.log(1024));
703
+ return (bytes / Math.pow(1024, e)).toFixed(2) + ' ' + ' KMGTP'.charAt(e) + 'B';
704
+ }
705
+ }
706
+ 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 });
707
+ 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 });
708
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: QueueComponent, decorators: [{
709
+ type: Component,
710
+ 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"] }]
711
+ }], ctorParameters: function () {
712
+ return [{ type: undefined, decorators: [{
713
+ type: Inject,
714
+ args: [FS_APP_MESSAGE_CONFIG]
715
+ }] }, { type: undefined, decorators: [{
716
+ type: Inject,
717
+ args: [MAT_DIALOG_DATA]
718
+ }] }, { type: i1$1.FsMessage }, { type: i1$2.FsPrompt }, { type: i1.MatDialog }, { type: i0.ChangeDetectorRef }];
719
+ }, propDecorators: { logList: [{
720
+ type: ViewChild,
721
+ args: ['logList']
722
+ }] } });
723
+
724
+ class FsMessageQueueService {
725
+ constructor(_dialog) {
726
+ this._dialog = _dialog;
727
+ }
728
+ openMessageQueue(messageQueueId, options = {}) {
729
+ return this._dialog.open(QueueComponent, Object.assign(Object.assign({}, options), { data: {
730
+ messageQueueId,
731
+ }, width: options.width || '85%' }))
732
+ .afterClosed();
733
+ }
734
+ }
735
+ FsMessageQueueService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMessageQueueService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
736
+ FsMessageQueueService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMessageQueueService, providedIn: 'root' });
737
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMessageQueueService, decorators: [{
738
+ type: Injectable,
739
+ args: [{
740
+ providedIn: 'root',
741
+ }]
742
+ }], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
743
+
744
+ class TruncatePipe {
745
+ transform(value, limit = 25, completeWords = false, ellipsis = '...') {
746
+ if (value.length < limit) {
747
+ return `${value.substr(0, limit)}`;
748
+ }
749
+ if (completeWords) {
750
+ limit = value.substr(0, limit).lastIndexOf(' ');
751
+ }
752
+ return `${value.substr(0, limit)}${ellipsis}`;
753
+ }
754
+ }
755
+ TruncatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TruncatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
756
+ TruncatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TruncatePipe, name: "truncate" });
757
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TruncatePipe, decorators: [{
758
+ type: Pipe,
759
+ args: [{
760
+ name: 'truncate'
761
+ }]
762
+ }] });
763
+
764
+ class QueuesComponent {
765
+ constructor(_config, _messageQueueService) {
766
+ this._config = _config;
767
+ this._messageQueueService = _messageQueueService;
768
+ this.list = null;
769
+ this.query = {};
770
+ this.config = null;
771
+ this.messageQueueStates = {};
772
+ this.MessageQueueState = MessageQueueState;
773
+ this._destroy$ = new Subject();
774
+ }
775
+ ngOnInit() {
776
+ this.messageQueueStates = indexNameValue(MessageQueueStates);
777
+ this.config = {
778
+ filters: [
779
+ {
780
+ name: 'keyword',
781
+ type: ItemType.Keyword,
782
+ label: 'Search',
783
+ },
784
+ {
785
+ name: 'state',
786
+ type: ItemType.Select,
787
+ label: 'Status',
788
+ values: () => {
789
+ return MessageQueueStates;
790
+ },
791
+ },
792
+ {
793
+ name: 'date',
794
+ type: ItemType.DateRange,
795
+ label: ['From Date', 'To Date'],
796
+ },
797
+ ],
798
+ sort: { value: 'created_date', direction: 'desc' },
799
+ fetch: (query) => {
800
+ query = Object.assign(Object.assign(Object.assign({}, query), this.query), { messageQueueAttachmentCounts: true, emailMessageQueues: true, emailMessageQueueBodies: false, smsMessageQueues: true });
801
+ return this._config.loadMessageQueues(query)
802
+ .pipe(map((response) => ({
803
+ data: response.data
804
+ .map((messageQueue) => {
805
+ return Object.assign(Object.assign({}, messageQueue), { scheduled: messageQueue.state === MessageQueueState.Queued && isAfter(messageQueue.scheduledDate, new Date()), messageQueueRecipients: messageQueue.messageQueueRecipients
806
+ .reduce((accum, messageQueueRecipient) => {
807
+ accum[messageQueueRecipient.recipient] = messageQueueRecipient.state;
808
+ return accum;
809
+ }, {}) });
810
+ }), paging: response.paging,
811
+ })));
812
+ },
813
+ };
814
+ if (this._config.bulkMessageQueues) {
815
+ this.config.selection = {
816
+ selectAll: false,
817
+ actions: [
818
+ {
819
+ type: SelectionActionType.Action,
820
+ name: 'queue',
821
+ label: 'Queue',
822
+ },
823
+ {
824
+ type: SelectionActionType.Action,
825
+ name: 'resend',
826
+ label: 'Resend',
827
+ },
828
+ {
829
+ type: SelectionActionType.Action,
830
+ name: 'cancel',
831
+ label: 'Cancel',
832
+ },
833
+ ],
834
+ actionSelected: (actionSelected) => {
835
+ return this._config.bulkMessageQueues(actionSelected.action.name, actionSelected.selected)
836
+ .pipe(tap(() => {
837
+ this.list.reload();
838
+ }));
839
+ },
840
+ };
841
+ }
842
+ this.config.filters.push({
843
+ name: 'message_id',
844
+ type: ItemType.Select,
845
+ label: 'Message Type',
846
+ values: (query) => {
847
+ query = Object.assign(Object.assign({}, query), { limit: 50 });
848
+ return this._config.loadMessages(query)
849
+ .pipe(map((response) => {
850
+ return [
851
+ { value: null, name: 'All' },
852
+ ...response.data
853
+ .map((item) => ({ name: item.name, value: item.id })),
854
+ ];
855
+ }));
856
+ },
857
+ });
858
+ }
859
+ open(messageQueue) {
860
+ this._messageQueueService.openMessageQueue(messageQueue.id)
861
+ .pipe(takeUntil(this._destroy$))
862
+ .subscribe(() => {
863
+ this.list.reload();
864
+ });
865
+ }
866
+ ngOnDestroy() {
867
+ this._destroy$.next();
868
+ this._destroy$.complete();
869
+ }
870
+ }
871
+ 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 });
872
+ 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 });
873
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: QueuesComponent, decorators: [{
874
+ type: Component,
875
+ 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"] }]
876
+ }], ctorParameters: function () {
877
+ return [{ type: undefined, decorators: [{
878
+ type: Inject,
879
+ args: [FS_APP_MESSAGE_CONFIG]
880
+ }] }, { type: FsMessageQueueService }];
881
+ }, propDecorators: { list: [{
882
+ type: ViewChild,
883
+ args: [FsListComponent, { static: true }]
884
+ }], query: [{
885
+ type: Input
886
+ }] } });
887
+
888
+ class LinkifyPipe {
889
+ transform(input) {
890
+ return anchorme({
891
+ input,
892
+ options: {
893
+ attributes: {
894
+ target: "_blank",
895
+ }
896
+ }
897
+ });
898
+ }
899
+ }
900
+ LinkifyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: LinkifyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
901
+ LinkifyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: LinkifyPipe, name: "linkify" });
902
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: LinkifyPipe, decorators: [{
903
+ type: Pipe,
904
+ args: [{ name: 'linkify' }]
905
+ }] });
906
+
907
+ class FsAppMessageQueuesModule {
908
+ }
909
+ FsAppMessageQueuesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
910
+ FsAppMessageQueuesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, declarations: [QueuesComponent,
911
+ QueueComponent,
912
+ LinkifyPipe,
913
+ TruncatePipe,
914
+ RecipientComponent], imports: [RouterModule,
915
+ FormsModule,
916
+ CommonModule,
917
+ MatTooltipModule,
918
+ MatDialogModule,
919
+ MatButtonModule,
920
+ MatIconModule,
921
+ MatTabsModule,
922
+ FsListModule,
923
+ FsDialogModule,
924
+ FsLabelModule,
925
+ FsDateModule,
926
+ FsSkeletonModule,
927
+ FsAppMessagesModule,
928
+ FsFormModule,
929
+ FsPromptInputModule,
930
+ FsIFrameModule], exports: [QueuesComponent,
931
+ QueueComponent] });
932
+ FsAppMessageQueuesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, providers: [
933
+ FsMessageQueueService,
934
+ ], imports: [[
935
+ RouterModule,
936
+ FormsModule,
937
+ CommonModule,
938
+ MatTooltipModule,
939
+ MatDialogModule,
940
+ MatButtonModule,
941
+ MatIconModule,
942
+ MatTabsModule,
943
+ FsListModule,
944
+ FsDialogModule,
945
+ FsLabelModule,
946
+ FsDateModule,
947
+ FsSkeletonModule,
948
+ FsAppMessagesModule,
949
+ FsFormModule,
950
+ FsPromptInputModule,
951
+ FsIFrameModule,
952
+ ]] });
953
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, decorators: [{
954
+ type: NgModule,
955
+ args: [{
956
+ imports: [
957
+ RouterModule,
958
+ FormsModule,
959
+ CommonModule,
960
+ MatTooltipModule,
961
+ MatDialogModule,
962
+ MatButtonModule,
963
+ MatIconModule,
964
+ MatTabsModule,
965
+ FsListModule,
966
+ FsDialogModule,
967
+ FsLabelModule,
968
+ FsDateModule,
969
+ FsSkeletonModule,
970
+ FsAppMessagesModule,
971
+ FsFormModule,
972
+ FsPromptInputModule,
973
+ FsIFrameModule,
974
+ ],
975
+ declarations: [
976
+ QueuesComponent,
977
+ QueueComponent,
978
+ LinkifyPipe,
979
+ TruncatePipe,
980
+ RecipientComponent,
981
+ ],
982
+ exports: [
983
+ QueuesComponent,
984
+ QueueComponent,
985
+ ],
986
+ providers: [
987
+ FsMessageQueueService,
988
+ ],
989
+ }]
990
+ }] });
991
+
992
+ class TemplateComponent {
993
+ constructor(_data, _config, _dialogRef, _message, _dialog) {
994
+ this._data = _data;
995
+ this._config = _config;
996
+ this._dialogRef = _dialogRef;
997
+ this._message = _message;
998
+ this._dialog = _dialog;
999
+ this.htmlEditorconfig = {
1000
+ language: 'html',
1001
+ insertSpaces: true,
1002
+ tabSize: 2,
1003
+ };
1004
+ this.cssEditorconfig = {
1005
+ language: 'scss',
1006
+ insertSpaces: true,
1007
+ tabSize: 2,
1008
+ };
1009
+ this.save = (event) => {
1010
+ return this._config.saveMessageTemplate(this.messageTemplate)
1011
+ .pipe(tap((messageTemplate) => {
1012
+ this._message.success('Saved Changes');
1013
+ if (event.submitter === 'save-close') {
1014
+ this._dialogRef.close(messageTemplate);
1015
+ }
1016
+ }));
1017
+ };
1018
+ }
1019
+ ngOnInit() {
1020
+ if (this._data.messageTemplate.id) {
1021
+ this._config.loadMessageTemplate(this._data.messageTemplate)
1022
+ .subscribe(messageTemplate => {
1023
+ this.messageTemplate = messageTemplate;
1024
+ });
1025
+ }
1026
+ else {
1027
+ this.messageTemplate = {};
1028
+ }
1029
+ }
1030
+ openPreview() {
1031
+ this._dialog.open(PreviewComponent, {
1032
+ data: {
1033
+ styles: this.messageTemplate.styles,
1034
+ html: this.messageTemplate.content,
1035
+ },
1036
+ width: '95%',
1037
+ });
1038
+ }
1039
+ }
1040
+ 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 });
1041
+ 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"] }] });
1042
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TemplateComponent, decorators: [{
1043
+ type: Component,
1044
+ 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"] }]
1045
+ }], ctorParameters: function () {
1046
+ return [{ type: undefined, decorators: [{
1047
+ type: Inject,
1048
+ args: [MAT_DIALOG_DATA]
1049
+ }] }, { type: undefined, decorators: [{
1050
+ type: Inject,
1051
+ args: [FS_APP_MESSAGE_CONFIG]
1052
+ }] }, { type: i1.MatDialogRef }, { type: i1$1.FsMessage }, { type: i1.MatDialog }];
1053
+ } });
1054
+
1055
+ class TemplatesComponent {
1056
+ constructor(_config, _dialog) {
1057
+ this._config = _config;
1058
+ this._dialog = _dialog;
1059
+ this.list = null;
1060
+ this.config = null;
1061
+ this.messageQueueStates = [];
1062
+ this._destroy$ = new Subject();
1063
+ }
1064
+ ngOnInit() {
1065
+ this.config = {
1066
+ actions: [
1067
+ {
1068
+ label: 'Create',
1069
+ click: () => {
1070
+ this.open({});
1071
+ }
1072
+ }
1073
+ ],
1074
+ status: false,
1075
+ fetch: query => {
1076
+ return this._config.loadMessageTemplates(query);
1077
+ }
1078
+ };
1079
+ if (this._config.deleteMessageTemplate) {
1080
+ this.config.rowActions = [
1081
+ {
1082
+ click: data => {
1083
+ return this._config.deleteMessageTemplate(data);
1084
+ },
1085
+ remove: {
1086
+ title: 'Confirm',
1087
+ template: 'Are you sure you would like to delete this template?',
1088
+ },
1089
+ menu: true,
1090
+ label: 'Delete',
1091
+ },
1092
+ ];
1093
+ }
1094
+ }
1095
+ open(messageTemplate) {
1096
+ const dialogRef = this._dialog.open(TemplateComponent, {
1097
+ data: {
1098
+ messageTemplate,
1099
+ },
1100
+ width: '85%',
1101
+ });
1102
+ dialogRef.afterClosed()
1103
+ .pipe(takeUntil(this._destroy$))
1104
+ .subscribe(() => {
1105
+ this.list.reload();
1106
+ });
1107
+ }
1108
+ ngOnDestroy() {
1109
+ this._destroy$.next();
1110
+ this._destroy$.complete();
1111
+ }
1112
+ }
1113
+ 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 });
1114
+ 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"] }] });
1115
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TemplatesComponent, decorators: [{
1116
+ type: Component,
1117
+ 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>" }]
1118
+ }], ctorParameters: function () {
1119
+ return [{ type: undefined, decorators: [{
1120
+ type: Inject,
1121
+ args: [FS_APP_MESSAGE_CONFIG]
1122
+ }] }, { type: i1.MatDialog }];
1123
+ }, propDecorators: { list: [{
1124
+ type: ViewChild,
1125
+ args: [FsListComponent, { static: true }]
1126
+ }] } });
1127
+
1128
+ class FsAppMessageTemplatesModule {
1129
+ }
1130
+ FsAppMessageTemplatesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1131
+ FsAppMessageTemplatesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, declarations: [TemplatesComponent,
1132
+ TemplateComponent], imports: [RouterModule,
1133
+ CommonModule,
1134
+ FormsModule,
1135
+ MatTooltipModule,
1136
+ MatDialogModule,
1137
+ MatButtonModule,
1138
+ MatTabsModule,
1139
+ MatFormFieldModule,
1140
+ MatFormFieldModule,
1141
+ MatInputModule,
1142
+ FsListModule,
1143
+ FsDialogModule,
1144
+ FsLabelModule,
1145
+ FsSkeletonModule,
1146
+ FsFormModule,
1147
+ FsTextEditorModule,
1148
+ FsAppMessagePreviewModule], exports: [TemplatesComponent,
1149
+ TemplateComponent] });
1150
+ FsAppMessageTemplatesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, imports: [[
1151
+ RouterModule,
1152
+ CommonModule,
1153
+ FormsModule,
1154
+ MatTooltipModule,
1155
+ MatDialogModule,
1156
+ MatButtonModule,
1157
+ MatTabsModule,
1158
+ MatFormFieldModule,
1159
+ MatFormFieldModule,
1160
+ MatInputModule,
1161
+ FsListModule,
1162
+ FsDialogModule,
1163
+ FsLabelModule,
1164
+ FsSkeletonModule,
1165
+ FsFormModule,
1166
+ FsTextEditorModule,
1167
+ FsAppMessagePreviewModule,
1168
+ ]] });
1169
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, decorators: [{
1170
+ type: NgModule,
1171
+ args: [{
1172
+ imports: [
1173
+ RouterModule,
1174
+ CommonModule,
1175
+ FormsModule,
1176
+ MatTooltipModule,
1177
+ MatDialogModule,
1178
+ MatButtonModule,
1179
+ MatTabsModule,
1180
+ MatFormFieldModule,
1181
+ MatFormFieldModule,
1182
+ MatInputModule,
1183
+ FsListModule,
1184
+ FsDialogModule,
1185
+ FsLabelModule,
1186
+ FsSkeletonModule,
1187
+ FsFormModule,
1188
+ FsTextEditorModule,
1189
+ FsAppMessagePreviewModule,
1190
+ ],
1191
+ declarations: [
1192
+ TemplatesComponent,
1193
+ TemplateComponent,
1194
+ ],
1195
+ exports: [
1196
+ TemplatesComponent,
1197
+ TemplateComponent,
1198
+ ],
1199
+ }]
1200
+ }] });
1201
+
1202
+ class WebhooksComponent {
1203
+ constructor(_config, _message) {
1204
+ this._config = _config;
1205
+ this._message = _message;
1206
+ }
1207
+ ngOnInit() {
1208
+ this.listConfig = {
1209
+ paging: false,
1210
+ actions: [
1211
+ {
1212
+ click: () => {
1213
+ this._config.createWebhook()
1214
+ .subscribe(() => {
1215
+ this._message.success('Created webhook');
1216
+ this.list.reload();
1217
+ });
1218
+ },
1219
+ label: 'Create',
1220
+ },
1221
+ ],
1222
+ rowActions: [
1223
+ {
1224
+ click: (webhook) => {
1225
+ this._config.deleteWebhook(webhook)
1226
+ .subscribe(() => {
1227
+ this._message.success('Deleted webhook');
1228
+ this.list.reload();
1229
+ });
1230
+ },
1231
+ label: 'Delete',
1232
+ },
1233
+ ],
1234
+ fetch: () => {
1235
+ return this._config.loadWebhooks()
1236
+ .pipe(map((webhooks) => ({ data: webhooks })));
1237
+ },
1238
+ };
1239
+ }
1240
+ }
1241
+ 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 });
1242
+ 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 });
1243
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: WebhooksComponent, decorators: [{
1244
+ type: Component,
1245
+ 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>" }]
1246
+ }], ctorParameters: function () {
1247
+ return [{ type: undefined, decorators: [{
1248
+ type: Inject,
1249
+ args: [FS_APP_MESSAGE_CONFIG]
1250
+ }] }, { type: i1$1.FsMessage }];
1251
+ }, propDecorators: { list: [{
1252
+ type: ViewChild,
1253
+ args: [FsListComponent]
1254
+ }] } });
1255
+
1256
+ class FsAppMessageWebhooksModule {
1257
+ }
1258
+ FsAppMessageWebhooksModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1259
+ FsAppMessageWebhooksModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, declarations: [WebhooksComponent], imports: [FsListModule,
1260
+ FsDateModule], exports: [WebhooksComponent] });
1261
+ FsAppMessageWebhooksModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, imports: [[
1262
+ FsListModule,
1263
+ FsDateModule,
1264
+ ]] });
1265
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, decorators: [{
1266
+ type: NgModule,
1267
+ args: [{
1268
+ imports: [
1269
+ FsListModule,
1270
+ FsDateModule,
1271
+ ],
1272
+ declarations: [
1273
+ WebhooksComponent,
1274
+ ],
1275
+ exports: [
1276
+ WebhooksComponent,
1277
+ ],
1278
+ }]
1279
+ }] });
1280
+
1281
+ /**
1282
+ * Generated bundle index. Do not edit.
1283
+ */
1284
+
1285
+ export { FS_APP_MESSAGE_CONFIG, FsAppMessageModule, FsAppMessageQueuesModule, FsAppMessageTemplatesModule, FsAppMessageWebhooksModule, FsAppMessagesModule, FsMessageQueueService, MessageComponent, MessagesComponent, QueueComponent, QueuesComponent, TemplateComponent, TemplatesComponent, WebhooksComponent };
1286
+ //# sourceMappingURL=firestitch-app-message.mjs.map