@onecx/integration-interface 9.0.0-rc.13 → 9.0.0-rc.15

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/index.cjs CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // libs/integration-interface/src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ AiCompletionGatherer: () => AiCompletionGatherer,
33
34
  AiContextGatherer: () => AiContextGatherer,
34
35
  ConfigurationTopic: () => ConfigurationTopic,
35
36
  CurrentLocationTopic: () => CurrentLocationTopic,
@@ -52,6 +53,7 @@ __export(index_exports, {
52
53
  MessageTopic: () => MessageTopic,
53
54
  NotificationService: () => NotificationService,
54
55
  NotificationTopic: () => NotificationTopic,
56
+ OneCXAiCompletionService: () => OneCXAiCompletionService,
55
57
  OverrideType: () => OverrideType,
56
58
  ParametersTopic: () => ParametersTopic,
57
59
  PermissionsRpcTopic: () => PermissionsRpcTopic,
@@ -69,6 +71,7 @@ __export(index_exports, {
69
71
  constructBaseUrlFromWorkspace: () => constructBaseUrlFromWorkspace,
70
72
  constructEndpointUrl: () => constructEndpointUrl,
71
73
  constructRouteUrl: () => constructRouteUrl,
74
+ consumerAiCompletionProvider: () => consumerAiCompletionProvider,
72
75
  determineBrowserLanguage: () => determineBrowserLanguage,
73
76
  dissolveEndpoint: () => dissolveEndpoint,
74
77
  doesUrlExistForWorkspace: () => doesUrlExistForWorkspace,
@@ -116,7 +119,8 @@ function ensureProperty(obj, path, initialValue) {
116
119
 
117
120
  // libs/accelerator/src/lib/declarations.ts
118
121
  var gatherPromises = ensureProperty(globalThis, ["@onecx/accelerator", "gatherer", "promises"], {});
119
- var topicUseBroadcastChannel = ensureProperty(gatherPromises, ["@onecx/accelerator", "topic", "useBroadcastChannel"], "V2");
122
+ var gatherId = ensureProperty(gatherPromises, ["@onecx/accelerator", "gatherer", "id"], 0);
123
+ var topicUseBroadcastChannel = ensureProperty(gatherId, ["@onecx/accelerator", "topic", "useBroadcastChannel"], "V2");
120
124
  var topicInitDate = ensureProperty(topicUseBroadcastChannel, ["@onecx/accelerator", "topic", "initDate"], Date.now());
121
125
  var topicTabId = ensureProperty(topicInitDate, ["@onecx/accelerator", "topic", "tabId"], Math.ceil(globalThis.performance?.now?.() ?? 0));
122
126
 
@@ -465,9 +469,8 @@ var Topic = class extends TopicPublisher {
465
469
  var import_rxjs2 = require("rxjs");
466
470
 
467
471
  // libs/accelerator/src/lib/utils/gatherer.ts
468
- var Gatherer = class _Gatherer {
472
+ var Gatherer = class {
469
473
  logger;
470
- static id = 0;
471
474
  topic;
472
475
  ownIds = /* @__PURE__ */ new Set();
473
476
  topicSub = null;
@@ -511,7 +514,7 @@ var Gatherer = class _Gatherer {
511
514
  if (!topicTabId["@onecx/accelerator"].gatherer?.promises) {
512
515
  throw new Error("Gatherer is not initialized");
513
516
  }
514
- const id = _Gatherer.id++;
517
+ const id = topicTabId["@onecx/accelerator"].gatherer.id++;
515
518
  this.ownIds.add(id);
516
519
  topicTabId["@onecx/accelerator"].gatherer.promises[id] = [];
517
520
  const message = { id, request };
@@ -601,7 +604,7 @@ var CurrentThemeTopic = class extends Topic {
601
604
 
602
605
  // libs/integration-interface/src/lib/topics/current-theme/v1/theme-override.model.ts
603
606
  var OverrideType = /* @__PURE__ */ ((OverrideType2) => {
604
- OverrideType2["PRIMENG"] = "PRIMENG";
607
+ OverrideType2["OPTIMUS"] = "OPTIMUS";
605
608
  OverrideType2["CSS"] = "CSS";
606
609
  return OverrideType2;
607
610
  })(OverrideType || {});
@@ -1443,3 +1446,32 @@ var AiContextGatherer = class extends Gatherer {
1443
1446
  super("aiContext", 1, callback);
1444
1447
  }
1445
1448
  };
1449
+
1450
+ // libs/integration-interface/src/lib/gatherers/ai-completion/v1/ai-completion.gatherer.ts
1451
+ var AiCompletionGatherer = class extends Gatherer {
1452
+ constructor(callback) {
1453
+ super("aiCompletion", 1, callback);
1454
+ }
1455
+ };
1456
+
1457
+ // libs/integration-interface/src/lib/services/ai-completion.service.ts
1458
+ async function consumerAiCompletionProvider(_request) {
1459
+ return null;
1460
+ }
1461
+ var OneCXAiCompletionService = class {
1462
+ logger = createLogger2("OneCXAiCompletionService");
1463
+ aiCompletionGatherer = new AiCompletionGatherer(consumerAiCompletionProvider);
1464
+ async getCompletion(request) {
1465
+ this.logger.debug("getCompletion", request);
1466
+ const responses = await this.aiCompletionGatherer.gather(request);
1467
+ const response = responses.find((r) => r !== null);
1468
+ if (!response) {
1469
+ throw new Error("No AI provider responded to the completion request");
1470
+ }
1471
+ this.logger.debug("getCompletion resolved", response);
1472
+ return response;
1473
+ }
1474
+ destroy() {
1475
+ this.aiCompletionGatherer.destroy();
1476
+ }
1477
+ };
package/dist/index.mjs CHANGED
@@ -24,7 +24,8 @@ function ensureProperty(obj, path, initialValue) {
24
24
 
25
25
  // libs/accelerator/src/lib/declarations.ts
26
26
  var gatherPromises = ensureProperty(globalThis, ["@onecx/accelerator", "gatherer", "promises"], {});
27
- var topicUseBroadcastChannel = ensureProperty(gatherPromises, ["@onecx/accelerator", "topic", "useBroadcastChannel"], "V2");
27
+ var gatherId = ensureProperty(gatherPromises, ["@onecx/accelerator", "gatherer", "id"], 0);
28
+ var topicUseBroadcastChannel = ensureProperty(gatherId, ["@onecx/accelerator", "topic", "useBroadcastChannel"], "V2");
28
29
  var topicInitDate = ensureProperty(topicUseBroadcastChannel, ["@onecx/accelerator", "topic", "initDate"], Date.now());
29
30
  var topicTabId = ensureProperty(topicInitDate, ["@onecx/accelerator", "topic", "tabId"], Math.ceil(globalThis.performance?.now?.() ?? 0));
30
31
 
@@ -373,9 +374,8 @@ var Topic = class extends TopicPublisher {
373
374
  import { BehaviorSubject as BehaviorSubject2, ReplaySubject } from "rxjs";
374
375
 
375
376
  // libs/accelerator/src/lib/utils/gatherer.ts
376
- var Gatherer = class _Gatherer {
377
+ var Gatherer = class {
377
378
  logger;
378
- static id = 0;
379
379
  topic;
380
380
  ownIds = /* @__PURE__ */ new Set();
381
381
  topicSub = null;
@@ -419,7 +419,7 @@ var Gatherer = class _Gatherer {
419
419
  if (!topicTabId["@onecx/accelerator"].gatherer?.promises) {
420
420
  throw new Error("Gatherer is not initialized");
421
421
  }
422
- const id = _Gatherer.id++;
422
+ const id = topicTabId["@onecx/accelerator"].gatherer.id++;
423
423
  this.ownIds.add(id);
424
424
  topicTabId["@onecx/accelerator"].gatherer.promises[id] = [];
425
425
  const message = { id, request };
@@ -509,7 +509,7 @@ var CurrentThemeTopic = class extends Topic {
509
509
 
510
510
  // libs/integration-interface/src/lib/topics/current-theme/v1/theme-override.model.ts
511
511
  var OverrideType = /* @__PURE__ */ ((OverrideType2) => {
512
- OverrideType2["PRIMENG"] = "PRIMENG";
512
+ OverrideType2["OPTIMUS"] = "OPTIMUS";
513
513
  OverrideType2["CSS"] = "CSS";
514
514
  return OverrideType2;
515
515
  })(OverrideType || {});
@@ -1351,7 +1351,37 @@ var AiContextGatherer = class extends Gatherer {
1351
1351
  super("aiContext", 1, callback);
1352
1352
  }
1353
1353
  };
1354
+
1355
+ // libs/integration-interface/src/lib/gatherers/ai-completion/v1/ai-completion.gatherer.ts
1356
+ var AiCompletionGatherer = class extends Gatherer {
1357
+ constructor(callback) {
1358
+ super("aiCompletion", 1, callback);
1359
+ }
1360
+ };
1361
+
1362
+ // libs/integration-interface/src/lib/services/ai-completion.service.ts
1363
+ async function consumerAiCompletionProvider(_request) {
1364
+ return null;
1365
+ }
1366
+ var OneCXAiCompletionService = class {
1367
+ logger = createLogger2("OneCXAiCompletionService");
1368
+ aiCompletionGatherer = new AiCompletionGatherer(consumerAiCompletionProvider);
1369
+ async getCompletion(request) {
1370
+ this.logger.debug("getCompletion", request);
1371
+ const responses = await this.aiCompletionGatherer.gather(request);
1372
+ const response = responses.find((r) => r !== null);
1373
+ if (!response) {
1374
+ throw new Error("No AI provider responded to the completion request");
1375
+ }
1376
+ this.logger.debug("getCompletion resolved", response);
1377
+ return response;
1378
+ }
1379
+ destroy() {
1380
+ this.aiCompletionGatherer.destroy();
1381
+ }
1382
+ };
1354
1383
  export {
1384
+ AiCompletionGatherer,
1355
1385
  AiContextGatherer,
1356
1386
  ConfigurationTopic,
1357
1387
  CurrentLocationTopic,
@@ -1374,6 +1404,7 @@ export {
1374
1404
  MessageTopic,
1375
1405
  NotificationService,
1376
1406
  NotificationTopic,
1407
+ OneCXAiCompletionService,
1377
1408
  OverrideType,
1378
1409
  ParametersTopic,
1379
1410
  PermissionsRpcTopic,
@@ -1391,6 +1422,7 @@ export {
1391
1422
  constructBaseUrlFromWorkspace,
1392
1423
  constructEndpointUrl,
1393
1424
  constructRouteUrl,
1425
+ consumerAiCompletionProvider,
1394
1426
  determineBrowserLanguage,
1395
1427
  dissolveEndpoint,
1396
1428
  doesUrlExistForWorkspace,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onecx/integration-interface",
3
- "version": "9.0.0-rc.13",
3
+ "version": "9.0.0-rc.15",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "peerDependencies": {
10
10
  "rxjs": "^7.8.1",
11
- "@onecx/accelerator": "^9.0.0-rc.13"
11
+ "@onecx/accelerator": "9.0.0-rc.15"
12
12
  },
13
13
  "type": "module",
14
14
  "dependencies": {
package/src/index.d.ts CHANGED
@@ -61,3 +61,6 @@ export * from './lib/topics/notification/v1/notification.topic';
61
61
  export * from './lib/services/notification.service';
62
62
  export * from './lib/gatherers/ai-context/v1/ai-context.model';
63
63
  export * from './lib/gatherers/ai-context/v1/ai-context.gatherer';
64
+ export * from './lib/gatherers/ai-completion/v1/ai-completion.model';
65
+ export * from './lib/gatherers/ai-completion/v1/ai-completion.gatherer';
66
+ export * from './lib/services/ai-completion.service';
package/src/index.js CHANGED
@@ -61,4 +61,7 @@ export * from './lib/topics/notification/v1/notification.topic';
61
61
  export * from './lib/services/notification.service';
62
62
  export * from './lib/gatherers/ai-context/v1/ai-context.model';
63
63
  export * from './lib/gatherers/ai-context/v1/ai-context.gatherer';
64
+ export * from './lib/gatherers/ai-completion/v1/ai-completion.model';
65
+ export * from './lib/gatherers/ai-completion/v1/ai-completion.gatherer';
66
+ export * from './lib/services/ai-completion.service';
64
67
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/integration-interface/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+CAA+C,CAAA;AAC7D,cAAc,4CAA4C,CAAA;AAC1D,cAAc,iDAAiD,CAAA;AAC/D,cAAc,8CAA8C,CAAA;AAE5D,cAAc,iDAAiD,CAAA;AAE/D,cAAc,qDAAqD,CAAA;AAEnE,cAAc,mDAAmD,CAAA;AACjE,cAAc,2CAA2C,CAAA;AACzD,cAAc,oDAAoD,CAAA;AAElE,cAAc,iDAAiD,CAAA;AAC/D,cAAc,iDAAiD,CAAA;AAE/D,cAAc,mDAAmD,CAAA;AAEjE,cAAc,2DAA2D,CAAA;AACzE,cAAc,iEAAiE,CAAA;AAC/E,cAAc,mDAAmD,CAAA;AACjE,cAAc,+CAA+C,CAAA;AAC7D,cAAc,kDAAkD,CAAA;AAEhE,cAAc,wDAAwD,CAAA;AAEtE,cAAc,uCAAuC,CAAA;AACrD,cAAc,uCAAuC,CAAA;AAErD,cAAc,0DAA0D,CAAA;AACxE,cAAc,gEAAgE,CAAA;AAC9E,cAAc,8CAA8C,CAAA;AAC5D,cAAc,2DAA2D,CAAA;AAEzE,cAAc,+CAA+C,CAAA;AAE7D,cAAc,uDAAuD,CAAA;AACrE,cAAc,uDAAuD,CAAA;AAErE,cAAc,qCAAqC,CAAA;AACnD,cAAc,yCAAyC,CAAA;AACvD,cAAc,mCAAmC,CAAA;AACjD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,gDAAgD,CAAA;AAE9D,cAAc,mDAAmD,CA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kC,CAAA;AAEhD,cAAc,iDAAiD,CAAA;AAC/D,cAAc,iDAAiD,CAAA;AAC/D,cAAc,qCAAqC,CAAA;AAEnD,cAAc,gDAAgD,CAAA;AAC9D,cAAc,mDAAmD,CAAA;AACjE,cAAc,sDAAsD,CAAA;AACpE,cAAc,yDAAyD,CAAA;AAEvE,cAAc,sCAAsC,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { Gatherer } from "@onecx/accelerator";
2
+ import type { AiCompletionRequest, AiCompletionResponse } from "./ai-completion.model";
3
+ /**
4
+ * This class acts as a thin communication layer for AI completions between consumers inside
5
+ * onecx-portal-ui-libs and the AI Provider Remote Component. It publishes AI completion requests,
6
+ * collects responses from the registered provider instance and returns them to the caller.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ *
11
+ * // create the gatherer in the provider (remote component) so it can answer completion requests
12
+ * // in ngOnDestroy, call the gatherer.destroy() method to clean up resources
13
+ *
14
+ * const aiCompletionGatherer = new AiCompletionGatherer(async (request) => {
15
+ * // request the AI provider BFF with request.agent / request.message / ...
16
+ * // and return the response: { message: string }
17
+ * // return null if you do not want to contribute to this request
18
+ * return { message: "..." }
19
+ * });
20
+ *
21
+ * // on the consumer side, publish the request and get the responses back:
22
+ * const responses = await aiCompletionGatherer.gather(request)
23
+ * // responses is an array of (AiCompletionResponse | null)
24
+ * ```
25
+ */
26
+ export declare class AiCompletionGatherer extends Gatherer<AiCompletionRequest, AiCompletionResponse | null> {
27
+ constructor(callback: (request: AiCompletionRequest) => Promise<AiCompletionResponse | null>);
28
+ }
@@ -0,0 +1,30 @@
1
+ import { Gatherer } from "@onecx/accelerator";
2
+ /**
3
+ * This class acts as a thin communication layer for AI completions between consumers inside
4
+ * onecx-portal-ui-libs and the AI Provider Remote Component. It publishes AI completion requests,
5
+ * collects responses from the registered provider instance and returns them to the caller.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ *
10
+ * // create the gatherer in the provider (remote component) so it can answer completion requests
11
+ * // in ngOnDestroy, call the gatherer.destroy() method to clean up resources
12
+ *
13
+ * const aiCompletionGatherer = new AiCompletionGatherer(async (request) => {
14
+ * // request the AI provider BFF with request.agent / request.message / ...
15
+ * // and return the response: { message: string }
16
+ * // return null if you do not want to contribute to this request
17
+ * return { message: "..." }
18
+ * });
19
+ *
20
+ * // on the consumer side, publish the request and get the responses back:
21
+ * const responses = await aiCompletionGatherer.gather(request)
22
+ * // responses is an array of (AiCompletionResponse | null)
23
+ * ```
24
+ */
25
+ export class AiCompletionGatherer extends Gatherer {
26
+ constructor(callback) {
27
+ super("aiCompletion", 1, callback);
28
+ }
29
+ }
30
+ //# sourceMappingURL=ai-completion.gatherer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-completion.gatherer.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/gatherers/ai-completion/v1/ai-completion.gatherer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAI7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,oBAAqB,SAAQ,QAA0D;IAChG,YAAY,QAAgF;QACxF,KAAK,CAAC,cAAc,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;IACtC,CAAC;CACJ"}
@@ -0,0 +1,12 @@
1
+ export interface AiCompletionRequest {
2
+ agent: {
3
+ id: string;
4
+ name: string;
5
+ };
6
+ aiContext: string[];
7
+ message: string;
8
+ systemPrompt: string;
9
+ }
10
+ export interface AiCompletionResponse {
11
+ message: string;
12
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ai-completion.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-completion.model.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/gatherers/ai-completion/v1/ai-completion.model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import type { AiCompletionRequest, AiCompletionResponse } from '../gatherers/ai-completion/v1/ai-completion.model';
2
+ export declare function consumerAiCompletionProvider(_request: AiCompletionRequest): Promise<AiCompletionResponse | null>;
3
+ /**
4
+ * Thin service wrapper around AiCompletionGatherer that lets consumers inside request AI completions.
5
+ *
6
+ * It forwards the given request unchanged through the gatherer and returns the first
7
+ * non-null response collected from the registered AI provider instance (for example the
8
+ * ocx-ai-connector-component). If no provider contributes a response, an error is thrown.
9
+ */
10
+ export declare class OneCXAiCompletionService {
11
+ private readonly logger;
12
+ private readonly aiCompletionGatherer;
13
+ getCompletion(request: AiCompletionRequest): Promise<AiCompletionResponse>;
14
+ destroy(): void;
15
+ }
@@ -0,0 +1,30 @@
1
+ import { AiCompletionGatherer } from '../gatherers/ai-completion/v1/ai-completion.gatherer';
2
+ import { createLogger } from '../utils/logger.utils';
3
+ export async function consumerAiCompletionProvider(_request) {
4
+ return null;
5
+ }
6
+ /**
7
+ * Thin service wrapper around AiCompletionGatherer that lets consumers inside request AI completions.
8
+ *
9
+ * It forwards the given request unchanged through the gatherer and returns the first
10
+ * non-null response collected from the registered AI provider instance (for example the
11
+ * ocx-ai-connector-component). If no provider contributes a response, an error is thrown.
12
+ */
13
+ export class OneCXAiCompletionService {
14
+ logger = createLogger('OneCXAiCompletionService');
15
+ aiCompletionGatherer = new AiCompletionGatherer(consumerAiCompletionProvider);
16
+ async getCompletion(request) {
17
+ this.logger.debug('getCompletion', request);
18
+ const responses = await this.aiCompletionGatherer.gather(request);
19
+ const response = responses.find((r) => r !== null);
20
+ if (!response) {
21
+ throw new Error('No AI provider responded to the completion request');
22
+ }
23
+ this.logger.debug('getCompletion resolved', response);
24
+ return response;
25
+ }
26
+ destroy() {
27
+ this.aiCompletionGatherer.destroy();
28
+ }
29
+ }
30
+ //# sourceMappingURL=ai-completion.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-completion.service.js","sourceRoot":"","sources":["../../../../../../libs/integration-interface/src/lib/services/ai-completion.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAA;AAE3F,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,QAA6B;IAE7B,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,wBAAwB;IAClB,MAAM,GAAG,YAAY,CAAC,0BAA0B,CAAC,CAAA;IAEjD,oBAAoB,GAAG,IAAI,oBAAoB,CAAC,4BAA4B,CAAC,CAAA;IAE9F,KAAK,CAAC,aAAa,CAAC,OAA4B;QAC9C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;QAC3C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QACjE,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAA;QAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;QACvE,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAA;QACrD,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAA;IACrC,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
1
  export declare enum OverrideType {
2
- PRIMENG = "PRIMENG",
2
+ OPTIMUS = "OPTIMUS",
3
3
  CSS = "CSS"
4
4
  }
5
5
  export interface ThemeOverride {
@@ -1,6 +1,6 @@
1
1
  export var OverrideType;
2
2
  (function (OverrideType) {
3
- OverrideType["PRIMENG"] = "PRIMENG";
3
+ OverrideType["OPTIMUS"] = "OPTIMUS";
4
4
  OverrideType["CSS"] = "CSS";
5
5
  })(OverrideType || (OverrideType = {}));
6
6
  //# sourceMappingURL=theme-override.model.js.map
package/src/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const LIB_NAME = "@onecx/integration-interface";
2
- export declare const LIB_VERSION = "9.0.0-rc.13";
2
+ export declare const LIB_VERSION = "9.0.0-rc.15";
package/src/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export const LIB_NAME = '@onecx/integration-interface';
2
- export const LIB_VERSION = '9.0.0-rc.13';
2
+ export const LIB_VERSION = '9.0.0-rc.15';
3
3
  //# sourceMappingURL=version.js.map