Skip to content

Commit

Permalink
Extension: fix typing errors following introduction of ExtensionWorks…
Browse files Browse the repository at this point in the history
…paceType
  • Loading branch information
PopDaph committed Jan 3, 2025
1 parent 2a07d1d commit af3c750
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 16 deletions.
4 changes: 2 additions & 2 deletions extension/app/src/components/auth/AuthProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LightWorkspaceType } from "@dust-tt/client";
import type { ExtensionWorkspaceType } from "@dust-tt/client";
import { useAuthHook } from "@extension/components/auth/useAuth";
import type { AuthError } from "@extension/lib/auth";
import type { StoredUser } from "@extension/lib/storage";
Expand All @@ -11,7 +11,7 @@ type AuthContextType = {
authError: AuthError | null;
setAuthError: (error: AuthError | null) => void;
user: StoredUser | null;
workspace: LightWorkspaceType | undefined;
workspace: ExtensionWorkspaceType | undefined;
isUserSetup: boolean;
isLoading: boolean;
handleLogin: (isForceLogin: boolean) => void;
Expand Down
4 changes: 2 additions & 2 deletions extension/app/src/components/auth/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LightWorkspaceType } from "@dust-tt/client";
import type { ExtensionWorkspaceType } from "@dust-tt/client";
import {
Button,
LogoHorizontalColorLogo,
Expand All @@ -19,7 +19,7 @@ type ProtectedRouteProps = {

export type ProtectedRouteChildrenProps = {
user: StoredUser;
workspace: LightWorkspaceType;
workspace: ExtensionWorkspaceType;
handleLogout: () => void;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
AgentMentionType,
ContentFragmentType,
LightWorkspaceType,
ExtensionWorkspaceType,
} from "@dust-tt/client";
import { Page, useSendNotification } from "@dust-tt/sparkle";
import { ConversationViewer } from "@extension/components/conversation/ConversationViewer";
Expand Down Expand Up @@ -35,7 +35,7 @@ import { useNavigate } from "react-router-dom";

interface ConversationContainerProps {
conversationId: string | null;
owner: LightWorkspaceType;
owner: ExtensionWorkspaceType;
user: StoredUser;
}

Expand Down
4 changes: 2 additions & 2 deletions extension/app/src/components/input_bar/InputBar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {
AgentMentionType,
ConversationPublicType,
ExtensionWorkspaceType,
LightAgentConfigurationType,
LightWorkspaceType,
} from "@dust-tt/client";
import { Button, Page, Spinner, StopIcon } from "@dust-tt/sparkle";
import { usePublicAgentConfigurations } from "@extension/components/assistants/usePublicAgentConfigurations";
Expand Down Expand Up @@ -37,7 +37,7 @@ export function AssistantInputBar({
setIncludeTab,
isSubmitting,
}: {
owner: LightWorkspaceType;
owner: ExtensionWorkspaceType;
onSubmit: (
input: string,
mentions: AgentMentionType[],
Expand Down
4 changes: 2 additions & 2 deletions extension/app/src/components/input_bar/InputBarContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
AgentMentionType,
ExtensionWorkspaceType,
LightAgentConfigurationType,
LightWorkspaceType,
} from "@dust-tt/client";
import { SplitButton } from "@dust-tt/sparkle";
import { AssistantPicker } from "@extension/components/assistants/AssistantPicker";
Expand All @@ -21,7 +21,7 @@ export interface InputBarContainerProps {
allAssistants: LightAgentConfigurationType[];
agentConfigurations: LightAgentConfigurationType[];
onEnterKeyDown: CustomEditorProps["onEnterKeyDown"];
owner: LightWorkspaceType;
owner: ExtensionWorkspaceType;
selectedAssistant: AgentMentionType | null;
stickyMentions?: AgentMentionType[];
disableAutoFocus: boolean;
Expand Down
4 changes: 2 additions & 2 deletions extension/app/src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import type {
StoredTokens,
StoredUser,
UserTypeWithWorkspaces,
UserTypeWithExtensionWorkspaces,
} from "@extension/lib/storage";
import {
clearStoredData,
Expand Down Expand Up @@ -115,7 +115,7 @@ export const getAccessToken = async (): Promise<string | null> => {
// Fetch me sends a request to the /me route to get the user info.
const fetchMe = async (
token: string
): Promise<Result<{ user: UserTypeWithWorkspaces }, AuthError>> => {
): Promise<Result<{ user: UserTypeWithExtensionWorkspaces }, AuthError>> => {
const response = await fetch(`${process.env.DUST_DOMAIN}/api/v1/me`, {
headers: {
Authorization: `Bearer ${token}`,
Expand Down
14 changes: 10 additions & 4 deletions extension/app/src/lib/storage.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import type { ContentFragmentType, MeResponseType } from "@dust-tt/client";
import type {
ContentFragmentType,
ExtensionWorkspaceType,
UserType,
} from "@dust-tt/client";
import type { Auth0AuthorizeResponse } from "@extension/lib/messages";
import type { UploadedFileWithKind } from "@extension/lib/types";

export type UserTypeWithWorkspaces = MeResponseType["user"];
export type UserTypeWithExtensionWorkspaces = UserType & {
workspaces: ExtensionWorkspaceType[];
};

export type StoredTokens = {
accessToken: string;
refreshToken: string;
expiresAt: number;
};

export type StoredUser = UserTypeWithWorkspaces & {
export type StoredUser = UserTypeWithExtensionWorkspaces & {
selectedWorkspace: string | null;
};

Expand Down Expand Up @@ -75,7 +81,7 @@ export const setConversationsContext = async (
*/

export const saveUser = async (
user: UserTypeWithWorkspaces
user: UserTypeWithExtensionWorkspaces
): Promise<StoredUser> => {
const storedUser: StoredUser = {
...user,
Expand Down

0 comments on commit af3c750

Please sign in to comment.