@memberjunction/ng-entity-communications 6.2.0-edge.0 → 6.2.0-edge.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/preview.component.d.ts +72 -10
- package/dist/lib/preview.component.d.ts.map +1 -1
- package/dist/lib/preview.component.js +169 -45
- package/dist/lib/preview.component.js.map +1 -1
- package/dist/lib/window.component.d.ts +11 -3
- package/dist/lib/window.component.d.ts.map +1 -1
- package/dist/lib/window.component.js +23 -3
- package/dist/lib/window.component.js.map +1 -1
- package/package.json +13 -13
|
@@ -8,29 +8,91 @@ import * as i0 from "@angular/core";
|
|
|
8
8
|
* Component for previewing in the UI what a communication will look like when sent using a specific entity and parameters for running a view that drive a dataset against a given template
|
|
9
9
|
*/
|
|
10
10
|
export declare class EntityCommunicationsPreviewComponent extends BaseAngularComponent implements OnInit {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
TemplateFilter: string | undefined;
|
|
12
|
+
/** @deprecated Use {@link TemplateFilter}. */
|
|
13
|
+
set templateFilter(value: string | undefined);
|
|
14
|
+
/** @deprecated Use {@link TemplateFilter}. */
|
|
15
|
+
get templateFilter(): string | undefined;
|
|
16
|
+
EntityInfo: EntityInfo | undefined;
|
|
17
|
+
/** @deprecated Use {@link EntityInfo}. */
|
|
18
|
+
set entityInfo(value: EntityInfo | undefined);
|
|
19
|
+
/** @deprecated Use {@link EntityInfo}. */
|
|
20
|
+
get entityInfo(): EntityInfo | undefined;
|
|
21
|
+
RunViewParams: RunViewParams | undefined;
|
|
22
|
+
/** @deprecated Use {@link RunViewParams}. */
|
|
23
|
+
set runViewParams(value: RunViewParams | undefined);
|
|
24
|
+
/** @deprecated Use {@link RunViewParams}. */
|
|
25
|
+
get runViewParams(): RunViewParams | undefined;
|
|
26
|
+
TemplateSelected: EventEmitter<MJTemplateEntityExtended>;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use {@link TemplateSelected}.
|
|
29
|
+
*
|
|
30
|
+
* The same emitter under the old binding name, so a template still binding
|
|
31
|
+
* (templateSelected) keeps working. Must stay AFTER TemplateSelected: class fields
|
|
32
|
+
* initialise in order, and the other way round this captures undefined.
|
|
33
|
+
*/
|
|
14
34
|
templateSelected: EventEmitter<MJTemplateEntityExtended>;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
35
|
+
Templates: MJTemplateEntityExtended[];
|
|
36
|
+
/** @deprecated Use {@link Templates}. */
|
|
37
|
+
get templates(): MJTemplateEntityExtended[];
|
|
38
|
+
/** @deprecated Use {@link Templates}. */
|
|
39
|
+
set templates(value: MJTemplateEntityExtended[]);
|
|
40
|
+
SelectedTemplate: MJTemplateEntityExtended | null;
|
|
41
|
+
/** @deprecated Use {@link SelectedTemplate}. */
|
|
42
|
+
get selectedTemplate(): MJTemplateEntityExtended | null;
|
|
43
|
+
/** @deprecated Use {@link SelectedTemplate}. */
|
|
44
|
+
set selectedTemplate(value: MJTemplateEntityExtended | null);
|
|
45
|
+
Step: number;
|
|
46
|
+
/** @deprecated Use {@link Step}. */
|
|
47
|
+
get step(): number;
|
|
48
|
+
/** @deprecated Use {@link Step}. */
|
|
49
|
+
set step(value: number);
|
|
50
|
+
PreviewMessages: ProcessedMessage[];
|
|
51
|
+
/** @deprecated Use {@link PreviewMessages}. */
|
|
52
|
+
get previewMessages(): ProcessedMessage[];
|
|
53
|
+
/** @deprecated Use {@link PreviewMessages}. */
|
|
54
|
+
set previewMessages(value: ProcessedMessage[]);
|
|
55
|
+
CurrentMessageIndex: number;
|
|
56
|
+
/** @deprecated Use {@link CurrentMessageIndex}. */
|
|
57
|
+
get currentMessageIndex(): number;
|
|
58
|
+
/** @deprecated Use {@link CurrentMessageIndex}. */
|
|
59
|
+
set currentMessageIndex(value: number);
|
|
60
|
+
Loading: boolean;
|
|
61
|
+
/** @deprecated Use {@link Loading}. */
|
|
62
|
+
get loading(): boolean;
|
|
63
|
+
/** @deprecated Use {@link Loading}. */
|
|
64
|
+
set loading(value: boolean);
|
|
21
65
|
constructor();
|
|
22
66
|
ngOnInit(): Promise<void>;
|
|
67
|
+
LoadTemplates(): Promise<void>;
|
|
68
|
+
/** @deprecated Use {@link LoadTemplates}. */
|
|
23
69
|
loadTemplates(): Promise<void>;
|
|
70
|
+
SelectTemplate(template: MJTemplateEntityExtended): void;
|
|
71
|
+
/** @deprecated Use {@link SelectTemplate}. */
|
|
24
72
|
selectTemplate(template: MJTemplateEntityExtended): void;
|
|
25
73
|
protected loadMessagePreviews(): Promise<void>;
|
|
74
|
+
CurrentPreviewItemSubject(): string;
|
|
75
|
+
/** @deprecated Use {@link CurrentPreviewItemSubject}. */
|
|
26
76
|
currentPreviewItemSubject(): string;
|
|
77
|
+
CurrentPreviewItemBody(): string;
|
|
78
|
+
/** @deprecated Use {@link CurrentPreviewItemBody}. */
|
|
27
79
|
currentPreviewItemBody(): string;
|
|
80
|
+
GoBack(): void;
|
|
81
|
+
/** @deprecated Use {@link GoBack}. */
|
|
28
82
|
goBack(): void;
|
|
83
|
+
FirstMessage(): void;
|
|
84
|
+
/** @deprecated Use {@link FirstMessage}. */
|
|
29
85
|
firstMessage(): void;
|
|
86
|
+
LastMessage(): void;
|
|
87
|
+
/** @deprecated Use {@link LastMessage}. */
|
|
30
88
|
lastMessage(): void;
|
|
89
|
+
NextMessage(): void;
|
|
90
|
+
/** @deprecated Use {@link NextMessage}. */
|
|
31
91
|
nextMessage(): void;
|
|
92
|
+
PreviousMessage(): void;
|
|
93
|
+
/** @deprecated Use {@link PreviousMessage}. */
|
|
32
94
|
previousMessage(): void;
|
|
33
95
|
static ɵfac: i0.ɵɵFactoryDeclaration<EntityCommunicationsPreviewComponent, never>;
|
|
34
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<EntityCommunicationsPreviewComponent, "mj-entity-communications-preview", never, { "templateFilter": { "alias": "templateFilter"; "required": false; }; "entityInfo": { "alias": "entityInfo"; "required": false; }; "runViewParams": { "alias": "runViewParams"; "required": false; }; }, { "templateSelected": "templateSelected"; }, never, never, false, never>;
|
|
96
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EntityCommunicationsPreviewComponent, "mj-entity-communications-preview", never, { "TemplateFilter": { "alias": "TemplateFilter"; "required": false; }; "templateFilter": { "alias": "templateFilter"; "required": false; }; "EntityInfo": { "alias": "EntityInfo"; "required": false; }; "entityInfo": { "alias": "entityInfo"; "required": false; }; "RunViewParams": { "alias": "RunViewParams"; "required": false; }; "runViewParams": { "alias": "runViewParams"; "required": false; }; }, { "TemplateSelected": "TemplateSelected"; "templateSelected": "templateSelected"; }, never, never, false, never>;
|
|
35
97
|
}
|
|
36
98
|
//# sourceMappingURL=preview.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.component.d.ts","sourceRoot":"","sources":["../../src/lib/preview.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAS,MAAM,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAoC,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACzG,OAAO,EAAE,UAAU,EAAW,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAA2B,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;;AAKlG;;GAEG;AACH,qBAMa,oCAAqC,SAAQ,oBAAqB,YAAW,MAAM;IACrF,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"preview.component.d.ts","sourceRoot":"","sources":["../../src/lib/preview.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAS,MAAM,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAoC,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;A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AAM,CAEjB;IACD,oCAAoC;IACpC,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAEM,eAAe,EAAE,gBAAgB,EAAE,CAAM;IAEhD,+CAA+C;IAC/C,IAAW,eAAe,IAAI,gBAAgB,EAAE,CAE/C;IACD,+CAA+C;IAC/C,IAAW,eAAe,CAAC,KAAK,EAAE,gBAAgB,EAAE,EAEnD;IACD,mBAAmB,EAAE,MAAM,CAAK;IAEhC,mDAAmD;IACnD,IAAI,mBAAmB,IAAI,MAAM,CAEhC;IACD,mDAAmD;IACnD,IAAI,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAEpC;IACM,OAAO,EAAE,OAAO,CAAS;IAEhC,uCAAuC;IACvC,IAAW,OAAO,IAAI,OAAO,CAE5B;IACD,uCAAuC;IACvC,IAAW,OAAO,CAAC,KAAK,EAAE,OAAO,EAEhC;;IAKK,QAAQ;IAOR,aAAa;IAuBnB,6CAA6C;IACvC,aAAa;IAInB,cAAc,CAAC,QAAQ,EAAE,wBAAwB;IAOjD,8CAA8C;IAC9C,cAAc,CAAC,QAAQ,EAAE,wBAAwB;cAIjC,mBAAmB;IAwCnC,yBAAyB,IAAI,MAAM;IAUnC,yDAAyD;IACzD,yBAAyB,IAAI,MAAM;IAGnC,sBAAsB,IAAI,MAAM;IAUhC,sDAAsD;IACtD,sBAAsB,IAAI,MAAM;IAIhC,MAAM;IAIN,sCAAsC;IACtC,MAAM;IAKN,YAAY;IAIZ,4CAA4C;IAC5C,YAAY;IAIZ,WAAW;IAIX,2CAA2C;IAC3C,WAAW;IAIX,WAAW;IAMX,2CAA2C;IAC3C,WAAW;IAIX,eAAe;IAMf,+CAA+C;IAC/C,eAAe;yCA7QJ,oCAAoC;2CAApC,oCAAoC;CAgRhD"}
|
|
@@ -118,25 +118,105 @@ function EntityCommunicationsPreviewComponent_Conditional_2_Template(rf, ctx) {
|
|
|
118
118
|
* Component for previewing in the UI what a communication will look like when sent using a specific entity and parameters for running a view that drive a dataset against a given template
|
|
119
119
|
*/
|
|
120
120
|
export class EntityCommunicationsPreviewComponent extends BaseAngularComponent {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
TemplateFilter;
|
|
122
|
+
/** @deprecated Use {@link TemplateFilter}. */
|
|
123
|
+
set templateFilter(value) {
|
|
124
|
+
this.TemplateFilter = value;
|
|
125
|
+
}
|
|
126
|
+
/** @deprecated Use {@link TemplateFilter}. */
|
|
127
|
+
get templateFilter() {
|
|
128
|
+
return this.TemplateFilter;
|
|
129
|
+
}
|
|
130
|
+
EntityInfo;
|
|
131
|
+
/** @deprecated Use {@link EntityInfo}. */
|
|
132
|
+
set entityInfo(value) {
|
|
133
|
+
this.EntityInfo = value;
|
|
134
|
+
}
|
|
135
|
+
/** @deprecated Use {@link EntityInfo}. */
|
|
136
|
+
get entityInfo() {
|
|
137
|
+
return this.EntityInfo;
|
|
138
|
+
}
|
|
139
|
+
RunViewParams;
|
|
140
|
+
/** @deprecated Use {@link RunViewParams}. */
|
|
141
|
+
set runViewParams(value) {
|
|
142
|
+
this.RunViewParams = value;
|
|
143
|
+
}
|
|
144
|
+
/** @deprecated Use {@link RunViewParams}. */
|
|
145
|
+
get runViewParams() {
|
|
146
|
+
return this.RunViewParams;
|
|
147
|
+
}
|
|
148
|
+
TemplateSelected = new EventEmitter();
|
|
149
|
+
/**
|
|
150
|
+
* @deprecated Use {@link TemplateSelected}.
|
|
151
|
+
*
|
|
152
|
+
* The same emitter under the old binding name, so a template still binding
|
|
153
|
+
* (templateSelected) keeps working. Must stay AFTER TemplateSelected: class fields
|
|
154
|
+
* initialise in order, and the other way round this captures undefined.
|
|
155
|
+
*/
|
|
156
|
+
templateSelected = this.TemplateSelected;
|
|
157
|
+
Templates = [];
|
|
158
|
+
/** @deprecated Use {@link Templates}. */
|
|
159
|
+
get templates() {
|
|
160
|
+
return this.Templates;
|
|
161
|
+
}
|
|
162
|
+
/** @deprecated Use {@link Templates}. */
|
|
163
|
+
set templates(value) {
|
|
164
|
+
this.Templates = value;
|
|
165
|
+
}
|
|
166
|
+
SelectedTemplate = null;
|
|
167
|
+
/** @deprecated Use {@link SelectedTemplate}. */
|
|
168
|
+
get selectedTemplate() {
|
|
169
|
+
return this.SelectedTemplate;
|
|
170
|
+
}
|
|
171
|
+
/** @deprecated Use {@link SelectedTemplate}. */
|
|
172
|
+
set selectedTemplate(value) {
|
|
173
|
+
this.SelectedTemplate = value;
|
|
174
|
+
}
|
|
175
|
+
Step = 1;
|
|
176
|
+
/** @deprecated Use {@link Step}. */
|
|
177
|
+
get step() {
|
|
178
|
+
return this.Step;
|
|
179
|
+
}
|
|
180
|
+
/** @deprecated Use {@link Step}. */
|
|
181
|
+
set step(value) {
|
|
182
|
+
this.Step = value;
|
|
183
|
+
}
|
|
184
|
+
PreviewMessages = [];
|
|
185
|
+
/** @deprecated Use {@link PreviewMessages}. */
|
|
186
|
+
get previewMessages() {
|
|
187
|
+
return this.PreviewMessages;
|
|
188
|
+
}
|
|
189
|
+
/** @deprecated Use {@link PreviewMessages}. */
|
|
190
|
+
set previewMessages(value) {
|
|
191
|
+
this.PreviewMessages = value;
|
|
192
|
+
}
|
|
193
|
+
CurrentMessageIndex = 0;
|
|
194
|
+
/** @deprecated Use {@link CurrentMessageIndex}. */
|
|
195
|
+
get currentMessageIndex() {
|
|
196
|
+
return this.CurrentMessageIndex;
|
|
197
|
+
}
|
|
198
|
+
/** @deprecated Use {@link CurrentMessageIndex}. */
|
|
199
|
+
set currentMessageIndex(value) {
|
|
200
|
+
this.CurrentMessageIndex = value;
|
|
201
|
+
}
|
|
202
|
+
Loading = false;
|
|
203
|
+
/** @deprecated Use {@link Loading}. */
|
|
204
|
+
get loading() {
|
|
205
|
+
return this.Loading;
|
|
206
|
+
}
|
|
207
|
+
/** @deprecated Use {@link Loading}. */
|
|
208
|
+
set loading(value) {
|
|
209
|
+
this.Loading = value;
|
|
210
|
+
}
|
|
131
211
|
constructor() {
|
|
132
212
|
super();
|
|
133
213
|
}
|
|
134
214
|
async ngOnInit() {
|
|
135
|
-
if (!this.
|
|
215
|
+
if (!this.EntityInfo || !this.RunViewParams)
|
|
136
216
|
throw new Error("EntityInfo and RunViewParams are required");
|
|
137
|
-
await this.
|
|
217
|
+
await this.LoadTemplates();
|
|
138
218
|
}
|
|
139
|
-
async
|
|
219
|
+
async LoadTemplates() {
|
|
140
220
|
// load up all template metadata
|
|
141
221
|
const rv = RunView.FromMetadataProvider(this.ProviderToUse);
|
|
142
222
|
// Dialect-neutral "active now" cutoff: GETDATE() does not exist on PostgreSQL,
|
|
@@ -144,26 +224,34 @@ export class EntityCommunicationsPreviewComponent extends BaseAngularComponent {
|
|
|
144
224
|
const nowIso = new Date().toISOString();
|
|
145
225
|
const result = await rv.RunView({
|
|
146
226
|
EntityName: "MJ: Templates",
|
|
147
|
-
ExtraFilter: `(IsActive = 1 AND (ActiveAt IS NULL OR ActiveAt <= '${nowIso}')) ${this.
|
|
227
|
+
ExtraFilter: `(IsActive = 1 AND (ActiveAt IS NULL OR ActiveAt <= '${nowIso}')) ${this.TemplateFilter ? `AND ${this.TemplateFilter}` : ''}`,
|
|
148
228
|
ResultType: 'entity_object'
|
|
149
229
|
});
|
|
150
230
|
const content = await rv.RunView({
|
|
151
231
|
EntityName: "MJ: Template Contents",
|
|
152
232
|
ResultType: 'entity_object'
|
|
153
233
|
});
|
|
154
|
-
this.
|
|
155
|
-
this.
|
|
234
|
+
this.Templates = result.Results;
|
|
235
|
+
this.Templates.forEach(template => {
|
|
156
236
|
template.Content = content.Results.filter(c => UUIDsEqual(c.TemplateID, template.ID));
|
|
157
237
|
});
|
|
158
238
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
this.
|
|
162
|
-
|
|
239
|
+
/** @deprecated Use {@link LoadTemplates}. */
|
|
240
|
+
async loadTemplates() {
|
|
241
|
+
return this.LoadTemplates();
|
|
242
|
+
}
|
|
243
|
+
SelectTemplate(template) {
|
|
244
|
+
this.SelectedTemplate = template;
|
|
245
|
+
this.TemplateSelected.emit(template);
|
|
246
|
+
this.Step = 2;
|
|
163
247
|
this.loadMessagePreviews();
|
|
164
248
|
}
|
|
249
|
+
/** @deprecated Use {@link SelectTemplate}. */
|
|
250
|
+
selectTemplate(template) {
|
|
251
|
+
return this.SelectTemplate(template);
|
|
252
|
+
}
|
|
165
253
|
async loadMessagePreviews() {
|
|
166
|
-
this.
|
|
254
|
+
this.Loading = true;
|
|
167
255
|
const msg = new Message();
|
|
168
256
|
msg.From = "amith@bluecypress.io";
|
|
169
257
|
msg.Subject = "Test Subject";
|
|
@@ -173,14 +261,14 @@ export class EntityCommunicationsPreviewComponent extends BaseAngularComponent {
|
|
|
173
261
|
const email = sendGrid.MessageTypes.find(mt => mt.Name === "Email");
|
|
174
262
|
if (!email)
|
|
175
263
|
throw new Error("Email message type not found");
|
|
176
|
-
if (!this.
|
|
264
|
+
if (!this.SelectedTemplate)
|
|
177
265
|
throw new Error("No template selected");
|
|
178
266
|
msg.MessageType = email;
|
|
179
|
-
msg.HTMLBodyTemplate = this.
|
|
267
|
+
msg.HTMLBodyTemplate = this.SelectedTemplate;
|
|
180
268
|
msg.SubjectTemplate = TemplateEngineBase.Instance.FindTemplate('Test Subject Template');
|
|
181
269
|
const commParams = {
|
|
182
|
-
EntityID: this.
|
|
183
|
-
RunViewParams: this.
|
|
270
|
+
EntityID: this.EntityInfo.ID,
|
|
271
|
+
RunViewParams: this.RunViewParams,
|
|
184
272
|
ProviderName: "SendGrid",
|
|
185
273
|
ProviderMessageTypeName: "Email",
|
|
186
274
|
Message: msg,
|
|
@@ -189,47 +277,75 @@ export class EntityCommunicationsPreviewComponent extends BaseAngularComponent {
|
|
|
189
277
|
};
|
|
190
278
|
const result = await EntityCommunicationsEngineClient.Instance.RunEntityCommunication(commParams);
|
|
191
279
|
if (result && result.Success && result.Results) {
|
|
192
|
-
this.
|
|
280
|
+
this.PreviewMessages = result.Results.map(r => r.Message);
|
|
193
281
|
}
|
|
194
|
-
this.
|
|
282
|
+
this.Loading = false;
|
|
195
283
|
}
|
|
196
|
-
|
|
197
|
-
if (this.
|
|
198
|
-
if (this.
|
|
199
|
-
return this.
|
|
284
|
+
CurrentPreviewItemSubject() {
|
|
285
|
+
if (this.PreviewMessages && this.PreviewMessages.length > 0) {
|
|
286
|
+
if (this.CurrentMessageIndex >= 0 && this.CurrentMessageIndex < this.PreviewMessages.length) {
|
|
287
|
+
return this.PreviewMessages[this.CurrentMessageIndex].ProcessedSubject;
|
|
200
288
|
}
|
|
201
289
|
}
|
|
202
290
|
return 'Error processing template content';
|
|
203
291
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
292
|
+
/** @deprecated Use {@link CurrentPreviewItemSubject}. */
|
|
293
|
+
currentPreviewItemSubject() {
|
|
294
|
+
return this.CurrentPreviewItemSubject();
|
|
295
|
+
}
|
|
296
|
+
CurrentPreviewItemBody() {
|
|
297
|
+
if (this.PreviewMessages && this.PreviewMessages.length > 0) {
|
|
298
|
+
if (this.CurrentMessageIndex >= 0 && this.CurrentMessageIndex < this.PreviewMessages.length) {
|
|
299
|
+
return this.PreviewMessages[this.CurrentMessageIndex].ProcessedHTMLBody;
|
|
208
300
|
}
|
|
209
301
|
}
|
|
210
302
|
return 'Error processing template content';
|
|
211
303
|
}
|
|
304
|
+
/** @deprecated Use {@link CurrentPreviewItemBody}. */
|
|
305
|
+
currentPreviewItemBody() {
|
|
306
|
+
return this.CurrentPreviewItemBody();
|
|
307
|
+
}
|
|
308
|
+
GoBack() {
|
|
309
|
+
this.Step = 1;
|
|
310
|
+
}
|
|
311
|
+
/** @deprecated Use {@link GoBack}. */
|
|
212
312
|
goBack() {
|
|
213
|
-
this.
|
|
313
|
+
return this.GoBack();
|
|
214
314
|
}
|
|
315
|
+
FirstMessage() {
|
|
316
|
+
this.CurrentMessageIndex = 0;
|
|
317
|
+
}
|
|
318
|
+
/** @deprecated Use {@link FirstMessage}. */
|
|
215
319
|
firstMessage() {
|
|
216
|
-
this.
|
|
320
|
+
return this.FirstMessage();
|
|
321
|
+
}
|
|
322
|
+
LastMessage() {
|
|
323
|
+
this.CurrentMessageIndex = this.PreviewMessages.length - 1;
|
|
217
324
|
}
|
|
325
|
+
/** @deprecated Use {@link LastMessage}. */
|
|
218
326
|
lastMessage() {
|
|
219
|
-
|
|
327
|
+
return this.LastMessage();
|
|
220
328
|
}
|
|
329
|
+
NextMessage() {
|
|
330
|
+
if (this.CurrentMessageIndex < this.PreviewMessages.length - 1) {
|
|
331
|
+
this.CurrentMessageIndex++;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
/** @deprecated Use {@link NextMessage}. */
|
|
221
335
|
nextMessage() {
|
|
222
|
-
|
|
223
|
-
|
|
336
|
+
return this.NextMessage();
|
|
337
|
+
}
|
|
338
|
+
PreviousMessage() {
|
|
339
|
+
if (this.CurrentMessageIndex > 0) {
|
|
340
|
+
this.CurrentMessageIndex--;
|
|
224
341
|
}
|
|
225
342
|
}
|
|
343
|
+
/** @deprecated Use {@link PreviousMessage}. */
|
|
226
344
|
previousMessage() {
|
|
227
|
-
|
|
228
|
-
this.currentMessageIndex--;
|
|
229
|
-
}
|
|
345
|
+
return this.PreviousMessage();
|
|
230
346
|
}
|
|
231
347
|
static ɵfac = function EntityCommunicationsPreviewComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || EntityCommunicationsPreviewComponent)(); };
|
|
232
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityCommunicationsPreviewComponent, selectors: [["mj-entity-communications-preview"]], inputs: { templateFilter: "templateFilter", entityInfo: "entityInfo", runViewParams: "runViewParams" }, outputs: { templateSelected: "templateSelected" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 2, consts: [[1, "step-1"], [1, "step-2"], [3, "click"], ["size", "medium", 3, "showText"], ["mjButton", "", 3, "click"], [1, "vcr-controls"], ["aria-label", "First", 3, "click", "disabled"], [1, "fas", "fa-angle-double-left"], ["aria-label", "Previous", 3, "click", "disabled"], [1, "fas", "fa-angle-left"], [1, "index-indicator"], ["aria-label", "Next", 3, "click", "disabled"], [1, "fas", "fa-angle-right"], ["aria-label", "Last", 3, "click", "disabled"], [1, "fas", "fa-angle-double-right"], [1, "template-preview"], [1, "subject-line"], [1, "preview-body", 3, "innerHTML"]], template: function EntityCommunicationsPreviewComponent_Template(rf, ctx) { if (rf & 1) {
|
|
348
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityCommunicationsPreviewComponent, selectors: [["mj-entity-communications-preview"]], inputs: { TemplateFilter: "TemplateFilter", templateFilter: "templateFilter", EntityInfo: "EntityInfo", entityInfo: "entityInfo", RunViewParams: "RunViewParams", runViewParams: "runViewParams" }, outputs: { TemplateSelected: "TemplateSelected", templateSelected: "templateSelected" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 2, consts: [[1, "step-1"], [1, "step-2"], [3, "click"], ["size", "medium", 3, "showText"], ["mjButton", "", 3, "click"], [1, "vcr-controls"], ["aria-label", "First", 3, "click", "disabled"], [1, "fas", "fa-angle-double-left"], ["aria-label", "Previous", 3, "click", "disabled"], [1, "fas", "fa-angle-left"], [1, "index-indicator"], ["aria-label", "Next", 3, "click", "disabled"], [1, "fas", "fa-angle-right"], ["aria-label", "Last", 3, "click", "disabled"], [1, "fas", "fa-angle-double-right"], [1, "template-preview"], [1, "subject-line"], [1, "preview-body", 3, "innerHTML"]], template: function EntityCommunicationsPreviewComponent_Template(rf, ctx) { if (rf & 1) {
|
|
233
349
|
i0.ɵɵelementStart(0, "div");
|
|
234
350
|
i0.ɵɵconditionalCreate(1, EntityCommunicationsPreviewComponent_Conditional_1_Template, 6, 0, "div", 0);
|
|
235
351
|
i0.ɵɵconditionalCreate(2, EntityCommunicationsPreviewComponent_Conditional_2_Template, 3, 1, "div", 1);
|
|
@@ -244,12 +360,20 @@ export class EntityCommunicationsPreviewComponent extends BaseAngularComponent {
|
|
|
244
360
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EntityCommunicationsPreviewComponent, [{
|
|
245
361
|
type: Component,
|
|
246
362
|
args: [{ standalone: false, selector: 'mj-entity-communications-preview', template: "<div>\n @if (step === 1) {\n <div class=\"step-1\">\n <h2>Select a Template</h2>\n <ul>\n @for (template of templates; track template) {\n <li (click)=\"selectTemplate(template)\">\n {{ template.Name }}\n </li>\n }\n </ul>\n </div>\n }\n\n @if (step === 2) {\n <div class=\"step-2\">\n @if(!loading) {\n @if (previewMessages.length === 0) {\n <h2>No Messages Available</h2>\n <button mjButton (click)=\"goBack()\">Back</button>\n }\n @else {\n <h2>Preview {{ selectedTemplate?.Name }}</h2>\n <button mjButton (click)=\"goBack()\">Back</button>\n <div class=\"vcr-controls\">\n <button (click)=\"firstMessage()\" aria-label=\"First\" [disabled]=\"currentMessageIndex === 0\">\n <span class=\"fas fa-angle-double-left\"></span>\n </button>\n <button (click)=\"previousMessage()\" aria-label=\"Previous\" [disabled]=\"currentMessageIndex === 0\">\n <span class=\"fas fa-angle-left\"></span>\n </button>\n <span class=\"index-indicator\">{{ currentMessageIndex + 1 }} of {{ previewMessages.length }}</span>\n <button (click)=\"nextMessage()\" aria-label=\"Next\" [disabled]=\"currentMessageIndex >= previewMessages.length - 1\">\n <span class=\"fas fa-angle-right\"></span>\n </button>\n <button (click)=\"lastMessage()\" aria-label=\"Last\" [disabled]=\"currentMessageIndex >= previewMessages.length - 1\">\n <span class=\"fas fa-angle-double-right\"></span>\n </button>\n </div>\n <div class=\"template-preview\">\n <div class=\"subject-line\">{{currentPreviewItemSubject()}}</div>\n <!-- XSS: mjSafeRichHtml pipe sanitizes with DOMPurify (HTML + SVG profiles) so template body cannot contain malicious scripts -->\n <div class=\"preview-body\" [innerHTML]=\"currentPreviewItemBody() | mjSafeRichHtml\"></div>\n </div>\n }\n }\n @else {\n <mj-loading [showText]=\"false\" size=\"medium\"></mj-loading>\n }\n</div>\n}\n</div>", styles: [".step-1, .step-2 {\n margin: 20px 0;\n}\n\n.template-preview {\n border: 1px solid var(--mj-border-strong);\n margin-top: 10px;\n}\n\n.subject-line {\n font-weight: bolder;\n border-bottom: 1px solid var(--mj-border-strong);\n padding: 5px;\n}\n\n.preview-body {\n padding: 5px;\n}\n\nul {\n list-style: none;\n padding: 0;\n}\n\nli {\n padding: 10px;\n border: 1px solid var(--mj-border-strong);\n margin: 5px 0;\n cursor: pointer;\n}\n\nli:hover {\n background-color: var(--mj-bg-surface-sunken);\n}\n\n.vcr-controls {\n margin-top: 5px;\n margin-bottom: 15px;\n}\n\n.vcr-controls button {\n margin-right: 5px;\n background: none;\n border: none;\n cursor: pointer;\n font-size: 20px;\n color: var(--mj-brand-primary);\n}\n\n.vcr-controls button:hover {\n color: var(--mj-brand-primary-hover);\n}\n\n.vcr-controls button:disabled {\n color: var(--mj-border-strong);\n cursor: not-allowed;\n}\n\n.vcr-controls button:disabled span {\n color: var(--mj-border-strong);\n}\n\n.index-indicator {\n margin: 0 10px;\n}"] }]
|
|
247
|
-
}], () => [], {
|
|
363
|
+
}], () => [], { TemplateFilter: [{
|
|
364
|
+
type: Input
|
|
365
|
+
}], templateFilter: [{
|
|
366
|
+
type: Input
|
|
367
|
+
}], EntityInfo: [{
|
|
248
368
|
type: Input
|
|
249
369
|
}], entityInfo: [{
|
|
250
370
|
type: Input
|
|
371
|
+
}], RunViewParams: [{
|
|
372
|
+
type: Input
|
|
251
373
|
}], runViewParams: [{
|
|
252
374
|
type: Input
|
|
375
|
+
}], TemplateSelected: [{
|
|
376
|
+
type: Output
|
|
253
377
|
}], templateSelected: [{
|
|
254
378
|
type: Output
|
|
255
379
|
}] }); })();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.component.js","sourceRoot":"","sources":["../../src/lib/preview.component.ts","../../src/lib/preview.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AC,mBAAmB,GAAG,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC7B,CAAC;IACH,CAAC;8HAxIU,oCAAoC;6DAApC,oCAAoC;YCnBjD,2BAAK;YACH,sGAAkB;YAalB,sGAAkB;YAqCpB,iBAAM;;YAlDJ,cAWC;YAXD,yCAWC;YAED,cAoCD;YApCC,yCAoCD;;;iFD/BY,oCAAoC;cANhD,SAAS;6BACI,KAAK,YACP,kCAAkC;;kBAK3C,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,MAAM;;kFAJI,oCAAoC","sourcesContent":["import { Component, Output, EventEmitter, Input, OnInit } from '@angular/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { CommunicationEngineBase, Message, ProcessedMessage } from '@memberjunction/communication-types';\nimport { EntityInfo, RunView, RunViewParams } from '@memberjunction/core';\nimport { UUIDsEqual } from '@memberjunction/global';\nimport { MJTemplateContentEntity, MJTemplateEntityExtended } from '@memberjunction/core-entities';\nimport { EntityCommunicationParams } from '@memberjunction/entity-communications-base';\nimport { EntityCommunicationsEngineClient } from '@memberjunction/entity-communications-client';\nimport { TemplateEngineBase } from '@memberjunction/templates-base-types';\n\n/**\n * Component for previewing in the UI what a communication will look like when sent using a specific entity and parameters for running a view that drive a dataset against a given template\n */\n@Component({\n standalone: false,\n selector: 'mj-entity-communications-preview',\n templateUrl: './preview.component.html',\n styleUrls: ['./preview.component.css']\n})\nexport class EntityCommunicationsPreviewComponent extends BaseAngularComponent implements OnInit {\n @Input() templateFilter: string | undefined;\n @Input() entityInfo: EntityInfo | undefined;\n @Input() runViewParams: RunViewParams | undefined;\n @Output() templateSelected = new EventEmitter<MJTemplateEntityExtended>();\n\n templates: MJTemplateEntityExtended[] = [];\n selectedTemplate: MJTemplateEntityExtended | null = null;\n step: number = 1;\n\n public previewMessages: ProcessedMessage[] = [];\n currentMessageIndex: number = 0;\n public loading: boolean = false;\n\n constructor() {\n super();}\n\n async ngOnInit() {\n if (!this.entityInfo || !this.runViewParams)\n throw new Error(\"EntityInfo and RunViewParams are required\");\n\n await this.loadTemplates();\n }\n\n async loadTemplates() {\n // load up all template metadata\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n // Dialect-neutral \"active now\" cutoff: GETDATE() does not exist on PostgreSQL,\n // so inject a JS-computed ISO-8601 literal instead.\n const nowIso = new Date().toISOString();\n const result = await rv.RunView<MJTemplateEntityExtended>(\n {\n EntityName: \"MJ: Templates\",\n ExtraFilter: `(IsActive = 1 AND (ActiveAt IS NULL OR ActiveAt <= '${nowIso}')) ${this.templateFilter ? `AND ${this.templateFilter}` : ''}`,\n ResultType: 'entity_object'\n }\n );\n const content = await rv.RunView<MJTemplateContentEntity>({\n EntityName: \"MJ: Template Contents\",\n ResultType: 'entity_object'\n })\n this.templates = result.Results;\n this.templates.forEach(template => {\n template.Content = content.Results.filter(c => UUIDsEqual(c.TemplateID, template.ID));\n });\n }\n\n selectTemplate(template: MJTemplateEntityExtended) {\n this.selectedTemplate = template;\n this.templateSelected.emit(template);\n this.step = 2;\n this.loadMessagePreviews(); \n }\n\n protected async loadMessagePreviews() {\n this.loading = true;\n\n const msg: Message = new Message();\n msg.From = \"amith@bluecypress.io\"\n msg.Subject = \"Test Subject\";\n\n const sendGrid = CommunicationEngineBase.Instance.Providers.find(p => p.Name === \"SendGrid\")\n if (!sendGrid)\n throw new Error(\"SendGrid provider not found\");\n\n const email = sendGrid.MessageTypes.find(mt => mt.Name === \"Email\");\n if (!email) \n throw new Error(\"Email message type not found\");\n\n if (!this.selectedTemplate)\n throw new Error(\"No template selected\");\n\n msg.MessageType = email;\n\n msg.HTMLBodyTemplate = this.selectedTemplate;\n msg.SubjectTemplate = TemplateEngineBase.Instance.FindTemplate('Test Subject Template')\n \n const commParams: EntityCommunicationParams = {\n EntityID: this.entityInfo!.ID, \n RunViewParams: this.runViewParams!, \n ProviderName: \"SendGrid\", \n ProviderMessageTypeName: \"Email\", \n Message: msg,\n PreviewOnly: true,\n IncludeProcessedMessages: true\n }\n const result = await EntityCommunicationsEngineClient.Instance.RunEntityCommunication(commParams);\n if (result && result.Success && result.Results) {\n this.previewMessages = result.Results.map(r => r.Message)\n }\n\n this.loading = false;\n }\n\n currentPreviewItemSubject(): string {\n if (this.previewMessages && this.previewMessages.length > 0) {\n if (this.currentMessageIndex >=0 && this.currentMessageIndex < this.previewMessages.length) {\n return this.previewMessages[this.currentMessageIndex].ProcessedSubject!; \n }\n }\n\n return 'Error processing template content';\n }\n currentPreviewItemBody(): string {\n if (this.previewMessages && this.previewMessages.length > 0) {\n if (this.currentMessageIndex >=0 && this.currentMessageIndex < this.previewMessages.length) {\n return this.previewMessages[this.currentMessageIndex].ProcessedHTMLBody!; \n }\n }\n\n return 'Error processing template content';\n }\n\n goBack() {\n this.step = 1;\n }\n\n\n firstMessage() {\n this.currentMessageIndex = 0;\n }\n\n lastMessage() {\n this.currentMessageIndex = this.previewMessages.length - 1;\n }\n\n nextMessage() {\n if (this.currentMessageIndex < this.previewMessages.length - 1) {\n this.currentMessageIndex++;\n }\n }\n\n previousMessage() {\n if (this.currentMessageIndex > 0) {\n this.currentMessageIndex--;\n }\n }\n}\n\n ","<div>\n @if (step === 1) {\n <div class=\"step-1\">\n <h2>Select a Template</h2>\n <ul>\n @for (template of templates; track template) {\n <li (click)=\"selectTemplate(template)\">\n {{ template.Name }}\n </li>\n }\n </ul>\n </div>\n }\n\n @if (step === 2) {\n <div class=\"step-2\">\n @if(!loading) {\n @if (previewMessages.length === 0) {\n <h2>No Messages Available</h2>\n <button mjButton (click)=\"goBack()\">Back</button>\n }\n @else {\n <h2>Preview {{ selectedTemplate?.Name }}</h2>\n <button mjButton (click)=\"goBack()\">Back</button>\n <div class=\"vcr-controls\">\n <button (click)=\"firstMessage()\" aria-label=\"First\" [disabled]=\"currentMessageIndex === 0\">\n <span class=\"fas fa-angle-double-left\"></span>\n </button>\n <button (click)=\"previousMessage()\" aria-label=\"Previous\" [disabled]=\"currentMessageIndex === 0\">\n <span class=\"fas fa-angle-left\"></span>\n </button>\n <span class=\"index-indicator\">{{ currentMessageIndex + 1 }} of {{ previewMessages.length }}</span>\n <button (click)=\"nextMessage()\" aria-label=\"Next\" [disabled]=\"currentMessageIndex >= previewMessages.length - 1\">\n <span class=\"fas fa-angle-right\"></span>\n </button>\n <button (click)=\"lastMessage()\" aria-label=\"Last\" [disabled]=\"currentMessageIndex >= previewMessages.length - 1\">\n <span class=\"fas fa-angle-double-right\"></span>\n </button>\n </div>\n <div class=\"template-preview\">\n <div class=\"subject-line\">{{currentPreviewItemSubject()}}</div>\n <!-- XSS: mjSafeRichHtml pipe sanitizes with DOMPurify (HTML + SVG profiles) so template body cannot contain malicious scripts -->\n <div class=\"preview-body\" [innerHTML]=\"currentPreviewItemBody() | mjSafeRichHtml\"></div>\n </div>\n }\n }\n @else {\n <mj-loading [showText]=\"false\" size=\"medium\"></mj-loading>\n }\n</div>\n}\n</div>"]}
|
|
1
|
+
{"version":3,"file":"preview.component.js","sourceRoot":"","sources":["../../src/lib/preview.component.ts","../../src/lib/preview.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAoB,MAAM,qCAAqC,CAAC;AACzG,OAAO,EAAc,OAAO,EAAiB,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;;;;;;ICFhE,6BAAuC;IAAnC,yOAAS,kCAAwB,KAAC;IACpC,YACF;IAAA,iBAAK;;;IADH,cACF;IADE,iDACF;;;IALJ,AADF,8BAAoB,SACd;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AAC;IAGD,YAAY;QACV,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,4CAA4C;IAC5C,YAAY;QACV,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;IAC7B,CAAC;IAED,WAAW;QACT,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7D,CAAC;IAED,2CAA2C;IAC3C,WAAW;QACT,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;IAED,WAAW;QACT,IAAI,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/D,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,2CAA2C;IAC3C,WAAW;QACT,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;IAED,eAAe;QACb,IAAI,IAAI,CAAC,mBAAmB,GAAG,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,+CAA+C;IAC/C,eAAe;QACb,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;8HA/QU,oCAAoC;6DAApC,oCAAoC;YCnBjD,2BAAK;YACH,sGAAkB;YAalB,sGAAkB;YAqCpB,iBAAM;;YAlDJ,cAWC;YAXD,yCAWC;YAED,cAoCD;YApCC,yCAoCD;;;iFD/BY,oCAAoC;cANhD,SAAS;6BACI,KAAK,YACP,kCAAkC;;kBAK3C,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAOL,MAAM;;kBASN,MAAM;;kFAxCI,oCAAoC","sourcesContent":["import { Component, Output, EventEmitter, Input, OnInit } from '@angular/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { CommunicationEngineBase, Message, ProcessedMessage } from '@memberjunction/communication-types';\nimport { EntityInfo, RunView, RunViewParams } from '@memberjunction/core';\nimport { UUIDsEqual } from '@memberjunction/global';\nimport { MJTemplateContentEntity, MJTemplateEntityExtended } from '@memberjunction/core-entities';\nimport { EntityCommunicationParams } from '@memberjunction/entity-communications-base';\nimport { EntityCommunicationsEngineClient } from '@memberjunction/entity-communications-client';\nimport { TemplateEngineBase } from '@memberjunction/templates-base-types';\n\n/**\n * Component for previewing in the UI what a communication will look like when sent using a specific entity and parameters for running a view that drive a dataset against a given template\n */\n@Component({\n standalone: false,\n selector: 'mj-entity-communications-preview',\n templateUrl: './preview.component.html',\n styleUrls: ['./preview.component.css']\n})\nexport class EntityCommunicationsPreviewComponent extends BaseAngularComponent implements OnInit {\n @Input() TemplateFilter: string | undefined;\n\n /** @deprecated Use {@link TemplateFilter}. */\n @Input() set templateFilter(value: string | undefined) {\n this.TemplateFilter = value;\n }\n /** @deprecated Use {@link TemplateFilter}. */\n get templateFilter(): string | undefined {\n return this.TemplateFilter;\n }\n @Input() EntityInfo: EntityInfo | undefined;\n\n /** @deprecated Use {@link EntityInfo}. */\n @Input() set entityInfo(value: EntityInfo | undefined) {\n this.EntityInfo = value;\n }\n /** @deprecated Use {@link EntityInfo}. */\n get entityInfo(): EntityInfo | undefined {\n return this.EntityInfo;\n }\n @Input() RunViewParams: RunViewParams | undefined;\n\n /** @deprecated Use {@link RunViewParams}. */\n @Input() set runViewParams(value: RunViewParams | undefined) {\n this.RunViewParams = value;\n }\n /** @deprecated Use {@link RunViewParams}. */\n get runViewParams(): RunViewParams | undefined {\n return this.RunViewParams;\n }\n @Output() TemplateSelected = new EventEmitter<MJTemplateEntityExtended>();\n\n /**\n * @deprecated Use {@link TemplateSelected}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (templateSelected) keeps working. Must stay AFTER TemplateSelected: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() templateSelected = this.TemplateSelected;\n\n Templates: MJTemplateEntityExtended[] = [];\n\n /** @deprecated Use {@link Templates}. */\n get templates(): MJTemplateEntityExtended[] {\n return this.Templates;\n }\n /** @deprecated Use {@link Templates}. */\n set templates(value: MJTemplateEntityExtended[]) {\n this.Templates = value;\n }\n SelectedTemplate: MJTemplateEntityExtended | null = null;\n\n /** @deprecated Use {@link SelectedTemplate}. */\n get selectedTemplate(): MJTemplateEntityExtended | null {\n return this.SelectedTemplate;\n }\n /** @deprecated Use {@link SelectedTemplate}. */\n set selectedTemplate(value: MJTemplateEntityExtended | null) {\n this.SelectedTemplate = value;\n }\n Step: number = 1;\n\n /** @deprecated Use {@link Step}. */\n get step(): number {\n return this.Step;\n }\n /** @deprecated Use {@link Step}. */\n set step(value: number) {\n this.Step = value;\n }\n\n public PreviewMessages: ProcessedMessage[] = [];\n\n /** @deprecated Use {@link PreviewMessages}. */\n public get previewMessages(): ProcessedMessage[] {\n return this.PreviewMessages;\n }\n /** @deprecated Use {@link PreviewMessages}. */\n public set previewMessages(value: ProcessedMessage[]) {\n this.PreviewMessages = value;\n }\n CurrentMessageIndex: number = 0;\n\n /** @deprecated Use {@link CurrentMessageIndex}. */\n get currentMessageIndex(): number {\n return this.CurrentMessageIndex;\n }\n /** @deprecated Use {@link CurrentMessageIndex}. */\n set currentMessageIndex(value: number) {\n this.CurrentMessageIndex = value;\n }\n public Loading: boolean = false;\n\n /** @deprecated Use {@link Loading}. */\n public get loading(): boolean {\n return this.Loading;\n }\n /** @deprecated Use {@link Loading}. */\n public set loading(value: boolean) {\n this.Loading = value;\n }\n\n constructor() {\n super();}\n\n async ngOnInit() {\n if (!this.EntityInfo || !this.RunViewParams)\n throw new Error(\"EntityInfo and RunViewParams are required\");\n\n await this.LoadTemplates();\n }\n\n async LoadTemplates() {\n // load up all template metadata\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n // Dialect-neutral \"active now\" cutoff: GETDATE() does not exist on PostgreSQL,\n // so inject a JS-computed ISO-8601 literal instead.\n const nowIso = new Date().toISOString();\n const result = await rv.RunView<MJTemplateEntityExtended>(\n {\n EntityName: \"MJ: Templates\",\n ExtraFilter: `(IsActive = 1 AND (ActiveAt IS NULL OR ActiveAt <= '${nowIso}')) ${this.TemplateFilter ? `AND ${this.TemplateFilter}` : ''}`,\n ResultType: 'entity_object'\n }\n );\n const content = await rv.RunView<MJTemplateContentEntity>({\n EntityName: \"MJ: Template Contents\",\n ResultType: 'entity_object'\n })\n this.Templates = result.Results;\n this.Templates.forEach(template => {\n template.Content = content.Results.filter(c => UUIDsEqual(c.TemplateID, template.ID));\n });\n }\n\n /** @deprecated Use {@link LoadTemplates}. */\n async loadTemplates() {\n return this.LoadTemplates();\n }\n\n SelectTemplate(template: MJTemplateEntityExtended) {\n this.SelectedTemplate = template;\n this.TemplateSelected.emit(template);\n this.Step = 2;\n this.loadMessagePreviews(); \n }\n\n /** @deprecated Use {@link SelectTemplate}. */\n selectTemplate(template: MJTemplateEntityExtended) {\n return this.SelectTemplate(template);\n }\n\n protected async loadMessagePreviews() {\n this.Loading = true;\n\n const msg: Message = new Message();\n msg.From = \"amith@bluecypress.io\"\n msg.Subject = \"Test Subject\";\n\n const sendGrid = CommunicationEngineBase.Instance.Providers.find(p => p.Name === \"SendGrid\")\n if (!sendGrid)\n throw new Error(\"SendGrid provider not found\");\n\n const email = sendGrid.MessageTypes.find(mt => mt.Name === \"Email\");\n if (!email) \n throw new Error(\"Email message type not found\");\n\n if (!this.SelectedTemplate)\n throw new Error(\"No template selected\");\n\n msg.MessageType = email;\n\n msg.HTMLBodyTemplate = this.SelectedTemplate;\n msg.SubjectTemplate = TemplateEngineBase.Instance.FindTemplate('Test Subject Template')\n \n const commParams: EntityCommunicationParams = {\n EntityID: this.EntityInfo!.ID, \n RunViewParams: this.RunViewParams!, \n ProviderName: \"SendGrid\", \n ProviderMessageTypeName: \"Email\", \n Message: msg,\n PreviewOnly: true,\n IncludeProcessedMessages: true\n }\n const result = await EntityCommunicationsEngineClient.Instance.RunEntityCommunication(commParams);\n if (result && result.Success && result.Results) {\n this.PreviewMessages = result.Results.map(r => r.Message)\n }\n\n this.Loading = false;\n }\n\n CurrentPreviewItemSubject(): string {\n if (this.PreviewMessages && this.PreviewMessages.length > 0) {\n if (this.CurrentMessageIndex >=0 && this.CurrentMessageIndex < this.PreviewMessages.length) {\n return this.PreviewMessages[this.CurrentMessageIndex].ProcessedSubject!; \n }\n }\n\n return 'Error processing template content';\n }\n\n /** @deprecated Use {@link CurrentPreviewItemSubject}. */\n currentPreviewItemSubject(): string {\n return this.CurrentPreviewItemSubject();\n }\n CurrentPreviewItemBody(): string {\n if (this.PreviewMessages && this.PreviewMessages.length > 0) {\n if (this.CurrentMessageIndex >=0 && this.CurrentMessageIndex < this.PreviewMessages.length) {\n return this.PreviewMessages[this.CurrentMessageIndex].ProcessedHTMLBody!; \n }\n }\n\n return 'Error processing template content';\n }\n\n /** @deprecated Use {@link CurrentPreviewItemBody}. */\n currentPreviewItemBody(): string {\n return this.CurrentPreviewItemBody();\n }\n\n GoBack() {\n this.Step = 1;\n }\n\n /** @deprecated Use {@link GoBack}. */\n goBack() {\n return this.GoBack();\n }\n\n\n FirstMessage() {\n this.CurrentMessageIndex = 0;\n }\n\n /** @deprecated Use {@link FirstMessage}. */\n firstMessage() {\n return this.FirstMessage();\n }\n\n LastMessage() {\n this.CurrentMessageIndex = this.PreviewMessages.length - 1;\n }\n\n /** @deprecated Use {@link LastMessage}. */\n lastMessage() {\n return this.LastMessage();\n }\n\n NextMessage() {\n if (this.CurrentMessageIndex < this.PreviewMessages.length - 1) {\n this.CurrentMessageIndex++;\n }\n }\n\n /** @deprecated Use {@link NextMessage}. */\n nextMessage() {\n return this.NextMessage();\n }\n\n PreviousMessage() {\n if (this.CurrentMessageIndex > 0) {\n this.CurrentMessageIndex--;\n }\n }\n\n /** @deprecated Use {@link PreviousMessage}. */\n previousMessage() {\n return this.PreviousMessage();\n }\n}\n\n ","<div>\n @if (step === 1) {\n <div class=\"step-1\">\n <h2>Select a Template</h2>\n <ul>\n @for (template of templates; track template) {\n <li (click)=\"selectTemplate(template)\">\n {{ template.Name }}\n </li>\n }\n </ul>\n </div>\n }\n\n @if (step === 2) {\n <div class=\"step-2\">\n @if(!loading) {\n @if (previewMessages.length === 0) {\n <h2>No Messages Available</h2>\n <button mjButton (click)=\"goBack()\">Back</button>\n }\n @else {\n <h2>Preview {{ selectedTemplate?.Name }}</h2>\n <button mjButton (click)=\"goBack()\">Back</button>\n <div class=\"vcr-controls\">\n <button (click)=\"firstMessage()\" aria-label=\"First\" [disabled]=\"currentMessageIndex === 0\">\n <span class=\"fas fa-angle-double-left\"></span>\n </button>\n <button (click)=\"previousMessage()\" aria-label=\"Previous\" [disabled]=\"currentMessageIndex === 0\">\n <span class=\"fas fa-angle-left\"></span>\n </button>\n <span class=\"index-indicator\">{{ currentMessageIndex + 1 }} of {{ previewMessages.length }}</span>\n <button (click)=\"nextMessage()\" aria-label=\"Next\" [disabled]=\"currentMessageIndex >= previewMessages.length - 1\">\n <span class=\"fas fa-angle-right\"></span>\n </button>\n <button (click)=\"lastMessage()\" aria-label=\"Last\" [disabled]=\"currentMessageIndex >= previewMessages.length - 1\">\n <span class=\"fas fa-angle-double-right\"></span>\n </button>\n </div>\n <div class=\"template-preview\">\n <div class=\"subject-line\">{{currentPreviewItemSubject()}}</div>\n <!-- XSS: mjSafeRichHtml pipe sanitizes with DOMPurify (HTML + SVG profiles) so template body cannot contain malicious scripts -->\n <div class=\"preview-body\" [innerHTML]=\"currentPreviewItemBody() | mjSafeRichHtml\"></div>\n </div>\n }\n }\n @else {\n <mj-loading [showText]=\"false\" size=\"medium\"></mj-loading>\n }\n</div>\n}\n</div>"]}
|
|
@@ -8,8 +8,16 @@ export declare class EntityCommunicationsPreviewWindowComponent {
|
|
|
8
8
|
MinWidth: number;
|
|
9
9
|
MinHeight: number;
|
|
10
10
|
Resizable: boolean;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
EntityInfo: EntityInfo | undefined;
|
|
12
|
+
/** @deprecated Use {@link EntityInfo}. */
|
|
13
|
+
set entityInfo(value: EntityInfo | undefined);
|
|
14
|
+
/** @deprecated Use {@link EntityInfo}. */
|
|
15
|
+
get entityInfo(): EntityInfo | undefined;
|
|
16
|
+
RunViewParams: RunViewParams | undefined;
|
|
17
|
+
/** @deprecated Use {@link RunViewParams}. */
|
|
18
|
+
set runViewParams(value: RunViewParams | undefined);
|
|
19
|
+
/** @deprecated Use {@link RunViewParams}. */
|
|
20
|
+
get runViewParams(): RunViewParams | undefined;
|
|
13
21
|
get DialogVisible(): boolean;
|
|
14
22
|
set DialogVisible(value: boolean);
|
|
15
23
|
private _dialogVisible;
|
|
@@ -31,6 +39,6 @@ export declare class EntityCommunicationsPreviewWindowComponent {
|
|
|
31
39
|
OnCancel(): void;
|
|
32
40
|
OnOK(): void;
|
|
33
41
|
static ɵfac: i0.ɵɵFactoryDeclaration<EntityCommunicationsPreviewWindowComponent, never>;
|
|
34
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<EntityCommunicationsPreviewWindowComponent, "mj-entity-communications-preview-window", never, { "Title": { "alias": "Title"; "required": false; }; "Width": { "alias": "Width"; "required": false; }; "Height": { "alias": "Height"; "required": false; }; "MinWidth": { "alias": "MinWidth"; "required": false; }; "MinHeight": { "alias": "MinHeight"; "required": false; }; "Resizable": { "alias": "Resizable"; "required": false; }; "entityInfo": { "alias": "entityInfo"; "required": false; }; "runViewParams": { "alias": "runViewParams"; "required": false; }; "DialogVisible": { "alias": "DialogVisible"; "required": false; }; "ToolbarSettings": { "alias": "ToolbarSettings"; "required": false; }; }, { "DialogClosed": "DialogClosed"; "RecordSelected": "RecordSelected"; "RecordUnselected": "RecordUnselected"; }, never, never, false, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EntityCommunicationsPreviewWindowComponent, "mj-entity-communications-preview-window", never, { "Title": { "alias": "Title"; "required": false; }; "Width": { "alias": "Width"; "required": false; }; "Height": { "alias": "Height"; "required": false; }; "MinWidth": { "alias": "MinWidth"; "required": false; }; "MinHeight": { "alias": "MinHeight"; "required": false; }; "Resizable": { "alias": "Resizable"; "required": false; }; "EntityInfo": { "alias": "EntityInfo"; "required": false; }; "entityInfo": { "alias": "entityInfo"; "required": false; }; "RunViewParams": { "alias": "RunViewParams"; "required": false; }; "runViewParams": { "alias": "runViewParams"; "required": false; }; "DialogVisible": { "alias": "DialogVisible"; "required": false; }; "ToolbarSettings": { "alias": "ToolbarSettings"; "required": false; }; }, { "DialogClosed": "DialogClosed"; "RecordSelected": "RecordSelected"; "RecordUnselected": "RecordUnselected"; }, never, never, false, never>;
|
|
35
43
|
}
|
|
36
44
|
//# sourceMappingURL=window.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window.component.d.ts","sourceRoot":"","sources":["../../src/lib/window.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAS,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;;AAE7E,qBAMa,0CAA0C;IAC5C,KAAK,EAAE,MAAM,CAA4B;IACzC,KAAK,SAAO;IACZ,MAAM,SAAO;IACb,QAAQ,SAAO;IACf,SAAS,SAAO;IAChB,SAAS,UAAQ;IAEjB,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"window.component.d.ts","sourceRoot":"","sources":["../../src/lib/window.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAS,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;;AAE7E,qBAMa,0CAA0C;IAC5C,KAAK,EAAE,MAAM,CAA4B;IACzC,KAAK,SAAO;IACZ,MAAM,SAAO;IACb,QAAQ,SAAO;IACf,SAAS,SAAO;IAChB,SAAS,UAAQ;IAEjB,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IAE5C,0CAA0C;IAC1C,IAAa,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAEpD;IACD,0CAA0C;IAC1C,IAAI,UAAU,IAAI,UAAU,GAAG,SAAS,CAEvC;IACQ,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IAElD,6CAA6C;IAC7C,IAAa,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,EAE1D;IACD,6CAA6C;IAC7C,IAAI,aAAa,IAAI,aAAa,GAAG,SAAS,CAE7C;IAED,IAAa,aAAa,IAAI,OAAO,CAEpC;IACD,IAAI,aAAa,CAAC,KAAK,EAAE,OAAO,EAM/B;IACD,OAAO,CAAC,cAAc,CAAkB;IACxC;;OAEG;IACO,YAAY,wBAA+B;IAIrD;;OAEG;IACa,eAAe,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAGpE;IAEQ,cAAc,sCAAoC;IAClD,gBAAgB,sCAAoC;IAE9D,SAAS,CAAC,gBAAgB,EAAE,UAAU,EAAE,CAAM;IAC9C,SAAS,CAAC,kBAAkB,EAAE,UAAU,EAAE,CAAM;IAGzC,QAAQ;IAKR,IAAI;yCAnEA,0CAA0C;2CAA1C,0CAA0C;CAuEtD"}
|
|
@@ -21,8 +21,24 @@ export class EntityCommunicationsPreviewWindowComponent {
|
|
|
21
21
|
MinWidth = 400;
|
|
22
22
|
MinHeight = 350;
|
|
23
23
|
Resizable = true;
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
EntityInfo;
|
|
25
|
+
/** @deprecated Use {@link EntityInfo}. */
|
|
26
|
+
set entityInfo(value) {
|
|
27
|
+
this.EntityInfo = value;
|
|
28
|
+
}
|
|
29
|
+
/** @deprecated Use {@link EntityInfo}. */
|
|
30
|
+
get entityInfo() {
|
|
31
|
+
return this.EntityInfo;
|
|
32
|
+
}
|
|
33
|
+
RunViewParams;
|
|
34
|
+
/** @deprecated Use {@link RunViewParams}. */
|
|
35
|
+
set runViewParams(value) {
|
|
36
|
+
this.RunViewParams = value;
|
|
37
|
+
}
|
|
38
|
+
/** @deprecated Use {@link RunViewParams}. */
|
|
39
|
+
get runViewParams() {
|
|
40
|
+
return this.RunViewParams;
|
|
41
|
+
}
|
|
26
42
|
get DialogVisible() {
|
|
27
43
|
return this._dialogVisible;
|
|
28
44
|
}
|
|
@@ -58,7 +74,7 @@ export class EntityCommunicationsPreviewWindowComponent {
|
|
|
58
74
|
this.DialogClosed.emit(true);
|
|
59
75
|
}
|
|
60
76
|
static ɵfac = function EntityCommunicationsPreviewWindowComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || EntityCommunicationsPreviewWindowComponent)(); };
|
|
61
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityCommunicationsPreviewWindowComponent, selectors: [["mj-entity-communications-preview-window"]], inputs: { Title: "Title", Width: "Width", Height: "Height", MinWidth: "MinWidth", MinHeight: "MinHeight", Resizable: "Resizable", entityInfo: "entityInfo", runViewParams: "runViewParams", DialogVisible: "DialogVisible", ToolbarSettings: "ToolbarSettings" }, outputs: { DialogClosed: "DialogClosed", RecordSelected: "RecordSelected", RecordUnselected: "RecordUnselected" }, standalone: false, decls: 1, vars: 1, consts: [[3, "Visible", "Width", "Height", "MinWidth", "MinHeight", "Title", "Resizable"], [3, "Close", "Visible", "Width", "Height", "MinWidth", "MinHeight", "Title", "Resizable"], [3, "entityInfo", "runViewParams"]], template: function EntityCommunicationsPreviewWindowComponent_Template(rf, ctx) { if (rf & 1) {
|
|
77
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityCommunicationsPreviewWindowComponent, selectors: [["mj-entity-communications-preview-window"]], inputs: { Title: "Title", Width: "Width", Height: "Height", MinWidth: "MinWidth", MinHeight: "MinHeight", Resizable: "Resizable", EntityInfo: "EntityInfo", entityInfo: "entityInfo", RunViewParams: "RunViewParams", runViewParams: "runViewParams", DialogVisible: "DialogVisible", ToolbarSettings: "ToolbarSettings" }, outputs: { DialogClosed: "DialogClosed", RecordSelected: "RecordSelected", RecordUnselected: "RecordUnselected" }, standalone: false, decls: 1, vars: 1, consts: [[3, "Visible", "Width", "Height", "MinWidth", "MinHeight", "Title", "Resizable"], [3, "Close", "Visible", "Width", "Height", "MinWidth", "MinHeight", "Title", "Resizable"], [3, "entityInfo", "runViewParams"]], template: function EntityCommunicationsPreviewWindowComponent_Template(rf, ctx) { if (rf & 1) {
|
|
62
78
|
i0.ɵɵconditionalCreate(0, EntityCommunicationsPreviewWindowComponent_Conditional_0_Template, 2, 9, "mj-window", 0);
|
|
63
79
|
} if (rf & 2) {
|
|
64
80
|
i0.ɵɵconditional(ctx.DialogVisible ? 0 : -1);
|
|
@@ -79,8 +95,12 @@ export class EntityCommunicationsPreviewWindowComponent {
|
|
|
79
95
|
type: Input
|
|
80
96
|
}], Resizable: [{
|
|
81
97
|
type: Input
|
|
98
|
+
}], EntityInfo: [{
|
|
99
|
+
type: Input
|
|
82
100
|
}], entityInfo: [{
|
|
83
101
|
type: Input
|
|
102
|
+
}], RunViewParams: [{
|
|
103
|
+
type: Input
|
|
84
104
|
}], runViewParams: [{
|
|
85
105
|
type: Input
|
|
86
106
|
}], DialogVisible: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window.component.js","sourceRoot":"","sources":["../../src/lib/window.component.ts","../../src/lib/window.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;;;;;;ICCnE,oCASC;IAFG,iNAAS,iBAAU,KAAC;IAGpB,sDAImC;IACvC,iBAAY;;;IAPR,AAFA,AADA,AADA,AADA,AADA,AADA,8BAAgB,uBACD,yBACE,6BACI,+BACE,uBACR,+BAEQ;IAGnB,cAAyB;IACzB,AADA,8CAAyB,uCACM;;ADH3C,MAAM,OAAO,0CAA0C;IAC5C,KAAK,GAAW,wBAAwB,CAAC;IACzC,KAAK,GAAG,GAAG,CAAC;IACZ,MAAM,GAAG,GAAG,CAAC;IACb,QAAQ,GAAG,GAAG,CAAC;IACf,SAAS,GAAG,GAAG,CAAC;IAChB,SAAS,GAAG,IAAI,CAAC;IAEjB,UAAU,CAAyB;
|
|
1
|
+
{"version":3,"file":"window.component.js","sourceRoot":"","sources":["../../src/lib/window.component.ts","../../src/lib/window.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;;;;;;ICCnE,oCASC;IAFG,iNAAS,iBAAU,KAAC;IAGpB,sDAImC;IACvC,iBAAY;;;IAPR,AAFA,AADA,AADA,AADA,AADA,AADA,8BAAgB,uBACD,yBACE,6BACI,+BACE,uBACR,+BAEQ;IAGnB,cAAyB;IACzB,AADA,8CAAyB,uCACM;;ADH3C,MAAM,OAAO,0CAA0C;IAC5C,KAAK,GAAW,wBAAwB,CAAC;IACzC,KAAK,GAAG,GAAG,CAAC;IACZ,MAAM,GAAG,GAAG,CAAC;IACb,QAAQ,GAAG,GAAG,CAAC;IACf,SAAS,GAAG,GAAG,CAAC;IAChB,SAAS,GAAG,IAAI,CAAC;IAEjB,UAAU,CAAyB;IAE5C,0CAA0C;IAC1C,IAAa,UAAU,CAAC,KAA6B;QACnD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IACD,0CAA0C;IAC1C,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IACQ,aAAa,CAA4B;IAElD,6CAA6C;IAC7C,IAAa,aAAa,CAAC,KAAgC;QACzD,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC7B,CAAC;IACD,6CAA6C;IAC7C,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAa,aAAa;QACxB,OAAO,IAAI,CAA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0C","sourcesContent":["import { Component, Output, EventEmitter, Input } from '@angular/core';\n\nimport { BaseEntity, EntityInfo, RunViewParams } from '@memberjunction/core';\n \n@Component({\n standalone: false,\n selector: 'mj-entity-communications-preview-window',\n templateUrl: './window.component.html',\n styleUrls: ['./window.component.css']\n})\nexport class EntityCommunicationsPreviewWindowComponent {\n @Input() Title: string = 'Communications Preview';\n @Input() Width = 650;\n @Input() Height = 600;\n @Input() MinWidth = 400;\n @Input() MinHeight = 350;\n @Input() Resizable = true;\n\n @Input() EntityInfo: EntityInfo | undefined;\n\n /** @deprecated Use {@link EntityInfo}. */\n @Input() set entityInfo(value: EntityInfo | undefined) {\n this.EntityInfo = value;\n }\n /** @deprecated Use {@link EntityInfo}. */\n get entityInfo(): EntityInfo | undefined {\n return this.EntityInfo;\n }\n @Input() RunViewParams: RunViewParams | undefined;\n\n /** @deprecated Use {@link RunViewParams}. */\n @Input() set runViewParams(value: RunViewParams | undefined) {\n this.RunViewParams = value;\n }\n /** @deprecated Use {@link RunViewParams}. */\n get runViewParams(): RunViewParams | undefined {\n return this.RunViewParams;\n }\n\n @Input() get DialogVisible(): boolean {\n return this._dialogVisible;\n }\n set DialogVisible(value: boolean) {\n if (value !== this._dialogVisible && value) {\n // showing the dialog\n //this.RefreshInitialValues();\n }\n this._dialogVisible = value;\n }\n private _dialogVisible: boolean = false;\n /**\n * Emits when the dialog is closed, the parameter is true if the dialog was closed with the OK button, false if it was closed with the Cancel button\n */\n @Output() DialogClosed = new EventEmitter<boolean>();\n \n \n\n /**\n * Configurable settings for the toolbar\n */\n @Input() public ToolbarSettings: { position: string; tools: string[] } = {\n position: \"right\",\n tools: [\"moveUp\", \"transferFrom\", \"transferAllFrom\", \"transferAllTo\", \"transferTo\", \"moveDown\"],\n };\n\n @Output() RecordSelected = new EventEmitter<BaseEntity[]>();\n @Output() RecordUnselected = new EventEmitter<BaseEntity[]>();\n\n protected _initialSelected: BaseEntity[] = [];\n protected _initialUnselected: BaseEntity[] = []; \n \n\n public OnCancel() { \n this.DialogVisible = false;\n this.DialogClosed.emit(false);\n }\n\n public OnOK() { \n this.DialogVisible = false;\n this.DialogClosed.emit(true);\n }\n}\n","@if (DialogVisible) {\n <mj-window\n [Visible]=\"true\"\n [Width]=\"Width\"\n [Height]=\"Height\"\n [MinWidth]=\"MinWidth\"\n [MinHeight]=\"MinHeight\"\n [Title]=\"Title\"\n (Close)=\"OnCancel()\"\n [Resizable]=\"Resizable\"\n >\n <mj-entity-communications-preview\n [entityInfo]=\"entityInfo\"\n [runViewParams]=\"runViewParams\"\n >\n </mj-entity-communications-preview>\n </mj-window>\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-entity-communications",
|
|
3
|
-
"version": "6.2.0-edge.
|
|
3
|
+
"version": "6.2.0-edge.2",
|
|
4
4
|
"description": "MemberJunction: Angular Components to allow a user to select templates, preview the messages with those tempaltes, and send them",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@angular/compiler": "21.2.22",
|
|
15
15
|
"@angular/compiler-cli": "21.2.22",
|
|
16
|
-
"@memberjunction/ng-test-utils": "6.2.0-edge.
|
|
16
|
+
"@memberjunction/ng-test-utils": "6.2.0-edge.2",
|
|
17
17
|
"vitest": "^4.0.18"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"@angular/forms": "^21.2.22"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@memberjunction/communication-types": "6.2.0-edge.
|
|
26
|
-
"@memberjunction/core": "6.2.0-edge.
|
|
27
|
-
"@memberjunction/core-entities": "6.2.0-edge.
|
|
28
|
-
"@memberjunction/entity-communications-base": "6.2.0-edge.
|
|
29
|
-
"@memberjunction/entity-communications-client": "6.2.0-edge.
|
|
30
|
-
"@memberjunction/global": "6.2.0-edge.
|
|
31
|
-
"@memberjunction/ng-base-types": "6.2.0-edge.
|
|
32
|
-
"@memberjunction/ng-container-directives": "6.2.0-edge.
|
|
33
|
-
"@memberjunction/ng-shared-generic": "6.2.0-edge.
|
|
34
|
-
"@memberjunction/ng-ui-components": "6.2.0-edge.
|
|
35
|
-
"@memberjunction/templates-base-types": "6.2.0-edge.
|
|
25
|
+
"@memberjunction/communication-types": "6.2.0-edge.2",
|
|
26
|
+
"@memberjunction/core": "6.2.0-edge.2",
|
|
27
|
+
"@memberjunction/core-entities": "6.2.0-edge.2",
|
|
28
|
+
"@memberjunction/entity-communications-base": "6.2.0-edge.2",
|
|
29
|
+
"@memberjunction/entity-communications-client": "6.2.0-edge.2",
|
|
30
|
+
"@memberjunction/global": "6.2.0-edge.2",
|
|
31
|
+
"@memberjunction/ng-base-types": "6.2.0-edge.2",
|
|
32
|
+
"@memberjunction/ng-container-directives": "6.2.0-edge.2",
|
|
33
|
+
"@memberjunction/ng-shared-generic": "6.2.0-edge.2",
|
|
34
|
+
"@memberjunction/ng-ui-components": "6.2.0-edge.2",
|
|
35
|
+
"@memberjunction/templates-base-types": "6.2.0-edge.2",
|
|
36
36
|
"tslib": "^2.8.1"
|
|
37
37
|
},
|
|
38
38
|
"sideEffects": false,
|