Skip to content
This repository was archived by the owner on Aug 15, 2023. It is now read-only.

Commit dc4937b

Browse files
committed
fix(shared): added metadata logger box to extension
1 parent 217f638 commit dc4937b

File tree

30 files changed

+1069
-213
lines changed

30 files changed

+1069
-213
lines changed

Diff for: packages/shared/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"react": "^17.0.2",
3131
"react-dom": "^17.0.2",
3232
"react-i18next": "^11.18.0",
33+
"react-json-view": "^1.21.3",
3334
"ts-endpoint": "^2.0.0",
3435
"ts-endpoint-express": "^2.0.0",
3536
"ts-io-error": "^2.0.0",

Diff for: packages/shared/src/extension/app.ts

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import _ from 'lodash';
2+
import { ParserFn } from '../providers/parser.provider';
23
import { HandshakeResponse } from '../models/HandshakeBody';
34
import { clearCache } from '../providers/dataDonation.provider';
45
import { FIXED_USER_NAME, initializeKey } from './background/account';
@@ -16,6 +17,7 @@ import log from './logger';
1617
import HubEvent from './models/HubEvent';
1718
import { ServerLookup } from './models/Message';
1819
import UserSettings from './models/UserSettings';
20+
import { renderUI, RenderUIProps } from './ui';
1921
import { bo } from './utils/browser.utils';
2022

2123
// instantiate a proper logger
@@ -67,7 +69,12 @@ interface SetupObserverOpts {
6769
onLocationChange: (oldLocation: string, newLocation: string) => void;
6870
}
6971

70-
export interface BootOpts {
72+
export interface BootOpts<
73+
S = any,
74+
M = any,
75+
C = any,
76+
PP extends Record<string, ParserFn<S, any, C>> = any
77+
> {
7178
payload: ServerLookup['payload'];
7279
mapLocalConfig: (
7380
c: UserSettings,
@@ -79,6 +86,7 @@ export interface BootOpts {
7986
onRegister: (h: Hub<HubEvent>, config: UserSettings) => void;
8087
};
8188
onAuthenticated: (res: any) => void;
89+
ui?: Omit<RenderUIProps<S, M, C, PP>, 'hub'>;
8290
}
8391

8492
/**
@@ -227,7 +235,12 @@ const serverHandshakeP = (
227235

228236
let loading = false;
229237
let app: App | undefined;
230-
export async function boot(opts: BootOpts): Promise<App> {
238+
export async function boot<
239+
S = any,
240+
M = any,
241+
C = any,
242+
PP extends Record<string, ParserFn<S, any, C>> = any
243+
>(opts: BootOpts<S, M, C, PP>): Promise<App> {
231244
if (app) {
232245
appLog.debug('App already booted!');
233246
return app;
@@ -316,12 +329,12 @@ export async function boot(opts: BootOpts): Promise<App> {
316329
// register platform specific event handlers
317330
opts.hub.onRegister(opts.hub.hub, config);
318331

319-
// emergency button should be used when a supported with
320-
// UX hack in place didn't see any UX change, so they
321-
// can report the problem and we can handle it.
322-
// initializeEmergencyButton();
332+
// render shared ui if configuration is given
333+
if (opts.ui) {
334+
renderUI({ hub: opts.hub.hub, ...opts.ui });
335+
}
323336

324-
// because the URL has been for sure reloaded, be sure to also
337+
// because the URL has been for sure reloaded, be sure to also clear cache
325338
clearCache();
326339

327340
// send the configuration to the server to register the extension

Diff for: packages/shared/src/extension/tooltip/index.tsx

-23
This file was deleted.

0 commit comments

Comments
 (0)