@entur-partner/app-shell 4.0.0 → 5.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppShell.d.ts +4 -4
- package/dist/EnvironmentBanner.d.ts +3 -2
- package/dist/OrganisationSelector.d.ts +1 -1
- package/dist/UserTypes.d.ts +2 -2
- package/dist/app-shell.cjs.development.js +419 -787
- 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 +420 -787
- package/dist/app-shell.esm.js.map +1 -1
- package/package.json +8 -6
- package/dist/Auth.d.ts +0 -21
- package/dist/authReducer.d.ts +0 -28
package/dist/app-shell.esm.js
CHANGED
|
@@ -1,357 +1,328 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { Loader, SkeletonRectangle } from '@entur/loader';
|
|
1
|
+
import React, { useState, useEffect, useContext, useCallback } from 'react';
|
|
3
2
|
import { BannerAlertBox } from '@entur/alert';
|
|
4
|
-
import { space } from '@entur/tokens';
|
|
5
3
|
import { Paragraph, Link, CodeText } from '@entur/typography';
|
|
6
|
-
import {
|
|
4
|
+
import { Loader, SkeletonRectangle } from '@entur/loader';
|
|
5
|
+
import { space } from '@entur/tokens';
|
|
6
|
+
import { Auth0Provider, useAuth0 } from '@auth0/auth0-react';
|
|
7
7
|
import { getColorForEnvironment, Environment, OrganisationDropDown } from '@entur-partner/common';
|
|
8
|
-
import
|
|
8
|
+
import { assertIsDefined } from '@entur-partner/util';
|
|
9
9
|
|
|
10
|
+
function _construct(t, e, r) {
|
|
11
|
+
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
12
|
+
var o = [null];
|
|
13
|
+
o.push.apply(o, e);
|
|
14
|
+
var p = new (t.bind.apply(t, o))();
|
|
15
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
16
|
+
}
|
|
17
|
+
function _isNativeReflectConstruct() {
|
|
18
|
+
try {
|
|
19
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
20
|
+
} catch (t) {}
|
|
21
|
+
return (_isNativeReflectConstruct = function () {
|
|
22
|
+
return !!t;
|
|
23
|
+
})();
|
|
24
|
+
}
|
|
10
25
|
function _regeneratorRuntime() {
|
|
11
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
12
|
-
|
|
13
26
|
_regeneratorRuntime = function () {
|
|
14
|
-
return
|
|
27
|
+
return e;
|
|
15
28
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
var t,
|
|
30
|
+
e = {},
|
|
31
|
+
r = Object.prototype,
|
|
32
|
+
n = r.hasOwnProperty,
|
|
33
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
34
|
+
t[e] = r.value;
|
|
35
|
+
},
|
|
36
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
37
|
+
a = i.iterator || "@@iterator",
|
|
38
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
39
|
+
u = i.toStringTag || "@@toStringTag";
|
|
40
|
+
function define(t, e, r) {
|
|
41
|
+
return Object.defineProperty(t, e, {
|
|
42
|
+
value: r,
|
|
28
43
|
enumerable: !0,
|
|
29
44
|
configurable: !0,
|
|
30
45
|
writable: !0
|
|
31
|
-
}),
|
|
46
|
+
}), t[e];
|
|
32
47
|
}
|
|
33
|
-
|
|
34
48
|
try {
|
|
35
49
|
define({}, "");
|
|
36
|
-
} catch (
|
|
37
|
-
define = function (
|
|
38
|
-
return
|
|
50
|
+
} catch (t) {
|
|
51
|
+
define = function (t, e, r) {
|
|
52
|
+
return t[e] = r;
|
|
39
53
|
};
|
|
40
54
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return function (method, arg) {
|
|
49
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
50
|
-
|
|
51
|
-
if ("completed" === state) {
|
|
52
|
-
if ("throw" === method) throw arg;
|
|
53
|
-
return doneResult();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
for (context.method = method, context.arg = arg;;) {
|
|
57
|
-
var delegate = context.delegate;
|
|
58
|
-
|
|
59
|
-
if (delegate) {
|
|
60
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
61
|
-
|
|
62
|
-
if (delegateResult) {
|
|
63
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
64
|
-
return delegateResult;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
69
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
70
|
-
context.dispatchException(context.arg);
|
|
71
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
72
|
-
state = "executing";
|
|
73
|
-
var record = tryCatch(innerFn, self, context);
|
|
74
|
-
|
|
75
|
-
if ("normal" === record.type) {
|
|
76
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
77
|
-
return {
|
|
78
|
-
value: record.arg,
|
|
79
|
-
done: context.done
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}(innerFn, self, context), generator;
|
|
55
|
+
function wrap(t, e, r, n) {
|
|
56
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
57
|
+
a = Object.create(i.prototype),
|
|
58
|
+
c = new Context(n || []);
|
|
59
|
+
return o(a, "_invoke", {
|
|
60
|
+
value: makeInvokeMethod(t, r, c)
|
|
61
|
+
}), a;
|
|
87
62
|
}
|
|
88
|
-
|
|
89
|
-
function tryCatch(fn, obj, arg) {
|
|
63
|
+
function tryCatch(t, e, r) {
|
|
90
64
|
try {
|
|
91
65
|
return {
|
|
92
66
|
type: "normal",
|
|
93
|
-
arg:
|
|
67
|
+
arg: t.call(e, r)
|
|
94
68
|
};
|
|
95
|
-
} catch (
|
|
69
|
+
} catch (t) {
|
|
96
70
|
return {
|
|
97
71
|
type: "throw",
|
|
98
|
-
arg:
|
|
72
|
+
arg: t
|
|
99
73
|
};
|
|
100
74
|
}
|
|
101
75
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
76
|
+
e.wrap = wrap;
|
|
77
|
+
var h = "suspendedStart",
|
|
78
|
+
l = "suspendedYield",
|
|
79
|
+
f = "executing",
|
|
80
|
+
s = "completed",
|
|
81
|
+
y = {};
|
|
106
82
|
function Generator() {}
|
|
107
|
-
|
|
108
83
|
function GeneratorFunction() {}
|
|
109
|
-
|
|
110
84
|
function GeneratorFunctionPrototype() {}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
85
|
+
var p = {};
|
|
86
|
+
define(p, a, function () {
|
|
114
87
|
return this;
|
|
115
88
|
});
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return this._invoke(method, arg);
|
|
89
|
+
var d = Object.getPrototypeOf,
|
|
90
|
+
v = d && d(d(values([])));
|
|
91
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
92
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
93
|
+
function defineIteratorMethods(t) {
|
|
94
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
95
|
+
define(t, e, function (t) {
|
|
96
|
+
return this._invoke(e, t);
|
|
125
97
|
});
|
|
126
98
|
});
|
|
127
99
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
invoke("
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
}, function (error) {
|
|
143
|
-
return invoke("throw", error, resolve, reject);
|
|
100
|
+
function AsyncIterator(t, e) {
|
|
101
|
+
function invoke(r, o, i, a) {
|
|
102
|
+
var c = tryCatch(t[r], t, o);
|
|
103
|
+
if ("throw" !== c.type) {
|
|
104
|
+
var u = c.arg,
|
|
105
|
+
h = u.value;
|
|
106
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
107
|
+
invoke("next", t, i, a);
|
|
108
|
+
}, function (t) {
|
|
109
|
+
invoke("throw", t, i, a);
|
|
110
|
+
}) : e.resolve(h).then(function (t) {
|
|
111
|
+
u.value = t, i(u);
|
|
112
|
+
}, function (t) {
|
|
113
|
+
return invoke("throw", t, i, a);
|
|
144
114
|
});
|
|
145
115
|
}
|
|
146
|
-
|
|
147
|
-
reject(record.arg);
|
|
116
|
+
a(c.arg);
|
|
148
117
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
118
|
+
var r;
|
|
119
|
+
o(this, "_invoke", {
|
|
120
|
+
value: function (t, n) {
|
|
121
|
+
function callInvokeWithMethodAndArg() {
|
|
122
|
+
return new e(function (e, r) {
|
|
123
|
+
invoke(t, n, e, r);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
157
127
|
}
|
|
158
|
-
|
|
159
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
160
|
-
};
|
|
128
|
+
});
|
|
161
129
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
130
|
+
function makeInvokeMethod(e, r, n) {
|
|
131
|
+
var o = h;
|
|
132
|
+
return function (i, a) {
|
|
133
|
+
if (o === f) throw Error("Generator is already running");
|
|
134
|
+
if (o === s) {
|
|
135
|
+
if ("throw" === i) throw a;
|
|
136
|
+
return {
|
|
137
|
+
value: t,
|
|
138
|
+
done: !0
|
|
139
|
+
};
|
|
170
140
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
141
|
+
for (n.method = i, n.arg = a;;) {
|
|
142
|
+
var c = n.delegate;
|
|
143
|
+
if (c) {
|
|
144
|
+
var u = maybeInvokeDelegate(c, n);
|
|
145
|
+
if (u) {
|
|
146
|
+
if (u === y) continue;
|
|
147
|
+
return u;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
151
|
+
if (o === h) throw o = s, n.arg;
|
|
152
|
+
n.dispatchException(n.arg);
|
|
153
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
154
|
+
o = f;
|
|
155
|
+
var p = tryCatch(e, r, n);
|
|
156
|
+
if ("normal" === p.type) {
|
|
157
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
158
|
+
return {
|
|
159
|
+
value: p.arg,
|
|
160
|
+
done: n.done
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
179
166
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
167
|
+
function maybeInvokeDelegate(e, r) {
|
|
168
|
+
var n = r.method,
|
|
169
|
+
o = e.iterator[n];
|
|
170
|
+
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;
|
|
171
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
172
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
173
|
+
var a = i.arg;
|
|
174
|
+
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);
|
|
175
|
+
}
|
|
176
|
+
function pushTryEntry(t) {
|
|
177
|
+
var e = {
|
|
178
|
+
tryLoc: t[0]
|
|
184
179
|
};
|
|
185
|
-
1 in
|
|
180
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
186
181
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
182
|
+
function resetTryEntry(t) {
|
|
183
|
+
var e = t.completion || {};
|
|
184
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
191
185
|
}
|
|
192
|
-
|
|
193
|
-
function Context(tryLocsList) {
|
|
186
|
+
function Context(t) {
|
|
194
187
|
this.tryEntries = [{
|
|
195
188
|
tryLoc: "root"
|
|
196
|
-
}],
|
|
189
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
197
190
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
next =
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return next.value = undefined, next.done = !0, next;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
return next.next = next;
|
|
191
|
+
function values(e) {
|
|
192
|
+
if (e || "" === e) {
|
|
193
|
+
var r = e[a];
|
|
194
|
+
if (r) return r.call(e);
|
|
195
|
+
if ("function" == typeof e.next) return e;
|
|
196
|
+
if (!isNaN(e.length)) {
|
|
197
|
+
var o = -1,
|
|
198
|
+
i = function next() {
|
|
199
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
200
|
+
return next.value = t, next.done = !0, next;
|
|
201
|
+
};
|
|
202
|
+
return i.next = i;
|
|
214
203
|
}
|
|
215
204
|
}
|
|
216
|
-
|
|
217
|
-
return {
|
|
218
|
-
next: doneResult
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function doneResult() {
|
|
223
|
-
return {
|
|
224
|
-
value: undefined,
|
|
225
|
-
done: !0
|
|
226
|
-
};
|
|
205
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
227
206
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
},
|
|
207
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
208
|
+
value: GeneratorFunctionPrototype,
|
|
209
|
+
configurable: !0
|
|
210
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
211
|
+
value: GeneratorFunction,
|
|
212
|
+
configurable: !0
|
|
213
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
214
|
+
var e = "function" == typeof t && t.constructor;
|
|
215
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
216
|
+
}, e.mark = function (t) {
|
|
217
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
218
|
+
}, e.awrap = function (t) {
|
|
235
219
|
return {
|
|
236
|
-
__await:
|
|
220
|
+
__await: t
|
|
237
221
|
};
|
|
238
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype,
|
|
222
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
239
223
|
return this;
|
|
240
|
-
}),
|
|
241
|
-
void 0 ===
|
|
242
|
-
var
|
|
243
|
-
return
|
|
244
|
-
return
|
|
224
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
225
|
+
void 0 === i && (i = Promise);
|
|
226
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
227
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
228
|
+
return t.done ? t.value : a.next();
|
|
245
229
|
});
|
|
246
|
-
}, defineIteratorMethods(
|
|
230
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
247
231
|
return this;
|
|
248
|
-
}), define(
|
|
232
|
+
}), define(g, "toString", function () {
|
|
249
233
|
return "[object Generator]";
|
|
250
|
-
}),
|
|
251
|
-
var
|
|
252
|
-
|
|
253
|
-
for (var
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
234
|
+
}), e.keys = function (t) {
|
|
235
|
+
var e = Object(t),
|
|
236
|
+
r = [];
|
|
237
|
+
for (var n in e) r.push(n);
|
|
238
|
+
return r.reverse(), function next() {
|
|
239
|
+
for (; r.length;) {
|
|
240
|
+
var t = r.pop();
|
|
241
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
259
242
|
}
|
|
260
|
-
|
|
261
243
|
return next.done = !0, next;
|
|
262
244
|
};
|
|
263
|
-
},
|
|
245
|
+
}, e.values = values, Context.prototype = {
|
|
264
246
|
constructor: Context,
|
|
265
|
-
reset: function (
|
|
266
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent =
|
|
247
|
+
reset: function (e) {
|
|
248
|
+
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);
|
|
267
249
|
},
|
|
268
250
|
stop: function () {
|
|
269
251
|
this.done = !0;
|
|
270
|
-
var
|
|
271
|
-
if ("throw" ===
|
|
252
|
+
var t = this.tryEntries[0].completion;
|
|
253
|
+
if ("throw" === t.type) throw t.arg;
|
|
272
254
|
return this.rval;
|
|
273
255
|
},
|
|
274
|
-
dispatchException: function (
|
|
275
|
-
if (this.done) throw
|
|
276
|
-
var
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
256
|
+
dispatchException: function (e) {
|
|
257
|
+
if (this.done) throw e;
|
|
258
|
+
var r = this;
|
|
259
|
+
function handle(n, o) {
|
|
260
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
280
261
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if (
|
|
292
|
-
if (this.prev <
|
|
293
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
294
|
-
} else if (hasCatch) {
|
|
295
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
262
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
263
|
+
var i = this.tryEntries[o],
|
|
264
|
+
a = i.completion;
|
|
265
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
266
|
+
if (i.tryLoc <= this.prev) {
|
|
267
|
+
var c = n.call(i, "catchLoc"),
|
|
268
|
+
u = n.call(i, "finallyLoc");
|
|
269
|
+
if (c && u) {
|
|
270
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
271
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
272
|
+
} else if (c) {
|
|
273
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
296
274
|
} else {
|
|
297
|
-
if (!
|
|
298
|
-
if (this.prev <
|
|
275
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
276
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
299
277
|
}
|
|
300
278
|
}
|
|
301
279
|
}
|
|
302
280
|
},
|
|
303
|
-
abrupt: function (
|
|
304
|
-
for (var
|
|
305
|
-
var
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
var finallyEntry = entry;
|
|
281
|
+
abrupt: function (t, e) {
|
|
282
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
283
|
+
var o = this.tryEntries[r];
|
|
284
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
285
|
+
var i = o;
|
|
309
286
|
break;
|
|
310
287
|
}
|
|
311
288
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
289
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
290
|
+
var a = i ? i.completion : {};
|
|
291
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
316
292
|
},
|
|
317
|
-
complete: function (
|
|
318
|
-
if ("throw" ===
|
|
319
|
-
return "break" ===
|
|
293
|
+
complete: function (t, e) {
|
|
294
|
+
if ("throw" === t.type) throw t.arg;
|
|
295
|
+
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;
|
|
320
296
|
},
|
|
321
|
-
finish: function (
|
|
322
|
-
for (var
|
|
323
|
-
var
|
|
324
|
-
if (
|
|
297
|
+
finish: function (t) {
|
|
298
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
299
|
+
var r = this.tryEntries[e];
|
|
300
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
325
301
|
}
|
|
326
302
|
},
|
|
327
|
-
catch: function (
|
|
328
|
-
for (var
|
|
329
|
-
var
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
var thrown = record.arg;
|
|
336
|
-
resetTryEntry(entry);
|
|
303
|
+
catch: function (t) {
|
|
304
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
305
|
+
var r = this.tryEntries[e];
|
|
306
|
+
if (r.tryLoc === t) {
|
|
307
|
+
var n = r.completion;
|
|
308
|
+
if ("throw" === n.type) {
|
|
309
|
+
var o = n.arg;
|
|
310
|
+
resetTryEntry(r);
|
|
337
311
|
}
|
|
338
|
-
|
|
339
|
-
return thrown;
|
|
312
|
+
return o;
|
|
340
313
|
}
|
|
341
314
|
}
|
|
342
|
-
|
|
343
|
-
throw new Error("illegal catch attempt");
|
|
315
|
+
throw Error("illegal catch attempt");
|
|
344
316
|
},
|
|
345
|
-
delegateYield: function (
|
|
317
|
+
delegateYield: function (e, r, n) {
|
|
346
318
|
return this.delegate = {
|
|
347
|
-
iterator: values(
|
|
348
|
-
resultName:
|
|
349
|
-
nextLoc:
|
|
350
|
-
}, "next" === this.method && (this.arg =
|
|
319
|
+
iterator: values(e),
|
|
320
|
+
resultName: r,
|
|
321
|
+
nextLoc: n
|
|
322
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
351
323
|
}
|
|
352
|
-
},
|
|
324
|
+
}, e;
|
|
353
325
|
}
|
|
354
|
-
|
|
355
326
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
356
327
|
try {
|
|
357
328
|
var info = gen[key](arg);
|
|
@@ -360,65 +331,53 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
360
331
|
reject(error);
|
|
361
332
|
return;
|
|
362
333
|
}
|
|
363
|
-
|
|
364
334
|
if (info.done) {
|
|
365
335
|
resolve(value);
|
|
366
336
|
} else {
|
|
367
337
|
Promise.resolve(value).then(_next, _throw);
|
|
368
338
|
}
|
|
369
339
|
}
|
|
370
|
-
|
|
371
340
|
function _asyncToGenerator(fn) {
|
|
372
341
|
return function () {
|
|
373
342
|
var self = this,
|
|
374
|
-
|
|
343
|
+
args = arguments;
|
|
375
344
|
return new Promise(function (resolve, reject) {
|
|
376
345
|
var gen = fn.apply(self, args);
|
|
377
|
-
|
|
378
346
|
function _next(value) {
|
|
379
347
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
380
348
|
}
|
|
381
|
-
|
|
382
349
|
function _throw(err) {
|
|
383
350
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
384
351
|
}
|
|
385
|
-
|
|
386
352
|
_next(undefined);
|
|
387
353
|
});
|
|
388
354
|
};
|
|
389
355
|
}
|
|
390
|
-
|
|
391
356
|
function _extends() {
|
|
392
357
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
393
358
|
for (var i = 1; i < arguments.length; i++) {
|
|
394
359
|
var source = arguments[i];
|
|
395
|
-
|
|
396
360
|
for (var key in source) {
|
|
397
361
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
398
362
|
target[key] = source[key];
|
|
399
363
|
}
|
|
400
364
|
}
|
|
401
365
|
}
|
|
402
|
-
|
|
403
366
|
return target;
|
|
404
367
|
};
|
|
405
368
|
return _extends.apply(this, arguments);
|
|
406
369
|
}
|
|
407
|
-
|
|
408
370
|
function _inheritsLoose(subClass, superClass) {
|
|
409
371
|
subClass.prototype = Object.create(superClass.prototype);
|
|
410
372
|
subClass.prototype.constructor = subClass;
|
|
411
|
-
|
|
412
373
|
_setPrototypeOf(subClass, superClass);
|
|
413
374
|
}
|
|
414
|
-
|
|
415
375
|
function _getPrototypeOf(o) {
|
|
416
376
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
417
377
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
418
378
|
};
|
|
419
379
|
return _getPrototypeOf(o);
|
|
420
380
|
}
|
|
421
|
-
|
|
422
381
|
function _setPrototypeOf(o, p) {
|
|
423
382
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
424
383
|
o.__proto__ = p;
|
|
@@ -426,61 +385,27 @@ function _setPrototypeOf(o, p) {
|
|
|
426
385
|
};
|
|
427
386
|
return _setPrototypeOf(o, p);
|
|
428
387
|
}
|
|
429
|
-
|
|
430
|
-
function _isNativeReflectConstruct() {
|
|
431
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
432
|
-
if (Reflect.construct.sham) return false;
|
|
433
|
-
if (typeof Proxy === "function") return true;
|
|
434
|
-
|
|
388
|
+
function _isNativeFunction(fn) {
|
|
435
389
|
try {
|
|
436
|
-
|
|
437
|
-
return true;
|
|
390
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
438
391
|
} catch (e) {
|
|
439
|
-
return
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
function _construct(Parent, args, Class) {
|
|
444
|
-
if (_isNativeReflectConstruct()) {
|
|
445
|
-
_construct = Reflect.construct.bind();
|
|
446
|
-
} else {
|
|
447
|
-
_construct = function _construct(Parent, args, Class) {
|
|
448
|
-
var a = [null];
|
|
449
|
-
a.push.apply(a, args);
|
|
450
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
451
|
-
var instance = new Constructor();
|
|
452
|
-
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
453
|
-
return instance;
|
|
454
|
-
};
|
|
392
|
+
return typeof fn === "function";
|
|
455
393
|
}
|
|
456
|
-
|
|
457
|
-
return _construct.apply(null, arguments);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
function _isNativeFunction(fn) {
|
|
461
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
462
394
|
}
|
|
463
|
-
|
|
464
395
|
function _wrapNativeSuper(Class) {
|
|
465
396
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
466
|
-
|
|
467
397
|
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
468
398
|
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
469
|
-
|
|
470
399
|
if (typeof Class !== "function") {
|
|
471
400
|
throw new TypeError("Super expression must either be null or a function");
|
|
472
401
|
}
|
|
473
|
-
|
|
474
402
|
if (typeof _cache !== "undefined") {
|
|
475
403
|
if (_cache.has(Class)) return _cache.get(Class);
|
|
476
|
-
|
|
477
404
|
_cache.set(Class, Wrapper);
|
|
478
405
|
}
|
|
479
|
-
|
|
480
406
|
function Wrapper() {
|
|
481
407
|
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
482
408
|
}
|
|
483
|
-
|
|
484
409
|
Wrapper.prototype = Object.create(Class.prototype, {
|
|
485
410
|
constructor: {
|
|
486
411
|
value: Wrapper,
|
|
@@ -491,305 +416,21 @@ function _wrapNativeSuper(Class) {
|
|
|
491
416
|
});
|
|
492
417
|
return _setPrototypeOf(Wrapper, Class);
|
|
493
418
|
};
|
|
494
|
-
|
|
495
419
|
return _wrapNativeSuper(Class);
|
|
496
420
|
}
|
|
497
|
-
|
|
498
421
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
499
422
|
if (source == null) return {};
|
|
500
423
|
var target = {};
|
|
501
424
|
var sourceKeys = Object.keys(source);
|
|
502
425
|
var key, i;
|
|
503
|
-
|
|
504
426
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
505
427
|
key = sourceKeys[i];
|
|
506
428
|
if (excluded.indexOf(key) >= 0) continue;
|
|
507
429
|
target[key] = source[key];
|
|
508
430
|
}
|
|
509
|
-
|
|
510
431
|
return target;
|
|
511
432
|
}
|
|
512
433
|
|
|
513
|
-
var initialState$1 = {
|
|
514
|
-
status: 'AUTHENTICATING'
|
|
515
|
-
};
|
|
516
|
-
function authReducer(state, event) {
|
|
517
|
-
switch (event.type) {
|
|
518
|
-
case 'AUTHENTICATED':
|
|
519
|
-
return {
|
|
520
|
-
status: 'AUTHENTICATED',
|
|
521
|
-
user: event.data.user
|
|
522
|
-
};
|
|
523
|
-
|
|
524
|
-
case 'LOGOUT':
|
|
525
|
-
return initialState$1;
|
|
526
|
-
|
|
527
|
-
case 'ERROR':
|
|
528
|
-
return {
|
|
529
|
-
error: event.error,
|
|
530
|
-
status: 'ERROR'
|
|
531
|
-
};
|
|
532
|
-
|
|
533
|
-
case 'NOT_AUTHENTICATED':
|
|
534
|
-
return _extends({}, state, {
|
|
535
|
-
status: 'NOT_AUTHENTICATED'
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
default:
|
|
539
|
-
return state;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
var _excluded$2 = ["children", "decorateUser"];
|
|
544
|
-
var POST_LOGIN_ROUTE_KEY = '@entur-partner:post-login-route';
|
|
545
|
-
var LOGIN_LAST_RETRY = '@entur-partner:last-login-retry';
|
|
546
|
-
|
|
547
|
-
var redirect = function redirect(pathname) {
|
|
548
|
-
if (pathname === void 0) {
|
|
549
|
-
pathname = '/';
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
return window.history.replaceState({}, document.title, pathname);
|
|
553
|
-
}; // TODO: replace with react-router history
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
var Auth0Context = /*#__PURE__*/React.createContext(undefined);
|
|
557
|
-
var useAuth = function useAuth() {
|
|
558
|
-
var auth = useContext(Auth0Context);
|
|
559
|
-
assertIsDefined(auth, 'A `<Auth0Provider>` component needs to be higher up in the component hierarchy.');
|
|
560
|
-
return auth;
|
|
561
|
-
};
|
|
562
|
-
var initialState = {
|
|
563
|
-
status: 'AUTHENTICATING'
|
|
564
|
-
};
|
|
565
|
-
var AuthProvider = function AuthProvider(_ref) {
|
|
566
|
-
var children = _ref.children,
|
|
567
|
-
decorateUser = _ref.decorateUser,
|
|
568
|
-
initOptions = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
569
|
-
|
|
570
|
-
var _useReducer = useReducer(authReducer, initialState),
|
|
571
|
-
state = _useReducer[0],
|
|
572
|
-
dispatch = _useReducer[1];
|
|
573
|
-
|
|
574
|
-
var _useState = useState(),
|
|
575
|
-
auth0Client = _useState[0],
|
|
576
|
-
setAuth0 = _useState[1];
|
|
577
|
-
|
|
578
|
-
useEffect(function () {
|
|
579
|
-
var initAuth0 = /*#__PURE__*/function () {
|
|
580
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
581
|
-
var client, route, postLoginRoute, isAuthenticated, auth0User, token, user;
|
|
582
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
583
|
-
while (1) {
|
|
584
|
-
switch (_context.prev = _context.next) {
|
|
585
|
-
case 0:
|
|
586
|
-
_context.next = 2;
|
|
587
|
-
return createAuth0Client(initOptions);
|
|
588
|
-
|
|
589
|
-
case 2:
|
|
590
|
-
client = _context.sent;
|
|
591
|
-
setAuth0(client);
|
|
592
|
-
|
|
593
|
-
if (!window.location.search.includes('code=')) {
|
|
594
|
-
_context.next = 11;
|
|
595
|
-
break;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
_context.next = 7;
|
|
599
|
-
return client.handleRedirectCallback();
|
|
600
|
-
|
|
601
|
-
case 7:
|
|
602
|
-
route = localStorage.getItem(POST_LOGIN_ROUTE_KEY);
|
|
603
|
-
localStorage.removeItem(POST_LOGIN_ROUTE_KEY);
|
|
604
|
-
postLoginRoute = route || '/';
|
|
605
|
-
redirect(postLoginRoute);
|
|
606
|
-
|
|
607
|
-
case 11:
|
|
608
|
-
_context.next = 13;
|
|
609
|
-
return client.isAuthenticated();
|
|
610
|
-
|
|
611
|
-
case 13:
|
|
612
|
-
isAuthenticated = _context.sent;
|
|
613
|
-
|
|
614
|
-
if (!isAuthenticated) {
|
|
615
|
-
_context.next = 27;
|
|
616
|
-
break;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
_context.next = 17;
|
|
620
|
-
return client.getUser();
|
|
621
|
-
|
|
622
|
-
case 17:
|
|
623
|
-
auth0User = _context.sent;
|
|
624
|
-
_context.next = 20;
|
|
625
|
-
return client.getTokenSilently();
|
|
626
|
-
|
|
627
|
-
case 20:
|
|
628
|
-
token = _context.sent;
|
|
629
|
-
_context.next = 23;
|
|
630
|
-
return decorateUser(auth0User, token);
|
|
631
|
-
|
|
632
|
-
case 23:
|
|
633
|
-
user = _context.sent;
|
|
634
|
-
dispatch({
|
|
635
|
-
type: 'AUTHENTICATED',
|
|
636
|
-
data: {
|
|
637
|
-
user: user
|
|
638
|
-
}
|
|
639
|
-
});
|
|
640
|
-
_context.next = 28;
|
|
641
|
-
break;
|
|
642
|
-
|
|
643
|
-
case 27:
|
|
644
|
-
dispatch({
|
|
645
|
-
type: 'NOT_AUTHENTICATED'
|
|
646
|
-
});
|
|
647
|
-
|
|
648
|
-
case 28:
|
|
649
|
-
case "end":
|
|
650
|
-
return _context.stop();
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
}, _callee);
|
|
654
|
-
}));
|
|
655
|
-
|
|
656
|
-
return function initAuth0() {
|
|
657
|
-
return _ref2.apply(this, arguments);
|
|
658
|
-
};
|
|
659
|
-
}();
|
|
660
|
-
|
|
661
|
-
initAuth0()["catch"]( /*#__PURE__*/function () {
|
|
662
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(error) {
|
|
663
|
-
var _localStorage$getItem, lastRetryEpochSeconds, nowEpochSeconds, timeSinceLastRetry, minimumTimeForRetry;
|
|
664
|
-
|
|
665
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
666
|
-
while (1) {
|
|
667
|
-
switch (_context2.prev = _context2.next) {
|
|
668
|
-
case 0:
|
|
669
|
-
_context2.prev = 0;
|
|
670
|
-
lastRetryEpochSeconds = parseInt((_localStorage$getItem = localStorage.getItem(LOGIN_LAST_RETRY)) != null ? _localStorage$getItem : '0');
|
|
671
|
-
nowEpochSeconds = Math.floor(Date.now() / 1000);
|
|
672
|
-
timeSinceLastRetry = nowEpochSeconds - lastRetryEpochSeconds;
|
|
673
|
-
minimumTimeForRetry = 120; // Has there been more than x seconds since last retry?
|
|
674
|
-
|
|
675
|
-
if (!(timeSinceLastRetry >= minimumTimeForRetry)) {
|
|
676
|
-
_context2.next = 12;
|
|
677
|
-
break;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
localStorage.setItem(LOGIN_LAST_RETRY, nowEpochSeconds.toString());
|
|
681
|
-
redirect('/');
|
|
682
|
-
_context2.next = 10;
|
|
683
|
-
return initAuth0();
|
|
684
|
-
|
|
685
|
-
case 10:
|
|
686
|
-
_context2.next = 13;
|
|
687
|
-
break;
|
|
688
|
-
|
|
689
|
-
case 12:
|
|
690
|
-
throw error;
|
|
691
|
-
|
|
692
|
-
case 13:
|
|
693
|
-
_context2.next = 18;
|
|
694
|
-
break;
|
|
695
|
-
|
|
696
|
-
case 15:
|
|
697
|
-
_context2.prev = 15;
|
|
698
|
-
_context2.t0 = _context2["catch"](0);
|
|
699
|
-
dispatch({
|
|
700
|
-
type: 'ERROR',
|
|
701
|
-
error: error
|
|
702
|
-
});
|
|
703
|
-
|
|
704
|
-
case 18:
|
|
705
|
-
case "end":
|
|
706
|
-
return _context2.stop();
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
}, _callee2, null, [[0, 15]]);
|
|
710
|
-
}));
|
|
711
|
-
|
|
712
|
-
return function (_x) {
|
|
713
|
-
return _ref3.apply(this, arguments);
|
|
714
|
-
};
|
|
715
|
-
}()); // eslint-disable-next-line
|
|
716
|
-
}, []);
|
|
717
|
-
|
|
718
|
-
var logout = function logout() {
|
|
719
|
-
assertIsDefined(auth0Client);
|
|
720
|
-
var _window$location = window.location,
|
|
721
|
-
protocol = _window$location.protocol,
|
|
722
|
-
hostname = _window$location.hostname,
|
|
723
|
-
port = _window$location.port;
|
|
724
|
-
auth0Client.logout({
|
|
725
|
-
returnTo: protocol + "//" + hostname + ":" + port
|
|
726
|
-
});
|
|
727
|
-
};
|
|
728
|
-
|
|
729
|
-
var login = /*#__PURE__*/function () {
|
|
730
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(redirectUri) {
|
|
731
|
-
var _window, location;
|
|
732
|
-
|
|
733
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
734
|
-
while (1) {
|
|
735
|
-
switch (_context3.prev = _context3.next) {
|
|
736
|
-
case 0:
|
|
737
|
-
if (redirectUri === void 0) {
|
|
738
|
-
redirectUri = window.location.origin;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
assertIsDefined(auth0Client);
|
|
742
|
-
_window = window, location = _window.location;
|
|
743
|
-
localStorage.setItem(POST_LOGIN_ROUTE_KEY, "" + location.pathname + location.search);
|
|
744
|
-
auth0Client.loginWithRedirect({
|
|
745
|
-
redirect_uri: redirectUri
|
|
746
|
-
});
|
|
747
|
-
|
|
748
|
-
case 5:
|
|
749
|
-
case "end":
|
|
750
|
-
return _context3.stop();
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
}, _callee3);
|
|
754
|
-
}));
|
|
755
|
-
|
|
756
|
-
return function login(_x2) {
|
|
757
|
-
return _ref4.apply(this, arguments);
|
|
758
|
-
};
|
|
759
|
-
}();
|
|
760
|
-
|
|
761
|
-
var getToken = /*#__PURE__*/function () {
|
|
762
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(options) {
|
|
763
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
764
|
-
while (1) {
|
|
765
|
-
switch (_context4.prev = _context4.next) {
|
|
766
|
-
case 0:
|
|
767
|
-
assertIsDefined(auth0Client);
|
|
768
|
-
return _context4.abrupt("return", auth0Client.getTokenSilently(options));
|
|
769
|
-
|
|
770
|
-
case 2:
|
|
771
|
-
case "end":
|
|
772
|
-
return _context4.stop();
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
}, _callee4);
|
|
776
|
-
}));
|
|
777
|
-
|
|
778
|
-
return function getToken(_x3) {
|
|
779
|
-
return _ref5.apply(this, arguments);
|
|
780
|
-
};
|
|
781
|
-
}();
|
|
782
|
-
|
|
783
|
-
return React.createElement(Auth0Context.Provider, {
|
|
784
|
-
value: _extends({}, state, {
|
|
785
|
-
auth0Client: auth0Client,
|
|
786
|
-
logout: logout,
|
|
787
|
-
getToken: getToken,
|
|
788
|
-
login: login
|
|
789
|
-
})
|
|
790
|
-
}, children);
|
|
791
|
-
};
|
|
792
|
-
|
|
793
434
|
var EnvironmentBanner = function EnvironmentBanner(_ref) {
|
|
794
435
|
var environment = _ref.environment;
|
|
795
436
|
return React.createElement("div", {
|
|
@@ -807,83 +448,121 @@ var EnvironmentBanner = function EnvironmentBanner(_ref) {
|
|
|
807
448
|
});
|
|
808
449
|
};
|
|
809
450
|
|
|
810
|
-
|
|
811
|
-
var
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
451
|
+
function userLogout(logout) {
|
|
452
|
+
var _window$location = window.location,
|
|
453
|
+
protocol = _window$location.protocol,
|
|
454
|
+
hostname = _window$location.hostname,
|
|
455
|
+
port = _window$location.port;
|
|
456
|
+
return logout({
|
|
457
|
+
logoutParams: {
|
|
458
|
+
returnTo: protocol + "//" + hostname + ":" + port
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
var Authenticate = function Authenticate(_ref) {
|
|
463
|
+
var children = _ref.children,
|
|
464
|
+
decorateUser = _ref.decorateUser;
|
|
465
|
+
var _useState = useState(undefined),
|
|
466
|
+
userWithPermission = _useState[0],
|
|
467
|
+
setUserWithPermission = _useState[1];
|
|
468
|
+
var _useAuth = useAuth0(),
|
|
469
|
+
user = _useAuth.user,
|
|
470
|
+
getAccessTokenSilently = _useAuth.getAccessTokenSilently,
|
|
471
|
+
loginWithRedirect = _useAuth.loginWithRedirect,
|
|
472
|
+
_logout = _useAuth.logout,
|
|
473
|
+
isLoading = _useAuth.isLoading,
|
|
474
|
+
isAuthenticated = _useAuth.isAuthenticated,
|
|
475
|
+
error = _useAuth.error;
|
|
816
476
|
useEffect(function () {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
getToken: getToken
|
|
477
|
+
var fetchUserData = /*#__PURE__*/function () {
|
|
478
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
479
|
+
var token, decoratedUser;
|
|
480
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
481
|
+
while (1) switch (_context.prev = _context.next) {
|
|
482
|
+
case 0:
|
|
483
|
+
_context.prev = 0;
|
|
484
|
+
_context.next = 3;
|
|
485
|
+
return getAccessTokenSilently();
|
|
486
|
+
case 3:
|
|
487
|
+
token = _context.sent;
|
|
488
|
+
_context.next = 6;
|
|
489
|
+
return decorateUser(user, token);
|
|
490
|
+
case 6:
|
|
491
|
+
decoratedUser = _context.sent;
|
|
492
|
+
setUserWithPermission(decoratedUser);
|
|
493
|
+
_context.next = 13;
|
|
494
|
+
break;
|
|
495
|
+
case 10:
|
|
496
|
+
_context.prev = 10;
|
|
497
|
+
_context.t0 = _context["catch"](0);
|
|
498
|
+
console.error('Error fetching user data:', _context.t0);
|
|
499
|
+
case 13:
|
|
500
|
+
case "end":
|
|
501
|
+
return _context.stop();
|
|
502
|
+
}
|
|
503
|
+
}, _callee, null, [[0, 10]]);
|
|
845
504
|
}));
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
505
|
+
return function fetchUserData() {
|
|
506
|
+
return _ref2.apply(this, arguments);
|
|
507
|
+
};
|
|
508
|
+
}();
|
|
509
|
+
if (isAuthenticated) {
|
|
510
|
+
fetchUserData();
|
|
511
|
+
}
|
|
512
|
+
}, [decorateUser, getAccessTokenSilently, isAuthenticated, user]);
|
|
513
|
+
if (!isLoading && !isAuthenticated) {
|
|
514
|
+
loginWithRedirect();
|
|
515
|
+
return React.createElement(Loader, {
|
|
516
|
+
style: {
|
|
517
|
+
marginTop: space.extraLarge9
|
|
518
|
+
}
|
|
519
|
+
}, "Redirecting to login page");
|
|
520
|
+
}
|
|
521
|
+
if (isLoading || !userWithPermission) {
|
|
522
|
+
return React.createElement(Loader, {
|
|
523
|
+
style: {
|
|
524
|
+
marginTop: space.extraLarge9
|
|
525
|
+
}
|
|
526
|
+
}, "Authenticating");
|
|
527
|
+
}
|
|
528
|
+
if (error) {
|
|
529
|
+
process.env.NODE_ENV !== 'production' && console.error(error);
|
|
530
|
+
return React.createElement(BannerAlertBox, {
|
|
531
|
+
variant: "error",
|
|
532
|
+
title: "Authentication failed",
|
|
533
|
+
style: {
|
|
534
|
+
maxWidth: '600px',
|
|
535
|
+
margin: '0 auto'
|
|
536
|
+
}
|
|
537
|
+
}, React.createElement(Paragraph, null, "Something went wrong while trying to authenticate you. If the problem persists you should contact", ' ', React.createElement(Link, {
|
|
538
|
+
href: "mailto:support@entur.org"
|
|
539
|
+
}, "support@entur.org"), " to get it resolved."), React.createElement(Paragraph, null, "Authentication failed with: ", React.createElement(CodeText, null, error == null ? void 0 : error.toString())));
|
|
869
540
|
}
|
|
541
|
+
assertIsDefined(userWithPermission);
|
|
542
|
+
return React.createElement(React.Fragment, null, children({
|
|
543
|
+
user: userWithPermission,
|
|
544
|
+
logout: function logout() {
|
|
545
|
+
return userLogout(_logout);
|
|
546
|
+
},
|
|
547
|
+
getToken: getAccessTokenSilently
|
|
548
|
+
}));
|
|
870
549
|
};
|
|
871
|
-
|
|
872
550
|
var AppShell = function AppShell(_ref3) {
|
|
873
551
|
var children = _ref3.children,
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
return React.createElement(AuthProvider, {
|
|
881
|
-
audience: audience,
|
|
552
|
+
audience = _ref3.audience,
|
|
553
|
+
domain = _ref3.domain,
|
|
554
|
+
clientId = _ref3.clientId,
|
|
555
|
+
decorateUser = _ref3.decorateUser,
|
|
556
|
+
environment = _ref3.environment;
|
|
557
|
+
return React.createElement(Auth0Provider, {
|
|
882
558
|
domain: domain,
|
|
883
|
-
|
|
884
|
-
|
|
559
|
+
clientId: clientId,
|
|
560
|
+
authorizationParams: {
|
|
561
|
+
redirect_uri: window.location.origin,
|
|
562
|
+
audience: audience
|
|
563
|
+
}
|
|
885
564
|
}, React.createElement(Authenticate, {
|
|
886
|
-
|
|
565
|
+
decorateUser: decorateUser
|
|
887
566
|
}, function (params) {
|
|
888
567
|
return React.createElement(React.Fragment, null, environment && environment !== Environment.Production && React.createElement(EnvironmentBanner, {
|
|
889
568
|
environment: environment
|
|
@@ -892,18 +571,15 @@ var AppShell = function AppShell(_ref3) {
|
|
|
892
571
|
};
|
|
893
572
|
|
|
894
573
|
var _excluded$1 = ["navigate", "children", "onClick", "target"];
|
|
895
|
-
|
|
896
574
|
function isModifiedEvent(event) {
|
|
897
575
|
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
898
576
|
}
|
|
899
|
-
|
|
900
577
|
var MicroFrontendLink = function MicroFrontendLink(_ref) {
|
|
901
578
|
var navigate = _ref.navigate,
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
579
|
+
children = _ref.children,
|
|
580
|
+
_onClick = _ref.onClick,
|
|
581
|
+
target = _ref.target,
|
|
582
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
907
583
|
return React.createElement("a", _extends({
|
|
908
584
|
onClick: function onClick(event) {
|
|
909
585
|
try {
|
|
@@ -912,10 +588,12 @@ var MicroFrontendLink = function MicroFrontendLink(_ref) {
|
|
|
912
588
|
event.preventDefault();
|
|
913
589
|
throw ex;
|
|
914
590
|
}
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
event.button === 0 && (
|
|
918
|
-
|
|
591
|
+
if (!event.defaultPrevented &&
|
|
592
|
+
// onClick prevented default
|
|
593
|
+
event.button === 0 && (
|
|
594
|
+
// ignore everything but right clicks
|
|
595
|
+
!target || target === '_self') &&
|
|
596
|
+
// let browser handle "target=_blank" etc.
|
|
919
597
|
!isModifiedEvent(event) // ignore clicks with modifier keys
|
|
920
598
|
) {
|
|
921
599
|
event.preventDefault();
|
|
@@ -945,47 +623,37 @@ var useMenu = function useMenu() {
|
|
|
945
623
|
};
|
|
946
624
|
var useMFNavigation = function useMFNavigation(path) {
|
|
947
625
|
var _useMenu = useMenu(),
|
|
948
|
-
|
|
949
|
-
|
|
626
|
+
getMFNavigate = _useMenu.getMFNavigate;
|
|
950
627
|
return getMFNavigate(path);
|
|
951
628
|
};
|
|
952
629
|
var MenuProvider = function MenuProvider(_ref) {
|
|
953
630
|
var children = _ref.children;
|
|
954
|
-
|
|
955
631
|
var _useState = useState({}),
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
632
|
+
groups = _useState[0],
|
|
633
|
+
setGroups = _useState[1];
|
|
959
634
|
var _useState2 = useState({}),
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
635
|
+
navFuncs = _useState2[0],
|
|
636
|
+
setNavFuncs = _useState2[1];
|
|
963
637
|
var addItems = useCallback(function (newItems, path) {
|
|
964
638
|
setGroups(function (prevState) {
|
|
965
639
|
var _extends2;
|
|
966
|
-
|
|
967
640
|
return _extends({}, prevState, (_extends2 = {}, _extends2[path] = newItems, _extends2));
|
|
968
641
|
});
|
|
969
642
|
}, [setGroups]);
|
|
970
|
-
|
|
971
643
|
var getMFNavigate = function getMFNavigate(path) {
|
|
972
644
|
return navFuncs[path];
|
|
973
645
|
};
|
|
974
|
-
|
|
975
646
|
var setMFNavigate = function setMFNavigate(path, navigation) {
|
|
976
647
|
return setNavFuncs(function (prev) {
|
|
977
648
|
var _extends3;
|
|
978
|
-
|
|
979
649
|
return _extends({}, prev, (_extends3 = {}, _extends3[path] = navigation, _extends3));
|
|
980
650
|
});
|
|
981
651
|
};
|
|
982
|
-
|
|
983
652
|
return React.createElement(MenuContext.Provider, {
|
|
984
653
|
value: {
|
|
985
654
|
addItems: addItems,
|
|
986
655
|
getItemsForPath: function getItemsForPath(path) {
|
|
987
656
|
var _groups$path;
|
|
988
|
-
|
|
989
657
|
return (_groups$path = groups[path]) != null ? _groups$path : [];
|
|
990
658
|
},
|
|
991
659
|
getMFNavigate: getMFNavigate,
|
|
@@ -1024,26 +692,21 @@ var useOrganisationId = function useOrganisationId() {
|
|
|
1024
692
|
assertIsDefined(context);
|
|
1025
693
|
return context.organisationId;
|
|
1026
694
|
};
|
|
1027
|
-
|
|
1028
695
|
var useOrganisationState = function useOrganisationState(initialOrganisationId) {
|
|
1029
696
|
var _useState = useState(Number(initialOrganisationId)),
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
697
|
+
organisationId = _useState[0],
|
|
698
|
+
setOrganisationId = _useState[1];
|
|
1033
699
|
useEffect(function () {
|
|
1034
700
|
organisationStorage.set(organisationId.toString());
|
|
1035
701
|
}, [organisationId]);
|
|
1036
702
|
return [organisationId, setOrganisationId];
|
|
1037
703
|
};
|
|
1038
|
-
|
|
1039
704
|
var OrganisationProvider = function OrganisationProvider(_ref) {
|
|
1040
705
|
var children = _ref.children,
|
|
1041
|
-
|
|
1042
|
-
|
|
706
|
+
organisationId = _ref.organisationId;
|
|
1043
707
|
var _useOrganisationState = useOrganisationState(organisationId),
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
708
|
+
orgId = _useOrganisationState[0],
|
|
709
|
+
setOrganisationId = _useOrganisationState[1];
|
|
1047
710
|
return React.createElement(OrganisationContext.Provider, {
|
|
1048
711
|
value: {
|
|
1049
712
|
organisationId: orgId,
|
|
@@ -1053,18 +716,15 @@ var OrganisationProvider = function OrganisationProvider(_ref) {
|
|
|
1053
716
|
};
|
|
1054
717
|
|
|
1055
718
|
var LanguageContext = /*#__PURE__*/React.createContext(undefined);
|
|
1056
|
-
|
|
1057
719
|
var useLanguageState = function useLanguageState(language) {
|
|
1058
720
|
var _useState = useState(language),
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
721
|
+
activeLanguage = _useState[0],
|
|
722
|
+
setLanguage = _useState[1];
|
|
1062
723
|
useEffect(function () {
|
|
1063
724
|
languageStorage.set(activeLanguage);
|
|
1064
725
|
}, [activeLanguage]);
|
|
1065
726
|
return [activeLanguage, setLanguage];
|
|
1066
727
|
};
|
|
1067
|
-
|
|
1068
728
|
var useLanguage = function useLanguage() {
|
|
1069
729
|
var context = useContext(LanguageContext);
|
|
1070
730
|
assertIsDefined(context);
|
|
@@ -1072,12 +732,10 @@ var useLanguage = function useLanguage() {
|
|
|
1072
732
|
};
|
|
1073
733
|
var LanguageProvider = function LanguageProvider(_ref) {
|
|
1074
734
|
var children = _ref.children,
|
|
1075
|
-
|
|
1076
|
-
|
|
735
|
+
language = _ref.language;
|
|
1077
736
|
var _useLanguageState = useLanguageState(language),
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
737
|
+
activeLanguage = _useLanguageState[0],
|
|
738
|
+
setLanguage = _useLanguageState[1];
|
|
1081
739
|
return React.createElement(LanguageContext.Provider, {
|
|
1082
740
|
value: {
|
|
1083
741
|
language: activeLanguage,
|
|
@@ -1087,109 +745,87 @@ var LanguageProvider = function LanguageProvider(_ref) {
|
|
|
1087
745
|
};
|
|
1088
746
|
|
|
1089
747
|
var OrganisationsError = /*#__PURE__*/function (_Error) {
|
|
1090
|
-
_inheritsLoose(OrganisationsError, _Error);
|
|
1091
|
-
|
|
1092
748
|
function OrganisationsError() {
|
|
1093
749
|
var _this;
|
|
1094
|
-
|
|
1095
750
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1096
751
|
args[_key] = arguments[_key];
|
|
1097
752
|
}
|
|
1098
|
-
|
|
1099
753
|
_this = _Error.call.apply(_Error, [this].concat(args)) || this;
|
|
1100
754
|
_this.message = 'Failed fetching organisations';
|
|
1101
755
|
return _this;
|
|
1102
756
|
}
|
|
1103
|
-
|
|
757
|
+
_inheritsLoose(OrganisationsError, _Error);
|
|
1104
758
|
return OrganisationsError;
|
|
1105
759
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
1106
760
|
|
|
1107
761
|
var _excluded = ["getToken", "getOrganisations", "value", "onChange"];
|
|
1108
762
|
var OrganisationSelector = function OrganisationSelector(_ref) {
|
|
1109
763
|
var getToken = _ref.getToken,
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
764
|
+
getOrganisations = _ref.getOrganisations,
|
|
765
|
+
value = _ref.value,
|
|
766
|
+
onChange = _ref.onChange,
|
|
767
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1115
768
|
var _useState = useState([]),
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
769
|
+
organisations = _useState[0],
|
|
770
|
+
setOrganisations = _useState[1];
|
|
1119
771
|
var _useLanguage = useLanguage(),
|
|
1120
|
-
|
|
1121
|
-
|
|
772
|
+
language = _useLanguage.language;
|
|
1122
773
|
var _useState2 = useState('LOADING'),
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
774
|
+
status = _useState2[0],
|
|
775
|
+
setStatus = _useState2[1];
|
|
1126
776
|
useEffect(function () {
|
|
1127
777
|
var fetchOrganisations = /*#__PURE__*/function () {
|
|
1128
778
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1129
779
|
var token, organisations;
|
|
1130
780
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1131
|
-
while (1) {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
if (!(typeof getOrganisations === 'string')) {
|
|
1141
|
-
_context.next = 9;
|
|
1142
|
-
break;
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
_context.next = 6;
|
|
1146
|
-
return fetch(getOrganisations, {
|
|
1147
|
-
headers: {
|
|
1148
|
-
Authorization: "Bearer " + token,
|
|
1149
|
-
Accept: 'application/json'
|
|
1150
|
-
}
|
|
1151
|
-
}).then(function (response) {
|
|
1152
|
-
return response.json();
|
|
1153
|
-
});
|
|
1154
|
-
|
|
1155
|
-
case 6:
|
|
1156
|
-
organisations = _context.sent;
|
|
1157
|
-
_context.next = 12;
|
|
781
|
+
while (1) switch (_context.prev = _context.next) {
|
|
782
|
+
case 0:
|
|
783
|
+
_context.next = 2;
|
|
784
|
+
return getToken();
|
|
785
|
+
case 2:
|
|
786
|
+
token = _context.sent;
|
|
787
|
+
if (!(typeof getOrganisations === 'string')) {
|
|
788
|
+
_context.next = 9;
|
|
1158
789
|
break;
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
790
|
+
}
|
|
791
|
+
_context.next = 6;
|
|
792
|
+
return fetch(getOrganisations, {
|
|
793
|
+
headers: {
|
|
794
|
+
Authorization: "Bearer " + token,
|
|
795
|
+
Accept: 'application/json'
|
|
796
|
+
}
|
|
797
|
+
}).then(function (response) {
|
|
798
|
+
return response.json();
|
|
799
|
+
});
|
|
800
|
+
case 6:
|
|
801
|
+
organisations = _context.sent;
|
|
802
|
+
_context.next = 12;
|
|
803
|
+
break;
|
|
804
|
+
case 9:
|
|
805
|
+
_context.next = 11;
|
|
806
|
+
return getOrganisations(token);
|
|
807
|
+
case 11:
|
|
808
|
+
organisations = _context.sent;
|
|
809
|
+
case 12:
|
|
810
|
+
setOrganisations(organisations);
|
|
811
|
+
setStatus('SUCCESS');
|
|
812
|
+
case 14:
|
|
813
|
+
case "end":
|
|
814
|
+
return _context.stop();
|
|
1175
815
|
}
|
|
1176
816
|
}, _callee);
|
|
1177
817
|
}));
|
|
1178
|
-
|
|
1179
818
|
return function fetchOrganisations() {
|
|
1180
819
|
return _ref2.apply(this, arguments);
|
|
1181
820
|
};
|
|
1182
821
|
}();
|
|
1183
|
-
|
|
1184
822
|
fetchOrganisations()["catch"](function (error) {
|
|
1185
823
|
if (process.env.NODE_ENV === 'development') {
|
|
1186
824
|
console.error(error);
|
|
1187
825
|
}
|
|
1188
|
-
|
|
1189
826
|
setStatus('ERROR');
|
|
1190
827
|
});
|
|
1191
828
|
}, [getOrganisations, getToken]);
|
|
1192
|
-
|
|
1193
829
|
switch (status) {
|
|
1194
830
|
case 'LOADING':
|
|
1195
831
|
return React.createElement("div", {
|
|
@@ -1199,7 +835,6 @@ var OrganisationSelector = function OrganisationSelector(_ref) {
|
|
|
1199
835
|
height: '2.4rem'
|
|
1200
836
|
}
|
|
1201
837
|
}));
|
|
1202
|
-
|
|
1203
838
|
case 'SUCCESS':
|
|
1204
839
|
return React.createElement(OrganisationDropDown, _extends({
|
|
1205
840
|
label: language === 'nb' ? 'Organisasjon' : 'Organisation',
|
|
@@ -1207,10 +842,8 @@ var OrganisationSelector = function OrganisationSelector(_ref) {
|
|
|
1207
842
|
organisations: organisations,
|
|
1208
843
|
onChange: onChange
|
|
1209
844
|
}, rest));
|
|
1210
|
-
|
|
1211
845
|
case 'ERROR':
|
|
1212
846
|
throw new OrganisationsError();
|
|
1213
|
-
|
|
1214
847
|
default:
|
|
1215
848
|
return null;
|
|
1216
849
|
}
|