domma-cms 1.49.1 → 1.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/admin/js/lib/chats-arrange.js +2 -2
- package/admin/js/lib/launchers-arrange.js +5 -2
- package/admin/js/lib/sidebar-renderer.js +1 -1
- package/admin/js/lib/site-settings-arrange.js +2 -2
- package/admin/js/templates/chats.html +26 -2
- package/admin/js/templates/docs/usage-chat.html +51 -5
- package/admin/js/templates/launchers.html +4 -0
- package/admin/js/templates/settings.html +18 -0
- package/admin/js/views/chats.js +5 -5
- package/admin/js/views/launchers.js +105 -33
- package/admin/js/views/layouts.js +1 -1
- package/admin/js/views/menu-editor.js +1 -1
- package/docs/DommaFeatures.md +4 -0
- package/package.json +1 -1
- package/public/css/launcher-chat.css +1 -1
- package/public/css/launchers.css +1 -1
- package/public/js/launcher-chat.mjs +16 -10
- package/public/js/launcher-settings.mjs +6 -2
- package/public/js/launchers.mjs +3 -3
- package/public/js/menu-cards.mjs +1 -1
- package/public/js/menu-decor.mjs +1 -1
- package/public/js/site.js +1 -1
- package/server/routes/api/chat.js +4 -2
- package/server/routes/api/chats.js +37 -0
- package/server/routes/api/settings.js +11 -1
- package/server/services/assistant.js +67 -0
- package/server/services/chat/ai.js +109 -0
- package/server/services/chat/conversation.js +37 -2
- package/server/services/chat/saved.js +117 -0
- package/server/services/chat/settings.js +30 -4
- package/server/services/chat/store.js +1 -1
- package/server/services/collectionAccess.js +2 -1
- package/server/services/launchers.js +1 -1
- package/server/services/menuRender.js +6 -5
- package/server/services/presetCollections.js +24 -2
- package/server/services/siteGitignore.js +1 -1
- package/server/templates/page.html +1 -1
|
@@ -14,7 +14,7 @@ import {colourToCss, floatToCss, floatBehaviour, spacerSize} from './menus.js';
|
|
|
14
14
|
// Highlight helpers live once, in the browser module, and are imported here -
|
|
15
15
|
// the same shared-module arrangement collection-export.mjs has with
|
|
16
16
|
// collections.js. Nothing in them touches the DOM.
|
|
17
|
-
import {highlightAttrs, itemHighlightAttrs,
|
|
17
|
+
import {highlightAttrs, itemHighlightAttrs, currentItems, menuAlign, cssClasses, entranceAttrs, entranceStyle} from '../../public/js/menu-decor.mjs';
|
|
18
18
|
|
|
19
19
|
/** Attribute-safe escaping - mirrors escapeAttr in markdown.js. */
|
|
20
20
|
function esc(str) {
|
|
@@ -36,9 +36,11 @@ function esc(str) {
|
|
|
36
36
|
* @param {string} [currentPath] The URL path being rendered. Items pointing at
|
|
37
37
|
* it are marked `is-active` + `aria-current` so a `highlight.active` effect
|
|
38
38
|
* has something to style. Omitted (the default) marks nothing.
|
|
39
|
+
* @param {Set<object>} [current] The current items (currentItems()), worked out
|
|
40
|
+
* once over the whole menu so a nested call agrees with its parent.
|
|
39
41
|
* @returns {string}
|
|
40
42
|
*/
|
|
41
|
-
export function renderMenuItemsAsUl(items, currentPath = '') {
|
|
43
|
+
export function renderMenuItemsAsUl(items, currentPath = '', current = currentItems(items, currentPath)) {
|
|
42
44
|
if (!items || !items.length) return '';
|
|
43
45
|
const lis = items.map(it => {
|
|
44
46
|
if (it && it.type === 'separator') return '<li class="dm-menu-sep" role="separator"><hr></li>';
|
|
@@ -53,13 +55,12 @@ export function renderMenuItemsAsUl(items, currentPath = '') {
|
|
|
53
55
|
}
|
|
54
56
|
const href = esc(it.url || '#');
|
|
55
57
|
const text = esc(it.text || '');
|
|
56
|
-
const child = Array.isArray(it.items) && it.items.length ? renderMenuItemsAsUl(it.items, currentPath) : '';
|
|
58
|
+
const child = Array.isArray(it.items) && it.items.length ? renderMenuItemsAsUl(it.items, currentPath, current) : '';
|
|
57
59
|
|
|
58
60
|
// The item for the page we are on. Both markers are emitted because
|
|
59
61
|
// sanitize-html keeps the class on every path while the aria attribute
|
|
60
62
|
// needs an explicit allowlist entry.
|
|
61
|
-
const
|
|
62
|
-
const classAttr = current ? ' class="is-active" aria-current="page"' : '';
|
|
63
|
+
const classAttr = current.has(it) ? ' class="is-active" aria-current="page"' : '';
|
|
63
64
|
// The designer's own classes go on the <li>, so they can lay the item
|
|
64
65
|
// out (push it right, size it) as well as style its link.
|
|
65
66
|
const liClasses = cssClasses(it.class);
|
|
@@ -500,6 +500,7 @@ const PRESETS = [
|
|
|
500
500
|
{name: 'count', label: 'Messages', type: 'number', default: 0},
|
|
501
501
|
{name: 'unread', label: 'Unread by staff', type: 'number', default: 0},
|
|
502
502
|
{name: 'misses', label: 'Unanswered in a row', type: 'number', default: 0},
|
|
503
|
+
{name: 'aiCount', label: 'AI answers', type: 'number', default: 0},
|
|
503
504
|
{name: 'askDetails', label: 'Details asked for', type: 'boolean', default: false},
|
|
504
505
|
{name: 'assignedTo', label: 'Answered by (id)', type: 'text'},
|
|
505
506
|
{name: 'assignedName', label: 'Answered by', type: 'text'},
|
|
@@ -514,7 +515,8 @@ const PRESETS = [
|
|
|
514
515
|
{name: 'text', label: 'Text', type: 'textarea'},
|
|
515
516
|
{name: 'answerId', label: 'Knowledge entry', type: 'text'},
|
|
516
517
|
{name: 'suggestions', label: 'Suggestions', type: 'json'},
|
|
517
|
-
{name: 'staffName', label: 'Staff name', type: 'text'}
|
|
518
|
+
{name: 'staffName', label: 'Staff name', type: 'text'},
|
|
519
|
+
{name: 'ai', label: 'Answered by AI', type: 'boolean', default: false}
|
|
518
520
|
]),
|
|
519
521
|
...chatPreset('chat-unanswered', 'Chat Unanswered', 'Questions the chat bot could not answer, for turning into Knowledge.', [
|
|
520
522
|
{name: 'text', label: 'Question', type: 'text', required: true},
|
|
@@ -524,6 +526,26 @@ const PRESETS = [
|
|
|
524
526
|
{name: 'firstAt', label: 'First asked', type: 'datetime'},
|
|
525
527
|
{name: 'lastAt', label: 'Last asked', type: 'datetime'},
|
|
526
528
|
{name: 'done', label: 'Dealt with', type: 'boolean', default: false}
|
|
529
|
+
]),
|
|
530
|
+
// A copy of a chat kept for a closer look (services/chat/saved.js): outlives the chat itself.
|
|
531
|
+
...chatPreset('chat-saved', 'Saved Chats', 'Chats kept for a closer look: a copy of the conversation, why it was saved, and what came of it.', [
|
|
532
|
+
{name: 'title', label: 'Title', type: 'text', required: true},
|
|
533
|
+
{name: 'note', label: 'Why it was saved', type: 'textarea'},
|
|
534
|
+
{name: 'outcome', label: 'Outcome', type: 'select', options: ['to look at', 'looking into it', 'done'], default: 'to look at'},
|
|
535
|
+
{name: 'visitorName', label: 'Name', type: 'text'},
|
|
536
|
+
{name: 'visitorEmail', label: 'Email', type: 'text'},
|
|
537
|
+
{name: 'page', label: 'Page', type: 'text'},
|
|
538
|
+
{name: 'startedAt', label: 'Chat started', type: 'datetime'},
|
|
539
|
+
{name: 'lastAt', label: 'Last message', type: 'datetime'},
|
|
540
|
+
{name: 'savedAt', label: 'Saved', type: 'datetime'},
|
|
541
|
+
{name: 'savedByName', label: 'Saved by', type: 'text'},
|
|
542
|
+
{name: 'savedBy', label: 'Saved by (id)', type: 'hidden'},
|
|
543
|
+
{name: 'chatId', label: 'Chat', type: 'hidden'},
|
|
544
|
+
{name: 'launcherId', label: 'Launcher', type: 'text'},
|
|
545
|
+
{name: 'chatStatus', label: 'Chat status when saved', type: 'text'},
|
|
546
|
+
{name: 'messageCount', label: 'Messages', type: 'number', default: 0},
|
|
547
|
+
{name: 'transcript', label: 'Conversation', type: 'textarea'},
|
|
548
|
+
{name: 'messages', label: 'Messages (data)', type: 'json'}
|
|
527
549
|
])
|
|
528
550
|
];
|
|
529
551
|
|
|
@@ -541,7 +563,7 @@ export const PRESET_COLLECTION_SLUGS = PRESETS.map(p => p.slug);
|
|
|
541
563
|
export const USER_DATA_PRESET_SLUGS = Object.freeze(['notes-notes', 'todo-items', 'contacts-contacts', 'contacts-groups']);
|
|
542
564
|
|
|
543
565
|
/** The chat presets (services/chat/store.js). */
|
|
544
|
-
export const CHAT_PRESET_SLUGS = Object.freeze(['chat-knowledge', 'chat-sessions', 'chat-messages', 'chat-unanswered']);
|
|
566
|
+
export const CHAT_PRESET_SLUGS = Object.freeze(['chat-knowledge', 'chat-sessions', 'chat-messages', 'chat-unanswered', 'chat-saved']);
|
|
545
567
|
|
|
546
568
|
/**
|
|
547
569
|
* The presets that may live in MongoDB (adapterRegistry.js resolveUserDataPreset):
|
|
@@ -91,7 +91,7 @@ export const PRIVATE_DATA = [
|
|
|
91
91
|
'jb-applications', 'jb-candidate-profiles', 'jb-signups',
|
|
92
92
|
// Visitor chat (Launchers, 1.28.0): conversations, names and emails, and the
|
|
93
93
|
// questions visitors asked. The Knowledge (chat-knowledge) is authored and stays.
|
|
94
|
-
'chat-sessions', 'chat-messages', 'chat-unanswered',
|
|
94
|
+
'chat-sessions', 'chat-messages', 'chat-unanswered', 'chat-saved',
|
|
95
95
|
// Games: each play carries the player's name and their resume token.
|
|
96
96
|
'quiz-plays', 'crossword-plays', 'daily-word-plays', 'word-search-plays',
|
|
97
97
|
// Outreach (Surveys, Campaigns): recipients, sends, claims, opens and clicks,
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
<script src="/public/js/form-logic-engine.js?v=20261031-forms-reduce-motion" defer></script>
|
|
189
189
|
|
|
190
190
|
<!-- Site initialisation -->
|
|
191
|
-
<script src="/public/js/site.js?v=20261109-
|
|
191
|
+
<script src="/public/js/site.js?v=20261109-current-query" type="module"></script>
|
|
192
192
|
<script src="/public/js/collection-context.js?v=20261010-utf8-payloads" type="module"></script>
|
|
193
193
|
{{ctxMenusModule}}
|
|
194
194
|
<!-- [image zoom] pictures' full-size view - only on a page that has one -->
|