@edusight/notification-widget 1.0.32 → 1.0.33
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/components-CFhP5nWW.cjs +70 -0
- package/dist/{components-KafszaqK.cjs.map → components-CFhP5nWW.cjs.map} +1 -1
- package/dist/{components-D8XxiFEB.js → components-Cfc2kMlt.js} +117 -129
- package/dist/{components-D8XxiFEB.js.map → components-Cfc2kMlt.js.map} +1 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +116 -117
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/components-KafszaqK.cjs +0 -71
package/dist/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l, jsxs as k } from "react/jsx-runtime";
|
|
2
2
|
import M, { Component as V, useState as C, useCallback as y, useEffect as b, createContext as z, useReducer as q, useRef as $, useContext as H } from "react";
|
|
3
3
|
import { io as J } from "socket.io-client";
|
|
4
4
|
import { NotificationClient as j } from "@edusight/notification-sdk";
|
|
5
|
-
import { M as G, a as Q, C as O, B as D, S as X, I as Y, L as Z } from "./components-
|
|
6
|
-
import { N as Te, P as _e } from "./components-
|
|
5
|
+
import { M as G, a as Q, C as O, B as D, S as X, I as Y, L as Z } from "./components-Cfc2kMlt.js";
|
|
6
|
+
import { N as Te, P as _e } from "./components-Cfc2kMlt.js";
|
|
7
7
|
import { u as ee, c as x } from "./hooks-BTG0z6yd.js";
|
|
8
8
|
const te = ({ error: t, onRetry: r }) => /* @__PURE__ */ k(
|
|
9
9
|
"div",
|
|
@@ -13,14 +13,14 @@ const te = ({ error: t, onRetry: r }) => /* @__PURE__ */ k(
|
|
|
13
13
|
"data-testid": "error-boundary-fallback",
|
|
14
14
|
children: [
|
|
15
15
|
/* @__PURE__ */ k("div", { className: "flex items-center mb-2", children: [
|
|
16
|
-
/* @__PURE__ */
|
|
16
|
+
/* @__PURE__ */ l(
|
|
17
17
|
G,
|
|
18
18
|
{
|
|
19
19
|
className: "w-6 h-6 text-[var(--widget-error)] mr-2",
|
|
20
20
|
"aria-hidden": "true"
|
|
21
21
|
}
|
|
22
22
|
),
|
|
23
|
-
/* @__PURE__ */
|
|
23
|
+
/* @__PURE__ */ l(
|
|
24
24
|
"h3",
|
|
25
25
|
{
|
|
26
26
|
className: "text-sm font-medium text-[var(--widget-error)]",
|
|
@@ -28,7 +28,7 @@ const te = ({ error: t, onRetry: r }) => /* @__PURE__ */ k(
|
|
|
28
28
|
}
|
|
29
29
|
)
|
|
30
30
|
] }),
|
|
31
|
-
/* @__PURE__ */
|
|
31
|
+
/* @__PURE__ */ l(
|
|
32
32
|
"p",
|
|
33
33
|
{
|
|
34
34
|
className: "text-sm mb-3 text-[var(--widget-error)]/80",
|
|
@@ -36,7 +36,7 @@ const te = ({ error: t, onRetry: r }) => /* @__PURE__ */ k(
|
|
|
36
36
|
}
|
|
37
37
|
),
|
|
38
38
|
process.env.NODE_ENV === "development" && t && /* @__PURE__ */ k("details", { className: "mb-3", children: [
|
|
39
|
-
/* @__PURE__ */
|
|
39
|
+
/* @__PURE__ */ l(
|
|
40
40
|
"summary",
|
|
41
41
|
{
|
|
42
42
|
className: "text-xs cursor-pointer text-[var(--widget-error)] hover:text-[var(--widget-error)]/80 transition-colors",
|
|
@@ -64,7 +64,7 @@ ${t.stack}`
|
|
|
64
64
|
onClick: r,
|
|
65
65
|
"data-testid": "error-retry-button",
|
|
66
66
|
children: [
|
|
67
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ l(
|
|
68
68
|
Q,
|
|
69
69
|
{
|
|
70
70
|
className: "mr-1 w-4 h-4",
|
|
@@ -98,13 +98,13 @@ class ne extends V {
|
|
|
98
98
|
error: r
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
componentDidCatch(r,
|
|
101
|
+
componentDidCatch(r, d) {
|
|
102
102
|
this.setState({
|
|
103
|
-
errorInfo:
|
|
104
|
-
}), this.props.onError && this.props.onError(r,
|
|
103
|
+
errorInfo: d
|
|
104
|
+
}), this.props.onError && this.props.onError(r, d);
|
|
105
105
|
}
|
|
106
106
|
render() {
|
|
107
|
-
return this.state.hasError ? /* @__PURE__ */
|
|
107
|
+
return this.state.hasError ? /* @__PURE__ */ l(
|
|
108
108
|
te,
|
|
109
109
|
{
|
|
110
110
|
error: this.state.error,
|
|
@@ -113,24 +113,24 @@ class ne extends V {
|
|
|
113
113
|
) : this.props.children;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
const re = () => window.__notificationSDK?.client,
|
|
116
|
+
const re = () => window.__notificationSDK?.client, oe = ({
|
|
117
117
|
onPreferencesLoaded: t,
|
|
118
118
|
onError: r
|
|
119
119
|
}) => {
|
|
120
|
-
const
|
|
120
|
+
const d = re(), [p, a] = C(!0), [o, n] = C(null), [s, f] = C(null), w = y(async () => {
|
|
121
121
|
try {
|
|
122
|
-
if (a(!0), n(null), !
|
|
122
|
+
if (a(!0), n(null), !d)
|
|
123
123
|
throw new Error("Notification client not available");
|
|
124
124
|
const u = window.__notificationSDK?.config;
|
|
125
125
|
if (!u)
|
|
126
126
|
throw new Error("SDK configuration not available");
|
|
127
|
-
const { subscriberId: g, tenantId: T, environmentId:
|
|
128
|
-
if (!g || !T || !
|
|
127
|
+
const { subscriberId: g, tenantId: T, environmentId: m } = u;
|
|
128
|
+
if (!g || !T || !m)
|
|
129
129
|
throw new Error("SubscriberId, TenantId or EnvironmentId not available in config");
|
|
130
|
-
const E = await
|
|
130
|
+
const E = await d.preferences.get(
|
|
131
131
|
T,
|
|
132
132
|
g,
|
|
133
|
-
|
|
133
|
+
m
|
|
134
134
|
), N = {
|
|
135
135
|
channels: {
|
|
136
136
|
email: E.emailEnabled ?? !0,
|
|
@@ -164,7 +164,7 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
164
164
|
} catch (u) {
|
|
165
165
|
const g = u instanceof Error ? u : new Error("Failed to load preferences");
|
|
166
166
|
u?.response?.status === 404 || u?.status === 404 || (n(g), r?.(g));
|
|
167
|
-
const
|
|
167
|
+
const m = {
|
|
168
168
|
channels: {
|
|
169
169
|
email: !0,
|
|
170
170
|
push: !0,
|
|
@@ -181,43 +181,42 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
181
181
|
weekdays: [!0, !0, !0, !0, !0, !1, !1]
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
|
-
f(
|
|
184
|
+
f(m), t(m);
|
|
185
185
|
} finally {
|
|
186
186
|
a(!1);
|
|
187
187
|
}
|
|
188
|
-
}, [
|
|
188
|
+
}, [d, t, r]);
|
|
189
189
|
return b(() => {
|
|
190
|
-
|
|
191
|
-
}, [
|
|
190
|
+
d && w();
|
|
191
|
+
}, [d, w]), {
|
|
192
192
|
isLoading: p,
|
|
193
|
-
error:
|
|
193
|
+
error: o,
|
|
194
194
|
preferences: s
|
|
195
195
|
};
|
|
196
|
-
},
|
|
197
|
-
const t =
|
|
196
|
+
}, ie = () => window.__notificationSDK?.client, ae = () => {
|
|
197
|
+
const t = ie(), [r, d] = C([]), [p, a] = C(!0), [o, n] = C(null), s = y(async () => {
|
|
198
198
|
try {
|
|
199
199
|
if (a(!0), n(null), !t)
|
|
200
|
-
throw new Error("Notification client not available");
|
|
200
|
+
throw new Error("[useWorkflows] Notification client not available");
|
|
201
201
|
const f = window.__notificationSDK?.config;
|
|
202
202
|
if (!f)
|
|
203
|
-
throw new Error("SDK configuration not available");
|
|
204
|
-
const { tenantId:
|
|
205
|
-
if (!
|
|
206
|
-
throw new Error("TenantId or EnvironmentId not available in config");
|
|
203
|
+
throw new Error("[useWorkflows] SDK configuration not available");
|
|
204
|
+
const { tenantId: w, environmentId: u } = f;
|
|
205
|
+
if (!w || !u)
|
|
206
|
+
throw new Error("[useWorkflows] TenantId or EnvironmentId not available in config");
|
|
207
207
|
const T = ((await t.workflows.list(
|
|
208
208
|
{ status: "active" },
|
|
209
|
-
|
|
210
|
-
m,
|
|
209
|
+
w,
|
|
211
210
|
u
|
|
212
|
-
))?.workflows || []).map((
|
|
213
|
-
workflowId:
|
|
214
|
-
name:
|
|
215
|
-
description:
|
|
211
|
+
))?.workflows || []).map((m) => ({
|
|
212
|
+
workflowId: m.workflowId,
|
|
213
|
+
name: m.name || m.workflowId,
|
|
214
|
+
description: m.description
|
|
216
215
|
}));
|
|
217
|
-
|
|
216
|
+
d(T);
|
|
218
217
|
} catch (f) {
|
|
219
|
-
const
|
|
220
|
-
n(
|
|
218
|
+
const w = f instanceof Error ? f : new Error("Failed to load workflows");
|
|
219
|
+
n(w), d([]);
|
|
221
220
|
} finally {
|
|
222
221
|
a(!1);
|
|
223
222
|
}
|
|
@@ -227,11 +226,11 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
227
226
|
}, [t, s]), {
|
|
228
227
|
workflows: r,
|
|
229
228
|
isLoading: p,
|
|
230
|
-
error:
|
|
229
|
+
error: o,
|
|
231
230
|
refetch: s
|
|
232
231
|
};
|
|
233
|
-
},
|
|
234
|
-
const t = H(
|
|
232
|
+
}, W = z(null), se = () => {
|
|
233
|
+
const t = H(W);
|
|
235
234
|
if (!t)
|
|
236
235
|
throw new Error("useSDK must be used within a NotificationWidget");
|
|
237
236
|
return t;
|
|
@@ -266,11 +265,11 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
266
265
|
connected: !1,
|
|
267
266
|
reconnecting: !1
|
|
268
267
|
}
|
|
269
|
-
},
|
|
268
|
+
}, le = ({
|
|
270
269
|
config: t,
|
|
271
270
|
children: r
|
|
272
271
|
}) => {
|
|
273
|
-
const [
|
|
272
|
+
const [d, p] = M.useState({
|
|
274
273
|
client: null,
|
|
275
274
|
isInitialized: !1,
|
|
276
275
|
error: null
|
|
@@ -309,37 +308,37 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
309
308
|
})(), () => {
|
|
310
309
|
a = !1;
|
|
311
310
|
};
|
|
312
|
-
}, [t]), /* @__PURE__ */
|
|
313
|
-
},
|
|
311
|
+
}, [t]), /* @__PURE__ */ l(W.Provider, { value: d, children: r });
|
|
312
|
+
}, de = (t, r) => {
|
|
314
313
|
switch (r.type) {
|
|
315
314
|
case "SET_NOTIFICATIONS":
|
|
316
315
|
return {
|
|
317
316
|
...t,
|
|
318
317
|
notifications: r.payload,
|
|
319
|
-
unreadCount: r.payload.filter((
|
|
318
|
+
unreadCount: r.payload.filter((o) => !o.isRead).length
|
|
320
319
|
};
|
|
321
320
|
case "ADD_NOTIFICATION":
|
|
322
|
-
const
|
|
321
|
+
const d = [r.payload, ...t.notifications];
|
|
323
322
|
return {
|
|
324
323
|
...t,
|
|
325
|
-
notifications:
|
|
326
|
-
unreadCount:
|
|
324
|
+
notifications: d,
|
|
325
|
+
unreadCount: d.filter((o) => !o.isRead).length
|
|
327
326
|
};
|
|
328
327
|
case "UPDATE_NOTIFICATION":
|
|
329
328
|
const p = t.notifications.map(
|
|
330
|
-
(
|
|
329
|
+
(o) => o.id === r.payload.id ? { ...o, ...r.payload.updates } : o
|
|
331
330
|
);
|
|
332
331
|
return {
|
|
333
332
|
...t,
|
|
334
333
|
notifications: p,
|
|
335
|
-
unreadCount: p.filter((
|
|
334
|
+
unreadCount: p.filter((o) => !o.isRead).length
|
|
336
335
|
};
|
|
337
336
|
case "DELETE_NOTIFICATION":
|
|
338
|
-
const a = t.notifications.filter((
|
|
337
|
+
const a = t.notifications.filter((o) => o.id !== r.payload);
|
|
339
338
|
return {
|
|
340
339
|
...t,
|
|
341
340
|
notifications: a,
|
|
342
|
-
unreadCount: a.filter((
|
|
341
|
+
unreadCount: a.filter((o) => !o.isRead).length
|
|
343
342
|
};
|
|
344
343
|
case "SET_PREFERENCES":
|
|
345
344
|
return {
|
|
@@ -362,30 +361,30 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
362
361
|
}, fe = ({
|
|
363
362
|
position: t = "right",
|
|
364
363
|
size: r = "medium",
|
|
365
|
-
theme:
|
|
364
|
+
theme: d = "light",
|
|
366
365
|
className: p = "",
|
|
367
366
|
onError: a
|
|
368
367
|
}) => {
|
|
369
|
-
const [
|
|
368
|
+
const [o, n] = q(de, ce), { client: s, isInitialized: f, error: w } = se(), u = $(null), g = y((e) => {
|
|
370
369
|
n({
|
|
371
370
|
type: "SET_PREFERENCES",
|
|
372
371
|
payload: e
|
|
373
372
|
});
|
|
374
373
|
}, []), T = y((e) => {
|
|
375
374
|
a && a(e);
|
|
376
|
-
}, [a]), { error:
|
|
375
|
+
}, [a]), { error: m } = oe({
|
|
377
376
|
onPreferencesLoaded: g,
|
|
378
377
|
onError: T
|
|
379
378
|
}), { workflows: E, isLoading: N } = ae(), { updatePreference: v, isSaving: _, error: K } = ee({
|
|
380
|
-
preferences:
|
|
379
|
+
preferences: o.preferences,
|
|
381
380
|
onPreferencesChange: g,
|
|
382
381
|
onError: T
|
|
383
382
|
});
|
|
384
383
|
b(() => {
|
|
385
384
|
if (!N && E.length > 0) {
|
|
386
|
-
const e = E.map((
|
|
387
|
-
workflowId:
|
|
388
|
-
name:
|
|
385
|
+
const e = E.map((i) => o.preferences.subscriptions.find((I) => I.workflowId === i.workflowId) || {
|
|
386
|
+
workflowId: i.workflowId,
|
|
387
|
+
name: i.name,
|
|
389
388
|
enabled: !0,
|
|
390
389
|
// Default to enabled
|
|
391
390
|
channels: {
|
|
@@ -395,24 +394,24 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
395
394
|
inApp: !0
|
|
396
395
|
}
|
|
397
396
|
});
|
|
398
|
-
JSON.stringify(e) !== JSON.stringify(
|
|
397
|
+
JSON.stringify(e) !== JSON.stringify(o.preferences.subscriptions) && n({
|
|
399
398
|
type: "SET_PREFERENCES",
|
|
400
399
|
payload: {
|
|
401
|
-
...
|
|
400
|
+
...o.preferences,
|
|
402
401
|
subscriptions: e
|
|
403
402
|
}
|
|
404
403
|
});
|
|
405
404
|
}
|
|
406
|
-
}, [E, N,
|
|
405
|
+
}, [E, N, o.preferences]);
|
|
407
406
|
const A = y((e) => {
|
|
408
407
|
try {
|
|
409
|
-
const
|
|
408
|
+
const i = x();
|
|
410
409
|
switch (e.type) {
|
|
411
410
|
case "notification_received": {
|
|
412
411
|
const c = e.data;
|
|
413
|
-
if (!
|
|
412
|
+
if (!i.validateWebSocketPayload(c))
|
|
414
413
|
break;
|
|
415
|
-
const I =
|
|
414
|
+
const I = i.toWidgetNotificationFromWebSocket(c);
|
|
416
415
|
n({
|
|
417
416
|
type: "ADD_NOTIFICATION",
|
|
418
417
|
payload: I
|
|
@@ -444,7 +443,7 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
444
443
|
}
|
|
445
444
|
} catch {
|
|
446
445
|
}
|
|
447
|
-
}, []),
|
|
446
|
+
}, []), R = y(async () => {
|
|
448
447
|
if (!(!s || !f || u.current))
|
|
449
448
|
try {
|
|
450
449
|
n({
|
|
@@ -511,9 +510,9 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
511
510
|
}, []), P = y(() => {
|
|
512
511
|
n({
|
|
513
512
|
type: "SET_UI_STATE",
|
|
514
|
-
payload: { isOpen: !
|
|
513
|
+
payload: { isOpen: !o.ui.isOpen }
|
|
515
514
|
});
|
|
516
|
-
}, [
|
|
515
|
+
}, [o.ui.isOpen]), U = y(() => {
|
|
517
516
|
n({
|
|
518
517
|
type: "SET_UI_STATE",
|
|
519
518
|
payload: { isOpen: !1 }
|
|
@@ -523,7 +522,7 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
523
522
|
type: "SET_UI_STATE",
|
|
524
523
|
payload: { currentView: e }
|
|
525
524
|
});
|
|
526
|
-
}, []), B = y(async (e,
|
|
525
|
+
}, []), B = y(async (e, i) => {
|
|
527
526
|
if (!s || !f)
|
|
528
527
|
return;
|
|
529
528
|
const c = window.__notificationSDK?.config;
|
|
@@ -531,7 +530,7 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
531
530
|
if (!e)
|
|
532
531
|
throw new Error("notificationId is required");
|
|
533
532
|
try {
|
|
534
|
-
switch (
|
|
533
|
+
switch (i.type) {
|
|
535
534
|
case "mark_read":
|
|
536
535
|
await s.inbox.markAsRead(e, c.tenantId, c.environmentId, c.subscriberId);
|
|
537
536
|
break;
|
|
@@ -545,10 +544,10 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
545
544
|
await s.inbox.delete(e, c.tenantId, c.environmentId, c.subscriberId);
|
|
546
545
|
break;
|
|
547
546
|
default:
|
|
548
|
-
|
|
547
|
+
i.handler && await i.handler(e);
|
|
549
548
|
break;
|
|
550
549
|
}
|
|
551
|
-
switch (
|
|
550
|
+
switch (i.type) {
|
|
552
551
|
case "mark_read":
|
|
553
552
|
n({
|
|
554
553
|
type: "UPDATE_NOTIFICATION",
|
|
@@ -587,8 +586,8 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
587
586
|
type: "SET_UI_STATE",
|
|
588
587
|
payload: { isLoading: !0 }
|
|
589
588
|
});
|
|
590
|
-
const
|
|
591
|
-
if (!
|
|
589
|
+
const i = window.__notificationSDK?.config;
|
|
590
|
+
if (!i)
|
|
592
591
|
throw new Error("SDK configuration not available");
|
|
593
592
|
const c = x(), h = ((await s.inbox.getRenderedNotifications(
|
|
594
593
|
{
|
|
@@ -596,9 +595,9 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
596
595
|
limit: 50,
|
|
597
596
|
offset: 0
|
|
598
597
|
},
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
598
|
+
i.tenantId,
|
|
599
|
+
i.environmentId,
|
|
600
|
+
i.subscriberId
|
|
602
601
|
))?.items || []).map(
|
|
603
602
|
(S) => c.toWidgetNotification(S)
|
|
604
603
|
);
|
|
@@ -609,24 +608,24 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
609
608
|
type: "SET_UI_STATE",
|
|
610
609
|
payload: { isLoading: !1, error: null }
|
|
611
610
|
});
|
|
612
|
-
} catch (
|
|
611
|
+
} catch (i) {
|
|
613
612
|
n({
|
|
614
613
|
type: "SET_UI_STATE",
|
|
615
614
|
payload: {
|
|
616
615
|
isLoading: !1,
|
|
617
|
-
error:
|
|
616
|
+
error: i
|
|
618
617
|
}
|
|
619
|
-
}), a && a(
|
|
618
|
+
}), a && a(i);
|
|
620
619
|
}
|
|
621
620
|
})();
|
|
622
|
-
}, [s, f, a]), b(() => (s && f &&
|
|
621
|
+
}, [s, f, a]), b(() => (s && f && R(), () => {
|
|
623
622
|
F();
|
|
624
623
|
}), [s]), b(() => {
|
|
625
|
-
if (!s || !f ||
|
|
624
|
+
if (!s || !f || o.websocket.connected) return;
|
|
626
625
|
const e = setInterval(async () => {
|
|
627
626
|
try {
|
|
628
|
-
const
|
|
629
|
-
if (!
|
|
627
|
+
const i = window.__notificationSDK?.config;
|
|
628
|
+
if (!i)
|
|
630
629
|
return;
|
|
631
630
|
const c = x(), h = ((await s.inbox.getRenderedNotifications(
|
|
632
631
|
{
|
|
@@ -634,9 +633,9 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
634
633
|
limit: 50,
|
|
635
634
|
offset: 0
|
|
636
635
|
},
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
636
|
+
i.tenantId,
|
|
637
|
+
i.environmentId,
|
|
638
|
+
i.subscriberId
|
|
640
639
|
))?.items || []).map(
|
|
641
640
|
(S) => c.toWidgetNotification(S)
|
|
642
641
|
);
|
|
@@ -648,11 +647,11 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
648
647
|
}
|
|
649
648
|
}, 3e4);
|
|
650
649
|
return () => clearInterval(e);
|
|
651
|
-
}, [s,
|
|
652
|
-
const e = (
|
|
653
|
-
if (
|
|
650
|
+
}, [s, o.websocket.connected]), b(() => {
|
|
651
|
+
const e = (i) => {
|
|
652
|
+
if (i.key === "notification_widget_sync" && i.newValue)
|
|
654
653
|
try {
|
|
655
|
-
const c = JSON.parse(
|
|
654
|
+
const c = JSON.parse(i.newValue);
|
|
656
655
|
A(c);
|
|
657
656
|
} catch {
|
|
658
657
|
}
|
|
@@ -664,19 +663,19 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
664
663
|
payload: { isLoading: _ }
|
|
665
664
|
});
|
|
666
665
|
}, [_]), b(() => {
|
|
667
|
-
const e =
|
|
666
|
+
const e = w || K || m;
|
|
668
667
|
e && n({
|
|
669
668
|
type: "SET_UI_STATE",
|
|
670
669
|
payload: { error: e }
|
|
671
670
|
});
|
|
672
|
-
}, [
|
|
671
|
+
}, [w, K, m]), !f && !w ? /* @__PURE__ */ l(
|
|
673
672
|
"div",
|
|
674
673
|
{
|
|
675
674
|
className: `relative inline-block ${p}`,
|
|
676
675
|
"data-widget-size": r || "small",
|
|
677
|
-
"data-theme":
|
|
676
|
+
"data-theme": d,
|
|
678
677
|
"data-testid": "notification-widget",
|
|
679
|
-
children: /* @__PURE__ */
|
|
678
|
+
children: /* @__PURE__ */ l(O, { componentName: "BellComponent", children: /* @__PURE__ */ l(
|
|
680
679
|
D,
|
|
681
680
|
{
|
|
682
681
|
unreadCount: 0,
|
|
@@ -687,25 +686,25 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
687
686
|
}
|
|
688
687
|
) })
|
|
689
688
|
}
|
|
690
|
-
) :
|
|
689
|
+
) : w ? /* @__PURE__ */ l(
|
|
691
690
|
"div",
|
|
692
691
|
{
|
|
693
692
|
className: `relative inline-block ${p}`,
|
|
694
693
|
"data-widget-size": r || "small",
|
|
695
|
-
"data-theme":
|
|
694
|
+
"data-theme": d,
|
|
696
695
|
"data-testid": "notification-widget",
|
|
697
|
-
children: /* @__PURE__ */
|
|
696
|
+
children: /* @__PURE__ */ l(
|
|
698
697
|
O,
|
|
699
698
|
{
|
|
700
699
|
componentName: "BellComponent",
|
|
701
|
-
fallback: /* @__PURE__ */
|
|
700
|
+
fallback: /* @__PURE__ */ l(
|
|
702
701
|
X,
|
|
703
702
|
{
|
|
704
|
-
error:
|
|
703
|
+
error: w.message,
|
|
705
704
|
onRetry: () => window.location.reload()
|
|
706
705
|
}
|
|
707
706
|
),
|
|
708
|
-
children: /* @__PURE__ */
|
|
707
|
+
children: /* @__PURE__ */ l(
|
|
709
708
|
D,
|
|
710
709
|
{
|
|
711
710
|
unreadCount: 0,
|
|
@@ -723,34 +722,34 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
723
722
|
{
|
|
724
723
|
className: `relative inline-block ${p}`,
|
|
725
724
|
"data-widget-size": r || "small",
|
|
726
|
-
"data-theme":
|
|
725
|
+
"data-theme": d,
|
|
727
726
|
"data-testid": "notification-widget",
|
|
728
727
|
children: [
|
|
729
|
-
/* @__PURE__ */
|
|
728
|
+
/* @__PURE__ */ l(O, { componentName: "BellComponent", children: /* @__PURE__ */ l(
|
|
730
729
|
D,
|
|
731
730
|
{
|
|
732
|
-
unreadCount:
|
|
731
|
+
unreadCount: o.unreadCount,
|
|
733
732
|
onClick: P,
|
|
734
733
|
size: r,
|
|
735
|
-
disabled:
|
|
734
|
+
disabled: o.ui.isLoading
|
|
736
735
|
}
|
|
737
736
|
) }),
|
|
738
|
-
/* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ l(
|
|
739
738
|
O,
|
|
740
739
|
{
|
|
741
740
|
componentName: "InboxPopover",
|
|
742
|
-
fallback: /* @__PURE__ */
|
|
743
|
-
children: /* @__PURE__ */
|
|
741
|
+
fallback: /* @__PURE__ */ l(Z, { message: "Unable to load notifications" }),
|
|
742
|
+
children: /* @__PURE__ */ l(
|
|
744
743
|
Y,
|
|
745
744
|
{
|
|
746
|
-
isOpen:
|
|
745
|
+
isOpen: o.ui.isOpen,
|
|
747
746
|
onClose: U,
|
|
748
747
|
position: t,
|
|
749
|
-
currentView:
|
|
748
|
+
currentView: o.ui.currentView,
|
|
750
749
|
onViewChange: L,
|
|
751
|
-
notifications:
|
|
750
|
+
notifications: o.notifications,
|
|
752
751
|
onNotificationAction: B,
|
|
753
|
-
preferences:
|
|
752
|
+
preferences: o.preferences,
|
|
754
753
|
onPreferenceChange: v,
|
|
755
754
|
isPreferencesLoading: _
|
|
756
755
|
}
|
|
@@ -763,7 +762,7 @@ const re = () => window.__notificationSDK?.client, ie = ({
|
|
|
763
762
|
}, ye = ({
|
|
764
763
|
sdkConfig: t,
|
|
765
764
|
...r
|
|
766
|
-
}) => /* @__PURE__ */
|
|
765
|
+
}) => /* @__PURE__ */ l(ne, { onError: r.onError, children: /* @__PURE__ */ l(le, { config: t, children: /* @__PURE__ */ l(fe, { ...r }) }) }), be = "3.0.0", ge = "@edusight/notification-widget";
|
|
767
766
|
export {
|
|
768
767
|
D as BellComponent,
|
|
769
768
|
Y as InboxPopover,
|