@onecx/integration-interface 8.0.0-rc.9 → 9.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +0 -1
  2. package/dist/index.cjs +351 -68
  3. package/dist/index.mjs +351 -68
  4. package/package.json +2 -9
  5. package/src/index.d.ts +8 -0
  6. package/src/index.js +8 -0
  7. package/src/index.js.map +1 -1
  8. package/src/lib/services/notification.service.d.ts +7 -0
  9. package/src/lib/services/notification.service.js +15 -0
  10. package/src/lib/services/notification.service.js.map +1 -0
  11. package/src/lib/topics/notification/v1/notification.model.d.ts +21 -0
  12. package/src/lib/topics/notification/v1/notification.model.js +1 -0
  13. package/src/lib/topics/notification/v1/notification.model.js.map +1 -0
  14. package/src/lib/topics/notification/v1/notification.topic.d.ts +5 -0
  15. package/src/lib/topics/notification/v1/notification.topic.js +7 -0
  16. package/src/lib/topics/notification/v1/notification.topic.js.map +1 -0
  17. package/src/lib/topics/remote-components/v1/remote-component.model.d.ts +1 -0
  18. package/src/lib/utils/configuration.utils.d.ts +41 -0
  19. package/src/lib/utils/configuration.utils.js +52 -0
  20. package/src/lib/utils/configuration.utils.js.map +1 -0
  21. package/src/lib/utils/parameters.utils.d.ts +14 -0
  22. package/src/lib/utils/parameters.utils.js +15 -0
  23. package/src/lib/utils/parameters.utils.js.map +1 -0
  24. package/src/lib/utils/portal-message.utils.d.ts +54 -0
  25. package/src/lib/utils/portal-message.utils.js +49 -0
  26. package/src/lib/utils/portal-message.utils.js.map +1 -0
  27. package/src/lib/utils/shell-capability.utils.d.ts +20 -1
  28. package/src/lib/utils/shell-capability.utils.js +29 -3
  29. package/src/lib/utils/shell-capability.utils.js.map +1 -1
  30. package/src/lib/utils/user-language.utils.d.ts +30 -0
  31. package/src/lib/utils/user-language.utils.js +56 -0
  32. package/src/lib/utils/user-language.utils.js.map +1 -0
  33. package/src/lib/utils/workspace.utils.d.ts +76 -0
  34. package/src/lib/utils/workspace.utils.js +199 -0
  35. package/src/lib/utils/workspace.utils.js.map +1 -0
  36. package/src/version.d.ts +1 -1
  37. package/src/version.js +1 -1
  38. package/migrations/index.d.ts +0 -3
  39. package/migrations/index.js +0 -4
  40. package/migrations/index.js.map +0 -1
  41. package/migrations/v5/warn-for-events-publisher-navigated.d.ts +0 -2
  42. package/migrations/v5/warn-for-events-publisher-navigated.js +0 -30
  43. package/migrations/v5/warn-for-events-publisher-navigated.js.map +0 -1
  44. package/migrations/v5/warn-for-events-topic-navigated.d.ts +0 -2
  45. package/migrations/v5/warn-for-events-topic-navigated.js +0 -31
  46. package/migrations/v5/warn-for-events-topic-navigated.js.map +0 -1
  47. package/migrations/v6/migrate-onecx-to-v6.d.ts +0 -2
  48. package/migrations/v6/migrate-onecx-to-v6.js +0 -5
  49. package/migrations/v6/migrate-onecx-to-v6.js.map +0 -1
  50. package/migrations.json +0 -46
package/dist/index.mjs CHANGED
@@ -4,25 +4,39 @@ import {
4
4
  BehaviorSubject
5
5
  } from "rxjs";
6
6
 
7
+ // libs/accelerator/src/lib/utils/ensure-property.utils.ts
8
+ function ensureProperty(obj, path, initialValue) {
9
+ let current = obj;
10
+ for (let i = 0; i < path.length - 1; i++) {
11
+ const key = path[i];
12
+ if (current[key] == null || typeof current[key] !== "object") {
13
+ current[key] = {};
14
+ }
15
+ current = current[key];
16
+ }
17
+ const lastKey = path.at(-1);
18
+ if (lastKey === void 0) {
19
+ return obj;
20
+ }
21
+ current[lastKey] ??= initialValue;
22
+ return obj;
23
+ }
24
+
7
25
  // libs/accelerator/src/lib/declarations.ts
8
- window["@onecx/accelerator"] ??= {};
9
- window["@onecx/accelerator"].gatherer ??= {};
10
- window["@onecx/accelerator"].gatherer.promises ??= {};
11
- window["@onecx/accelerator"].topic ??= {};
12
- window["@onecx/accelerator"].topic.useBroadcastChannel ??= "V2";
13
- window["@onecx/accelerator"].topic.initDate ??= Date.now();
14
- window["@onecx/accelerator"].topic.tabId ??= Math.ceil(globalThis.performance.now());
26
+ var gatherPromises = ensureProperty(globalThis, ["@onecx/accelerator", "gatherer", "promises"], {});
27
+ var topicUseBroadcastChannel = ensureProperty(gatherPromises, ["@onecx/accelerator", "topic", "useBroadcastChannel"], "V2");
28
+ var topicInitDate = ensureProperty(topicUseBroadcastChannel, ["@onecx/accelerator", "topic", "initDate"], Date.now());
29
+ var topicTabId = ensureProperty(topicInitDate, ["@onecx/accelerator", "topic", "tabId"], Math.ceil(globalThis.performance?.now?.() ?? 0));
15
30
 
16
31
  // libs/accelerator/src/lib/utils/logs.utils.ts
17
32
  function isStatsEnabled() {
18
- return window["@onecx/accelerator"]?.topic?.statsEnabled === true;
33
+ const g2 = ensureProperty(topicTabId, ["@onecx/accelerator", "topic", "statsEnabled"], false);
34
+ return g2["@onecx/accelerator"].topic.statsEnabled === true;
19
35
  }
20
36
  function increaseMessageCount(topicName, messageType) {
21
- window["@onecx/accelerator"].topic ??= {};
22
- window["@onecx/accelerator"].topic.stats ??= {};
23
- window["@onecx/accelerator"].topic.stats.messagesPublished ??= {};
37
+ const g2 = ensureProperty(topicTabId, ["@onecx/accelerator", "topic", "stats", "messagesPublished"], {});
24
38
  if (isStatsEnabled()) {
25
- const messageStats = window["@onecx/accelerator"].topic.stats.messagesPublished;
39
+ const messageStats = g2["@onecx/accelerator"].topic.stats.messagesPublished;
26
40
  if (!messageStats[topicName]) {
27
41
  messageStats[topicName] = {
28
42
  TopicNext: 0,
@@ -34,11 +48,9 @@ function increaseMessageCount(topicName, messageType) {
34
48
  }
35
49
  }
36
50
  function increaseInstanceCount(topicName) {
37
- window["@onecx/accelerator"].topic ??= {};
38
- window["@onecx/accelerator"].topic.stats ??= {};
39
- window["@onecx/accelerator"].topic.stats.instancesCreated ??= {};
51
+ const g2 = ensureProperty(globalThis, ["@onecx/accelerator", "topic", "stats", "instancesCreated"], {});
40
52
  if (isStatsEnabled()) {
41
- const instanceStats = window["@onecx/accelerator"].topic.stats.instancesCreated;
53
+ const instanceStats = g2["@onecx/accelerator"].topic.stats.instancesCreated;
42
54
  if (!instanceStats[topicName]) {
43
55
  instanceStats[topicName] = 0;
44
56
  }
@@ -47,13 +59,13 @@ function increaseInstanceCount(topicName) {
47
59
  }
48
60
 
49
61
  // libs/accelerator/src/lib/topic/message.ts
50
- window["onecxMessageId"] ??= 1;
62
+ var g = ensureProperty(globalThis, ["onecxMessageId"], 1);
51
63
  var Message = class {
52
64
  // id can be undefined while used via old implementation
53
65
  constructor(type) {
54
66
  this.type = type;
55
- this.timestamp = window.performance.now();
56
- this.id = window["onecxMessageId"]++;
67
+ this.timestamp = globalThis.performance?.now?.() ?? Date.now();
68
+ this.id = g.onecxMessageId++;
57
69
  }
58
70
  timestamp;
59
71
  id;
@@ -135,26 +147,28 @@ var TopicPublisher = class {
135
147
  if (this.publishBroadcastChannel && this.publishBroadcastChannelV2) {
136
148
  return;
137
149
  }
138
- if (window["@onecx/accelerator"]?.topic?.useBroadcastChannel) {
150
+ if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel) {
139
151
  if (typeof BroadcastChannel === "undefined") {
140
152
  this.baseLogger.info("BroadcastChannel not supported. Disabling BroadcastChannel for topic publisher");
141
- window["@onecx/accelerator"] ??= {};
142
- window["@onecx/accelerator"].topic ??= {};
143
- window["@onecx/accelerator"].topic.useBroadcastChannel = false;
153
+ topicTabId["@onecx/accelerator"].topic.useBroadcastChannel = false;
144
154
  } else {
145
155
  this.publishBroadcastChannel = new BroadcastChannel(`Topic-${this.name}|${this.version}`);
146
- this.publishBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${window["@onecx/accelerator"].topic.tabId}`);
156
+ this.publishBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${topicTabId["@onecx/accelerator"].topic.tabId}`);
147
157
  }
148
158
  }
149
159
  }
150
160
  sendMessage(message) {
151
161
  this.createBroadcastChannel();
152
- if (window["@onecx/accelerator"]?.topic?.useBroadcastChannel === "V2") {
162
+ if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel === "V2") {
153
163
  this.publishBroadcastChannelV2?.postMessage(message);
154
- } else if (window["@onecx/accelerator"]?.topic?.useBroadcastChannel) {
164
+ } else if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel) {
155
165
  this.publishBroadcastChannel?.postMessage(message);
156
166
  } else {
157
- window.postMessage(message, "*");
167
+ const postMessage = globalThis.postMessage;
168
+ if (typeof postMessage !== "function") {
169
+ throw new TypeError("postMessage is not available in this environment");
170
+ }
171
+ postMessage(message, "*");
158
172
  }
159
173
  }
160
174
  };
@@ -171,18 +185,13 @@ var Topic = class extends TopicPublisher {
171
185
  readBroadcastChannelV2;
172
186
  constructor(name, version, sendGetMessage = true) {
173
187
  super(name, version);
174
- window["@onecx/accelerator"] ??= {};
175
- window["@onecx/accelerator"].topic ??= {};
176
- window["@onecx/accelerator"].topic.initDate ??= Date.now();
177
- if (window["@onecx/accelerator"]?.topic?.useBroadcastChannel) {
188
+ if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel) {
178
189
  if (typeof BroadcastChannel === "undefined") {
179
190
  this.logger.info("BroadcastChannel not supported. Disabling BroadcastChannel for topic");
180
- window["@onecx/accelerator"] ??= {};
181
- window["@onecx/accelerator"].topic ??= {};
182
- window["@onecx/accelerator"].topic.useBroadcastChannel = false;
191
+ topicTabId["@onecx/accelerator"].topic.useBroadcastChannel = false;
183
192
  } else {
184
193
  this.readBroadcastChannel = new BroadcastChannel(`Topic-${this.name}|${this.version}`);
185
- this.readBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${window["@onecx/accelerator"].topic.tabId}`);
194
+ this.readBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${topicTabId["@onecx/accelerator"].topic.tabId}`);
186
195
  }
187
196
  }
188
197
  if (isStatsEnabled()) {
@@ -191,11 +200,14 @@ var Topic = class extends TopicPublisher {
191
200
  this.isInitializedPromise = new Promise((resolve) => {
192
201
  this.resolveInitPromise = resolve;
193
202
  });
194
- window.addEventListener("message", this.windowEventListener);
203
+ const addEventListener = globalThis.addEventListener;
204
+ if (typeof addEventListener === "function") {
205
+ addEventListener("message", this.windowEventListener);
206
+ }
195
207
  this.readBroadcastChannel?.addEventListener("message", (m) => this.onBroadcastChannelMessage(m));
196
208
  this.readBroadcastChannelV2?.addEventListener("message", (m) => this.onBroadcastChannelMessageV2(m));
197
209
  if (sendGetMessage) {
198
- if (window["@onecx/accelerator"].topic.initDate && Date.now() - window["@onecx/accelerator"].topic.initDate < 2e3) {
210
+ if (topicTabId["@onecx/accelerator"].topic.initDate && Date.now() - topicTabId["@onecx/accelerator"].topic.initDate < 2e3) {
199
211
  setTimeout(() => {
200
212
  if (!this.isInit) {
201
213
  const message = new TopicMessage("TopicGet" /* TopicGet */, this.name, this.version);
@@ -254,7 +266,10 @@ var Topic = class extends TopicPublisher {
254
266
  return this.asObservable().toPromise();
255
267
  }
256
268
  destroy() {
257
- window.removeEventListener("message", this.windowEventListener, true);
269
+ const removeEventListener = globalThis.removeEventListener;
270
+ if (typeof removeEventListener === "function") {
271
+ removeEventListener("message", this.windowEventListener, true);
272
+ }
258
273
  this.readBroadcastChannel?.close();
259
274
  this.publishBroadcastChannel?.close();
260
275
  this.readBroadcastChannelV2?.close();
@@ -310,20 +325,16 @@ var Topic = class extends TopicPublisher {
310
325
  }
311
326
  }
312
327
  disableBroadcastChannel() {
313
- window["@onecx/accelerator"] ??= {};
314
- window["@onecx/accelerator"].topic ??= {};
315
- if (window["@onecx/accelerator"].topic.useBroadcastChannel === true) {
328
+ if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel === true) {
316
329
  this.logger.info("Disabling BroadcastChannel for topic");
317
330
  }
318
- window["@onecx/accelerator"].topic.useBroadcastChannel = false;
331
+ topicTabId["@onecx/accelerator"].topic.useBroadcastChannel = false;
319
332
  }
320
333
  disableBroadcastChannelV2() {
321
- window["@onecx/accelerator"] ??= {};
322
- window["@onecx/accelerator"].topic ??= {};
323
- if (window["@onecx/accelerator"].topic.useBroadcastChannel === "V2") {
334
+ if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel === "V2") {
324
335
  this.logger.info("Disabling BroadcastChannel V2 for topic");
325
336
  }
326
- window["@onecx/accelerator"].topic.useBroadcastChannel = true;
337
+ topicTabId["@onecx/accelerator"].topic.useBroadcastChannel = true;
327
338
  }
328
339
  handleTopicResolveMessage(m) {
329
340
  const publishPromiseResolver = this.publishPromiseResolver[m.data.resolveId];
@@ -361,24 +372,6 @@ var Topic = class extends TopicPublisher {
361
372
  // libs/accelerator/src/lib/topic/mocks/fake-topic.ts
362
373
  import { BehaviorSubject as BehaviorSubject2, ReplaySubject } from "rxjs";
363
374
 
364
- // libs/accelerator/src/lib/utils/ensure-property.utils.ts
365
- function ensureProperty(obj, path, initialValue) {
366
- let current = obj;
367
- for (let i = 0; i < path.length - 1; i++) {
368
- const key = path[i];
369
- if (current[key] == null || typeof current[key] !== "object") {
370
- current[key] = {};
371
- }
372
- current = current[key];
373
- }
374
- const lastKey = path.at(-1);
375
- if (lastKey === void 0) {
376
- return obj;
377
- }
378
- current[lastKey] ??= initialValue;
379
- return obj;
380
- }
381
-
382
375
  // libs/integration-interface/src/lib/topics/current-mfe/v1/current-mfe.topic.ts
383
376
  var CurrentMfeTopic = class extends Topic {
384
377
  constructor() {
@@ -748,9 +741,17 @@ var ShellCapability = /* @__PURE__ */ ((ShellCapability2) => {
748
741
  })(ShellCapability || {});
749
742
 
750
743
  // libs/integration-interface/src/lib/utils/shell-capability.utils.ts
751
- function hasShellCapability(capability) {
752
- return window["onecx-shell-capabilities"]?.includes(capability) ?? false;
753
- }
744
+ var SHELL_CAPABILITIES_KEY = "onecx-shell-capabilities";
745
+ var setShellCapabilities = (capabilities) => {
746
+ ;
747
+ globalThis[SHELL_CAPABILITIES_KEY] = capabilities;
748
+ };
749
+ var getShellCapabilities = () => {
750
+ return globalThis[SHELL_CAPABILITIES_KEY];
751
+ };
752
+ var hasShellCapability = (capability) => {
753
+ return getShellCapabilities()?.includes(capability) ?? false;
754
+ };
754
755
 
755
756
  // libs/integration-interface/src/lib/services/dynamic-translation.service.ts
756
757
  var UNVERSIONED_KEY = "undefined";
@@ -1005,6 +1006,266 @@ var DynamicTranslationService = class {
1005
1006
  this.dynamicTranslationsTopic$.destroy();
1006
1007
  }
1007
1008
  };
1009
+
1010
+ // libs/integration-interface/src/lib/utils/workspace.utils.ts
1011
+ var aliasStart = "[[";
1012
+ var aliasEnd = "]]";
1013
+ var paramStart = "{";
1014
+ var paramEnd = "}";
1015
+ var joinWithSlash = (base, path) => {
1016
+ let normalizedBase = base;
1017
+ let normalizedPath = path;
1018
+ if (!normalizedBase.endsWith("/")) {
1019
+ normalizedBase += "/";
1020
+ }
1021
+ if (normalizedPath.startsWith("/")) {
1022
+ normalizedPath = normalizedPath.slice(1);
1023
+ }
1024
+ return normalizedBase + normalizedPath;
1025
+ };
1026
+ var constructBaseUrlFromWorkspace = (workspace, warn) => {
1027
+ if (workspace.baseUrl === void 0) {
1028
+ warn("There was no baseUrl for received workspace.");
1029
+ return "";
1030
+ }
1031
+ return workspace.baseUrl;
1032
+ };
1033
+ var filterRouteFromList = (routes, appId, productName, warn) => {
1034
+ if (!routes) {
1035
+ return void 0;
1036
+ }
1037
+ const productRoutes = routes.filter((route) => route.appId === appId && route.productName === productName);
1038
+ if (productRoutes.length === 0) {
1039
+ return void 0;
1040
+ }
1041
+ if (productRoutes.length > 1) {
1042
+ warn("There were more than one route. First route has been used.");
1043
+ }
1044
+ return productRoutes[0];
1045
+ };
1046
+ var dissolveEndpoint = (endpointName, endpoints) => {
1047
+ let endpoint = endpoints.find((ep) => ep.name === endpointName);
1048
+ if (!endpoint) {
1049
+ return void 0;
1050
+ }
1051
+ while (endpoint.path?.includes(aliasStart)) {
1052
+ const path = endpoint.path;
1053
+ const startIdx = path.indexOf(aliasStart) + aliasStart.length;
1054
+ const endIdx = path.lastIndexOf(aliasEnd);
1055
+ if (endIdx <= startIdx) {
1056
+ return void 0;
1057
+ }
1058
+ const aliasName = path.substring(startIdx, endIdx);
1059
+ endpoint = endpoints.find((ep) => ep.name === aliasName);
1060
+ if (!endpoint) {
1061
+ return void 0;
1062
+ }
1063
+ }
1064
+ return endpoint;
1065
+ };
1066
+ var getStringFromUnknown = (value) => {
1067
+ if (value === null || value === void 0) {
1068
+ return "";
1069
+ }
1070
+ if (typeof value === "string") {
1071
+ return value;
1072
+ }
1073
+ return String(value);
1074
+ };
1075
+ var fillParamsForPath = (path, endpointParameters, warn) => {
1076
+ while (path.includes(paramStart)) {
1077
+ const paramName = path.substring(path.indexOf(paramStart) + paramStart.length, path.indexOf(paramEnd));
1078
+ const paramValue = getStringFromUnknown(endpointParameters[paramName]);
1079
+ if (paramValue && paramValue.length > 0) {
1080
+ path = path.replace(paramStart.concat(paramName).concat(paramEnd), paramValue);
1081
+ } else {
1082
+ warn(`Searched param "${paramName}" was not found in given param list `);
1083
+ return "";
1084
+ }
1085
+ }
1086
+ return path;
1087
+ };
1088
+ var constructEndpointUrl = (route, endpointName, endpointParameters, warn = console.warn) => {
1089
+ if (!route.endpoints) {
1090
+ return "";
1091
+ }
1092
+ const finalEndpoint = dissolveEndpoint(endpointName, route.endpoints);
1093
+ if (!finalEndpoint?.path) {
1094
+ warn("No endpoint or endpoint.path could be found");
1095
+ return "";
1096
+ }
1097
+ const paramsFilled = fillParamsForPath(finalEndpoint.path, endpointParameters ?? {}, warn);
1098
+ if (paramsFilled === void 0) {
1099
+ warn("Params could not be filled correctly");
1100
+ return "";
1101
+ }
1102
+ return paramsFilled;
1103
+ };
1104
+ var constructRouteUrl = (workspace, appId, productName, endpointName, endpointParameters, warn = console.warn) => {
1105
+ const route = filterRouteFromList(workspace.routes, appId, productName, warn);
1106
+ let url = constructBaseUrlFromWorkspace(workspace, warn);
1107
+ if (!route) {
1108
+ warn(`No route.baseUrl could be found for given appId "${appId}" and productName "${productName}"`);
1109
+ return url;
1110
+ }
1111
+ if (route.baseUrl?.length) {
1112
+ url = route.baseUrl;
1113
+ }
1114
+ if (endpointName == void 0) {
1115
+ return url;
1116
+ }
1117
+ const endpointPath = constructEndpointUrl(route, endpointName, endpointParameters, warn);
1118
+ if (!endpointPath.length) {
1119
+ return url;
1120
+ }
1121
+ url = joinWithSlash(url, endpointPath);
1122
+ return url;
1123
+ };
1124
+ var doesUrlExistForWorkspace = (workspace, productName, appId, endpointName, warn = console.warn) => {
1125
+ const checkEndpoint = endpointName !== void 0 && endpointName.length > 0;
1126
+ if (!workspace.routes) {
1127
+ return false;
1128
+ }
1129
+ const route = filterRouteFromList(workspace.routes, appId, productName, warn);
1130
+ if (checkEndpoint) {
1131
+ if (!route?.endpoints?.length) {
1132
+ return false;
1133
+ }
1134
+ const endpoint = route.endpoints.find((ep) => ep.name === endpointName);
1135
+ return !!endpoint?.path?.length;
1136
+ }
1137
+ return !!route?.baseUrl?.length;
1138
+ };
1139
+
1140
+ // libs/integration-interface/src/lib/utils/user-language.utils.ts
1141
+ var determineBrowserLanguage = () => {
1142
+ const windowRef = globalThis.window;
1143
+ if (!windowRef || !windowRef.navigator) {
1144
+ return void 0;
1145
+ }
1146
+ let browserLang = windowRef.navigator.languages?.[0];
1147
+ browserLang = browserLang || windowRef.navigator.language;
1148
+ if (!browserLang) {
1149
+ return void 0;
1150
+ }
1151
+ if (browserLang.includes("-")) {
1152
+ browserLang = browserLang.split("-")[0];
1153
+ }
1154
+ if (browserLang.includes("_")) {
1155
+ browserLang = browserLang.split("_")[0];
1156
+ }
1157
+ return browserLang;
1158
+ };
1159
+ var resolveLegacyLanguage = (profile, defaultLang, determineLang = determineBrowserLanguage) => {
1160
+ return profile.accountSettings?.localeAndTimeSettings?.locale ?? determineLang() ?? defaultLang;
1161
+ };
1162
+ var resolveProfileLanguage = (profile, defaultLang, getNormalizedLocales, determineLang = determineBrowserLanguage) => {
1163
+ let locales = profile.settings?.locales;
1164
+ if (!locales) {
1165
+ return resolveLegacyLanguage(profile, defaultLang, determineLang);
1166
+ }
1167
+ if (locales.length === 0) {
1168
+ locales = getNormalizedLocales();
1169
+ }
1170
+ const firstLang = locales.find((lang) => lang.length === 2);
1171
+ return firstLang ?? defaultLang;
1172
+ };
1173
+
1174
+ // libs/integration-interface/src/lib/utils/parameters.utils.ts
1175
+ var findParameterValue = (payload, key, productName, appId) => {
1176
+ return payload.parameters.find((parameter) => parameter.productName === productName && parameter.appId === appId)?.parameters[key];
1177
+ };
1178
+
1179
+ // libs/integration-interface/src/lib/utils/configuration.utils.ts
1180
+ var getInlinedConfig = () => {
1181
+ return globalThis.APP_CONFIG;
1182
+ };
1183
+ var resolveConfig = async ({
1184
+ defaultConfig = {},
1185
+ skipRemoteConfigLoad,
1186
+ remoteConfigURL,
1187
+ loadRemoteConfig
1188
+ }) => {
1189
+ const inlinedConfig = getInlinedConfig();
1190
+ if (inlinedConfig) {
1191
+ return { config: inlinedConfig, source: "inlined" };
1192
+ }
1193
+ if (skipRemoteConfigLoad) {
1194
+ return { config: defaultConfig, source: "default" };
1195
+ }
1196
+ const resolvedUrl = remoteConfigURL || "assets/env.json";
1197
+ const remoteConfig = await loadRemoteConfig(resolvedUrl);
1198
+ return {
1199
+ config: { ...defaultConfig, ...remoteConfig ?? {} },
1200
+ source: "remote"
1201
+ };
1202
+ };
1203
+ var resolveConfigPayload = async ({
1204
+ defaultConfig = {},
1205
+ skipRemoteConfigLoad,
1206
+ remoteConfigURL,
1207
+ loadRemoteConfig
1208
+ }) => {
1209
+ const inlinedConfig = getInlinedConfig();
1210
+ if (inlinedConfig) {
1211
+ return { config: inlinedConfig, source: "inlined" };
1212
+ }
1213
+ if (skipRemoteConfigLoad) {
1214
+ return { config: defaultConfig, source: "default" };
1215
+ }
1216
+ const resolvedUrl = remoteConfigURL || "assets/env.json";
1217
+ const remoteConfig = await loadRemoteConfig(resolvedUrl);
1218
+ return {
1219
+ config: remoteConfig ?? {},
1220
+ source: "remote"
1221
+ };
1222
+ };
1223
+
1224
+ // libs/integration-interface/src/lib/utils/portal-message.utils.ts
1225
+ var buildPortalMessagePayload = (severity, message, summary, detail) => ({
1226
+ ...message,
1227
+ severity,
1228
+ summary,
1229
+ detail
1230
+ });
1231
+ var resolveTranslation = async (translate, key, params) => {
1232
+ if (!key) {
1233
+ return void 0;
1234
+ }
1235
+ if (!translate) {
1236
+ return key;
1237
+ }
1238
+ return await translate(key, params);
1239
+ };
1240
+ var buildTranslatedMessage = async (severity, message, translate) => {
1241
+ const [summary, detail] = await Promise.all([
1242
+ resolveTranslation(translate, message.summaryKey, message.summaryParameters),
1243
+ resolveTranslation(translate, message.detailKey, message.detailParameters)
1244
+ ]);
1245
+ return buildPortalMessagePayload(severity, message, summary, detail);
1246
+ };
1247
+
1248
+ // libs/integration-interface/src/lib/topics/notification/v1/notification.topic.ts
1249
+ var NotificationTopic = class extends Topic {
1250
+ constructor() {
1251
+ super("notification", 1);
1252
+ }
1253
+ };
1254
+
1255
+ // libs/integration-interface/src/lib/services/notification.service.ts
1256
+ var NotificationService = class {
1257
+ _notificationTopic$;
1258
+ get notificationTopic() {
1259
+ this._notificationTopic$ ??= new NotificationTopic();
1260
+ return this._notificationTopic$;
1261
+ }
1262
+ set notificationTopic(source) {
1263
+ this._notificationTopic$ = source;
1264
+ }
1265
+ destroy() {
1266
+ this.notificationTopic.destroy();
1267
+ }
1268
+ };
1008
1269
  export {
1009
1270
  ConfigurationTopic,
1010
1271
  CurrentLocationTopic,
@@ -1025,6 +1286,8 @@ export {
1025
1286
  ImageRepositoryTopic,
1026
1287
  IsAuthenticatedTopic,
1027
1288
  MessageTopic,
1289
+ NotificationService,
1290
+ NotificationTopic,
1028
1291
  OverrideType,
1029
1292
  ParametersTopic,
1030
1293
  PermissionsRpcTopic,
@@ -1037,9 +1300,29 @@ export {
1037
1300
  Technologies,
1038
1301
  UNVERSIONED_KEY,
1039
1302
  UserProfileTopic,
1303
+ buildPortalMessagePayload,
1304
+ buildTranslatedMessage,
1305
+ constructBaseUrlFromWorkspace,
1306
+ constructEndpointUrl,
1307
+ constructRouteUrl,
1308
+ determineBrowserLanguage,
1309
+ dissolveEndpoint,
1310
+ doesUrlExistForWorkspace,
1040
1311
  ensureIconCache,
1312
+ fillParamsForPath,
1313
+ filterRouteFromList,
1314
+ findParameterValue,
1041
1315
  generateClassName,
1042
1316
  getDynamicTranslationsCache,
1317
+ getInlinedConfig,
1318
+ getShellCapabilities,
1319
+ getStringFromUnknown,
1043
1320
  hasShellCapability,
1044
- normalizeIconName
1321
+ normalizeIconName,
1322
+ resolveConfig,
1323
+ resolveConfigPayload,
1324
+ resolveLegacyLanguage,
1325
+ resolveProfileLanguage,
1326
+ resolveTranslation,
1327
+ setShellCapabilities
1045
1328
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onecx/integration-interface",
3
- "version": "8.0.0-rc.9",
3
+ "version": "9.0.0-rc.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,11 +8,7 @@
8
8
  },
9
9
  "peerDependencies": {
10
10
  "rxjs": "^7.8.1",
11
- "@nx/devkit": "^22.0.2",
12
- "@onecx/accelerator": "^8.0.0-rc.9",
13
- "@onecx/nx-migration-utils": "^8.0.0-rc.9",
14
- "@phenomnomnominal/tsquery": "^6",
15
- "typescript": "^5.5.4"
11
+ "@onecx/accelerator": "^9.0.0-rc.1"
16
12
  },
17
13
  "type": "module",
18
14
  "dependencies": {
@@ -33,8 +29,5 @@
33
29
  },
34
30
  "publishConfig": {
35
31
  "access": "public"
36
- },
37
- "nx-migrations": {
38
- "migrations": "./migrations.json"
39
32
  }
40
33
  }
package/src/index.d.ts CHANGED
@@ -51,3 +51,11 @@ export * from './lib/topics/dynamic-translations/v1/dynamic-translations.topic';
51
51
  export * from './lib/services/dynamic-translation.service';
52
52
  export * from './lib/models/shell-capability.model';
53
53
  export * from './lib/utils/shell-capability.utils';
54
+ export * from './lib/utils/workspace.utils';
55
+ export * from './lib/utils/user-language.utils';
56
+ export * from './lib/utils/parameters.utils';
57
+ export * from './lib/utils/configuration.utils';
58
+ export * from './lib/utils/portal-message.utils';
59
+ export * from './lib/topics/notification/v1/notification.model';
60
+ export * from './lib/topics/notification/v1/notification.topic';
61
+ export * from './lib/services/notification.service';
package/src/index.js CHANGED
@@ -51,4 +51,12 @@ export * from './lib/topics/dynamic-translations/v1/dynamic-translations.topic';
51
51
  export * from './lib/services/dynamic-translation.service';
52
52
  export * from './lib/models/shell-capability.model';
53
53
  export * from './lib/utils/shell-capability.utils';
54
+ export * from './lib/utils/workspace.utils';
55
+ export * from './lib/utils/user-language.utils';
56
+ export * from './lib/utils/parameters.utils';
57
+ export * from './lib/utils/configuration.utils';
58
+ export * from './lib/utils/portal-message.utils';
59
+ export * from './lib/topics/notification/v1/notification.model';
60
+ export * from './lib/topics/notification/v1/notification.topic';
61
+ export * from './lib/services/notification.service';
54
62
  //# 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,0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BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAEhD,cAAc,iDAAiD,CAAA;AAC/D,cAAc,iDAAiD,CAAA;AAC/D,cAAc,qCAAqC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { NotificationTopic } from "../topics/notification/v1/notification.topic";
2
+ export declare class NotificationService {
3
+ private _notificationTopic$;
4
+ get notificationTopic(): NotificationTopic;
5
+ set notificationTopic(source: NotificationTopic);
6
+ destroy(): void;
7
+ }
@@ -0,0 +1,15 @@
1
+ import { NotificationTopic } from "../topics/notification/v1/notification.topic";
2
+ export class NotificationService {
3
+ _notificationTopic$;
4
+ get notificationTopic() {
5
+ this._notificationTopic$ ??= new NotificationTopic();
6
+ return this._notificationTopic$;
7
+ }
8
+ set notificationTopic(source) {
9
+ this._notificationTopic$ = source;
10
+ }
11
+ destroy() {
12
+ this.notificationTopic.destroy();
13
+ }
14
+ }
15
+ //# sourceMappingURL=notification.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.service.js","sourceRoot":"","sources":["../../../../../../libs/integration-interface/src/lib/services/notification.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,MAAM,OAAO,mBAAmB;IAEpB,mBAAmB,CAAgC;IAC3D,IAAI,iBAAiB;QACjB,IAAI,CAAC,mBAAmB,KAAK,IAAI,iBAAiB,EAAE,CAAA;QACpD,OAAO,IAAI,CAAC,mBAAmB,CAAA;IACnC,CAAC;IACD,IAAI,iBAAiB,CAAC,MAAyB;QAC3C,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAA;IACrC,CAAC;IAED,OAAO;QACH,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAA;IACpC,CAAC;CACJ"}
@@ -0,0 +1,21 @@
1
+ export interface Notification {
2
+ type: string;
3
+ address: string;
4
+ headers: {
5
+ [key: string]: string;
6
+ };
7
+ body: {
8
+ id: string;
9
+ applicationId: string;
10
+ senderId: string;
11
+ receiverId: string;
12
+ persist: boolean;
13
+ creationData: Date;
14
+ contentMeta: [
15
+ {
16
+ key: string;
17
+ value: string;
18
+ }
19
+ ];
20
+ };
21
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=notification.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.model.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/topics/notification/v1/notification.model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { Topic } from '@onecx/accelerator';
2
+ import { Notification } from './notification.model';
3
+ export declare class NotificationTopic extends Topic<Notification> {
4
+ constructor();
5
+ }