@codingfactory/notify-kit-client 0.1.0 → 0.2.2
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 +170 -199
- package/dist/index.js +1127 -185
- package/dist/index.js.map +1 -1
- package/dist/nuxt/index.d.ts +2 -2
- package/dist/nuxt/index.js +1 -1
- package/dist/nuxt/index.js.map +1 -1
- package/dist/{useNotifyKitModals-BZ_NiTKw.d.ts → useNotifyKitModals-CWHM9rYY.d.ts} +205 -59
- package/package.json +1 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { N as
|
|
2
|
-
export {
|
|
1
|
+
import { N as NotifyKitNotification, a as NotifyKitClient, b as NotifyKitMeResponse, L as ListNotificationsParams, c as NotifyKitListResponse, d as NotifyKitUnreadCountResponse, e as NotifyKitReadMutationResponse, P as PaginationParams, f as NotifyKitPreferenceSettingsQuery, g as NotifyKitPreferences, h as NotifyKitPreferencesUpdate, i as NotifyKitClientConfig, C as ConnectionState, B as BulkActionResult, j as BulkFilters, S as SearchFilters, k as SavedFilter, l as NotificationCategory, m as NotificationLevel } from './useNotifyKitModals-CWHM9rYY.js';
|
|
2
|
+
export { n as BulkActionRequest, I as InvalidSnoozeDurationError, o as NOTIFICATION_CATEGORIES, p as NOTIFICATION_LEVELS, q as NOTIFY_KIT_MODALS_KEY, r as NOTIFY_KIT_STORE_KEY, s as NotifyKitApiError, t as NotifyKitDigestPreferences, u as NotifyKitErrorResponse, v as NotifyKitGroupedEntry, w as NotifyKitGroupedListResponse, x as NotifyKitModalSpec, y as NotifyKitModalState, z as NotifyKitModalsClientLike, A as NotifyKitModalsResponse, D as NotifyKitMutationResponse, E as NotifyKitPreferenceBooleanMap, F as NotifyKitPreferenceModeMap, G as NotifyKitPreferenceSettings, H as NotifyKitPreferenceSettingsUpdate, J as NotifyKitSingleNotificationResponse, K as NotifyKitStoreState, M as PaginationMeta, O as SavedFiltersResponse, Q as SearchResult, U as UseNotifyKitModalsOptions, R as UseNotifyKitModalsReturn, T as UseNotifyKitStoreReturn, V as createNotifyKitClient, W as isMeResponse, X as isModalEnabled, Y as isModalSpec, Z as isNotifyKitNotification, _ as isNotifyKitPreferenceSettings, $ as isNotifyKitQuietHours, a0 as isPaginationMeta, a1 as isUnreadCountResponse, a2 as isValidCategory, a3 as isValidLevel, a4 as provideNotifyKitModals, a5 as provideNotifyKitStore, a6 as resetNotifyKitStore, a7 as useNotifyKitModals, a8 as useNotifyKitStore } from './useNotifyKitModals-CWHM9rYY.js';
|
|
3
3
|
import { InjectionKey, ComputedRef, Ref } from 'vue';
|
|
4
4
|
|
|
5
|
+
declare function normalizeApiNotification(raw: unknown): NotifyKitNotification;
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Notify Kit API endpoint constants.
|
|
7
9
|
*
|
|
@@ -31,8 +33,9 @@ declare const ENDPOINTS: {
|
|
|
31
33
|
readonly ACK_MODAL: (id: string) => string;
|
|
32
34
|
/** POST - Snooze a modal notification */
|
|
33
35
|
readonly SNOOZE_MODAL: (id: string) => string;
|
|
34
|
-
/** GET - Get user's notification
|
|
35
|
-
readonly
|
|
36
|
+
/** GET/PATCH - Get or update user's notification preference settings */
|
|
37
|
+
readonly PREFERENCE_SETTINGS: "/preference-settings";
|
|
38
|
+
readonly PREFERENCES: "/preference-settings";
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
/**
|
|
@@ -55,7 +58,8 @@ interface UseNotifyKitClientReturn {
|
|
|
55
58
|
getMe: () => Promise<NotifyKitMeResponse>;
|
|
56
59
|
listNotifications: (params?: ListNotificationsParams) => Promise<NotifyKitListResponse>;
|
|
57
60
|
getUnreadCount: () => Promise<NotifyKitUnreadCountResponse>;
|
|
58
|
-
|
|
61
|
+
getNotification: (id: string) => Promise<NotifyKitNotification>;
|
|
62
|
+
markRead: (id: string) => Promise<NotifyKitReadMutationResponse>;
|
|
59
63
|
markAllRead: () => Promise<void>;
|
|
60
64
|
deleteNotification: (id: string) => Promise<void>;
|
|
61
65
|
markGroupRead: (groupKey: string) => Promise<void>;
|
|
@@ -63,8 +67,10 @@ interface UseNotifyKitClientReturn {
|
|
|
63
67
|
listModals: () => Promise<readonly NotifyKitNotification[]>;
|
|
64
68
|
ackModal: (id: string) => Promise<void>;
|
|
65
69
|
snoozeModal: (id: string, minutes: number) => Promise<void>;
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
getPreferenceSettings: (query?: NotifyKitPreferenceSettingsQuery) => Promise<NotifyKitPreferences>;
|
|
71
|
+
updatePreferenceSettings: (preferences: NotifyKitPreferencesUpdate) => Promise<NotifyKitPreferences>;
|
|
72
|
+
getPreferences: (query?: NotifyKitPreferenceSettingsQuery) => Promise<NotifyKitPreferences>;
|
|
73
|
+
updatePreferences: (preferences: NotifyKitPreferencesUpdate) => Promise<NotifyKitPreferences>;
|
|
68
74
|
}
|
|
69
75
|
/**
|
|
70
76
|
* Provides a NotifyKitClient for injection into descendant components.
|
|
@@ -106,6 +112,45 @@ declare function provideNotifyKitClient(config: NotifyKitClientConfig): NotifyKi
|
|
|
106
112
|
*/
|
|
107
113
|
declare function useNotifyKitClient(config?: NotifyKitClientConfig): UseNotifyKitClientReturn;
|
|
108
114
|
|
|
115
|
+
/**
|
|
116
|
+
* useNotifyKitInbox composable
|
|
117
|
+
*
|
|
118
|
+
* Provides higher-level notification inbox orchestration on top of the
|
|
119
|
+
* low-level Notify Kit store and HTTP client.
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
interface NotifyKitInboxClientLike {
|
|
123
|
+
listNotifications: (params?: ListNotificationsParams) => Promise<NotifyKitListResponse>;
|
|
124
|
+
getUnreadCount: () => Promise<NotifyKitUnreadCountResponse>;
|
|
125
|
+
getNotification: (id: string) => Promise<NotifyKitNotification>;
|
|
126
|
+
markRead: (id: string) => Promise<NotifyKitReadMutationResponse>;
|
|
127
|
+
markAllRead: () => Promise<void>;
|
|
128
|
+
deleteNotification: (id: string) => Promise<void>;
|
|
129
|
+
}
|
|
130
|
+
interface UseNotifyKitInboxOptions {
|
|
131
|
+
client: NotifyKitInboxClientLike;
|
|
132
|
+
perPage?: number;
|
|
133
|
+
}
|
|
134
|
+
interface UseNotifyKitInboxReturn {
|
|
135
|
+
readonly notifications: ComputedRef<readonly NotifyKitNotification[]>;
|
|
136
|
+
readonly unreadCount: ComputedRef<number>;
|
|
137
|
+
readonly loading: ComputedRef<boolean>;
|
|
138
|
+
readonly error: ComputedRef<string | null>;
|
|
139
|
+
readonly hasMore: ComputedRef<boolean>;
|
|
140
|
+
readonly nextPage: ComputedRef<number | null>;
|
|
141
|
+
readonly isUnreadCountCoolingDown: ComputedRef<boolean>;
|
|
142
|
+
loadUnreadCount: (force?: boolean) => Promise<boolean>;
|
|
143
|
+
fetchNotifications: (page?: number | string | null, append?: boolean) => Promise<readonly NotifyKitNotification[] | undefined>;
|
|
144
|
+
loadMore: () => Promise<void>;
|
|
145
|
+
markAsRead: (notificationId: string) => Promise<void>;
|
|
146
|
+
markAllAsRead: () => Promise<void>;
|
|
147
|
+
deleteNotification: (notificationId: string) => Promise<void>;
|
|
148
|
+
clearAll: () => Promise<void>;
|
|
149
|
+
reset: () => void;
|
|
150
|
+
}
|
|
151
|
+
declare function resetNotifyKitInbox(): void;
|
|
152
|
+
declare function useNotifyKitInbox(options: UseNotifyKitInboxOptions): UseNotifyKitInboxReturn;
|
|
153
|
+
|
|
109
154
|
/**
|
|
110
155
|
* useNotifyKitRealtime composable
|
|
111
156
|
*
|
|
@@ -126,7 +171,7 @@ interface EchoLike {
|
|
|
126
171
|
* Minimal Echo channel interface.
|
|
127
172
|
*/
|
|
128
173
|
interface EchoChannelLike {
|
|
129
|
-
notification: (callback: (notification:
|
|
174
|
+
notification: (callback: (notification: unknown) => void) => EchoChannelLike;
|
|
130
175
|
stopListening: (event: string) => EchoChannelLike;
|
|
131
176
|
}
|
|
132
177
|
/**
|
|
@@ -207,6 +252,22 @@ interface UseNotifyKitRealtimeReturn {
|
|
|
207
252
|
*/
|
|
208
253
|
declare function useNotifyKitRealtime(options: UseNotifyKitRealtimeOptions): UseNotifyKitRealtimeReturn;
|
|
209
254
|
|
|
255
|
+
/**
|
|
256
|
+
* useNotifyKitRealtimeState composable
|
|
257
|
+
*
|
|
258
|
+
* Owns generic notification state updates for realtime payloads:
|
|
259
|
+
* payload normalization, idempotent merge-by-id behavior, and unread count
|
|
260
|
+
* reconciliation for realtime read/delete transitions.
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
interface UseNotifyKitRealtimeStateReturn {
|
|
264
|
+
applyIncomingPayload: (payload: unknown) => NotifyKitNotification | null;
|
|
265
|
+
applyIncomingNotification: (notification: NotifyKitNotification) => void;
|
|
266
|
+
handleNotificationRead: (notificationId: string) => void;
|
|
267
|
+
handleNotificationDeleted: (notificationId: string) => void;
|
|
268
|
+
}
|
|
269
|
+
declare function useNotifyKitRealtimeState(): UseNotifyKitRealtimeStateReturn;
|
|
270
|
+
|
|
210
271
|
/**
|
|
211
272
|
* useNotifyKitFallback composable
|
|
212
273
|
*
|
|
@@ -214,99 +275,103 @@ declare function useNotifyKitRealtime(options: UseNotifyKitRealtimeOptions): Use
|
|
|
214
275
|
* Automatically starts polling when disconnected and stops when reconnected.
|
|
215
276
|
*/
|
|
216
277
|
|
|
217
|
-
/**
|
|
218
|
-
* Configuration options for fallback polling.
|
|
219
|
-
*/
|
|
220
278
|
interface FallbackConfig {
|
|
221
|
-
/**
|
|
222
|
-
* Time in milliseconds before starting fallback polling after disconnect.
|
|
223
|
-
* Default: 5000 (5 seconds)
|
|
224
|
-
*/
|
|
225
279
|
disconnectThresholdMs: number;
|
|
226
|
-
/**
|
|
227
|
-
* Polling interval for unread count in milliseconds.
|
|
228
|
-
* Default: 30000 (30 seconds)
|
|
229
|
-
*/
|
|
230
280
|
unreadCountIntervalMs: number;
|
|
231
|
-
/**
|
|
232
|
-
* Polling interval for modals in milliseconds.
|
|
233
|
-
* Default: 120000 (2 minutes)
|
|
234
|
-
*/
|
|
235
281
|
modalsIntervalMs: number;
|
|
236
|
-
/**
|
|
237
|
-
* Grace period in milliseconds after reconnection before stopping polling.
|
|
238
|
-
* Default: 2000 (2 seconds)
|
|
239
|
-
*/
|
|
240
282
|
reconnectGracePeriodMs: number;
|
|
241
283
|
}
|
|
242
|
-
/**
|
|
243
|
-
* Options for useNotifyKitFallback composable.
|
|
244
|
-
*/
|
|
245
284
|
interface UseNotifyKitFallbackOptions {
|
|
246
|
-
/**
|
|
247
|
-
* NotifyKit client instance for API calls.
|
|
248
|
-
*/
|
|
249
285
|
client: NotifyKitClient;
|
|
250
|
-
/**
|
|
251
|
-
* Connection state ref to watch for disconnect/reconnect.
|
|
252
|
-
*/
|
|
253
286
|
connectionState: Ref<ConnectionState>;
|
|
254
|
-
/**
|
|
255
|
-
* Partial fallback configuration (merged with defaults).
|
|
256
|
-
*/
|
|
257
287
|
config?: Partial<FallbackConfig>;
|
|
258
|
-
/**
|
|
259
|
-
* Callback when new modals are fetched during fallback.
|
|
260
|
-
*/
|
|
261
288
|
onModalsReceived?: (modals: readonly NotifyKitNotification[]) => void;
|
|
262
|
-
/**
|
|
263
|
-
* Callback when unread count is fetched during fallback.
|
|
264
|
-
*/
|
|
265
289
|
onUnreadCountReceived?: (count: number) => void;
|
|
266
290
|
}
|
|
267
|
-
/**
|
|
268
|
-
* Return type of useNotifyKitFallback composable.
|
|
269
|
-
*/
|
|
270
291
|
interface UseNotifyKitFallbackReturn {
|
|
271
|
-
/** Whether fallback polling is currently active */
|
|
272
292
|
readonly isPolling: Ref<boolean>;
|
|
273
|
-
/** Timestamp of the last poll */
|
|
274
293
|
readonly lastPollAt: Ref<number | null>;
|
|
275
|
-
/** Start fallback polling manually */
|
|
276
294
|
startPolling: () => void;
|
|
277
|
-
/** Stop fallback polling manually */
|
|
278
295
|
stopPolling: () => void;
|
|
279
|
-
/** Poll unread count immediately */
|
|
280
296
|
pollUnreadCount: () => Promise<void>;
|
|
281
|
-
/** Poll modals immediately */
|
|
282
297
|
pollModals: () => Promise<void>;
|
|
283
298
|
}
|
|
299
|
+
declare function useNotifyKitFallback(options: UseNotifyKitFallbackOptions): UseNotifyKitFallbackReturn;
|
|
300
|
+
|
|
284
301
|
/**
|
|
285
|
-
*
|
|
302
|
+
* useNotifyKitBulkActions composable
|
|
286
303
|
*
|
|
287
|
-
*
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
304
|
+
* Provides state and methods for bulk notification operations.
|
|
305
|
+
*/
|
|
306
|
+
|
|
307
|
+
interface BulkActionsState {
|
|
308
|
+
readonly selectedIds: ReadonlySet<string>;
|
|
309
|
+
readonly isSelectionMode: boolean;
|
|
310
|
+
readonly isProcessing: boolean;
|
|
311
|
+
readonly error: string | null;
|
|
312
|
+
}
|
|
313
|
+
interface UseNotifyKitBulkActionsOptions {
|
|
314
|
+
readonly client: NotifyKitClient;
|
|
315
|
+
}
|
|
316
|
+
interface UseNotifyKitBulkActionsReturn {
|
|
317
|
+
readonly state: BulkActionsState;
|
|
318
|
+
readonly selectedCount: ComputedRef<number>;
|
|
319
|
+
readonly hasSelection: ComputedRef<boolean>;
|
|
320
|
+
readonly selectedIdsArray: ComputedRef<readonly string[]>;
|
|
321
|
+
toggleSelection: (id: string) => void;
|
|
322
|
+
select: (id: string) => void;
|
|
323
|
+
deselect: (id: string) => void;
|
|
324
|
+
selectAll: (ids: readonly string[]) => void;
|
|
325
|
+
clearSelection: () => void;
|
|
326
|
+
enterSelectionMode: () => void;
|
|
327
|
+
exitSelectionMode: () => void;
|
|
328
|
+
markSelectedRead: () => Promise<BulkActionResult>;
|
|
329
|
+
markAllRead: (filters?: BulkFilters) => Promise<BulkActionResult>;
|
|
330
|
+
archiveSelected: () => Promise<BulkActionResult>;
|
|
331
|
+
archiveAll: (filters?: BulkFilters) => Promise<BulkActionResult>;
|
|
332
|
+
deleteSelected: () => Promise<BulkActionResult>;
|
|
333
|
+
deleteAll: (filters?: BulkFilters) => Promise<BulkActionResult>;
|
|
334
|
+
reset: () => void;
|
|
335
|
+
}
|
|
336
|
+
declare function useNotifyKitBulkActions(options: UseNotifyKitBulkActionsOptions): UseNotifyKitBulkActionsReturn;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* useNotifyKitSearch composable
|
|
294
340
|
*
|
|
295
|
-
*
|
|
296
|
-
* isPolling,
|
|
297
|
-
* lastPollAt,
|
|
298
|
-
* startPolling,
|
|
299
|
-
* stopPolling
|
|
300
|
-
* } = useNotifyKitFallback({
|
|
301
|
-
* client: client.client,
|
|
302
|
-
* connectionState,
|
|
303
|
-
* config: {
|
|
304
|
-
* unreadCountIntervalMs: 15000, // Poll more frequently
|
|
305
|
-
* }
|
|
306
|
-
* })
|
|
307
|
-
* ```
|
|
341
|
+
* Provides state and methods for notification search functionality.
|
|
308
342
|
*/
|
|
309
|
-
|
|
343
|
+
|
|
344
|
+
interface SearchState {
|
|
345
|
+
readonly query: string;
|
|
346
|
+
readonly results: readonly NotifyKitNotification[];
|
|
347
|
+
readonly total: number;
|
|
348
|
+
readonly isSearching: boolean;
|
|
349
|
+
readonly hasSearched: boolean;
|
|
350
|
+
readonly filters: SearchFilters | null;
|
|
351
|
+
readonly error: string | null;
|
|
352
|
+
}
|
|
353
|
+
interface UseNotifyKitSearchOptions {
|
|
354
|
+
readonly client: NotifyKitClient;
|
|
355
|
+
readonly minQueryLength?: number;
|
|
356
|
+
readonly debounceMs?: number;
|
|
357
|
+
}
|
|
358
|
+
interface UseNotifyKitSearchReturn {
|
|
359
|
+
readonly state: SearchState;
|
|
360
|
+
readonly hasResults: ComputedRef<boolean>;
|
|
361
|
+
readonly resultCount: ComputedRef<number>;
|
|
362
|
+
readonly isValidQuery: ComputedRef<boolean>;
|
|
363
|
+
readonly savedFilters: Ref<readonly SavedFilter[]>;
|
|
364
|
+
readonly savedFiltersLoading: Ref<boolean>;
|
|
365
|
+
search: (query: string, filters?: SearchFilters) => Promise<void>;
|
|
366
|
+
clearSearch: () => void;
|
|
367
|
+
setFilters: (filters: SearchFilters | null) => void;
|
|
368
|
+
loadSavedFilters: () => Promise<void>;
|
|
369
|
+
applyFilter: (filter: SavedFilter) => Promise<void>;
|
|
370
|
+
saveFilter: (name: string, filters: Record<string, unknown>) => Promise<SavedFilter>;
|
|
371
|
+
deleteFilter: (filterId: string) => Promise<void>;
|
|
372
|
+
reset: () => void;
|
|
373
|
+
}
|
|
374
|
+
declare function useNotifyKitSearch(options: UseNotifyKitSearchOptions): UseNotifyKitSearchReturn;
|
|
310
375
|
|
|
311
376
|
/**
|
|
312
377
|
* Toast Policy Helpers
|
|
@@ -411,130 +476,36 @@ declare const defaultToastPolicy: ToastPolicy;
|
|
|
411
476
|
declare function createToastPolicy(config: ToastPolicyConfig): ToastPolicy;
|
|
412
477
|
|
|
413
478
|
/**
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*/
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Action type from notification payload.
|
|
479
|
+
* Helpers for resolving and binding the current user's Notify Kit
|
|
480
|
+
* broadcast channel outside of a specific Vue composable.
|
|
420
481
|
*/
|
|
421
|
-
interface
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
readonly url?: string;
|
|
426
|
-
readonly method?: string;
|
|
427
|
-
readonly endpoint?: string;
|
|
428
|
-
readonly body?: Record<string, unknown>;
|
|
429
|
-
readonly confirm?: string;
|
|
482
|
+
interface NotifyKitBroadcastChannelClientLike {
|
|
483
|
+
getMe: () => Promise<{
|
|
484
|
+
broadcast_channel: string;
|
|
485
|
+
}>;
|
|
430
486
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
*
|
|
434
|
-
* @param notification - The notification being displayed in the modal
|
|
435
|
-
* @param ids - Element IDs for title and body elements
|
|
436
|
-
* @returns Object of ARIA attributes to spread on the modal element
|
|
437
|
-
*
|
|
438
|
-
* @example
|
|
439
|
-
* ```vue
|
|
440
|
-
* <div v-bind="getModalAriaAttributes(notification, { titleId: 'modal-title', bodyId: 'modal-body' })">
|
|
441
|
-
* <h2 id="modal-title">{{ notification.title }}</h2>
|
|
442
|
-
* <p id="modal-body">{{ notification.body }}</p>
|
|
443
|
-
* </div>
|
|
444
|
-
* ```
|
|
445
|
-
*/
|
|
446
|
-
declare function getModalAriaAttributes(notification: NotifyKitNotification, ids: {
|
|
447
|
-
titleId: string;
|
|
448
|
-
bodyId: string;
|
|
449
|
-
}): Record<string, string>;
|
|
450
|
-
/**
|
|
451
|
-
* Get an escape key handler based on the modal's escape behavior configuration.
|
|
452
|
-
*
|
|
453
|
-
* @param notification - The notification being displayed
|
|
454
|
-
* @param callbacks - Callback functions for close and snooze actions
|
|
455
|
-
* @returns A keydown event handler, or null if escape is disabled
|
|
456
|
-
*
|
|
457
|
-
* @example
|
|
458
|
-
* ```typescript
|
|
459
|
-
* const handleKeydown = getEscapeKeyHandler(notification, {
|
|
460
|
-
* onClose: () => closeModal(),
|
|
461
|
-
* onSnooze: (minutes) => snoozeModal(minutes),
|
|
462
|
-
* });
|
|
463
|
-
*
|
|
464
|
-
* if (handleKeydown) {
|
|
465
|
-
* document.addEventListener('keydown', handleKeydown);
|
|
466
|
-
* }
|
|
467
|
-
* ```
|
|
468
|
-
*/
|
|
469
|
-
declare function getEscapeKeyHandler(notification: NotifyKitNotification, callbacks: {
|
|
470
|
-
onClose: () => void;
|
|
471
|
-
onSnooze: (minutes: number) => void;
|
|
472
|
-
}): ((event: KeyboardEvent) => void) | null;
|
|
473
|
-
/**
|
|
474
|
-
* Focus trap interface returned by createFocusTrap.
|
|
475
|
-
*/
|
|
476
|
-
interface FocusTrap {
|
|
477
|
-
/** Activate the focus trap - call when modal opens */
|
|
478
|
-
activate: () => void;
|
|
479
|
-
/** Deactivate the focus trap - call when modal closes */
|
|
480
|
-
deactivate: () => void;
|
|
487
|
+
interface NotifyKitBroadcastEchoChannelLike {
|
|
488
|
+
notification: (callback: (notification: unknown) => void) => NotifyKitBroadcastEchoChannelLike;
|
|
481
489
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
* @param action - The action configuration
|
|
502
|
-
* @param index - Index of the action in the actions array
|
|
503
|
-
* @returns Object of attributes to spread on the button element
|
|
504
|
-
*
|
|
505
|
-
* @example
|
|
506
|
-
* ```vue
|
|
507
|
-
* <button
|
|
508
|
-
* v-for="(action, index) in actions"
|
|
509
|
-
* v-bind="getActionButtonAttributes(action, index)"
|
|
510
|
-
* @click="handleAction(action)"
|
|
511
|
-
* >
|
|
512
|
-
* {{ action.label }}
|
|
513
|
-
* </button>
|
|
514
|
-
* ```
|
|
515
|
-
*/
|
|
516
|
-
declare function getActionButtonAttributes(action: NotifyKitAction, index: number): Record<string, string | boolean>;
|
|
517
|
-
/**
|
|
518
|
-
* Determine if a notification is critical (requires acknowledgment).
|
|
519
|
-
*
|
|
520
|
-
* @param notification - The notification to check
|
|
521
|
-
* @returns True if the notification is critical
|
|
522
|
-
*/
|
|
523
|
-
declare function isCriticalModal(notification: NotifyKitNotification): boolean;
|
|
524
|
-
/**
|
|
525
|
-
* Determine if backdrop click should close the modal.
|
|
526
|
-
*
|
|
527
|
-
* @param notification - The notification being displayed
|
|
528
|
-
* @returns True if clicking the backdrop should close the modal
|
|
529
|
-
*/
|
|
530
|
-
declare function shouldCloseOnBackdropClick(notification: NotifyKitNotification): boolean;
|
|
531
|
-
/**
|
|
532
|
-
* Get the minimum snooze duration for a notification.
|
|
533
|
-
*
|
|
534
|
-
* @param notification - The notification to check
|
|
535
|
-
* @returns Minimum snooze duration in minutes, or null if snoozing is not available
|
|
536
|
-
*/
|
|
537
|
-
declare function getMinSnoozeDuration(notification: NotifyKitNotification): number | null;
|
|
490
|
+
interface NotifyKitBroadcastEchoLike {
|
|
491
|
+
private: (channel: string) => NotifyKitBroadcastEchoChannelLike;
|
|
492
|
+
leave: (channel: string) => void;
|
|
493
|
+
}
|
|
494
|
+
interface ResolveNotifyKitBroadcastChannelOptions {
|
|
495
|
+
client: NotifyKitBroadcastChannelClientLike;
|
|
496
|
+
channel?: string;
|
|
497
|
+
}
|
|
498
|
+
interface BindNotifyKitBroadcastChannelOptions {
|
|
499
|
+
echo: NotifyKitBroadcastEchoLike;
|
|
500
|
+
channel: string;
|
|
501
|
+
onNotification: (notification: unknown) => void;
|
|
502
|
+
}
|
|
503
|
+
interface NotifyKitBroadcastChannelSubscription {
|
|
504
|
+
readonly channel: string;
|
|
505
|
+
unsubscribe: () => void;
|
|
506
|
+
}
|
|
507
|
+
declare function resolveNotifyKitBroadcastChannel(options: ResolveNotifyKitBroadcastChannelOptions): Promise<string>;
|
|
508
|
+
declare function bindNotifyKitBroadcastChannel(options: BindNotifyKitBroadcastChannelOptions): NotifyKitBroadcastChannelSubscription;
|
|
538
509
|
|
|
539
510
|
/**
|
|
540
511
|
* @coding-factory/notify-kit-client
|
|
@@ -542,6 +513,6 @@ declare function getMinSnoozeDuration(notification: NotifyKitNotification): numb
|
|
|
542
513
|
* Headless Vue 3/Nuxt client for Notify Kit notifications.
|
|
543
514
|
* Provides TypeScript types, HTTP client, composables, and Nuxt integration.
|
|
544
515
|
*/
|
|
545
|
-
declare const VERSION = "0.
|
|
516
|
+
declare const VERSION = "0.2.2";
|
|
546
517
|
|
|
547
|
-
export { ConnectionState, ENDPOINTS, type EchoChannelLike, type EchoLike, type FallbackConfig,
|
|
518
|
+
export { type BindNotifyKitBroadcastChannelOptions, BulkActionResult, type BulkActionsState, BulkFilters, ConnectionState, ENDPOINTS, type EchoChannelLike, type EchoLike, type FallbackConfig, ListNotificationsParams, NOTIFY_KIT_CLIENT_KEY, NotificationCategory, NotificationLevel, type NotifyKitBroadcastChannelClientLike, type NotifyKitBroadcastChannelSubscription, type NotifyKitBroadcastEchoChannelLike, type NotifyKitBroadcastEchoLike, NotifyKitClient, NotifyKitClientConfig, type NotifyKitClientLike, type NotifyKitInboxClientLike, NotifyKitListResponse, NotifyKitMeResponse, NotifyKitNotification, NotifyKitPreferenceSettingsQuery, NotifyKitPreferences, NotifyKitPreferencesUpdate, NotifyKitReadMutationResponse, NotifyKitUnreadCountResponse, PaginationParams, type ResolveNotifyKitBroadcastChannelOptions, SavedFilter, SearchFilters, type SearchState, type ToastPolicy, type ToastPolicyConfig, type UseNotifyKitBulkActionsOptions, type UseNotifyKitBulkActionsReturn, type UseNotifyKitClientReturn, type UseNotifyKitFallbackOptions, type UseNotifyKitFallbackReturn, type UseNotifyKitInboxOptions, type UseNotifyKitInboxReturn, type UseNotifyKitRealtimeOptions, type UseNotifyKitRealtimeReturn, type UseNotifyKitRealtimeStateReturn, type UseNotifyKitSearchOptions, type UseNotifyKitSearchReturn, VERSION, bindNotifyKitBroadcastChannel, createToastPolicy, defaultToastPolicy, normalizeApiNotification, provideNotifyKitClient, resetNotifyKitInbox, resolveNotifyKitBroadcastChannel, useNotifyKitBulkActions, useNotifyKitClient, useNotifyKitFallback, useNotifyKitInbox, useNotifyKitRealtime, useNotifyKitRealtimeState, useNotifyKitSearch };
|