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:
@@ -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 { getErrorMessage } from "../utils/error-messages"
|
||||||
import FormValidator from "../utils/form-validator"
|
import FormValidator from "../utils/form-validator"
|
||||||
import { useAdminCreateAnalyticsConfig } from "../services/analytics"
|
import { useAdminCreateAnalyticsConfig } from "../services/analytics"
|
||||||
import { useAnalytics } from "../providers/analytics-provider"
|
import {
|
||||||
|
AnalyticsProvider,
|
||||||
|
useAnalytics,
|
||||||
|
} from "../providers/analytics-provider"
|
||||||
import AnalyticsConfigForm, {
|
import AnalyticsConfigForm, {
|
||||||
AnalyticsConfigFormType,
|
AnalyticsConfigFormType,
|
||||||
} from "../components/organisms/analytics-config-form"
|
} from "../components/organisms/analytics-config-form"
|
||||||
import { nestedForm } from "../utils/nested-form"
|
import { nestedForm } from "../utils/nested-form"
|
||||||
|
import { WRITE_KEY } from "../constants/analytics"
|
||||||
|
|
||||||
type FormValues = {
|
type FormValues = {
|
||||||
password: string
|
password: string
|
||||||
@@ -151,88 +155,90 @@ const InvitePage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PublicLayout>
|
<AnalyticsProvider writeKey={WRITE_KEY}>
|
||||||
<SEO title="Create Account" />
|
<PublicLayout>
|
||||||
{signUp ? (
|
<SEO title="Create Account" />
|
||||||
<form onSubmit={handleAcceptInvite}>
|
{signUp ? (
|
||||||
<div className="flex w-[300px] flex-col items-center">
|
<form onSubmit={handleAcceptInvite}>
|
||||||
<h1 className="inter-xlarge-semibold mb-large text-[20px]">
|
<div className="flex w-[300px] flex-col items-center">
|
||||||
Create your Medusa account
|
<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>
|
</h1>
|
||||||
<div className="gap-y-small flex flex-col">
|
{first_run ? (
|
||||||
<div>
|
<p className="inter-base-regular text-grey-50 mt-xsmall">
|
||||||
<SigninInput readOnly placeholder={token.user_email} />
|
Create an admin account to access your <br /> Medusa dashboard.
|
||||||
</div>
|
</p>
|
||||||
<div>
|
) : (
|
||||||
<SigninInput
|
<p className="inter-base-regular text-grey-50 mt-xsmall">
|
||||||
placeholder="Password"
|
You can now join the team. Sign up below and get started
|
||||||
type={"password"}
|
<br />
|
||||||
{...register("password", {
|
with your Medusa account right away.
|
||||||
required: FormValidator.required("Password"),
|
</p>
|
||||||
})}
|
)}
|
||||||
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
|
<Button
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
size="medium"
|
size="medium"
|
||||||
className="mt-large w-[300px]"
|
className="mt-xlarge w-[300px]"
|
||||||
loading={isLoading}
|
onClick={() => setSignUp(true)}
|
||||||
>
|
>
|
||||||
Create account
|
Sign up
|
||||||
</Button>
|
</Button>
|
||||||
<p className="inter-small-regular text-grey-50 mt-xlarge">
|
|
||||||
Already signed up? <a href="/login">Log in</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
)}
|
||||||
) : (
|
</PublicLayout>
|
||||||
<div className="flex flex-col items-center text-center">
|
</AnalyticsProvider>
|
||||||
<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>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user