@sisense/sdk-ui-angular 1.31.0 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/ai/lib/component-wrapper-helpers/context-connectors.d.ts +10 -0
  2. package/dist/ai/lib/component-wrapper-helpers/index.d.ts +2 -0
  3. package/dist/ai/lib/component-wrapper-helpers/template.d.ts +2 -0
  4. package/dist/ai/lib/components/chatbot.component.d.ts +132 -0
  5. package/dist/ai/lib/components/get-nlg-insights.component.d.ts +141 -0
  6. package/dist/ai/lib/components/index.d.ts +2 -0
  7. package/dist/ai/lib/sdk-ai.module.d.ts +40 -5
  8. package/dist/ai/lib/sdk-ui-core-exports.d.ts +1 -0
  9. package/dist/ai/lib/services/ai.service.d.ts +88 -0
  10. package/dist/ai/lib/services/index.d.ts +1 -0
  11. package/dist/ai/public-api.d.ts +6 -0
  12. package/dist/esm2020/ai/lib/component-wrapper-helpers/context-connectors.mjs +20 -0
  13. package/dist/esm2020/ai/lib/component-wrapper-helpers/index.mjs +3 -0
  14. package/dist/esm2020/ai/lib/component-wrapper-helpers/template.mjs +5 -0
  15. package/dist/esm2020/ai/lib/components/chatbot.component.mjs +138 -0
  16. package/dist/esm2020/ai/lib/components/get-nlg-insights.component.mjs +145 -0
  17. package/dist/esm2020/ai/lib/components/index.mjs +3 -0
  18. package/dist/esm2020/ai/lib/sdk-ai.module.mjs +40 -6
  19. package/dist/esm2020/ai/lib/sdk-ui-core-exports.mjs +3 -0
  20. package/dist/esm2020/ai/lib/services/ai.service.mjs +137 -0
  21. package/dist/esm2020/ai/lib/services/index.mjs +2 -0
  22. package/dist/esm2020/ai/public-api.mjs +7 -1
  23. package/dist/esm2020/lib/component-wrapper-helpers/index.mjs +2 -1
  24. package/dist/esm2020/lib/components/charts/area-chart.component.mjs +1 -1
  25. package/dist/esm2020/lib/components/charts/area-range-chart.component.mjs +1 -1
  26. package/dist/esm2020/lib/components/charts/areamap-chart.component.mjs +1 -1
  27. package/dist/esm2020/lib/components/charts/bar-chart.component.mjs +1 -1
  28. package/dist/esm2020/lib/components/charts/boxplot-chart.component.mjs +1 -1
  29. package/dist/esm2020/lib/components/charts/chart.component.mjs +1 -1
  30. package/dist/esm2020/lib/components/charts/column-chart.component.mjs +1 -1
  31. package/dist/esm2020/lib/components/charts/funnel-chart.component.mjs +1 -1
  32. package/dist/esm2020/lib/components/charts/indicator-chart.component.mjs +1 -1
  33. package/dist/esm2020/lib/components/charts/line-chart.component.mjs +1 -1
  34. package/dist/esm2020/lib/components/charts/pie-chart.component.mjs +1 -1
  35. package/dist/esm2020/lib/components/charts/pivot-table.component.mjs +1 -1
  36. package/dist/esm2020/lib/components/charts/polar-chart.component.mjs +1 -1
  37. package/dist/esm2020/lib/components/charts/scatter-chart.component.mjs +1 -1
  38. package/dist/esm2020/lib/components/charts/scattermap-chart.component.mjs +1 -1
  39. package/dist/esm2020/lib/components/charts/sunburst-chart.component.mjs +1 -1
  40. package/dist/esm2020/lib/components/charts/table.component.mjs +1 -1
  41. package/dist/esm2020/lib/components/charts/treemap-chart.component.mjs +1 -1
  42. package/dist/esm2020/lib/components/dashboard/dashboard-by-id.component.mjs +4 -4
  43. package/dist/esm2020/lib/components/dashboard/dashboard.component.mjs +1 -1
  44. package/dist/esm2020/lib/components/drilldown-breadcrumbs.component.mjs +1 -1
  45. package/dist/esm2020/lib/components/filters/criteria-filter-tile.component.mjs +1 -1
  46. package/dist/esm2020/lib/components/filters/date-range-filter-tile.component.mjs +1 -1
  47. package/dist/esm2020/lib/components/filters/member-filter-tile.component.mjs +1 -1
  48. package/dist/esm2020/lib/components/filters/relative-date-filter-tile.component.mjs +1 -1
  49. package/dist/esm2020/lib/components/widgets/chart-widget.component.mjs +1 -1
  50. package/dist/esm2020/lib/components/widgets/index.mjs +2 -1
  51. package/dist/esm2020/lib/components/widgets/pivot-table-widget.component.mjs +127 -0
  52. package/dist/esm2020/lib/components/widgets/table-widget.component.mjs +1 -1
  53. package/dist/esm2020/lib/components/widgets/widget-by-id.component.mjs +1 -1
  54. package/dist/esm2020/lib/decorators/index.mjs +3 -0
  55. package/dist/esm2020/lib/decorators/trackable.decorator.mjs +2 -1
  56. package/dist/esm2020/lib/sdk-ui-core-exports.mjs +2 -2
  57. package/dist/esm2020/lib/sdk-ui.module.mjs +10 -6
  58. package/dist/esm2020/lib/services/query.service.mjs +31 -5
  59. package/dist/esm2020/lib/services/sisense-context.service.mjs +3 -3
  60. package/dist/esm2020/lib/services/theme.service.mjs +3 -3
  61. package/dist/esm2020/lib/types/dashboard-config.mjs +2 -0
  62. package/dist/esm2020/lib/types/index.mjs +2 -1
  63. package/dist/esm2020/lib/utilities/dashboard-helpers.mjs +119 -0
  64. package/dist/esm2020/lib/utilities/dashboard-model-translator.mjs +49 -0
  65. package/dist/esm2020/lib/utilities/index.mjs +7 -0
  66. package/dist/esm2020/lib/utilities/widget-model-translator.mjs +304 -0
  67. package/dist/esm2020/public-api.mjs +6 -25
  68. package/dist/esm2020/version.mjs +2 -2
  69. package/dist/fesm2015/sisense-sdk-ui-angular-ai.mjs +471 -8
  70. package/dist/fesm2015/sisense-sdk-ui-angular-ai.mjs.map +1 -1
  71. package/dist/fesm2015/sisense-sdk-ui-angular.mjs +671 -43
  72. package/dist/fesm2015/sisense-sdk-ui-angular.mjs.map +1 -1
  73. package/dist/fesm2020/sisense-sdk-ui-angular-ai.mjs +466 -8
  74. package/dist/fesm2020/sisense-sdk-ui-angular-ai.mjs.map +1 -1
  75. package/dist/fesm2020/sisense-sdk-ui-angular.mjs +668 -42
  76. package/dist/fesm2020/sisense-sdk-ui-angular.mjs.map +1 -1
  77. package/dist/lib/component-wrapper-helpers/index.d.ts +1 -0
  78. package/dist/lib/components/charts/area-chart.component.d.ts +3 -0
  79. package/dist/lib/components/charts/area-range-chart.component.d.ts +3 -0
  80. package/dist/lib/components/charts/areamap-chart.component.d.ts +3 -0
  81. package/dist/lib/components/charts/bar-chart.component.d.ts +3 -0
  82. package/dist/lib/components/charts/boxplot-chart.component.d.ts +3 -0
  83. package/dist/lib/components/charts/chart.component.d.ts +3 -0
  84. package/dist/lib/components/charts/column-chart.component.d.ts +3 -0
  85. package/dist/lib/components/charts/funnel-chart.component.d.ts +3 -0
  86. package/dist/lib/components/charts/indicator-chart.component.d.ts +3 -0
  87. package/dist/lib/components/charts/line-chart.component.d.ts +3 -0
  88. package/dist/lib/components/charts/pie-chart.component.d.ts +3 -0
  89. package/dist/lib/components/charts/pivot-table.component.d.ts +3 -0
  90. package/dist/lib/components/charts/polar-chart.component.d.ts +3 -0
  91. package/dist/lib/components/charts/scatter-chart.component.d.ts +3 -0
  92. package/dist/lib/components/charts/scattermap-chart.component.d.ts +3 -0
  93. package/dist/lib/components/charts/sunburst-chart.component.d.ts +3 -0
  94. package/dist/lib/components/charts/table.component.d.ts +3 -2
  95. package/dist/lib/components/charts/treemap-chart.component.d.ts +3 -0
  96. package/dist/lib/components/dashboard/dashboard-by-id.component.d.ts +11 -5
  97. package/dist/lib/components/dashboard/dashboard.component.d.ts +8 -2
  98. package/dist/lib/components/drilldown-breadcrumbs.component.d.ts +3 -0
  99. package/dist/lib/components/filters/criteria-filter-tile.component.d.ts +3 -0
  100. package/dist/lib/components/filters/date-range-filter-tile.component.d.ts +3 -0
  101. package/dist/lib/components/filters/member-filter-tile.component.d.ts +3 -0
  102. package/dist/lib/components/filters/relative-date-filter-tile.component.d.ts +3 -0
  103. package/dist/lib/components/widgets/chart-widget.component.d.ts +3 -0
  104. package/dist/lib/components/widgets/index.d.ts +1 -0
  105. package/dist/lib/components/widgets/pivot-table-widget.component.d.ts +127 -0
  106. package/dist/lib/components/widgets/table-widget.component.d.ts +5 -0
  107. package/dist/lib/components/widgets/widget-by-id.component.d.ts +3 -2
  108. package/dist/lib/decorators/index.d.ts +2 -0
  109. package/dist/lib/decorators/trackable.decorator.d.ts +1 -0
  110. package/dist/lib/sdk-ui-core-exports.d.ts +2 -2
  111. package/dist/lib/sdk-ui.module.d.ts +6 -5
  112. package/dist/lib/services/plugins.service.d.ts +1 -1
  113. package/dist/lib/services/query.service.d.ts +29 -3
  114. package/dist/lib/services/sisense-context.service.d.ts +2 -2
  115. package/dist/lib/services/theme.service.d.ts +2 -2
  116. package/dist/lib/types/dashboard-config.d.ts +24 -0
  117. package/dist/lib/types/index.d.ts +1 -0
  118. package/dist/lib/utilities/dashboard-helpers.d.ts +105 -0
  119. package/dist/lib/utilities/dashboard-model-translator.d.ts +47 -0
  120. package/dist/lib/utilities/index.d.ts +23 -0
  121. package/dist/lib/utilities/widget-model-translator.d.ts +289 -0
  122. package/dist/package.json +1 -1
  123. package/dist/public-api.d.ts +5 -22
  124. package/dist/version.d.ts +1 -1
  125. package/package.json +4 -4
@@ -1,35 +1,498 @@
1
1
  import * as i0 from '@angular/core';
2
- import { NgModule } from '@angular/core';
2
+ import { InjectionToken, Injectable, Optional, Inject, Component, ViewChild, Input, NgModule } from '@angular/core';
3
3
  import { CommonModule } from '@angular/common';
4
- import { SdkUiModule } from '@sisense/sdk-ui-angular';
4
+ import * as i1 from '@sisense/sdk-ui-angular';
5
+ import { TrackableService, createSisenseContextConnector, createThemeContextConnector, SdkUiModule } from '@sisense/sdk-ui-angular';
6
+ import { createContextProviderRenderer, ComponentAdapter, createElement } from '@sisense/sdk-ui-preact';
7
+ import { CustomAiContextProvider, ChatRestApi, prepareGetNlgInsightsPayload, DEFAULT_RECOMMENDATIONS_COUNT, widgetComposer, prepareGetNlqResultPayload, Chatbot, GetNlgInsights } from '@sisense/sdk-ui-preact/ai';
8
+ import { __awaiter, __decorate } from 'tslib';
9
+
10
+ const rootId = 'preact';
11
+ const template = `
12
+ <div #${rootId} style="width: 100%; height: 100%"></div>
13
+ `;
5
14
 
6
- /* eslint-disable import/no-extraneous-dependencies */
7
15
  /**
8
- * SDK AI Module
16
+ * Creates AI context connector
9
17
  *
18
+ * @param aiService - The AI service
10
19
  * @internal
11
20
  */
21
+ const createAiContextConnector = (aiService) => {
22
+ return {
23
+ prepareContext() {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const api = yield aiService.getApi();
26
+ return {
27
+ api,
28
+ };
29
+ });
30
+ },
31
+ renderContextProvider: createContextProviderRenderer(CustomAiContextProvider),
32
+ };
33
+ };
34
+
35
+ /**
36
+ * Token used to inject {@link AiContextConfig} into your application.
37
+ *
38
+ * @example
39
+ * Example of importing {@link SdkAiModule} and injecting {@link AiContextConfig} into your application,
40
+ * along with importing dependency {@link SdkUiModule} and injecting {@link SisenseContextConfig} to connect to a Sisense instance:
41
+ *
42
+ * ```ts
43
+ * import { SdkUiModule, SisenseContextConfig } from '@sisense/sdk-ui-angular';
44
+ * import { SdkAiModule, AI_CONTEXT_CONFIG_TOKEN, AiContextConfig } from '@sisense/sdk-ui-angular/ai';
45
+ *
46
+ * const AI_CONTEXT_CONFIG: AiContextConfig = {
47
+ * volatile: true,
48
+ * };
49
+ * const SISENSE_CONTEXT_CONFIG: SisenseContextConfig = {
50
+ * url: "<instance url>", // replace with the URL of your Sisense instance
51
+ * token: "<api token>", // replace with the API token of your user account
52
+ * defaultDataSource: DM.DataSource,
53
+ * };
54
+ *
55
+ * @NgModule({
56
+ * imports: [
57
+ * BrowserModule,
58
+ * SdkUiModule,
59
+ * SdkAiModule,
60
+ * ],
61
+ * declarations: [AppComponent],
62
+ * providers: [
63
+ * { provide: AI_CONTEXT_CONFIG_TOKEN, useValue: AI_CONTEXT_CONFIG },
64
+ * { provide: SISENSE_CONTEXT_CONFIG_TOKEN, useValue: SISENSE_CONTEXT_CONFIG },
65
+ * ],
66
+ * bootstrap: [AppComponent],
67
+ * })
68
+ * ```
69
+ *
70
+ * @group Generative AI
71
+ * @beta
72
+ */
73
+ const AI_CONTEXT_CONFIG_TOKEN = new InjectionToken('AI Context Config');
74
+ /**
75
+ * Service for working with Sisense Fusion Generative AI.
76
+ *
77
+ * ::: warning Note
78
+ * This service is currently under beta release for our managed cloud customers on version L2024.2 or above. It is subject to changes as we make fixes and improvements.
79
+ * :::
80
+ *
81
+ * @group Generative AI
82
+ * @beta
83
+ */
84
+ let AiService = class AiService {
85
+ constructor(sisenseContextService, aiContextConfig) {
86
+ this.sisenseContextService = sisenseContextService;
87
+ this.apiPromise = this.sisenseContextService
88
+ .getApp()
89
+ .then((app) => new ChatRestApi(app.httpClient, aiContextConfig === null || aiContextConfig === void 0 ? void 0 : aiContextConfig.volatile));
90
+ }
91
+ /** @internal */
92
+ getApi() {
93
+ return this.apiPromise;
94
+ }
95
+ /**
96
+ * Fetches an analysis of the provided query using natural language generation (NLG).
97
+ * Specifying NLG parameters is similar to providing parameters to the {@link QueryService.executeQuery} service method, using dimensions, measures, and filters.
98
+ *
99
+ * @param params - Parameters for getting NLG insights
100
+ * @returns NLG insights text summary
101
+ */
102
+ getNlgInsights(params) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ const api = yield this.getApi();
105
+ const payload = prepareGetNlgInsightsPayload(params);
106
+ return api.ai
107
+ .getNlgInsights(payload)
108
+ .then((response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.answer; });
109
+ });
110
+ }
111
+ /**
112
+ * Fetches recommended questions for a data model or perspective.
113
+ *
114
+ * @param params - Parameters for recommendations
115
+ * @returns An array of objects, each containing recommended question text and its corresponding `widgetProps`
116
+ */
117
+ getQueryRecommendations(params) {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ const api = yield this.getApi();
120
+ const { contextTitle, count, enableAxisTitlesInWidgetProps } = params;
121
+ const recCount = count !== null && count !== void 0 ? count : DEFAULT_RECOMMENDATIONS_COUNT;
122
+ const rawRecommendations = (yield api.ai.getQueryRecommendations(contextTitle, { numOfRecommendations: recCount })) ||
123
+ [];
124
+ return rawRecommendations.map((recommendation) => (Object.assign(Object.assign({}, recommendation), { widgetProps: recommendation.jaql
125
+ ? widgetComposer.toWidgetProps(recommendation, {
126
+ useCustomizedStyleOptions: enableAxisTitlesInWidgetProps,
127
+ })
128
+ : undefined })));
129
+ });
130
+ }
131
+ /**
132
+ * Executes a natural language query (NLQ) against a data model or perspective
133
+ *
134
+ * @param params - NLQ query parameters
135
+ * @returns The result as WidgetProps
136
+ */
137
+ getNlqResult(params) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ const { contextTitle, request } = prepareGetNlqResultPayload(params);
140
+ const api = yield this.getApi();
141
+ const data = yield (api === null || api === void 0 ? void 0 : api.ai.getNlqResult(contextTitle, request));
142
+ return data
143
+ ? widgetComposer.toWidgetProps(data, {
144
+ useCustomizedStyleOptions: params.enableAxisTitlesInWidgetProps || false,
145
+ })
146
+ : undefined;
147
+ });
148
+ }
149
+ };
150
+ AiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AiService, deps: [{ token: i1.SisenseContextService }, { token: AI_CONTEXT_CONFIG_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
151
+ AiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AiService, providedIn: 'root' });
152
+ AiService = __decorate([
153
+ TrackableService(['getNlgInsights', 'getQueryRecommendations'])
154
+ ], AiService);
155
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AiService, decorators: [{
156
+ type: Injectable,
157
+ args: [{
158
+ providedIn: 'root',
159
+ }]
160
+ }], ctorParameters: function () {
161
+ return [{ type: i1.SisenseContextService }, { type: undefined, decorators: [{
162
+ type: Optional
163
+ }, {
164
+ type: Inject,
165
+ args: [AI_CONTEXT_CONFIG_TOKEN]
166
+ }] }];
167
+ } });
168
+
169
+ /**
170
+ * An Angular component that renders a chatbot with data topic selection.
171
+ *
172
+ * ::: warning Note
173
+ * This component is currently under beta release for our managed cloud customers on version L2024.2 or above. It is subject to changes as we make fixes and improvements.
174
+ * :::
175
+ *
176
+ * @example
177
+ * An example of using the `ChatbotComponent`:
178
+ *
179
+ * ```html
180
+ <!--Component HTML template in example.component.html-->
181
+ <csdk-chatbot
182
+ [width]="chatbot.width"
183
+ [height]="chatbot.height"
184
+ [config]="chatbot.config"
185
+ />
186
+ * ```
187
+ *
188
+ * ```ts
189
+ // Component behavior in example.component.ts
190
+ import { Component } from '@angular/core';
191
+
192
+ @Component({
193
+ selector: 'example',
194
+ templateUrl: './example.component.html',
195
+ styleUrls: ['./example.component.scss'],
196
+ })
197
+ export class ExampleComponent {
198
+ chatbot = {
199
+ width: '500px',
200
+ height: '700px',
201
+ config: {
202
+ numOfRecommendations: 5,
203
+ },
204
+ };
205
+ }
206
+ * ```
207
+ *
208
+ * <img src="media://angular-chatbot-example.png" width="500px" />
209
+ *
210
+ * @group Generative AI
211
+ * @beta
212
+ */
213
+ class ChatbotComponent {
214
+ /**
215
+ * Constructor for the `ChatbotComponent`.
216
+ *
217
+ * @param sisenseContextService - Sisense context service
218
+ * @param themeService - Theme service
219
+ * @param aiService - AI service
220
+ */
221
+ constructor(
222
+ /**
223
+ * Sisense context service
224
+ *
225
+ * @category Constructor
226
+ */
227
+ sisenseContextService,
228
+ /**
229
+ * Theme service
230
+ *
231
+ * @category Constructor
232
+ */
233
+ themeService,
234
+ /**
235
+ * AI service
236
+ *
237
+ * @category Constructor
238
+ */
239
+ aiService) {
240
+ this.sisenseContextService = sisenseContextService;
241
+ this.themeService = themeService;
242
+ this.aiService = aiService;
243
+ this.componentAdapter = new ComponentAdapter(() => this.createPreactComponent(), [
244
+ createSisenseContextConnector(this.sisenseContextService),
245
+ createThemeContextConnector(this.themeService),
246
+ createAiContextConnector(this.aiService),
247
+ ]);
248
+ }
249
+ /**
250
+ * @internal
251
+ */
252
+ ngAfterViewInit() {
253
+ this.componentAdapter.render(this.preactRef.nativeElement);
254
+ }
255
+ /**
256
+ * @internal
257
+ */
258
+ ngOnChanges() {
259
+ if (this.preactRef) {
260
+ this.componentAdapter.render(this.preactRef.nativeElement);
261
+ }
262
+ }
263
+ createPreactComponent() {
264
+ const props = {
265
+ width: this.width,
266
+ height: this.height,
267
+ config: this.config,
268
+ };
269
+ return createElement(Chatbot, props);
270
+ }
271
+ /**
272
+ * @internal
273
+ */
274
+ ngOnDestroy() {
275
+ this.componentAdapter.destroy();
276
+ }
277
+ }
278
+ ChatbotComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChatbotComponent, deps: [{ token: i1.SisenseContextService }, { token: i1.ThemeService }, { token: AiService }], target: i0.ɵɵFactoryTarget.Component });
279
+ ChatbotComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ChatbotComponent, selector: "csdk-chatbot", inputs: { width: "width", height: "height", config: "config" }, viewQueries: [{ propertyName: "preactRef", first: true, predicate: ["preact"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n <div #preact style=\"width: 100%; height: 100%\"></div>\n", isInline: true });
280
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChatbotComponent, decorators: [{
281
+ type: Component,
282
+ args: [{
283
+ selector: 'csdk-chatbot',
284
+ template,
285
+ }]
286
+ }], ctorParameters: function () { return [{ type: i1.SisenseContextService }, { type: i1.ThemeService }, { type: AiService }]; }, propDecorators: { preactRef: [{
287
+ type: ViewChild,
288
+ args: [rootId]
289
+ }], width: [{
290
+ type: Input
291
+ }], height: [{
292
+ type: Input
293
+ }], config: [{
294
+ type: Input
295
+ }] } });
296
+
297
+ /**
298
+ * An Angular component that fetches and displays a collapsible analysis of the provided query using natural language generation (NLG).
299
+ * Specifying NLG parameters is similar to providing parameters to the {@link QueryService.executeQuery} service method, using dimensions, measures, and filters.
300
+ *
301
+ * ::: warning Note
302
+ * This component is currently under beta release for our managed cloud customers on version L2024.2 or above. It is subject to changes as we make fixes and improvements.
303
+ * :::
304
+ *
305
+ * @example
306
+ * An example of using the `GetNlgInsightsComponent`:
307
+ *
308
+ * ```html
309
+ <!--Component HTML template in example.component.html-->
310
+ <csdk-get-nlg-insights
311
+ [dataSource]="nlgParams.dataSource"
312
+ [dimensions]="nlgParams.dimensions"
313
+ [measures]="nlgParams.measures"
314
+ />
315
+ * ```
316
+ *
317
+ * ```ts
318
+ // Component behavior in example.component.ts
319
+ import { Component } from '@angular/core';
320
+ import { measureFactory } from '@sisense/sdk-data';
321
+ import * as DM from '../../assets/sample-healthcare-model';
322
+
323
+ @Component({
324
+ selector: 'example',
325
+ templateUrl: './example.component.html',
326
+ styleUrls: ['./example.component.scss'],
327
+ })
328
+ export class ExampleComponent {
329
+ nlgParams = {
330
+ dataSource: DM.DataSource.title,
331
+ dimensions: [DM.Divisions.Divison_name],
332
+ measures: [measureFactory.sum(DM.Admissions.Cost_of_admission)],
333
+ };
334
+ }
335
+ * ```
336
+ *
337
+ * <img src="media://angular-get-nlg-insights-example.png" width="700px" />
338
+ *
339
+ * @group Generative AI
340
+ * @beta
341
+ */
342
+ class GetNlgInsightsComponent {
343
+ /**
344
+ * Constructor for the `GetNlgInsightsProps`.
345
+ *
346
+ * @param sisenseContextService - Sisense context service
347
+ * @param themeService - Theme service
348
+ * @param aiService - AI service
349
+ */
350
+ constructor(
351
+ /**
352
+ * Sisense context service
353
+ *
354
+ * @category Constructor
355
+ */
356
+ sisenseContextService,
357
+ /**
358
+ * Theme service
359
+ *
360
+ * @category Constructor
361
+ */
362
+ themeService,
363
+ /**
364
+ * AI service
365
+ *
366
+ * @category Constructor
367
+ */
368
+ aiService) {
369
+ this.sisenseContextService = sisenseContextService;
370
+ this.themeService = themeService;
371
+ this.aiService = aiService;
372
+ this.componentAdapter = new ComponentAdapter(() => this.createPreactComponent(), [
373
+ createSisenseContextConnector(this.sisenseContextService),
374
+ createThemeContextConnector(this.themeService),
375
+ createAiContextConnector(this.aiService),
376
+ ]);
377
+ }
378
+ /**
379
+ * @internal
380
+ */
381
+ ngAfterViewInit() {
382
+ this.componentAdapter.render(this.preactRef.nativeElement);
383
+ }
384
+ /**
385
+ * @internal
386
+ */
387
+ ngOnChanges() {
388
+ if (this.preactRef) {
389
+ this.componentAdapter.render(this.preactRef.nativeElement);
390
+ }
391
+ }
392
+ createPreactComponent() {
393
+ const props = {
394
+ dataSource: this.dataSource,
395
+ dimensions: this.dimensions,
396
+ measures: this.measures,
397
+ filters: this.filters,
398
+ verbosity: this.verbosity,
399
+ };
400
+ return createElement(GetNlgInsights, props);
401
+ }
402
+ /**
403
+ * @internal
404
+ */
405
+ ngOnDestroy() {
406
+ this.componentAdapter.destroy();
407
+ }
408
+ }
409
+ GetNlgInsightsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GetNlgInsightsComponent, deps: [{ token: i1.SisenseContextService }, { token: i1.ThemeService }, { token: AiService }], target: i0.ɵɵFactoryTarget.Component });
410
+ GetNlgInsightsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: GetNlgInsightsComponent, selector: "csdk-get-nlg-insights", inputs: { dataSource: "dataSource", dimensions: "dimensions", measures: "measures", filters: "filters", verbosity: "verbosity" }, viewQueries: [{ propertyName: "preactRef", first: true, predicate: ["preact"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n <div #preact style=\"width: 100%; height: 100%\"></div>\n", isInline: true });
411
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GetNlgInsightsComponent, decorators: [{
412
+ type: Component,
413
+ args: [{
414
+ selector: 'csdk-get-nlg-insights',
415
+ template,
416
+ }]
417
+ }], ctorParameters: function () { return [{ type: i1.SisenseContextService }, { type: i1.ThemeService }, { type: AiService }]; }, propDecorators: { preactRef: [{
418
+ type: ViewChild,
419
+ args: [rootId]
420
+ }], dataSource: [{
421
+ type: Input
422
+ }], dimensions: [{
423
+ type: Input
424
+ }], measures: [{
425
+ type: Input
426
+ }], filters: [{
427
+ type: Input
428
+ }], verbosity: [{
429
+ type: Input
430
+ }] } });
431
+
432
+ /* eslint-disable import/no-extraneous-dependencies */
433
+ /**
434
+ * SDK AI Module, which is a container for generative AI components and services.
435
+ *
436
+ * @example
437
+ * Example of importing {@link SdkAiModule} and injecting {@link AiContextConfig} into your application,
438
+ * along with importing dependency {@link SdkUiModule} and injecting {@link SisenseContextConfig} to connect to a Sisense instance:
439
+ *
440
+ * ```ts
441
+ * import { SdkUiModule, SisenseContextConfig } from '@sisense/sdk-ui-angular';
442
+ * import { SdkAiModule, AI_CONTEXT_CONFIG_TOKEN, AiContextConfig } from '@sisense/sdk-ui-angular/ai';
443
+ *
444
+ * const AI_CONTEXT_CONFIG: AiContextConfig = {
445
+ * volatile: true,
446
+ * };
447
+ * const SISENSE_CONTEXT_CONFIG: SisenseContextConfig = {
448
+ * url: "<instance url>", // replace with the URL of your Sisense instance
449
+ * token: "<api token>", // replace with the API token of your user account
450
+ * defaultDataSource: DM.DataSource,
451
+ * };
452
+ *
453
+ * @NgModule({
454
+ * imports: [
455
+ * BrowserModule,
456
+ * SdkUiModule,
457
+ * SdkAiModule,
458
+ * ],
459
+ * declarations: [AppComponent],
460
+ * providers: [
461
+ * { provide: AI_CONTEXT_CONFIG_TOKEN, useValue: AI_CONTEXT_CONFIG },
462
+ * { provide: SISENSE_CONTEXT_CONFIG_TOKEN, useValue: SISENSE_CONTEXT_CONFIG },
463
+ * ],
464
+ * bootstrap: [AppComponent],
465
+ * })
466
+ * ```
467
+ *
468
+ * @group Generative AI
469
+ * @beta
470
+ */
12
471
  class SdkAiModule {
13
472
  constructor() {
14
473
  console.log('SdkAiModule loaded');
15
474
  }
16
475
  }
17
476
  SdkAiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SdkAiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
18
- SdkAiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: SdkAiModule, imports: [CommonModule, SdkUiModule] });
477
+ SdkAiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: SdkAiModule, declarations: [ChatbotComponent, GetNlgInsightsComponent], imports: [CommonModule, SdkUiModule], exports: [ChatbotComponent, GetNlgInsightsComponent] });
19
478
  SdkAiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SdkAiModule, imports: [CommonModule, SdkUiModule] });
20
479
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SdkAiModule, decorators: [{
21
480
  type: NgModule,
22
481
  args: [{
23
- declarations: [],
482
+ declarations: [ChatbotComponent, GetNlgInsightsComponent],
24
483
  imports: [CommonModule, SdkUiModule],
25
- exports: [],
484
+ exports: [ChatbotComponent, GetNlgInsightsComponent],
26
485
  providers: [],
27
486
  }]
28
487
  }], ctorParameters: function () { return []; } });
29
488
 
489
+ /**
490
+ * Public API Surface of @sisense/sdk-ui-angular/ai
491
+ */
492
+
30
493
  /**
31
494
  * Generated bundle index. Do not edit.
32
495
  */
33
496
 
34
- export { SdkAiModule };
497
+ export { AI_CONTEXT_CONFIG_TOKEN, AiService, ChatbotComponent, GetNlgInsightsComponent, SdkAiModule };
35
498
  //# sourceMappingURL=sisense-sdk-ui-angular-ai.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"sisense-sdk-ui-angular-ai.mjs","sources":["../../src/ai/lib/sdk-ai.module.ts","../../src/ai/sisense-sdk-ui-angular-ai.ts"],"sourcesContent":["/* eslint-disable import/no-extraneous-dependencies */\nimport { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { SdkUiModule } from '@sisense/sdk-ui-angular';\n\n/**\n * SDK AI Module\n *\n * @internal\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule, SdkUiModule],\n exports: [],\n providers: [],\n})\nexport class SdkAiModule {\n constructor() {\n console.log('SdkAiModule loaded');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;AAKA;;;;AAIG;MAOU,WAAW,CAAA;AACtB,IAAA,WAAA,GAAA;AACE,QAAA,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;KACnC;;yGAHU,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;0GAAX,WAAW,EAAA,OAAA,EAAA,CAJZ,YAAY,EAAE,WAAW,CAAA,EAAA,CAAA,CAAA;0GAIxB,WAAW,EAAA,OAAA,EAAA,CAJZ,YAAY,EAAE,WAAW,CAAA,EAAA,CAAA,CAAA;4FAIxB,WAAW,EAAA,UAAA,EAAA,CAAA;kBANvB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;AACpC,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,SAAS,EAAE,EAAE;iBACd,CAAA;;;ACfD;;AAEG;;;;"}
1
+ {"version":3,"file":"sisense-sdk-ui-angular-ai.mjs","sources":["../../src/ai/lib/component-wrapper-helpers/template.ts","../../src/ai/lib/component-wrapper-helpers/context-connectors.ts","../../src/ai/lib/services/ai.service.ts","../../src/ai/lib/components/chatbot.component.ts","../../src/ai/lib/components/get-nlg-insights.component.ts","../../src/ai/lib/sdk-ai.module.ts","../../src/ai/public-api.ts","../../src/ai/sisense-sdk-ui-angular-ai.ts"],"sourcesContent":["export const rootId = 'preact';\nexport const template = `\n <div #${rootId} style=\"width: 100%; height: 100%\"></div>\n`;\n","import { ContextConnector, createContextProviderRenderer } from '@sisense/sdk-ui-preact';\nimport { CustomAiContextProvider, CustomAiContext } from '@sisense/sdk-ui-preact/ai';\nimport { AiService } from '../services/ai.service';\n\n/**\n * Creates AI context connector\n *\n * @param aiService - The AI service\n * @internal\n */\nexport const createAiContextConnector = (\n aiService: AiService,\n): ContextConnector<CustomAiContext> => {\n return {\n async prepareContext() {\n const api = await aiService.getApi();\n return {\n api,\n };\n },\n renderContextProvider: createContextProviderRenderer(CustomAiContextProvider),\n };\n};\n","import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';\nimport {\n ChatRestApi,\n UseGetNlgInsightsParams,\n prepareGetNlgInsightsPayload,\n GetQueryRecommendationsParams,\n AiContextProviderProps,\n GetNlgInsightsResponse,\n QueryRecommendation,\n GetNlqResultParams,\n DEFAULT_RECOMMENDATIONS_COUNT,\n widgetComposer,\n prepareGetNlqResultPayload,\n} from '@sisense/sdk-ui-preact/ai';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { SisenseContextService, TrackableService, WidgetProps } from '@sisense/sdk-ui-angular';\n\nexport interface AiContextConfig extends Omit<AiContextProviderProps, 'children'> {}\nexport interface GetNlgInsightsParams extends Omit<UseGetNlgInsightsParams, 'enabled'> {}\n\n/**\n * Token used to inject {@link AiContextConfig} into your application.\n *\n * @example\n * Example of importing {@link SdkAiModule} and injecting {@link AiContextConfig} into your application,\n * along with importing dependency {@link SdkUiModule} and injecting {@link SisenseContextConfig} to connect to a Sisense instance:\n *\n * ```ts\n * import { SdkUiModule, SisenseContextConfig } from '@sisense/sdk-ui-angular';\n * import { SdkAiModule, AI_CONTEXT_CONFIG_TOKEN, AiContextConfig } from '@sisense/sdk-ui-angular/ai';\n *\n * const AI_CONTEXT_CONFIG: AiContextConfig = {\n * volatile: true,\n * };\n * const SISENSE_CONTEXT_CONFIG: SisenseContextConfig = {\n * url: \"<instance url>\", // replace with the URL of your Sisense instance\n * token: \"<api token>\", // replace with the API token of your user account\n * defaultDataSource: DM.DataSource,\n * };\n *\n * @NgModule({\n * imports: [\n * BrowserModule,\n * SdkUiModule,\n * SdkAiModule,\n * ],\n * declarations: [AppComponent],\n * providers: [\n * { provide: AI_CONTEXT_CONFIG_TOKEN, useValue: AI_CONTEXT_CONFIG },\n * { provide: SISENSE_CONTEXT_CONFIG_TOKEN, useValue: SISENSE_CONTEXT_CONFIG },\n * ],\n * bootstrap: [AppComponent],\n * })\n * ```\n *\n * @group Generative AI\n * @beta\n */\nexport const AI_CONTEXT_CONFIG_TOKEN = new InjectionToken<AiContextConfig>('AI Context Config');\n\n/**\n * Service for working with Sisense Fusion Generative AI.\n *\n * ::: warning Note\n * This service is currently under beta release for our managed cloud customers on version L2024.2 or above. It is subject to changes as we make fixes and improvements.\n * :::\n *\n * @group Generative AI\n * @beta\n */\n@Injectable({\n providedIn: 'root',\n})\n@TrackableService<AiService>(['getNlgInsights', 'getQueryRecommendations'])\nexport class AiService {\n private apiPromise: Promise<ChatRestApi>;\n\n constructor(\n private sisenseContextService: SisenseContextService,\n @Optional() @Inject(AI_CONTEXT_CONFIG_TOKEN) aiContextConfig?: AiContextConfig,\n ) {\n this.apiPromise = this.sisenseContextService\n .getApp()\n .then((app) => new ChatRestApi(app.httpClient, aiContextConfig?.volatile));\n }\n\n /** @internal */\n getApi(): Promise<ChatRestApi> {\n return this.apiPromise;\n }\n\n /**\n * Fetches an analysis of the provided query using natural language generation (NLG).\n * Specifying NLG parameters is similar to providing parameters to the {@link QueryService.executeQuery} service method, using dimensions, measures, and filters.\n *\n * @param params - Parameters for getting NLG insights\n * @returns NLG insights text summary\n */\n async getNlgInsights(params: GetNlgInsightsParams): Promise<string | undefined> {\n const api = await this.getApi();\n const payload = prepareGetNlgInsightsPayload(params);\n return api.ai\n .getNlgInsights(payload)\n .then((response?: GetNlgInsightsResponse) => response?.data?.answer);\n }\n\n /**\n * Fetches recommended questions for a data model or perspective.\n *\n * @param params - Parameters for recommendations\n * @returns An array of objects, each containing recommended question text and its corresponding `widgetProps`\n */\n async getQueryRecommendations(\n params: GetQueryRecommendationsParams,\n ): Promise<QueryRecommendation[]> {\n const api = await this.getApi();\n const { contextTitle, count, enableAxisTitlesInWidgetProps } = params;\n const recCount = count ?? DEFAULT_RECOMMENDATIONS_COUNT;\n\n const rawRecommendations =\n (await api.ai.getQueryRecommendations(contextTitle, { numOfRecommendations: recCount })) ||\n [];\n\n return rawRecommendations.map(\n (recommendation: QueryRecommendation) =>\n ({\n ...recommendation,\n widgetProps: recommendation.jaql\n ? widgetComposer.toWidgetProps(recommendation, {\n useCustomizedStyleOptions: enableAxisTitlesInWidgetProps,\n })\n : undefined,\n } as QueryRecommendation),\n );\n }\n\n /**\n * Executes a natural language query (NLQ) against a data model or perspective\n *\n * @param params - NLQ query parameters\n * @returns The result as WidgetProps\n */\n async getNlqResult(params: GetNlqResultParams): Promise<WidgetProps | undefined> {\n const { contextTitle, request } = prepareGetNlqResultPayload(params);\n const api = await this.getApi();\n\n const data = await api?.ai.getNlqResult(contextTitle, request);\n\n return data\n ? widgetComposer.toWidgetProps(data, {\n useCustomizedStyleOptions: params.enableAxisTitlesInWidgetProps || false,\n })\n : undefined;\n }\n}\n","import {\n AfterViewInit,\n Component,\n ElementRef,\n Input,\n OnChanges,\n OnDestroy,\n ViewChild,\n} from '@angular/core';\nimport { ComponentAdapter, createElement } from '@sisense/sdk-ui-preact';\nimport { Chatbot, type ChatbotProps as ChatbotPropsPreact } from '@sisense/sdk-ui-preact/ai';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {\n SisenseContextService,\n ThemeService,\n createSisenseContextConnector,\n createThemeContextConnector,\n} from '@sisense/sdk-ui-angular';\nimport { template, rootId } from '../component-wrapper-helpers/template';\nimport { AiService } from '../services/ai.service';\nimport { createAiContextConnector } from '../component-wrapper-helpers';\n\n/**\n * Props of the {@link ChatbotComponent}.\n */\nexport interface ChatbotProps extends ChatbotPropsPreact {}\n\n/**\n * An Angular component that renders a chatbot with data topic selection.\n *\n * ::: warning Note\n * This component is currently under beta release for our managed cloud customers on version L2024.2 or above. It is subject to changes as we make fixes and improvements.\n * :::\n *\n * @example\n * An example of using the `ChatbotComponent`:\n *\n * ```html\n<!--Component HTML template in example.component.html-->\n<csdk-chatbot\n [width]=\"chatbot.width\"\n [height]=\"chatbot.height\"\n [config]=\"chatbot.config\"\n/>\n * ```\n *\n * ```ts\n// Component behavior in example.component.ts\nimport { Component } from '@angular/core';\n\n@Component({\n selector: 'example',\n templateUrl: './example.component.html',\n styleUrls: ['./example.component.scss'],\n})\nexport class ExampleComponent {\n chatbot = {\n width: '500px',\n height: '700px',\n config: {\n numOfRecommendations: 5,\n },\n };\n}\n * ```\n *\n * <img src=\"media://angular-chatbot-example.png\" width=\"500px\" />\n *\n * @group Generative AI\n * @beta\n */\n@Component({\n selector: 'csdk-chatbot',\n template,\n})\nexport class ChatbotComponent implements AfterViewInit, OnChanges, OnDestroy {\n /**\n * @internal\n */\n @ViewChild(rootId)\n preactRef!: ElementRef<HTMLDivElement>;\n\n /**\n * {@inheritDoc @sisense/sdk-ui!ChatbotProps.width}\n */\n @Input()\n width: ChatbotProps['width'];\n\n /**\n * {@inheritDoc @sisense/sdk-ui!ChatbotProps.height}\n */\n @Input()\n height: ChatbotProps['height'];\n\n /**\n * {@inheritDoc @sisense/sdk-ui!ChatbotProps.config}\n */\n @Input()\n config: ChatbotProps['config'];\n\n private componentAdapter: ComponentAdapter;\n\n /**\n * Constructor for the `ChatbotComponent`.\n *\n * @param sisenseContextService - Sisense context service\n * @param themeService - Theme service\n * @param aiService - AI service\n */\n constructor(\n /**\n * Sisense context service\n *\n * @category Constructor\n */\n public sisenseContextService: SisenseContextService,\n /**\n * Theme service\n *\n * @category Constructor\n */\n public themeService: ThemeService,\n /**\n * AI service\n *\n * @category Constructor\n */\n public aiService: AiService,\n ) {\n this.componentAdapter = new ComponentAdapter(\n () => this.createPreactComponent(),\n [\n createSisenseContextConnector(this.sisenseContextService),\n createThemeContextConnector(this.themeService),\n createAiContextConnector(this.aiService),\n ],\n );\n }\n\n /**\n * @internal\n */\n ngAfterViewInit() {\n this.componentAdapter.render(this.preactRef.nativeElement);\n }\n\n /**\n * @internal\n */\n ngOnChanges() {\n if (this.preactRef) {\n this.componentAdapter.render(this.preactRef.nativeElement);\n }\n }\n\n private createPreactComponent() {\n const props = {\n width: this.width,\n height: this.height,\n config: this.config,\n };\n\n return createElement(Chatbot, props);\n }\n\n /**\n * @internal\n */\n ngOnDestroy() {\n this.componentAdapter.destroy();\n }\n}\n","import {\n AfterViewInit,\n Component,\n ElementRef,\n Input,\n OnChanges,\n OnDestroy,\n ViewChild,\n} from '@angular/core';\nimport { ComponentAdapter, createElement } from '@sisense/sdk-ui-preact';\nimport {\n GetNlgInsights,\n type GetNlgInsightsProps as GetNlgInsightsPropsPreact,\n} from '@sisense/sdk-ui-preact/ai';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {\n SisenseContextService,\n ThemeService,\n createSisenseContextConnector,\n createThemeContextConnector,\n} from '@sisense/sdk-ui-angular';\nimport { AiService } from '../services/ai.service';\nimport { createAiContextConnector } from '../component-wrapper-helpers';\nimport { template, rootId } from '../component-wrapper-helpers/template';\n\n/**\n * Props of the {@link GetNlgInsightsComponent}.\n */\nexport interface GetNlgInsightsProps extends GetNlgInsightsPropsPreact {}\n\n/**\n * An Angular component that fetches and displays a collapsible analysis of the provided query using natural language generation (NLG).\n * Specifying NLG parameters is similar to providing parameters to the {@link QueryService.executeQuery} service method, using dimensions, measures, and filters.\n *\n * ::: warning Note\n * This component is currently under beta release for our managed cloud customers on version L2024.2 or above. It is subject to changes as we make fixes and improvements.\n * :::\n *\n * @example\n * An example of using the `GetNlgInsightsComponent`:\n *\n * ```html\n<!--Component HTML template in example.component.html-->\n<csdk-get-nlg-insights\n [dataSource]=\"nlgParams.dataSource\"\n [dimensions]=\"nlgParams.dimensions\"\n [measures]=\"nlgParams.measures\"\n/>\n * ```\n *\n * ```ts\n// Component behavior in example.component.ts\nimport { Component } from '@angular/core';\nimport { measureFactory } from '@sisense/sdk-data';\nimport * as DM from '../../assets/sample-healthcare-model';\n\n@Component({\n selector: 'example',\n templateUrl: './example.component.html',\n styleUrls: ['./example.component.scss'],\n})\nexport class ExampleComponent {\n nlgParams = {\n dataSource: DM.DataSource.title,\n dimensions: [DM.Divisions.Divison_name],\n measures: [measureFactory.sum(DM.Admissions.Cost_of_admission)],\n };\n}\n * ```\n *\n * <img src=\"media://angular-get-nlg-insights-example.png\" width=\"700px\" />\n *\n * @group Generative AI\n * @beta\n */\n@Component({\n selector: 'csdk-get-nlg-insights',\n template,\n})\nexport class GetNlgInsightsComponent implements AfterViewInit, OnChanges, OnDestroy {\n /**\n * @internal\n */\n @ViewChild(rootId)\n preactRef!: ElementRef<HTMLDivElement>;\n\n /**\n * {@inheritDoc @sisense/sdk-ui!GetNlgInsightsProps.dataSource}\n */\n @Input()\n dataSource!: GetNlgInsightsProps['dataSource'];\n\n /**\n * {@inheritDoc @sisense/sdk-ui!GetNlgInsightsProps.dimensions}\n */\n @Input()\n dimensions: GetNlgInsightsProps['dimensions'];\n\n /**\n * {@inheritDoc @sisense/sdk-ui!GetNlgInsightsProps.measures}\n */\n @Input()\n measures: GetNlgInsightsProps['measures'];\n\n /**\n * {@inheritDoc @sisense/sdk-ui!GetNlgInsightsProps.filters}\n */\n @Input()\n filters: GetNlgInsightsProps['filters'];\n\n /**\n * {@inheritDoc @sisense/sdk-ui!GetNlgInsightsProps.verbosity}\n */\n @Input()\n verbosity: GetNlgInsightsProps['verbosity'];\n\n private componentAdapter: ComponentAdapter;\n\n /**\n * Constructor for the `GetNlgInsightsProps`.\n *\n * @param sisenseContextService - Sisense context service\n * @param themeService - Theme service\n * @param aiService - AI service\n */\n constructor(\n /**\n * Sisense context service\n *\n * @category Constructor\n */\n public sisenseContextService: SisenseContextService,\n /**\n * Theme service\n *\n * @category Constructor\n */\n public themeService: ThemeService,\n /**\n * AI service\n *\n * @category Constructor\n */\n public aiService: AiService,\n ) {\n this.componentAdapter = new ComponentAdapter(\n () => this.createPreactComponent(),\n [\n createSisenseContextConnector(this.sisenseContextService),\n createThemeContextConnector(this.themeService),\n createAiContextConnector(this.aiService),\n ],\n );\n }\n\n /**\n * @internal\n */\n ngAfterViewInit() {\n this.componentAdapter.render(this.preactRef.nativeElement);\n }\n\n /**\n * @internal\n */\n ngOnChanges() {\n if (this.preactRef) {\n this.componentAdapter.render(this.preactRef.nativeElement);\n }\n }\n\n private createPreactComponent() {\n const props = {\n dataSource: this.dataSource,\n dimensions: this.dimensions,\n measures: this.measures,\n filters: this.filters,\n verbosity: this.verbosity,\n };\n\n return createElement(GetNlgInsights, props);\n }\n\n /**\n * @internal\n */\n ngOnDestroy() {\n this.componentAdapter.destroy();\n }\n}\n","/* eslint-disable import/no-extraneous-dependencies */\nimport { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { SdkUiModule } from '@sisense/sdk-ui-angular';\nimport { ChatbotComponent, GetNlgInsightsComponent } from './components';\n\n/**\n * SDK AI Module, which is a container for generative AI components and services.\n *\n * @example\n * Example of importing {@link SdkAiModule} and injecting {@link AiContextConfig} into your application,\n * along with importing dependency {@link SdkUiModule} and injecting {@link SisenseContextConfig} to connect to a Sisense instance:\n *\n * ```ts\n * import { SdkUiModule, SisenseContextConfig } from '@sisense/sdk-ui-angular';\n * import { SdkAiModule, AI_CONTEXT_CONFIG_TOKEN, AiContextConfig } from '@sisense/sdk-ui-angular/ai';\n *\n * const AI_CONTEXT_CONFIG: AiContextConfig = {\n * volatile: true,\n * };\n * const SISENSE_CONTEXT_CONFIG: SisenseContextConfig = {\n * url: \"<instance url>\", // replace with the URL of your Sisense instance\n * token: \"<api token>\", // replace with the API token of your user account\n * defaultDataSource: DM.DataSource,\n * };\n *\n * @NgModule({\n * imports: [\n * BrowserModule,\n * SdkUiModule,\n * SdkAiModule,\n * ],\n * declarations: [AppComponent],\n * providers: [\n * { provide: AI_CONTEXT_CONFIG_TOKEN, useValue: AI_CONTEXT_CONFIG },\n * { provide: SISENSE_CONTEXT_CONFIG_TOKEN, useValue: SISENSE_CONTEXT_CONFIG },\n * ],\n * bootstrap: [AppComponent],\n * })\n * ```\n *\n * @group Generative AI\n * @beta\n */\n@NgModule({\n declarations: [ChatbotComponent, GetNlgInsightsComponent],\n imports: [CommonModule, SdkUiModule],\n exports: [ChatbotComponent, GetNlgInsightsComponent],\n providers: [],\n})\nexport class SdkAiModule {\n constructor() {\n console.log('SdkAiModule loaded');\n }\n}\n","/**\n * Public API Surface of @sisense/sdk-ui-angular/ai\n */\n\nexport * from './lib/sdk-ai.module';\nexport * from './lib/components';\nexport * from './lib/services';\nexport * from './lib/sdk-ui-core-exports';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i2.AiService"],"mappings":";;;;;;;;;AAAO,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,MAAM,QAAQ,GAAG,CAAA;YACZ,MAAM,CAAA;CACjB;;ACCD;;;;;AAKG;AACI,MAAM,wBAAwB,GAAG,CACtC,SAAoB,KACiB;IACrC,OAAO;QACC,cAAc,GAAA;;AAClB,gBAAA,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,MAAM,EAAE,CAAC;gBACrC,OAAO;oBACL,GAAG;iBACJ,CAAC;aACH,CAAA,CAAA;AAAA,SAAA;AACD,QAAA,qBAAqB,EAAE,6BAA6B,CAAC,uBAAuB,CAAC;KAC9E,CAAC;AACJ,CAAC;;ACFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCG;MACU,uBAAuB,GAAG,IAAI,cAAc,CAAkB,mBAAmB,EAAE;AAEhG;;;;;;;;;AASG;AAKU,IAAA,SAAS,GAAf,MAAM,SAAS,CAAA;IAGpB,WACU,CAAA,qBAA4C,EACP,eAAiC,EAAA;AADtE,QAAA,IAAqB,CAAA,qBAAA,GAArB,qBAAqB,CAAuB;AAGpD,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,qBAAqB;AACzC,aAAA,MAAM,EAAE;aACR,IAAI,CAAC,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,eAAe,aAAf,eAAe,KAAA,KAAA,CAAA,GAAA,KAAA,C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