@bigbinary/neeto-molecules 5.9.9 → 5.9.10-beta2
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/MadeWith.js +2 -2
- package/dist/cjs/MadeWith.js +3 -3
- package/dist/cjs/lock-f3r8WHga.js +20 -0
- package/dist/cjs/lock-f3r8WHga.js.map +1 -0
- package/dist/cjs/useWhatsNewChangesCount-CAxjl3n7.js +599 -0
- package/dist/cjs/useWhatsNewChangesCount-CAxjl3n7.js.map +1 -0
- package/dist/cjs/v2/ErrorPage.js +3 -16
- package/dist/cjs/v2/ErrorPage.js.map +1 -1
- package/dist/cjs/v2/FloatingActionMenu.js +69 -358
- package/dist/cjs/v2/FloatingActionMenu.js.map +1 -1
- package/dist/cjs/v2/MadeWith.js +3 -3
- package/dist/cjs/v2/ShareViaLink.js +1 -0
- package/dist/cjs/v2/ShareViaLink.js.map +1 -1
- package/dist/cjs/v2/Sidebar.js +129 -8
- package/dist/cjs/v2/Sidebar.js.map +1 -1
- package/dist/lock-BFUDkBSb.js +18 -0
- package/dist/lock-BFUDkBSb.js.map +1 -0
- package/dist/useWhatsNewChangesCount-Do5jWaPy.js +562 -0
- package/dist/useWhatsNewChangesCount-Do5jWaPy.js.map +1 -0
- package/dist/v2/ErrorPage.js +2 -15
- package/dist/v2/ErrorPage.js.map +1 -1
- package/dist/v2/FloatingActionMenu.js +73 -343
- package/dist/v2/FloatingActionMenu.js.map +1 -1
- package/dist/v2/MadeWith.js +2 -2
- package/dist/v2/ShareViaLink.js +1 -0
- package/dist/v2/ShareViaLink.js.map +1 -1
- package/dist/v2/Sidebar.js +131 -10
- package/dist/v2/Sidebar.js.map +1 -1
- package/package.json +2 -2
- package/src/translations/en.json +4 -0
- package/types/v2/Sidebar.d.ts +2 -0
- package/dist/cjs/useWhatsNewChangesCount-BVkLLk7f.js +0 -121
- package/dist/cjs/useWhatsNewChangesCount-BVkLLk7f.js.map +0 -1
- package/dist/useWhatsNewChangesCount-CQxhUCpt.js +0 -106
- package/dist/useWhatsNewChangesCount-CQxhUCpt.js.map +0 -1
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var i18next = require('i18next');
|
|
4
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
5
|
-
var React = require('react');
|
|
6
|
-
|
|
7
|
-
var MY_ORGANIZATION_URL = "/auth/organization/edit";
|
|
8
|
-
var BILLING_URL = "/auth/admin_billing";
|
|
9
|
-
var DELETE_WORKSPACE_URL = "/auth/organization/delete";
|
|
10
|
-
var ENGAGE_WIDGET_TRIGGER_ID = "neetoengage-trigger";
|
|
11
|
-
var DEFAULT_MENU_LINK_PROPS = {
|
|
12
|
-
engageProps: {
|
|
13
|
-
id: ENGAGE_WIDGET_TRIGGER_ID,
|
|
14
|
-
label: i18next.t("neetoMolecules.sidebar.helpLinks.whatsNew"),
|
|
15
|
-
"data-testid": "help-link-engage-button"
|
|
16
|
-
},
|
|
17
|
-
keyboardShortcutProps: {
|
|
18
|
-
label: i18next.t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
|
|
19
|
-
"data-testid": "help-link-keyboard-shortcut-button"
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// Theme switcher
|
|
24
|
-
var APP_THEME_LOCALSTORAGE_KEY = "appTheme";
|
|
25
|
-
var THEMES = {
|
|
26
|
-
LIGHT: "light",
|
|
27
|
-
DARK: "dark"
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// Legacy neetoUI theme classes — kept until full migration is complete.
|
|
31
|
-
var LEGACY_THEMES = {
|
|
32
|
-
LIGHT: "neeto-ui-theme--light",
|
|
33
|
-
DARK: "neeto-ui-theme--dark"
|
|
34
|
-
};
|
|
35
|
-
var NEETO_AUTH_BILLING_INFO_URL = "/neeto_sso/api/v1/subscription/billing";
|
|
36
|
-
var MENU_ITEM_CLASSES = "gap-2.5 px-2.5 py-2 font-medium [&>[data-slot=menu-item-prefix]>svg]:!size-[18px] [&>[data-slot=menu-item-suffix]>svg]:!size-[18px]";
|
|
37
|
-
var THEME_BUTTON_BASE = "relative z-10 flex items-center justify-center gap-1 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none";
|
|
38
|
-
var THEME_ICON_BASE = "transition-transform duration-300 ease-out";
|
|
39
|
-
var SLOWNESS_DESCRIPTION_MAX_LENGTH = 2000;
|
|
40
|
-
|
|
41
|
-
// Shared source of truth for the neetoEngage changelog unread count.
|
|
42
|
-
//
|
|
43
|
-
// The widget reports the count by calling `window.Nv.onReceiveData({ unreadCount })`
|
|
44
|
-
// whenever it changes (on load and each time entries are marked read). Opening
|
|
45
|
-
// the widget doesn't clear it: the count only drops as entries are read. Both the FloatingActionMenu and the
|
|
46
|
-
// Sidebar surface this count, so this module installs a SINGLE set of
|
|
47
|
-
// `window.Nv` handlers (chaining onto any pre-existing ones) and fans the value
|
|
48
|
-
// out to every subscribed component. Installation happens on the first
|
|
49
|
-
// subscriber and is torn down only when the last one unsubscribes — so
|
|
50
|
-
// interleaved mount/unmount of the two surfaces can never leave a stale handler
|
|
51
|
-
// on the global object.
|
|
52
|
-
|
|
53
|
-
var currentCount = null;
|
|
54
|
-
var subscribers = new Set();
|
|
55
|
-
var isInstalled = false;
|
|
56
|
-
var previousOnReceiveData;
|
|
57
|
-
var notify = function notify() {
|
|
58
|
-
return subscribers.forEach(function (setCount) {
|
|
59
|
-
return setCount(currentCount);
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
var install = function install() {
|
|
63
|
-
if (isInstalled) return;
|
|
64
|
-
isInstalled = true;
|
|
65
|
-
var existing = window.Nv || {};
|
|
66
|
-
previousOnReceiveData = existing.onReceiveData;
|
|
67
|
-
window.Nv = Object.assign(existing, {
|
|
68
|
-
onReceiveData: function onReceiveData(data) {
|
|
69
|
-
var _previousOnReceiveDat;
|
|
70
|
-
(_previousOnReceiveDat = previousOnReceiveData) === null || _previousOnReceiveDat === void 0 || _previousOnReceiveDat(data);
|
|
71
|
-
// Only react to a numeric unreadCount; `0` clears the badge (a non-zero
|
|
72
|
-
// count would otherwise stay stale until the pane is opened).
|
|
73
|
-
if (typeof (data === null || data === void 0 ? void 0 : data.unreadCount) === "number") {
|
|
74
|
-
currentCount = data.unreadCount || null;
|
|
75
|
-
notify();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
var uninstall = function uninstall() {
|
|
81
|
-
if (!isInstalled) return;
|
|
82
|
-
isInstalled = false;
|
|
83
|
-
if (window.Nv) {
|
|
84
|
-
window.Nv.onReceiveData = previousOnReceiveData;
|
|
85
|
-
}
|
|
86
|
-
// currentCount is kept: the widget only reports it on page load and after a
|
|
87
|
-
// "Mark as read", so a surface that remounts (e.g. after navigating to a page
|
|
88
|
-
// without a sidebar and back) would otherwise lose it until a full reload.
|
|
89
|
-
};
|
|
90
|
-
var useWhatsNewChangesCount = function useWhatsNewChangesCount() {
|
|
91
|
-
var _useState = React.useState(currentCount),
|
|
92
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
93
|
-
changesCount = _useState2[0],
|
|
94
|
-
setChangesCount = _useState2[1];
|
|
95
|
-
React.useEffect(function () {
|
|
96
|
-
install();
|
|
97
|
-
subscribers.add(setChangesCount);
|
|
98
|
-
setChangesCount(currentCount);
|
|
99
|
-
return function () {
|
|
100
|
-
subscribers["delete"](setChangesCount);
|
|
101
|
-
if (subscribers.size === 0) uninstall();
|
|
102
|
-
};
|
|
103
|
-
}, []);
|
|
104
|
-
return changesCount;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
exports.APP_THEME_LOCALSTORAGE_KEY = APP_THEME_LOCALSTORAGE_KEY;
|
|
108
|
-
exports.BILLING_URL = BILLING_URL;
|
|
109
|
-
exports.DEFAULT_MENU_LINK_PROPS = DEFAULT_MENU_LINK_PROPS;
|
|
110
|
-
exports.DELETE_WORKSPACE_URL = DELETE_WORKSPACE_URL;
|
|
111
|
-
exports.ENGAGE_WIDGET_TRIGGER_ID = ENGAGE_WIDGET_TRIGGER_ID;
|
|
112
|
-
exports.LEGACY_THEMES = LEGACY_THEMES;
|
|
113
|
-
exports.MENU_ITEM_CLASSES = MENU_ITEM_CLASSES;
|
|
114
|
-
exports.MY_ORGANIZATION_URL = MY_ORGANIZATION_URL;
|
|
115
|
-
exports.NEETO_AUTH_BILLING_INFO_URL = NEETO_AUTH_BILLING_INFO_URL;
|
|
116
|
-
exports.SLOWNESS_DESCRIPTION_MAX_LENGTH = SLOWNESS_DESCRIPTION_MAX_LENGTH;
|
|
117
|
-
exports.THEMES = THEMES;
|
|
118
|
-
exports.THEME_BUTTON_BASE = THEME_BUTTON_BASE;
|
|
119
|
-
exports.THEME_ICON_BASE = THEME_ICON_BASE;
|
|
120
|
-
exports.useWhatsNewChangesCount = useWhatsNewChangesCount;
|
|
121
|
-
//# sourceMappingURL=useWhatsNewChangesCount-BVkLLk7f.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWhatsNewChangesCount-BVkLLk7f.js","sources":["../../src/v2/components/FloatingActionMenu/constants.js","../../src/v2/components/FloatingActionMenu/hooks/useWhatsNewChangesCount.js"],"sourcesContent":["import { t } from \"i18next\";\n\nexport const MY_ORGANIZATION_URL = \"/auth/organization/edit\";\nexport const BILLING_URL = \"/auth/admin_billing\";\nexport const DELETE_WORKSPACE_URL = \"/auth/organization/delete\";\nexport const ENGAGE_WIDGET_TRIGGER_ID = \"neetoengage-trigger\";\n\nexport const DEFAULT_MENU_LINK_PROPS = {\n engageProps: {\n id: ENGAGE_WIDGET_TRIGGER_ID,\n label: t(\"neetoMolecules.sidebar.helpLinks.whatsNew\"),\n \"data-testid\": \"help-link-engage-button\",\n },\n keyboardShortcutProps: {\n label: t(\"neetoMolecules.sidebar.helpLinks.keyboardShortcuts\"),\n \"data-testid\": \"help-link-keyboard-shortcut-button\",\n },\n};\n\n// Theme switcher\nexport const APP_THEME_LOCALSTORAGE_KEY = \"appTheme\";\n\nexport const THEMES = { LIGHT: \"light\", DARK: \"dark\" };\n\n// Legacy neetoUI theme classes — kept until full migration is complete.\nexport const LEGACY_THEMES = {\n LIGHT: \"neeto-ui-theme--light\",\n DARK: \"neeto-ui-theme--dark\",\n};\n\nexport const NEETO_AUTH_BILLING_INFO_URL =\n \"/neeto_sso/api/v1/subscription/billing\";\n\nexport const MENU_ITEM_CLASSES =\n \"gap-2.5 px-2.5 py-2 font-medium [&>[data-slot=menu-item-prefix]>svg]:!size-[18px] [&>[data-slot=menu-item-suffix]>svg]:!size-[18px]\";\n\nexport const THEME_BUTTON_BASE =\n \"relative z-10 flex items-center justify-center gap-1 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none\";\n\nexport const THEME_ICON_BASE = \"transition-transform duration-300 ease-out\";\n\nexport const SLOWNESS_DESCRIPTION_MAX_LENGTH = 2000;\n","import { useEffect, useState } from \"react\";\n\n// Shared source of truth for the neetoEngage changelog unread count.\n//\n// The widget reports the count by calling `window.Nv.onReceiveData({ unreadCount })`\n// whenever it changes (on load and each time entries are marked read). Opening\n// the widget doesn't clear it: the count only drops as entries are read. Both the FloatingActionMenu and the\n// Sidebar surface this count, so this module installs a SINGLE set of\n// `window.Nv` handlers (chaining onto any pre-existing ones) and fans the value\n// out to every subscribed component. Installation happens on the first\n// subscriber and is torn down only when the last one unsubscribes — so\n// interleaved mount/unmount of the two surfaces can never leave a stale handler\n// on the global object.\n\nlet currentCount = null;\nconst subscribers = new Set();\nlet isInstalled = false;\nlet previousOnReceiveData;\n\nconst notify = () => subscribers.forEach(setCount => setCount(currentCount));\n\nconst install = () => {\n if (isInstalled) return;\n isInstalled = true;\n\n const existing = window.Nv || {};\n previousOnReceiveData = existing.onReceiveData;\n\n window.Nv = Object.assign(existing, {\n onReceiveData: data => {\n previousOnReceiveData?.(data);\n // Only react to a numeric unreadCount; `0` clears the badge (a non-zero\n // count would otherwise stay stale until the pane is opened).\n if (typeof data?.unreadCount === \"number\") {\n currentCount = data.unreadCount || null;\n notify();\n }\n },\n });\n};\n\nconst uninstall = () => {\n if (!isInstalled) return;\n isInstalled = false;\n\n if (window.Nv) {\n window.Nv.onReceiveData = previousOnReceiveData;\n }\n // currentCount is kept: the widget only reports it on page load and after a\n // \"Mark as read\", so a surface that remounts (e.g. after navigating to a page\n // without a sidebar and back) would otherwise lose it until a full reload.\n};\n\nconst useWhatsNewChangesCount = () => {\n const [changesCount, setChangesCount] = useState(currentCount);\n\n useEffect(() => {\n install();\n subscribers.add(setChangesCount);\n setChangesCount(currentCount);\n\n return () => {\n subscribers.delete(setChangesCount);\n if (subscribers.size === 0) uninstall();\n };\n }, []);\n\n return changesCount;\n};\n\nexport default useWhatsNewChangesCount;\n"],"names":["MY_ORGANIZATION_URL","BILLING_URL","DELETE_WORKSPACE_URL","ENGAGE_WIDGET_TRIGGER_ID","DEFAULT_MENU_LINK_PROPS","engageProps","id","label","t","keyboardShortcutProps","APP_THEME_LOCALSTORAGE_KEY","THEMES","LIGHT","DARK","LEGACY_THEMES","NEETO_AUTH_BILLING_INFO_URL","MENU_ITEM_CLASSES","THEME_BUTTON_BASE","THEME_ICON_BASE","SLOWNESS_DESCRIPTION_MAX_LENGTH","currentCount","subscribers","Set","isInstalled","previousOnReceiveData","notify","forEach","setCount","install","existing","window","Nv","onReceiveData","Object","assign","data","_previousOnReceiveDat","unreadCount","uninstall","useWhatsNewChangesCount","_useState","useState","_useState2","_slicedToArray","changesCount","setChangesCount","useEffect","add","size"],"mappings":";;;;;;AAEO,IAAMA,mBAAmB,GAAG;AAC5B,IAAMC,WAAW,GAAG;AACpB,IAAMC,oBAAoB,GAAG;AAC7B,IAAMC,wBAAwB,GAAG;AAEjC,IAAMC,uBAAuB,GAAG;AACrCC,EAAAA,WAAW,EAAE;AACXC,IAAAA,EAAE,EAAEH,wBAAwB;AAC5BI,IAAAA,KAAK,EAAEC,SAAC,CAA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;EACH,CAAC,EAAE,EAAE,CAAC;AAEN,EAAA,OAAOM,YAAY;AACrB;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { t } from 'i18next';
|
|
2
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
-
import { useState, useEffect } from 'react';
|
|
4
|
-
|
|
5
|
-
var MY_ORGANIZATION_URL = "/auth/organization/edit";
|
|
6
|
-
var BILLING_URL = "/auth/admin_billing";
|
|
7
|
-
var DELETE_WORKSPACE_URL = "/auth/organization/delete";
|
|
8
|
-
var ENGAGE_WIDGET_TRIGGER_ID = "neetoengage-trigger";
|
|
9
|
-
var DEFAULT_MENU_LINK_PROPS = {
|
|
10
|
-
engageProps: {
|
|
11
|
-
id: ENGAGE_WIDGET_TRIGGER_ID,
|
|
12
|
-
label: t("neetoMolecules.sidebar.helpLinks.whatsNew"),
|
|
13
|
-
"data-testid": "help-link-engage-button"
|
|
14
|
-
},
|
|
15
|
-
keyboardShortcutProps: {
|
|
16
|
-
label: t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
|
|
17
|
-
"data-testid": "help-link-keyboard-shortcut-button"
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// Theme switcher
|
|
22
|
-
var APP_THEME_LOCALSTORAGE_KEY = "appTheme";
|
|
23
|
-
var THEMES = {
|
|
24
|
-
LIGHT: "light",
|
|
25
|
-
DARK: "dark"
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// Legacy neetoUI theme classes — kept until full migration is complete.
|
|
29
|
-
var LEGACY_THEMES = {
|
|
30
|
-
LIGHT: "neeto-ui-theme--light",
|
|
31
|
-
DARK: "neeto-ui-theme--dark"
|
|
32
|
-
};
|
|
33
|
-
var NEETO_AUTH_BILLING_INFO_URL = "/neeto_sso/api/v1/subscription/billing";
|
|
34
|
-
var MENU_ITEM_CLASSES = "gap-2.5 px-2.5 py-2 font-medium [&>[data-slot=menu-item-prefix]>svg]:!size-[18px] [&>[data-slot=menu-item-suffix]>svg]:!size-[18px]";
|
|
35
|
-
var THEME_BUTTON_BASE = "relative z-10 flex items-center justify-center gap-1 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none";
|
|
36
|
-
var THEME_ICON_BASE = "transition-transform duration-300 ease-out";
|
|
37
|
-
var SLOWNESS_DESCRIPTION_MAX_LENGTH = 2000;
|
|
38
|
-
|
|
39
|
-
// Shared source of truth for the neetoEngage changelog unread count.
|
|
40
|
-
//
|
|
41
|
-
// The widget reports the count by calling `window.Nv.onReceiveData({ unreadCount })`
|
|
42
|
-
// whenever it changes (on load and each time entries are marked read). Opening
|
|
43
|
-
// the widget doesn't clear it: the count only drops as entries are read. Both the FloatingActionMenu and the
|
|
44
|
-
// Sidebar surface this count, so this module installs a SINGLE set of
|
|
45
|
-
// `window.Nv` handlers (chaining onto any pre-existing ones) and fans the value
|
|
46
|
-
// out to every subscribed component. Installation happens on the first
|
|
47
|
-
// subscriber and is torn down only when the last one unsubscribes — so
|
|
48
|
-
// interleaved mount/unmount of the two surfaces can never leave a stale handler
|
|
49
|
-
// on the global object.
|
|
50
|
-
|
|
51
|
-
var currentCount = null;
|
|
52
|
-
var subscribers = new Set();
|
|
53
|
-
var isInstalled = false;
|
|
54
|
-
var previousOnReceiveData;
|
|
55
|
-
var notify = function notify() {
|
|
56
|
-
return subscribers.forEach(function (setCount) {
|
|
57
|
-
return setCount(currentCount);
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
var install = function install() {
|
|
61
|
-
if (isInstalled) return;
|
|
62
|
-
isInstalled = true;
|
|
63
|
-
var existing = window.Nv || {};
|
|
64
|
-
previousOnReceiveData = existing.onReceiveData;
|
|
65
|
-
window.Nv = Object.assign(existing, {
|
|
66
|
-
onReceiveData: function onReceiveData(data) {
|
|
67
|
-
var _previousOnReceiveDat;
|
|
68
|
-
(_previousOnReceiveDat = previousOnReceiveData) === null || _previousOnReceiveDat === void 0 || _previousOnReceiveDat(data);
|
|
69
|
-
// Only react to a numeric unreadCount; `0` clears the badge (a non-zero
|
|
70
|
-
// count would otherwise stay stale until the pane is opened).
|
|
71
|
-
if (typeof (data === null || data === void 0 ? void 0 : data.unreadCount) === "number") {
|
|
72
|
-
currentCount = data.unreadCount || null;
|
|
73
|
-
notify();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
var uninstall = function uninstall() {
|
|
79
|
-
if (!isInstalled) return;
|
|
80
|
-
isInstalled = false;
|
|
81
|
-
if (window.Nv) {
|
|
82
|
-
window.Nv.onReceiveData = previousOnReceiveData;
|
|
83
|
-
}
|
|
84
|
-
// currentCount is kept: the widget only reports it on page load and after a
|
|
85
|
-
// "Mark as read", so a surface that remounts (e.g. after navigating to a page
|
|
86
|
-
// without a sidebar and back) would otherwise lose it until a full reload.
|
|
87
|
-
};
|
|
88
|
-
var useWhatsNewChangesCount = function useWhatsNewChangesCount() {
|
|
89
|
-
var _useState = useState(currentCount),
|
|
90
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
91
|
-
changesCount = _useState2[0],
|
|
92
|
-
setChangesCount = _useState2[1];
|
|
93
|
-
useEffect(function () {
|
|
94
|
-
install();
|
|
95
|
-
subscribers.add(setChangesCount);
|
|
96
|
-
setChangesCount(currentCount);
|
|
97
|
-
return function () {
|
|
98
|
-
subscribers["delete"](setChangesCount);
|
|
99
|
-
if (subscribers.size === 0) uninstall();
|
|
100
|
-
};
|
|
101
|
-
}, []);
|
|
102
|
-
return changesCount;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export { APP_THEME_LOCALSTORAGE_KEY as A, BILLING_URL as B, DELETE_WORKSPACE_URL as D, ENGAGE_WIDGET_TRIGGER_ID as E, LEGACY_THEMES as L, MENU_ITEM_CLASSES as M, NEETO_AUTH_BILLING_INFO_URL as N, SLOWNESS_DESCRIPTION_MAX_LENGTH as S, THEMES as T, THEME_ICON_BASE as a, THEME_BUTTON_BASE as b, MY_ORGANIZATION_URL as c, DEFAULT_MENU_LINK_PROPS as d, useWhatsNewChangesCount as u };
|
|
106
|
-
//# sourceMappingURL=useWhatsNewChangesCount-CQxhUCpt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWhatsNewChangesCount-CQxhUCpt.js","sources":["../src/v2/components/FloatingActionMenu/constants.js","../src/v2/components/FloatingActionMenu/hooks/useWhatsNewChangesCount.js"],"sourcesContent":["import { t } from \"i18next\";\n\nexport const MY_ORGANIZATION_URL = \"/auth/organization/edit\";\nexport const BILLING_URL = \"/auth/admin_billing\";\nexport const DELETE_WORKSPACE_URL = \"/auth/organization/delete\";\nexport const ENGAGE_WIDGET_TRIGGER_ID = \"neetoengage-trigger\";\n\nexport const DEFAULT_MENU_LINK_PROPS = {\n engageProps: {\n id: ENGAGE_WIDGET_TRIGGER_ID,\n label: t(\"neetoMolecules.sidebar.helpLinks.whatsNew\"),\n \"data-testid\": \"help-link-engage-button\",\n },\n keyboardShortcutProps: {\n label: t(\"neetoMolecules.sidebar.helpLinks.keyboardShortcuts\"),\n \"data-testid\": \"help-link-keyboard-shortcut-button\",\n },\n};\n\n// Theme switcher\nexport const APP_THEME_LOCALSTORAGE_KEY = \"appTheme\";\n\nexport const THEMES = { LIGHT: \"light\", DARK: \"dark\" };\n\n// Legacy neetoUI theme classes — kept until full migration is complete.\nexport const LEGACY_THEMES = {\n LIGHT: \"neeto-ui-theme--light\",\n DARK: \"neeto-ui-theme--dark\",\n};\n\nexport const NEETO_AUTH_BILLING_INFO_URL =\n \"/neeto_sso/api/v1/subscription/billing\";\n\nexport const MENU_ITEM_CLASSES =\n \"gap-2.5 px-2.5 py-2 font-medium [&>[data-slot=menu-item-prefix]>svg]:!size-[18px] [&>[data-slot=menu-item-suffix]>svg]:!size-[18px]\";\n\nexport const THEME_BUTTON_BASE =\n \"relative z-10 flex items-center justify-center gap-1 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none\";\n\nexport const THEME_ICON_BASE = \"transition-transform duration-300 ease-out\";\n\nexport const SLOWNESS_DESCRIPTION_MAX_LENGTH = 2000;\n","import { useEffect, useState } from \"react\";\n\n// Shared source of truth for the neetoEngage changelog unread count.\n//\n// The widget reports the count by calling `window.Nv.onReceiveData({ unreadCount })`\n// whenever it changes (on load and each time entries are marked read). Opening\n// the widget doesn't clear it: the count only drops as entries are read. Both the FloatingActionMenu and the\n// Sidebar surface this count, so this module installs a SINGLE set of\n// `window.Nv` handlers (chaining onto any pre-existing ones) and fans the value\n// out to every subscribed component. Installation happens on the first\n// subscriber and is torn down only when the last one unsubscribes — so\n// interleaved mount/unmount of the two surfaces can never leave a stale handler\n// on the global object.\n\nlet currentCount = null;\nconst subscribers = new Set();\nlet isInstalled = false;\nlet previousOnReceiveData;\n\nconst notify = () => subscribers.forEach(setCount => setCount(currentCount));\n\nconst install = () => {\n if (isInstalled) return;\n isInstalled = true;\n\n const existing = window.Nv || {};\n previousOnReceiveData = existing.onReceiveData;\n\n window.Nv = Object.assign(existing, {\n onReceiveData: data => {\n previousOnReceiveData?.(data);\n // Only react to a numeric unreadCount; `0` clears the badge (a non-zero\n // count would otherwise stay stale until the pane is opened).\n if (typeof data?.unreadCount === \"number\") {\n currentCount = data.unreadCount || null;\n notify();\n }\n },\n });\n};\n\nconst uninstall = () => {\n if (!isInstalled) return;\n isInstalled = false;\n\n if (window.Nv) {\n window.Nv.onReceiveData = previousOnReceiveData;\n }\n // currentCount is kept: the widget only reports it on page load and after a\n // \"Mark as read\", so a surface that remounts (e.g. after navigating to a page\n // without a sidebar and back) would otherwise lose it until a full reload.\n};\n\nconst useWhatsNewChangesCount = () => {\n const [changesCount, setChangesCount] = useState(currentCount);\n\n useEffect(() => {\n install();\n subscribers.add(setChangesCount);\n setChangesCount(currentCount);\n\n return () => {\n subscribers.delete(setChangesCount);\n if (subscribers.size === 0) uninstall();\n };\n }, []);\n\n return changesCount;\n};\n\nexport default useWhatsNewChangesCount;\n"],"names":["MY_ORGANIZATION_URL","BILLING_URL","DELETE_WORKSPACE_URL","ENGAGE_WIDGET_TRIGGER_ID","DEFAULT_MENU_LINK_PROPS","engageProps","id","label","t","keyboardShortcutProps","APP_THEME_LOCALSTORAGE_KEY","THEMES","LIGHT","DARK","LEGACY_THEMES","NEETO_AUTH_BILLING_INFO_URL","MENU_ITEM_CLASSES","THEME_BUTTON_BASE","THEME_ICON_BASE","SLOWNESS_DESCRIPTION_MAX_LENGTH","currentCount","subscribers","Set","isInstalled","previousOnReceiveData","notify","forEach","setCount","install","existing","window","Nv","onReceiveData","Object","assign","data","_previousOnReceiveDat","unreadCount","uninstall","useWhatsNewChangesCount","_useState","useState","_useState2","_slicedToArray","changesCount","setChangesCount","useEffect","add","size"],"mappings":";;;;AAEO,IAAMA,mBAAmB,GAAG;AAC5B,IAAMC,WAAW,GAAG;AACpB,IAAMC,oBAAoB,GAAG;AAC7B,IAAMC,wBAAwB,GAAG;AAEjC,IAAMC,uBAAuB,GAAG;AACrCC,EAAAA,WAAW,EAAE;AACXC,IAAAA,EAAE,EAAEH,wBAAwB;AAC5BI,IAAAA,KAAK,EAAEC,CAAC,CAAC,2CAA2C,CAAC;AACrD,IAAA,aAAa,EAAE;GAChB;AACDC,EAAAA,qBAAqB,EAAE;AACrBF,IAAAA,KAAK,EAAEC,CAAC,CAAC,oDAAoD,CAAC;AAC9D,IAAA,aAAa,EAAE;AACjB;AACF;;AAEA;AACO,IAAME,0BAA0B,GAAG;AAEnC,IAAMC,MAAM,GAAG;AAAEC,EAAAA,KAAK,EAAE,OAAO;AAAEC,EAAAA,IAAI,EAAE;AAAO;;AAErD;AACO,IAAMC,aAAa,GAAG;AAC3BF,EAAAA,KAAK,EAAE,uBAAuB;AAC9BC,EAAAA,IAAI,EAAE;AACR;AAEO,IAAME,2BAA2B,GACtC;AAEK,IAAMC,iBAAiB,GAC5B;AAEK,IAAMC,iBAAiB,GAC5B;AAEK,IAAMC,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