@novu/js 3.15.0 → 3.16.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/dist/cjs/{chunk-C23LCEUU.js → chunk-6I5A5OGE.js} +393 -50
- package/dist/{esm/novu-event-emitter-D9AphR7g.d.mts → cjs/inbox-service-CEMMLHsX.d.ts} +715 -611
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +18 -18
- package/dist/cjs/internal/index.d.ts +1 -1
- package/dist/cjs/internal/index.js +6 -6
- package/dist/{esm/novu-DTGsXJjv.d.mts → cjs/novu-ChPiHuXt.d.ts} +27 -1
- package/dist/cjs/themes/index.d.ts +3 -3
- package/dist/cjs/{types-DXbz7pFA.d.ts → types-CPxEgcM4.d.ts} +52 -7
- package/dist/cjs/ui/index.d.ts +52 -6
- package/dist/cjs/ui/index.js +6574 -5632
- package/dist/esm/{chunk-DXONCY42.mjs → chunk-FBE56J52.mjs} +345 -2
- package/dist/{cjs/novu-event-emitter-D9AphR7g.d.ts → esm/inbox-service-CEMMLHsX.d.mts} +715 -611
- package/dist/esm/index.d.mts +3 -3
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/internal/index.d.mts +1 -1
- package/dist/esm/internal/index.mjs +1 -1
- package/dist/{cjs/novu-CI_mzxvm.d.ts → esm/novu-BlonRpYH.d.mts} +27 -1
- package/dist/esm/themes/index.d.mts +3 -3
- package/dist/esm/{types-zMKIpsOL.d.mts → types-B29Y1SQy.d.mts} +52 -7
- package/dist/esm/ui/index.d.mts +52 -6
- package/dist/esm/ui/index.mjs +6573 -5631
- package/dist/index.css +1 -1
- package/dist/novu.min.js +16 -16
- package/dist/novu.min.js.gz +0 -0
- package/package.json +1 -1
- /package/dist/cjs/{chunk-YPTYVCVE.js → chunk-WDGG3OER.js} +0 -0
- /package/dist/esm/{chunk-3WBJEI4O.mjs → chunk-4S22IB5W.mjs} +0 -0
|
@@ -6,32 +6,6 @@ type HttpClientOptions = {
|
|
|
6
6
|
headers?: Record<string, string>;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
declare class SubscriptionsCache {
|
|
10
|
-
#private;
|
|
11
|
-
constructor({ emitterInstance, inboxServiceInstance, useCache, }: {
|
|
12
|
-
emitterInstance: NovuEventEmitter;
|
|
13
|
-
inboxServiceInstance: InboxService;
|
|
14
|
-
useCache: boolean;
|
|
15
|
-
});
|
|
16
|
-
private handleCreate;
|
|
17
|
-
private handleUpdate;
|
|
18
|
-
private handlePreferenceUpdate;
|
|
19
|
-
private handleBulkPreferenceUpdate;
|
|
20
|
-
private updateSubscriptionPreferences;
|
|
21
|
-
private createUpdatedSubscription;
|
|
22
|
-
private handleDelete;
|
|
23
|
-
private handleDeleteByIdentifier;
|
|
24
|
-
has(args: ListSubscriptionsArgs): boolean;
|
|
25
|
-
set(args: ListSubscriptionsArgs, data: TopicSubscription[]): void;
|
|
26
|
-
setOne(args: GetSubscriptionArgs, data: TopicSubscription): void;
|
|
27
|
-
getAll(args: ListSubscriptionsArgs): TopicSubscription[] | undefined;
|
|
28
|
-
get(args: GetSubscriptionArgs): TopicSubscription | undefined;
|
|
29
|
-
invalidate(args: {
|
|
30
|
-
topicKey: string;
|
|
31
|
-
}): void;
|
|
32
|
-
clearAll(): void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
9
|
declare class NovuError extends Error {
|
|
36
10
|
originalError: Error;
|
|
37
11
|
constructor(message: string, originalError: unknown);
|
|
@@ -121,280 +95,117 @@ declare class Preference {
|
|
|
121
95
|
}>): Result<Preference>;
|
|
122
96
|
}
|
|
123
97
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
* If you want to provide custom types for the notification.data object,
|
|
127
|
-
* simply redeclare this rule in the global namespace.
|
|
128
|
-
* Every notification object will use the provided type.
|
|
129
|
-
*/
|
|
130
|
-
interface NotificationData {
|
|
131
|
-
[k: string]: unknown;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
declare enum NotificationStatus {
|
|
135
|
-
READ = "read",
|
|
136
|
-
SEEN = "seen",
|
|
137
|
-
SNOOZED = "snoozed",
|
|
138
|
-
UNREAD = "unread",
|
|
139
|
-
UNSEEN = "unseen",
|
|
140
|
-
UNSNOOZED = "unsnoozed"
|
|
141
|
-
}
|
|
142
|
-
declare enum PreferenceLevel {
|
|
143
|
-
GLOBAL = "global",
|
|
144
|
-
TEMPLATE = "template"
|
|
145
|
-
}
|
|
146
|
-
declare enum ChannelType {
|
|
147
|
-
IN_APP = "in_app",
|
|
148
|
-
EMAIL = "email",
|
|
149
|
-
SMS = "sms",
|
|
150
|
-
CHAT = "chat",
|
|
151
|
-
PUSH = "push"
|
|
152
|
-
}
|
|
153
|
-
declare enum WebSocketEvent {
|
|
154
|
-
RECEIVED = "notification_received",
|
|
155
|
-
UNREAD = "unread_count_changed",
|
|
156
|
-
UNSEEN = "unseen_count_changed"
|
|
157
|
-
}
|
|
158
|
-
type SocketTypeOption = 'cloud' | 'self-hosted';
|
|
159
|
-
type NovuSocketOptions = {
|
|
160
|
-
socketType?: SocketTypeOption;
|
|
161
|
-
[key: string]: unknown;
|
|
162
|
-
};
|
|
163
|
-
declare enum SeverityLevelEnum {
|
|
164
|
-
HIGH = "high",
|
|
165
|
-
MEDIUM = "medium",
|
|
166
|
-
LOW = "low",
|
|
167
|
-
NONE = "none"
|
|
168
|
-
}
|
|
169
|
-
declare enum WorkflowCriticalityEnum {
|
|
170
|
-
CRITICAL = "critical",
|
|
171
|
-
NON_CRITICAL = "nonCritical",
|
|
172
|
-
ALL = "all"
|
|
173
|
-
}
|
|
174
|
-
type UnreadCount = {
|
|
175
|
-
total: number;
|
|
176
|
-
severity: Record<SeverityLevelEnum, number>;
|
|
98
|
+
type KeylessInitializeSessionArgs = {} & {
|
|
99
|
+
[K in string]?: never;
|
|
177
100
|
};
|
|
178
|
-
type
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
maxSnoozeDurationHours: number;
|
|
186
|
-
applicationIdentifier?: string;
|
|
187
|
-
contextKeys?: string[];
|
|
101
|
+
type InitializeSessionArgs = KeylessInitializeSessionArgs | {
|
|
102
|
+
applicationIdentifier: string;
|
|
103
|
+
subscriber: Subscriber;
|
|
104
|
+
subscriberHash?: string;
|
|
105
|
+
contextHash?: string;
|
|
106
|
+
defaultSchedule?: DefaultSchedule;
|
|
107
|
+
context?: Context;
|
|
188
108
|
};
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
109
|
+
|
|
110
|
+
declare class SubscriptionPreference {
|
|
111
|
+
#private;
|
|
112
|
+
readonly subscriptionId: string;
|
|
113
|
+
readonly workflow: Workflow;
|
|
114
|
+
readonly enabled: boolean;
|
|
115
|
+
readonly condition?: RulesLogic;
|
|
116
|
+
constructor(preference: SubscriptionPreferenceResponse, emitter: NovuEventEmitter, inboxService: InboxService, cache: SubscriptionsCache, useCache?: boolean);
|
|
117
|
+
update(args: {
|
|
118
|
+
value: boolean | RulesLogic;
|
|
119
|
+
}): Result<SubscriptionPreference>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
type WorkflowIdentifierOrId = string;
|
|
123
|
+
type WorkflowFilter = {
|
|
124
|
+
workflowId: WorkflowIdentifierOrId;
|
|
125
|
+
enabled?: boolean;
|
|
126
|
+
condition?: RulesLogic;
|
|
127
|
+
filter?: never;
|
|
200
128
|
};
|
|
201
|
-
type
|
|
202
|
-
|
|
203
|
-
|
|
129
|
+
type WorkflowGroupFilter = {
|
|
130
|
+
filter: {
|
|
131
|
+
workflowIds?: Array<WorkflowIdentifierOrId>;
|
|
132
|
+
tags?: string[];
|
|
133
|
+
};
|
|
134
|
+
enabled?: boolean;
|
|
135
|
+
condition?: RulesLogic;
|
|
136
|
+
workflowId?: never;
|
|
204
137
|
};
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
type Action = {
|
|
210
|
-
label: string;
|
|
211
|
-
isCompleted: boolean;
|
|
212
|
-
redirect?: Redirect;
|
|
138
|
+
type PreferenceFilter = WorkflowIdentifierOrId | WorkflowFilter | WorkflowGroupFilter;
|
|
139
|
+
type ListSubscriptionsArgs = {
|
|
140
|
+
topicKey: string;
|
|
213
141
|
};
|
|
214
|
-
type
|
|
215
|
-
|
|
216
|
-
identifier
|
|
217
|
-
|
|
218
|
-
critical: boolean;
|
|
142
|
+
type GetSubscriptionArgs = {
|
|
143
|
+
topicKey: string;
|
|
144
|
+
identifier?: string;
|
|
145
|
+
workflowIds?: string[];
|
|
219
146
|
tags?: string[];
|
|
220
|
-
severity: SeverityLevelEnum;
|
|
221
147
|
};
|
|
222
|
-
type
|
|
223
|
-
|
|
148
|
+
type CreateSubscriptionArgs = {
|
|
149
|
+
topicKey: string;
|
|
150
|
+
topicName?: string;
|
|
151
|
+
identifier?: string;
|
|
152
|
+
name?: string;
|
|
153
|
+
preferences?: Array<PreferenceFilter> | undefined;
|
|
224
154
|
};
|
|
225
|
-
type
|
|
226
|
-
|
|
155
|
+
type BaseUpdateSubscriptionArgs = {
|
|
156
|
+
topicKey: string;
|
|
157
|
+
identifier: string;
|
|
158
|
+
name?: string;
|
|
159
|
+
preferences?: Array<PreferenceFilter>;
|
|
227
160
|
};
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
* ```ts
|
|
233
|
-
* const tags: TagsFilter = ['promo', 'sale'];
|
|
234
|
-
* ```
|
|
235
|
-
*
|
|
236
|
-
* @example AND of OR-groups — match (`urgent` **or** `critical`) **and** (`billing`)
|
|
237
|
-
* ```ts
|
|
238
|
-
* const tags: TagsFilter = {
|
|
239
|
-
* and: [{ or: ['urgent', 'critical'] }, { or: ['billing'] }],
|
|
240
|
-
* };
|
|
241
|
-
* ```
|
|
242
|
-
*/
|
|
243
|
-
type TagsFilter = string[] | TagsFilterOrGroup | TagsFilterAndForm;
|
|
244
|
-
type InboxNotification = {
|
|
245
|
-
id: string;
|
|
246
|
-
transactionId: string;
|
|
247
|
-
subject?: string;
|
|
248
|
-
body: string;
|
|
249
|
-
to: Subscriber;
|
|
250
|
-
isRead: boolean;
|
|
251
|
-
isSeen: boolean;
|
|
252
|
-
isArchived: boolean;
|
|
253
|
-
isSnoozed: boolean;
|
|
254
|
-
snoozedUntil?: string | null;
|
|
255
|
-
deliveredAt?: string[];
|
|
256
|
-
createdAt: string;
|
|
257
|
-
readAt?: string | null;
|
|
258
|
-
firstSeenAt?: string | null;
|
|
259
|
-
archivedAt?: string | null;
|
|
260
|
-
avatar?: string;
|
|
261
|
-
primaryAction?: Action;
|
|
262
|
-
secondaryAction?: Action;
|
|
263
|
-
channelType: ChannelType;
|
|
264
|
-
tags?: string[];
|
|
265
|
-
data?: NotificationData;
|
|
266
|
-
redirect?: Redirect;
|
|
267
|
-
workflow?: Workflow;
|
|
268
|
-
severity: SeverityLevelEnum;
|
|
161
|
+
type InstanceUpdateSubscriptionArgs = {
|
|
162
|
+
subscription: TopicSubscription;
|
|
163
|
+
name?: string;
|
|
164
|
+
preferences?: Array<PreferenceFilter>;
|
|
269
165
|
};
|
|
270
|
-
type
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
snoozed?: boolean;
|
|
275
|
-
seen?: boolean;
|
|
276
|
-
data?: Record<string, unknown>;
|
|
277
|
-
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
278
|
-
createdGte?: number;
|
|
279
|
-
createdLte?: number;
|
|
166
|
+
type UpdateSubscriptionArgs = BaseUpdateSubscriptionArgs | InstanceUpdateSubscriptionArgs;
|
|
167
|
+
type BaseSubscriptionPreferenceArgs = {
|
|
168
|
+
workflowId: string;
|
|
169
|
+
value: boolean | RulesLogic;
|
|
280
170
|
};
|
|
281
|
-
type
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
in_app?: boolean;
|
|
285
|
-
chat?: boolean;
|
|
286
|
-
push?: boolean;
|
|
171
|
+
type InstanceSubscriptionPreferenceArgs = {
|
|
172
|
+
preference: SubscriptionPreference;
|
|
173
|
+
value: boolean | RulesLogic;
|
|
287
174
|
};
|
|
288
|
-
type
|
|
289
|
-
|
|
290
|
-
|
|
175
|
+
type UpdateSubscriptionPreferenceArgs = BaseSubscriptionPreferenceArgs | InstanceSubscriptionPreferenceArgs;
|
|
176
|
+
type BaseDeleteSubscriptionArgs = {
|
|
177
|
+
identifier: string;
|
|
178
|
+
topicKey: string;
|
|
291
179
|
};
|
|
292
|
-
type
|
|
293
|
-
|
|
294
|
-
hours?: Array<TimeRange>;
|
|
180
|
+
type InstanceDeleteSubscriptionArgs = {
|
|
181
|
+
subscription: TopicSubscription;
|
|
295
182
|
};
|
|
296
|
-
type
|
|
297
|
-
monday?: DaySchedule;
|
|
298
|
-
tuesday?: DaySchedule;
|
|
299
|
-
wednesday?: DaySchedule;
|
|
300
|
-
thursday?: DaySchedule;
|
|
301
|
-
friday?: DaySchedule;
|
|
302
|
-
saturday?: DaySchedule;
|
|
303
|
-
sunday?: DaySchedule;
|
|
304
|
-
};
|
|
305
|
-
type DefaultSchedule = {
|
|
306
|
-
isEnabled?: boolean;
|
|
307
|
-
weeklySchedule?: WeeklySchedule;
|
|
308
|
-
};
|
|
309
|
-
type ContextValue = string | {
|
|
310
|
-
id: string;
|
|
311
|
-
data?: Record<string, unknown>;
|
|
312
|
-
};
|
|
313
|
-
type Context = Partial<Record<string, ContextValue>>;
|
|
314
|
-
type PreferencesResponse = {
|
|
315
|
-
level: PreferenceLevel;
|
|
316
|
-
enabled: boolean;
|
|
317
|
-
condition?: RulesLogic;
|
|
318
|
-
subscriptionId?: string;
|
|
319
|
-
channels: ChannelPreference;
|
|
320
|
-
overrides?: IPreferenceOverride[];
|
|
321
|
-
workflow?: Workflow;
|
|
322
|
-
schedule?: {
|
|
323
|
-
isEnabled: boolean;
|
|
324
|
-
weeklySchedule?: WeeklySchedule;
|
|
325
|
-
};
|
|
326
|
-
};
|
|
327
|
-
declare enum PreferenceOverrideSourceEnum {
|
|
328
|
-
SUBSCRIBER = "subscriber",
|
|
329
|
-
TEMPLATE = "template",
|
|
330
|
-
WORKFLOW_OVERRIDE = "workflowOverride"
|
|
331
|
-
}
|
|
332
|
-
type IPreferenceOverride = {
|
|
333
|
-
channel: ChannelType;
|
|
334
|
-
source: PreferenceOverrideSourceEnum;
|
|
335
|
-
};
|
|
336
|
-
type SubscriptionPreferenceResponse = Omit<PreferencesResponse, 'subscriptionId' | 'workflow' | 'schedule' | 'level' | 'channels'> & {
|
|
337
|
-
subscriptionId: string;
|
|
338
|
-
workflow: Workflow;
|
|
339
|
-
};
|
|
340
|
-
type SubscriptionResponse = {
|
|
341
|
-
id: string;
|
|
342
|
-
identifier: string;
|
|
343
|
-
name?: string;
|
|
344
|
-
preferences?: Array<SubscriptionPreferenceResponse>;
|
|
345
|
-
};
|
|
346
|
-
type Options = {
|
|
347
|
-
refetch?: boolean;
|
|
348
|
-
useCache?: boolean;
|
|
349
|
-
};
|
|
350
|
-
type Result<D = undefined, E = NovuError> = Promise<{
|
|
351
|
-
data?: D;
|
|
352
|
-
error?: E;
|
|
353
|
-
}>;
|
|
354
|
-
type KeylessNovuOptions = {} & {
|
|
355
|
-
[K in string]?: never;
|
|
356
|
-
};
|
|
357
|
-
type StandardNovuOptions = {
|
|
358
|
-
/** @deprecated Use apiUrl instead */
|
|
359
|
-
backendUrl?: string;
|
|
360
|
-
applicationIdentifier: string;
|
|
361
|
-
subscriberHash?: string;
|
|
362
|
-
contextHash?: string;
|
|
363
|
-
apiUrl?: string;
|
|
364
|
-
socketUrl?: string;
|
|
365
|
-
/**
|
|
366
|
-
* Custom socket configuration options. These options will be merged with the default socket configuration.
|
|
367
|
-
* Use `socketType` to explicitly select the socket implementation: `'cloud'` for PartySocket or `'self-hosted'` for socket.io.
|
|
368
|
-
* For socket.io-client connections, supports all socket.io-client options (e.g., `path`, `reconnectionDelay`, `timeout`, etc.).
|
|
369
|
-
* For PartySocket connections, options are applied to the WebSocket instance.
|
|
370
|
-
*/
|
|
371
|
-
socketOptions?: NovuSocketOptions;
|
|
372
|
-
useCache?: boolean;
|
|
373
|
-
defaultSchedule?: DefaultSchedule;
|
|
374
|
-
context?: Context;
|
|
375
|
-
} & ({
|
|
376
|
-
/** @deprecated Use subscriber prop instead */
|
|
377
|
-
subscriberId: string;
|
|
378
|
-
subscriber?: never;
|
|
379
|
-
} | {
|
|
380
|
-
subscriber: Subscriber | string;
|
|
381
|
-
subscriberId?: never;
|
|
382
|
-
});
|
|
383
|
-
type NovuOptions = KeylessNovuOptions | StandardNovuOptions;
|
|
384
|
-
type Prettify<T> = {
|
|
385
|
-
[K in keyof T]: T[K];
|
|
386
|
-
} & {};
|
|
183
|
+
type DeleteSubscriptionArgs = BaseDeleteSubscriptionArgs | InstanceDeleteSubscriptionArgs;
|
|
387
184
|
|
|
388
|
-
declare class
|
|
185
|
+
declare class SubscriptionsCache {
|
|
389
186
|
#private;
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
187
|
+
constructor({ emitterInstance, inboxServiceInstance, useCache, }: {
|
|
188
|
+
emitterInstance: NovuEventEmitter;
|
|
189
|
+
inboxServiceInstance: InboxService;
|
|
190
|
+
useCache: boolean;
|
|
191
|
+
});
|
|
192
|
+
private handleCreate;
|
|
193
|
+
private handleUpdate;
|
|
194
|
+
private handlePreferenceUpdate;
|
|
195
|
+
private handleBulkPreferenceUpdate;
|
|
196
|
+
private updateSubscriptionPreferences;
|
|
197
|
+
private createUpdatedSubscription;
|
|
198
|
+
private handleDelete;
|
|
199
|
+
private handleDeleteByIdentifier;
|
|
200
|
+
has(args: ListSubscriptionsArgs): boolean;
|
|
201
|
+
set(args: ListSubscriptionsArgs, data: TopicSubscription[]): void;
|
|
202
|
+
setOne(args: GetSubscriptionArgs, data: TopicSubscription): void;
|
|
203
|
+
getAll(args: ListSubscriptionsArgs): TopicSubscription[] | undefined;
|
|
204
|
+
get(args: GetSubscriptionArgs): TopicSubscription | undefined;
|
|
205
|
+
invalidate(args: {
|
|
206
|
+
topicKey: string;
|
|
207
|
+
}): void;
|
|
208
|
+
clearAll(): void;
|
|
398
209
|
}
|
|
399
210
|
|
|
400
211
|
declare class TopicSubscription {
|
|
@@ -415,214 +226,142 @@ declare class TopicSubscription {
|
|
|
415
226
|
delete(): Result<void>;
|
|
416
227
|
}
|
|
417
228
|
|
|
418
|
-
type
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
enabled?: boolean;
|
|
422
|
-
condition?: RulesLogic;
|
|
423
|
-
filter?: never;
|
|
424
|
-
};
|
|
425
|
-
type WorkflowGroupFilter = {
|
|
426
|
-
filter: {
|
|
427
|
-
workflowIds?: Array<WorkflowIdentifierOrId>;
|
|
428
|
-
tags?: string[];
|
|
429
|
-
};
|
|
430
|
-
enabled?: boolean;
|
|
431
|
-
condition?: RulesLogic;
|
|
432
|
-
workflowId?: never;
|
|
433
|
-
};
|
|
434
|
-
type PreferenceFilter = WorkflowIdentifierOrId | WorkflowFilter | WorkflowGroupFilter;
|
|
435
|
-
type ListSubscriptionsArgs = {
|
|
436
|
-
topicKey: string;
|
|
437
|
-
};
|
|
438
|
-
type GetSubscriptionArgs = {
|
|
439
|
-
topicKey: string;
|
|
440
|
-
identifier?: string;
|
|
441
|
-
workflowIds?: string[];
|
|
442
|
-
tags?: string[];
|
|
443
|
-
};
|
|
444
|
-
type CreateSubscriptionArgs = {
|
|
445
|
-
topicKey: string;
|
|
446
|
-
topicName?: string;
|
|
447
|
-
identifier?: string;
|
|
448
|
-
name?: string;
|
|
449
|
-
preferences?: Array<PreferenceFilter> | undefined;
|
|
450
|
-
};
|
|
451
|
-
type BaseUpdateSubscriptionArgs = {
|
|
452
|
-
topicKey: string;
|
|
453
|
-
identifier: string;
|
|
454
|
-
name?: string;
|
|
455
|
-
preferences?: Array<PreferenceFilter>;
|
|
229
|
+
type NovuPendingEvent<A, D = undefined> = {
|
|
230
|
+
args: A;
|
|
231
|
+
data?: D;
|
|
456
232
|
};
|
|
457
|
-
type
|
|
458
|
-
|
|
459
|
-
name?: string;
|
|
460
|
-
preferences?: Array<PreferenceFilter>;
|
|
233
|
+
type NovuResolvedEvent<A, D> = NovuPendingEvent<A, D> & {
|
|
234
|
+
error?: unknown;
|
|
461
235
|
};
|
|
462
|
-
type
|
|
463
|
-
type
|
|
464
|
-
|
|
465
|
-
|
|
236
|
+
type EventName<T extends string> = `${T}.pending` | `${T}.resolved`;
|
|
237
|
+
type EventStatus<T extends string> = `${T extends `${infer _}.${infer __}.${infer V}` ? V : never}`;
|
|
238
|
+
type EventObject<K extends string, ARGS, DATA, EVENT_STATUS = EventStatus<K>> = EVENT_STATUS extends 'pending' ? NovuPendingEvent<ARGS, DATA> : NovuResolvedEvent<ARGS, DATA>;
|
|
239
|
+
type BaseEvents<T extends string, ARGS, DATA> = {
|
|
240
|
+
[key in `${EventName<T>}`]: EventObject<key, ARGS, DATA>;
|
|
466
241
|
};
|
|
467
|
-
type
|
|
468
|
-
|
|
469
|
-
|
|
242
|
+
type SessionInitializeEvents = BaseEvents<'session.initialize', InitializeSessionArgs, Session>;
|
|
243
|
+
type NotificationsFetchEvents = BaseEvents<'notifications.list', ListNotificationsArgs, ListNotificationsResponse>;
|
|
244
|
+
type NotificationsFetchCountEvents = BaseEvents<'notifications.count', CountArgs, CountResponse>;
|
|
245
|
+
type NotificationReadEvents = BaseEvents<'notification.read', ReadArgs, Notification>;
|
|
246
|
+
type NotificationUnreadEvents = BaseEvents<'notification.unread', UnreadArgs, Notification>;
|
|
247
|
+
type NotificationSeenEvents = BaseEvents<'notification.seen', SeenArgs, Notification>;
|
|
248
|
+
type NotificationArchiveEvents = BaseEvents<'notification.archive', ArchivedArgs, Notification>;
|
|
249
|
+
type NotificationUnarchiveEvents = BaseEvents<'notification.unarchive', UnarchivedArgs, Notification>;
|
|
250
|
+
type NotificationDeleteEvents = BaseEvents<'notification.delete', DeletedArgs, Notification>;
|
|
251
|
+
type NotificationSnoozeEvents = BaseEvents<'notification.snooze', SnoozeArgs, Notification>;
|
|
252
|
+
type NotificationUnsnoozeEvents = BaseEvents<'notification.unsnooze', UnsnoozeArgs, Notification>;
|
|
253
|
+
type NotificationCompleteActionEvents = BaseEvents<'notification.complete_action', CompleteArgs, Notification>;
|
|
254
|
+
type NotificationRevertActionEvents = BaseEvents<'notification.revert_action', RevertArgs, Notification>;
|
|
255
|
+
type NotificationsReadAllEvents = BaseEvents<'notifications.read_all', {
|
|
256
|
+
tags?: TagsFilter;
|
|
257
|
+
data?: Record<string, unknown>;
|
|
258
|
+
}, Notification[]>;
|
|
259
|
+
type NotificationsSeenAllEvents = BaseEvents<'notifications.seen_all', {
|
|
260
|
+
notificationIds: string[];
|
|
261
|
+
} | {
|
|
262
|
+
tags?: TagsFilter;
|
|
263
|
+
data?: Record<string, unknown>;
|
|
264
|
+
} | {}, Notification[]>;
|
|
265
|
+
type NotificationsArchivedAllEvents = BaseEvents<'notifications.archive_all', {
|
|
266
|
+
tags?: TagsFilter;
|
|
267
|
+
data?: Record<string, unknown>;
|
|
268
|
+
}, Notification[]>;
|
|
269
|
+
type NotificationsReadArchivedAllEvents = BaseEvents<'notifications.archive_all_read', {
|
|
270
|
+
tags?: TagsFilter;
|
|
271
|
+
data?: Record<string, unknown>;
|
|
272
|
+
}, Notification[]>;
|
|
273
|
+
type NotificationsDeletedAllEvents = BaseEvents<'notifications.delete_all', {
|
|
274
|
+
tags?: TagsFilter;
|
|
275
|
+
data?: Record<string, unknown>;
|
|
276
|
+
}, Notification[]>;
|
|
277
|
+
type PreferencesFetchEvents = BaseEvents<'preferences.list', ListPreferencesArgs, Preference[]>;
|
|
278
|
+
type PreferenceUpdateEvents = BaseEvents<'preference.update', UpdatePreferenceArgs, Preference>;
|
|
279
|
+
type PreferencesBulkUpdateEvents = BaseEvents<'preferences.bulk_update', Array<UpdatePreferenceArgs>, Preference[]>;
|
|
280
|
+
type PreferenceScheduleGetEvents = BaseEvents<'preference.schedule.get', undefined, Schedule>;
|
|
281
|
+
type PreferenceScheduleUpdateEvents = BaseEvents<'preference.schedule.update', UpdateScheduleArgs, Schedule>;
|
|
282
|
+
type SubscriptionsFetchEvents = BaseEvents<'subscriptions.list', ListSubscriptionsArgs, TopicSubscription[]>;
|
|
283
|
+
type SubscriptionGetEvents = BaseEvents<'subscription.get', GetSubscriptionArgs, TopicSubscription | null>;
|
|
284
|
+
type SubscriptionCreateEvents = BaseEvents<'subscription.create', CreateSubscriptionArgs, TopicSubscription>;
|
|
285
|
+
type SubscriptionUpdateEvents = BaseEvents<'subscription.update', UpdateSubscriptionArgs, TopicSubscription>;
|
|
286
|
+
type SubscriptionPreferenceUpdateEvents = BaseEvents<'subscription.preference.update', UpdateSubscriptionPreferenceArgs, SubscriptionPreference>;
|
|
287
|
+
type SubscriptionPreferencesBulkUpdateEvents = BaseEvents<'subscription.preferences.bulk_update', Array<UpdateSubscriptionPreferenceArgs & {
|
|
288
|
+
subscriptionId: string;
|
|
289
|
+
}>, SubscriptionPreference[]>;
|
|
290
|
+
type SubscriptionDeleteEvents = BaseEvents<'subscription.delete', DeleteSubscriptionArgs, void>;
|
|
291
|
+
type ChannelConnectionOAuthUrlEvents = BaseEvents<'channel-connection.oauth-url', GenerateChatOAuthUrlArgs, {
|
|
292
|
+
url: string;
|
|
293
|
+
}>;
|
|
294
|
+
type ChannelConnectionsFetchEvents = BaseEvents<'channel-connections.list', ListChannelConnectionsArgs, ChannelConnectionResponse[]>;
|
|
295
|
+
type ChannelConnectionGetEvents = BaseEvents<'channel-connection.get', GetChannelConnectionArgs, ChannelConnectionResponse | null>;
|
|
296
|
+
type ChannelConnectionDeleteEvents = BaseEvents<'channel-connection.delete', DeleteChannelConnectionArgs, void>;
|
|
297
|
+
type ChannelEndpointsFetchEvents = BaseEvents<'channel-endpoints.list', ListChannelEndpointsArgs, ChannelEndpointResponse[]>;
|
|
298
|
+
type ChannelEndpointGetEvents = BaseEvents<'channel-endpoint.get', GetChannelEndpointArgs, ChannelEndpointResponse | null>;
|
|
299
|
+
type ChannelEndpointCreateEvents = BaseEvents<'channel-endpoint.create', CreateChannelEndpointArgs, ChannelEndpointResponse>;
|
|
300
|
+
type ChannelEndpointDeleteEvents = BaseEvents<'channel-endpoint.delete', DeleteChannelEndpointArgs, void>;
|
|
301
|
+
type SocketConnectEvents = BaseEvents<'socket.connect', {
|
|
302
|
+
socketUrl: string;
|
|
303
|
+
}, undefined>;
|
|
304
|
+
type NotificationReceivedEvent = `notifications.${WebSocketEvent.RECEIVED}`;
|
|
305
|
+
type NotificationUnseenEvent = `notifications.${WebSocketEvent.UNSEEN}`;
|
|
306
|
+
type NotificationUnreadEvent = `notifications.${WebSocketEvent.UNREAD}`;
|
|
307
|
+
type SocketEvents = {
|
|
308
|
+
[key in NotificationReceivedEvent]: {
|
|
309
|
+
result: Notification;
|
|
310
|
+
};
|
|
311
|
+
} & {
|
|
312
|
+
[key in NotificationUnseenEvent]: {
|
|
313
|
+
result: number;
|
|
314
|
+
};
|
|
315
|
+
} & {
|
|
316
|
+
[key in NotificationUnreadEvent]: {
|
|
317
|
+
result: {
|
|
318
|
+
total: number;
|
|
319
|
+
severity: Record<string, number>;
|
|
320
|
+
};
|
|
321
|
+
};
|
|
470
322
|
};
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
323
|
+
/**
|
|
324
|
+
* Events that are emitted by Novu Event Emitter.
|
|
325
|
+
*
|
|
326
|
+
* The event name consists of second pattern: module.action.status
|
|
327
|
+
* - module: the name of the module
|
|
328
|
+
* - action: the action that is being performed
|
|
329
|
+
* - status: the status of the action, could be pending or resolved
|
|
330
|
+
*
|
|
331
|
+
* Each event has a corresponding payload that is associated with the event:
|
|
332
|
+
* - pending: the args that are passed to the action and the optional optimistic value
|
|
333
|
+
* - resolved: the args that are passed to the action and the result of the action or the error that is thrown
|
|
334
|
+
*/
|
|
335
|
+
type Events = SessionInitializeEvents & NotificationsFetchEvents & {
|
|
336
|
+
'notifications.list.updated': {
|
|
337
|
+
data: ListNotificationsResponse;
|
|
338
|
+
};
|
|
339
|
+
} & NotificationsFetchCountEvents & PreferencesFetchEvents & {
|
|
340
|
+
'preferences.list.updated': {
|
|
341
|
+
data: Preference[];
|
|
342
|
+
};
|
|
343
|
+
} & PreferenceUpdateEvents & PreferencesBulkUpdateEvents & PreferenceScheduleGetEvents & PreferenceScheduleUpdateEvents & {
|
|
344
|
+
'preference.schedule.get.updated': {
|
|
345
|
+
data: Schedule;
|
|
346
|
+
};
|
|
347
|
+
} & SubscriptionsFetchEvents & SubscriptionGetEvents & SubscriptionCreateEvents & SubscriptionPreferenceUpdateEvents & SubscriptionUpdateEvents & SubscriptionPreferencesBulkUpdateEvents & SubscriptionDeleteEvents & {
|
|
348
|
+
'subscriptions.list.updated': {
|
|
349
|
+
data: {
|
|
350
|
+
topicKey: string;
|
|
351
|
+
subscriptions: TopicSubscription[];
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
} & ChannelConnectionOAuthUrlEvents & ChannelConnectionsFetchEvents & ChannelConnectionGetEvents & ChannelConnectionDeleteEvents & ChannelEndpointsFetchEvents & ChannelEndpointGetEvents & ChannelEndpointCreateEvents & ChannelEndpointDeleteEvents & SocketConnectEvents & SocketEvents & NotificationReadEvents & NotificationUnreadEvents & NotificationSeenEvents & NotificationArchiveEvents & NotificationUnarchiveEvents & NotificationDeleteEvents & NotificationSnoozeEvents & NotificationUnsnoozeEvents & NotificationCompleteActionEvents & NotificationRevertActionEvents & NotificationsReadAllEvents & NotificationsSeenAllEvents & NotificationsArchivedAllEvents & NotificationsReadArchivedAllEvents & NotificationsDeletedAllEvents;
|
|
355
|
+
type EventNames = keyof Events;
|
|
356
|
+
type SocketEventNames = keyof SocketEvents;
|
|
357
|
+
type EventHandler<T = unknown> = (event: T) => void;
|
|
480
358
|
|
|
481
|
-
|
|
482
|
-
declare class InboxService {
|
|
359
|
+
declare class NovuEventEmitter {
|
|
483
360
|
#private;
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
subscriberHash?: string;
|
|
489
|
-
contextHash?: string;
|
|
490
|
-
subscriber?: Subscriber;
|
|
491
|
-
defaultSchedule?: DefaultSchedule;
|
|
492
|
-
context?: Context;
|
|
493
|
-
}): Promise<Session>;
|
|
494
|
-
fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, seen, data, severity, createdGte, createdLte, }: {
|
|
495
|
-
tags?: TagsFilter;
|
|
496
|
-
read?: boolean;
|
|
497
|
-
archived?: boolean;
|
|
498
|
-
snoozed?: boolean;
|
|
499
|
-
seen?: boolean;
|
|
500
|
-
limit?: number;
|
|
501
|
-
after?: string;
|
|
502
|
-
offset?: number;
|
|
503
|
-
data?: Record<string, unknown>;
|
|
504
|
-
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
505
|
-
createdGte?: number;
|
|
506
|
-
createdLte?: number;
|
|
507
|
-
}): Promise<{
|
|
508
|
-
data: InboxNotification[];
|
|
509
|
-
hasMore: boolean;
|
|
510
|
-
filter: NotificationFilter;
|
|
511
|
-
}>;
|
|
512
|
-
count({ filters, }: {
|
|
513
|
-
filters: Array<{
|
|
514
|
-
tags?: TagsFilter;
|
|
515
|
-
read?: boolean;
|
|
516
|
-
archived?: boolean;
|
|
517
|
-
snoozed?: boolean;
|
|
518
|
-
seen?: boolean;
|
|
519
|
-
data?: Record<string, unknown>;
|
|
520
|
-
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
521
|
-
}>;
|
|
522
|
-
}): Promise<{
|
|
523
|
-
data: Array<{
|
|
524
|
-
count: number;
|
|
525
|
-
filter: NotificationFilter;
|
|
526
|
-
}>;
|
|
527
|
-
}>;
|
|
528
|
-
read(notificationId: string): Promise<InboxNotification>;
|
|
529
|
-
unread(notificationId: string): Promise<InboxNotification>;
|
|
530
|
-
archive(notificationId: string): Promise<InboxNotification>;
|
|
531
|
-
unarchive(notificationId: string): Promise<InboxNotification>;
|
|
532
|
-
snooze(notificationId: string, snoozeUntil: string): Promise<InboxNotification>;
|
|
533
|
-
unsnooze(notificationId: string): Promise<InboxNotification>;
|
|
534
|
-
readAll({ tags, data }: {
|
|
535
|
-
tags?: TagsFilter;
|
|
536
|
-
data?: Record<string, unknown>;
|
|
537
|
-
}): Promise<void>;
|
|
538
|
-
archiveAll({ tags, data }: {
|
|
539
|
-
tags?: TagsFilter;
|
|
540
|
-
data?: Record<string, unknown>;
|
|
541
|
-
}): Promise<void>;
|
|
542
|
-
archiveAllRead({ tags, data }: {
|
|
543
|
-
tags?: TagsFilter;
|
|
544
|
-
data?: Record<string, unknown>;
|
|
545
|
-
}): Promise<void>;
|
|
546
|
-
delete(notificationId: string): Promise<void>;
|
|
547
|
-
deleteAll({ tags, data }: {
|
|
548
|
-
tags?: TagsFilter;
|
|
549
|
-
data?: Record<string, unknown>;
|
|
550
|
-
}): Promise<void>;
|
|
551
|
-
markAsSeen({ notificationIds, tags, data, }: {
|
|
552
|
-
notificationIds?: string[];
|
|
553
|
-
tags?: TagsFilter;
|
|
554
|
-
data?: Record<string, unknown>;
|
|
555
|
-
}): Promise<void>;
|
|
556
|
-
seen(notificationId: string): Promise<void>;
|
|
557
|
-
completeAction({ actionType, notificationId, }: {
|
|
558
|
-
notificationId: string;
|
|
559
|
-
actionType: ActionTypeEnum;
|
|
560
|
-
}): Promise<InboxNotification>;
|
|
561
|
-
revertAction({ actionType, notificationId, }: {
|
|
562
|
-
notificationId: string;
|
|
563
|
-
actionType: ActionTypeEnum;
|
|
564
|
-
}): Promise<InboxNotification>;
|
|
565
|
-
fetchPreferences({ tags, severity, criticality, }: {
|
|
566
|
-
tags?: string[];
|
|
567
|
-
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
568
|
-
criticality: WorkflowCriticalityEnum;
|
|
569
|
-
}): Promise<PreferencesResponse[]>;
|
|
570
|
-
bulkUpdatePreferences(preferences: Array<{
|
|
571
|
-
workflowId: string;
|
|
572
|
-
} & ChannelPreference>): Promise<PreferencesResponse[]>;
|
|
573
|
-
updateGlobalPreferences(preferences: ChannelPreference & {
|
|
574
|
-
schedule?: {
|
|
575
|
-
isEnabled?: boolean;
|
|
576
|
-
weeklySchedule?: WeeklySchedule;
|
|
577
|
-
};
|
|
578
|
-
}): Promise<PreferencesResponse>;
|
|
579
|
-
updateWorkflowPreferences({ workflowId, channels, }: {
|
|
580
|
-
workflowId: string;
|
|
581
|
-
channels: ChannelPreference;
|
|
582
|
-
}): Promise<PreferencesResponse>;
|
|
583
|
-
fetchGlobalPreferences(): Promise<PreferencesResponse>;
|
|
584
|
-
triggerHelloWorldEvent(): Promise<unknown>;
|
|
585
|
-
fetchSubscriptions(topicKey: string): Promise<SubscriptionResponse[]>;
|
|
586
|
-
getSubscription(topicKey: string, identifier?: string, workflowIds?: string[], tags?: string[]): Promise<SubscriptionResponse | undefined>;
|
|
587
|
-
createSubscription({ identifier, name, topicKey, topicName, preferences, }: {
|
|
588
|
-
identifier?: string;
|
|
589
|
-
name?: string;
|
|
590
|
-
topicKey: string;
|
|
591
|
-
topicName?: string;
|
|
592
|
-
preferences?: Array<PreferenceFilter>;
|
|
593
|
-
}): Promise<SubscriptionResponse>;
|
|
594
|
-
updateSubscription({ topicKey, identifier, name, preferences, }: {
|
|
595
|
-
topicKey: string;
|
|
596
|
-
identifier: string;
|
|
597
|
-
name?: string;
|
|
598
|
-
preferences?: Array<PreferenceFilter>;
|
|
599
|
-
}): Promise<SubscriptionResponse>;
|
|
600
|
-
updateSubscriptionPreference({ subscriptionIdentifier, workflowId, enabled, condition, email, sms, in_app, chat, push, }: {
|
|
601
|
-
subscriptionIdentifier: string;
|
|
602
|
-
workflowId: string;
|
|
603
|
-
enabled?: boolean;
|
|
604
|
-
condition?: RulesLogic;
|
|
605
|
-
email?: boolean;
|
|
606
|
-
sms?: boolean;
|
|
607
|
-
in_app?: boolean;
|
|
608
|
-
chat?: boolean;
|
|
609
|
-
push?: boolean;
|
|
610
|
-
}): Promise<SubscriptionPreferenceResponse>;
|
|
611
|
-
bulkUpdateSubscriptionPreferences(preferences: Array<{
|
|
612
|
-
subscriptionIdentifier: string;
|
|
613
|
-
workflowId: string;
|
|
614
|
-
enabled?: boolean;
|
|
615
|
-
condition?: RulesLogic;
|
|
616
|
-
email?: boolean;
|
|
617
|
-
sms?: boolean;
|
|
618
|
-
in_app?: boolean;
|
|
619
|
-
chat?: boolean;
|
|
620
|
-
push?: boolean;
|
|
621
|
-
}>): Promise<SubscriptionPreferenceResponse[]>;
|
|
622
|
-
deleteSubscription({ topicKey, identifier }: {
|
|
623
|
-
topicKey: string;
|
|
624
|
-
identifier: string;
|
|
625
|
-
}): Promise<void>;
|
|
361
|
+
constructor();
|
|
362
|
+
on<Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>): () => void;
|
|
363
|
+
off<Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>): void;
|
|
364
|
+
emit<Key extends EventNames>(type: Key, event?: Events[Key]): void;
|
|
626
365
|
}
|
|
627
366
|
|
|
628
367
|
declare class Notification implements Pick<NovuEventEmitter, 'on'>, InboxNotification {
|
|
@@ -747,144 +486,509 @@ type UnsnoozeArgs = BaseArgs | InstanceArgs;
|
|
|
747
486
|
type CompleteArgs = BaseArgs | InstanceArgs;
|
|
748
487
|
type RevertArgs = BaseArgs | InstanceArgs;
|
|
749
488
|
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
489
|
+
declare global {
|
|
490
|
+
/**
|
|
491
|
+
* If you want to provide custom types for the notification.data object,
|
|
492
|
+
* simply redeclare this rule in the global namespace.
|
|
493
|
+
* Every notification object will use the provided type.
|
|
494
|
+
*/
|
|
495
|
+
interface NotificationData {
|
|
496
|
+
[k: string]: unknown;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
declare enum NotificationStatus {
|
|
500
|
+
READ = "read",
|
|
501
|
+
SEEN = "seen",
|
|
502
|
+
SNOOZED = "snoozed",
|
|
503
|
+
UNREAD = "unread",
|
|
504
|
+
UNSEEN = "unseen",
|
|
505
|
+
UNSNOOZED = "unsnoozed"
|
|
506
|
+
}
|
|
507
|
+
declare enum PreferenceLevel {
|
|
508
|
+
GLOBAL = "global",
|
|
509
|
+
TEMPLATE = "template"
|
|
510
|
+
}
|
|
511
|
+
declare enum ChannelType {
|
|
512
|
+
IN_APP = "in_app",
|
|
513
|
+
EMAIL = "email",
|
|
514
|
+
SMS = "sms",
|
|
515
|
+
CHAT = "chat",
|
|
516
|
+
PUSH = "push"
|
|
517
|
+
}
|
|
518
|
+
declare enum WebSocketEvent {
|
|
519
|
+
RECEIVED = "notification_received",
|
|
520
|
+
UNREAD = "unread_count_changed",
|
|
521
|
+
UNSEEN = "unseen_count_changed"
|
|
522
|
+
}
|
|
523
|
+
type SocketTypeOption = 'cloud' | 'self-hosted';
|
|
524
|
+
type NovuSocketOptions = {
|
|
525
|
+
socketType?: SocketTypeOption;
|
|
526
|
+
[key: string]: unknown;
|
|
760
527
|
};
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
528
|
+
declare enum SeverityLevelEnum {
|
|
529
|
+
HIGH = "high",
|
|
530
|
+
MEDIUM = "medium",
|
|
531
|
+
LOW = "low",
|
|
532
|
+
NONE = "none"
|
|
533
|
+
}
|
|
534
|
+
declare enum WorkflowCriticalityEnum {
|
|
535
|
+
CRITICAL = "critical",
|
|
536
|
+
NON_CRITICAL = "nonCritical",
|
|
537
|
+
ALL = "all"
|
|
538
|
+
}
|
|
539
|
+
type UnreadCount = {
|
|
540
|
+
total: number;
|
|
541
|
+
severity: Record<SeverityLevelEnum, number>;
|
|
765
542
|
};
|
|
766
|
-
type
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
543
|
+
type Session = {
|
|
544
|
+
token: string;
|
|
545
|
+
/** @deprecated Use unreadCount.total instead */
|
|
546
|
+
totalUnreadCount: number;
|
|
547
|
+
unreadCount: UnreadCount;
|
|
548
|
+
removeNovuBranding: boolean;
|
|
549
|
+
isDevelopmentMode: boolean;
|
|
550
|
+
maxSnoozeDurationHours: number;
|
|
551
|
+
applicationIdentifier?: string;
|
|
552
|
+
contextKeys?: string[];
|
|
774
553
|
};
|
|
775
|
-
type
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
type NotificationSnoozeEvents = BaseEvents<'notification.snooze', SnoozeArgs, Notification>;
|
|
785
|
-
type NotificationUnsnoozeEvents = BaseEvents<'notification.unsnooze', UnsnoozeArgs, Notification>;
|
|
786
|
-
type NotificationCompleteActionEvents = BaseEvents<'notification.complete_action', CompleteArgs, Notification>;
|
|
787
|
-
type NotificationRevertActionEvents = BaseEvents<'notification.revert_action', RevertArgs, Notification>;
|
|
788
|
-
type NotificationsReadAllEvents = BaseEvents<'notifications.read_all', {
|
|
789
|
-
tags?: TagsFilter;
|
|
790
|
-
data?: Record<string, unknown>;
|
|
791
|
-
}, Notification[]>;
|
|
792
|
-
type NotificationsSeenAllEvents = BaseEvents<'notifications.seen_all', {
|
|
793
|
-
notificationIds: string[];
|
|
794
|
-
} | {
|
|
795
|
-
tags?: TagsFilter;
|
|
796
|
-
data?: Record<string, unknown>;
|
|
797
|
-
} | {}, Notification[]>;
|
|
798
|
-
type NotificationsArchivedAllEvents = BaseEvents<'notifications.archive_all', {
|
|
799
|
-
tags?: TagsFilter;
|
|
800
|
-
data?: Record<string, unknown>;
|
|
801
|
-
}, Notification[]>;
|
|
802
|
-
type NotificationsReadArchivedAllEvents = BaseEvents<'notifications.archive_all_read', {
|
|
803
|
-
tags?: TagsFilter;
|
|
804
|
-
data?: Record<string, unknown>;
|
|
805
|
-
}, Notification[]>;
|
|
806
|
-
type NotificationsDeletedAllEvents = BaseEvents<'notifications.delete_all', {
|
|
807
|
-
tags?: TagsFilter;
|
|
554
|
+
type Subscriber = {
|
|
555
|
+
id?: string;
|
|
556
|
+
subscriberId: string;
|
|
557
|
+
firstName?: string;
|
|
558
|
+
lastName?: string;
|
|
559
|
+
email?: string;
|
|
560
|
+
phone?: string;
|
|
561
|
+
avatar?: string;
|
|
562
|
+
locale?: string;
|
|
808
563
|
data?: Record<string, unknown>;
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
type
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
type
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
type
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
};
|
|
838
|
-
} & {
|
|
839
|
-
[key in NotificationUnreadEvent]: {
|
|
840
|
-
result: {
|
|
841
|
-
total: number;
|
|
842
|
-
severity: Record<string, number>;
|
|
843
|
-
};
|
|
844
|
-
};
|
|
564
|
+
timezone?: string;
|
|
565
|
+
};
|
|
566
|
+
type Redirect = {
|
|
567
|
+
url: string;
|
|
568
|
+
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop';
|
|
569
|
+
};
|
|
570
|
+
declare enum ActionTypeEnum {
|
|
571
|
+
PRIMARY = "primary",
|
|
572
|
+
SECONDARY = "secondary"
|
|
573
|
+
}
|
|
574
|
+
type Action = {
|
|
575
|
+
label: string;
|
|
576
|
+
isCompleted: boolean;
|
|
577
|
+
redirect?: Redirect;
|
|
578
|
+
};
|
|
579
|
+
type Workflow = {
|
|
580
|
+
id: string;
|
|
581
|
+
identifier: string;
|
|
582
|
+
name: string;
|
|
583
|
+
critical: boolean;
|
|
584
|
+
tags?: string[];
|
|
585
|
+
severity: SeverityLevelEnum;
|
|
586
|
+
};
|
|
587
|
+
type TagsFilterOrGroup = {
|
|
588
|
+
or: string[];
|
|
589
|
+
};
|
|
590
|
+
type TagsFilterAndForm = {
|
|
591
|
+
and: TagsFilterOrGroup[];
|
|
845
592
|
};
|
|
846
593
|
/**
|
|
847
|
-
*
|
|
594
|
+
* Inbox tag filter: a **single** OR-group as `string[]` or `{ or: string[] }`, or **multiple** OR-groups (AND of OR) as `{ and: [{ or: string[] }, ...] }`.
|
|
848
595
|
*
|
|
849
|
-
*
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
*
|
|
596
|
+
* @example Single OR-group — match notifications tagged `promo` **or** `sale`
|
|
597
|
+
* ```ts
|
|
598
|
+
* const tags: TagsFilter = ['promo', 'sale'];
|
|
599
|
+
* ```
|
|
853
600
|
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
*
|
|
601
|
+
* @example AND of OR-groups — match (`urgent` **or** `critical`) **and** (`billing`)
|
|
602
|
+
* ```ts
|
|
603
|
+
* const tags: TagsFilter = {
|
|
604
|
+
* and: [{ or: ['urgent', 'critical'] }, { or: ['billing'] }],
|
|
605
|
+
* };
|
|
606
|
+
* ```
|
|
857
607
|
*/
|
|
858
|
-
type
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
608
|
+
type TagsFilter = string[] | TagsFilterOrGroup | TagsFilterAndForm;
|
|
609
|
+
type InboxNotification = {
|
|
610
|
+
id: string;
|
|
611
|
+
transactionId: string;
|
|
612
|
+
subject?: string;
|
|
613
|
+
body: string;
|
|
614
|
+
to: Subscriber;
|
|
615
|
+
isRead: boolean;
|
|
616
|
+
isSeen: boolean;
|
|
617
|
+
isArchived: boolean;
|
|
618
|
+
isSnoozed: boolean;
|
|
619
|
+
snoozedUntil?: string | null;
|
|
620
|
+
deliveredAt?: string[];
|
|
621
|
+
createdAt: string;
|
|
622
|
+
readAt?: string | null;
|
|
623
|
+
firstSeenAt?: string | null;
|
|
624
|
+
archivedAt?: string | null;
|
|
625
|
+
avatar?: string;
|
|
626
|
+
primaryAction?: Action;
|
|
627
|
+
secondaryAction?: Action;
|
|
628
|
+
channelType: ChannelType;
|
|
629
|
+
tags?: string[];
|
|
630
|
+
data?: NotificationData;
|
|
631
|
+
redirect?: Redirect;
|
|
632
|
+
workflow?: Workflow;
|
|
633
|
+
severity: SeverityLevelEnum;
|
|
634
|
+
};
|
|
635
|
+
type NotificationFilter = {
|
|
636
|
+
tags?: TagsFilter;
|
|
637
|
+
read?: boolean;
|
|
638
|
+
archived?: boolean;
|
|
639
|
+
snoozed?: boolean;
|
|
640
|
+
seen?: boolean;
|
|
641
|
+
data?: Record<string, unknown>;
|
|
642
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
643
|
+
createdGte?: number;
|
|
644
|
+
createdLte?: number;
|
|
645
|
+
};
|
|
646
|
+
type ChannelPreference = {
|
|
647
|
+
email?: boolean;
|
|
648
|
+
sms?: boolean;
|
|
649
|
+
in_app?: boolean;
|
|
650
|
+
chat?: boolean;
|
|
651
|
+
push?: boolean;
|
|
652
|
+
};
|
|
653
|
+
type TimeRange = {
|
|
654
|
+
start: string;
|
|
655
|
+
end: string;
|
|
656
|
+
};
|
|
657
|
+
type DaySchedule = {
|
|
658
|
+
isEnabled: boolean;
|
|
659
|
+
hours?: Array<TimeRange>;
|
|
660
|
+
};
|
|
661
|
+
type WeeklySchedule = {
|
|
662
|
+
monday?: DaySchedule;
|
|
663
|
+
tuesday?: DaySchedule;
|
|
664
|
+
wednesday?: DaySchedule;
|
|
665
|
+
thursday?: DaySchedule;
|
|
666
|
+
friday?: DaySchedule;
|
|
667
|
+
saturday?: DaySchedule;
|
|
668
|
+
sunday?: DaySchedule;
|
|
669
|
+
};
|
|
670
|
+
type DefaultSchedule = {
|
|
671
|
+
isEnabled?: boolean;
|
|
672
|
+
weeklySchedule?: WeeklySchedule;
|
|
673
|
+
};
|
|
674
|
+
type ContextValue = string | {
|
|
675
|
+
id: string;
|
|
676
|
+
data?: Record<string, unknown>;
|
|
677
|
+
};
|
|
678
|
+
type Context = Partial<Record<string, ContextValue>>;
|
|
679
|
+
type PreferencesResponse = {
|
|
680
|
+
level: PreferenceLevel;
|
|
681
|
+
enabled: boolean;
|
|
682
|
+
condition?: RulesLogic;
|
|
683
|
+
subscriptionId?: string;
|
|
684
|
+
channels: ChannelPreference;
|
|
685
|
+
overrides?: IPreferenceOverride[];
|
|
686
|
+
workflow?: Workflow;
|
|
687
|
+
schedule?: {
|
|
688
|
+
isEnabled: boolean;
|
|
689
|
+
weeklySchedule?: WeeklySchedule;
|
|
865
690
|
};
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
|
|
691
|
+
};
|
|
692
|
+
declare enum PreferenceOverrideSourceEnum {
|
|
693
|
+
SUBSCRIBER = "subscriber",
|
|
694
|
+
TEMPLATE = "template",
|
|
695
|
+
WORKFLOW_OVERRIDE = "workflowOverride"
|
|
696
|
+
}
|
|
697
|
+
type IPreferenceOverride = {
|
|
698
|
+
channel: ChannelType;
|
|
699
|
+
source: PreferenceOverrideSourceEnum;
|
|
700
|
+
};
|
|
701
|
+
type SubscriptionPreferenceResponse = Omit<PreferencesResponse, 'subscriptionId' | 'workflow' | 'schedule' | 'level' | 'channels'> & {
|
|
702
|
+
subscriptionId: string;
|
|
703
|
+
workflow: Workflow;
|
|
704
|
+
};
|
|
705
|
+
type SubscriptionResponse = {
|
|
706
|
+
id: string;
|
|
707
|
+
identifier: string;
|
|
708
|
+
name?: string;
|
|
709
|
+
preferences?: Array<SubscriptionPreferenceResponse>;
|
|
710
|
+
};
|
|
711
|
+
type Options = {
|
|
712
|
+
refetch?: boolean;
|
|
713
|
+
useCache?: boolean;
|
|
714
|
+
};
|
|
715
|
+
type Result<D = undefined, E = NovuError> = Promise<{
|
|
716
|
+
data?: D;
|
|
717
|
+
error?: E;
|
|
718
|
+
}>;
|
|
719
|
+
type KeylessNovuOptions = {} & {
|
|
720
|
+
[K in string]?: never;
|
|
721
|
+
};
|
|
722
|
+
type StandardNovuOptions = {
|
|
723
|
+
/** @deprecated Use apiUrl instead */
|
|
724
|
+
backendUrl?: string;
|
|
725
|
+
applicationIdentifier: string;
|
|
726
|
+
subscriberHash?: string;
|
|
727
|
+
contextHash?: string;
|
|
728
|
+
apiUrl?: string;
|
|
729
|
+
socketUrl?: string;
|
|
730
|
+
/**
|
|
731
|
+
* Custom socket configuration options. These options will be merged with the default socket configuration.
|
|
732
|
+
* Use `socketType` to explicitly select the socket implementation: `'cloud'` for PartySocket or `'self-hosted'` for socket.io.
|
|
733
|
+
* For socket.io-client connections, supports all socket.io-client options (e.g., `path`, `reconnectionDelay`, `timeout`, etc.).
|
|
734
|
+
* For PartySocket connections, options are applied to the WebSocket instance.
|
|
735
|
+
*/
|
|
736
|
+
socketOptions?: NovuSocketOptions;
|
|
737
|
+
useCache?: boolean;
|
|
738
|
+
defaultSchedule?: DefaultSchedule;
|
|
739
|
+
context?: Context;
|
|
740
|
+
} & ({
|
|
741
|
+
/** @deprecated Use subscriber prop instead */
|
|
742
|
+
subscriberId: string;
|
|
743
|
+
subscriber?: never;
|
|
744
|
+
} | {
|
|
745
|
+
subscriber: Subscriber | string;
|
|
746
|
+
subscriberId?: never;
|
|
747
|
+
});
|
|
748
|
+
type NovuOptions = KeylessNovuOptions | StandardNovuOptions;
|
|
749
|
+
type Prettify<T> = {
|
|
750
|
+
[K in keyof T]: T[K];
|
|
751
|
+
} & {};
|
|
752
|
+
|
|
753
|
+
type ChannelConnectionResponse = {
|
|
754
|
+
identifier: string;
|
|
755
|
+
};
|
|
756
|
+
type ChannelEndpointResponse = {
|
|
757
|
+
identifier: string;
|
|
758
|
+
type: string;
|
|
759
|
+
};
|
|
760
|
+
type OAuthMode = 'connect' | 'link_user';
|
|
761
|
+
type ConnectionMode = 'subscriber' | 'shared';
|
|
762
|
+
type GenerateChatOAuthUrlArgs = {
|
|
763
|
+
integrationIdentifier: string;
|
|
764
|
+
connectionIdentifier?: string;
|
|
765
|
+
subscriberId?: string;
|
|
766
|
+
context?: Context;
|
|
767
|
+
scope?: string[];
|
|
768
|
+
userScope?: string[];
|
|
769
|
+
mode?: OAuthMode;
|
|
770
|
+
connectionMode?: ConnectionMode;
|
|
771
|
+
};
|
|
772
|
+
type ListChannelConnectionsArgs = {
|
|
773
|
+
subscriberId?: string;
|
|
774
|
+
integrationIdentifier?: string;
|
|
775
|
+
channel?: string;
|
|
776
|
+
providerId?: string;
|
|
777
|
+
contextKeys?: string[];
|
|
778
|
+
limit?: number;
|
|
779
|
+
after?: string;
|
|
780
|
+
before?: string;
|
|
781
|
+
};
|
|
782
|
+
type GetChannelConnectionArgs = {
|
|
783
|
+
identifier: string;
|
|
784
|
+
};
|
|
785
|
+
type CreateChannelConnectionArgs = {
|
|
786
|
+
identifier?: string;
|
|
787
|
+
integrationIdentifier: string;
|
|
788
|
+
subscriberId?: string;
|
|
789
|
+
context?: Context;
|
|
790
|
+
workspace: {
|
|
791
|
+
id: string;
|
|
792
|
+
name?: string;
|
|
869
793
|
};
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
data: {
|
|
873
|
-
topicKey: string;
|
|
874
|
-
subscriptions: TopicSubscription[];
|
|
875
|
-
};
|
|
794
|
+
auth: {
|
|
795
|
+
accessToken: string;
|
|
876
796
|
};
|
|
877
|
-
}
|
|
878
|
-
type
|
|
879
|
-
|
|
880
|
-
|
|
797
|
+
};
|
|
798
|
+
type DeleteChannelConnectionArgs = {
|
|
799
|
+
identifier: string;
|
|
800
|
+
};
|
|
801
|
+
type ListChannelEndpointsArgs = {
|
|
802
|
+
subscriberId?: string;
|
|
803
|
+
integrationIdentifier?: string;
|
|
804
|
+
connectionIdentifier?: string;
|
|
805
|
+
channel?: string;
|
|
806
|
+
providerId?: string;
|
|
807
|
+
contextKeys?: string[];
|
|
808
|
+
limit?: number;
|
|
809
|
+
after?: string;
|
|
810
|
+
before?: string;
|
|
811
|
+
};
|
|
812
|
+
type GetChannelEndpointArgs = {
|
|
813
|
+
identifier: string;
|
|
814
|
+
};
|
|
815
|
+
type CreateChannelEndpointArgs = {
|
|
816
|
+
identifier?: string;
|
|
817
|
+
integrationIdentifier: string;
|
|
818
|
+
connectionIdentifier?: string;
|
|
819
|
+
subscriberId: string;
|
|
820
|
+
context?: Context;
|
|
821
|
+
type: string;
|
|
822
|
+
endpoint: Record<string, string>;
|
|
823
|
+
};
|
|
824
|
+
type DeleteChannelEndpointArgs = {
|
|
825
|
+
identifier: string;
|
|
826
|
+
};
|
|
881
827
|
|
|
882
|
-
|
|
828
|
+
type InboxServiceOptions = HttpClientOptions;
|
|
829
|
+
declare class InboxService {
|
|
883
830
|
#private;
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
831
|
+
isSessionInitialized: boolean;
|
|
832
|
+
constructor(options?: InboxServiceOptions);
|
|
833
|
+
initializeSession({ applicationIdentifier, subscriberHash, contextHash, subscriber, defaultSchedule, context, }: {
|
|
834
|
+
applicationIdentifier?: string;
|
|
835
|
+
subscriberHash?: string;
|
|
836
|
+
contextHash?: string;
|
|
837
|
+
subscriber?: Subscriber;
|
|
838
|
+
defaultSchedule?: DefaultSchedule;
|
|
839
|
+
context?: Context;
|
|
840
|
+
}): Promise<Session>;
|
|
841
|
+
fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, seen, data, severity, createdGte, createdLte, }: {
|
|
842
|
+
tags?: TagsFilter;
|
|
843
|
+
read?: boolean;
|
|
844
|
+
archived?: boolean;
|
|
845
|
+
snoozed?: boolean;
|
|
846
|
+
seen?: boolean;
|
|
847
|
+
limit?: number;
|
|
848
|
+
after?: string;
|
|
849
|
+
offset?: number;
|
|
850
|
+
data?: Record<string, unknown>;
|
|
851
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
852
|
+
createdGte?: number;
|
|
853
|
+
createdLte?: number;
|
|
854
|
+
}): Promise<{
|
|
855
|
+
data: InboxNotification[];
|
|
856
|
+
hasMore: boolean;
|
|
857
|
+
filter: NotificationFilter;
|
|
858
|
+
}>;
|
|
859
|
+
count({ filters, }: {
|
|
860
|
+
filters: Array<{
|
|
861
|
+
tags?: TagsFilter;
|
|
862
|
+
read?: boolean;
|
|
863
|
+
archived?: boolean;
|
|
864
|
+
snoozed?: boolean;
|
|
865
|
+
seen?: boolean;
|
|
866
|
+
data?: Record<string, unknown>;
|
|
867
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
868
|
+
}>;
|
|
869
|
+
}): Promise<{
|
|
870
|
+
data: Array<{
|
|
871
|
+
count: number;
|
|
872
|
+
filter: NotificationFilter;
|
|
873
|
+
}>;
|
|
874
|
+
}>;
|
|
875
|
+
read(notificationId: string): Promise<InboxNotification>;
|
|
876
|
+
unread(notificationId: string): Promise<InboxNotification>;
|
|
877
|
+
archive(notificationId: string): Promise<InboxNotification>;
|
|
878
|
+
unarchive(notificationId: string): Promise<InboxNotification>;
|
|
879
|
+
snooze(notificationId: string, snoozeUntil: string): Promise<InboxNotification>;
|
|
880
|
+
unsnooze(notificationId: string): Promise<InboxNotification>;
|
|
881
|
+
readAll({ tags, data }: {
|
|
882
|
+
tags?: TagsFilter;
|
|
883
|
+
data?: Record<string, unknown>;
|
|
884
|
+
}): Promise<void>;
|
|
885
|
+
archiveAll({ tags, data }: {
|
|
886
|
+
tags?: TagsFilter;
|
|
887
|
+
data?: Record<string, unknown>;
|
|
888
|
+
}): Promise<void>;
|
|
889
|
+
archiveAllRead({ tags, data }: {
|
|
890
|
+
tags?: TagsFilter;
|
|
891
|
+
data?: Record<string, unknown>;
|
|
892
|
+
}): Promise<void>;
|
|
893
|
+
delete(notificationId: string): Promise<void>;
|
|
894
|
+
deleteAll({ tags, data }: {
|
|
895
|
+
tags?: TagsFilter;
|
|
896
|
+
data?: Record<string, unknown>;
|
|
897
|
+
}): Promise<void>;
|
|
898
|
+
markAsSeen({ notificationIds, tags, data, }: {
|
|
899
|
+
notificationIds?: string[];
|
|
900
|
+
tags?: TagsFilter;
|
|
901
|
+
data?: Record<string, unknown>;
|
|
902
|
+
}): Promise<void>;
|
|
903
|
+
seen(notificationId: string): Promise<void>;
|
|
904
|
+
completeAction({ actionType, notificationId, }: {
|
|
905
|
+
notificationId: string;
|
|
906
|
+
actionType: ActionTypeEnum;
|
|
907
|
+
}): Promise<InboxNotification>;
|
|
908
|
+
revertAction({ actionType, notificationId, }: {
|
|
909
|
+
notificationId: string;
|
|
910
|
+
actionType: ActionTypeEnum;
|
|
911
|
+
}): Promise<InboxNotification>;
|
|
912
|
+
fetchPreferences({ tags, severity, criticality, }: {
|
|
913
|
+
tags?: string[];
|
|
914
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
915
|
+
criticality: WorkflowCriticalityEnum;
|
|
916
|
+
}): Promise<PreferencesResponse[]>;
|
|
917
|
+
bulkUpdatePreferences(preferences: Array<{
|
|
918
|
+
workflowId: string;
|
|
919
|
+
} & ChannelPreference>): Promise<PreferencesResponse[]>;
|
|
920
|
+
updateGlobalPreferences(preferences: ChannelPreference & {
|
|
921
|
+
schedule?: {
|
|
922
|
+
isEnabled?: boolean;
|
|
923
|
+
weeklySchedule?: WeeklySchedule;
|
|
924
|
+
};
|
|
925
|
+
}): Promise<PreferencesResponse>;
|
|
926
|
+
updateWorkflowPreferences({ workflowId, channels, }: {
|
|
927
|
+
workflowId: string;
|
|
928
|
+
channels: ChannelPreference;
|
|
929
|
+
}): Promise<PreferencesResponse>;
|
|
930
|
+
fetchGlobalPreferences(): Promise<PreferencesResponse>;
|
|
931
|
+
triggerHelloWorldEvent(): Promise<unknown>;
|
|
932
|
+
fetchSubscriptions(topicKey: string): Promise<SubscriptionResponse[]>;
|
|
933
|
+
getSubscription(topicKey: string, identifier?: string, workflowIds?: string[], tags?: string[]): Promise<SubscriptionResponse | undefined>;
|
|
934
|
+
createSubscription({ identifier, name, topicKey, topicName, preferences, }: {
|
|
935
|
+
identifier?: string;
|
|
936
|
+
name?: string;
|
|
937
|
+
topicKey: string;
|
|
938
|
+
topicName?: string;
|
|
939
|
+
preferences?: Array<PreferenceFilter>;
|
|
940
|
+
}): Promise<SubscriptionResponse>;
|
|
941
|
+
updateSubscription({ topicKey, identifier, name, preferences, }: {
|
|
942
|
+
topicKey: string;
|
|
943
|
+
identifier: string;
|
|
944
|
+
name?: string;
|
|
945
|
+
preferences?: Array<PreferenceFilter>;
|
|
946
|
+
}): Promise<SubscriptionResponse>;
|
|
947
|
+
updateSubscriptionPreference({ subscriptionIdentifier, workflowId, enabled, condition, email, sms, in_app, chat, push, }: {
|
|
948
|
+
subscriptionIdentifier: string;
|
|
949
|
+
workflowId: string;
|
|
950
|
+
enabled?: boolean;
|
|
951
|
+
condition?: RulesLogic;
|
|
952
|
+
email?: boolean;
|
|
953
|
+
sms?: boolean;
|
|
954
|
+
in_app?: boolean;
|
|
955
|
+
chat?: boolean;
|
|
956
|
+
push?: boolean;
|
|
957
|
+
}): Promise<SubscriptionPreferenceResponse>;
|
|
958
|
+
bulkUpdateSubscriptionPreferences(preferences: Array<{
|
|
959
|
+
subscriptionIdentifier: string;
|
|
960
|
+
workflowId: string;
|
|
961
|
+
enabled?: boolean;
|
|
962
|
+
condition?: RulesLogic;
|
|
963
|
+
email?: boolean;
|
|
964
|
+
sms?: boolean;
|
|
965
|
+
in_app?: boolean;
|
|
966
|
+
chat?: boolean;
|
|
967
|
+
push?: boolean;
|
|
968
|
+
}>): Promise<SubscriptionPreferenceResponse[]>;
|
|
969
|
+
deleteSubscription({ topicKey, identifier }: {
|
|
970
|
+
topicKey: string;
|
|
971
|
+
identifier: string;
|
|
972
|
+
}): Promise<void>;
|
|
973
|
+
generateChatOAuthUrl({ integrationIdentifier, connectionIdentifier, subscriberId, context, scope, userScope, mode, connectionMode, }: GenerateChatOAuthUrlArgs): Promise<{
|
|
974
|
+
url: string;
|
|
975
|
+
}>;
|
|
976
|
+
listChannelConnections(args?: ListChannelConnectionsArgs): Promise<{
|
|
977
|
+
data: ChannelConnectionResponse[];
|
|
978
|
+
next?: string;
|
|
979
|
+
previous?: string;
|
|
980
|
+
}>;
|
|
981
|
+
getChannelConnection(identifier: string): Promise<ChannelConnectionResponse>;
|
|
982
|
+
createChannelConnection({ identifier, integrationIdentifier, subscriberId, context, workspace, auth, }: CreateChannelConnectionArgs): Promise<ChannelConnectionResponse>;
|
|
983
|
+
deleteChannelConnection(identifier: string): Promise<void>;
|
|
984
|
+
listChannelEndpoints(args?: ListChannelEndpointsArgs): Promise<{
|
|
985
|
+
data: ChannelEndpointResponse[];
|
|
986
|
+
next?: string;
|
|
987
|
+
previous?: string;
|
|
988
|
+
}>;
|
|
989
|
+
getChannelEndpoint(identifier: string): Promise<ChannelEndpointResponse>;
|
|
990
|
+
createChannelEndpoint({ identifier, integrationIdentifier, connectionIdentifier, subscriberId, context, type, endpoint, }: CreateChannelEndpointArgs): Promise<ChannelEndpointResponse>;
|
|
991
|
+
deleteChannelEndpoint(identifier: string): Promise<void>;
|
|
888
992
|
}
|
|
889
993
|
|
|
890
|
-
export {
|
|
994
|
+
export { type UpdateSubscriptionPreferenceArgs as $, type PreferenceFilter as A, type BaseDeleteSubscriptionArgs as B, type ChannelConnectionResponse as C, type DaySchedule as D, type EventHandler as E, type FiltersCountResponse as F, type GenerateChatOAuthUrlArgs as G, PreferenceLevel as H, type InboxNotification as I, type PreferencesResponse as J, Schedule as K, type ListChannelConnectionsArgs as L, type SocketEventNames as M, Notification as N, type SocketTypeOption as O, Preference as P, type StandardNovuOptions as Q, type Subscriber as R, SeverityLevelEnum as S, type TagsFilter as T, SubscriptionPreference as U, type TagsFilterAndForm as V, type TagsFilterOrGroup as W, type TimeRange as X, TopicSubscription as Y, type UnreadCount as Z, type UpdateSubscriptionArgs as _, type NotificationFilter as a, WebSocketEvent as a0, type WeeklySchedule as a1, WorkflowCriticalityEnum as a2, type WorkflowFilter as a3, type WorkflowGroupFilter as a4, type WorkflowIdentifierOrId as a5, type ConnectionMode as a6, InboxService as a7, NovuEventEmitter as a8, type Session as a9, type Result as aa, ScheduleCache as ab, type UpdateScheduleArgs as ac, PreferencesCache as ad, type ListPreferencesArgs as ae, type BasePreferenceArgs as af, type InstancePreferenceArgs as ag, type ListNotificationsArgs as ah, type FilterCountArgs as ai, type FilterCountResponse as aj, type FiltersCountArgs as ak, type BaseArgs as al, type InstanceArgs as am, type SnoozeArgs as an, SubscriptionsCache as ao, type Options as ap, type EventNames as aq, type ContextValue as ar, type BaseUpdateSubscriptionArgs as b, type ChannelEndpointResponse as c, type ChannelPreference as d, ChannelType as e, type Context as f, type CreateChannelConnectionArgs as g, type CreateChannelEndpointArgs as h, type CreateSubscriptionArgs as i, type DefaultSchedule as j, type DeleteChannelConnectionArgs as k, type DeleteChannelEndpointArgs as l, type DeleteSubscriptionArgs as m, type Events as n, type GetChannelConnectionArgs as o, type GetChannelEndpointArgs as p, type GetSubscriptionArgs as q, type InstanceDeleteSubscriptionArgs as r, type InstanceUpdateSubscriptionArgs as s, type ListChannelEndpointsArgs as t, type ListNotificationsResponse as u, type ListSubscriptionsArgs as v, NotificationStatus as w, NovuError as x, type NovuOptions as y, type NovuSocketOptions as z };
|