feat(MED-97): show person name instead of keycloak email in company invite form
This commit is contained in:
@@ -10,7 +10,7 @@ import { withI18n } from '~/lib/i18n/with-i18n';
|
|||||||
import Cart from '../../_components/cart';
|
import Cart from '../../_components/cart';
|
||||||
import CartTimer from '../../_components/cart/cart-timer';
|
import CartTimer from '../../_components/cart/cart-timer';
|
||||||
import { loadCurrentUserAccount } from '../../_lib/server/load-user-account';
|
import { loadCurrentUserAccount } from '../../_lib/server/load-user-account';
|
||||||
import { AccountBalanceService } from '~/lib/services/accountBalance.service';
|
import { AccountBalanceService } from '@kit/accounts/services/account-balance.service';
|
||||||
|
|
||||||
export async function generateMetadata() {
|
export async function generateMetadata() {
|
||||||
const { t } = await createI18nServerInstance();
|
const { t } = await createI18nServerInstance();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import { Trans } from '@kit/ui/trans';
|
|||||||
|
|
||||||
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
||||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||||
|
import { toTitleCase } from '~/lib/utils';
|
||||||
|
|
||||||
interface JoinTeamAccountPageProps {
|
interface JoinTeamAccountPageProps {
|
||||||
searchParams: Promise<{
|
searchParams: Promise<{
|
||||||
@@ -110,12 +111,12 @@ async function JoinTeamAccountPage(props: JoinTeamAccountPageProps) {
|
|||||||
// once the user accepts the invitation, we redirect them to the account home page
|
// once the user accepts the invitation, we redirect them to the account home page
|
||||||
const membershipConfirmation = pathsConfig.auth.membershipConfirmation;
|
const membershipConfirmation = pathsConfig.auth.membershipConfirmation;
|
||||||
|
|
||||||
const email = auth.data.email ?? '';
|
const fullName = toTitleCase(auth.data.user_metadata.full_name ?? '');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthLayoutShell Logo={AppLogo}>
|
<AuthLayoutShell Logo={AppLogo}>
|
||||||
<AcceptInvitationContainer
|
<AcceptInvitationContainer
|
||||||
email={email}
|
fullName={fullName}
|
||||||
inviteToken={token}
|
inviteToken={token}
|
||||||
invitation={invitation}
|
invitation={invitation}
|
||||||
paths={{
|
paths={{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { HttpTypes } from '@medusajs/types';
|
|||||||
|
|
||||||
import { getAuthHeaders, getCacheOptions } from './cookies';
|
import { getAuthHeaders, getCacheOptions } from './cookies';
|
||||||
|
|
||||||
export const retrieveOrder = async (id: string) => {
|
export const retrieveOrder = async (id: string, allowCache = true) => {
|
||||||
const headers = {
|
const headers = {
|
||||||
...(await getAuthHeaders()),
|
...(await getAuthHeaders()),
|
||||||
};
|
};
|
||||||
@@ -24,7 +24,7 @@ export const retrieveOrder = async (id: string) => {
|
|||||||
},
|
},
|
||||||
headers,
|
headers,
|
||||||
next,
|
next,
|
||||||
cache: 'force-cache',
|
...(allowCache ? { cache: 'force-cache' } : {}),
|
||||||
})
|
})
|
||||||
.then(({ order }) => order)
|
.then(({ order }) => order)
|
||||||
.catch((err) => medusaError(err));
|
.catch((err) => medusaError(err));
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
|
|
||||||
import { useDismissNotification } from '@kit/notifications/hooks';
|
|
||||||
import { Heading } from '@kit/ui/heading';
|
import { Heading } from '@kit/ui/heading';
|
||||||
import { If } from '@kit/ui/if';
|
import { If } from '@kit/ui/if';
|
||||||
import { Separator } from '@kit/ui/separator';
|
import { Separator } from '@kit/ui/separator';
|
||||||
@@ -12,7 +11,7 @@ import { SignOutInvitationButton } from './sign-out-invitation-button';
|
|||||||
|
|
||||||
export function AcceptInvitationContainer(props: {
|
export function AcceptInvitationContainer(props: {
|
||||||
inviteToken: string;
|
inviteToken: string;
|
||||||
email: string;
|
fullName: string;
|
||||||
|
|
||||||
invitation: {
|
invitation: {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -76,7 +75,7 @@ export function AcceptInvitationContainer(props: {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<InvitationSubmitButton
|
<InvitationSubmitButton
|
||||||
email={props.email}
|
fullName={props.fullName}
|
||||||
accountName={props.invitation.account.name}
|
accountName={props.invitation.account.name}
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Trans } from '@kit/ui/trans';
|
|||||||
|
|
||||||
export function InvitationSubmitButton(props: {
|
export function InvitationSubmitButton(props: {
|
||||||
accountName: string;
|
accountName: string;
|
||||||
email: string;
|
fullName: string;
|
||||||
}) {
|
}) {
|
||||||
const { pending } = useFormStatus();
|
const { pending } = useFormStatus();
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ export function InvitationSubmitButton(props: {
|
|||||||
i18nKey={pending ? 'teams:joiningTeam' : 'teams:continueAs'}
|
i18nKey={pending ? 'teams:joiningTeam' : 'teams:continueAs'}
|
||||||
values={{
|
values={{
|
||||||
accountName: props.accountName,
|
accountName: props.accountName,
|
||||||
email: props.email,
|
fullName: props.fullName,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user