@juice-js/notifications 0.0.0-stage → 2.1.0-alpha.1

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.
@@ -0,0 +1,566 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { InjectionToken, EnvironmentProviders, OnDestroy, OnInit, ModuleWithProviders } from '@angular/core';
3
+ import { Observable } from 'rxjs';
4
+ import * as i1 from '@angular/router';
5
+
6
+ /**
7
+ * The shapes of the Juice.Notifications person's API (`/api/v1/tenants/{tenantId}/me/…`), as it sends them: camelCase, enums as strings,
8
+ * times as ISO 8601 text.
9
+ */
10
+ type NotificationPriority = 'low' | 'normal' | 'high' | 'critical';
11
+ /** An action a type declares (`{ id, label }`): listed on its items, acted on from phase 3. */
12
+ interface InboxAction {
13
+ id: string;
14
+ label: string;
15
+ }
16
+ /** A correlation's state, as the API writes it (camelCase). */
17
+ type CorrelationState = 'open' | 'acknowledged' | 'resolved' | 'cancelled';
18
+ /** The item's correlation: open ones wait for someone; a resolved one shows its outcome (Juice.Notifications phase 3). */
19
+ interface InboxCorrelation {
20
+ state: CorrelationState;
21
+ outcome: string | null;
22
+ acknowledgedBy: string | null;
23
+ resolvedAt: string | null;
24
+ }
25
+ /** What the person did with the item: `read`, `acknowledged`, or `action` with its id. */
26
+ interface InboxInteraction {
27
+ kind: 'read' | 'acknowledged' | 'action';
28
+ actionId: string | null;
29
+ at: string;
30
+ }
31
+ /** An item in the person's inbox. */
32
+ interface InboxItem {
33
+ id: string;
34
+ type: string;
35
+ group: string;
36
+ title: string;
37
+ body: string;
38
+ url: string | null;
39
+ actions: InboxAction[] | null;
40
+ actionable: boolean;
41
+ priority: NotificationPriority;
42
+ createdAt: string;
43
+ readAt: string | null;
44
+ archivedAt: string | null;
45
+ /** Null when the notification has no correlation key. */
46
+ correlation?: InboxCorrelation | null;
47
+ interactions?: InboxInteraction[];
48
+ }
49
+ /** Whether the item's actions can still be chosen: it has some, and its correlation (if any) is open or acknowledged. */
50
+ declare function canAct(item: InboxItem): boolean;
51
+ /** The action the person chose on the item, if any. */
52
+ declare function chosenAction(item: InboxItem): string | null;
53
+ /** A display group of the tenant, in order, with the person's open and unread counts in it. */
54
+ interface InboxGroupCount {
55
+ key: string;
56
+ name: string;
57
+ position: number;
58
+ open: number;
59
+ unread: number;
60
+ }
61
+ interface InboxCounts {
62
+ groups: InboxGroupCount[];
63
+ unread: number;
64
+ actionableOpen: number;
65
+ }
66
+ /** What a listing asks for; everything is optional. */
67
+ interface InboxQuery {
68
+ /** A display group's key; left out: every group. */
69
+ group?: string;
70
+ unread?: boolean;
71
+ /** Actionable and open (not archived). */
72
+ actionable?: boolean;
73
+ /** Archived items instead of open ones. */
74
+ archived?: boolean;
75
+ /** The id of the last item already shown: the page after it. */
76
+ before?: string;
77
+ /** At most 100; the API's default is 50. */
78
+ limit?: number;
79
+ }
80
+ /** What the inbox hub says: `added` or `changed` with the items, or `reset` (reload everything). */
81
+ interface InboxChange {
82
+ kind: 'added' | 'changed' | 'reset';
83
+ items: string[];
84
+ }
85
+ type PreferenceMode = 'on' | 'off' | 'digest';
86
+ /** How the person hears about a category (or `*`) on a channel (or `*`); the most specific choice wins. */
87
+ interface Preference {
88
+ category: string;
89
+ channel: string;
90
+ mode: PreferenceMode;
91
+ updatedAt?: string;
92
+ }
93
+ /** A quiet period: on `days` (`mon` … `sun`; null: every day) from `start` to `end` (`HH:mm`), in `timeZone` (IANA). */
94
+ interface QuietHours {
95
+ days: string[] | null;
96
+ start: string;
97
+ end: string;
98
+ timeZone: string | null;
99
+ }
100
+ /** The signed-in person as the service knows them. */
101
+ interface Me {
102
+ id: string;
103
+ source: string;
104
+ externalId: string;
105
+ name: string | null;
106
+ locale: string | null;
107
+ timeZone: string | null;
108
+ quietHours: QuietHours | null;
109
+ }
110
+ /** As the API writes it (camelCase: `ok`, `bouncing`, `failed`). A failed address isn't used until verified again. */
111
+ type ContactHealth = 'ok' | 'bouncing' | 'failed';
112
+ /** One of the person's addresses; only a verified one that hasn't failed is used. */
113
+ interface ContactPoint {
114
+ id: string;
115
+ channel: string;
116
+ address: string;
117
+ verified: boolean;
118
+ verifiedAt: string | null;
119
+ verifiedBy: string | null;
120
+ health: ContactHealth;
121
+ healthReason: string | null;
122
+ createdAt: string;
123
+ }
124
+ /** A code to send the tenant's bot from the chat account to link (`ABCD-EFGH`), valid until `expiresAt` and once. */
125
+ interface LinkCode {
126
+ channel: string;
127
+ code: string;
128
+ expiresAt: string;
129
+ }
130
+ /** A type the tenant receives, at its latest version, with each channel's templates (the application's, the tenant's own). */
131
+ interface TenantType {
132
+ key: string;
133
+ name: string;
134
+ version: number;
135
+ application: string;
136
+ channels: {
137
+ channel: string;
138
+ declared: boolean;
139
+ overridden: boolean;
140
+ }[];
141
+ }
142
+ /** A channel's templates for a type: the application's, and the tenant's own (null without one). */
143
+ interface TenantTemplate {
144
+ type: string;
145
+ typeVersion: number;
146
+ channel: string;
147
+ locale: string;
148
+ application: string | null;
149
+ tenant: string | null;
150
+ tenantVersion: number | null;
151
+ updatedAt: string | null;
152
+ }
153
+ /** A template rendered: the channel's content (email: subject, text, html), or why it failed; and the data it used. */
154
+ interface TemplatePreview {
155
+ channel: string;
156
+ content: Record<string, unknown> | null;
157
+ error: string | null;
158
+ data: Record<string, unknown>;
159
+ }
160
+ /** A device registered for push; its token is never returned. */
161
+ interface Device {
162
+ id: string;
163
+ platform: 'fcm' | 'apns' | 'webpush';
164
+ appId: string;
165
+ locale: string | null;
166
+ createdAt: string;
167
+ lastSeenAt: string;
168
+ }
169
+ /** A registration: a token (FCM, APNs) or a Web Push subscription. Registering again refreshes it. */
170
+ interface RegisterDevice {
171
+ platform: 'fcm' | 'apns' | 'webpush';
172
+ appId: string;
173
+ token?: string;
174
+ subscription?: {
175
+ endpoint: string;
176
+ p256dh: string;
177
+ auth: string;
178
+ };
179
+ locale?: string | null;
180
+ }
181
+ /** A verification code is on its way, valid until `expiresAt`. */
182
+ interface VerificationSent {
183
+ expiresAt: string;
184
+ }
185
+ /** The API's error body (RFC 9457 problem details with a `code`, and field errors by JSON pointer). */
186
+ interface NotificationsProblem {
187
+ status: number;
188
+ code: string;
189
+ detail?: string;
190
+ errors?: {
191
+ pointer: string;
192
+ message: string;
193
+ }[];
194
+ }
195
+
196
+ /**
197
+ * Where the Juice.Notifications API is, and how to find the person's tenant and token. Only `apiUrl` is required: the tenant comes from the
198
+ * access token's `platform_tenant` claim and the token from `angular-oauth2-oidc`'s `OAuthService`, as `@juice-js/auth` signs people in.
199
+ */
200
+ interface NotificationsConfig {
201
+ /** The API's base URL, without a trailing slash: `https://notifications.example.com`. */
202
+ apiUrl: string;
203
+ /** The inbox hub; left out: `${apiUrl}/hubs/inbox`. */
204
+ hubUrl?: string;
205
+ /**
206
+ * The tenant's id (a GUID, which the API routes by; not the app's tenant identifier in its URL). A string, or a function read on each call;
207
+ * left out: the access token's `platform_tenant` claim.
208
+ */
209
+ tenantId?: string | (() => string | null | undefined);
210
+ /** The access token; left out: `OAuthService.getAccessToken()`. The REST calls get theirs from `@juice-js/auth`'s interceptor. */
211
+ accessToken?: () => string | null | undefined;
212
+ /** Items per page in the panel (at most 100). */
213
+ pageSize?: number;
214
+ /**
215
+ * The chat accounts people may link on the contact points page, as the tenant's integrations offer them: `['slack', 'telegram']`. Left out:
216
+ * none (email only).
217
+ */
218
+ linkChannels?: string[];
219
+ /** Whether people may add phone numbers for SMS (the tenant sends SMS). Left out: email only. */
220
+ phoneNumbers?: boolean;
221
+ /** The Telegram bot's username, without `@`: the link code then opens the bot with it (`https://t.me/{bot}?start={code}`). */
222
+ telegramBot?: string;
223
+ }
224
+ declare const NOTIFICATIONS_CONFIG: InjectionToken<NotificationsConfig>;
225
+ /** Registers the configuration: `providers: [provideNotifications({ apiUrl: environment.notificationsApi })]`. */
226
+ declare function provideNotifications(config: NotificationsConfig): EnvironmentProviders;
227
+ /** A JWT's payload claim, or null when the token isn't a JWT or hasn't it. Reads; never verifies (the API does). */
228
+ declare function tokenClaim(token: string | null | undefined, claim: string): string | null;
229
+
230
+ /** Thrown (as an observable error) when no tenant id can be found: the configuration has none and the token no `platform_tenant` claim. */
231
+ declare class NoTenantError extends Error {
232
+ constructor();
233
+ }
234
+ /**
235
+ * The person's API of Juice.Notifications, one method per call. The bearer token comes from `@juice-js/auth`'s interceptor (list the API in
236
+ * `AuthModuleConfig.allowedUrls`); errors are the API's problem details ({@link NotificationsProblem}) in an `HttpErrorResponse`.
237
+ */
238
+ declare class NotificationsApi {
239
+ private readonly http;
240
+ private readonly config;
241
+ private readonly oauth;
242
+ /** The access token for the hub (REST calls get theirs from the interceptor). */
243
+ accessToken(): string | null;
244
+ /** The tenant's id: configured, or the token's `platform_tenant` claim. */
245
+ tenantId(): string | null;
246
+ get hubUrl(): string;
247
+ inbox(query?: InboxQuery): Observable<InboxItem[]>;
248
+ counts(): Observable<InboxCounts>;
249
+ item(id: string): Observable<InboxItem>;
250
+ /** Marks an item read (`true`) or unread. */
251
+ read(id: string, read?: boolean): Observable<InboxItem>;
252
+ /** Archives an item (`true`, which also reads it) or puts it back. */
253
+ archive(id: string, archive?: boolean): Observable<InboxItem>;
254
+ /**
255
+ * Chooses one of the item's actions: the producer hears it and decides (the inbox decides nothing). Once per action; refused (409
256
+ * `correlation_closed`) once it has been decided.
257
+ */
258
+ act(id: string, actionId: string): Observable<InboxItem>;
259
+ /** Acknowledges the item: the producer hears it. */
260
+ acknowledge(id: string): Observable<InboxItem>;
261
+ /** Marks every open item read, in one group or all; answers how many were. */
262
+ readAll(group?: string): Observable<number>;
263
+ profile(): Observable<Me>;
264
+ preferences(): Observable<Preference[]>;
265
+ /** Replaces all of the person's preferences (an empty list: everything on). */
266
+ savePreferences(preferences: Preference[]): Observable<Preference[]>;
267
+ saveQuietHours(quiet: QuietHours): Observable<QuietHours>;
268
+ clearQuietHours(): Observable<void>;
269
+ contactPoints(): Observable<ContactPoint[]>;
270
+ addContactPoint(channel: string, address: string): Observable<ContactPoint>;
271
+ removeContactPoint(id: string): Observable<void>;
272
+ /** Sends a verification code to the address. */
273
+ sendCode(id: string): Observable<VerificationSent>;
274
+ verify(id: string, code: string): Observable<ContactPoint>;
275
+ /** A code to link a chat account (`slack`, `telegram`): the person sends it to the tenant's bot from that account. */
276
+ linkCode(channel: string): Observable<LinkCode>;
277
+ devices(): Observable<Device[]>;
278
+ /** Registers this device for push (or refreshes its registration); see `enableWebPush` for browsers. */
279
+ registerDevice(device: RegisterDevice): Observable<Device>;
280
+ removeDevice(id: string): Observable<void>;
281
+ /** The types the tenant receives (tenant admins), for the template editor. */
282
+ tenantTypes(): Observable<TenantType[]>;
283
+ template(type: string, channel: string): Observable<TenantTemplate>;
284
+ /** Saves the tenant's own template for a type and channel, over the application's. */
285
+ saveTemplate(type: string, channel: string, body: string): Observable<TenantTemplate>;
286
+ /** Removes the tenant's template: the application's is used again. */
287
+ removeTemplate(type: string, channel: string): Observable<void>;
288
+ /** Renders a template (the one in effect, without `body`) with `data` (a sample from the type's schema, without it). Nothing is stored. */
289
+ previewTemplate(type: string, channel: string, body: string | null, data: unknown | null): Observable<TemplatePreview>;
290
+ /** A call under `…/tenants/{tenantId}` (the tenant's admins), or {@link NoTenantError} when there's no tenant. */
291
+ private tenant;
292
+ /** A call under `…/tenants/{tenantId}/me`, or {@link NoTenantError} when there's no tenant. */
293
+ private me;
294
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NotificationsApi, never>;
295
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<NotificationsApi>;
296
+ }
297
+
298
+ /** What the inbox needs from its live connection. */
299
+ interface InboxHubHandlers {
300
+ /** The hub's one event, `inboxChanged`. */
301
+ changed(change: InboxChange): void;
302
+ /** Connected again after a drop: anything may have changed meanwhile, so reload. */
303
+ reconnected(): void;
304
+ }
305
+ /** A live connection; `stop()` ends it. */
306
+ interface InboxHubHandle {
307
+ stop(): Promise<void>;
308
+ }
309
+ /**
310
+ * Opens the inbox hub (`/hubs/inbox?tenant=…`, the token as `access_token` in the query, as WebSockets need). It reconnects on its own, and
311
+ * after the server closes a session whose token expired it starts again with a fresh token. Replace it in tests.
312
+ */
313
+ declare class InboxHubConnector {
314
+ connect(url: string, tenantId: string, accessToken: () => string | null, handlers: InboxHubHandlers): InboxHubHandle;
315
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<InboxHubConnector, never>;
316
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<InboxHubConnector>;
317
+ }
318
+
319
+ /**
320
+ * The person's inbox as signals, kept current by the hub: the counts (the bell's badge, the panel's tabs), and the items of the group and filter
321
+ * shown. Call {@link start} once signed in (the bell does); {@link stop} on sign-out.
322
+ */
323
+ declare class InboxService implements OnDestroy {
324
+ private readonly api;
325
+ private readonly hub;
326
+ private readonly pageSize;
327
+ private readonly _counts;
328
+ private readonly _items;
329
+ private readonly _group;
330
+ private readonly _actionable;
331
+ private readonly _loading;
332
+ private readonly _more;
333
+ private readonly _error;
334
+ readonly counts: _angular_core.Signal<InboxCounts | null>;
335
+ /** Unread in every group: the bell's badge. */
336
+ readonly unread: _angular_core.Signal<number>;
337
+ readonly actionableOpen: _angular_core.Signal<number>;
338
+ readonly items: _angular_core.Signal<InboxItem[]>;
339
+ /** The group shown (a key), or null for every group. */
340
+ readonly group: _angular_core.Signal<string | null>;
341
+ /** Only actionable and open items. */
342
+ readonly actionableOnly: _angular_core.Signal<boolean>;
343
+ readonly loading: _angular_core.Signal<boolean>;
344
+ /** Whether there may be more items past the last one shown. */
345
+ readonly hasMore: _angular_core.Signal<boolean>;
346
+ /** The last load's error, until the next one succeeds. */
347
+ readonly error: _angular_core.Signal<unknown>;
348
+ private connection;
349
+ private listing;
350
+ private started;
351
+ /** Loads the counts and the first page, and opens the hub. Again after {@link stop}; once otherwise. */
352
+ start(): void;
353
+ stop(): void;
354
+ ngOnDestroy(): void;
355
+ /** Shows one group (a key) or every group (null). */
356
+ showGroup(group: string | null): void;
357
+ showActionableOnly(only: boolean): void;
358
+ /** The page after the last item shown. */
359
+ loadMore(): void;
360
+ /** Counts and the first page again. */
361
+ reload(): void;
362
+ /** Marks an item read (or unread), here at once and then as the API answers. */
363
+ markRead(item: InboxItem, read?: boolean): Promise<void>;
364
+ /** Archives an item (or restores one): it leaves (or joins) the open items. */
365
+ archive(item: InboxItem, archive?: boolean): Promise<void>;
366
+ /** Chooses one of the item's actions; the item comes back with the choice recorded (and the correlation as it stands). */
367
+ act(item: InboxItem, actionId: string): Promise<void>;
368
+ /** Marks every open item read, in the group shown or all. */
369
+ readAll(): Promise<void>;
370
+ private apply;
371
+ /** An item as it now is: replaced where shown, or dropped if it no longer belongs to the listing. */
372
+ private replace;
373
+ private onChange;
374
+ private loadCounts;
375
+ private loadItems;
376
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<InboxService, never>;
377
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<InboxService>;
378
+ }
379
+
380
+ /** How the app turns on Web Push for the signed-in person. */
381
+ interface WebPushOptions {
382
+ /** The tenant's VAPID public key (its `webpush` integration's `settings.publicKey`), base64url. */
383
+ vapidPublicKey: string;
384
+ /** The service worker to register: the library's `juice-push-sw.js`, copied to the app's root (see the README). */
385
+ serviceWorkerUrl?: string;
386
+ /** What the registration is called on the service: this web app. Left out: `web`. */
387
+ appId?: string;
388
+ /** The person's locale for this device. */
389
+ locale?: string;
390
+ }
391
+ /** Web Push isn't available here: no service workers, no Push API, or the person said no. */
392
+ declare class WebPushUnavailableError extends Error {
393
+ }
394
+ /** Whether this browser can take Web Push at all. */
395
+ declare function webPushSupported(): boolean;
396
+ /**
397
+ * Subscribes this browser to push (asking the person, when they haven't answered yet) and registers the subscription with the service, so
398
+ * notifications of types with a `push` template reach it. Call it again on each start: registering an existing subscription only refreshes it.
399
+ */
400
+ declare function enableWebPush(api: NotificationsApi, options: WebPushOptions): Promise<Device>;
401
+ /** On sign-out: removes the registration from the service and unsubscribes this browser. */
402
+ declare function disableWebPush(api: NotificationsApi, deviceId: string, serviceWorkerUrl?: string): Promise<void>;
403
+
404
+ /**
405
+ * The bell for a toolbar: the person's unread count as its badge, and the inbox panel when clicked. It starts the inbox once the person is
406
+ * signed in (and again after a new sign-in), and stops it on sign-out.
407
+ */
408
+ declare class NotificationBellComponent implements OnInit {
409
+ readonly inbox: InboxService;
410
+ private readonly oauth;
411
+ private readonly destroyRef;
412
+ /** Whether opening an item follows its link. */
413
+ readonly followLinks: _angular_core.InputSignal<boolean>;
414
+ badge(): string;
415
+ ngOnInit(): void;
416
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NotificationBellComponent, never>;
417
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NotificationBellComponent, "juice-notification-bell", never, { "followLinks": { "alias": "followLinks"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
418
+ }
419
+
420
+ /**
421
+ * The person's inbox: a tab per display group with its unread count, an "actionable and open" filter, the items newest first (unread ones
422
+ * marked), and per item read and archive. Opening an item reads it and follows its link (`links.self`) unless {@link opened} is handled
423
+ * (`followLinks` false).
424
+ */
425
+ declare class InboxPanelComponent {
426
+ readonly inbox: InboxService;
427
+ /** Whether opening an item follows its link; when false, handle {@link opened}. */
428
+ readonly followLinks: _angular_core.InputSignal<boolean>;
429
+ /** An item was opened (after it was marked read). */
430
+ readonly opened: _angular_core.OutputEmitterRef<InboxItem>;
431
+ open(item: InboxItem): void;
432
+ toggleRead(item: InboxItem, event: Event): void;
433
+ archive(item: InboxItem, event: Event): void;
434
+ act(item: InboxItem, actionId: string, event: Event): void;
435
+ readonly canAct: typeof canAct;
436
+ readonly chosen: typeof chosenAction;
437
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<InboxPanelComponent, never>;
438
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<InboxPanelComponent, "juice-inbox-panel", never, { "followLinks": { "alias": "followLinks"; "required": false; "isSignal": true; }; }, { "opened": "opened"; }, never, never, true, never>;
439
+ }
440
+
441
+ /** Days as the API names them, Monday first. */
442
+ declare const WEEK_DAYS: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
443
+ /**
444
+ * The person's notification preferences (a mode per category and channel; `*` for every one; the most specific wins) and quiet hours, when
445
+ * personal channels wait and the inbox doesn't. A mandatory type reaches the person anyway, in the inbox at least.
446
+ */
447
+ declare class PreferencesComponent implements OnInit {
448
+ private readonly api;
449
+ readonly channels: string[];
450
+ readonly modes: PreferenceMode[];
451
+ readonly days: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
452
+ readonly rows: _angular_core.WritableSignal<Preference[]>;
453
+ readonly quiet: _angular_core.WritableSignal<QuietHours | null>;
454
+ readonly quietOn: _angular_core.WritableSignal<boolean>;
455
+ readonly busy: _angular_core.WritableSignal<boolean>;
456
+ readonly message: _angular_core.WritableSignal<string | null>;
457
+ readonly error: _angular_core.WritableSignal<string | null>;
458
+ ngOnInit(): Promise<void>;
459
+ add(): void;
460
+ remove(index: number): void;
461
+ update(index: number, change: Partial<Preference>): void;
462
+ savePreferences(): Promise<void>;
463
+ quietDay(day: string): boolean;
464
+ setQuiet(change: Partial<QuietHours>): void;
465
+ toggleDay(day: string, on: boolean): void;
466
+ saveQuietHours(): Promise<void>;
467
+ private run;
468
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PreferencesComponent, never>;
469
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<PreferencesComponent, "juice-notification-preferences", never, {}, {}, never, never, true, never>;
470
+ }
471
+
472
+ /**
473
+ * The person's email addresses: add one, have a code sent to it and enter the code, or remove one. Only a verified address that hasn't failed
474
+ * is ever used; one your organization's directory vouches for arrives verified. And their chat accounts (`linkChannels`): a chat account is
475
+ * never typed in; the person asks for a code and sends it to the tenant's bot from that account, which links it.
476
+ */
477
+ declare class ContactPointsComponent implements OnInit {
478
+ private readonly api;
479
+ private readonly config;
480
+ readonly points: _angular_core.WritableSignal<ContactPoint[]>;
481
+ readonly emails: _angular_core.Signal<ContactPoint[]>;
482
+ readonly accounts: _angular_core.Signal<ContactPoint[]>;
483
+ readonly phoneNumbers: boolean;
484
+ readonly phone: _angular_core.WritableSignal<string>;
485
+ readonly linkChannels: string[];
486
+ /** The code being shown, for the channel it links. */
487
+ readonly link: _angular_core.WritableSignal<LinkCode | null>;
488
+ readonly address: _angular_core.WritableSignal<string>;
489
+ /** Codes being typed, by contact point. */
490
+ readonly codes: _angular_core.WritableSignal<Record<string, string>>;
491
+ /** Contact points a code was sent to, with when it expires. */
492
+ readonly sent: _angular_core.WritableSignal<Record<string, string>>;
493
+ readonly busy: _angular_core.WritableSignal<boolean>;
494
+ readonly error: _angular_core.WritableSignal<string | null>;
495
+ ngOnInit(): Promise<void>;
496
+ add(channel?: 'email' | 'sms'): Promise<void>;
497
+ sendCode(point: ContactPoint, alone?: boolean): Promise<void>;
498
+ setCode(id: string, code: string): void;
499
+ verify(point: ContactPoint): Promise<void>;
500
+ linkAccount(channel: string): Promise<void>;
501
+ /** Telegram's deep link, which opens the bot with the code (`/start`), when the bot's name is configured. */
502
+ telegramLink(code: LinkCode): string | null;
503
+ /** After sending the code: the linked account shows up in the list. */
504
+ linked(): Promise<void>;
505
+ remove(point: ContactPoint): Promise<void>;
506
+ private load;
507
+ private run;
508
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ContactPointsComponent, never>;
509
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ContactPointsComponent, "juice-contact-points", never, {}, {}, never, never, true, never>;
510
+ }
511
+
512
+ /**
513
+ * The tenant's own templates (Juice.Notifications D22): pick a type and a channel, edit the text (Scriban), preview it with the type's sample
514
+ * data or your own, save it over the application's template, or remove it to use the application's again. For the tenant's admins.
515
+ */
516
+ declare class TemplatesComponent implements OnInit {
517
+ private readonly api;
518
+ readonly types: _angular_core.WritableSignal<TenantType[]>;
519
+ readonly type: _angular_core.WritableSignal<string | null>;
520
+ readonly channel: _angular_core.WritableSignal<string | null>;
521
+ readonly template: _angular_core.WritableSignal<TenantTemplate | null>;
522
+ readonly body: _angular_core.WritableSignal<string>;
523
+ readonly data: _angular_core.WritableSignal<string>;
524
+ readonly preview: _angular_core.WritableSignal<TemplatePreview | null>;
525
+ readonly busy: _angular_core.WritableSignal<boolean>;
526
+ readonly error: _angular_core.WritableSignal<string | null>;
527
+ readonly saved: _angular_core.WritableSignal<boolean>;
528
+ /** The chosen type's channels with a template (the application's or the tenant's). */
529
+ readonly channels: _angular_core.Signal<{
530
+ channel: string;
531
+ declared: boolean;
532
+ overridden: boolean;
533
+ }[]>;
534
+ ngOnInit(): Promise<void>;
535
+ pickType(key: string): Promise<void>;
536
+ pickChannel(channel: string | null): Promise<void>;
537
+ previewNow(): Promise<void>;
538
+ /** Saves the text as the tenant's template (refused with the reason when it doesn't parse, as a producer's would be). */
539
+ save(): Promise<void>;
540
+ /** Removes the tenant's template: the application's is used again. */
541
+ remove(): Promise<void>;
542
+ private render;
543
+ private run;
544
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TemplatesComponent, never>;
545
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TemplatesComponent, "juice-notification-templates", never, {}, {}, never, never, true, never>;
546
+ }
547
+
548
+ /**
549
+ * For NgModule apps: `NotificationsModule.forRoot({ apiUrl })` once, then `<juice-notification-bell>` in the toolbar. Standalone apps use
550
+ * `provideNotifications` and import the components directly.
551
+ */
552
+ declare class NotificationsModule {
553
+ static forRoot(config: NotificationsConfig): ModuleWithProviders<NotificationsModule>;
554
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NotificationsModule, never>;
555
+ static ɵmod: _angular_core.ɵɵNgModuleDeclaration<NotificationsModule, never, [typeof NotificationBellComponent, typeof InboxPanelComponent], [typeof NotificationBellComponent, typeof InboxPanelComponent]>;
556
+ static ɵinj: _angular_core.ɵɵInjectorDeclaration<NotificationsModule>;
557
+ }
558
+
559
+ declare class NotificationsRoutingModule {
560
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NotificationsRoutingModule, never>;
561
+ static ɵmod: _angular_core.ɵɵNgModuleDeclaration<NotificationsRoutingModule, never, [typeof i1.RouterModule], [typeof i1.RouterModule]>;
562
+ static ɵinj: _angular_core.ɵɵInjectorDeclaration<NotificationsRoutingModule>;
563
+ }
564
+
565
+ export { ContactPointsComponent, InboxHubConnector, InboxPanelComponent, InboxService, NOTIFICATIONS_CONFIG, NoTenantError, NotificationBellComponent, NotificationsApi, NotificationsModule, NotificationsRoutingModule, PreferencesComponent, TemplatesComponent, WEEK_DAYS, WebPushUnavailableError, canAct, chosenAction, disableWebPush, enableWebPush, provideNotifications, tokenClaim, webPushSupported };
566
+ export type { ContactHealth, ContactPoint, CorrelationState, Device, InboxAction, InboxChange, InboxCorrelation, InboxCounts, InboxGroupCount, InboxHubHandle, InboxHubHandlers, InboxInteraction, InboxItem, InboxQuery, LinkCode, Me, NotificationPriority, NotificationsConfig, NotificationsProblem, Preference, PreferenceMode, QuietHours, RegisterDevice, TemplatePreview, TenantTemplate, TenantType, VerificationSent, WebPushOptions };