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