@entur-partner/app-shell-standalone 6.0.5-alpha.1 → 6.0.5-alpha.2
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/AppShellStandalone.d.ts +0 -3
- package/dist/Menu.d.ts +2 -2
- package/dist/PostHogProviderWrapper.d.ts +11 -6
- package/dist/app-shell-standalone.cjs.development.js +399 -43
- package/dist/app-shell-standalone.cjs.development.js.map +1 -1
- package/dist/app-shell-standalone.cjs.production.min.js +1 -1
- package/dist/app-shell-standalone.cjs.production.min.js.map +1 -1
- package/dist/app-shell-standalone.esm.js +401 -45
- package/dist/app-shell-standalone.esm.js.map +1 -1
- package/package.json +6 -4
|
@@ -10,9 +10,6 @@ export interface AppShellStandaloneProps extends Omit<AppShellProps, 'children'>
|
|
|
10
10
|
*/
|
|
11
11
|
getOrganisations: GetOrganisationsFn | string;
|
|
12
12
|
environment?: Environment;
|
|
13
|
-
/**
|
|
14
|
-
* Optional PostHog API key for tracking. If not provided, a default Entur Partner key will be used.
|
|
15
|
-
*/
|
|
16
13
|
postHogApiKey?: string;
|
|
17
14
|
}
|
|
18
15
|
export declare const AppShellStandalone: ({ children, audience, domain, clientId, decorateUser, getOrganisations, redirectUri, environment, postHogApiKey, }: AppShellStandaloneProps) => React.JSX.Element;
|
package/dist/Menu.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Environment } from '@entur-partner/common';
|
|
2
3
|
import { AppShellValues, GetOrganisationsFn } from '@entur-partner/app-shell';
|
|
3
|
-
|
|
4
|
-
export declare const MESSAGES: {
|
|
4
|
+
export declare const messages: {
|
|
5
5
|
readonly nb: {
|
|
6
6
|
switchLanguage: string;
|
|
7
7
|
logout: string;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export declare const useMFPostHog: () => {
|
|
3
|
+
capture: (event_name: import("posthog-js").EventName, properties?: import("posthog-js").Properties | null | undefined, options?: import("posthog-js").CaptureOptions | undefined) => import("posthog-js").CaptureResult | undefined;
|
|
4
|
+
alias: (alias: string, original?: string | undefined) => number | void | import("posthog-js").CaptureResult;
|
|
5
|
+
identify: (new_distinct_id?: string | undefined, userPropertiesToSet?: import("posthog-js").Properties | undefined, userPropertiesToSetOnce?: import("posthog-js").Properties | undefined) => void;
|
|
6
|
+
register: (properties: import("posthog-js").Properties, days?: number | undefined) => void;
|
|
7
|
+
register_once: (properties: import("posthog-js").Properties, default_value?: any, days?: number | undefined) => void;
|
|
8
|
+
unregister: (property: string) => void;
|
|
9
|
+
group: (groupType: string, groupKey: string, groupPropertiesToSet?: import("posthog-js").Properties | undefined) => void;
|
|
10
|
+
setPersonProperties: (userPropertiesToSet?: import("posthog-js").Properties | undefined, userPropertiesToSetOnce?: import("posthog-js").Properties | undefined) => void;
|
|
11
|
+
reset: (reset_device_id?: boolean | undefined) => void;
|
|
12
|
+
};
|
|
8
13
|
type Props = {
|
|
9
14
|
postHogApiKey?: string;
|
|
10
15
|
children: ReactNode;
|
|
@@ -5,15 +5,347 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var common = require('@entur-partner/common');
|
|
7
7
|
var appShell = require('@entur-partner/app-shell');
|
|
8
|
-
var postHog = require('posthog-js');
|
|
9
8
|
var menu = require('@entur/menu');
|
|
10
9
|
var tokens = require('@entur/tokens');
|
|
10
|
+
var postHog = require('posthog-js');
|
|
11
|
+
var react = require('posthog-js/react');
|
|
11
12
|
|
|
12
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
14
|
|
|
14
15
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
16
|
var postHog__default = /*#__PURE__*/_interopDefaultLegacy(postHog);
|
|
16
17
|
|
|
18
|
+
function _regeneratorRuntime() {
|
|
19
|
+
_regeneratorRuntime = function () {
|
|
20
|
+
return e;
|
|
21
|
+
};
|
|
22
|
+
var t,
|
|
23
|
+
e = {},
|
|
24
|
+
r = Object.prototype,
|
|
25
|
+
n = r.hasOwnProperty,
|
|
26
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
27
|
+
t[e] = r.value;
|
|
28
|
+
},
|
|
29
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
30
|
+
a = i.iterator || "@@iterator",
|
|
31
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
32
|
+
u = i.toStringTag || "@@toStringTag";
|
|
33
|
+
function define(t, e, r) {
|
|
34
|
+
return Object.defineProperty(t, e, {
|
|
35
|
+
value: r,
|
|
36
|
+
enumerable: !0,
|
|
37
|
+
configurable: !0,
|
|
38
|
+
writable: !0
|
|
39
|
+
}), t[e];
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
define({}, "");
|
|
43
|
+
} catch (t) {
|
|
44
|
+
define = function (t, e, r) {
|
|
45
|
+
return t[e] = r;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function wrap(t, e, r, n) {
|
|
49
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
50
|
+
a = Object.create(i.prototype),
|
|
51
|
+
c = new Context(n || []);
|
|
52
|
+
return o(a, "_invoke", {
|
|
53
|
+
value: makeInvokeMethod(t, r, c)
|
|
54
|
+
}), a;
|
|
55
|
+
}
|
|
56
|
+
function tryCatch(t, e, r) {
|
|
57
|
+
try {
|
|
58
|
+
return {
|
|
59
|
+
type: "normal",
|
|
60
|
+
arg: t.call(e, r)
|
|
61
|
+
};
|
|
62
|
+
} catch (t) {
|
|
63
|
+
return {
|
|
64
|
+
type: "throw",
|
|
65
|
+
arg: t
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
e.wrap = wrap;
|
|
70
|
+
var h = "suspendedStart",
|
|
71
|
+
l = "suspendedYield",
|
|
72
|
+
f = "executing",
|
|
73
|
+
s = "completed",
|
|
74
|
+
y = {};
|
|
75
|
+
function Generator() {}
|
|
76
|
+
function GeneratorFunction() {}
|
|
77
|
+
function GeneratorFunctionPrototype() {}
|
|
78
|
+
var p = {};
|
|
79
|
+
define(p, a, function () {
|
|
80
|
+
return this;
|
|
81
|
+
});
|
|
82
|
+
var d = Object.getPrototypeOf,
|
|
83
|
+
v = d && d(d(values([])));
|
|
84
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
85
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
86
|
+
function defineIteratorMethods(t) {
|
|
87
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
88
|
+
define(t, e, function (t) {
|
|
89
|
+
return this._invoke(e, t);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function AsyncIterator(t, e) {
|
|
94
|
+
function invoke(r, o, i, a) {
|
|
95
|
+
var c = tryCatch(t[r], t, o);
|
|
96
|
+
if ("throw" !== c.type) {
|
|
97
|
+
var u = c.arg,
|
|
98
|
+
h = u.value;
|
|
99
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
100
|
+
invoke("next", t, i, a);
|
|
101
|
+
}, function (t) {
|
|
102
|
+
invoke("throw", t, i, a);
|
|
103
|
+
}) : e.resolve(h).then(function (t) {
|
|
104
|
+
u.value = t, i(u);
|
|
105
|
+
}, function (t) {
|
|
106
|
+
return invoke("throw", t, i, a);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
a(c.arg);
|
|
110
|
+
}
|
|
111
|
+
var r;
|
|
112
|
+
o(this, "_invoke", {
|
|
113
|
+
value: function (t, n) {
|
|
114
|
+
function callInvokeWithMethodAndArg() {
|
|
115
|
+
return new e(function (e, r) {
|
|
116
|
+
invoke(t, n, e, r);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function makeInvokeMethod(e, r, n) {
|
|
124
|
+
var o = h;
|
|
125
|
+
return function (i, a) {
|
|
126
|
+
if (o === f) throw Error("Generator is already running");
|
|
127
|
+
if (o === s) {
|
|
128
|
+
if ("throw" === i) throw a;
|
|
129
|
+
return {
|
|
130
|
+
value: t,
|
|
131
|
+
done: !0
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
for (n.method = i, n.arg = a;;) {
|
|
135
|
+
var c = n.delegate;
|
|
136
|
+
if (c) {
|
|
137
|
+
var u = maybeInvokeDelegate(c, n);
|
|
138
|
+
if (u) {
|
|
139
|
+
if (u === y) continue;
|
|
140
|
+
return u;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
144
|
+
if (o === h) throw o = s, n.arg;
|
|
145
|
+
n.dispatchException(n.arg);
|
|
146
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
147
|
+
o = f;
|
|
148
|
+
var p = tryCatch(e, r, n);
|
|
149
|
+
if ("normal" === p.type) {
|
|
150
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
151
|
+
return {
|
|
152
|
+
value: p.arg,
|
|
153
|
+
done: n.done
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function maybeInvokeDelegate(e, r) {
|
|
161
|
+
var n = r.method,
|
|
162
|
+
o = e.iterator[n];
|
|
163
|
+
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;
|
|
164
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
165
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
166
|
+
var a = i.arg;
|
|
167
|
+
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);
|
|
168
|
+
}
|
|
169
|
+
function pushTryEntry(t) {
|
|
170
|
+
var e = {
|
|
171
|
+
tryLoc: t[0]
|
|
172
|
+
};
|
|
173
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
174
|
+
}
|
|
175
|
+
function resetTryEntry(t) {
|
|
176
|
+
var e = t.completion || {};
|
|
177
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
178
|
+
}
|
|
179
|
+
function Context(t) {
|
|
180
|
+
this.tryEntries = [{
|
|
181
|
+
tryLoc: "root"
|
|
182
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
183
|
+
}
|
|
184
|
+
function values(e) {
|
|
185
|
+
if (e || "" === e) {
|
|
186
|
+
var r = e[a];
|
|
187
|
+
if (r) return r.call(e);
|
|
188
|
+
if ("function" == typeof e.next) return e;
|
|
189
|
+
if (!isNaN(e.length)) {
|
|
190
|
+
var o = -1,
|
|
191
|
+
i = function next() {
|
|
192
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
193
|
+
return next.value = t, next.done = !0, next;
|
|
194
|
+
};
|
|
195
|
+
return i.next = i;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
199
|
+
}
|
|
200
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
201
|
+
value: GeneratorFunctionPrototype,
|
|
202
|
+
configurable: !0
|
|
203
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
204
|
+
value: GeneratorFunction,
|
|
205
|
+
configurable: !0
|
|
206
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
207
|
+
var e = "function" == typeof t && t.constructor;
|
|
208
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
209
|
+
}, e.mark = function (t) {
|
|
210
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
211
|
+
}, e.awrap = function (t) {
|
|
212
|
+
return {
|
|
213
|
+
__await: t
|
|
214
|
+
};
|
|
215
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
216
|
+
return this;
|
|
217
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
218
|
+
void 0 === i && (i = Promise);
|
|
219
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
220
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
221
|
+
return t.done ? t.value : a.next();
|
|
222
|
+
});
|
|
223
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
224
|
+
return this;
|
|
225
|
+
}), define(g, "toString", function () {
|
|
226
|
+
return "[object Generator]";
|
|
227
|
+
}), e.keys = function (t) {
|
|
228
|
+
var e = Object(t),
|
|
229
|
+
r = [];
|
|
230
|
+
for (var n in e) r.push(n);
|
|
231
|
+
return r.reverse(), function next() {
|
|
232
|
+
for (; r.length;) {
|
|
233
|
+
var t = r.pop();
|
|
234
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
235
|
+
}
|
|
236
|
+
return next.done = !0, next;
|
|
237
|
+
};
|
|
238
|
+
}, e.values = values, Context.prototype = {
|
|
239
|
+
constructor: Context,
|
|
240
|
+
reset: function (e) {
|
|
241
|
+
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);
|
|
242
|
+
},
|
|
243
|
+
stop: function () {
|
|
244
|
+
this.done = !0;
|
|
245
|
+
var t = this.tryEntries[0].completion;
|
|
246
|
+
if ("throw" === t.type) throw t.arg;
|
|
247
|
+
return this.rval;
|
|
248
|
+
},
|
|
249
|
+
dispatchException: function (e) {
|
|
250
|
+
if (this.done) throw e;
|
|
251
|
+
var r = this;
|
|
252
|
+
function handle(n, o) {
|
|
253
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
254
|
+
}
|
|
255
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
256
|
+
var i = this.tryEntries[o],
|
|
257
|
+
a = i.completion;
|
|
258
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
259
|
+
if (i.tryLoc <= this.prev) {
|
|
260
|
+
var c = n.call(i, "catchLoc"),
|
|
261
|
+
u = n.call(i, "finallyLoc");
|
|
262
|
+
if (c && u) {
|
|
263
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
264
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
265
|
+
} else if (c) {
|
|
266
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
267
|
+
} else {
|
|
268
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
269
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
abrupt: function (t, e) {
|
|
275
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
276
|
+
var o = this.tryEntries[r];
|
|
277
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
278
|
+
var i = o;
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
283
|
+
var a = i ? i.completion : {};
|
|
284
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
285
|
+
},
|
|
286
|
+
complete: function (t, e) {
|
|
287
|
+
if ("throw" === t.type) throw t.arg;
|
|
288
|
+
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;
|
|
289
|
+
},
|
|
290
|
+
finish: function (t) {
|
|
291
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
292
|
+
var r = this.tryEntries[e];
|
|
293
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
catch: function (t) {
|
|
297
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
298
|
+
var r = this.tryEntries[e];
|
|
299
|
+
if (r.tryLoc === t) {
|
|
300
|
+
var n = r.completion;
|
|
301
|
+
if ("throw" === n.type) {
|
|
302
|
+
var o = n.arg;
|
|
303
|
+
resetTryEntry(r);
|
|
304
|
+
}
|
|
305
|
+
return o;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
throw Error("illegal catch attempt");
|
|
309
|
+
},
|
|
310
|
+
delegateYield: function (e, r, n) {
|
|
311
|
+
return this.delegate = {
|
|
312
|
+
iterator: values(e),
|
|
313
|
+
resultName: r,
|
|
314
|
+
nextLoc: n
|
|
315
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
316
|
+
}
|
|
317
|
+
}, e;
|
|
318
|
+
}
|
|
319
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
320
|
+
try {
|
|
321
|
+
var info = gen[key](arg);
|
|
322
|
+
var value = info.value;
|
|
323
|
+
} catch (error) {
|
|
324
|
+
reject(error);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (info.done) {
|
|
328
|
+
resolve(value);
|
|
329
|
+
} else {
|
|
330
|
+
Promise.resolve(value).then(_next, _throw);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
function _asyncToGenerator(fn) {
|
|
334
|
+
return function () {
|
|
335
|
+
var self = this,
|
|
336
|
+
args = arguments;
|
|
337
|
+
return new Promise(function (resolve, reject) {
|
|
338
|
+
var gen = fn.apply(self, args);
|
|
339
|
+
function _next(value) {
|
|
340
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
341
|
+
}
|
|
342
|
+
function _throw(err) {
|
|
343
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
344
|
+
}
|
|
345
|
+
_next(undefined);
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
}
|
|
17
349
|
function _extends() {
|
|
18
350
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
19
351
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -29,40 +361,47 @@ function _extends() {
|
|
|
29
361
|
return _extends.apply(this, arguments);
|
|
30
362
|
}
|
|
31
363
|
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
throw new Error('useOptInPostHog must be used within a PostHogProvider');
|
|
364
|
+
var useMFPostHog = function useMFPostHog() {
|
|
365
|
+
var postHog = react.usePostHog();
|
|
366
|
+
if (!postHog) {
|
|
367
|
+
throw new Error('PostHog is not initialized. Ensure PostHog API key is provided in the AppShellStandalone.');
|
|
37
368
|
}
|
|
38
|
-
return
|
|
369
|
+
return {
|
|
370
|
+
capture: postHog.capture,
|
|
371
|
+
alias: postHog.alias,
|
|
372
|
+
identify: postHog.identify,
|
|
373
|
+
register: postHog.register,
|
|
374
|
+
register_once: postHog.register_once,
|
|
375
|
+
unregister: postHog.unregister,
|
|
376
|
+
group: postHog.group,
|
|
377
|
+
setPersonProperties: postHog.setPersonProperties,
|
|
378
|
+
reset: postHog.reset
|
|
379
|
+
};
|
|
39
380
|
};
|
|
40
381
|
var PostHogProviderWrapper = function PostHogProviderWrapper(_ref) {
|
|
41
382
|
var postHogApiKey = _ref.postHogApiKey,
|
|
42
383
|
children = _ref.children;
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
384
|
+
var consents = appShell.useConsentManager();
|
|
385
|
+
React.useEffect(function () {
|
|
386
|
+
if (!postHogApiKey) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
if (consents.PostHog.consentGiven) {
|
|
390
|
+
postHog__default["default"].opt_in_capturing();
|
|
391
|
+
} else {
|
|
392
|
+
postHog__default["default"].opt_out_capturing();
|
|
393
|
+
}
|
|
394
|
+
}, [consents.PostHog.consentGiven, postHogApiKey]);
|
|
46
395
|
if (!postHogApiKey) {
|
|
47
|
-
console.warn('
|
|
48
|
-
return React__default["default"].createElement(
|
|
49
|
-
value: {
|
|
50
|
-
isInitialized: false,
|
|
51
|
-
optInPostHog: optInPostHog,
|
|
52
|
-
setOptInPostHog: setOptInPostHog
|
|
53
|
-
}
|
|
54
|
-
}, children);
|
|
396
|
+
console.warn('AppShellStandalone Warning: PostHog API key is not provided. PostHog will not be initialized.');
|
|
397
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
55
398
|
}
|
|
56
399
|
postHog__default["default"].init(postHogApiKey, {
|
|
57
400
|
api_host: 'https://eu.posthog.com',
|
|
58
401
|
opt_out_capturing_by_default: true
|
|
59
402
|
});
|
|
60
|
-
return React__default["default"].createElement(
|
|
61
|
-
|
|
62
|
-
isInitialized: true,
|
|
63
|
-
optInPostHog: optInPostHog,
|
|
64
|
-
setOptInPostHog: setOptInPostHog
|
|
65
|
-
}
|
|
403
|
+
return React__default["default"].createElement(react.PostHogProvider, {
|
|
404
|
+
client: postHog__default["default"]
|
|
66
405
|
}, children);
|
|
67
406
|
};
|
|
68
407
|
|
|
@@ -71,16 +410,16 @@ var EN_GB = {
|
|
|
71
410
|
logout: 'Sign out',
|
|
72
411
|
appVersion: 'Versjon',
|
|
73
412
|
myProfile: 'My profile',
|
|
74
|
-
cookieSettings: '
|
|
413
|
+
cookieSettings: 'Cookie settings'
|
|
75
414
|
};
|
|
76
415
|
var NO_NB = {
|
|
77
416
|
switchLanguage: 'Switch to English',
|
|
78
417
|
logout: 'Logg ut',
|
|
79
418
|
appVersion: 'Version',
|
|
80
419
|
myProfile: 'Min profil',
|
|
81
|
-
cookieSettings: '
|
|
420
|
+
cookieSettings: 'Cookieinstillinger'
|
|
82
421
|
};
|
|
83
|
-
var
|
|
422
|
+
var messages = {
|
|
84
423
|
nb: NO_NB,
|
|
85
424
|
en: EN_GB,
|
|
86
425
|
'nb-NO': NO_NB,
|
|
@@ -101,22 +440,18 @@ var Menu = function Menu(_ref) {
|
|
|
101
440
|
setOrganisationId = _useOrganisation.setOrganisationId,
|
|
102
441
|
organisationId = _useOrganisation.organisationId;
|
|
103
442
|
var items = getItemsForPath('app-shell');
|
|
104
|
-
var
|
|
105
|
-
isInitialized = _useOptInPostHog.isInitialized,
|
|
106
|
-
setOptInPostHog = _useOptInPostHog.setOptInPostHog;
|
|
443
|
+
var mfPostHog = useMFPostHog();
|
|
107
444
|
return React__default["default"].createElement(common.Menu, null, React__default["default"].createElement("div", {
|
|
108
445
|
style: {
|
|
109
446
|
marginLeft: tokens.space.extraLarge2,
|
|
110
447
|
marginTop: tokens.space.large,
|
|
111
448
|
marginBottom: tokens.space.extraLarge
|
|
112
449
|
}
|
|
113
|
-
}, React__default["default"].createElement("a", {
|
|
114
|
-
href: "/"
|
|
115
450
|
}, React__default["default"].createElement(common.EnturPartnerLogo, {
|
|
116
451
|
altText: 'Entur partner logo',
|
|
117
452
|
className: "menu-space menu-logo",
|
|
118
453
|
environment: environment
|
|
119
|
-
}))
|
|
454
|
+
})), React__default["default"].createElement("div", {
|
|
120
455
|
style: {
|
|
121
456
|
margin: tokens.space.large
|
|
122
457
|
}
|
|
@@ -124,18 +459,34 @@ var Menu = function Menu(_ref) {
|
|
|
124
459
|
space: "small"
|
|
125
460
|
}, React__default["default"].createElement(common.UserMenu, {
|
|
126
461
|
onLanguageChange: setLanguage,
|
|
127
|
-
onLogout:
|
|
462
|
+
onLogout: function () {
|
|
463
|
+
var _onLogout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
464
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
465
|
+
while (1) switch (_context.prev = _context.next) {
|
|
466
|
+
case 0:
|
|
467
|
+
mfPostHog.reset();
|
|
468
|
+
_context.next = 3;
|
|
469
|
+
return logout();
|
|
470
|
+
case 3:
|
|
471
|
+
case "end":
|
|
472
|
+
return _context.stop();
|
|
473
|
+
}
|
|
474
|
+
}, _callee);
|
|
475
|
+
}));
|
|
476
|
+
function onLogout() {
|
|
477
|
+
return _onLogout.apply(this, arguments);
|
|
478
|
+
}
|
|
479
|
+
return onLogout;
|
|
480
|
+
}(),
|
|
128
481
|
language: language,
|
|
129
|
-
messages:
|
|
482
|
+
messages: messages[language],
|
|
130
483
|
userName: user.given_name ? user.given_name + " " + user.family_name : user.name,
|
|
131
484
|
environment: environment,
|
|
132
485
|
showVersionItem: false,
|
|
133
486
|
showMyProfileItem: false,
|
|
134
|
-
showCookieSettingsItem:
|
|
487
|
+
showCookieSettingsItem: true,
|
|
135
488
|
onCookieSettingsOpen: function onCookieSettingsOpen() {
|
|
136
|
-
|
|
137
|
-
return !prev;
|
|
138
|
-
});
|
|
489
|
+
window.UC_UI.showSecondLayer();
|
|
139
490
|
},
|
|
140
491
|
onNavigateToMyProfile: function onNavigateToMyProfile() {}
|
|
141
492
|
}), React__default["default"].createElement(appShell.OrganisationSelector, {
|
|
@@ -167,6 +518,8 @@ var Menu = function Menu(_ref) {
|
|
|
167
518
|
var Content = function Content(_ref) {
|
|
168
519
|
var children = _ref.children,
|
|
169
520
|
values = _ref.values;
|
|
521
|
+
var mfPostHog = useMFPostHog();
|
|
522
|
+
var consents = appShell.useConsentManager();
|
|
170
523
|
var _useMenu = appShell.useMenu(),
|
|
171
524
|
addItems = _useMenu.addItems,
|
|
172
525
|
_setMFNavigate = _useMenu.setMFNavigate;
|
|
@@ -177,6 +530,9 @@ var Content = function Content(_ref) {
|
|
|
177
530
|
return addItems(items, 'app-shell');
|
|
178
531
|
};
|
|
179
532
|
return React__default["default"].createElement(common.Content, null, children(_extends({}, values, {
|
|
533
|
+
user: _extends({}, values.user, {
|
|
534
|
+
consents: consents
|
|
535
|
+
}),
|
|
180
536
|
language: language,
|
|
181
537
|
navigate: function navigate() {
|
|
182
538
|
{
|
|
@@ -188,7 +544,7 @@ var Content = function Content(_ref) {
|
|
|
188
544
|
setMFNavigate: function setMFNavigate(navigate) {
|
|
189
545
|
return _setMFNavigate('app-shell', navigate);
|
|
190
546
|
},
|
|
191
|
-
|
|
547
|
+
mfPostHog: mfPostHog
|
|
192
548
|
})));
|
|
193
549
|
};
|
|
194
550
|
var AppShellStandalone = function AppShellStandalone(_ref2) {
|
|
@@ -211,10 +567,10 @@ var AppShellStandalone = function AppShellStandalone(_ref2) {
|
|
|
211
567
|
}, function (values) {
|
|
212
568
|
var _languageStorage$get, _organisationStorage$;
|
|
213
569
|
return React__default["default"].createElement(appShell.LanguageProvider, {
|
|
214
|
-
language: (_languageStorage$get = appShell.languageStorage.get()) != null ? _languageStorage$get : 'nb
|
|
570
|
+
language: (_languageStorage$get = appShell.languageStorage.get()) != null ? _languageStorage$get : 'nb'
|
|
215
571
|
}, React__default["default"].createElement(appShell.OrganisationProvider, {
|
|
216
572
|
organisationId: (_organisationStorage$ = appShell.organisationStorage.get()) != null ? _organisationStorage$ : values.user['https://entur.io/organisationID'].toString()
|
|
217
|
-
}, React__default["default"].createElement(PostHogProviderWrapper, {
|
|
573
|
+
}, React__default["default"].createElement(appShell.ConsentManagerProvider, null, React__default["default"].createElement(PostHogProviderWrapper, {
|
|
218
574
|
postHogApiKey: postHogApiKey
|
|
219
575
|
}, React__default["default"].createElement(appShell.MenuProvider, null, React__default["default"].createElement(Menu, _extends({}, values, {
|
|
220
576
|
getOrganisations: getOrganisations,
|
|
@@ -222,7 +578,7 @@ var AppShellStandalone = function AppShellStandalone(_ref2) {
|
|
|
222
578
|
})), React__default["default"].createElement(Content, {
|
|
223
579
|
children: children,
|
|
224
580
|
values: values
|
|
225
|
-
})))));
|
|
581
|
+
}))))));
|
|
226
582
|
});
|
|
227
583
|
};
|
|
228
584
|
|