@memberjunction/ng-entity-communications 5.39.0 → 5.40.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/dist/lib/preview.component.js +5 -4
- package/dist/lib/preview.component.js.map +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +5 -3
- package/dist/module.js.map +1 -1
- package/package.json +12 -12
|
@@ -72,6 +72,7 @@ function EntityCommunicationsPreviewComponent_Conditional_2_Conditional_1_Condit
|
|
|
72
72
|
i0.ɵɵtext(17);
|
|
73
73
|
i0.ɵɵelementEnd();
|
|
74
74
|
i0.ɵɵelement(18, "div", 17);
|
|
75
|
+
i0.ɵɵpipe(19, "mjSafeRichHtml");
|
|
75
76
|
i0.ɵɵelementEnd();
|
|
76
77
|
} if (rf & 2) {
|
|
77
78
|
const ctx_r2 = i0.ɵɵnextContext(3);
|
|
@@ -90,10 +91,10 @@ function EntityCommunicationsPreviewComponent_Conditional_2_Conditional_1_Condit
|
|
|
90
91
|
i0.ɵɵadvance(4);
|
|
91
92
|
i0.ɵɵtextInterpolate(ctx_r2.currentPreviewItemSubject());
|
|
92
93
|
i0.ɵɵadvance();
|
|
93
|
-
i0.ɵɵproperty("innerHTML", ctx_r2.currentPreviewItemBody(), i0.ɵɵsanitizeHtml);
|
|
94
|
+
i0.ɵɵproperty("innerHTML", i0.ɵɵpipeBind1(19, 9, ctx_r2.currentPreviewItemBody()), i0.ɵɵsanitizeHtml);
|
|
94
95
|
} }
|
|
95
96
|
function EntityCommunicationsPreviewComponent_Conditional_2_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
96
|
-
i0.ɵɵconditionalCreate(0, EntityCommunicationsPreviewComponent_Conditional_2_Conditional_1_Conditional_0_Template, 4, 0)(1, EntityCommunicationsPreviewComponent_Conditional_2_Conditional_1_Conditional_1_Template,
|
|
97
|
+
i0.ɵɵconditionalCreate(0, EntityCommunicationsPreviewComponent_Conditional_2_Conditional_1_Conditional_0_Template, 4, 0)(1, EntityCommunicationsPreviewComponent_Conditional_2_Conditional_1_Conditional_1_Template, 20, 11);
|
|
97
98
|
} if (rf & 2) {
|
|
98
99
|
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
99
100
|
i0.ɵɵconditional(ctx_r2.previewMessages.length === 0 ? 0 : 1);
|
|
@@ -232,11 +233,11 @@ export class EntityCommunicationsPreviewComponent {
|
|
|
232
233
|
i0.ɵɵconditional(ctx.step === 1 ? 1 : -1);
|
|
233
234
|
i0.ɵɵadvance();
|
|
234
235
|
i0.ɵɵconditional(ctx.step === 2 ? 2 : -1);
|
|
235
|
-
} }, dependencies: [i1.MJButtonDirective, i2.LoadingComponent], styles: [".step-1[_ngcontent-%COMP%], .step-2[_ngcontent-%COMP%] {\n margin: 20px 0;\n}\n\n.template-preview[_ngcontent-%COMP%] {\n border: 1px solid var(--mj-border-strong);\n margin-top: 10px;\n}\n\n.subject-line[_ngcontent-%COMP%] {\n font-weight: bolder;\n border-bottom: 1px solid var(--mj-border-strong);\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 var(--mj-border-strong);\n margin: 5px 0;\n cursor: pointer;\n}\n\nli[_ngcontent-%COMP%]:hover {\n background-color: var(--mj-bg-surface-sunken);\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: var(--mj-brand-primary);\n}\n\n.vcr-controls[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover {\n color: var(--mj-brand-primary-hover);\n}\n\n.vcr-controls[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled {\n color: var(--mj-border-strong);\n cursor: not-allowed;\n}\n\n.vcr-controls[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled span[_ngcontent-%COMP%] {\n color: var(--mj-border-strong);\n}\n\n.index-indicator[_ngcontent-%COMP%] {\n margin: 0 10px;\n}"] });
|
|
236
|
+
} }, dependencies: [i1.MJButtonDirective, i2.LoadingComponent, i2.MJSafeRichHtmlPipe], styles: [".step-1[_ngcontent-%COMP%], .step-2[_ngcontent-%COMP%] {\n margin: 20px 0;\n}\n\n.template-preview[_ngcontent-%COMP%] {\n border: 1px solid var(--mj-border-strong);\n margin-top: 10px;\n}\n\n.subject-line[_ngcontent-%COMP%] {\n font-weight: bolder;\n border-bottom: 1px solid var(--mj-border-strong);\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 var(--mj-border-strong);\n margin: 5px 0;\n cursor: pointer;\n}\n\nli[_ngcontent-%COMP%]:hover {\n background-color: var(--mj-bg-surface-sunken);\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: var(--mj-brand-primary);\n}\n\n.vcr-controls[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover {\n color: var(--mj-brand-primary-hover);\n}\n\n.vcr-controls[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled {\n color: var(--mj-border-strong);\n cursor: not-allowed;\n}\n\n.vcr-controls[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled span[_ngcontent-%COMP%] {\n color: var(--mj-border-strong);\n}\n\n.index-indicator[_ngcontent-%COMP%] {\n margin: 0 10px;\n}"] });
|
|
236
237
|
}
|
|
237
238
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EntityCommunicationsPreviewComponent, [{
|
|
238
239
|
type: Component,
|
|
239
|
-
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 <div class=\"preview-body\" [innerHTML]=\"currentPreviewItemBody()\"></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}"] }]
|
|
240
|
+
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}"] }]
|
|
240
241
|
}], () => [], { templateFilter: [{
|
|
241
242
|
type: Input
|
|
242
243
|
}], entityInfo: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.component.js","sourceRoot":"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AWC;YAXD,yCAWC;YAED,cAmCD;YAnCC,yCAmCD;;;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 { 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 const result = await rv.RunView<MJTemplateEntityExtended>(\n {\n EntityName: \"MJ: Templates\",\n ExtraFilter: `(IsActive = 1 AND (ActiveAt IS NULL OR ActiveAt <= GETDATE())) ${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 <div class=\"preview-body\" [innerHTML]=\"currentPreviewItemBody()\"></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,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;;;;;;ICDhE,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,iCAAoC;IAAnB,qOAAS,eAAQ,KAAC;IAAC,oBAAI;IAAA,iBAAS;IAE/C,AADF,8BAA0B,gBACmE;IAAnF,qOAAS,qBAAc,KAAC;IAC9B,0BAA8C;IAChD,iBAAS;IACT,iCAAiG;IAAzF,qOAAS,wBAAiB,KAAC;IACjC,0BAAuC;IACzC,iBAAS;IACT,gCAA8B;IAAA,aAA6D;IAAA,iBA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AE,CAAC;YACjC,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC7B,CAAC;IACH,CAAC;8HApIU,oCAAoC;6DAApC,oCAAoC;YClBjD,2BAAK;YACH,sGAAkB;YAalB,sGAAkB;YAqCpB,iBAAM;;YAlDJ,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 const result = await rv.RunView<MJTemplateEntityExtended>(\n {\n EntityName: \"MJ: Templates\",\n ExtraFilter: `(IsActive = 1 AND (ActiveAt IS NULL OR ActiveAt <= GETDATE())) ${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/dist/module.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as i5 from "@memberjunction/ng-ui-components";
|
|
|
7
7
|
import * as i6 from "@memberjunction/ng-shared-generic";
|
|
8
8
|
export declare class EntityCommunicationsModule {
|
|
9
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<EntityCommunicationsModule, never>;
|
|
10
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<EntityCommunicationsModule, [typeof i1.EntityCommunicationsPreviewComponent, typeof i2.EntityCommunicationsPreviewWindowComponent], [typeof i3.CommonModule, typeof i4.ContainerDirectivesModule, typeof i5.MJButtonDirective, typeof i5.MJWindowComponent, typeof i6.SharedGenericModule], [typeof i1.EntityCommunicationsPreviewComponent, typeof i2.EntityCommunicationsPreviewWindowComponent]>;
|
|
10
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<EntityCommunicationsModule, [typeof i1.EntityCommunicationsPreviewComponent, typeof i2.EntityCommunicationsPreviewWindowComponent], [typeof i3.CommonModule, typeof i4.ContainerDirectivesModule, typeof i5.MJButtonDirective, typeof i5.MJWindowComponent, typeof i6.SharedGenericModule, typeof i6.MJSafeRichHtmlPipe], [typeof i1.EntityCommunicationsPreviewComponent, typeof i2.EntityCommunicationsPreviewWindowComponent]>;
|
|
11
11
|
static ɵinj: i0.ɵɵInjectorDeclaration<EntityCommunicationsModule>;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=module.d.ts.map
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;AAWA,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;AAWA,qBAkBa,0BAA0B;yCAA1B,0BAA0B;0CAA1B,0BAA0B;0CAA1B,0BAA0B;CAAI"}
|
package/dist/module.js
CHANGED
|
@@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
|
|
|
3
3
|
// MJ UI Components
|
|
4
4
|
import { MJButtonDirective, MJWindowComponent } from '@memberjunction/ng-ui-components';
|
|
5
5
|
import { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';
|
|
6
|
-
import { SharedGenericModule } from '@memberjunction/ng-shared-generic';
|
|
6
|
+
import { SharedGenericModule, MJSafeRichHtmlPipe } from '@memberjunction/ng-shared-generic';
|
|
7
7
|
import { EntityCommunicationsPreviewWindowComponent } from './lib/window.component';
|
|
8
8
|
import { EntityCommunicationsPreviewComponent } from './lib/preview.component';
|
|
9
9
|
import * as i0 from "@angular/core";
|
|
@@ -27,7 +27,8 @@ export class EntityCommunicationsModule {
|
|
|
27
27
|
ContainerDirectivesModule,
|
|
28
28
|
MJButtonDirective,
|
|
29
29
|
MJWindowComponent,
|
|
30
|
-
SharedGenericModule
|
|
30
|
+
SharedGenericModule,
|
|
31
|
+
MJSafeRichHtmlPipe
|
|
31
32
|
],
|
|
32
33
|
exports: [
|
|
33
34
|
EntityCommunicationsPreviewComponent,
|
|
@@ -40,6 +41,7 @@ export class EntityCommunicationsModule {
|
|
|
40
41
|
ContainerDirectivesModule,
|
|
41
42
|
MJButtonDirective,
|
|
42
43
|
MJWindowComponent,
|
|
43
|
-
SharedGenericModule
|
|
44
|
+
SharedGenericModule,
|
|
45
|
+
MJSafeRichHtmlPipe], exports: [EntityCommunicationsPreviewComponent,
|
|
44
46
|
EntityCommunicationsPreviewWindowComponent] }); })();
|
|
45
47
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,mBAAmB;AACnB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAExF,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,mBAAmB;AACnB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAExF,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5F,OAAO,EAAE,0CAA0C,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;;AAoB/E,MAAM,OAAO,0BAA0B;oHAA1B,0BAA0B;4DAA1B,0BAA0B;gEAZnC,YAAY;YACZ,yBAAyB;YAEzB,iBAAiB;YACjB,mBAAmB;;iFAQV,0BAA0B;cAlBtC,QAAQ;eAAC;gBACR,YAAY,EAAE;oBACZ,oCAAoC;oBACpC,0CAA0C;iBAC3C;gBACD,OAAO,EAAE;oBACP,YAAY;oBACZ,yBAAyB;oBACzB,iBAAiB;oBACjB,iBAAiB;oBACjB,mBAAmB;oBACnB,kBAAkB;iBACnB;gBACD,OAAO,EAAE;oBACP,oCAAoC;oBACpC,0CAA0C;iBAC3C;aACF;;wFACY,0BAA0B,mBAhBnC,oCAAoC;QACpC,0CAA0C,aAG1C,YAAY;QACZ,yBAAyB;QACzB,iBAAiB;QACjB,iBAAiB;QACjB,mBAAmB;QACnB,kBAAkB,aAGlB,oCAAoC;QACpC,0CAA0C","sourcesContent":["import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\n// MJ UI Components\nimport { MJButtonDirective, MJWindowComponent } from '@memberjunction/ng-ui-components';\n\nimport { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';\nimport { SharedGenericModule, MJSafeRichHtmlPipe } from '@memberjunction/ng-shared-generic';\nimport { EntityCommunicationsPreviewWindowComponent } from './lib/window.component';\nimport { EntityCommunicationsPreviewComponent } from './lib/preview.component';\n\n@NgModule({\n declarations: [\n EntityCommunicationsPreviewComponent,\n EntityCommunicationsPreviewWindowComponent\n ],\n imports: [\n CommonModule,\n ContainerDirectivesModule,\n MJButtonDirective,\n MJWindowComponent,\n SharedGenericModule,\n MJSafeRichHtmlPipe\n ],\n exports: [\n EntityCommunicationsPreviewComponent,\n EntityCommunicationsPreviewWindowComponent\n ]\n})\nexport class EntityCommunicationsModule { }"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-entity-communications",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.40.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",
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"@angular/router": "21.1.3"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@memberjunction/communication-types": "5.
|
|
31
|
-
"@memberjunction/core": "5.
|
|
32
|
-
"@memberjunction/core-entities": "5.
|
|
33
|
-
"@memberjunction/entity-communications-base": "5.
|
|
34
|
-
"@memberjunction/entity-communications-client": "5.
|
|
35
|
-
"@memberjunction/global": "5.
|
|
36
|
-
"@memberjunction/ng-container-directives": "5.
|
|
37
|
-
"@memberjunction/ng-shared": "5.
|
|
38
|
-
"@memberjunction/ng-shared-generic": "5.
|
|
39
|
-
"@memberjunction/ng-ui-components": "5.
|
|
40
|
-
"@memberjunction/templates-base-types": "5.
|
|
30
|
+
"@memberjunction/communication-types": "5.40.0",
|
|
31
|
+
"@memberjunction/core": "5.40.0",
|
|
32
|
+
"@memberjunction/core-entities": "5.40.0",
|
|
33
|
+
"@memberjunction/entity-communications-base": "5.40.0",
|
|
34
|
+
"@memberjunction/entity-communications-client": "5.40.0",
|
|
35
|
+
"@memberjunction/global": "5.40.0",
|
|
36
|
+
"@memberjunction/ng-container-directives": "5.40.0",
|
|
37
|
+
"@memberjunction/ng-shared": "5.40.0",
|
|
38
|
+
"@memberjunction/ng-shared-generic": "5.40.0",
|
|
39
|
+
"@memberjunction/ng-ui-components": "5.40.0",
|
|
40
|
+
"@memberjunction/templates-base-types": "5.40.0",
|
|
41
41
|
"tslib": "^2.8.1"
|
|
42
42
|
},
|
|
43
43
|
"sideEffects": false,
|