@memberjunction/ng-explorer-core 0.9.79 → 0.9.116

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.
Files changed (105) hide show
  1. package/dist/lib/ask-skip/ask-skip.component.d.ts +87 -86
  2. package/dist/lib/ask-skip/ask-skip.component.js +615 -580
  3. package/dist/lib/ask-skip/skip-dynamic-report-wrapper.d.ts +12 -12
  4. package/dist/lib/ask-skip/skip-dynamic-report-wrapper.js +40 -39
  5. package/dist/lib/auth-button/auth-button.component.d.ts +12 -12
  6. package/dist/lib/auth-button/auth-button.component.js +44 -43
  7. package/dist/lib/dashboard-browser-component/dashboard-browser.component.d.ts +18 -18
  8. package/dist/lib/dashboard-browser-component/dashboard-browser.component.js +118 -117
  9. package/dist/lib/data-browser-component/data-browser.component.d.ts +16 -14
  10. package/dist/lib/data-browser-component/data-browser.component.js +96 -91
  11. package/dist/lib/favorites/favorites.component.d.ts +14 -14
  12. package/dist/lib/favorites/favorites.component.js +114 -114
  13. package/dist/lib/generic/base-form-component.d.ts +76 -76
  14. package/dist/lib/generic/base-form-component.js +436 -436
  15. package/dist/lib/generic/base-form-section-component.d.ts +6 -6
  16. package/dist/lib/generic/base-form-section-component.js +9 -9
  17. package/dist/lib/generic/base-record-component.d.ts +6 -6
  18. package/dist/lib/generic/base-record-component.js +15 -15
  19. package/dist/lib/generic/base-resource-component.d.ts +34 -34
  20. package/dist/lib/generic/base-resource-component.js +75 -75
  21. package/dist/lib/generic/dynamic-chart.d.ts +33 -33
  22. package/dist/lib/generic/dynamic-chart.js +236 -235
  23. package/dist/lib/generic/dynamic-grid.d.ts +25 -25
  24. package/dist/lib/generic/dynamic-grid.js +120 -119
  25. package/dist/lib/generic/dynamic-report.d.ts +38 -38
  26. package/dist/lib/generic/dynamic-report.js +353 -347
  27. package/dist/lib/generic/form-toolbar.d.ts +7 -7
  28. package/dist/lib/generic/form-toolbar.js +85 -89
  29. package/dist/lib/generic/resource-container-component.d.ts +25 -25
  30. package/dist/lib/generic/resource-container-component.js +104 -103
  31. package/dist/lib/generic/section-loader-component.d.ts +17 -17
  32. package/dist/lib/generic/section-loader-component.js +66 -65
  33. package/dist/lib/generic-browse-list/generic-browse-list.component.d.ts +26 -24
  34. package/dist/lib/generic-browse-list/generic-browse-list.component.js +145 -143
  35. package/dist/lib/guards/auth-guard.service.d.ts +11 -11
  36. package/dist/lib/guards/auth-guard.service.js +24 -24
  37. package/dist/lib/guards/entities.guard.d.ts +3 -3
  38. package/dist/lib/guards/entities.guard.js +38 -38
  39. package/dist/lib/header/MSFT_UserImageService.d.ts +11 -11
  40. package/dist/lib/header/MSFT_UserImageService.js +23 -23
  41. package/dist/lib/header/header.component.d.ts +51 -51
  42. package/dist/lib/header/header.component.js +220 -208
  43. package/dist/lib/home-component/home.component.d.ts +11 -9
  44. package/dist/lib/home-component/home.component.js +77 -54
  45. package/dist/lib/join-grid/join-grid.component.d.ts +30 -30
  46. package/dist/lib/join-grid/join-grid.component.js +222 -225
  47. package/dist/lib/navigation/navigation.component.d.ts +104 -103
  48. package/dist/lib/navigation/navigation.component.js +1026 -1004
  49. package/dist/lib/query-browser-component/query-browser.component.d.ts +14 -0
  50. package/dist/lib/query-browser-component/query-browser.component.js +56 -0
  51. package/dist/lib/report-browser-component/report-browser.component.d.ts +14 -14
  52. package/dist/lib/report-browser-component/report-browser.component.js +56 -55
  53. package/dist/lib/resource-wrappers/dashboard-resource.component.d.ts +8 -8
  54. package/dist/lib/resource-wrappers/dashboard-resource.component.js +51 -50
  55. package/dist/lib/resource-wrappers/query-resource.component.d.ts +10 -0
  56. package/dist/lib/resource-wrappers/query-resource.component.js +55 -0
  57. package/dist/lib/resource-wrappers/record-resource.component.d.ts +10 -10
  58. package/dist/lib/resource-wrappers/record-resource.component.js +71 -70
  59. package/dist/lib/resource-wrappers/report-resource.component.d.ts +10 -10
  60. package/dist/lib/resource-wrappers/report-resource.component.js +55 -54
  61. package/dist/lib/resource-wrappers/resource-wrappers-loader.d.ts +1 -1
  62. package/dist/lib/resource-wrappers/resource-wrappers-loader.js +14 -12
  63. package/dist/lib/resource-wrappers/search-results-resource.component.d.ts +10 -10
  64. package/dist/lib/resource-wrappers/search-results-resource.component.js +52 -51
  65. package/dist/lib/resource-wrappers/view-resource.component.d.ts +8 -8
  66. package/dist/lib/resource-wrappers/view-resource.component.js +61 -60
  67. package/dist/lib/settings/settings.component.d.ts +5 -5
  68. package/dist/lib/settings/settings.component.js +15 -14
  69. package/dist/lib/single-application/single-application.component.d.ts +20 -20
  70. package/dist/lib/single-application/single-application.component.js +113 -113
  71. package/dist/lib/single-dashboard/Components/add-item/add-item.component.d.ts +28 -28
  72. package/dist/lib/single-dashboard/Components/add-item/add-item.component.js +210 -212
  73. package/dist/lib/single-dashboard/Components/delete-item/delete-item.component.d.ts +13 -13
  74. package/dist/lib/single-dashboard/Components/delete-item/delete-item.component.js +60 -59
  75. package/dist/lib/single-dashboard/Components/edit-dashboard/edit-dashboard.component.d.ts +26 -26
  76. package/dist/lib/single-dashboard/Components/edit-dashboard/edit-dashboard.component.js +170 -169
  77. package/dist/lib/single-dashboard/single-dashboard.component.d.ts +75 -75
  78. package/dist/lib/single-dashboard/single-dashboard.component.js +464 -456
  79. package/dist/lib/single-entity/single-entity.component.d.ts +33 -33
  80. package/dist/lib/single-entity/single-entity.component.js +258 -252
  81. package/dist/lib/single-query/single-query.component.d.ts +16 -0
  82. package/dist/lib/single-query/single-query.component.js +70 -0
  83. package/dist/lib/single-record/single-record.component.d.ts +21 -21
  84. package/dist/lib/single-record/single-record.component.js +95 -95
  85. package/dist/lib/single-report/single-report.component.d.ts +21 -22
  86. package/dist/lib/single-report/single-report.component.js +89 -87
  87. package/dist/lib/single-search-result/single-search-result.component.d.ts +15 -15
  88. package/dist/lib/single-search-result/single-search-result.component.js +61 -60
  89. package/dist/lib/single-view/single-view.component.d.ts +38 -38
  90. package/dist/lib/single-view/single-view.component.js +201 -201
  91. package/dist/lib/user-notifications/user-notifications.component.d.ts +32 -32
  92. package/dist/lib/user-notifications/user-notifications.component.js +282 -282
  93. package/dist/lib/user-profile/user-profile.component.d.ts +10 -10
  94. package/dist/lib/user-profile/user-profile.component.js +42 -41
  95. package/dist/lib/user-view-properties/view-properties-dialog.component.d.ts +71 -71
  96. package/dist/lib/user-view-properties/view-properties-dialog.component.js +594 -581
  97. package/dist/module.d.ts +65 -65
  98. package/dist/module.js +328 -338
  99. package/dist/public-api.d.ts +42 -47
  100. package/dist/public-api.js +45 -50
  101. package/dist/shared/shared.service.d.ts +94 -92
  102. package/dist/shared/shared.service.js +324 -318
  103. package/dist/shared/urlPipe.d.ts +7 -7
  104. package/dist/shared/urlPipe.js +16 -16
  105. package/package.json +24 -15
@@ -1,488 +1,501 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { Component, ViewChild } from '@angular/core';
11
- import { Metadata, RunView } from '@memberjunction/core';
12
- import { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';
13
- import { Container } from '@memberjunction/ng-container-directives';
14
- import { SkipDynamicReportComponent } from './skip-dynamic-report-wrapper';
15
- import * as i0 from "@angular/core";
16
- import * as i1 from "../../shared/shared.service";
17
- import * as i2 from "@angular/router";
18
- import * as i3 from "@angular/common";
19
- import * as i4 from "@angular/forms";
20
- import * as i5 from "@progress/kendo-angular-buttons";
21
- import * as i6 from "@progress/kendo-angular-indicators";
22
- import * as i7 from "@progress/kendo-angular-icons";
23
- import * as i8 from "@memberjunction/ng-container-directives";
24
- import * as i9 from "@progress/kendo-angular-listview";
25
- const _c0 = ["AskSkipPanel"];
26
- const _c1 = ["conversationList"];
27
- const _c2 = ["AskSkipInput"];
28
- function AskSkipComponent_ng_template_6_kendo_icon_1_Template(rf, ctx) { if (rf & 1) {
29
- i0.ɵɵelement(0, "kendo-icon", 22);
30
- } }
31
- function AskSkipComponent_ng_template_6_kendo_icon_2_Template(rf, ctx) { if (rf & 1) {
32
- i0.ɵɵelement(0, "kendo-icon", 23);
33
- } }
34
- function AskSkipComponent_ng_template_6_span_4_Template(rf, ctx) { if (rf & 1) {
35
- i0.ɵɵelementStart(0, "span");
36
- i0.ɵɵtext(1);
37
- i0.ɵɵelementEnd();
38
- } if (rf & 2) {
39
- const dataItem_r6 = i0.ɵɵnextContext().dataItem;
40
- i0.ɵɵadvance(1);
41
- i0.ɵɵtextInterpolate(dataItem_r6.Name);
42
- } }
43
- function AskSkipComponent_ng_template_6_textarea_5_Template(rf, ctx) { if (rf & 1) {
44
- const _r15 = i0.ɵɵgetCurrentView();
45
- i0.ɵɵelementStart(0, "textarea", 24);
46
- i0.ɵɵlistener("ngModelChange", function AskSkipComponent_ng_template_6_textarea_5_Template_textarea_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r15); const dataItem_r6 = i0.ɵɵnextContext().dataItem; return i0.ɵɵresetView(dataItem_r6.Name = $event); });
47
- i0.ɵɵelementEnd();
48
- } if (rf & 2) {
49
- const dataItem_r6 = i0.ɵɵnextContext().dataItem;
50
- i0.ɵɵproperty("ngModel", dataItem_r6.Name);
51
- } }
52
- function AskSkipComponent_ng_template_6_div_6_kendo_icon_1_Template(rf, ctx) { if (rf & 1) {
53
- const _r23 = i0.ɵɵgetCurrentView();
54
- i0.ɵɵelementStart(0, "kendo-icon", 30);
55
- i0.ɵɵlistener("click", function AskSkipComponent_ng_template_6_div_6_kendo_icon_1_Template_kendo_icon_click_0_listener() { i0.ɵɵrestoreView(_r23); const dataItem_r6 = i0.ɵɵnextContext(2).dataItem; const ctx_r21 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r21.editConvo(dataItem_r6)); });
56
- i0.ɵɵelementEnd();
57
- } }
58
- function AskSkipComponent_ng_template_6_div_6_kendo_icon_2_Template(rf, ctx) { if (rf & 1) {
59
- const _r26 = i0.ɵɵgetCurrentView();
60
- i0.ɵɵelementStart(0, "kendo-icon", 31);
61
- i0.ɵɵlistener("click", function AskSkipComponent_ng_template_6_div_6_kendo_icon_2_Template_kendo_icon_click_0_listener() { i0.ɵɵrestoreView(_r26); const dataItem_r6 = i0.ɵɵnextContext(2).dataItem; const ctx_r24 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r24.deleteConvo(dataItem_r6)); });
62
- i0.ɵɵelementEnd();
63
- } }
64
- function AskSkipComponent_ng_template_6_div_6_kendo_icon_3_Template(rf, ctx) { if (rf & 1) {
65
- const _r29 = i0.ɵɵgetCurrentView();
66
- i0.ɵɵelementStart(0, "kendo-icon", 32);
67
- i0.ɵɵlistener("click", function AskSkipComponent_ng_template_6_div_6_kendo_icon_3_Template_kendo_icon_click_0_listener() { i0.ɵɵrestoreView(_r29); const dataItem_r6 = i0.ɵɵnextContext(2).dataItem; const ctx_r27 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r27.saveConvoName(dataItem_r6)); });
68
- i0.ɵɵelementEnd();
69
- } }
70
- function AskSkipComponent_ng_template_6_div_6_kendo_icon_4_Template(rf, ctx) { if (rf & 1) {
71
- const _r32 = i0.ɵɵgetCurrentView();
72
- i0.ɵɵelementStart(0, "kendo-icon", 33);
73
- i0.ɵɵlistener("click", function AskSkipComponent_ng_template_6_div_6_kendo_icon_4_Template_kendo_icon_click_0_listener() { i0.ɵɵrestoreView(_r32); const dataItem_r6 = i0.ɵɵnextContext(2).dataItem; const ctx_r30 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r30.cancelConvoEdit(dataItem_r6)); });
74
- i0.ɵɵelementEnd();
75
- } }
76
- function AskSkipComponent_ng_template_6_div_6_Template(rf, ctx) { if (rf & 1) {
77
- i0.ɵɵelementStart(0, "div", 25);
78
- i0.ɵɵtemplate(1, AskSkipComponent_ng_template_6_div_6_kendo_icon_1_Template, 1, 0, "kendo-icon", 26);
79
- i0.ɵɵtemplate(2, AskSkipComponent_ng_template_6_div_6_kendo_icon_2_Template, 1, 0, "kendo-icon", 27);
80
- i0.ɵɵtemplate(3, AskSkipComponent_ng_template_6_div_6_kendo_icon_3_Template, 1, 0, "kendo-icon", 28);
81
- i0.ɵɵtemplate(4, AskSkipComponent_ng_template_6_div_6_kendo_icon_4_Template, 1, 0, "kendo-icon", 29);
82
- i0.ɵɵelementEnd();
83
- } if (rf & 2) {
84
- const ctx_r11 = i0.ɵɵnextContext(2);
85
- i0.ɵɵadvance(1);
86
- i0.ɵɵproperty("ngIf", !ctx_r11.ConversationEditMode);
87
- i0.ɵɵadvance(1);
88
- i0.ɵɵproperty("ngIf", !ctx_r11.ConversationEditMode);
89
- i0.ɵɵadvance(1);
90
- i0.ɵɵproperty("ngIf", ctx_r11.ConversationEditMode);
91
- i0.ɵɵadvance(1);
92
- i0.ɵɵproperty("ngIf", ctx_r11.ConversationEditMode);
93
- } }
94
- function AskSkipComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
95
- const _r34 = i0.ɵɵgetCurrentView();
96
- i0.ɵɵelementStart(0, "div", 16);
97
- i0.ɵɵlistener("click", function AskSkipComponent_ng_template_6_Template_div_click_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r34); const dataItem_r6 = restoredCtx.dataItem; const ctx_r33 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r33.selectConversation(dataItem_r6)); });
98
- i0.ɵɵtemplate(1, AskSkipComponent_ng_template_6_kendo_icon_1_Template, 1, 0, "kendo-icon", 17);
99
- i0.ɵɵtemplate(2, AskSkipComponent_ng_template_6_kendo_icon_2_Template, 1, 0, "kendo-icon", 18);
100
- i0.ɵɵelementStart(3, "div", 19);
101
- i0.ɵɵtemplate(4, AskSkipComponent_ng_template_6_span_4_Template, 2, 1, "span", 11);
102
- i0.ɵɵtemplate(5, AskSkipComponent_ng_template_6_textarea_5_Template, 1, 1, "textarea", 20);
103
- i0.ɵɵelementEnd();
104
- i0.ɵɵtemplate(6, AskSkipComponent_ng_template_6_div_6_Template, 5, 4, "div", 21);
105
- i0.ɵɵelementEnd();
106
- } if (rf & 2) {
107
- const dataItem_r6 = ctx.dataItem;
108
- const ctx_r1 = i0.ɵɵnextContext();
109
- i0.ɵɵproperty("ngClass", (ctx_r1.SelectedConversation == null ? null : ctx_r1.SelectedConversation.ID) === dataItem_r6.ID ? "conversation-item-selected" : "")("title", dataItem_r6.Name);
110
- i0.ɵɵadvance(1);
111
- i0.ɵɵproperty("ngIf", !ctx_r1.IsSkipProcessing(dataItem_r6));
112
- i0.ɵɵadvance(1);
113
- i0.ɵɵproperty("ngIf", ctx_r1.SelectedConversation && ctx_r1.IsSkipProcessing(dataItem_r6));
114
- i0.ɵɵadvance(2);
115
- i0.ɵɵproperty("ngIf", dataItem_r6.ID !== (ctx_r1.SelectedConversation == null ? null : ctx_r1.SelectedConversation.ID) || !ctx_r1.ConversationEditMode);
116
- i0.ɵɵadvance(1);
117
- i0.ɵɵproperty("ngIf", dataItem_r6.ID === (ctx_r1.SelectedConversation == null ? null : ctx_r1.SelectedConversation.ID) && ctx_r1.ConversationEditMode);
118
- i0.ɵɵadvance(1);
119
- i0.ɵɵproperty("ngIf", (ctx_r1.SelectedConversation == null ? null : ctx_r1.SelectedConversation.ID) === dataItem_r6.ID);
120
- } }
121
- function AskSkipComponent_div_12_Template(rf, ctx) { if (rf & 1) {
122
- i0.ɵɵelementStart(0, "div")(1, "div", 34)(2, "div", 35);
123
- i0.ɵɵelement(3, "img", 36);
124
- i0.ɵɵelementEnd();
125
- i0.ɵɵelementStart(4, "div", 37)(5, "div");
126
- i0.ɵɵtext(6);
127
- i0.ɵɵelementEnd()()()();
128
- } if (rf & 2) {
129
- const message_r35 = ctx.$implicit;
130
- const ctx_r3 = i0.ɵɵnextContext();
131
- i0.ɵɵadvance(1);
132
- i0.ɵɵproperty("ngClass", message_r35.Role.trim().toLowerCase() === "ai" ? "ai-message" : message_r35.Role.trim().toLowerCase() === "error" ? "error-message" : "user-message");
133
- i0.ɵɵadvance(2);
134
- i0.ɵɵpropertyInterpolate("src", message_r35.Role.trim().toLowerCase() === "ai" || message_r35.Role.trim().toLowerCase() === "error" ? "assets/Skip - Mark Only - Small.png" : ctx_r3.userImage(), i0.ɵɵsanitizeUrl);
135
- i0.ɵɵadvance(1);
136
- i0.ɵɵproperty("id", "skip_message_" + message_r35.ID);
137
- i0.ɵɵadvance(2);
138
- i0.ɵɵtextInterpolate(ctx_r3.createDetailHtml(message_r35));
139
- } }
140
- function AskSkipComponent_div_13_Template(rf, ctx) { if (rf & 1) {
141
- i0.ɵɵelementStart(0, "div");
142
- i0.ɵɵelement(1, "kendo-loader");
143
- i0.ɵɵelementEnd();
144
- } }
145
- const _c3 = function () { return { "item-border": true }; };
146
- class SkipMessage {
147
- constructor() {
148
- this.Type = 'user';
149
- this.Message = '';
150
- this.ID = 0;
151
- }
152
- }
153
- export class SkipColumnInfo {
154
- }
155
- export class SkipSQLResults {
156
- }
157
- export class SkipChartOptions {
158
- }
159
- export class SkipData {
160
- }
161
- export class AskSkipComponent {
162
- constructor(sharedService, renderer, injector, router, route, location) {
163
- this.sharedService = sharedService;
164
- this.renderer = renderer;
165
- this.injector = injector;
166
- this.router = router;
167
- this.route = route;
168
- this.location = location;
169
- this.AllowSend = true;
170
- this.Messages = [];
171
- this.Conversations = [];
172
- this.ConversationEditMode = false;
173
- this._loaded = false;
174
- this._scrollToBottom = false;
175
- this._oldConvoName = '';
176
- this._detailHtml = {};
177
- this._processingStatus = {};
178
- }
179
- ngOnInit() {
180
- }
181
- ngOnDestroy() {
182
- // Unsubscribe to prevent memory leaks
183
- if (this.paramsSubscription) {
184
- this.paramsSubscription.unsubscribe();
185
- }
186
- }
187
- ngAfterViewInit() {
188
- this.paramsSubscription = this.route.params.subscribe(params => {
189
- if (!this._loaded) {
190
- this._loaded = true; // do this once
191
- const conversationId = params['conversationId'];
192
- if (conversationId && !isNaN(conversationId)) {
193
- this.loadConversations(parseInt(conversationId, 10)); // Load the conversation based on the conversationId
194
- }
195
- else {
196
- this.loadConversations();
197
- }
198
- }
199
- });
200
- }
201
- ngAfterViewChecked() {
202
- if (this._scrollToBottom) {
203
- this.scrollToBottom();
204
- }
205
- this._scrollToBottom = false;
206
- }
207
- loadConversations(conversationIdToLoad = undefined) {
208
- return __awaiter(this, void 0, void 0, function* () {
209
- const md = new Metadata();
210
- const rv = new RunView();
211
- const result = yield rv.RunView({
212
- EntityName: 'Conversations',
213
- ExtraFilter: 'UserID=' + md.CurrentUser.ID,
214
- OrderBy: 'CreatedAt DESC' // get in reverse order
215
- });
216
- if (result && result.Success) {
217
- this.Conversations = result.Results;
218
- }
219
- if (this.Conversations.length === 0) {
220
- // no conversations, so create a new one
221
- this.createNewConversation();
222
- this.sharedService.InvokeManualResize();
223
- }
224
- else if (conversationIdToLoad) {
225
- // we have > 0 convos and we were asked to load a specific one
226
- const convo = this.Conversations.find(c => c.ID == conversationIdToLoad);
227
- if (convo) {
228
- this.selectConversation(convo);
229
- }
230
- else {
231
- // we didn't find the conversation so just select the first one
232
- this.selectConversation(this.Conversations[0]);
233
- }
234
- }
235
- else {
236
- // select the first conversation since no param was provided and we have > 0 convos
237
- this.selectConversation(this.Conversations[0]);
238
- }
239
- });
240
- }
241
- editConvo(conversation) {
242
- this._oldConvoName = conversation.Name;
243
- this.ConversationEditMode = true;
244
- }
245
- cancelConvoEdit(conversation) {
246
- conversation.Name = this._oldConvoName;
247
- this.ConversationEditMode = false;
248
- }
249
- saveConvoName(conversation) {
250
- return __awaiter(this, void 0, void 0, function* () {
251
- let newConvoObject;
252
- if (conversation.Save !== undefined) {
253
- newConvoObject = conversation;
254
- }
255
- else {
256
- const md = new Metadata();
257
- newConvoObject = yield md.GetEntityObject('Conversations');
258
- yield newConvoObject.Load(conversation.ID);
259
- // now replace conversation in the list with the new object
260
- this.Conversations = this.Conversations.map(c => c.ID == conversation.ID ? newConvoObject : c);
261
- }
262
- newConvoObject.Name = conversation.Name;
263
- if (yield newConvoObject.Save())
264
- this.ConversationEditMode = false;
265
- else
266
- this.sharedService.CreateSimpleNotification('Error saving conversation name', 'error', 5000);
267
- });
268
- }
269
- deleteConvo(conversation) {
270
- return __awaiter(this, void 0, void 0, function* () {
271
- if (confirm('Are you sure you want to delete this conversation?')) {
272
- // delete the conversation - we might need to load the entity if the current object isn't a "real object"
273
- if (yield this.DeleteConversation(conversation.ID)) {
274
- // get the index of the conversation
275
- const idx = this.Conversations.findIndex(c => c.ID === conversation.ID);
276
- // remove the conversation from the list
277
- this.Conversations = this.Conversations.filter(c => c.ID != conversation.ID);
278
- if (this.Conversations.length > 0) {
279
- const newIdx = idx > 0 ? idx - 1 : 0;
280
- this.selectConversation(this.Conversations[newIdx]);
281
- }
282
- else
283
- this.Messages = [];
284
- }
285
- else {
286
- this.sharedService.CreateSimpleNotification('Error deleting conversation', 'error', 5000);
287
- }
288
- }
289
- });
290
- }
291
- createNewConversation() {
292
- return __awaiter(this, void 0, void 0, function* () {
293
- const md = new Metadata();
294
- const convo = yield md.GetEntityObject('Conversations');
295
- convo.NewRecord();
296
- convo.Name = 'New Chat'; // default value
297
- convo.UserID = md.CurrentUser.ID;
298
- yield convo.Save();
299
- this.Conversations = [convo, ...this.Conversations]; // do this way instead of unshift to ensure that binding refreshes
300
- this.selectConversation(convo);
301
- this._scrollToBottom = true; // this results in the angular after Viewchecked scrolling to bottom when it's done
302
- });
303
- }
304
- onEnter(event) {
305
- this.sendSkipQuestion();
306
- }
307
- selectConversation(conversation) {
308
- var _a;
309
- return __awaiter(this, void 0, void 0, function* () {
310
- if (conversation && conversation.ID !== ((_a = this.SelectedConversation) === null || _a === void 0 ? void 0 : _a.ID)) {
311
- // load up the conversation if not already the one that's loaded
312
- this.Messages = []; // clear out the messages
313
- const oldStatus = this._processingStatus[conversation.ID];
314
- this._processingStatus[conversation.ID] = true;
315
- this.SelectedConversation = conversation;
316
- const md = new Metadata();
317
- const rv = new RunView();
318
- const result = yield rv.RunView({
319
- EntityName: 'Conversation Details',
320
- ExtraFilter: 'ConversationID=' + conversation.ID,
321
- OrderBy: 'CreatedAt ASC' // show messages in order of creation
322
- });
323
- if (result && result.Success) {
324
- this._detailHtml = {};
325
- this.Messages = result.Results;
326
- this._scrollToBottom = true; // this results in the angular after Viewchecked scrolling to bottom when it's done
327
- }
328
- this._processingStatus[conversation.ID] = oldStatus; // set back to old status as it might have been processing
329
- this.sharedService.InvokeManualResize(500);
330
- // ensure the list box has the conversation in view
331
- this.scrollToConversation(conversation.ID);
332
- // finally update the browser URL since we've changed the conversation ID
333
- this.location.go('/askskip/' + conversation.ID);
334
- // this.router.navigate(['askskip', conversation.ID]);
335
- }
336
- });
337
- }
338
- scrollToConversation(conversationId) {
339
- if (this.conversationList) {
340
- const convoElement = this.conversationList.element.nativeElement;
341
- const itemIndex = this.Conversations.findIndex(c => c.ID === conversationId);
342
- // Find the item element within the container based on its index
343
- const itemElement = Array.from(convoElement.querySelectorAll('[data-kendo-listview-item-index]'))
344
- .find((el) => parseInt(el.getAttribute('data-kendo-listview-item-index'), 10) === itemIndex);
345
- if (itemElement) {
346
- setTimeout(() => {
347
- // do this within a timeout to ensure rendering is completed
348
- itemElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
349
- }, 100);
350
- }
351
- }
352
- }
353
- sendSkipQuestion() {
354
- var _a, _b, _c;
355
- return __awaiter(this, void 0, void 0, function* () {
356
- const convoID = this.SelectedConversation ? this.SelectedConversation.ID : -1;
357
- if (this.SelectedConversation)
358
- this._processingStatus[(_a = this.SelectedConversation) === null || _a === void 0 ? void 0 : _a.ID] = true;
359
- const val = this.askSkipInput.nativeElement.value;
360
- if (val && val.length > 0) {
361
- this.AllowSend = false;
362
- const md = new Metadata();
363
- const convoDetail = yield md.GetEntityObject('Conversation Details');
364
- convoDetail.NewRecord();
365
- convoDetail.Message = val;
366
- convoDetail.Role = 'user';
367
- this.Messages.push(convoDetail); // this is NOT saved here because it is saved on the server side. Later on in this code after the save we will update the object with the ID from the server
368
- this.askSkipInput.nativeElement.value = '';
369
- this._scrollToBottom = true; // this results in the angular after Viewchecked scrolling to bottom when it's done
370
- const result = yield this.ExecuteAskSkipQuery(val, this.SelectedConversation);
371
- if (result && result.ExecuteAskSkipQuery && result.ExecuteAskSkipQuery.Success) {
372
- if (convoID !== ((_b = this.SelectedConversation) === null || _b === void 0 ? void 0 : _b.ID)) {
373
- // this scenario arises when we have a selected convo change after we submitted our request to skip
374
- // so we do nothing here other than update the status.
375
- this._processingStatus[convoID] = false;
376
- }
377
- else {
378
- const resultObject = JSON.parse(result.ExecuteAskSkipQuery.Result);
379
- if (!this.SelectedConversation) {
380
- const convo = yield md.GetEntityObject('Conversations');
381
- yield convo.Load(result.ExecuteAskSkipQuery.ConversationId);
382
- this._processingStatus[result.ExecuteAskSkipQuery.ConversationId] = true;
383
- this.Conversations.push(convo);
384
- this.SelectedConversation = convo;
385
- }
386
- else if (this.Messages.length === 1) {
387
- // we are on the first message so skip renamed the convo, use that
388
- this.SelectedConversation.Name = resultObject.ReportTitle; // this will update the UI
389
- // the below LOOKS redundant to just updating this.SelectedConversation.Name, but it is needed to ensure that the list box is updated
390
- // otherwise Angular binding doesn't pick up the change without the below.
391
- const idx = this.Conversations.findIndex(c => { var _a; return c.ID === ((_a = this.SelectedConversation) === null || _a === void 0 ? void 0 : _a.ID); });
392
- if (idx >= 0) {
393
- // update our this.Conversations array to reflect the new name. First find the index of the conversation and then get that item and update it
394
- this.Conversations[idx].Name = this.SelectedConversation.Name;
395
- }
396
- }
397
- yield convoDetail.Load(result.ExecuteAskSkipQuery.UserMessageConversationDetailId); // update the object to load from DB
398
- const aiDetail = yield md.GetEntityObject('Conversation Details');
399
- yield aiDetail.Load(result.ExecuteAskSkipQuery.AIMessageConversationDetailId); // get record from the database
400
- this.Messages.push(aiDetail);
401
- // we don't create a user notification here in the client, that is done on the server and via GraphQL subscriptions it tells us and we update the UI automatically...
402
- }
403
- }
404
- else {
405
- const errorMessage = yield md.GetEntityObject('Conversation Details');
406
- errorMessage.NewRecord();
407
- errorMessage.Role = 'error';
408
- errorMessage.Message = 'Error took place';
409
- this.Messages.push(errorMessage);
410
- this.AllowSend = true;
411
- }
412
- this._scrollToBottom = true; // this results in the angular after Viewchecked scrolling to bottom when it's done
413
- if (this.SelectedConversation)
414
- this._processingStatus[(_c = this.SelectedConversation) === null || _c === void 0 ? void 0 : _c.ID] = false;
415
- this.AllowSend = true;
416
- // invoke manual resize with a delay to ensure that the scroll to bottom has taken place
417
- this.sharedService.InvokeManualResize(500);
418
- }
419
- });
420
- }
421
- createDetailHtml(detail) {
422
- if (detail.ID !== null && detail.ID !== undefined && detail.ID > 0 && this._detailHtml[detail.ID]) {
423
- // use cached HTML details for SAVED conversation details, don't do for NEW ONes where ID is null
424
- return this._detailHtml[detail.ID];
425
- }
426
- else {
427
- let sMessage = '';
428
- if (detail.Role.trim().toLowerCase() === 'ai') {
429
- const resultObject = JSON.parse(detail.Message);
430
- const newId = this.Messages.length;
431
- if (resultObject && resultObject.SQLResults && resultObject.SQLResults.results.length > 0) {
432
- sMessage = "Here's the report I've prepared for you, please let me know if you need anything changed or another report!";
433
- }
434
- else {
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Component, ViewChild } from '@angular/core';
11
+ import { Metadata, RunQuery, RunView } from '@memberjunction/core';
12
+ import { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';
13
+ import { Container } from '@memberjunction/ng-container-directives';
14
+ import { SkipDynamicReportComponent } from './skip-dynamic-report-wrapper';
15
+ import * as i0 from "@angular/core";
16
+ import * as i1 from "../../shared/shared.service";
17
+ import * as i2 from "@angular/router";
18
+ import * as i3 from "@angular/common";
19
+ import * as i4 from "@angular/forms";
20
+ import * as i5 from "@progress/kendo-angular-buttons";
21
+ import * as i6 from "@progress/kendo-angular-indicators";
22
+ import * as i7 from "@progress/kendo-angular-icons";
23
+ import * as i8 from "@memberjunction/ng-container-directives";
24
+ import * as i9 from "@progress/kendo-angular-listview";
25
+ const _c0 = ["AskSkipPanel"];
26
+ const _c1 = ["conversationList"];
27
+ const _c2 = ["AskSkipInput"];
28
+ function AskSkipComponent_ng_template_8_kendo_svgicon_1_Template(rf, ctx) { if (rf & 1) {
29
+ i0.ɵɵelement(0, "kendo-svgicon", 22);
30
+ } if (rf & 2) {
31
+ const ctx_r7 = i0.ɵɵnextContext(2);
32
+ i0.ɵɵproperty("icon", ctx_r7.sharedService.kendoSVGIcon("comment"));
33
+ } }
34
+ function AskSkipComponent_ng_template_8_kendo_svgicon_2_Template(rf, ctx) { if (rf & 1) {
35
+ i0.ɵɵelement(0, "kendo-svgicon", 23);
36
+ } if (rf & 2) {
37
+ const ctx_r8 = i0.ɵɵnextContext(2);
38
+ i0.ɵɵproperty("icon", ctx_r8.sharedService.kendoSVGIcon("clock"));
39
+ } }
40
+ function AskSkipComponent_ng_template_8_span_4_Template(rf, ctx) { if (rf & 1) {
41
+ i0.ɵɵelementStart(0, "span");
42
+ i0.ɵɵtext(1);
43
+ i0.ɵɵelementEnd();
44
+ } if (rf & 2) {
45
+ const dataItem_r6 = i0.ɵɵnextContext().dataItem;
46
+ i0.ɵɵadvance();
47
+ i0.ɵɵtextInterpolate(dataItem_r6.Name);
48
+ } }
49
+ function AskSkipComponent_ng_template_8_textarea_5_Template(rf, ctx) { if (rf & 1) {
50
+ const _r15 = i0.ɵɵgetCurrentView();
51
+ i0.ɵɵelementStart(0, "textarea", 24);
52
+ i0.ɵɵlistener("ngModelChange", function AskSkipComponent_ng_template_8_textarea_5_Template_textarea_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r15); const dataItem_r6 = i0.ɵɵnextContext().dataItem; return i0.ɵɵresetView(dataItem_r6.Name = $event); });
53
+ i0.ɵɵelementEnd();
54
+ } if (rf & 2) {
55
+ const dataItem_r6 = i0.ɵɵnextContext().dataItem;
56
+ i0.ɵɵproperty("ngModel", dataItem_r6.Name);
57
+ } }
58
+ function AskSkipComponent_ng_template_8_div_6_kendo_svgicon_1_Template(rf, ctx) { if (rf & 1) {
59
+ const _r23 = i0.ɵɵgetCurrentView();
60
+ i0.ɵɵelementStart(0, "kendo-svgicon", 30);
61
+ i0.ɵɵlistener("click", function AskSkipComponent_ng_template_8_div_6_kendo_svgicon_1_Template_kendo_svgicon_click_0_listener() { i0.ɵɵrestoreView(_r23); const dataItem_r6 = i0.ɵɵnextContext(2).dataItem; const ctx_r21 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r21.editConvo(dataItem_r6)); });
62
+ i0.ɵɵelementEnd();
63
+ } if (rf & 2) {
64
+ const ctx_r17 = i0.ɵɵnextContext(3);
65
+ i0.ɵɵproperty("icon", ctx_r17.sharedService.kendoSVGIcon("edit"));
66
+ } }
67
+ function AskSkipComponent_ng_template_8_div_6_kendo_svgicon_2_Template(rf, ctx) { if (rf & 1) {
68
+ const _r26 = i0.ɵɵgetCurrentView();
69
+ i0.ɵɵelementStart(0, "kendo-svgicon", 31);
70
+ i0.ɵɵlistener("click", function AskSkipComponent_ng_template_8_div_6_kendo_svgicon_2_Template_kendo_svgicon_click_0_listener() { i0.ɵɵrestoreView(_r26); const dataItem_r6 = i0.ɵɵnextContext(2).dataItem; const ctx_r24 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r24.deleteConvo(dataItem_r6)); });
71
+ i0.ɵɵelementEnd();
72
+ } if (rf & 2) {
73
+ const ctx_r18 = i0.ɵɵnextContext(3);
74
+ i0.ɵɵproperty("icon", ctx_r18.sharedService.kendoSVGIcon("delete"));
75
+ } }
76
+ function AskSkipComponent_ng_template_8_div_6_kendo_svgicon_3_Template(rf, ctx) { if (rf & 1) {
77
+ const _r29 = i0.ɵɵgetCurrentView();
78
+ i0.ɵɵelementStart(0, "kendo-svgicon", 32);
79
+ i0.ɵɵlistener("click", function AskSkipComponent_ng_template_8_div_6_kendo_svgicon_3_Template_kendo_svgicon_click_0_listener() { i0.ɵɵrestoreView(_r29); const dataItem_r6 = i0.ɵɵnextContext(2).dataItem; const ctx_r27 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r27.saveConvoName(dataItem_r6)); });
80
+ i0.ɵɵelementEnd();
81
+ } if (rf & 2) {
82
+ const ctx_r19 = i0.ɵɵnextContext(3);
83
+ i0.ɵɵproperty("icon", ctx_r19.sharedService.kendoSVGIcon("check"));
84
+ } }
85
+ function AskSkipComponent_ng_template_8_div_6_kendo_svgicon_4_Template(rf, ctx) { if (rf & 1) {
86
+ const _r32 = i0.ɵɵgetCurrentView();
87
+ i0.ɵɵelementStart(0, "kendo-svgicon", 33);
88
+ i0.ɵɵlistener("click", function AskSkipComponent_ng_template_8_div_6_kendo_svgicon_4_Template_kendo_svgicon_click_0_listener() { i0.ɵɵrestoreView(_r32); const dataItem_r6 = i0.ɵɵnextContext(2).dataItem; const ctx_r30 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r30.cancelConvoEdit(dataItem_r6)); });
89
+ i0.ɵɵelementEnd();
90
+ } if (rf & 2) {
91
+ const ctx_r20 = i0.ɵɵnextContext(3);
92
+ i0.ɵɵproperty("icon", ctx_r20.sharedService.kendoSVGIcon("close"));
93
+ } }
94
+ function AskSkipComponent_ng_template_8_div_6_Template(rf, ctx) { if (rf & 1) {
95
+ i0.ɵɵelementStart(0, "div", 25);
96
+ i0.ɵɵtemplate(1, AskSkipComponent_ng_template_8_div_6_kendo_svgicon_1_Template, 1, 1, "kendo-svgicon", 26)(2, AskSkipComponent_ng_template_8_div_6_kendo_svgicon_2_Template, 1, 1, "kendo-svgicon", 27)(3, AskSkipComponent_ng_template_8_div_6_kendo_svgicon_3_Template, 1, 1, "kendo-svgicon", 28)(4, AskSkipComponent_ng_template_8_div_6_kendo_svgicon_4_Template, 1, 1, "kendo-svgicon", 29);
97
+ i0.ɵɵelementEnd();
98
+ } if (rf & 2) {
99
+ const ctx_r11 = i0.ɵɵnextContext(2);
100
+ i0.ɵɵadvance();
101
+ i0.ɵɵproperty("ngIf", !ctx_r11.ConversationEditMode);
102
+ i0.ɵɵadvance();
103
+ i0.ɵɵproperty("ngIf", !ctx_r11.ConversationEditMode);
104
+ i0.ɵɵadvance();
105
+ i0.ɵɵproperty("ngIf", ctx_r11.ConversationEditMode);
106
+ i0.ɵɵadvance();
107
+ i0.ɵɵproperty("ngIf", ctx_r11.ConversationEditMode);
108
+ } }
109
+ function AskSkipComponent_ng_template_8_Template(rf, ctx) { if (rf & 1) {
110
+ const _r34 = i0.ɵɵgetCurrentView();
111
+ i0.ɵɵelementStart(0, "div", 16);
112
+ i0.ɵɵlistener("click", function AskSkipComponent_ng_template_8_Template_div_click_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r34); const dataItem_r6 = restoredCtx.dataItem; const ctx_r33 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r33.selectConversation(dataItem_r6)); });
113
+ i0.ɵɵtemplate(1, AskSkipComponent_ng_template_8_kendo_svgicon_1_Template, 1, 1, "kendo-svgicon", 17)(2, AskSkipComponent_ng_template_8_kendo_svgicon_2_Template, 1, 1, "kendo-svgicon", 18);
114
+ i0.ɵɵelementStart(3, "div", 19);
115
+ i0.ɵɵtemplate(4, AskSkipComponent_ng_template_8_span_4_Template, 2, 1, "span", 11)(5, AskSkipComponent_ng_template_8_textarea_5_Template, 1, 1, "textarea", 20);
116
+ i0.ɵɵelementEnd();
117
+ i0.ɵɵtemplate(6, AskSkipComponent_ng_template_8_div_6_Template, 5, 4, "div", 21);
118
+ i0.ɵɵelementEnd();
119
+ } if (rf & 2) {
120
+ const dataItem_r6 = ctx.dataItem;
121
+ const ctx_r1 = i0.ɵɵnextContext();
122
+ i0.ɵɵproperty("ngClass", (ctx_r1.SelectedConversation == null ? null : ctx_r1.SelectedConversation.ID) === dataItem_r6.ID ? "conversation-item-selected" : "")("title", dataItem_r6.Name);
123
+ i0.ɵɵadvance();
124
+ i0.ɵɵproperty("ngIf", !ctx_r1.IsSkipProcessing(dataItem_r6));
125
+ i0.ɵɵadvance();
126
+ i0.ɵɵproperty("ngIf", ctx_r1.SelectedConversation && ctx_r1.IsSkipProcessing(dataItem_r6));
127
+ i0.ɵɵadvance(2);
128
+ i0.ɵɵproperty("ngIf", dataItem_r6.ID !== (ctx_r1.SelectedConversation == null ? null : ctx_r1.SelectedConversation.ID) || !ctx_r1.ConversationEditMode);
129
+ i0.ɵɵadvance();
130
+ i0.ɵɵproperty("ngIf", dataItem_r6.ID === (ctx_r1.SelectedConversation == null ? null : ctx_r1.SelectedConversation.ID) && ctx_r1.ConversationEditMode);
131
+ i0.ɵɵadvance();
132
+ i0.ɵɵproperty("ngIf", (ctx_r1.SelectedConversation == null ? null : ctx_r1.SelectedConversation.ID) === dataItem_r6.ID);
133
+ } }
134
+ function AskSkipComponent_div_14_Template(rf, ctx) { if (rf & 1) {
135
+ i0.ɵɵelementStart(0, "div")(1, "div", 34)(2, "div", 35);
136
+ i0.ɵɵelement(3, "img", 36);
137
+ i0.ɵɵelementEnd();
138
+ i0.ɵɵelementStart(4, "div", 37)(5, "div");
139
+ i0.ɵɵtext(6);
140
+ i0.ɵɵelementEnd()()()();
141
+ } if (rf & 2) {
142
+ const message_r35 = ctx.$implicit;
143
+ const ctx_r3 = i0.ɵɵnextContext();
144
+ i0.ɵɵadvance();
145
+ i0.ɵɵproperty("ngClass", message_r35.Role.trim().toLowerCase() === "ai" ? "ai-message" : message_r35.Role.trim().toLowerCase() === "error" ? "error-message" : "user-message");
146
+ i0.ɵɵadvance(2);
147
+ i0.ɵɵpropertyInterpolate("src", message_r35.Role.trim().toLowerCase() === "ai" || message_r35.Role.trim().toLowerCase() === "error" ? "assets/Skip - Mark Only - Small.png" : ctx_r3.userImage(), i0.ɵɵsanitizeUrl);
148
+ i0.ɵɵadvance();
149
+ i0.ɵɵproperty("id", "skip_message_" + message_r35.ID);
150
+ i0.ɵɵadvance(2);
151
+ i0.ɵɵtextInterpolate(ctx_r3.createDetailHtml(message_r35));
152
+ } }
153
+ function AskSkipComponent_div_15_Template(rf, ctx) { if (rf & 1) {
154
+ i0.ɵɵelementStart(0, "div");
155
+ i0.ɵɵelement(1, "kendo-loader");
156
+ i0.ɵɵelementEnd();
157
+ } }
158
+ const _c3 = () => ({ "item-border": true });
159
+ class SkipMessage {
160
+ constructor() {
161
+ this.Type = 'user';
162
+ this.Message = '';
163
+ this.ID = 0;
164
+ }
165
+ }
166
+ export class SkipColumnInfo {
167
+ }
168
+ export class SkipSQLResults {
169
+ }
170
+ export class SkipChartOptions {
171
+ }
172
+ export class SkipData {
173
+ }
174
+ export class AskSkipComponent {
175
+ constructor(sharedService, renderer, injector, router, route, location) {
176
+ this.sharedService = sharedService;
177
+ this.renderer = renderer;
178
+ this.injector = injector;
179
+ this.router = router;
180
+ this.route = route;
181
+ this.location = location;
182
+ this.AllowSend = true;
183
+ this.Messages = [];
184
+ this.Conversations = [];
185
+ this.ConversationEditMode = false;
186
+ this._loaded = false;
187
+ this._scrollToBottom = false;
188
+ this._oldConvoName = '';
189
+ this._detailHtml = {};
190
+ this._processingStatus = {};
191
+ }
192
+ ngOnInit() {
193
+ }
194
+ ngOnDestroy() {
195
+ // Unsubscribe to prevent memory leaks
196
+ if (this.paramsSubscription) {
197
+ this.paramsSubscription.unsubscribe();
198
+ }
199
+ }
200
+ ngAfterViewInit() {
201
+ this.paramsSubscription = this.route.params.subscribe(params => {
202
+ if (!this._loaded) {
203
+ this._loaded = true; // do this once
204
+ const conversationId = params['conversationId'];
205
+ if (conversationId && !isNaN(conversationId)) {
206
+ this.loadConversations(parseInt(conversationId, 10)); // Load the conversation based on the conversationId
207
+ }
208
+ else {
209
+ this.loadConversations();
210
+ }
211
+ }
212
+ });
213
+ }
214
+ ngAfterViewChecked() {
215
+ if (this._scrollToBottom) {
216
+ this.scrollToBottom();
217
+ }
218
+ this._scrollToBottom = false;
219
+ }
220
+ loadConversations(conversationIdToLoad = undefined) {
221
+ return __awaiter(this, void 0, void 0, function* () {
222
+ const md = new Metadata();
223
+ const rv = new RunView();
224
+ const result = yield rv.RunView({
225
+ EntityName: 'Conversations',
226
+ ExtraFilter: 'UserID=' + md.CurrentUser.ID,
227
+ OrderBy: 'CreatedAt DESC' // get in reverse order
228
+ });
229
+ if (result && result.Success) {
230
+ this.Conversations = result.Results;
231
+ }
232
+ if (this.Conversations.length === 0) {
233
+ // no conversations, so create a new one
234
+ this.createNewConversation();
235
+ this.sharedService.InvokeManualResize();
236
+ }
237
+ else if (conversationIdToLoad) {
238
+ // we have > 0 convos and we were asked to load a specific one
239
+ const convo = this.Conversations.find(c => c.ID == conversationIdToLoad);
240
+ if (convo) {
241
+ this.selectConversation(convo);
242
+ }
243
+ else {
244
+ // we didn't find the conversation so just select the first one
245
+ this.selectConversation(this.Conversations[0]);
246
+ }
247
+ }
248
+ else {
249
+ // select the first conversation since no param was provided and we have > 0 convos
250
+ this.selectConversation(this.Conversations[0]);
251
+ }
252
+ });
253
+ }
254
+ editConvo(conversation) {
255
+ this._oldConvoName = conversation.Name;
256
+ this.ConversationEditMode = true;
257
+ }
258
+ cancelConvoEdit(conversation) {
259
+ conversation.Name = this._oldConvoName;
260
+ this.ConversationEditMode = false;
261
+ }
262
+ saveConvoName(conversation) {
263
+ return __awaiter(this, void 0, void 0, function* () {
264
+ let newConvoObject;
265
+ if (conversation.Save !== undefined) {
266
+ newConvoObject = conversation;
267
+ }
268
+ else {
269
+ const md = new Metadata();
270
+ newConvoObject = yield md.GetEntityObject('Conversations');
271
+ yield newConvoObject.Load(conversation.ID);
272
+ // now replace conversation in the list with the new object
273
+ this.Conversations = this.Conversations.map(c => c.ID == conversation.ID ? newConvoObject : c);
274
+ }
275
+ newConvoObject.Name = conversation.Name;
276
+ if (yield newConvoObject.Save())
277
+ this.ConversationEditMode = false;
278
+ else
279
+ this.sharedService.CreateSimpleNotification('Error saving conversation name', 'error', 5000);
280
+ });
281
+ }
282
+ deleteConvo(conversation) {
283
+ return __awaiter(this, void 0, void 0, function* () {
284
+ if (confirm('Are you sure you want to delete this conversation?')) {
285
+ // delete the conversation - we might need to load the entity if the current object isn't a "real object"
286
+ if (yield this.DeleteConversation(conversation.ID)) {
287
+ // get the index of the conversation
288
+ const idx = this.Conversations.findIndex(c => c.ID === conversation.ID);
289
+ // remove the conversation from the list
290
+ this.Conversations = this.Conversations.filter(c => c.ID != conversation.ID);
291
+ if (this.Conversations.length > 0) {
292
+ const newIdx = idx > 0 ? idx - 1 : 0;
293
+ this.selectConversation(this.Conversations[newIdx]);
294
+ }
295
+ else
296
+ this.Messages = [];
297
+ }
298
+ else {
299
+ this.sharedService.CreateSimpleNotification('Error deleting conversation', 'error', 5000);
300
+ }
301
+ }
302
+ });
303
+ }
304
+ createNewConversation() {
305
+ return __awaiter(this, void 0, void 0, function* () {
306
+ const md = new Metadata();
307
+ const convo = yield md.GetEntityObject('Conversations');
308
+ convo.NewRecord();
309
+ convo.Name = 'New Chat'; // default value
310
+ convo.UserID = md.CurrentUser.ID;
311
+ yield convo.Save();
312
+ this.Conversations = [convo, ...this.Conversations]; // do this way instead of unshift to ensure that binding refreshes
313
+ this.selectConversation(convo);
314
+ this._scrollToBottom = true; // this results in the angular after Viewchecked scrolling to bottom when it's done
315
+ });
316
+ }
317
+ onEnter(event) {
318
+ this.sendSkipQuestion();
319
+ }
320
+ selectConversation(conversation) {
321
+ var _a;
322
+ return __awaiter(this, void 0, void 0, function* () {
323
+ if (conversation && conversation.ID !== ((_a = this.SelectedConversation) === null || _a === void 0 ? void 0 : _a.ID)) {
324
+ // load up the conversation if not already the one that's loaded
325
+ this.Messages = []; // clear out the messages
326
+ const oldStatus = this._processingStatus[conversation.ID];
327
+ this._processingStatus[conversation.ID] = true;
328
+ this.SelectedConversation = conversation;
329
+ const md = new Metadata();
330
+ const rv = new RunView();
331
+ const result = yield rv.RunView({
332
+ EntityName: 'Conversation Details',
333
+ ExtraFilter: 'ConversationID=' + conversation.ID,
334
+ OrderBy: 'CreatedAt ASC' // show messages in order of creation
335
+ });
336
+ if (result && result.Success) {
337
+ this._detailHtml = {};
338
+ this.Messages = result.Results;
339
+ this._scrollToBottom = true; // this results in the angular after Viewchecked scrolling to bottom when it's done
340
+ }
341
+ this._processingStatus[conversation.ID] = oldStatus; // set back to old status as it might have been processing
342
+ this.sharedService.InvokeManualResize(500);
343
+ // ensure the list box has the conversation in view
344
+ this.scrollToConversation(conversation.ID);
345
+ // finally update the browser URL since we've changed the conversation ID
346
+ this.location.go('/askskip/' + conversation.ID);
347
+ // this.router.navigate(['askskip', conversation.ID]);
348
+ }
349
+ });
350
+ }
351
+ scrollToConversation(conversationId) {
352
+ if (this.conversationList) {
353
+ const convoElement = this.conversationList.element.nativeElement;
354
+ const itemIndex = this.Conversations.findIndex(c => c.ID === conversationId);
355
+ // Find the item element within the container based on its index
356
+ const itemElement = Array.from(convoElement.querySelectorAll('[data-kendo-listview-item-index]'))
357
+ .find((el) => parseInt(el.getAttribute('data-kendo-listview-item-index'), 10) === itemIndex);
358
+ if (itemElement) {
359
+ setTimeout(() => {
360
+ // do this within a timeout to ensure rendering is completed
361
+ itemElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
362
+ }, 100);
363
+ }
364
+ }
365
+ }
366
+ sendSkipQuestion() {
367
+ var _a, _b, _c;
368
+ return __awaiter(this, void 0, void 0, function* () {
369
+ const convoID = this.SelectedConversation ? this.SelectedConversation.ID : -1;
370
+ if (this.SelectedConversation)
371
+ this._processingStatus[(_a = this.SelectedConversation) === null || _a === void 0 ? void 0 : _a.ID] = true;
372
+ const val = this.askSkipInput.nativeElement.value;
373
+ if (val && val.length > 0) {
374
+ this.AllowSend = false;
375
+ const md = new Metadata();
376
+ const convoDetail = yield md.GetEntityObject('Conversation Details');
377
+ convoDetail.NewRecord();
378
+ convoDetail.Message = val;
379
+ convoDetail.Role = 'user';
380
+ this.Messages.push(convoDetail); // this is NOT saved here because it is saved on the server side. Later on in this code after the save we will update the object with the ID from the server
381
+ this.askSkipInput.nativeElement.value = '';
382
+ this._scrollToBottom = true; // this results in the angular after Viewchecked scrolling to bottom when it's done
383
+ const result = yield this.ExecuteAskSkipQuery(val, this.SelectedConversation);
384
+ if (result && result.ExecuteAskSkipQuery && result.ExecuteAskSkipQuery.Success) {
385
+ if (convoID !== ((_b = this.SelectedConversation) === null || _b === void 0 ? void 0 : _b.ID)) {
386
+ // this scenario arises when we have a selected convo change after we submitted our request to skip
387
+ // so we do nothing here other than update the status.
388
+ this._processingStatus[convoID] = false;
389
+ }
390
+ else {
391
+ const resultObject = JSON.parse(result.ExecuteAskSkipQuery.Result);
392
+ if (!this.SelectedConversation) {
393
+ const convo = yield md.GetEntityObject('Conversations');
394
+ yield convo.Load(result.ExecuteAskSkipQuery.ConversationId);
395
+ this._processingStatus[result.ExecuteAskSkipQuery.ConversationId] = true;
396
+ this.Conversations.push(convo);
397
+ this.SelectedConversation = convo;
398
+ }
399
+ else if (this.Messages.length === 1) {
400
+ // we are on the first message so skip renamed the convo, use that
401
+ this.SelectedConversation.Name = resultObject.ReportTitle; // this will update the UI
402
+ // the below LOOKS redundant to just updating this.SelectedConversation.Name, but it is needed to ensure that the list box is updated
403
+ // otherwise Angular binding doesn't pick up the change without the below.
404
+ const idx = this.Conversations.findIndex(c => { var _a; return c.ID === ((_a = this.SelectedConversation) === null || _a === void 0 ? void 0 : _a.ID); });
405
+ if (idx >= 0) {
406
+ // update our this.Conversations array to reflect the new name. First find the index of the conversation and then get that item and update it
407
+ this.Conversations[idx].Name = this.SelectedConversation.Name;
408
+ }
409
+ }
410
+ yield convoDetail.Load(result.ExecuteAskSkipQuery.UserMessageConversationDetailId); // update the object to load from DB
411
+ const aiDetail = yield md.GetEntityObject('Conversation Details');
412
+ yield aiDetail.Load(result.ExecuteAskSkipQuery.AIMessageConversationDetailId); // get record from the database
413
+ this.Messages.push(aiDetail);
414
+ // we don't create a user notification here in the client, that is done on the server and via GraphQL subscriptions it tells us and we update the UI automatically...
415
+ }
416
+ }
417
+ else {
418
+ const errorMessage = yield md.GetEntityObject('Conversation Details');
419
+ errorMessage.NewRecord();
420
+ errorMessage.Role = 'error';
421
+ errorMessage.Message = 'Error took place';
422
+ this.Messages.push(errorMessage);
423
+ this.AllowSend = true;
424
+ }
425
+ this._scrollToBottom = true; // this results in the angular after Viewchecked scrolling to bottom when it's done
426
+ if (this.SelectedConversation)
427
+ this._processingStatus[(_c = this.SelectedConversation) === null || _c === void 0 ? void 0 : _c.ID] = false;
428
+ this.AllowSend = true;
429
+ // invoke manual resize with a delay to ensure that the scroll to bottom has taken place
430
+ this.sharedService.InvokeManualResize(500);
431
+ }
432
+ });
433
+ }
434
+ createDetailHtml(detail) {
435
+ if (detail.ID !== null && detail.ID !== undefined && detail.ID > 0 && this._detailHtml[detail.ID]) {
436
+ // use cached HTML details for SAVED conversation details, don't do for NEW ONes where ID is null
437
+ return this._detailHtml[detail.ID];
438
+ }
439
+ else {
440
+ let sMessage = '';
441
+ if (detail.Role.trim().toLowerCase() === 'ai') {
442
+ const resultObject = JSON.parse(detail.Message);
443
+ const newId = this.Messages.length;
444
+ if (resultObject && resultObject.SQLResults && resultObject.SQLResults.results.length > 0) {
445
+ sMessage = "Here's the report I've prepared for you, please let me know if you need anything changed or another report!";
446
+ }
447
+ else {
435
448
  sMessage = `<div class="alert alert-warning" role="alert">
436
449
  <strong>No data returned.</strong>
437
- </div>`;
438
- }
439
- if (resultObject && resultObject.SQLResults && resultObject.SQLResults.results.length > 0) {
440
- this.addReportToConversation(detail, resultObject, detail.ID);
441
- }
442
- }
443
- else {
444
- sMessage = detail.Message;
445
- }
446
- if (detail.ID !== null && detail.ID !== undefined && detail.ID > 0)
447
- this._detailHtml[detail.ID] = sMessage; // only cache it if it's a saved detail if it is for a new one don't bother yet...
448
- return sMessage;
449
- }
450
- }
451
- scrollToBottom() {
452
- try {
453
- this.askSkipPanel.nativeElement.scrollTop = this.askSkipPanel.nativeElement.scrollHeight;
454
- }
455
- catch (err) {
456
- }
457
- }
458
- addReportToConversation(detail, result, messageId) {
459
- // set a short timeout to allow Angular to render as the div we want to add the grid to won't exist yet otherwise
460
- setTimeout(() => {
461
- const componentRef = this.askSkip.viewContainerRef.createComponent(SkipDynamicReportComponent);
462
- // Pass the data to the new chart
463
- const report = componentRef.instance;
464
- report.SkipData = result;
465
- report.ConversationID = detail.ConversationID;
466
- report.ConversationDetailID = detail.ID;
467
- if (this.SelectedConversation)
468
- report.ConversationName = this.SelectedConversation.Name;
469
- this._scrollToBottom = true;
470
- // // Get a reference to the root element of the component
471
- // const elementRef = componentRef.location.nativeElement;
472
- // // Add the class to the element
473
- // this.renderer.addClass(elementRef, 'skip-dynamic-report-container');
474
- // Locate the target child div by its ID
475
- const targetChildDiv = document.getElementById('skip_message_' + messageId);
476
- // Move the component's element to the required location
477
- this.renderer.appendChild(targetChildDiv, componentRef.location.nativeElement);
478
- }, 250);
479
- }
480
- userImage() {
481
- return this.sharedService.CurrentUserImage;
482
- }
483
- ExecuteAskSkipQuery(question, SelectedConversation) {
484
- return __awaiter(this, void 0, void 0, function* () {
485
- try {
450
+ </div>`;
451
+ }
452
+ if (resultObject && resultObject.SQLResults && resultObject.SQLResults.results.length > 0) {
453
+ this.addReportToConversation(detail, resultObject, detail.ID);
454
+ }
455
+ }
456
+ else {
457
+ sMessage = detail.Message;
458
+ }
459
+ if (detail.ID !== null && detail.ID !== undefined && detail.ID > 0)
460
+ this._detailHtml[detail.ID] = sMessage; // only cache it if it's a saved detail if it is for a new one don't bother yet...
461
+ return sMessage;
462
+ }
463
+ }
464
+ scrollToBottom() {
465
+ try {
466
+ this.askSkipPanel.nativeElement.scrollTop = this.askSkipPanel.nativeElement.scrollHeight;
467
+ }
468
+ catch (err) {
469
+ }
470
+ }
471
+ addReportToConversation(detail, result, messageId) {
472
+ // set a short timeout to allow Angular to render as the div we want to add the grid to won't exist yet otherwise
473
+ setTimeout(() => {
474
+ const componentRef = this.askSkip.viewContainerRef.createComponent(SkipDynamicReportComponent);
475
+ // Pass the data to the new chart
476
+ const report = componentRef.instance;
477
+ report.SkipData = result;
478
+ report.ConversationID = detail.ConversationID;
479
+ report.ConversationDetailID = detail.ID;
480
+ if (this.SelectedConversation)
481
+ report.ConversationName = this.SelectedConversation.Name;
482
+ this._scrollToBottom = true;
483
+ // // Get a reference to the root element of the component
484
+ // const elementRef = componentRef.location.nativeElement;
485
+ // // Add the class to the element
486
+ // this.renderer.addClass(elementRef, 'skip-dynamic-report-container');
487
+ // Locate the target child div by its ID
488
+ const targetChildDiv = document.getElementById('skip_message_' + messageId);
489
+ // Move the component's element to the required location
490
+ this.renderer.appendChild(targetChildDiv, componentRef.location.nativeElement);
491
+ }, 250);
492
+ }
493
+ userImage() {
494
+ return this.sharedService.CurrentUserImage;
495
+ }
496
+ ExecuteAskSkipQuery(question, SelectedConversation) {
497
+ return __awaiter(this, void 0, void 0, function* () {
498
+ try {
486
499
  const gql = `query ExecuteAskSkipQuery($userQuestion: String!, $conversationId: Int!) {
487
500
  ExecuteAskSkipQuery(UserQuestion: $userQuestion, ConversationId: $conversationId) {
488
501
  Success
@@ -492,100 +505,122 @@ export class AskSkipComponent {
492
505
  UserMessageConversationDetailId
493
506
  AIMessageConversationDetailId
494
507
  }
495
- }`;
496
- const result = yield GraphQLDataProvider.ExecuteGQL(gql, { userQuestion: question, conversationId: SelectedConversation ? SelectedConversation.ID : 0 });
497
- return result;
498
- }
499
- catch (err) {
500
- console.error(err);
501
- const md = new Metadata();
502
- const errorMessage = yield md.GetEntityObject('Conversation Details');
503
- errorMessage.NewRecord();
504
- errorMessage.Role = 'error';
505
- errorMessage.Message = 'Error took place' + err;
506
- this.Messages.push(errorMessage);
507
- this.AllowSend = true;
508
- }
509
- });
510
- }
511
- DeleteConversation(ConversationID) {
512
- return __awaiter(this, void 0, void 0, function* () {
513
- const md = new Metadata();
514
- const convEntity = yield md.GetEntityObject('Conversations');
515
- yield convEntity.Load(ConversationID);
516
- return yield convEntity.Delete();
517
- });
518
- }
519
- IsSkipProcessing(Conversation) {
520
- if (this._processingStatus[Conversation.ID]) {
521
- return this._processingStatus[Conversation.ID];
522
- }
523
- else
524
- return false;
525
- }
526
- }
527
- AskSkipComponent.ɵfac = function AskSkipComponent_Factory(t) { return new (t || AskSkipComponent)(i0.ɵɵdirectiveInject(i1.SharedService), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i2.Router), i0.ɵɵdirectiveInject(i2.ActivatedRoute), i0.ɵɵdirectiveInject(i3.Location)); };
528
- AskSkipComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AskSkipComponent, selectors: [["app-ask-skip"]], viewQuery: function AskSkipComponent_Query(rf, ctx) { if (rf & 1) {
529
- i0.ɵɵviewQuery(Container, 7);
530
- i0.ɵɵviewQuery(_c0, 7);
531
- i0.ɵɵviewQuery(_c1, 5);
532
- i0.ɵɵviewQuery(_c2, 5);
533
- } if (rf & 2) {
534
- let _t;
535
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.askSkip = _t.first);
536
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.askSkipPanel = _t.first);
537
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.conversationList = _t.first);
538
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.askSkipInput = _t.first);
539
- } }, decls: 19, vars: 13, consts: [[1, "chat-container"], [1, "conversation-history"], ["kendoButton", "", 3, "click"], ["mjFillContainer", "", 1, "conversation-list", 3, "data", "itemClass", "fillWidth"], ["conversationList", ""], ["kendoListViewItemTemplate", ""], [1, "input-wrapper"], [1, "skip-title"], ["mjContainer", "", "mjFillContainer", "", 1, "messages", 3, "bottomMargin", "fillWidth"], ["AskSkipPanel", ""], [4, "ngFor", "ngForOf"], [4, "ngIf"], [1, "input-area"], ["type", "text", "placeholder", "Type your message...", 3, "disabled", "keyup.enter"], ["AskSkipInput", ""], ["kendoButton", "", 3, "disabled", "primary", "click"], [1, "conversation-item", 3, "ngClass", "title", "click"], ["name", "comment", "class", "conversation-icon", 4, "ngIf"], ["name", "clock", "class", "conversation-icon", 4, "ngIf"], [1, "text-container"], ["maxlength", "100", 3, "ngModel", "ngModelChange", 4, "ngIf"], ["class", "edit-conversation-panel", 4, "ngIf"], ["name", "comment", 1, "conversation-icon"], ["name", "clock", 1, "conversation-icon"], ["maxlength", "100", 3, "ngModel", "ngModelChange"], [1, "edit-conversation-panel"], ["name", "edit", "class", "edit-icon", 3, "click", 4, "ngIf"], ["name", "delete", "class", "delete-icon", 3, "click", 4, "ngIf"], ["name", "check", "class", "save-icon", 3, "click", 4, "ngIf"], ["name", "close", "class", "cancel-edit-icon", 3, "click", 4, "ngIf"], ["name", "edit", 1, "edit-icon", 3, "click"], ["name", "delete", 1, "delete-icon", 3, "click"], ["name", "check", 1, "save-icon", 3, "click"], ["name", "close", 1, "cancel-edit-icon", 3, "click"], [1, "message-row", 3, "ngClass"], [1, "message-image"], [1, "avatar", 3, "src"], ["mjContainer", "", 1, "message", 3, "id"]], template: function AskSkipComponent_Template(rf, ctx) { if (rf & 1) {
540
- i0.ɵɵelementStart(0, "div", 0)(1, "div", 1)(2, "button", 2);
541
- i0.ɵɵlistener("click", function AskSkipComponent_Template_button_click_2_listener() { return ctx.createNewConversation(); });
542
- i0.ɵɵtext(3, "+ New Chat");
543
- i0.ɵɵelementEnd();
544
- i0.ɵɵelementStart(4, "kendo-listview", 3, 4);
545
- i0.ɵɵtemplate(6, AskSkipComponent_ng_template_6_Template, 7, 7, "ng-template", 5);
546
- i0.ɵɵelementEnd()();
547
- i0.ɵɵelementStart(7, "div", 6)(8, "div", 7);
548
- i0.ɵɵtext(9, "Ask Skip!");
549
- i0.ɵɵelementEnd();
550
- i0.ɵɵelementStart(10, "div", 8, 9);
551
- i0.ɵɵtemplate(12, AskSkipComponent_div_12_Template, 7, 4, "div", 10);
552
- i0.ɵɵtemplate(13, AskSkipComponent_div_13_Template, 2, 0, "div", 11);
553
- i0.ɵɵelementEnd();
554
- i0.ɵɵelementStart(14, "div", 12)(15, "textarea", 13, 14);
555
- i0.ɵɵlistener("keyup.enter", function AskSkipComponent_Template_textarea_keyup_enter_15_listener($event) { return ctx.onEnter($event); });
556
- i0.ɵɵelementEnd();
557
- i0.ɵɵelementStart(17, "button", 15);
558
- i0.ɵɵlistener("click", function AskSkipComponent_Template_button_click_17_listener() { return ctx.sendSkipQuestion(); });
559
- i0.ɵɵtext(18, "Send");
560
- i0.ɵɵelementEnd()()()();
561
- } if (rf & 2) {
562
- i0.ɵɵadvance(4);
563
- i0.ɵɵstyleProp("height", 280, "px");
564
- i0.ɵɵproperty("data", ctx.Conversations)("itemClass", i0.ɵɵpureFunction0(12, _c3))("fillWidth", false);
565
- i0.ɵɵadvance(6);
566
- i0.ɵɵproperty("bottomMargin", 60)("fillWidth", false);
567
- i0.ɵɵadvance(2);
568
- i0.ɵɵproperty("ngForOf", ctx.Messages);
569
- i0.ɵɵadvance(1);
570
- i0.ɵɵproperty("ngIf", ctx.SelectedConversation && ctx.IsSkipProcessing(ctx.SelectedConversation));
571
- i0.ɵɵadvance(2);
572
- i0.ɵɵproperty("disabled", ctx.SelectedConversation && ctx.IsSkipProcessing(ctx.SelectedConversation));
573
- i0.ɵɵadvance(2);
574
- i0.ɵɵproperty("disabled", ctx.SelectedConversation !== undefined && ctx.IsSkipProcessing(ctx.SelectedConversation))("primary", true);
575
- } }, dependencies: [i3.NgClass, i3.NgForOf, i3.NgIf, i4.DefaultValueAccessor, i4.NgControlStatus, i4.MaxLengthValidator, i4.NgModel, i5.Button, i6.LoaderComponent, i7.IconComponent, i8.FillContainer, i8.Container, i9.ItemTemplateDirective, i9.ListViewComponent], styles: [".chat-container[_ngcontent-%COMP%] {\r\n padding: 0px;\r\n display: flex;\r\n flex-direction: row;\r\n height: 100%;\r\n}\r\n\r\n.new-conversation[_ngcontent-%COMP%] {\r\n height: 30px;\r\n font-size: large;\r\n}\r\n\r\n.conversation-history[_ngcontent-%COMP%] {\r\n min-width: 225px;\r\n width: 225px;\r\n height: 100%;\r\n overflow-y: auto; \r\n margin-right: 10px;\r\n padding-top: 5px;\r\n\r\n margin-top: 0px; \r\n padding-top: 0px; \r\n}\r\n\r\n.conversation-history[_ngcontent-%COMP%] > button[_ngcontent-%COMP%] {\r\n height: 25px;\r\n}\r\n\r\n\r\n\r\n.skip-title[_ngcontent-%COMP%] {\r\n font-size: larger;\r\n margin-bottom: 5px;\r\n height: 20px;\r\n margin-top: 5px;\r\n}\r\n\r\n.conversation-list[_ngcontent-%COMP%] {\r\n margin-top: 5px;\r\n padding-top: 5px;\r\n}\r\n\r\n.messages[_ngcontent-%COMP%] {\r\n flex-grow: 1; \r\n overflow-y: auto; \r\n overflow-x: hidden; \r\n border: solid 1px rgba(0, 0, 0, 0.08);\r\n margin-bottom: 5px;\r\n\r\n margin-top: 2px; \r\n}\r\n\r\n.message-row[_ngcontent-%COMP%] {\r\n display: flex;\r\n align-items: start; \r\n border-bottom: solid 1px rgba(0, 0, 0, 0.08);\r\n padding: 10px;\r\n width: 100%;\r\n}\r\n\r\n.conversation-item[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-right: 5px;\r\n padding-top: 10px;\r\n padding-bottom: 10px;\r\n padding-left: 5px;\r\n padding-right: 5px;\r\n border-radius: 5px;\r\n cursor: pointer;\r\n overflow: hidden;\r\n max-height: 150px;\r\n font-size: 14px;\r\n\r\n display: flex;\r\n align-items: flex-start; \r\n\r\n flex-wrap: wrap; \r\n}\r\n\r\n.text-container[_ngcontent-%COMP%] {\r\n flex: 1; \r\n display: flex;\r\n flex-direction: column; \r\n}\r\n\r\n.text-container[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%] {\r\n resize: none; \r\n \r\n}\r\n\r\n.conversation-item[_ngcontent-%COMP%] > .conversation-icon[_ngcontent-%COMP%] {\r\n margin-top: 3px;\r\n}\r\n\r\n.conversation-item[_ngcontent-%COMP%] span[_ngcontent-%COMP%] {\r\n display: inline-block;\r\n white-space: pre-wrap; \r\n overflow: auto;\r\n word-wrap: break-word;\r\n margin-left: 3px; \r\n}\r\n\r\n.conversation-item[_ngcontent-%COMP%]:hover {\r\n background-color: rgba(0, 0, 0, 0.05);\r\n}\r\n.conversation-item-selected[_ngcontent-%COMP%] {\r\n background-color: rgba(0, 0, 0, 0.15);\r\n}\r\n.conversation-item[_ngcontent-%COMP%] > .conversation-icon[_ngcontent-%COMP%] {\r\n margin-right: 11px;\r\n}\r\n.edit-conversation-panel[_ngcontent-%COMP%] {\r\n width: 100%; \r\n display: flex;\r\n justify-content: flex-end; \r\n}\r\n.edit-conversation-panel[_ngcontent-%COMP%] > .k-icon[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n cursor: pointer;\r\n}\r\n.edit-conversation-panel[_ngcontent-%COMP%] > .k-icon[_ngcontent-%COMP%]:hover {\r\n color: #ff0000;\r\n}\r\n\r\n.message[_ngcontent-%COMP%] {\r\n word-wrap: break-word;\r\n width: 100%;\r\n margin-right: 20px;\r\n}\r\n.message-image[_ngcontent-%COMP%] {\r\n max-width: 45px;\r\n max-height: 45px;\r\n margin-right: 10px;\r\n margin-left: 5px;\r\n margin-bottom: 10px;\r\n}\r\n.message-image[_ngcontent-%COMP%] > img[_ngcontent-%COMP%] {\r\n max-width: 100%;\r\n max-height: 100%;\r\n}\r\n.user-message[_ngcontent-%COMP%] {\r\n background-color: white;\r\n \r\n}\r\n\r\n.error-message[_ngcontent-%COMP%] {\r\n background-color:lightpink;\r\n \r\n }\r\n \r\n.ai-message[_ngcontent-%COMP%] {\r\n background-color:rgba(0, 0, 0, 0.05);\r\n \r\n}\r\n\r\n\r\n\r\n.user-message[_ngcontent-%COMP%] {\r\n align-self: flex-start; \r\n}\r\n\r\n.ai-message[_ngcontent-%COMP%] {\r\n align-self: flex-end; \r\n}\r\n\r\n.input-area[_ngcontent-%COMP%] {\r\n height: 49px;\r\n display: flex;\r\n align-items: center;\r\n}\r\n\r\n.input-area[_ngcontent-%COMP%] > button[_ngcontent-%COMP%] {\r\n vertical-align: top;\r\n width: 100px;\r\n height: 40px;\r\n font-size: large;\r\n margin-top: 3px;\r\n margin-left: 1px;\r\n}\r\n\r\n.input-area[_ngcontent-%COMP%] > textarea[_ngcontent-%COMP%] {\r\n padding: 3px;\r\n border: solid 1px rgba(0, 0, 0, 0.08) ;\r\n margin-top: 4px;\r\n margin-right: 5px;\r\n height: 42px;\r\n font-size: large;\r\n resize: none;\r\n flex: 1; \r\n} \r\n\r\n.input-wrapper[_ngcontent-%COMP%] {\r\n flex-grow: 1; \r\n height: 100%;\r\n}"] });
576
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AskSkipComponent, [{
577
- type: Component,
578
- args: [{ selector: 'app-ask-skip', template: "<div class = \"chat-container\">\n <div class=\"conversation-history\">\n <button kendoButton (click)=\"createNewConversation()\" >+ New Chat</button>\n <kendo-listview\n class=\"conversation-list\"\n [data]=\"Conversations\"\n [style.height.px]=\"280\"\n [itemClass]=\"{ 'item-border': true }\"\n mjFillContainer \n [fillWidth]=\"false\"\n #conversationList\n >\n <ng-template kendoListViewItemTemplate let-dataItem=\"dataItem\">\n <div class=\"conversation-item\" \n [ngClass]=\"SelectedConversation?.ID === dataItem.ID ? 'conversation-item-selected' : ''\"\n [title]=\"dataItem.Name\" \n (click)=\"selectConversation(dataItem)\"> \n <kendo-icon *ngIf=\"!IsSkipProcessing(dataItem)\" name=\"comment\" class=\"conversation-icon\"></kendo-icon>\n <kendo-icon *ngIf=\"SelectedConversation && IsSkipProcessing(dataItem)\" name=\"clock\" class=\"conversation-icon\"></kendo-icon>\n <div class=\"text-container\">\n <span *ngIf=\"dataItem.ID !== SelectedConversation?.ID || !ConversationEditMode\">{{ dataItem.Name }}</span>\n <textarea *ngIf=\"dataItem.ID === SelectedConversation?.ID && ConversationEditMode\" [(ngModel)]=\"dataItem.Name\" maxlength=\"100\"></textarea>\n </div>\n <div *ngIf=\"SelectedConversation?.ID === dataItem.ID\" class=\"edit-conversation-panel\">\n <kendo-icon *ngIf=\"!ConversationEditMode\" name=\"edit\" class=\"edit-icon\" (click)=\"editConvo(dataItem)\"></kendo-icon>\n <kendo-icon *ngIf=\"!ConversationEditMode\" name=\"delete\" class=\"delete-icon\" (click)=\"deleteConvo(dataItem)\"></kendo-icon> \n <kendo-icon *ngIf=\"ConversationEditMode\" name=\"check\" class=\"save-icon\" (click)=\"saveConvoName(dataItem)\" ></kendo-icon>\n <kendo-icon *ngIf=\"ConversationEditMode\" name=\"close\" class=\"cancel-edit-icon\" (click)=\"cancelConvoEdit(dataItem)\"></kendo-icon>\n </div>\n </div>\n </ng-template>\n </kendo-listview>\n </div>\n <div class=\"input-wrapper\">\n <div class=\"skip-title\">Ask Skip!</div>\n <div #AskSkipPanel mjContainer class=\"messages\" mjFillContainer [bottomMargin]=\"60\" [fillWidth]=\"false\">\n <div *ngFor=\"let message of Messages\"> \n <div class=\"message-row\" [ngClass]=\"message.Role.trim().toLowerCase() === 'ai' ? 'ai-message' : message.Role.trim().toLowerCase() === 'error' ? 'error-message' : 'user-message'\" >\n <div class=\"message-image\">\n <img src=\"{{message.Role.trim().toLowerCase() === 'ai' || message.Role.trim().toLowerCase() === 'error' ? 'assets/Skip - Mark Only - Small.png' : userImage()}}\" class=\"avatar\" />\n </div>\n <div class=\"message\" mjContainer [id]=\"'skip_message_' + message.ID\">\n <div>{{this.createDetailHtml(message)}}</div> \n </div>\n </div>\n </div>\n <div *ngIf=\"SelectedConversation && IsSkipProcessing(SelectedConversation)\">\n <kendo-loader></kendo-loader>\n </div>\n </div>\n <div class=\"input-area\">\n <textarea\n #AskSkipInput \n [disabled]=\"SelectedConversation && IsSkipProcessing(SelectedConversation)\" \n (keyup.enter)=\"onEnter($event)\" \n type=\"text\" \n placeholder=\"Type your message...\"></textarea>\n <button kendoButton [disabled]=\"SelectedConversation !== undefined && IsSkipProcessing(SelectedConversation)\" (click)=\"sendSkipQuestion()\" [primary]=\"true\">Send</button>\n </div>\n </div>\n</div> ", styles: [".chat-container {\r\n padding: 0px;\r\n display: flex;\r\n flex-direction: row;\r\n height: 100%;\r\n}\r\n\r\n.new-conversation {\r\n height: 30px;\r\n font-size: large;\r\n}\r\n\r\n.conversation-history {\r\n min-width: 225px;\r\n width: 225px;\r\n height: 100%;\r\n overflow-y: auto; /* Add scroll if the content exceeds the height */\r\n margin-right: 10px;\r\n padding-top: 5px;\r\n\r\n margin-top: 0px; \r\n padding-top: 0px; \r\n}\r\n\r\n.conversation-history > button {\r\n height: 25px;\r\n}\r\n\r\n\r\n\r\n.skip-title {\r\n font-size: larger;\r\n margin-bottom: 5px;\r\n height: 20px;\r\n margin-top: 5px;\r\n}\r\n\r\n.conversation-list {\r\n margin-top: 5px;\r\n padding-top: 5px;\r\n}\r\n\r\n.messages {\r\n flex-grow: 1; /* This will make the messages take the remaining space */\r\n overflow-y: auto; /* enable scrolling if the content overflows */\r\n overflow-x: hidden; /* hide horizontal scrollbar */\r\n border: solid 1px rgba(0, 0, 0, 0.08);\r\n margin-bottom: 5px;\r\n\r\n margin-top: 2px; /* align it with the top of converation history exactly*/\r\n}\r\n\r\n.message-row {\r\n display: flex;\r\n align-items: start; /* if you want to align them at the top */\r\n border-bottom: solid 1px rgba(0, 0, 0, 0.08);\r\n padding: 10px;\r\n width: 100%;\r\n}\r\n\r\n.conversation-item {\r\n margin-left: 5px;\r\n margin-right: 5px;\r\n padding-top: 10px;\r\n padding-bottom: 10px;\r\n padding-left: 5px;\r\n padding-right: 5px;\r\n border-radius: 5px;\r\n cursor: pointer;\r\n overflow: hidden;\r\n max-height: 150px;\r\n font-size: 14px;\r\n\r\n display: flex;\r\n align-items: flex-start; /* Align items to the top */\r\n\r\n flex-wrap: wrap; /* Allow items to wrap to the next line */\r\n}\r\n\r\n.text-container {\r\n flex: 1; /* Take up remaining space */\r\n display: flex;\r\n flex-direction: column; /* Stack children vertically */\r\n}\r\n\r\n.text-container textarea {\r\n resize: none; /* Disable resizing */\r\n /* Add more styles for the textarea if needed */\r\n}\r\n\r\n.conversation-item > .conversation-icon {\r\n margin-top: 3px;\r\n}\r\n\r\n.conversation-item span {\r\n display: inline-block;\r\n white-space: pre-wrap; /* Allow text to wrap */\r\n overflow: auto;\r\n word-wrap: break-word;\r\n margin-left: 3px; /* Move the text to the right */\r\n}\r\n\r\n.conversation-item:hover {\r\n background-color: rgba(0, 0, 0, 0.05);\r\n}\r\n.conversation-item-selected {\r\n background-color: rgba(0, 0, 0, 0.15);\r\n}\r\n.conversation-item > .conversation-icon {\r\n margin-right: 11px;\r\n}\r\n.edit-conversation-panel {\r\n width: 100%; /* Take up the full width */\r\n display: flex;\r\n justify-content: flex-end; /* Align icons to the right */\r\n}\r\n.edit-conversation-panel > .k-icon {\r\n margin-left: 5px;\r\n cursor: pointer;\r\n}\r\n.edit-conversation-panel > .k-icon:hover {\r\n color: #ff0000;\r\n}\r\n\r\n.message {\r\n word-wrap: break-word;\r\n width: 100%;\r\n margin-right: 20px;\r\n}\r\n.message-image {\r\n max-width: 45px;\r\n max-height: 45px;\r\n margin-right: 10px;\r\n margin-left: 5px;\r\n margin-bottom: 10px;\r\n}\r\n.message-image > img {\r\n max-width: 100%;\r\n max-height: 100%;\r\n}\r\n.user-message {\r\n background-color: white;\r\n /* additional styling for user messages... */\r\n}\r\n\r\n.error-message {\r\n background-color:lightpink;\r\n /* additional styling for AI messages... */\r\n }\r\n \r\n.ai-message {\r\n background-color:rgba(0, 0, 0, 0.05);\r\n /* additional styling for AI messages... */\r\n}\r\n\r\n\r\n\r\n.user-message {\r\n align-self: flex-start; /* align user messages to the left */\r\n}\r\n\r\n.ai-message {\r\n align-self: flex-end; /* align AI messages to the right */\r\n}\r\n\r\n.input-area {\r\n height: 49px;\r\n display: flex;\r\n align-items: center;\r\n}\r\n\r\n.input-area > button {\r\n vertical-align: top;\r\n width: 100px;\r\n height: 40px;\r\n font-size: large;\r\n margin-top: 3px;\r\n margin-left: 1px;\r\n}\r\n\r\n.input-area > textarea {\r\n padding: 3px;\r\n border: solid 1px rgba(0, 0, 0, 0.08) ;\r\n margin-top: 4px;\r\n margin-right: 5px;\r\n height: 42px;\r\n font-size: large;\r\n resize: none;\r\n flex: 1; /* Take up remaining space */\r\n} \r\n\r\n.input-wrapper {\r\n flex-grow: 1; /* This will make the input-wrapper take the remaining space */\r\n height: 100%;\r\n}\r\n"] }]
579
- }], function () { return [{ type: i1.SharedService }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: i2.Router }, { type: i2.ActivatedRoute }, { type: i3.Location }]; }, { askSkip: [{
580
- type: ViewChild,
581
- args: [Container, { static: true }]
582
- }], askSkipPanel: [{
583
- type: ViewChild,
584
- args: ['AskSkipPanel', { static: true }]
585
- }], conversationList: [{
586
- type: ViewChild,
587
- args: ['conversationList', { static: false }]
588
- }], askSkipInput: [{
589
- type: ViewChild,
590
- args: ['AskSkipInput']
591
- }] }); })();
508
+ }`;
509
+ const result = yield GraphQLDataProvider.ExecuteGQL(gql, { userQuestion: question, conversationId: SelectedConversation ? SelectedConversation.ID : 0 });
510
+ return result;
511
+ }
512
+ catch (err) {
513
+ console.error(err);
514
+ const md = new Metadata();
515
+ const errorMessage = yield md.GetEntityObject('Conversation Details');
516
+ errorMessage.NewRecord();
517
+ errorMessage.Role = 'error';
518
+ errorMessage.Message = 'Error took place' + err;
519
+ this.Messages.push(errorMessage);
520
+ this.AllowSend = true;
521
+ }
522
+ });
523
+ }
524
+ DeleteConversation(ConversationID) {
525
+ return __awaiter(this, void 0, void 0, function* () {
526
+ const md = new Metadata();
527
+ const convEntity = yield md.GetEntityObject('Conversations');
528
+ yield convEntity.Load(ConversationID);
529
+ return yield convEntity.Delete();
530
+ });
531
+ }
532
+ IsSkipProcessing(Conversation) {
533
+ if (this._processingStatus[Conversation.ID]) {
534
+ return this._processingStatus[Conversation.ID];
535
+ }
536
+ else
537
+ return false;
538
+ }
539
+ runQuery() {
540
+ return __awaiter(this, void 0, void 0, function* () {
541
+ // total test crap code, get rid of this once we have a real queries UI
542
+ const rq = new RunQuery();
543
+ // ask the user which query ID to run
544
+ const queryId = prompt('Enter the query ID to run');
545
+ if (queryId) {
546
+ const result = yield rq.RunQuery({ QueryID: parseInt(queryId, 10) });
547
+ if (result && result.Success) {
548
+ alert('Success! ' + JSON.stringify(result.Results));
549
+ console.log(result.Results);
550
+ }
551
+ else {
552
+ alert('Error! ' + result.ErrorMessage);
553
+ }
554
+ }
555
+ });
556
+ }
557
+ }
558
+ AskSkipComponent.ɵfac = function AskSkipComponent_Factory(t) { return new (t || AskSkipComponent)(i0.ɵɵdirectiveInject(i1.SharedService), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i2.Router), i0.ɵɵdirectiveInject(i2.ActivatedRoute), i0.ɵɵdirectiveInject(i3.Location)); };
559
+ AskSkipComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AskSkipComponent, selectors: [["app-ask-skip"]], viewQuery: function AskSkipComponent_Query(rf, ctx) { if (rf & 1) {
560
+ i0.ɵɵviewQuery(Container, 7);
561
+ i0.ɵɵviewQuery(_c0, 7);
562
+ i0.ɵɵviewQuery(_c1, 5);
563
+ i0.ɵɵviewQuery(_c2, 5);
564
+ } if (rf & 2) {
565
+ let _t;
566
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.askSkip = _t.first);
567
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.askSkipPanel = _t.first);
568
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.conversationList = _t.first);
569
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.askSkipInput = _t.first);
570
+ } }, decls: 21, vars: 13, consts: [[1, "chat-container"], ["kendoButton", "", 3, "click"], [1, "conversation-history"], ["mjFillContainer", "", 1, "conversation-list", 3, "data", "itemClass", "fillWidth"], ["conversationList", ""], ["kendoListViewItemTemplate", ""], [1, "input-wrapper"], [1, "skip-title"], ["mjContainer", "", "mjFillContainer", "", 1, "messages", 3, "bottomMargin", "fillWidth"], ["AskSkipPanel", ""], [4, "ngFor", "ngForOf"], [4, "ngIf"], [1, "input-area"], ["type", "text", "placeholder", "Type your message...", 3, "disabled", "keyup.enter"], ["AskSkipInput", ""], ["kendoButton", "", 3, "disabled", "primary", "click"], [1, "conversation-item", 3, "ngClass", "title", "click"], ["name", "comment", "svgIcon", "conversation-icon", 3, "icon", 4, "ngIf"], ["name", "clock", "class", "conversation-icon", 3, "icon", 4, "ngIf"], [1, "text-container"], ["maxlength", "100", 3, "ngModel", "ngModelChange", 4, "ngIf"], ["class", "edit-conversation-panel", 4, "ngIf"], ["name", "comment", "svgIcon", "conversation-icon", 3, "icon"], ["name", "clock", 1, "conversation-icon", 3, "icon"], ["maxlength", "100", 3, "ngModel", "ngModelChange"], [1, "edit-conversation-panel"], ["name", "edit", "class", "edit-icon", 3, "icon", "click", 4, "ngIf"], ["name", "delete", "class", "delete-icon", 3, "icon", "click", 4, "ngIf"], ["name", "check", "class", "save-icon", 3, "icon", "click", 4, "ngIf"], ["name", "close", "class", "cancel-edit-icon", 3, "icon", "click", 4, "ngIf"], ["name", "edit", 1, "edit-icon", 3, "icon", "click"], ["name", "delete", 1, "delete-icon", 3, "icon", "click"], ["name", "check", 1, "save-icon", 3, "icon", "click"], ["name", "close", 1, "cancel-edit-icon", 3, "icon", "click"], [1, "message-row", 3, "ngClass"], [1, "message-image"], [1, "avatar", 3, "src"], ["mjContainer", "", 1, "message", 3, "id"]], template: function AskSkipComponent_Template(rf, ctx) { if (rf & 1) {
571
+ i0.ɵɵelementStart(0, "div", 0)(1, "button", 1);
572
+ i0.ɵɵlistener("click", function AskSkipComponent_Template_button_click_1_listener() { return ctx.runQuery(); });
573
+ i0.ɵɵtext(2, "Test - Run Query");
574
+ i0.ɵɵelementEnd();
575
+ i0.ɵɵelementStart(3, "div", 2)(4, "button", 1);
576
+ i0.ɵɵlistener("click", function AskSkipComponent_Template_button_click_4_listener() { return ctx.createNewConversation(); });
577
+ i0.ɵɵtext(5, "+ New Chat");
578
+ i0.ɵɵelementEnd();
579
+ i0.ɵɵelementStart(6, "kendo-listview", 3, 4);
580
+ i0.ɵɵtemplate(8, AskSkipComponent_ng_template_8_Template, 7, 7, "ng-template", 5);
581
+ i0.ɵɵelementEnd()();
582
+ i0.ɵɵelementStart(9, "div", 6)(10, "div", 7);
583
+ i0.ɵɵtext(11, "Ask Skip!");
584
+ i0.ɵɵelementEnd();
585
+ i0.ɵɵelementStart(12, "div", 8, 9);
586
+ i0.ɵɵtemplate(14, AskSkipComponent_div_14_Template, 7, 4, "div", 10)(15, AskSkipComponent_div_15_Template, 2, 0, "div", 11);
587
+ i0.ɵɵelementEnd();
588
+ i0.ɵɵelementStart(16, "div", 12)(17, "textarea", 13, 14);
589
+ i0.ɵɵlistener("keyup.enter", function AskSkipComponent_Template_textarea_keyup_enter_17_listener($event) { return ctx.onEnter($event); });
590
+ i0.ɵɵelementEnd();
591
+ i0.ɵɵelementStart(19, "button", 15);
592
+ i0.ɵɵlistener("click", function AskSkipComponent_Template_button_click_19_listener() { return ctx.sendSkipQuestion(); });
593
+ i0.ɵɵtext(20, "Send");
594
+ i0.ɵɵelementEnd()()()();
595
+ } if (rf & 2) {
596
+ i0.ɵɵadvance(6);
597
+ i0.ɵɵstyleProp("height", 280, "px");
598
+ i0.ɵɵproperty("data", ctx.Conversations)("itemClass", i0.ɵɵpureFunction0(12, _c3))("fillWidth", false);
599
+ i0.ɵɵadvance(6);
600
+ i0.ɵɵproperty("bottomMargin", 60)("fillWidth", false);
601
+ i0.ɵɵadvance(2);
602
+ i0.ɵɵproperty("ngForOf", ctx.Messages);
603
+ i0.ɵɵadvance();
604
+ i0.ɵɵproperty("ngIf", ctx.SelectedConversation && ctx.IsSkipProcessing(ctx.SelectedConversation));
605
+ i0.ɵɵadvance(2);
606
+ i0.ɵɵproperty("disabled", ctx.SelectedConversation && ctx.IsSkipProcessing(ctx.SelectedConversation));
607
+ i0.ɵɵadvance(2);
608
+ i0.ɵɵproperty("disabled", ctx.SelectedConversation !== undefined && ctx.IsSkipProcessing(ctx.SelectedConversation))("primary", true);
609
+ } }, dependencies: [i3.NgClass, i3.NgForOf, i3.NgIf, i4.DefaultValueAccessor, i4.NgControlStatus, i4.MaxLengthValidator, i4.NgModel, i5.ButtonComponent, i6.LoaderComponent, i7.SVGIconComponent, i8.FillContainer, i8.Container, i9.ItemTemplateDirective, i9.ListViewComponent], styles: [".chat-container[_ngcontent-%COMP%] {\r\n padding: 0px;\r\n display: flex;\r\n flex-direction: row;\r\n height: 100%;\r\n}\r\n\r\n.new-conversation[_ngcontent-%COMP%] {\r\n height: 30px;\r\n font-size: large;\r\n}\r\n\r\n.conversation-history[_ngcontent-%COMP%] {\r\n min-width: 225px;\r\n width: 225px;\r\n height: 100%;\r\n overflow-y: auto; \n\r\n margin-right: 10px;\r\n padding-top: 5px;\r\n\r\n margin-top: 0px; \r\n padding-top: 0px; \r\n}\r\n\r\n.conversation-history[_ngcontent-%COMP%] > button[_ngcontent-%COMP%] {\r\n height: 25px;\r\n}\r\n\r\n\r\n\r\n.skip-title[_ngcontent-%COMP%] {\r\n font-size: larger;\r\n margin-bottom: 5px;\r\n height: 20px;\r\n margin-top: 5px;\r\n}\r\n\r\n.conversation-list[_ngcontent-%COMP%] {\r\n margin-top: 5px;\r\n padding-top: 5px;\r\n}\r\n\r\n.messages[_ngcontent-%COMP%] {\r\n flex-grow: 1; \n\r\n overflow-y: auto; \n\r\n overflow-x: hidden; \n\r\n border: solid 1px rgba(0, 0, 0, 0.08);\r\n margin-bottom: 5px;\r\n\r\n margin-top: 2px; \n\r\n}\r\n\r\n.message-row[_ngcontent-%COMP%] {\r\n display: flex;\r\n align-items: start; \n\r\n border-bottom: solid 1px rgba(0, 0, 0, 0.08);\r\n padding: 10px;\r\n width: 100%;\r\n}\r\n\r\n.conversation-item[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-right: 5px;\r\n padding-top: 10px;\r\n padding-bottom: 10px;\r\n padding-left: 5px;\r\n padding-right: 5px;\r\n border-radius: 5px;\r\n cursor: pointer;\r\n overflow: hidden;\r\n max-height: 150px;\r\n font-size: 14px;\r\n\r\n display: flex;\r\n align-items: flex-start; \n\r\n\r\n flex-wrap: wrap; \n\r\n}\r\n\r\n.text-container[_ngcontent-%COMP%] {\r\n flex: 1; \n\r\n display: flex;\r\n flex-direction: column; \n\r\n}\r\n\r\n.text-container[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%] {\r\n resize: none; \n\r\n \n\r\n}\r\n\r\n.conversation-item[_ngcontent-%COMP%] > .conversation-icon[_ngcontent-%COMP%] {\r\n margin-top: 3px;\r\n}\r\n\r\n.conversation-item[_ngcontent-%COMP%] span[_ngcontent-%COMP%] {\r\n display: inline-block;\r\n white-space: pre-wrap; \n\r\n overflow: auto;\r\n word-wrap: break-word;\r\n margin-left: 3px; \n\r\n}\r\n\r\n.conversation-item[_ngcontent-%COMP%]:hover {\r\n background-color: rgba(0, 0, 0, 0.05);\r\n}\r\n.conversation-item-selected[_ngcontent-%COMP%] {\r\n background-color: rgba(0, 0, 0, 0.15);\r\n}\r\n.conversation-item[_ngcontent-%COMP%] > .conversation-icon[_ngcontent-%COMP%] {\r\n margin-right: 11px;\r\n}\r\n.edit-conversation-panel[_ngcontent-%COMP%] {\r\n width: 100%; \n\r\n display: flex;\r\n justify-content: flex-end; \n\r\n}\r\n.edit-conversation-panel[_ngcontent-%COMP%] > .k-icon[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n cursor: pointer;\r\n}\r\n.edit-conversation-panel[_ngcontent-%COMP%] > .k-icon[_ngcontent-%COMP%]:hover {\r\n color: #ff0000;\r\n}\r\n\r\n.message[_ngcontent-%COMP%] {\r\n word-wrap: break-word;\r\n width: 100%;\r\n margin-right: 20px;\r\n}\r\n.message-image[_ngcontent-%COMP%] {\r\n max-width: 45px;\r\n max-height: 45px;\r\n margin-right: 10px;\r\n margin-left: 5px;\r\n margin-bottom: 10px;\r\n}\r\n.message-image[_ngcontent-%COMP%] > img[_ngcontent-%COMP%] {\r\n max-width: 100%;\r\n max-height: 100%;\r\n}\r\n.user-message[_ngcontent-%COMP%] {\r\n background-color: white;\r\n \n\r\n}\r\n\r\n.error-message[_ngcontent-%COMP%] {\r\n background-color:lightpink;\r\n \n\r\n }\r\n \r\n.ai-message[_ngcontent-%COMP%] {\r\n background-color:rgba(0, 0, 0, 0.05);\r\n \n\r\n}\r\n\r\n\r\n\r\n.user-message[_ngcontent-%COMP%] {\r\n align-self: flex-start; \n\r\n}\r\n\r\n.ai-message[_ngcontent-%COMP%] {\r\n align-self: flex-end; \n\r\n}\r\n\r\n.input-area[_ngcontent-%COMP%] {\r\n height: 49px;\r\n display: flex;\r\n align-items: center;\r\n}\r\n\r\n.input-area[_ngcontent-%COMP%] > button[_ngcontent-%COMP%] {\r\n vertical-align: top;\r\n width: 100px;\r\n height: 40px;\r\n font-size: large;\r\n margin-top: 3px;\r\n margin-left: 1px;\r\n}\r\n\r\n.input-area[_ngcontent-%COMP%] > textarea[_ngcontent-%COMP%] {\r\n padding: 3px;\r\n border: solid 1px rgba(0, 0, 0, 0.08) ;\r\n margin-top: 4px;\r\n margin-right: 5px;\r\n height: 42px;\r\n font-size: large;\r\n resize: none;\r\n flex: 1; \n\r\n} \r\n\r\n.input-wrapper[_ngcontent-%COMP%] {\r\n flex-grow: 1; \n\r\n height: 100%;\r\n}"] });
610
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AskSkipComponent, [{
611
+ type: Component,
612
+ args: [{ selector: 'app-ask-skip', template: "<div class = \"chat-container\">\n <button kendoButton (click)=\"runQuery()\" >Test - Run Query</button>\n <div class=\"conversation-history\">\n <button kendoButton (click)=\"createNewConversation()\" >+ New Chat</button>\n <kendo-listview\n class=\"conversation-list\"\n [data]=\"Conversations\"\n [style.height.px]=\"280\"\n [itemClass]=\"{ 'item-border': true }\"\n mjFillContainer \n [fillWidth]=\"false\"\n #conversationList\n >\n <ng-template kendoListViewItemTemplate let-dataItem=\"dataItem\">\n <div class=\"conversation-item\" \n [ngClass]=\"SelectedConversation?.ID === dataItem.ID ? 'conversation-item-selected' : ''\"\n [title]=\"dataItem.Name\" \n (click)=\"selectConversation(dataItem)\"> \n <kendo-svgicon *ngIf=\"!IsSkipProcessing(dataItem)\" [icon]=\"sharedService.kendoSVGIcon('comment')\" name=\"comment\" svgIcon=\"conversation-icon\"></kendo-svgicon>\n <kendo-svgicon *ngIf=\"SelectedConversation && IsSkipProcessing(dataItem)\" [icon]=\"sharedService.kendoSVGIcon('clock')\" name=\"clock\" class=\"conversation-icon\"></kendo-svgicon>\n <div class=\"text-container\">\n <span *ngIf=\"dataItem.ID !== SelectedConversation?.ID || !ConversationEditMode\">{{ dataItem.Name }}</span>\n <textarea *ngIf=\"dataItem.ID === SelectedConversation?.ID && ConversationEditMode\" [(ngModel)]=\"dataItem.Name\" maxlength=\"100\"></textarea>\n </div>\n <div *ngIf=\"SelectedConversation?.ID === dataItem.ID\" class=\"edit-conversation-panel\">\n <kendo-svgicon *ngIf=\"!ConversationEditMode\" [icon]=\"sharedService.kendoSVGIcon('edit')\" name=\"edit\" class=\"edit-icon\" (click)=\"editConvo(dataItem)\"></kendo-svgicon>\n <kendo-svgicon *ngIf=\"!ConversationEditMode\" [icon]=\"sharedService.kendoSVGIcon('delete')\" name=\"delete\" class=\"delete-icon\" (click)=\"deleteConvo(dataItem)\"></kendo-svgicon> \n <kendo-svgicon *ngIf=\"ConversationEditMode\" [icon]=\"sharedService.kendoSVGIcon('check')\" name=\"check\" class=\"save-icon\" (click)=\"saveConvoName(dataItem)\" ></kendo-svgicon>\n <kendo-svgicon *ngIf=\"ConversationEditMode\" [icon]=\"sharedService.kendoSVGIcon('close')\" name=\"close\" class=\"cancel-edit-icon\" (click)=\"cancelConvoEdit(dataItem)\"></kendo-svgicon>\n </div>\n </div>\n </ng-template>\n </kendo-listview>\n </div>\n <div class=\"input-wrapper\">\n <div class=\"skip-title\">Ask Skip!</div>\n <div #AskSkipPanel mjContainer class=\"messages\" mjFillContainer [bottomMargin]=\"60\" [fillWidth]=\"false\">\n <div *ngFor=\"let message of Messages\"> \n <div class=\"message-row\" [ngClass]=\"message.Role.trim().toLowerCase() === 'ai' ? 'ai-message' : message.Role.trim().toLowerCase() === 'error' ? 'error-message' : 'user-message'\" >\n <div class=\"message-image\">\n <img src=\"{{message.Role.trim().toLowerCase() === 'ai' || message.Role.trim().toLowerCase() === 'error' ? 'assets/Skip - Mark Only - Small.png' : userImage()}}\" class=\"avatar\" />\n </div>\n <div class=\"message\" mjContainer [id]=\"'skip_message_' + message.ID\">\n <div>{{this.createDetailHtml(message)}}</div> \n </div>\n </div>\n </div>\n <div *ngIf=\"SelectedConversation && IsSkipProcessing(SelectedConversation)\">\n <kendo-loader></kendo-loader>\n </div>\n </div>\n <div class=\"input-area\">\n <textarea\n #AskSkipInput \n [disabled]=\"SelectedConversation && IsSkipProcessing(SelectedConversation)\" \n (keyup.enter)=\"onEnter($event)\" \n type=\"text\" \n placeholder=\"Type your message...\"></textarea>\n <button kendoButton [disabled]=\"SelectedConversation !== undefined && IsSkipProcessing(SelectedConversation)\" (click)=\"sendSkipQuestion()\" [primary]=\"true\">Send</button>\n </div>\n </div>\n</div> ", styles: [".chat-container {\r\n padding: 0px;\r\n display: flex;\r\n flex-direction: row;\r\n height: 100%;\r\n}\r\n\r\n.new-conversation {\r\n height: 30px;\r\n font-size: large;\r\n}\r\n\r\n.conversation-history {\r\n min-width: 225px;\r\n width: 225px;\r\n height: 100%;\r\n overflow-y: auto; /* Add scroll if the content exceeds the height */\r\n margin-right: 10px;\r\n padding-top: 5px;\r\n\r\n margin-top: 0px; \r\n padding-top: 0px; \r\n}\r\n\r\n.conversation-history > button {\r\n height: 25px;\r\n}\r\n\r\n\r\n\r\n.skip-title {\r\n font-size: larger;\r\n margin-bottom: 5px;\r\n height: 20px;\r\n margin-top: 5px;\r\n}\r\n\r\n.conversation-list {\r\n margin-top: 5px;\r\n padding-top: 5px;\r\n}\r\n\r\n.messages {\r\n flex-grow: 1; /* This will make the messages take the remaining space */\r\n overflow-y: auto; /* enable scrolling if the content overflows */\r\n overflow-x: hidden; /* hide horizontal scrollbar */\r\n border: solid 1px rgba(0, 0, 0, 0.08);\r\n margin-bottom: 5px;\r\n\r\n margin-top: 2px; /* align it with the top of converation history exactly*/\r\n}\r\n\r\n.message-row {\r\n display: flex;\r\n align-items: start; /* if you want to align them at the top */\r\n border-bottom: solid 1px rgba(0, 0, 0, 0.08);\r\n padding: 10px;\r\n width: 100%;\r\n}\r\n\r\n.conversation-item {\r\n margin-left: 5px;\r\n margin-right: 5px;\r\n padding-top: 10px;\r\n padding-bottom: 10px;\r\n padding-left: 5px;\r\n padding-right: 5px;\r\n border-radius: 5px;\r\n cursor: pointer;\r\n overflow: hidden;\r\n max-height: 150px;\r\n font-size: 14px;\r\n\r\n display: flex;\r\n align-items: flex-start; /* Align items to the top */\r\n\r\n flex-wrap: wrap; /* Allow items to wrap to the next line */\r\n}\r\n\r\n.text-container {\r\n flex: 1; /* Take up remaining space */\r\n display: flex;\r\n flex-direction: column; /* Stack children vertically */\r\n}\r\n\r\n.text-container textarea {\r\n resize: none; /* Disable resizing */\r\n /* Add more styles for the textarea if needed */\r\n}\r\n\r\n.conversation-item > .conversation-icon {\r\n margin-top: 3px;\r\n}\r\n\r\n.conversation-item span {\r\n display: inline-block;\r\n white-space: pre-wrap; /* Allow text to wrap */\r\n overflow: auto;\r\n word-wrap: break-word;\r\n margin-left: 3px; /* Move the text to the right */\r\n}\r\n\r\n.conversation-item:hover {\r\n background-color: rgba(0, 0, 0, 0.05);\r\n}\r\n.conversation-item-selected {\r\n background-color: rgba(0, 0, 0, 0.15);\r\n}\r\n.conversation-item > .conversation-icon {\r\n margin-right: 11px;\r\n}\r\n.edit-conversation-panel {\r\n width: 100%; /* Take up the full width */\r\n display: flex;\r\n justify-content: flex-end; /* Align icons to the right */\r\n}\r\n.edit-conversation-panel > .k-icon {\r\n margin-left: 5px;\r\n cursor: pointer;\r\n}\r\n.edit-conversation-panel > .k-icon:hover {\r\n color: #ff0000;\r\n}\r\n\r\n.message {\r\n word-wrap: break-word;\r\n width: 100%;\r\n margin-right: 20px;\r\n}\r\n.message-image {\r\n max-width: 45px;\r\n max-height: 45px;\r\n margin-right: 10px;\r\n margin-left: 5px;\r\n margin-bottom: 10px;\r\n}\r\n.message-image > img {\r\n max-width: 100%;\r\n max-height: 100%;\r\n}\r\n.user-message {\r\n background-color: white;\r\n /* additional styling for user messages... */\r\n}\r\n\r\n.error-message {\r\n background-color:lightpink;\r\n /* additional styling for AI messages... */\r\n }\r\n \r\n.ai-message {\r\n background-color:rgba(0, 0, 0, 0.05);\r\n /* additional styling for AI messages... */\r\n}\r\n\r\n\r\n\r\n.user-message {\r\n align-self: flex-start; /* align user messages to the left */\r\n}\r\n\r\n.ai-message {\r\n align-self: flex-end; /* align AI messages to the right */\r\n}\r\n\r\n.input-area {\r\n height: 49px;\r\n display: flex;\r\n align-items: center;\r\n}\r\n\r\n.input-area > button {\r\n vertical-align: top;\r\n width: 100px;\r\n height: 40px;\r\n font-size: large;\r\n margin-top: 3px;\r\n margin-left: 1px;\r\n}\r\n\r\n.input-area > textarea {\r\n padding: 3px;\r\n border: solid 1px rgba(0, 0, 0, 0.08) ;\r\n margin-top: 4px;\r\n margin-right: 5px;\r\n height: 42px;\r\n font-size: large;\r\n resize: none;\r\n flex: 1; /* Take up remaining space */\r\n} \r\n\r\n.input-wrapper {\r\n flex-grow: 1; /* This will make the input-wrapper take the remaining space */\r\n height: 100%;\r\n}\r\n"] }]
613
+ }], () => [{ type: i1.SharedService }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: i2.Router }, { type: i2.ActivatedRoute }, { type: i3.Location }], { askSkip: [{
614
+ type: ViewChild,
615
+ args: [Container, { static: true }]
616
+ }], askSkipPanel: [{
617
+ type: ViewChild,
618
+ args: ['AskSkipPanel', { static: true }]
619
+ }], conversationList: [{
620
+ type: ViewChild,
621
+ args: ['conversationList', { static: false }]
622
+ }], askSkipInput: [{
623
+ type: ViewChild,
624
+ args: ['AskSkipInput']
625
+ }] }); })();
626
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AskSkipComponent, { className: "AskSkipComponent", filePath: "src\\lib\\ask-skip\\ask-skip.component.ts", lineNumber: 56 }); })();