Skip to content

Commit b9571bf

Browse files
authored
Merge branch 'main' into jr/integration-build-serve
2 parents dcec915 + 6e90b7f commit b9571bf

10 files changed

Lines changed: 70 additions & 7 deletions

File tree

.changeset/fifty-suits-vanish.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/backend": patch
3+
---
4+
5+
Added date filter parameters to user list endpoint
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
---
4+
5+
Fix backwards compatibility for legacy `clerkUICtor` option removed in the `ui` prop PR

.changeset/ready-cats-tease.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/astro': patch
3+
---
4+
5+
Fixed an issue when using `ClientRouter` where Clerk components don't load until navigation is performed.

.changeset/thin-camels-refuse.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/ui": patch
3+
---
4+
5+
Fixed an issue where primary identifier in OAuth consent screen shows undefined when signing in with phone number only

packages/astro/src/integration/create-integration.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,10 @@ function createIntegration<Params extends HotloadAstroClerkIntegrationParams>()
125125
}
126126
127127
if (transitionEnabledOnThisPage()) {
128-
const { navigate, swapFunctions } = await import('astro:transitions/client');
128+
// We must do the dynamic imports within the event listeners because otherwise we may race and miss initial astro:page-load
129+
document.addEventListener('astro:before-swap', async (e) => {
130+
const { swapFunctions } = await import('astro:transitions/client');
129131
130-
document.addEventListener('astro:before-swap', (e) => {
131132
const clerkComponents = document.querySelector('#clerk-components');
132133
// Keep the div element added by Clerk
133134
if (clerkComponents) {
@@ -139,6 +140,8 @@ function createIntegration<Params extends HotloadAstroClerkIntegrationParams>()
139140
});
140141
141142
document.addEventListener('astro:page-load', async (e) => {
143+
const { navigate } = await import('astro:transitions/client');
144+
142145
await runInjectionScript({
143146
...${JSON.stringify(internalParams)},
144147
routerPush: navigate,

packages/backend/src/api/endpoints/UserApi.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ type UserListParams = ClerkPaginationRequest<
4040
| 'last_active_at'
4141
| 'last_sign_in_at'
4242
>;
43+
/**
44+
* @deprecated Use `lastActiveAtAfter` instead. This parameter will be removed in a future version.
45+
*/
4346
last_active_at_since?: number;
47+
lastActiveAtBefore?: number;
48+
lastActiveAtAfter?: number;
49+
createdAtBefore?: number;
50+
createdAtAfter?: number;
4451
lastSignInAtAfter?: number;
4552
lastSignInAtBefore?: number;
4653
organizationId?: string[];

packages/clerk-js/bundlewatch.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"files": [
3-
{ "path": "./dist/clerk.js", "maxSize": "538KB" },
3+
{ "path": "./dist/clerk.js", "maxSize": "539KB" },
44
{ "path": "./dist/clerk.browser.js", "maxSize": "66KB" },
55
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "66KB" },
66
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "106KB" },

packages/clerk-js/src/core/__tests__/clerk.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,5 +2830,31 @@ describe('Clerk singleton', () => {
28302830

28312831
expect(mockClerkUICtor).toHaveBeenCalled();
28322832
});
2833+
2834+
it('supports legacy clerkUICtor option for backwards compatibility', async () => {
2835+
const mockClerkUIInstance = { mount: vi.fn() };
2836+
const mockClerkUICtor = vi.fn(() => mockClerkUIInstance);
2837+
2838+
const sut = new Clerk(productionPublishableKey);
2839+
await sut.load({
2840+
...mockedLoadOptions,
2841+
clerkUICtor: mockClerkUICtor,
2842+
} as any);
2843+
2844+
expect(mockClerkUICtor).toHaveBeenCalled();
2845+
});
2846+
2847+
it('supports legacy clerkUiCtor option for backwards compatibility', async () => {
2848+
const mockClerkUIInstance = { mount: vi.fn() };
2849+
const mockClerkUICtor = vi.fn(() => mockClerkUIInstance);
2850+
2851+
const sut = new Clerk(productionPublishableKey);
2852+
await sut.load({
2853+
...mockedLoadOptions,
2854+
clerkUiCtor: mockClerkUICtor,
2855+
} as any);
2856+
2857+
expect(mockClerkUICtor).toHaveBeenCalled();
2858+
});
28332859
});
28342860
});

packages/clerk-js/src/core/clerk.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,9 +3277,18 @@ export class Clerk implements ClerkInterface {
32773277
};
32783278

32793279
#initOptions = (options?: ClerkOptions): ClerkOptions => {
3280+
// Support legacy clerkUICtor / clerkUiCtor options from older SDK versions.
3281+
// Convert to the new ui.ClerkUI format so the rest of the codebase only checks one path.
3282+
const legacy = options as Record<string, unknown> | undefined;
3283+
const legacyCtor = legacy?.clerkUICtor ?? legacy?.clerkUiCtor;
3284+
const ui = legacyCtor
3285+
? { ...options?.ui, ClerkUI: legacyCtor as NonNullable<ClerkOptions['ui']>['ClerkUI'] }
3286+
: options?.ui;
3287+
32803288
return {
32813289
...defaultOptions,
32823290
...options,
3291+
ui,
32833292
allowedRedirectOrigins: createAllowedRedirectOrigins(
32843293
options?.allowedRedirectOrigins,
32853294
this.frontendApi,

packages/ui/src/components/OAuthConsent/OAuthConsent.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function OAuthConsentInternal() {
2525
const { applicationName, logoImageUrl } = useEnvironment().displayConfig;
2626
const [isUriModalOpen, setIsUriModalOpen] = useState(false);
2727

28-
const primaryEmailAddress = user?.emailAddresses.find(email => email.id === user.primaryEmailAddress?.id);
28+
const primaryIdentifier = user?.primaryEmailAddress?.emailAddress || user?.primaryPhoneNumber?.phoneNumber;
2929

3030
// Filter out offline_access from displayed scopes as it doesn't describe what can be accessed
3131
const displayedScopes = (scopes || []).filter(item => item.scope !== OFFLINE_ACCESS_SCOPE);
@@ -106,9 +106,7 @@ export function OAuthConsentInternal() {
106106
</ConnectionHeader>
107107
)}
108108
<Header.Title localizationKey={oAuthApplicationName} />
109-
<Header.Subtitle
110-
localizationKey={`wants to access ${applicationName} on behalf of ${primaryEmailAddress}`}
111-
/>
109+
<Header.Subtitle localizationKey={`wants to access ${applicationName} on behalf of ${primaryIdentifier}`} />
112110
</Header.Root>
113111
<Box
114112
sx={t => ({

0 commit comments

Comments
 (0)