@onecx/integration-interface 8.0.0-rc.10 → 8.0.0-rc.11

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 (36) hide show
  1. package/dist/index.cjs +294 -4
  2. package/dist/index.mjs +294 -4
  3. package/package.json +2 -2
  4. package/src/index.d.ts +8 -0
  5. package/src/index.js +8 -0
  6. package/src/index.js.map +1 -1
  7. package/src/lib/services/notification.service.d.ts +7 -0
  8. package/src/lib/services/notification.service.js +15 -0
  9. package/src/lib/services/notification.service.js.map +1 -0
  10. package/src/lib/topics/notification/v1/notification.model.d.ts +21 -0
  11. package/src/lib/topics/notification/v1/notification.model.js +1 -0
  12. package/src/lib/topics/notification/v1/notification.model.js.map +1 -0
  13. package/src/lib/topics/notification/v1/notification.topic.d.ts +5 -0
  14. package/src/lib/topics/notification/v1/notification.topic.js +7 -0
  15. package/src/lib/topics/notification/v1/notification.topic.js.map +1 -0
  16. package/src/lib/topics/remote-components/v1/remote-component.model.d.ts +1 -0
  17. package/src/lib/utils/configuration.utils.d.ts +41 -0
  18. package/src/lib/utils/configuration.utils.js +52 -0
  19. package/src/lib/utils/configuration.utils.js.map +1 -0
  20. package/src/lib/utils/parameters.utils.d.ts +14 -0
  21. package/src/lib/utils/parameters.utils.js +15 -0
  22. package/src/lib/utils/parameters.utils.js.map +1 -0
  23. package/src/lib/utils/portal-message.utils.d.ts +54 -0
  24. package/src/lib/utils/portal-message.utils.js +49 -0
  25. package/src/lib/utils/portal-message.utils.js.map +1 -0
  26. package/src/lib/utils/shell-capability.utils.d.ts +20 -1
  27. package/src/lib/utils/shell-capability.utils.js +29 -3
  28. package/src/lib/utils/shell-capability.utils.js.map +1 -1
  29. package/src/lib/utils/user-language.utils.d.ts +30 -0
  30. package/src/lib/utils/user-language.utils.js +56 -0
  31. package/src/lib/utils/user-language.utils.js.map +1 -0
  32. package/src/lib/utils/workspace.utils.d.ts +76 -0
  33. package/src/lib/utils/workspace.utils.js +199 -0
  34. package/src/lib/utils/workspace.utils.js.map +1 -0
  35. package/src/version.d.ts +1 -1
  36. package/src/version.js +1 -1
package/dist/index.cjs CHANGED
@@ -49,6 +49,8 @@ __export(index_exports, {
49
49
  ImageRepositoryTopic: () => ImageRepositoryTopic,
50
50
  IsAuthenticatedTopic: () => IsAuthenticatedTopic,
51
51
  MessageTopic: () => MessageTopic,
52
+ NotificationService: () => NotificationService,
53
+ NotificationTopic: () => NotificationTopic,
52
54
  OverrideType: () => OverrideType,
53
55
  ParametersTopic: () => ParametersTopic,
54
56
  PermissionsRpcTopic: () => PermissionsRpcTopic,
@@ -61,11 +63,31 @@ __export(index_exports, {
61
63
  Technologies: () => Technologies,
62
64
  UNVERSIONED_KEY: () => UNVERSIONED_KEY,
63
65
  UserProfileTopic: () => UserProfileTopic,
66
+ buildPortalMessagePayload: () => buildPortalMessagePayload,
67
+ buildTranslatedMessage: () => buildTranslatedMessage,
68
+ constructBaseUrlFromWorkspace: () => constructBaseUrlFromWorkspace,
69
+ constructEndpointUrl: () => constructEndpointUrl,
70
+ constructRouteUrl: () => constructRouteUrl,
71
+ determineBrowserLanguage: () => determineBrowserLanguage,
72
+ dissolveEndpoint: () => dissolveEndpoint,
73
+ doesUrlExistForWorkspace: () => doesUrlExistForWorkspace,
64
74
  ensureIconCache: () => ensureIconCache,
75
+ fillParamsForPath: () => fillParamsForPath,
76
+ filterRouteFromList: () => filterRouteFromList,
77
+ findParameterValue: () => findParameterValue,
65
78
  generateClassName: () => generateClassName,
66
79
  getDynamicTranslationsCache: () => getDynamicTranslationsCache,
80
+ getInlinedConfig: () => getInlinedConfig,
81
+ getShellCapabilities: () => getShellCapabilities,
82
+ getStringFromUnknown: () => getStringFromUnknown,
67
83
  hasShellCapability: () => hasShellCapability,
68
- normalizeIconName: () => normalizeIconName
84
+ normalizeIconName: () => normalizeIconName,
85
+ resolveConfig: () => resolveConfig,
86
+ resolveConfigPayload: () => resolveConfigPayload,
87
+ resolveLegacyLanguage: () => resolveLegacyLanguage,
88
+ resolveProfileLanguage: () => resolveProfileLanguage,
89
+ resolveTranslation: () => resolveTranslation,
90
+ setShellCapabilities: () => setShellCapabilities
69
91
  });
70
92
  module.exports = __toCommonJS(index_exports);
71
93
 
@@ -810,9 +832,17 @@ var ShellCapability = /* @__PURE__ */ ((ShellCapability2) => {
810
832
  })(ShellCapability || {});
811
833
 
812
834
  // libs/integration-interface/src/lib/utils/shell-capability.utils.ts
813
- function hasShellCapability(capability) {
814
- return window["onecx-shell-capabilities"]?.includes(capability) ?? false;
815
- }
835
+ var SHELL_CAPABILITIES_KEY = "onecx-shell-capabilities";
836
+ var setShellCapabilities = (capabilities) => {
837
+ ;
838
+ globalThis[SHELL_CAPABILITIES_KEY] = capabilities;
839
+ };
840
+ var getShellCapabilities = () => {
841
+ return globalThis[SHELL_CAPABILITIES_KEY];
842
+ };
843
+ var hasShellCapability = (capability) => {
844
+ return getShellCapabilities()?.includes(capability) ?? false;
845
+ };
816
846
 
817
847
  // libs/integration-interface/src/lib/services/dynamic-translation.service.ts
818
848
  var UNVERSIONED_KEY = "undefined";
@@ -1067,3 +1097,263 @@ var DynamicTranslationService = class {
1067
1097
  this.dynamicTranslationsTopic$.destroy();
1068
1098
  }
1069
1099
  };
1100
+
1101
+ // libs/integration-interface/src/lib/utils/workspace.utils.ts
1102
+ var aliasStart = "[[";
1103
+ var aliasEnd = "]]";
1104
+ var paramStart = "{";
1105
+ var paramEnd = "}";
1106
+ var joinWithSlash = (base, path) => {
1107
+ let normalizedBase = base;
1108
+ let normalizedPath = path;
1109
+ if (!normalizedBase.endsWith("/")) {
1110
+ normalizedBase += "/";
1111
+ }
1112
+ if (normalizedPath.startsWith("/")) {
1113
+ normalizedPath = normalizedPath.slice(1);
1114
+ }
1115
+ return normalizedBase + normalizedPath;
1116
+ };
1117
+ var constructBaseUrlFromWorkspace = (workspace, warn) => {
1118
+ if (workspace.baseUrl === void 0) {
1119
+ warn("There was no baseUrl for received workspace.");
1120
+ return "";
1121
+ }
1122
+ return workspace.baseUrl;
1123
+ };
1124
+ var filterRouteFromList = (routes, appId, productName, warn) => {
1125
+ if (!routes) {
1126
+ return void 0;
1127
+ }
1128
+ const productRoutes = routes.filter((route) => route.appId === appId && route.productName === productName);
1129
+ if (productRoutes.length === 0) {
1130
+ return void 0;
1131
+ }
1132
+ if (productRoutes.length > 1) {
1133
+ warn("There were more than one route. First route has been used.");
1134
+ }
1135
+ return productRoutes[0];
1136
+ };
1137
+ var dissolveEndpoint = (endpointName, endpoints) => {
1138
+ let endpoint = endpoints.find((ep) => ep.name === endpointName);
1139
+ if (!endpoint) {
1140
+ return void 0;
1141
+ }
1142
+ while (endpoint.path?.includes(aliasStart)) {
1143
+ const path = endpoint.path;
1144
+ const startIdx = path.indexOf(aliasStart) + aliasStart.length;
1145
+ const endIdx = path.lastIndexOf(aliasEnd);
1146
+ if (endIdx <= startIdx) {
1147
+ return void 0;
1148
+ }
1149
+ const aliasName = path.substring(startIdx, endIdx);
1150
+ endpoint = endpoints.find((ep) => ep.name === aliasName);
1151
+ if (!endpoint) {
1152
+ return void 0;
1153
+ }
1154
+ }
1155
+ return endpoint;
1156
+ };
1157
+ var getStringFromUnknown = (value) => {
1158
+ if (value === null || value === void 0) {
1159
+ return "";
1160
+ }
1161
+ if (typeof value === "string") {
1162
+ return value;
1163
+ }
1164
+ return String(value);
1165
+ };
1166
+ var fillParamsForPath = (path, endpointParameters, warn) => {
1167
+ while (path.includes(paramStart)) {
1168
+ const paramName = path.substring(path.indexOf(paramStart) + paramStart.length, path.indexOf(paramEnd));
1169
+ const paramValue = getStringFromUnknown(endpointParameters[paramName]);
1170
+ if (paramValue && paramValue.length > 0) {
1171
+ path = path.replace(paramStart.concat(paramName).concat(paramEnd), paramValue);
1172
+ } else {
1173
+ warn(`Searched param "${paramName}" was not found in given param list `);
1174
+ return "";
1175
+ }
1176
+ }
1177
+ return path;
1178
+ };
1179
+ var constructEndpointUrl = (route, endpointName, endpointParameters, warn = console.warn) => {
1180
+ if (!route.endpoints) {
1181
+ return "";
1182
+ }
1183
+ const finalEndpoint = dissolveEndpoint(endpointName, route.endpoints);
1184
+ if (!finalEndpoint?.path) {
1185
+ warn("No endpoint or endpoint.path could be found");
1186
+ return "";
1187
+ }
1188
+ const paramsFilled = fillParamsForPath(finalEndpoint.path, endpointParameters ?? {}, warn);
1189
+ if (paramsFilled === void 0) {
1190
+ warn("Params could not be filled correctly");
1191
+ return "";
1192
+ }
1193
+ return paramsFilled;
1194
+ };
1195
+ var constructRouteUrl = (workspace, appId, productName, endpointName, endpointParameters, warn = console.warn) => {
1196
+ const route = filterRouteFromList(workspace.routes, appId, productName, warn);
1197
+ let url = constructBaseUrlFromWorkspace(workspace, warn);
1198
+ if (!route) {
1199
+ warn(`No route.baseUrl could be found for given appId "${appId}" and productName "${productName}"`);
1200
+ return url;
1201
+ }
1202
+ if (route.baseUrl?.length) {
1203
+ url = route.baseUrl;
1204
+ }
1205
+ if (endpointName == void 0) {
1206
+ return url;
1207
+ }
1208
+ const endpointPath = constructEndpointUrl(route, endpointName, endpointParameters, warn);
1209
+ if (!endpointPath.length) {
1210
+ return url;
1211
+ }
1212
+ url = joinWithSlash(url, endpointPath);
1213
+ return url;
1214
+ };
1215
+ var doesUrlExistForWorkspace = (workspace, productName, appId, endpointName, warn = console.warn) => {
1216
+ const checkEndpoint = endpointName !== void 0 && endpointName.length > 0;
1217
+ if (!workspace.routes) {
1218
+ return false;
1219
+ }
1220
+ const route = filterRouteFromList(workspace.routes, appId, productName, warn);
1221
+ if (checkEndpoint) {
1222
+ if (!route?.endpoints?.length) {
1223
+ return false;
1224
+ }
1225
+ const endpoint = route.endpoints.find((ep) => ep.name === endpointName);
1226
+ return !!endpoint?.path?.length;
1227
+ }
1228
+ return !!route?.baseUrl?.length;
1229
+ };
1230
+
1231
+ // libs/integration-interface/src/lib/utils/user-language.utils.ts
1232
+ var determineBrowserLanguage = () => {
1233
+ const windowRef = globalThis.window;
1234
+ if (!windowRef || !windowRef.navigator) {
1235
+ return void 0;
1236
+ }
1237
+ let browserLang = windowRef.navigator.languages?.[0];
1238
+ browserLang = browserLang || windowRef.navigator.language;
1239
+ if (!browserLang) {
1240
+ return void 0;
1241
+ }
1242
+ if (browserLang.includes("-")) {
1243
+ browserLang = browserLang.split("-")[0];
1244
+ }
1245
+ if (browserLang.includes("_")) {
1246
+ browserLang = browserLang.split("_")[0];
1247
+ }
1248
+ return browserLang;
1249
+ };
1250
+ var resolveLegacyLanguage = (profile, defaultLang, determineLang = determineBrowserLanguage) => {
1251
+ return profile.accountSettings?.localeAndTimeSettings?.locale ?? determineLang() ?? defaultLang;
1252
+ };
1253
+ var resolveProfileLanguage = (profile, defaultLang, getNormalizedLocales, determineLang = determineBrowserLanguage) => {
1254
+ let locales = profile.settings?.locales;
1255
+ if (!locales) {
1256
+ return resolveLegacyLanguage(profile, defaultLang, determineLang);
1257
+ }
1258
+ if (locales.length === 0) {
1259
+ locales = getNormalizedLocales();
1260
+ }
1261
+ const firstLang = locales.find((lang) => lang.length === 2);
1262
+ return firstLang ?? defaultLang;
1263
+ };
1264
+
1265
+ // libs/integration-interface/src/lib/utils/parameters.utils.ts
1266
+ var findParameterValue = (payload, key, productName, appId) => {
1267
+ return payload.parameters.find((parameter) => parameter.productName === productName && parameter.appId === appId)?.parameters[key];
1268
+ };
1269
+
1270
+ // libs/integration-interface/src/lib/utils/configuration.utils.ts
1271
+ var getInlinedConfig = () => {
1272
+ return globalThis.APP_CONFIG;
1273
+ };
1274
+ var resolveConfig = async ({
1275
+ defaultConfig = {},
1276
+ skipRemoteConfigLoad,
1277
+ remoteConfigURL,
1278
+ loadRemoteConfig
1279
+ }) => {
1280
+ const inlinedConfig = getInlinedConfig();
1281
+ if (inlinedConfig) {
1282
+ return { config: inlinedConfig, source: "inlined" };
1283
+ }
1284
+ if (skipRemoteConfigLoad) {
1285
+ return { config: defaultConfig, source: "default" };
1286
+ }
1287
+ const resolvedUrl = remoteConfigURL || "assets/env.json";
1288
+ const remoteConfig = await loadRemoteConfig(resolvedUrl);
1289
+ return {
1290
+ config: { ...defaultConfig, ...remoteConfig ?? {} },
1291
+ source: "remote"
1292
+ };
1293
+ };
1294
+ var resolveConfigPayload = async ({
1295
+ defaultConfig = {},
1296
+ skipRemoteConfigLoad,
1297
+ remoteConfigURL,
1298
+ loadRemoteConfig
1299
+ }) => {
1300
+ const inlinedConfig = getInlinedConfig();
1301
+ if (inlinedConfig) {
1302
+ return { config: inlinedConfig, source: "inlined" };
1303
+ }
1304
+ if (skipRemoteConfigLoad) {
1305
+ return { config: defaultConfig, source: "default" };
1306
+ }
1307
+ const resolvedUrl = remoteConfigURL || "assets/env.json";
1308
+ const remoteConfig = await loadRemoteConfig(resolvedUrl);
1309
+ return {
1310
+ config: remoteConfig ?? {},
1311
+ source: "remote"
1312
+ };
1313
+ };
1314
+
1315
+ // libs/integration-interface/src/lib/utils/portal-message.utils.ts
1316
+ var buildPortalMessagePayload = (severity, message, summary, detail) => ({
1317
+ ...message,
1318
+ severity,
1319
+ summary,
1320
+ detail
1321
+ });
1322
+ var resolveTranslation = async (translate, key, params) => {
1323
+ if (!key) {
1324
+ return void 0;
1325
+ }
1326
+ if (!translate) {
1327
+ return key;
1328
+ }
1329
+ return await translate(key, params);
1330
+ };
1331
+ var buildTranslatedMessage = async (severity, message, translate) => {
1332
+ const [summary, detail] = await Promise.all([
1333
+ resolveTranslation(translate, message.summaryKey, message.summaryParameters),
1334
+ resolveTranslation(translate, message.detailKey, message.detailParameters)
1335
+ ]);
1336
+ return buildPortalMessagePayload(severity, message, summary, detail);
1337
+ };
1338
+
1339
+ // libs/integration-interface/src/lib/topics/notification/v1/notification.topic.ts
1340
+ var NotificationTopic = class extends Topic {
1341
+ constructor() {
1342
+ super("notification", 1);
1343
+ }
1344
+ };
1345
+
1346
+ // libs/integration-interface/src/lib/services/notification.service.ts
1347
+ var NotificationService = class {
1348
+ _notificationTopic$;
1349
+ get notificationTopic() {
1350
+ this._notificationTopic$ ??= new NotificationTopic();
1351
+ return this._notificationTopic$;
1352
+ }
1353
+ set notificationTopic(source) {
1354
+ this._notificationTopic$ = source;
1355
+ }
1356
+ destroy() {
1357
+ this.notificationTopic.destroy();
1358
+ }
1359
+ };
package/dist/index.mjs CHANGED
@@ -741,9 +741,17 @@ var ShellCapability = /* @__PURE__ */ ((ShellCapability2) => {
741
741
  })(ShellCapability || {});
742
742
 
743
743
  // libs/integration-interface/src/lib/utils/shell-capability.utils.ts
744
- function hasShellCapability(capability) {
745
- return window["onecx-shell-capabilities"]?.includes(capability) ?? false;
746
- }
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
+ };
747
755
 
748
756
  // libs/integration-interface/src/lib/services/dynamic-translation.service.ts
749
757
  var UNVERSIONED_KEY = "undefined";
@@ -998,6 +1006,266 @@ var DynamicTranslationService = class {
998
1006
  this.dynamicTranslationsTopic$.destroy();
999
1007
  }
1000
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
+ };
1001
1269
  export {
1002
1270
  ConfigurationTopic,
1003
1271
  CurrentLocationTopic,
@@ -1018,6 +1286,8 @@ export {
1018
1286
  ImageRepositoryTopic,
1019
1287
  IsAuthenticatedTopic,
1020
1288
  MessageTopic,
1289
+ NotificationService,
1290
+ NotificationTopic,
1021
1291
  OverrideType,
1022
1292
  ParametersTopic,
1023
1293
  PermissionsRpcTopic,
@@ -1030,9 +1300,29 @@ export {
1030
1300
  Technologies,
1031
1301
  UNVERSIONED_KEY,
1032
1302
  UserProfileTopic,
1303
+ buildPortalMessagePayload,
1304
+ buildTranslatedMessage,
1305
+ constructBaseUrlFromWorkspace,
1306
+ constructEndpointUrl,
1307
+ constructRouteUrl,
1308
+ determineBrowserLanguage,
1309
+ dissolveEndpoint,
1310
+ doesUrlExistForWorkspace,
1033
1311
  ensureIconCache,
1312
+ fillParamsForPath,
1313
+ filterRouteFromList,
1314
+ findParameterValue,
1034
1315
  generateClassName,
1035
1316
  getDynamicTranslationsCache,
1317
+ getInlinedConfig,
1318
+ getShellCapabilities,
1319
+ getStringFromUnknown,
1036
1320
  hasShellCapability,
1037
- normalizeIconName
1321
+ normalizeIconName,
1322
+ resolveConfig,
1323
+ resolveConfigPayload,
1324
+ resolveLegacyLanguage,
1325
+ resolveProfileLanguage,
1326
+ resolveTranslation,
1327
+ setShellCapabilities
1038
1328
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onecx/integration-interface",
3
- "version": "8.0.0-rc.10",
3
+ "version": "8.0.0-rc.11",
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": "^8.0.0-rc.10"
11
+ "@onecx/accelerator": "^8.0.0-rc.11"
12
12
  },
13
13
  "type": "module",
14
14
  "dependencies": {
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