zudoku 0.3.0-dev.50 → 0.3.0-dev.52

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.
@@ -9,7 +9,7 @@ const clerkAuth: AuthenticationProviderInitializer<
9
9
  let clerkApi: Clerk;
10
10
 
11
11
  const ensureLoaded = (async () => {
12
- if (import.meta.env.SSR) return;
12
+ if (typeof window === "undefined") return;
13
13
  const { Clerk } = await import("@clerk/clerk-js");
14
14
  clerkApi = new Clerk(clerkPubKey);
15
15
 
@@ -43,8 +43,8 @@ const DevPortalInner = ({
43
43
  );
44
44
 
45
45
  const mdxComponents = useMemo(
46
- () => ({ ...MdxComponents, ...props.mdxComponents }),
47
- [props.mdxComponents],
46
+ () => ({ ...MdxComponents, ...props.mdx?.components }),
47
+ [props.mdx?.components],
48
48
  );
49
49
 
50
50
  const devPortalContext = useMemo(() => new DevPortalContext(props), [props]);
@@ -1,6 +1,5 @@
1
1
  import { QueryClient } from "@tanstack/react-query";
2
2
  import { type ReactNode } from "react";
3
- import { create } from "zustand";
4
3
  import { type AuthenticationProvider } from "../authentication/authentication.js";
5
4
  import type { ComponentsContextType } from "../components/context/ComponentsContext.js";
6
5
  import { type DevPortalPath } from "../components/DevPortal.js";
@@ -54,14 +53,8 @@ export type NavigationItem = {
54
53
  categories?: NavigationCategory[];
55
54
  };
56
55
 
57
- export type RoutingState = {
58
- path?: string;
59
- };
60
-
61
56
  export const queryClient = new QueryClient();
62
57
 
63
- export const useRoutingState = create<RoutingState>(() => ({}));
64
-
65
58
  export type ApiKeyCache = "api-keys";
66
59
  export type DevPortalCacheKey = ApiKeyCache | string;
67
60
 
@@ -88,7 +81,9 @@ export type ZudokuContextOptions = {
88
81
  authentication?: AuthenticationProvider;
89
82
  navigation: NavigationItem[];
90
83
  plugins?: DevPortalPlugin[];
91
- mdxComponents?: MdxComponentsType;
84
+ mdx?: {
85
+ components?: MdxComponentsType;
86
+ };
92
87
  overrides?: ComponentsContextType;
93
88
  };
94
89
 
@@ -98,8 +93,6 @@ export class DevPortalContext {
98
93
  public meta: ZudokuContextOptions["metadata"];
99
94
  public page: ZudokuContextOptions["page"];
100
95
  public authentication?: ZudokuContextOptions["authentication"];
101
-
102
- public state: typeof useRoutingState;
103
96
  private navigationPlugins: NavigationPlugin[];
104
97
 
105
98
  constructor(config: ZudokuContextOptions) {
@@ -109,7 +102,6 @@ export class DevPortalContext {
109
102
  this.authentication = config.authentication;
110
103
  this.meta = config.metadata;
111
104
  this.page = config.page;
112
- this.state = useRoutingState;
113
105
  }
114
106
 
115
107
  initialize = async () => {
@@ -144,7 +136,7 @@ export class DevPortalContext {
144
136
  return navigations.flatMap((nav) => nav ?? []);
145
137
  };
146
138
 
147
- async signRequest(request: Request) {
139
+ signRequest = async (request: Request) => {
148
140
  if (!this.authentication) {
149
141
  throw new Error("No authentication provider configured");
150
142
  }
@@ -154,5 +146,5 @@ export class DevPortalContext {
154
146
  request.headers.set("Authorization", `Bearer ${accessToken}`);
155
147
 
156
148
  return request;
157
- }
149
+ };
158
150
  }