@sisense/sdk-ui-angular 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm2020/ai/lib/services/ai.service.mjs +6 -4
- package/dist/esm2020/lib/components/dashboard/dashboard-by-id.component.mjs +2 -2
- package/dist/esm2020/lib/components/dashboard/dashboard.component.mjs +2 -2
- package/dist/esm2020/lib/decorators/trackable.decorator.mjs +2 -2
- package/dist/esm2020/lib/services/theme.service.mjs +8 -4
- package/dist/esm2020/version.mjs +2 -2
- package/dist/fesm2015/sisense-sdk-ui-angular-ai.mjs +2 -3
- package/dist/fesm2015/sisense-sdk-ui-angular-ai.mjs.map +1 -1
- package/dist/fesm2015/sisense-sdk-ui-angular.mjs +9 -5
- package/dist/fesm2015/sisense-sdk-ui-angular.mjs.map +1 -1
- package/dist/fesm2020/sisense-sdk-ui-angular-ai.mjs +5 -3
- package/dist/fesm2020/sisense-sdk-ui-angular-ai.mjs.map +1 -1
- package/dist/fesm2020/sisense-sdk-ui-angular.mjs +9 -5
- package/dist/fesm2020/sisense-sdk-ui-angular.mjs.map +1 -1
- package/dist/lib/decorators/trackable.decorator.d.ts +2 -0
- package/dist/lib/services/theme.service.d.ts +1 -0
- package/dist/package.json +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +4 -4
|
@@ -118,10 +118,12 @@ let AiService = class AiService {
|
|
|
118
118
|
*/
|
|
119
119
|
async getQueryRecommendations(params) {
|
|
120
120
|
const api = await this.getApi();
|
|
121
|
-
const { contextTitle, count, enableAxisTitlesInWidgetProps } = params;
|
|
121
|
+
const { contextTitle, count, enableAxisTitlesInWidgetProps, customPrompt } = params;
|
|
122
122
|
const recCount = count ?? DEFAULT_RECOMMENDATIONS_COUNT;
|
|
123
|
-
const rawRecommendations = (await api.ai.getQueryRecommendations(contextTitle, {
|
|
124
|
-
|
|
123
|
+
const rawRecommendations = (await api.ai.getQueryRecommendations(contextTitle, {
|
|
124
|
+
numOfRecommendations: recCount,
|
|
125
|
+
...(customPrompt ? { userPrompt: customPrompt } : undefined),
|
|
126
|
+
})) || [];
|
|
125
127
|
return rawRecommendations.map((recommendation) => ({
|
|
126
128
|
...recommendation,
|
|
127
129
|
widgetProps: recommendation.jaql
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sisense-sdk-ui-angular-ai.mjs","sources":["../../src/ai/lib/component-wrapper-helpers/context-connectors.ts","../../src/ai/lib/component-wrapper-helpers/template.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/lib/sdk-ui-core-exports.ts","../../src/ai/public-api.ts","../../src/ai/sisense-sdk-ui-angular-ai.ts"],"sourcesContent":["import { ContextConnector, DataObserver } from '@sisense/sdk-ui-preact';\nimport { CustomAiContextProvider, CustomAiContextProviderProps } from '@sisense/sdk-ui-preact/ai';\n\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<CustomAiContextProviderProps> => {\n const propsObserver = new DataObserver<CustomAiContextProviderProps>();\n\n aiService\n .getApi()\n .then((api) =>\n propsObserver.setValue({\n context: {\n api,\n },\n }),\n )\n .catch((error) =>\n propsObserver.setValue({\n error,\n }),\n );\n\n return {\n propsObserver,\n providerComponent: CustomAiContextProvider,\n };\n};\n","export const rootId = 'preact';\nexport const template = `\n <div #${rootId} class=\"csdk-full-size-container\"></div>\n`;\nexport const styles = [\n `.csdk-full-size-container {\n width: 100%;\n height: 100%;\n }`,\n];\n","import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { SisenseContextService, TrackableService, WidgetProps } from '@sisense/sdk-ui-angular';\nimport {\n AiContextProviderProps,\n ChatRestApi,\n DEFAULT_RECOMMENDATIONS_COUNT,\n GetNlgInsightsResponse,\n GetNlqResultParams,\n GetQueryRecommendationsParams,\n prepareGetNlgInsightsPayload,\n prepareGetNlqResultPayload,\n QueryRecommendation as QueryRecommendationPreact,\n UseGetNlgInsightsParams,\n widgetComposer,\n} from '@sisense/sdk-ui-preact/ai';\n\nexport interface AiContextConfig extends Omit<AiContextProviderProps, 'children'> {}\nexport interface GetNlgInsightsParams extends Omit<UseGetNlgInsightsParams, 'enabled'> {}\n\n/**\n * {@inheritDoc @sisense/sdk-ui!QueryRecommendation}\n */\nexport interface QueryRecommendation extends Omit<QueryRecommendationPreact, 'widgetProps'> {\n /**\n * {@inheritDoc @sisense/sdk-ui!QueryRecommendation.widgetProps}\n */\n widgetProps?: WidgetProps;\n}\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 * @group Generative AI\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 * @group Generative AI\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 * @beta\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 * @beta\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 }) as WidgetProps)\n : undefined;\n }\n}\n","import {\n AfterViewInit,\n Component,\n ElementRef,\n Input,\n OnChanges,\n OnDestroy,\n ViewChild,\n} from '@angular/core';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {\n createSisenseContextConnector,\n createThemeContextConnector,\n SisenseContextService,\n ThemeService,\n} from '@sisense/sdk-ui-angular';\nimport { ComponentAdapter } from '@sisense/sdk-ui-preact';\nimport {\n Chatbot as ChatbotPreact,\n type ChatbotProps as ChatbotPropsPreact,\n} from '@sisense/sdk-ui-preact/ai';\n\nimport { createAiContextConnector, rootId, styles, template } from '../component-wrapper-helpers';\nimport { AiService } from '../services/ai.service';\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 * @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 * @group Generative AI\n */\n@Component({\n selector: 'csdk-chatbot',\n template,\n styles,\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<typeof ChatbotPreact>;\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(ChatbotPreact, [\n createSisenseContextConnector(this.sisenseContextService),\n createThemeContextConnector(this.themeService),\n createAiContextConnector(this.aiService),\n ]);\n }\n\n /**\n * @internal\n */\n ngAfterViewInit() {\n this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());\n }\n\n /**\n * @internal\n */\n ngOnChanges() {\n if (this.preactRef) {\n this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());\n }\n }\n\n private getPreactComponentProps(): ChatbotPropsPreact {\n return {\n width: this.width,\n height: this.height,\n config: this.config,\n };\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';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {\n createSisenseContextConnector,\n createThemeContextConnector,\n SisenseContextService,\n ThemeService,\n} from '@sisense/sdk-ui-angular';\nimport { ComponentAdapter } from '@sisense/sdk-ui-preact';\nimport {\n GetNlgInsights as GetNlgInsightsPreact,\n type GetNlgInsightsProps as GetNlgInsightsPropsPreact,\n} from '@sisense/sdk-ui-preact/ai';\n\nimport { createAiContextConnector, rootId, styles, template } from '../component-wrapper-helpers';\nimport { AiService } from '../services/ai.service';\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 * @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 * @group Generative AI\n */\n@Component({\n selector: 'csdk-get-nlg-insights',\n template,\n styles,\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<typeof GetNlgInsightsPreact>;\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(GetNlgInsightsPreact, [\n createSisenseContextConnector(this.sisenseContextService),\n createThemeContextConnector(this.themeService),\n createAiContextConnector(this.aiService),\n ]);\n }\n\n /**\n * @internal\n */\n ngAfterViewInit() {\n this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());\n }\n\n /**\n * @internal\n */\n ngOnChanges() {\n if (this.preactRef) {\n this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());\n }\n }\n\n private getPreactComponentProps(): GetNlgInsightsPropsPreact {\n return {\n dataSource: this.dataSource,\n dimensions: this.dimensions,\n measures: this.measures,\n filters: this.filters,\n verbosity: this.verbosity,\n };\n }\n\n /**\n * @internal\n */\n ngOnDestroy() {\n this.componentAdapter.destroy();\n }\n}\n","/* eslint-disable import/no-extraneous-dependencies */\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { SdkUiModule } from '@sisense/sdk-ui-angular';\n\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 * @group Generative AI\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","// This file re-exports common types/utils from @sisense/sdk-ui-preact/ai\n\n// Re-exports types from @sisense/sdk-ui-preact/ai\nexport type {\n ChatConfig,\n GetNlqResultParams,\n GetQueryRecommendationsParams,\n} from '@sisense/sdk-ui-preact/ai';\n","/**\n * Public API Surface of @sisense/sdk-ui-angular/ai\n */\n\nexport * from './lib/components';\nexport * from './lib/sdk-ai.module';\nexport * from './lib/sdk-ui-core-exports';\nexport * from './lib/services';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["ChatbotPreact","i2.AiService","GetNlgInsightsPreact"],"mappings":";;;;;;;;;AAKA;;;;;AAKG;AACI,MAAM,wBAAwB,GAAG,CACtC,SAAoB,KAC8B;AAClD,IAAA,MAAM,aAAa,GAAG,IAAI,YAAY,EAAgC,CAAC;IAEvE,SAAS;AACN,SAAA,MAAM,EAAE;SACR,IAAI,CAAC,CAAC,GAAG,KACR,aAAa,CAAC,QAAQ,CAAC;AACrB,QAAA,OAAO,EAAE;YACP,GAAG;AACJ,SAAA;AACF,KAAA,CAAC,CACH;SACA,KAAK,CAAC,CAAC,KAAK,KACX,aAAa,CAAC,QAAQ,CAAC;QACrB,KAAK;AACN,KAAA,CAAC,CACH,CAAC;IAEJ,OAAO;QACL,aAAa;AACb,QAAA,iBAAiB,EAAE,uBAAuB;KAC3C,CAAC;AACJ,CAAC;;ACnCM,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,MAAM,QAAQ,GAAG,CAAA;YACZ,MAAM,CAAA;CACjB,CAAC;AACK,MAAM,MAAM,GAAG;AACpB,IAAA,CAAA;;;AAGI,KAAA,CAAA;CACL;;ACqBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCG;MACU,uBAAuB,GAAG,IAAI,cAAc,CAAkB,mBAAmB,EAAE;AAEhG;;;;AAIG;AAKU,IAAA,SAAS,GAAf,MAAM,SAAS,CAAA;IAGpB,WACU,CAAA,qBAA4C,EACP,eAAiC,EAAA;QADtE,IAAqB,CAAA,qBAAA,GAArB,qBAAqB,CAAuB;AAGpD,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,qBAAqB;AACzC,aAAA,MAAM,EAAE;AACR,aAAA,IAAI,CAAC,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,e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EAAA,CAC9C,YAAY,EAAE,WAAW,CAAA,EAAA,OAAA,EAAA,CACzB,gBAAgB,EAAE,uBAAuB,CAAA,EAAA,CAAA,CAAA;0GAGxC,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,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;AACzD,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;AACpC,oBAAA,OAAO,EAAE,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;AACpD,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA,CAAA;;;AChDD;;ACAA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"sisense-sdk-ui-angular-ai.mjs","sources":["../../src/ai/lib/component-wrapper-helpers/context-connectors.ts","../../src/ai/lib/component-wrapper-helpers/template.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/lib/sdk-ui-core-exports.ts","../../src/ai/public-api.ts","../../src/ai/sisense-sdk-ui-angular-ai.ts"],"sourcesContent":["import { ContextConnector, DataObserver } from '@sisense/sdk-ui-preact';\nimport { CustomAiContextProvider, CustomAiContextProviderProps } from '@sisense/sdk-ui-preact/ai';\n\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<CustomAiContextProviderProps> => {\n const propsObserver = new DataObserver<CustomAiContextProviderProps>();\n\n aiService\n .getApi()\n .then((api) =>\n propsObserver.setValue({\n context: {\n api,\n },\n }),\n )\n .catch((error) =>\n propsObserver.setValue({\n error,\n }),\n );\n\n return {\n propsObserver,\n providerComponent: CustomAiContextProvider,\n };\n};\n","export const rootId = 'preact';\nexport const template = `\n <div #${rootId} class=\"csdk-full-size-container\"></div>\n`;\nexport const styles = [\n `.csdk-full-size-container {\n width: 100%;\n height: 100%;\n }`,\n];\n","import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { SisenseContextService, TrackableService, WidgetProps } from '@sisense/sdk-ui-angular';\nimport {\n AiContextProviderProps,\n ChatRestApi,\n DEFAULT_RECOMMENDATIONS_COUNT,\n GetNlgInsightsResponse,\n GetNlqResultParams,\n GetQueryRecommendationsParams,\n prepareGetNlgInsightsPayload,\n prepareGetNlqResultPayload,\n QueryRecommendation as QueryRecommendationPreact,\n UseGetNlgInsightsParams,\n widgetComposer,\n} from '@sisense/sdk-ui-preact/ai';\n\nexport interface AiContextConfig extends Omit<AiContextProviderProps, 'children'> {}\nexport interface GetNlgInsightsParams extends Omit<UseGetNlgInsightsParams, 'enabled'> {}\n\n/**\n * {@inheritDoc @sisense/sdk-ui!QueryRecommendation}\n */\nexport interface QueryRecommendation extends Omit<QueryRecommendationPreact, 'widgetProps'> {\n /**\n * {@inheritDoc @sisense/sdk-ui!QueryRecommendation.widgetProps}\n */\n widgetProps?: WidgetProps;\n}\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 * @group Generative AI\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 * @group Generative AI\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 * @beta\n */\n async getQueryRecommendations(\n params: GetQueryRecommendationsParams,\n ): Promise<QueryRecommendation[]> {\n const api = await this.getApi();\n const { contextTitle, count, enableAxisTitlesInWidgetProps, customPrompt } = params;\n const recCount = count ?? DEFAULT_RECOMMENDATIONS_COUNT;\n\n const rawRecommendations =\n (await api.ai.getQueryRecommendations(contextTitle, {\n numOfRecommendations: recCount,\n ...(customPrompt ? { userPrompt: customPrompt } : undefined),\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 * @beta\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 }) as WidgetProps)\n : undefined;\n }\n}\n","import {\n AfterViewInit,\n Component,\n ElementRef,\n Input,\n OnChanges,\n OnDestroy,\n ViewChild,\n} from '@angular/core';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {\n createSisenseContextConnector,\n createThemeContextConnector,\n SisenseContextService,\n ThemeService,\n} from '@sisense/sdk-ui-angular';\nimport { ComponentAdapter } from '@sisense/sdk-ui-preact';\nimport {\n Chatbot as ChatbotPreact,\n type ChatbotProps as ChatbotPropsPreact,\n} from '@sisense/sdk-ui-preact/ai';\n\nimport { createAiContextConnector, rootId, styles, template } from '../component-wrapper-helpers';\nimport { AiService } from '../services/ai.service';\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 * @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 * @group Generative AI\n */\n@Component({\n selector: 'csdk-chatbot',\n template,\n styles,\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<typeof ChatbotPreact>;\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(ChatbotPreact, [\n createSisenseContextConnector(this.sisenseContextService),\n createThemeContextConnector(this.themeService),\n createAiContextConnector(this.aiService),\n ]);\n }\n\n /**\n * @internal\n */\n ngAfterViewInit() {\n this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());\n }\n\n /**\n * @internal\n */\n ngOnChanges() {\n if (this.preactRef) {\n this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());\n }\n }\n\n private getPreactComponentProps(): ChatbotPropsPreact {\n return {\n width: this.width,\n height: this.height,\n config: this.config,\n };\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';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {\n createSisenseContextConnector,\n createThemeContextConnector,\n SisenseContextService,\n ThemeService,\n} from '@sisense/sdk-ui-angular';\nimport { ComponentAdapter } from '@sisense/sdk-ui-preact';\nimport {\n GetNlgInsights as GetNlgInsightsPreact,\n type GetNlgInsightsProps as GetNlgInsightsPropsPreact,\n} from '@sisense/sdk-ui-preact/ai';\n\nimport { createAiContextConnector, rootId, styles, template } from '../component-wrapper-helpers';\nimport { AiService } from '../services/ai.service';\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 * @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 * @group Generative AI\n */\n@Component({\n selector: 'csdk-get-nlg-insights',\n template,\n styles,\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<typeof GetNlgInsightsPreact>;\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(GetNlgInsightsPreact, [\n createSisenseContextConnector(this.sisenseContextService),\n createThemeContextConnector(this.themeService),\n createAiContextConnector(this.aiService),\n ]);\n }\n\n /**\n * @internal\n */\n ngAfterViewInit() {\n this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());\n }\n\n /**\n * @internal\n */\n ngOnChanges() {\n if (this.preactRef) {\n this.componentAdapter.render(this.preactRef.nativeElement, this.getPreactComponentProps());\n }\n }\n\n private getPreactComponentProps(): GetNlgInsightsPropsPreact {\n return {\n dataSource: this.dataSource,\n dimensions: this.dimensions,\n measures: this.measures,\n filters: this.filters,\n verbosity: this.verbosity,\n };\n }\n\n /**\n * @internal\n */\n ngOnDestroy() {\n this.componentAdapter.destroy();\n }\n}\n","/* eslint-disable import/no-extraneous-dependencies */\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { SdkUiModule } from '@sisense/sdk-ui-angular';\n\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 * @group Generative AI\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","// This file re-exports common types/utils from @sisense/sdk-ui-preact/ai\n\n// Re-exports types from @sisense/sdk-ui-preact/ai\nexport type {\n ChatConfig,\n GetNlqResultParams,\n GetQueryRecommendationsParams,\n} from '@sisense/sdk-ui-preact/ai';\n","/**\n * Public API Surface of @sisense/sdk-ui-angular/ai\n */\n\nexport * from './lib/components';\nexport * from './lib/sdk-ai.module';\nexport * from './lib/sdk-ui-core-exports';\nexport * from './lib/services';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["ChatbotPreact","i2.AiService","GetNlgInsightsPreact"],"mappings":";;;;;;;;;AAKA;;;;;AAKG;AACI,MAAM,wBAAwB,GAAG,CACtC,SAAoB,KAC8B;AAClD,IAAA,MAAM,aAAa,GAAG,IAAI,YAAY,EAAgC,CAAC;IAEvE,SAAS;AACN,SAAA,MAAM,EAAE;SACR,IAAI,CAAC,CAAC,GAAG,KACR,aAAa,CAAC,QAAQ,CAAC;AACrB,QAAA,OAAO,EAAE;YACP,GAAG;AACJ,SAAA;AACF,KAAA,CAAC,CACH;SACA,KAAK,CAAC,CAAC,KAAK,KACX,aAAa,CAAC,QAAQ,CAAC;QACrB,KAAK;AACN,KAAA,CAAC,CACH,CAAC;IAEJ,OAAO;QACL,aAAa;AACb,QAAA,iBAAiB,EAAE,uBAAuB;KAC3C,CAAC;AACJ,CAAC;;ACnCM,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,MAAM,QAAQ,GAAG,CAAA;YACZ,MAAM,CAAA;CACjB,CAAC;AACK,MAAM,MAAM,GAAG;AACpB,IAAA,CAAA;;;AAGI,KAAA,CAAA;CACL;;ACqBD;;;;;;;;;;;;;;;;;;;;;;;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A,CAAA;sBADT,KAAK;gBAON,QAAQ,EAAA,CAAA;sBADP,KAAK;gBAON,OAAO,EAAA,CAAA;sBADN,KAAK;gBAON,SAAS,EAAA,CAAA;sBADR,KAAK;;;AC5GR;AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCG;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,YAAA,EAAA,CALP,gBAAgB,EAAE,uBAAuB,CAAA,EAAA,OAAA,EAAA,CAC9C,YAAY,EAAE,WAAW,CAAA,EAAA,OAAA,EAAA,CACzB,gBAAgB,EAAE,uBAAuB,CAAA,EAAA,CAAA,CAAA;0GAGxC,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,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;AACzD,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;AACpC,oBAAA,OAAO,EAAE,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;AACpD,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA,CAAA;;;AChDD;;ACAA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -187,7 +187,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
187
187
|
args: [SISENSE_CONTEXT_CONFIG_TOKEN]
|
|
188
188
|
}] }]; } });
|
|
189
189
|
|
|
190
|
-
var packageVersion = '2.
|
|
190
|
+
var packageVersion = '2.7.0';
|
|
191
191
|
|
|
192
192
|
/**
|
|
193
193
|
* Service for rendering components dynamically.
|
|
@@ -844,15 +844,18 @@ const THEME_CONFIG_TOKEN = new InjectionToken('theme configuration');
|
|
|
844
844
|
let ThemeService = class ThemeService {
|
|
845
845
|
constructor(sisenseContextService, themeConfig) {
|
|
846
846
|
this.sisenseContextService = sisenseContextService;
|
|
847
|
+
this.initializationPromise = Promise.resolve();
|
|
847
848
|
this.themeSettings$ = new BehaviorSubject(getDefaultThemeSettings());
|
|
848
|
-
|
|
849
|
+
this.initializationPromise = this.initThemeSettings(themeConfig?.theme);
|
|
849
850
|
}
|
|
850
851
|
async initThemeSettings(theme) {
|
|
851
852
|
const app = await this.sisenseContextService.getApp();
|
|
852
853
|
// apply system theme settings first
|
|
853
854
|
await this.applyThemeSettings(app.settings.serverThemeSettings);
|
|
854
855
|
if (theme) {
|
|
855
|
-
|
|
856
|
+
// Manually tracks theme update during initialization as execution of updateThemeSettings for consistency.
|
|
857
|
+
track('sdkAngularServiceMethodExecuted', 'ThemeService.updateThemeSettings');
|
|
858
|
+
await this.applyThemeSettings(theme);
|
|
856
859
|
}
|
|
857
860
|
}
|
|
858
861
|
async applyThemeSettings(theme) {
|
|
@@ -875,6 +878,7 @@ let ThemeService = class ThemeService {
|
|
|
875
878
|
return this.themeSettings$.asObservable();
|
|
876
879
|
}
|
|
877
880
|
async updateThemeSettings(theme) {
|
|
881
|
+
await this.initializationPromise;
|
|
878
882
|
await this.applyThemeSettings(theme);
|
|
879
883
|
}
|
|
880
884
|
};
|
|
@@ -3372,9 +3376,9 @@ class DashboardComponent {
|
|
|
3372
3376
|
this.themeService = themeService;
|
|
3373
3377
|
this.customWidgetsService = customWidgetsService;
|
|
3374
3378
|
this.componentAdapter = new ComponentAdapter(Dashboard, [
|
|
3379
|
+
createCustomWidgetsContextConnector(this.customWidgetsService),
|
|
3375
3380
|
createSisenseContextConnector(this.sisenseContextService),
|
|
3376
3381
|
createThemeContextConnector(this.themeService),
|
|
3377
|
-
createCustomWidgetsContextConnector(this.customWidgetsService),
|
|
3378
3382
|
]);
|
|
3379
3383
|
}
|
|
3380
3384
|
/**
|
|
@@ -3496,9 +3500,9 @@ class DashboardByIdComponent {
|
|
|
3496
3500
|
this.themeService = themeService;
|
|
3497
3501
|
this.customWidgetsService = customWidgetsService;
|
|
3498
3502
|
this.componentAdapter = new ComponentAdapter(DashboardById, [
|
|
3503
|
+
createCustomWidgetsContextConnector(this.customWidgetsService),
|
|
3499
3504
|
createSisenseContextConnector(this.sisenseContextService),
|
|
3500
3505
|
createThemeContextConnector(this.themeService),
|
|
3501
|
-
createCustomWidgetsContextConnector(this.customWidgetsService),
|
|
3502
3506
|
]);
|
|
3503
3507
|
}
|
|
3504
3508
|
/**
|