Skip to content

@memberjunction/ng-entity-communications

Angular components for selecting message templates, previewing communications with live entity data, and sending messages to recipients within the MemberJunction framework.

The @memberjunction/ng-entity-communications package provides a two-step communication workflow: first, users browse and select from available message templates; then they preview how those templates render against actual entity data before sending. The package includes both an inline preview component and a dialog wrapper for modal presentation.

flowchart TD
    subgraph Phase1["Template Selection"]
        TS[Browse Active Templates] --> TF[Apply Template Filter]
        TF --> TC[User Selects Template]
    end

    subgraph Phase2["Preview & Send"]
        TC --> PG[Generate Previews]
        PG --> NAV[Navigate Messages]
        NAV --> SEND[Confirm / Cancel]
    end

    subgraph Integration["MJ Integration"]
        ECC[EntityCommunicationsEngineClient] --> PG
        RV[RunView - Entity Data] --> PG
        TE[Template Engine] --> PG
    end

    style Phase1 fill:#2d6a9f,stroke:#1a4971,color:#fff
    style Phase2 fill:#7c5295,stroke:#563a6b,color:#fff
    style Integration fill:#2d8659,stroke:#1a5c3a,color:#fff
Terminal window
npm install @memberjunction/ng-entity-communications
import { EntityCommunicationsModule } from '@memberjunction/ng-entity-communications';
@NgModule({
imports: [EntityCommunicationsModule]
})
export class YourModule { }
<mj-entity-communications-preview
[entityInfo]="entityInfo"
[runViewParams]="runViewParams"
[templateFilter]="'TemplateType = ''Email'''"
(templateSelected)="onTemplateSelected($event)">
</mj-entity-communications-preview>
@if (showPreview) {
<mj-entity-communications-preview-window
[entityInfo]="customerEntityInfo"
[runViewParams]="customerViewParams"
[DialogVisible]="showPreview"
[Title]="'Customer Email Preview'"
(DialogClosed)="onPreviewClosed($event)">
</mj-entity-communications-preview-window>
}
import { Component } from '@angular/core';
import { EntityInfo, Metadata, RunViewParams } from '@memberjunction/core';
import { TemplateEntityExtended } from '@memberjunction/templates-base-types';
@Component({
selector: 'app-customer-communication',
template: `
<button (click)="showPreview = true">Preview Customer Emails</button>
@if (showPreview) {
<mj-entity-communications-preview-window
[entityInfo]="customerEntityInfo"
[runViewParams]="customerViewParams"
[DialogVisible]="showPreview"
[Title]="'Customer Email Preview'"
(DialogClosed)="onPreviewClosed($event)">
</mj-entity-communications-preview-window>
}
`
})
export class CustomerCommunicationComponent {
showPreview = false;
customerEntityInfo: EntityInfo;
customerViewParams: RunViewParams;
constructor() {
const md = new Metadata();
this.customerEntityInfo = md.Entities.find(e => e.Name === 'Customers')!;
this.customerViewParams = {
EntityName: 'Customers',
ExtraFilter: 'IsActive = 1',
OrderBy: 'LastContactDate ASC',
ResultType: 'entity_object'
};
}
onPreviewClosed(confirmed: boolean) {
this.showPreview = false;
if (confirmed) {
console.log('User confirmed sending emails');
}
}
}

EntityCommunicationsPreviewComponent (mj-entity-communications-preview)

Section titled “EntityCommunicationsPreviewComponent (mj-entity-communications-preview)”

Main component for template selection and message preview.

InputTypeDescription
entityInfoEntityInfoEntity metadata for the communication recipients
runViewParamsRunViewParamsParameters for loading entity data
templateFilterstringSQL filter expression for available templates
OutputTypeDescription
templateSelectedEventEmitter<TemplateEntityExtended>Emitted when a template is selected

EntityCommunicationsPreviewWindowComponent (mj-entity-communications-preview-window)

Section titled “EntityCommunicationsPreviewWindowComponent (mj-entity-communications-preview-window)”

Dialog wrapper around the preview component.

InputTypeDefaultDescription
DialogVisibleboolean-Controls dialog visibility
Titlestring'Communications Preview'Dialog title
Widthnumber650Dialog width in pixels
Heightnumber600Dialog height in pixels
MinWidthnumber400Minimum dialog width
MinHeightnumber350Minimum dialog height
ResizablebooleantrueWhether the dialog can be resized
entityInfoEntityInfo-Entity metadata
runViewParamsRunViewParams-View parameters for data loading
OutputTypeDescription
DialogClosedEventEmitter<boolean>true if confirmed, false if canceled
  1. Template Selection — Component loads active templates filtered by the templateFilter expression. User browses and selects a template.
  2. Preview Generation — The selected template is processed against entity data from runViewParams using EntityCommunicationsEngineClient. A loading indicator shows during processing.
  3. Preview Navigation — VCR-style controls (first, previous, next, last) let the user browse through all generated preview messages, viewing processed subject lines and HTML bodies.
  4. Confirmation (dialog mode) — OK/Cancel buttons control the dialog, with DialogClosed emitting the user’s choice.
PackageDescription
@memberjunction/coreMetadata, entity framework, view execution
@memberjunction/core-entitiesEntity type definitions
@memberjunction/globalGlobal utilities and event system
@memberjunction/communication-typesMessage types and communication engine interfaces
@memberjunction/entity-communications-baseEntityCommunicationParams interface
@memberjunction/entity-communications-clientClient-side communication processing engine
@memberjunction/templates-base-typesTemplate engine and extended template types
@memberjunction/ng-container-directivesContainer directive utilities
@memberjunction/ng-sharedShared Angular utilities
@memberjunction/ng-shared-genericShared generic components
  • @angular/common ^21.x
  • @angular/core ^21.x
  • @angular/forms ^21.x
  • @angular/router ^21.x
  • @progress/kendo-angular-buttons ^22.x
  • @progress/kendo-angular-dialog ^22.x
  • @progress/kendo-angular-listbox ^22.x
  • @progress/kendo-angular-indicators ^22.x
Terminal window
cd packages/Angular/Generic/entity-communication
npm run build

ISC