@codingfactory/notify-kit-client 0.1.0 → 0.2.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/README.md +500 -0
- package/dist/index.d.ts +167 -198
- package/dist/index.js +1126 -184
- package/dist/index.js.map +1 -1
- package/dist/nuxt/index.d.ts +1 -1
- package/dist/{useNotifyKitModals-BZ_NiTKw.d.ts → useNotifyKitModals-CUfVmBsN.d.ts} +205 -59
- package/package.json +1 -6
|
@@ -3,28 +3,6 @@ import { InjectionKey, ComputedRef, Ref } from 'vue';
|
|
|
3
3
|
/**
|
|
4
4
|
* Modal-related type definitions for critical notification modals.
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* Escape key behavior modes for modals.
|
|
8
|
-
*/
|
|
9
|
-
type EscapeKeyBehavior = 'close' | 'snooze' | 'disabled';
|
|
10
|
-
/**
|
|
11
|
-
* Accessibility settings for modal notifications.
|
|
12
|
-
* Ensures WCAG 2.1 AA compliance.
|
|
13
|
-
*/
|
|
14
|
-
interface NotifyKitModalAccessibility {
|
|
15
|
-
/** Escape key behavior: close, snooze, or disabled */
|
|
16
|
-
readonly escape_key_behavior: EscapeKeyBehavior;
|
|
17
|
-
/** Whether focus is trapped inside the modal */
|
|
18
|
-
readonly focus_trap: boolean;
|
|
19
|
-
/** Whether to auto-focus the first action button */
|
|
20
|
-
readonly auto_focus_first_action: boolean;
|
|
21
|
-
/** ARIA role for the modal element */
|
|
22
|
-
readonly aria_role: string;
|
|
23
|
-
/** ID of the element that labels the modal (aria-labelledby) */
|
|
24
|
-
readonly aria_labelled_by: string | null;
|
|
25
|
-
/** ID of the element that describes the modal (aria-describedby) */
|
|
26
|
-
readonly aria_described_by: string | null;
|
|
27
|
-
}
|
|
28
6
|
/**
|
|
29
7
|
* Modal specification included in notifications that require modal display.
|
|
30
8
|
*/
|
|
@@ -35,8 +13,6 @@ interface NotifyKitModalSpec {
|
|
|
35
13
|
readonly requires_ack: boolean;
|
|
36
14
|
/** Available snooze duration options in minutes */
|
|
37
15
|
readonly snooze_options_minutes: readonly number[];
|
|
38
|
-
/** Accessibility settings for the modal */
|
|
39
|
-
readonly accessibility: NotifyKitModalAccessibility;
|
|
40
16
|
}
|
|
41
17
|
/**
|
|
42
18
|
* Modal state tracking for a notification.
|
|
@@ -125,39 +101,58 @@ declare function isNotifyKitNotification(value: unknown): value is NotifyKitNoti
|
|
|
125
101
|
declare function isModalEnabled(notification: NotifyKitNotification): boolean;
|
|
126
102
|
|
|
127
103
|
/**
|
|
128
|
-
* User notification
|
|
104
|
+
* User notification preference settings type definitions.
|
|
129
105
|
*/
|
|
130
106
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
readonly database: boolean;
|
|
137
|
-
/** Whether to broadcast in real-time */
|
|
138
|
-
readonly broadcast: boolean;
|
|
139
|
-
/** Whether to send via email */
|
|
140
|
-
readonly mail: boolean;
|
|
107
|
+
type NotifyKitPreferenceBooleanMap = Readonly<Record<string, boolean>>;
|
|
108
|
+
type NotifyKitPreferenceModeMap = Readonly<Record<string, string>>;
|
|
109
|
+
interface NotifyKitQuietHours {
|
|
110
|
+
readonly start: string;
|
|
111
|
+
readonly end: string;
|
|
141
112
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
readonly
|
|
113
|
+
interface NotifyKitDigestPreferences {
|
|
114
|
+
readonly enabled: boolean;
|
|
115
|
+
readonly frequency: 'daily' | 'weekly';
|
|
116
|
+
readonly categories: readonly NotificationCategory[] | null;
|
|
117
|
+
readonly workspace_id: string | null;
|
|
118
|
+
readonly timezone: string | null;
|
|
119
|
+
readonly hour: number;
|
|
120
|
+
readonly quiet_hours: NotifyKitQuietHours | null;
|
|
148
121
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
readonly
|
|
122
|
+
interface NotifyKitPreferenceSettings {
|
|
123
|
+
readonly channels: NotifyKitPreferenceBooleanMap;
|
|
124
|
+
readonly channel_modes: NotifyKitPreferenceModeMap;
|
|
125
|
+
readonly topics: NotifyKitPreferenceBooleanMap;
|
|
126
|
+
readonly email_preferences: NotifyKitPreferenceBooleanMap;
|
|
127
|
+
readonly keyword_rules: readonly string[];
|
|
128
|
+
readonly digest: NotifyKitDigestPreferences;
|
|
129
|
+
readonly available_channels: readonly string[];
|
|
130
|
+
readonly available_topics: readonly string[];
|
|
131
|
+
readonly available_email_preferences: readonly string[];
|
|
156
132
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
133
|
+
interface NotifyKitPreferenceSettingsQuery {
|
|
134
|
+
readonly workspace_id?: string | null;
|
|
135
|
+
}
|
|
136
|
+
interface NotifyKitPreferenceSettingsUpdate {
|
|
137
|
+
readonly workspace_id?: string | null;
|
|
138
|
+
readonly channels?: Record<string, boolean>;
|
|
139
|
+
readonly channel_modes?: Record<string, string>;
|
|
140
|
+
readonly topics?: Record<string, boolean>;
|
|
141
|
+
readonly email_preferences?: Record<string, boolean>;
|
|
142
|
+
readonly keyword_rules?: readonly string[];
|
|
143
|
+
readonly digest?: {
|
|
144
|
+
readonly enabled?: boolean;
|
|
145
|
+
readonly frequency?: 'daily' | 'weekly';
|
|
146
|
+
readonly categories?: readonly NotificationCategory[] | null;
|
|
147
|
+
readonly timezone?: string | null;
|
|
148
|
+
readonly hour?: number;
|
|
149
|
+
readonly quiet_hours?: NotifyKitQuietHours | null;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
type NotifyKitPreferences = NotifyKitPreferenceSettings;
|
|
153
|
+
type NotifyKitPreferencesUpdate = NotifyKitPreferenceSettingsUpdate;
|
|
154
|
+
declare function isNotifyKitQuietHours(value: unknown): value is NotifyKitQuietHours;
|
|
155
|
+
declare function isNotifyKitPreferenceSettings(value: unknown): value is NotifyKitPreferenceSettings;
|
|
161
156
|
|
|
162
157
|
/**
|
|
163
158
|
* API response type definitions for Notify Kit endpoints.
|
|
@@ -230,6 +225,27 @@ interface NotifyKitModalsResponse {
|
|
|
230
225
|
/** Array of outstanding modal notifications */
|
|
231
226
|
readonly data: readonly NotifyKitNotification[];
|
|
232
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Response from GET /notifications/:id endpoint.
|
|
230
|
+
*/
|
|
231
|
+
interface NotifyKitSingleNotificationResponse {
|
|
232
|
+
/** The requested notification */
|
|
233
|
+
readonly data: NotifyKitNotification;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Generic message response from mutation endpoints.
|
|
237
|
+
*/
|
|
238
|
+
interface NotifyKitMutationResponse {
|
|
239
|
+
/** Human-readable result message */
|
|
240
|
+
readonly message: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Response from read actions that also return the updated unread count.
|
|
244
|
+
*/
|
|
245
|
+
interface NotifyKitReadMutationResponse extends NotifyKitMutationResponse {
|
|
246
|
+
/** Updated unread count when supplied by the backend */
|
|
247
|
+
readonly unread_count?: number;
|
|
248
|
+
}
|
|
233
249
|
/**
|
|
234
250
|
* Parameters for listing notifications.
|
|
235
251
|
*/
|
|
@@ -277,6 +293,75 @@ declare function isMeResponse(value: unknown): value is NotifyKitMeResponse;
|
|
|
277
293
|
* Type guard to validate NotifyKitUnreadCountResponse.
|
|
278
294
|
*/
|
|
279
295
|
declare function isUnreadCountResponse(value: unknown): value is NotifyKitUnreadCountResponse;
|
|
296
|
+
/**
|
|
297
|
+
* Filters for bulk operations.
|
|
298
|
+
*/
|
|
299
|
+
interface BulkFilters {
|
|
300
|
+
/** Filter by category */
|
|
301
|
+
readonly category?: NotificationCategory;
|
|
302
|
+
/** Filter to unread only */
|
|
303
|
+
readonly unread_only?: boolean;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Request body for bulk actions.
|
|
307
|
+
*/
|
|
308
|
+
interface BulkActionRequest {
|
|
309
|
+
/** Specific notification IDs to act on */
|
|
310
|
+
readonly notification_ids?: readonly string[];
|
|
311
|
+
/** Act on all matching notifications */
|
|
312
|
+
readonly all?: boolean;
|
|
313
|
+
/** Filters to apply when all=true */
|
|
314
|
+
readonly filters?: BulkFilters;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Response from bulk action endpoints.
|
|
318
|
+
*/
|
|
319
|
+
interface BulkActionResult {
|
|
320
|
+
/** Number of notifications affected */
|
|
321
|
+
readonly affected: number;
|
|
322
|
+
/** Number of failures */
|
|
323
|
+
readonly failed: number;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Search filters for notification search.
|
|
327
|
+
*/
|
|
328
|
+
interface SearchFilters {
|
|
329
|
+
/** Filter by category */
|
|
330
|
+
readonly category?: NotificationCategory;
|
|
331
|
+
/** Filter to unread only */
|
|
332
|
+
readonly unread?: boolean;
|
|
333
|
+
/** Filter by level */
|
|
334
|
+
readonly level?: string;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Response from search endpoint.
|
|
338
|
+
*/
|
|
339
|
+
interface SearchResult {
|
|
340
|
+
/** Array of matching notifications */
|
|
341
|
+
readonly data: readonly NotifyKitNotification[];
|
|
342
|
+
/** Total number of matches */
|
|
343
|
+
readonly total: number;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* A saved filter preset.
|
|
347
|
+
*/
|
|
348
|
+
interface SavedFilter {
|
|
349
|
+
/** Unique filter ID */
|
|
350
|
+
readonly id: string;
|
|
351
|
+
/** Display name */
|
|
352
|
+
readonly name: string;
|
|
353
|
+
/** Filter configuration */
|
|
354
|
+
readonly filters: Readonly<Record<string, unknown>>;
|
|
355
|
+
/** Whether this is a system-provided preset */
|
|
356
|
+
readonly system: boolean;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Response from saved filters endpoint.
|
|
360
|
+
*/
|
|
361
|
+
interface SavedFiltersResponse {
|
|
362
|
+
/** Array of saved filters */
|
|
363
|
+
readonly data: readonly SavedFilter[];
|
|
364
|
+
}
|
|
280
365
|
|
|
281
366
|
/**
|
|
282
367
|
* Notify Kit HTTP Client
|
|
@@ -301,8 +386,9 @@ interface NotifyKitClientConfig {
|
|
|
301
386
|
declare class NotifyKitApiError extends Error {
|
|
302
387
|
readonly status: number;
|
|
303
388
|
readonly errors?: Readonly<Record<string, readonly string[]>> | undefined;
|
|
389
|
+
readonly headers?: Readonly<Record<string, string>> | undefined;
|
|
304
390
|
readonly name = "NotifyKitApiError";
|
|
305
|
-
constructor(message: string, status: number, errors?: Readonly<Record<string, readonly string[]>> | undefined);
|
|
391
|
+
constructor(message: string, status: number, errors?: Readonly<Record<string, readonly string[]>> | undefined, headers?: Readonly<Record<string, string>> | undefined);
|
|
306
392
|
}
|
|
307
393
|
/**
|
|
308
394
|
* HTTP Client for the Notify Kit API.
|
|
@@ -324,10 +410,14 @@ declare class NotifyKitClient {
|
|
|
324
410
|
* Get the count of unread notifications.
|
|
325
411
|
*/
|
|
326
412
|
getUnreadCount(): Promise<NotifyKitUnreadCountResponse>;
|
|
413
|
+
/**
|
|
414
|
+
* Get a single notification for the current user.
|
|
415
|
+
*/
|
|
416
|
+
getNotification(id: string): Promise<NotifyKitNotification>;
|
|
327
417
|
/**
|
|
328
418
|
* Mark a notification as read.
|
|
329
419
|
*/
|
|
330
|
-
markRead(id: string): Promise<
|
|
420
|
+
markRead(id: string): Promise<NotifyKitReadMutationResponse>;
|
|
331
421
|
/**
|
|
332
422
|
* Mark all notifications as read.
|
|
333
423
|
*/
|
|
@@ -357,13 +447,69 @@ declare class NotifyKitClient {
|
|
|
357
447
|
*/
|
|
358
448
|
snoozeModal(id: string, minutes: number): Promise<void>;
|
|
359
449
|
/**
|
|
360
|
-
* Get the current user's notification
|
|
450
|
+
* Get the current user's notification preference settings.
|
|
451
|
+
*/
|
|
452
|
+
getPreferenceSettings(query?: NotifyKitPreferenceSettingsQuery): Promise<NotifyKitPreferences>;
|
|
453
|
+
/**
|
|
454
|
+
* Alias for getPreferenceSettings.
|
|
455
|
+
*/
|
|
456
|
+
getPreferences(query?: NotifyKitPreferenceSettingsQuery): Promise<NotifyKitPreferences>;
|
|
457
|
+
/**
|
|
458
|
+
* Update the current user's notification preference settings.
|
|
459
|
+
*/
|
|
460
|
+
updatePreferenceSettings(preferences: NotifyKitPreferencesUpdate): Promise<NotifyKitPreferences>;
|
|
461
|
+
/**
|
|
462
|
+
* Alias for updatePreferenceSettings.
|
|
463
|
+
*/
|
|
464
|
+
updatePreferences(preferences: NotifyKitPreferencesUpdate): Promise<NotifyKitPreferences>;
|
|
465
|
+
/**
|
|
466
|
+
* Bulk mark notifications as read.
|
|
467
|
+
*/
|
|
468
|
+
bulkMarkRead(ids: readonly string[]): Promise<BulkActionResult>;
|
|
469
|
+
/**
|
|
470
|
+
* Bulk mark all matching notifications as read.
|
|
471
|
+
*/
|
|
472
|
+
bulkMarkAllRead(filters?: BulkFilters): Promise<BulkActionResult>;
|
|
473
|
+
/**
|
|
474
|
+
* Bulk archive notifications.
|
|
475
|
+
*/
|
|
476
|
+
bulkArchive(ids: readonly string[]): Promise<BulkActionResult>;
|
|
477
|
+
/**
|
|
478
|
+
* Bulk archive all matching notifications.
|
|
479
|
+
*/
|
|
480
|
+
bulkArchiveAll(filters?: BulkFilters): Promise<BulkActionResult>;
|
|
481
|
+
/**
|
|
482
|
+
* Bulk delete notifications.
|
|
483
|
+
*/
|
|
484
|
+
bulkDelete(ids: readonly string[]): Promise<BulkActionResult>;
|
|
485
|
+
/**
|
|
486
|
+
* Bulk delete all matching notifications.
|
|
487
|
+
*/
|
|
488
|
+
bulkDeleteAll(filters?: BulkFilters): Promise<BulkActionResult>;
|
|
489
|
+
/**
|
|
490
|
+
* Search notifications by query.
|
|
491
|
+
*/
|
|
492
|
+
search(query: string, filters?: SearchFilters, limit?: number): Promise<SearchResult>;
|
|
493
|
+
/**
|
|
494
|
+
* Get saved filters (system + custom).
|
|
495
|
+
*/
|
|
496
|
+
getSavedFilters(): Promise<readonly SavedFilter[]>;
|
|
497
|
+
/**
|
|
498
|
+
* Save a custom filter.
|
|
499
|
+
*/
|
|
500
|
+
saveFilter(name: string, filters: Record<string, unknown>): Promise<SavedFilter>;
|
|
501
|
+
/**
|
|
502
|
+
* Delete a custom filter.
|
|
503
|
+
*/
|
|
504
|
+
deleteFilter(filterId: string): Promise<void>;
|
|
505
|
+
/**
|
|
506
|
+
* Archive a notification.
|
|
361
507
|
*/
|
|
362
|
-
|
|
508
|
+
archiveNotification(id: string): Promise<void>;
|
|
363
509
|
/**
|
|
364
|
-
*
|
|
510
|
+
* Unarchive a notification.
|
|
365
511
|
*/
|
|
366
|
-
|
|
512
|
+
unarchiveNotification(id: string): Promise<void>;
|
|
367
513
|
private buildNotificationParams;
|
|
368
514
|
private request;
|
|
369
515
|
}
|
|
@@ -583,4 +729,4 @@ declare function provideNotifyKitModals(options: UseNotifyKitModalsOptions): Use
|
|
|
583
729
|
*/
|
|
584
730
|
declare function useNotifyKitModals(options: UseNotifyKitModalsOptions): UseNotifyKitModalsReturn;
|
|
585
731
|
|
|
586
|
-
export {
|
|
732
|
+
export { isNotifyKitQuietHours as $, type NotifyKitModalsResponse as A, type BulkActionResult as B, type ConnectionState as C, type NotifyKitMutationResponse as D, type NotifyKitPreferenceBooleanMap as E, type NotifyKitPreferenceModeMap as F, type NotifyKitPreferenceSettings as G, type NotifyKitPreferenceSettingsUpdate as H, InvalidSnoozeDurationError as I, type NotifyKitSingleNotificationResponse as J, type NotifyKitStoreState as K, type ListNotificationsParams as L, type PaginationMeta as M, NotifyKitClient as N, type SavedFiltersResponse as O, type PaginationParams as P, type SearchResult as Q, type UseNotifyKitModalsReturn as R, type SearchFilters as S, type UseNotifyKitStoreReturn as T, type UseNotifyKitModalsOptions as U, createNotifyKitClient as V, isMeResponse as W, isModalEnabled as X, isModalSpec as Y, isNotifyKitNotification as Z, isNotifyKitPreferenceSettings as _, type NotifyKitMeResponse as a, isPaginationMeta as a0, isUnreadCountResponse as a1, isValidCategory as a2, isValidLevel as a3, provideNotifyKitModals as a4, provideNotifyKitStore as a5, resetNotifyKitStore as a6, useNotifyKitModals as a7, useNotifyKitStore as a8, type NotifyKitListResponse as b, type NotifyKitUnreadCountResponse as c, type NotifyKitNotification as d, type NotifyKitReadMutationResponse as e, type NotifyKitPreferenceSettingsQuery as f, type NotifyKitPreferences as g, type NotifyKitPreferencesUpdate as h, type NotifyKitClientConfig as i, type BulkFilters as j, type SavedFilter as k, type NotificationCategory as l, type NotificationLevel as m, type BulkActionRequest as n, NOTIFICATION_CATEGORIES as o, NOTIFICATION_LEVELS as p, NOTIFY_KIT_MODALS_KEY as q, NOTIFY_KIT_STORE_KEY as r, NotifyKitApiError as s, type NotifyKitDigestPreferences as t, type NotifyKitErrorResponse as u, type NotifyKitGroupedEntry as v, type NotifyKitGroupedListResponse as w, type NotifyKitModalSpec as x, type NotifyKitModalState as y, type NotifyKitModalsClientLike as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingfactory/notify-kit-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Headless Vue 3/Nuxt client for Notify Kit notifications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,9 +20,7 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
|
-
"generate:types": "npx tsx ../../scripts/generate-types.ts",
|
|
24
23
|
"dev": "tsup --watch",
|
|
25
|
-
"prebuild": "npm run generate:types",
|
|
26
24
|
"build": "tsup",
|
|
27
25
|
"typecheck": "tsc --noEmit",
|
|
28
26
|
"lint": "eslint src tests",
|
|
@@ -70,8 +68,5 @@
|
|
|
70
68
|
"type": "git",
|
|
71
69
|
"url": "https://github.com/coding-factory/notify-kit.git",
|
|
72
70
|
"directory": "packages/notify-kit-client"
|
|
73
|
-
},
|
|
74
|
-
"publishConfig": {
|
|
75
|
-
"access": "restricted"
|
|
76
71
|
}
|
|
77
72
|
}
|