@onecx/integration-interface 8.0.0-rc.9 → 8.0.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/README.md +0 -1
- package/dist/index.cjs +351 -68
- package/dist/index.mjs +351 -68
- package/package.json +2 -9
- package/src/index.d.ts +8 -0
- package/src/index.js +8 -0
- package/src/index.js.map +1 -1
- package/src/lib/services/notification.service.d.ts +7 -0
- package/src/lib/services/notification.service.js +15 -0
- package/src/lib/services/notification.service.js.map +1 -0
- package/src/lib/topics/notification/v1/notification.model.d.ts +21 -0
- package/src/lib/topics/notification/v1/notification.model.js +1 -0
- package/src/lib/topics/notification/v1/notification.model.js.map +1 -0
- package/src/lib/topics/notification/v1/notification.topic.d.ts +5 -0
- package/src/lib/topics/notification/v1/notification.topic.js +7 -0
- package/src/lib/topics/notification/v1/notification.topic.js.map +1 -0
- package/src/lib/topics/remote-components/v1/remote-component.model.d.ts +1 -0
- package/src/lib/utils/configuration.utils.d.ts +41 -0
- package/src/lib/utils/configuration.utils.js +52 -0
- package/src/lib/utils/configuration.utils.js.map +1 -0
- package/src/lib/utils/parameters.utils.d.ts +14 -0
- package/src/lib/utils/parameters.utils.js +15 -0
- package/src/lib/utils/parameters.utils.js.map +1 -0
- package/src/lib/utils/portal-message.utils.d.ts +54 -0
- package/src/lib/utils/portal-message.utils.js +49 -0
- package/src/lib/utils/portal-message.utils.js.map +1 -0
- package/src/lib/utils/shell-capability.utils.d.ts +20 -1
- package/src/lib/utils/shell-capability.utils.js +29 -3
- package/src/lib/utils/shell-capability.utils.js.map +1 -1
- package/src/lib/utils/user-language.utils.d.ts +30 -0
- package/src/lib/utils/user-language.utils.js +56 -0
- package/src/lib/utils/user-language.utils.js.map +1 -0
- package/src/lib/utils/workspace.utils.d.ts +76 -0
- package/src/lib/utils/workspace.utils.js +199 -0
- package/src/lib/utils/workspace.utils.js.map +1 -0
- package/src/version.d.ts +1 -1
- package/src/version.js +1 -1
- package/src/version.js.map +1 -1
- package/migrations/index.d.ts +0 -3
- package/migrations/index.js +0 -4
- package/migrations/index.js.map +0 -1
- package/migrations/v5/warn-for-events-publisher-navigated.d.ts +0 -2
- package/migrations/v5/warn-for-events-publisher-navigated.js +0 -30
- package/migrations/v5/warn-for-events-publisher-navigated.js.map +0 -1
- package/migrations/v5/warn-for-events-topic-navigated.d.ts +0 -2
- package/migrations/v5/warn-for-events-topic-navigated.js +0 -31
- package/migrations/v5/warn-for-events-topic-navigated.js.map +0 -1
- package/migrations/v6/migrate-onecx-to-v6.d.ts +0 -2
- package/migrations/v6/migrate-onecx-to-v6.js +0 -5
- package/migrations/v6/migrate-onecx-to-v6.js.map +0 -1
- package/migrations.json +0 -46
package/README.md
CHANGED
|
@@ -11,7 +11,6 @@ npm install @onecx/integration-interface
|
|
|
11
11
|
|
|
12
12
|
## Additional Commands
|
|
13
13
|
- `npx nx run integration-interface:build` - Builds the library and outputs the result to the `dist` folder.
|
|
14
|
-
- `npx nx run integration-interface:build-migrations` - Builds the migration files for the library.
|
|
15
14
|
- `npx nx run integration-interface:test` - Runs the unit tests for the library.
|
|
16
15
|
- `npx nx run integration-interface:lint` - Lints the library's codebase.
|
|
17
16
|
- `npx nx run integration-interface:release` - Releases a new version of the library to npm, following semantic versioning guidelines.
|
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
|
|
|
@@ -73,25 +95,39 @@ module.exports = __toCommonJS(index_exports);
|
|
|
73
95
|
var import_operators = require("rxjs/operators");
|
|
74
96
|
var import_rxjs = require("rxjs");
|
|
75
97
|
|
|
98
|
+
// libs/accelerator/src/lib/utils/ensure-property.utils.ts
|
|
99
|
+
function ensureProperty(obj, path, initialValue) {
|
|
100
|
+
let current = obj;
|
|
101
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
102
|
+
const key = path[i];
|
|
103
|
+
if (current[key] == null || typeof current[key] !== "object") {
|
|
104
|
+
current[key] = {};
|
|
105
|
+
}
|
|
106
|
+
current = current[key];
|
|
107
|
+
}
|
|
108
|
+
const lastKey = path.at(-1);
|
|
109
|
+
if (lastKey === void 0) {
|
|
110
|
+
return obj;
|
|
111
|
+
}
|
|
112
|
+
current[lastKey] ??= initialValue;
|
|
113
|
+
return obj;
|
|
114
|
+
}
|
|
115
|
+
|
|
76
116
|
// libs/accelerator/src/lib/declarations.ts
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
window["@onecx/accelerator"].topic.useBroadcastChannel ??= "V2";
|
|
82
|
-
window["@onecx/accelerator"].topic.initDate ??= Date.now();
|
|
83
|
-
window["@onecx/accelerator"].topic.tabId ??= Math.ceil(globalThis.performance.now());
|
|
117
|
+
var gatherPromises = ensureProperty(globalThis, ["@onecx/accelerator", "gatherer", "promises"], {});
|
|
118
|
+
var topicUseBroadcastChannel = ensureProperty(gatherPromises, ["@onecx/accelerator", "topic", "useBroadcastChannel"], "V2");
|
|
119
|
+
var topicInitDate = ensureProperty(topicUseBroadcastChannel, ["@onecx/accelerator", "topic", "initDate"], Date.now());
|
|
120
|
+
var topicTabId = ensureProperty(topicInitDate, ["@onecx/accelerator", "topic", "tabId"], Math.ceil(globalThis.performance?.now?.() ?? 0));
|
|
84
121
|
|
|
85
122
|
// libs/accelerator/src/lib/utils/logs.utils.ts
|
|
86
123
|
function isStatsEnabled() {
|
|
87
|
-
|
|
124
|
+
const g2 = ensureProperty(topicTabId, ["@onecx/accelerator", "topic", "statsEnabled"], false);
|
|
125
|
+
return g2["@onecx/accelerator"].topic.statsEnabled === true;
|
|
88
126
|
}
|
|
89
127
|
function increaseMessageCount(topicName, messageType) {
|
|
90
|
-
|
|
91
|
-
window["@onecx/accelerator"].topic.stats ??= {};
|
|
92
|
-
window["@onecx/accelerator"].topic.stats.messagesPublished ??= {};
|
|
128
|
+
const g2 = ensureProperty(topicTabId, ["@onecx/accelerator", "topic", "stats", "messagesPublished"], {});
|
|
93
129
|
if (isStatsEnabled()) {
|
|
94
|
-
const messageStats =
|
|
130
|
+
const messageStats = g2["@onecx/accelerator"].topic.stats.messagesPublished;
|
|
95
131
|
if (!messageStats[topicName]) {
|
|
96
132
|
messageStats[topicName] = {
|
|
97
133
|
TopicNext: 0,
|
|
@@ -103,11 +139,9 @@ function increaseMessageCount(topicName, messageType) {
|
|
|
103
139
|
}
|
|
104
140
|
}
|
|
105
141
|
function increaseInstanceCount(topicName) {
|
|
106
|
-
|
|
107
|
-
window["@onecx/accelerator"].topic.stats ??= {};
|
|
108
|
-
window["@onecx/accelerator"].topic.stats.instancesCreated ??= {};
|
|
142
|
+
const g2 = ensureProperty(globalThis, ["@onecx/accelerator", "topic", "stats", "instancesCreated"], {});
|
|
109
143
|
if (isStatsEnabled()) {
|
|
110
|
-
const instanceStats =
|
|
144
|
+
const instanceStats = g2["@onecx/accelerator"].topic.stats.instancesCreated;
|
|
111
145
|
if (!instanceStats[topicName]) {
|
|
112
146
|
instanceStats[topicName] = 0;
|
|
113
147
|
}
|
|
@@ -116,13 +150,13 @@ function increaseInstanceCount(topicName) {
|
|
|
116
150
|
}
|
|
117
151
|
|
|
118
152
|
// libs/accelerator/src/lib/topic/message.ts
|
|
119
|
-
|
|
153
|
+
var g = ensureProperty(globalThis, ["onecxMessageId"], 1);
|
|
120
154
|
var Message = class {
|
|
121
155
|
// id can be undefined while used via old implementation
|
|
122
156
|
constructor(type) {
|
|
123
157
|
this.type = type;
|
|
124
|
-
this.timestamp =
|
|
125
|
-
this.id =
|
|
158
|
+
this.timestamp = globalThis.performance?.now?.() ?? Date.now();
|
|
159
|
+
this.id = g.onecxMessageId++;
|
|
126
160
|
}
|
|
127
161
|
timestamp;
|
|
128
162
|
id;
|
|
@@ -204,26 +238,28 @@ var TopicPublisher = class {
|
|
|
204
238
|
if (this.publishBroadcastChannel && this.publishBroadcastChannelV2) {
|
|
205
239
|
return;
|
|
206
240
|
}
|
|
207
|
-
if (
|
|
241
|
+
if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel) {
|
|
208
242
|
if (typeof BroadcastChannel === "undefined") {
|
|
209
243
|
this.baseLogger.info("BroadcastChannel not supported. Disabling BroadcastChannel for topic publisher");
|
|
210
|
-
|
|
211
|
-
window["@onecx/accelerator"].topic ??= {};
|
|
212
|
-
window["@onecx/accelerator"].topic.useBroadcastChannel = false;
|
|
244
|
+
topicTabId["@onecx/accelerator"].topic.useBroadcastChannel = false;
|
|
213
245
|
} else {
|
|
214
246
|
this.publishBroadcastChannel = new BroadcastChannel(`Topic-${this.name}|${this.version}`);
|
|
215
|
-
this.publishBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${
|
|
247
|
+
this.publishBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${topicTabId["@onecx/accelerator"].topic.tabId}`);
|
|
216
248
|
}
|
|
217
249
|
}
|
|
218
250
|
}
|
|
219
251
|
sendMessage(message) {
|
|
220
252
|
this.createBroadcastChannel();
|
|
221
|
-
if (
|
|
253
|
+
if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel === "V2") {
|
|
222
254
|
this.publishBroadcastChannelV2?.postMessage(message);
|
|
223
|
-
} else if (
|
|
255
|
+
} else if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel) {
|
|
224
256
|
this.publishBroadcastChannel?.postMessage(message);
|
|
225
257
|
} else {
|
|
226
|
-
|
|
258
|
+
const postMessage = globalThis.postMessage;
|
|
259
|
+
if (typeof postMessage !== "function") {
|
|
260
|
+
throw new TypeError("postMessage is not available in this environment");
|
|
261
|
+
}
|
|
262
|
+
postMessage(message, "*");
|
|
227
263
|
}
|
|
228
264
|
}
|
|
229
265
|
};
|
|
@@ -240,18 +276,13 @@ var Topic = class extends TopicPublisher {
|
|
|
240
276
|
readBroadcastChannelV2;
|
|
241
277
|
constructor(name, version, sendGetMessage = true) {
|
|
242
278
|
super(name, version);
|
|
243
|
-
|
|
244
|
-
window["@onecx/accelerator"].topic ??= {};
|
|
245
|
-
window["@onecx/accelerator"].topic.initDate ??= Date.now();
|
|
246
|
-
if (window["@onecx/accelerator"]?.topic?.useBroadcastChannel) {
|
|
279
|
+
if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel) {
|
|
247
280
|
if (typeof BroadcastChannel === "undefined") {
|
|
248
281
|
this.logger.info("BroadcastChannel not supported. Disabling BroadcastChannel for topic");
|
|
249
|
-
|
|
250
|
-
window["@onecx/accelerator"].topic ??= {};
|
|
251
|
-
window["@onecx/accelerator"].topic.useBroadcastChannel = false;
|
|
282
|
+
topicTabId["@onecx/accelerator"].topic.useBroadcastChannel = false;
|
|
252
283
|
} else {
|
|
253
284
|
this.readBroadcastChannel = new BroadcastChannel(`Topic-${this.name}|${this.version}`);
|
|
254
|
-
this.readBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${
|
|
285
|
+
this.readBroadcastChannelV2 = new BroadcastChannel(`TopicV2-${this.name}|${this.version}-${topicTabId["@onecx/accelerator"].topic.tabId}`);
|
|
255
286
|
}
|
|
256
287
|
}
|
|
257
288
|
if (isStatsEnabled()) {
|
|
@@ -260,11 +291,14 @@ var Topic = class extends TopicPublisher {
|
|
|
260
291
|
this.isInitializedPromise = new Promise((resolve) => {
|
|
261
292
|
this.resolveInitPromise = resolve;
|
|
262
293
|
});
|
|
263
|
-
|
|
294
|
+
const addEventListener = globalThis.addEventListener;
|
|
295
|
+
if (typeof addEventListener === "function") {
|
|
296
|
+
addEventListener("message", this.windowEventListener);
|
|
297
|
+
}
|
|
264
298
|
this.readBroadcastChannel?.addEventListener("message", (m) => this.onBroadcastChannelMessage(m));
|
|
265
299
|
this.readBroadcastChannelV2?.addEventListener("message", (m) => this.onBroadcastChannelMessageV2(m));
|
|
266
300
|
if (sendGetMessage) {
|
|
267
|
-
if (
|
|
301
|
+
if (topicTabId["@onecx/accelerator"].topic.initDate && Date.now() - topicTabId["@onecx/accelerator"].topic.initDate < 2e3) {
|
|
268
302
|
setTimeout(() => {
|
|
269
303
|
if (!this.isInit) {
|
|
270
304
|
const message = new TopicMessage("TopicGet" /* TopicGet */, this.name, this.version);
|
|
@@ -323,7 +357,10 @@ var Topic = class extends TopicPublisher {
|
|
|
323
357
|
return this.asObservable().toPromise();
|
|
324
358
|
}
|
|
325
359
|
destroy() {
|
|
326
|
-
|
|
360
|
+
const removeEventListener = globalThis.removeEventListener;
|
|
361
|
+
if (typeof removeEventListener === "function") {
|
|
362
|
+
removeEventListener("message", this.windowEventListener, true);
|
|
363
|
+
}
|
|
327
364
|
this.readBroadcastChannel?.close();
|
|
328
365
|
this.publishBroadcastChannel?.close();
|
|
329
366
|
this.readBroadcastChannelV2?.close();
|
|
@@ -379,20 +416,16 @@ var Topic = class extends TopicPublisher {
|
|
|
379
416
|
}
|
|
380
417
|
}
|
|
381
418
|
disableBroadcastChannel() {
|
|
382
|
-
|
|
383
|
-
window["@onecx/accelerator"].topic ??= {};
|
|
384
|
-
if (window["@onecx/accelerator"].topic.useBroadcastChannel === true) {
|
|
419
|
+
if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel === true) {
|
|
385
420
|
this.logger.info("Disabling BroadcastChannel for topic");
|
|
386
421
|
}
|
|
387
|
-
|
|
422
|
+
topicTabId["@onecx/accelerator"].topic.useBroadcastChannel = false;
|
|
388
423
|
}
|
|
389
424
|
disableBroadcastChannelV2() {
|
|
390
|
-
|
|
391
|
-
window["@onecx/accelerator"].topic ??= {};
|
|
392
|
-
if (window["@onecx/accelerator"].topic.useBroadcastChannel === "V2") {
|
|
425
|
+
if (topicTabId["@onecx/accelerator"].topic.useBroadcastChannel === "V2") {
|
|
393
426
|
this.logger.info("Disabling BroadcastChannel V2 for topic");
|
|
394
427
|
}
|
|
395
|
-
|
|
428
|
+
topicTabId["@onecx/accelerator"].topic.useBroadcastChannel = true;
|
|
396
429
|
}
|
|
397
430
|
handleTopicResolveMessage(m) {
|
|
398
431
|
const publishPromiseResolver = this.publishPromiseResolver[m.data.resolveId];
|
|
@@ -430,24 +463,6 @@ var Topic = class extends TopicPublisher {
|
|
|
430
463
|
// libs/accelerator/src/lib/topic/mocks/fake-topic.ts
|
|
431
464
|
var import_rxjs2 = require("rxjs");
|
|
432
465
|
|
|
433
|
-
// libs/accelerator/src/lib/utils/ensure-property.utils.ts
|
|
434
|
-
function ensureProperty(obj, path, initialValue) {
|
|
435
|
-
let current = obj;
|
|
436
|
-
for (let i = 0; i < path.length - 1; i++) {
|
|
437
|
-
const key = path[i];
|
|
438
|
-
if (current[key] == null || typeof current[key] !== "object") {
|
|
439
|
-
current[key] = {};
|
|
440
|
-
}
|
|
441
|
-
current = current[key];
|
|
442
|
-
}
|
|
443
|
-
const lastKey = path.at(-1);
|
|
444
|
-
if (lastKey === void 0) {
|
|
445
|
-
return obj;
|
|
446
|
-
}
|
|
447
|
-
current[lastKey] ??= initialValue;
|
|
448
|
-
return obj;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
466
|
// libs/integration-interface/src/lib/topics/current-mfe/v1/current-mfe.topic.ts
|
|
452
467
|
var CurrentMfeTopic = class extends Topic {
|
|
453
468
|
constructor() {
|
|
@@ -817,9 +832,17 @@ var ShellCapability = /* @__PURE__ */ ((ShellCapability2) => {
|
|
|
817
832
|
})(ShellCapability || {});
|
|
818
833
|
|
|
819
834
|
// libs/integration-interface/src/lib/utils/shell-capability.utils.ts
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
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
|
+
};
|
|
823
846
|
|
|
824
847
|
// libs/integration-interface/src/lib/services/dynamic-translation.service.ts
|
|
825
848
|
var UNVERSIONED_KEY = "undefined";
|
|
@@ -1074,3 +1097,263 @@ var DynamicTranslationService = class {
|
|
|
1074
1097
|
this.dynamicTranslationsTopic$.destroy();
|
|
1075
1098
|
}
|
|
1076
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
|
+
};
|