) {
- const sdkLogs = localStorage.getItem(SDK_LOGS_STORAGE_KEY) || "[]";
- const parsedSDKLogs = JSON.parse(sdkLogs);
-
- getAnalytics().then((stAnalytics: any) => {
- if (stAnalytics === undefined) {
- console.log("mocked event send:", "auth_error_sdk_logs", parsedSDKLogs);
- return;
- }
- stAnalytics.sendEvent(
- 'auth_error_sdk_logs',
- {
- type: 'auth_error_sdk_logs',
- logs: parsedSDKLogs,
- ...customData
- },
- 'v1'
- )
- });
}
\ No newline at end of file
diff --git a/v2/src/theme/DocItem/index.js b/v2/src/theme/DocItem/index.js
index be4703bb2..11e1d9026 100644
--- a/v2/src/theme/DocItem/index.js
+++ b/v2/src/theme/DocItem/index.js
@@ -221,7 +221,7 @@ function DocItem(props) {
{location.pathname.startsWith("/docs/contribute/") ?
<>
- This is a contributors guide and NOT a user guide. Please visit these docs if you are using or evaluating SuperTokens.
+ This is a contributors guide and NOT a user guide. Please visit these docs if you are using or evaluating SuperTokens.
> : null}
diff --git a/v2/src/theme/Layout/index.js b/v2/src/theme/Layout/index.js
index 6cf8e0a68..341bc9e91 100644
--- a/v2/src/theme/Layout/index.js
+++ b/v2/src/theme/Layout/index.js
@@ -18,11 +18,12 @@ import Head from '@docusaurus/Head';
import { useLocation } from '@docusaurus/router';
import './styles.css';
import supertokens from "supertokens-website";
-import {overrideConsoleImplementation,saveSDKLogsConsoleOverride, sendSDKLogsToBackend} from '../../components/utils'
-import {checkForDesyncedSession, cookieExists, historyPushStateOverride} from '../../components/httpNetworking'
+import {
+ getSdkLogConfigs,
+ preSDKLogsOverrides,
+} from '../../components/sdklogsutils';
import styles from "./styles.module.css";
-
if (typeof window !== 'undefined') {
let API_DOMAIN
let API_BASE_PATH
@@ -33,31 +34,11 @@ if (typeof window !== 'undefined') {
API_DOMAIN = "https://dev.api.supertokens.com"
API_BASE_PATH = "/0/auth"
}
- overrideConsoleImplementation(saveSDKLogsConsoleOverride);
let sessionExpiredStatusCode = 401;
+ preSDKLogsOverrides();
supertokens.init({
apiDomain: API_DOMAIN,
apiBasePath: API_BASE_PATH,
- enableDebugLogs: true,
- cookieHandler: (original) => {
- return {
- ...original,
- setCookie: (cookieString) => {
- const cookieName = cookieString.split(";")[0].split("=")[0];
- if (cookieName === "sFrontToken") {
- let cookieValue = cookieString.split(";")[0].split("=")[1].trim();
- if (cookieValue === "" && cookieExists("sFrontToken")) {
- const stack = new Error().stack;
- sendSDKLogsToBackend({
- stack,
- title: "front_token_cookie_removed",
- });
- }
- }
- return original.setCookie(cookieString);
- },
- };
- },
sessionExpiredStatusCode,
preAPIHook: async (context) => {
return {
@@ -66,14 +47,13 @@ if (typeof window !== 'undefined') {
...context.requestInit,
headers: {
...context.requestInit.headers,
- "api-version": "0"
- }
- }
- }
- }
+ 'api-version': '0',
+ },
+ },
+ };
+ },
+ ...getSdkLogConfigs(),
});
- checkForDesyncedSession();
- historyPushStateOverride(checkForDesyncedSession);
}
function OriginalLayout(props) {
diff --git a/v2/src/theme/NavbarItem/recipeSelector.js b/v2/src/theme/NavbarItem/recipeSelector.js
index 6d5839605..b6bd1c262 100644
--- a/v2/src/theme/NavbarItem/recipeSelector.js
+++ b/v2/src/theme/NavbarItem/recipeSelector.js
@@ -44,7 +44,7 @@ export default function RecipeSelector(props) {
};
useEffect(() => {
const closeDropDown = (e) => {
- if (e.target.classList[0].startsWith("recipe_selector")) {
+ if (e.target.classList[0]?.startsWith("recipe_selector")) {
// no-op
} else {
setOpen(false);