Skip to content

Commit

Permalink
Add getSignInUrl (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
artf authored Jan 18, 2025
1 parent cb7badf commit 7391350
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/app/_components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Header: React.FC<HeaderProps> = ({ isHome, className, ...rest }) => {
{
content: "Sign In",
className: "rounded-full border-2 !px-4",
href: urls.getSdkLicensesUrl({ ref: "mainTopNav" }),
href: urls.getSignInUrl({ ref: "mainTopNav" }),
target: "_blank",
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function HomePage() {
<div className="flex flex-row gap-[16px] flex-wrap items-center justify-center pt-[50px] pb-[50px]">
<CTALink href={urls.getStudioEditorUrl()}>Try the Editor</CTALink>
<CTALink
href={urls.getSdkLicensesUrl({ ref: "heroAccount" })}
href={urls.getSignInUrl({ ref: "heroAccount" })}
variant="tertiary"
>
Create Account
Expand Down
24 changes: 12 additions & 12 deletions src/lib/urls.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
const toCapitalCase = (str: string) =>
str.charAt(0).toUpperCase() + str.slice(1);

interface UrlProps {
plan?: "free" | "startup" | "business" | "enterprise";
ref?: string;
}

const APP_URL = "https://app.grapesjs.com";
const WEBSITE_URL = "https://grapesjs.com";
const UTM_PARAMS = `utm_source=grapesjs&utm_medium=button`;

const getRef = ({ ref, plan }: UrlProps) =>
ref ? `&ref=${ref}` : plan ? `&ref=ctaSdkPlan${toCapitalCase(plan)}` : "";

const urls = {
getGettingStartedDocsUrl: () =>
`${APP_URL}/docs-sdk/overview/getting-started?${UTM_PARAMS}`,
getGrapesJsDocs: () => `${WEBSITE_URL}/docs/?${UTM_PARAMS}`,
getStudioEditorUrl: () => `${APP_URL}/studio?${UTM_PARAMS}`,
getSdkLicensesUrl: ({
plan,
ref,
}: {
plan?: "free" | "startup" | "business" | "enterprise";
ref?: string;
}) =>
`${APP_URL}/dashboard/sdk/licenses?${UTM_PARAMS}${
ref ? `&ref=${ref}` : plan ? `&ref=ctaSdkPlan${toCapitalCase(plan)}` : ""
}
`,

getSignInUrl: (props: UrlProps) =>
`${APP_URL}/signin?${UTM_PARAMS}${getRef(props)}`,
getSdkLicensesUrl: (props: UrlProps) =>
`${APP_URL}/dashboard/sdk/licenses?${UTM_PARAMS}${getRef(props)}`,
getHomeUrl: () => "/",
getFeaturesUrl: () => "/#features",
getPricingUrl: () => "/#pricing",
Expand Down

0 comments on commit 7391350

Please sign in to comment.