@memberjunction/ng-conversations 6.2.0-edge.0 → 6.2.0-edge.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.
- package/README.md +35 -2
- package/dist/lib/components/active-tasks/active-tasks-panel.component.d.ts +19 -3
- package/dist/lib/components/active-tasks/active-tasks-panel.component.d.ts.map +1 -1
- package/dist/lib/components/active-tasks/active-tasks-panel.component.js +39 -7
- package/dist/lib/components/active-tasks/active-tasks-panel.component.js.map +1 -1
- package/dist/lib/components/agent/active-agent-indicator.component.d.ts +74 -6
- package/dist/lib/components/agent/active-agent-indicator.component.d.ts.map +1 -1
- package/dist/lib/components/agent/active-agent-indicator.component.js +111 -21
- package/dist/lib/components/agent/active-agent-indicator.component.js.map +1 -1
- package/dist/lib/components/agent/agent-process-panel.component.d.ts +31 -5
- package/dist/lib/components/agent/agent-process-panel.component.d.ts.map +1 -1
- package/dist/lib/components/agent/agent-process-panel.component.js +71 -15
- package/dist/lib/components/agent/agent-process-panel.component.js.map +1 -1
- package/dist/lib/components/artifact/artifact-share-modal.component.d.ts +65 -9
- package/dist/lib/components/artifact/artifact-share-modal.component.d.ts.map +1 -1
- package/dist/lib/components/artifact/artifact-share-modal.component.js +169 -57
- package/dist/lib/components/artifact/artifact-share-modal.component.js.map +1 -1
- package/dist/lib/components/attachment/image-viewer.component.d.ts +77 -11
- package/dist/lib/components/attachment/image-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/attachment/image-viewer.component.js +181 -47
- package/dist/lib/components/attachment/image-viewer.component.js.map +1 -1
- package/dist/lib/components/collection/artifact-collection-picker-modal.component.d.ts +129 -19
- package/dist/lib/components/collection/artifact-collection-picker-modal.component.d.ts.map +1 -1
- package/dist/lib/components/collection/artifact-collection-picker-modal.component.js +350 -116
- package/dist/lib/components/collection/artifact-collection-picker-modal.component.js.map +1 -1
- package/dist/lib/components/collection/artifact-create-modal.component.d.ts +60 -8
- package/dist/lib/components/collection/artifact-create-modal.component.d.ts.map +1 -1
- package/dist/lib/components/collection/artifact-create-modal.component.js +130 -46
- package/dist/lib/components/collection/artifact-create-modal.component.js.map +1 -1
- package/dist/lib/components/collection/collection-artifact-card.component.d.ts +63 -3
- package/dist/lib/components/collection/collection-artifact-card.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-artifact-card.component.js +113 -19
- package/dist/lib/components/collection/collection-artifact-card.component.js.map +1 -1
- package/dist/lib/components/collection/collection-form-modal.component.d.ts +54 -8
- package/dist/lib/components/collection/collection-form-modal.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-form-modal.component.js +130 -46
- package/dist/lib/components/collection/collection-form-modal.component.js.map +1 -1
- package/dist/lib/components/collection/collection-share-modal.component.d.ts +70 -10
- package/dist/lib/components/collection/collection-share-modal.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-share-modal.component.js +175 -53
- package/dist/lib/components/collection/collection-share-modal.component.js.map +1 -1
- package/dist/lib/components/collection/collection-tree.component.d.ts +89 -9
- package/dist/lib/components/collection/collection-tree.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-tree.component.js +220 -70
- package/dist/lib/components/collection/collection-tree.component.js.map +1 -1
- package/dist/lib/components/collection/collection-view.component.d.ts +89 -11
- package/dist/lib/components/collection/collection-view.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-view.component.js +154 -40
- package/dist/lib/components/collection/collection-view.component.js.map +1 -1
- package/dist/lib/components/collection/collections-full-view.component.d.ts +390 -38
- package/dist/lib/components/collection/collections-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collections-full-view.component.js +951 -367
- package/dist/lib/components/collection/collections-full-view.component.js.map +1 -1
- package/dist/lib/components/composer/ai-composer.component.d.ts +213 -18
- package/dist/lib/components/composer/ai-composer.component.d.ts.map +1 -1
- package/dist/lib/components/composer/ai-composer.component.js +388 -44
- package/dist/lib/components/composer/ai-composer.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts +12 -1
- package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-agent-picker.component.js +26 -4
- package/dist/lib/components/conversation/conversation-agent-picker.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +1090 -123
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +2399 -706
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-empty-state.component.d.ts +139 -19
- package/dist/lib/components/conversation/conversation-empty-state.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-empty-state.component.js +296 -59
- package/dist/lib/components/conversation/conversation-empty-state.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts +579 -78
- package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.js +2322 -823
- package/dist/lib/components/conversation/conversation-list.component.js.map +1 -1
- package/dist/lib/components/conversation/pinned-messages-panel.component.d.ts +40 -4
- package/dist/lib/components/conversation/pinned-messages-panel.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/pinned-messages-panel.component.js +72 -14
- package/dist/lib/components/conversation/pinned-messages-panel.component.js.map +1 -1
- package/dist/lib/components/dialogs/input-dialog.component.d.ts +57 -11
- package/dist/lib/components/dialogs/input-dialog.component.d.ts.map +1 -1
- package/dist/lib/components/dialogs/input-dialog.component.js +128 -16
- package/dist/lib/components/dialogs/input-dialog.component.js.map +1 -1
- package/dist/lib/components/dialogs/rating-dialog.component.d.ts +68 -10
- package/dist/lib/components/dialogs/rating-dialog.component.d.ts.map +1 -1
- package/dist/lib/components/dialogs/rating-dialog.component.js +151 -27
- package/dist/lib/components/dialogs/rating-dialog.component.js.map +1 -1
- package/dist/lib/components/export/export-modal.component.d.ts +84 -10
- package/dist/lib/components/export/export-modal.component.d.ts.map +1 -1
- package/dist/lib/components/export/export-modal.component.js +173 -49
- package/dist/lib/components/export/export-modal.component.js.map +1 -1
- package/dist/lib/components/global-tasks/global-tasks-panel.component.d.ts +29 -3
- package/dist/lib/components/global-tasks/global-tasks-panel.component.d.ts.map +1 -1
- package/dist/lib/components/global-tasks/global-tasks-panel.component.js +58 -12
- package/dist/lib/components/global-tasks/global-tasks-panel.component.js.map +1 -1
- package/dist/lib/components/library/library-full-view.component.d.ts +57 -8
- package/dist/lib/components/library/library-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/library/library-full-view.component.js +119 -35
- package/dist/lib/components/library/library-full-view.component.js.map +1 -1
- package/dist/lib/components/members/members-modal.component.d.ts +76 -10
- package/dist/lib/components/members/members-modal.component.d.ts.map +1 -1
- package/dist/lib/components/members/members-modal.component.js +164 -50
- package/dist/lib/components/members/members-modal.component.js.map +1 -1
- package/dist/lib/components/message/actionable-commands.component.d.ts +37 -5
- package/dist/lib/components/message/actionable-commands.component.d.ts.map +1 -1
- package/dist/lib/components/message/actionable-commands.component.js +82 -16
- package/dist/lib/components/message/actionable-commands.component.js.map +1 -1
- package/dist/lib/components/message/conversation-message-rating.component.d.ts +46 -10
- package/dist/lib/components/message/conversation-message-rating.component.d.ts.map +1 -1
- package/dist/lib/components/message/conversation-message-rating.component.js +120 -36
- package/dist/lib/components/message/conversation-message-rating.component.js.map +1 -1
- package/dist/lib/components/message/message-input.component.d.ts +549 -74
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input.component.js +1250 -421
- package/dist/lib/components/message/message-input.component.js.map +1 -1
- package/dist/lib/components/message/message-item.component.d.ts +411 -29
- package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-item.component.js +896 -222
- package/dist/lib/components/message/message-item.component.js.map +1 -1
- package/dist/lib/components/message/message-list.component.d.ts +288 -29
- package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-list.component.js +561 -123
- package/dist/lib/components/message/message-list.component.js.map +1 -1
- package/dist/lib/components/navigation/conversation-navigation.component.d.ts +64 -5
- package/dist/lib/components/navigation/conversation-navigation.component.d.ts.map +1 -1
- package/dist/lib/components/navigation/conversation-navigation.component.js +101 -11
- package/dist/lib/components/navigation/conversation-navigation.component.js.map +1 -1
- package/dist/lib/components/notification/activity-indicator.component.d.ts +6 -2
- package/dist/lib/components/notification/activity-indicator.component.d.ts.map +1 -1
- package/dist/lib/components/notification/activity-indicator.component.js +13 -3
- package/dist/lib/components/notification/activity-indicator.component.js.map +1 -1
- package/dist/lib/components/notification/notification-badge.component.d.ts +15 -3
- package/dist/lib/components/notification/notification-badge.component.d.ts.map +1 -1
- package/dist/lib/components/notification/notification-badge.component.js +36 -8
- package/dist/lib/components/notification/notification-badge.component.js.map +1 -1
- package/dist/lib/components/overlay/chat-overlay.component.d.ts +1 -1
- package/dist/lib/components/overlay/chat-overlay.component.js +4 -4
- package/dist/lib/components/overlay/chat-overlay.component.js.map +1 -1
- package/dist/lib/components/project/project-form-modal.component.d.ts +93 -11
- package/dist/lib/components/project/project-form-modal.component.d.ts.map +1 -1
- package/dist/lib/components/project/project-form-modal.component.js +348 -87
- package/dist/lib/components/project/project-form-modal.component.js.map +1 -1
- package/dist/lib/components/project/project-selector.component.d.ts +78 -8
- package/dist/lib/components/project/project-selector.component.d.ts.map +1 -1
- package/dist/lib/components/project/project-selector.component.js +177 -46
- package/dist/lib/components/project/project-selector.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts +1 -1
- package/dist/lib/components/realtime/realtime-activity-rail.component.js +2 -2
- package/dist/lib/components/realtime/realtime-activity-rail.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts +1 -1
- package/dist/lib/components/realtime/realtime-delegation-card.component.js +2 -2
- package/dist/lib/components/realtime/realtime-delegation-card.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +2 -2
- package/dist/lib/components/realtime/realtime-session-overlay.component.js +18 -18
- package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts +47 -23
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.js +136 -92
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts +2 -2
- package/dist/lib/components/realtime/realtime-surface-tabs.component.js +4 -4
- package/dist/lib/components/realtime/realtime-surface-tabs.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js +3 -3
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -1
- package/dist/lib/components/realtime/realtime-ui-config.d.ts +13 -11
- package/dist/lib/components/realtime/realtime-ui-config.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-ui-config.js +29 -25
- package/dist/lib/components/realtime/realtime-ui-config.js.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts +3 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +6 -2
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -1
- package/dist/lib/components/search/search-panel.component.d.ts +133 -22
- package/dist/lib/components/search/search-panel.component.d.ts.map +1 -1
- package/dist/lib/components/search/search-panel.component.js +312 -83
- package/dist/lib/components/search/search-panel.component.js.map +1 -1
- package/dist/lib/components/share/share-modal.component.d.ts +69 -9
- package/dist/lib/components/share/share-modal.component.d.ts.map +1 -1
- package/dist/lib/components/share/share-modal.component.js +139 -31
- package/dist/lib/components/share/share-modal.component.js.map +1 -1
- package/dist/lib/components/shared/user-picker.component.d.ts +48 -8
- package/dist/lib/components/shared/user-picker.component.d.ts.map +1 -1
- package/dist/lib/components/shared/user-picker.component.js +110 -30
- package/dist/lib/components/shared/user-picker.component.js.map +1 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts +114 -11
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts.map +1 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.js +199 -21
- package/dist/lib/components/sidebar/conversation-sidebar.component.js.map +1 -1
- package/dist/lib/components/sidebar/routines-section.component.d.ts +20 -1
- package/dist/lib/components/sidebar/routines-section.component.d.ts.map +1 -1
- package/dist/lib/components/sidebar/routines-section.component.js +25 -5
- package/dist/lib/components/sidebar/routines-section.component.js.map +1 -1
- package/dist/lib/components/slots/slot-interfaces.d.ts +19 -0
- package/dist/lib/components/slots/slot-interfaces.d.ts.map +1 -1
- package/dist/lib/components/slots/slot-interfaces.js.map +1 -1
- package/dist/lib/components/task/tasks-full-view.component.d.ts +95 -13
- package/dist/lib/components/task/tasks-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/task/tasks-full-view.component.js +223 -75
- package/dist/lib/components/task/tasks-full-view.component.js.map +1 -1
- package/dist/lib/components/tasks/task-widget.component.d.ts +46 -6
- package/dist/lib/components/tasks/task-widget.component.d.ts.map +1 -1
- package/dist/lib/components/tasks/task-widget.component.js +100 -16
- package/dist/lib/components/tasks/task-widget.component.js.map +1 -1
- package/dist/lib/components/tasks/tasks-dropdown.component.d.ts +64 -7
- package/dist/lib/components/tasks/tasks-dropdown.component.d.ts.map +1 -1
- package/dist/lib/components/tasks/tasks-dropdown.component.js +127 -27
- package/dist/lib/components/tasks/tasks-dropdown.component.js.map +1 -1
- package/dist/lib/components/thread/thread-panel.component.d.ts +66 -8
- package/dist/lib/components/thread/thread-panel.component.d.ts.map +1 -1
- package/dist/lib/components/thread/thread-panel.component.js +146 -36
- package/dist/lib/components/thread/thread-panel.component.js.map +1 -1
- package/dist/lib/components/toast/toast.component.d.ts +11 -1
- package/dist/lib/components/toast/toast.component.d.ts.map +1 -1
- package/dist/lib/components/toast/toast.component.js +25 -5
- package/dist/lib/components/toast/toast.component.js.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts +385 -42
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.js +887 -291
- package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
- package/dist/lib/composer-plugins/base-conversation-mention.provider.d.ts +8 -0
- package/dist/lib/composer-plugins/base-conversation-mention.provider.d.ts.map +1 -1
- package/dist/lib/composer-plugins/base-conversation-mention.provider.js +8 -1
- package/dist/lib/composer-plugins/base-conversation-mention.provider.js.map +1 -1
- package/dist/lib/directives/chat-slot.directive.d.ts +5 -1
- package/dist/lib/directives/chat-slot.directive.d.ts.map +1 -1
- package/dist/lib/directives/chat-slot.directive.js.map +1 -1
- package/dist/lib/directives/search-shortcut.directive.d.ts +9 -1
- package/dist/lib/directives/search-shortcut.directive.d.ts.map +1 -1
- package/dist/lib/directives/search-shortcut.directive.js +14 -4
- package/dist/lib/directives/search-shortcut.directive.js.map +1 -1
- package/dist/lib/events/chat-events.d.ts +34 -7
- package/dist/lib/events/chat-events.d.ts.map +1 -1
- package/dist/lib/events/chat-events.js +37 -7
- package/dist/lib/events/chat-events.js.map +1 -1
- package/dist/lib/models/agent-turn.model.d.ts +103 -0
- package/dist/lib/models/agent-turn.model.d.ts.map +1 -0
- package/dist/lib/models/agent-turn.model.js +12 -0
- package/dist/lib/models/agent-turn.model.js.map +1 -0
- package/dist/lib/models/collection-view.model.js.map +1 -1
- package/dist/lib/models/conversation-state.model.d.ts +8 -0
- package/dist/lib/models/conversation-state.model.d.ts.map +1 -1
- package/dist/lib/models/conversation-state.model.js.map +1 -1
- package/dist/lib/models/lazy-artifact-info.d.ts +44 -12
- package/dist/lib/models/lazy-artifact-info.d.ts.map +1 -1
- package/dist/lib/models/lazy-artifact-info.js +98 -34
- package/dist/lib/models/lazy-artifact-info.js.map +1 -1
- package/dist/lib/services/active-tasks.service.d.ts +30 -4
- package/dist/lib/services/active-tasks.service.d.ts.map +1 -1
- package/dist/lib/services/active-tasks.service.js +71 -19
- package/dist/lib/services/active-tasks.service.js.map +1 -1
- package/dist/lib/services/agent-state.service.d.ts +17 -1
- package/dist/lib/services/agent-state.service.d.ts.map +1 -1
- package/dist/lib/services/agent-state.service.js +48 -16
- package/dist/lib/services/agent-state.service.js.map +1 -1
- package/dist/lib/services/artifact-permission.service.d.ts +39 -0
- package/dist/lib/services/artifact-permission.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-permission.service.js +152 -17
- package/dist/lib/services/artifact-permission.service.js.map +1 -1
- package/dist/lib/services/artifact-state.service.d.ts +58 -5
- package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-state.service.js +135 -35
- package/dist/lib/services/artifact-state.service.js.map +1 -1
- package/dist/lib/services/collection-permission.service.d.ts +28 -0
- package/dist/lib/services/collection-permission.service.d.ts.map +1 -1
- package/dist/lib/services/collection-permission.service.js +88 -32
- package/dist/lib/services/collection-permission.service.js.map +1 -1
- package/dist/lib/services/collection-state.service.d.ts +11 -1
- package/dist/lib/services/collection-state.service.d.ts.map +1 -1
- package/dist/lib/services/collection-state.service.js +25 -5
- package/dist/lib/services/collection-state.service.js.map +1 -1
- package/dist/lib/services/conversation-agent.service.d.ts +26 -4
- package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-agent.service.js +57 -18
- package/dist/lib/services/conversation-agent.service.js.map +1 -1
- package/dist/lib/services/conversation-attachment.service.d.ts +17 -0
- package/dist/lib/services/conversation-attachment.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-attachment.service.js +38 -10
- package/dist/lib/services/conversation-attachment.service.js.map +1 -1
- package/dist/lib/services/conversation-streaming.service.d.ts +22 -0
- package/dist/lib/services/conversation-streaming.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-streaming.service.js +50 -10
- package/dist/lib/services/conversation-streaming.service.js.map +1 -1
- package/dist/lib/services/data-cache.service.d.ts +31 -0
- package/dist/lib/services/data-cache.service.d.ts.map +1 -1
- package/dist/lib/services/data-cache.service.js +71 -15
- package/dist/lib/services/data-cache.service.js.map +1 -1
- package/dist/lib/services/dialog.service.d.ts +13 -0
- package/dist/lib/services/dialog.service.d.ts.map +1 -1
- package/dist/lib/services/dialog.service.js +25 -5
- package/dist/lib/services/dialog.service.js.map +1 -1
- package/dist/lib/services/export.service.d.ts +2 -0
- package/dist/lib/services/export.service.d.ts.map +1 -1
- package/dist/lib/services/export.service.js +5 -1
- package/dist/lib/services/export.service.js.map +1 -1
- package/dist/lib/services/mention-parser.service.d.ts +10 -0
- package/dist/lib/services/mention-parser.service.d.ts.map +1 -1
- package/dist/lib/services/mention-parser.service.js +25 -5
- package/dist/lib/services/mention-parser.service.js.map +1 -1
- package/dist/lib/services/notification.service.d.ts +54 -6
- package/dist/lib/services/notification.service.d.ts.map +1 -1
- package/dist/lib/services/notification.service.js +123 -27
- package/dist/lib/services/notification.service.js.map +1 -1
- package/dist/lib/services/realtime-audio-recorder.d.ts +4 -4
- package/dist/lib/services/realtime-audio-recorder.js +12 -12
- package/dist/lib/services/realtime-audio-recorder.js.map +1 -1
- package/dist/lib/services/realtime-pcm-wav.d.ts +4 -0
- package/dist/lib/services/realtime-pcm-wav.d.ts.map +1 -1
- package/dist/lib/services/realtime-pcm-wav.js +10 -2
- package/dist/lib/services/realtime-pcm-wav.js.map +1 -1
- package/dist/lib/services/search.service.d.ts +42 -9
- package/dist/lib/services/search.service.d.ts.map +1 -1
- package/dist/lib/services/search.service.js +103 -23
- package/dist/lib/services/search.service.js.map +1 -1
- package/dist/lib/services/toast.service.d.ts +19 -1
- package/dist/lib/services/toast.service.d.ts.map +1 -1
- package/dist/lib/services/toast.service.js +45 -9
- package/dist/lib/services/toast.service.js.map +1 -1
- package/dist/lib/services/ui-command-handler.service.d.ts +16 -2
- package/dist/lib/services/ui-command-handler.service.d.ts.map +1 -1
- package/dist/lib/services/ui-command-handler.service.js +36 -8
- package/dist/lib/services/ui-command-handler.service.js.map +1 -1
- package/dist/lib/utils/agent-artifact-summary.d.ts +2 -2
- package/dist/lib/utils/agent-artifact-summary.js +3 -3
- package/dist/lib/utils/agent-artifact-summary.js.map +1 -1
- package/dist/lib/utils/agent-turn-routing.d.ts +69 -0
- package/dist/lib/utils/agent-turn-routing.d.ts.map +1 -0
- package/dist/lib/utils/agent-turn-routing.js +96 -0
- package/dist/lib/utils/agent-turn-routing.js.map +1 -0
- package/dist/lib/utils/artifact-panel-action.d.ts +15 -4
- package/dist/lib/utils/artifact-panel-action.d.ts.map +1 -1
- package/dist/lib/utils/artifact-panel-action.js +10 -2
- package/dist/lib/utils/artifact-panel-action.js.map +1 -1
- package/dist/lib/utils/distinct-artifacts.d.ts +2 -0
- package/dist/lib/utils/distinct-artifacts.d.ts.map +1 -1
- package/dist/lib/utils/distinct-artifacts.js +5 -1
- package/dist/lib/utils/distinct-artifacts.js.map +1 -1
- package/dist/lib/utils/plan-mode-preference.d.ts +2 -2
- package/dist/lib/utils/plan-mode-preference.js +6 -6
- package/dist/lib/utils/plan-mode-preference.js.map +1 -1
- package/dist/public-api.d.ts +3 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +3 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +32 -32
|
@@ -36,7 +36,7 @@ export class DataCacheService {
|
|
|
36
36
|
* @param currentUser User context for loading
|
|
37
37
|
* @returns The cached or loaded MJConversationEntity, or null if not found
|
|
38
38
|
*/
|
|
39
|
-
async
|
|
39
|
+
async GetConversation(id, currentUser) {
|
|
40
40
|
// Check cache first
|
|
41
41
|
const cached = this.conversations.find(c => UUIDsEqual(c.ID, id));
|
|
42
42
|
if (cached) {
|
|
@@ -53,13 +53,17 @@ export class DataCacheService {
|
|
|
53
53
|
}
|
|
54
54
|
return null;
|
|
55
55
|
}
|
|
56
|
+
/** @deprecated Use {@link GetConversation}. */
|
|
57
|
+
async getConversation(id, currentUser) {
|
|
58
|
+
return this.GetConversation(id, currentUser);
|
|
59
|
+
}
|
|
56
60
|
/**
|
|
57
61
|
* Create a new MJConversationEntity and automatically cache it
|
|
58
62
|
* The cache is the ONLY place GetEntityObject() should be called
|
|
59
63
|
* @param currentUser User context
|
|
60
64
|
* @returns New MJConversationEntity instance (already cached)
|
|
61
65
|
*/
|
|
62
|
-
async
|
|
66
|
+
async CreateConversation(currentUser) {
|
|
63
67
|
const md = this.Provider;
|
|
64
68
|
const conversation = await md.GetEntityObject('MJ: Conversations', currentUser);
|
|
65
69
|
// Automatically add to cache - user code doesn't need to do anything
|
|
@@ -68,20 +72,32 @@ export class DataCacheService {
|
|
|
68
72
|
this.conversations.push(conversation);
|
|
69
73
|
return conversation;
|
|
70
74
|
}
|
|
75
|
+
/** @deprecated Use {@link CreateConversation}. */
|
|
76
|
+
async createConversation(currentUser) {
|
|
77
|
+
return this.CreateConversation(currentUser);
|
|
78
|
+
}
|
|
71
79
|
/**
|
|
72
80
|
* Remove a MJConversationEntity from the cache
|
|
73
81
|
* @param id The conversation ID to remove
|
|
74
82
|
*/
|
|
75
|
-
|
|
83
|
+
RemoveConversation(id) {
|
|
76
84
|
this.conversations = this.conversations.filter(c => !UUIDsEqual(c.ID, id));
|
|
77
85
|
}
|
|
86
|
+
/** @deprecated Use {@link RemoveConversation}. */
|
|
87
|
+
removeConversation(id) {
|
|
88
|
+
return this.RemoveConversation(id);
|
|
89
|
+
}
|
|
78
90
|
/**
|
|
79
91
|
* Get all cached MJConversationEntity objects (no DB call)
|
|
80
92
|
* @returns Array of cached conversations
|
|
81
93
|
*/
|
|
82
|
-
|
|
94
|
+
GetCachedConversations() {
|
|
83
95
|
return this.conversations;
|
|
84
96
|
}
|
|
97
|
+
/** @deprecated Use {@link GetCachedConversations}. */
|
|
98
|
+
getCachedConversations() {
|
|
99
|
+
return this.GetCachedConversations();
|
|
100
|
+
}
|
|
85
101
|
// =============================================================================
|
|
86
102
|
// MJConversationDetailEntity Methods
|
|
87
103
|
// =============================================================================
|
|
@@ -91,7 +107,7 @@ export class DataCacheService {
|
|
|
91
107
|
* @param currentUser User context for loading
|
|
92
108
|
* @returns The cached or loaded MJConversationDetailEntity, or null if not found
|
|
93
109
|
*/
|
|
94
|
-
async
|
|
110
|
+
async GetConversationDetail(id, currentUser) {
|
|
95
111
|
// Check cache first
|
|
96
112
|
const cached = this.conversationDetails.find(d => UUIDsEqual(d.ID, id));
|
|
97
113
|
if (cached) {
|
|
@@ -108,13 +124,17 @@ export class DataCacheService {
|
|
|
108
124
|
}
|
|
109
125
|
return null;
|
|
110
126
|
}
|
|
127
|
+
/** @deprecated Use {@link GetConversationDetail}. */
|
|
128
|
+
async getConversationDetail(id, currentUser) {
|
|
129
|
+
return this.GetConversationDetail(id, currentUser);
|
|
130
|
+
}
|
|
111
131
|
/**
|
|
112
132
|
* Create a new MJConversationDetailEntity and automatically cache it
|
|
113
133
|
* The cache is the ONLY place GetEntityObject() should be called
|
|
114
134
|
* @param currentUser User context
|
|
115
135
|
* @returns New MJConversationDetailEntity instance (already cached)
|
|
116
136
|
*/
|
|
117
|
-
async
|
|
137
|
+
async CreateConversationDetail(currentUser) {
|
|
118
138
|
const md = this.Provider;
|
|
119
139
|
const detail = await md.GetEntityObject('MJ: Conversation Details', currentUser);
|
|
120
140
|
// Automatically add to cache - user code doesn't need to do anything
|
|
@@ -123,6 +143,10 @@ export class DataCacheService {
|
|
|
123
143
|
this.conversationDetails.push(detail);
|
|
124
144
|
return detail;
|
|
125
145
|
}
|
|
146
|
+
/** @deprecated Use {@link CreateConversationDetail}. */
|
|
147
|
+
async createConversationDetail(currentUser) {
|
|
148
|
+
return this.CreateConversationDetail(currentUser);
|
|
149
|
+
}
|
|
126
150
|
/**
|
|
127
151
|
* Load all ConversationDetail entities for a conversation and cache them
|
|
128
152
|
* Used when loading a conversation's message history
|
|
@@ -130,7 +154,7 @@ export class DataCacheService {
|
|
|
130
154
|
* @param currentUser User context
|
|
131
155
|
* @returns Array of MJConversationDetailEntity objects
|
|
132
156
|
*/
|
|
133
|
-
async
|
|
157
|
+
async LoadConversationDetails(conversationId, currentUser) {
|
|
134
158
|
const timestamp = new Date().toISOString();
|
|
135
159
|
console.log(`[${timestamp}] 💾 DataCacheService.loadConversationDetails - Loading messages for conversation ${conversationId}`);
|
|
136
160
|
const rv = RunView.FromMetadataProvider(this.Provider);
|
|
@@ -161,21 +185,33 @@ export class DataCacheService {
|
|
|
161
185
|
console.log(`[${timestamp}] 💾 DataCacheService - Failed to load messages for conversation ${conversationId}`);
|
|
162
186
|
return [];
|
|
163
187
|
}
|
|
188
|
+
/** @deprecated Use {@link LoadConversationDetails}. */
|
|
189
|
+
async loadConversationDetails(conversationId, currentUser) {
|
|
190
|
+
return this.LoadConversationDetails(conversationId, currentUser);
|
|
191
|
+
}
|
|
164
192
|
/**
|
|
165
193
|
* Get all cached ConversationDetail entities for a conversation (no DB call)
|
|
166
194
|
* @param conversationId The conversation ID
|
|
167
195
|
* @returns Array of cached conversation details
|
|
168
196
|
*/
|
|
169
|
-
|
|
197
|
+
GetCachedConversationDetails(conversationId) {
|
|
170
198
|
return this.conversationDetails.filter(d => UUIDsEqual(d.ConversationID, conversationId));
|
|
171
199
|
}
|
|
200
|
+
/** @deprecated Use {@link GetCachedConversationDetails}. */
|
|
201
|
+
getCachedConversationDetails(conversationId) {
|
|
202
|
+
return this.GetCachedConversationDetails(conversationId);
|
|
203
|
+
}
|
|
172
204
|
/**
|
|
173
205
|
* Remove a MJConversationDetailEntity from the cache
|
|
174
206
|
* @param id The conversation detail ID to remove
|
|
175
207
|
*/
|
|
176
|
-
|
|
208
|
+
RemoveConversationDetail(id) {
|
|
177
209
|
this.conversationDetails = this.conversationDetails.filter(d => !UUIDsEqual(d.ID, id));
|
|
178
210
|
}
|
|
211
|
+
/** @deprecated Use {@link RemoveConversationDetail}. */
|
|
212
|
+
removeConversationDetail(id) {
|
|
213
|
+
return this.RemoveConversationDetail(id);
|
|
214
|
+
}
|
|
179
215
|
// =============================================================================
|
|
180
216
|
// Cache Management
|
|
181
217
|
// =============================================================================
|
|
@@ -184,7 +220,7 @@ export class DataCacheService {
|
|
|
184
220
|
* This forces a reload from the database on next access
|
|
185
221
|
* @param entityName The entity name to refresh (e.g., 'Conversations', 'MJ: Conversation Details')
|
|
186
222
|
*/
|
|
187
|
-
async
|
|
223
|
+
async RefreshEntity(entityName) {
|
|
188
224
|
switch (entityName) {
|
|
189
225
|
case 'Conversations':
|
|
190
226
|
this.conversations = [];
|
|
@@ -196,16 +232,20 @@ export class DataCacheService {
|
|
|
196
232
|
console.warn('Unknown entity name for refresh:', entityName);
|
|
197
233
|
}
|
|
198
234
|
}
|
|
235
|
+
/** @deprecated Use {@link RefreshEntity}. */
|
|
236
|
+
async refreshEntity(entityName) {
|
|
237
|
+
return this.RefreshEntity(entityName);
|
|
238
|
+
}
|
|
199
239
|
/**
|
|
200
240
|
* Refresh a specific cache by name
|
|
201
241
|
* This method can be extended to handle different cache types
|
|
202
242
|
* @param cacheName The cache name ('Core', 'AI', 'Actions')
|
|
203
243
|
*/
|
|
204
|
-
async
|
|
244
|
+
async RefreshCache(cacheName) {
|
|
205
245
|
switch (cacheName) {
|
|
206
246
|
case 'Core':
|
|
207
247
|
// Clear core entity caches
|
|
208
|
-
this.
|
|
248
|
+
this.Clear();
|
|
209
249
|
break;
|
|
210
250
|
case 'AI':
|
|
211
251
|
// AI-specific cache refresh would go here
|
|
@@ -220,32 +260,48 @@ export class DataCacheService {
|
|
|
220
260
|
console.warn('Unknown cache name for refresh:', cacheName);
|
|
221
261
|
}
|
|
222
262
|
}
|
|
263
|
+
/** @deprecated Use {@link RefreshCache}. */
|
|
264
|
+
async refreshCache(cacheName) {
|
|
265
|
+
return this.RefreshCache(cacheName);
|
|
266
|
+
}
|
|
223
267
|
/**
|
|
224
268
|
* Clear all cached entities
|
|
225
269
|
* Call when switching environments, users, or when needed
|
|
226
270
|
*/
|
|
227
|
-
|
|
271
|
+
Clear() {
|
|
228
272
|
this.conversations = [];
|
|
229
273
|
this.conversationDetails = [];
|
|
230
274
|
}
|
|
275
|
+
/** @deprecated Use {@link Clear}. */
|
|
276
|
+
clear() {
|
|
277
|
+
return this.Clear();
|
|
278
|
+
}
|
|
231
279
|
/**
|
|
232
280
|
* Clear cached entities for a specific conversation
|
|
233
281
|
* @param conversationId The conversation ID
|
|
234
282
|
*/
|
|
235
|
-
|
|
283
|
+
ClearConversation(conversationId) {
|
|
236
284
|
this.conversations = this.conversations.filter(c => !UUIDsEqual(c.ID, conversationId));
|
|
237
285
|
this.conversationDetails = this.conversationDetails.filter(d => !UUIDsEqual(d.ConversationID, conversationId));
|
|
238
286
|
}
|
|
287
|
+
/** @deprecated Use {@link ClearConversation}. */
|
|
288
|
+
clearConversation(conversationId) {
|
|
289
|
+
return this.ClearConversation(conversationId);
|
|
290
|
+
}
|
|
239
291
|
/**
|
|
240
292
|
* Get cache statistics for debugging
|
|
241
293
|
* @returns Object with cache sizes
|
|
242
294
|
*/
|
|
243
|
-
|
|
295
|
+
GetStats() {
|
|
244
296
|
return {
|
|
245
297
|
conversations: this.conversations.length,
|
|
246
298
|
conversationDetails: this.conversationDetails.length
|
|
247
299
|
};
|
|
248
300
|
}
|
|
301
|
+
/** @deprecated Use {@link GetStats}. */
|
|
302
|
+
getStats() {
|
|
303
|
+
return this.GetStats();
|
|
304
|
+
}
|
|
249
305
|
static ɵfac = function DataCacheService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DataCacheService)(); };
|
|
250
306
|
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: DataCacheService, factory: DataCacheService.ɵfac, providedIn: 'root' });
|
|
251
307
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-cache.service.js","sourceRoot":"","sources":["../../../src/lib/services/data-cache.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAwB,OAAO,EAAqB,MAAM,sBAAsB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AAgB,WAAhB,gBAAgB,mBAFf,MAAM;;iFAEP,gBAAgB;cAH5B,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB","sourcesContent":["import { Injectable } from '@angular/core';\nimport { MJConversationEntity, MJConversationDetailEntity } from '@memberjunction/core-entities';\nimport { Metadata, UserInfo, BaseEntity, RunView, IMetadataProvider } from '@memberjunction/core';\nimport { UUIDsEqual } from '@memberjunction/global';\n\n/**\n * Global singleton cache for conversation-related entities.\n * Maintains single instances of entities to prevent race conditions and ensure\n * all components see the same object state.\n *\n * Pattern: Instead of creating new entity instances with GetEntityObject() everywhere,\n * request entities from this cache. The cache returns the same instance each time,\n * so when one component updates entity.Status = 'Complete', all other components\n * see that change immediately without needing to reload from the database.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class DataCacheService {\n // Separate arrays for each entity type\n private conversations: MJConversationEntity[] = [];\n private conversationDetails: MJConversationDetailEntity[] = [];\n\n private _provider: IMetadataProvider | null = null;\n\n constructor() {}\n\n /**\n * Set the metadata provider this service should use. When unset, falls back to Metadata.Provider.\n */\n public set Provider(value: IMetadataProvider | null) {\n this._provider = value;\n }\n\n public get Provider(): IMetadataProvider {\n return this._provider ?? Metadata.Provider;\n }\n\n // =============================================================================\n // MJConversationEntity Methods\n // =============================================================================\n\n /**\n * Get a MJConversationEntity by ID from cache, or load it if not cached\n * @param id The conversation ID\n * @param currentUser User context for loading\n * @returns The cached or loaded MJConversationEntity, or null if not found\n */\n async getConversation(id: string, currentUser: UserInfo): Promise<MJConversationEntity | null> {\n // Check cache first\n const cached = this.conversations.find(c => UUIDsEqual(c.ID, id));\n if (cached) {\n return cached;\n }\n\n // Not in cache - load from DB\n const md = this.Provider;\n const conversation = await md.GetEntityObject<MJConversationEntity>('MJ: Conversations', currentUser);\n const loaded = await conversation.Load(id);\n\n if (loaded) {\n // Add to cache\n this.conversations.push(conversation);\n return conversation;\n }\n\n return null;\n }\n\n /**\n * Create a new MJConversationEntity and automatically cache it\n * The cache is the ONLY place GetEntityObject() should be called\n * @param currentUser User context\n * @returns New MJConversationEntity instance (already cached)\n */\n async createConversation(currentUser: UserInfo): Promise<MJConversationEntity> {\n const md = this.Provider;\n const conversation = await md.GetEntityObject<MJConversationEntity>('MJ: Conversations', currentUser);\n\n // Automatically add to cache - user code doesn't need to do anything\n // Note: Conversation has no ID yet (not saved), so we can't deduplicate\n // After Save(), the ID will be populated and future getConversation() calls will find it\n this.conversations.push(conversation);\n\n return conversation;\n }\n\n /**\n * Remove a MJConversationEntity from the cache\n * @param id The conversation ID to remove\n */\n removeConversation(id: string): void {\n this.conversations = this.conversations.filter(c => !UUIDsEqual(c.ID, id));\n }\n\n /**\n * Get all cached MJConversationEntity objects (no DB call)\n * @returns Array of cached conversations\n */\n getCachedConversations(): MJConversationEntity[] {\n return this.conversations;\n }\n\n // =============================================================================\n // MJConversationDetailEntity Methods\n // =============================================================================\n\n /**\n * Get a MJConversationDetailEntity by ID from cache, or load it if not cached\n * @param id The conversation detail ID\n * @param currentUser User context for loading\n * @returns The cached or loaded MJConversationDetailEntity, or null if not found\n */\n async getConversationDetail(id: string, currentUser: UserInfo): Promise<MJConversationDetailEntity | null> {\n // Check cache first\n const cached = this.conversationDetails.find(d => UUIDsEqual(d.ID, id));\n if (cached) {\n return cached;\n }\n\n // Not in cache - load from DB\n const md = this.Provider;\n const detail = await md.GetEntityObject<MJConversationDetailEntity>('MJ: Conversation Details', currentUser);\n const loaded = await detail.Load(id);\n\n if (loaded) {\n // Add to cache\n this.conversationDetails.push(detail);\n return detail;\n }\n\n return null;\n }\n\n /**\n * Create a new MJConversationDetailEntity and automatically cache it\n * The cache is the ONLY place GetEntityObject() should be called\n * @param currentUser User context\n * @returns New MJConversationDetailEntity instance (already cached)\n */\n async createConversationDetail(currentUser: UserInfo): Promise<MJConversationDetailEntity> {\n const md = this.Provider;\n const detail = await md.GetEntityObject<MJConversationDetailEntity>('MJ: Conversation Details', currentUser);\n\n // Automatically add to cache - user code doesn't need to do anything\n // Note: Detail has no ID yet (not saved), so we can't deduplicate\n // After Save(), the ID will be populated and future getConversationDetail() calls will find it\n\n this.conversationDetails.push(detail);\n\n return detail;\n }\n\n /**\n * Load all ConversationDetail entities for a conversation and cache them\n * Used when loading a conversation's message history\n * @param conversationId The conversation ID\n * @param currentUser User context\n * @returns Array of MJConversationDetailEntity objects\n */\n async loadConversationDetails(conversationId: string, currentUser: UserInfo): Promise<MJConversationDetailEntity[]> {\n const timestamp = new Date().toISOString();\n console.log(`[${timestamp}] 💾 DataCacheService.loadConversationDetails - Loading messages for conversation ${conversationId}`);\n\n const rv = RunView.FromMetadataProvider(this.Provider);\n\n console.log(`[${timestamp}] 💾 DataCacheService - Executing RunView for Conversation Details`);\n const result = await rv.RunView<MJConversationDetailEntity>(\n {\n EntityName: 'MJ: Conversation Details',\n ExtraFilter: `ConversationID='${conversationId}'`,\n OrderBy: '__mj_CreatedAt ASC',\n ResultType: 'entity_object'\n },\n currentUser\n );\n\n if (result.Success) {\n const details = result.Results || [];\n console.log(`[${timestamp}] 💾 DataCacheService - Loaded ${details.length} message(s) for conversation ${conversationId}`);\n\n // Add all to cache (avoid duplicates by checking ID)\n for (const detail of details) {\n const existingIndex = this.conversationDetails.findIndex(d => UUIDsEqual(d.ID, detail.ID));\n if (existingIndex >= 0) {\n // Replace existing (ensures we keep the same object reference)\n this.conversationDetails[existingIndex] = detail;\n } else {\n // Add new\n this.conversationDetails.push(detail);\n }\n }\n\n return details;\n }\n\n console.log(`[${timestamp}] 💾 DataCacheService - Failed to load messages for conversation ${conversationId}`);\n return [];\n }\n\n /**\n * Get all cached ConversationDetail entities for a conversation (no DB call)\n * @param conversationId The conversation ID\n * @returns Array of cached conversation details\n */\n getCachedConversationDetails(conversationId: string): MJConversationDetailEntity[] {\n return this.conversationDetails.filter(d => UUIDsEqual(d.ConversationID, conversationId));\n }\n\n /**\n * Remove a MJConversationDetailEntity from the cache\n * @param id The conversation detail ID to remove\n */\n removeConversationDetail(id: string): void {\n this.conversationDetails = this.conversationDetails.filter(d => !UUIDsEqual(d.ID, id));\n }\n\n // =============================================================================\n // Cache Management\n // =============================================================================\n\n /**\n * Refresh entity data by clearing cached entities of a specific type\n * This forces a reload from the database on next access\n * @param entityName The entity name to refresh (e.g., 'Conversations', 'MJ: Conversation Details')\n */\n async refreshEntity(entityName: string): Promise<void> {\n switch (entityName) {\n case 'Conversations':\n this.conversations = [];\n break;\n case 'MJ: Conversation Details':\n this.conversationDetails = [];\n break;\n default:\n console.warn('Unknown entity name for refresh:', entityName);\n }\n }\n\n /**\n * Refresh a specific cache by name\n * This method can be extended to handle different cache types\n * @param cacheName The cache name ('Core', 'AI', 'Actions')\n */\n async refreshCache(cacheName: 'Core' | 'AI' | 'Actions'): Promise<void> {\n switch (cacheName) {\n case 'Core':\n // Clear core entity caches\n this.clear();\n break;\n case 'AI':\n // AI-specific cache refresh would go here\n // For now, just log it\n console.log('AI cache refresh requested (not yet implemented)');\n break;\n case 'Actions':\n // Actions-specific cache refresh would go here\n console.log('Actions cache refresh requested (not yet implemented)');\n break;\n default:\n console.warn('Unknown cache name for refresh:', cacheName);\n }\n }\n\n /**\n * Clear all cached entities\n * Call when switching environments, users, or when needed\n */\n clear(): void {\n this.conversations = [];\n this.conversationDetails = [];\n }\n\n /**\n * Clear cached entities for a specific conversation\n * @param conversationId The conversation ID\n */\n clearConversation(conversationId: string): void {\n this.conversations = this.conversations.filter(c => !UUIDsEqual(c.ID, conversationId));\n this.conversationDetails = this.conversationDetails.filter(d => !UUIDsEqual(d.ConversationID, conversationId));\n }\n\n /**\n * Get cache statistics for debugging\n * @returns Object with cache sizes\n */\n getStats(): { conversations: number; conversationDetails: number } {\n return {\n conversations: this.conversations.length,\n conversationDetails: this.conversationDetails.length\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"data-cache.service.js","sourceRoot":"","sources":["../../../src/lib/services/data-cache.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA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,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;IACjH,CAAC;IAED,iDAAiD;IACjD,iBAAiB,CAAC,cAAsB;QACtC,OAAO,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC;IAED;;;OAGG;IACH,QAAQ;QACN,OAAO;YACL,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM;YACxC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,CAAC,MAAM;SACrD,CAAC;IACJ,CAAC;IAED,wCAAwC;IACxC,QAAQ;QACN,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;0GAvVU,gBAAgB;gEAAhB,gBAAgB,WAAhB,gBAAgB,mBAFf,MAAM;;iFAEP,gBAAgB;cAH5B,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB","sourcesContent":["import { Injectable } from '@angular/core';\nimport { MJConversationEntity, MJConversationDetailEntity } from '@memberjunction/core-entities';\nimport { Metadata, UserInfo, BaseEntity, RunView, IMetadataProvider } from '@memberjunction/core';\nimport { UUIDsEqual } from '@memberjunction/global';\n\n/**\n * Global singleton cache for conversation-related entities.\n * Maintains single instances of entities to prevent race conditions and ensure\n * all components see the same object state.\n *\n * Pattern: Instead of creating new entity instances with GetEntityObject() everywhere,\n * request entities from this cache. The cache returns the same instance each time,\n * so when one component updates entity.Status = 'Complete', all other components\n * see that change immediately without needing to reload from the database.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class DataCacheService {\n // Separate arrays for each entity type\n private conversations: MJConversationEntity[] = [];\n private conversationDetails: MJConversationDetailEntity[] = [];\n\n private _provider: IMetadataProvider | null = null;\n\n constructor() {}\n\n /**\n * Set the metadata provider this service should use. When unset, falls back to Metadata.Provider.\n */\n public set Provider(value: IMetadataProvider | null) {\n this._provider = value;\n }\n\n public get Provider(): IMetadataProvider {\n return this._provider ?? Metadata.Provider;\n }\n\n // =============================================================================\n // MJConversationEntity Methods\n // =============================================================================\n\n /**\n * Get a MJConversationEntity by ID from cache, or load it if not cached\n * @param id The conversation ID\n * @param currentUser User context for loading\n * @returns The cached or loaded MJConversationEntity, or null if not found\n */\n async GetConversation(id: string, currentUser: UserInfo): Promise<MJConversationEntity | null> {\n // Check cache first\n const cached = this.conversations.find(c => UUIDsEqual(c.ID, id));\n if (cached) {\n return cached;\n }\n\n // Not in cache - load from DB\n const md = this.Provider;\n const conversation = await md.GetEntityObject<MJConversationEntity>('MJ: Conversations', currentUser);\n const loaded = await conversation.Load(id);\n\n if (loaded) {\n // Add to cache\n this.conversations.push(conversation);\n return conversation;\n }\n\n return null;\n }\n\n /** @deprecated Use {@link GetConversation}. */\n async getConversation(id: string, currentUser: UserInfo): Promise<MJConversationEntity | null> {\n return this.GetConversation(id, currentUser);\n }\n\n /**\n * Create a new MJConversationEntity and automatically cache it\n * The cache is the ONLY place GetEntityObject() should be called\n * @param currentUser User context\n * @returns New MJConversationEntity instance (already cached)\n */\n async CreateConversation(currentUser: UserInfo): Promise<MJConversationEntity> {\n const md = this.Provider;\n const conversation = await md.GetEntityObject<MJConversationEntity>('MJ: Conversations', currentUser);\n\n // Automatically add to cache - user code doesn't need to do anything\n // Note: Conversation has no ID yet (not saved), so we can't deduplicate\n // After Save(), the ID will be populated and future getConversation() calls will find it\n this.conversations.push(conversation);\n\n return conversation;\n }\n\n /** @deprecated Use {@link CreateConversation}. */\n async createConversation(currentUser: UserInfo): Promise<MJConversationEntity> {\n return this.CreateConversation(currentUser);\n }\n\n /**\n * Remove a MJConversationEntity from the cache\n * @param id The conversation ID to remove\n */\n RemoveConversation(id: string): void {\n this.conversations = this.conversations.filter(c => !UUIDsEqual(c.ID, id));\n }\n\n /** @deprecated Use {@link RemoveConversation}. */\n removeConversation(id: string): void {\n return this.RemoveConversation(id);\n }\n\n /**\n * Get all cached MJConversationEntity objects (no DB call)\n * @returns Array of cached conversations\n */\n GetCachedConversations(): MJConversationEntity[] {\n return this.conversations;\n }\n\n /** @deprecated Use {@link GetCachedConversations}. */\n getCachedConversations(): MJConversationEntity[] {\n return this.GetCachedConversations();\n }\n\n // =============================================================================\n // MJConversationDetailEntity Methods\n // =============================================================================\n\n /**\n * Get a MJConversationDetailEntity by ID from cache, or load it if not cached\n * @param id The conversation detail ID\n * @param currentUser User context for loading\n * @returns The cached or loaded MJConversationDetailEntity, or null if not found\n */\n async GetConversationDetail(id: string, currentUser: UserInfo): Promise<MJConversationDetailEntity | null> {\n // Check cache first\n const cached = this.conversationDetails.find(d => UUIDsEqual(d.ID, id));\n if (cached) {\n return cached;\n }\n\n // Not in cache - load from DB\n const md = this.Provider;\n const detail = await md.GetEntityObject<MJConversationDetailEntity>('MJ: Conversation Details', currentUser);\n const loaded = await detail.Load(id);\n\n if (loaded) {\n // Add to cache\n this.conversationDetails.push(detail);\n return detail;\n }\n\n return null;\n }\n\n /** @deprecated Use {@link GetConversationDetail}. */\n async getConversationDetail(id: string, currentUser: UserInfo): Promise<MJConversationDetailEntity | null> {\n return this.GetConversationDetail(id, currentUser);\n }\n\n /**\n * Create a new MJConversationDetailEntity and automatically cache it\n * The cache is the ONLY place GetEntityObject() should be called\n * @param currentUser User context\n * @returns New MJConversationDetailEntity instance (already cached)\n */\n async CreateConversationDetail(currentUser: UserInfo): Promise<MJConversationDetailEntity> {\n const md = this.Provider;\n const detail = await md.GetEntityObject<MJConversationDetailEntity>('MJ: Conversation Details', currentUser);\n\n // Automatically add to cache - user code doesn't need to do anything\n // Note: Detail has no ID yet (not saved), so we can't deduplicate\n // After Save(), the ID will be populated and future getConversationDetail() calls will find it\n\n this.conversationDetails.push(detail);\n\n return detail;\n }\n\n /** @deprecated Use {@link CreateConversationDetail}. */\n async createConversationDetail(currentUser: UserInfo): Promise<MJConversationDetailEntity> {\n return this.CreateConversationDetail(currentUser);\n }\n\n /**\n * Load all ConversationDetail entities for a conversation and cache them\n * Used when loading a conversation's message history\n * @param conversationId The conversation ID\n * @param currentUser User context\n * @returns Array of MJConversationDetailEntity objects\n */\n async LoadConversationDetails(conversationId: string, currentUser: UserInfo): Promise<MJConversationDetailEntity[]> {\n const timestamp = new Date().toISOString();\n console.log(`[${timestamp}] 💾 DataCacheService.loadConversationDetails - Loading messages for conversation ${conversationId}`);\n\n const rv = RunView.FromMetadataProvider(this.Provider);\n\n console.log(`[${timestamp}] 💾 DataCacheService - Executing RunView for Conversation Details`);\n const result = await rv.RunView<MJConversationDetailEntity>(\n {\n EntityName: 'MJ: Conversation Details',\n ExtraFilter: `ConversationID='${conversationId}'`,\n OrderBy: '__mj_CreatedAt ASC',\n ResultType: 'entity_object'\n },\n currentUser\n );\n\n if (result.Success) {\n const details = result.Results || [];\n console.log(`[${timestamp}] 💾 DataCacheService - Loaded ${details.length} message(s) for conversation ${conversationId}`);\n\n // Add all to cache (avoid duplicates by checking ID)\n for (const detail of details) {\n const existingIndex = this.conversationDetails.findIndex(d => UUIDsEqual(d.ID, detail.ID));\n if (existingIndex >= 0) {\n // Replace existing (ensures we keep the same object reference)\n this.conversationDetails[existingIndex] = detail;\n } else {\n // Add new\n this.conversationDetails.push(detail);\n }\n }\n\n return details;\n }\n\n console.log(`[${timestamp}] 💾 DataCacheService - Failed to load messages for conversation ${conversationId}`);\n return [];\n }\n\n /** @deprecated Use {@link LoadConversationDetails}. */\n async loadConversationDetails(conversationId: string, currentUser: UserInfo): Promise<MJConversationDetailEntity[]> {\n return this.LoadConversationDetails(conversationId, currentUser);\n }\n\n /**\n * Get all cached ConversationDetail entities for a conversation (no DB call)\n * @param conversationId The conversation ID\n * @returns Array of cached conversation details\n */\n GetCachedConversationDetails(conversationId: string): MJConversationDetailEntity[] {\n return this.conversationDetails.filter(d => UUIDsEqual(d.ConversationID, conversationId));\n }\n\n /** @deprecated Use {@link GetCachedConversationDetails}. */\n getCachedConversationDetails(conversationId: string): MJConversationDetailEntity[] {\n return this.GetCachedConversationDetails(conversationId);\n }\n\n /**\n * Remove a MJConversationDetailEntity from the cache\n * @param id The conversation detail ID to remove\n */\n RemoveConversationDetail(id: string): void {\n this.conversationDetails = this.conversationDetails.filter(d => !UUIDsEqual(d.ID, id));\n }\n\n /** @deprecated Use {@link RemoveConversationDetail}. */\n removeConversationDetail(id: string): void {\n return this.RemoveConversationDetail(id);\n }\n\n // =============================================================================\n // Cache Management\n // =============================================================================\n\n /**\n * Refresh entity data by clearing cached entities of a specific type\n * This forces a reload from the database on next access\n * @param entityName The entity name to refresh (e.g., 'Conversations', 'MJ: Conversation Details')\n */\n async RefreshEntity(entityName: string): Promise<void> {\n switch (entityName) {\n case 'Conversations':\n this.conversations = [];\n break;\n case 'MJ: Conversation Details':\n this.conversationDetails = [];\n break;\n default:\n console.warn('Unknown entity name for refresh:', entityName);\n }\n }\n\n /** @deprecated Use {@link RefreshEntity}. */\n async refreshEntity(entityName: string): Promise<void> {\n return this.RefreshEntity(entityName);\n }\n\n /**\n * Refresh a specific cache by name\n * This method can be extended to handle different cache types\n * @param cacheName The cache name ('Core', 'AI', 'Actions')\n */\n async RefreshCache(cacheName: 'Core' | 'AI' | 'Actions'): Promise<void> {\n switch (cacheName) {\n case 'Core':\n // Clear core entity caches\n this.Clear();\n break;\n case 'AI':\n // AI-specific cache refresh would go here\n // For now, just log it\n console.log('AI cache refresh requested (not yet implemented)');\n break;\n case 'Actions':\n // Actions-specific cache refresh would go here\n console.log('Actions cache refresh requested (not yet implemented)');\n break;\n default:\n console.warn('Unknown cache name for refresh:', cacheName);\n }\n }\n\n /** @deprecated Use {@link RefreshCache}. */\n async refreshCache(cacheName: 'Core' | 'AI' | 'Actions'): Promise<void> {\n return this.RefreshCache(cacheName);\n }\n\n /**\n * Clear all cached entities\n * Call when switching environments, users, or when needed\n */\n Clear(): void {\n this.conversations = [];\n this.conversationDetails = [];\n }\n\n /** @deprecated Use {@link Clear}. */\n clear(): void {\n return this.Clear();\n }\n\n /**\n * Clear cached entities for a specific conversation\n * @param conversationId The conversation ID\n */\n ClearConversation(conversationId: string): void {\n this.conversations = this.conversations.filter(c => !UUIDsEqual(c.ID, conversationId));\n this.conversationDetails = this.conversationDetails.filter(d => !UUIDsEqual(d.ConversationID, conversationId));\n }\n\n /** @deprecated Use {@link ClearConversation}. */\n clearConversation(conversationId: string): void {\n return this.ClearConversation(conversationId);\n }\n\n /**\n * Get cache statistics for debugging\n * @returns Object with cache sizes\n */\n GetStats(): { conversations: number; conversationDetails: number } {\n return {\n conversations: this.conversations.length,\n conversationDetails: this.conversationDetails.length\n };\n }\n\n /** @deprecated Use {@link GetStats}. */\n getStats(): { conversations: number; conversationDetails: number } {\n return this.GetStats();\n }\n}\n"]}
|
|
@@ -57,10 +57,14 @@ export declare class DialogService {
|
|
|
57
57
|
* Show a confirmation dialog
|
|
58
58
|
* @returns Promise<boolean> - true if user clicked OK, false if cancelled
|
|
59
59
|
*/
|
|
60
|
+
Confirm(options: ConfirmDialogOptions): Promise<boolean>;
|
|
61
|
+
/** @deprecated Use {@link Confirm}. */
|
|
60
62
|
confirm(options: ConfirmDialogOptions): Promise<boolean>;
|
|
61
63
|
/**
|
|
62
64
|
* Show an alert dialog
|
|
63
65
|
*/
|
|
66
|
+
Alert(title: string, message: string, okText?: string): Promise<void>;
|
|
67
|
+
/** @deprecated Use {@link Alert}. */
|
|
64
68
|
alert(title: string, message: string, okText?: string): Promise<void>;
|
|
65
69
|
/**
|
|
66
70
|
* Show an input dialog
|
|
@@ -69,6 +73,11 @@ export declare class DialogService {
|
|
|
69
73
|
* If dual input: returns object with both values
|
|
70
74
|
* Returns null if cancelled
|
|
71
75
|
*/
|
|
76
|
+
Input(options: InputDialogOptions): Promise<string | {
|
|
77
|
+
value: string;
|
|
78
|
+
secondValue?: string;
|
|
79
|
+
} | null>;
|
|
80
|
+
/** @deprecated Use {@link Input}. */
|
|
72
81
|
input(options: InputDialogOptions): Promise<string | {
|
|
73
82
|
value: string;
|
|
74
83
|
secondValue?: string;
|
|
@@ -77,10 +86,14 @@ export declare class DialogService {
|
|
|
77
86
|
* Show a rating dialog (1-10 + free-form comments).
|
|
78
87
|
* @returns Promise<RatingDialogResult | null> — null if cancelled or no rating selected.
|
|
79
88
|
*/
|
|
89
|
+
Rating(options?: RatingDialogOptions): Promise<RatingDialogResult | null>;
|
|
90
|
+
/** @deprecated Use {@link Rating}. */
|
|
80
91
|
rating(options?: RatingDialogOptions): Promise<RatingDialogResult | null>;
|
|
81
92
|
/**
|
|
82
93
|
* Show a custom dialog with custom content and actions
|
|
83
94
|
*/
|
|
95
|
+
Custom(title: string, content: string, buttons: DialogButton[], width?: number): MJDialogRef;
|
|
96
|
+
/** @deprecated Use {@link Custom}. */
|
|
84
97
|
custom(title: string, content: string, buttons: DialogButton[], width?: number): MJDialogRef;
|
|
85
98
|
static ɵfac: i0.ɵɵFactoryDeclaration<DialogService, never>;
|
|
86
99
|
static ɵprov: i0.ɵɵInjectableDeclaration<DialogService>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/dialog.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAkB,MAAM,kCAAkC,CAAC;;AAKhG,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,mBA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AAM,GAAG;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI,CAAC;IAIlG;;;OAGG;IACH,MAAM,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IA0C7E,sCAAsC;IACtC,MAAM,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAI7E;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,GAAE,MAAY,GAAG,WAAW;IA2BjG,sCAAsC;IACtC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,GAAE,MAAY,GAAG,WAAW;yCAxOtF,aAAa;6CAAb,aAAa;CA2OzB"}
|
|
@@ -16,7 +16,7 @@ export class DialogService {
|
|
|
16
16
|
* Show a confirmation dialog
|
|
17
17
|
* @returns Promise<boolean> - true if user clicked OK, false if cancelled
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
Confirm(options) {
|
|
20
20
|
return new Promise((resolve) => {
|
|
21
21
|
const dialogRef = this.mjDialogService.open({
|
|
22
22
|
title: options.title,
|
|
@@ -46,10 +46,14 @@ export class DialogService {
|
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
+
/** @deprecated Use {@link Confirm}. */
|
|
50
|
+
confirm(options) {
|
|
51
|
+
return this.Confirm(options);
|
|
52
|
+
}
|
|
49
53
|
/**
|
|
50
54
|
* Show an alert dialog
|
|
51
55
|
*/
|
|
52
|
-
|
|
56
|
+
Alert(title, message, okText = 'OK') {
|
|
53
57
|
return new Promise((resolve) => {
|
|
54
58
|
const dialogRef = this.mjDialogService.open({
|
|
55
59
|
title: title,
|
|
@@ -68,6 +72,10 @@ export class DialogService {
|
|
|
68
72
|
});
|
|
69
73
|
});
|
|
70
74
|
}
|
|
75
|
+
/** @deprecated Use {@link Alert}. */
|
|
76
|
+
alert(title, message, okText = 'OK') {
|
|
77
|
+
return this.Alert(title, message, okText);
|
|
78
|
+
}
|
|
71
79
|
/**
|
|
72
80
|
* Show an input dialog
|
|
73
81
|
* @returns Promise<string | {value: string; secondValue?: string} | null> -
|
|
@@ -75,7 +83,7 @@ export class DialogService {
|
|
|
75
83
|
* If dual input: returns object with both values
|
|
76
84
|
* Returns null if cancelled
|
|
77
85
|
*/
|
|
78
|
-
|
|
86
|
+
Input(options) {
|
|
79
87
|
return new Promise((resolve) => {
|
|
80
88
|
const dialogRef = this.mjDialogService.open({
|
|
81
89
|
title: options.title,
|
|
@@ -140,11 +148,15 @@ export class DialogService {
|
|
|
140
148
|
});
|
|
141
149
|
});
|
|
142
150
|
}
|
|
151
|
+
/** @deprecated Use {@link Input}. */
|
|
152
|
+
input(options) {
|
|
153
|
+
return this.Input(options);
|
|
154
|
+
}
|
|
143
155
|
/**
|
|
144
156
|
* Show a rating dialog (1-10 + free-form comments).
|
|
145
157
|
* @returns Promise<RatingDialogResult | null> — null if cancelled or no rating selected.
|
|
146
158
|
*/
|
|
147
|
-
|
|
159
|
+
Rating(options = {}) {
|
|
148
160
|
return new Promise((resolve) => {
|
|
149
161
|
const okText = options.okText || 'Submit';
|
|
150
162
|
const cancelText = options.cancelText || 'Cancel';
|
|
@@ -184,10 +196,14 @@ export class DialogService {
|
|
|
184
196
|
});
|
|
185
197
|
});
|
|
186
198
|
}
|
|
199
|
+
/** @deprecated Use {@link Rating}. */
|
|
200
|
+
rating(options = {}) {
|
|
201
|
+
return this.Rating(options);
|
|
202
|
+
}
|
|
187
203
|
/**
|
|
188
204
|
* Show a custom dialog with custom content and actions
|
|
189
205
|
*/
|
|
190
|
-
|
|
206
|
+
Custom(title, content, buttons, width = 500) {
|
|
191
207
|
const actions = buttons.map(btn => ({
|
|
192
208
|
text: btn.text,
|
|
193
209
|
primary: btn.primary || false
|
|
@@ -210,6 +226,10 @@ export class DialogService {
|
|
|
210
226
|
});
|
|
211
227
|
return dialogRef;
|
|
212
228
|
}
|
|
229
|
+
/** @deprecated Use {@link Custom}. */
|
|
230
|
+
custom(title, content, buttons, width = 500) {
|
|
231
|
+
return this.Custom(title, content, buttons, width);
|
|
232
|
+
}
|
|
213
233
|
static ɵfac = function DialogService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DialogService)(i0.ɵɵinject(i1.MJDialogService)); };
|
|
214
234
|
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: DialogService, factory: DialogService.ɵfac, providedIn: 'root' });
|
|
215
235
|
}
|
|
@@ -1 +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;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;;;AAqDtF;;;GAGG;AAIH,MAAM,OAAO,aAAa;IACJ;IAApB,YAAoB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAExD;;;OAGG;IACH,OAAO,CAAC,OAA6B;QACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;gBAC1C,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI;wBAC5B,OAAO,EAAE,IAAI;wBACb,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CA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ogRef, MJDialogAction } from '@memberjunction/ng-ui-components';\nimport { Observable } from 'rxjs';\nimport { InputDialogComponent } from '../components/dialogs/input-dialog.component';\nimport { RatingDialogComponent } from '../components/dialogs/rating-dialog.component';\n\nexport interface DialogButton {\n text: string;\n primary?: boolean;\n action: () => void;\n}\n\nexport interface InputDialogOptions {\n title: string;\n message: string;\n inputLabel: string;\n inputValue?: string;\n inputType?: 'text' | 'textarea' | 'number' | 'email';\n placeholder?: string;\n required?: boolean;\n secondInputLabel?: string;\n secondInputValue?: string;\n secondInputPlaceholder?: string;\n secondInputRequired?: boolean;\n okText?: string;\n cancelText?: string;\n}\n\nexport interface ConfirmDialogOptions {\n title: string;\n message: string;\n okText?: string;\n cancelText?: string;\n dangerous?: boolean;\n}\n\nexport interface RatingDialogOptions {\n title?: string;\n message?: string;\n initialRating?: number | null;\n initialComments?: string;\n okText?: string;\n cancelText?: string;\n /** When true, the rating dialog shows a consent checkbox the user must\n * accept before submitting (first-time-only authorization). */\n requireConsent?: boolean;\n}\n\nexport interface RatingDialogResult {\n rating: number;\n comments: string;\n /** True only when the user *just* acknowledged consent in this dialog —\n * i.e. `requireConsent` was true and they checked the box. The caller\n * should persist the acknowledgement so consent isn't requested again. */\n consentNewlyAcknowledged: boolean;\n}\n\n/**\n * Dialog service for displaying MJ dialogs.\n * Replaces browser alert() and confirm() with proper UI components.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class DialogService {\n constructor(private mjDialogService: MJDialogService) {}\n\n /**\n * Show a confirmation dialog\n * @returns Promise<boolean> - true if user clicked OK, false if cancelled\n */\n confirm(options: ConfirmDialogOptions): Promise<boolean> {\n return new Promise((resolve) => {\n const dialogRef = this.mjDialogService.open({\n title: options.title,\n content: options.message,\n actions: [\n {\n text: options.okText || 'OK',\n primary: true,\n themeColor: options.dangerous ? 'error' : 'primary'\n },\n {\n text: options.cancelText || 'Cancel',\n primary: false\n }\n ],\n width: 450,\n minWidth: 250\n });\n\n dialogRef.Result.subscribe((result) => {\n const action = result as MJDialogAction | undefined;\n if (action && 'text' in action) {\n resolve(action.text === (options.okText || 'OK'));\n } else {\n resolve(false);\n }\n });\n });\n }\n\n /**\n * Show an alert dialog\n */\n alert(title: string, message: string, okText: string = 'OK'): Promise<void> {\n return new Promise((resolve) => {\n const dialogRef = this.mjDialogService.open({\n title: title,\n content: message,\n actions: [\n {\n text: okText,\n primary: true\n }\n ],\n width: 450,\n minWidth: 250\n });\n\n dialogRef.Result.subscribe(() => {\n resolve();\n });\n });\n }\n\n /**\n * Show an input dialog\n * @returns Promise<string | {value: string; secondValue?: string} | null> -\n * If single input: returns string\n * If dual input: returns object with both values\n * Returns null if cancelled\n */\n input(options: InputDialogOptions): Promise<string | {value: string; secondValue?: string} | null> {\n return new Promise((resolve) => {\n const dialogRef = this.mjDialogService.open({\n title: options.title,\n content: InputDialogComponent,\n actions: [\n {\n text: options.okText || 'OK',\n primary: true\n },\n {\n text: options.cancelText || 'Cancel',\n primary: false\n }\n ],\n width: 500,\n minWidth: 300\n });\n\n // Pass data to the component\n const componentInstance = dialogRef.Content!.instance as unknown as InputDialogComponent;\n componentInstance.message = options.message;\n componentInstance.inputLabel = options.inputLabel;\n componentInstance.inputType = options.inputType || 'text';\n componentInstance.placeholder = options.placeholder || '';\n componentInstance.required = options.required || false;\n componentInstance.value = options.inputValue || '';\n componentInstance.secondInputLabel = options.secondInputLabel || '';\n componentInstance.secondInputPlaceholder = options.secondInputPlaceholder || '';\n componentInstance.secondInputRequired = options.secondInputRequired || false;\n componentInstance.secondValue = options.secondInputValue || '';\n\n // Focus and select input after dialog opens\n setTimeout(() => {\n const inputElement = document.querySelector('.mj-dialog-body input, .mj-dialog-body textarea') as HTMLInputElement | HTMLTextAreaElement;\n if (inputElement) {\n inputElement.focus();\n inputElement.select();\n }\n }, 100);\n\n dialogRef.Result.subscribe((result) => {\n const action = result as MJDialogAction | undefined;\n if (action && 'text' in action && action.text === (options.okText || 'OK')) {\n const value = componentInstance.getValue();\n if (options.required && !value) {\n resolve(null);\n } else {\n // If second input is present, return object with both values\n if (options.secondInputLabel) {\n resolve({\n value: value,\n secondValue: componentInstance.getSecondValue()\n });\n } else {\n // Single input - return string for backward compatibility\n resolve(value);\n }\n }\n } else {\n resolve(null);\n }\n });\n });\n }\n\n /**\n * Show a rating dialog (1-10 + free-form comments).\n * @returns Promise<RatingDialogResult | null> — null if cancelled or no rating selected.\n */\n rating(options: RatingDialogOptions = {}): Promise<RatingDialogResult | null> {\n return new Promise((resolve) => {\n const okText = options.okText || 'Submit';\n const cancelText = options.cancelText || 'Cancel';\n\n const dialogRef = this.mjDialogService.open({\n title: options.title || 'Rate this response',\n content: RatingDialogComponent,\n actions: [\n { text: okText, primary: true },\n { text: cancelText, primary: false }\n ],\n width: 560,\n minWidth: 320\n });\n\n const componentInstance = dialogRef.Content!.instance as unknown as RatingDialogComponent;\n componentInstance.message = options.message ?? '';\n componentInstance.initialRating = options.initialRating ?? null;\n componentInstance.initialComments = options.initialComments ?? '';\n componentInstance.requireConsent = options.requireConsent ?? false;\n\n dialogRef.Result.subscribe((result) => {\n const action = result as MJDialogAction | undefined;\n if (action && 'text' in action && action.text === okText) {\n const rating = componentInstance.getRating();\n if (rating == null || !componentInstance.isConsentValid()) {\n resolve(null);\n } else {\n resolve({\n rating,\n comments: componentInstance.getComments(),\n consentNewlyAcknowledged: componentInstance.wasConsentNewlyAcknowledged()\n });\n }\n } else {\n resolve(null);\n }\n });\n });\n }\n\n /**\n * Show a custom dialog with custom content and actions\n */\n custom(title: string, content: string, buttons: DialogButton[], width: number = 500): MJDialogRef {\n const actions = buttons.map(btn => ({\n text: btn.text,\n primary: btn.primary || false\n }));\n\n const dialogRef = this.mjDialogService.open({\n title: title,\n content: content,\n actions: actions,\n width: width,\n minWidth: 300\n });\n\n dialogRef.Result.subscribe((result) => {\n const action = result as MJDialogAction | undefined;\n if (action && 'text' in action) {\n const button = buttons.find(b => b.text === action.text);\n if (button && button.action) {\n button.action();\n }\n }\n });\n\n return dialogRef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,OAAO,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;uGA1OU,aAAa;gEAAb,aAAa,WAAb,aAAa,mBAFZ,MAAM;;iFAEP,aAAa;cAHzB,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB","sourcesContent":["import { Injectable } from '@angular/core';\nimport { MJDialogService, MJDialogRef, MJDialogAction } from '@memberjunction/ng-ui-components';\nimport { Observable } from 'rxjs';\nimport { InputDialogComponent } from '../components/dialogs/input-dialog.component';\nimport { RatingDialogComponent } from '../components/dialogs/rating-dialog.component';\n\nexport interface DialogButton {\n text: string;\n primary?: boolean;\n action: () => void;\n}\n\nexport interface InputDialogOptions {\n title: string;\n message: string;\n inputLabel: string;\n inputValue?: string;\n inputType?: 'text' | 'textarea' | 'number' | 'email';\n placeholder?: string;\n required?: boolean;\n secondInputLabel?: string;\n secondInputValue?: string;\n secondInputPlaceholder?: string;\n secondInputRequired?: boolean;\n okText?: string;\n cancelText?: string;\n}\n\nexport interface ConfirmDialogOptions {\n title: string;\n message: string;\n okText?: string;\n cancelText?: string;\n dangerous?: boolean;\n}\n\nexport interface RatingDialogOptions {\n title?: string;\n message?: string;\n initialRating?: number | null;\n initialComments?: string;\n okText?: string;\n cancelText?: string;\n /** When true, the rating dialog shows a consent checkbox the user must\n * accept before submitting (first-time-only authorization). */\n requireConsent?: boolean;\n}\n\nexport interface RatingDialogResult {\n rating: number;\n comments: string;\n /** True only when the user *just* acknowledged consent in this dialog —\n * i.e. `requireConsent` was true and they checked the box. The caller\n * should persist the acknowledgement so consent isn't requested again. */\n consentNewlyAcknowledged: boolean;\n}\n\n/**\n * Dialog service for displaying MJ dialogs.\n * Replaces browser alert() and confirm() with proper UI components.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class DialogService {\n constructor(private mjDialogService: MJDialogService) {}\n\n /**\n * Show a confirmation dialog\n * @returns Promise<boolean> - true if user clicked OK, false if cancelled\n */\n Confirm(options: ConfirmDialogOptions): Promise<boolean> {\n return new Promise((resolve) => {\n const dialogRef = this.mjDialogService.open({\n title: options.title,\n content: options.message,\n actions: [\n {\n text: options.okText || 'OK',\n primary: true,\n themeColor: options.dangerous ? 'error' : 'primary'\n },\n {\n text: options.cancelText || 'Cancel',\n primary: false\n }\n ],\n width: 450,\n minWidth: 250\n });\n\n dialogRef.Result.subscribe((result) => {\n const action = result as MJDialogAction | undefined;\n if (action && 'text' in action) {\n resolve(action.text === (options.okText || 'OK'));\n } else {\n resolve(false);\n }\n });\n });\n }\n\n /** @deprecated Use {@link Confirm}. */\n confirm(options: ConfirmDialogOptions): Promise<boolean> {\n return this.Confirm(options);\n }\n\n /**\n * Show an alert dialog\n */\n Alert(title: string, message: string, okText: string = 'OK'): Promise<void> {\n return new Promise((resolve) => {\n const dialogRef = this.mjDialogService.open({\n title: title,\n content: message,\n actions: [\n {\n text: okText,\n primary: true\n }\n ],\n width: 450,\n minWidth: 250\n });\n\n dialogRef.Result.subscribe(() => {\n resolve();\n });\n });\n }\n\n /** @deprecated Use {@link Alert}. */\n alert(title: string, message: string, okText: string = 'OK'): Promise<void> {\n return this.Alert(title, message, okText);\n }\n\n /**\n * Show an input dialog\n * @returns Promise<string | {value: string; secondValue?: string} | null> -\n * If single input: returns string\n * If dual input: returns object with both values\n * Returns null if cancelled\n */\n Input(options: InputDialogOptions): Promise<string | {value: string; secondValue?: string} | null> {\n return new Promise((resolve) => {\n const dialogRef = this.mjDialogService.open({\n title: options.title,\n content: InputDialogComponent,\n actions: [\n {\n text: options.okText || 'OK',\n primary: true\n },\n {\n text: options.cancelText || 'Cancel',\n primary: false\n }\n ],\n width: 500,\n minWidth: 300\n });\n\n // Pass data to the component\n const componentInstance = dialogRef.Content!.instance as unknown as InputDialogComponent;\n componentInstance.message = options.message;\n componentInstance.inputLabel = options.inputLabel;\n componentInstance.inputType = options.inputType || 'text';\n componentInstance.placeholder = options.placeholder || '';\n componentInstance.required = options.required || false;\n componentInstance.value = options.inputValue || '';\n componentInstance.secondInputLabel = options.secondInputLabel || '';\n componentInstance.secondInputPlaceholder = options.secondInputPlaceholder || '';\n componentInstance.secondInputRequired = options.secondInputRequired || false;\n componentInstance.secondValue = options.secondInputValue || '';\n\n // Focus and select input after dialog opens\n setTimeout(() => {\n const inputElement = document.querySelector('.mj-dialog-body input, .mj-dialog-body textarea') as HTMLInputElement | HTMLTextAreaElement;\n if (inputElement) {\n inputElement.focus();\n inputElement.select();\n }\n }, 100);\n\n dialogRef.Result.subscribe((result) => {\n const action = result as MJDialogAction | undefined;\n if (action && 'text' in action && action.text === (options.okText || 'OK')) {\n const value = componentInstance.getValue();\n if (options.required && !value) {\n resolve(null);\n } else {\n // If second input is present, return object with both values\n if (options.secondInputLabel) {\n resolve({\n value: value,\n secondValue: componentInstance.getSecondValue()\n });\n } else {\n // Single input - return string for backward compatibility\n resolve(value);\n }\n }\n } else {\n resolve(null);\n }\n });\n });\n }\n\n /** @deprecated Use {@link Input}. */\n input(options: InputDialogOptions): Promise<string | {value: string; secondValue?: string} | null> {\n return this.Input(options);\n }\n\n /**\n * Show a rating dialog (1-10 + free-form comments).\n * @returns Promise<RatingDialogResult | null> — null if cancelled or no rating selected.\n */\n Rating(options: RatingDialogOptions = {}): Promise<RatingDialogResult | null> {\n return new Promise((resolve) => {\n const okText = options.okText || 'Submit';\n const cancelText = options.cancelText || 'Cancel';\n\n const dialogRef = this.mjDialogService.open({\n title: options.title || 'Rate this response',\n content: RatingDialogComponent,\n actions: [\n { text: okText, primary: true },\n { text: cancelText, primary: false }\n ],\n width: 560,\n minWidth: 320\n });\n\n const componentInstance = dialogRef.Content!.instance as unknown as RatingDialogComponent;\n componentInstance.message = options.message ?? '';\n componentInstance.initialRating = options.initialRating ?? null;\n componentInstance.initialComments = options.initialComments ?? '';\n componentInstance.requireConsent = options.requireConsent ?? false;\n\n dialogRef.Result.subscribe((result) => {\n const action = result as MJDialogAction | undefined;\n if (action && 'text' in action && action.text === okText) {\n const rating = componentInstance.getRating();\n if (rating == null || !componentInstance.isConsentValid()) {\n resolve(null);\n } else {\n resolve({\n rating,\n comments: componentInstance.getComments(),\n consentNewlyAcknowledged: componentInstance.wasConsentNewlyAcknowledged()\n });\n }\n } else {\n resolve(null);\n }\n });\n });\n }\n\n /** @deprecated Use {@link Rating}. */\n rating(options: RatingDialogOptions = {}): Promise<RatingDialogResult | null> {\n return this.Rating(options);\n }\n\n /**\n * Show a custom dialog with custom content and actions\n */\n Custom(title: string, content: string, buttons: DialogButton[], width: number = 500): MJDialogRef {\n const actions = buttons.map(btn => ({\n text: btn.text,\n primary: btn.primary || false\n }));\n\n const dialogRef = this.mjDialogService.open({\n title: title,\n content: content,\n actions: actions,\n width: width,\n minWidth: 300\n });\n\n dialogRef.Result.subscribe((result) => {\n const action = result as MJDialogAction | undefined;\n if (action && 'text' in action) {\n const button = buttons.find(b => b.text === action.text);\n if (button && button.action) {\n button.action();\n }\n }\n });\n\n return dialogRef;\n }\n\n /** @deprecated Use {@link Custom}. */\n custom(title: string, content: string, buttons: DialogButton[], width: number = 500): MJDialogRef {\n return this.Custom(title, content, buttons, width);\n }\n}\n"]}
|
|
@@ -95,6 +95,8 @@ export declare class ExportService {
|
|
|
95
95
|
*/
|
|
96
96
|
set Provider(value: IMetadataProvider | null);
|
|
97
97
|
get Provider(): IMetadataProvider;
|
|
98
|
+
ExportConversation(conversationId: string, format: ExportFormat, currentUser: UserInfo, options?: ExportOptions): Promise<void>;
|
|
99
|
+
/** @deprecated Use {@link ExportConversation}. */
|
|
98
100
|
exportConversation(conversationId: string, format: ExportFormat, currentUser: UserInfo, options?: ExportOptions): Promise<void>;
|
|
99
101
|
/**
|
|
100
102
|
* Build the export document for already-loaded conversation data — the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/export.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAW,QAAQ,EAAY,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11 +29,15 @@ export class ExportService {
|
|
|
29
29
|
get Provider() {
|
|
30
30
|
return this._provider ?? Metadata.Provider;
|
|
31
31
|
}
|
|
32
|
-
async
|
|
32
|
+
async ExportConversation(conversationId, format, currentUser, options = {}) {
|
|
33
33
|
const conversation = await this.loadConversationData(conversationId, currentUser);
|
|
34
34
|
const { content, filename, mimeType } = await this.BuildExportContent(conversation, format, options);
|
|
35
35
|
this.downloadFile(content, filename, mimeType);
|
|
36
36
|
}
|
|
37
|
+
/** @deprecated Use {@link ExportConversation}. */
|
|
38
|
+
async exportConversation(conversationId, format, currentUser, options = {}) {
|
|
39
|
+
return this.ExportConversation(conversationId, format, currentUser, options);
|
|
40
|
+
}
|
|
37
41
|
/**
|
|
38
42
|
* Build the export document for already-loaded conversation data — the
|
|
39
43
|
* download-free seam of {@link exportConversation}. Async because HTML-format
|