@entur-partner/app-shell 6.1.5 → 6.1.6-alpha.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.
- package/dist/AppShell.d.ts +20 -20
- package/dist/ConsentManagerProvider.d.ts +16 -16
- package/dist/EnvironmentBanner.d.ts +7 -7
- package/dist/LanguageProvider.d.ts +12 -12
- package/dist/MenuProvider.d.ts +17 -17
- package/dist/MicroFrontendLink.d.ts +8 -8
- package/dist/OrganisationProvider.d.ts +13 -13
- package/dist/OrganisationSelector.d.ts +15 -15
- package/dist/OrganisationsError.d.ts +3 -3
- package/dist/PostHogProviderWrapper.d.ts +32 -32
- package/dist/app-shell.cjs.development.js +447 -664
- package/dist/app-shell.cjs.development.js.map +1 -1
- package/dist/app-shell.cjs.production.min.js +1 -1
- package/dist/app-shell.cjs.production.min.js.map +1 -1
- package/dist/app-shell.esm.js +427 -639
- package/dist/app-shell.esm.js.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/storage.d.ts +14 -14
- package/dist/types/ConsentTypes.d.ts +33 -33
- package/dist/types/UserTypes.d.ts +3 -3
- package/dist/util/convertUCServicesToConsents.d.ts +13 -13
- package/package.json +53 -54
package/dist/app-shell.esm.js
CHANGED
|
@@ -1,14 +1,39 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Auth0Provider, useAuth0 } from '@auth0/auth0-react';
|
|
2
2
|
import { BannerAlertBox } from '@entur/alert';
|
|
3
|
-
import { Paragraph, Link, CodeText } from '@entur/typography';
|
|
4
3
|
import { Loader, SkeletonRectangle } from '@entur/loader';
|
|
5
4
|
import { space } from '@entur/tokens';
|
|
6
|
-
import {
|
|
5
|
+
import { Paragraph, Link, CodeText } from '@entur/typography';
|
|
7
6
|
import { getColorForEnvironment, Environment, OrganisationDropDown } from '@entur-partner/common';
|
|
8
7
|
import { assertIsDefined } from '@entur-partner/util';
|
|
8
|
+
import React, { useState, useEffect, useContext, createContext, useCallback } from 'react';
|
|
9
9
|
import postHog from 'posthog-js';
|
|
10
10
|
import { PostHogProvider } from 'posthog-js/react';
|
|
11
11
|
|
|
12
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
13
|
+
try {
|
|
14
|
+
var i = n[a](c),
|
|
15
|
+
u = i.value;
|
|
16
|
+
} catch (n) {
|
|
17
|
+
return void e(n);
|
|
18
|
+
}
|
|
19
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
20
|
+
}
|
|
21
|
+
function _asyncToGenerator(n) {
|
|
22
|
+
return function () {
|
|
23
|
+
var t = this,
|
|
24
|
+
e = arguments;
|
|
25
|
+
return new Promise(function (r, o) {
|
|
26
|
+
var a = n.apply(t, e);
|
|
27
|
+
function _next(n) {
|
|
28
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
29
|
+
}
|
|
30
|
+
function _throw(n) {
|
|
31
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
32
|
+
}
|
|
33
|
+
_next(void 0);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
}
|
|
12
37
|
function _construct(t, e, r) {
|
|
13
38
|
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
14
39
|
var o = [null];
|
|
@@ -16,6 +41,30 @@ function _construct(t, e, r) {
|
|
|
16
41
|
var p = new (t.bind.apply(t, o))();
|
|
17
42
|
return r && _setPrototypeOf(p, r.prototype), p;
|
|
18
43
|
}
|
|
44
|
+
function _extends() {
|
|
45
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
46
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
47
|
+
var t = arguments[e];
|
|
48
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
49
|
+
}
|
|
50
|
+
return n;
|
|
51
|
+
}, _extends.apply(null, arguments);
|
|
52
|
+
}
|
|
53
|
+
function _getPrototypeOf(t) {
|
|
54
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
55
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
56
|
+
}, _getPrototypeOf(t);
|
|
57
|
+
}
|
|
58
|
+
function _inheritsLoose(t, o) {
|
|
59
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
60
|
+
}
|
|
61
|
+
function _isNativeFunction(t) {
|
|
62
|
+
try {
|
|
63
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
64
|
+
} catch (n) {
|
|
65
|
+
return "function" == typeof t;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
19
68
|
function _isNativeReflectConstruct() {
|
|
20
69
|
try {
|
|
21
70
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
@@ -24,413 +73,149 @@ function _isNativeReflectConstruct() {
|
|
|
24
73
|
return !!t;
|
|
25
74
|
})();
|
|
26
75
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
r = Object.prototype,
|
|
34
|
-
n = r.hasOwnProperty,
|
|
35
|
-
o = Object.defineProperty || function (t, e, r) {
|
|
36
|
-
t[e] = r.value;
|
|
37
|
-
},
|
|
38
|
-
i = "function" == typeof Symbol ? Symbol : {},
|
|
39
|
-
a = i.iterator || "@@iterator",
|
|
40
|
-
c = i.asyncIterator || "@@asyncIterator",
|
|
41
|
-
u = i.toStringTag || "@@toStringTag";
|
|
42
|
-
function define(t, e, r) {
|
|
43
|
-
return Object.defineProperty(t, e, {
|
|
44
|
-
value: r,
|
|
45
|
-
enumerable: !0,
|
|
46
|
-
configurable: !0,
|
|
47
|
-
writable: !0
|
|
48
|
-
}), t[e];
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
define({}, "");
|
|
52
|
-
} catch (t) {
|
|
53
|
-
define = function (t, e, r) {
|
|
54
|
-
return t[e] = r;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function wrap(t, e, r, n) {
|
|
58
|
-
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
59
|
-
a = Object.create(i.prototype),
|
|
60
|
-
c = new Context(n || []);
|
|
61
|
-
return o(a, "_invoke", {
|
|
62
|
-
value: makeInvokeMethod(t, r, c)
|
|
63
|
-
}), a;
|
|
76
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
77
|
+
if (null == r) return {};
|
|
78
|
+
var t = {};
|
|
79
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
80
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
81
|
+
t[n] = r[n];
|
|
64
82
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
function AsyncIterator(t, e) {
|
|
103
|
-
function invoke(r, o, i, a) {
|
|
104
|
-
var c = tryCatch(t[r], t, o);
|
|
105
|
-
if ("throw" !== c.type) {
|
|
106
|
-
var u = c.arg,
|
|
107
|
-
h = u.value;
|
|
108
|
-
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
109
|
-
invoke("next", t, i, a);
|
|
110
|
-
}, function (t) {
|
|
111
|
-
invoke("throw", t, i, a);
|
|
112
|
-
}) : e.resolve(h).then(function (t) {
|
|
113
|
-
u.value = t, i(u);
|
|
114
|
-
}, function (t) {
|
|
115
|
-
return invoke("throw", t, i, a);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
a(c.arg);
|
|
119
|
-
}
|
|
120
|
-
var r;
|
|
121
|
-
o(this, "_invoke", {
|
|
122
|
-
value: function (t, n) {
|
|
123
|
-
function callInvokeWithMethodAndArg() {
|
|
124
|
-
return new e(function (e, r) {
|
|
125
|
-
invoke(t, n, e, r);
|
|
126
|
-
});
|
|
83
|
+
return t;
|
|
84
|
+
}
|
|
85
|
+
function _regenerator() {
|
|
86
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
87
|
+
var e,
|
|
88
|
+
t,
|
|
89
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
90
|
+
n = r.iterator || "@@iterator",
|
|
91
|
+
o = r.toStringTag || "@@toStringTag";
|
|
92
|
+
function i(r, n, o, i) {
|
|
93
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
94
|
+
u = Object.create(c.prototype);
|
|
95
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
96
|
+
var i,
|
|
97
|
+
c,
|
|
98
|
+
u,
|
|
99
|
+
f = 0,
|
|
100
|
+
p = o || [],
|
|
101
|
+
y = !1,
|
|
102
|
+
G = {
|
|
103
|
+
p: 0,
|
|
104
|
+
n: 0,
|
|
105
|
+
v: e,
|
|
106
|
+
a: d,
|
|
107
|
+
f: d.bind(e, 4),
|
|
108
|
+
d: function (t, r) {
|
|
109
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
function d(r, n) {
|
|
113
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
114
|
+
var o,
|
|
115
|
+
i = p[t],
|
|
116
|
+
d = G.p,
|
|
117
|
+
l = i[2];
|
|
118
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
127
119
|
}
|
|
128
|
-
|
|
120
|
+
if (o || r > 1) return a;
|
|
121
|
+
throw y = !0, n;
|
|
129
122
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
123
|
+
return function (o, p, l) {
|
|
124
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
125
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
126
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
127
|
+
try {
|
|
128
|
+
if (f = 2, i) {
|
|
129
|
+
if (c || (o = "next"), t = i[o]) {
|
|
130
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
131
|
+
if (!t.done) return t;
|
|
132
|
+
u = t.value, c < 2 && (c = 0);
|
|
133
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
134
|
+
i = e;
|
|
135
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
136
|
+
} catch (t) {
|
|
137
|
+
i = e, c = 1, u = t;
|
|
138
|
+
} finally {
|
|
139
|
+
f = 1;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
138
142
|
return {
|
|
139
143
|
value: t,
|
|
140
|
-
done:
|
|
144
|
+
done: y
|
|
141
145
|
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
var c = n.delegate;
|
|
145
|
-
if (c) {
|
|
146
|
-
var u = maybeInvokeDelegate(c, n);
|
|
147
|
-
if (u) {
|
|
148
|
-
if (u === y) continue;
|
|
149
|
-
return u;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
153
|
-
if (o === h) throw o = s, n.arg;
|
|
154
|
-
n.dispatchException(n.arg);
|
|
155
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
156
|
-
o = f;
|
|
157
|
-
var p = tryCatch(e, r, n);
|
|
158
|
-
if ("normal" === p.type) {
|
|
159
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
160
|
-
return {
|
|
161
|
-
value: p.arg,
|
|
162
|
-
done: n.done
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
function maybeInvokeDelegate(e, r) {
|
|
170
|
-
var n = r.method,
|
|
171
|
-
o = e.iterator[n];
|
|
172
|
-
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
173
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
174
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
175
|
-
var a = i.arg;
|
|
176
|
-
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
177
|
-
}
|
|
178
|
-
function pushTryEntry(t) {
|
|
179
|
-
var e = {
|
|
180
|
-
tryLoc: t[0]
|
|
181
|
-
};
|
|
182
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
183
|
-
}
|
|
184
|
-
function resetTryEntry(t) {
|
|
185
|
-
var e = t.completion || {};
|
|
186
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
187
|
-
}
|
|
188
|
-
function Context(t) {
|
|
189
|
-
this.tryEntries = [{
|
|
190
|
-
tryLoc: "root"
|
|
191
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
146
|
+
};
|
|
147
|
+
}(r, o, i), !0), u;
|
|
192
148
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return i.next = i;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
149
|
+
var a = {};
|
|
150
|
+
function Generator() {}
|
|
151
|
+
function GeneratorFunction() {}
|
|
152
|
+
function GeneratorFunctionPrototype() {}
|
|
153
|
+
t = Object.getPrototypeOf;
|
|
154
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
155
|
+
return this;
|
|
156
|
+
}), t),
|
|
157
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
158
|
+
function f(e) {
|
|
159
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
208
160
|
}
|
|
209
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype,
|
|
210
|
-
value: GeneratorFunctionPrototype,
|
|
211
|
-
configurable: !0
|
|
212
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
213
|
-
value: GeneratorFunction,
|
|
214
|
-
configurable: !0
|
|
215
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
216
|
-
var e = "function" == typeof t && t.constructor;
|
|
217
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
218
|
-
}, e.mark = function (t) {
|
|
219
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
220
|
-
}, e.awrap = function (t) {
|
|
221
|
-
return {
|
|
222
|
-
__await: t
|
|
223
|
-
};
|
|
224
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
161
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
225
162
|
return this;
|
|
226
|
-
}),
|
|
227
|
-
void 0 === i && (i = Promise);
|
|
228
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
229
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
230
|
-
return t.done ? t.value : a.next();
|
|
231
|
-
});
|
|
232
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
233
|
-
return this;
|
|
234
|
-
}), define(g, "toString", function () {
|
|
163
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
235
164
|
return "[object Generator]";
|
|
236
|
-
}),
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return r.reverse(), function next() {
|
|
241
|
-
for (; r.length;) {
|
|
242
|
-
var t = r.pop();
|
|
243
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
244
|
-
}
|
|
245
|
-
return next.done = !0, next;
|
|
165
|
+
}), (_regenerator = function () {
|
|
166
|
+
return {
|
|
167
|
+
w: i,
|
|
168
|
+
m: f
|
|
246
169
|
};
|
|
247
|
-
}
|
|
248
|
-
constructor: Context,
|
|
249
|
-
reset: function (e) {
|
|
250
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
251
|
-
},
|
|
252
|
-
stop: function () {
|
|
253
|
-
this.done = !0;
|
|
254
|
-
var t = this.tryEntries[0].completion;
|
|
255
|
-
if ("throw" === t.type) throw t.arg;
|
|
256
|
-
return this.rval;
|
|
257
|
-
},
|
|
258
|
-
dispatchException: function (e) {
|
|
259
|
-
if (this.done) throw e;
|
|
260
|
-
var r = this;
|
|
261
|
-
function handle(n, o) {
|
|
262
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
263
|
-
}
|
|
264
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
265
|
-
var i = this.tryEntries[o],
|
|
266
|
-
a = i.completion;
|
|
267
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
268
|
-
if (i.tryLoc <= this.prev) {
|
|
269
|
-
var c = n.call(i, "catchLoc"),
|
|
270
|
-
u = n.call(i, "finallyLoc");
|
|
271
|
-
if (c && u) {
|
|
272
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
273
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
274
|
-
} else if (c) {
|
|
275
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
276
|
-
} else {
|
|
277
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
278
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
abrupt: function (t, e) {
|
|
284
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
285
|
-
var o = this.tryEntries[r];
|
|
286
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
287
|
-
var i = o;
|
|
288
|
-
break;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
292
|
-
var a = i ? i.completion : {};
|
|
293
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
294
|
-
},
|
|
295
|
-
complete: function (t, e) {
|
|
296
|
-
if ("throw" === t.type) throw t.arg;
|
|
297
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
298
|
-
},
|
|
299
|
-
finish: function (t) {
|
|
300
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
301
|
-
var r = this.tryEntries[e];
|
|
302
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
catch: function (t) {
|
|
306
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
307
|
-
var r = this.tryEntries[e];
|
|
308
|
-
if (r.tryLoc === t) {
|
|
309
|
-
var n = r.completion;
|
|
310
|
-
if ("throw" === n.type) {
|
|
311
|
-
var o = n.arg;
|
|
312
|
-
resetTryEntry(r);
|
|
313
|
-
}
|
|
314
|
-
return o;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
throw Error("illegal catch attempt");
|
|
318
|
-
},
|
|
319
|
-
delegateYield: function (e, r, n) {
|
|
320
|
-
return this.delegate = {
|
|
321
|
-
iterator: values(e),
|
|
322
|
-
resultName: r,
|
|
323
|
-
nextLoc: n
|
|
324
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
325
|
-
}
|
|
326
|
-
}, e;
|
|
170
|
+
})();
|
|
327
171
|
}
|
|
328
|
-
function
|
|
172
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
173
|
+
var i = Object.defineProperty;
|
|
329
174
|
try {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
reject(error);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
if (info.done) {
|
|
337
|
-
resolve(value);
|
|
338
|
-
} else {
|
|
339
|
-
Promise.resolve(value).then(_next, _throw);
|
|
175
|
+
i({}, "", {});
|
|
176
|
+
} catch (e) {
|
|
177
|
+
i = 0;
|
|
340
178
|
}
|
|
341
|
-
|
|
342
|
-
function
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
return new Promise(function (resolve, reject) {
|
|
347
|
-
var gen = fn.apply(self, args);
|
|
348
|
-
function _next(value) {
|
|
349
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
350
|
-
}
|
|
351
|
-
function _throw(err) {
|
|
352
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
353
|
-
}
|
|
354
|
-
_next(undefined);
|
|
355
|
-
});
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
function _extends() {
|
|
359
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
360
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
361
|
-
var source = arguments[i];
|
|
362
|
-
for (var key in source) {
|
|
363
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
364
|
-
target[key] = source[key];
|
|
365
|
-
}
|
|
366
|
-
}
|
|
179
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
180
|
+
function o(r, n) {
|
|
181
|
+
_regeneratorDefine(e, r, function (e) {
|
|
182
|
+
return this._invoke(r, n, e);
|
|
183
|
+
});
|
|
367
184
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
_setPrototypeOf(subClass, superClass);
|
|
376
|
-
}
|
|
377
|
-
function _getPrototypeOf(o) {
|
|
378
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
379
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
380
|
-
};
|
|
381
|
-
return _getPrototypeOf(o);
|
|
185
|
+
r ? i ? i(e, r, {
|
|
186
|
+
value: n,
|
|
187
|
+
enumerable: !t,
|
|
188
|
+
configurable: !t,
|
|
189
|
+
writable: !t
|
|
190
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
191
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
382
192
|
}
|
|
383
|
-
function _setPrototypeOf(
|
|
384
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
};
|
|
388
|
-
return _setPrototypeOf(o, p);
|
|
193
|
+
function _setPrototypeOf(t, e) {
|
|
194
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
195
|
+
return t.__proto__ = e, t;
|
|
196
|
+
}, _setPrototypeOf(t, e);
|
|
389
197
|
}
|
|
390
|
-
function
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
399
|
-
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
400
|
-
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
401
|
-
if (typeof Class !== "function") {
|
|
402
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
403
|
-
}
|
|
404
|
-
if (typeof _cache !== "undefined") {
|
|
405
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
406
|
-
_cache.set(Class, Wrapper);
|
|
198
|
+
function _wrapNativeSuper(t) {
|
|
199
|
+
var r = "function" == typeof Map ? new Map() : void 0;
|
|
200
|
+
return _wrapNativeSuper = function (t) {
|
|
201
|
+
if (null === t || !_isNativeFunction(t)) return t;
|
|
202
|
+
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
203
|
+
if (void 0 !== r) {
|
|
204
|
+
if (r.has(t)) return r.get(t);
|
|
205
|
+
r.set(t, Wrapper);
|
|
407
206
|
}
|
|
408
207
|
function Wrapper() {
|
|
409
|
-
return _construct(
|
|
208
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
410
209
|
}
|
|
411
|
-
Wrapper.prototype = Object.create(
|
|
210
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
412
211
|
constructor: {
|
|
413
212
|
value: Wrapper,
|
|
414
|
-
enumerable:
|
|
415
|
-
writable:
|
|
416
|
-
configurable:
|
|
213
|
+
enumerable: !1,
|
|
214
|
+
writable: !0,
|
|
215
|
+
configurable: !0
|
|
417
216
|
}
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
};
|
|
421
|
-
return _wrapNativeSuper(Class);
|
|
422
|
-
}
|
|
423
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
424
|
-
if (source == null) return {};
|
|
425
|
-
var target = {};
|
|
426
|
-
var sourceKeys = Object.keys(source);
|
|
427
|
-
var key, i;
|
|
428
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
429
|
-
key = sourceKeys[i];
|
|
430
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
431
|
-
target[key] = source[key];
|
|
432
|
-
}
|
|
433
|
-
return target;
|
|
217
|
+
}), _setPrototypeOf(Wrapper, t);
|
|
218
|
+
}, _wrapNativeSuper(t);
|
|
434
219
|
}
|
|
435
220
|
|
|
436
221
|
var EnvironmentBanner = function EnvironmentBanner(_ref) {
|
|
@@ -438,13 +223,13 @@ var EnvironmentBanner = function EnvironmentBanner(_ref) {
|
|
|
438
223
|
return React.createElement("div", {
|
|
439
224
|
className: "epp-environment-banner",
|
|
440
225
|
style: {
|
|
441
|
-
position:
|
|
226
|
+
position: "fixed",
|
|
442
227
|
zIndex: 9999,
|
|
443
228
|
top: 0,
|
|
444
229
|
left: 0,
|
|
445
230
|
right: 0,
|
|
446
|
-
width:
|
|
447
|
-
height:
|
|
231
|
+
width: "100vw",
|
|
232
|
+
height: "16px",
|
|
448
233
|
backgroundColor: getColorForEnvironment(environment)
|
|
449
234
|
}
|
|
450
235
|
});
|
|
@@ -477,32 +262,31 @@ var Authenticate = function Authenticate(_ref) {
|
|
|
477
262
|
error = _useAuth.error;
|
|
478
263
|
useEffect(function () {
|
|
479
264
|
var fetchUserData = /*#__PURE__*/function () {
|
|
480
|
-
var _ref2 = _asyncToGenerator(
|
|
481
|
-
var token, decoratedUser;
|
|
482
|
-
return
|
|
483
|
-
while (1) switch (_context.
|
|
265
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
266
|
+
var token, decoratedUser, _t;
|
|
267
|
+
return _regenerator().w(function (_context) {
|
|
268
|
+
while (1) switch (_context.p = _context.n) {
|
|
484
269
|
case 0:
|
|
485
|
-
_context.
|
|
486
|
-
_context.
|
|
270
|
+
_context.p = 0;
|
|
271
|
+
_context.n = 1;
|
|
487
272
|
return getAccessTokenSilently();
|
|
488
|
-
case
|
|
489
|
-
token = _context.
|
|
490
|
-
_context.
|
|
273
|
+
case 1:
|
|
274
|
+
token = _context.v;
|
|
275
|
+
_context.n = 2;
|
|
491
276
|
return decorateUser(user, token);
|
|
492
|
-
case
|
|
493
|
-
decoratedUser = _context.
|
|
277
|
+
case 2:
|
|
278
|
+
decoratedUser = _context.v;
|
|
494
279
|
setUserWithPermission(decoratedUser);
|
|
495
|
-
_context.
|
|
280
|
+
_context.n = 4;
|
|
496
281
|
break;
|
|
497
|
-
case
|
|
498
|
-
_context.
|
|
499
|
-
|
|
500
|
-
console.error(
|
|
501
|
-
case
|
|
502
|
-
|
|
503
|
-
return _context.stop();
|
|
282
|
+
case 3:
|
|
283
|
+
_context.p = 3;
|
|
284
|
+
_t = _context.v;
|
|
285
|
+
console.error("Error fetching user data:", _t);
|
|
286
|
+
case 4:
|
|
287
|
+
return _context.a(2);
|
|
504
288
|
}
|
|
505
|
-
}, _callee, null, [[0,
|
|
289
|
+
}, _callee, null, [[0, 3]]);
|
|
506
290
|
}));
|
|
507
291
|
return function fetchUserData() {
|
|
508
292
|
return _ref2.apply(this, arguments);
|
|
@@ -528,15 +312,15 @@ var Authenticate = function Authenticate(_ref) {
|
|
|
528
312
|
}, "Authenticating");
|
|
529
313
|
}
|
|
530
314
|
if (error) {
|
|
531
|
-
process.env.NODE_ENV !==
|
|
315
|
+
process.env.NODE_ENV !== "production" && console.error(error);
|
|
532
316
|
return React.createElement(BannerAlertBox, {
|
|
533
317
|
variant: "error",
|
|
534
318
|
title: "Authentication failed",
|
|
535
319
|
style: {
|
|
536
|
-
maxWidth:
|
|
537
|
-
margin:
|
|
320
|
+
maxWidth: "600px",
|
|
321
|
+
margin: "0 auto"
|
|
538
322
|
}
|
|
539
|
-
}, React.createElement(Paragraph, null, "Something went wrong while trying to authenticate you. If the problem persists you should contact",
|
|
323
|
+
}, React.createElement(Paragraph, null, "Something went wrong while trying to authenticate you. If the problem persists you should contact", " ", React.createElement(Link, {
|
|
540
324
|
href: "mailto:support@entur.org"
|
|
541
325
|
}, "support@entur.org"), " to get it resolved."), React.createElement(Paragraph, null, "Authentication failed with: ", React.createElement(CodeText, null, error == null ? void 0 : error.toString())));
|
|
542
326
|
}
|
|
@@ -572,38 +356,163 @@ var AppShell = function AppShell(_ref3) {
|
|
|
572
356
|
}));
|
|
573
357
|
};
|
|
574
358
|
|
|
575
|
-
var
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
359
|
+
var ORGANISATION_STORAGE_KEY = "EP::activeOrgId";
|
|
360
|
+
var organisationStorage = {
|
|
361
|
+
get: function get() {
|
|
362
|
+
return localStorage.getItem(ORGANISATION_STORAGE_KEY);
|
|
363
|
+
},
|
|
364
|
+
set: function set(value) {
|
|
365
|
+
return localStorage.setItem(ORGANISATION_STORAGE_KEY, value);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
var LANGUAGE_STORAGE_KEY = "EP::locale";
|
|
369
|
+
var languageStorage = {
|
|
370
|
+
get: function get() {
|
|
371
|
+
return localStorage.getItem(LANGUAGE_STORAGE_KEY);
|
|
372
|
+
},
|
|
373
|
+
set: function set(value) {
|
|
374
|
+
return localStorage.setItem(LANGUAGE_STORAGE_KEY, value);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
var UC_UI_STORAGE_KEY = "ucData";
|
|
378
|
+
var ucUiStorage = {
|
|
379
|
+
get: function get() {
|
|
380
|
+
return localStorage.getItem(UC_UI_STORAGE_KEY);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
var SERVICE_NAMES = {
|
|
385
|
+
Usercentrics: "Usercentrics Consent Management Platform",
|
|
386
|
+
PostHog: "PostHog.com",
|
|
387
|
+
Sentry: "Sentry"
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
var DEFAULT_CONSENT_GIVEN = {
|
|
391
|
+
Usercentrics: {
|
|
392
|
+
consentGiven: false
|
|
393
|
+
},
|
|
394
|
+
PostHog: {
|
|
395
|
+
consentGiven: false
|
|
396
|
+
},
|
|
397
|
+
Sentry: {
|
|
398
|
+
consentGiven: false
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
var convertUCServicesToConsents = function convertUCServicesToConsents(services) {
|
|
402
|
+
return services.map(function (service) {
|
|
403
|
+
var _Object$entries$find, _ref3;
|
|
404
|
+
var serviceName = (_Object$entries$find = Object.entries(SERVICE_NAMES).find(function (keyValue) {
|
|
405
|
+
return keyValue[1] === service.name;
|
|
406
|
+
})) == null ? void 0 : _Object$entries$find[0];
|
|
407
|
+
// Ensure the service name exists in SERVICE_NAMES
|
|
408
|
+
assertIsDefined(serviceName, "Service name " + service.name + " not found in SERVICE_NAMES");
|
|
409
|
+
if (typeof service.consent === "boolean") {
|
|
410
|
+
var _ref;
|
|
411
|
+
var consentGiven = service.consent;
|
|
412
|
+
return _ref = {}, _ref[serviceName] = {
|
|
413
|
+
consentGiven: consentGiven
|
|
414
|
+
}, _ref;
|
|
415
|
+
} else if (typeof service.consent === "object" && "given" in service.consent) {
|
|
416
|
+
var _ref2;
|
|
417
|
+
var _consentGiven = service.consent.given;
|
|
418
|
+
return _ref2 = {}, _ref2[serviceName] = {
|
|
419
|
+
consentGiven: _consentGiven
|
|
420
|
+
}, _ref2;
|
|
421
|
+
}
|
|
422
|
+
return _ref3 = {}, _ref3[serviceName] = {
|
|
423
|
+
consentGiven: false
|
|
424
|
+
}, _ref3;
|
|
425
|
+
}).reduce(
|
|
426
|
+
// biome-ignore lint/performance/noAccumulatingSpread: Ignore it for now. No changes in code.
|
|
427
|
+
function (acc, curr) {
|
|
428
|
+
return _extends({}, acc, curr);
|
|
429
|
+
}, DEFAULT_CONSENT_GIVEN);
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
var ConsentContext = /*#__PURE__*/createContext(DEFAULT_CONSENT_GIVEN);
|
|
433
|
+
var useConsentManager = function useConsentManager() {
|
|
434
|
+
var context = useContext(ConsentContext);
|
|
435
|
+
return context;
|
|
436
|
+
};
|
|
437
|
+
var ConsentManagerProvider = function ConsentManagerProvider(_ref) {
|
|
438
|
+
var children = _ref.children;
|
|
439
|
+
var _useState = useState(DEFAULT_CONSENT_GIVEN),
|
|
440
|
+
consentManager = _useState[0],
|
|
441
|
+
setConsentManager = _useState[1];
|
|
442
|
+
// Initialize consent manager from local storage once
|
|
443
|
+
useEffect(function () {
|
|
444
|
+
if (typeof window === "undefined") return;
|
|
445
|
+
var ucData = ucUiStorage.get();
|
|
446
|
+
if (ucData) {
|
|
447
|
+
var data = JSON.parse(ucData);
|
|
448
|
+
var services = convertUCServicesToConsents(Object.values(data.consent.services));
|
|
449
|
+
setConsentManager(services);
|
|
450
|
+
}
|
|
451
|
+
}, []);
|
|
452
|
+
// Listen for Usercentrics consent events and update consent manager state
|
|
453
|
+
useEffect(function () {
|
|
454
|
+
var handleConsentEvent = /*#__PURE__*/function () {
|
|
455
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
|
|
456
|
+
var customEvent, services, updatedConsentManager;
|
|
457
|
+
return _regenerator().w(function (_context) {
|
|
458
|
+
while (1) switch (_context.n) {
|
|
459
|
+
case 0:
|
|
460
|
+
if (!(typeof window === "undefined")) {
|
|
461
|
+
_context.n = 1;
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
return _context.a(2);
|
|
465
|
+
case 1:
|
|
466
|
+
customEvent = event;
|
|
467
|
+
services = Object.values(customEvent.detail.services);
|
|
468
|
+
updatedConsentManager = convertUCServicesToConsents(services);
|
|
469
|
+
setConsentManager(updatedConsentManager);
|
|
470
|
+
case 2:
|
|
471
|
+
return _context.a(2);
|
|
472
|
+
}
|
|
473
|
+
}, _callee);
|
|
474
|
+
}));
|
|
475
|
+
return function handleConsentEvent(_x) {
|
|
476
|
+
return _ref2.apply(this, arguments);
|
|
477
|
+
};
|
|
478
|
+
}();
|
|
479
|
+
window.addEventListener("UC_CONSENT", handleConsentEvent);
|
|
480
|
+
return function () {
|
|
481
|
+
return window.removeEventListener("UC_CONSENT", handleConsentEvent);
|
|
482
|
+
};
|
|
483
|
+
}, []);
|
|
484
|
+
return React.createElement(ConsentContext.Provider, {
|
|
485
|
+
value: consentManager
|
|
486
|
+
}, children);
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
var LanguageContext = /*#__PURE__*/React.createContext(undefined);
|
|
490
|
+
var useLanguageState = function useLanguageState(language) {
|
|
491
|
+
var _useState = useState(language),
|
|
492
|
+
activeLanguage = _useState[0],
|
|
493
|
+
setLanguage = _useState[1];
|
|
494
|
+
useEffect(function () {
|
|
495
|
+
languageStorage.set(activeLanguage);
|
|
496
|
+
}, [activeLanguage]);
|
|
497
|
+
return [activeLanguage, setLanguage];
|
|
498
|
+
};
|
|
499
|
+
var useLanguage = function useLanguage() {
|
|
500
|
+
var context = useContext(LanguageContext);
|
|
501
|
+
assertIsDefined(context);
|
|
502
|
+
return context;
|
|
503
|
+
};
|
|
504
|
+
var LanguageProvider = function LanguageProvider(_ref) {
|
|
505
|
+
var children = _ref.children,
|
|
506
|
+
language = _ref.language;
|
|
507
|
+
var _useLanguageState = useLanguageState(language),
|
|
508
|
+
activeLanguage = _useLanguageState[0],
|
|
509
|
+
setLanguage = _useLanguageState[1];
|
|
510
|
+
return React.createElement(LanguageContext.Provider, {
|
|
511
|
+
value: {
|
|
512
|
+
language: activeLanguage,
|
|
513
|
+
setLanguage: setLanguage
|
|
514
|
+
}
|
|
515
|
+
}, children);
|
|
607
516
|
};
|
|
608
517
|
|
|
609
518
|
var MenuContext = /*#__PURE__*/React.createContext({
|
|
@@ -641,7 +550,7 @@ var MenuProvider = function MenuProvider(_ref) {
|
|
|
641
550
|
var _extends2;
|
|
642
551
|
return _extends({}, prevState, (_extends2 = {}, _extends2[path] = newItems, _extends2));
|
|
643
552
|
});
|
|
644
|
-
}, [
|
|
553
|
+
}, []);
|
|
645
554
|
var getMFNavigate = function getMFNavigate(path) {
|
|
646
555
|
return navFuncs[path];
|
|
647
556
|
};
|
|
@@ -664,29 +573,42 @@ var MenuProvider = function MenuProvider(_ref) {
|
|
|
664
573
|
}, children);
|
|
665
574
|
};
|
|
666
575
|
|
|
667
|
-
var
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
576
|
+
var _excluded$1 = ["navigate", "children", "onClick", "target"];
|
|
577
|
+
function isModifiedEvent(event) {
|
|
578
|
+
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
579
|
+
}
|
|
580
|
+
var MicroFrontendLink = function MicroFrontendLink(_ref) {
|
|
581
|
+
var navigate = _ref.navigate,
|
|
582
|
+
children = _ref.children,
|
|
583
|
+
_onClick = _ref.onClick,
|
|
584
|
+
target = _ref.target,
|
|
585
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
586
|
+
return (
|
|
587
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: Ignore lint rule for now. No changes in code.
|
|
588
|
+
React.createElement("a", _extends({
|
|
589
|
+
// biome-ignore lint/a11y/useValidAnchor: Ignore lint rule for now. No changes in code.
|
|
590
|
+
onClick: function onClick(event) {
|
|
591
|
+
try {
|
|
592
|
+
if (_onClick) _onClick(event);
|
|
593
|
+
} catch (ex) {
|
|
594
|
+
event.preventDefault();
|
|
595
|
+
throw ex;
|
|
596
|
+
}
|
|
597
|
+
if (!event.defaultPrevented &&
|
|
598
|
+
// onClick prevented default
|
|
599
|
+
event.button === 0 && (
|
|
600
|
+
// ignore everything but right clicks
|
|
601
|
+
!target || target === "_self") &&
|
|
602
|
+
// let browser handle "target=_blank" etc.
|
|
603
|
+
!isModifiedEvent(event) // ignore clicks with modifier keys
|
|
604
|
+
) {
|
|
605
|
+
event.preventDefault();
|
|
606
|
+
navigate();
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
target: target
|
|
610
|
+
}, rest), children)
|
|
611
|
+
);
|
|
690
612
|
};
|
|
691
613
|
|
|
692
614
|
var OrganisationContext = /*#__PURE__*/React.createContext(undefined);
|
|
@@ -723,35 +645,6 @@ var OrganisationProvider = function OrganisationProvider(_ref) {
|
|
|
723
645
|
}, children);
|
|
724
646
|
};
|
|
725
647
|
|
|
726
|
-
var LanguageContext = /*#__PURE__*/React.createContext(undefined);
|
|
727
|
-
var useLanguageState = function useLanguageState(language) {
|
|
728
|
-
var _useState = useState(language),
|
|
729
|
-
activeLanguage = _useState[0],
|
|
730
|
-
setLanguage = _useState[1];
|
|
731
|
-
useEffect(function () {
|
|
732
|
-
languageStorage.set(activeLanguage);
|
|
733
|
-
}, [activeLanguage]);
|
|
734
|
-
return [activeLanguage, setLanguage];
|
|
735
|
-
};
|
|
736
|
-
var useLanguage = function useLanguage() {
|
|
737
|
-
var context = useContext(LanguageContext);
|
|
738
|
-
assertIsDefined(context);
|
|
739
|
-
return context;
|
|
740
|
-
};
|
|
741
|
-
var LanguageProvider = function LanguageProvider(_ref) {
|
|
742
|
-
var children = _ref.children,
|
|
743
|
-
language = _ref.language;
|
|
744
|
-
var _useLanguageState = useLanguageState(language),
|
|
745
|
-
activeLanguage = _useLanguageState[0],
|
|
746
|
-
setLanguage = _useLanguageState[1];
|
|
747
|
-
return React.createElement(LanguageContext.Provider, {
|
|
748
|
-
value: {
|
|
749
|
-
language: activeLanguage,
|
|
750
|
-
setLanguage: setLanguage
|
|
751
|
-
}
|
|
752
|
-
}, children);
|
|
753
|
-
};
|
|
754
|
-
|
|
755
648
|
var OrganisationsError = /*#__PURE__*/function (_Error) {
|
|
756
649
|
function OrganisationsError() {
|
|
757
650
|
var _this;
|
|
@@ -759,12 +652,12 @@ var OrganisationsError = /*#__PURE__*/function (_Error) {
|
|
|
759
652
|
args[_key] = arguments[_key];
|
|
760
653
|
}
|
|
761
654
|
_this = _Error.call.apply(_Error, [this].concat(args)) || this;
|
|
762
|
-
_this.message =
|
|
655
|
+
_this.message = "Failed fetching organisations";
|
|
763
656
|
return _this;
|
|
764
657
|
}
|
|
765
658
|
_inheritsLoose(OrganisationsError, _Error);
|
|
766
659
|
return OrganisationsError;
|
|
767
|
-
}(
|
|
660
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
768
661
|
|
|
769
662
|
var _excluded = ["getToken", "getOrganisations", "selectedOrganisationId", "onChange"];
|
|
770
663
|
var OrganisationSelector = function OrganisationSelector(_ref) {
|
|
@@ -778,48 +671,47 @@ var OrganisationSelector = function OrganisationSelector(_ref) {
|
|
|
778
671
|
setOrganisations = _useState[1];
|
|
779
672
|
var _useLanguage = useLanguage(),
|
|
780
673
|
language = _useLanguage.language;
|
|
781
|
-
var _useState2 = useState(
|
|
674
|
+
var _useState2 = useState("LOADING"),
|
|
782
675
|
status = _useState2[0],
|
|
783
676
|
setStatus = _useState2[1];
|
|
784
677
|
useEffect(function () {
|
|
785
678
|
var fetchOrganisations = /*#__PURE__*/function () {
|
|
786
|
-
var _ref2 = _asyncToGenerator(
|
|
679
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
787
680
|
var token, organisations;
|
|
788
|
-
return
|
|
789
|
-
while (1) switch (_context.
|
|
681
|
+
return _regenerator().w(function (_context) {
|
|
682
|
+
while (1) switch (_context.n) {
|
|
790
683
|
case 0:
|
|
791
|
-
_context.
|
|
684
|
+
_context.n = 1;
|
|
792
685
|
return getToken();
|
|
793
|
-
case
|
|
794
|
-
token = _context.
|
|
795
|
-
if (!(typeof getOrganisations ===
|
|
796
|
-
_context.
|
|
686
|
+
case 1:
|
|
687
|
+
token = _context.v;
|
|
688
|
+
if (!(typeof getOrganisations === "string")) {
|
|
689
|
+
_context.n = 3;
|
|
797
690
|
break;
|
|
798
691
|
}
|
|
799
|
-
_context.
|
|
692
|
+
_context.n = 2;
|
|
800
693
|
return fetch(getOrganisations, {
|
|
801
694
|
headers: {
|
|
802
695
|
Authorization: "Bearer " + token,
|
|
803
|
-
Accept:
|
|
696
|
+
Accept: "application/json"
|
|
804
697
|
}
|
|
805
698
|
}).then(function (response) {
|
|
806
699
|
return response.json();
|
|
807
700
|
});
|
|
808
|
-
case
|
|
809
|
-
organisations = _context.
|
|
810
|
-
_context.
|
|
701
|
+
case 2:
|
|
702
|
+
organisations = _context.v;
|
|
703
|
+
_context.n = 5;
|
|
811
704
|
break;
|
|
812
|
-
case
|
|
813
|
-
_context.
|
|
705
|
+
case 3:
|
|
706
|
+
_context.n = 4;
|
|
814
707
|
return getOrganisations(token);
|
|
815
|
-
case
|
|
816
|
-
organisations = _context.
|
|
817
|
-
case
|
|
708
|
+
case 4:
|
|
709
|
+
organisations = _context.v;
|
|
710
|
+
case 5:
|
|
818
711
|
setOrganisations(organisations);
|
|
819
|
-
setStatus(
|
|
820
|
-
case
|
|
821
|
-
|
|
822
|
-
return _context.stop();
|
|
712
|
+
setStatus("SUCCESS");
|
|
713
|
+
case 6:
|
|
714
|
+
return _context.a(2);
|
|
823
715
|
}
|
|
824
716
|
}, _callee);
|
|
825
717
|
}));
|
|
@@ -828,139 +720,35 @@ var OrganisationSelector = function OrganisationSelector(_ref) {
|
|
|
828
720
|
};
|
|
829
721
|
}();
|
|
830
722
|
fetchOrganisations()["catch"](function (error) {
|
|
831
|
-
if (process.env.NODE_ENV ===
|
|
723
|
+
if (process.env.NODE_ENV === "development") {
|
|
832
724
|
console.error(error);
|
|
833
725
|
}
|
|
834
|
-
setStatus(
|
|
726
|
+
setStatus("ERROR");
|
|
835
727
|
});
|
|
836
728
|
}, [getOrganisations, getToken]);
|
|
837
729
|
switch (status) {
|
|
838
|
-
case
|
|
730
|
+
case "LOADING":
|
|
839
731
|
return React.createElement("div", {
|
|
840
732
|
className: "eds-contrast"
|
|
841
733
|
}, React.createElement(SkeletonRectangle, {
|
|
842
734
|
style: {
|
|
843
|
-
height:
|
|
735
|
+
height: "2.4rem"
|
|
844
736
|
}
|
|
845
737
|
}));
|
|
846
|
-
case
|
|
738
|
+
case "SUCCESS":
|
|
847
739
|
return React.createElement(OrganisationDropDown, _extends({
|
|
848
|
-
label: language ===
|
|
740
|
+
label: language === "nb" || language === "nb-NO" ? "Organisasjon" : "Organisation",
|
|
849
741
|
selectedOrganisationId: selectedOrganisationId,
|
|
850
742
|
organisations: organisations,
|
|
851
743
|
onChange: onChange
|
|
852
744
|
}, rest));
|
|
853
|
-
case
|
|
745
|
+
case "ERROR":
|
|
854
746
|
throw new OrganisationsError();
|
|
855
747
|
default:
|
|
856
748
|
return null;
|
|
857
749
|
}
|
|
858
750
|
};
|
|
859
751
|
|
|
860
|
-
var SERVICE_NAMES = {
|
|
861
|
-
Usercentrics: 'Usercentrics Consent Management Platform',
|
|
862
|
-
PostHog: 'PostHog.com',
|
|
863
|
-
Sentry: 'Sentry'
|
|
864
|
-
};
|
|
865
|
-
|
|
866
|
-
var DEFAULT_CONSENT_GIVEN = {
|
|
867
|
-
Usercentrics: {
|
|
868
|
-
consentGiven: false
|
|
869
|
-
},
|
|
870
|
-
PostHog: {
|
|
871
|
-
consentGiven: false
|
|
872
|
-
},
|
|
873
|
-
Sentry: {
|
|
874
|
-
consentGiven: false
|
|
875
|
-
}
|
|
876
|
-
};
|
|
877
|
-
var convertUCServicesToConsents = function convertUCServicesToConsents(services) {
|
|
878
|
-
return services.map(function (service) {
|
|
879
|
-
var _Object$entries$find, _ref3;
|
|
880
|
-
var serviceName = (_Object$entries$find = Object.entries(SERVICE_NAMES).find(function (keyValue) {
|
|
881
|
-
return keyValue[1] === service.name;
|
|
882
|
-
})) == null ? void 0 : _Object$entries$find[0];
|
|
883
|
-
// Ensure the service name exists in SERVICE_NAMES
|
|
884
|
-
assertIsDefined(serviceName, "Service name " + service.name + " not found in SERVICE_NAMES");
|
|
885
|
-
if (typeof service.consent == 'boolean') {
|
|
886
|
-
var _ref;
|
|
887
|
-
var consentGiven = service.consent;
|
|
888
|
-
return _ref = {}, _ref[serviceName] = {
|
|
889
|
-
consentGiven: consentGiven
|
|
890
|
-
}, _ref;
|
|
891
|
-
} else if (typeof service.consent === 'object' && 'given' in service.consent) {
|
|
892
|
-
var _ref2;
|
|
893
|
-
var _consentGiven = service.consent.given;
|
|
894
|
-
return _ref2 = {}, _ref2[serviceName] = {
|
|
895
|
-
consentGiven: _consentGiven
|
|
896
|
-
}, _ref2;
|
|
897
|
-
}
|
|
898
|
-
return _ref3 = {}, _ref3[serviceName] = {
|
|
899
|
-
consentGiven: false
|
|
900
|
-
}, _ref3;
|
|
901
|
-
}).reduce(function (acc, curr) {
|
|
902
|
-
return _extends({}, acc, curr);
|
|
903
|
-
}, DEFAULT_CONSENT_GIVEN);
|
|
904
|
-
};
|
|
905
|
-
|
|
906
|
-
var ConsentContext = /*#__PURE__*/createContext(DEFAULT_CONSENT_GIVEN);
|
|
907
|
-
var useConsentManager = function useConsentManager() {
|
|
908
|
-
var context = useContext(ConsentContext);
|
|
909
|
-
return context;
|
|
910
|
-
};
|
|
911
|
-
var ConsentManagerProvider = function ConsentManagerProvider(_ref) {
|
|
912
|
-
var children = _ref.children;
|
|
913
|
-
var _useState = useState(DEFAULT_CONSENT_GIVEN),
|
|
914
|
-
consentManager = _useState[0],
|
|
915
|
-
setConsentManager = _useState[1];
|
|
916
|
-
// Initialize consent manager from local storage once
|
|
917
|
-
useEffect(function () {
|
|
918
|
-
if (typeof window === 'undefined') return;
|
|
919
|
-
var ucData = ucUiStorage.get();
|
|
920
|
-
if (ucData) {
|
|
921
|
-
var data = JSON.parse(ucData);
|
|
922
|
-
var services = convertUCServicesToConsents(Object.values(data.consent.services));
|
|
923
|
-
setConsentManager(services);
|
|
924
|
-
}
|
|
925
|
-
}, []);
|
|
926
|
-
// Listen for Usercentrics consent events and update consent manager state
|
|
927
|
-
useEffect(function () {
|
|
928
|
-
var handleConsentEvent = /*#__PURE__*/function () {
|
|
929
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
930
|
-
var customEvent, services, updatedConsentManager;
|
|
931
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
932
|
-
while (1) switch (_context.prev = _context.next) {
|
|
933
|
-
case 0:
|
|
934
|
-
if (!(typeof window === 'undefined')) {
|
|
935
|
-
_context.next = 2;
|
|
936
|
-
break;
|
|
937
|
-
}
|
|
938
|
-
return _context.abrupt("return");
|
|
939
|
-
case 2:
|
|
940
|
-
customEvent = event;
|
|
941
|
-
services = Object.values(customEvent.detail.services);
|
|
942
|
-
updatedConsentManager = convertUCServicesToConsents(services);
|
|
943
|
-
setConsentManager(updatedConsentManager);
|
|
944
|
-
case 6:
|
|
945
|
-
case "end":
|
|
946
|
-
return _context.stop();
|
|
947
|
-
}
|
|
948
|
-
}, _callee);
|
|
949
|
-
}));
|
|
950
|
-
return function handleConsentEvent(_x) {
|
|
951
|
-
return _ref2.apply(this, arguments);
|
|
952
|
-
};
|
|
953
|
-
}();
|
|
954
|
-
window.addEventListener('UC_CONSENT', handleConsentEvent);
|
|
955
|
-
return function () {
|
|
956
|
-
return window.removeEventListener('UC_CONSENT', handleConsentEvent);
|
|
957
|
-
};
|
|
958
|
-
}, []);
|
|
959
|
-
return React.createElement(ConsentContext.Provider, {
|
|
960
|
-
value: consentManager
|
|
961
|
-
}, children);
|
|
962
|
-
};
|
|
963
|
-
|
|
964
752
|
var PostHogProviderWrapper = function PostHogProviderWrapper(_ref) {
|
|
965
753
|
var _ref$debug = _ref.debug,
|
|
966
754
|
debug = _ref$debug === void 0 ? false : _ref$debug,
|
|
@@ -984,16 +772,16 @@ var PostHogProviderWrapper = function PostHogProviderWrapper(_ref) {
|
|
|
984
772
|
// If no API key is provided or PostHog is forced to be disabled, do not initialize PostHog
|
|
985
773
|
if (!postHogApiKey || forceDisablePostHog) {
|
|
986
774
|
if (!forceDisablePostHog) {
|
|
987
|
-
console.warn(
|
|
775
|
+
console.warn("AppShellStandalone Warning: PostHog API key is not provided. PostHog will not be initialized.");
|
|
988
776
|
} else {
|
|
989
|
-
console.warn(
|
|
777
|
+
console.warn("AppShellStandalone Warning: PostHog tracking is disabled by force. PostHog will not be initialized.");
|
|
990
778
|
}
|
|
991
779
|
return React.createElement(React.Fragment, null, children);
|
|
992
780
|
}
|
|
993
781
|
postHog.init(postHogApiKey, {
|
|
994
782
|
debug: debug,
|
|
995
|
-
api_host: isStandalone ?
|
|
996
|
-
ui_host:
|
|
783
|
+
api_host: isStandalone ? "https://eu.posthog.com" : "/ingest",
|
|
784
|
+
ui_host: "https://eu.posthog.com",
|
|
997
785
|
opt_out_capturing_by_default: true,
|
|
998
786
|
autocapture: isStandalone
|
|
999
787
|
}, project);
|