@firestitch/app-message 13.0.4 → 13.0.6

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 (105) hide show
  1. package/app/helpers/index-name-value.d.ts +1 -1
  2. package/app/helpers/index.d.ts +1 -1
  3. package/app/modules/app-message/app-message.module.d.ts +8 -8
  4. package/app/modules/app-message/injectors/app-message-config.injector.d.ts +3 -3
  5. package/app/modules/app-message/injectors/index.d.ts +1 -1
  6. package/app/modules/app-message/interfaces/app-message-config.d.ts +30 -30
  7. package/app/modules/app-message/interfaces/index.d.ts +1 -1
  8. package/app/modules/app-message/types/index.d.ts +1 -1
  9. package/app/modules/app-message/types/types.type.d.ts +49 -49
  10. package/app/modules/message-preview/components/index.d.ts +1 -1
  11. package/app/modules/message-preview/components/preview/index.d.ts +1 -1
  12. package/app/modules/message-preview/components/preview/preview.component.d.ts +11 -11
  13. package/app/modules/message-preview/message-preview.module.d.ts +11 -11
  14. package/app/modules/message-queues/components/queue/queue.component.d.ts +44 -44
  15. package/app/modules/message-queues/components/queues/queues.component.d.ts +24 -22
  16. package/app/modules/message-queues/components/recipient/recipient.component.d.ts +10 -10
  17. package/app/modules/message-queues/consts/index.d.ts +1 -1
  18. package/app/modules/message-queues/consts/message-queue-event-type.const.d.ts +5 -5
  19. package/app/modules/message-queues/consts/message-queue-states.const.d.ts +5 -5
  20. package/app/modules/message-queues/enums/email-message-queue-format.enum.d.ts +5 -5
  21. package/app/modules/message-queues/enums/index.d.ts +3 -3
  22. package/app/modules/message-queues/enums/message-queue-event-type.enum.d.ts +4 -4
  23. package/app/modules/message-queues/enums/message-queue-state.enum.d.ts +9 -9
  24. package/app/modules/message-queues/enums/message-queue-type.enum.d.ts +4 -4
  25. package/app/modules/message-queues/message-queues.module.d.ts +28 -28
  26. package/app/modules/message-queues/pipes/linkify.pipe.d.ts +7 -7
  27. package/app/modules/message-queues/pipes/truncate.pipe.d.ts +7 -7
  28. package/app/modules/message-queues/services/message-queue.service.d.ts +10 -10
  29. package/app/modules/message-templates/components/index.d.ts +2 -2
  30. package/app/modules/message-templates/components/template/index.d.ts +1 -1
  31. package/app/modules/message-templates/components/template/template.component.d.ts +23 -23
  32. package/app/modules/message-templates/components/templates/index.d.ts +1 -1
  33. package/app/modules/message-templates/components/templates/templates.component.d.ts +19 -19
  34. package/app/modules/message-templates/message-templates.module.d.ts +24 -24
  35. package/app/modules/messages/components/attachments/attachments.component.d.ts +18 -18
  36. package/app/modules/messages/components/attachments/index.d.ts +1 -1
  37. package/app/modules/messages/components/index.d.ts +3 -3
  38. package/app/modules/messages/components/message/index.d.ts +1 -1
  39. package/app/modules/messages/components/message/message.component.d.ts +30 -30
  40. package/app/modules/messages/components/messages/index.d.ts +1 -1
  41. package/app/modules/messages/components/messages/messages.component.d.ts +19 -19
  42. package/app/modules/messages/consts/email-message-formats.const.d.ts +5 -5
  43. package/app/modules/messages/consts/index.d.ts +1 -1
  44. package/app/modules/messages/enums/email-message-format.enum.d.ts +5 -5
  45. package/app/modules/messages/enums/index.d.ts +1 -1
  46. package/app/modules/messages/messages.module.d.ts +31 -31
  47. package/app/modules/webhooks/components/webhooks/webhooks.component.d.ts +15 -15
  48. package/app/modules/webhooks/webhooks.module.d.ts +9 -9
  49. package/esm2020/app/helpers/index-name-value.mjs +7 -7
  50. package/esm2020/app/helpers/index.mjs +1 -1
  51. package/esm2020/app/modules/app-message/app-message.module.mjs +16 -16
  52. package/esm2020/app/modules/app-message/injectors/app-message-config.injector.mjs +3 -3
  53. package/esm2020/app/modules/app-message/injectors/index.mjs +1 -1
  54. package/esm2020/app/modules/app-message/interfaces/app-message-config.mjs +1 -1
  55. package/esm2020/app/modules/app-message/interfaces/index.mjs +1 -1
  56. package/esm2020/app/modules/app-message/types/index.mjs +1 -1
  57. package/esm2020/app/modules/app-message/types/types.type.mjs +1 -1
  58. package/esm2020/app/modules/message-preview/components/index.mjs +1 -1
  59. package/esm2020/app/modules/message-preview/components/preview/index.mjs +1 -1
  60. package/esm2020/app/modules/message-preview/components/preview/preview.component.mjs +25 -25
  61. package/esm2020/app/modules/message-preview/message-preview.module.mjs +37 -37
  62. package/esm2020/app/modules/message-queues/components/queue/queue.component.mjs +209 -209
  63. package/esm2020/app/modules/message-queues/components/queues/queues.component.mjs +162 -157
  64. package/esm2020/app/modules/message-queues/components/recipient/recipient.component.mjs +25 -25
  65. package/esm2020/app/modules/message-queues/consts/index.mjs +1 -1
  66. package/esm2020/app/modules/message-queues/consts/message-queue-event-type.const.mjs +5 -5
  67. package/esm2020/app/modules/message-queues/consts/message-queue-states.const.mjs +10 -10
  68. package/esm2020/app/modules/message-queues/enums/email-message-queue-format.enum.mjs +6 -6
  69. package/esm2020/app/modules/message-queues/enums/index.mjs +3 -3
  70. package/esm2020/app/modules/message-queues/enums/message-queue-event-type.enum.mjs +5 -5
  71. package/esm2020/app/modules/message-queues/enums/message-queue-state.enum.mjs +10 -10
  72. package/esm2020/app/modules/message-queues/enums/message-queue-type.enum.mjs +5 -5
  73. package/esm2020/app/modules/message-queues/message-queues.module.mjs +109 -109
  74. package/esm2020/app/modules/message-queues/pipes/linkify.pipe.mjs +21 -21
  75. package/esm2020/app/modules/message-queues/pipes/truncate.pipe.mjs +21 -21
  76. package/esm2020/app/modules/message-queues/services/message-queue.service.mjs +28 -28
  77. package/esm2020/app/modules/message-templates/components/index.mjs +2 -2
  78. package/esm2020/app/modules/message-templates/components/template/index.mjs +1 -1
  79. package/esm2020/app/modules/message-templates/components/template/template.component.mjs +80 -80
  80. package/esm2020/app/modules/message-templates/components/templates/index.mjs +1 -1
  81. package/esm2020/app/modules/message-templates/components/templates/templates.component.mjs +80 -80
  82. package/esm2020/app/modules/message-templates/message-templates.module.mjs +93 -93
  83. package/esm2020/app/modules/messages/components/attachments/attachments.component.mjs +80 -80
  84. package/esm2020/app/modules/messages/components/attachments/index.mjs +1 -1
  85. package/esm2020/app/modules/messages/components/index.mjs +3 -3
  86. package/esm2020/app/modules/messages/components/message/index.mjs +1 -1
  87. package/esm2020/app/modules/messages/components/message/message.component.mjs +129 -129
  88. package/esm2020/app/modules/messages/components/messages/index.mjs +1 -1
  89. package/esm2020/app/modules/messages/components/messages/messages.component.mjs +71 -71
  90. package/esm2020/app/modules/messages/consts/email-message-formats.const.mjs +6 -6
  91. package/esm2020/app/modules/messages/consts/index.mjs +1 -1
  92. package/esm2020/app/modules/messages/enums/email-message-format.enum.mjs +6 -6
  93. package/esm2020/app/modules/messages/enums/index.mjs +1 -1
  94. package/esm2020/app/modules/messages/messages.module.mjs +120 -120
  95. package/esm2020/app/modules/webhooks/components/webhooks/webhooks.component.mjs +60 -60
  96. package/esm2020/app/modules/webhooks/webhooks.module.mjs +29 -29
  97. package/esm2020/firestitch-app-message.mjs +4 -4
  98. package/esm2020/public_api.mjs +16 -15
  99. package/fesm2015/firestitch-app-message.mjs +1170 -1167
  100. package/fesm2015/firestitch-app-message.mjs.map +1 -1
  101. package/fesm2020/firestitch-app-message.mjs +1174 -1170
  102. package/fesm2020/firestitch-app-message.mjs.map +1 -1
  103. package/firestitch-app-message.d.ts +5 -5
  104. package/package.json +1 -1
  105. package/public_api.d.ts +16 -15
@@ -56,1231 +56,1234 @@ import anchorme from 'anchorme';
56
56
  import { SelectionActionType } from '@firestitch/selection';
57
57
  import { isAfter } from 'date-fns';
58
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: [{}]
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
72
  }] });
73
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
- }] }];
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
93
  } });
94
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
- }]
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
124
  }] });
125
125
 
126
- const FS_APP_MESSAGE_ROOT_CONFIG = new InjectionToken('fs-app-message-root-config');
126
+ const FS_APP_MESSAGE_ROOT_CONFIG = new InjectionToken('fs-app-message-root-config');
127
127
  const FS_APP_MESSAGE_CONFIG = new InjectionToken('fs-app-message-config');
128
128
 
129
- var EmailMessageFormat;
130
- (function (EmailMessageFormat) {
131
- EmailMessageFormat["Text"] = "T";
132
- EmailMessageFormat["HTML"] = "H";
133
- EmailMessageFormat["RichText"] = "R";
129
+ var EmailMessageFormat;
130
+ (function (EmailMessageFormat) {
131
+ EmailMessageFormat["Text"] = "T";
132
+ EmailMessageFormat["HTML"] = "H";
133
+ EmailMessageFormat["RichText"] = "R";
134
134
  })(EmailMessageFormat || (EmailMessageFormat = {}));
135
135
 
136
- const EmailMessageFormats = [
137
- { name: 'Text', value: EmailMessageFormat.Text },
138
- { name: 'HTML', value: EmailMessageFormat.HTML },
139
- { name: 'Rich Text', value: EmailMessageFormat.RichText }
136
+ const EmailMessageFormats = [
137
+ { name: 'Text', value: EmailMessageFormat.Text },
138
+ { name: 'HTML', value: EmailMessageFormat.HTML },
139
+ { name: 'Rich Text', value: EmailMessageFormat.RichText }
140
140
  ];
141
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
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
213
  }] } });
214
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 <mat-label>Name</mat-label>\n <input\n matInput\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 <mat-label>Description</mat-label>\n <input\n matInput\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 <mat-label>From Email</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.fromEmail\"\n name=\"from_email\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>From Name</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.fromName\"\n name=\"from_name\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>Reply To</mat-label>\n <input\n matInput\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 <mat-label>To</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.toRecipients\"\n name=\"to\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>CC</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.ccRecipients\"\n name=\"cc\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>BCC</mat-label>\n <input\n matInput\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-label>Customize Message</mat-label>\n <mat-select\n required\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-label>Format</mat-label>\n <mat-select\n required\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-label>Template</mat-label>\n <mat-select\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 <mat-label>Subject</mat-label>\n <input\n matInput\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-label>Customize Message</mat-label>\n <mat-select\n required\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: i6.MatLabel, selector: "mat-label" }, { 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 <mat-label>Name</mat-label>\n <input\n matInput\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 <mat-label>Description</mat-label>\n <input\n matInput\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 <mat-label>From Email</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.fromEmail\"\n name=\"from_email\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>From Name</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.fromName\"\n name=\"from_name\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>Reply To</mat-label>\n <input\n matInput\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 <mat-label>To</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.toRecipients\"\n name=\"to\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>CC</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.ccRecipients\"\n name=\"cc\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>BCC</mat-label>\n <input\n matInput\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-label>Customize Message</mat-label>\n <mat-select\n required\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-label>Format</mat-label>\n <mat-select\n required\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-label>Template</mat-label>\n <mat-select\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 <mat-label>Subject</mat-label>\n <input\n matInput\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-label>Customize Message</mat-label>\n <mat-select\n required\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 }];
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 <mat-label>Name</mat-label>\n <input\n matInput\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 <mat-label>Description</mat-label>\n <input\n matInput\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 <mat-label>From Email</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.fromEmail\"\n name=\"from_email\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>From Name</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.fromName\"\n name=\"from_name\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>Reply To</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.replyEmail\"\n name=\"reply_to\">\n </mat-form-field>\n </div>\n\n <div class=\"fs-row.gap-small.wrap\">\n <mat-form-field>\n <mat-label>To</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.toRecipients\"\n name=\"to\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>CC</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.ccRecipients\"\n name=\"cc\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>BCC</mat-label>\n <input\n matInput\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-label>Customize Message</mat-label>\n <mat-select\n required\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-label>Format</mat-label>\n <mat-select\n required\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-label>Template</mat-label>\n <mat-select\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 <mat-label>Subject</mat-label>\n <input\n matInput\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-label>Customize Message</mat-label>\n <mat-select\n required\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: i6.MatLabel, selector: "mat-label" }, { 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 <mat-label>Name</mat-label>\n <input\n matInput\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 <mat-label>Description</mat-label>\n <input\n matInput\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 <mat-label>From Email</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.fromEmail\"\n name=\"from_email\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>From Name</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.fromName\"\n name=\"from_name\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>Reply To</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.replyEmail\"\n name=\"reply_to\">\n </mat-form-field>\n </div>\n\n <div class=\"fs-row.gap-small.wrap\">\n <mat-form-field>\n <mat-label>To</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.toRecipients\"\n name=\"to\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>CC</mat-label>\n <input\n matInput\n [(ngModel)]=\"message.emailMessage.ccRecipients\"\n name=\"cc\">\n </mat-form-field>\n <mat-form-field>\n <mat-label>BCC</mat-label>\n <input\n matInput\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-label>Customize Message</mat-label>\n <mat-select\n required\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-label>Format</mat-label>\n <mat-select\n required\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-label>Template</mat-label>\n <mat-select\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 <mat-label>Subject</mat-label>\n <input\n matInput\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-label>Customize Message</mat-label>\n <mat-select\n required\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
314
  } });
315
315
 
316
- function indexNameValue(arry) {
317
- const obj = {};
318
- arry.forEach(item => {
319
- obj[item.value] = item.name;
320
- });
321
- return obj;
316
+ function indexNameValue(arry) {
317
+ const obj = {};
318
+ arry.forEach(item => {
319
+ obj[item.value] = item.name;
320
+ });
321
+ return obj;
322
322
  }
323
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 }]
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
382
  }] } });
383
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
- }]
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
476
  }] });
477
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";
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
487
  })(MessageQueueState || (MessageQueueState = {}));
488
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 }
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
497
  ];
498
498
 
499
- var EmailMessageQueueFormat;
500
- (function (EmailMessageQueueFormat) {
501
- EmailMessageQueueFormat["Text"] = "T";
502
- EmailMessageQueueFormat["HTML"] = "H";
503
- EmailMessageQueueFormat["RichText"] = "R";
499
+ var EmailMessageQueueFormat;
500
+ (function (EmailMessageQueueFormat) {
501
+ EmailMessageQueueFormat["Text"] = "T";
502
+ EmailMessageQueueFormat["HTML"] = "H";
503
+ EmailMessageQueueFormat["RichText"] = "R";
504
504
  })(EmailMessageQueueFormat || (EmailMessageQueueFormat = {}));
505
505
 
506
- var MessageQueueType;
507
- (function (MessageQueueType) {
508
- MessageQueueType["Sms"] = "S";
509
- MessageQueueType["Email"] = "E";
506
+ var MessageQueueType;
507
+ (function (MessageQueueType) {
508
+ MessageQueueType["Sms"] = "S";
509
+ MessageQueueType["Email"] = "E";
510
510
  })(MessageQueueType || (MessageQueueType = {}));
511
511
 
512
- var MessageQueueEventType;
513
- (function (MessageQueueEventType) {
514
- MessageQueueEventType["Click"] = "click";
515
- MessageQueueEventType["Open"] = "open";
512
+ var MessageQueueEventType;
513
+ (function (MessageQueueEventType) {
514
+ MessageQueueEventType["Click"] = "click";
515
+ MessageQueueEventType["Open"] = "open";
516
516
  })(MessageQueueEventType || (MessageQueueEventType = {}));
517
517
 
518
- const MessageQueueEventTypes = [
519
- { name: 'Open', value: MessageQueueEventType.Open },
520
- { name: 'Click', value: MessageQueueEventType.Click },
518
+ const MessageQueueEventTypes = [
519
+ { name: 'Open', value: MessageQueueEventType.Open },
520
+ { name: 'Click', value: MessageQueueEventType.Click },
521
521
  ];
522
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
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
542
  }] } });
543
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']
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
722
  }] } });
723
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
- }]
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
742
  }], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
743
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
- }]
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
762
  }] });
763
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: 'messageIid',
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
764
+ class QueuesComponent {
765
+ constructor(_config, _messageQueueService) {
766
+ this._config = _config;
767
+ this._messageQueueService = _messageQueueService;
768
+ this.list = null;
769
+ this.query = {};
770
+ this.type = null;
771
+ this.config = null;
772
+ this.messageQueueStates = {};
773
+ this.MessageQueueState = MessageQueueState;
774
+ this._destroy$ = new Subject();
775
+ }
776
+ ngOnInit() {
777
+ this.messageQueueStates = indexNameValue(MessageQueueStates);
778
+ this.config = {
779
+ filters: [
780
+ {
781
+ name: 'keyword',
782
+ type: ItemType.Keyword,
783
+ label: 'Search',
784
+ },
785
+ {
786
+ name: 'state',
787
+ type: ItemType.Select,
788
+ label: 'Status',
789
+ values: () => {
790
+ return MessageQueueStates;
791
+ },
792
+ },
793
+ {
794
+ name: 'date',
795
+ type: ItemType.DateRange,
796
+ label: ['From Date', 'To Date'],
797
+ },
798
+ ],
799
+ sort: { value: 'created_date', direction: 'desc' },
800
+ fetch: (query) => {
801
+ query = Object.assign(Object.assign(Object.assign({}, query), this.query), { type: this.type, messageQueueAttachmentCounts: true, emailMessageQueues: true, emailMessageQueueBodies: false, smsMessageQueues: true });
802
+ return this._config.loadMessageQueues(query)
803
+ .pipe(map((response) => ({
804
+ data: response.data
805
+ .map((messageQueue) => {
806
+ return Object.assign(Object.assign({}, messageQueue), { scheduled: messageQueue.state === MessageQueueState.Queued && isAfter(messageQueue.scheduledDate, new Date()), messageQueueRecipients: messageQueue.messageQueueRecipients
807
+ .reduce((accum, messageQueueRecipient) => {
808
+ accum[messageQueueRecipient.recipient] = messageQueueRecipient.state;
809
+ return accum;
810
+ }, {}) });
811
+ }), paging: response.paging,
812
+ })));
813
+ },
814
+ };
815
+ if (this._config.bulkMessageQueues) {
816
+ this.config.selection = {
817
+ selectAll: false,
818
+ actions: [
819
+ {
820
+ type: SelectionActionType.Action,
821
+ name: 'queue',
822
+ label: 'Queue',
823
+ },
824
+ {
825
+ type: SelectionActionType.Action,
826
+ name: 'resend',
827
+ label: 'Resend',
828
+ },
829
+ {
830
+ type: SelectionActionType.Action,
831
+ name: 'cancel',
832
+ label: 'Cancel',
833
+ },
834
+ ],
835
+ actionSelected: (actionSelected) => {
836
+ return this._config.bulkMessageQueues(actionSelected.action.name, actionSelected.selected)
837
+ .pipe(tap(() => {
838
+ this.list.reload();
839
+ }));
840
+ },
841
+ };
842
+ }
843
+ this.config.filters.push({
844
+ name: 'messageId',
845
+ type: ItemType.Select,
846
+ label: 'Message Type',
847
+ values: (query) => {
848
+ query = Object.assign(Object.assign({}, query), { limit: 50 });
849
+ return this._config.loadMessages(query)
850
+ .pipe(map((response) => {
851
+ return [
852
+ { value: null, name: 'All' },
853
+ ...response.data
854
+ .map((item) => ({ name: item.name, value: item.id })),
855
+ ];
856
+ }));
857
+ },
858
+ });
859
+ }
860
+ open(messageQueue) {
861
+ this._messageQueueService.openMessageQueue(messageQueue.id)
862
+ .pipe(takeUntil(this._destroy$))
863
+ .subscribe(() => {
864
+ this.list.reload();
865
+ });
866
+ }
867
+ ngOnDestroy() {
868
+ this._destroy$.next();
869
+ this._destroy$.complete();
870
+ }
871
+ }
872
+ 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 });
873
+ QueuesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: QueuesComponent, selector: "fs-app-message-queues", inputs: { query: "query", type: "type" }, 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 });
874
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: QueuesComponent, decorators: [{
875
+ type: Component,
876
+ 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"] }]
877
+ }], ctorParameters: function () {
878
+ return [{ type: undefined, decorators: [{
879
+ type: Inject,
880
+ args: [FS_APP_MESSAGE_CONFIG]
881
+ }] }, { type: FsMessageQueueService }];
882
+ }, propDecorators: { list: [{
883
+ type: ViewChild,
884
+ args: [FsListComponent, { static: true }]
885
+ }], query: [{
886
+ type: Input
887
+ }], type: [{
888
+ type: Input
886
889
  }] } });
887
890
 
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' }]
891
+ class LinkifyPipe {
892
+ transform(input) {
893
+ return anchorme({
894
+ input,
895
+ options: {
896
+ attributes: {
897
+ target: "_blank",
898
+ }
899
+ }
900
+ });
901
+ }
902
+ }
903
+ LinkifyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: LinkifyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
904
+ LinkifyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: LinkifyPipe, name: "linkify" });
905
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: LinkifyPipe, decorators: [{
906
+ type: Pipe,
907
+ args: [{ name: 'linkify' }]
905
908
  }] });
906
909
 
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
- }]
910
+ class FsAppMessageQueuesModule {
911
+ }
912
+ FsAppMessageQueuesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
913
+ FsAppMessageQueuesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, declarations: [QueuesComponent,
914
+ QueueComponent,
915
+ LinkifyPipe,
916
+ TruncatePipe,
917
+ RecipientComponent], imports: [RouterModule,
918
+ FormsModule,
919
+ CommonModule,
920
+ MatTooltipModule,
921
+ MatDialogModule,
922
+ MatButtonModule,
923
+ MatIconModule,
924
+ MatTabsModule,
925
+ FsListModule,
926
+ FsDialogModule,
927
+ FsLabelModule,
928
+ FsDateModule,
929
+ FsSkeletonModule,
930
+ FsAppMessagesModule,
931
+ FsFormModule,
932
+ FsPromptInputModule,
933
+ FsIFrameModule], exports: [QueuesComponent,
934
+ QueueComponent] });
935
+ FsAppMessageQueuesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, providers: [
936
+ FsMessageQueueService,
937
+ ], imports: [[
938
+ RouterModule,
939
+ FormsModule,
940
+ CommonModule,
941
+ MatTooltipModule,
942
+ MatDialogModule,
943
+ MatButtonModule,
944
+ MatIconModule,
945
+ MatTabsModule,
946
+ FsListModule,
947
+ FsDialogModule,
948
+ FsLabelModule,
949
+ FsDateModule,
950
+ FsSkeletonModule,
951
+ FsAppMessagesModule,
952
+ FsFormModule,
953
+ FsPromptInputModule,
954
+ FsIFrameModule,
955
+ ]] });
956
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageQueuesModule, decorators: [{
957
+ type: NgModule,
958
+ args: [{
959
+ imports: [
960
+ RouterModule,
961
+ FormsModule,
962
+ CommonModule,
963
+ MatTooltipModule,
964
+ MatDialogModule,
965
+ MatButtonModule,
966
+ MatIconModule,
967
+ MatTabsModule,
968
+ FsListModule,
969
+ FsDialogModule,
970
+ FsLabelModule,
971
+ FsDateModule,
972
+ FsSkeletonModule,
973
+ FsAppMessagesModule,
974
+ FsFormModule,
975
+ FsPromptInputModule,
976
+ FsIFrameModule,
977
+ ],
978
+ declarations: [
979
+ QueuesComponent,
980
+ QueueComponent,
981
+ LinkifyPipe,
982
+ TruncatePipe,
983
+ RecipientComponent,
984
+ ],
985
+ exports: [
986
+ QueuesComponent,
987
+ QueueComponent,
988
+ ],
989
+ providers: [
990
+ FsMessageQueueService,
991
+ ],
992
+ }]
990
993
  }] });
991
994
 
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 <mat-label>Name</mat-label>\n <input\n matInput\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: i6.MatLabel, selector: "mat-label" }, { 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 <mat-label>Name</mat-label>\n <input\n matInput\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 }];
995
+ class TemplateComponent {
996
+ constructor(_data, _config, _dialogRef, _message, _dialog) {
997
+ this._data = _data;
998
+ this._config = _config;
999
+ this._dialogRef = _dialogRef;
1000
+ this._message = _message;
1001
+ this._dialog = _dialog;
1002
+ this.htmlEditorconfig = {
1003
+ language: 'html',
1004
+ insertSpaces: true,
1005
+ tabSize: 2,
1006
+ };
1007
+ this.cssEditorconfig = {
1008
+ language: 'scss',
1009
+ insertSpaces: true,
1010
+ tabSize: 2,
1011
+ };
1012
+ this.save = (event) => {
1013
+ return this._config.saveMessageTemplate(this.messageTemplate)
1014
+ .pipe(tap((messageTemplate) => {
1015
+ this._message.success('Saved Changes');
1016
+ if (event.submitter === 'save-close') {
1017
+ this._dialogRef.close(messageTemplate);
1018
+ }
1019
+ }));
1020
+ };
1021
+ }
1022
+ ngOnInit() {
1023
+ if (this._data.messageTemplate.id) {
1024
+ this._config.loadMessageTemplate(this._data.messageTemplate)
1025
+ .subscribe(messageTemplate => {
1026
+ this.messageTemplate = messageTemplate;
1027
+ });
1028
+ }
1029
+ else {
1030
+ this.messageTemplate = {};
1031
+ }
1032
+ }
1033
+ openPreview() {
1034
+ this._dialog.open(PreviewComponent, {
1035
+ data: {
1036
+ styles: this.messageTemplate.styles,
1037
+ html: this.messageTemplate.content,
1038
+ },
1039
+ width: '95%',
1040
+ });
1041
+ }
1042
+ }
1043
+ 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 });
1044
+ 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 <mat-label>Name</mat-label>\n <input\n matInput\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: i6.MatLabel, selector: "mat-label" }, { 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"] }] });
1045
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TemplateComponent, decorators: [{
1046
+ type: Component,
1047
+ 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 <mat-label>Name</mat-label>\n <input\n matInput\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"] }]
1048
+ }], ctorParameters: function () {
1049
+ return [{ type: undefined, decorators: [{
1050
+ type: Inject,
1051
+ args: [MAT_DIALOG_DATA]
1052
+ }] }, { type: undefined, decorators: [{
1053
+ type: Inject,
1054
+ args: [FS_APP_MESSAGE_CONFIG]
1055
+ }] }, { type: i1.MatDialogRef }, { type: i1$1.FsMessage }, { type: i1.MatDialog }];
1053
1056
  } });
1054
1057
 
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 }]
1058
+ class TemplatesComponent {
1059
+ constructor(_config, _dialog) {
1060
+ this._config = _config;
1061
+ this._dialog = _dialog;
1062
+ this.list = null;
1063
+ this.config = null;
1064
+ this.messageQueueStates = [];
1065
+ this._destroy$ = new Subject();
1066
+ }
1067
+ ngOnInit() {
1068
+ this.config = {
1069
+ actions: [
1070
+ {
1071
+ label: 'Create',
1072
+ click: () => {
1073
+ this.open({});
1074
+ }
1075
+ }
1076
+ ],
1077
+ status: false,
1078
+ fetch: query => {
1079
+ return this._config.loadMessageTemplates(query);
1080
+ }
1081
+ };
1082
+ if (this._config.deleteMessageTemplate) {
1083
+ this.config.rowActions = [
1084
+ {
1085
+ click: data => {
1086
+ return this._config.deleteMessageTemplate(data);
1087
+ },
1088
+ remove: {
1089
+ title: 'Confirm',
1090
+ template: 'Are you sure you would like to delete this template?',
1091
+ },
1092
+ menu: true,
1093
+ label: 'Delete',
1094
+ },
1095
+ ];
1096
+ }
1097
+ }
1098
+ open(messageTemplate) {
1099
+ const dialogRef = this._dialog.open(TemplateComponent, {
1100
+ data: {
1101
+ messageTemplate,
1102
+ },
1103
+ width: '85%',
1104
+ });
1105
+ dialogRef.afterClosed()
1106
+ .pipe(takeUntil(this._destroy$))
1107
+ .subscribe(() => {
1108
+ this.list.reload();
1109
+ });
1110
+ }
1111
+ ngOnDestroy() {
1112
+ this._destroy$.next();
1113
+ this._destroy$.complete();
1114
+ }
1115
+ }
1116
+ 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 });
1117
+ 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"] }] });
1118
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TemplatesComponent, decorators: [{
1119
+ type: Component,
1120
+ 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>" }]
1121
+ }], ctorParameters: function () {
1122
+ return [{ type: undefined, decorators: [{
1123
+ type: Inject,
1124
+ args: [FS_APP_MESSAGE_CONFIG]
1125
+ }] }, { type: i1.MatDialog }];
1126
+ }, propDecorators: { list: [{
1127
+ type: ViewChild,
1128
+ args: [FsListComponent, { static: true }]
1126
1129
  }] } });
1127
1130
 
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
- }]
1131
+ class FsAppMessageTemplatesModule {
1132
+ }
1133
+ FsAppMessageTemplatesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1134
+ FsAppMessageTemplatesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, declarations: [TemplatesComponent,
1135
+ TemplateComponent], imports: [RouterModule,
1136
+ CommonModule,
1137
+ FormsModule,
1138
+ MatTooltipModule,
1139
+ MatDialogModule,
1140
+ MatButtonModule,
1141
+ MatTabsModule,
1142
+ MatFormFieldModule,
1143
+ MatFormFieldModule,
1144
+ MatInputModule,
1145
+ FsListModule,
1146
+ FsDialogModule,
1147
+ FsLabelModule,
1148
+ FsSkeletonModule,
1149
+ FsFormModule,
1150
+ FsTextEditorModule,
1151
+ FsAppMessagePreviewModule], exports: [TemplatesComponent,
1152
+ TemplateComponent] });
1153
+ FsAppMessageTemplatesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, imports: [[
1154
+ RouterModule,
1155
+ CommonModule,
1156
+ FormsModule,
1157
+ MatTooltipModule,
1158
+ MatDialogModule,
1159
+ MatButtonModule,
1160
+ MatTabsModule,
1161
+ MatFormFieldModule,
1162
+ MatFormFieldModule,
1163
+ MatInputModule,
1164
+ FsListModule,
1165
+ FsDialogModule,
1166
+ FsLabelModule,
1167
+ FsSkeletonModule,
1168
+ FsFormModule,
1169
+ FsTextEditorModule,
1170
+ FsAppMessagePreviewModule,
1171
+ ]] });
1172
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageTemplatesModule, decorators: [{
1173
+ type: NgModule,
1174
+ args: [{
1175
+ imports: [
1176
+ RouterModule,
1177
+ CommonModule,
1178
+ FormsModule,
1179
+ MatTooltipModule,
1180
+ MatDialogModule,
1181
+ MatButtonModule,
1182
+ MatTabsModule,
1183
+ MatFormFieldModule,
1184
+ MatFormFieldModule,
1185
+ MatInputModule,
1186
+ FsListModule,
1187
+ FsDialogModule,
1188
+ FsLabelModule,
1189
+ FsSkeletonModule,
1190
+ FsFormModule,
1191
+ FsTextEditorModule,
1192
+ FsAppMessagePreviewModule,
1193
+ ],
1194
+ declarations: [
1195
+ TemplatesComponent,
1196
+ TemplateComponent,
1197
+ ],
1198
+ exports: [
1199
+ TemplatesComponent,
1200
+ TemplateComponent,
1201
+ ],
1202
+ }]
1200
1203
  }] });
1201
1204
 
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]
1205
+ class WebhooksComponent {
1206
+ constructor(_config, _message) {
1207
+ this._config = _config;
1208
+ this._message = _message;
1209
+ }
1210
+ ngOnInit() {
1211
+ this.listConfig = {
1212
+ paging: false,
1213
+ actions: [
1214
+ {
1215
+ click: () => {
1216
+ this._config.createWebhook()
1217
+ .subscribe(() => {
1218
+ this._message.success('Created webhook');
1219
+ this.list.reload();
1220
+ });
1221
+ },
1222
+ label: 'Create',
1223
+ },
1224
+ ],
1225
+ rowActions: [
1226
+ {
1227
+ click: (webhook) => {
1228
+ this._config.deleteWebhook(webhook)
1229
+ .subscribe(() => {
1230
+ this._message.success('Deleted webhook');
1231
+ this.list.reload();
1232
+ });
1233
+ },
1234
+ label: 'Delete',
1235
+ },
1236
+ ],
1237
+ fetch: () => {
1238
+ return this._config.loadWebhooks()
1239
+ .pipe(map((webhooks) => ({ data: webhooks })));
1240
+ },
1241
+ };
1242
+ }
1243
+ }
1244
+ 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 });
1245
+ 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 });
1246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: WebhooksComponent, decorators: [{
1247
+ type: Component,
1248
+ 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>" }]
1249
+ }], ctorParameters: function () {
1250
+ return [{ type: undefined, decorators: [{
1251
+ type: Inject,
1252
+ args: [FS_APP_MESSAGE_CONFIG]
1253
+ }] }, { type: i1$1.FsMessage }];
1254
+ }, propDecorators: { list: [{
1255
+ type: ViewChild,
1256
+ args: [FsListComponent]
1254
1257
  }] } });
1255
1258
 
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
- }]
1259
+ class FsAppMessageWebhooksModule {
1260
+ }
1261
+ FsAppMessageWebhooksModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1262
+ FsAppMessageWebhooksModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, declarations: [WebhooksComponent], imports: [FsListModule,
1263
+ FsDateModule], exports: [WebhooksComponent] });
1264
+ FsAppMessageWebhooksModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, imports: [[
1265
+ FsListModule,
1266
+ FsDateModule,
1267
+ ]] });
1268
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAppMessageWebhooksModule, decorators: [{
1269
+ type: NgModule,
1270
+ args: [{
1271
+ imports: [
1272
+ FsListModule,
1273
+ FsDateModule,
1274
+ ],
1275
+ declarations: [
1276
+ WebhooksComponent,
1277
+ ],
1278
+ exports: [
1279
+ WebhooksComponent,
1280
+ ],
1281
+ }]
1279
1282
  }] });
1280
1283
 
1281
- /**
1282
- * Generated bundle index. Do not edit.
1284
+ /**
1285
+ * Generated bundle index. Do not edit.
1283
1286
  */
1284
1287
 
1285
- export { FS_APP_MESSAGE_CONFIG, FsAppMessageModule, FsAppMessageQueuesModule, FsAppMessageTemplatesModule, FsAppMessageWebhooksModule, FsAppMessagesModule, FsMessageQueueService, MessageComponent, MessagesComponent, QueueComponent, QueuesComponent, TemplateComponent, TemplatesComponent, WebhooksComponent };
1288
+ export { FS_APP_MESSAGE_CONFIG, FsAppMessageModule, FsAppMessageQueuesModule, FsAppMessageTemplatesModule, FsAppMessageWebhooksModule, FsAppMessagesModule, FsMessageQueueService, MessageComponent, MessageQueueType, MessagesComponent, QueueComponent, QueuesComponent, TemplateComponent, TemplatesComponent, WebhooksComponent };
1286
1289
  //# sourceMappingURL=firestitch-app-message.mjs.map