@memberjunction/ng-conversations 2.104.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/README.md +197 -0
- package/dist/lib/components/active-tasks/active-tasks-panel.component.d.ts +20 -0
- package/dist/lib/components/active-tasks/active-tasks-panel.component.d.ts.map +1 -0
- package/dist/lib/components/active-tasks/active-tasks-panel.component.js +125 -0
- package/dist/lib/components/active-tasks/active-tasks-panel.component.js.map +1 -0
- package/dist/lib/components/agent/active-agent-indicator.component.d.ts +48 -0
- package/dist/lib/components/agent/active-agent-indicator.component.d.ts.map +1 -0
- package/dist/lib/components/agent/active-agent-indicator.component.js +199 -0
- package/dist/lib/components/agent/active-agent-indicator.component.js.map +1 -0
- package/dist/lib/components/agent/agent-process-panel.component.d.ts +30 -0
- package/dist/lib/components/agent/agent-process-panel.component.d.ts.map +1 -0
- package/dist/lib/components/agent/agent-process-panel.component.js +333 -0
- package/dist/lib/components/agent/agent-process-panel.component.js.map +1 -0
- package/dist/lib/components/artifact/artifact-panel.component.d.ts +22 -0
- package/dist/lib/components/artifact/artifact-panel.component.d.ts.map +1 -0
- package/dist/lib/components/artifact/artifact-panel.component.js +237 -0
- package/dist/lib/components/artifact/artifact-panel.component.js.map +1 -0
- package/dist/lib/components/artifact/artifact-upload-modal.component.d.ts +39 -0
- package/dist/lib/components/artifact/artifact-upload-modal.component.d.ts.map +1 -0
- package/dist/lib/components/artifact/artifact-upload-modal.component.js +384 -0
- package/dist/lib/components/artifact/artifact-upload-modal.component.js.map +1 -0
- package/dist/lib/components/artifact/artifact-version-history.component.d.ts +28 -0
- package/dist/lib/components/artifact/artifact-version-history.component.d.ts.map +1 -0
- package/dist/lib/components/artifact/artifact-version-history.component.js +280 -0
- package/dist/lib/components/artifact/artifact-version-history.component.js.map +1 -0
- package/dist/lib/components/artifact/artifact-viewer-panel.component.d.ts +22 -0
- package/dist/lib/components/artifact/artifact-viewer-panel.component.d.ts.map +1 -0
- package/dist/lib/components/artifact/artifact-viewer-panel.component.js +182 -0
- package/dist/lib/components/artifact/artifact-viewer-panel.component.js.map +1 -0
- package/dist/lib/components/artifact/artifact-viewer.component.d.ts +27 -0
- package/dist/lib/components/artifact/artifact-viewer.component.d.ts.map +1 -0
- package/dist/lib/components/artifact/artifact-viewer.component.js +266 -0
- package/dist/lib/components/artifact/artifact-viewer.component.js.map +1 -0
- package/dist/lib/components/artifact/inline-artifact.component.d.ts +46 -0
- package/dist/lib/components/artifact/inline-artifact.component.d.ts.map +1 -0
- package/dist/lib/components/artifact/inline-artifact.component.js +447 -0
- package/dist/lib/components/artifact/inline-artifact.component.js.map +1 -0
- package/dist/lib/components/collection/collection-artifact-card.component.d.ts +18 -0
- package/dist/lib/components/collection/collection-artifact-card.component.d.ts.map +1 -0
- package/dist/lib/components/collection/collection-artifact-card.component.js +147 -0
- package/dist/lib/components/collection/collection-artifact-card.component.js.map +1 -0
- package/dist/lib/components/collection/collection-form-modal.component.d.ts +33 -0
- package/dist/lib/components/collection/collection-form-modal.component.d.ts.map +1 -0
- package/dist/lib/components/collection/collection-form-modal.component.js +245 -0
- package/dist/lib/components/collection/collection-form-modal.component.js.map +1 -0
- package/dist/lib/components/collection/collection-tree.component.d.ts +42 -0
- package/dist/lib/components/collection/collection-tree.component.d.ts.map +1 -0
- package/dist/lib/components/collection/collection-tree.component.js +482 -0
- package/dist/lib/components/collection/collection-tree.component.js.map +1 -0
- package/dist/lib/components/collection/collection-view.component.d.ts +31 -0
- package/dist/lib/components/collection/collection-view.component.d.ts.map +1 -0
- package/dist/lib/components/collection/collection-view.component.js +254 -0
- package/dist/lib/components/collection/collection-view.component.js.map +1 -0
- package/dist/lib/components/collection/collections-full-view.component.d.ts +55 -0
- package/dist/lib/components/collection/collections-full-view.component.d.ts.map +1 -0
- package/dist/lib/components/collection/collections-full-view.component.js +578 -0
- package/dist/lib/components/collection/collections-full-view.component.js.map +1 -0
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +160 -0
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -0
- package/dist/lib/components/conversation/conversation-chat-area.component.js +891 -0
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -0
- package/dist/lib/components/conversation/conversation-list.component.d.ts +29 -0
- package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -0
- package/dist/lib/components/conversation/conversation-list.component.js +255 -0
- package/dist/lib/components/conversation/conversation-list.component.js.map +1 -0
- package/dist/lib/components/dialogs/input-dialog.component.d.ts +17 -0
- package/dist/lib/components/dialogs/input-dialog.component.d.ts.map +1 -0
- package/dist/lib/components/dialogs/input-dialog.component.js +122 -0
- package/dist/lib/components/dialogs/input-dialog.component.js.map +1 -0
- package/dist/lib/components/export/export-modal.component.d.ts +37 -0
- package/dist/lib/components/export/export-modal.component.d.ts.map +1 -0
- package/dist/lib/components/export/export-modal.component.js +414 -0
- package/dist/lib/components/export/export-modal.component.js.map +1 -0
- package/dist/lib/components/library/library-full-view.component.d.ts +36 -0
- package/dist/lib/components/library/library-full-view.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-full-view.component.js +270 -0
- package/dist/lib/components/library/library-full-view.component.js.map +1 -0
- package/dist/lib/components/members/members-modal.component.d.ts +42 -0
- package/dist/lib/components/members/members-modal.component.d.ts.map +1 -0
- package/dist/lib/components/members/members-modal.component.js +352 -0
- package/dist/lib/components/members/members-modal.component.js.map +1 -0
- package/dist/lib/components/mention/mention-dropdown.component.d.ts +44 -0
- package/dist/lib/components/mention/mention-dropdown.component.d.ts.map +1 -0
- package/dist/lib/components/mention/mention-dropdown.component.js +194 -0
- package/dist/lib/components/mention/mention-dropdown.component.js.map +1 -0
- package/dist/lib/components/message/message-input.component.d.ts +137 -0
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -0
- package/dist/lib/components/message/message-input.component.js +1159 -0
- package/dist/lib/components/message/message-input.component.js.map +1 -0
- package/dist/lib/components/message/message-item.component.d.ts +140 -0
- package/dist/lib/components/message/message-item.component.d.ts.map +1 -0
- package/dist/lib/components/message/message-item.component.js +817 -0
- package/dist/lib/components/message/message-item.component.js.map +1 -0
- package/dist/lib/components/message/message-list.component.d.ts +77 -0
- package/dist/lib/components/message/message-list.component.d.ts.map +1 -0
- package/dist/lib/components/message/message-list.component.js +316 -0
- package/dist/lib/components/message/message-list.component.js.map +1 -0
- package/dist/lib/components/navigation/conversation-navigation.component.d.ts +13 -0
- package/dist/lib/components/navigation/conversation-navigation.component.d.ts.map +1 -0
- package/dist/lib/components/navigation/conversation-navigation.component.js +88 -0
- package/dist/lib/components/navigation/conversation-navigation.component.js.map +1 -0
- package/dist/lib/components/notification/activity-indicator.component.d.ts +11 -0
- package/dist/lib/components/notification/activity-indicator.component.d.ts.map +1 -0
- package/dist/lib/components/notification/activity-indicator.component.js +56 -0
- package/dist/lib/components/notification/activity-indicator.component.js.map +1 -0
- package/dist/lib/components/notification/notification-badge.component.d.ts +27 -0
- package/dist/lib/components/notification/notification-badge.component.d.ts.map +1 -0
- package/dist/lib/components/notification/notification-badge.component.js +160 -0
- package/dist/lib/components/notification/notification-badge.component.js.map +1 -0
- package/dist/lib/components/project/project-form-modal.component.d.ts +34 -0
- package/dist/lib/components/project/project-form-modal.component.d.ts.map +1 -0
- package/dist/lib/components/project/project-form-modal.component.js +357 -0
- package/dist/lib/components/project/project-form-modal.component.js.map +1 -0
- package/dist/lib/components/project/project-selector.component.d.ts +36 -0
- package/dist/lib/components/project/project-selector.component.d.ts.map +1 -0
- package/dist/lib/components/project/project-selector.component.js +317 -0
- package/dist/lib/components/project/project-selector.component.js.map +1 -0
- package/dist/lib/components/search/search-panel.component.d.ts +120 -0
- package/dist/lib/components/search/search-panel.component.d.ts.map +1 -0
- package/dist/lib/components/search/search-panel.component.js +714 -0
- package/dist/lib/components/search/search-panel.component.js.map +1 -0
- package/dist/lib/components/share/share-modal.component.d.ts +46 -0
- package/dist/lib/components/share/share-modal.component.d.ts.map +1 -0
- package/dist/lib/components/share/share-modal.component.js +431 -0
- package/dist/lib/components/share/share-modal.component.js.map +1 -0
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts +18 -0
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts.map +1 -0
- package/dist/lib/components/sidebar/conversation-sidebar.component.js +81 -0
- package/dist/lib/components/sidebar/conversation-sidebar.component.js.map +1 -0
- package/dist/lib/components/task/task-form-modal.component.d.ts +42 -0
- package/dist/lib/components/task/task-form-modal.component.d.ts.map +1 -0
- package/dist/lib/components/task/task-form-modal.component.js +329 -0
- package/dist/lib/components/task/task-form-modal.component.js.map +1 -0
- package/dist/lib/components/task/task-item.component.d.ts +22 -0
- package/dist/lib/components/task/task-item.component.d.ts.map +1 -0
- package/dist/lib/components/task/task-item.component.js +234 -0
- package/dist/lib/components/task/task-item.component.js.map +1 -0
- package/dist/lib/components/task/task-list.component.d.ts +32 -0
- package/dist/lib/components/task/task-list.component.d.ts.map +1 -0
- package/dist/lib/components/task/task-list.component.js +290 -0
- package/dist/lib/components/task/task-list.component.js.map +1 -0
- package/dist/lib/components/tasks/tasks-dropdown.component.d.ts +27 -0
- package/dist/lib/components/tasks/tasks-dropdown.component.d.ts.map +1 -0
- package/dist/lib/components/tasks/tasks-dropdown.component.js +254 -0
- package/dist/lib/components/tasks/tasks-dropdown.component.js.map +1 -0
- package/dist/lib/components/thread/thread-panel.component.d.ts +65 -0
- package/dist/lib/components/thread/thread-panel.component.d.ts.map +1 -0
- package/dist/lib/components/thread/thread-panel.component.js +325 -0
- package/dist/lib/components/thread/thread-panel.component.js.map +1 -0
- package/dist/lib/components/toast/toast.component.d.ts +26 -0
- package/dist/lib/components/toast/toast.component.d.ts.map +1 -0
- package/dist/lib/components/toast/toast.component.js +108 -0
- package/dist/lib/components/toast/toast.component.js.map +1 -0
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts +75 -0
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -0
- package/dist/lib/components/workspace/conversation-workspace.component.js +299 -0
- package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -0
- package/dist/lib/conversations.module.d.ts +62 -0
- package/dist/lib/conversations.module.d.ts.map +1 -0
- package/dist/lib/conversations.module.js +248 -0
- package/dist/lib/conversations.module.js.map +1 -0
- package/dist/lib/directives/search-shortcut.directive.d.ts +17 -0
- package/dist/lib/directives/search-shortcut.directive.d.ts.map +1 -0
- package/dist/lib/directives/search-shortcut.directive.js +39 -0
- package/dist/lib/directives/search-shortcut.directive.js.map +1 -0
- package/dist/lib/models/conversation-state.model.d.ts +72 -0
- package/dist/lib/models/conversation-state.model.d.ts.map +1 -0
- package/dist/lib/models/conversation-state.model.js +2 -0
- package/dist/lib/models/conversation-state.model.js.map +1 -0
- package/dist/lib/models/notification.model.d.ts +89 -0
- package/dist/lib/models/notification.model.d.ts.map +1 -0
- package/dist/lib/models/notification.model.js +11 -0
- package/dist/lib/models/notification.model.js.map +1 -0
- package/dist/lib/services/active-tasks.service.d.ts +65 -0
- package/dist/lib/services/active-tasks.service.d.ts.map +1 -0
- package/dist/lib/services/active-tasks.service.js +95 -0
- package/dist/lib/services/active-tasks.service.js.map +1 -0
- package/dist/lib/services/agent-state.service.d.ts +78 -0
- package/dist/lib/services/agent-state.service.d.ts.map +1 -0
- package/dist/lib/services/agent-state.service.js +213 -0
- package/dist/lib/services/agent-state.service.js.map +1 -0
- package/dist/lib/services/artifact-state.service.d.ts +114 -0
- package/dist/lib/services/artifact-state.service.d.ts.map +1 -0
- package/dist/lib/services/artifact-state.service.js +288 -0
- package/dist/lib/services/artifact-state.service.js.map +1 -0
- package/dist/lib/services/conversation-agent.service.d.ts +79 -0
- package/dist/lib/services/conversation-agent.service.d.ts.map +1 -0
- package/dist/lib/services/conversation-agent.service.js +259 -0
- package/dist/lib/services/conversation-agent.service.js.map +1 -0
- package/dist/lib/services/conversation-state.service.d.ts +122 -0
- package/dist/lib/services/conversation-state.service.d.ts.map +1 -0
- package/dist/lib/services/conversation-state.service.js +255 -0
- package/dist/lib/services/conversation-state.service.js.map +1 -0
- package/dist/lib/services/dialog.service.d.ts +54 -0
- package/dist/lib/services/dialog.service.d.ts.map +1 -0
- package/dist/lib/services/dialog.service.js +157 -0
- package/dist/lib/services/dialog.service.js.map +1 -0
- package/dist/lib/services/export.service.d.ts +25 -0
- package/dist/lib/services/export.service.d.ts.map +1 -0
- package/dist/lib/services/export.service.js +237 -0
- package/dist/lib/services/export.service.js.map +1 -0
- package/dist/lib/services/mention-autocomplete.service.d.ts +59 -0
- package/dist/lib/services/mention-autocomplete.service.d.ts.map +1 -0
- package/dist/lib/services/mention-autocomplete.service.js +160 -0
- package/dist/lib/services/mention-autocomplete.service.js.map +1 -0
- package/dist/lib/services/mention-parser.service.d.ts +46 -0
- package/dist/lib/services/mention-parser.service.d.ts.map +1 -0
- package/dist/lib/services/mention-parser.service.js +156 -0
- package/dist/lib/services/mention-parser.service.js.map +1 -0
- package/dist/lib/services/notification.service.d.ts +108 -0
- package/dist/lib/services/notification.service.d.ts.map +1 -0
- package/dist/lib/services/notification.service.js +431 -0
- package/dist/lib/services/notification.service.js.map +1 -0
- package/dist/lib/services/search.service.d.ts +144 -0
- package/dist/lib/services/search.service.d.ts.map +1 -0
- package/dist/lib/services/search.service.js +370 -0
- package/dist/lib/services/search.service.js.map +1 -0
- package/dist/lib/services/toast.service.d.ts +46 -0
- package/dist/lib/services/toast.service.d.ts.map +1 -0
- package/dist/lib/services/toast.service.js +76 -0
- package/dist/lib/services/toast.service.js.map +1 -0
- package/dist/public-api.d.ts +42 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +49 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Metadata, RunView } from '@memberjunction/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Simplified state management for conversations
|
|
6
|
+
* Uses simple arrays with Angular change detection instead of complex observables
|
|
7
|
+
* This prevents synchronization issues when updating conversation properties
|
|
8
|
+
*/
|
|
9
|
+
export class ConversationStateService {
|
|
10
|
+
// Simple properties - Angular change detection will handle updates
|
|
11
|
+
conversations = [];
|
|
12
|
+
activeConversationId = null;
|
|
13
|
+
searchQuery = '';
|
|
14
|
+
isLoading = false;
|
|
15
|
+
activeThreadId = null;
|
|
16
|
+
constructor() { }
|
|
17
|
+
/**
|
|
18
|
+
* Gets the active conversation object
|
|
19
|
+
*/
|
|
20
|
+
get activeConversation() {
|
|
21
|
+
if (!this.activeConversationId)
|
|
22
|
+
return null;
|
|
23
|
+
return this.conversations.find(c => c.ID === this.activeConversationId) || null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets filtered conversations based on search query
|
|
27
|
+
*/
|
|
28
|
+
get filteredConversations() {
|
|
29
|
+
if (!this.searchQuery || this.searchQuery.trim() === '') {
|
|
30
|
+
return this.conversations;
|
|
31
|
+
}
|
|
32
|
+
const lowerQuery = this.searchQuery.toLowerCase();
|
|
33
|
+
return this.conversations.filter(c => (c.Name?.toLowerCase().includes(lowerQuery)) ||
|
|
34
|
+
(c.Description?.toLowerCase().includes(lowerQuery)));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets pinned conversations
|
|
38
|
+
*/
|
|
39
|
+
get pinnedConversations() {
|
|
40
|
+
return this.conversations.filter(c => c.IsPinned);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Sets the active conversation
|
|
44
|
+
* @param id The conversation ID to activate (or null to clear)
|
|
45
|
+
*/
|
|
46
|
+
setActiveConversation(id) {
|
|
47
|
+
console.log('🎯 Setting active conversation:', id);
|
|
48
|
+
this.activeConversationId = id;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gets the current active conversation ID
|
|
52
|
+
*/
|
|
53
|
+
getActiveConversationId() {
|
|
54
|
+
return this.activeConversationId;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Adds a conversation to the list
|
|
58
|
+
* @param conversation The conversation to add
|
|
59
|
+
*/
|
|
60
|
+
addConversation(conversation) {
|
|
61
|
+
this.conversations = [conversation, ...this.conversations];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Updates a conversation in the list by directly modifying the entity object
|
|
65
|
+
* Angular change detection will pick up the changes automatically
|
|
66
|
+
* @param id The conversation ID
|
|
67
|
+
* @param updates The fields to update
|
|
68
|
+
*/
|
|
69
|
+
updateConversationInPlace(id, updates) {
|
|
70
|
+
const conversation = this.conversations.find(c => c.ID === id);
|
|
71
|
+
if (conversation) {
|
|
72
|
+
Object.assign(conversation, updates);
|
|
73
|
+
console.log('📝 Updated conversation in-place:', { id, updates });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Removes a conversation from the list
|
|
78
|
+
* @param id The conversation ID to remove
|
|
79
|
+
*/
|
|
80
|
+
removeConversation(id) {
|
|
81
|
+
this.conversations = this.conversations.filter(c => c.ID !== id);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Sets the search query
|
|
85
|
+
* @param query The search query string
|
|
86
|
+
*/
|
|
87
|
+
setSearchQuery(query) {
|
|
88
|
+
this.searchQuery = query;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Clears the search query
|
|
92
|
+
*/
|
|
93
|
+
clearSearchQuery() {
|
|
94
|
+
this.searchQuery = '';
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Loads conversations from the database
|
|
98
|
+
* @param environmentId The environment ID to filter by
|
|
99
|
+
* @param currentUser The current user context
|
|
100
|
+
*/
|
|
101
|
+
async loadConversations(environmentId, currentUser) {
|
|
102
|
+
this.isLoading = true;
|
|
103
|
+
try {
|
|
104
|
+
const rv = new RunView();
|
|
105
|
+
const filter = `EnvironmentID='${environmentId}' AND (IsArchived IS NULL OR IsArchived=0)`;
|
|
106
|
+
const result = await rv.RunView({
|
|
107
|
+
EntityName: 'Conversations',
|
|
108
|
+
ExtraFilter: filter,
|
|
109
|
+
OrderBy: 'IsPinned DESC, __mj_UpdatedAt DESC',
|
|
110
|
+
MaxRows: 1000,
|
|
111
|
+
ResultType: 'entity_object'
|
|
112
|
+
}, currentUser);
|
|
113
|
+
if (result.Success) {
|
|
114
|
+
this.conversations = result.Results || [];
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
console.error('Failed to load conversations:', result.ErrorMessage);
|
|
118
|
+
this.conversations = [];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
console.error('Error loading conversations:', error);
|
|
123
|
+
this.conversations = [];
|
|
124
|
+
}
|
|
125
|
+
finally {
|
|
126
|
+
this.isLoading = false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Creates a new conversation
|
|
131
|
+
* @param name The conversation name
|
|
132
|
+
* @param environmentId The environment ID
|
|
133
|
+
* @param currentUser The current user context
|
|
134
|
+
* @param description Optional description
|
|
135
|
+
* @param projectId Optional project ID
|
|
136
|
+
* @returns The created conversation entity
|
|
137
|
+
*/
|
|
138
|
+
async createConversation(name, environmentId, currentUser, description, projectId) {
|
|
139
|
+
const md = new Metadata();
|
|
140
|
+
const conversation = await md.GetEntityObject('Conversations', currentUser);
|
|
141
|
+
conversation.Name = name;
|
|
142
|
+
conversation.EnvironmentID = environmentId;
|
|
143
|
+
conversation.UserID = currentUser.ID;
|
|
144
|
+
if (description)
|
|
145
|
+
conversation.Description = description;
|
|
146
|
+
if (projectId)
|
|
147
|
+
conversation.ProjectID = projectId;
|
|
148
|
+
const saved = await conversation.Save();
|
|
149
|
+
if (saved) {
|
|
150
|
+
this.addConversation(conversation);
|
|
151
|
+
return conversation;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
throw new Error(conversation.LatestResult?.Message || 'Failed to create conversation');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Deletes a conversation
|
|
159
|
+
* @param id The conversation ID
|
|
160
|
+
* @param currentUser The current user context
|
|
161
|
+
* @returns True if successful
|
|
162
|
+
*/
|
|
163
|
+
async deleteConversation(id, currentUser) {
|
|
164
|
+
const md = new Metadata();
|
|
165
|
+
const conversation = await md.GetEntityObject('Conversations', currentUser);
|
|
166
|
+
const loaded = await conversation.Load(id);
|
|
167
|
+
if (!loaded) {
|
|
168
|
+
throw new Error('Conversation not found');
|
|
169
|
+
}
|
|
170
|
+
const deleted = await conversation.Delete();
|
|
171
|
+
if (deleted) {
|
|
172
|
+
this.removeConversation(id);
|
|
173
|
+
if (this.getActiveConversationId() === id) {
|
|
174
|
+
this.setActiveConversation(null);
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
throw new Error(conversation.LatestResult?.Message || 'Failed to delete conversation');
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Updates a conversation - saves to database AND updates in-place in the array
|
|
184
|
+
* @param id The conversation ID
|
|
185
|
+
* @param updates The fields to update
|
|
186
|
+
* @param currentUser The current user context
|
|
187
|
+
* @returns True if successful
|
|
188
|
+
*/
|
|
189
|
+
async saveConversation(id, updates, currentUser) {
|
|
190
|
+
const md = new Metadata();
|
|
191
|
+
const conversation = await md.GetEntityObject('Conversations', currentUser);
|
|
192
|
+
const loaded = await conversation.Load(id);
|
|
193
|
+
if (!loaded) {
|
|
194
|
+
throw new Error('Conversation not found');
|
|
195
|
+
}
|
|
196
|
+
// Apply updates
|
|
197
|
+
Object.assign(conversation, updates);
|
|
198
|
+
const saved = await conversation.Save();
|
|
199
|
+
if (saved) {
|
|
200
|
+
// Update the in-memory conversation directly
|
|
201
|
+
this.updateConversationInPlace(id, updates);
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
throw new Error(conversation.LatestResult?.Message || 'Failed to update conversation');
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Toggles the pinned status of a conversation
|
|
210
|
+
* @param id The conversation ID
|
|
211
|
+
* @param currentUser The current user context
|
|
212
|
+
*/
|
|
213
|
+
async togglePin(id, currentUser) {
|
|
214
|
+
const conversation = this.conversations.find(c => c.ID === id);
|
|
215
|
+
if (conversation) {
|
|
216
|
+
await this.saveConversation(id, { IsPinned: !conversation.IsPinned }, currentUser);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Archives a conversation
|
|
221
|
+
* @param id The conversation ID
|
|
222
|
+
* @param currentUser The current user context
|
|
223
|
+
*/
|
|
224
|
+
async archiveConversation(id, currentUser) {
|
|
225
|
+
await this.saveConversation(id, { IsArchived: true }, currentUser);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Opens a thread panel for a specific message
|
|
229
|
+
* @param messageId The parent message ID
|
|
230
|
+
*/
|
|
231
|
+
openThread(messageId) {
|
|
232
|
+
this.activeThreadId = messageId;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Closes the currently open thread panel
|
|
236
|
+
*/
|
|
237
|
+
closeThread() {
|
|
238
|
+
this.activeThreadId = null;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Gets the currently active thread ID
|
|
242
|
+
*/
|
|
243
|
+
getActiveThreadId() {
|
|
244
|
+
return this.activeThreadId;
|
|
245
|
+
}
|
|
246
|
+
static ɵfac = function ConversationStateService_Factory(t) { return new (t || ConversationStateService)(); };
|
|
247
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ConversationStateService, factory: ConversationStateService.ɵfac, providedIn: 'root' });
|
|
248
|
+
}
|
|
249
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConversationStateService, [{
|
|
250
|
+
type: Injectable,
|
|
251
|
+
args: [{
|
|
252
|
+
providedIn: 'root'
|
|
253
|
+
}]
|
|
254
|
+
}], () => [], null); })();
|
|
255
|
+
//# sourceMappingURL=conversation-state.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-state.service.js","sourceRoot":"","sources":["../../../src/lib/services/conversation-state.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;;AAEnE;;;;GAIG;AAIH,MAAM,OAAO,wBAAwB;IACnC,mEAAmE;IAC5D,aAAa,GAAyB,EAAE,CAAC;IACzC,oBAAoB,GAAkB,IAAI,CAAC;IAC3C,WAAW,GAAW,EAAE,CAAC;IACzB,SAAS,GAAY,KAAK,CAAC;IAC3B,cAAc,GAAkB,IAAI,CAAC;IAE5C,gBAAe,CAAC;IAEhB;;OAEG;IACH,IAAI,kBAAkB;QACpB,IAAI,CAAC,IAAI,CAAC,oBAAoB;YAAE,OAAO,IAAI,CAAC;QAC5C,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,oBAAoB,CAAC,IAAI,IAAI,CAAC;IAClF,CAAC;IAED;;OAEG;IACH,IAAI,qBAAqB;QACvB,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACxD,OAAO,IAAI,CAAC,aAAa,CAAC;QAC5B,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CACnC,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC,WAAW,EAAE,WAAW,E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QAAQ,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,WAAW,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,mBAAmB,CAAC,EAAU,EAAE,WAAqB;QACzD,MAAM,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,SAAiB;QAC1B,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,WAAW;QACT,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;kFA/QU,wBAAwB;gEAAxB,wBAAwB,WAAxB,wBAAwB,mBAFvB,MAAM;;iFAEP,wBAAwB;cAHpC,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { DialogService as KendoDialogService, DialogRef } from '@progress/kendo-angular-dialog';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export interface DialogButton {
|
|
4
|
+
text: string;
|
|
5
|
+
primary?: boolean;
|
|
6
|
+
action: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface InputDialogOptions {
|
|
9
|
+
title: string;
|
|
10
|
+
message: string;
|
|
11
|
+
inputLabel: string;
|
|
12
|
+
inputValue?: string;
|
|
13
|
+
inputType?: 'text' | 'textarea' | 'number' | 'email';
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
okText?: string;
|
|
17
|
+
cancelText?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ConfirmDialogOptions {
|
|
20
|
+
title: string;
|
|
21
|
+
message: string;
|
|
22
|
+
okText?: string;
|
|
23
|
+
cancelText?: string;
|
|
24
|
+
dangerous?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Dialog service for displaying Kendo-based dialogs
|
|
28
|
+
* Replaces browser alert() and confirm() with proper UI components
|
|
29
|
+
*/
|
|
30
|
+
export declare class DialogService {
|
|
31
|
+
private kendoDialogService;
|
|
32
|
+
constructor(kendoDialogService: KendoDialogService);
|
|
33
|
+
/**
|
|
34
|
+
* Show a confirmation dialog
|
|
35
|
+
* @returns Promise<boolean> - true if user clicked OK, false if cancelled
|
|
36
|
+
*/
|
|
37
|
+
confirm(options: ConfirmDialogOptions): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Show an alert dialog
|
|
40
|
+
*/
|
|
41
|
+
alert(title: string, message: string, okText?: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Show an input dialog
|
|
44
|
+
* @returns Promise<string | null> - input value if OK clicked, null if cancelled
|
|
45
|
+
*/
|
|
46
|
+
input(options: InputDialogOptions): Promise<string | null>;
|
|
47
|
+
/**
|
|
48
|
+
* Show a custom dialog with custom content and actions
|
|
49
|
+
*/
|
|
50
|
+
custom(title: string, content: string, buttons: DialogButton[], width?: number): DialogRef;
|
|
51
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DialogService, never>;
|
|
52
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DialogService>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=dialog.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/dialog.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;;AAIhG,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,W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s/input-dialog.component';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import * as i1 from "@progress/kendo-angular-dialog";
|
|
5
|
+
/**
|
|
6
|
+
* Dialog service for displaying Kendo-based dialogs
|
|
7
|
+
* Replaces browser alert() and confirm() with proper UI components
|
|
8
|
+
*/
|
|
9
|
+
export class DialogService {
|
|
10
|
+
kendoDialogService;
|
|
11
|
+
constructor(kendoDialogService) {
|
|
12
|
+
this.kendoDialogService = kendoDialogService;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Show a confirmation dialog
|
|
16
|
+
* @returns Promise<boolean> - true if user clicked OK, false if cancelled
|
|
17
|
+
*/
|
|
18
|
+
confirm(options) {
|
|
19
|
+
return new Promise((resolve) => {
|
|
20
|
+
const dialogRef = this.kendoDialogService.open({
|
|
21
|
+
title: options.title,
|
|
22
|
+
content: options.message,
|
|
23
|
+
actions: [
|
|
24
|
+
{
|
|
25
|
+
text: options.cancelText || 'Cancel',
|
|
26
|
+
primary: false
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
text: options.okText || 'OK',
|
|
30
|
+
primary: true,
|
|
31
|
+
themeColor: options.dangerous ? 'error' : 'primary'
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
width: 450,
|
|
35
|
+
minWidth: 250
|
|
36
|
+
});
|
|
37
|
+
dialogRef.result.subscribe((result) => {
|
|
38
|
+
if (result instanceof Object && 'text' in result) {
|
|
39
|
+
resolve(result.text === (options.okText || 'OK'));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
resolve(false);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Show an alert dialog
|
|
49
|
+
*/
|
|
50
|
+
alert(title, message, okText = 'OK') {
|
|
51
|
+
return new Promise((resolve) => {
|
|
52
|
+
const dialogRef = this.kendoDialogService.open({
|
|
53
|
+
title: title,
|
|
54
|
+
content: message,
|
|
55
|
+
actions: [
|
|
56
|
+
{
|
|
57
|
+
text: okText,
|
|
58
|
+
primary: true
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
width: 450,
|
|
62
|
+
minWidth: 250
|
|
63
|
+
});
|
|
64
|
+
dialogRef.result.subscribe(() => {
|
|
65
|
+
resolve();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Show an input dialog
|
|
71
|
+
* @returns Promise<string | null> - input value if OK clicked, null if cancelled
|
|
72
|
+
*/
|
|
73
|
+
input(options) {
|
|
74
|
+
return new Promise((resolve) => {
|
|
75
|
+
const dialogRef = this.kendoDialogService.open({
|
|
76
|
+
title: options.title,
|
|
77
|
+
content: InputDialogComponent,
|
|
78
|
+
actions: [
|
|
79
|
+
{
|
|
80
|
+
text: options.cancelText || 'Cancel',
|
|
81
|
+
primary: false
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
text: options.okText || 'OK',
|
|
85
|
+
primary: true
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
width: 500,
|
|
89
|
+
minWidth: 300
|
|
90
|
+
});
|
|
91
|
+
// Pass data to the component
|
|
92
|
+
const componentInstance = dialogRef.content.instance;
|
|
93
|
+
componentInstance.message = options.message;
|
|
94
|
+
componentInstance.inputLabel = options.inputLabel;
|
|
95
|
+
componentInstance.inputType = options.inputType || 'text';
|
|
96
|
+
componentInstance.placeholder = options.placeholder || '';
|
|
97
|
+
componentInstance.required = options.required || false;
|
|
98
|
+
componentInstance.value = options.inputValue || '';
|
|
99
|
+
// Focus and select input after dialog opens
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
const inputElement = document.querySelector('.k-dialog input, .k-dialog textarea');
|
|
102
|
+
if (inputElement) {
|
|
103
|
+
inputElement.focus();
|
|
104
|
+
inputElement.select();
|
|
105
|
+
}
|
|
106
|
+
}, 100);
|
|
107
|
+
dialogRef.result.subscribe((result) => {
|
|
108
|
+
if (result instanceof Object && 'text' in result && result.text === (options.okText || 'OK')) {
|
|
109
|
+
const value = componentInstance.getValue();
|
|
110
|
+
if (options.required && !value) {
|
|
111
|
+
resolve(null);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
resolve(value);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
resolve(null);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Show a custom dialog with custom content and actions
|
|
125
|
+
*/
|
|
126
|
+
custom(title, content, buttons, width = 500) {
|
|
127
|
+
const actions = buttons.map(btn => ({
|
|
128
|
+
text: btn.text,
|
|
129
|
+
primary: btn.primary || false
|
|
130
|
+
}));
|
|
131
|
+
const dialogRef = this.kendoDialogService.open({
|
|
132
|
+
title: title,
|
|
133
|
+
content: content,
|
|
134
|
+
actions: actions,
|
|
135
|
+
width: width,
|
|
136
|
+
minWidth: 300
|
|
137
|
+
});
|
|
138
|
+
dialogRef.result.subscribe((result) => {
|
|
139
|
+
if (result instanceof Object && 'text' in result) {
|
|
140
|
+
const button = buttons.find(b => b.text === result.text);
|
|
141
|
+
if (button && button.action) {
|
|
142
|
+
button.action();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return dialogRef;
|
|
147
|
+
}
|
|
148
|
+
static ɵfac = function DialogService_Factory(t) { return new (t || DialogService)(i0.ɵɵinject(i1.DialogService)); };
|
|
149
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: DialogService, factory: DialogService.ɵfac, providedIn: 'root' });
|
|
150
|
+
}
|
|
151
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DialogService, [{
|
|
152
|
+
type: Injectable,
|
|
153
|
+
args: [{
|
|
154
|
+
providedIn: 'root'
|
|
155
|
+
}]
|
|
156
|
+
}], () => [{ type: i1.DialogService }], null); })();
|
|
157
|
+
//# sourceMappingURL=dialog.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.service.js","sourceRoot":"","sources":["../../../src/lib/services/dialog.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;;;AA4BpF;;;GAGG;AAIH,MAAM,OAAO,aAAa;IACJ;IAApB,YAAoB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAAG,CAAC;IAE9D;;;OAGG;IACH,OAAO,CAAC,OAA6B;QACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC;gBAC7C,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,OAAO,CAAC,UAAU,IAAI,QAAQ;wBACpC,OAAO,EAAE,KAAK;qBACf;oBACD;wBACE,IAAI,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI;wBAC5B,OAAO,EAAE,IAAI;wBACb,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;qBACpD;iBACF;gBACD,KAAK,EAAE,GAAG;gBACV,QAAQ,EAAE,GAAG;aACd,CAAC,CAAC;YAEH,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE;gBACpC,IAAI,MAAM,YAAY,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;oBACjD,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC;gBACpD,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,KAA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Ae,EAAE,OAAuB,EAAE,QAAgB,GAAG;QACjF,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAClC,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,KAAK;SAC9B,CAAC,CAAC,CAAC;QAEJ,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC;YAC7C,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,GAAG;SACd,CAAC,CAAC;QAEH,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE;YACpC,IAAI,MAAM,YAAY,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;gBACjD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;gBACzD,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;oBAC5B,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClB,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;uEAhJU,aAAa;gEAAb,aAAa,WAAb,aAAa,mBAFZ,MAAM;;iFAEP,aAAa;cAHzB,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UserInfo } from '@memberjunction/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export type ExportFormat = 'json' | 'markdown' | 'html' | 'text';
|
|
4
|
+
export interface ExportOptions {
|
|
5
|
+
includeMessages?: boolean;
|
|
6
|
+
includeMetadata?: boolean;
|
|
7
|
+
prettyPrint?: boolean;
|
|
8
|
+
includeCSS?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class ExportService {
|
|
11
|
+
exportConversation(conversationId: string, format: ExportFormat, currentUser: UserInfo, options?: ExportOptions): Promise<void>;
|
|
12
|
+
private loadConversationData;
|
|
13
|
+
private exportAsJSON;
|
|
14
|
+
private exportAsMarkdown;
|
|
15
|
+
private exportAsHTML;
|
|
16
|
+
private exportAsText;
|
|
17
|
+
private downloadFile;
|
|
18
|
+
private formatDate;
|
|
19
|
+
private capitalizeRole;
|
|
20
|
+
private escapeHtml;
|
|
21
|
+
private getTimestamp;
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ExportService, never>;
|
|
23
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ExportService>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=export.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/export.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,QAAQ,EAAE,MAAM,sBAAsB,CAAC;;AAEzD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,qBAGa,aAAa;IAClB,kBAAkB,CACtB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,QAAQ,EACrB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC;YA2CF,oBAAoB;IA+BlC,OAAO,CAAC,YAAY;IA8CpB,OAAO,CAAC,gBAAgB;IAmCxB,OAAO,CAAC,YAAY;IA+DpB,OAAO,CAAC,YAAY;IAqCpB,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,YAAY;yCAtST,aAAa;6CAAb,aAAa;CA0SzB"}
|