@memberjunction/ng-entity-communications 2.0.0

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.
@@ -0,0 +1,32 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { ProcessedMessage } from '@memberjunction/communication-types';
3
+ import { EntityInfo, RunViewParams } from '@memberjunction/core';
4
+ import { TemplateEntityExtended } from '@memberjunction/templates-base-types';
5
+ import * as i0 from "@angular/core";
6
+ export declare class EntityCommunicationsPreviewComponent implements OnInit {
7
+ templateFilter: string | undefined;
8
+ entityInfo: EntityInfo | undefined;
9
+ runViewParams: RunViewParams | undefined;
10
+ templateSelected: EventEmitter<TemplateEntityExtended>;
11
+ templates: TemplateEntityExtended[];
12
+ selectedTemplate: TemplateEntityExtended | null;
13
+ step: number;
14
+ previewMessages: ProcessedMessage[];
15
+ currentMessageIndex: number;
16
+ loading: boolean;
17
+ constructor();
18
+ ngOnInit(): Promise<void>;
19
+ loadTemplates(): Promise<void>;
20
+ selectTemplate(template: TemplateEntityExtended): void;
21
+ protected loadMessagePreviews(): Promise<void>;
22
+ currentPreviewItemSubject(): string;
23
+ currentPreviewItemBody(): string;
24
+ goBack(): void;
25
+ firstMessage(): void;
26
+ lastMessage(): void;
27
+ nextMessage(): void;
28
+ previousMessage(): void;
29
+ static ɵfac: i0.ɵɵFactoryDeclaration<EntityCommunicationsPreviewComponent, never>;
30
+ 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>;
31
+ }
32
+ //# sourceMappingURL=preview.component.d.ts.map
@@ -0,0 +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,EAAoC,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACzG,OAAO,EAAE,UAAU,EAAW,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1E,OAAO,EAAsB,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;;AAElG,qBAKa,oCAAqC,YAAW,MAAM;IACxD,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IACxC,gBAAgB,uCAA8C;IAExE,SAAS,EAAE,sBAAsB,EAAE,CAAM;IACzC,gBAAgB,EAAE,sBAAsB,GAAG,IAAI,CAAQ;IACvD,IAAI,EAAE,MAAM,CAAK;IAEV,eAAe,EAAE,gBAAgB,EAAE,CAAM;IAChD,mBAAmB,EAAE,MAAM,CAAK;IACzB,OAAO,EAAE,OAAO,CAAS;;IAI1B,QAAQ;IAOR,aAAa;IAoBnB,cAAc,CAAC,QAAQ,EAAE,sBAAsB;cAO/B,mBAAmB;IAwCnC,yBAAyB,IAAI,MAAM;IASnC,sBAAsB,IAAI,MAAM;IAUhC,MAAM;IAKN,YAAY;IAIZ,WAAW;IAIX,WAAW;IAMX,eAAe;yCAhIJ,oCAAoC;2CAApC,oCAAoC;CAqIhD"}
@@ -0,0 +1,256 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Component, Output, EventEmitter, Input } from '@angular/core';
11
+ import { CommunicationEngineBase, Message } from '@memberjunction/communication-types';
12
+ import { RunView } from '@memberjunction/core';
13
+ import { EntityCommunicationsEngineClient } from '@memberjunction/entity-communications-client';
14
+ import { TemplateEngineBase } from '@memberjunction/templates-base-types';
15
+ import * as i0 from "@angular/core";
16
+ import * as i1 from "@angular/common";
17
+ import * as i2 from "@progress/kendo-angular-buttons";
18
+ import * as i3 from "@progress/kendo-angular-indicators";
19
+ function EntityCommunicationsPreviewComponent_div_1_li_4_Template(rf, ctx) { if (rf & 1) {
20
+ const _r1 = i0.ɵɵgetCurrentView();
21
+ i0.ɵɵelementStart(0, "li", 4);
22
+ i0.ɵɵlistener("click", function EntityCommunicationsPreviewComponent_div_1_li_4_Template_li_click_0_listener() { const template_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.selectTemplate(template_r2)); });
23
+ i0.ɵɵtext(1);
24
+ i0.ɵɵelementEnd();
25
+ } if (rf & 2) {
26
+ const template_r2 = ctx.$implicit;
27
+ i0.ɵɵadvance();
28
+ i0.ɵɵtextInterpolate1(" ", template_r2.Name, " ");
29
+ } }
30
+ function EntityCommunicationsPreviewComponent_div_1_Template(rf, ctx) { if (rf & 1) {
31
+ i0.ɵɵelementStart(0, "div", 2)(1, "h2");
32
+ i0.ɵɵtext(2, "Select a Template");
33
+ i0.ɵɵelementEnd();
34
+ i0.ɵɵelementStart(3, "ul");
35
+ i0.ɵɵtemplate(4, EntityCommunicationsPreviewComponent_div_1_li_4_Template, 2, 1, "li", 3);
36
+ i0.ɵɵelementEnd()();
37
+ } if (rf & 2) {
38
+ const ctx_r2 = i0.ɵɵnextContext();
39
+ i0.ɵɵadvance(4);
40
+ i0.ɵɵproperty("ngForOf", ctx_r2.templates);
41
+ } }
42
+ function EntityCommunicationsPreviewComponent_div_2_Conditional_1_Conditional_0_Template(rf, ctx) { if (rf & 1) {
43
+ const _r4 = i0.ɵɵgetCurrentView();
44
+ i0.ɵɵelementStart(0, "h2");
45
+ i0.ɵɵtext(1, "No Messages Available");
46
+ i0.ɵɵelementEnd();
47
+ i0.ɵɵelementStart(2, "button", 6);
48
+ i0.ɵɵlistener("click", function EntityCommunicationsPreviewComponent_div_2_Conditional_1_Conditional_0_Template_button_click_2_listener() { i0.ɵɵrestoreView(_r4); const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.goBack()); });
49
+ i0.ɵɵtext(3, "Back");
50
+ i0.ɵɵelementEnd();
51
+ } }
52
+ function EntityCommunicationsPreviewComponent_div_2_Conditional_1_Conditional_1_Template(rf, ctx) { if (rf & 1) {
53
+ const _r5 = i0.ɵɵgetCurrentView();
54
+ i0.ɵɵelementStart(0, "h2");
55
+ i0.ɵɵtext(1);
56
+ i0.ɵɵelementEnd();
57
+ i0.ɵɵelementStart(2, "button", 6);
58
+ i0.ɵɵlistener("click", function EntityCommunicationsPreviewComponent_div_2_Conditional_1_Conditional_1_Template_button_click_2_listener() { i0.ɵɵrestoreView(_r5); const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.goBack()); });
59
+ i0.ɵɵtext(3, "Back");
60
+ i0.ɵɵelementEnd();
61
+ i0.ɵɵelementStart(4, "div", 7)(5, "button", 8);
62
+ i0.ɵɵlistener("click", function EntityCommunicationsPreviewComponent_div_2_Conditional_1_Conditional_1_Template_button_click_5_listener() { i0.ɵɵrestoreView(_r5); const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.firstMessage()); });
63
+ i0.ɵɵelement(6, "span", 9);
64
+ i0.ɵɵelementEnd();
65
+ i0.ɵɵelementStart(7, "button", 10);
66
+ i0.ɵɵlistener("click", function EntityCommunicationsPreviewComponent_div_2_Conditional_1_Conditional_1_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r5); const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.previousMessage()); });
67
+ i0.ɵɵelement(8, "span", 11);
68
+ i0.ɵɵelementEnd();
69
+ i0.ɵɵelementStart(9, "span", 12);
70
+ i0.ɵɵtext(10);
71
+ i0.ɵɵelementEnd();
72
+ i0.ɵɵelementStart(11, "button", 13);
73
+ i0.ɵɵlistener("click", function EntityCommunicationsPreviewComponent_div_2_Conditional_1_Conditional_1_Template_button_click_11_listener() { i0.ɵɵrestoreView(_r5); const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.nextMessage()); });
74
+ i0.ɵɵelement(12, "span", 14);
75
+ i0.ɵɵelementEnd();
76
+ i0.ɵɵelementStart(13, "button", 15);
77
+ i0.ɵɵlistener("click", function EntityCommunicationsPreviewComponent_div_2_Conditional_1_Conditional_1_Template_button_click_13_listener() { i0.ɵɵrestoreView(_r5); const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.lastMessage()); });
78
+ i0.ɵɵelement(14, "span", 16);
79
+ i0.ɵɵelementEnd()();
80
+ i0.ɵɵelementStart(15, "div", 17)(16, "div", 18);
81
+ i0.ɵɵtext(17);
82
+ i0.ɵɵelementEnd();
83
+ i0.ɵɵelement(18, "div", 19);
84
+ i0.ɵɵelementEnd();
85
+ } if (rf & 2) {
86
+ const ctx_r2 = i0.ɵɵnextContext(3);
87
+ i0.ɵɵadvance();
88
+ i0.ɵɵtextInterpolate1("Preview ", ctx_r2.selectedTemplate == null ? null : ctx_r2.selectedTemplate.Name, "");
89
+ i0.ɵɵadvance(4);
90
+ i0.ɵɵproperty("disabled", ctx_r2.currentMessageIndex === 0);
91
+ i0.ɵɵadvance(2);
92
+ i0.ɵɵproperty("disabled", ctx_r2.currentMessageIndex === 0);
93
+ i0.ɵɵadvance(3);
94
+ i0.ɵɵtextInterpolate2("", ctx_r2.currentMessageIndex + 1, " of ", ctx_r2.previewMessages.length, "");
95
+ i0.ɵɵadvance();
96
+ i0.ɵɵproperty("disabled", ctx_r2.currentMessageIndex >= ctx_r2.previewMessages.length - 1);
97
+ i0.ɵɵadvance(2);
98
+ i0.ɵɵproperty("disabled", ctx_r2.currentMessageIndex >= ctx_r2.previewMessages.length - 1);
99
+ i0.ɵɵadvance(4);
100
+ i0.ɵɵtextInterpolate(ctx_r2.currentPreviewItemSubject());
101
+ i0.ɵɵadvance();
102
+ i0.ɵɵproperty("innerHTML", ctx_r2.currentPreviewItemBody(), i0.ɵɵsanitizeHtml);
103
+ } }
104
+ function EntityCommunicationsPreviewComponent_div_2_Conditional_1_Template(rf, ctx) { if (rf & 1) {
105
+ i0.ɵɵtemplate(0, EntityCommunicationsPreviewComponent_div_2_Conditional_1_Conditional_0_Template, 4, 0)(1, EntityCommunicationsPreviewComponent_div_2_Conditional_1_Conditional_1_Template, 19, 9);
106
+ } if (rf & 2) {
107
+ const ctx_r2 = i0.ɵɵnextContext(2);
108
+ i0.ɵɵconditional(ctx_r2.previewMessages.length === 0 ? 0 : 1);
109
+ } }
110
+ function EntityCommunicationsPreviewComponent_div_2_Conditional_2_Template(rf, ctx) { if (rf & 1) {
111
+ i0.ɵɵelement(0, "kendo-loader");
112
+ } }
113
+ function EntityCommunicationsPreviewComponent_div_2_Template(rf, ctx) { if (rf & 1) {
114
+ i0.ɵɵelementStart(0, "div", 5);
115
+ i0.ɵɵtemplate(1, EntityCommunicationsPreviewComponent_div_2_Conditional_1_Template, 2, 1)(2, EntityCommunicationsPreviewComponent_div_2_Conditional_2_Template, 1, 0, "kendo-loader");
116
+ i0.ɵɵelementEnd();
117
+ } if (rf & 2) {
118
+ const ctx_r2 = i0.ɵɵnextContext();
119
+ i0.ɵɵadvance();
120
+ i0.ɵɵconditional(!ctx_r2.loading ? 1 : 2);
121
+ } }
122
+ export class EntityCommunicationsPreviewComponent {
123
+ constructor() {
124
+ this.templateSelected = new EventEmitter();
125
+ this.templates = [];
126
+ this.selectedTemplate = null;
127
+ this.step = 1;
128
+ this.previewMessages = [];
129
+ this.currentMessageIndex = 0;
130
+ this.loading = false;
131
+ }
132
+ ngOnInit() {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ if (!this.entityInfo || !this.runViewParams)
135
+ throw new Error("EntityInfo and RunViewParams are required");
136
+ yield this.loadTemplates();
137
+ });
138
+ }
139
+ loadTemplates() {
140
+ return __awaiter(this, void 0, void 0, function* () {
141
+ // load up all template metadata
142
+ const rv = new RunView();
143
+ const result = yield rv.RunView({
144
+ EntityName: "Templates",
145
+ ExtraFilter: `(IsActive = 1 AND (ActiveAt IS NULL OR ActiveAt <= GETDATE())) ${this.templateFilter ? `AND ${this.templateFilter}` : ''}`,
146
+ ResultType: 'entity_object'
147
+ });
148
+ const content = yield rv.RunView({
149
+ EntityName: "Template Contents",
150
+ ResultType: 'entity_object'
151
+ });
152
+ this.templates = result.Results;
153
+ this.templates.forEach(template => {
154
+ template.Content = content.Results.filter(c => c.TemplateID === template.ID);
155
+ });
156
+ });
157
+ }
158
+ selectTemplate(template) {
159
+ this.selectedTemplate = template;
160
+ this.templateSelected.emit(template);
161
+ this.step = 2;
162
+ this.loadMessagePreviews();
163
+ }
164
+ loadMessagePreviews() {
165
+ return __awaiter(this, void 0, void 0, function* () {
166
+ this.loading = true;
167
+ const msg = new Message();
168
+ msg.From = "amith@bluecypress.io";
169
+ msg.Subject = "Test Subject";
170
+ const sendGrid = CommunicationEngineBase.Instance.Providers.find(p => p.Name === "SendGrid");
171
+ if (!sendGrid)
172
+ throw new Error("SendGrid provider not found");
173
+ const email = sendGrid.MessageTypes.find(mt => mt.Name === "Email");
174
+ if (!email)
175
+ throw new Error("Email message type not found");
176
+ if (!this.selectedTemplate)
177
+ throw new Error("No template selected");
178
+ msg.MessageType = email;
179
+ msg.HTMLBodyTemplate = this.selectedTemplate;
180
+ msg.SubjectTemplate = TemplateEngineBase.Instance.FindTemplate('Test Subject Template');
181
+ const commParams = {
182
+ EntityID: this.entityInfo.ID,
183
+ RunViewParams: this.runViewParams,
184
+ ProviderName: "SendGrid",
185
+ ProviderMessageTypeName: "Email",
186
+ Message: msg,
187
+ PreviewOnly: true,
188
+ IncludeProcessedMessages: true
189
+ };
190
+ const result = yield EntityCommunicationsEngineClient.Instance.RunEntityCommunication(commParams);
191
+ if (result && result.Success && result.Results) {
192
+ this.previewMessages = result.Results.map(r => r.Message);
193
+ }
194
+ this.loading = false;
195
+ });
196
+ }
197
+ currentPreviewItemSubject() {
198
+ if (this.previewMessages && this.previewMessages.length > 0) {
199
+ if (this.currentMessageIndex >= 0 && this.currentMessageIndex < this.previewMessages.length) {
200
+ return this.previewMessages[this.currentMessageIndex].ProcessedSubject;
201
+ }
202
+ }
203
+ return 'Error processing template content';
204
+ }
205
+ currentPreviewItemBody() {
206
+ if (this.previewMessages && this.previewMessages.length > 0) {
207
+ if (this.currentMessageIndex >= 0 && this.currentMessageIndex < this.previewMessages.length) {
208
+ return this.previewMessages[this.currentMessageIndex].ProcessedHTMLBody;
209
+ }
210
+ }
211
+ return 'Error processing template content';
212
+ }
213
+ goBack() {
214
+ this.step = 1;
215
+ }
216
+ firstMessage() {
217
+ this.currentMessageIndex = 0;
218
+ }
219
+ lastMessage() {
220
+ this.currentMessageIndex = this.previewMessages.length - 1;
221
+ }
222
+ nextMessage() {
223
+ if (this.currentMessageIndex < this.previewMessages.length - 1) {
224
+ this.currentMessageIndex++;
225
+ }
226
+ }
227
+ previousMessage() {
228
+ if (this.currentMessageIndex > 0) {
229
+ this.currentMessageIndex--;
230
+ }
231
+ }
232
+ }
233
+ EntityCommunicationsPreviewComponent.ɵfac = function EntityCommunicationsPreviewComponent_Factory(t) { return new (t || EntityCommunicationsPreviewComponent)(); };
234
+ EntityCommunicationsPreviewComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityCommunicationsPreviewComponent, selectors: [["mj-entity-communications-preview"]], inputs: { templateFilter: "templateFilter", entityInfo: "entityInfo", runViewParams: "runViewParams" }, outputs: { templateSelected: "templateSelected" }, decls: 3, vars: 2, consts: [["class", "step-1", 4, "ngIf"], ["class", "step-2", 4, "ngIf"], [1, "step-1"], [3, "click", 4, "ngFor", "ngForOf"], [3, "click"], [1, "step-2"], ["kendoButton", "", 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) {
235
+ i0.ɵɵelementStart(0, "div");
236
+ i0.ɵɵtemplate(1, EntityCommunicationsPreviewComponent_div_1_Template, 5, 1, "div", 0)(2, EntityCommunicationsPreviewComponent_div_2_Template, 3, 1, "div", 1);
237
+ i0.ɵɵelementEnd();
238
+ } if (rf & 2) {
239
+ i0.ɵɵadvance();
240
+ i0.ɵɵproperty("ngIf", ctx.step === 1);
241
+ i0.ɵɵadvance();
242
+ i0.ɵɵproperty("ngIf", ctx.step === 2);
243
+ } }, dependencies: [i1.NgForOf, i1.NgIf, i2.ButtonComponent, i3.LoaderComponent], styles: [".step-1[_ngcontent-%COMP%], .step-2[_ngcontent-%COMP%] {\n margin: 20px 0;\n}\n\n.template-preview[_ngcontent-%COMP%] {\n border: 1px solid #ccc;\n margin-top: 10px;\n}\n\n.subject-line[_ngcontent-%COMP%] {\n font-weight: bolder;\n border-bottom: 1px solid #ccc;\n padding: 5px;\n}\n\n.preview-body[_ngcontent-%COMP%] {\n padding: 5px;\n}\n\nul[_ngcontent-%COMP%] {\n list-style: none;\n padding: 0;\n}\n\nli[_ngcontent-%COMP%] {\n padding: 10px;\n border: 1px solid #ccc;\n margin: 5px 0;\n cursor: pointer;\n}\n\nli[_ngcontent-%COMP%]:hover {\n background-color: #f0f0f0;\n}\n\n.vcr-controls[_ngcontent-%COMP%] {\n margin-top: 5px;\n margin-bottom: 15px;\n}\n\n.vcr-controls[_ngcontent-%COMP%] button[_ngcontent-%COMP%] {\n margin-right: 5px;\n background: none;\n border: none;\n cursor: pointer;\n font-size: 20px;\n color: #007bff;\n}\n\n.vcr-controls[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover {\n color: #0056b3;\n}\n\n.vcr-controls[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled {\n color: #ccc;\n cursor: not-allowed;\n}\n\n.vcr-controls[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled span[_ngcontent-%COMP%] {\n color: #ccc;\n}\n\n.index-indicator[_ngcontent-%COMP%] {\n margin: 0 10px;\n}"] });
244
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EntityCommunicationsPreviewComponent, [{
245
+ type: Component,
246
+ args: [{ selector: 'mj-entity-communications-preview', template: "<div> \n <div *ngIf=\"step === 1\" class=\"step-1\">\n <h2>Select a Template</h2>\n <ul>\n <li *ngFor=\"let template of templates\" (click)=\"selectTemplate(template)\">\n {{ template.Name }}\n </li>\n </ul>\n </div>\n\n <div *ngIf=\"step === 2\" class=\"step-2\">\n @if(!loading) {\n @if (previewMessages.length === 0) {\n <h2>No Messages Available</h2>\n <button kendoButton (click)=\"goBack()\">Back</button>\n }\n @else {\n <h2>Preview {{ selectedTemplate?.Name }}</h2>\n <button kendoButton (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 <div class=\"preview-body\" [innerHTML]=\"currentPreviewItemBody()\"></div>\n </div> \n }\n }\n @else {\n <kendo-loader></kendo-loader> \n }\n </div>\n</div>", styles: [".step-1, .step-2 {\n margin: 20px 0;\n}\n\n.template-preview {\n border: 1px solid #ccc;\n margin-top: 10px;\n}\n\n.subject-line {\n font-weight: bolder;\n border-bottom: 1px solid #ccc;\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 #ccc;\n margin: 5px 0;\n cursor: pointer;\n}\n\nli:hover {\n background-color: #f0f0f0;\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: #007bff;\n}\n\n.vcr-controls button:hover {\n color: #0056b3;\n}\n\n.vcr-controls button:disabled {\n color: #ccc;\n cursor: not-allowed;\n}\n\n.vcr-controls button:disabled span {\n color: #ccc;\n}\n\n.index-indicator {\n margin: 0 10px;\n}"] }]
247
+ }], () => [], { templateFilter: [{
248
+ type: Input
249
+ }], entityInfo: [{
250
+ type: Input
251
+ }], runViewParams: [{
252
+ type: Input
253
+ }], templateSelected: [{
254
+ type: Output
255
+ }] }); })();
256
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(EntityCommunicationsPreviewComponent, { className: "EntityCommunicationsPreviewComponent" }); })();
@@ -0,0 +1,34 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import { BaseEntity, EntityInfo, RunViewParams } from '@memberjunction/core';
3
+ import { ListBoxToolbarConfig } from '@progress/kendo-angular-listbox';
4
+ import * as i0 from "@angular/core";
5
+ export declare class EntityCommunicationsPreviewWindowComponent {
6
+ Title: string;
7
+ Width: number;
8
+ Height: number;
9
+ MinWidth: number;
10
+ MinHeight: number;
11
+ Resizable: boolean;
12
+ entityInfo: EntityInfo | undefined;
13
+ runViewParams: RunViewParams | undefined;
14
+ get DialogVisible(): boolean;
15
+ set DialogVisible(value: boolean);
16
+ private _dialogVisible;
17
+ /**
18
+ * 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
19
+ */
20
+ DialogClosed: EventEmitter<boolean>;
21
+ /**
22
+ * Configurable settings for the toolbar
23
+ */
24
+ ToolbarSettings: ListBoxToolbarConfig;
25
+ RecordSelected: EventEmitter<BaseEntity[]>;
26
+ RecordUnselected: EventEmitter<BaseEntity[]>;
27
+ protected _initialSelected: BaseEntity[];
28
+ protected _initialUnselected: BaseEntity[];
29
+ OnCancel(): void;
30
+ OnOK(): void;
31
+ static ɵfac: i0.ɵɵFactoryDeclaration<EntityCommunicationsPreviewWindowComponent, never>;
32
+ 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>;
33
+ }
34
+ //# sourceMappingURL=window.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window.component.d.ts","sourceRoot":"","sources":["../../src/lib/window.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,YAAY,EAAkD,MAAM,eAAe,CAAC;AAEvI,OAAO,EAAY,UAAU,EAAoD,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGzI,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;;AAEvE,qBAKa,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;IACnC,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IAElD,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,oBAAoB,CAGnD;IAEQ,cAAc,6BAAoC;IAClD,gBAAgB,6BAAoC;IAE9D,SAAS,CAAC,gBAAgB,EAAE,UAAU,EAAE,CAAM;IAC9C,SAAS,CAAC,kBAAkB,EAAE,UAAU,EAAE,CAAM;IAGzC,QAAQ;IAKR,IAAI;yCAjDA,0CAA0C;2CAA1C,0CAA0C;CAqDtD"}
@@ -0,0 +1,97 @@
1
+ import { Component, Output, EventEmitter, Input } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "@progress/kendo-angular-dialog";
4
+ import * as i2 from "./preview.component";
5
+ function EntityCommunicationsPreviewWindowComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
6
+ const _r1 = i0.ɵɵgetCurrentView();
7
+ i0.ɵɵelementStart(0, "kendo-window", 1);
8
+ i0.ɵɵlistener("close", function EntityCommunicationsPreviewWindowComponent_Conditional_0_Template_kendo_window_close_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnCancel()); });
9
+ i0.ɵɵelement(1, "mj-entity-communications-preview", 2);
10
+ i0.ɵɵelementEnd();
11
+ } if (rf & 2) {
12
+ const ctx_r1 = i0.ɵɵnextContext();
13
+ i0.ɵɵproperty("width", ctx_r1.Width)("height", ctx_r1.Height)("minWidth", ctx_r1.MinWidth)("minHeight", ctx_r1.MinHeight)("title", ctx_r1.Title)("resizable", ctx_r1.Resizable);
14
+ i0.ɵɵadvance();
15
+ i0.ɵɵproperty("entityInfo", ctx_r1.entityInfo)("runViewParams", ctx_r1.runViewParams);
16
+ } }
17
+ export class EntityCommunicationsPreviewWindowComponent {
18
+ constructor() {
19
+ this.Title = 'Communications Preview';
20
+ this.Width = 650;
21
+ this.Height = 600;
22
+ this.MinWidth = 400;
23
+ this.MinHeight = 350;
24
+ this.Resizable = true;
25
+ this._dialogVisible = false;
26
+ /**
27
+ * 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
28
+ */
29
+ this.DialogClosed = new EventEmitter();
30
+ /**
31
+ * Configurable settings for the toolbar
32
+ */
33
+ this.ToolbarSettings = {
34
+ position: "right",
35
+ tools: ["moveUp", "transferFrom", "transferAllFrom", "transferAllTo", "transferTo", "moveDown"],
36
+ };
37
+ this.RecordSelected = new EventEmitter();
38
+ this.RecordUnselected = new EventEmitter();
39
+ this._initialSelected = [];
40
+ this._initialUnselected = [];
41
+ }
42
+ get DialogVisible() {
43
+ return this._dialogVisible;
44
+ }
45
+ set DialogVisible(value) {
46
+ if (value !== this._dialogVisible && value) {
47
+ // showing the dialog
48
+ //this.RefreshInitialValues();
49
+ }
50
+ this._dialogVisible = value;
51
+ }
52
+ OnCancel() {
53
+ this.DialogVisible = false;
54
+ this.DialogClosed.emit(false);
55
+ }
56
+ OnOK() {
57
+ this.DialogVisible = false;
58
+ this.DialogClosed.emit(true);
59
+ }
60
+ }
61
+ EntityCommunicationsPreviewWindowComponent.ɵfac = function EntityCommunicationsPreviewWindowComponent_Factory(t) { return new (t || EntityCommunicationsPreviewWindowComponent)(); };
62
+ EntityCommunicationsPreviewWindowComponent.ɵ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" }, decls: 1, vars: 1, consts: [[3, "width", "height", "minWidth", "minHeight", "title", "resizable"], [3, "close", "width", "height", "minWidth", "minHeight", "title", "resizable"], [3, "entityInfo", "runViewParams"]], template: function EntityCommunicationsPreviewWindowComponent_Template(rf, ctx) { if (rf & 1) {
63
+ i0.ɵɵtemplate(0, EntityCommunicationsPreviewWindowComponent_Conditional_0_Template, 2, 8, "kendo-window", 0);
64
+ } if (rf & 2) {
65
+ i0.ɵɵconditional(ctx.DialogVisible ? 0 : -1);
66
+ } }, dependencies: [i1.WindowComponent, i2.EntityCommunicationsPreviewComponent] });
67
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EntityCommunicationsPreviewWindowComponent, [{
68
+ type: Component,
69
+ args: [{ selector: 'mj-entity-communications-preview-window', template: "@if (DialogVisible) {\n <kendo-window\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 </kendo-window> \n}" }]
70
+ }], null, { Title: [{
71
+ type: Input
72
+ }], Width: [{
73
+ type: Input
74
+ }], Height: [{
75
+ type: Input
76
+ }], MinWidth: [{
77
+ type: Input
78
+ }], MinHeight: [{
79
+ type: Input
80
+ }], Resizable: [{
81
+ type: Input
82
+ }], entityInfo: [{
83
+ type: Input
84
+ }], runViewParams: [{
85
+ type: Input
86
+ }], DialogVisible: [{
87
+ type: Input
88
+ }], DialogClosed: [{
89
+ type: Output
90
+ }], ToolbarSettings: [{
91
+ type: Input
92
+ }], RecordSelected: [{
93
+ type: Output
94
+ }], RecordUnselected: [{
95
+ type: Output
96
+ }] }); })();
97
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(EntityCommunicationsPreviewWindowComponent, { className: "EntityCommunicationsPreviewWindowComponent" }); })();
@@ -0,0 +1,15 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./lib/preview.component";
3
+ import * as i2 from "./lib/window.component";
4
+ import * as i3 from "@angular/common";
5
+ import * as i4 from "@progress/kendo-angular-dialog";
6
+ import * as i5 from "@memberjunction/ng-container-directives";
7
+ import * as i6 from "@progress/kendo-angular-buttons";
8
+ import * as i7 from "@progress/kendo-angular-listbox";
9
+ import * as i8 from "@progress/kendo-angular-indicators";
10
+ export declare class EntityCommunicationsModule {
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<EntityCommunicationsModule, never>;
12
+ static ɵmod: i0.ɵɵNgModuleDeclaration<EntityCommunicationsModule, [typeof i1.EntityCommunicationsPreviewComponent, typeof i2.EntityCommunicationsPreviewWindowComponent], [typeof i3.CommonModule, typeof i4.DialogsModule, typeof i5.ContainerDirectivesModule, typeof i6.ButtonsModule, typeof i7.ListBoxModule, typeof i8.IndicatorsModule], [typeof i1.EntityCommunicationsPreviewComponent, typeof i2.EntityCommunicationsPreviewWindowComponent]>;
13
+ static ɵinj: i0.ɵɵInjectorDeclaration<EntityCommunicationsModule>;
14
+ }
15
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;AAaA,qBAkBa,0BAA0B;yCAA1B,0BAA0B;0CAA1B,0BAA0B;0CAA1B,0BAA0B;CAAI"}
package/dist/module.js ADDED
@@ -0,0 +1,50 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ // Kendo UI Angular imports
4
+ import { DialogsModule } from "@progress/kendo-angular-dialog";
5
+ import { ButtonsModule } from '@progress/kendo-angular-buttons';
6
+ import { ListBoxModule } from '@progress/kendo-angular-listbox';
7
+ import { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';
8
+ import { EntityCommunicationsPreviewWindowComponent } from './lib/window.component';
9
+ import { EntityCommunicationsPreviewComponent } from './lib/preview.component';
10
+ import { IndicatorsModule } from '@progress/kendo-angular-indicators';
11
+ import * as i0 from "@angular/core";
12
+ export class EntityCommunicationsModule {
13
+ }
14
+ EntityCommunicationsModule.ɵfac = function EntityCommunicationsModule_Factory(t) { return new (t || EntityCommunicationsModule)(); };
15
+ EntityCommunicationsModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: EntityCommunicationsModule });
16
+ EntityCommunicationsModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
17
+ DialogsModule,
18
+ ContainerDirectivesModule,
19
+ ButtonsModule,
20
+ ListBoxModule,
21
+ IndicatorsModule] });
22
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EntityCommunicationsModule, [{
23
+ type: NgModule,
24
+ args: [{
25
+ declarations: [
26
+ EntityCommunicationsPreviewComponent,
27
+ EntityCommunicationsPreviewWindowComponent
28
+ ],
29
+ imports: [
30
+ CommonModule,
31
+ DialogsModule,
32
+ ContainerDirectivesModule,
33
+ ButtonsModule,
34
+ ListBoxModule,
35
+ IndicatorsModule
36
+ ],
37
+ exports: [
38
+ EntityCommunicationsPreviewComponent,
39
+ EntityCommunicationsPreviewWindowComponent
40
+ ]
41
+ }]
42
+ }], null, null); })();
43
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(EntityCommunicationsModule, { declarations: [EntityCommunicationsPreviewComponent,
44
+ EntityCommunicationsPreviewWindowComponent], imports: [CommonModule,
45
+ DialogsModule,
46
+ ContainerDirectivesModule,
47
+ ButtonsModule,
48
+ ListBoxModule,
49
+ IndicatorsModule], exports: [EntityCommunicationsPreviewComponent,
50
+ EntityCommunicationsPreviewWindowComponent] }); })();
@@ -0,0 +1,4 @@
1
+ export * from './module';
2
+ export * from './lib/preview.component';
3
+ export * from './lib/window.component';
4
+ //# sourceMappingURL=public-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Public API Surface
3
+ */
4
+ export * from './module';
5
+ export * from './lib/preview.component';
6
+ export * from './lib/window.component';
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@memberjunction/ng-entity-communications",
3
+ "version": "2.0.0",
4
+ "description": "MemberJunction: Angular Components to allow a user to select templates, preview the messages with those tempaltes, and send them",
5
+ "main": "./dist/public-api.js",
6
+ "typings": "./dist/public-api.d.ts",
7
+ "files": [
8
+ "/dist"
9
+ ],
10
+ "scripts": {
11
+ "test": "echo \"Error: no test specified\" && exit 1",
12
+ "build": "ngc"
13
+ },
14
+ "keywords": [],
15
+ "author": "",
16
+ "license": "ISC",
17
+ "devDependencies": {
18
+ "@angular/compiler": "18.0.2",
19
+ "@angular/compiler-cli": "18.0.2"
20
+ },
21
+ "peerDependencies": {
22
+ "@angular/common": "18.0.2",
23
+ "@angular/core": "18.0.2",
24
+ "@angular/forms": "18.0.2",
25
+ "@angular/router": "18.0.2",
26
+ "@progress/kendo-angular-buttons": "16.2.0",
27
+ "@progress/kendo-angular-dialog": "16.2.0",
28
+ "@progress/kendo-angular-listbox": "16.2.0",
29
+ "@progress/kendo-angular-indicators": "16.2.0"
30
+ },
31
+ "dependencies": {
32
+ "@memberjunction/core-entities": "2.0.0",
33
+ "@memberjunction/global": "2.0.0",
34
+ "@memberjunction/core": "2.0.0",
35
+ "@memberjunction/communication-types": "2.0.0",
36
+ "@memberjunction/entity-communications-base": "2.0.0",
37
+ "@memberjunction/entity-communications-client": "2.0.0",
38
+ "@memberjunction/ng-container-directives": "2.0.0",
39
+ "@memberjunction/ng-shared": "2.0.0",
40
+ "tslib": "^2.3.0"
41
+ },
42
+ "sideEffects": false
43
+ }