@everymatrix/nuts-inbox-widget 1.91.0 → 1.91.1

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.
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-4522ef7e.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
- const SUPPORTED_LANGUAGES = ['hu', 'en', 'tr'];
9
8
  const TRANSLATIONS = {
10
9
  en: {
11
10
  notifications: 'Notifications',
@@ -39,11 +38,33 @@ const TRANSLATIONS = {
39
38
  deleteAllMessages: 'Delete all messages',
40
39
  next: 'Következő',
41
40
  prev: 'Előző'
41
+ },
42
+ az: {
43
+ notifications: "Bildirişlər",
44
+ noMessages: "Burada hələ yeni heç nə yoxdur",
45
+ markAllAsRead: "Hamısını oxunmuş kimi işarələ",
46
+ markAsRead: "Oxunmuş kimi işarələ",
47
+ markAsUnread: "Oxunmamış kimi işarələ",
48
+ removeMessage: "Mesajı sil",
49
+ deleteAllMessages: "Bütün mesajları sil",
50
+ next: "Növbəti",
51
+ prev: "Əvvəlki"
52
+ },
53
+ es: {
54
+ notifications: "Notificaciones",
55
+ noMessages: "Aún no hay nada nuevo por aquí",
56
+ markAllAsRead: "Marcar todo como leído",
57
+ markAsRead: "Marcar como leído",
58
+ markAsUnread: "Marcar como no leído",
59
+ removeMessage: "Eliminar el mensaje",
60
+ deleteAllMessages: "Eliminar todos los mensajes",
61
+ next: "Siguiente",
62
+ prev: "Anterior"
42
63
  }
43
64
  };
44
65
  const translate$1 = (key, customLang, values) => {
45
66
  const lang = customLang;
46
- let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
67
+ let translation = TRANSLATIONS[lang !== undefined && lang in TRANSLATIONS ? lang : DEFAULT_LANGUAGE][key];
47
68
  if (values !== undefined) {
48
69
  for (const [key, value] of Object.entries(values.values)) {
49
70
  const regex = new RegExp(`{${key}}`, 'g');
@@ -59,11 +80,18 @@ const getTranslations = (url) => {
59
80
  .then((res) => res.json())
60
81
  .then((data) => {
61
82
  Object.keys(data).forEach((item) => {
83
+ if (!TRANSLATIONS[item]) {
84
+ TRANSLATIONS[item] = {};
85
+ }
62
86
  for (let key in data[item]) {
63
87
  TRANSLATIONS[item][key] = data[item][key];
64
88
  }
65
89
  });
66
90
  resolve(true);
91
+ })
92
+ .catch((err) => {
93
+ console.error('Failed to fetch translations:', err);
94
+ resolve(false);
67
95
  });
68
96
  });
69
97
  };
@@ -42360,9 +42388,10 @@ function renderAbstractNodeToSVGElement(node, options) {
42360
42388
 
42361
42389
  const MAX_NOTIFICATION_TEXT_LENGTH = 200;
42362
42390
  const MAX_NOTIFICATION_LINES = 5;
42391
+ const BLOCK_ELEMENT_REGEX = /<br\s*\/?>|<\/p>|<\/h[1-6]>|<\/?blockquote>/gi;
42363
42392
 
42364
42393
  const truncate = (str, maxChars, maxLines) => {
42365
- var _a, _b, _c;
42394
+ var _a;
42366
42395
  if (!str || maxChars < 0)
42367
42396
  return "";
42368
42397
  const parser = new DOMParser();
@@ -42370,29 +42399,37 @@ const truncate = (str, maxChars, maxLines) => {
42370
42399
  let charCount = 0;
42371
42400
  let lineCount = 0;
42372
42401
  const walker = doc.createTreeWalker(doc.body, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT);
42402
+ const removeAfter = (node) => {
42403
+ let current = node;
42404
+ while (current && current !== doc.body) {
42405
+ const parent = current.parentNode;
42406
+ if (!parent)
42407
+ break;
42408
+ while (current.nextSibling) {
42409
+ parent.removeChild(current.nextSibling);
42410
+ }
42411
+ current = parent;
42412
+ }
42413
+ };
42373
42414
  while (walker.nextNode()) {
42374
42415
  const node = walker.currentNode;
42375
42416
  if (node.nodeType === Node.TEXT_NODE) {
42376
42417
  const text = node.textContent || "";
42377
42418
  if (charCount + text.length > maxChars) {
42378
42419
  node.textContent = text.slice(0, maxChars - charCount) + "...";
42379
- while (node.nextSibling) {
42380
- (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(node.nextSibling);
42381
- }
42420
+ removeAfter(node);
42382
42421
  break;
42383
42422
  }
42384
42423
  charCount += text.length;
42385
42424
  }
42386
42425
  else {
42387
42426
  const tagName = node.nodeName.toLowerCase();
42388
- if (tagName === "br" || /^h[1-6]$/.test(tagName) || tagName === "p") {
42427
+ if (tagName === "br" || /^h[1-6]$/.test(tagName) || tagName === "p" || tagName === "blockquote") {
42389
42428
  lineCount++;
42390
42429
  if (lineCount >= maxLines) {
42391
42430
  const ellipsis = doc.createTextNode("...");
42392
- (_b = node.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(ellipsis, node.nextSibling);
42393
- while (node.nextSibling) {
42394
- (_c = node.parentNode) === null || _c === void 0 ? void 0 : _c.removeChild(node.nextSibling);
42395
- }
42431
+ (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(ellipsis, node);
42432
+ removeAfter(ellipsis);
42396
42433
  break;
42397
42434
  }
42398
42435
  }
@@ -42521,7 +42558,7 @@ const NutsNotification = class {
42521
42558
  }
42522
42559
  const fullyStrippedContent = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] });
42523
42560
  if ((fullyStrippedContent === null || fullyStrippedContent === void 0 ? void 0 : fullyStrippedContent.length) <= this.maxTextLength &&
42524
- (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(/<br\s*\/?>|<\/p>|<\/h[1-6]>/gi)) || []).length <= this.maxLines) {
42561
+ (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(BLOCK_ELEMENT_REGEX)) || []).length <= this.maxLines) {
42525
42562
  return;
42526
42563
  }
42527
42564
  this.displayedContent = truncate(this.content, this.maxTextLength, this.maxLines);
@@ -42630,7 +42667,7 @@ const NutsNotification = class {
42630
42667
  this.messageRead = this.read;
42631
42668
  const fullyStrippedContent = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] });
42632
42669
  if ((fullyStrippedContent === null || fullyStrippedContent === void 0 ? void 0 : fullyStrippedContent.length) > this.maxTextLength ||
42633
- (((_a = this.content) === null || _a === void 0 ? void 0 : _a.match(/<br\s*\/?>|<\/p>|<\/h[1-6]>/gi)) || []).length) {
42670
+ (((_a = this.content) === null || _a === void 0 ? void 0 : _a.match(BLOCK_ELEMENT_REGEX)) || []).length) {
42634
42671
  this.displayedContent = truncate(this.content, this.maxTextLength, this.maxLines);
42635
42672
  }
42636
42673
  else {
@@ -42674,11 +42711,11 @@ const NutsNotification = class {
42674
42711
  'img'
42675
42712
  ]
42676
42713
  });
42677
- return (index.h("div", { key: 'ac04933f45fbcc0c100615388fe010528c422f6f', class: "Wrapper", onClick: this.markNotificationAsRead }, index.h("div", { key: 'c85d1cdefb959c390c8db554864f2756809a5341', class: 'NotificationContainer' + (this.messageSeen ? '' : ' Unseen'), ref: this.assignRefToStylingContainer, onClick: this.notificationActionHandler }, this.badge ? (index.h("div", { class: "AvatarContainer" }, index.h("div", { class: "Avatar" }, ((_a = systemIcons[this.badge]) === null || _a === void 0 ? void 0 : _a.icon) ? (index.h("div", { innerHTML: systemIcons[this.badge].icon })) : (index.h("img", { class: "AvatarImage", src: this.badge }))))) : (''), index.h("div", { key: 'f58174fbeb1041f6f94e2032f01802702ecea9af', class: "ContentContainer" }, index.h("div", { key: '0b35a305a4d7385e324f27463bd9f3f00ccd1ea9', innerHTML: sanitizedNotificationBody, class: "NotificationBody" }), index.h("p", { key: '11baf24cfea3d48cf3366c97eaed8f7921abd2f3', class: "Date" }, formatDistanceToNow(new Date(this.date), {
42714
+ return (index.h("div", { key: 'a6e5c8ad297e9c99dc4955ec7aad14b201abf523', class: "Wrapper", onClick: this.markNotificationAsRead }, index.h("div", { key: '1e92d30f79d7eda3ee3d2592299bc4969cf41ede', class: 'NotificationContainer' + (this.messageSeen ? '' : ' Unseen'), ref: this.assignRefToStylingContainer, onClick: this.notificationActionHandler }, this.badge ? (index.h("div", { class: "AvatarContainer" }, index.h("div", { class: "Avatar" }, ((_a = systemIcons[this.badge]) === null || _a === void 0 ? void 0 : _a.icon) ? (index.h("div", { innerHTML: systemIcons[this.badge].icon })) : (index.h("img", { class: "AvatarImage", src: this.badge }))))) : (''), index.h("div", { key: 'c6df1cc1801ac038933ebc8986c66f2cf81c3833', class: "ContentContainer" }, index.h("div", { key: 'f15effff484f5f8679e31d05a794ac9ffd6462a8', innerHTML: sanitizedNotificationBody, class: "NotificationBody" }), index.h("p", { key: '24966927ff1e452a00482dfb9d9527a1d1d85742', class: "Date" }, formatDistanceToNow(new Date(this.date), {
42678
42715
  addSuffix: true,
42679
42716
  locale: dateFnsLocale(this.language)
42680
- }))), index.h("div", { key: '87670fb6228e11ff3097fdaee66d005d0fb06a6a', class: "RightActionsContainer" }, index.h("div", { key: 'f858a84bb3dea7486397c80af4aa3e8e0fc7f395', class: "Settings", onClick: this.toggleSettingsModal }, index.h("svg", { key: '3312814097d3d29d8f299e218b172b130bf2e93a', width: "24", height: "24", viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { key: 'e58f7b83f66e95d6866354578a07fefe5a938da3', d: "M20.625 15.5C20.625 16.5547 21.4453 17.375 22.5 17.375C23.5156 17.375 24.375 16.5547 24.375 15.5C24.375 14.4844 23.5156 13.625 22.5 13.625C21.4453 13.625 20.625 14.4844 20.625 15.5ZM9.375 15.5C9.375 14.4844 8.51562 13.625 7.5 13.625C6.44531 13.625 5.625 14.4844 5.625 15.5C5.625 16.5547 6.44531 17.375 7.5 17.375C8.51562 17.375 9.375 16.5547 9.375 15.5ZM16.875 15.5C16.875 14.4844 16.0156 13.625 15 13.625C13.9453 13.625 13.125 14.4844 13.125 15.5C13.125 16.5547 13.9453 17.375 15 17.375C16.0156 17.375 16.875 16.5547 16.875 15.5Z", fill: "currentColor" }))), (((_b = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] })) === null || _b === void 0 ? void 0 : _b.length) > this.maxTextLength ||
42681
- (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(/<br\s*\/?>|<\/p>|<\/h[1-6]>/gi)) || []).length > this.maxLines) && (index.h("div", { key: '33109a51a711b637f50593731721c98a08ca0157', class: "AccordionArrow", innerHTML: systemIcons.arrowDown.icon, ref: this.assignRefToDropdownArrow, onClick: this.accordionArrowClickHandler })))), this.showSettingsModal ? (index.h("div", { class: "SettingsDropdown" }, index.h("button", { onClick: this.toggleNotificationRead }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M14.9434 5.17969C14.2109 4.59375 13.625 4.125 10.1387 1.60547C9.64062 1.25391 8.67383 0.375 8 0.375V0.404297C7.9707 0.404297 7.9707 0.375 7.9707 0.375C7.29688 0.375 6.33008 1.25391 5.83203 1.60547C2.3457 4.125 1.75977 4.59375 1.02734 5.17969C0.675781 5.44336 0.5 5.85352 0.5 6.26367V13.9688C0.5 14.7598 1.11523 15.375 1.90625 15.375H14.0938C14.8555 15.375 15.5 14.7598 15.5 13.9688V6.26367C15.5 5.85352 15.2949 5.44336 14.9434 5.17969ZM9.37695 11.1562C8.9668 11.4785 8.46875 11.6543 8 11.6543C7.50195 11.6543 7.00391 11.4785 6.59375 11.1562L2.375 7.8457V6.49805C2.99023 6 3.72266 5.44336 6.94531 3.12891C7.0332 3.04102 7.15039 2.95312 7.26758 2.86523C7.41406 2.74805 7.73633 2.48438 8 2.33789C8.23438 2.48438 8.55664 2.74805 8.70312 2.86523C8.82031 2.95312 8.9375 3.04102 9.02539 3.12891C12.2188 5.44336 12.9805 6 13.625 6.49805V7.8457L9.37695 11.1562Z", fill: "currentColor" })), translate$1(this.messageRead ? 'markAsUnread' : 'markAsRead', this.language)), index.h("button", { onClick: this.deleteNotification }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M4.375 15.4375C4.375 16.1758 4.94922 16.75 5.6875 16.75H13.5625C14.2734 16.75 14.875 16.1758 14.875 15.4375V6.25H4.375V15.4375ZM11.8125 8.4375C11.8125 8.21875 12.0039 8 12.25 8C12.4688 8 12.6875 8.21875 12.6875 8.4375V14.5625C12.6875 14.8086 12.4688 15 12.25 15C12.0039 15 11.8125 14.8086 11.8125 14.5625V8.4375ZM9.1875 8.4375C9.1875 8.21875 9.37891 8 9.625 8C9.84375 8 10.0625 8.21875 10.0625 8.4375V14.5625C10.0625 14.8086 9.84375 15 9.625 15C9.37891 15 9.1875 14.8086 9.1875 14.5625V8.4375ZM6.5625 8.4375C6.5625 8.21875 6.75391 8 7 8C7.21875 8 7.4375 8.21875 7.4375 8.4375V14.5625C7.4375 14.8086 7.21875 15 7 15C6.75391 15 6.5625 14.8086 6.5625 14.5625V8.4375ZM15.3125 3.625H12.25L11.9219 2.99609C11.8398 2.85938 11.7031 2.75 11.5391 2.75H7.68359C7.51953 2.75 7.38281 2.85938 7.30078 2.99609L7 3.625H3.9375C3.69141 3.625 3.5 3.84375 3.5 4.0625V4.9375C3.5 5.18359 3.69141 5.375 3.9375 5.375H15.3125C15.5312 5.375 15.75 5.18359 15.75 4.9375V4.0625C15.75 3.84375 15.5312 3.625 15.3125 3.625Z", fill: "currentColor" })), translate$1('removeMessage', this.language)))) : ('')));
42717
+ }))), index.h("div", { key: '71556828f255616171d3003b9a1b71f8c085d3f4', class: "RightActionsContainer" }, index.h("div", { key: 'e15d3cd943e119c5d9f221083cb1a7fe20b6995a', class: "Settings", onClick: this.toggleSettingsModal }, index.h("svg", { key: '1af781321dc8f23582f33ed55061012242236cc0', width: "24", height: "24", viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { key: 'e79e7ef95efef24b70a2ba6389e57f385ea6a266', d: "M20.625 15.5C20.625 16.5547 21.4453 17.375 22.5 17.375C23.5156 17.375 24.375 16.5547 24.375 15.5C24.375 14.4844 23.5156 13.625 22.5 13.625C21.4453 13.625 20.625 14.4844 20.625 15.5ZM9.375 15.5C9.375 14.4844 8.51562 13.625 7.5 13.625C6.44531 13.625 5.625 14.4844 5.625 15.5C5.625 16.5547 6.44531 17.375 7.5 17.375C8.51562 17.375 9.375 16.5547 9.375 15.5ZM16.875 15.5C16.875 14.4844 16.0156 13.625 15 13.625C13.9453 13.625 13.125 14.4844 13.125 15.5C13.125 16.5547 13.9453 17.375 15 17.375C16.0156 17.375 16.875 16.5547 16.875 15.5Z", fill: "currentColor" }))), (((_b = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] })) === null || _b === void 0 ? void 0 : _b.length) > this.maxTextLength ||
42718
+ (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(BLOCK_ELEMENT_REGEX)) || []).length > this.maxLines) && (index.h("div", { key: '56cdc3008e063cd38f1aeea1ce5aee111d97862b', class: "AccordionArrow", innerHTML: systemIcons.arrowDown.icon, ref: this.assignRefToDropdownArrow, onClick: this.accordionArrowClickHandler })))), this.showSettingsModal ? (index.h("div", { class: "SettingsDropdown" }, index.h("button", { onClick: this.toggleNotificationRead }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M14.9434 5.17969C14.2109 4.59375 13.625 4.125 10.1387 1.60547C9.64062 1.25391 8.67383 0.375 8 0.375V0.404297C7.9707 0.404297 7.9707 0.375 7.9707 0.375C7.29688 0.375 6.33008 1.25391 5.83203 1.60547C2.3457 4.125 1.75977 4.59375 1.02734 5.17969C0.675781 5.44336 0.5 5.85352 0.5 6.26367V13.9688C0.5 14.7598 1.11523 15.375 1.90625 15.375H14.0938C14.8555 15.375 15.5 14.7598 15.5 13.9688V6.26367C15.5 5.85352 15.2949 5.44336 14.9434 5.17969ZM9.37695 11.1562C8.9668 11.4785 8.46875 11.6543 8 11.6543C7.50195 11.6543 7.00391 11.4785 6.59375 11.1562L2.375 7.8457V6.49805C2.99023 6 3.72266 5.44336 6.94531 3.12891C7.0332 3.04102 7.15039 2.95312 7.26758 2.86523C7.41406 2.74805 7.73633 2.48438 8 2.33789C8.23438 2.48438 8.55664 2.74805 8.70312 2.86523C8.82031 2.95312 8.9375 3.04102 9.02539 3.12891C12.2188 5.44336 12.9805 6 13.625 6.49805V7.8457L9.37695 11.1562Z", fill: "currentColor" })), translate$1(this.messageRead ? 'markAsUnread' : 'markAsRead', this.language)), index.h("button", { onClick: this.deleteNotification }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M4.375 15.4375C4.375 16.1758 4.94922 16.75 5.6875 16.75H13.5625C14.2734 16.75 14.875 16.1758 14.875 15.4375V6.25H4.375V15.4375ZM11.8125 8.4375C11.8125 8.21875 12.0039 8 12.25 8C12.4688 8 12.6875 8.21875 12.6875 8.4375V14.5625C12.6875 14.8086 12.4688 15 12.25 15C12.0039 15 11.8125 14.8086 11.8125 14.5625V8.4375ZM9.1875 8.4375C9.1875 8.21875 9.37891 8 9.625 8C9.84375 8 10.0625 8.21875 10.0625 8.4375V14.5625C10.0625 14.8086 9.84375 15 9.625 15C9.37891 15 9.1875 14.8086 9.1875 14.5625V8.4375ZM6.5625 8.4375C6.5625 8.21875 6.75391 8 7 8C7.21875 8 7.4375 8.21875 7.4375 8.4375V14.5625C7.4375 14.8086 7.21875 15 7 15C6.75391 15 6.5625 14.8086 6.5625 14.5625V8.4375ZM15.3125 3.625H12.25L11.9219 2.99609C11.8398 2.85938 11.7031 2.75 11.5391 2.75H7.68359C7.51953 2.75 7.38281 2.85938 7.30078 2.99609L7 3.625H3.9375C3.69141 3.625 3.5 3.84375 3.5 4.0625V4.9375C3.5 5.18359 3.69141 5.375 3.9375 5.375H15.3125C15.5312 5.375 15.75 5.18359 15.75 4.9375V4.0625C15.75 3.84375 15.5312 3.625 15.3125 3.625Z", fill: "currentColor" })), translate$1('removeMessage', this.language)))) : ('')));
42682
42719
  }
42683
42720
  get el() { return index.getElement(this); }
42684
42721
  static get watchers() { return {
@@ -1,2 +1,3 @@
1
1
  export const MAX_NOTIFICATION_TEXT_LENGTH = 200;
2
2
  export const MAX_NOTIFICATION_LINES = 5;
3
+ export const BLOCK_ELEMENT_REGEX = /<br\s*\/?>|<\/p>|<\/h[1-6]>|<\/?blockquote>/gi;
@@ -5,7 +5,7 @@ import * as dateFnsLocales from "date-fns/locale";
5
5
  import DOMPurify from "dompurify";
6
6
  import { WarningFilled, InfoCircleFilled, CheckCircleFilled, CloseCircleFilled, UpCircleFilled, QuestionCircleFilled, DownOutlined } from "@ant-design/icons-svg";
7
7
  import { renderIconDefinitionToSVGElement } from "@ant-design/icons-svg/es/helpers";
8
- import { MAX_NOTIFICATION_LINES, MAX_NOTIFICATION_TEXT_LENGTH } from "./constants";
8
+ import { BLOCK_ELEMENT_REGEX, MAX_NOTIFICATION_LINES, MAX_NOTIFICATION_TEXT_LENGTH } from "./constants";
9
9
  import { truncate } from "../../utils/utils";
10
10
  import { deleteMessage, markAsRead } from "../../api/methods";
11
11
  const systemIcons = {
@@ -123,7 +123,7 @@ export class NutsNotification {
123
123
  }
124
124
  const fullyStrippedContent = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] });
125
125
  if ((fullyStrippedContent === null || fullyStrippedContent === void 0 ? void 0 : fullyStrippedContent.length) <= this.maxTextLength &&
126
- (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(/<br\s*\/?>|<\/p>|<\/h[1-6]>/gi)) || []).length <= this.maxLines) {
126
+ (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(BLOCK_ELEMENT_REGEX)) || []).length <= this.maxLines) {
127
127
  return;
128
128
  }
129
129
  this.displayedContent = truncate(this.content, this.maxTextLength, this.maxLines);
@@ -232,7 +232,7 @@ export class NutsNotification {
232
232
  this.messageRead = this.read;
233
233
  const fullyStrippedContent = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] });
234
234
  if ((fullyStrippedContent === null || fullyStrippedContent === void 0 ? void 0 : fullyStrippedContent.length) > this.maxTextLength ||
235
- (((_a = this.content) === null || _a === void 0 ? void 0 : _a.match(/<br\s*\/?>|<\/p>|<\/h[1-6]>/gi)) || []).length) {
235
+ (((_a = this.content) === null || _a === void 0 ? void 0 : _a.match(BLOCK_ELEMENT_REGEX)) || []).length) {
236
236
  this.displayedContent = truncate(this.content, this.maxTextLength, this.maxLines);
237
237
  }
238
238
  else {
@@ -276,11 +276,11 @@ export class NutsNotification {
276
276
  'img'
277
277
  ]
278
278
  });
279
- return (h("div", { key: 'ac04933f45fbcc0c100615388fe010528c422f6f', class: "Wrapper", onClick: this.markNotificationAsRead }, h("div", { key: 'c85d1cdefb959c390c8db554864f2756809a5341', class: 'NotificationContainer' + (this.messageSeen ? '' : ' Unseen'), ref: this.assignRefToStylingContainer, onClick: this.notificationActionHandler }, this.badge ? (h("div", { class: "AvatarContainer" }, h("div", { class: "Avatar" }, ((_a = systemIcons[this.badge]) === null || _a === void 0 ? void 0 : _a.icon) ? (h("div", { innerHTML: systemIcons[this.badge].icon })) : (h("img", { class: "AvatarImage", src: this.badge }))))) : (''), h("div", { key: 'f58174fbeb1041f6f94e2032f01802702ecea9af', class: "ContentContainer" }, h("div", { key: '0b35a305a4d7385e324f27463bd9f3f00ccd1ea9', innerHTML: sanitizedNotificationBody, class: "NotificationBody" }), h("p", { key: '11baf24cfea3d48cf3366c97eaed8f7921abd2f3', class: "Date" }, formatDistanceToNow(new Date(this.date), {
279
+ return (h("div", { key: 'a6e5c8ad297e9c99dc4955ec7aad14b201abf523', class: "Wrapper", onClick: this.markNotificationAsRead }, h("div", { key: '1e92d30f79d7eda3ee3d2592299bc4969cf41ede', class: 'NotificationContainer' + (this.messageSeen ? '' : ' Unseen'), ref: this.assignRefToStylingContainer, onClick: this.notificationActionHandler }, this.badge ? (h("div", { class: "AvatarContainer" }, h("div", { class: "Avatar" }, ((_a = systemIcons[this.badge]) === null || _a === void 0 ? void 0 : _a.icon) ? (h("div", { innerHTML: systemIcons[this.badge].icon })) : (h("img", { class: "AvatarImage", src: this.badge }))))) : (''), h("div", { key: 'c6df1cc1801ac038933ebc8986c66f2cf81c3833', class: "ContentContainer" }, h("div", { key: 'f15effff484f5f8679e31d05a794ac9ffd6462a8', innerHTML: sanitizedNotificationBody, class: "NotificationBody" }), h("p", { key: '24966927ff1e452a00482dfb9d9527a1d1d85742', class: "Date" }, formatDistanceToNow(new Date(this.date), {
280
280
  addSuffix: true,
281
281
  locale: dateFnsLocale(this.language)
282
- }))), h("div", { key: '87670fb6228e11ff3097fdaee66d005d0fb06a6a', class: "RightActionsContainer" }, h("div", { key: 'f858a84bb3dea7486397c80af4aa3e8e0fc7f395', class: "Settings", onClick: this.toggleSettingsModal }, h("svg", { key: '3312814097d3d29d8f299e218b172b130bf2e93a', width: "24", height: "24", viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'e58f7b83f66e95d6866354578a07fefe5a938da3', d: "M20.625 15.5C20.625 16.5547 21.4453 17.375 22.5 17.375C23.5156 17.375 24.375 16.5547 24.375 15.5C24.375 14.4844 23.5156 13.625 22.5 13.625C21.4453 13.625 20.625 14.4844 20.625 15.5ZM9.375 15.5C9.375 14.4844 8.51562 13.625 7.5 13.625C6.44531 13.625 5.625 14.4844 5.625 15.5C5.625 16.5547 6.44531 17.375 7.5 17.375C8.51562 17.375 9.375 16.5547 9.375 15.5ZM16.875 15.5C16.875 14.4844 16.0156 13.625 15 13.625C13.9453 13.625 13.125 14.4844 13.125 15.5C13.125 16.5547 13.9453 17.375 15 17.375C16.0156 17.375 16.875 16.5547 16.875 15.5Z", fill: "currentColor" }))), (((_b = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] })) === null || _b === void 0 ? void 0 : _b.length) > this.maxTextLength ||
283
- (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(/<br\s*\/?>|<\/p>|<\/h[1-6]>/gi)) || []).length > this.maxLines) && (h("div", { key: '33109a51a711b637f50593731721c98a08ca0157', class: "AccordionArrow", innerHTML: systemIcons.arrowDown.icon, ref: this.assignRefToDropdownArrow, onClick: this.accordionArrowClickHandler })))), this.showSettingsModal ? (h("div", { class: "SettingsDropdown" }, h("button", { onClick: this.toggleNotificationRead }, h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M14.9434 5.17969C14.2109 4.59375 13.625 4.125 10.1387 1.60547C9.64062 1.25391 8.67383 0.375 8 0.375V0.404297C7.9707 0.404297 7.9707 0.375 7.9707 0.375C7.29688 0.375 6.33008 1.25391 5.83203 1.60547C2.3457 4.125 1.75977 4.59375 1.02734 5.17969C0.675781 5.44336 0.5 5.85352 0.5 6.26367V13.9688C0.5 14.7598 1.11523 15.375 1.90625 15.375H14.0938C14.8555 15.375 15.5 14.7598 15.5 13.9688V6.26367C15.5 5.85352 15.2949 5.44336 14.9434 5.17969ZM9.37695 11.1562C8.9668 11.4785 8.46875 11.6543 8 11.6543C7.50195 11.6543 7.00391 11.4785 6.59375 11.1562L2.375 7.8457V6.49805C2.99023 6 3.72266 5.44336 6.94531 3.12891C7.0332 3.04102 7.15039 2.95312 7.26758 2.86523C7.41406 2.74805 7.73633 2.48438 8 2.33789C8.23438 2.48438 8.55664 2.74805 8.70312 2.86523C8.82031 2.95312 8.9375 3.04102 9.02539 3.12891C12.2188 5.44336 12.9805 6 13.625 6.49805V7.8457L9.37695 11.1562Z", fill: "currentColor" })), translate(this.messageRead ? 'markAsUnread' : 'markAsRead', this.language)), h("button", { onClick: this.deleteNotification }, h("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M4.375 15.4375C4.375 16.1758 4.94922 16.75 5.6875 16.75H13.5625C14.2734 16.75 14.875 16.1758 14.875 15.4375V6.25H4.375V15.4375ZM11.8125 8.4375C11.8125 8.21875 12.0039 8 12.25 8C12.4688 8 12.6875 8.21875 12.6875 8.4375V14.5625C12.6875 14.8086 12.4688 15 12.25 15C12.0039 15 11.8125 14.8086 11.8125 14.5625V8.4375ZM9.1875 8.4375C9.1875 8.21875 9.37891 8 9.625 8C9.84375 8 10.0625 8.21875 10.0625 8.4375V14.5625C10.0625 14.8086 9.84375 15 9.625 15C9.37891 15 9.1875 14.8086 9.1875 14.5625V8.4375ZM6.5625 8.4375C6.5625 8.21875 6.75391 8 7 8C7.21875 8 7.4375 8.21875 7.4375 8.4375V14.5625C7.4375 14.8086 7.21875 15 7 15C6.75391 15 6.5625 14.8086 6.5625 14.5625V8.4375ZM15.3125 3.625H12.25L11.9219 2.99609C11.8398 2.85938 11.7031 2.75 11.5391 2.75H7.68359C7.51953 2.75 7.38281 2.85938 7.30078 2.99609L7 3.625H3.9375C3.69141 3.625 3.5 3.84375 3.5 4.0625V4.9375C3.5 5.18359 3.69141 5.375 3.9375 5.375H15.3125C15.5312 5.375 15.75 5.18359 15.75 4.9375V4.0625C15.75 3.84375 15.5312 3.625 15.3125 3.625Z", fill: "currentColor" })), translate('removeMessage', this.language)))) : ('')));
282
+ }))), h("div", { key: '71556828f255616171d3003b9a1b71f8c085d3f4', class: "RightActionsContainer" }, h("div", { key: 'e15d3cd943e119c5d9f221083cb1a7fe20b6995a', class: "Settings", onClick: this.toggleSettingsModal }, h("svg", { key: '1af781321dc8f23582f33ed55061012242236cc0', width: "24", height: "24", viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'e79e7ef95efef24b70a2ba6389e57f385ea6a266', d: "M20.625 15.5C20.625 16.5547 21.4453 17.375 22.5 17.375C23.5156 17.375 24.375 16.5547 24.375 15.5C24.375 14.4844 23.5156 13.625 22.5 13.625C21.4453 13.625 20.625 14.4844 20.625 15.5ZM9.375 15.5C9.375 14.4844 8.51562 13.625 7.5 13.625C6.44531 13.625 5.625 14.4844 5.625 15.5C5.625 16.5547 6.44531 17.375 7.5 17.375C8.51562 17.375 9.375 16.5547 9.375 15.5ZM16.875 15.5C16.875 14.4844 16.0156 13.625 15 13.625C13.9453 13.625 13.125 14.4844 13.125 15.5C13.125 16.5547 13.9453 17.375 15 17.375C16.0156 17.375 16.875 16.5547 16.875 15.5Z", fill: "currentColor" }))), (((_b = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] })) === null || _b === void 0 ? void 0 : _b.length) > this.maxTextLength ||
283
+ (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(BLOCK_ELEMENT_REGEX)) || []).length > this.maxLines) && (h("div", { key: '56cdc3008e063cd38f1aeea1ce5aee111d97862b', class: "AccordionArrow", innerHTML: systemIcons.arrowDown.icon, ref: this.assignRefToDropdownArrow, onClick: this.accordionArrowClickHandler })))), this.showSettingsModal ? (h("div", { class: "SettingsDropdown" }, h("button", { onClick: this.toggleNotificationRead }, h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M14.9434 5.17969C14.2109 4.59375 13.625 4.125 10.1387 1.60547C9.64062 1.25391 8.67383 0.375 8 0.375V0.404297C7.9707 0.404297 7.9707 0.375 7.9707 0.375C7.29688 0.375 6.33008 1.25391 5.83203 1.60547C2.3457 4.125 1.75977 4.59375 1.02734 5.17969C0.675781 5.44336 0.5 5.85352 0.5 6.26367V13.9688C0.5 14.7598 1.11523 15.375 1.90625 15.375H14.0938C14.8555 15.375 15.5 14.7598 15.5 13.9688V6.26367C15.5 5.85352 15.2949 5.44336 14.9434 5.17969ZM9.37695 11.1562C8.9668 11.4785 8.46875 11.6543 8 11.6543C7.50195 11.6543 7.00391 11.4785 6.59375 11.1562L2.375 7.8457V6.49805C2.99023 6 3.72266 5.44336 6.94531 3.12891C7.0332 3.04102 7.15039 2.95312 7.26758 2.86523C7.41406 2.74805 7.73633 2.48438 8 2.33789C8.23438 2.48438 8.55664 2.74805 8.70312 2.86523C8.82031 2.95312 8.9375 3.04102 9.02539 3.12891C12.2188 5.44336 12.9805 6 13.625 6.49805V7.8457L9.37695 11.1562Z", fill: "currentColor" })), translate(this.messageRead ? 'markAsUnread' : 'markAsRead', this.language)), h("button", { onClick: this.deleteNotification }, h("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M4.375 15.4375C4.375 16.1758 4.94922 16.75 5.6875 16.75H13.5625C14.2734 16.75 14.875 16.1758 14.875 15.4375V6.25H4.375V15.4375ZM11.8125 8.4375C11.8125 8.21875 12.0039 8 12.25 8C12.4688 8 12.6875 8.21875 12.6875 8.4375V14.5625C12.6875 14.8086 12.4688 15 12.25 15C12.0039 15 11.8125 14.8086 11.8125 14.5625V8.4375ZM9.1875 8.4375C9.1875 8.21875 9.37891 8 9.625 8C9.84375 8 10.0625 8.21875 10.0625 8.4375V14.5625C10.0625 14.8086 9.84375 15 9.625 15C9.37891 15 9.1875 14.8086 9.1875 14.5625V8.4375ZM6.5625 8.4375C6.5625 8.21875 6.75391 8 7 8C7.21875 8 7.4375 8.21875 7.4375 8.4375V14.5625C7.4375 14.8086 7.21875 15 7 15C6.75391 15 6.5625 14.8086 6.5625 14.5625V8.4375ZM15.3125 3.625H12.25L11.9219 2.99609C11.8398 2.85938 11.7031 2.75 11.5391 2.75H7.68359C7.51953 2.75 7.38281 2.85938 7.30078 2.99609L7 3.625H3.9375C3.69141 3.625 3.5 3.84375 3.5 4.0625V4.9375C3.5 5.18359 3.69141 5.375 3.9375 5.375H15.3125C15.5312 5.375 15.75 5.18359 15.75 4.9375V4.0625C15.75 3.84375 15.5312 3.625 15.3125 3.625Z", fill: "currentColor" })), translate('removeMessage', this.language)))) : ('')));
284
284
  }
285
285
  static get is() { return "nuts-notification"; }
286
286
  static get originalStyleUrls() {
@@ -1,5 +1,4 @@
1
1
  const DEFAULT_LANGUAGE = 'en';
2
- const SUPPORTED_LANGUAGES = ['hu', 'en', 'tr'];
3
2
  const TRANSLATIONS = {
4
3
  en: {
5
4
  notifications: 'Notifications',
@@ -33,11 +32,33 @@ const TRANSLATIONS = {
33
32
  deleteAllMessages: 'Delete all messages',
34
33
  next: 'Következő',
35
34
  prev: 'Előző'
35
+ },
36
+ az: {
37
+ notifications: "Bildirişlər",
38
+ noMessages: "Burada hələ yeni heç nə yoxdur",
39
+ markAllAsRead: "Hamısını oxunmuş kimi işarələ",
40
+ markAsRead: "Oxunmuş kimi işarələ",
41
+ markAsUnread: "Oxunmamış kimi işarələ",
42
+ removeMessage: "Mesajı sil",
43
+ deleteAllMessages: "Bütün mesajları sil",
44
+ next: "Növbəti",
45
+ prev: "Əvvəlki"
46
+ },
47
+ es: {
48
+ notifications: "Notificaciones",
49
+ noMessages: "Aún no hay nada nuevo por aquí",
50
+ markAllAsRead: "Marcar todo como leído",
51
+ markAsRead: "Marcar como leído",
52
+ markAsUnread: "Marcar como no leído",
53
+ removeMessage: "Eliminar el mensaje",
54
+ deleteAllMessages: "Eliminar todos los mensajes",
55
+ next: "Siguiente",
56
+ prev: "Anterior"
36
57
  }
37
58
  };
38
59
  export const translate = (key, customLang, values) => {
39
60
  const lang = customLang;
40
- let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
61
+ let translation = TRANSLATIONS[lang !== undefined && lang in TRANSLATIONS ? lang : DEFAULT_LANGUAGE][key];
41
62
  if (values !== undefined) {
42
63
  for (const [key, value] of Object.entries(values.values)) {
43
64
  const regex = new RegExp(`{${key}}`, 'g');
@@ -53,11 +74,18 @@ export const getTranslations = (url) => {
53
74
  .then((res) => res.json())
54
75
  .then((data) => {
55
76
  Object.keys(data).forEach((item) => {
77
+ if (!TRANSLATIONS[item]) {
78
+ TRANSLATIONS[item] = {};
79
+ }
56
80
  for (let key in data[item]) {
57
81
  TRANSLATIONS[item][key] = data[item][key];
58
82
  }
59
83
  });
60
84
  resolve(true);
85
+ })
86
+ .catch((err) => {
87
+ console.error('Failed to fetch translations:', err);
88
+ resolve(false);
61
89
  });
62
90
  });
63
91
  };
@@ -1,5 +1,5 @@
1
1
  export const truncate = (str, maxChars, maxLines) => {
2
- var _a, _b, _c;
2
+ var _a;
3
3
  if (!str || maxChars < 0)
4
4
  return "";
5
5
  const parser = new DOMParser();
@@ -7,29 +7,37 @@ export const truncate = (str, maxChars, maxLines) => {
7
7
  let charCount = 0;
8
8
  let lineCount = 0;
9
9
  const walker = doc.createTreeWalker(doc.body, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT);
10
+ const removeAfter = (node) => {
11
+ let current = node;
12
+ while (current && current !== doc.body) {
13
+ const parent = current.parentNode;
14
+ if (!parent)
15
+ break;
16
+ while (current.nextSibling) {
17
+ parent.removeChild(current.nextSibling);
18
+ }
19
+ current = parent;
20
+ }
21
+ };
10
22
  while (walker.nextNode()) {
11
23
  const node = walker.currentNode;
12
24
  if (node.nodeType === Node.TEXT_NODE) {
13
25
  const text = node.textContent || "";
14
26
  if (charCount + text.length > maxChars) {
15
27
  node.textContent = text.slice(0, maxChars - charCount) + "...";
16
- while (node.nextSibling) {
17
- (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(node.nextSibling);
18
- }
28
+ removeAfter(node);
19
29
  break;
20
30
  }
21
31
  charCount += text.length;
22
32
  }
23
33
  else {
24
34
  const tagName = node.nodeName.toLowerCase();
25
- if (tagName === "br" || /^h[1-6]$/.test(tagName) || tagName === "p") {
35
+ if (tagName === "br" || /^h[1-6]$/.test(tagName) || tagName === "p" || tagName === "blockquote") {
26
36
  lineCount++;
27
37
  if (lineCount >= maxLines) {
28
38
  const ellipsis = doc.createTextNode("...");
29
- (_b = node.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(ellipsis, node.nextSibling);
30
- while (node.nextSibling) {
31
- (_c = node.parentNode) === null || _c === void 0 ? void 0 : _c.removeChild(node.nextSibling);
32
- }
39
+ (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(ellipsis, node);
40
+ removeAfter(ellipsis);
33
41
  break;
34
42
  }
35
43
  }
@@ -1,7 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-0160662f.js';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
- const SUPPORTED_LANGUAGES = ['hu', 'en', 'tr'];
5
4
  const TRANSLATIONS = {
6
5
  en: {
7
6
  notifications: 'Notifications',
@@ -35,11 +34,33 @@ const TRANSLATIONS = {
35
34
  deleteAllMessages: 'Delete all messages',
36
35
  next: 'Következő',
37
36
  prev: 'Előző'
37
+ },
38
+ az: {
39
+ notifications: "Bildirişlər",
40
+ noMessages: "Burada hələ yeni heç nə yoxdur",
41
+ markAllAsRead: "Hamısını oxunmuş kimi işarələ",
42
+ markAsRead: "Oxunmuş kimi işarələ",
43
+ markAsUnread: "Oxunmamış kimi işarələ",
44
+ removeMessage: "Mesajı sil",
45
+ deleteAllMessages: "Bütün mesajları sil",
46
+ next: "Növbəti",
47
+ prev: "Əvvəlki"
48
+ },
49
+ es: {
50
+ notifications: "Notificaciones",
51
+ noMessages: "Aún no hay nada nuevo por aquí",
52
+ markAllAsRead: "Marcar todo como leído",
53
+ markAsRead: "Marcar como leído",
54
+ markAsUnread: "Marcar como no leído",
55
+ removeMessage: "Eliminar el mensaje",
56
+ deleteAllMessages: "Eliminar todos los mensajes",
57
+ next: "Siguiente",
58
+ prev: "Anterior"
38
59
  }
39
60
  };
40
61
  const translate$1 = (key, customLang, values) => {
41
62
  const lang = customLang;
42
- let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
63
+ let translation = TRANSLATIONS[lang !== undefined && lang in TRANSLATIONS ? lang : DEFAULT_LANGUAGE][key];
43
64
  if (values !== undefined) {
44
65
  for (const [key, value] of Object.entries(values.values)) {
45
66
  const regex = new RegExp(`{${key}}`, 'g');
@@ -55,11 +76,18 @@ const getTranslations = (url) => {
55
76
  .then((res) => res.json())
56
77
  .then((data) => {
57
78
  Object.keys(data).forEach((item) => {
79
+ if (!TRANSLATIONS[item]) {
80
+ TRANSLATIONS[item] = {};
81
+ }
58
82
  for (let key in data[item]) {
59
83
  TRANSLATIONS[item][key] = data[item][key];
60
84
  }
61
85
  });
62
86
  resolve(true);
87
+ })
88
+ .catch((err) => {
89
+ console.error('Failed to fetch translations:', err);
90
+ resolve(false);
63
91
  });
64
92
  });
65
93
  };
@@ -42356,9 +42384,10 @@ function renderAbstractNodeToSVGElement(node, options) {
42356
42384
 
42357
42385
  const MAX_NOTIFICATION_TEXT_LENGTH = 200;
42358
42386
  const MAX_NOTIFICATION_LINES = 5;
42387
+ const BLOCK_ELEMENT_REGEX = /<br\s*\/?>|<\/p>|<\/h[1-6]>|<\/?blockquote>/gi;
42359
42388
 
42360
42389
  const truncate = (str, maxChars, maxLines) => {
42361
- var _a, _b, _c;
42390
+ var _a;
42362
42391
  if (!str || maxChars < 0)
42363
42392
  return "";
42364
42393
  const parser = new DOMParser();
@@ -42366,29 +42395,37 @@ const truncate = (str, maxChars, maxLines) => {
42366
42395
  let charCount = 0;
42367
42396
  let lineCount = 0;
42368
42397
  const walker = doc.createTreeWalker(doc.body, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT);
42398
+ const removeAfter = (node) => {
42399
+ let current = node;
42400
+ while (current && current !== doc.body) {
42401
+ const parent = current.parentNode;
42402
+ if (!parent)
42403
+ break;
42404
+ while (current.nextSibling) {
42405
+ parent.removeChild(current.nextSibling);
42406
+ }
42407
+ current = parent;
42408
+ }
42409
+ };
42369
42410
  while (walker.nextNode()) {
42370
42411
  const node = walker.currentNode;
42371
42412
  if (node.nodeType === Node.TEXT_NODE) {
42372
42413
  const text = node.textContent || "";
42373
42414
  if (charCount + text.length > maxChars) {
42374
42415
  node.textContent = text.slice(0, maxChars - charCount) + "...";
42375
- while (node.nextSibling) {
42376
- (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(node.nextSibling);
42377
- }
42416
+ removeAfter(node);
42378
42417
  break;
42379
42418
  }
42380
42419
  charCount += text.length;
42381
42420
  }
42382
42421
  else {
42383
42422
  const tagName = node.nodeName.toLowerCase();
42384
- if (tagName === "br" || /^h[1-6]$/.test(tagName) || tagName === "p") {
42423
+ if (tagName === "br" || /^h[1-6]$/.test(tagName) || tagName === "p" || tagName === "blockquote") {
42385
42424
  lineCount++;
42386
42425
  if (lineCount >= maxLines) {
42387
42426
  const ellipsis = doc.createTextNode("...");
42388
- (_b = node.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(ellipsis, node.nextSibling);
42389
- while (node.nextSibling) {
42390
- (_c = node.parentNode) === null || _c === void 0 ? void 0 : _c.removeChild(node.nextSibling);
42391
- }
42427
+ (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(ellipsis, node);
42428
+ removeAfter(ellipsis);
42392
42429
  break;
42393
42430
  }
42394
42431
  }
@@ -42517,7 +42554,7 @@ const NutsNotification = class {
42517
42554
  }
42518
42555
  const fullyStrippedContent = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] });
42519
42556
  if ((fullyStrippedContent === null || fullyStrippedContent === void 0 ? void 0 : fullyStrippedContent.length) <= this.maxTextLength &&
42520
- (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(/<br\s*\/?>|<\/p>|<\/h[1-6]>/gi)) || []).length <= this.maxLines) {
42557
+ (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(BLOCK_ELEMENT_REGEX)) || []).length <= this.maxLines) {
42521
42558
  return;
42522
42559
  }
42523
42560
  this.displayedContent = truncate(this.content, this.maxTextLength, this.maxLines);
@@ -42626,7 +42663,7 @@ const NutsNotification = class {
42626
42663
  this.messageRead = this.read;
42627
42664
  const fullyStrippedContent = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] });
42628
42665
  if ((fullyStrippedContent === null || fullyStrippedContent === void 0 ? void 0 : fullyStrippedContent.length) > this.maxTextLength ||
42629
- (((_a = this.content) === null || _a === void 0 ? void 0 : _a.match(/<br\s*\/?>|<\/p>|<\/h[1-6]>/gi)) || []).length) {
42666
+ (((_a = this.content) === null || _a === void 0 ? void 0 : _a.match(BLOCK_ELEMENT_REGEX)) || []).length) {
42630
42667
  this.displayedContent = truncate(this.content, this.maxTextLength, this.maxLines);
42631
42668
  }
42632
42669
  else {
@@ -42670,11 +42707,11 @@ const NutsNotification = class {
42670
42707
  'img'
42671
42708
  ]
42672
42709
  });
42673
- return (h("div", { key: 'ac04933f45fbcc0c100615388fe010528c422f6f', class: "Wrapper", onClick: this.markNotificationAsRead }, h("div", { key: 'c85d1cdefb959c390c8db554864f2756809a5341', class: 'NotificationContainer' + (this.messageSeen ? '' : ' Unseen'), ref: this.assignRefToStylingContainer, onClick: this.notificationActionHandler }, this.badge ? (h("div", { class: "AvatarContainer" }, h("div", { class: "Avatar" }, ((_a = systemIcons[this.badge]) === null || _a === void 0 ? void 0 : _a.icon) ? (h("div", { innerHTML: systemIcons[this.badge].icon })) : (h("img", { class: "AvatarImage", src: this.badge }))))) : (''), h("div", { key: 'f58174fbeb1041f6f94e2032f01802702ecea9af', class: "ContentContainer" }, h("div", { key: '0b35a305a4d7385e324f27463bd9f3f00ccd1ea9', innerHTML: sanitizedNotificationBody, class: "NotificationBody" }), h("p", { key: '11baf24cfea3d48cf3366c97eaed8f7921abd2f3', class: "Date" }, formatDistanceToNow(new Date(this.date), {
42710
+ return (h("div", { key: 'a6e5c8ad297e9c99dc4955ec7aad14b201abf523', class: "Wrapper", onClick: this.markNotificationAsRead }, h("div", { key: '1e92d30f79d7eda3ee3d2592299bc4969cf41ede', class: 'NotificationContainer' + (this.messageSeen ? '' : ' Unseen'), ref: this.assignRefToStylingContainer, onClick: this.notificationActionHandler }, this.badge ? (h("div", { class: "AvatarContainer" }, h("div", { class: "Avatar" }, ((_a = systemIcons[this.badge]) === null || _a === void 0 ? void 0 : _a.icon) ? (h("div", { innerHTML: systemIcons[this.badge].icon })) : (h("img", { class: "AvatarImage", src: this.badge }))))) : (''), h("div", { key: 'c6df1cc1801ac038933ebc8986c66f2cf81c3833', class: "ContentContainer" }, h("div", { key: 'f15effff484f5f8679e31d05a794ac9ffd6462a8', innerHTML: sanitizedNotificationBody, class: "NotificationBody" }), h("p", { key: '24966927ff1e452a00482dfb9d9527a1d1d85742', class: "Date" }, formatDistanceToNow(new Date(this.date), {
42674
42711
  addSuffix: true,
42675
42712
  locale: dateFnsLocale(this.language)
42676
- }))), h("div", { key: '87670fb6228e11ff3097fdaee66d005d0fb06a6a', class: "RightActionsContainer" }, h("div", { key: 'f858a84bb3dea7486397c80af4aa3e8e0fc7f395', class: "Settings", onClick: this.toggleSettingsModal }, h("svg", { key: '3312814097d3d29d8f299e218b172b130bf2e93a', width: "24", height: "24", viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'e58f7b83f66e95d6866354578a07fefe5a938da3', d: "M20.625 15.5C20.625 16.5547 21.4453 17.375 22.5 17.375C23.5156 17.375 24.375 16.5547 24.375 15.5C24.375 14.4844 23.5156 13.625 22.5 13.625C21.4453 13.625 20.625 14.4844 20.625 15.5ZM9.375 15.5C9.375 14.4844 8.51562 13.625 7.5 13.625C6.44531 13.625 5.625 14.4844 5.625 15.5C5.625 16.5547 6.44531 17.375 7.5 17.375C8.51562 17.375 9.375 16.5547 9.375 15.5ZM16.875 15.5C16.875 14.4844 16.0156 13.625 15 13.625C13.9453 13.625 13.125 14.4844 13.125 15.5C13.125 16.5547 13.9453 17.375 15 17.375C16.0156 17.375 16.875 16.5547 16.875 15.5Z", fill: "currentColor" }))), (((_b = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] })) === null || _b === void 0 ? void 0 : _b.length) > this.maxTextLength ||
42677
- (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(/<br\s*\/?>|<\/p>|<\/h[1-6]>/gi)) || []).length > this.maxLines) && (h("div", { key: '33109a51a711b637f50593731721c98a08ca0157', class: "AccordionArrow", innerHTML: systemIcons.arrowDown.icon, ref: this.assignRefToDropdownArrow, onClick: this.accordionArrowClickHandler })))), this.showSettingsModal ? (h("div", { class: "SettingsDropdown" }, h("button", { onClick: this.toggleNotificationRead }, h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M14.9434 5.17969C14.2109 4.59375 13.625 4.125 10.1387 1.60547C9.64062 1.25391 8.67383 0.375 8 0.375V0.404297C7.9707 0.404297 7.9707 0.375 7.9707 0.375C7.29688 0.375 6.33008 1.25391 5.83203 1.60547C2.3457 4.125 1.75977 4.59375 1.02734 5.17969C0.675781 5.44336 0.5 5.85352 0.5 6.26367V13.9688C0.5 14.7598 1.11523 15.375 1.90625 15.375H14.0938C14.8555 15.375 15.5 14.7598 15.5 13.9688V6.26367C15.5 5.85352 15.2949 5.44336 14.9434 5.17969ZM9.37695 11.1562C8.9668 11.4785 8.46875 11.6543 8 11.6543C7.50195 11.6543 7.00391 11.4785 6.59375 11.1562L2.375 7.8457V6.49805C2.99023 6 3.72266 5.44336 6.94531 3.12891C7.0332 3.04102 7.15039 2.95312 7.26758 2.86523C7.41406 2.74805 7.73633 2.48438 8 2.33789C8.23438 2.48438 8.55664 2.74805 8.70312 2.86523C8.82031 2.95312 8.9375 3.04102 9.02539 3.12891C12.2188 5.44336 12.9805 6 13.625 6.49805V7.8457L9.37695 11.1562Z", fill: "currentColor" })), translate$1(this.messageRead ? 'markAsUnread' : 'markAsRead', this.language)), h("button", { onClick: this.deleteNotification }, h("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M4.375 15.4375C4.375 16.1758 4.94922 16.75 5.6875 16.75H13.5625C14.2734 16.75 14.875 16.1758 14.875 15.4375V6.25H4.375V15.4375ZM11.8125 8.4375C11.8125 8.21875 12.0039 8 12.25 8C12.4688 8 12.6875 8.21875 12.6875 8.4375V14.5625C12.6875 14.8086 12.4688 15 12.25 15C12.0039 15 11.8125 14.8086 11.8125 14.5625V8.4375ZM9.1875 8.4375C9.1875 8.21875 9.37891 8 9.625 8C9.84375 8 10.0625 8.21875 10.0625 8.4375V14.5625C10.0625 14.8086 9.84375 15 9.625 15C9.37891 15 9.1875 14.8086 9.1875 14.5625V8.4375ZM6.5625 8.4375C6.5625 8.21875 6.75391 8 7 8C7.21875 8 7.4375 8.21875 7.4375 8.4375V14.5625C7.4375 14.8086 7.21875 15 7 15C6.75391 15 6.5625 14.8086 6.5625 14.5625V8.4375ZM15.3125 3.625H12.25L11.9219 2.99609C11.8398 2.85938 11.7031 2.75 11.5391 2.75H7.68359C7.51953 2.75 7.38281 2.85938 7.30078 2.99609L7 3.625H3.9375C3.69141 3.625 3.5 3.84375 3.5 4.0625V4.9375C3.5 5.18359 3.69141 5.375 3.9375 5.375H15.3125C15.5312 5.375 15.75 5.18359 15.75 4.9375V4.0625C15.75 3.84375 15.5312 3.625 15.3125 3.625Z", fill: "currentColor" })), translate$1('removeMessage', this.language)))) : ('')));
42713
+ }))), h("div", { key: '71556828f255616171d3003b9a1b71f8c085d3f4', class: "RightActionsContainer" }, h("div", { key: 'e15d3cd943e119c5d9f221083cb1a7fe20b6995a', class: "Settings", onClick: this.toggleSettingsModal }, h("svg", { key: '1af781321dc8f23582f33ed55061012242236cc0', width: "24", height: "24", viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'e79e7ef95efef24b70a2ba6389e57f385ea6a266', d: "M20.625 15.5C20.625 16.5547 21.4453 17.375 22.5 17.375C23.5156 17.375 24.375 16.5547 24.375 15.5C24.375 14.4844 23.5156 13.625 22.5 13.625C21.4453 13.625 20.625 14.4844 20.625 15.5ZM9.375 15.5C9.375 14.4844 8.51562 13.625 7.5 13.625C6.44531 13.625 5.625 14.4844 5.625 15.5C5.625 16.5547 6.44531 17.375 7.5 17.375C8.51562 17.375 9.375 16.5547 9.375 15.5ZM16.875 15.5C16.875 14.4844 16.0156 13.625 15 13.625C13.9453 13.625 13.125 14.4844 13.125 15.5C13.125 16.5547 13.9453 17.375 15 17.375C16.0156 17.375 16.875 16.5547 16.875 15.5Z", fill: "currentColor" }))), (((_b = DOMPurify.sanitize(this.content, { ALLOWED_TAGS: [] })) === null || _b === void 0 ? void 0 : _b.length) > this.maxTextLength ||
42714
+ (((_c = this.content) === null || _c === void 0 ? void 0 : _c.match(BLOCK_ELEMENT_REGEX)) || []).length > this.maxLines) && (h("div", { key: '56cdc3008e063cd38f1aeea1ce5aee111d97862b', class: "AccordionArrow", innerHTML: systemIcons.arrowDown.icon, ref: this.assignRefToDropdownArrow, onClick: this.accordionArrowClickHandler })))), this.showSettingsModal ? (h("div", { class: "SettingsDropdown" }, h("button", { onClick: this.toggleNotificationRead }, h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M14.9434 5.17969C14.2109 4.59375 13.625 4.125 10.1387 1.60547C9.64062 1.25391 8.67383 0.375 8 0.375V0.404297C7.9707 0.404297 7.9707 0.375 7.9707 0.375C7.29688 0.375 6.33008 1.25391 5.83203 1.60547C2.3457 4.125 1.75977 4.59375 1.02734 5.17969C0.675781 5.44336 0.5 5.85352 0.5 6.26367V13.9688C0.5 14.7598 1.11523 15.375 1.90625 15.375H14.0938C14.8555 15.375 15.5 14.7598 15.5 13.9688V6.26367C15.5 5.85352 15.2949 5.44336 14.9434 5.17969ZM9.37695 11.1562C8.9668 11.4785 8.46875 11.6543 8 11.6543C7.50195 11.6543 7.00391 11.4785 6.59375 11.1562L2.375 7.8457V6.49805C2.99023 6 3.72266 5.44336 6.94531 3.12891C7.0332 3.04102 7.15039 2.95312 7.26758 2.86523C7.41406 2.74805 7.73633 2.48438 8 2.33789C8.23438 2.48438 8.55664 2.74805 8.70312 2.86523C8.82031 2.95312 8.9375 3.04102 9.02539 3.12891C12.2188 5.44336 12.9805 6 13.625 6.49805V7.8457L9.37695 11.1562Z", fill: "currentColor" })), translate$1(this.messageRead ? 'markAsUnread' : 'markAsRead', this.language)), h("button", { onClick: this.deleteNotification }, h("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M4.375 15.4375C4.375 16.1758 4.94922 16.75 5.6875 16.75H13.5625C14.2734 16.75 14.875 16.1758 14.875 15.4375V6.25H4.375V15.4375ZM11.8125 8.4375C11.8125 8.21875 12.0039 8 12.25 8C12.4688 8 12.6875 8.21875 12.6875 8.4375V14.5625C12.6875 14.8086 12.4688 15 12.25 15C12.0039 15 11.8125 14.8086 11.8125 14.5625V8.4375ZM9.1875 8.4375C9.1875 8.21875 9.37891 8 9.625 8C9.84375 8 10.0625 8.21875 10.0625 8.4375V14.5625C10.0625 14.8086 9.84375 15 9.625 15C9.37891 15 9.1875 14.8086 9.1875 14.5625V8.4375ZM6.5625 8.4375C6.5625 8.21875 6.75391 8 7 8C7.21875 8 7.4375 8.21875 7.4375 8.4375V14.5625C7.4375 14.8086 7.21875 15 7 15C6.75391 15 6.5625 14.8086 6.5625 14.5625V8.4375ZM15.3125 3.625H12.25L11.9219 2.99609C11.8398 2.85938 11.7031 2.75 11.5391 2.75H7.68359C7.51953 2.75 7.38281 2.85938 7.30078 2.99609L7 3.625H3.9375C3.69141 3.625 3.5 3.84375 3.5 4.0625V4.9375C3.5 5.18359 3.69141 5.375 3.9375 5.375H15.3125C15.5312 5.375 15.75 5.18359 15.75 4.9375V4.0625C15.75 3.84375 15.5312 3.625 15.3125 3.625Z", fill: "currentColor" })), translate$1('removeMessage', this.language)))) : ('')));
42678
42715
  }
42679
42716
  get el() { return getElement(this); }
42680
42717
  static get watchers() { return {