@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
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NotifyKitClient, a as NotifyKitMeResponse, L as ListNotificationsParams, b as NotifyKitListResponse, c as NotifyKitUnreadCountResponse, P as PaginationParams,
|
|
2
|
-
export {
|
|
1
|
+
import { N as NotifyKitClient, a as NotifyKitMeResponse, L as ListNotificationsParams, b as NotifyKitListResponse, c as NotifyKitUnreadCountResponse, d as NotifyKitNotification, 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-CUfVmBsN.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-CUfVmBsN.js';
|
|
3
3
|
import { InjectionKey, ComputedRef, Ref } from 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -31,8 +31,9 @@ declare const ENDPOINTS: {
|
|
|
31
31
|
readonly ACK_MODAL: (id: string) => string;
|
|
32
32
|
/** POST - Snooze a modal notification */
|
|
33
33
|
readonly SNOOZE_MODAL: (id: string) => string;
|
|
34
|
-
/** GET - Get user's notification
|
|
35
|
-
readonly
|
|
34
|
+
/** GET/PATCH - Get or update user's notification preference settings */
|
|
35
|
+
readonly PREFERENCE_SETTINGS: "/preference-settings";
|
|
36
|
+
readonly PREFERENCES: "/preference-settings";
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
/**
|
|
@@ -55,7 +56,8 @@ interface UseNotifyKitClientReturn {
|
|
|
55
56
|
getMe: () => Promise<NotifyKitMeResponse>;
|
|
56
57
|
listNotifications: (params?: ListNotificationsParams) => Promise<NotifyKitListResponse>;
|
|
57
58
|
getUnreadCount: () => Promise<NotifyKitUnreadCountResponse>;
|
|
58
|
-
|
|
59
|
+
getNotification: (id: string) => Promise<NotifyKitNotification>;
|
|
60
|
+
markRead: (id: string) => Promise<NotifyKitReadMutationResponse>;
|
|
59
61
|
markAllRead: () => Promise<void>;
|
|
60
62
|
deleteNotification: (id: string) => Promise<void>;
|
|
61
63
|
markGroupRead: (groupKey: string) => Promise<void>;
|
|
@@ -63,8 +65,10 @@ interface UseNotifyKitClientReturn {
|
|
|
63
65
|
listModals: () => Promise<readonly NotifyKitNotification[]>;
|
|
64
66
|
ackModal: (id: string) => Promise<void>;
|
|
65
67
|
snoozeModal: (id: string, minutes: number) => Promise<void>;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
getPreferenceSettings: (query?: NotifyKitPreferenceSettingsQuery) => Promise<NotifyKitPreferences>;
|
|
69
|
+
updatePreferenceSettings: (preferences: NotifyKitPreferencesUpdate) => Promise<NotifyKitPreferences>;
|
|
70
|
+
getPreferences: (query?: NotifyKitPreferenceSettingsQuery) => Promise<NotifyKitPreferences>;
|
|
71
|
+
updatePreferences: (preferences: NotifyKitPreferencesUpdate) => Promise<NotifyKitPreferences>;
|
|
68
72
|
}
|
|
69
73
|
/**
|
|
70
74
|
* Provides a NotifyKitClient for injection into descendant components.
|
|
@@ -106,6 +110,45 @@ declare function provideNotifyKitClient(config: NotifyKitClientConfig): NotifyKi
|
|
|
106
110
|
*/
|
|
107
111
|
declare function useNotifyKitClient(config?: NotifyKitClientConfig): UseNotifyKitClientReturn;
|
|
108
112
|
|
|
113
|
+
/**
|
|
114
|
+
* useNotifyKitInbox composable
|
|
115
|
+
*
|
|
116
|
+
* Provides higher-level notification inbox orchestration on top of the
|
|
117
|
+
* low-level Notify Kit store and HTTP client.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
interface NotifyKitInboxClientLike {
|
|
121
|
+
listNotifications: (params?: ListNotificationsParams) => Promise<NotifyKitListResponse>;
|
|
122
|
+
getUnreadCount: () => Promise<NotifyKitUnreadCountResponse>;
|
|
123
|
+
getNotification: (id: string) => Promise<NotifyKitNotification>;
|
|
124
|
+
markRead: (id: string) => Promise<NotifyKitReadMutationResponse>;
|
|
125
|
+
markAllRead: () => Promise<void>;
|
|
126
|
+
deleteNotification: (id: string) => Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
interface UseNotifyKitInboxOptions {
|
|
129
|
+
client: NotifyKitInboxClientLike;
|
|
130
|
+
perPage?: number;
|
|
131
|
+
}
|
|
132
|
+
interface UseNotifyKitInboxReturn {
|
|
133
|
+
readonly notifications: ComputedRef<readonly NotifyKitNotification[]>;
|
|
134
|
+
readonly unreadCount: ComputedRef<number>;
|
|
135
|
+
readonly loading: ComputedRef<boolean>;
|
|
136
|
+
readonly error: ComputedRef<string | null>;
|
|
137
|
+
readonly hasMore: ComputedRef<boolean>;
|
|
138
|
+
readonly nextPage: ComputedRef<number | null>;
|
|
139
|
+
readonly isUnreadCountCoolingDown: ComputedRef<boolean>;
|
|
140
|
+
loadUnreadCount: () => Promise<boolean>;
|
|
141
|
+
fetchNotifications: (page?: number | string | null, append?: boolean) => Promise<readonly NotifyKitNotification[] | undefined>;
|
|
142
|
+
loadMore: () => Promise<void>;
|
|
143
|
+
markAsRead: (notificationId: string) => Promise<void>;
|
|
144
|
+
markAllAsRead: () => Promise<void>;
|
|
145
|
+
deleteNotification: (notificationId: string) => Promise<void>;
|
|
146
|
+
clearAll: () => Promise<void>;
|
|
147
|
+
reset: () => void;
|
|
148
|
+
}
|
|
149
|
+
declare function resetNotifyKitInbox(): void;
|
|
150
|
+
declare function useNotifyKitInbox(options: UseNotifyKitInboxOptions): UseNotifyKitInboxReturn;
|
|
151
|
+
|
|
109
152
|
/**
|
|
110
153
|
* useNotifyKitRealtime composable
|
|
111
154
|
*
|
|
@@ -126,7 +169,7 @@ interface EchoLike {
|
|
|
126
169
|
* Minimal Echo channel interface.
|
|
127
170
|
*/
|
|
128
171
|
interface EchoChannelLike {
|
|
129
|
-
notification: (callback: (notification:
|
|
172
|
+
notification: (callback: (notification: unknown) => void) => EchoChannelLike;
|
|
130
173
|
stopListening: (event: string) => EchoChannelLike;
|
|
131
174
|
}
|
|
132
175
|
/**
|
|
@@ -207,6 +250,22 @@ interface UseNotifyKitRealtimeReturn {
|
|
|
207
250
|
*/
|
|
208
251
|
declare function useNotifyKitRealtime(options: UseNotifyKitRealtimeOptions): UseNotifyKitRealtimeReturn;
|
|
209
252
|
|
|
253
|
+
/**
|
|
254
|
+
* useNotifyKitRealtimeState composable
|
|
255
|
+
*
|
|
256
|
+
* Owns generic notification state updates for realtime payloads:
|
|
257
|
+
* payload normalization, idempotent merge-by-id behavior, and unread count
|
|
258
|
+
* reconciliation for realtime read/delete transitions.
|
|
259
|
+
*/
|
|
260
|
+
|
|
261
|
+
interface UseNotifyKitRealtimeStateReturn {
|
|
262
|
+
applyIncomingPayload: (payload: unknown) => NotifyKitNotification | null;
|
|
263
|
+
applyIncomingNotification: (notification: NotifyKitNotification) => void;
|
|
264
|
+
handleNotificationRead: (notificationId: string) => void;
|
|
265
|
+
handleNotificationDeleted: (notificationId: string) => void;
|
|
266
|
+
}
|
|
267
|
+
declare function useNotifyKitRealtimeState(): UseNotifyKitRealtimeStateReturn;
|
|
268
|
+
|
|
210
269
|
/**
|
|
211
270
|
* useNotifyKitFallback composable
|
|
212
271
|
*
|
|
@@ -214,99 +273,103 @@ declare function useNotifyKitRealtime(options: UseNotifyKitRealtimeOptions): Use
|
|
|
214
273
|
* Automatically starts polling when disconnected and stops when reconnected.
|
|
215
274
|
*/
|
|
216
275
|
|
|
217
|
-
/**
|
|
218
|
-
* Configuration options for fallback polling.
|
|
219
|
-
*/
|
|
220
276
|
interface FallbackConfig {
|
|
221
|
-
/**
|
|
222
|
-
* Time in milliseconds before starting fallback polling after disconnect.
|
|
223
|
-
* Default: 5000 (5 seconds)
|
|
224
|
-
*/
|
|
225
277
|
disconnectThresholdMs: number;
|
|
226
|
-
/**
|
|
227
|
-
* Polling interval for unread count in milliseconds.
|
|
228
|
-
* Default: 30000 (30 seconds)
|
|
229
|
-
*/
|
|
230
278
|
unreadCountIntervalMs: number;
|
|
231
|
-
/**
|
|
232
|
-
* Polling interval for modals in milliseconds.
|
|
233
|
-
* Default: 120000 (2 minutes)
|
|
234
|
-
*/
|
|
235
279
|
modalsIntervalMs: number;
|
|
236
|
-
/**
|
|
237
|
-
* Grace period in milliseconds after reconnection before stopping polling.
|
|
238
|
-
* Default: 2000 (2 seconds)
|
|
239
|
-
*/
|
|
240
280
|
reconnectGracePeriodMs: number;
|
|
241
281
|
}
|
|
242
|
-
/**
|
|
243
|
-
* Options for useNotifyKitFallback composable.
|
|
244
|
-
*/
|
|
245
282
|
interface UseNotifyKitFallbackOptions {
|
|
246
|
-
/**
|
|
247
|
-
* NotifyKit client instance for API calls.
|
|
248
|
-
*/
|
|
249
283
|
client: NotifyKitClient;
|
|
250
|
-
/**
|
|
251
|
-
* Connection state ref to watch for disconnect/reconnect.
|
|
252
|
-
*/
|
|
253
284
|
connectionState: Ref<ConnectionState>;
|
|
254
|
-
/**
|
|
255
|
-
* Partial fallback configuration (merged with defaults).
|
|
256
|
-
*/
|
|
257
285
|
config?: Partial<FallbackConfig>;
|
|
258
|
-
/**
|
|
259
|
-
* Callback when new modals are fetched during fallback.
|
|
260
|
-
*/
|
|
261
286
|
onModalsReceived?: (modals: readonly NotifyKitNotification[]) => void;
|
|
262
|
-
/**
|
|
263
|
-
* Callback when unread count is fetched during fallback.
|
|
264
|
-
*/
|
|
265
287
|
onUnreadCountReceived?: (count: number) => void;
|
|
266
288
|
}
|
|
267
|
-
/**
|
|
268
|
-
* Return type of useNotifyKitFallback composable.
|
|
269
|
-
*/
|
|
270
289
|
interface UseNotifyKitFallbackReturn {
|
|
271
|
-
/** Whether fallback polling is currently active */
|
|
272
290
|
readonly isPolling: Ref<boolean>;
|
|
273
|
-
/** Timestamp of the last poll */
|
|
274
291
|
readonly lastPollAt: Ref<number | null>;
|
|
275
|
-
/** Start fallback polling manually */
|
|
276
292
|
startPolling: () => void;
|
|
277
|
-
/** Stop fallback polling manually */
|
|
278
293
|
stopPolling: () => void;
|
|
279
|
-
/** Poll unread count immediately */
|
|
280
294
|
pollUnreadCount: () => Promise<void>;
|
|
281
|
-
/** Poll modals immediately */
|
|
282
295
|
pollModals: () => Promise<void>;
|
|
283
296
|
}
|
|
297
|
+
declare function useNotifyKitFallback(options: UseNotifyKitFallbackOptions): UseNotifyKitFallbackReturn;
|
|
298
|
+
|
|
284
299
|
/**
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
* Automatically monitors connection state and starts/stops polling
|
|
288
|
-
* based on WebSocket connectivity.
|
|
300
|
+
* useNotifyKitBulkActions composable
|
|
289
301
|
*
|
|
290
|
-
*
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
302
|
+
* Provides state and methods for bulk notification operations.
|
|
303
|
+
*/
|
|
304
|
+
|
|
305
|
+
interface BulkActionsState {
|
|
306
|
+
readonly selectedIds: ReadonlySet<string>;
|
|
307
|
+
readonly isSelectionMode: boolean;
|
|
308
|
+
readonly isProcessing: boolean;
|
|
309
|
+
readonly error: string | null;
|
|
310
|
+
}
|
|
311
|
+
interface UseNotifyKitBulkActionsOptions {
|
|
312
|
+
readonly client: NotifyKitClient;
|
|
313
|
+
}
|
|
314
|
+
interface UseNotifyKitBulkActionsReturn {
|
|
315
|
+
readonly state: BulkActionsState;
|
|
316
|
+
readonly selectedCount: ComputedRef<number>;
|
|
317
|
+
readonly hasSelection: ComputedRef<boolean>;
|
|
318
|
+
readonly selectedIdsArray: ComputedRef<readonly string[]>;
|
|
319
|
+
toggleSelection: (id: string) => void;
|
|
320
|
+
select: (id: string) => void;
|
|
321
|
+
deselect: (id: string) => void;
|
|
322
|
+
selectAll: (ids: readonly string[]) => void;
|
|
323
|
+
clearSelection: () => void;
|
|
324
|
+
enterSelectionMode: () => void;
|
|
325
|
+
exitSelectionMode: () => void;
|
|
326
|
+
markSelectedRead: () => Promise<BulkActionResult>;
|
|
327
|
+
markAllRead: (filters?: BulkFilters) => Promise<BulkActionResult>;
|
|
328
|
+
archiveSelected: () => Promise<BulkActionResult>;
|
|
329
|
+
archiveAll: (filters?: BulkFilters) => Promise<BulkActionResult>;
|
|
330
|
+
deleteSelected: () => Promise<BulkActionResult>;
|
|
331
|
+
deleteAll: (filters?: BulkFilters) => Promise<BulkActionResult>;
|
|
332
|
+
reset: () => void;
|
|
333
|
+
}
|
|
334
|
+
declare function useNotifyKitBulkActions(options: UseNotifyKitBulkActionsOptions): UseNotifyKitBulkActionsReturn;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* useNotifyKitSearch composable
|
|
294
338
|
*
|
|
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
|
-
* ```
|
|
339
|
+
* Provides state and methods for notification search functionality.
|
|
308
340
|
*/
|
|
309
|
-
|
|
341
|
+
|
|
342
|
+
interface SearchState {
|
|
343
|
+
readonly query: string;
|
|
344
|
+
readonly results: readonly NotifyKitNotification[];
|
|
345
|
+
readonly total: number;
|
|
346
|
+
readonly isSearching: boolean;
|
|
347
|
+
readonly hasSearched: boolean;
|
|
348
|
+
readonly filters: SearchFilters | null;
|
|
349
|
+
readonly error: string | null;
|
|
350
|
+
}
|
|
351
|
+
interface UseNotifyKitSearchOptions {
|
|
352
|
+
readonly client: NotifyKitClient;
|
|
353
|
+
readonly minQueryLength?: number;
|
|
354
|
+
readonly debounceMs?: number;
|
|
355
|
+
}
|
|
356
|
+
interface UseNotifyKitSearchReturn {
|
|
357
|
+
readonly state: SearchState;
|
|
358
|
+
readonly hasResults: ComputedRef<boolean>;
|
|
359
|
+
readonly resultCount: ComputedRef<number>;
|
|
360
|
+
readonly isValidQuery: ComputedRef<boolean>;
|
|
361
|
+
readonly savedFilters: Ref<readonly SavedFilter[]>;
|
|
362
|
+
readonly savedFiltersLoading: Ref<boolean>;
|
|
363
|
+
search: (query: string, filters?: SearchFilters) => Promise<void>;
|
|
364
|
+
clearSearch: () => void;
|
|
365
|
+
setFilters: (filters: SearchFilters | null) => void;
|
|
366
|
+
loadSavedFilters: () => Promise<void>;
|
|
367
|
+
applyFilter: (filter: SavedFilter) => Promise<void>;
|
|
368
|
+
saveFilter: (name: string, filters: Record<string, unknown>) => Promise<SavedFilter>;
|
|
369
|
+
deleteFilter: (filterId: string) => Promise<void>;
|
|
370
|
+
reset: () => void;
|
|
371
|
+
}
|
|
372
|
+
declare function useNotifyKitSearch(options: UseNotifyKitSearchOptions): UseNotifyKitSearchReturn;
|
|
310
373
|
|
|
311
374
|
/**
|
|
312
375
|
* Toast Policy Helpers
|
|
@@ -411,130 +474,36 @@ declare const defaultToastPolicy: ToastPolicy;
|
|
|
411
474
|
declare function createToastPolicy(config: ToastPolicyConfig): ToastPolicy;
|
|
412
475
|
|
|
413
476
|
/**
|
|
414
|
-
*
|
|
415
|
-
*
|
|
477
|
+
* Helpers for resolving and binding the current user's Notify Kit
|
|
478
|
+
* broadcast channel outside of a specific Vue composable.
|
|
416
479
|
*/
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
interface NotifyKitAction {
|
|
422
|
-
readonly type: 'link' | 'api' | 'ack' | 'snooze';
|
|
423
|
-
readonly label: string;
|
|
424
|
-
readonly primary?: boolean;
|
|
425
|
-
readonly url?: string;
|
|
426
|
-
readonly method?: string;
|
|
427
|
-
readonly endpoint?: string;
|
|
428
|
-
readonly body?: Record<string, unknown>;
|
|
429
|
-
readonly confirm?: string;
|
|
480
|
+
interface NotifyKitBroadcastChannelClientLike {
|
|
481
|
+
getMe: () => Promise<{
|
|
482
|
+
broadcast_channel: string;
|
|
483
|
+
}>;
|
|
430
484
|
}
|
|
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;
|
|
485
|
+
interface NotifyKitBroadcastEchoChannelLike {
|
|
486
|
+
notification: (callback: (notification: unknown) => void) => NotifyKitBroadcastEchoChannelLike;
|
|
481
487
|
}
|
|
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;
|
|
488
|
+
interface NotifyKitBroadcastEchoLike {
|
|
489
|
+
private: (channel: string) => NotifyKitBroadcastEchoChannelLike;
|
|
490
|
+
leave: (channel: string) => void;
|
|
491
|
+
}
|
|
492
|
+
interface ResolveNotifyKitBroadcastChannelOptions {
|
|
493
|
+
client: NotifyKitBroadcastChannelClientLike;
|
|
494
|
+
channel?: string;
|
|
495
|
+
}
|
|
496
|
+
interface BindNotifyKitBroadcastChannelOptions {
|
|
497
|
+
echo: NotifyKitBroadcastEchoLike;
|
|
498
|
+
channel: string;
|
|
499
|
+
onNotification: (notification: unknown) => void;
|
|
500
|
+
}
|
|
501
|
+
interface NotifyKitBroadcastChannelSubscription {
|
|
502
|
+
readonly channel: string;
|
|
503
|
+
unsubscribe: () => void;
|
|
504
|
+
}
|
|
505
|
+
declare function resolveNotifyKitBroadcastChannel(options: ResolveNotifyKitBroadcastChannelOptions): Promise<string>;
|
|
506
|
+
declare function bindNotifyKitBroadcastChannel(options: BindNotifyKitBroadcastChannelOptions): NotifyKitBroadcastChannelSubscription;
|
|
538
507
|
|
|
539
508
|
/**
|
|
540
509
|
* @coding-factory/notify-kit-client
|
|
@@ -544,4 +513,4 @@ declare function getMinSnoozeDuration(notification: NotifyKitNotification): numb
|
|
|
544
513
|
*/
|
|
545
514
|
declare const VERSION = "0.1.0";
|
|
546
515
|
|
|
547
|
-
export { ConnectionState, ENDPOINTS, type EchoChannelLike, type EchoLike, type FallbackConfig,
|
|
516
|
+
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, provideNotifyKitClient, resetNotifyKitInbox, resolveNotifyKitBroadcastChannel, useNotifyKitBulkActions, useNotifyKitClient, useNotifyKitFallback, useNotifyKitInbox, useNotifyKitRealtime, useNotifyKitRealtimeState, useNotifyKitSearch };
|