@memberjunction/ng-entity-communications 5.51.0 → 6.1.0-edge.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.
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 MemberJunction
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
2
3
|
import { ProcessedMessage } from '@memberjunction/communication-types';
|
|
3
4
|
import { EntityInfo, RunViewParams } from '@memberjunction/core';
|
|
4
5
|
import { MJTemplateEntityExtended } from '@memberjunction/core-entities';
|
|
@@ -6,7 +7,7 @@ import * as i0 from "@angular/core";
|
|
|
6
7
|
/**
|
|
7
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
|
|
8
9
|
*/
|
|
9
|
-
export declare class EntityCommunicationsPreviewComponent implements OnInit {
|
|
10
|
+
export declare class EntityCommunicationsPreviewComponent extends BaseAngularComponent implements OnInit {
|
|
10
11
|
templateFilter: string | undefined;
|
|
11
12
|
entityInfo: EntityInfo | undefined;
|
|
12
13
|
runViewParams: RunViewParams | undefined;
|
|
@@ -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,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,YAAW,MAAM;
|
|
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;IACnC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IACxC,gBAAgB,yCAAgD;IAE1E,SAAS,EAAE,wBAAwB,EAAE,CAAM;IAC3C,gBAAgB,EAAE,wBAAwB,GAAG,IAAI,CAAQ;IACzD,IAAI,EAAE,MAAM,CAAK;IAEV,eAAe,EAAE,gBAAgB,EAAE,CAAM;IAChD,mBAAmB,EAAE,MAAM,CAAK;IACzB,OAAO,EAAE,OAAO,CAAS;;IAK1B,QAAQ;IAOR,aAAa;IAuBnB,cAAc,CAAC,QAAQ,EAAE,wBAAwB;cAOjC,mBAAmB;IAwCnC,yBAAyB,IAAI,MAAM;IASnC,sBAAsB,IAAI,MAAM;IAUhC,MAAM;IAKN,YAAY;IAIZ,WAAW;IAIX,WAAW;IAMX,eAAe;yCApIJ,oCAAoC;2CAApC,oCAAoC;CAyIhD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component, Output, EventEmitter, Input } from '@angular/core';
|
|
2
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
2
3
|
import { CommunicationEngineBase, Message } from '@memberjunction/communication-types';
|
|
3
4
|
import { RunView } from '@memberjunction/core';
|
|
4
5
|
import { UUIDsEqual } from '@memberjunction/global';
|
|
@@ -116,7 +117,7 @@ function EntityCommunicationsPreviewComponent_Conditional_2_Template(rf, ctx) {
|
|
|
116
117
|
/**
|
|
117
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
|
|
118
119
|
*/
|
|
119
|
-
export class EntityCommunicationsPreviewComponent {
|
|
120
|
+
export class EntityCommunicationsPreviewComponent extends BaseAngularComponent {
|
|
120
121
|
templateFilter;
|
|
121
122
|
entityInfo;
|
|
122
123
|
runViewParams;
|
|
@@ -127,7 +128,9 @@ export class EntityCommunicationsPreviewComponent {
|
|
|
127
128
|
previewMessages = [];
|
|
128
129
|
currentMessageIndex = 0;
|
|
129
130
|
loading = false;
|
|
130
|
-
constructor() {
|
|
131
|
+
constructor() {
|
|
132
|
+
super();
|
|
133
|
+
}
|
|
131
134
|
async ngOnInit() {
|
|
132
135
|
if (!this.entityInfo || !this.runViewParams)
|
|
133
136
|
throw new Error("EntityInfo and RunViewParams are required");
|
|
@@ -135,7 +138,7 @@ export class EntityCommunicationsPreviewComponent {
|
|
|
135
138
|
}
|
|
136
139
|
async loadTemplates() {
|
|
137
140
|
// load up all template metadata
|
|
138
|
-
const rv =
|
|
141
|
+
const rv = RunView.FromMetadataProvider(this.ProviderToUse);
|
|
139
142
|
// Dialect-neutral "active now" cutoff: GETDATE() does not exist on PostgreSQL,
|
|
140
143
|
// so inject a JS-computed ISO-8601 literal instead.
|
|
141
144
|
const nowIso = new Date().toISOString();
|
|
@@ -226,7 +229,7 @@ export class EntityCommunicationsPreviewComponent {
|
|
|
226
229
|
}
|
|
227
230
|
}
|
|
228
231
|
static ɵfac = function EntityCommunicationsPreviewComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || EntityCommunicationsPreviewComponent)(); };
|
|
229
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityCommunicationsPreviewComponent, selectors: [["mj-entity-communications-preview"]], inputs: { templateFilter: "templateFilter", entityInfo: "entityInfo", runViewParams: "runViewParams" }, outputs: { templateSelected: "templateSelected" }, standalone: false, 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) {
|
|
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) {
|
|
230
233
|
i0.ɵɵelementStart(0, "div");
|
|
231
234
|
i0.ɵɵconditionalCreate(1, EntityCommunicationsPreviewComponent_Conditional_1_Template, 6, 0, "div", 0);
|
|
232
235
|
i0.ɵɵconditionalCreate(2, EntityCommunicationsPreviewComponent_Conditional_2_Template, 3, 1, "div", 1);
|
|
@@ -250,5 +253,5 @@ export class EntityCommunicationsPreviewComponent {
|
|
|
250
253
|
}], templateSelected: [{
|
|
251
254
|
type: Output
|
|
252
255
|
}] }); })();
|
|
253
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(EntityCommunicationsPreviewComponent, { className: "EntityCommunicationsPreviewComponent", filePath: "src/lib/preview.component.ts", lineNumber:
|
|
256
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(EntityCommunicationsPreviewComponent, { className: "EntityCommunicationsPreviewComponent", filePath: "src/lib/preview.component.ts", lineNumber: 20 }); })();
|
|
254
257
|
//# sourceMappingURL=preview.component.js.map
|
|
@@ -1 +1 @@
|
|
|
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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J,cAWC;YAXD,yCAWC;YAED,cAoCD;YApCC,yCAoCD;;;iFDhCY,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 { 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 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\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 = new RunView();\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;IAAA,iCAAiB;IAAA,iBAAK;IAC1B,0BAAI;IACF,yIAIC;IAEL,AADE,iBAAK,EACD;;;IANF,eAIC;IAJD,+BAIC;;;;IASC,0BAAI;IAAA,qCAAqB;IAAA,iBAAK;IAC9B,iCAAoC;IAAnB,qOAAS,eAAQ,KAAC;IAAC,oBAAI;IAAA,iBAAS;;;;IAGnD,0BAAI;IAAA,YAAoC;IAAA,iBAAK;IAC7C,iCAAo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,GAAG,CAAC,CAAC;IAChB,CAAC;IAGD,YAAY;QACV,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,WAAW;QACT,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7D,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,eAAe;QACb,IAAI,IAAI,CAAC,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>"]}
|
package/package.json
CHANGED
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-entity-communications",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.0-edge.0",
|
|
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",
|
|
7
7
|
"files": [
|
|
8
8
|
"/dist"
|
|
9
9
|
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"test": "vitest run",
|
|
12
|
-
"build": "ngc",
|
|
13
|
-
"test:watch": "vitest"
|
|
14
|
-
},
|
|
15
10
|
"keywords": [],
|
|
16
11
|
"author": "",
|
|
17
12
|
"license": "ISC",
|
|
18
13
|
"devDependencies": {
|
|
19
14
|
"@angular/compiler": "21.1.3",
|
|
20
15
|
"@angular/compiler-cli": "21.1.3",
|
|
21
|
-
"@memberjunction/ng-test-utils": "
|
|
16
|
+
"@memberjunction/ng-test-utils": "6.1.0-edge.0",
|
|
22
17
|
"vitest": "^4.0.18"
|
|
23
18
|
},
|
|
24
19
|
"peerDependencies": {
|
|
25
20
|
"@angular/common": "21.1.3",
|
|
26
21
|
"@angular/core": "21.1.3",
|
|
27
|
-
"@angular/forms": "21.1.3"
|
|
28
|
-
"@angular/router": "21.1.3"
|
|
22
|
+
"@angular/forms": "21.1.3"
|
|
29
23
|
},
|
|
30
24
|
"dependencies": {
|
|
31
|
-
"@memberjunction/communication-types": "
|
|
32
|
-
"@memberjunction/core": "
|
|
33
|
-
"@memberjunction/core-entities": "
|
|
34
|
-
"@memberjunction/entity-communications-base": "
|
|
35
|
-
"@memberjunction/entity-communications-client": "
|
|
36
|
-
"@memberjunction/global": "
|
|
37
|
-
"@memberjunction/ng-
|
|
38
|
-
"@memberjunction/ng-
|
|
39
|
-
"@memberjunction/ng-shared-generic": "
|
|
40
|
-
"@memberjunction/ng-ui-components": "
|
|
41
|
-
"@memberjunction/templates-base-types": "
|
|
25
|
+
"@memberjunction/communication-types": "6.1.0-edge.0",
|
|
26
|
+
"@memberjunction/core": "6.1.0-edge.0",
|
|
27
|
+
"@memberjunction/core-entities": "6.1.0-edge.0",
|
|
28
|
+
"@memberjunction/entity-communications-base": "6.1.0-edge.0",
|
|
29
|
+
"@memberjunction/entity-communications-client": "6.1.0-edge.0",
|
|
30
|
+
"@memberjunction/global": "6.1.0-edge.0",
|
|
31
|
+
"@memberjunction/ng-base-types": "6.1.0-edge.0",
|
|
32
|
+
"@memberjunction/ng-container-directives": "6.1.0-edge.0",
|
|
33
|
+
"@memberjunction/ng-shared-generic": "6.1.0-edge.0",
|
|
34
|
+
"@memberjunction/ng-ui-components": "6.1.0-edge.0",
|
|
35
|
+
"@memberjunction/templates-base-types": "6.1.0-edge.0",
|
|
42
36
|
"tslib": "^2.8.1"
|
|
43
37
|
},
|
|
44
38
|
"sideEffects": false,
|
|
45
39
|
"repository": {
|
|
46
40
|
"type": "git",
|
|
47
41
|
"url": "https://github.com/MemberJunction/MJ"
|
|
42
|
+
},
|
|
43
|
+
"mjUILayer": "widgets",
|
|
44
|
+
"scripts": {
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"test:types": "tsc --noEmit -p tsconfig.spec.json",
|
|
47
|
+
"build": "ngc",
|
|
48
|
+
"test:watch": "vitest"
|
|
48
49
|
}
|
|
49
|
-
}
|
|
50
|
+
}
|