Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat: add itar notifiactions

Brad Barbin54c95011799a
diff --git a/apps/academy/app/utils/path.ts b/apps/academy/app/utils/path.ts
index 72d950621e..c55e35e6d2 100644
--- a/apps/academy/app/utils/path.ts
+++ b/apps/academy/app/utils/path.ts
@@ -5,7 +5,7 @@ const challenge = "/challenge"; // from ~/routes/challenge+ folder
const course = "/course"; // from ~/routes/course+ folder
const lesson = "/lesson"; // from ~/routes/lesson+ folder
-const ERP_URL = SUPABASE_URL.includes("localhost")
+const ERP_URL = SUPABASE_URL?.includes("localhost")
? "http://localhost:3000"
: "https://app.carbon.ms";
diff --git a/apps/erp/app/components/AvatarMenu.tsx b/apps/erp/app/components/AvatarMenu.tsx
index da9dcbe097..a7e73b03de 100644
--- a/apps/erp/app/components/AvatarMenu.tsx
+++ b/apps/erp/app/components/AvatarMenu.tsx
@@ -1,3 +1,4 @@
+import { ITAR_ENVIRONMENT } from "@carbon/auth";
import {
DropdownMenu,
DropdownMenuContent,
@@ -12,8 +13,9 @@ import {
DropdownMenuSubTrigger,
DropdownMenuTrigger,
Switch,
+ useDisclosure,
} from "@carbon/react";
-import { useEdition, useMode } from "@carbon/remix";
+import { ItarDisclosure, useEdition, useMode } from "@carbon/remix";
import { Edition, themes } from "@carbon/utils";
import { Form, Link, useFetcher } from "@remix-run/react";
import { useRef, useState } from "react";
@@ -67,138 +69,153 @@ const AvatarMenu = () => {
const optimisticTheme =
(fetcher?.formData?.get("theme") as string | null) ?? theme;
+ const itarDisclosure = useDisclosure();
+
return (
- <DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
- <DropdownMenuTrigger className="outline-none focus-visible:outline-none">
- <Avatar path={user.avatarUrl} name={name} />
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-56">
- <DropdownMenuLabel>Signed in as {name}</DropdownMenuLabel>
- <DropdownMenuSeparator />
- <DropdownMenuItem asChild>
- <Link to={path.to.authenticatedRoot}>
- <DropdownMenuIcon icon={<LuHouse />} />
- Dashboard
- </Link>
- </DropdownMenuItem>
- <DropdownMenuSeparator />
-
- <DropdownMenuItem asChild>
- <Link to={path.to.apiIntroduction}>
- <DropdownMenuIcon icon={<LuFileText />} />
- API Documentation
- </Link>
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem onSelect={(e) => e.preventDefault()}>
- <div className="flex items-center justify-between w-full">
- <div className="flex items-center justify-start">
- <DropdownMenuIcon
- icon={mode === "dark" ? <LuMoon /> : <LuSun />}
- />
- Dark Mode
+ <>
+ <DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
+ <DropdownMenuTrigger className="outline-none focus-visible:outline-none">
+ <Avatar path={user.avatarUrl} name={name} />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-56">
+ <DropdownMenuLabel>Signed in as {name}</DropdownMenuLabel>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem asChild>
+ <Link to={path.to.authenticatedRoot}>
+ <DropdownMenuIcon icon={<LuHouse />} />
+ Dashboard
+ </Link>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+
+ <DropdownMenuItem asChild>
+ <Link to={path.to.apiIntroduction}>
+ <DropdownMenuIcon icon={<LuFileText />} />
+ API Documentation
+ </Link>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem onSelect={(e) => e.preventDefault()}>
+ <div className="flex items-center justify-between w-full">
+ <div className="flex items-center justify-start">
+ <DropdownMenuIcon
+ icon={mode === "dark" ? <LuMoon /> : <LuSun />}
+ />
+ Dark Mode
+ </div>
+ <div>
+ <Switch
+ checked={mode === "dark"}
+ onCheckedChange={() => modeSubmitRef.current?.click()}
+ />
+ <fetcher.Form
+ action={path.to.root}
+ method="post"
+ onSubmit={() => {
+ document.body.removeAttribute("style");
+ }}
+ className="sr-only"
+ >
+ <input type="hidden" name="mode" value={nextMode} />
+ <button
+ ref={modeSubmitRef}
+ className="sr-only"
+ type="submit"
+ />
+ </fetcher.Form>
+ </div>
</div>
- <div>
- <Switch
- checked={mode === "dark"}
- onCheckedChange={() => modeSubmitRef.current?.click()}
- />
- <fetcher.Form
- action={path.to.root}
- method="post"
- onSubmit={() => {
- document.body.removeAttribute("style");
- }}
- className="sr-only"
+ </DropdownMenuItem>
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger>
+ <DropdownMenuIcon icon={<LuPalette />} />
+ Theme Color
+ </DropdownMenuSubTrigger>
+ <DropdownMenuSubContent>
+ <DropdownMenuRadioGroup
+ value={optimisticTheme}
+ onValueChange={onThemeChange}
>
- <input type="hidden" name="mode" value={nextMode} />
- <button ref={modeSubmitRef} className="sr-only" type="submit" />
- </fetcher.Form>
- </div>
- </div>
- </DropdownMenuItem>
- <DropdownMenuSub>
- <DropdownMenuSubTrigger>
- <DropdownMenuIcon icon={<LuPalette />} />
- Theme Color
- </DropdownMenuSubTrigger>
- <DropdownMenuSubContent>
- <DropdownMenuRadioGroup
- value={optimisticTheme}
- onValueChange={onThemeChange}
- >
- {themes.map((t) => (
- <DropdownMenuRadioItem
- key={t.name}
- value={t.name}
- onSelect={(e) => e.preventDefault()}
- style={
- {
- "--theme-primary": `hsl(${
- t?.activeColor[mode === "dark" ? "dark" : "light"]
- })`,
- } as React.CSSProperties
- }
- >
- <div className="flex items-center">
- <div className="w-4 h-4 rounded-full mr-2 bg-[--theme-primary]" />
- {t.label}
- </div>
- </DropdownMenuRadioItem>
- ))}
- </DropdownMenuRadioGroup>
- </DropdownMenuSubContent>
- </DropdownMenuSub>
-
- <DropdownMenuSeparator />
- <DropdownMenuItem asChild>
- <Link to={path.to.profile}>
- <DropdownMenuIcon icon={<LuUser />} />
- Account Settings
- </Link>
- </DropdownMenuItem>
-
- {edition === Edition.Cloud && isOwner() && (
+ {themes.map((t) => (
+ <DropdownMenuRadioItem
+ key={t.name}
+ value={t.name}
+ onSelect={(e) => e.preventDefault()}
+ style={
+ {
+ "--theme-primary": `hsl(${
+ t?.activeColor[mode === "dark" ? "dark" : "light"]
+ })`,
+ } as React.CSSProperties
+ }
+ >
+ <div className="flex items-center">
+ <div className="w-4 h-4 rounded-full mr-2 bg-[--theme-primary]" />
+ {t.label}
+ </div>
+ </DropdownMenuRadioItem>
+ ))}
+ </DropdownMenuRadioGroup>
+ </DropdownMenuSubContent>
+ </DropdownMenuSub>
+
+ <DropdownMenuSeparator />
<DropdownMenuItem asChild>
- <Link to={path.to.billing}>
- <DropdownMenuIcon icon={<LuCreditCard />} />
- <span>Manage Subscription</span>
+ <Link to={path.to.profile}>
+ <DropdownMenuIcon icon={<LuUser />} />
+ Account Settings
</Link>
</DropdownMenuItem>
- )}
-
- <DropdownMenuSub>
- <DropdownMenuSubTrigger>
- <DropdownMenuIcon icon={<LuFileText />} />
- Terms and Privacy
- </DropdownMenuSubTrigger>
- <DropdownMenuSubContent>
+
+ {edition === Edition.Cloud && isOwner() && (
<DropdownMenuItem asChild>
- <a href={path.to.legal.termsAndConditions}>
- <DropdownMenuIcon icon={<LuFileText />} />
- Terms of Service
- </a>
+ <Link to={path.to.billing}>
+ <DropdownMenuIcon icon={<LuCreditCard />} />
+ <span>Manage Subscription</span>
+ </Link>
</DropdownMenuItem>
- <DropdownMenuItem asChild>
- <a href={path.to.legal.privacyPolicy}>
- <DropdownMenuIcon icon={<LuShieldCheck />} />
- Privacy Policy
- </a>
+ )}
+
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger>
+ <DropdownMenuIcon icon={<LuFileText />} />
+ Terms and Privacy
+ </DropdownMenuSubTrigger>
+ <DropdownMenuSubContent>
+ <DropdownMenuItem asChild>
+ <a href={path.to.legal.termsAndConditions}>
+ <DropdownMenuIcon icon={<LuFileText />} />
+ Terms of Service
+ </a>
+ </DropdownMenuItem>
+ <DropdownMenuItem asChild>
+ <a href={path.to.legal.privacyPolicy}>
+ <DropdownMenuIcon icon={<LuShieldCheck />} />
+ Privacy Policy
+ </a>
+ </DropdownMenuItem>
+ </DropdownMenuSubContent>
+ </DropdownMenuSub>
+
+ <DropdownMenuSeparator />
+ {ITAR_ENVIRONMENT && (
+ <DropdownMenuItem onClick={itarDisclosure.onOpen}>
+ <DropdownMenuIcon icon={<LuShieldCheck />} />
+ About
</DropdownMenuItem>
- </DropdownMenuSubContent>
- </DropdownMenuSub>
-
- <DropdownMenuSeparator />
- <DropdownMenuItem asChild>
- <Form method="post" action={path.to.logout}>
- <button type="submit" className="w-full h-full flex items-center">
- <DropdownMenuIcon icon={<LuLogOut />} />
- <span>Sign Out</span>
- </button>
- </Form>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ )}
+ <DropdownMenuItem asChild>
+ <Form method="post" action={path.to.logout}>
+ <button type="submit" className="w-full h-full flex items-center">
+ <DropdownMenuIcon icon={<LuLogOut />} />
+ <span>Sign Out</span>
+ </button>
+ </Form>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ {ITAR_ENVIRONMENT && <ItarDisclosure disclosure={itarDisclosure} />}
+ </>
);
};
diff --git a/apps/erp/app/root.tsx b/apps/erp/app/root.tsx
index b8b8a125ec..c4435d6b7b 100644
--- a/apps/erp/app/root.tsx
+++ b/apps/erp/app/root.tsx
@@ -53,6 +53,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
const {
CARBON_EDITION,
CLOUDFLARE_TURNSTILE_SITE_KEY,
+ ITAR_ENVIRONMENT,
POSTHOG_API_HOST,
POSTHOG_PROJECT_PUBLIC_KEY,
SUPABASE_URL,
@@ -67,6 +68,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
env: {
CARBON_EDITION,
CLOUDFLARE_TURNSTILE_SITE_KEY,
+ ITAR_ENVIRONMENT,
POSTHOG_API_HOST,
POSTHOG_PROJECT_PUBLIC_KEY,
SUPABASE_URL,
diff --git a/apps/erp/app/routes/_public+/login.tsx b/apps/erp/app/routes/_public+/login.tsx
index f3cd361ce2..495945d4ee 100644
--- a/apps/erp/app/routes/_public+/login.tsx
+++ b/apps/erp/app/routes/_public+/login.tsx
@@ -5,6 +5,7 @@ import {
CLOUDFLARE_TURNSTILE_SECRET_KEY,
CLOUDFLARE_TURNSTILE_SITE_KEY,
error,
+ ITAR_ENVIRONMENT,
magicLinkValidator,
} from "@carbon/auth";
import { sendMagicLink, verifyAuthSession } from "@carbon/auth/auth.server";
@@ -23,7 +24,7 @@ import {
toast,
VStack,
} from "@carbon/react";
-import { useMode } from "@carbon/remix";
+import { ItarLoginDisclaimer, useMode } from "@carbon/remix";
import { Edition } from "@carbon/utils";
import { Turnstile } from "@marsidev/react-turnstile";
import { useFetcher, useSearchParams } from "@remix-run/react";
@@ -288,35 +289,33 @@ export default function LoginRoute() {
)}
</div>
- {mode !== "verify" && fetcher.data?.success !== true && (
- <div className="text-center mt-4">
- <p className="text-sm text-muted-foreground">
- Login or create a new account
+ <div className="flex flex-col gap-4 text-sm text-center text-balance text-muted-foreground w-[380px]">
+ {mode !== "verify" && fetcher.data?.success !== true && (
+ <p>Login or create a new account</p>
+ )}
+ {ITAR_ENVIRONMENT && <ItarLoginDisclaimer />}
+ {CarbonEdition === Edition.Cloud && (
+ <p>
+ By signing in, you agree to the{" "}
+ <a
+ href="https://carbon.ms/terms"
+ target="_blank"
+ rel="noreferrer"
+ className="underline"
+ >
+ Terms of Service
+ </a>{" "}
+ and{" "}
+ <a
+ href="https://carbon.ms/privacy"
+ target="_blank"
+ rel="noreferrer"
+ className="underline"
+ >
+ Privacy Policy.
+ </a>
</p>
- </div>
- )}
-
- <div className="text-sm text-center text-balance text-muted-foreground w-[380px] mt-4">
- <p>
- By signing in, you agree to the{" "}
- <a
- href="https://carbon.ms/terms"
- target="_blank"
- rel="noreferrer"
- className="underline"
- >
- Terms of Service
- </a>{" "}
- and{" "}
- <a
- href="https://carbon.ms/privacy"
- target="_blank"
- rel="noreferrer"
- className="underline"
- >
- Privacy Policy.
- </a>
- </p>
+ )}
</div>
</>
);
diff --git a/apps/erp/app/routes/x+/_layout.tsx b/apps/erp/app/routes/x+/_layout.tsx
index 4cfce0e1de..03a3776613 100644
--- a/apps/erp/app/routes/x+/_layout.tsx
+++ b/apps/erp/app/routes/x+/_layout.tsx
@@ -1,18 +1,28 @@
-import { CarbonEdition, CarbonProvider, getCarbon } from "@carbon/auth";
+import {
+ CarbonEdition,
+ CarbonProvider,
+ getCarbon,
+ ITAR_ENVIRONMENT,
+} from "@carbon/auth";
import {
destroyAuthSession,
requireAuthSession,
} from "@carbon/auth/session.server";
-import { Button, IconButton, TooltipProvider, useMount } from "@carbon/react";
+import { TooltipProvider, useMount } from "@carbon/react";
+import {
+ AcademyBanner,
+ ItarPopup,
+ useKeyboardWedgeNavigation,
+ useNProgress,
+} from "@carbon/remix";
import { getStripeCustomerByCompanyId } from "@carbon/stripe/stripe.server";
import { Edition } from "@carbon/utils";
import type { ShouldRevalidateFunction } from "@remix-run/react";
-import { Outlet, useFetcher, useLoaderData } from "@remix-run/react";
+import { Outlet, useLoaderData } from "@remix-run/react";
import type { LoaderFunctionArgs } from "@vercel/remix";
import { json, redirect } from "@vercel/remix";
import posthog from "posthog-js";
-import { LuArrowUpRight, LuX } from "react-icons/lu";
import { RealtimeDataProvider } from "~/components";
import { PrimaryNavigation, Topbar } from "~/components/Layout";
import {
@@ -29,7 +39,6 @@ import {
} from "~/modules/users/users.server";
import { path } from "~/utils/path";
-import { useKeyboardWedgeNavigation, useNProgress } from "@carbon/remix";
import { getSavedViews } from "~/modules/shared/shared.service";
export const config = {
@@ -143,59 +152,32 @@ export default function AuthenticatedRoute() {
return (
<div className="h-[100dvh] flex flex-col">
- <CarbonProvider session={session}>
- <RealtimeDataProvider>
- <TooltipProvider>
- <div className="flex flex-col h-screen">
- {user?.acknowledgedUniversity ? null : <AcademyBanner />}
- <Topbar />
- <div className="flex flex-1 h-[calc(100vh-49px)] relative">
- <PrimaryNavigation />
- <main className="flex-1 overflow-y-auto scrollbar-hide border-l border-t bg-muted sm:rounded-tl-2xl relative z-10">
- <Outlet />
- </main>
- </div>
- </div>
- </TooltipProvider>
- </RealtimeDataProvider>
- </CarbonProvider>
- </div>
- );
-}
-
-function AcademyBanner() {
- const fetcher = useFetcher<{}>();
-
- return (
- <div className="fixed bottom-3 left-1/2 -translate-x-1/2 flex items-center justify-between gap-10 bg-[#212278] dark:bg-[#2f31ae] text-white py-1 px-2 rounded-lg z-50 shadow-md">
- <div />
- <fetcher.Form method="post" action={path.to.acknowledge}>
- <input type="hidden" name="intent" value="academy" />
- <input
- type="hidden"
- name="redirectTo"
- value="https://learn.carbon.ms"
+ {user?.acknowledgedITAR === false && ITAR_ENVIRONMENT ? (
+ <ItarPopup
+ acknowledgeAction={path.to.acknowledge}
+ logoutAction={path.to.logout}
/>
- <Button
- type="submit"
- variant="ghost"
- size="lg"
- className="hover:bg-transparent text-white hover:text-white"
- rightIcon={<LuArrowUpRight />}
- >
- <span>Introducing Carbon Academy</span>
- </Button>
- </fetcher.Form>
- <fetcher.Form method="post" action={path.to.acknowledge}>
- <input type="hidden" name="intent" value="academy" />
- <IconButton
- type="submit"
- aria-label="Close"
- variant="ghost"
- className="text-white dark:text-white hover:text-white"
- icon={<LuX />}
- />
- </fetcher.Form>
+ ) : (
+ <CarbonProvider session={session}>
+ <RealtimeDataProvider>
+ <TooltipProvider>
+ <div className="flex flex-col h-screen">
+ {user?.acknowledgedUniversity ? null : (
+ <AcademyBanner acknowledgeAction={path.to.acknowledge} />
+ )}
+
+ <Topbar />
+ <div className="flex flex-1 h-[calc(100vh-49px)] relative">
+ <PrimaryNavigation />
+ <main className="flex-1 overflow-y-auto scrollbar-hide border-l border-t bg-muted sm:rounded-tl-2xl relative z-10">
+ <Outlet />
+ </main>
+ </div>
+ </div>
+ </TooltipProvider>
+ </RealtimeDataProvider>
+ </CarbonProvider>
+ )}
</div>
);
}
diff --git a/apps/erp/app/routes/x+/acknowledge.tsx b/apps/erp/app/routes/x+/acknowledge.tsx
index 33500b60d4..e34ac1ba7b 100644
--- a/apps/erp/app/routes/x+/acknowledge.tsx
+++ b/apps/erp/app/routes/x+/acknowledge.tsx
@@ -20,7 +20,25 @@ export async function action({ request }: ActionFunctionArgs) {
if (redirectTo) {
throw redirect(redirectTo);
}
+
+ return { success: true, message: "University acknowledged" };
}
- return null;
+ if (intent === "itar") {
+ const updateResult = await client
+ .from("user")
+ .update({
+ acknowledgedITAR: true,
+ })
+ .eq("id", userId);
+
+ if (updateResult.error) {
+ return {
+ success: false,
+ message: "Failed to update ITAR acknowledgement",
+ };
+ }
+
+ return { success: true, message: "ITAR acknowledged" };
+ }
}
diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.ts
index 4b6fe7f25a..a123c9e0cf 100644
--- a/apps/erp/app/utils/path.ts
+++ b/apps/erp/app/utils/path.ts
@@ -1,13 +1,11 @@
-import { SUPABASE_URL } from "@carbon/auth";
+import { getMESUrl, SUPABASE_URL } from "@carbon/auth";
import { generatePath } from "@remix-run/react";
const x = "/x"; // from ~/routes/x+ folder
const api = "/api"; // from ~/routes/api+ folder
const file = "/file"; // from ~/routes/file+ folder
const onboarding = "/onboarding"; // from ~/routes/onboarding+ folder
-const mes = SUPABASE_URL.includes("localhost")
- ? "http://localhost:3001"
- : "https://mes.carbon.ms";
+const mes = getMESUrl();
export const path = {
to: {
diff --git a/apps/mes/app/components/AppSidebar.tsx b/apps/mes/app/components/AppSidebar.tsx
index b89c6855cd..acfed3d6be 100644
--- a/apps/mes/app/components/AppSidebar.tsx
+++ b/apps/mes/app/components/AppSidebar.tsx
@@ -10,11 +10,12 @@ import {
LuLogOut,
LuMapPin,
LuMoon,
+ LuShieldCheck,
LuSun,
LuUser,
} from "react-icons/lu";
-import { type Company } from "@carbon/auth";
+import { ITAR_ENVIRONMENT, type Company } from "@carbon/auth";
import {
Avatar,
cn,
@@ -42,9 +43,10 @@ import {
SidebarMenuItem,
SidebarRail,
Switch,
+ useDisclosure,
useSidebar,
} from "@carbon/react";
-import { useMode } from "@carbon/remix";
+import { ItarDisclosure, useMode } from "@carbon/remix";
import { Form, Link, useFetcher, useLocation } from "@remix-run/react";
import { useRef, type ComponentProps } from "react";
import { BsFillHexagonFill } from "react-icons/bs";
@@ -256,6 +258,9 @@ export function UserNav({
const optimisticLocation =
(fetcher.formData?.get("location") as string | undefined) ?? location;
+
+ const itarDisclosure = useDisclosure();
+
return (
<SidebarMenu>
<SidebarMenuItem>
@@ -292,6 +297,7 @@ export function UserNav({
</Link>
</DropdownMenuItem>
<DropdownMenuSeparator />
+
<DropdownMenuSub>
<DropdownMenuSubTrigger>
<DropdownMenuIcon icon={<LuBuilding />} />
@@ -392,6 +398,12 @@ export function UserNav({
</div>
</DropdownMenuItem>
<DropdownMenuSeparator />
+ {ITAR_ENVIRONMENT && (
+ <DropdownMenuItem onClick={itarDisclosure.onOpen}>
+ <DropdownMenuIcon icon={<LuShieldCheck />} />
+ About
+ </DropdownMenuItem>
+ )}
<DropdownMenuItem onSelect={(e) => e.preventDefault()}>
<Form method="post" action={path.to.logout}>
<button type="submit" className="w-full flex items-center">
@@ -403,6 +415,7 @@ export function UserNav({
</DropdownMenuContent>
</DropdownMenu>
</SidebarMenuItem>
+ {ITAR_ENVIRONMENT && <ItarDisclosure disclosure={itarDisclosure} />}
</SidebarMenu>
);
}
diff --git a/apps/mes/app/root.tsx b/apps/mes/app/root.tsx
index 80a935254a..2ba96e7c28 100644
--- a/apps/mes/app/root.tsx
+++ b/apps/mes/app/root.tsx
@@ -51,6 +51,7 @@ export const meta: MetaFunction = () => {
export async function loader({ request }: LoaderFunctionArgs) {
const {
CARBON_EDITION,
+ ITAR_ENVIRONMENT,
POSTHOG_API_HOST,
POSTHOG_PROJECT_PUBLIC_KEY,
SUPABASE_URL,
@@ -63,6 +64,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
{
env: {
CARBON_EDITION,
+ ITAR_ENVIRONMENT,
POSTHOG_API_HOST,
POSTHOG_PROJECT_PUBLIC_KEY,
SUPABASE_URL,
diff --git a/apps/mes/app/routes/_public+/login.tsx b/apps/mes/app/routes/_public+/login.tsx
index 816d8deae8..6350bd7087 100644
--- a/apps/mes/app/routes/_public+/login.tsx
+++ b/apps/mes/app/routes/_public+/login.tsx
@@ -1,7 +1,9 @@
import {
assertIsPost,
carbonClient,
+ CarbonEdition,
error,
+ ITAR_ENVIRONMENT,
magicLinkValidator,
} from "@carbon/auth";
import { sendMagicLink, verifyAuthSession } from "@carbon/auth/auth.server";
@@ -19,6 +21,8 @@ import {
toast,
VStack,
} from "@carbon/react";
+import { ItarLoginDisclaimer } from "@carbon/remix";
+import { Edition } from "@carbon/utils";
import { useFetcher, useSearchParams } from "@remix-run/react";
import { Ratelimit } from "@upstash/ratelimit";
import type {
@@ -178,27 +182,30 @@ export default function LoginRoute() {
</ValidatedForm>
)}
</div>
- <div className="text-sm text-center text-balance text-muted-foreground w-[380px] mt-4">
- <p>
- By signing in, you agree to the{" "}
- <a
- href="https://carbon.ms/terms"
- target="_blank"
- rel="noreferrer"
- className="underline"
- >
- Terms of Service
- </a>{" "}
- and{" "}
- <a
- href="https://carbon.ms/privacy"
- target="_blank"
- rel="noreferrer"
- className="underline"
- >
- Privacy Policy.
- </a>
- </p>
+ <div className="flex flex-col gap-4 text-sm text-center text-balance text-muted-foreground w-[380px]">
+ {ITAR_ENVIRONMENT && <ItarLoginDisclaimer />}
+ {CarbonEdition === Edition.Cloud && (
+ <p>
+ By signing in, you agree to the{" "}
+ <a
+ href="https://carbon.ms/terms"
+ target="_blank"
+ rel="noreferrer"
+ className="underline"
+ >
+ Terms of Service
+ </a>{" "}
+ and{" "}
+ <a
+ href="https://carbon.ms/privacy"
+ target="_blank"
+ rel="noreferrer"
+ className="underline"
+ >
+ Privacy Policy.
+ </a>
+ </p>
+ )}
</div>
</>
);
diff --git a/apps/mes/app/routes/x+/_layout.tsx b/apps/mes/app/routes/x+/_layout.tsx
index 8c1d1772a9..0b08f4837b 100644
--- a/apps/mes/app/routes/x+/_layout.tsx
+++ b/apps/mes/app/routes/x+/_layout.tsx
@@ -4,13 +4,19 @@ import {
getCarbon,
getCompanies,
getUser,
+ ITAR_ENVIRONMENT,
} from "@carbon/auth";
import {
destroyAuthSession,
requireAuthSession,
} from "@carbon/auth/session.server";
import { SidebarProvider, TooltipProvider, useMount } from "@carbon/react";
-import { useKeyboardWedgeNavigation, useNProgress } from "@carbon/remix";
+import {
+ AcademyBanner,
+ ItarPopup,
+ useKeyboardWedgeNavigation,
+ useNProgress,
+} from "@carbon/remix";
import { getStripeCustomerByCompanyId } from "@carbon/stripe/stripe.server";
import { Edition } from "@carbon/utils";
import type { ShouldRevalidateFunction } from "@remix-run/react";
@@ -20,7 +26,6 @@ import { json, redirect } from "@vercel/remix";
import posthog from "posthog-js";
import { AppSidebar } from "~/components";
import RealtimeDataProvider from "~/components/RealtimeDataProvider";
-import { useUser } from "~/hooks";
import { getLocation, setLocation } from "~/services/location.server";
import {
getActiveJobCount,
@@ -116,38 +121,55 @@ export async function loader({ request }: LoaderFunctionArgs) {
}
export default function AuthenticatedRoute() {
- const { session, activeEvents, company, companies, location, locations } =
- useLoaderData<typeof loader>();
+ const {
+ session,
+ activeEvents,
+ company,
+ companies,
+ location,
+ locations,
+ user,
+ } = useLoaderData<typeof loader>();
useNProgress();
useKeyboardWedgeNavigation();
- const user = useUser();
useMount(() => {
- posthog.identify(user.id, {
- email: user.email,
- name: `${user.firstName} ${user.lastName}`,
+ posthog.identify(user?.id, {
+ email: user?.email,
+ name: `${user?.firstName} ${user?.lastName}`,
});
});
return (
<div className="h-screen w-screen overflow-y-auto md:overflow-hidden">
- <CarbonProvider session={session}>
- <RealtimeDataProvider>
- <SidebarProvider defaultOpen={false}>
- <TooltipProvider delayDuration={0}>
- <AppSidebar
- activeEvents={activeEvents}
- company={company}
- companies={companies}
- location={location}
- locations={locations}
- />
- <Outlet />
- </TooltipProvider>
- </SidebarProvider>
- </RealtimeDataProvider>
- </CarbonProvider>
+ {user?.acknowledgedITAR === false && ITAR_ENVIRONMENT ? (
+ <ItarPopup
+ acknowledgeAction={path.to.acknowledge}
+ logoutAction={path.to.logout}
+ />
+ ) : (
+ <CarbonProvider session={session}>
+ <RealtimeDataProvider>
+ <SidebarProvider defaultOpen={false}>
+ <TooltipProvider delayDuration={0}>
+ {user?.acknowledgedUniversity ? null : (
+ <AcademyBanner acknowledgeAction={path.to.acknowledge} />
+ )}
+
+ <AppSidebar
+ activeEvents={activeEvents}
+ company={company}
+ companies={companies}
+ location={location}
+ locations={locations}
+ />
+ <Outlet />
+ </TooltipProvider>
+ </SidebarProvider>
+ </RealtimeDataProvider>
+ </CarbonProvider>
+ )}
</div>
);
}
diff --git a/apps/mes/app/routes/x+/acknowledge.tsx b/apps/mes/app/routes/x+/acknowledge.tsx
new file mode 100644
index 0000000000..e34ac1ba7b
--- /dev/null
+++ b/apps/mes/app/routes/x+/acknowledge.tsx
@@ -0,0 +1,44 @@
+import { requirePermissions } from "@carbon/auth/auth.server";
+import type { ActionFunctionArgs } from "@vercel/remix";
+import { redirect } from "@vercel/remix";
+
+export async function action({ request }: ActionFunctionArgs) {
+ const { client, userId } = await requirePermissions(request, {});
+
+ const formData = await request.formData();
+ const intent = formData.get("intent") as string;
+ const redirectTo = formData.get("redirectTo") as string | null;
+
+ if (intent === "academy") {
+ await client
+ .from("user")
+ .update({
+ acknowledgedUniversity: true,
+ })
+ .eq("id", userId);
+
+ if (redirectTo) {
+ throw redirect(redirectTo);
+ }
+
+ return { success: true, message: "University acknowledged" };
+ }
+
+ if (intent === "itar") {
+ const updateResult = await client
+ .from("user")
+ .update({
+ acknowledgedITAR: true,
+ })
+ .eq("id", userId);
+
+ if (updateResult.error) {
+ return {
+ success: false,
+ message: "Failed to update ITAR acknowledgement",
+ };
+ }
+
+ return { success: true, message: "ITAR acknowledged" };
+ }
+}
diff --git a/apps/mes/app/utils/path.ts b/apps/mes/app/utils/path.ts
index 38c1e82531..06b5f2a7cd 100644
--- a/apps/mes/app/utils/path.ts
+++ b/apps/mes/app/utils/path.ts
@@ -58,6 +58,7 @@ export const path = {
previewFile: (path: string) => generatePath(`${file}/preview/${path}`),
},
accountSettings: `${ERP_URL}/x/account`,
+ acknowledge: `${x}/acknowledge`,
active: `${x}/active`,
assigned: `${x}/assigned`,
authenticatedRoot: x,
diff --git a/package-lock.json b/package-lock.json
index da1e40c5ef..4eb0f3bc78 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -159,7 +159,6 @@
"nanoid": "5.0.4",
"nanostores": "^0.9.3",
"non.geist": "~1.0.3",
- "nprogress": "0.2.0",
"papaparse": "5.3.2",
"performant-array-to-tree": "1.11.0",
"posthog-js": "^1.116.6",
@@ -36810,7 +36809,14 @@
"packages/remix": {
"name": "@carbon/remix",
"version": "*",
+ "dependencies": {
+ "@remix-run/react": "^2.11.2",
+ "nprogress": "^0.2.0",
+ "react": "^18.3.1",
+ "react-icons": "^5.4.0"
+ },
"devDependencies": {
+ "@carbon/react": "*",
"@carbon/tsconfig": "*",
"@carbon/utils": "*",
"@types/jest": "^26.0.22",
diff --git a/packages/auth/src/config/env.ts b/packages/auth/src/config/env.ts
index 4a948f0e47..e61dcb5d2c 100644
--- a/packages/auth/src/config/env.ts
+++ b/packages/auth/src/config/env.ts
@@ -1,16 +1,17 @@
-import { Edition, isBrowser } from "@carbon/utils";
+import { Edition, isBrowser, parseBoolean } from "@carbon/utils";
declare global {
interface Window {
env: {
CARBON_EDITION: string;
- SUPABASE_URL: string;
- SUPABASE_ANON_KEY: string;
+ CLOUDFLARE_TURNSTILE_SITE_KEY: string;
+ ITAR_ENVIRONMENT: string;
POSTHOG_API_HOST: string;
POSTHOG_PROJECT_PUBLIC_KEY: string;
+ SUPABASE_URL: string;
+ SUPABASE_ANON_KEY: string;
VERCEL_URL: string;
VERCEL_ENV: string;
- CLOUDFLARE_TURNSTILE_SITE_KEY: string;
};
}
}
@@ -105,6 +106,14 @@ export const EXCHANGE_RATES_API_KEY = getEnv("EXCHANGE_RATES_API_KEY", {
isRequired: false,
isSecret: true,
});
+
+const itarEnvironment = getEnv("ITAR_ENVIRONMENT", {
+ isRequired: false,
+ isSecret: false,
+});
+
+export const ITAR_ENVIRONMENT = parseBoolean(itarEnvironment, false);
+
export const NOVU_APPLICATION_ID = getEnv("NOVU_APPLICATION_ID", {
isRequired: false,
isSecret: false,
@@ -192,7 +201,9 @@ export const CLOUDFLARE_TURNSTILE_SECRET_KEY = getEnv(
export function getAppUrl() {
if (VERCEL_ENV === "production" || NODE_ENV === "production") {
- return "https://app.carbon.ms";
+ return ITAR_ENVIRONMENT
+ ? "https://itar.carbon.ms"
+ : "https://app.carbon.ms";
}
if (VERCEL_ENV === "preview") {
@@ -202,9 +213,24 @@ export function getAppUrl() {
return "http://localhost:3000";
}
+export function getMESUrl() {
+ if (VERCEL_ENV === "production" || NODE_ENV === "production") {
+ return ITAR_ENVIRONMENT
+ ? "https://itar.mes.carbon.ms"
+ : "https://mes.carbon.ms";
+ }
+
+ if (VERCEL_ENV === "preview") {
+ return `https://${process.env.VERCEL_URL}`;
+ }
+
+ return "http://localhost:3001";
+}
+
export function getBrowserEnv() {
return {
CARBON_EDITION,
+ ITAR_ENVIRONMENT,
SUPABASE_URL,
SUPABASE_ANON_KEY,
POSTHOG_API_HOST,
diff --git a/packages/auth/src/lib/supabase/client.ts b/packages/auth/src/lib/supabase/client.ts
index 17ffee098b..0d648fe507 100644
--- a/packages/auth/src/lib/supabase/client.ts
+++ b/packages/auth/src/lib/supabase/client.ts
@@ -4,8 +4,8 @@ import { createClient } from "@supabase/supabase-js";
import {
SUPABASE_ANON_KEY,
- SUPABASE_URL,
SUPABASE_SERVICE_ROLE_KEY,
+ SUPABASE_URL,
} from "../../config/env";
const getCarbonClient = (supabaseKey: string, accessToken?: string) => {
@@ -19,7 +19,7 @@ const getCarbonClient = (supabaseKey: string, accessToken?: string) => {
}
: {};
- const client = createClient<Database>(SUPABASE_URL, supabaseKey, {
+ const client = createClient<Database, "public">(SUPABASE_URL, supabaseKey, {
auth: {
autoRefreshToken: false,
persistSession: false,
@@ -31,13 +31,17 @@ const getCarbonClient = (supabaseKey: string, accessToken?: string) => {
};
export const getCarbonAPIKeyClient = (apiKey: string) => {
- const client = createClient<Database>(SUPABASE_URL, SUPABASE_ANON_KEY, {
- global: {
- headers: {
- "carbon-key": apiKey,
+ const client = createClient<Database, "public">(
+ SUPABASE_URL,
+ SUPABASE_ANON_KEY,
+ {
+ global: {
+ headers: {
+ "carbon-key": apiKey,
+ },
},
- },
- });
+ }
+ );
return client;
};
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 5ea8f210b4..fb54909f95 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -19393,7 +19393,7 @@ export type Database = {
Row: {
assignee: string | null
companyId: string | null
- content: Json | null
+ content: Json
createdAt: string
createdBy: string
description: string | null
@@ -19408,7 +19408,7 @@ export type Database = {
Insert: {
assignee?: string | null
companyId?: string | null
- content?: Json | null
+ content?: Json
createdAt?: string
createdBy: string
description?: string | null
@@ -19423,7 +19423,7 @@ export type Database = {
Update: {
assignee?: string | null
companyId?: string | null
- content?: Json | null
+ content?: Json
createdAt?: string
createdBy?: string
description?: string | null
@@ -34427,6 +34427,7 @@ export type Database = {
user: {
Row: {
about: string
+ acknowledgedITAR: boolean
acknowledgedUniversity: boolean
active: boolean | null
admin: boolean | null
@@ -34442,6 +34443,7 @@ export type Database = {
}
Insert: {
about?: string
+ acknowledgedITAR?: boolean
acknowledgedUniversity?: boolean
active?: boolean | null
admin?: boolean | null
@@ -34457,6 +34459,7 @@ export type Database = {
}
Update: {
about?: string
+ acknowledgedITAR?: boolean
acknowledgedUniversity?: boolean
active?: boolean | null
admin?: boolean | null
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 5ea8f210b4..fb54909f95 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -19393,7 +19393,7 @@ export type Database = {
Row: {
assignee: string | null
companyId: string | null
- content: Json | null
+ content: Json
createdAt: string
createdBy: string
description: string | null
@@ -19408,7 +19408,7 @@ export type Database = {
Insert: {
assignee?: string | null
companyId?: string | null
- content?: Json | null
+ content?: Json
createdAt?: string
createdBy: string
description?: string | null
@@ -19423,7 +19423,7 @@ export type Database = {
Update: {
assignee?: string | null
companyId?: string | null
- content?: Json | null
+ content?: Json
createdAt?: string
createdBy?: string
description?: string | null
@@ -34427,6 +34427,7 @@ export type Database = {
user: {
Row: {
about: string
+ acknowledgedITAR: boolean
acknowledgedUniversity: boolean
active: boolean | null
admin: boolean | null
@@ -34442,6 +34443,7 @@ export type Database = {
}
Insert: {
about?: string
+ acknowledgedITAR?: boolean
acknowledgedUniversity?: boolean
active?: boolean | null
admin?: boolean | null
@@ -34457,6 +34459,7 @@ export type Database = {
}
Update: {
about?: string
+ acknowledgedITAR?: boolean
acknowledgedUniversity?: boolean
active?: boolean | null
admin?: boolean | null
diff --git a/packages/database/supabase/migrations/20250920215832_itar-acknowledge.sql b/packages/database/supabase/migrations/20250920215832_itar-acknowledge.sql
new file mode 100644
index 0000000000..fc77de90ff
--- /dev/null
+++ b/packages/database/supabase/migrations/20250920215832_itar-acknowledge.sql
@@ -0,0 +1 @@
+ALTER TABLE "user" ADD COLUMN "acknowledgedITAR" BOOLEAN NOT NULL DEFAULT FALSE;
\ No newline at end of file
diff --git a/packages/documents/src/email/QuoteEmail.tsx b/packages/documents/src/email/QuoteEmail.tsx
index efc6656b1f..81936a3e41 100644
--- a/packages/documents/src/email/QuoteEmail.tsx
+++ b/packages/documents/src/email/QuoteEmail.tsx
@@ -1,3 +1,4 @@
+import { getAppUrl } from "@carbon/auth";
import type { Database } from "@carbon/database";
import {
Body,
@@ -31,7 +32,7 @@ const QuoteEmail = ({
}: QuoteEmailProps) => {
const digitalQuoteUrl =
companySettings.digitalQuoteEnabled && !!quote.externalLinkId
- ? `https://app.carbon.ms/share/quote/${quote.externalLinkId}` // the VERCEL_URL variable was giving us a preview branch
+ ? `${getAppUrl()}/share/quote/${quote.externalLinkId}` // the VERCEL_URL variable was giving us a preview branch
: undefined;
const preview = <Preview>{`${quote.quoteId} from ${company.name}`}</Preview>;
diff --git a/packages/documents/src/pdf/JobTravelerPDF.tsx b/packages/documents/src/pdf/JobTravelerPDF.tsx
index b74253f7f8..3931db56a3 100644
--- a/packages/documents/src/pdf/JobTravelerPDF.tsx
+++ b/packages/documents/src/pdf/JobTravelerPDF.tsx
@@ -1,3 +1,4 @@
+import { getMESUrl } from "@carbon/auth";
import type { Database } from "@carbon/database";
import type { JSONContent } from "@carbon/react";
import { Image, StyleSheet, Text, View } from "@react-pdf/renderer";
@@ -18,11 +19,11 @@ interface JobTravelerProps extends PDF {
}
function getStartPath(operationId: string) {
- return `https://mes.carbon.ms/x/start/${operationId}`;
+ return `${getMESUrl()}/x/start/${operationId}`;
}
function getEndPath(operationId: string) {
- return `https://mes.carbon.ms/x/end/${operationId}`;
+ return `${getMESUrl()}/x/end/${operationId}`;
}
// Initialize tailwind-styled-components
diff --git a/packages/ee/src/slack/config.tsx b/packages/ee/src/slack/config.tsx
index cb34c62251..2e9a9e0ac8 100644
--- a/packages/ee/src/slack/config.tsx
+++ b/packages/ee/src/slack/config.tsx
@@ -1,3 +1,4 @@
+import { ITAR_ENVIRONMENT } from "@carbon/auth";
import { z } from "zod";
import type { IntegrationConfig } from "../types";
@@ -5,7 +6,7 @@ export const Slack: IntegrationConfig = {
name: "Slack",
id: "slack",
category: "Assistant",
- active: true,
+ active: ITAR_ENVIRONMENT === false,
logo: Logo,
shortDescription: "Use the Carbon Assistant in your Slack workspace.",
description:
diff --git a/packages/react/src/Toast.tsx b/packages/react/src/Toast.tsx
index b115958640..1270af2bab 100644
--- a/packages/react/src/Toast.tsx
+++ b/packages/react/src/Toast.tsx
@@ -18,9 +18,9 @@ const Toaster = ({ ...props }: ToasterProps) => {
cancelButton:
"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
success:
- "group-[.toaster]:bg-blue-600 group-[.toaster]:text-blue-100 dark:group-[.toaster]:bg-blue-900 group-[.toaster]:border-blue-600 dark:group-[.toaster]:text-blue-400 group-[.toaster]:text-white",
+ "group-[.toaster]:bg-blue-700 group-[.toaster]:text-white group-[.toaster]:border-blue-700 ",
error:
- "group-[.toaster]:bg-red-600 group-[.toaster]:text-red-100 dark:group-[.toaster]:bg-red-900 group-[.toaster]:border-red-600 dark:group-[.toaster]:text-red-400 group-[.toaster]:text-white",
+ "group-[.toaster]:bg-red-600 group-[.toaster]:text-white group-[.toaster]:border-red-600 ",
},
}}
{...props}
diff --git a/packages/remix/package.json b/packages/remix/package.json
index 57c50e4db5..2f7ecc5b17 100644
--- a/packages/remix/package.json
+++ b/packages/remix/package.json
@@ -1,9 +1,13 @@
{
"name": "@carbon/remix",
"dependencies": {
- "nprogress": "^0.2.0"
+ "@remix-run/react": "^2.11.2",
+ "nprogress": "^0.2.0",
+ "react": "^18.3.1",
+ "react-icons": "^5.4.0"
},
"devDependencies": {
+ "@carbon/react": "*",
"@carbon/tsconfig": "*",
"@carbon/utils": "*",
"@types/jest": "^26.0.22",
diff --git a/packages/remix/src/components/Acknowledge.tsx b/packages/remix/src/components/Acknowledge.tsx
new file mode 100644
index 0000000000..705bfb16f5
--- /dev/null
+++ b/packages/remix/src/components/Acknowledge.tsx
@@ -0,0 +1,150 @@
+import type { useDisclosure } from "@carbon/react";
+import {
+ Button,
+ IconButton,
+ Modal,
+ ModalBody,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalTitle,
+ toast,
+} from "@carbon/react";
+import { Form, useFetcher } from "@remix-run/react";
+import { useEffect } from "react";
+import { LuArrowUpRight, LuX } from "react-icons/lu";
+
+export function AcademyBanner({
+ acknowledgeAction,
+}: {
+ acknowledgeAction: string;
+}) {
+ const fetcher = useFetcher<{}>();
+
+ return (
+ <div className="fixed bottom-3 left-1/2 -translate-x-1/2 flex items-center justify-between gap-10 bg-[#212278] dark:bg-[#2f31ae] text-white py-1 px-2 rounded-lg z-50 shadow-md">
+ <div />
+ <fetcher.Form method="post" action={acknowledgeAction}>
+ <input type="hidden" name="intent" value="academy" />
+ <input
+ type="hidden"
+ name="redirectTo"
+ value="https://learn.carbon.ms"
+ />
+ <Button
+ type="submit"
+ variant="ghost"
+ size="lg"
+ className="hover:bg-transparent text-white hover:text-white"
+ rightIcon={<LuArrowUpRight />}
+ >
+ <span>Introducing Carbon Academy</span>
+ </Button>
+ </fetcher.Form>
+ <fetcher.Form method="post" action={acknowledgeAction}>
+ <input type="hidden" name="intent" value="academy" />
+ <IconButton
+ type="submit"
+ aria-label="Close"
+ variant="ghost"
+ className="text-white dark:text-white hover:text-white"
+ icon={<LuX />}
+ />
+ </fetcher.Form>
+ </div>
+ );
+}
+
+export function ItarLoginDisclaimer() {
+ return (
+ <p>
+ <p>
+ This is an ITAR-controlled solution. Access and use are restricted to
+ U.S. Persons only
+ </p>
+ </p>
+ );
+}
+
+export function ItarDisclosure({
+ disclosure,
+}: {
+ disclosure: ReturnType<typeof useDisclosure>;
+}) {
+ return (
+ <Modal
+ open={disclosure.isOpen}
+ onOpenChange={(open) => {
+ if (!open) disclosure.onClose();
+ }}
+ >
+ <ModalContent size="medium">
+ <ModalHeader>
+ <ModalTitle>ITAR-controlled solution</ModalTitle>
+ </ModalHeader>
+ <ModalBody>
+ <p className="text-sm text-muted-foreground">
+ This is an ITAR-controlled solution. Access and use are restricted
+ to U.S. Persons only
+ </p>
+ </ModalBody>
+ <ModalFooter>
+ <Button variant="secondary" onClick={disclosure.onClose}>
+ Close
+ </Button>
+ </ModalFooter>
+ </ModalContent>
+ </Modal>
+ );
+}
+
+export function ItarPopup({
+ acknowledgeAction,
+ logoutAction,
+}: {
+ acknowledgeAction: string;
+ logoutAction: string;
+}) {
+ const acknowledgeFetcher = useFetcher<{
+ success: boolean;
+ message: string;
+ }>();
+ const isLoading = acknowledgeFetcher.state !== "idle";
+ useEffect(() => {
+ if (acknowledgeFetcher.data?.success === true) {
+ toast.success(acknowledgeFetcher.data?.message);
+ } else if (acknowledgeFetcher.data?.success === false) {
+ toast.error(acknowledgeFetcher.data?.message);
+ }
+ }, [acknowledgeFetcher.data]);
+
+ return (
+ <Modal open>
+ <ModalContent size="medium">
+ <ModalHeader>
+ <ModalTitle>ITAR-controlled solution</ModalTitle>
+ </ModalHeader>
+ <ModalBody>
+ <p className="text-sm text-muted-foreground">
+ This is an ITAR-controlled solution. Access and use are restricted
+ to U.S. Persons only
+ </p>
+ </ModalBody>
+ <ModalFooter>
+ <acknowledgeFetcher.Form method="post" action={acknowledgeAction}>
+ <input type="hidden" name="intent" value="itar" />
+ <Button type="submit" isLoading={isLoading} isDisabled={isLoading}>
+ I am a U.S. Person
+ </Button>
+ </acknowledgeFetcher.Form>
+
+ <Form method="post" action={logoutAction}>
+ <Button type="submit" variant="secondary" isDisabled={isLoading}>
+ I am not a U.S. Person
+ </Button>
+ </Form>
+ </ModalFooter>
+ </ModalContent>
+ </Modal>
+ );
+}
diff --git a/packages/remix/src/components/index.ts b/packages/remix/src/components/index.ts
new file mode 100644
index 0000000000..405ec57446
--- /dev/null
+++ b/packages/remix/src/components/index.ts
@@ -0,0 +1 @@
+export * from "./Acknowledge";
diff --git a/packages/remix/src/index.ts b/packages/remix/src/index.ts
index 007f69d09c..a234113be0 100644
--- a/packages/remix/src/index.ts
+++ b/packages/remix/src/index.ts
@@ -1 +1,2 @@
+export * from "./components";
export * from "./hooks";
diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts
index 4a07b4d76c..9ff1c53de7 100644
--- a/packages/utils/src/index.ts
+++ b/packages/utils/src/index.ts
@@ -13,6 +13,7 @@ export * from "./labels";
export * from "./llm";
export * from "./math";
export * from "./ssr";
+export * from "./string";
export * from "./themes";
export * from "./tiptap";
export * from "./types";
diff --git a/packages/utils/src/string.ts b/packages/utils/src/string.ts
new file mode 100644
index 0000000000..07eac52dee
--- /dev/null
+++ b/packages/utils/src/string.ts
@@ -0,0 +1,12 @@
+export function parseBoolean<T>(
+ value: string | undefined,
+ defaultValue?: T
+): boolean | T {
+ if (!value) return defaultValue;
+
+ if (typeof value === "boolean") return value;
+ const normalized = value.trim().toLowerCase();
+ if (normalized === "true" || normalized === "1") return true;
+ if (normalized === "false" || normalized === "0") return false;
+ return defaultValue; // or throw an error if invalid
+}