Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
00a3208
fix: validation issues
ogzhanolguncu Jul 8, 2025
300710e
feat: add tRPC endpoint
ogzhanolguncu Jul 8, 2025
5c0ecc9
fix: add suspense with fallabck
ogzhanolguncu Jul 8, 2025
db2c568
Merge branch 'main' into onboarding-trpc
ogzhanolguncu Jul 8, 2025
cffa854
feat: add workspace creation to the first step
ogzhanolguncu Jul 9, 2025
948dcd6
feat: add run every step individually
ogzhanolguncu Jul 9, 2025
d6189a3
Merge branch 'main' into onboarding-trpc
ogzhanolguncu Jul 9, 2025
eb1d767
feat: success step
ogzhanolguncu Jul 9, 2025
30937eb
feat: add control for skippiong
ogzhanolguncu Jul 9, 2025
64aaed0
refactor: replace new onboarding
ogzhanolguncu Jul 9, 2025
30424b8
feat: add mising user and help button
ogzhanolguncu Jul 10, 2025
66520bc
feat: prevent unauthenticated user access
ogzhanolguncu Jul 10, 2025
dfdbf52
fix: add use client
ogzhanolguncu Jul 10, 2025
4ec14b9
Merge branch 'main' of github.com:unkeyed/unkey into onboarding-success
ogzhanolguncu Jul 11, 2025
c718be4
fix: get rid of workspace param
ogzhanolguncu Jul 11, 2025
8b57c8a
refactor: make shared key secret section
ogzhanolguncu Jul 11, 2025
ec906b2
chore: remove redundant workspace lookup
ogzhanolguncu Jul 11, 2025
b4aaf1e
fix: coderabbit issue
ogzhanolguncu Jul 11, 2025
e4ea2fb
chore: rephrase the error message
ogzhanolguncu Jul 11, 2025
faec061
Merge branch 'main' of github.com:unkeyed/unkey into onboarding-success
ogzhanolguncu Jul 11, 2025
a94fefb
chore: fmt
ogzhanolguncu Jul 11, 2025
0b910ea
Merge branch 'main' into onboarding-success
ogzhanolguncu Jul 11, 2025
dda7d1a
fix: import path
ogzhanolguncu Jul 11, 2025
66585e0
Merge branch 'onboarding-success' of github.com:unkeyed/unkey into on…
ogzhanolguncu Jul 11, 2025
d4d0b00
fix: wording
ogzhanolguncu Jul 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import { ConfirmPopover } from "@/components/confirmation-popover";
import { Dialog, DialogContent } from "@/components/ui/dialog";
import { ArrowRight, Check, CircleInfo, Key2, Plus } from "@unkey/icons";
import { Button, Code, CopyButton, InfoTooltip, VisibleButton, toast } from "@unkey/ui";
import { ArrowRight, Check, Key2, Plus } from "@unkey/icons";
import { Button, InfoTooltip, toast } from "@unkey/ui";
import { useRouter } from "next/navigation";
import { useEffect, useRef, useState } from "react";
import { UNNAMED_KEY } from "../create-key.constants";
import { SecretKey } from "./secret-key";
import { KeySecretSection } from "./key-secret-section";

export const KeyCreatedSuccessDialog = ({
isOpen,
Expand All @@ -24,7 +24,6 @@ export const KeyCreatedSuccessDialog = ({
keyspaceId?: string | null;
onCreateAnother?: () => void;
}) => {
const [showKeyInSnippet, setShowKeyInSnippet] = useState(false);
const [isConfirmOpen, setIsConfirmOpen] = useState(false);
const [pendingAction, setPendingAction] = useState<
"close" | "create-another" | "go-to-details" | null
Expand Down Expand Up @@ -53,21 +52,6 @@ export const KeyCreatedSuccessDialog = ({
return null;
}

const split = keyData.key.split("_") ?? [];
const maskedKey =
split.length >= 2
? `${split.at(0)}_${"*".repeat(split.at(1)?.length ?? 0)}`
: "*".repeat(split.at(0)?.length ?? 0);

const snippet = `curl -XPOST '${
process.env.NEXT_PUBLIC_UNKEY_API_URL ?? "https://api.unkey.dev"
}/v1/keys.verifyKey' \\
-H 'Content-Type: application/json' \\
-d '{
"key": "${keyData.key}",
"apiId": "${apiId}"
}'`;

const handleCloseAttempt = (action: "close" | "create-another" | "go-to-details" = "close") => {
setPendingAction(action);
setIsConfirmOpen(true);
Expand Down Expand Up @@ -199,36 +183,12 @@ export const KeyCreatedSuccessDialog = ({
</div>
</div>
</div>
<div className="flex flex-col gap-2 items-start w-full mt-6">
<div className="text-gray-12 text-sm font-semibold">Key Secret</div>
<SecretKey value={keyData.key} title="API Key" className="bg-white dark:bg-black " />
<div className="text-gray-9 text-[13px] flex items-center gap-1.5">
<CircleInfo className="text-accent-9" size="sm-regular" />
<span>
Copy and save this key secret as it won't be shown again.{" "}
<a
href="https://www.unkey.com/docs/security/recovering-keys"
target="_blank"
rel="noopener noreferrer"
className="text-info-11 hover:underline"
>
Learn more
</a>
</span>
</div>
</div>
<div className="flex flex-col gap-2 items-start w-full mt-8">
<div className="text-gray-12 text-sm font-semibold">Try It Out</div>

<Code
visibleButton={
<VisibleButton isVisible={showKeyInSnippet} setIsVisible={setShowKeyInSnippet} />
}
copyButton={<CopyButton value={snippet} />}
>
{showKeyInSnippet ? snippet : snippet.replace(keyData.key, maskedKey)}
</Code>
</div>
<KeySecretSection
keyValue={keyData.key}
apiId={apiId}
className="mt-6 w-full"
secretKeyClassName="bg-white dark:bg-black"
/>
<div className="mt-6">
<div className="mt-4 text-center text-gray-10 text-xs leading-6">
All set! You can now create another key or explore the docs to learn more
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"use client";

import { SecretKey } from "@/app/(app)/apis/[apiId]/_components/create-key/components/secret-key";
import { CircleInfo } from "@unkey/icons";
import { Code, CopyButton, VisibleButton } from "@unkey/ui";
import { useState } from "react";

type KeySecretSectionProps = {
keyValue: string;
apiId: string;
className?: string;
secretKeyClassName?: string;
codeClassName?: string;
};

export const KeySecretSection = ({
keyValue,
apiId,
className,
secretKeyClassName = "bg-white dark:bg-black",
codeClassName,
}: KeySecretSectionProps) => {
const [showKeyInSnippet, setShowKeyInSnippet] = useState(false);

const split = keyValue.split("_") ?? [];
const maskedKey =
split.length >= 2
? `${split.at(0)}_${"*".repeat(split.at(1)?.length ?? 0)}`
: "*".repeat(split.at(0)?.length ?? 0);

const snippet = `curl -XPOST '${
process.env.NEXT_PUBLIC_UNKEY_API_URL ?? "https://api.unkey.dev"
}/v1/keys.verifyKey' \\
-H 'Content-Type: application/json' \\
-d '{
"key": "${keyValue}",
"apiId": "${apiId}"
}'`;

return (
<div className={className}>
<div className="flex flex-col gap-2 items-start w-full">
<div className="text-gray-12 text-sm font-semibold">Key Secret</div>
<SecretKey value={keyValue} title="API Key" className={secretKeyClassName} />
<div className="text-gray-9 text-[13px] flex items-center gap-1.5">
<CircleInfo className="text-accent-9" size="sm-regular" />
<span>
Copy and save this key secret as it won't be shown again.{" "}
<a
href="https://www.unkey.com/docs/security/recovering-keys"
target="_blank"
rel="noopener noreferrer"
className="text-info-11 hover:underline"
>
Learn more
</a>
</span>
</div>
</div>
<div className="flex flex-col gap-2 items-start w-full mt-8">
<div className="text-gray-12 text-sm font-semibold">Try It Out</div>
<Code
className={codeClassName}
visibleButton={
<VisibleButton isVisible={showKeyInSnippet} setIsVisible={setShowKeyInSnippet} />
}
copyButton={<CopyButton value={snippet} />}
>
{showKeyInSnippet ? snippet : snippet.replace(keyValue, maskedKey)}
</Code>
</div>
</div>
);
};
21 changes: 0 additions & 21 deletions apps/dashboard/app/new-2/constants.ts

This file was deleted.

146 changes: 0 additions & 146 deletions apps/dashboard/app/new-2/page.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"use client";
import { Switch } from "@/components/ui/switch";

import { CircleInfo } from "@unkey/icons";
import { InfoTooltip } from "@unkey/ui";
import { useState } from "react";
Expand All @@ -12,6 +14,7 @@ type ExpandableSettingsProps = {
defaultChecked?: boolean;
onCheckedChange?: (checked: boolean) => void;
disabled?: boolean;
disabledTooltip?: string;
};

export const ExpandableSettings = ({
Expand All @@ -22,6 +25,7 @@ export const ExpandableSettings = ({
defaultChecked = false,
onCheckedChange,
disabled = false,
disabledTooltip = "You need to have a valid API name",
}: ExpandableSettingsProps) => {
const [isEnabled, setIsEnabled] = useState(defaultChecked);

Expand All @@ -32,13 +36,19 @@ export const ExpandableSettings = ({
setIsEnabled(checked);
onCheckedChange?.(checked);
};
const handleSwitchClick = (e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();
};

const handleHeaderClick = () => {
const handleHeaderClick = (e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();
handleCheckedChange(!isEnabled);
};

return (
<InfoTooltip content="You need to have a valid API name" disabled={!disabled}>
<InfoTooltip content={disabledTooltip} disabled={!disabled} asChild>
<div className={disabled ? "opacity-50 pointer-events-none" : ""}>
{/* Header */}
<button
Expand All @@ -56,7 +66,7 @@ export const ExpandableSettings = ({
)}
</div>
{/* biome-ignore lint/a11y/useKeyWithClickEvents: no need */}
<div onClick={(e) => e.stopPropagation()} className="ml-auto">
<div onClick={handleSwitchClick} className="ml-auto">
<Switch
checked={isEnabled}
onCheckedChange={handleCheckedChange}
Expand Down
Loading