Skip to content

Commit 99cdf9b

Browse files
authoredOct 16, 2024··
chore(clerk-js,localizations,types): Enhance localization for RestrictedAccess texts,add support btn (#4335)
1 parent ce40ff6 commit 99cdf9b

File tree

6 files changed

+43
-11
lines changed

6 files changed

+43
-11
lines changed
 

‎.changeset/new-bananas-complain.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@clerk/localizations": minor
3+
"@clerk/clerk-js": minor
4+
"@clerk/types": minor
5+
---
6+
7+
The "Restricted access" screen has been improved for visual consistency and the ability to contact support. The displayed texts have been made more clear and the sign-in button has been moved to the bottom.

‎integration/tests/restricted-mode.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ export default function Page() {
102102
await u.po.signUp.goTo();
103103
await u.po.signUp.waitForMounted();
104104

105-
await expect(u.page.getByText(/Restricted access/i).first()).toBeVisible();
106-
const backToSignIn = u.page.getByRole('link', { name: /Back to sign in/i });
105+
await expect(u.page.getByText(/Access restricted/i).first()).toBeVisible();
106+
const backToSignIn = u.page.getByRole('link', { name: /Sign in/i });
107107
await backToSignIn.click();
108108

109109
await u.po.signUp.waitForMounted();
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
import { useClerk } from '@clerk/shared/react';
22

33
import { useSignUpContext } from '../../contexts';
4-
import { Icon, localizationKeys } from '../../customizables';
4+
import { Button, Flex, Icon, localizationKeys } from '../../customizables';
55
import { Card, Header } from '../../elements';
66
import { useCardState } from '../../elements/contexts';
7+
import { useSupportEmail } from '../../hooks/useSupportEmail';
78
import { Block } from '../../icons';
9+
810
export const SignUpRestrictedAccess = () => {
911
const clerk = useClerk();
1012
const card = useCardState();
1113
const { signInUrl } = useSignUpContext();
14+
const supportEmail = useSupportEmail();
15+
16+
const handleEmailSupport = () => {
17+
window.location.href = `mailto:${supportEmail}`;
18+
};
1219

1320
return (
1421
<Card.Root>
@@ -18,22 +25,36 @@ export const SignUpRestrictedAccess = () => {
1825
icon={Block}
1926
sx={t => ({
2027
margin: 'auto',
21-
width: t.sizes.$12,
22-
height: t.sizes.$12,
28+
width: t.sizes.$10,
29+
height: t.sizes.$10,
2330
})}
2431
/>
2532
<Header.Title localizationKey={localizationKeys('signUp.restrictedAccess.title')} />
2633
<Header.Subtitle localizationKey={localizationKeys('signUp.restrictedAccess.subtitle')} />
2734
</Header.Root>
2835
<Card.Alert>{card.error}</Card.Alert>
36+
{supportEmail && (
37+
<Flex
38+
direction='col'
39+
gap={4}
40+
>
41+
<Button
42+
localizationKey={localizationKeys('signUp.restrictedAccess.blockButton__emailSupport')}
43+
onClick={handleEmailSupport}
44+
hasArrow
45+
/>
46+
</Flex>
47+
)}
48+
</Card.Content>
49+
<Card.Footer>
2950
<Card.Action elementId='signUp'>
51+
<Card.ActionText localizationKey={localizationKeys('signUp.restrictedAccess.actionText')} />
3052
<Card.ActionLink
3153
localizationKey={localizationKeys('signUp.restrictedAccess.actionLink')}
3254
to={clerk.buildUrlWithAuth(signInUrl)}
3355
/>
3456
</Card.Action>
35-
</Card.Content>
36-
<Card.Footer />
57+
</Card.Footer>
3758
</Card.Root>
3859
);
3960
};

‎packages/clerk-js/src/ui/components/SignUp/__tests__/SignUpStart.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ describe('SignUpStart', () => {
252252
});
253253

254254
render(<SignUpStart />, { wrapper });
255-
screen.getByText('Restricted access');
255+
screen.getByText('Access restricted');
256256
});
257257
});
258258

‎packages/localizations/src/en-US.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,11 @@ export const enUS: LocalizationResource = {
509509
title: 'Create your account',
510510
},
511511
restrictedAccess: {
512-
title: 'Restricted access',
513-
subtitle: 'Access to this app is limited, and an invitation is required to sign up.',
514-
actionLink: 'Back to sign in',
512+
title: 'Access restricted',
513+
subtitle: 'Sign ups are currently disabled. If you believe you should have access, please contact support.',
514+
actionLink: 'Sign in',
515+
actionText: 'Already have an account?',
516+
blockButton__emailSupport: 'Email support',
515517
},
516518
},
517519
socialButtonsBlockButton: 'Continue with {{provider|titleize}}',

‎packages/types/src/localization.ts

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ type _LocalizationResource = {
148148
title: LocalizationValue;
149149
subtitle: LocalizationValue;
150150
actionLink: LocalizationValue;
151+
actionText: LocalizationValue;
152+
blockButton__emailSupport: LocalizationValue;
151153
};
152154
};
153155
signIn: {

0 commit comments

Comments
 (0)
Please sign in to comment.