fix(admin-ui): Wrap invite route in AnalyticsProvider (#5111)
* fix(admin-ui): Wrap invite route in AnalyticsProvider * Create nervous-keys-impress.md
This commit is contained in:
6
.changeset/nervous-keys-impress.md
Normal file
6
.changeset/nervous-keys-impress.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@medusajs/admin-ui": patch
|
||||
"@medusajs/admin": patch
|
||||
---
|
||||
|
||||
fix(admin-ui): Wrap invite route in AnalyticsProvider
|
||||
@@ -13,11 +13,15 @@ import useNotification from "../hooks/use-notification"
|
||||
import { getErrorMessage } from "../utils/error-messages"
|
||||
import FormValidator from "../utils/form-validator"
|
||||
import { useAdminCreateAnalyticsConfig } from "../services/analytics"
|
||||
import { useAnalytics } from "../providers/analytics-provider"
|
||||
import {
|
||||
AnalyticsProvider,
|
||||
useAnalytics,
|
||||
} from "../providers/analytics-provider"
|
||||
import AnalyticsConfigForm, {
|
||||
AnalyticsConfigFormType,
|
||||
} from "../components/organisms/analytics-config-form"
|
||||
import { nestedForm } from "../utils/nested-form"
|
||||
import { WRITE_KEY } from "../constants/analytics"
|
||||
|
||||
type FormValues = {
|
||||
password: string
|
||||
@@ -151,88 +155,90 @@ const InvitePage = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<PublicLayout>
|
||||
<SEO title="Create Account" />
|
||||
{signUp ? (
|
||||
<form onSubmit={handleAcceptInvite}>
|
||||
<div className="flex w-[300px] flex-col items-center">
|
||||
<h1 className="inter-xlarge-semibold mb-large text-[20px]">
|
||||
Create your Medusa account
|
||||
<AnalyticsProvider writeKey={WRITE_KEY}>
|
||||
<PublicLayout>
|
||||
<SEO title="Create Account" />
|
||||
{signUp ? (
|
||||
<form onSubmit={handleAcceptInvite}>
|
||||
<div className="flex w-[300px] flex-col items-center">
|
||||
<h1 className="inter-xlarge-semibold mb-large text-[20px]">
|
||||
Create your Medusa account
|
||||
</h1>
|
||||
<div className="gap-y-small flex flex-col">
|
||||
<div>
|
||||
<SigninInput readOnly placeholder={token.user_email} />
|
||||
</div>
|
||||
<div>
|
||||
<SigninInput
|
||||
placeholder="Password"
|
||||
type={"password"}
|
||||
{...register("password", {
|
||||
required: FormValidator.required("Password"),
|
||||
})}
|
||||
autoComplete="new-password"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<SigninInput
|
||||
placeholder="Confirm password"
|
||||
type={"password"}
|
||||
{...register("repeat_password", {
|
||||
required: "You must confirm your password",
|
||||
})}
|
||||
autoComplete="new-password"
|
||||
/>
|
||||
<InputError errors={errors} name="repeat_password" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="gap-y-small my-8 flex w-[300px] flex-col">
|
||||
<AnalyticsConfigForm
|
||||
form={nestedForm(form, "analytics")}
|
||||
compact={true}
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="medium"
|
||||
className="mt-large w-[300px]"
|
||||
loading={isLoading}
|
||||
>
|
||||
Create account
|
||||
</Button>
|
||||
<p className="inter-small-regular text-grey-50 mt-xlarge">
|
||||
Already signed up? <a href="/login">Log in</a>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
) : (
|
||||
<div className="flex flex-col items-center text-center">
|
||||
<h1 className="inter-xlarge-semibold text-[20px]">
|
||||
{first_run
|
||||
? `Let's get you started!`
|
||||
: `You have been invited to join the team`}
|
||||
</h1>
|
||||
<div className="gap-y-small flex flex-col">
|
||||
<div>
|
||||
<SigninInput readOnly placeholder={token.user_email} />
|
||||
</div>
|
||||
<div>
|
||||
<SigninInput
|
||||
placeholder="Password"
|
||||
type={"password"}
|
||||
{...register("password", {
|
||||
required: FormValidator.required("Password"),
|
||||
})}
|
||||
autoComplete="new-password"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<SigninInput
|
||||
placeholder="Confirm password"
|
||||
type={"password"}
|
||||
{...register("repeat_password", {
|
||||
required: "You must confirm your password",
|
||||
})}
|
||||
autoComplete="new-password"
|
||||
/>
|
||||
<InputError errors={errors} name="repeat_password" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="gap-y-small my-8 flex w-[300px] flex-col">
|
||||
<AnalyticsConfigForm
|
||||
form={nestedForm(form, "analytics")}
|
||||
compact={true}
|
||||
/>
|
||||
</div>
|
||||
{first_run ? (
|
||||
<p className="inter-base-regular text-grey-50 mt-xsmall">
|
||||
Create an admin account to access your <br /> Medusa dashboard.
|
||||
</p>
|
||||
) : (
|
||||
<p className="inter-base-regular text-grey-50 mt-xsmall">
|
||||
You can now join the team. Sign up below and get started
|
||||
<br />
|
||||
with your Medusa account right away.
|
||||
</p>
|
||||
)}
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="medium"
|
||||
className="mt-large w-[300px]"
|
||||
loading={isLoading}
|
||||
className="mt-xlarge w-[300px]"
|
||||
onClick={() => setSignUp(true)}
|
||||
>
|
||||
Create account
|
||||
Sign up
|
||||
</Button>
|
||||
<p className="inter-small-regular text-grey-50 mt-xlarge">
|
||||
Already signed up? <a href="/login">Log in</a>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
) : (
|
||||
<div className="flex flex-col items-center text-center">
|
||||
<h1 className="inter-xlarge-semibold text-[20px]">
|
||||
{first_run
|
||||
? `Let's get you started!`
|
||||
: `You have been invited to join the team`}
|
||||
</h1>
|
||||
{first_run ? (
|
||||
<p className="inter-base-regular text-grey-50 mt-xsmall">
|
||||
Create an admin account to access your <br /> Medusa dashboard.
|
||||
</p>
|
||||
) : (
|
||||
<p className="inter-base-regular text-grey-50 mt-xsmall">
|
||||
You can now join the team. Sign up below and get started
|
||||
<br />
|
||||
with your Medusa account right away.
|
||||
</p>
|
||||
)}
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="medium"
|
||||
className="mt-xlarge w-[300px]"
|
||||
onClick={() => setSignUp(true)}
|
||||
>
|
||||
Sign up
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</PublicLayout>
|
||||
)}
|
||||
</PublicLayout>
|
||||
</AnalyticsProvider>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user