i-tech-shared-components 1.4.94 → 1.4.95
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/fesm2022/i-tech-shared-components.mjs +86 -2
- package/fesm2022/i-tech-shared-components.mjs.map +1 -1
- package/lib/components/announcement-modal/announcement-modal.component.d.ts +45 -0
- package/lib/interfaces/announcement.interface.d.ts +44 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { ButtonType } from '../../interfaces/button-types.enum';
|
|
3
|
+
import { LabelTypeEnum } from '../../interfaces/label-type.enum';
|
|
4
|
+
import { Announcement, AnnouncementButtonEvent } from '../../interfaces/announcement.interface';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* Renders an announcement: optional label, title, optional image, HTML body and its buttons.
|
|
8
|
+
*
|
|
9
|
+
* It does no navigation or HTTP; the host reacts to the emitted events.
|
|
10
|
+
* Inside a MatDialog it renders as the dialog content; with `preview` it renders inline (admin portal live preview).
|
|
11
|
+
*/
|
|
12
|
+
export declare class AnnouncementModalComponent {
|
|
13
|
+
/**
|
|
14
|
+
* Renders inline with its own shadow instead of relying on a dialog container.
|
|
15
|
+
*/
|
|
16
|
+
preview: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Emits the primary button's link.
|
|
19
|
+
*/
|
|
20
|
+
primaryClick: EventEmitter<AnnouncementButtonEvent>;
|
|
21
|
+
/**
|
|
22
|
+
* Emits the secondary button's link (target is null when it only closes).
|
|
23
|
+
*/
|
|
24
|
+
secondaryClick: EventEmitter<AnnouncementButtonEvent>;
|
|
25
|
+
/**
|
|
26
|
+
* Emits when the close button is clicked.
|
|
27
|
+
*/
|
|
28
|
+
close: EventEmitter<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Emits the snooze duration in hours when "Remind me later" is clicked.
|
|
31
|
+
*/
|
|
32
|
+
remindLater: EventEmitter<number>;
|
|
33
|
+
protected readonly ButtonType: typeof ButtonType;
|
|
34
|
+
protected data: Announcement | null;
|
|
35
|
+
protected labelColor: LabelTypeEnum;
|
|
36
|
+
protected primaryEvent: AnnouncementButtonEvent | null;
|
|
37
|
+
protected secondaryEvent: AnnouncementButtonEvent | null;
|
|
38
|
+
/**
|
|
39
|
+
* The announcement to render.
|
|
40
|
+
*/
|
|
41
|
+
set announcement(value: Announcement | null);
|
|
42
|
+
private toEvent;
|
|
43
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AnnouncementModalComponent, never>;
|
|
44
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AnnouncementModalComponent, "i-tech-announcement-modal", never, { "preview": { "alias": "preview"; "required": false; }; "announcement": { "alias": "announcement"; "required": false; }; }, { "primaryClick": "primaryClick"; "secondaryClick": "secondaryClick"; "close": "close"; "remindLater": "remindLater"; }, never, never, true, never>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { LabelTypeEnum } from './label-type.enum';
|
|
2
|
+
/**
|
|
3
|
+
* Where an announcement button leads. The host app decides how to follow it.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum AnnouncementLinkType {
|
|
6
|
+
/** An https URL, opened in a new tab. */
|
|
7
|
+
EXTERNAL_URL = "EXTERNAL_URL",
|
|
8
|
+
/** A route inside the host app, e.g. `/loads`. */
|
|
9
|
+
IN_APP_PATH = "IN_APP_PATH"
|
|
10
|
+
}
|
|
11
|
+
export interface AnnouncementButton {
|
|
12
|
+
label: string;
|
|
13
|
+
linkType?: AnnouncementLinkType | null;
|
|
14
|
+
/** Empty target = the button only closes the announcement. */
|
|
15
|
+
target?: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface AnnouncementCloseButton {
|
|
18
|
+
label: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Announcement payload as returned by notification_service.
|
|
22
|
+
*/
|
|
23
|
+
export interface Announcement {
|
|
24
|
+
id?: string;
|
|
25
|
+
label?: string | null;
|
|
26
|
+
labelColor?: LabelTypeEnum | null;
|
|
27
|
+
title: string;
|
|
28
|
+
/** Allowlisted HTML, already sanitized by the server. Rendered through Angular's sanitizer again. */
|
|
29
|
+
body?: string | null;
|
|
30
|
+
imageUrl?: string | null;
|
|
31
|
+
imageAlt?: string | null;
|
|
32
|
+
primaryButton?: AnnouncementButton | null;
|
|
33
|
+
secondaryButton?: AnnouncementButton | null;
|
|
34
|
+
closeButton?: AnnouncementCloseButton | null;
|
|
35
|
+
/** Null = no "Remind me later" button. */
|
|
36
|
+
remindLaterHours?: number | null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Emitted when the primary or secondary button is clicked.
|
|
40
|
+
*/
|
|
41
|
+
export interface AnnouncementButtonEvent {
|
|
42
|
+
linkType: AnnouncementLinkType | null;
|
|
43
|
+
target: string | null;
|
|
44
|
+
}
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -39,3 +39,5 @@ export * from './lib/interfaces/date-range-filtration.interface';
|
|
|
39
39
|
export * from './lib/interfaces/segmented-button.interface';
|
|
40
40
|
export * from './lib/components/segmented-button/segmented-button.component';
|
|
41
41
|
export * from './lib/components/time-input/time-input.component';
|
|
42
|
+
export * from './lib/interfaces/announcement.interface';
|
|
43
|
+
export * from './lib/components/announcement-modal/announcement-modal.component';
|