@novu/js 2.3.1 → 2.4.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.
@@ -0,0 +1,33 @@
1
+ // src/ui/internal/parseMarkdown.tsx
2
+ var parseMarkdownIntoTokens = (text) => {
3
+ const tokens = [];
4
+ let buffer = "";
5
+ let inBold = false;
6
+ for (let i = 0; i < text.length; i += 1) {
7
+ if (text[i] === "\\" && text[i + 1] === "*") {
8
+ buffer += "*";
9
+ i += 1;
10
+ } else if (text[i] === "*" && text[i + 1] === "*") {
11
+ if (buffer) {
12
+ tokens.push({
13
+ type: inBold ? "bold" : "text",
14
+ content: buffer
15
+ });
16
+ buffer = "";
17
+ }
18
+ inBold = !inBold;
19
+ i += 1;
20
+ } else {
21
+ buffer += text[i];
22
+ }
23
+ }
24
+ if (buffer) {
25
+ tokens.push({
26
+ type: inBold ? "bold" : "text",
27
+ content: buffer
28
+ });
29
+ }
30
+ return tokens;
31
+ };
32
+
33
+ export { parseMarkdownIntoTokens };
@@ -1418,7 +1418,8 @@ var InboxService = class {
1418
1418
  __privateAdd(this, _httpClient);
1419
1419
  __privateSet(this, _httpClient, new HttpClient(options));
1420
1420
  __privateGet(this, _httpClient).updateHeaders({
1421
- "Novu-API-Version": NOVU_API_VERSION
1421
+ "Novu-API-Version": NOVU_API_VERSION,
1422
+ "Novu-User-Agent": options.userAgent || "@novu/js"
1422
1423
  });
1423
1424
  }
1424
1425
  initializeSession(_0) {
@@ -1524,6 +1525,9 @@ var InboxService = class {
1524
1525
  _httpClient = new WeakMap();
1525
1526
 
1526
1527
  // src/novu.ts
1528
+ var version = "2.4.0";
1529
+ var name = "@novu/js";
1530
+ var userAgent = `${name}@${version}`;
1527
1531
  var _emitter7, _session, _socket, _inboxService3;
1528
1532
  var Novu = class {
1529
1533
  constructor(options) {
@@ -1531,8 +1535,11 @@ var Novu = class {
1531
1535
  __privateAdd(this, _session);
1532
1536
  __privateAdd(this, _socket);
1533
1537
  __privateAdd(this, _inboxService3);
1534
- var _a, _b, _c;
1535
- __privateSet(this, _inboxService3, new InboxService({ backendUrl: (_a = options.backendUrl) != null ? _a : PRODUCTION_BACKEND_URL }));
1538
+ var _a, _b, _c, _d;
1539
+ __privateSet(this, _inboxService3, new InboxService({
1540
+ backendUrl: (_a = options.backendUrl) != null ? _a : PRODUCTION_BACKEND_URL,
1541
+ userAgent: (_b = options.__userAgent) != null ? _b : userAgent
1542
+ }));
1536
1543
  __privateSet(this, _emitter7, new NovuEventEmitter());
1537
1544
  __privateSet(this, _session, new Session(
1538
1545
  {
@@ -1545,12 +1552,12 @@ var Novu = class {
1545
1552
  ));
1546
1553
  __privateGet(this, _session).initialize();
1547
1554
  this.notifications = new Notifications({
1548
- useCache: (_b = options.useCache) != null ? _b : true,
1555
+ useCache: (_c = options.useCache) != null ? _c : true,
1549
1556
  inboxServiceInstance: __privateGet(this, _inboxService3),
1550
1557
  eventEmitterInstance: __privateGet(this, _emitter7)
1551
1558
  });
1552
1559
  this.preferences = new Preferences({
1553
- useCache: (_c = options.useCache) != null ? _c : true,
1560
+ useCache: (_d = options.useCache) != null ? _d : true,
1554
1561
  inboxServiceInstance: __privateGet(this, _inboxService3),
1555
1562
  eventEmitterInstance: __privateGet(this, _emitter7)
1556
1563
  });
@@ -1,5 +1,5 @@
1
- import { N as NotificationFilter } from './novu-psplDV5F.mjs';
2
- export { k as Action, A as ActionTypeEnum, m as ChannelPreference, f as ChannelType, C as CtaType, E as EventHandler, a as Events, F as FiltersCountResponse, q as IPreferenceOverride, I as InboxNotification, L as ListNotificationsResponse, i as MessageAction, M as MessageButton, t as Notification, e as NotificationActionStatus, d as NotificationButton, c as NotificationStatus, b as Novu, v as NovuError, s as NovuOptions, n as PaginatedResponse, u as Preference, P as PreferenceLevel, g as PreferenceOverrideSource, p as PreferenceOverrideSourceEnum, o as PreferencesResponse, R as Redirect, r as Result, h as Session, S as SocketEventNames, j as Subscriber, T as TODO, W as WebSocketEvent, l as Workflow } from './novu-psplDV5F.mjs';
1
+ import { N as NotificationFilter } from './novu-gS68EfJw.mjs';
2
+ export { k as Action, A as ActionTypeEnum, m as ChannelPreference, f as ChannelType, C as CtaType, E as EventHandler, a as Events, F as FiltersCountResponse, q as IPreferenceOverride, I as InboxNotification, L as ListNotificationsResponse, i as MessageAction, M as MessageButton, t as Notification, e as NotificationActionStatus, d as NotificationButton, c as NotificationStatus, b as Novu, v as NovuError, s as NovuOptions, n as PaginatedResponse, u as Preference, P as PreferenceLevel, g as PreferenceOverrideSource, p as PreferenceOverrideSourceEnum, o as PreferencesResponse, R as Redirect, r as Result, h as Session, S as SocketEventNames, j as Subscriber, T as TODO, W as WebSocketEvent, l as Workflow } from './novu-gS68EfJw.mjs';
3
3
  import '@novu/client';
4
4
 
5
5
  declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
@@ -1,2 +1,2 @@
1
- export { ActionTypeEnum, ChannelType, CtaType, NotificationActionStatus, NotificationButton, NotificationStatus, Novu, PreferenceLevel, PreferenceOverrideSource, PreferenceOverrideSourceEnum, WebSocketEvent, areTagsEqual, isSameFilter } from './chunk-QIWP6QB5.mjs';
1
+ export { ActionTypeEnum, ChannelType, CtaType, NotificationActionStatus, NotificationButton, NotificationStatus, Novu, PreferenceLevel, PreferenceOverrideSource, PreferenceOverrideSourceEnum, WebSocketEvent, areTagsEqual, isSameFilter } from './chunk-VCUP7D3X.mjs';
2
2
  import './chunk-STZMOEWR.mjs';
@@ -0,0 +1,7 @@
1
+ interface Token {
2
+ type: 'bold' | 'text';
3
+ content: string;
4
+ }
5
+ declare const parseMarkdownIntoTokens: (text: string) => Token[];
6
+
7
+ export { type Token, parseMarkdownIntoTokens };
@@ -0,0 +1,2 @@
1
+ export { parseMarkdownIntoTokens } from '../chunk-GPV65U5R.mjs';
2
+ import '../chunk-STZMOEWR.mjs';
@@ -169,6 +169,10 @@ type NovuOptions = {
169
169
  backendUrl?: string;
170
170
  socketUrl?: string;
171
171
  useCache?: boolean;
172
+ /**
173
+ * @internal Should be used internally
174
+ */
175
+ __userAgent?: string;
172
176
  };
173
177
 
174
178
  type InboxServiceOptions = ApiOptions;
@@ -1,5 +1,5 @@
1
- import { g as Theme } from '../types-xYLv4vWZ.mjs';
2
- import '../novu-psplDV5F.mjs';
1
+ import { g as Theme } from '../types-MmHw9UXx.mjs';
2
+ import '../novu-gS68EfJw.mjs';
3
3
  import '@novu/client';
4
4
 
5
5
  declare const dark: Theme;
@@ -1,4 +1,4 @@
1
- import { t as Notification, N as NotificationFilter, s as NovuOptions, b as Novu } from './novu-psplDV5F.mjs';
1
+ import { t as Notification, N as NotificationFilter, s as NovuOptions, b as Novu } from './novu-gS68EfJw.mjs';
2
2
 
3
3
  declare const defaultLocalization: {
4
4
  readonly locale: "en-US";
@@ -1,7 +1,7 @@
1
- import { s as NovuOptions } from '../novu-psplDV5F.mjs';
2
- export { t as Notification } from '../novu-psplDV5F.mjs';
3
- import { N as NotificationRenderer, B as BellRenderer, a as NotificationClickHandler, b as NotificationActionClickHandler, c as NovuProviderProps, d as BaseNovuProviderProps, A as Appearance, L as Localization, T as Tab, P as PreferencesFilter, R as RouterPush } from '../types-xYLv4vWZ.mjs';
4
- export { e as AppearanceKey, C as CSSProperties, E as ElementStyles, f as Elements, i as LocalizationKey, h as NotificationStatus, g as Theme, V as Variables } from '../types-xYLv4vWZ.mjs';
1
+ import { s as NovuOptions } from '../novu-gS68EfJw.mjs';
2
+ export { t as Notification } from '../novu-gS68EfJw.mjs';
3
+ import { N as NotificationRenderer, B as BellRenderer, a as NotificationClickHandler, b as NotificationActionClickHandler, c as NovuProviderProps, d as BaseNovuProviderProps, A as Appearance, L as Localization, T as Tab, P as PreferencesFilter, R as RouterPush } from '../types-MmHw9UXx.mjs';
4
+ export { e as AppearanceKey, C as CSSProperties, E as ElementStyles, f as Elements, i as LocalizationKey, h as NotificationStatus, g as Theme, V as Variables } from '../types-MmHw9UXx.mjs';
5
5
  import * as solid_js from 'solid-js';
6
6
  import { ComponentProps } from 'solid-js';
7
7
  import { MountableElement } from 'solid-js/web';