@entur-partner/app-shell-standalone 6.0.5-alpha.1 → 6.0.5-alpha.3
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/Menu.d.ts +2 -2
- package/dist/PostHogProviderWrapper.d.ts +33 -7
- package/dist/{AppShellStandalone.d.ts → app-shell-standalone/src/AppShellStandalone.d.ts} +1 -4
- package/dist/app-shell-standalone.cjs.development.js +413 -51
- 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 +415 -54
- package/dist/app-shell-standalone.esm.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +6 -4
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,13 +1,39 @@
|
|
|
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
|
+
__loaded: boolean;
|
|
13
|
+
config: import("posthog-js").PostHogConfig;
|
|
14
|
+
init: (token: string, config?: Partial<import("posthog-js").PostHogConfig> | undefined, name?: string | undefined) => import("posthog-js").PostHog;
|
|
15
|
+
};
|
|
8
16
|
type Props = {
|
|
17
|
+
/**
|
|
18
|
+
* PostHog API key for initializing the PostHog client.
|
|
19
|
+
* If not provided, PostHog will not be initialized.
|
|
20
|
+
*/
|
|
9
21
|
postHogApiKey?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Flag to indicate if the application is running in a standalone mode or as a micro-frontend.
|
|
24
|
+
*/
|
|
25
|
+
isStandalone: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Optional project identifier for PostHog.
|
|
28
|
+
* This can be used to differentiate between different projects in PostHog.
|
|
29
|
+
*/
|
|
30
|
+
project?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Flag to force disable PostHog tracking.
|
|
33
|
+
* If true, PostHog will not be initialized even if postHogApiKey is provided.
|
|
34
|
+
*/
|
|
35
|
+
forceDisablePostHog?: boolean;
|
|
10
36
|
children: ReactNode;
|
|
11
37
|
};
|
|
12
|
-
export declare const PostHogProviderWrapper: ({ postHogApiKey, children }: Props) => React.JSX.Element;
|
|
38
|
+
export declare const PostHogProviderWrapper: ({ postHogApiKey, isStandalone, project, forceDisablePostHog, children, }: Props) => React.JSX.Element;
|
|
13
39
|
export {};
|
|
@@ -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
|
-
export declare const AppShellStandalone: ({ children, audience, domain, clientId, decorateUser, getOrganisations, redirectUri, environment,
|
|
15
|
+
export declare const AppShellStandalone: ({ children, audience, domain, clientId, decorateUser, getOrganisations, redirectUri, environment, }: AppShellStandaloneProps) => React.JSX.Element;
|
|
@@ -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,57 @@ function _extends() {
|
|
|
29
361
|
return _extends.apply(this, arguments);
|
|
30
362
|
}
|
|
31
363
|
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
364
|
+
var useMFPostHog = function useMFPostHog() {
|
|
365
|
+
var postHog = react.usePostHog();
|
|
366
|
+
return {
|
|
367
|
+
capture: postHog.capture,
|
|
368
|
+
alias: postHog.alias,
|
|
369
|
+
identify: postHog.identify,
|
|
370
|
+
register: postHog.register,
|
|
371
|
+
register_once: postHog.register_once,
|
|
372
|
+
unregister: postHog.unregister,
|
|
373
|
+
group: postHog.group,
|
|
374
|
+
setPersonProperties: postHog.setPersonProperties,
|
|
375
|
+
reset: postHog.reset,
|
|
376
|
+
__loaded: postHog.__loaded,
|
|
377
|
+
config: postHog.config,
|
|
378
|
+
init: postHog.init
|
|
379
|
+
};
|
|
39
380
|
};
|
|
40
381
|
var PostHogProviderWrapper = function PostHogProviderWrapper(_ref) {
|
|
41
382
|
var postHogApiKey = _ref.postHogApiKey,
|
|
383
|
+
isStandalone = _ref.isStandalone,
|
|
384
|
+
project = _ref.project,
|
|
385
|
+
_ref$forceDisablePost = _ref.forceDisablePostHog,
|
|
386
|
+
forceDisablePostHog = _ref$forceDisablePost === void 0 ? false : _ref$forceDisablePost,
|
|
42
387
|
children = _ref.children;
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
388
|
+
var consents = appShell.useConsentManager();
|
|
389
|
+
React.useEffect(function () {
|
|
390
|
+
if (!postHogApiKey || forceDisablePostHog) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
if (consents != null && consents.PostHog.consentGiven) {
|
|
394
|
+
postHog__default["default"].opt_in_capturing();
|
|
395
|
+
} else {
|
|
396
|
+
postHog__default["default"].opt_out_capturing();
|
|
397
|
+
}
|
|
398
|
+
}, [consents == null ? void 0 : consents.PostHog.consentGiven, forceDisablePostHog, postHogApiKey]);
|
|
399
|
+
// If no API key is provided or PostHog is forced to be disabled, do not initialize PostHog
|
|
400
|
+
if (!postHogApiKey || forceDisablePostHog) {
|
|
401
|
+
if (!forceDisablePostHog) {
|
|
402
|
+
console.warn('AppShellStandalone Warning: PostHog API key is not provided. PostHog will not be initialized.');
|
|
403
|
+
} else {
|
|
404
|
+
console.warn('AppShellStandalone Warning: PostHog tracking is disabled by force. PostHog will not be initialized.');
|
|
405
|
+
}
|
|
406
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
55
407
|
}
|
|
56
408
|
postHog__default["default"].init(postHogApiKey, {
|
|
57
|
-
api_host: 'https://eu.posthog.com',
|
|
409
|
+
api_host: isStandalone ? 'https://eu.posthog.com' : '/ingest',
|
|
410
|
+
ui_host: 'https://eu.posthog.com',
|
|
58
411
|
opt_out_capturing_by_default: true
|
|
59
|
-
});
|
|
60
|
-
return React__default["default"].createElement(
|
|
61
|
-
|
|
62
|
-
isInitialized: true,
|
|
63
|
-
optInPostHog: optInPostHog,
|
|
64
|
-
setOptInPostHog: setOptInPostHog
|
|
65
|
-
}
|
|
412
|
+
}, project);
|
|
413
|
+
return React__default["default"].createElement(react.PostHogProvider, {
|
|
414
|
+
client: postHog__default["default"]
|
|
66
415
|
}, children);
|
|
67
416
|
};
|
|
68
417
|
|
|
@@ -71,16 +420,16 @@ var EN_GB = {
|
|
|
71
420
|
logout: 'Sign out',
|
|
72
421
|
appVersion: 'Versjon',
|
|
73
422
|
myProfile: 'My profile',
|
|
74
|
-
cookieSettings: '
|
|
423
|
+
cookieSettings: 'Cookie settings'
|
|
75
424
|
};
|
|
76
425
|
var NO_NB = {
|
|
77
426
|
switchLanguage: 'Switch to English',
|
|
78
427
|
logout: 'Logg ut',
|
|
79
428
|
appVersion: 'Version',
|
|
80
429
|
myProfile: 'Min profil',
|
|
81
|
-
cookieSettings: '
|
|
430
|
+
cookieSettings: 'Cookieinstillinger'
|
|
82
431
|
};
|
|
83
|
-
var
|
|
432
|
+
var messages = {
|
|
84
433
|
nb: NO_NB,
|
|
85
434
|
en: EN_GB,
|
|
86
435
|
'nb-NO': NO_NB,
|
|
@@ -101,22 +450,18 @@ var Menu = function Menu(_ref) {
|
|
|
101
450
|
setOrganisationId = _useOrganisation.setOrganisationId,
|
|
102
451
|
organisationId = _useOrganisation.organisationId;
|
|
103
452
|
var items = getItemsForPath('app-shell');
|
|
104
|
-
var
|
|
105
|
-
isInitialized = _useOptInPostHog.isInitialized,
|
|
106
|
-
setOptInPostHog = _useOptInPostHog.setOptInPostHog;
|
|
453
|
+
var mfPostHog = useMFPostHog();
|
|
107
454
|
return React__default["default"].createElement(common.Menu, null, React__default["default"].createElement("div", {
|
|
108
455
|
style: {
|
|
109
456
|
marginLeft: tokens.space.extraLarge2,
|
|
110
457
|
marginTop: tokens.space.large,
|
|
111
458
|
marginBottom: tokens.space.extraLarge
|
|
112
459
|
}
|
|
113
|
-
}, React__default["default"].createElement("a", {
|
|
114
|
-
href: "/"
|
|
115
460
|
}, React__default["default"].createElement(common.EnturPartnerLogo, {
|
|
116
461
|
altText: 'Entur partner logo',
|
|
117
462
|
className: "menu-space menu-logo",
|
|
118
463
|
environment: environment
|
|
119
|
-
}))
|
|
464
|
+
})), React__default["default"].createElement("div", {
|
|
120
465
|
style: {
|
|
121
466
|
margin: tokens.space.large
|
|
122
467
|
}
|
|
@@ -124,18 +469,34 @@ var Menu = function Menu(_ref) {
|
|
|
124
469
|
space: "small"
|
|
125
470
|
}, React__default["default"].createElement(common.UserMenu, {
|
|
126
471
|
onLanguageChange: setLanguage,
|
|
127
|
-
onLogout:
|
|
472
|
+
onLogout: function () {
|
|
473
|
+
var _onLogout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
474
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
475
|
+
while (1) switch (_context.prev = _context.next) {
|
|
476
|
+
case 0:
|
|
477
|
+
mfPostHog.reset();
|
|
478
|
+
_context.next = 3;
|
|
479
|
+
return logout();
|
|
480
|
+
case 3:
|
|
481
|
+
case "end":
|
|
482
|
+
return _context.stop();
|
|
483
|
+
}
|
|
484
|
+
}, _callee);
|
|
485
|
+
}));
|
|
486
|
+
function onLogout() {
|
|
487
|
+
return _onLogout.apply(this, arguments);
|
|
488
|
+
}
|
|
489
|
+
return onLogout;
|
|
490
|
+
}(),
|
|
128
491
|
language: language,
|
|
129
|
-
messages:
|
|
492
|
+
messages: messages[language],
|
|
130
493
|
userName: user.given_name ? user.given_name + " " + user.family_name : user.name,
|
|
131
494
|
environment: environment,
|
|
132
495
|
showVersionItem: false,
|
|
133
496
|
showMyProfileItem: false,
|
|
134
|
-
showCookieSettingsItem:
|
|
497
|
+
showCookieSettingsItem: true,
|
|
135
498
|
onCookieSettingsOpen: function onCookieSettingsOpen() {
|
|
136
|
-
|
|
137
|
-
return !prev;
|
|
138
|
-
});
|
|
499
|
+
window.UC_UI.showSecondLayer();
|
|
139
500
|
},
|
|
140
501
|
onNavigateToMyProfile: function onNavigateToMyProfile() {}
|
|
141
502
|
}), React__default["default"].createElement(appShell.OrganisationSelector, {
|
|
@@ -167,6 +528,7 @@ var Menu = function Menu(_ref) {
|
|
|
167
528
|
var Content = function Content(_ref) {
|
|
168
529
|
var children = _ref.children,
|
|
169
530
|
values = _ref.values;
|
|
531
|
+
var consents = appShell.useConsentManager();
|
|
170
532
|
var _useMenu = appShell.useMenu(),
|
|
171
533
|
addItems = _useMenu.addItems,
|
|
172
534
|
_setMFNavigate = _useMenu.setMFNavigate;
|
|
@@ -177,6 +539,9 @@ var Content = function Content(_ref) {
|
|
|
177
539
|
return addItems(items, 'app-shell');
|
|
178
540
|
};
|
|
179
541
|
return React__default["default"].createElement(common.Content, null, children(_extends({}, values, {
|
|
542
|
+
user: _extends({}, values.user, {
|
|
543
|
+
consents: consents
|
|
544
|
+
}),
|
|
180
545
|
language: language,
|
|
181
546
|
navigate: function navigate() {
|
|
182
547
|
{
|
|
@@ -187,8 +552,7 @@ var Content = function Content(_ref) {
|
|
|
187
552
|
organisationId: organisationId.toString(),
|
|
188
553
|
setMFNavigate: function setMFNavigate(navigate) {
|
|
189
554
|
return _setMFNavigate('app-shell', navigate);
|
|
190
|
-
}
|
|
191
|
-
postHogClient: postHog__default["default"]
|
|
555
|
+
}
|
|
192
556
|
})));
|
|
193
557
|
};
|
|
194
558
|
var AppShellStandalone = function AppShellStandalone(_ref2) {
|
|
@@ -199,8 +563,7 @@ var AppShellStandalone = function AppShellStandalone(_ref2) {
|
|
|
199
563
|
decorateUser = _ref2.decorateUser,
|
|
200
564
|
getOrganisations = _ref2.getOrganisations,
|
|
201
565
|
redirectUri = _ref2.redirectUri,
|
|
202
|
-
environment = _ref2.environment
|
|
203
|
-
postHogApiKey = _ref2.postHogApiKey;
|
|
566
|
+
environment = _ref2.environment;
|
|
204
567
|
return React__default["default"].createElement(appShell.AppShell, {
|
|
205
568
|
audience: audience,
|
|
206
569
|
domain: domain,
|
|
@@ -211,12 +574,10 @@ var AppShellStandalone = function AppShellStandalone(_ref2) {
|
|
|
211
574
|
}, function (values) {
|
|
212
575
|
var _languageStorage$get, _organisationStorage$;
|
|
213
576
|
return React__default["default"].createElement(appShell.LanguageProvider, {
|
|
214
|
-
language: (_languageStorage$get = appShell.languageStorage.get()) != null ? _languageStorage$get : 'nb
|
|
577
|
+
language: (_languageStorage$get = appShell.languageStorage.get()) != null ? _languageStorage$get : 'nb'
|
|
215
578
|
}, React__default["default"].createElement(appShell.OrganisationProvider, {
|
|
216
579
|
organisationId: (_organisationStorage$ = appShell.organisationStorage.get()) != null ? _organisationStorage$ : values.user['https://entur.io/organisationID'].toString()
|
|
217
|
-
}, React__default["default"].createElement(
|
|
218
|
-
postHogApiKey: postHogApiKey
|
|
219
|
-
}, React__default["default"].createElement(appShell.MenuProvider, null, React__default["default"].createElement(Menu, _extends({}, values, {
|
|
580
|
+
}, React__default["default"].createElement(appShell.ConsentManagerProvider, null, React__default["default"].createElement(appShell.MenuProvider, null, React__default["default"].createElement(Menu, _extends({}, values, {
|
|
220
581
|
getOrganisations: getOrganisations,
|
|
221
582
|
environment: environment
|
|
222
583
|
})), React__default["default"].createElement(Content, {
|
|
@@ -227,4 +588,5 @@ var AppShellStandalone = function AppShellStandalone(_ref2) {
|
|
|
227
588
|
};
|
|
228
589
|
|
|
229
590
|
exports.AppShellStandalone = AppShellStandalone;
|
|
591
|
+
exports.PostHogProviderWrapper = PostHogProviderWrapper;
|
|
230
592
|
//# sourceMappingURL=app-shell-standalone.cjs.development.js.map
|