Skip to content

Commit

Permalink
rewrite logout warning as a web component (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
andnorda authored Jul 10, 2024
1 parent da9c1d4 commit feb3e31
Show file tree
Hide file tree
Showing 15 changed files with 315 additions and 352 deletions.
Binary file modified bun.lockb
Binary file not shown.
3 changes: 1 addition & 2 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"rollup-plugin-minify-html-literals-v3": "1.3.3",
"vite-bundle-visualizer": "1.2.1",
"vite-tsconfig-paths": "4.2.0",
"vitest": "1.6.0",
"msw": "2.3.0"
"vitest": "1.6.0"
}
}
231 changes: 0 additions & 231 deletions packages/client/src/logout-warning.ts

This file was deleted.

38 changes: 6 additions & 32 deletions packages/client/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import { initHistoryEvents } from "./events";
import { addFaroMetaData } from "./faro";
import { buildHtmlElement } from "./helpers/html-element-builder";
import { cdnUrl } from "./helpers/urls";
import { initLogoutWarning } from "./logout-warning";
import "./main.css";
import { env, param, updateDecoratorParams } from "./params";
import { param, updateDecoratorParams } from "./params";
import { useLoadIfActiveSession } from "./screensharing";

import.meta.glob("./styles/*.css", { eager: true });
Expand Down Expand Up @@ -44,35 +43,10 @@ const init = () => {
initAuth().then((auth) => {
initAnalytics(auth);
});

if (param("logoutWarning")) {
initLogoutWarning();
}
};

const enableMocking = async () => {
if (process.env.NODE_ENV !== "development") {
return;
}

if (window.location.origin !== env("APP_URL")) {
console.log(
"Skipping mock worker as current origin is not decorator origin",
);
return;
}

const { worker } = await import("./mocks");

return worker.start({
onUnhandledRequest: "bypass",
});
};

enableMocking().then(() => {
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", init);
} else {
init();
}
});
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", init);
} else {
init();
}
51 changes: 0 additions & 51 deletions packages/client/src/mocks.ts

This file was deleted.

Loading

0 comments on commit feb3e31

Please sign in to comment.