@novu/js 2.6.4 → 2.6.6

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.
@@ -1069,13 +1069,13 @@ var updatePreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function*
1069
1069
  useCache,
1070
1070
  args
1071
1071
  }) {
1072
- const { workflowId, channelPreferences } = args;
1072
+ const { workflowId, channels } = args;
1073
1073
  try {
1074
1074
  emitter.emit("preference.update.pending", {
1075
1075
  args,
1076
1076
  data: args.preference ? new Preference(
1077
1077
  chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, args.preference), {
1078
- channels: chunk7B52C2XE_js.__spreadValues(chunk7B52C2XE_js.__spreadValues({}, args.preference.channels), channelPreferences)
1078
+ channels: chunk7B52C2XE_js.__spreadValues(chunk7B52C2XE_js.__spreadValues({}, args.preference.channels), channels)
1079
1079
  }),
1080
1080
  {
1081
1081
  emitterInstance: emitter,
@@ -1087,10 +1087,10 @@ var updatePreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function*
1087
1087
  });
1088
1088
  let response;
1089
1089
  if (workflowId) {
1090
- response = yield apiService.updateWorkflowPreferences({ workflowId, channelPreferences });
1090
+ response = yield apiService.updateWorkflowPreferences({ workflowId, channels });
1091
1091
  } else {
1092
1092
  optimisticUpdateWorkflowPreferences({ emitter, apiService, cache, useCache, args });
1093
- response = yield apiService.updateGlobalPreferences(channelPreferences);
1093
+ response = yield apiService.updateGlobalPreferences(channels);
1094
1094
  }
1095
1095
  const preference = new Preference(response, {
1096
1096
  emitterInstance: emitter,
@@ -1120,7 +1120,7 @@ var optimisticUpdateWorkflowPreferences = ({
1120
1120
  channels: Object.entries(el.channels).reduce((acc, [key, value]) => {
1121
1121
  var _a2;
1122
1122
  const channelType = key;
1123
- acc[channelType] = (_a2 = args.channelPreferences[channelType]) != null ? _a2 : value;
1123
+ acc[channelType] = (_a2 = args.channels[channelType]) != null ? _a2 : value;
1124
1124
  return acc;
1125
1125
  }, {})
1126
1126
  });
@@ -1134,7 +1134,7 @@ var optimisticUpdateWorkflowPreferences = ({
1134
1134
  emitter.emit("preference.update.pending", {
1135
1135
  args: {
1136
1136
  workflowId: (_a = el.workflow) == null ? void 0 : _a.id,
1137
- channelPreferences: updatedPreference.channels
1137
+ channels: updatedPreference.channels
1138
1138
  },
1139
1139
  data: updatedPreference
1140
1140
  });
@@ -1165,7 +1165,11 @@ var Preference = class {
1165
1165
  this.channels = preference.channels;
1166
1166
  this.workflow = preference.workflow;
1167
1167
  }
1168
- update({ channelPreferences }) {
1168
+ update({
1169
+ channels,
1170
+ // @deprecated use channels instead
1171
+ channelPreferences
1172
+ }) {
1169
1173
  var _a;
1170
1174
  return updatePreference({
1171
1175
  emitter: chunk7B52C2XE_js.__privateGet(this, _emitter4),
@@ -1174,7 +1178,7 @@ var Preference = class {
1174
1178
  useCache: chunk7B52C2XE_js.__privateGet(this, _useCache2),
1175
1179
  args: {
1176
1180
  workflowId: (_a = this.workflow) == null ? void 0 : _a.id,
1177
- channelPreferences,
1181
+ channels: channels || channelPreferences,
1178
1182
  preference: {
1179
1183
  level: this.level,
1180
1184
  enabled: this.enabled,
@@ -1473,22 +1477,19 @@ initializeSocket_fn = function() {
1473
1477
  });
1474
1478
  };
1475
1479
 
1476
- // src/utils/config.ts
1477
- var PRODUCTION_BACKEND_URL = "https://api.novu.co";
1478
-
1479
1480
  // src/api/http-client.ts
1480
1481
  var DEFAULT_API_VERSION = "v1";
1481
1482
  var DEFAULT_BACKEND_URL = "https://api.novu.co";
1482
- var DEFAULT_USER_AGENT = `${"@novu/js"}@${"2.6.4"}`;
1483
+ var DEFAULT_USER_AGENT = `${"@novu/js"}@${"2.6.6"}`;
1483
1484
  var HttpClient = class {
1484
1485
  constructor(options = {}) {
1485
1486
  const {
1486
1487
  apiVersion = DEFAULT_API_VERSION,
1487
- backendUrl = DEFAULT_BACKEND_URL,
1488
+ apiUrl = DEFAULT_BACKEND_URL,
1488
1489
  userAgent = DEFAULT_USER_AGENT
1489
1490
  } = options || {};
1490
1491
  this.apiVersion = apiVersion;
1491
- this.backendUrl = `${backendUrl}/${this.apiVersion}`;
1492
+ this.apiUrl = `${apiUrl}/${this.apiVersion}`;
1492
1493
  this.headers = {
1493
1494
  "Novu-API-Version": "2024-06-26",
1494
1495
  "Content-Type": "application/json",
@@ -1553,7 +1554,7 @@ var HttpClient = class {
1553
1554
  options,
1554
1555
  unwrapEnvelope = true
1555
1556
  }) {
1556
- const fullUrl = combineUrl(this.backendUrl, path, searchParams ? `?${searchParams.toString()}` : "");
1557
+ const fullUrl = combineUrl(this.apiUrl, path, searchParams ? `?${searchParams.toString()}` : "");
1557
1558
  const reqInit = {
1558
1559
  method: (options == null ? void 0 : options.method) || "GET",
1559
1560
  headers: chunk7B52C2XE_js.__spreadValues(chunk7B52C2XE_js.__spreadValues({}, this.headers), (options == null ? void 0 : options.headers) || {}),
@@ -1682,14 +1683,14 @@ var InboxService = class {
1682
1683
  const query = queryParams.size ? `?${queryParams.toString()}` : "";
1683
1684
  return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(`${INBOX_ROUTE}/preferences${query}`);
1684
1685
  }
1685
- updateGlobalPreferences(channelPreferences) {
1686
- return chunk7B52C2XE_js.__privateGet(this, _httpClient).patch(`${INBOX_ROUTE}/preferences`, channelPreferences);
1686
+ updateGlobalPreferences(channels) {
1687
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).patch(`${INBOX_ROUTE}/preferences`, channels);
1687
1688
  }
1688
1689
  updateWorkflowPreferences({
1689
1690
  workflowId,
1690
- channelPreferences
1691
+ channels
1691
1692
  }) {
1692
- return chunk7B52C2XE_js.__privateGet(this, _httpClient).patch(`${INBOX_ROUTE}/preferences/${workflowId}`, channelPreferences);
1693
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).patch(`${INBOX_ROUTE}/preferences/${workflowId}`, channels);
1693
1694
  }
1694
1695
  };
1695
1696
  _httpClient = new WeakMap();
@@ -1702,9 +1703,9 @@ var Novu = class {
1702
1703
  chunk7B52C2XE_js.__privateAdd(this, _session);
1703
1704
  chunk7B52C2XE_js.__privateAdd(this, _socket);
1704
1705
  chunk7B52C2XE_js.__privateAdd(this, _inboxService3);
1705
- var _a, _b, _c;
1706
+ var _a, _b;
1706
1707
  chunk7B52C2XE_js.__privateSet(this, _inboxService3, new InboxService({
1707
- backendUrl: (_a = options.backendUrl) != null ? _a : PRODUCTION_BACKEND_URL,
1708
+ apiUrl: options.apiUrl || options.backendUrl,
1708
1709
  userAgent: options.__userAgent
1709
1710
  }));
1710
1711
  chunk7B52C2XE_js.__privateSet(this, _emitter7, new NovuEventEmitter());
@@ -1719,12 +1720,12 @@ var Novu = class {
1719
1720
  ));
1720
1721
  chunk7B52C2XE_js.__privateGet(this, _session).initialize();
1721
1722
  this.notifications = new Notifications({
1722
- useCache: (_b = options.useCache) != null ? _b : true,
1723
+ useCache: (_a = options.useCache) != null ? _a : true,
1723
1724
  inboxServiceInstance: chunk7B52C2XE_js.__privateGet(this, _inboxService3),
1724
1725
  eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this, _emitter7)
1725
1726
  });
1726
1727
  this.preferences = new Preferences({
1727
- useCache: (_c = options.useCache) != null ? _c : true,
1728
+ useCache: (_b = options.useCache) != null ? _b : true,
1728
1729
  inboxServiceInstance: chunk7B52C2XE_js.__privateGet(this, _inboxService3),
1729
1730
  eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this, _emitter7)
1730
1731
  });
@@ -1,5 +1,5 @@
1
- import { N as NotificationFilter } from './novu-CTwfWx9z.js';
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-CTwfWx9z.js';
1
+ import { N as NotificationFilter } from './novu-DbpFmjhC.js';
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, u as Notification, e as NotificationActionStatus, d as NotificationButton, c as NotificationStatus, b as Novu, w as NovuError, s as NovuOptions, n as PaginatedResponse, v as Preference, P as PreferenceLevel, g as PreferenceOverrideSource, p as PreferenceOverrideSourceEnum, o as PreferencesResponse, t as Prettify, 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-DbpFmjhC.js';
3
3
 
4
4
  declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
5
5
  declare const isSameFilter: (filter1: NotificationFilter, filter2: NotificationFilter) => boolean;
package/dist/cjs/index.js CHANGED
@@ -1,59 +1,59 @@
1
1
  'use strict';
2
2
 
3
- var chunkNCIKS5DU_js = require('./chunk-NCIKS5DU.js');
3
+ var chunkZ4XIR64I_js = require('./chunk-Z4XIR64I.js');
4
4
  require('./chunk-7B52C2XE.js');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "ActionTypeEnum", {
9
9
  enumerable: true,
10
- get: function () { return chunkNCIKS5DU_js.ActionTypeEnum; }
10
+ get: function () { return chunkZ4XIR64I_js.ActionTypeEnum; }
11
11
  });
12
12
  Object.defineProperty(exports, "ChannelType", {
13
13
  enumerable: true,
14
- get: function () { return chunkNCIKS5DU_js.ChannelType; }
14
+ get: function () { return chunkZ4XIR64I_js.ChannelType; }
15
15
  });
16
16
  Object.defineProperty(exports, "CtaType", {
17
17
  enumerable: true,
18
- get: function () { return chunkNCIKS5DU_js.CtaType; }
18
+ get: function () { return chunkZ4XIR64I_js.CtaType; }
19
19
  });
20
20
  Object.defineProperty(exports, "NotificationActionStatus", {
21
21
  enumerable: true,
22
- get: function () { return chunkNCIKS5DU_js.NotificationActionStatus; }
22
+ get: function () { return chunkZ4XIR64I_js.NotificationActionStatus; }
23
23
  });
24
24
  Object.defineProperty(exports, "NotificationButton", {
25
25
  enumerable: true,
26
- get: function () { return chunkNCIKS5DU_js.NotificationButton; }
26
+ get: function () { return chunkZ4XIR64I_js.NotificationButton; }
27
27
  });
28
28
  Object.defineProperty(exports, "NotificationStatus", {
29
29
  enumerable: true,
30
- get: function () { return chunkNCIKS5DU_js.NotificationStatus; }
30
+ get: function () { return chunkZ4XIR64I_js.NotificationStatus; }
31
31
  });
32
32
  Object.defineProperty(exports, "Novu", {
33
33
  enumerable: true,
34
- get: function () { return chunkNCIKS5DU_js.Novu; }
34
+ get: function () { return chunkZ4XIR64I_js.Novu; }
35
35
  });
36
36
  Object.defineProperty(exports, "PreferenceLevel", {
37
37
  enumerable: true,
38
- get: function () { return chunkNCIKS5DU_js.PreferenceLevel; }
38
+ get: function () { return chunkZ4XIR64I_js.PreferenceLevel; }
39
39
  });
40
40
  Object.defineProperty(exports, "PreferenceOverrideSource", {
41
41
  enumerable: true,
42
- get: function () { return chunkNCIKS5DU_js.PreferenceOverrideSource; }
42
+ get: function () { return chunkZ4XIR64I_js.PreferenceOverrideSource; }
43
43
  });
44
44
  Object.defineProperty(exports, "PreferenceOverrideSourceEnum", {
45
45
  enumerable: true,
46
- get: function () { return chunkNCIKS5DU_js.PreferenceOverrideSourceEnum; }
46
+ get: function () { return chunkZ4XIR64I_js.PreferenceOverrideSourceEnum; }
47
47
  });
48
48
  Object.defineProperty(exports, "WebSocketEvent", {
49
49
  enumerable: true,
50
- get: function () { return chunkNCIKS5DU_js.WebSocketEvent; }
50
+ get: function () { return chunkZ4XIR64I_js.WebSocketEvent; }
51
51
  });
52
52
  Object.defineProperty(exports, "areTagsEqual", {
53
53
  enumerable: true,
54
- get: function () { return chunkNCIKS5DU_js.areTagsEqual; }
54
+ get: function () { return chunkZ4XIR64I_js.areTagsEqual; }
55
55
  });
56
56
  Object.defineProperty(exports, "isSameFilter", {
57
57
  enumerable: true,
58
- get: function () { return chunkNCIKS5DU_js.isSameFilter; }
58
+ get: function () { return chunkZ4XIR64I_js.isSameFilter; }
59
59
  });
@@ -8,7 +8,8 @@ type ListPreferencesArgs = {
8
8
  };
9
9
  type UpdatePreferencesArgs = {
10
10
  workflowId?: string;
11
- channelPreferences: ChannelPreference;
11
+ channels: ChannelPreference;
12
+ channelPreferences?: ChannelPreference;
12
13
  preference?: {
13
14
  level: PreferenceLevel;
14
15
  enabled: boolean;
@@ -43,9 +44,7 @@ declare class Preference {
43
44
  cache: PreferencesCache;
44
45
  useCache: boolean;
45
46
  });
46
- update({ channelPreferences }: {
47
- channelPreferences: ChannelPreference;
48
- }): Result<Preference>;
47
+ update({ channels, channelPreferences, }: Prettify<Pick<UpdatePreferencesArgs, 'channels' | 'channelPreferences'>>): Result<Preference>;
49
48
  }
50
49
 
51
50
  declare enum NotificationStatus {
@@ -194,6 +193,7 @@ type NovuOptions = {
194
193
  subscriberId: string;
195
194
  subscriberHash?: string;
196
195
  backendUrl?: string;
196
+ apiUrl?: string;
197
197
  socketUrl?: string;
198
198
  useCache?: boolean;
199
199
  /**
@@ -201,10 +201,13 @@ type NovuOptions = {
201
201
  */
202
202
  __userAgent?: string;
203
203
  };
204
+ type Prettify<T> = {
205
+ [K in keyof T]: T[K];
206
+ } & {};
204
207
 
205
208
  type HttpClientOptions = {
206
209
  apiVersion?: string;
207
- backendUrl?: string;
210
+ apiUrl?: string;
208
211
  userAgent?: string;
209
212
  };
210
213
 
@@ -264,10 +267,10 @@ declare class InboxService {
264
267
  actionType: ActionTypeEnum;
265
268
  }): Promise<InboxNotification>;
266
269
  fetchPreferences(tags?: string[]): Promise<PreferencesResponse[]>;
267
- updateGlobalPreferences(channelPreferences: ChannelPreference): Promise<PreferencesResponse>;
268
- updateWorkflowPreferences({ workflowId, channelPreferences, }: {
270
+ updateGlobalPreferences(channels: ChannelPreference): Promise<PreferencesResponse>;
271
+ updateWorkflowPreferences({ workflowId, channels, }: {
269
272
  workflowId: string;
270
- channelPreferences: ChannelPreference;
273
+ channels: ChannelPreference;
271
274
  }): Promise<PreferencesResponse>;
272
275
  }
273
276
 
@@ -548,4 +551,4 @@ declare class Novu implements Pick<NovuEventEmitter, 'on'> {
548
551
  constructor(options: NovuOptions);
549
552
  }
550
553
 
551
- export { ActionTypeEnum as A, CtaType as C, type EventHandler as E, type FiltersCountResponse as F, type InboxNotification as I, type ListNotificationsResponse as L, type MessageButton as M, type NotificationFilter as N, PreferenceLevel as P, type Redirect as R, type SocketEventNames as S, type TODO as T, WebSocketEvent as W, type Events as a, Novu as b, NotificationStatus as c, NotificationButton as d, NotificationActionStatus as e, ChannelType as f, PreferenceOverrideSource as g, type Session as h, type MessageAction as i, type Subscriber as j, type Action as k, type Workflow as l, type ChannelPreference as m, type PaginatedResponse as n, type PreferencesResponse as o, PreferenceOverrideSourceEnum as p, type IPreferenceOverride as q, type Result as r, type NovuOptions as s, Notification as t, Preference as u, NovuError as v };
554
+ export { ActionTypeEnum as A, CtaType as C, type EventHandler as E, type FiltersCountResponse as F, type InboxNotification as I, type ListNotificationsResponse as L, type MessageButton as M, type NotificationFilter as N, PreferenceLevel as P, type Redirect as R, type SocketEventNames as S, type TODO as T, WebSocketEvent as W, type Events as a, Novu as b, NotificationStatus as c, NotificationButton as d, NotificationActionStatus as e, ChannelType as f, PreferenceOverrideSource as g, type Session as h, type MessageAction as i, type Subscriber as j, type Action as k, type Workflow as l, type ChannelPreference as m, type PaginatedResponse as n, type PreferencesResponse as o, PreferenceOverrideSourceEnum as p, type IPreferenceOverride as q, type Result as r, type NovuOptions as s, type Prettify as t, Notification as u, Preference as v, NovuError as w };
@@ -1,5 +1,5 @@
1
- import { g as Theme } from '../types-C9Kspo68.js';
2
- import '../novu-CTwfWx9z.js';
1
+ import { g as Theme } from '../types-B8jOWXQS.js';
2
+ import '../novu-DbpFmjhC.js';
3
3
 
4
4
  declare const dark: Theme;
5
5
 
@@ -1,4 +1,4 @@
1
- import { t as Notification, N as NotificationFilter, s as NovuOptions, b as Novu } from './novu-CTwfWx9z.js';
1
+ import { u as Notification, N as NotificationFilter, s as NovuOptions, b as Novu } from './novu-DbpFmjhC.js';
2
2
 
3
3
  declare const defaultLocalization: {
4
4
  readonly locale: "en-US";
@@ -1,7 +1,7 @@
1
- import { s as NovuOptions } from '../novu-CTwfWx9z.js';
2
- export { t as Notification } from '../novu-CTwfWx9z.js';
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-C9Kspo68.js';
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-C9Kspo68.js';
1
+ import { s as NovuOptions } from '../novu-DbpFmjhC.js';
2
+ export { u as Notification } from '../novu-DbpFmjhC.js';
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-B8jOWXQS.js';
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-B8jOWXQS.js';
5
5
  import { Placement, OffsetOptions } from '@floating-ui/dom';
6
6
  import * as solid_js from 'solid-js';
7
7
  import { ComponentProps } from 'solid-js';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkNCIKS5DU_js = require('../chunk-NCIKS5DU.js');
3
+ var chunkZ4XIR64I_js = require('../chunk-Z4XIR64I.js');
4
4
  var chunkERC62PGI_js = require('../chunk-ERC62PGI.js');
5
5
  var chunk7B52C2XE_js = require('../chunk-7B52C2XE.js');
6
6
  var web = require('solid-js/web');
@@ -754,7 +754,7 @@ var useInboxContext = () => {
754
754
  };
755
755
  var NovuContext = solidJs.createContext(void 0);
756
756
  function NovuProvider(props) {
757
- const novu = solidJs.createMemo(() => props.novu || new chunkNCIKS5DU_js.Novu(props.options));
757
+ const novu = solidJs.createMemo(() => props.novu || new chunkZ4XIR64I_js.Novu(props.options));
758
758
  return web.createComponent(NovuContext.Provider, {
759
759
  get value() {
760
760
  return novu();
@@ -1247,7 +1247,14 @@ var Bell = (props) => {
1247
1247
  }
1248
1248
  });
1249
1249
  };
1250
- var _tmpl$21 = /* @__PURE__ */ web.template(`<div class="nt-flex nt-shrink-0 nt-justify-center nt-items-center nt-gap-1 nt-mt-auto nt-pt-9 nt-pb-3 nt-text-foreground-alpha-200"><span class=nt-text-xs>Powered by Novu`);
1250
+
1251
+ // src/utils/is-browser.ts
1252
+ function isBrowser() {
1253
+ return typeof window !== "undefined";
1254
+ }
1255
+
1256
+ // src/ui/components/elements/Footer.tsx
1257
+ var _tmpl$21 = /* @__PURE__ */ web.template(`<div class="nt-flex nt-shrink-0 nt-justify-center nt-items-center nt-gap-1 nt-mt-auto nt-pt-9 nt-pb-3 nt-text-foreground-alpha-200"><a target=_blank class="nt-block nt-w-full nt-flex nt-items-center nt-gap-1 nt-justify-center"><span class=nt-text-xs>Powered by Novu`);
1251
1258
  var Footer = () => {
1252
1259
  const {
1253
1260
  hideBranding
@@ -1257,12 +1264,19 @@ var Footer = () => {
1257
1264
  return !hideBranding();
1258
1265
  },
1259
1266
  get children() {
1260
- var _el$ = _tmpl$21(), _el$2 = _el$.firstChild;
1261
- web.insert(_el$, web.createComponent(Novu2, {}), _el$2);
1267
+ var _el$ = _tmpl$21(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
1268
+ web.insert(_el$2, web.createComponent(Novu2, {}), _el$3);
1269
+ web.effect(() => web.setAttribute(_el$2, "href", `https://go.novu.co/powered?ref=${getCurrentDomain()}`));
1262
1270
  return _el$;
1263
1271
  }
1264
1272
  });
1265
1273
  };
1274
+ function getCurrentDomain() {
1275
+ if (isBrowser()) {
1276
+ return window.location.hostname;
1277
+ }
1278
+ return "";
1279
+ }
1266
1280
  var _tmpl$22 = /* @__PURE__ */ web.template(`<button>`);
1267
1281
  var buttonVariants = classVarianceAuthority.cva("nt-inline-flex nt-gap-4 nt-items-center nt-justify-center nt-whitespace-nowrap nt-rounded-lg nt-text-sm nt-font-medium nt-ring-offset-background nt-transition-colors focus-visible:nt-outline-none focus-visible:nt-ring-2 focus-visible:nt-ring-primary nt-focus-visible:nt-ring-offset-2 disabled:nt-pointer-events-none disabled:nt-opacity-50", {
1268
1282
  variants: {
@@ -2013,7 +2027,7 @@ var useNotificationsInfiniteScroll = (props) => {
2013
2027
  }));
2014
2028
  solidJs.onMount(() => {
2015
2029
  const listener = ({ data: data2 }) => {
2016
- if (!data2 || !chunkNCIKS5DU_js.isSameFilter(filter, data2.filter)) {
2030
+ if (!data2 || !chunkZ4XIR64I_js.isSameFilter(filter, data2.filter)) {
2017
2031
  return;
2018
2032
  }
2019
2033
  mutate({ data: data2.notifications, hasMore: data2.hasMore });
@@ -2023,7 +2037,7 @@ var useNotificationsInfiniteScroll = (props) => {
2023
2037
  });
2024
2038
  solidJs.createEffect(() => {
2025
2039
  const newFilter = chunk7B52C2XE_js.__spreadValues({}, props.options());
2026
- if (chunkNCIKS5DU_js.isSameFilter(filter, newFilter)) {
2040
+ if (chunkZ4XIR64I_js.isSameFilter(filter, newFilter)) {
2027
2041
  return;
2028
2042
  }
2029
2043
  novu.notifications.clearCache();
@@ -2520,7 +2534,7 @@ var Preferences = () => {
2520
2534
  enabled
2521
2535
  }) => {
2522
2536
  preference == null ? void 0 : preference.update({
2523
- channelPreferences: {
2537
+ channels: {
2524
2538
  [channel]: enabled
2525
2539
  }
2526
2540
  });
@@ -2727,17 +2741,16 @@ var Bold = (props) => {
2727
2741
  };
2728
2742
  var Text = (props) => props.children;
2729
2743
  var Markdown = (props) => {
2730
- const _a = props, {
2731
- children,
2732
- strongAppearanceKey
2733
- } = _a, rest = chunk7B52C2XE_js.__objRest(_a, [
2734
- "children",
2735
- "strongAppearanceKey"
2736
- ]);
2737
- const tokens = solidJs.createMemo(() => chunkERC62PGI_js.parseMarkdownIntoTokens(children));
2744
+ const [local, rest] = solidJs.splitProps(props, ["class", "children", "appearanceKey", "strongAppearanceKey"]);
2745
+ const style = useStyle();
2746
+ const tokens = solidJs.createMemo(() => chunkERC62PGI_js.parseMarkdownIntoTokens(local.children));
2738
2747
  return (() => {
2739
2748
  var _el$2 = _tmpl$213();
2740
- web.spread(_el$2, rest, false, true);
2749
+ web.spread(_el$2, web.mergeProps({
2750
+ get ["class"]() {
2751
+ return style(local.appearanceKey, cn(local.class));
2752
+ }
2753
+ }, rest), false, true);
2741
2754
  web.insert(_el$2, web.createComponent(solidJs.For, {
2742
2755
  get each() {
2743
2756
  return tokens();
@@ -2745,7 +2758,9 @@ var Markdown = (props) => {
2745
2758
  children: (token) => {
2746
2759
  if (token.type === "bold") {
2747
2760
  return web.createComponent(Bold, {
2748
- appearanceKey: strongAppearanceKey,
2761
+ get appearanceKey() {
2762
+ return local.strongAppearanceKey;
2763
+ },
2749
2764
  get children() {
2750
2765
  return token.content;
2751
2766
  }
@@ -3138,9 +3153,8 @@ var DefaultNotification = (props) => {
3138
3153
  return props.notification.subject;
3139
3154
  },
3140
3155
  children: (subject) => web.createComponent(Markdown_default, {
3141
- get ["class"]() {
3142
- return style("notificationSubject", "nt-text-start");
3143
- },
3156
+ appearanceKey: "notificationSubject__strong",
3157
+ "class": "nt-text-start",
3144
3158
  strongAppearanceKey: "notificationSubject__strong",
3145
3159
  get children() {
3146
3160
  return subject();
@@ -3148,10 +3162,9 @@ var DefaultNotification = (props) => {
3148
3162
  })
3149
3163
  }), _el$8);
3150
3164
  web.insert(_el$4, web.createComponent(Markdown_default, {
3151
- get ["class"]() {
3152
- return style("notificationBody", "nt-text-start");
3153
- },
3165
+ appearanceKey: "notificationBody__strong",
3154
3166
  strongAppearanceKey: "notificationBody__strong",
3167
+ "class": "nt-text-start nt-whitespace-pre-wrap",
3155
3168
  get children() {
3156
3169
  return props.notification.body;
3157
3170
  }
@@ -4002,7 +4015,7 @@ var Renderer = (props) => {
4002
4015
  }
4003
4016
  });
4004
4017
  };
4005
- var version = "2.6.4";
4018
+ var version = "2.6.6";
4006
4019
  var cssHref = `https://cdn.jsdelivr.net/npm/@novu/js@${version}/dist/index.css`;
4007
4020
  var _dispose, _rootElement, _mountedElements, _setMountedElements, _appearance, _setAppearance, _localization, _setLocalization, _options, _setOptions, _tabs, _setTabs, _routerPush, _setRouterPush, _preferencesFilter, _setPreferencesFilter, _predefinedNovu, _NovuUI_instances, mountComponentRenderer_fn, updateComponentProps_fn;
4008
4021
  var NovuUI = class {
@@ -1062,13 +1062,13 @@ var updatePreference = (_0) => __async(void 0, [_0], function* ({
1062
1062
  useCache,
1063
1063
  args
1064
1064
  }) {
1065
- const { workflowId, channelPreferences } = args;
1065
+ const { workflowId, channels } = args;
1066
1066
  try {
1067
1067
  emitter.emit("preference.update.pending", {
1068
1068
  args,
1069
1069
  data: args.preference ? new Preference(
1070
1070
  __spreadProps(__spreadValues({}, args.preference), {
1071
- channels: __spreadValues(__spreadValues({}, args.preference.channels), channelPreferences)
1071
+ channels: __spreadValues(__spreadValues({}, args.preference.channels), channels)
1072
1072
  }),
1073
1073
  {
1074
1074
  emitterInstance: emitter,
@@ -1080,10 +1080,10 @@ var updatePreference = (_0) => __async(void 0, [_0], function* ({
1080
1080
  });
1081
1081
  let response;
1082
1082
  if (workflowId) {
1083
- response = yield apiService.updateWorkflowPreferences({ workflowId, channelPreferences });
1083
+ response = yield apiService.updateWorkflowPreferences({ workflowId, channels });
1084
1084
  } else {
1085
1085
  optimisticUpdateWorkflowPreferences({ emitter, apiService, cache, useCache, args });
1086
- response = yield apiService.updateGlobalPreferences(channelPreferences);
1086
+ response = yield apiService.updateGlobalPreferences(channels);
1087
1087
  }
1088
1088
  const preference = new Preference(response, {
1089
1089
  emitterInstance: emitter,
@@ -1113,7 +1113,7 @@ var optimisticUpdateWorkflowPreferences = ({
1113
1113
  channels: Object.entries(el.channels).reduce((acc, [key, value]) => {
1114
1114
  var _a2;
1115
1115
  const channelType = key;
1116
- acc[channelType] = (_a2 = args.channelPreferences[channelType]) != null ? _a2 : value;
1116
+ acc[channelType] = (_a2 = args.channels[channelType]) != null ? _a2 : value;
1117
1117
  return acc;
1118
1118
  }, {})
1119
1119
  });
@@ -1127,7 +1127,7 @@ var optimisticUpdateWorkflowPreferences = ({
1127
1127
  emitter.emit("preference.update.pending", {
1128
1128
  args: {
1129
1129
  workflowId: (_a = el.workflow) == null ? void 0 : _a.id,
1130
- channelPreferences: updatedPreference.channels
1130
+ channels: updatedPreference.channels
1131
1131
  },
1132
1132
  data: updatedPreference
1133
1133
  });
@@ -1158,7 +1158,11 @@ var Preference = class {
1158
1158
  this.channels = preference.channels;
1159
1159
  this.workflow = preference.workflow;
1160
1160
  }
1161
- update({ channelPreferences }) {
1161
+ update({
1162
+ channels,
1163
+ // @deprecated use channels instead
1164
+ channelPreferences
1165
+ }) {
1162
1166
  var _a;
1163
1167
  return updatePreference({
1164
1168
  emitter: __privateGet(this, _emitter4),
@@ -1167,7 +1171,7 @@ var Preference = class {
1167
1171
  useCache: __privateGet(this, _useCache2),
1168
1172
  args: {
1169
1173
  workflowId: (_a = this.workflow) == null ? void 0 : _a.id,
1170
- channelPreferences,
1174
+ channels: channels || channelPreferences,
1171
1175
  preference: {
1172
1176
  level: this.level,
1173
1177
  enabled: this.enabled,
@@ -1466,22 +1470,19 @@ initializeSocket_fn = function() {
1466
1470
  });
1467
1471
  };
1468
1472
 
1469
- // src/utils/config.ts
1470
- var PRODUCTION_BACKEND_URL = "https://api.novu.co";
1471
-
1472
1473
  // src/api/http-client.ts
1473
1474
  var DEFAULT_API_VERSION = "v1";
1474
1475
  var DEFAULT_BACKEND_URL = "https://api.novu.co";
1475
- var DEFAULT_USER_AGENT = `${"@novu/js"}@${"2.6.4"}`;
1476
+ var DEFAULT_USER_AGENT = `${"@novu/js"}@${"2.6.6"}`;
1476
1477
  var HttpClient = class {
1477
1478
  constructor(options = {}) {
1478
1479
  const {
1479
1480
  apiVersion = DEFAULT_API_VERSION,
1480
- backendUrl = DEFAULT_BACKEND_URL,
1481
+ apiUrl = DEFAULT_BACKEND_URL,
1481
1482
  userAgent = DEFAULT_USER_AGENT
1482
1483
  } = options || {};
1483
1484
  this.apiVersion = apiVersion;
1484
- this.backendUrl = `${backendUrl}/${this.apiVersion}`;
1485
+ this.apiUrl = `${apiUrl}/${this.apiVersion}`;
1485
1486
  this.headers = {
1486
1487
  "Novu-API-Version": "2024-06-26",
1487
1488
  "Content-Type": "application/json",
@@ -1546,7 +1547,7 @@ var HttpClient = class {
1546
1547
  options,
1547
1548
  unwrapEnvelope = true
1548
1549
  }) {
1549
- const fullUrl = combineUrl(this.backendUrl, path, searchParams ? `?${searchParams.toString()}` : "");
1550
+ const fullUrl = combineUrl(this.apiUrl, path, searchParams ? `?${searchParams.toString()}` : "");
1550
1551
  const reqInit = {
1551
1552
  method: (options == null ? void 0 : options.method) || "GET",
1552
1553
  headers: __spreadValues(__spreadValues({}, this.headers), (options == null ? void 0 : options.headers) || {}),
@@ -1675,14 +1676,14 @@ var InboxService = class {
1675
1676
  const query = queryParams.size ? `?${queryParams.toString()}` : "";
1676
1677
  return __privateGet(this, _httpClient).get(`${INBOX_ROUTE}/preferences${query}`);
1677
1678
  }
1678
- updateGlobalPreferences(channelPreferences) {
1679
- return __privateGet(this, _httpClient).patch(`${INBOX_ROUTE}/preferences`, channelPreferences);
1679
+ updateGlobalPreferences(channels) {
1680
+ return __privateGet(this, _httpClient).patch(`${INBOX_ROUTE}/preferences`, channels);
1680
1681
  }
1681
1682
  updateWorkflowPreferences({
1682
1683
  workflowId,
1683
- channelPreferences
1684
+ channels
1684
1685
  }) {
1685
- return __privateGet(this, _httpClient).patch(`${INBOX_ROUTE}/preferences/${workflowId}`, channelPreferences);
1686
+ return __privateGet(this, _httpClient).patch(`${INBOX_ROUTE}/preferences/${workflowId}`, channels);
1686
1687
  }
1687
1688
  };
1688
1689
  _httpClient = new WeakMap();
@@ -1695,9 +1696,9 @@ var Novu = class {
1695
1696
  __privateAdd(this, _session);
1696
1697
  __privateAdd(this, _socket);
1697
1698
  __privateAdd(this, _inboxService3);
1698
- var _a, _b, _c;
1699
+ var _a, _b;
1699
1700
  __privateSet(this, _inboxService3, new InboxService({
1700
- backendUrl: (_a = options.backendUrl) != null ? _a : PRODUCTION_BACKEND_URL,
1701
+ apiUrl: options.apiUrl || options.backendUrl,
1701
1702
  userAgent: options.__userAgent
1702
1703
  }));
1703
1704
  __privateSet(this, _emitter7, new NovuEventEmitter());
@@ -1712,12 +1713,12 @@ var Novu = class {
1712
1713
  ));
1713
1714
  __privateGet(this, _session).initialize();
1714
1715
  this.notifications = new Notifications({
1715
- useCache: (_b = options.useCache) != null ? _b : true,
1716
+ useCache: (_a = options.useCache) != null ? _a : true,
1716
1717
  inboxServiceInstance: __privateGet(this, _inboxService3),
1717
1718
  eventEmitterInstance: __privateGet(this, _emitter7)
1718
1719
  });
1719
1720
  this.preferences = new Preferences({
1720
- useCache: (_c = options.useCache) != null ? _c : true,
1721
+ useCache: (_b = options.useCache) != null ? _b : true,
1721
1722
  inboxServiceInstance: __privateGet(this, _inboxService3),
1722
1723
  eventEmitterInstance: __privateGet(this, _emitter7)
1723
1724
  });
@@ -1,5 +1,5 @@
1
- import { N as NotificationFilter } from './novu-CTwfWx9z.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-CTwfWx9z.mjs';
1
+ import { N as NotificationFilter } from './novu-DbpFmjhC.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, u as Notification, e as NotificationActionStatus, d as NotificationButton, c as NotificationStatus, b as Novu, w as NovuError, s as NovuOptions, n as PaginatedResponse, v as Preference, P as PreferenceLevel, g as PreferenceOverrideSource, p as PreferenceOverrideSourceEnum, o as PreferencesResponse, t as Prettify, 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-DbpFmjhC.mjs';
3
3
 
4
4
  declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
5
5
  declare const isSameFilter: (filter1: NotificationFilter, filter2: NotificationFilter) => boolean;
@@ -1,2 +1,2 @@
1
- export { ActionTypeEnum, ChannelType, CtaType, NotificationActionStatus, NotificationButton, NotificationStatus, Novu, PreferenceLevel, PreferenceOverrideSource, PreferenceOverrideSourceEnum, WebSocketEvent, areTagsEqual, isSameFilter } from './chunk-OMRGYSBS.mjs';
1
+ export { ActionTypeEnum, ChannelType, CtaType, NotificationActionStatus, NotificationButton, NotificationStatus, Novu, PreferenceLevel, PreferenceOverrideSource, PreferenceOverrideSourceEnum, WebSocketEvent, areTagsEqual, isSameFilter } from './chunk-JJC36NOH.mjs';
2
2
  import './chunk-STZMOEWR.mjs';