@forgeroute/ui 0.5.33 → 0.5.35

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeroute/ui",
3
- "version": "0.5.33",
3
+ "version": "0.5.35",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=22.0.0",
6
6
  "@angular/core": ">=22.0.0",
@@ -364,6 +364,15 @@ export declare const UI_DEFAULT_LABELS: {
364
364
  readonly 'emailTemplateEditor.fontSize': "Font size";
365
365
  readonly 'emailTemplateEditor.headingLevel': "Heading level";
366
366
  readonly 'emailTemplateEditor.hideReactions': "Hide Reactions";
367
+ readonly 'emailTemplateEditor.checksTitle': "Check before saving";
368
+ readonly 'emailTemplateEditor.checkUnknownVariable': "The variable {{ name }} is not available: it is sent as empty text.";
369
+ readonly 'emailTemplateEditor.checkImageAlt_one': "{{ count }} image has no alt text.";
370
+ readonly 'emailTemplateEditor.checkImageAlt_other': "{{ count }} images have no alt text.";
371
+ readonly 'emailTemplateEditor.checkEmptyLink_one': "{{ count }} link has no address.";
372
+ readonly 'emailTemplateEditor.checkEmptyLink_other': "{{ count }} links have no address.";
373
+ readonly 'emailTemplateEditor.uploadImage': "Upload image";
374
+ readonly 'emailTemplateEditor.uploadingImage': "Uploading image…";
375
+ readonly 'emailTemplateEditor.imageUploadFailed': "The image could not be uploaded. Try again or paste an image address.";
367
376
  readonly 'emailTemplateEditor.imageAddress': "Image address";
368
377
  readonly 'emailTemplateEditor.imageAltText': "Image alt text";
369
378
  readonly 'emailTemplateEditor.insertImage': "Insert image";
@@ -2795,7 +2804,7 @@ export declare class ButtonComponent {
2795
2804
  readonly color: import("@angular/core").InputSignal<string | undefined>;
2796
2805
  readonly active: import("@angular/core").InputSignal<boolean>;
2797
2806
  readonly size: import("@angular/core").InputSignal<"sm" | "md" | "lg" | "xs">;
2798
- readonly type: import("@angular/core").InputSignal<"button" | "submit" | "reset">;
2807
+ readonly type: import("@angular/core").InputSignal<"reset" | "submit" | "button">;
2799
2808
  readonly disabled: import("@angular/core").InputSignal<boolean>;
2800
2809
  readonly loading: import("@angular/core").InputSignal<boolean>;
2801
2810
  readonly fullWidth: import("@angular/core").InputSignal<boolean>;
@@ -2944,7 +2953,7 @@ export declare class ModalComponent implements OnInit, OnDestroy {
2944
2953
  */
2945
2954
  readonly describedBy: import("@angular/core").InputSignal<string | null>;
2946
2955
  readonly maxWidth: import("@angular/core").InputSignal<string>;
2947
- readonly bodyOverflow: import("@angular/core").InputSignal<"hidden" | "auto" | "visible">;
2956
+ readonly bodyOverflow: import("@angular/core").InputSignal<"auto" | "visible" | "hidden">;
2948
2957
  /** `data-testid` of the dialog element itself (the host `<ui-modal>` is always in the page, the dialog only while open). None when empty. */
2949
2958
  readonly dialogTestId: import("@angular/core").InputSignal<string>;
2950
2959
  /** Hides the header X button (e.g. while a request is running). Escape and a backdrop click still close unless `closable` is false. */
@@ -276,6 +276,25 @@ export interface EmailTemplateVideoDefaults {
276
276
  export interface EmailTemplateVideoOptions extends EmailTemplateVideoDefaults {}
277
277
  /** Builds the link a video block points at; the default is the video's own share link. */
278
278
  export type EmailTemplateVideoLinkFn = (video: EmailTemplateVideo, options: EmailTemplateVideoOptions) => string;
279
+ /**
280
+ * How an app styles the Preview and Mobile tabs so the preview looks like the email its customers receive. Every field is optional and validated
281
+ * before it is written into the preview document (a colour must be `#rgb`..`#rrggbbaa` or a plain colour name, the font a plain family list, the logo an
282
+ * http(s) address, the texts are escaped); an invalid value is ignored and the default look stays. Only the preview changes: the saved message never contains it.
283
+ */
284
+ export interface EmailTemplatePreviewBrand {
285
+ /** A font-family list, e.g. `Georgia, 'Times New Roman', serif`. */
286
+ fontFamily?: string;
287
+ textColor?: string;
288
+ linkColor?: string;
289
+ /** Colour behind the whole message. */
290
+ backgroundColor?: string;
291
+ /** An http(s) image shown above the message. */
292
+ logoUrl?: string;
293
+ /** Shown beside / below the logo above the message. */
294
+ companyName?: string;
295
+ /** Shown under the message (an address, a signature, a legal line); line breaks are kept. */
296
+ footerText?: string;
297
+ }
279
298
  interface EmailBlock {
280
299
  id: string;
281
300
  html: string;
@@ -305,6 +324,19 @@ export declare class EmailTemplateEditorComponent {
305
324
  /** The template to edit. `null` = a blank new template. An object without `id` is a new template that starts from those values (e.g. a copy). */
306
325
  readonly template: import("@angular/core").InputSignal<EmailTemplateValue | null>;
307
326
  readonly categories: import("@angular/core").InputSignal<SelectOption<string>[]>;
327
+ /** Shows the Category field (default). An app without categories sets `false`; the saved `category` then stays whatever the template already had. */
328
+ readonly showCategory: import("@angular/core").InputSignal<boolean>;
329
+ /** Shows "Use this template all year" and the Active From / To dates (default). An app whose templates are not seasonal sets `false`: nothing is shown and Save always emits `useAllYear: true` with no dates. */
330
+ readonly showActiveRange: import("@angular/core").InputSignal<boolean>;
331
+ /** Styles the Preview and Mobile tabs like the app's real emails (font, colours, logo, company name, footer); see `EmailTemplatePreviewBrand`. `null` = the default look. */
332
+ readonly previewBrand: import("@angular/core").InputSignal<EmailTemplatePreviewBrand | null>;
333
+ /** The Preview and Mobile tabs fill every variable with its `example` (default off: they show the `{{key}}` tokens as written). The saved message is never changed. */
334
+ readonly previewSampleData: import("@angular/core").InputSignal<boolean>;
335
+ /**
336
+ * Lets the user pick an image file in the Insert Image dialog. The host uploads it and resolves the public http(s) address of the stored image; a rejection (or a value that is not
337
+ * an http(s) address) shows the "could not be uploaded" message and the user can still paste an address. `null` (default) = no upload button, addresses only.
338
+ */
339
+ readonly imageUpload: import("@angular/core").InputSignal<((file: File) => Promise<string>) | null>;
308
340
  readonly categoryPlaceholderInput: import("@angular/core").InputSignal<string | null>;
309
341
  readonly categoryPlaceholder: import("@angular/core").Signal<string>;
310
342
  readonly assignmentOptions: import("@angular/core").InputSignal<EmailTemplateAssignmentOption[]>;
@@ -410,6 +442,8 @@ export declare class EmailTemplateEditorComponent {
410
442
  readonly showImageDialog: import("@angular/core").WritableSignal<boolean>;
411
443
  readonly imageUrl: import("@angular/core").WritableSignal<string>;
412
444
  readonly imageAlt: import("@angular/core").WritableSignal<string>;
445
+ readonly imageUploading: import("@angular/core").WritableSignal<boolean>;
446
+ readonly imageUploadError: import("@angular/core").WritableSignal<string>;
413
447
  readonly showTestSendDialog: import("@angular/core").WritableSignal<boolean>;
414
448
  readonly testSendEmail: import("@angular/core").WritableSignal<string>;
415
449
  readonly activeEditorTab: import("@angular/core").WritableSignal<EditorTab>;
@@ -474,6 +508,9 @@ export declare class EmailTemplateEditorComponent {
474
508
  readonly canInsertLink: import("@angular/core").Signal<boolean>;
475
509
  readonly imageUrlError: import("@angular/core").Signal<string>;
476
510
  readonly canInsertImage: import("@angular/core").Signal<boolean>;
511
+ /** Mistakes in the subject / message that turn into a broken email (see `findEmailChecks`); the sentences below list them. */
512
+ private readonly emailChecks;
513
+ readonly checkMessages: import("@angular/core").Signal<string[]>;
477
514
  readonly testEmailError: import("@angular/core").Signal<string>;
478
515
  readonly canSendTest: import("@angular/core").Signal<boolean>;
479
516
  /** The test email is the SAVED template: true when the editor holds changes that were not saved yet. */
@@ -555,6 +592,8 @@ export declare class EmailTemplateEditorComponent {
555
592
  insertLink(): void;
556
593
  openImageDialog(): void;
557
594
  insertImageFromUrl(): void;
595
+ /** The user picked a file in the Insert Image dialog: the host uploads it and the address it returns fills the address field (the user still adds alt text and presses Insert). */
596
+ onImageFile(event: Event): Promise<void>;
558
597
  openTestSendDialog(): void;
559
598
  onTestSend(): void;
560
599
  openVideoTab(): void;
@@ -580,6 +619,31 @@ export declare class EmailTemplateEditorComponent {
580
619
  "required": false;
581
620
  "isSignal": true;
582
621
  };
622
+ "showCategory": {
623
+ "alias": "showCategory";
624
+ "required": false;
625
+ "isSignal": true;
626
+ };
627
+ "showActiveRange": {
628
+ "alias": "showActiveRange";
629
+ "required": false;
630
+ "isSignal": true;
631
+ };
632
+ "previewBrand": {
633
+ "alias": "previewBrand";
634
+ "required": false;
635
+ "isSignal": true;
636
+ };
637
+ "previewSampleData": {
638
+ "alias": "previewSampleData";
639
+ "required": false;
640
+ "isSignal": true;
641
+ };
642
+ "imageUpload": {
643
+ "alias": "imageUpload";
644
+ "required": false;
645
+ "isSignal": true;
646
+ };
583
647
  "categoryPlaceholderInput": {
584
648
  "alias": "categoryPlaceholder";
585
649
  "required": false;
@@ -770,7 +834,23 @@ export declare const DEFAULT_EMAIL_TEMPLATE_VARIABLE_GROUPS: {
770
834
  * The document the Preview / Mobile tabs show (inside a sandboxed iframe): the serialised message with the base look of a sent email. A
771
835
  * Content-Security-Policy meta blocks scripts and anything but images / inline styles, and links open nowhere (sandbox, no popups).
772
836
  */
773
- export declare function buildPreviewDocument(bodyHtml: string): string;
837
+ export declare function buildPreviewDocument(bodyHtml: string, brand?: EmailTemplatePreviewBrand | null): string;
838
+ /** Keeps only the brand values that are safe to write into the preview document (see `EmailTemplatePreviewBrand`); anything else is dropped. */
839
+ export declare function safePreviewBrand(brand?: EmailTemplatePreviewBrand | null): EmailTemplatePreviewBrand;
840
+ /** The `{{key}}` merge variables written in the texts, each once, in the order they first appear. */
841
+ export declare function usedVariableKeys(...texts: string[]): string[];
842
+ /** The message as the Preview shows it with sample data: every known `{{key}}` becomes the variable's (escaped) `example`; a key the host does not offer stays as written. */
843
+ export declare function fillSampleVariables(html: string, groups: readonly EmailTemplateVariableGroup[]): string;
844
+ /** What the editor warns about before a template is saved: mistakes that turn into a broken email. */
845
+ export interface EmailChecks {
846
+ /** Variables used in the subject or message that the host does not offer: they are sent as empty text. */
847
+ unknownVariables: string[];
848
+ /** Images with no alt text (what a screen reader and a blocked-image inbox show). */
849
+ imagesWithoutAlt: number;
850
+ /** Links with no address (empty or `#`): clicking them goes nowhere. */
851
+ emptyLinks: number;
852
+ }
853
+ export declare function findEmailChecks(subject: string, bodyHtml: string, knownKeys: readonly string[]): EmailChecks;
774
854
  /** The default merge variables with names in the app's active language (the `key` and the example value stay as they are). */
775
855
  export declare function localizedEmailVariableGroups(): {
776
856
  name: string;