From e7476f0e9421d3addff91acebf2325c3cdaf152e Mon Sep 17 00:00:00 2001 From: Jacek Radko Date: Fri, 13 Dec 2024 11:13:56 -0600 Subject: [PATCH 01/10] chore(clerk-react): Additional tests with vitest (#4772) --- .changeset/breezy-foxes-lay.md | 2 + packages/react/.eslintrc.js | 2 +- packages/react/jest.config.js | 24 --- packages/react/package.json | 4 +- .../src/__tests__/isomorphicClerk.test.ts | 11 +- .../__tests__/OrganizationProfile.test.tsx | 1 + .../__tests__/OrganizationSwitcher.test.tsx | 1 + .../src/components/__tests__/SignIn.test.tsx | 1 + .../__tests__/SignInButton.test.tsx | 16 +- .../SignInWithMetamaskButton.test.tsx | 16 +- .../__tests__/SignOutButton.test.tsx | 24 +-- .../src/components/__tests__/SignUp.test.tsx | 1 + .../__tests__/SignUpButton.test.tsx | 34 ++-- .../components/__tests__/UserButton.test.tsx | 1 + .../components/__tests__/UserProfile.test.tsx | 1 + .../src/components/controlComponents.tsx | 12 +- .../contexts/__tests__/ClerkProvider.test.tsx | 3 +- .../useRoutingProps.test.tsx.snap | 8 +- .../src/hooks/__tests__/useAuth.test.tsx | 177 +++++++++++++++++- .../src/hooks/__tests__/useAuth.types.test.ts | 1 + .../hooks/__tests__/useRoutingProps.test.tsx | 15 +- packages/react/src/hooks/useAuth.ts | 26 +++ .../__tests__/useCustomMenuItems.test.tsx | 7 +- .../useMaxAllowedInstancesGuard.test.tsx | 3 +- packages/react/tsup.config.ts | 2 - packages/react/turbo.json | 3 +- packages/react/vitest.config.mts | 13 ++ packages/react/vitest.setup.mts | 8 + 28 files changed, 317 insertions(+), 100 deletions(-) create mode 100644 .changeset/breezy-foxes-lay.md delete mode 100644 packages/react/jest.config.js create mode 100644 packages/react/vitest.config.mts create mode 100644 packages/react/vitest.setup.mts diff --git a/.changeset/breezy-foxes-lay.md b/.changeset/breezy-foxes-lay.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/breezy-foxes-lay.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/react/.eslintrc.js b/packages/react/.eslintrc.js index 15b29bf0e6..829162d863 100644 --- a/packages/react/.eslintrc.js +++ b/packages/react/.eslintrc.js @@ -1,4 +1,4 @@ module.exports = { root: true, - extends: ['@clerk/custom/browser', '@clerk/custom/typescript', '@clerk/custom/jest', '@clerk/custom/react'], + extends: ['@clerk/custom/browser', '@clerk/custom/typescript', '@clerk/custom/react'], }; diff --git a/packages/react/jest.config.js b/packages/react/jest.config.js deleted file mode 100644 index 0b8ddf1fa5..0000000000 --- a/packages/react/jest.config.js +++ /dev/null @@ -1,24 +0,0 @@ -const { name, version } = require('./package.json'); - -module.exports = { - displayName: name.replace('@clerk', ''), - injectGlobals: true, - - roots: ['/src'], - testEnvironment: 'jsdom', - setupFilesAfterEnv: ['../../jest.setup-after-env.ts'], - - moduleDirectories: ['node_modules', '/src'], - transform: { - '^.+\\.m?tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }], - }, - - testRegex: ['/ui/.*/__tests__/.*.test.[jt]sx?$', '/.*.test.[jt]sx?$'], - testPathIgnorePatterns: ['/node_modules/'], - - globals: { - __DEV__: true, - PACKAGE_NAME: name, - PACKAGE_VERSION: version, - }, -}; diff --git a/packages/react/package.json b/packages/react/package.json index c8d1993351..be547a79e1 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -71,9 +71,7 @@ "lint:attw": "attw --pack .", "lint:publint": "publint", "publish:local": "pnpm yalc push --replace --sig", - "test": "jest", - "test:cache:clear": "jest --clearCache --useStderr", - "test:ci": "jest --maxWorkers=70%" + "test": "vitest" }, "dependencies": { "@clerk/shared": "workspace:^", diff --git a/packages/react/src/__tests__/isomorphicClerk.test.ts b/packages/react/src/__tests__/isomorphicClerk.test.ts index 90f17bd441..ed58f91195 100644 --- a/packages/react/src/__tests__/isomorphicClerk.test.ts +++ b/packages/react/src/__tests__/isomorphicClerk.test.ts @@ -1,14 +1,15 @@ import type { Resources, UnsubscribeCallback } from '@clerk/types'; +import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; import { IsomorphicClerk } from '../isomorphicClerk'; describe('isomorphicClerk', () => { beforeAll(() => { - jest.useFakeTimers(); + vi.useFakeTimers(); }); afterAll(() => { - jest.useRealTimers(); + vi.useRealTimers(); }); it('instantiates a IsomorphicClerk instance', () => { @@ -35,10 +36,10 @@ describe('isomorphicClerk', () => { void isomorphicClerk.__unstable__updateProps({ appearance: { baseTheme: 'green' } }); expect(propsHistory).toEqual([]); - jest.spyOn(isomorphicClerk, 'loaded', 'get').mockReturnValue(true); + vi.spyOn(isomorphicClerk, 'loaded', 'get').mockReturnValue(true); isomorphicClerk.emitLoaded(); void isomorphicClerk.__unstable__updateProps({ appearance: { baseTheme: 'white' } }); - await jest.runAllTimersAsync(); + await vi.runAllTimersAsync(); expect(propsHistory).toEqual([ { appearance: { baseTheme: 'dark' } }, @@ -75,7 +76,7 @@ describe('isomorphicClerk', () => { // Unsubscribe one listener before ClerkJS is loaded unsubscribe1(); - jest.spyOn(isomorphicClerk, 'loaded', 'get').mockReturnValue(true); + vi.spyOn(isomorphicClerk, 'loaded', 'get').mockReturnValue(true); isomorphicClerk.emitLoaded(); const unsubscribe3 = isomorphicClerk.addListener(payload => listenerCallHistory.push(payload)); diff --git a/packages/react/src/components/__tests__/OrganizationProfile.test.tsx b/packages/react/src/components/__tests__/OrganizationProfile.test.tsx index 93bb2eb123..6fbeeb3e56 100644 --- a/packages/react/src/components/__tests__/OrganizationProfile.test.tsx +++ b/packages/react/src/components/__tests__/OrganizationProfile.test.tsx @@ -1,5 +1,6 @@ import { expectTypeOf } from 'expect-type'; import type React from 'react'; +import { describe, test } from 'vitest'; import type { OrganizationProfile } from '..'; diff --git a/packages/react/src/components/__tests__/OrganizationSwitcher.test.tsx b/packages/react/src/components/__tests__/OrganizationSwitcher.test.tsx index 75156cfd4f..503980f59e 100644 --- a/packages/react/src/components/__tests__/OrganizationSwitcher.test.tsx +++ b/packages/react/src/components/__tests__/OrganizationSwitcher.test.tsx @@ -1,5 +1,6 @@ import { expectTypeOf } from 'expect-type'; import type React from 'react'; +import { describe, test } from 'vitest'; import type { OrganizationSwitcher } from '..'; diff --git a/packages/react/src/components/__tests__/SignIn.test.tsx b/packages/react/src/components/__tests__/SignIn.test.tsx index a3044c496e..84e67fbf0a 100644 --- a/packages/react/src/components/__tests__/SignIn.test.tsx +++ b/packages/react/src/components/__tests__/SignIn.test.tsx @@ -1,5 +1,6 @@ import { expectTypeOf } from 'expect-type'; import type React from 'react'; +import { describe, test } from 'vitest'; import type { SignIn } from '..'; diff --git a/packages/react/src/components/__tests__/SignInButton.test.tsx b/packages/react/src/components/__tests__/SignInButton.test.tsx index a1b14241b9..b9eba07aa5 100644 --- a/packages/react/src/components/__tests__/SignInButton.test.tsx +++ b/packages/react/src/components/__tests__/SignInButton.test.tsx @@ -1,17 +1,18 @@ import { render, screen } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; +import { userEvent } from '@testing-library/user-event'; import React from 'react'; +import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { SignInButton } from '../SignInButton'; -const mockRedirectToSignIn = jest.fn(); +const mockRedirectToSignIn = vi.fn(); const originalError = console.error; const mockClerk = { redirectToSignIn: mockRedirectToSignIn, } as any; -jest.mock('../withClerk', () => { +vi.mock('../withClerk', () => { return { withClerk: (Component: any) => (props: any) => { return ( @@ -28,7 +29,7 @@ const url = 'https://www.clerk.com'; describe('', () => { beforeAll(() => { - console.error = jest.fn(); + console.error = vi.fn(); }); afterAll(() => { @@ -68,7 +69,7 @@ describe('', () => { }); it('renders passed button and calls both click handlers', async () => { - const handler = jest.fn(); + const handler = vi.fn(); render( @@ -90,10 +91,11 @@ describe('', () => { it('uses text passed as children', async () => { render(text); - screen.getByText('text'); + + await screen.findByText('text'); }); - it('throws if multiple children provided', async () => { + it('throws if multiple children provided', () => { expect(() => { render( diff --git a/packages/react/src/components/__tests__/SignInWithMetamaskButton.test.tsx b/packages/react/src/components/__tests__/SignInWithMetamaskButton.test.tsx index 40580ba45a..55626256d4 100644 --- a/packages/react/src/components/__tests__/SignInWithMetamaskButton.test.tsx +++ b/packages/react/src/components/__tests__/SignInWithMetamaskButton.test.tsx @@ -1,17 +1,18 @@ import { render, screen, waitFor } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; +import { userEvent } from '@testing-library/user-event'; import React from 'react'; +import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { SignInWithMetamaskButton } from '../SignInWithMetamaskButton'; -const mockAuthenticatewithMetamask = jest.fn(); +const mockAuthenticatewithMetamask = vi.fn(); const originalError = console.error; const mockClerk = { authenticateWithMetamask: mockAuthenticatewithMetamask, } as any; -jest.mock('../withClerk', () => { +vi.mock('../withClerk', () => { return { withClerk: (Component: any) => (props: any) => ( { describe('', () => { beforeAll(() => { - console.error = jest.fn(); + console.error = vi.fn(); }); afterAll(() => { @@ -38,7 +39,8 @@ describe('', () => { it('calls clerk.authenticateWithMetamask when clicked', async () => { render(); const btn = screen.getByText('Sign in with Metamask'); - userEvent.click(btn); + await userEvent.click(btn); + await waitFor(() => { expect(mockAuthenticatewithMetamask).toHaveBeenCalled(); }); @@ -53,8 +55,8 @@ describe('', () => { expect(() => { render( - - + + , ); }).toThrow(); diff --git a/packages/react/src/components/__tests__/SignOutButton.test.tsx b/packages/react/src/components/__tests__/SignOutButton.test.tsx index 88058dbd77..2d3813ee62 100644 --- a/packages/react/src/components/__tests__/SignOutButton.test.tsx +++ b/packages/react/src/components/__tests__/SignOutButton.test.tsx @@ -1,17 +1,18 @@ import { render, screen, waitFor } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; +import { userEvent } from '@testing-library/user-event'; import React from 'react'; +import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { SignOutButton } from '../SignOutButton'; -const mockSignOut = jest.fn(); +const mockSignOut = vi.fn(); const originalError = console.error; const mockClerk = { signOut: mockSignOut, } as any; -jest.mock('../withClerk', () => { +vi.mock('../withClerk', () => { return { withClerk: (Component: any) => (props: any) => { return ( @@ -28,7 +29,7 @@ const url = 'https://www.clerk.com'; describe('', () => { beforeAll(() => { - console.error = jest.fn(); + console.error = vi.fn(); }); afterAll(() => { @@ -42,7 +43,7 @@ describe('', () => { it('calls clerk.signOutOne when clicked', async () => { render(); const btn = screen.getByText('Sign out'); - userEvent.click(btn); + await userEvent.click(btn); await waitFor(() => { expect(mockSignOut).toHaveBeenCalled(); }); @@ -51,7 +52,7 @@ describe('', () => { it('handles redirectUrl prop', async () => { render(); const btn = screen.getByText('Sign out'); - userEvent.click(btn); + await userEvent.click(btn); await waitFor(() => { expect(mockSignOut).toHaveBeenCalledWith({ redirectUrl: url }); }); @@ -60,7 +61,7 @@ describe('', () => { it('handles signOutOptions prop', async () => { render(); const btn = screen.getByText('Sign out'); - userEvent.click(btn); + await userEvent.click(btn); await waitFor(() => { expect(mockSignOut).toHaveBeenCalledWith({ redirectUrl: url, sessionId: 'sess_1yDceUR8SIKtQ0gIOO8fNsW7nhe' }); }); @@ -68,15 +69,16 @@ describe('', () => { it('uses text passed as children', async () => { render(text); - screen.getByText('text'); + + await screen.findByText('text'); }); - it('throws if multiple children provided', async () => { + it('throws if multiple children provided', () => { expect(() => { render( - - + + , ); }).toThrow(); diff --git a/packages/react/src/components/__tests__/SignUp.test.tsx b/packages/react/src/components/__tests__/SignUp.test.tsx index c1e6a84985..82afcddeec 100644 --- a/packages/react/src/components/__tests__/SignUp.test.tsx +++ b/packages/react/src/components/__tests__/SignUp.test.tsx @@ -1,5 +1,6 @@ import { expectTypeOf } from 'expect-type'; import type React from 'react'; +import { describe, test } from 'vitest'; import type { SignUp } from '..'; diff --git a/packages/react/src/components/__tests__/SignUpButton.test.tsx b/packages/react/src/components/__tests__/SignUpButton.test.tsx index b1f9f4e755..f3156c19bb 100644 --- a/packages/react/src/components/__tests__/SignUpButton.test.tsx +++ b/packages/react/src/components/__tests__/SignUpButton.test.tsx @@ -1,17 +1,18 @@ import { render, screen, waitFor } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; +import { userEvent } from '@testing-library/user-event'; import React from 'react'; +import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { SignUpButton } from '../SignUpButton'; -const mockRedirectToSignUp = jest.fn(); +const mockRedirectToSignUp = vi.fn(); const originalError = console.error; const mockClerk = { redirectToSignUp: mockRedirectToSignUp, } as any; -jest.mock('../withClerk', () => { +vi.mock('../withClerk', () => { return { withClerk: (Component: any) => (props: any) => { return ( @@ -28,7 +29,7 @@ const url = 'https://www.clerk.com'; describe('', () => { beforeAll(() => { - console.error = jest.fn(); + console.error = vi.fn(); }); afterAll(() => { @@ -42,7 +43,8 @@ describe('', () => { it('calls clerk.redirectToSignUp when clicked', async () => { render(); const btn = screen.getByText('Sign up'); - userEvent.click(btn); + + await userEvent.click(btn); await waitFor(() => { expect(mockRedirectToSignUp).toHaveBeenCalled(); }); @@ -51,7 +53,8 @@ describe('', () => { it('handles forceRedirectUrl prop', async () => { render(); const btn = screen.getByText('Sign up'); - userEvent.click(btn); + + await userEvent.click(btn); await waitFor(() => { expect(mockRedirectToSignUp).toHaveBeenCalledWith({ forceRedirectUrl: url, signUpForceRedirectUrl: url }); }); @@ -60,7 +63,8 @@ describe('', () => { it('handles fallbackRedirectUrl prop', async () => { render(); const btn = screen.getByText('Sign up'); - userEvent.click(btn); + + await userEvent.click(btn); await waitFor(() => { expect(mockRedirectToSignUp).toHaveBeenCalledWith({ fallbackRedirectUrl: url, @@ -70,14 +74,20 @@ describe('', () => { }); it('renders passed button and calls both click handlers', async () => { - const handler = jest.fn(); + const handler = vi.fn(); render( - + , ); const btn = screen.getByText('custom button'); - userEvent.click(btn); + + await userEvent.click(btn); await waitFor(() => { expect(handler).toHaveBeenCalled(); expect(mockRedirectToSignUp).toHaveBeenCalled(); @@ -93,8 +103,8 @@ describe('', () => { expect(() => { render( - - + + , ); }).toThrow(); diff --git a/packages/react/src/components/__tests__/UserButton.test.tsx b/packages/react/src/components/__tests__/UserButton.test.tsx index 6051df91cf..8f58628e39 100644 --- a/packages/react/src/components/__tests__/UserButton.test.tsx +++ b/packages/react/src/components/__tests__/UserButton.test.tsx @@ -1,5 +1,6 @@ import { expectTypeOf } from 'expect-type'; import type React from 'react'; +import { describe, test } from 'vitest'; import type { UserButton } from '..'; diff --git a/packages/react/src/components/__tests__/UserProfile.test.tsx b/packages/react/src/components/__tests__/UserProfile.test.tsx index 71e5378ee2..a68bb336ef 100644 --- a/packages/react/src/components/__tests__/UserProfile.test.tsx +++ b/packages/react/src/components/__tests__/UserProfile.test.tsx @@ -1,5 +1,6 @@ import { expectTypeOf } from 'expect-type'; import type React from 'react'; +import { describe, test } from 'vitest'; import type { UserProfile } from '..'; diff --git a/packages/react/src/components/controlComponents.tsx b/packages/react/src/components/controlComponents.tsx index 4f41ef2486..09359b8fca 100644 --- a/packages/react/src/components/controlComponents.tsx +++ b/packages/react/src/components/controlComponents.tsx @@ -20,7 +20,7 @@ export const SignedIn = ({ children }: React.PropsWithChildren) => { const { userId } = useAuthContext(); if (userId) { - return <>{children}; + return children; } return null; }; @@ -30,7 +30,7 @@ export const SignedOut = ({ children }: React.PropsWithChildren) => { const { userId } = useAuthContext(); if (userId === null) { - return <>{children}; + return children; } return null; }; @@ -42,7 +42,7 @@ export const ClerkLoaded = ({ children }: React.PropsWithChildren) => { if (!isomorphicClerk.loaded) { return null; } - return <>{children}; + return children; }; export const ClerkLoading = ({ children }: React.PropsWithChildren) => { @@ -52,7 +52,7 @@ export const ClerkLoading = ({ children }: React.PropsWithChildren) => if (isomorphicClerk.loaded) { return null; } - return <>{children}; + return children; }; export type ProtectProps = React.PropsWithChildren< @@ -109,9 +109,9 @@ export const Protect = ({ children, fallback, ...restAuthorizedParams }: Protect /** * Fallback to UI provided by user or `null` if authorization checks failed */ - const unauthorized = <>{fallback ?? null}; + const unauthorized = fallback ?? null; - const authorized = <>{children}; + const authorized = children; if (!userId) { return unauthorized; diff --git a/packages/react/src/contexts/__tests__/ClerkProvider.test.tsx b/packages/react/src/contexts/__tests__/ClerkProvider.test.tsx index b6cbeb900c..5c0b3ee0a5 100644 --- a/packages/react/src/contexts/__tests__/ClerkProvider.test.tsx +++ b/packages/react/src/contexts/__tests__/ClerkProvider.test.tsx @@ -17,10 +17,11 @@ import { } from '@clerk/localizations'; import { dark } from '@clerk/themes'; import { expectTypeOf } from 'expect-type'; +import { describe, it } from 'vitest'; import type { ClerkProvider } from '../ClerkProvider'; -//@ts-ignore +// @ts-ignore type ClerkProviderProps = Parameters[0]; describe('ClerkProvider', () => { diff --git a/packages/react/src/hooks/__tests__/__snapshots__/useRoutingProps.test.tsx.snap b/packages/react/src/hooks/__tests__/__snapshots__/useRoutingProps.test.tsx.snap index aad50c7788..0d0e7cb936 100644 --- a/packages/react/src/hooks/__tests__/__snapshots__/useRoutingProps.test.tsx.snap +++ b/packages/react/src/hooks/__tests__/__snapshots__/useRoutingProps.test.tsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`useRoutingProps() path prop has priority over path option 1`] = ` +exports[`useRoutingProps() > path prop has priority over path option 1`] = `
@@ -10,7 +10,7 @@ exports[`useRoutingProps() path prop has priority over path option 1`] = ` `; -exports[`useRoutingProps() the path option is ignored when "hash" routing prop 1`] = ` +exports[`useRoutingProps() > the path option is ignored when "hash" routing prop 1`] = `
@@ -20,7 +20,7 @@ exports[`useRoutingProps() the path option is ignored when "hash" routing prop 1 `; -exports[`useRoutingProps() the path option is ignored when "virtual" routing prop 1`] = ` +exports[`useRoutingProps() > the path option is ignored when "virtual" routing prop 1`] = `
diff --git a/packages/react/src/hooks/__tests__/useAuth.test.tsx b/packages/react/src/hooks/__tests__/useAuth.test.tsx index 5b78c7c836..c4272cff3b 100644 --- a/packages/react/src/hooks/__tests__/useAuth.test.tsx +++ b/packages/react/src/hooks/__tests__/useAuth.test.tsx @@ -1,7 +1,28 @@ -import { render } from '@testing-library/react'; +import { createCheckAuthorization } from '@clerk/shared/authorization'; +import { ClerkInstanceContext } from '@clerk/shared/react'; +import type { LoadedClerk } from '@clerk/types'; +import { render, renderHook } from '@testing-library/react'; import React from 'react'; +import { afterAll, beforeAll, beforeEach, describe, expect, it, test, vi } from 'vitest'; -import { useAuth } from '../useAuth'; +import { AuthContext } from '../../contexts/AuthContext'; +import { errorThrower } from '../../errors/errorThrower'; +import { invalidStateError } from '../../errors/messages'; +import { useAuth, useDerivedAuth } from '../useAuth'; + +vi.mock('@clerk/shared/authorization', async () => ({ + ...(await vi.importActual('@clerk/shared/authorization')), + createCheckAuthorization: vi.fn().mockReturnValue(vi.fn().mockReturnValue(true)), +})); + +vi.mock('../../errors/errorThrower', () => ({ + errorThrower: { + throw: vi.fn(), + throwMissingClerkProviderError: vi.fn(() => { + throw new Error('missing ClerkProvider error'); + }), + }, +})); const TestComponent = () => { const { isLoaded, isSignedIn } = useAuth(); @@ -14,11 +35,157 @@ const TestComponent = () => { }; describe('useAuth', () => { + let consoleErrorSpy: any; + + beforeAll(() => { + consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {}); + }); + + afterAll(() => { + consoleErrorSpy.mockRestore(); + }); + test('throws an error if not wrapped in ', () => { expect(() => { render(); - }).toThrow( - '@clerk/clerk-react: useAuth can only be used within the component. Learn more: https://clerk.com/docs/components/clerk-provider', - ); + }).toThrow('missing ClerkProvider error'); + }); + + test('renders the correct values when wrapped in ', () => { + expect(() => { + render( + + + + + , + ); + }).not.toThrow(); + }); +}); + +describe('useDerivedAuth', () => { + beforeEach(() => { + vi.clearAllMocks(); + }); + + it('returns not loaded state when sessionId and userId are undefined', () => { + const { + result: { current }, + } = renderHook(() => useDerivedAuth({})); + + expect(current.isLoaded).toBe(false); + expect(current.isSignedIn).toBeUndefined(); + expect(current.sessionId).toBeUndefined(); + expect(current.userId).toBeUndefined(); + expect(current.actor).toBeUndefined(); + expect(current.orgId).toBeUndefined(); + expect(current.orgRole).toBeUndefined(); + expect(current.orgSlug).toBeUndefined(); + expect(current.has).toBeUndefined(); + }); + + it('returns loaded but not signed in when sessionId and userId are null', () => { + const { + result: { current }, + } = renderHook(() => useDerivedAuth({ sessionId: null, userId: null })); + expect(current.isLoaded).toBe(true); + expect(current.isSignedIn).toBe(false); + expect(current.sessionId).toBeNull(); + expect(current.userId).toBeNull(); + expect(current.actor).toBeNull(); + expect(current.orgId).toBeNull(); + expect(current.orgRole).toBeNull(); + expect(current.orgSlug).toBeNull(); + expect(current.has).toBeInstanceOf(Function); + expect(current.has?.({ permission: 'test' })).toBe(false); + }); + + it('returns signed in with org context when sessionId, userId, orgId, and orgRole are present', () => { + const authObject = { + sessionId: 'session123', + userId: 'user123', + actor: 'actor123', + orgId: 'org123', + orgRole: 'admin', + orgSlug: 'my-org', + signOut: vi.fn(), + getToken: vi.fn(), + }; + + const { + result: { current }, + } = renderHook(() => useDerivedAuth(authObject)); + + expect(current.isLoaded).toBe(true); + expect(current.isSignedIn).toBe(true); + expect(current.sessionId).toBe('session123'); + expect(current.userId).toBe('user123'); + expect(current.actor).toBe('actor123'); + expect(current.orgId).toBe('org123'); + expect(current.orgRole).toBe('admin'); + expect(current.orgSlug).toBe('my-org'); + expect(typeof current.has).toBe('function'); + expect(current.signOut).toBe(authObject.signOut); + expect(current.getToken).toBe(authObject.getToken); + + // Check has function behavior + vi.mocked(createCheckAuthorization).mockReturnValueOnce(vi.fn().mockReturnValue('authorized')); + expect(current.has?.({ permission: 'read' })).toBe('authorized'); + }); + + it('returns signed in without org context when sessionId and userId are present but no orgId', () => { + const authObject = { + sessionId: 'session123', + userId: 'user123', + actor: 'actor123', + signOut: vi.fn(), + getToken: vi.fn(), + }; + const { + result: { current }, + } = renderHook(() => useDerivedAuth(authObject)); + + expect(current.isLoaded).toBe(true); + expect(current.isSignedIn).toBe(true); + expect(current.sessionId).toBe('session123'); + expect(current.userId).toBe('user123'); + expect(current.actor).toBe('actor123'); + expect(current.orgId).toBeNull(); + expect(current.orgRole).toBeNull(); + expect(current.orgSlug).toBeNull(); + expect(typeof current.has).toBe('function'); + expect(current.signOut).toBe(authObject.signOut); + expect(current.getToken).toBe(authObject.getToken); + + // Check derivedHas fallback + vi.mocked(createCheckAuthorization).mockReturnValueOnce(vi.fn().mockReturnValue(false)); + expect(current.has?.({ permission: 'read' })).toBe(false); + }); + + it('throws invalid state error if none of the conditions match', () => { + const authObject = { + sessionId: true, + userId: undefined, + }; + renderHook(() => useDerivedAuth(authObject)); + + // eslint-disable-next-line @typescript-eslint/unbound-method + expect(errorThrower.throw).toHaveBeenCalledWith(invalidStateError); + }); + + it('uses provided has function if available', () => { + const mockHas = vi.fn().mockReturnValue('mocked-result'); + const authObject = { + sessionId: 'session123', + userId: 'user123', + has: mockHas, + }; + const { + result: { current }, + } = renderHook(() => useDerivedAuth(authObject)); + + expect(current.has?.({ permission: 'test' })).toBe('mocked-result'); + expect(mockHas).toHaveBeenCalledWith({ permission: 'test' }); }); }); diff --git a/packages/react/src/hooks/__tests__/useAuth.types.test.ts b/packages/react/src/hooks/__tests__/useAuth.types.test.ts index b7a29cdbd4..b7f4357741 100644 --- a/packages/react/src/hooks/__tests__/useAuth.types.test.ts +++ b/packages/react/src/hooks/__tests__/useAuth.types.test.ts @@ -1,4 +1,5 @@ import { expectTypeOf } from 'expect-type'; +import { describe, it } from 'vitest'; import type { useAuth } from '../useAuth'; diff --git a/packages/react/src/hooks/__tests__/useRoutingProps.test.tsx b/packages/react/src/hooks/__tests__/useRoutingProps.test.tsx index f363ee03e8..1fe95aaa89 100644 --- a/packages/react/src/hooks/__tests__/useRoutingProps.test.tsx +++ b/packages/react/src/hooks/__tests__/useRoutingProps.test.tsx @@ -1,5 +1,6 @@ import { render } from '@testing-library/react'; import React from 'react'; +import { afterAll, beforeAll, describe, expect, test, vi } from 'vitest'; import { useRoutingProps } from '../useRoutingProps'; @@ -7,14 +8,14 @@ const originalError = console.error; describe('useRoutingProps()', () => { beforeAll(() => { - console.error = jest.fn(); + console.error = vi.fn(); }); afterAll(() => { console.error = originalError; }); - it('defaults to path routing and a path prop is required', () => { + test('defaults to path routing and a path prop is required', () => { const TestingComponent = props => { const options = useRoutingProps('TestingComponent', props); return
{JSON.stringify(options)}
; @@ -25,7 +26,7 @@ describe('useRoutingProps()', () => { }).toThrowError(/@clerk\/clerk-react: The component uses path-based routing by default/); }); - it('the path option is ignored when "hash" routing prop', () => { + test('the path option is ignored when "hash" routing prop', () => { const TestingComponent = props => { const options = useRoutingProps('TestingComponent', props, { path: '/path-option' }); return
{JSON.stringify(options)}
; @@ -41,7 +42,7 @@ describe('useRoutingProps()', () => { expect(baseElement).toMatchSnapshot(); }); - it('the path option is ignored when "virtual" routing prop', () => { + test('the path option is ignored when "virtual" routing prop', () => { const TestingComponent = props => { const options = useRoutingProps('TestingComponent', props, { path: '/path-option' }); return
{JSON.stringify(options)}
; @@ -57,7 +58,7 @@ describe('useRoutingProps()', () => { expect(baseElement).toMatchSnapshot(); }); - it('throws error when "hash" routing and path prop are set', () => { + test('throws error when "hash" routing and path prop are set', () => { const TestingComponent = props => { const options = useRoutingProps('TestingComponent', props); return
{JSON.stringify(options)}
; @@ -75,7 +76,7 @@ describe('useRoutingProps()', () => { ); }); - it('throws error when "virtual" routing and path prop are set', () => { + test('throws error when "virtual" routing and path prop are set', () => { const TestingComponent = props => { const options = useRoutingProps('TestingComponent', props); return
{JSON.stringify(options)}
; @@ -93,7 +94,7 @@ describe('useRoutingProps()', () => { ); }); - it('path prop has priority over path option', () => { + test('path prop has priority over path option', () => { const TestingComponent = props => { const options = useRoutingProps('TestingComponent', props, { path: '/path-option' }); return
{JSON.stringify(options)}
; diff --git a/packages/react/src/hooks/useAuth.ts b/packages/react/src/hooks/useAuth.ts index bb3a56a4d6..4598fd4226 100644 --- a/packages/react/src/hooks/useAuth.ts +++ b/packages/react/src/hooks/useAuth.ts @@ -77,6 +77,32 @@ export const useAuth: UseAuth = (initialAuthState = {}) => { }); }; +/** + * A hook that derives and returns authentication state and utility functions based on the provided auth object. + * + * @param authObject - An object containing authentication-related properties and functions. + * + * @returns A derived authentication state with helper methods. If the authentication state is invalid, an error is thrown. + * + * @remarks + * This hook inspects session, user, and organization information to determine the current authentication state. + * It returns an object that includes various properties such as whether the state is loaded, if a user is signed in, + * session and user identifiers, organization roles, and a `has` function for authorization checks. + * Additionally, it provides `signOut` and `getToken` functions if applicable. + * + * Example usage: + * ```tsx + * const { + * isLoaded, + * isSignedIn, + * userId, + * orgId, + * has, + * signOut, + * getToken + * } = useDerivedAuth(authObject); + * ``` + */ export function useDerivedAuth(authObject: any): UseAuthReturn { const { sessionId, diff --git a/packages/react/src/utils/__tests__/useCustomMenuItems.test.tsx b/packages/react/src/utils/__tests__/useCustomMenuItems.test.tsx index a7c7528f07..b748226b25 100644 --- a/packages/react/src/utils/__tests__/useCustomMenuItems.test.tsx +++ b/packages/react/src/utils/__tests__/useCustomMenuItems.test.tsx @@ -1,12 +1,13 @@ import { renderHook } from '@testing-library/react'; import React from 'react'; +import { describe, expect, it, vi } from 'vitest'; import { MenuAction, MenuItems, MenuLink } from '../../components/uiComponents'; import { useUserButtonCustomMenuItems } from '../useCustomMenuItems'; // Mock the logErrorInDevMode function -jest.mock('@clerk/shared', () => ({ - logErrorInDevMode: jest.fn(), +vi.mock('@clerk/shared', () => ({ + logErrorInDevMode: vi.fn(), })); describe('useUserButtonCustomMenuItems', () => { @@ -108,7 +109,7 @@ describe('useUserButtonCustomMenuItems', () => { }); it('should process valid MenuAction items and call onClick when triggered', () => { - const mockOnClick = jest.fn(); + const mockOnClick = vi.fn(); const children = ( { beforeAll(() => { - console.error = jest.fn(); + console.error = vi.fn(); }); afterAll(() => { diff --git a/packages/react/tsup.config.ts b/packages/react/tsup.config.ts index d6c36bf4de..d0290c0e12 100644 --- a/packages/react/tsup.config.ts +++ b/packages/react/tsup.config.ts @@ -1,8 +1,6 @@ import { defineConfig } from 'tsup'; -// @ts-expect-error for `import module with '.json' extension` import { version as clerkJsVersion } from '../clerk-js/package.json'; -// @ts-expect-error for `import module with '.json' extension` import { name, version } from './package.json'; export default defineConfig(overrideOptions => { diff --git a/packages/react/turbo.json b/packages/react/turbo.json index e8bcbfeee0..71a56e92f1 100644 --- a/packages/react/turbo.json +++ b/packages/react/turbo.json @@ -6,8 +6,9 @@ "inputs": [ "**/__test__/**", "*.d.ts", - "jest.*", "src/**", + "vitest.config.mts", + "vitest.setup.mts", "tsconfig.json", "tsconfig.*.json", "tsup.config.ts", diff --git a/packages/react/vitest.config.mts b/packages/react/vitest.config.mts new file mode 100644 index 0000000000..b28aa67a58 --- /dev/null +++ b/packages/react/vitest.config.mts @@ -0,0 +1,13 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + plugins: [], + test: { + env: { + CLERK_SECRET_KEY: 'TEST_SECRET_KEY', + }, + environment: 'jsdom', + includeSource: ['**/*.{js,ts,jsx,tsx}'], + setupFiles: './vitest.setup.mts', + }, +}); diff --git a/packages/react/vitest.setup.mts b/packages/react/vitest.setup.mts new file mode 100644 index 0000000000..46a9c43405 --- /dev/null +++ b/packages/react/vitest.setup.mts @@ -0,0 +1,8 @@ +import { afterEach } from 'vitest'; +import { cleanup } from '@testing-library/react'; + +globalThis.__DEV__ = true; +globalThis.PACKAGE_NAME = '@clerk/clerk-react'; +globalThis.PACKAGE_VERSION = '0.0.0-test'; + +afterEach(cleanup); From acd9326ef2d6942b981b3ee59c4b20ddd303323d Mon Sep 17 00:00:00 2001 From: Stefanos Anagnostou Date: Fri, 13 Dec 2024 19:49:59 +0200 Subject: [PATCH 02/10] fix(clerk-js,types,clerk-expo): Rename `toJSON` to `__internal_toSnapshot` on resources (#4777) --- .changeset/strong-hounds-train.md | 7 + .../clerk-js/src/core/resources/AuthConfig.ts | 2 +- .../clerk-js/src/core/resources/Client.ts | 8 +- .../src/core/resources/DisplayConfig.ts | 2 +- .../src/core/resources/EmailAddress.ts | 6 +- .../src/core/resources/EnterpriseAccount.ts | 8 +- .../src/core/resources/Environment.ts | 10 +- .../src/core/resources/ExternalAccount.ts | 4 +- .../src/core/resources/IdentificationLink.ts | 2 +- .../src/core/resources/Organization.ts | 2 +- .../core/resources/OrganizationMembership.ts | 6 +- .../core/resources/OrganizationSettings.ts | 2 +- .../clerk-js/src/core/resources/Passkey.ts | 4 +- .../src/core/resources/PhoneNumber.ts | 6 +- .../src/core/resources/PublicUserData.ts | 2 +- .../src/core/resources/SamlAccount.ts | 8 +- .../clerk-js/src/core/resources/Session.ts | 8 +- .../clerk-js/src/core/resources/SignIn.ts | 8 +- .../clerk-js/src/core/resources/SignUp.ts | 4 +- packages/clerk-js/src/core/resources/Token.ts | 2 +- packages/clerk-js/src/core/resources/User.ts | 18 +- .../clerk-js/src/core/resources/UserData.ts | 2 +- .../src/core/resources/UserSettings.ts | 2 +- .../src/core/resources/Verification.ts | 16 +- .../clerk-js/src/core/resources/Web3Wallet.ts | 4 +- .../core/resources/__tests__/Client.test.ts | 136 +++++++++ .../resources/__tests__/Environment.test.ts | 233 ++++++++++++++ .../__snapshots__/Client.test.ts.snap | 232 ++++++++++++++ .../__snapshots__/Environment.test.ts.snap | 284 ++++++++++++++++++ .../__snapshots__/Organization.test.ts.snap | 37 ++- .../OrganizationMembership.test.ts.snap | 63 ++-- ...OrganizationMembershipRequest.test.ts.snap | 14 +- .../__snapshots__/Session.test.ts.snap | 58 +++- .../provider/singleton/createClerkInstance.ts | 4 +- packages/types/src/authConfig.ts | 2 +- packages/types/src/client.ts | 2 +- packages/types/src/displayConfig.ts | 2 +- packages/types/src/emailAddress.ts | 2 +- packages/types/src/enterpriseAccount.ts | 4 +- packages/types/src/environment.ts | 2 +- packages/types/src/externalAccount.ts | 2 +- packages/types/src/identificationLink.ts | 2 +- packages/types/src/organization.ts | 2 +- packages/types/src/organizationMembership.ts | 2 +- packages/types/src/organizationSettings.ts | 2 +- packages/types/src/passkey.ts | 2 +- packages/types/src/phoneNumber.ts | 2 +- packages/types/src/samlAccount.ts | 2 +- packages/types/src/samlConnection.ts | 2 +- packages/types/src/session.ts | 2 +- packages/types/src/signIn.ts | 2 +- packages/types/src/signUp.ts | 6 +- packages/types/src/snapshots.ts | 2 +- packages/types/src/token.ts | 2 +- packages/types/src/user.ts | 2 +- packages/types/src/userSettings.ts | 2 +- packages/types/src/verification.ts | 2 +- packages/types/src/web3Wallet.ts | 2 +- 58 files changed, 1110 insertions(+), 148 deletions(-) create mode 100644 .changeset/strong-hounds-train.md diff --git a/.changeset/strong-hounds-train.md b/.changeset/strong-hounds-train.md new file mode 100644 index 0000000000..a18bc7b164 --- /dev/null +++ b/.changeset/strong-hounds-train.md @@ -0,0 +1,7 @@ +--- +'@clerk/clerk-js': patch +'@clerk/types': patch +'@clerk/clerk-expo': patch +--- + +Rename `toJSON()` resource methods to `__internal_toSnapshot()` to avoid issues with serializing functions. diff --git a/packages/clerk-js/src/core/resources/AuthConfig.ts b/packages/clerk-js/src/core/resources/AuthConfig.ts index 44a8194629..dae725e7db 100644 --- a/packages/clerk-js/src/core/resources/AuthConfig.ts +++ b/packages/clerk-js/src/core/resources/AuthConfig.ts @@ -18,7 +18,7 @@ export class AuthConfig extends BaseResource implements AuthConfigResource { return this; } - public toJSON(): AuthConfigJSONSnapshot { + public __internal_toSnapshot(): AuthConfigJSONSnapshot { return { object: 'auth_config', id: this.id || '', diff --git a/packages/clerk-js/src/core/resources/Client.ts b/packages/clerk-js/src/core/resources/Client.ts index 4764a73d0e..09a76e5704 100644 --- a/packages/clerk-js/src/core/resources/Client.ts +++ b/packages/clerk-js/src/core/resources/Client.ts @@ -124,14 +124,14 @@ export class Client extends BaseResource implements ClientResource { return this; } - public toJSON(): ClientJSONSnapshot { + public __internal_toSnapshot(): ClientJSONSnapshot { return { object: 'client', status: null, id: this.id || '', - sessions: this.sessions.map(s => s.toJSON()), - sign_up: this.signUp.toJSON(), - sign_in: this.signIn.toJSON(), + sessions: this.sessions.map(s => s.__internal_toSnapshot()), + sign_up: this.signUp.__internal_toSnapshot(), + sign_in: this.signIn.__internal_toSnapshot(), last_active_session_id: this.lastActiveSessionId, cookie_expires_at: this.cookieExpiresAt ? this.cookieExpiresAt.getTime() : null, created_at: this.createdAt?.getTime() ?? null, diff --git a/packages/clerk-js/src/core/resources/DisplayConfig.ts b/packages/clerk-js/src/core/resources/DisplayConfig.ts index 6b5f51f70d..c9fb68c4a8 100644 --- a/packages/clerk-js/src/core/resources/DisplayConfig.ts +++ b/packages/clerk-js/src/core/resources/DisplayConfig.ts @@ -103,7 +103,7 @@ export class DisplayConfig extends BaseResource implements DisplayConfigResource return this; } - public toJSON(): DisplayConfigJSONSnapshot { + public __internal_toSnapshot(): DisplayConfigJSONSnapshot { return { object: 'display_config', id: this.id, diff --git a/packages/clerk-js/src/core/resources/EmailAddress.ts b/packages/clerk-js/src/core/resources/EmailAddress.ts index 8b05621749..31bed1f4b4 100644 --- a/packages/clerk-js/src/core/resources/EmailAddress.ts +++ b/packages/clerk-js/src/core/resources/EmailAddress.ts @@ -94,13 +94,13 @@ export class EmailAddress extends BaseResource implements EmailAddressResource { return this; } - public toJSON(): EmailAddressJSONSnapshot { + public __internal_toSnapshot(): EmailAddressJSONSnapshot { return { object: 'email_address', id: this.id, email_address: this.emailAddress, - verification: this.verification.toJSON(), - linked_to: this.linkedTo.map(link => link.toJSON()), + verification: this.verification.__internal_toSnapshot(), + linked_to: this.linkedTo.map(link => link.__internal_toSnapshot()), }; } } diff --git a/packages/clerk-js/src/core/resources/EnterpriseAccount.ts b/packages/clerk-js/src/core/resources/EnterpriseAccount.ts index 7269c30f14..8a884c089f 100644 --- a/packages/clerk-js/src/core/resources/EnterpriseAccount.ts +++ b/packages/clerk-js/src/core/resources/EnterpriseAccount.ts @@ -58,7 +58,7 @@ export class EnterpriseAccount extends BaseResource implements EnterpriseAccount return this; } - public toJSON(): EnterpriseAccountJSONSnapshot { + public __internal_toSnapshot(): EnterpriseAccountJSONSnapshot { return { object: 'enterprise_account', id: this.id, @@ -70,8 +70,8 @@ export class EnterpriseAccount extends BaseResource implements EnterpriseAccount first_name: this.firstName, last_name: this.lastName, public_metadata: this.publicMetadata, - verification: this.verification?.toJSON() || null, - enterprise_connection: this.enterpriseConnection?.toJSON() || null, + verification: this.verification?.__internal_toSnapshot() || null, + enterprise_connection: this.enterpriseConnection?.__internal_toSnapshot() || null, }; } } @@ -115,7 +115,7 @@ export class EnterpriseAccountConnection extends BaseResource implements Enterpr return this; } - public toJSON(): EnterpriseAccountConnectionJSONSnapshot { + public __internal_toSnapshot(): EnterpriseAccountConnectionJSONSnapshot { return { object: 'enterprise_account_connection', id: this.id, diff --git a/packages/clerk-js/src/core/resources/Environment.ts b/packages/clerk-js/src/core/resources/Environment.ts index acccc55591..7a9d9b379c 100644 --- a/packages/clerk-js/src/core/resources/Environment.ts +++ b/packages/clerk-js/src/core/resources/Environment.ts @@ -68,14 +68,14 @@ export class Environment extends BaseResource implements EnvironmentResource { return this; } - public toJSON(): EnvironmentJSONSnapshot { + public __internal_toSnapshot(): EnvironmentJSONSnapshot { return { object: 'environment', id: this.id || '', - auth_config: this.authConfig.toJSON(), - display_config: this.displayConfig.toJSON(), - user_settings: this.userSettings.toJSON(), - organization_settings: this.organizationSettings.toJSON(), + auth_config: this.authConfig.__internal_toSnapshot(), + display_config: this.displayConfig.__internal_toSnapshot(), + user_settings: this.userSettings.__internal_toSnapshot(), + organization_settings: this.organizationSettings.__internal_toSnapshot(), maintenance_mode: this.maintenanceMode, }; } diff --git a/packages/clerk-js/src/core/resources/ExternalAccount.ts b/packages/clerk-js/src/core/resources/ExternalAccount.ts index e6bd2c9321..eb40c0f49c 100644 --- a/packages/clerk-js/src/core/resources/ExternalAccount.ts +++ b/packages/clerk-js/src/core/resources/ExternalAccount.ts @@ -68,7 +68,7 @@ export class ExternalAccount extends BaseResource implements ExternalAccountReso return this; } - public toJSON(): ExternalAccountJSONSnapshot { + public __internal_toSnapshot(): ExternalAccountJSONSnapshot { return { object: 'external_account', id: this.id, @@ -83,7 +83,7 @@ export class ExternalAccount extends BaseResource implements ExternalAccountReso username: this.username, public_metadata: this.publicMetadata, label: this.label, - verification: this.verification?.toJSON() || null, + verification: this.verification?.__internal_toSnapshot() || null, }; } diff --git a/packages/clerk-js/src/core/resources/IdentificationLink.ts b/packages/clerk-js/src/core/resources/IdentificationLink.ts index 4ccbf3c59c..72c497906a 100644 --- a/packages/clerk-js/src/core/resources/IdentificationLink.ts +++ b/packages/clerk-js/src/core/resources/IdentificationLink.ts @@ -21,7 +21,7 @@ export class IdentificationLink extends BaseResource implements IdentificationLi return this; } - public toJSON(): IdentificationLinkJSONSnapshot { + public __internal_toSnapshot(): IdentificationLinkJSONSnapshot { return { object: 'identification_link', id: this.id, diff --git a/packages/clerk-js/src/core/resources/Organization.ts b/packages/clerk-js/src/core/resources/Organization.ts index 57f12ffabf..314f36c7b6 100644 --- a/packages/clerk-js/src/core/resources/Organization.ts +++ b/packages/clerk-js/src/core/resources/Organization.ts @@ -281,7 +281,7 @@ export class Organization extends BaseResource implements OrganizationResource { return this; } - public toJSON(): OrganizationJSONSnapshot { + public __internal_toSnapshot(): OrganizationJSONSnapshot { return { object: 'organization', id: this.id, diff --git a/packages/clerk-js/src/core/resources/OrganizationMembership.ts b/packages/clerk-js/src/core/resources/OrganizationMembership.ts index e1afa2b1a2..52a5e936ea 100644 --- a/packages/clerk-js/src/core/resources/OrganizationMembership.ts +++ b/packages/clerk-js/src/core/resources/OrganizationMembership.ts @@ -80,13 +80,13 @@ export class OrganizationMembership extends BaseResource implements Organization return this; } - public toJSON(): OrganizationMembershipJSONSnapshot { + public __internal_toSnapshot(): OrganizationMembershipJSONSnapshot { return { object: 'organization_membership', id: this.id, - organization: this.organization.toJSON(), + organization: this.organization.__internal_toSnapshot(), public_metadata: this.publicMetadata, - public_user_data: this.publicUserData.toJSON(), + public_user_data: this.publicUserData.__internal_toSnapshot(), permissions: this.permissions, role: this.role, created_at: this.createdAt.getTime(), diff --git a/packages/clerk-js/src/core/resources/OrganizationSettings.ts b/packages/clerk-js/src/core/resources/OrganizationSettings.ts index 2094af7175..183f8e55b4 100644 --- a/packages/clerk-js/src/core/resources/OrganizationSettings.ts +++ b/packages/clerk-js/src/core/resources/OrganizationSettings.ts @@ -37,7 +37,7 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe return this; } - public toJSON(): OrganizationSettingsJSONSnapshot { + public __internal_toSnapshot(): OrganizationSettingsJSONSnapshot { return { enabled: this.enabled, max_allowed_memberships: this.maxAllowedMemberships, diff --git a/packages/clerk-js/src/core/resources/Passkey.ts b/packages/clerk-js/src/core/resources/Passkey.ts index ed9b9d42ee..34cb80868b 100644 --- a/packages/clerk-js/src/core/resources/Passkey.ts +++ b/packages/clerk-js/src/core/resources/Passkey.ts @@ -146,12 +146,12 @@ export class Passkey extends BaseResource implements PasskeyResource { return this; } - public toJSON(): PasskeyJSONSnapshot { + public __internal_toSnapshot(): PasskeyJSONSnapshot { return { object: 'passkey', id: this.id, name: this.name, - verification: this.verification?.toJSON() || null, + verification: this.verification?.__internal_toSnapshot() || null, last_used_at: this.lastUsedAt?.getTime() || null, created_at: this.createdAt.getTime(), updated_at: this.updatedAt.getTime(), diff --git a/packages/clerk-js/src/core/resources/PhoneNumber.ts b/packages/clerk-js/src/core/resources/PhoneNumber.ts index 89ca781238..2d10ff8ba2 100644 --- a/packages/clerk-js/src/core/resources/PhoneNumber.ts +++ b/packages/clerk-js/src/core/resources/PhoneNumber.ts @@ -86,15 +86,15 @@ export class PhoneNumber extends BaseResource implements PhoneNumberResource { return this; } - public toJSON(): PhoneNumberJSONSnapshot { + public __internal_toSnapshot(): PhoneNumberJSONSnapshot { return { object: 'phone_number', id: this.id || '', phone_number: this.phoneNumber, reserved_for_second_factor: this.reservedForSecondFactor, default_second_factor: this.defaultSecondFactor, - verification: this.verification.toJSON(), - linked_to: this.linkedTo.map(link => link.toJSON()), + verification: this.verification.__internal_toSnapshot(), + linked_to: this.linkedTo.map(link => link.__internal_toSnapshot()), backup_codes: this.backupCodes, }; } diff --git a/packages/clerk-js/src/core/resources/PublicUserData.ts b/packages/clerk-js/src/core/resources/PublicUserData.ts index df1a497482..5025345917 100644 --- a/packages/clerk-js/src/core/resources/PublicUserData.ts +++ b/packages/clerk-js/src/core/resources/PublicUserData.ts @@ -25,7 +25,7 @@ export class PublicUserData implements IPublicUserData { return this; } - public toJSON(): PublicUserDataJSONSnapshot { + public __internal_toSnapshot(): PublicUserDataJSONSnapshot { return { object: 'public_user_data', id: this.userId || '', diff --git a/packages/clerk-js/src/core/resources/SamlAccount.ts b/packages/clerk-js/src/core/resources/SamlAccount.ts index c0cf4b7d1f..1fb407edb3 100644 --- a/packages/clerk-js/src/core/resources/SamlAccount.ts +++ b/packages/clerk-js/src/core/resources/SamlAccount.ts @@ -55,7 +55,7 @@ export class SamlAccount extends BaseResource implements SamlAccountResource { return this; } - public toJSON(): SamlAccountJSONSnapshot { + public __internal_toSnapshot(): SamlAccountJSONSnapshot { return { object: 'saml_account', id: this.id, @@ -65,8 +65,8 @@ export class SamlAccount extends BaseResource implements SamlAccountResource { email_address: this.emailAddress, first_name: this.firstName, last_name: this.lastName, - verification: this.verification?.toJSON() || null, - saml_connection: this.samlConnection?.toJSON(), + verification: this.verification?.__internal_toSnapshot() || null, + saml_connection: this.samlConnection?.__internal_toSnapshot(), }; } } @@ -106,7 +106,7 @@ export class SamlAccountConnection extends BaseResource implements SamlAccountCo return this; } - public toJSON(): SamlAccountConnectionJSONSnapshot { + public __internal_toSnapshot(): SamlAccountConnectionJSONSnapshot { return { object: 'saml_account_connection', id: this.id, diff --git a/packages/clerk-js/src/core/resources/Session.ts b/packages/clerk-js/src/core/resources/Session.ts index b81d0b2b25..2a6c1b6e3a 100644 --- a/packages/clerk-js/src/core/resources/Session.ts +++ b/packages/clerk-js/src/core/resources/Session.ts @@ -234,7 +234,7 @@ export class Session extends BaseResource implements SessionResource { return this; } - public toJSON(): SessionJSONSnapshot { + public __internal_toSnapshot(): SessionJSONSnapshot { return { object: 'session', id: this.id, @@ -245,9 +245,9 @@ export class Session extends BaseResource implements SessionResource { last_active_at: this.lastActiveAt.getTime(), last_active_organization_id: this.lastActiveOrganizationId, actor: this.actor, - user: this.user?.toJSON() || null, - public_user_data: this.publicUserData.toJSON(), - last_active_token: this.lastActiveToken?.toJSON() || null, + user: this.user?.__internal_toSnapshot() || null, + public_user_data: this.publicUserData.__internal_toSnapshot(), + last_active_token: this.lastActiveToken?.__internal_toSnapshot() || null, created_at: this.createdAt.getTime(), updated_at: this.updatedAt.getTime(), }; diff --git a/packages/clerk-js/src/core/resources/SignIn.ts b/packages/clerk-js/src/core/resources/SignIn.ts index bceead989b..8a1f2c8504 100644 --- a/packages/clerk-js/src/core/resources/SignIn.ts +++ b/packages/clerk-js/src/core/resources/SignIn.ts @@ -437,7 +437,7 @@ export class SignIn extends BaseResource implements SignInResource { return this; } - public toJSON(): SignInJSONSnapshot { + public __internal_toSnapshot(): SignInJSONSnapshot { return { object: 'sign_in', id: this.id || '', @@ -445,11 +445,11 @@ export class SignIn extends BaseResource implements SignInResource { supported_identifiers: this.supportedIdentifiers, supported_first_factors: deepCamelToSnake(this.supportedFirstFactors), supported_second_factors: deepCamelToSnake(this.supportedSecondFactors), - first_factor_verification: this.firstFactorVerification.toJSON(), - second_factor_verification: this.secondFactorVerification.toJSON(), + first_factor_verification: this.firstFactorVerification.__internal_toSnapshot(), + second_factor_verification: this.secondFactorVerification.__internal_toSnapshot(), identifier: this.identifier, created_session_id: this.createdSessionId, - user_data: this.userData.toJSON(), + user_data: this.userData.__internal_toSnapshot(), }; } } diff --git a/packages/clerk-js/src/core/resources/SignUp.ts b/packages/clerk-js/src/core/resources/SignUp.ts index 387245dcc2..4a6785a3b0 100644 --- a/packages/clerk-js/src/core/resources/SignUp.ts +++ b/packages/clerk-js/src/core/resources/SignUp.ts @@ -402,7 +402,7 @@ export class SignUp extends BaseResource implements SignUpResource { return this; } - public toJSON(): SignUpJSONSnapshot { + public __internal_toSnapshot(): SignUpJSONSnapshot { return { object: 'sign_up', id: this.id || '', @@ -411,7 +411,7 @@ export class SignUp extends BaseResource implements SignUpResource { optional_fields: this.optionalFields, missing_fields: this.missingFields, unverified_fields: this.unverifiedFields, - verifications: this.verifications.toJSON(), + verifications: this.verifications.__internal_toSnapshot(), username: this.username, first_name: this.firstName, last_name: this.lastName, diff --git a/packages/clerk-js/src/core/resources/Token.ts b/packages/clerk-js/src/core/resources/Token.ts index 738b262ab1..80df33dc79 100644 --- a/packages/clerk-js/src/core/resources/Token.ts +++ b/packages/clerk-js/src/core/resources/Token.ts @@ -43,7 +43,7 @@ export class Token extends BaseResource implements TokenResource { return this; } - public toJSON(): TokenJSONSnapshot { + public __internal_toSnapshot(): TokenJSONSnapshot { return { object: 'token', id: this.id || '', diff --git a/packages/clerk-js/src/core/resources/User.ts b/packages/clerk-js/src/core/resources/User.ts index c25b883a35..e8c491707b 100644 --- a/packages/clerk-js/src/core/resources/User.ts +++ b/packages/clerk-js/src/core/resources/User.ts @@ -378,7 +378,7 @@ export class User extends BaseResource implements UserResource { return this; } - public toJSON(): UserJSONSnapshot { + public __internal_toSnapshot(): UserJSONSnapshot { return { object: 'user', id: this.id, @@ -390,14 +390,14 @@ export class User extends BaseResource implements UserResource { unsafe_metadata: this.unsafeMetadata, image_url: this.imageUrl, has_image: this.hasImage, - email_addresses: this.emailAddresses.map(ea => ea.toJSON()), - phone_numbers: this.phoneNumbers.map(ph => ph.toJSON()), - web3_wallets: this.web3Wallets.map(ph => ph.toJSON()), - external_accounts: this.externalAccounts.map(ea => ea.toJSON()), - passkeys: this.passkeys.map(passkey => passkey.toJSON()), - organization_memberships: this.organizationMemberships.map(om => om.toJSON()), - saml_accounts: this.samlAccounts.map(sa => sa.toJSON()), - enterprise_accounts: this.enterpriseAccounts.map(ea => ea.toJSON()), + email_addresses: this.emailAddresses.map(ea => ea.__internal_toSnapshot()), + phone_numbers: this.phoneNumbers.map(ph => ph.__internal_toSnapshot()), + web3_wallets: this.web3Wallets.map(ph => ph.__internal_toSnapshot()), + external_accounts: this.externalAccounts.map(ea => ea.__internal_toSnapshot()), + passkeys: this.passkeys.map(passkey => passkey.__internal_toSnapshot()), + organization_memberships: this.organizationMemberships.map(om => om.__internal_toSnapshot()), + saml_accounts: this.samlAccounts.map(sa => sa.__internal_toSnapshot()), + enterprise_accounts: this.enterpriseAccounts.map(ea => ea.__internal_toSnapshot()), totp_enabled: this.totpEnabled, backup_code_enabled: this.backupCodeEnabled, two_factor_enabled: this.twoFactorEnabled, diff --git a/packages/clerk-js/src/core/resources/UserData.ts b/packages/clerk-js/src/core/resources/UserData.ts index 7d64695245..cbe3628945 100644 --- a/packages/clerk-js/src/core/resources/UserData.ts +++ b/packages/clerk-js/src/core/resources/UserData.ts @@ -21,7 +21,7 @@ export class UserData implements IUserData { return this; } - public toJSON(): UserDataJSONSnapshot { + public __internal_toSnapshot(): UserDataJSONSnapshot { return { first_name: this.firstName, last_name: this.lastName, diff --git a/packages/clerk-js/src/core/resources/UserSettings.ts b/packages/clerk-js/src/core/resources/UserSettings.ts index 515faad982..15f9abb9c3 100644 --- a/packages/clerk-js/src/core/resources/UserSettings.ts +++ b/packages/clerk-js/src/core/resources/UserSettings.ts @@ -104,7 +104,7 @@ export class UserSettings extends BaseResource implements UserSettingsResource { return this; } - public toJSON(): UserSettingsJSONSnapshot { + public __internal_toSnapshot(): UserSettingsJSONSnapshot { return { social: this.social, saml: this.saml, diff --git a/packages/clerk-js/src/core/resources/Verification.ts b/packages/clerk-js/src/core/resources/Verification.ts index 5dc20e62bd..e30bc9e6ff 100644 --- a/packages/clerk-js/src/core/resources/Verification.ts +++ b/packages/clerk-js/src/core/resources/Verification.ts @@ -61,7 +61,7 @@ export class Verification extends BaseResource implements VerificationResource { return this; } - public toJSON(): VerificationJSONSnapshot { + public __internal_toSnapshot(): VerificationJSONSnapshot { return { object: 'verification', id: this.id || '', @@ -120,12 +120,12 @@ export class SignUpVerifications implements SignUpVerificationsResource { } } - public toJSON(): SignUpVerificationsJSONSnapshot { + public __internal_toSnapshot(): SignUpVerificationsJSONSnapshot { return { - email_address: this.emailAddress.toJSON(), - phone_number: this.phoneNumber.toJSON(), - web3_wallet: this.web3Wallet.toJSON(), - external_account: this.externalAccount.toJSON(), + email_address: this.emailAddress.__internal_toSnapshot(), + phone_number: this.phoneNumber.__internal_toSnapshot(), + web3_wallet: this.web3Wallet.__internal_toSnapshot(), + external_account: this.externalAccount.__internal_toSnapshot(), }; } } @@ -145,9 +145,9 @@ export class SignUpVerification extends Verification { } } - public toJSON(): SignUpVerificationJSONSnapshot { + public __internal_toSnapshot(): SignUpVerificationJSONSnapshot { return { - ...super.toJSON(), + ...super.__internal_toSnapshot(), next_action: this.nextAction, supported_strategies: this.supportedStrategies, }; diff --git a/packages/clerk-js/src/core/resources/Web3Wallet.ts b/packages/clerk-js/src/core/resources/Web3Wallet.ts index 75940fc01a..210f879554 100644 --- a/packages/clerk-js/src/core/resources/Web3Wallet.ts +++ b/packages/clerk-js/src/core/resources/Web3Wallet.ts @@ -61,12 +61,12 @@ export class Web3Wallet extends BaseResource implements Web3WalletResource { return this; } - public toJSON(): Web3WalletJSONSnapshot { + public __internal_toSnapshot(): Web3WalletJSONSnapshot { return { object: 'web3_wallet', id: this.id, web3_wallet: this.web3Wallet, - verification: this.verification.toJSON(), + verification: this.verification.__internal_toSnapshot(), }; } } diff --git a/packages/clerk-js/src/core/resources/__tests__/Client.test.ts b/packages/clerk-js/src/core/resources/__tests__/Client.test.ts index b2843200c3..aefc7f26b5 100644 --- a/packages/clerk-js/src/core/resources/__tests__/Client.test.ts +++ b/packages/clerk-js/src/core/resources/__tests__/Client.test.ts @@ -207,4 +207,140 @@ describe('Client Singleton', () => { expect(client).toMatchSnapshot(); }); + + it('__internal_toSnapshot()', () => { + const clientJSON = { + object: 'client', + status: null, + id: 'client_DUMMY_ID', + sessions: [], + sign_up: { + object: 'sign_up', + id: '', + status: null, + required_fields: [], + optional_fields: [], + missing_fields: [], + unverified_fields: [], + verifications: { + email_address: { + object: 'verification', + id: '', + status: null, + strategy: null, + nonce: null, + message: null, + external_verification_redirect_url: null, + attempts: null, + expire_at: 1733924546849, + error: { code: '', message: '', meta: {} }, + verified_at_client: null, + next_action: '', + supported_strategies: [], + }, + phone_number: { + object: 'verification', + id: '', + status: null, + strategy: null, + nonce: null, + message: null, + external_verification_redirect_url: null, + attempts: null, + expire_at: 1733924546849, + error: { code: '', message: '', meta: {} }, + verified_at_client: null, + next_action: '', + supported_strategies: [], + }, + web3_wallet: { + object: 'verification', + id: '', + status: null, + strategy: null, + nonce: null, + message: null, + external_verification_redirect_url: null, + attempts: null, + expire_at: 1733924546849, + error: { code: '', message: '', meta: {} }, + verified_at_client: null, + next_action: '', + supported_strategies: [], + }, + external_account: { + object: 'verification', + id: '', + status: null, + strategy: null, + nonce: null, + message: null, + external_verification_redirect_url: null, + attempts: null, + expire_at: 1733924546849, + error: { code: '', message: '', meta: {} }, + verified_at_client: null, + }, + }, + username: null, + first_name: null, + last_name: null, + email_address: null, + phone_number: null, + has_password: false, + unsafe_metadata: {}, + created_session_id: null, + created_user_id: null, + abandon_at: null, + web3_wallet: null, + legal_accepted_at: null, + }, + sign_in: { + object: 'sign_in', + id: '', + status: null, + supported_identifiers: [], + supported_first_factors: [], + supported_second_factors: null, + first_factor_verification: { + object: 'verification', + id: '', + status: null, + strategy: null, + nonce: null, + message: null, + external_verification_redirect_url: null, + attempts: null, + expire_at: 1733924546849, + error: { code: '', message: '', meta: {} }, + verified_at_client: null, + }, + second_factor_verification: { + object: 'verification', + id: '', + status: null, + strategy: null, + nonce: null, + message: null, + external_verification_redirect_url: null, + attempts: null, + expire_at: 1733924546849, + error: { code: '', message: '', meta: {} }, + verified_at_client: null, + }, + identifier: null, + created_session_id: null, + user_data: {}, + }, + last_active_session_id: null, + cookie_expires_at: null, + created_at: 1733924546843, + updated_at: 1733924546843, + } as unknown as ClientJSONSnapshot; + + // @ts-expect-error We cannot mess with the singleton when tests are running in parallel + const client = new Client(clientJSON); + + expect(client.__internal_toSnapshot()).toMatchSnapshot(); + }); }); diff --git a/packages/clerk-js/src/core/resources/__tests__/Environment.test.ts b/packages/clerk-js/src/core/resources/__tests__/Environment.test.ts index 9bfa0f2ba7..acc168988c 100644 --- a/packages/clerk-js/src/core/resources/__tests__/Environment.test.ts +++ b/packages/clerk-js/src/core/resources/__tests__/Environment.test.ts @@ -235,4 +235,237 @@ describe('Environment', () => { expect(environment).toMatchSnapshot(); }); + + it('__internal_toSnapshot()', () => { + const environmentJSON = { + object: 'environment', + id: '', + auth_config: { object: 'auth_config', id: '', single_session_mode: true, claimed_at: null }, + display_config: { + object: 'display_config', + id: 'display_config_DUMMY_ID', + instance_environment_type: 'development', + application_name: '', + theme: { + buttons: { font_color: '#ffffff', font_family: 'sans-serif', font_weight: '600' }, + general: { + color: '#6c47ff', + padding: '1em', + box_shadow: '0 2px 8px rgba(0, 0, 0, 0.2)', + font_color: '#151515', + font_family: 'sans-serif', + border_radius: '0.5em', + background_color: '#ffffff', + label_font_weight: '600', + }, + accounts: { background_color: '#ffffff' }, + }, + preferred_sign_in_strategy: 'password', + logo_image_url: '', + favicon_image_url: '', + home_url: '', + sign_in_url: '', + sign_up_url: '', + user_profile_url: '', + after_sign_in_url: '', + after_sign_up_url: '', + after_sign_out_one_url: '', + after_sign_out_all_url: '', + after_switch_session_url: '', + branded: true, + captcha_public_key: null, + captcha_widget_type: null, + captcha_provider: null, + captcha_public_key_invisible: null, + captcha_oauth_bypass: [], + captcha_heartbeat: false, + support_email: '', + clerk_js_version: '5', + organization_profile_url: '', + create_organization_url: '', + after_leave_organization_url: '', + after_create_organization_url: '', + google_one_tap_client_id: null, + show_devmode_warning: true, + terms_url: null, + privacy_policy_url: null, + waitlist_url: '', + after_join_waitlist_url: '', + }, + user_settings: { + social: { + oauth_google: { + enabled: true, + required: false, + authenticatable: true, + block_email_subaddresses: true, + strategy: 'oauth_google', + not_selectable: false, + deprecated: false, + name: 'Google', + logo_url: 'https://img.clerk.com/static/google.png', + }, + }, + saml: { enabled: false }, + attributes: { + email_address: { + enabled: true, + required: true, + used_for_first_factor: true, + first_factors: ['email_code'], + used_for_second_factor: false, + second_factors: [], + verifications: ['email_code'], + verify_at_sign_up: true, + name: 'email_address', + }, + phone_number: { + enabled: false, + required: false, + used_for_first_factor: false, + first_factors: [], + used_for_second_factor: false, + second_factors: [], + verifications: [], + verify_at_sign_up: false, + name: 'phone_number', + }, + username: { + enabled: false, + required: false, + used_for_first_factor: false, + first_factors: [], + used_for_second_factor: false, + second_factors: [], + verifications: [], + verify_at_sign_up: false, + name: 'username', + }, + web3_wallet: { + enabled: false, + required: false, + used_for_first_factor: false, + first_factors: [], + used_for_second_factor: false, + second_factors: [], + verifications: [], + verify_at_sign_up: false, + name: 'web3_wallet', + }, + first_name: { + enabled: false, + required: false, + used_for_first_factor: false, + first_factors: [], + used_for_second_factor: false, + second_factors: [], + verifications: [], + verify_at_sign_up: false, + name: 'first_name', + }, + last_name: { + enabled: false, + required: false, + used_for_first_factor: false, + first_factors: [], + used_for_second_factor: false, + second_factors: [], + verifications: [], + verify_at_sign_up: false, + name: 'last_name', + }, + password: { + enabled: true, + required: true, + used_for_first_factor: false, + first_factors: [], + used_for_second_factor: false, + second_factors: [], + verifications: [], + verify_at_sign_up: false, + name: 'password', + }, + authenticator_app: { + enabled: false, + required: false, + used_for_first_factor: false, + first_factors: [], + used_for_second_factor: false, + second_factors: [], + verifications: [], + verify_at_sign_up: false, + name: 'authenticator_app', + }, + ticket: { + enabled: true, + required: false, + used_for_first_factor: false, + first_factors: [], + used_for_second_factor: false, + second_factors: [], + verifications: [], + verify_at_sign_up: false, + name: 'ticket', + }, + backup_code: { + enabled: false, + required: false, + used_for_first_factor: false, + first_factors: [], + used_for_second_factor: false, + second_factors: [], + verifications: [], + verify_at_sign_up: false, + name: 'backup_code', + }, + passkey: { + enabled: false, + required: false, + used_for_first_factor: false, + first_factors: [], + used_for_second_factor: false, + second_factors: [], + verifications: [], + verify_at_sign_up: false, + name: 'passkey', + }, + }, + actions: { delete_self: true, create_organization: true, create_organizations_limit: null }, + sign_in: { second_factor: { required: false } }, + sign_up: { + captcha_enabled: false, + captcha_widget_type: 'smart', + custom_action_required: false, + progressive: true, + mode: 'public', + legal_consent_enabled: false, + }, + password_settings: { + disable_hibp: false, + min_length: 8, + max_length: 72, + require_special_char: false, + require_numbers: false, + require_uppercase: false, + require_lowercase: false, + show_zxcvbn: false, + min_zxcvbn_strength: 0, + enforce_hibp_on_sign_in: true, + allowed_special_characters: '!"#$%&\'()*+,-./:;<=>?@[]^_`{|}~', + }, + passkey_settings: { allow_autofill: true, show_sign_in_button: true }, + }, + organization_settings: { + enabled: false, + max_allowed_memberships: 5, + actions: { admin_delete: true }, + domains: { enabled: false, enrollment_modes: [], default_role: null }, + }, + maintenance_mode: false, + } as unknown as EnvironmentJSONSnapshot; + + const environment = new Environment(environmentJSON); + + expect(environment.__internal_toSnapshot()).toMatchSnapshot(); + }); }); diff --git a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Client.test.ts.snap b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Client.test.ts.snap index fcb60a9777..09e6c4b8d3 100644 --- a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Client.test.ts.snap +++ b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Client.test.ts.snap @@ -1,6 +1,238 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Client Singleton has the same initial properties 1`] = ` +Client { + "cookieExpiresAt": null, + "createdAt": 2024-12-11T13:42:26.843Z, + "id": "client_DUMMY_ID", + "lastActiveSessionId": null, + "pathRoot": "/client", + "sessions": [], + "signIn": SignIn { + "attemptFirstFactor": [Function], + "attemptSecondFactor": [Function], + "authenticateWithCoinbaseWallet": [Function], + "authenticateWithMetamask": [Function], + "authenticateWithOKXWallet": [Function], + "authenticateWithPasskey": [Function], + "authenticateWithRedirect": [Function], + "authenticateWithWeb3": [Function], + "create": [Function], + "createEmailLinkFlow": [Function], + "createdSessionId": null, + "firstFactorVerification": Verification { + "attempts": null, + "error": { + "code": "", + "longMessage": undefined, + "message": "", + "meta": { + "emailAddresses": undefined, + "identifiers": undefined, + "paramName": undefined, + "sessionId": undefined, + "zxcvbn": undefined, + }, + }, + "expireAt": 2024-12-11T13:42:26.849Z, + "externalVerificationRedirectURL": null, + "message": null, + "nonce": null, + "pathRoot": "", + "status": null, + "strategy": null, + "verifiedAtClient": null, + "verifiedFromTheSameClient": [Function], + }, + "id": "", + "identifier": null, + "pathRoot": "/client/sign_ins", + "prepareFirstFactor": [Function], + "prepareSecondFactor": [Function], + "resetPassword": [Function], + "secondFactorVerification": Verification { + "attempts": null, + "error": { + "code": "", + "longMessage": undefined, + "message": "", + "meta": { + "emailAddresses": undefined, + "identifiers": undefined, + "paramName": undefined, + "sessionId": undefined, + "zxcvbn": undefined, + }, + }, + "expireAt": 2024-12-11T13:42:26.849Z, + "externalVerificationRedirectURL": null, + "message": null, + "nonce": null, + "pathRoot": "", + "status": null, + "strategy": null, + "verifiedAtClient": null, + "verifiedFromTheSameClient": [Function], + }, + "status": null, + "supportedFirstFactors": [], + "supportedIdentifiers": [], + "supportedSecondFactors": null, + "userData": UserData { + "firstName": undefined, + "hasImage": undefined, + "imageUrl": undefined, + "lastName": undefined, + }, + "validatePassword": [Function], + }, + "signUp": SignUp { + "abandonAt": null, + "attemptEmailAddressVerification": [Function], + "attemptPhoneNumberVerification": [Function], + "attemptVerification": [Function], + "attemptWeb3WalletVerification": [Function], + "authenticateWithCoinbaseWallet": [Function], + "authenticateWithMetamask": [Function], + "authenticateWithOKXWallet": [Function], + "authenticateWithRedirect": [Function], + "authenticateWithWeb3": [Function], + "create": [Function], + "createEmailLinkFlow": [Function], + "createdSessionId": null, + "createdUserId": null, + "emailAddress": null, + "firstName": null, + "hasPassword": false, + "id": "", + "lastName": null, + "legalAcceptedAt": null, + "missingFields": [], + "optionalFields": [], + "pathRoot": "/client/sign_ups", + "phoneNumber": null, + "prepareEmailAddressVerification": [Function], + "preparePhoneNumberVerification": [Function], + "prepareVerification": [Function], + "prepareWeb3WalletVerification": [Function], + "requiredFields": [], + "status": null, + "unsafeMetadata": {}, + "unverifiedFields": [], + "update": [Function], + "username": null, + "validatePassword": [Function], + "verifications": SignUpVerifications { + "emailAddress": SignUpVerification { + "attempts": null, + "error": { + "code": "", + "longMessage": undefined, + "message": "", + "meta": { + "emailAddresses": undefined, + "identifiers": undefined, + "paramName": undefined, + "sessionId": undefined, + "zxcvbn": undefined, + }, + }, + "expireAt": 2024-12-11T13:42:26.849Z, + "externalVerificationRedirectURL": null, + "message": null, + "nextAction": "", + "nonce": null, + "pathRoot": "", + "status": null, + "strategy": null, + "supportedStrategies": [], + "verifiedAtClient": null, + "verifiedFromTheSameClient": [Function], + }, + "externalAccount": Verification { + "attempts": null, + "error": { + "code": "", + "longMessage": undefined, + "message": "", + "meta": { + "emailAddresses": undefined, + "identifiers": undefined, + "paramName": undefined, + "sessionId": undefined, + "zxcvbn": undefined, + }, + }, + "expireAt": 2024-12-11T13:42:26.849Z, + "externalVerificationRedirectURL": null, + "message": null, + "nonce": null, + "pathRoot": "", + "status": null, + "strategy": null, + "verifiedAtClient": null, + "verifiedFromTheSameClient": [Function], + }, + "phoneNumber": SignUpVerification { + "attempts": null, + "error": { + "code": "", + "longMessage": undefined, + "message": "", + "meta": { + "emailAddresses": undefined, + "identifiers": undefined, + "paramName": undefined, + "sessionId": undefined, + "zxcvbn": undefined, + }, + }, + "expireAt": 2024-12-11T13:42:26.849Z, + "externalVerificationRedirectURL": null, + "message": null, + "nextAction": "", + "nonce": null, + "pathRoot": "", + "status": null, + "strategy": null, + "supportedStrategies": [], + "verifiedAtClient": null, + "verifiedFromTheSameClient": [Function], + }, + "web3Wallet": SignUpVerification { + "attempts": null, + "error": { + "code": "", + "longMessage": undefined, + "message": "", + "meta": { + "emailAddresses": undefined, + "identifiers": undefined, + "paramName": undefined, + "sessionId": undefined, + "zxcvbn": undefined, + }, + }, + "expireAt": 2024-12-11T13:42:26.849Z, + "externalVerificationRedirectURL": null, + "message": null, + "nextAction": "", + "nonce": null, + "pathRoot": "", + "status": null, + "strategy": null, + "supportedStrategies": [], + "verifiedAtClient": null, + "verifiedFromTheSameClient": [Function], + }, + }, + "web3wallet": null, + }, + "updatedAt": 2024-12-11T13:42:26.843Z, +} +`; + +exports[`Client Singleton __internal_toSnapshot() 1`] = ` { "cookie_expires_at": null, "created_at": 1733924546843, diff --git a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Environment.test.ts.snap b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Environment.test.ts.snap index 36b3355bc2..874997733b 100644 --- a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Environment.test.ts.snap +++ b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Environment.test.ts.snap @@ -1,6 +1,290 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Environment has the same initial properties 1`] = ` +Environment { + "authConfig": AuthConfig { + "claimedAt": null, + "pathRoot": "", + "singleSessionMode": true, + }, + "displayConfig": DisplayConfig { + "afterCreateOrganizationUrl": "", + "afterJoinWaitlistUrl": "", + "afterLeaveOrganizationUrl": "", + "afterSignInUrl": "", + "afterSignOutAllUrl": "", + "afterSignOutOneUrl": "", + "afterSignUpUrl": "", + "afterSwitchSessionUrl": "", + "applicationName": "", + "branded": true, + "captchaHeartbeat": false, + "captchaHeartbeatIntervalMs": undefined, + "captchaOauthBypass": [], + "captchaProvider": null, + "captchaPublicKey": null, + "captchaPublicKeyInvisible": null, + "captchaWidgetType": null, + "clerkJSVersion": "5", + "createOrganizationUrl": "", + "faviconImageUrl": "", + "googleOneTapClientId": null, + "homeUrl": "", + "id": "display_config_DUMMY_ID", + "instanceEnvironmentType": "development", + "logoImageUrl": "", + "organizationProfileUrl": "", + "pathRoot": "", + "preferredSignInStrategy": "password", + "privacyPolicyUrl": null, + "showDevModeWarning": true, + "signInUrl": "", + "signUpUrl": "", + "supportEmail": "", + "termsUrl": null, + "theme": { + "accounts": { + "background_color": "#ffffff", + }, + "buttons": { + "font_color": "#ffffff", + "font_family": "sans-serif", + "font_weight": "600", + }, + "general": { + "background_color": "#ffffff", + "border_radius": "0.5em", + "box_shadow": "0 2px 8px rgba(0, 0, 0, 0.2)", + "color": "#6c47ff", + "font_color": "#151515", + "font_family": "sans-serif", + "label_font_weight": "600", + "padding": "1em", + }, + }, + "userProfileUrl": "", + "waitlistUrl": "", + }, + "isDevelopmentOrStaging": [Function], + "isProduction": [Function], + "isSingleSession": [Function], + "maintenanceMode": false, + "onWindowLocationHost": [Function], + "organizationSettings": OrganizationSettings { + "actions": { + "adminDelete": true, + }, + "domains": { + "defaultRole": null, + "enabled": false, + "enrollmentModes": [], + }, + "enabled": false, + "maxAllowedMemberships": 5, + "pathRoot": "", + }, + "pathRoot": "/environment", + "userSettings": UserSettings { + "actions": { + "create_organization": true, + "create_organizations_limit": null, + "delete_self": true, + }, + "attributes": { + "authenticator_app": { + "enabled": false, + "first_factors": [], + "name": "authenticator_app", + "required": false, + "second_factors": [], + "used_for_first_factor": false, + "used_for_second_factor": false, + "verifications": [], + "verify_at_sign_up": false, + }, + "backup_code": { + "enabled": false, + "first_factors": [], + "name": "backup_code", + "required": false, + "second_factors": [], + "used_for_first_factor": false, + "used_for_second_factor": false, + "verifications": [], + "verify_at_sign_up": false, + }, + "email_address": { + "enabled": true, + "first_factors": [ + "email_code", + ], + "name": "email_address", + "required": true, + "second_factors": [], + "used_for_first_factor": true, + "used_for_second_factor": false, + "verifications": [ + "email_code", + ], + "verify_at_sign_up": true, + }, + "first_name": { + "enabled": false, + "first_factors": [], + "name": "first_name", + "required": false, + "second_factors": [], + "used_for_first_factor": false, + "used_for_second_factor": false, + "verifications": [], + "verify_at_sign_up": false, + }, + "last_name": { + "enabled": false, + "first_factors": [], + "name": "last_name", + "required": false, + "second_factors": [], + "used_for_first_factor": false, + "used_for_second_factor": false, + "verifications": [], + "verify_at_sign_up": false, + }, + "passkey": { + "enabled": false, + "first_factors": [], + "name": "passkey", + "required": false, + "second_factors": [], + "used_for_first_factor": false, + "used_for_second_factor": false, + "verifications": [], + "verify_at_sign_up": false, + }, + "password": { + "enabled": true, + "first_factors": [], + "name": "password", + "required": true, + "second_factors": [], + "used_for_first_factor": false, + "used_for_second_factor": false, + "verifications": [], + "verify_at_sign_up": false, + }, + "phone_number": { + "enabled": false, + "first_factors": [], + "name": "phone_number", + "required": false, + "second_factors": [], + "used_for_first_factor": false, + "used_for_second_factor": false, + "verifications": [], + "verify_at_sign_up": false, + }, + "ticket": { + "enabled": true, + "first_factors": [], + "name": "ticket", + "required": false, + "second_factors": [], + "used_for_first_factor": false, + "used_for_second_factor": false, + "verifications": [], + "verify_at_sign_up": false, + }, + "username": { + "enabled": false, + "first_factors": [], + "name": "username", + "required": false, + "second_factors": [], + "used_for_first_factor": false, + "used_for_second_factor": false, + "verifications": [], + "verify_at_sign_up": false, + }, + "web3_wallet": { + "enabled": false, + "first_factors": [], + "name": "web3_wallet", + "required": false, + "second_factors": [], + "used_for_first_factor": false, + "used_for_second_factor": false, + "verifications": [], + "verify_at_sign_up": false, + }, + }, + "authenticatableSocialStrategies": [ + "oauth_google", + ], + "enabledFirstFactorIdentifiers": [ + "email_address", + ], + "enterpriseSSO": undefined, + "id": undefined, + "passkeySettings": { + "allow_autofill": true, + "show_sign_in_button": true, + }, + "passwordSettings": { + "allowed_special_characters": "!"#$%&'()*+,-./:;<=>?@[]^_\`{|}~", + "disable_hibp": false, + "enforce_hibp_on_sign_in": true, + "max_length": 72, + "min_length": 8, + "min_zxcvbn_strength": 0, + "require_lowercase": false, + "require_numbers": false, + "require_special_char": false, + "require_uppercase": false, + "show_zxcvbn": false, + }, + "pathRoot": "", + "saml": { + "enabled": false, + }, + "signIn": { + "second_factor": { + "required": false, + }, + }, + "signUp": { + "captcha_enabled": false, + "captcha_widget_type": "smart", + "custom_action_required": false, + "legal_consent_enabled": false, + "mode": "public", + "progressive": true, + }, + "social": { + "oauth_google": { + "authenticatable": true, + "block_email_subaddresses": true, + "deprecated": false, + "enabled": true, + "logo_url": "https://img.clerk.com/static/google.png", + "name": "Google", + "not_selectable": false, + "required": false, + "strategy": "oauth_google", + }, + }, + "socialProviderStrategies": [ + "oauth_google", + ], + "usernameSettings": { + "max_length": NaN, + "min_length": NaN, + }, + "web3FirstFactors": [], + }, +} +`; + +exports[`Environment __internal_toSnapshot() 1`] = ` { "auth_config": { "claimed_at": null, diff --git a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Organization.test.ts.snap b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Organization.test.ts.snap index 96f00a783c..b1e85d7941 100644 --- a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Organization.test.ts.snap +++ b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Organization.test.ts.snap @@ -1,21 +1,36 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Organization has the same initial properties 1`] = ` -{ - "admin_delete_enabled": true, - "created_at": 12345, - "has_image": true, +Organization { + "addMember": [Function], + "adminDeleteEnabled": true, + "createDomain": [Function], + "createdAt": 1970-01-01T00:00:12.345Z, + "destroy": [Function], + "getDomain": [Function], + "getDomains": [Function], + "getInvitations": [Function], + "getMembershipRequests": [Function], + "getMemberships": [Function], + "getRoles": [Function], + "hasImage": true, "id": "test_id", - "image_url": "https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18xbHlXRFppb2JyNjAwQUtVZVFEb1NsckVtb00iLCJyaWQiOiJ1c2VyXzJKbElJQTN2VXNjWXh1N2VUMnhINmFrTGgxOCIsImluaXRpYWxzIjoiREsifQ?width=160", - "max_allowed_memberships": 3, - "members_count": 1, + "imageUrl": "https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18xbHlXRFppb2JyNjAwQUtVZVFEb1NsckVtb00iLCJyaWQiOiJ1c2VyXzJKbElJQTN2VXNjWXh1N2VUMnhINmFrTGgxOCIsImluaXRpYWxzIjoiREsifQ?width=160", + "inviteMember": [Function], + "inviteMembers": [Function], + "maxAllowedMemberships": 3, + "membersCount": 1, "name": "test_name", - "object": "organization", - "pending_invitations_count": 10, - "public_metadata": { + "pathRoot": "/organizations", + "pendingInvitationsCount": 10, + "publicMetadata": { "public": "metadata", }, + "removeMember": [Function], + "setLogo": [Function], "slug": "test_slug", - "updated_at": 5678, + "update": [Function], + "updateMember": [Function], + "updatedAt": 1970-01-01T00:00:05.678Z, } `; diff --git a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/OrganizationMembership.test.ts.snap b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/OrganizationMembership.test.ts.snap index 01aaecc168..d0d564b0e3 100644 --- a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/OrganizationMembership.test.ts.snap +++ b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/OrganizationMembership.test.ts.snap @@ -1,42 +1,57 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`OrganizationMembership has the same initial properties 1`] = ` -{ - "created_at": 12345, +OrganizationMembership { + "createdAt": 1970-01-01T00:00:12.345Z, + "destroy": [Function], "id": "test_id", - "object": "organization_membership", - "organization": { - "admin_delete_enabled": true, - "created_at": 12345, - "has_image": true, + "organization": Organization { + "addMember": [Function], + "adminDeleteEnabled": true, + "createDomain": [Function], + "createdAt": 1970-01-01T00:00:12.345Z, + "destroy": [Function], + "getDomain": [Function], + "getDomains": [Function], + "getInvitations": [Function], + "getMembershipRequests": [Function], + "getMemberships": [Function], + "getRoles": [Function], + "hasImage": true, "id": "test_org_id", - "image_url": "https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18xbHlXRFppb2JyNjAwQUtVZVFEb1NsckVtb00iLCJyaWQiOiJ1c2VyXzJKbElJQTN2VXNjWXh1N2VUMnhINmFrTGgxOCIsImluaXRpYWxzIjoiREsifQ?width=160", - "max_allowed_memberships": 3, - "members_count": 1, + "imageUrl": "https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18xbHlXRFppb2JyNjAwQUtVZVFEb1NsckVtb00iLCJyaWQiOiJ1c2VyXzJKbElJQTN2VXNjWXh1N2VUMnhINmFrTGgxOCIsImluaXRpYWxzIjoiREsifQ?width=160", + "inviteMember": [Function], + "inviteMembers": [Function], + "maxAllowedMemberships": 3, + "membersCount": 1, "name": "test_name", - "object": "organization", - "pending_invitations_count": 10, - "public_metadata": { + "pathRoot": "/organizations", + "pendingInvitationsCount": 10, + "publicMetadata": { "public": "metadata", }, + "removeMember": [Function], + "setLogo": [Function], "slug": "test_slug", - "updated_at": 67890, + "update": [Function], + "updateMember": [Function], + "updatedAt": 1970-01-01T00:01:07.890Z, }, + "pathRoot": "", "permissions": [], - "public_metadata": { + "publicMetadata": { "foo": "bar", }, - "public_user_data": { - "first_name": "test_first_name", - "has_image": true, - "id": "", + "publicUserData": PublicUserData { + "firstName": "test_first_name", + "hasImage": true, "identifier": "test@identifier.gr", - "image_url": " https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29udGVudC5jb20vYS9BQ2c4b2NLTmR2TUtFQzN5cUVpMVFjV0UzQjExbF9WUEVOWW5manlLMlVQd0tCSWw9czEwMDAtYyIsInMiOiJkRkowS3dTSkRINndiODE5cXJTUUxxaWF1ZS9QcHdndC84L0lUUlpYNHpnIn0?width=160", - "last_name": "test_last_name", - "object": "public_user_data", - "user_id": undefined, + "imageUrl": " https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29udGVudC5jb20vYS9BQ2c4b2NLTmR2TUtFQzN5cUVpMVFjV0UzQjExbF9WUEVOWW5manlLMlVQd0tCSWw9czEwMDAtYyIsInMiOiJkRkowS3dTSkRINndiODE5cXJTUUxxaWF1ZS9QcHdndC84L0lUUlpYNHpnIn0?width=160", + "lastName": "test_last_name", + "userId": undefined, }, "role": "admin", - "updated_at": 5678, + "update": [Function], + "updatedAt": 1970-01-01T00:00:05.678Z, } `; diff --git a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/OrganizationMembershipRequest.test.ts.snap b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/OrganizationMembershipRequest.test.ts.snap index f92e8040af..57cabd7dc0 100644 --- a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/OrganizationMembershipRequest.test.ts.snap +++ b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/OrganizationMembershipRequest.test.ts.snap @@ -7,15 +7,13 @@ OrganizationMembershipRequest { "id": "test_id", "organizationId": "test_org_id", "pathRoot": "", - "publicUserData": { - "first_name": "test_first_name", - "has_image": true, - "id": "", + "publicUserData": PublicUserData { + "firstName": "test_first_name", + "hasImage": true, "identifier": "test@identifier.gr", - "image_url": "https://clerk.com", - "last_name": "test_last_name", - "object": "public_user_data", - "user_id": undefined, + "imageUrl": "https://clerk.com", + "lastName": "test_last_name", + "userId": undefined, }, "reject": [Function], "status": "pending", diff --git a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Session.test.ts.snap b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Session.test.ts.snap index bb4501d62d..ce9e54c2f0 100644 --- a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Session.test.ts.snap +++ b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/Session.test.ts.snap @@ -4,10 +4,31 @@ exports[`Session getToken() dispatches token:update event on getToken with activ [ "token:update", { - "token": { - "id": "", - "jwt": "eyJhbGciOiJSUzI1NiIsImtpZCI6Imluc18yR0lvUWhiVXB5MGhYN0IyY1ZrdVRNaW5Yb0QiLCJ0eXAiOiJKV1QifQ.eyJhenAiOiJodHRwczovL2FjY291bnRzLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsImV4cCI6MTY2NjY0ODMxMCwiaWF0IjoxNjY2NjQ4MjUwLCJpc3MiOiJodHRwczovL2NsZXJrLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsIm5iZiI6MTY2NjY0ODI0MCwic2lkIjoic2Vzc18yR2JEQjRlbk5kQ2E1dlMxenBDM1h6Zzl0SzkiLCJzdWIiOiJ1c2VyXzJHSXBYT0VwVnlKdzUxcmtabjlLbW5jNlN4ciJ9.n1Usc-DLDftqA0Xb-_2w8IGs4yjCmwc5RngwbSRvwevuZOIuRoeHmE2sgCdEvjfJEa7ewL6EVGVcM557TWPW--g_J1XQPwBy8tXfz7-S73CEuyRFiR97L2AHRdvRtvGtwR-o6l8aHaFxtlmfWbQXfg4kFJz2UGe9afmh3U9-f_4JOZ5fa3mI98UMy1-bo20vjXeWQ9aGrqaxHQxjnzzC-1Kpi5LdPvhQ16H0dPB8MHRTSM5TAuLKTpPV7wqixmbtcc2-0k6b9FKYZNqRVTaIyV-lifZloBvdzlfOF8nW1VVH_fx-iW5Q3hovHFcJIULHEC1kcAYTubbxzpgeVQepGg", - "object": "token", + "token": Token { + "getRawString": [Function], + "jwt": { + "claims": { + "__raw": "eyJhbGciOiJSUzI1NiIsImtpZCI6Imluc18yR0lvUWhiVXB5MGhYN0IyY1ZrdVRNaW5Yb0QiLCJ0eXAiOiJKV1QifQ.eyJhenAiOiJodHRwczovL2FjY291bnRzLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsImV4cCI6MTY2NjY0ODMxMCwiaWF0IjoxNjY2NjQ4MjUwLCJpc3MiOiJodHRwczovL2NsZXJrLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsIm5iZiI6MTY2NjY0ODI0MCwic2lkIjoic2Vzc18yR2JEQjRlbk5kQ2E1dlMxenBDM1h6Zzl0SzkiLCJzdWIiOiJ1c2VyXzJHSXBYT0VwVnlKdzUxcmtabjlLbW5jNlN4ciJ9.n1Usc-DLDftqA0Xb-_2w8IGs4yjCmwc5RngwbSRvwevuZOIuRoeHmE2sgCdEvjfJEa7ewL6EVGVcM557TWPW--g_J1XQPwBy8tXfz7-S73CEuyRFiR97L2AHRdvRtvGtwR-o6l8aHaFxtlmfWbQXfg4kFJz2UGe9afmh3U9-f_4JOZ5fa3mI98UMy1-bo20vjXeWQ9aGrqaxHQxjnzzC-1Kpi5LdPvhQ16H0dPB8MHRTSM5TAuLKTpPV7wqixmbtcc2-0k6b9FKYZNqRVTaIyV-lifZloBvdzlfOF8nW1VVH_fx-iW5Q3hovHFcJIULHEC1kcAYTubbxzpgeVQepGg", + "azp": "https://accounts.inspired.puma-74.lcl.dev", + "exp": 1666648310, + "iat": 1666648250, + "iss": "https://clerk.inspired.puma-74.lcl.dev", + "nbf": 1666648240, + "sid": "sess_2GbDB4enNdCa5vS1zpC3Xzg9tK9", + "sub": "user_2GIpXOEpVyJw51rkZn9Kmnc6Sxr", + }, + "encoded": { + "header": "eyJhbGciOiJSUzI1NiIsImtpZCI6Imluc18yR0lvUWhiVXB5MGhYN0IyY1ZrdVRNaW5Yb0QiLCJ0eXAiOiJKV1QifQ", + "payload": "eyJhenAiOiJodHRwczovL2FjY291bnRzLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsImV4cCI6MTY2NjY0ODMxMCwiaWF0IjoxNjY2NjQ4MjUwLCJpc3MiOiJodHRwczovL2NsZXJrLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsIm5iZiI6MTY2NjY0ODI0MCwic2lkIjoic2Vzc18yR2JEQjRlbk5kQ2E1dlMxenBDM1h6Zzl0SzkiLCJzdWIiOiJ1c2VyXzJHSXBYT0VwVnlKdzUxcmtabjlLbW5jNlN4ciJ9", + "signature": "n1Usc-DLDftqA0Xb-_2w8IGs4yjCmwc5RngwbSRvwevuZOIuRoeHmE2sgCdEvjfJEa7ewL6EVGVcM557TWPW--g_J1XQPwBy8tXfz7-S73CEuyRFiR97L2AHRdvRtvGtwR-o6l8aHaFxtlmfWbQXfg4kFJz2UGe9afmh3U9-f_4JOZ5fa3mI98UMy1-bo20vjXeWQ9aGrqaxHQxjnzzC-1Kpi5LdPvhQ16H0dPB8MHRTSM5TAuLKTpPV7wqixmbtcc2-0k6b9FKYZNqRVTaIyV-lifZloBvdzlfOF8nW1VVH_fx-iW5Q3hovHFcJIULHEC1kcAYTubbxzpgeVQepGg", + }, + "header": { + "alg": "RS256", + "kid": "ins_2GIoQhbUpy0hX7B2cVkuTMinXoD", + "typ": "JWT", + }, + }, + "pathRoot": "/client/sessions/session_1/tokens", }, }, ] @@ -17,10 +38,31 @@ exports[`Session getToken() dispatches token:update event on getToken without ac [ "token:update", { - "token": { - "id": "", - "jwt": "eyJhbGciOiJSUzI1NiIsImtpZCI6Imluc18yR0lvUWhiVXB5MGhYN0IyY1ZrdVRNaW5Yb0QiLCJ0eXAiOiJKV1QifQ.eyJhenAiOiJodHRwczovL2FjY291bnRzLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsImV4cCI6MTY2NjY0ODMxMCwiaWF0IjoxNjY2NjQ4MjUwLCJpc3MiOiJodHRwczovL2NsZXJrLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsIm5iZiI6MTY2NjY0ODI0MCwic2lkIjoic2Vzc18yR2JEQjRlbk5kQ2E1dlMxenBDM1h6Zzl0SzkiLCJzdWIiOiJ1c2VyXzJHSXBYT0VwVnlKdzUxcmtabjlLbW5jNlN4ciJ9.n1Usc-DLDftqA0Xb-_2w8IGs4yjCmwc5RngwbSRvwevuZOIuRoeHmE2sgCdEvjfJEa7ewL6EVGVcM557TWPW--g_J1XQPwBy8tXfz7-S73CEuyRFiR97L2AHRdvRtvGtwR-o6l8aHaFxtlmfWbQXfg4kFJz2UGe9afmh3U9-f_4JOZ5fa3mI98UMy1-bo20vjXeWQ9aGrqaxHQxjnzzC-1Kpi5LdPvhQ16H0dPB8MHRTSM5TAuLKTpPV7wqixmbtcc2-0k6b9FKYZNqRVTaIyV-lifZloBvdzlfOF8nW1VVH_fx-iW5Q3hovHFcJIULHEC1kcAYTubbxzpgeVQepGg", - "object": "token", + "token": Token { + "getRawString": [Function], + "jwt": { + "claims": { + "__raw": "eyJhbGciOiJSUzI1NiIsImtpZCI6Imluc18yR0lvUWhiVXB5MGhYN0IyY1ZrdVRNaW5Yb0QiLCJ0eXAiOiJKV1QifQ.eyJhenAiOiJodHRwczovL2FjY291bnRzLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsImV4cCI6MTY2NjY0ODMxMCwiaWF0IjoxNjY2NjQ4MjUwLCJpc3MiOiJodHRwczovL2NsZXJrLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsIm5iZiI6MTY2NjY0ODI0MCwic2lkIjoic2Vzc18yR2JEQjRlbk5kQ2E1dlMxenBDM1h6Zzl0SzkiLCJzdWIiOiJ1c2VyXzJHSXBYT0VwVnlKdzUxcmtabjlLbW5jNlN4ciJ9.n1Usc-DLDftqA0Xb-_2w8IGs4yjCmwc5RngwbSRvwevuZOIuRoeHmE2sgCdEvjfJEa7ewL6EVGVcM557TWPW--g_J1XQPwBy8tXfz7-S73CEuyRFiR97L2AHRdvRtvGtwR-o6l8aHaFxtlmfWbQXfg4kFJz2UGe9afmh3U9-f_4JOZ5fa3mI98UMy1-bo20vjXeWQ9aGrqaxHQxjnzzC-1Kpi5LdPvhQ16H0dPB8MHRTSM5TAuLKTpPV7wqixmbtcc2-0k6b9FKYZNqRVTaIyV-lifZloBvdzlfOF8nW1VVH_fx-iW5Q3hovHFcJIULHEC1kcAYTubbxzpgeVQepGg", + "azp": "https://accounts.inspired.puma-74.lcl.dev", + "exp": 1666648310, + "iat": 1666648250, + "iss": "https://clerk.inspired.puma-74.lcl.dev", + "nbf": 1666648240, + "sid": "sess_2GbDB4enNdCa5vS1zpC3Xzg9tK9", + "sub": "user_2GIpXOEpVyJw51rkZn9Kmnc6Sxr", + }, + "encoded": { + "header": "eyJhbGciOiJSUzI1NiIsImtpZCI6Imluc18yR0lvUWhiVXB5MGhYN0IyY1ZrdVRNaW5Yb0QiLCJ0eXAiOiJKV1QifQ", + "payload": "eyJhenAiOiJodHRwczovL2FjY291bnRzLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsImV4cCI6MTY2NjY0ODMxMCwiaWF0IjoxNjY2NjQ4MjUwLCJpc3MiOiJodHRwczovL2NsZXJrLmluc3BpcmVkLnB1bWEtNzQubGNsLmRldiIsIm5iZiI6MTY2NjY0ODI0MCwic2lkIjoic2Vzc18yR2JEQjRlbk5kQ2E1dlMxenBDM1h6Zzl0SzkiLCJzdWIiOiJ1c2VyXzJHSXBYT0VwVnlKdzUxcmtabjlLbW5jNlN4ciJ9", + "signature": "n1Usc-DLDftqA0Xb-_2w8IGs4yjCmwc5RngwbSRvwevuZOIuRoeHmE2sgCdEvjfJEa7ewL6EVGVcM557TWPW--g_J1XQPwBy8tXfz7-S73CEuyRFiR97L2AHRdvRtvGtwR-o6l8aHaFxtlmfWbQXfg4kFJz2UGe9afmh3U9-f_4JOZ5fa3mI98UMy1-bo20vjXeWQ9aGrqaxHQxjnzzC-1Kpi5LdPvhQ16H0dPB8MHRTSM5TAuLKTpPV7wqixmbtcc2-0k6b9FKYZNqRVTaIyV-lifZloBvdzlfOF8nW1VVH_fx-iW5Q3hovHFcJIULHEC1kcAYTubbxzpgeVQepGg", + }, + "header": { + "alg": "RS256", + "kid": "ins_2GIoQhbUpy0hX7B2cVkuTMinXoD", + "typ": "JWT", + }, + }, + "pathRoot": "/client/sessions/session_1/tokens", }, }, ] diff --git a/packages/expo/src/provider/singleton/createClerkInstance.ts b/packages/expo/src/provider/singleton/createClerkInstance.ts index b7a7ff2266..a617471fe7 100644 --- a/packages/expo/src/provider/singleton/createClerkInstance.ts +++ b/packages/expo/src/provider/singleton/createClerkInstance.ts @@ -117,11 +117,11 @@ export function createClerkInstance(ClerkClass: typeof Clerk) { // @ts-expect-error - This is an internal API const environment = __internal_clerk?.__unstable__environment as EnvironmentResource; if (environment) { - void EnvironmentResourceCache.save(environment.toJSON()); + void EnvironmentResourceCache.save(environment.__internal_toSnapshot()); } if (client) { - void ClientResourceCache.save(client.toJSON()); + void ClientResourceCache.save(client.__internal_toSnapshot()); if (client.lastActiveSessionId) { const lastActiveSession = client.activeSessions.find(s => s.id === client.lastActiveSessionId); const token = lastActiveSession?.lastActiveToken?.getRawString(); diff --git a/packages/types/src/authConfig.ts b/packages/types/src/authConfig.ts index 183fdb061e..529f1e6fd7 100644 --- a/packages/types/src/authConfig.ts +++ b/packages/types/src/authConfig.ts @@ -12,5 +12,5 @@ export interface AuthConfigResource extends ClerkResource { * Defaults to `null`. */ claimedAt: Date | null; - toJSON: () => AuthConfigJSONSnapshot; + __internal_toSnapshot: () => AuthConfigJSONSnapshot; } diff --git a/packages/types/src/client.ts b/packages/types/src/client.ts index 271ef519cd..beee5f5baa 100644 --- a/packages/types/src/client.ts +++ b/packages/types/src/client.ts @@ -22,5 +22,5 @@ export interface ClientResource extends ClerkResource { cookieExpiresAt: Date | null; createdAt: Date | null; updatedAt: Date | null; - toJSON: () => ClientJSONSnapshot; + __internal_toSnapshot: () => ClientJSONSnapshot; } diff --git a/packages/types/src/displayConfig.ts b/packages/types/src/displayConfig.ts index dea84552c1..301e86b43e 100644 --- a/packages/types/src/displayConfig.ts +++ b/packages/types/src/displayConfig.ts @@ -92,5 +92,5 @@ export interface DisplayConfigResource extends ClerkResource { privacyPolicyUrl: string; waitlistUrl: string; afterJoinWaitlistUrl: string; - toJSON: () => DisplayConfigJSONSnapshot; + __internal_toSnapshot: () => DisplayConfigJSONSnapshot; } diff --git a/packages/types/src/emailAddress.ts b/packages/types/src/emailAddress.ts index be42d8154b..d257860afb 100644 --- a/packages/types/src/emailAddress.ts +++ b/packages/types/src/emailAddress.ts @@ -29,5 +29,5 @@ export interface EmailAddressResource extends ClerkResource { createEmailLinkFlow: () => CreateEmailLinkFlowReturn; destroy: () => Promise; create: () => Promise; - toJSON: () => EmailAddressJSONSnapshot; + __internal_toSnapshot: () => EmailAddressJSONSnapshot; } diff --git a/packages/types/src/enterpriseAccount.ts b/packages/types/src/enterpriseAccount.ts index 271542c5e0..f43e405f00 100644 --- a/packages/types/src/enterpriseAccount.ts +++ b/packages/types/src/enterpriseAccount.ts @@ -20,7 +20,7 @@ export interface EnterpriseAccountResource extends ClerkResource { providerUserId: string | null; publicMetadata: Record | null; verification: VerificationResource | null; - toJSON: () => EnterpriseAccountJSONSnapshot; + __internal_toSnapshot: () => EnterpriseAccountJSONSnapshot; } export interface EnterpriseAccountConnectionResource extends ClerkResource { @@ -34,5 +34,5 @@ export interface EnterpriseAccountConnectionResource extends ClerkResource { protocol: EnterpriseProtocol; provider: EnterpriseProvider; syncUserAttributes: boolean; - toJSON: () => EnterpriseAccountConnectionJSONSnapshot; + __internal_toSnapshot: () => EnterpriseAccountConnectionJSONSnapshot; } diff --git a/packages/types/src/environment.ts b/packages/types/src/environment.ts index b87b981f17..320fa78bf2 100644 --- a/packages/types/src/environment.ts +++ b/packages/types/src/environment.ts @@ -16,5 +16,5 @@ export interface EnvironmentResource extends ClerkResource { isDevelopmentOrStaging: () => boolean; onWindowLocationHost: () => boolean; maintenanceMode: boolean; - toJSON: () => EnvironmentJSONSnapshot; + __internal_toSnapshot: () => EnvironmentJSONSnapshot; } diff --git a/packages/types/src/externalAccount.ts b/packages/types/src/externalAccount.ts index 5d5cfe8f90..c8b2fbd952 100644 --- a/packages/types/src/externalAccount.ts +++ b/packages/types/src/externalAccount.ts @@ -28,5 +28,5 @@ export interface ExternalAccountResource extends ClerkResource { providerSlug: () => OAuthProvider; providerTitle: () => string; accountIdentifier: () => string; - toJSON: () => ExternalAccountJSONSnapshot; + __internal_toSnapshot: () => ExternalAccountJSONSnapshot; } diff --git a/packages/types/src/identificationLink.ts b/packages/types/src/identificationLink.ts index f03034dbdf..462587b85e 100644 --- a/packages/types/src/identificationLink.ts +++ b/packages/types/src/identificationLink.ts @@ -5,5 +5,5 @@ import type { ClerkResource } from './resource'; export interface IdentificationLinkResource extends ClerkResource { id: string; type: string; - toJSON(): IdentificationLinkJSONSnapshot; + __internal_toSnapshot(): IdentificationLinkJSONSnapshot; } diff --git a/packages/types/src/organization.ts b/packages/types/src/organization.ts index 9185c62057..ed51567472 100644 --- a/packages/types/src/organization.ts +++ b/packages/types/src/organization.ts @@ -58,7 +58,7 @@ export interface OrganizationResource extends ClerkResource { getDomain: ({ domainId }: { domainId: string }) => Promise; destroy: () => Promise; setLogo: (params: SetOrganizationLogoParams) => Promise; - toJSON: () => OrganizationJSONSnapshot; + __internal_toSnapshot: () => OrganizationJSONSnapshot; } export type GetRolesParams = ClerkPaginationParams; diff --git a/packages/types/src/organizationMembership.ts b/packages/types/src/organizationMembership.ts index f9501955fd..8a010d1991 100644 --- a/packages/types/src/organizationMembership.ts +++ b/packages/types/src/organizationMembership.ts @@ -50,7 +50,7 @@ export interface OrganizationMembershipResource extends ClerkResource { updatedAt: Date; destroy: () => Promise; update: (updateParams: UpdateOrganizationMembershipParams) => Promise; - toJSON: () => OrganizationMembershipJSONSnapshot; + __internal_toSnapshot: () => OrganizationMembershipJSONSnapshot; } export type OrganizationCustomPermissionKey = ClerkAuthorization extends Placeholder diff --git a/packages/types/src/organizationSettings.ts b/packages/types/src/organizationSettings.ts index 6522c2669b..6cadacebca 100644 --- a/packages/types/src/organizationSettings.ts +++ b/packages/types/src/organizationSettings.ts @@ -30,5 +30,5 @@ export interface OrganizationSettingsResource extends ClerkResource { enrollmentModes: OrganizationEnrollmentMode[]; defaultRole: string | null; }; - toJSON: () => OrganizationSettingsJSONSnapshot; + __internal_toSnapshot: () => OrganizationSettingsJSONSnapshot; } diff --git a/packages/types/src/passkey.ts b/packages/types/src/passkey.ts index 57f036e61c..f8a9a879a6 100644 --- a/packages/types/src/passkey.ts +++ b/packages/types/src/passkey.ts @@ -20,7 +20,7 @@ export interface PasskeyResource extends ClerkResource { update: (params: UpdatePasskeyParams) => Promise; delete: () => Promise; - toJSON: () => PasskeyJSONSnapshot; + __internal_toSnapshot: () => PasskeyJSONSnapshot; } export type PublicKeyCredentialCreationOptionsWithoutExtensions = Omit< diff --git a/packages/types/src/phoneNumber.ts b/packages/types/src/phoneNumber.ts index 7a66b4509b..36bb32574e 100644 --- a/packages/types/src/phoneNumber.ts +++ b/packages/types/src/phoneNumber.ts @@ -34,5 +34,5 @@ export interface PhoneNumberResource extends ClerkResource { setReservedForSecondFactor: (params: SetReservedForSecondFactorParams) => Promise; destroy: () => Promise; create: () => Promise; - toJSON: () => PhoneNumberJSONSnapshot; + __internal_toSnapshot: () => PhoneNumberJSONSnapshot; } diff --git a/packages/types/src/samlAccount.ts b/packages/types/src/samlAccount.ts index 1fb30cdf17..8bfa969ff2 100644 --- a/packages/types/src/samlAccount.ts +++ b/packages/types/src/samlAccount.ts @@ -14,5 +14,5 @@ export interface SamlAccountResource extends ClerkResource { lastName: string; verification: VerificationResource | null; samlConnection: SamlAccountConnectionResource | null; - toJSON: () => SamlAccountJSONSnapshot; + __internal_toSnapshot: () => SamlAccountJSONSnapshot; } diff --git a/packages/types/src/samlConnection.ts b/packages/types/src/samlConnection.ts index 1c438d9125..678878c8c2 100644 --- a/packages/types/src/samlConnection.ts +++ b/packages/types/src/samlConnection.ts @@ -14,5 +14,5 @@ export interface SamlAccountConnectionResource extends ClerkResource { disableAdditionalIdentifications: boolean; createdAt: Date; updatedAt: Date; - toJSON: () => SamlAccountConnectionJSONSnapshot; + __internal_toSnapshot: () => SamlAccountConnectionJSONSnapshot; } diff --git a/packages/types/src/session.ts b/packages/types/src/session.ts index 90ef8aed57..028ceacee3 100644 --- a/packages/types/src/session.ts +++ b/packages/types/src/session.ts @@ -102,7 +102,7 @@ export interface SessionResource extends ClerkResource { attemptSecondFactorVerification: ( params: SessionVerifyAttemptSecondFactorParams, ) => Promise; - toJSON: () => SessionJSONSnapshot; + __internal_toSnapshot: () => SessionJSONSnapshot; } export interface ActiveSessionResource extends SessionResource { diff --git a/packages/types/src/signIn.ts b/packages/types/src/signIn.ts index 6915f0feec..f9d9425dc9 100644 --- a/packages/types/src/signIn.ts +++ b/packages/types/src/signIn.ts @@ -112,7 +112,7 @@ export interface SignInResource extends ClerkResource { createEmailLinkFlow: () => CreateEmailLinkFlowReturn; validatePassword: (password: string, callbacks?: ValidatePasswordCallbacks) => void; - toJSON: () => SignInJSONSnapshot; + __internal_toSnapshot: () => SignInJSONSnapshot; } export type SignInStatus = diff --git a/packages/types/src/signUp.ts b/packages/types/src/signUp.ts index b2e5935698..c94d69e6be 100644 --- a/packages/types/src/signUp.ts +++ b/packages/types/src/signUp.ts @@ -102,7 +102,7 @@ export interface SignUpResource extends ClerkResource { authenticateWithMetamask: (params?: SignUpAuthenticateWithWeb3Params) => Promise; authenticateWithCoinbaseWallet: (params?: SignUpAuthenticateWithWeb3Params) => Promise; authenticateWithOKXWallet: (params?: SignUpAuthenticateWithWeb3Params) => Promise; - toJSON: () => SignUpJSONSnapshot; + __internal_toSnapshot: () => SignUpJSONSnapshot; } export type SignUpStatus = 'missing_requirements' | 'complete' | 'abandoned'; @@ -190,11 +190,11 @@ export interface SignUpVerificationsResource { phoneNumber: SignUpVerificationResource; externalAccount: VerificationResource; web3Wallet: VerificationResource; - toJSON: () => SignUpVerificationsJSONSnapshot; + __internal_toSnapshot: () => SignUpVerificationsJSONSnapshot; } export interface SignUpVerificationResource extends VerificationResource { supportedStrategies: string[]; nextAction: string; - toJSON: () => SignUpVerificationJSONSnapshot; + __internal_toSnapshot: () => SignUpVerificationJSONSnapshot; } diff --git a/packages/types/src/snapshots.ts b/packages/types/src/snapshots.ts index 4d15806ef9..e32ff39091 100644 --- a/packages/types/src/snapshots.ts +++ b/packages/types/src/snapshots.ts @@ -1,4 +1,4 @@ -// this file contains the types returned by the toJSON method of the resources +// this file contains the types returned by the __internal_toSnapshot method of the resources import type { DisplayConfigJSON } from './displayConfig'; import type { diff --git a/packages/types/src/token.ts b/packages/types/src/token.ts index 181b1023bd..2101452df1 100644 --- a/packages/types/src/token.ts +++ b/packages/types/src/token.ts @@ -6,5 +6,5 @@ import type { ClerkResource } from './resource'; export interface TokenResource extends ClerkResource { jwt?: JWT; getRawString: () => string; - toJSON: () => TokenJSONSnapshot; + __internal_toSnapshot: () => TokenJSONSnapshot; } diff --git a/packages/types/src/user.ts b/packages/types/src/user.ts index 6042b13376..15bc308226 100644 --- a/packages/types/src/user.ts +++ b/packages/types/src/user.ts @@ -127,7 +127,7 @@ export interface UserResource extends ClerkResource { get hasVerifiedPhoneNumber(): boolean; - toJSON: () => UserJSONSnapshot; + __internal_toSnapshot: () => UserJSONSnapshot; } export type CreateEmailAddressParams = { email: string }; diff --git a/packages/types/src/userSettings.ts b/packages/types/src/userSettings.ts index f0f6adc760..f8dab67246 100644 --- a/packages/types/src/userSettings.ts +++ b/packages/types/src/userSettings.ts @@ -150,5 +150,5 @@ export interface UserSettingsResource extends ClerkResource { enabledFirstFactorIdentifiers: Attribute[]; instanceIsPasswordBased: boolean; hasValidAuthFactor: boolean; - toJSON: () => UserSettingsJSONSnapshot; + __internal_toSnapshot: () => UserSettingsJSONSnapshot; } diff --git a/packages/types/src/verification.ts b/packages/types/src/verification.ts index 7fee93a0d8..9cb143cb3f 100644 --- a/packages/types/src/verification.ts +++ b/packages/types/src/verification.ts @@ -15,7 +15,7 @@ export interface VerificationResource extends ClerkResource { strategy: string | null; verifiedAtClient: string | null; verifiedFromTheSameClient: () => boolean; - toJSON: () => VerificationJSONSnapshot; + __internal_toSnapshot: () => VerificationJSONSnapshot; } export interface PasskeyVerificationResource extends VerificationResource { diff --git a/packages/types/src/web3Wallet.ts b/packages/types/src/web3Wallet.ts index 51ada6941d..5921b91c56 100644 --- a/packages/types/src/web3Wallet.ts +++ b/packages/types/src/web3Wallet.ts @@ -23,7 +23,7 @@ export interface Web3WalletResource extends ClerkResource { attemptVerification: (params: AttemptWeb3WalletVerificationParams) => Promise; destroy: () => Promise; create: () => Promise; - toJSON: () => Web3WalletJSONSnapshot; + __internal_toSnapshot: () => Web3WalletJSONSnapshot; } export type GenerateSignature = (opts: GenerateSignatureParams) => Promise; From faccaa17c7c74d28f0e4015896197385fa22419a Mon Sep 17 00:00:00 2001 From: Clerk Cookie <136073014+clerk-cookie@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:01:53 -0500 Subject: [PATCH 03/10] ci(repo): Version packages (#4773) Co-authored-by: github-actions[bot] --- .changeset/breezy-foxes-lay.md | 2 -- .changeset/cold-tomatoes-float.md | 7 ------- .changeset/strong-hounds-train.md | 7 ------- .changeset/wild-planes-swim.md | 2 -- packages/astro/CHANGELOG.md | 9 +++++++++ packages/astro/package.json | 2 +- packages/backend/CHANGELOG.md | 8 ++++++++ packages/backend/package.json | 2 +- packages/chrome-extension/CHANGELOG.md | 9 +++++++++ packages/chrome-extension/package.json | 2 +- packages/clerk-js/CHANGELOG.md | 13 +++++++++++++ packages/clerk-js/package.json | 2 +- packages/elements/CHANGELOG.md | 9 +++++++++ packages/elements/package.json | 2 +- packages/expo-passkeys/CHANGELOG.md | 8 ++++++++ packages/expo-passkeys/package.json | 2 +- packages/expo/CHANGELOG.md | 12 ++++++++++++ packages/expo/package.json | 2 +- packages/express/CHANGELOG.md | 9 +++++++++ packages/express/package.json | 2 +- packages/fastify/CHANGELOG.md | 9 +++++++++ packages/fastify/package.json | 2 +- packages/localizations/CHANGELOG.md | 9 +++++++++ packages/localizations/package.json | 2 +- packages/nextjs/CHANGELOG.md | 10 ++++++++++ packages/nextjs/package.json | 2 +- packages/nuxt/CHANGELOG.md | 10 ++++++++++ packages/nuxt/package.json | 2 +- packages/react-router/CHANGELOG.md | 10 ++++++++++ packages/react-router/package.json | 2 +- packages/react/CHANGELOG.md | 8 ++++++++ packages/react/package.json | 2 +- packages/remix/CHANGELOG.md | 10 ++++++++++ packages/remix/package.json | 2 +- packages/sdk-node/CHANGELOG.md | 9 +++++++++ packages/sdk-node/package.json | 2 +- packages/shared/CHANGELOG.md | 7 +++++++ packages/shared/package.json | 2 +- packages/tanstack-start/CHANGELOG.md | 10 ++++++++++ packages/tanstack-start/package.json | 2 +- packages/testing/CHANGELOG.md | 9 +++++++++ packages/testing/package.json | 2 +- packages/themes/CHANGELOG.md | 7 +++++++ packages/themes/package.json | 2 +- packages/types/CHANGELOG.md | 8 ++++++++ packages/types/package.json | 2 +- packages/ui/CHANGELOG.md | 10 ++++++++++ packages/ui/package.json | 2 +- packages/vue/CHANGELOG.md | 8 ++++++++ packages/vue/package.json | 2 +- 50 files changed, 234 insertions(+), 41 deletions(-) delete mode 100644 .changeset/breezy-foxes-lay.md delete mode 100644 .changeset/cold-tomatoes-float.md delete mode 100644 .changeset/strong-hounds-train.md delete mode 100644 .changeset/wild-planes-swim.md diff --git a/.changeset/breezy-foxes-lay.md b/.changeset/breezy-foxes-lay.md deleted file mode 100644 index a845151cc8..0000000000 --- a/.changeset/breezy-foxes-lay.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/cold-tomatoes-float.md b/.changeset/cold-tomatoes-float.md deleted file mode 100644 index d51895d162..0000000000 --- a/.changeset/cold-tomatoes-float.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@clerk/localizations': patch -'@clerk/clerk-js': patch -'@clerk/types': patch ---- - -Added min and max length username settings to username field error. diff --git a/.changeset/strong-hounds-train.md b/.changeset/strong-hounds-train.md deleted file mode 100644 index a18bc7b164..0000000000 --- a/.changeset/strong-hounds-train.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@clerk/clerk-js': patch -'@clerk/types': patch -'@clerk/clerk-expo': patch ---- - -Rename `toJSON()` resource methods to `__internal_toSnapshot()` to avoid issues with serializing functions. diff --git a/.changeset/wild-planes-swim.md b/.changeset/wild-planes-swim.md deleted file mode 100644 index a845151cc8..0000000000 --- a/.changeset/wild-planes-swim.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index cb20c6c910..9a1fd62925 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,14 @@ # @clerk/astro +## 2.1.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/backend@1.21.2 + - @clerk/shared@2.20.2 + ## 2.1.1 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index 33a610c671..8816b384db 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/astro", - "version": "2.1.1", + "version": "2.1.2", "description": "Clerk SDK for Astro", "keywords": [ "auth", diff --git a/packages/backend/CHANGELOG.md b/packages/backend/CHANGELOG.md index 6faaf4b78f..6bedb14330 100644 --- a/packages/backend/CHANGELOG.md +++ b/packages/backend/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 1.21.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/shared@2.20.2 + ## 1.21.1 ### Patch Changes diff --git a/packages/backend/package.json b/packages/backend/package.json index bfcc251689..76f1e6d7ce 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/backend", - "version": "1.21.1", + "version": "1.21.2", "description": "Clerk Backend SDK - REST Client for Backend API & JWT verification utilities", "homepage": "https://clerk.com/", "bugs": { diff --git a/packages/chrome-extension/CHANGELOG.md b/packages/chrome-extension/CHANGELOG.md index e352e5f4f5..c530dddb39 100644 --- a/packages/chrome-extension/CHANGELOG.md +++ b/packages/chrome-extension/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 2.1.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/clerk-js@5.42.1 + - @clerk/clerk-react@5.20.2 + - @clerk/shared@2.20.2 + ## 2.1.1 ### Patch Changes diff --git a/packages/chrome-extension/package.json b/packages/chrome-extension/package.json index 0d097860d6..ddd5138ec5 100644 --- a/packages/chrome-extension/package.json +++ b/packages/chrome-extension/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/chrome-extension", - "version": "2.1.1", + "version": "2.1.2", "description": "Clerk SDK for Chrome extensions", "keywords": [ "auth", diff --git a/packages/clerk-js/CHANGELOG.md b/packages/clerk-js/CHANGELOG.md index 791db10783..c39a8fad2c 100644 --- a/packages/clerk-js/CHANGELOG.md +++ b/packages/clerk-js/CHANGELOG.md @@ -1,5 +1,18 @@ # Change Log +## 5.42.1 + +### Patch Changes + +- Added min and max length username settings to username field error. ([#4771](https://github.com/clerk/javascript/pull/4771)) by [@alexcarpenter](https://github.com/alexcarpenter) + +- Rename `toJSON()` resource methods to `__internal_toSnapshot()` to avoid issues with serializing functions. ([#4777](https://github.com/clerk/javascript/pull/4777)) by [@anagstef](https://github.com/anagstef) + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/localizations@3.9.2 + - @clerk/types@4.39.4 + - @clerk/shared@2.20.2 + ## 5.42.0 ### Minor Changes diff --git a/packages/clerk-js/package.json b/packages/clerk-js/package.json index e1ae2460fd..da4d5c86d1 100644 --- a/packages/clerk-js/package.json +++ b/packages/clerk-js/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/clerk-js", - "version": "5.42.0", + "version": "5.42.1", "description": "Clerk JS library", "keywords": [ "clerk", diff --git a/packages/elements/CHANGELOG.md b/packages/elements/CHANGELOG.md index b566ad1b55..11ff3de30e 100644 --- a/packages/elements/CHANGELOG.md +++ b/packages/elements/CHANGELOG.md @@ -1,5 +1,14 @@ # @clerk/elements +## 0.22.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/clerk-react@5.20.2 + - @clerk/shared@2.20.2 + ## 0.22.1 ### Patch Changes diff --git a/packages/elements/package.json b/packages/elements/package.json index 391e4860d5..9f89bb1c88 100644 --- a/packages/elements/package.json +++ b/packages/elements/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/elements", - "version": "0.22.1", + "version": "0.22.2", "description": "Clerk Elements", "keywords": [ "clerk", diff --git a/packages/expo-passkeys/CHANGELOG.md b/packages/expo-passkeys/CHANGELOG.md index 2ac2a95bc0..2521ec8713 100644 --- a/packages/expo-passkeys/CHANGELOG.md +++ b/packages/expo-passkeys/CHANGELOG.md @@ -1,5 +1,13 @@ # @clerk/expo-passkeys +## 0.1.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/shared@2.20.2 + ## 0.1.1 ### Patch Changes diff --git a/packages/expo-passkeys/package.json b/packages/expo-passkeys/package.json index 4a02cac3a2..0b5741b36d 100644 --- a/packages/expo-passkeys/package.json +++ b/packages/expo-passkeys/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/expo-passkeys", - "version": "0.1.1", + "version": "0.1.2", "description": "Passkeys library to be used with Clerk for expo", "keywords": [ "react-native", diff --git a/packages/expo/CHANGELOG.md b/packages/expo/CHANGELOG.md index ebb561f552..c81a037367 100644 --- a/packages/expo/CHANGELOG.md +++ b/packages/expo/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 2.6.1 + +### Patch Changes + +- Rename `toJSON()` resource methods to `__internal_toSnapshot()` to avoid issues with serializing functions. ([#4777](https://github.com/clerk/javascript/pull/4777)) by [@anagstef](https://github.com/anagstef) + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/clerk-js@5.42.1 + - @clerk/types@4.39.4 + - @clerk/clerk-react@5.20.2 + - @clerk/shared@2.20.2 + ## 2.6.0 ### Minor Changes diff --git a/packages/expo/package.json b/packages/expo/package.json index 00eff40f72..db357624c1 100644 --- a/packages/expo/package.json +++ b/packages/expo/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/clerk-expo", - "version": "2.6.0", + "version": "2.6.1", "description": "Clerk React Native/Expo library", "keywords": [ "react", diff --git a/packages/express/CHANGELOG.md b/packages/express/CHANGELOG.md index 246f2ca6dc..bc152b073b 100644 --- a/packages/express/CHANGELOG.md +++ b/packages/express/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 1.3.29 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/backend@1.21.2 + - @clerk/shared@2.20.2 + ## 1.3.28 ### Patch Changes diff --git a/packages/express/package.json b/packages/express/package.json index 218b10d048..d56310917a 100644 --- a/packages/express/package.json +++ b/packages/express/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/express", - "version": "1.3.28", + "version": "1.3.29", "description": "Clerk server SDK for usage with Express", "keywords": [ "clerk", diff --git a/packages/fastify/CHANGELOG.md b/packages/fastify/CHANGELOG.md index f2e97c93db..c52eada860 100644 --- a/packages/fastify/CHANGELOG.md +++ b/packages/fastify/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 2.1.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/backend@1.21.2 + - @clerk/shared@2.20.2 + ## 2.1.1 ### Patch Changes diff --git a/packages/fastify/package.json b/packages/fastify/package.json index 2de0021b28..388a1d9101 100644 --- a/packages/fastify/package.json +++ b/packages/fastify/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/fastify", - "version": "2.1.1", + "version": "2.1.2", "description": "Clerk SDK for Fastify", "keywords": [ "auth", diff --git a/packages/localizations/CHANGELOG.md b/packages/localizations/CHANGELOG.md index 636b58db26..c68e280d72 100644 --- a/packages/localizations/CHANGELOG.md +++ b/packages/localizations/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 3.9.2 + +### Patch Changes + +- Added min and max length username settings to username field error. ([#4771](https://github.com/clerk/javascript/pull/4771)) by [@alexcarpenter](https://github.com/alexcarpenter) + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + ## 3.9.1 ### Patch Changes diff --git a/packages/localizations/package.json b/packages/localizations/package.json index 9ac3d03db2..c1fe0f9198 100644 --- a/packages/localizations/package.json +++ b/packages/localizations/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/localizations", - "version": "3.9.1", + "version": "3.9.2", "description": "Localizations for the Clerk components", "keywords": [ "react", diff --git a/packages/nextjs/CHANGELOG.md b/packages/nextjs/CHANGELOG.md index 2295c40f3b..2194484dfb 100644 --- a/packages/nextjs/CHANGELOG.md +++ b/packages/nextjs/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## 6.9.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/clerk-react@5.20.2 + - @clerk/backend@1.21.2 + - @clerk/shared@2.20.2 + ## 6.9.1 ### Patch Changes diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 9b36cfd99f..dbcedd0b6f 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/nextjs", - "version": "6.9.1", + "version": "6.9.2", "description": "Clerk SDK for NextJS", "keywords": [ "clerk", diff --git a/packages/nuxt/CHANGELOG.md b/packages/nuxt/CHANGELOG.md index d075556287..b7d0ab13ac 100644 --- a/packages/nuxt/CHANGELOG.md +++ b/packages/nuxt/CHANGELOG.md @@ -1,5 +1,15 @@ # @clerk/nuxt +## 0.1.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/backend@1.21.2 + - @clerk/shared@2.20.2 + - @clerk/vue@0.1.2 + ## 0.1.1 ### Patch Changes diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 3f804360a0..8c44b1156a 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/nuxt", - "version": "0.1.1", + "version": "0.1.2", "description": "Clerk SDK for Nuxt", "keywords": [ "clerk", diff --git a/packages/react-router/CHANGELOG.md b/packages/react-router/CHANGELOG.md index 2a85a87566..3084db9df1 100644 --- a/packages/react-router/CHANGELOG.md +++ b/packages/react-router/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## 0.1.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/clerk-react@5.20.2 + - @clerk/backend@1.21.2 + - @clerk/shared@2.20.2 + ## 0.1.1 ### Patch Changes diff --git a/packages/react-router/package.json b/packages/react-router/package.json index 47ead7b339..2684e85f95 100644 --- a/packages/react-router/package.json +++ b/packages/react-router/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/react-router", - "version": "0.1.1", + "version": "0.1.2", "description": "Clerk SDK for React Router", "keywords": [ "clerk", diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index 9bd4e5ac60..905c9a6932 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 5.20.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/shared@2.20.2 + ## 5.20.1 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index be547a79e1..36727fc6cc 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/clerk-react", - "version": "5.20.1", + "version": "5.20.2", "description": "Clerk React library", "keywords": [ "clerk", diff --git a/packages/remix/CHANGELOG.md b/packages/remix/CHANGELOG.md index d833331873..5f4d7cec3f 100644 --- a/packages/remix/CHANGELOG.md +++ b/packages/remix/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## 4.4.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/clerk-react@5.20.2 + - @clerk/backend@1.21.2 + - @clerk/shared@2.20.2 + ## 4.4.1 ### Patch Changes diff --git a/packages/remix/package.json b/packages/remix/package.json index acaeeb83cc..330917904f 100644 --- a/packages/remix/package.json +++ b/packages/remix/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/remix", - "version": "4.4.1", + "version": "4.4.2", "description": "Clerk SDK for Remix", "keywords": [ "clerk", diff --git a/packages/sdk-node/CHANGELOG.md b/packages/sdk-node/CHANGELOG.md index cf691687d4..27baeb9ed4 100644 --- a/packages/sdk-node/CHANGELOG.md +++ b/packages/sdk-node/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 5.1.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/backend@1.21.2 + - @clerk/shared@2.20.2 + ## 5.1.1 ### Patch Changes diff --git a/packages/sdk-node/package.json b/packages/sdk-node/package.json index 9ed4697439..596413355d 100644 --- a/packages/sdk-node/package.json +++ b/packages/sdk-node/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/clerk-sdk-node", - "version": "5.1.1", + "version": "5.1.2", "description": "Clerk server SDK for usage with node", "keywords": [ "clerk", diff --git a/packages/shared/CHANGELOG.md b/packages/shared/CHANGELOG.md index 6d041f68db..025bc14a42 100644 --- a/packages/shared/CHANGELOG.md +++ b/packages/shared/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 2.20.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + ## 2.20.1 ### Patch Changes diff --git a/packages/shared/package.json b/packages/shared/package.json index f310fb41b9..3acfb9a977 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/shared", - "version": "2.20.1", + "version": "2.20.2", "description": "Internal package utils used by the Clerk SDKs", "repository": { "type": "git", diff --git a/packages/tanstack-start/CHANGELOG.md b/packages/tanstack-start/CHANGELOG.md index fb031d7686..4db742d7c5 100644 --- a/packages/tanstack-start/CHANGELOG.md +++ b/packages/tanstack-start/CHANGELOG.md @@ -1,5 +1,15 @@ # @clerk/tanstack-start +## 0.8.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/clerk-react@5.20.2 + - @clerk/backend@1.21.2 + - @clerk/shared@2.20.2 + ## 0.8.1 ### Patch Changes diff --git a/packages/tanstack-start/package.json b/packages/tanstack-start/package.json index c7fdcc70eb..139c65a844 100644 --- a/packages/tanstack-start/package.json +++ b/packages/tanstack-start/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/tanstack-start", - "version": "0.8.1", + "version": "0.8.2", "description": "Clerk SDK for TanStack Start", "keywords": [ "clerk", diff --git a/packages/testing/CHANGELOG.md b/packages/testing/CHANGELOG.md index 7ece86e5de..547fbcfafa 100644 --- a/packages/testing/CHANGELOG.md +++ b/packages/testing/CHANGELOG.md @@ -1,5 +1,14 @@ # @clerk/testing +## 1.4.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/backend@1.21.2 + - @clerk/shared@2.20.2 + ## 1.4.1 ### Patch Changes diff --git a/packages/testing/package.json b/packages/testing/package.json index f5c464dbfd..e07b9c81c5 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/testing", - "version": "1.4.1", + "version": "1.4.2", "description": "Utilities to help you create E2E test suites for apps using Clerk", "keywords": [ "auth", diff --git a/packages/themes/CHANGELOG.md b/packages/themes/CHANGELOG.md index 0f9ea0c2f5..975e17b0ea 100644 --- a/packages/themes/CHANGELOG.md +++ b/packages/themes/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 2.2.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + ## 2.2.1 ### Patch Changes diff --git a/packages/themes/package.json b/packages/themes/package.json index 06ae0c08aa..324fa18de6 100644 --- a/packages/themes/package.json +++ b/packages/themes/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/themes", - "version": "2.2.1", + "version": "2.2.2", "description": "Themes for the Clerk auth components", "keywords": [ "react", diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index da711bacb8..6fa877a977 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 4.39.4 + +### Patch Changes + +- Added min and max length username settings to username field error. ([#4771](https://github.com/clerk/javascript/pull/4771)) by [@alexcarpenter](https://github.com/alexcarpenter) + +- Rename `toJSON()` resource methods to `__internal_toSnapshot()` to avoid issues with serializing functions. ([#4777](https://github.com/clerk/javascript/pull/4777)) by [@anagstef](https://github.com/anagstef) + ## 4.39.3 ### Patch Changes diff --git a/packages/types/package.json b/packages/types/package.json index 6c582961b3..1646e1ca6b 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/types", - "version": "4.39.3", + "version": "4.39.4", "description": "Typings for Clerk libraries.", "keywords": [ "clerk", diff --git a/packages/ui/CHANGELOG.md b/packages/ui/CHANGELOG.md index be317fc379..0154c33c9e 100644 --- a/packages/ui/CHANGELOG.md +++ b/packages/ui/CHANGELOG.md @@ -1,5 +1,15 @@ # @clerk/ui +## 0.3.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/localizations@3.9.2 + - @clerk/types@4.39.4 + - @clerk/elements@0.22.2 + - @clerk/shared@2.20.2 + ## 0.3.1 ### Patch Changes diff --git a/packages/ui/package.json b/packages/ui/package.json index 9e7ea85ed1..5736994735 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/ui", - "version": "0.3.1", + "version": "0.3.2", "repository": { "type": "git", "url": "git+https://github.com/clerk/javascript.git", diff --git a/packages/vue/CHANGELOG.md b/packages/vue/CHANGELOG.md index eb5ad7b2db..1d11c1d03c 100644 --- a/packages/vue/CHANGELOG.md +++ b/packages/vue/CHANGELOG.md @@ -1,5 +1,13 @@ # @clerk/vue +## 0.1.2 + +### Patch Changes + +- Updated dependencies [[`aeafa7c5efd50c893d088ac99199d7eaecc04025`](https://github.com/clerk/javascript/commit/aeafa7c5efd50c893d088ac99199d7eaecc04025), [`acd9326ef2d6942b981b3ee59c4b20ddd303323d`](https://github.com/clerk/javascript/commit/acd9326ef2d6942b981b3ee59c4b20ddd303323d)]: + - @clerk/types@4.39.4 + - @clerk/shared@2.20.2 + ## 0.1.1 ### Patch Changes diff --git a/packages/vue/package.json b/packages/vue/package.json index 365fd8deb9..42d977bd43 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@clerk/vue", - "version": "0.1.1", + "version": "0.1.2", "description": "Clerk SDK for Vue", "keywords": [ "clerk", From dfdf23bc9a25ebc13df98d553454a14c765423bb Mon Sep 17 00:00:00 2001 From: Robert Soriano Date: Sat, 14 Dec 2024 07:46:54 -0800 Subject: [PATCH 04/10] fix(vue): Make sure Clerk object is available before accessing properties (#4779) --- .changeset/fresh-olives-watch.md | 5 +++++ packages/vue/src/composables/useSignIn.ts | 4 ++-- packages/vue/src/composables/useSignUp.ts | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/fresh-olives-watch.md diff --git a/.changeset/fresh-olives-watch.md b/.changeset/fresh-olives-watch.md new file mode 100644 index 0000000000..e0d334e179 --- /dev/null +++ b/.changeset/fresh-olives-watch.md @@ -0,0 +1,5 @@ +--- +"@clerk/vue": patch +--- + +Fixed an issue when accessing Clerk properties inside composables before Clerk is available. diff --git a/packages/vue/src/composables/useSignIn.ts b/packages/vue/src/composables/useSignIn.ts index 05ea8425c0..102d452158 100644 --- a/packages/vue/src/composables/useSignIn.ts +++ b/packages/vue/src/composables/useSignIn.ts @@ -41,14 +41,14 @@ export const useSignIn: UseSignIn = () => { }); const result = computed(() => { - if (!clientCtx.value) { + if (!clerk.value || !clientCtx.value) { return { isLoaded: false, signIn: undefined, setActive: undefined }; } return { isLoaded: true, signIn: clientCtx.value.signIn, - setActive: clerk.value!.setActive, + setActive: clerk.value.setActive, }; }); diff --git a/packages/vue/src/composables/useSignUp.ts b/packages/vue/src/composables/useSignUp.ts index b4c93a6869..7271179183 100644 --- a/packages/vue/src/composables/useSignUp.ts +++ b/packages/vue/src/composables/useSignUp.ts @@ -41,14 +41,14 @@ export const useSignUp: UseSignUp = () => { }); const result = computed(() => { - if (!clientCtx.value) { + if (!clerk.value || !clientCtx.value) { return { isLoaded: false, signUp: undefined, setActive: undefined }; } return { isLoaded: true, signUp: clientCtx.value.signUp, - setActive: clerk.value!.setActive, + setActive: clerk.value.setActive, }; }); From cb36566db661f7010a80bf86fd705f0a1eb817dd Mon Sep 17 00:00:00 2001 From: Stefanos Anagnostou Date: Mon, 16 Dec 2024 13:14:49 +0200 Subject: [PATCH 05/10] chore(clerk-js): Add snapshot test for `PublicUserData` (#4782) --- .changeset/stale-cougars-roll.md | 2 ++ .../resources/__tests__/PublicUserData.test.ts | 18 ++++++++++++++++++ .../__snapshots__/PublicUserData.test.ts.snap | 3 +++ 3 files changed, 23 insertions(+) create mode 100644 .changeset/stale-cougars-roll.md create mode 100644 packages/clerk-js/src/core/resources/__tests__/PublicUserData.test.ts create mode 100644 packages/clerk-js/src/core/resources/__tests__/__snapshots__/PublicUserData.test.ts.snap diff --git a/.changeset/stale-cougars-roll.md b/.changeset/stale-cougars-roll.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/stale-cougars-roll.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/clerk-js/src/core/resources/__tests__/PublicUserData.test.ts b/packages/clerk-js/src/core/resources/__tests__/PublicUserData.test.ts new file mode 100644 index 0000000000..cf5f4473fd --- /dev/null +++ b/packages/clerk-js/src/core/resources/__tests__/PublicUserData.test.ts @@ -0,0 +1,18 @@ +import { PublicUserData } from '../PublicUserData'; + +describe('PublicUserData', () => { + it('JSON.stringify returns the same object structure', () => { + const pud = new PublicUserData({ + object: 'public_user_data', + id: '123', + first_name: 'John', + last_name: 'Doe', + image_url: 'https://example.com/image.jpg', + has_image: true, + identifier: 'john-doe', + user_id: '123', + }); + + expect(JSON.stringify(pud)).toMatchSnapshot(); + }); +}); diff --git a/packages/clerk-js/src/core/resources/__tests__/__snapshots__/PublicUserData.test.ts.snap b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/PublicUserData.test.ts.snap new file mode 100644 index 0000000000..01673ae963 --- /dev/null +++ b/packages/clerk-js/src/core/resources/__tests__/__snapshots__/PublicUserData.test.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`PublicUserData JSON.stringify returns the same object structure 1`] = `"{"firstName":"John","lastName":"Doe","imageUrl":"https://example.com/image.jpg","hasImage":true,"identifier":"john-doe","userId":"123"}"`; From 2d5c62b5dd655ffecd55d7ca1cc4d71782331a9e Mon Sep 17 00:00:00 2001 From: Lennart Date: Mon, 16 Dec 2024 14:08:23 +0100 Subject: [PATCH 06/10] chore(remix): Add note about React Router v7 to README (#4783) --- .changeset/large-hats-clap.md | 5 +++++ packages/remix/README.md | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/large-hats-clap.md diff --git a/.changeset/large-hats-clap.md b/.changeset/large-hats-clap.md new file mode 100644 index 0000000000..f40878e180 --- /dev/null +++ b/.changeset/large-hats-clap.md @@ -0,0 +1,5 @@ +--- +'@clerk/remix': patch +--- + +Add note about React Router v7 to the README. If you want to use React Router v7 and Clerk together, please use the [`@clerk/react-router`](https://clerk.com/docs/references/react-router/overview) SDK instead. diff --git a/packages/remix/README.md b/packages/remix/README.md index 7321ce2ef4..5d2c44d8a8 100644 --- a/packages/remix/README.md +++ b/packages/remix/README.md @@ -25,13 +25,15 @@
+> [!IMPORTANT] If you're starting a new project with React Router v7 or are in the process of upgrading a Remix v2 application, please use the [`@clerk/react-router`](https://clerk.com/docs/references/react-router/overview) SDK. `@clerk/remix` is only compatible with Remix v2. + ## Getting Started [Clerk](https://clerk.com/?utm_source=github&utm_medium=clerk_remix) is the easiest way to add authentication and user management to your Remix application. Add sign up, sign in, and profile management to your application in minutes. ### Prerequisites -- Remix `^2.0.0` or later +- Remix `^2.0.0` - React 18 or later - Node.js `>=18.17.0` or later - An existing Clerk application. [Create your account for free](https://dashboard.clerk.com/sign-up?utm_source=github&utm_medium=clerk_remix). From 528688406c476f7f5f8828ab5d40e31465992d29 Mon Sep 17 00:00:00 2001 From: Lennart Date: Mon, 16 Dec 2024 15:33:06 +0100 Subject: [PATCH 07/10] chore(react-router): Add basic unit tests (#4784) --- .changeset/pink-onions-ring.md | 2 + packages/react-router/package.json | 3 +- .../__snapshots__/exports.test.ts.snap | 50 +++++++++++++++++++ .../src/__tests__/exports.test.ts | 14 ++++++ .../src/utils/__tests__/assert.test.ts | 38 ++++++++++++++ packages/react-router/vitest.config.mts | 9 ++++ packages/react-router/vitest.setup.mts | 3 ++ 7 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 .changeset/pink-onions-ring.md create mode 100644 packages/react-router/src/__tests__/__snapshots__/exports.test.ts.snap create mode 100644 packages/react-router/src/__tests__/exports.test.ts create mode 100644 packages/react-router/src/utils/__tests__/assert.test.ts create mode 100644 packages/react-router/vitest.config.mts create mode 100644 packages/react-router/vitest.setup.mts diff --git a/.changeset/pink-onions-ring.md b/.changeset/pink-onions-ring.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/pink-onions-ring.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/react-router/package.json b/packages/react-router/package.json index 2684e85f95..25a46923ff 100644 --- a/packages/react-router/package.json +++ b/packages/react-router/package.json @@ -68,7 +68,8 @@ "lint": "eslint src/", "lint:attw": "attw --pack . --ignore-rules cjs-resolves-to-esm", "lint:publint": "publint", - "publish:local": "pnpm dlx yalc push --replace --sig" + "publish:local": "pnpm dlx yalc push --replace --sig", + "test": "vitest" }, "dependencies": { "@clerk/backend": "workspace:^", diff --git a/packages/react-router/src/__tests__/__snapshots__/exports.test.ts.snap b/packages/react-router/src/__tests__/__snapshots__/exports.test.ts.snap new file mode 100644 index 0000000000..90b135b14a --- /dev/null +++ b/packages/react-router/src/__tests__/__snapshots__/exports.test.ts.snap @@ -0,0 +1,50 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`root public exports > should not change unexpectedly 1`] = ` +[ + "AuthenticateWithRedirectCallback", + "ClerkLoaded", + "ClerkLoading", + "ClerkProvider", + "CreateOrganization", + "GoogleOneTap", + "OrganizationList", + "OrganizationProfile", + "OrganizationSwitcher", + "Protect", + "RedirectToCreateOrganization", + "RedirectToOrganizationProfile", + "RedirectToSignIn", + "RedirectToSignUp", + "RedirectToUserProfile", + "SignIn", + "SignInButton", + "SignInWithMetamaskButton", + "SignOutButton", + "SignUp", + "SignUpButton", + "SignedIn", + "SignedOut", + "UserButton", + "UserProfile", + "Waitlist", + "useAuth", + "useClerk", + "useEmailLink", + "useOrganization", + "useOrganizationList", + "useReverification", + "useSession", + "useSessionList", + "useSignIn", + "useSignUp", + "useUser", +] +`; + +exports[`ssr public exports > should not change unexpectedly 1`] = ` +[ + "getAuth", + "rootAuthLoader", +] +`; diff --git a/packages/react-router/src/__tests__/exports.test.ts b/packages/react-router/src/__tests__/exports.test.ts new file mode 100644 index 0000000000..4bba4ec227 --- /dev/null +++ b/packages/react-router/src/__tests__/exports.test.ts @@ -0,0 +1,14 @@ +import * as publicExports from '../index'; +import * as ssrExports from '../ssr/index'; + +describe('root public exports', () => { + it('should not change unexpectedly', () => { + expect(Object.keys(publicExports).sort()).toMatchSnapshot(); + }); +}); + +describe('ssr public exports', () => { + it('should not change unexpectedly', () => { + expect(Object.keys(ssrExports).sort()).toMatchSnapshot(); + }); +}); diff --git a/packages/react-router/src/utils/__tests__/assert.test.ts b/packages/react-router/src/utils/__tests__/assert.test.ts new file mode 100644 index 0000000000..931f362299 --- /dev/null +++ b/packages/react-router/src/utils/__tests__/assert.test.ts @@ -0,0 +1,38 @@ +/* eslint-disable no-global-assign */ +import { isSpaMode } from '../assert'; + +describe('isSpaMode', () => { + const currentWindow = window; + + afterEach(() => { + window = currentWindow; + }); + + it('should return undefined when window is undefined', () => { + expect(isSpaMode()).toBeUndefined(); + }); + + it('should return undefined when window.__reactRouterContext is undefined', () => { + // @ts-expect-error - Tests + window = { __reactRouterContext: undefined }; + expect(isSpaMode()).toBeUndefined(); + }); + + it('should return undefined when window.__reactRouterContext.isSpaMode is undefined', () => { + // @ts-expect-error - Tests + window = { __reactRouterContext: { isSpaMode: undefined } }; + expect(isSpaMode()).toBeUndefined(); + }); + + it('should return true when window.__reactRouterContext.isSpaMode is true', () => { + // @ts-expect-error - Tests + window = { __reactRouterContext: { isSpaMode: true } }; + expect(isSpaMode()).toBe(true); + }); + + it('should return false when window.__reactRouterContext.isSpaMode is false', () => { + // @ts-expect-error - Tests + window = { __reactRouterContext: { isSpaMode: false } }; + expect(isSpaMode()).toBe(false); + }); +}); diff --git a/packages/react-router/vitest.config.mts b/packages/react-router/vitest.config.mts new file mode 100644 index 0000000000..5fcd8bde40 --- /dev/null +++ b/packages/react-router/vitest.config.mts @@ -0,0 +1,9 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + globals: true, + environment: 'jsdom', + setupFiles: './vitest.setup.mts', + }, +}); diff --git a/packages/react-router/vitest.setup.mts b/packages/react-router/vitest.setup.mts new file mode 100644 index 0000000000..2c3b51d11f --- /dev/null +++ b/packages/react-router/vitest.setup.mts @@ -0,0 +1,3 @@ +globalThis.__DEV__ = true; +globalThis.PACKAGE_NAME = '@clerk/react-router'; +globalThis.PACKAGE_VERSION = '0.0.0-test'; From 2de7ac42f6db38e840ce84aceb2ecb1640493cf9 Mon Sep 17 00:00:00 2001 From: Alex Carpenter Date: Mon, 16 Dec 2024 09:49:10 -0500 Subject: [PATCH 08/10] fix(clerk-js): Redirect to current page within modal with no redirect url (#4768) --- .changeset/young-swans-sin.md | 5 +++++ .../clerk-js/src/ui/components/SignIn/SignIn.tsx | 1 + .../clerk-js/src/ui/components/SignUp/SignUp.tsx | 1 + .../clerk-js/src/ui/contexts/components/SignIn.ts | 3 ++- .../clerk-js/src/ui/contexts/components/SignUp.ts | 3 ++- .../src/utils/__tests__/redirectUrls.test.ts | 15 +++++++++++++++ packages/clerk-js/src/utils/redirectUrls.ts | 10 +++++++++- 7 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .changeset/young-swans-sin.md diff --git a/.changeset/young-swans-sin.md b/.changeset/young-swans-sin.md new file mode 100644 index 0000000000..320d0e91e5 --- /dev/null +++ b/.changeset/young-swans-sin.md @@ -0,0 +1,5 @@ +--- +'@clerk/clerk-js': minor +--- + +Redirect to the current page when within modal mode and no redirect URL is provided. diff --git a/packages/clerk-js/src/ui/components/SignIn/SignIn.tsx b/packages/clerk-js/src/ui/components/SignIn/SignIn.tsx index fbce678921..ea783fc013 100644 --- a/packages/clerk-js/src/ui/components/SignIn/SignIn.tsx +++ b/packages/clerk-js/src/ui/components/SignIn/SignIn.tsx @@ -176,6 +176,7 @@ export const SignInModal = (props: SignInModalProps): JSX.Element => { componentName: 'SignIn', ...signInProps, routing: 'virtual', + mode: 'modal', }} > {/*TODO: Used by InvisibleRootBox, can we simplify? */} diff --git a/packages/clerk-js/src/ui/components/SignUp/SignUp.tsx b/packages/clerk-js/src/ui/components/SignUp/SignUp.tsx index e231773fc8..430ae2f53a 100644 --- a/packages/clerk-js/src/ui/components/SignUp/SignUp.tsx +++ b/packages/clerk-js/src/ui/components/SignUp/SignUp.tsx @@ -103,6 +103,7 @@ export const SignUpModal = (props: SignUpModalProps): JSX.Element => { componentName: 'SignUp', ...signUpProps, routing: 'virtual', + mode: 'modal', }} > {/*TODO: Used by InvisibleRootBox, can we simplify? */} diff --git a/packages/clerk-js/src/ui/contexts/components/SignIn.ts b/packages/clerk-js/src/ui/contexts/components/SignIn.ts index c717bec4da..e089e0f1b9 100644 --- a/packages/clerk-js/src/ui/contexts/components/SignIn.ts +++ b/packages/clerk-js/src/ui/contexts/components/SignIn.ts @@ -37,7 +37,7 @@ export const useSignInContext = (): SignInContextType => { throw new Error(`Clerk: useSignInContext called outside of the mounted SignIn component.`); } - const { componentName, ..._ctx } = context; + const { componentName, mode, ..._ctx } = context; const ctx = _ctx.__experimental?.combinedProps || _ctx; const initialValuesFromQueryParams = useMemo( @@ -53,6 +53,7 @@ export const useSignInContext = (): SignInContextType => { signInForceRedirectUrl: ctx.forceRedirectUrl, }, queryParams, + mode, ); const afterSignInUrl = clerk.buildUrlWithAuth(redirectUrls.getAfterSignInUrl()); diff --git a/packages/clerk-js/src/ui/contexts/components/SignUp.ts b/packages/clerk-js/src/ui/contexts/components/SignUp.ts index d532d527af..643525c4ef 100644 --- a/packages/clerk-js/src/ui/contexts/components/SignUp.ts +++ b/packages/clerk-js/src/ui/contexts/components/SignUp.ts @@ -41,7 +41,7 @@ export const useSignUpContext = (): SignUpContextType => { throw new Error('Clerk: useSignUpContext called outside of the mounted SignUp component.'); } - const { componentName, ...ctx } = context; + const { componentName, mode, ...ctx } = context; const redirectUrls = new RedirectUrls( options, @@ -51,6 +51,7 @@ export const useSignUpContext = (): SignUpContextType => { signUpForceRedirectUrl: ctx.forceRedirectUrl, }, queryParams, + mode, ); const afterSignUpUrl = clerk.buildUrlWithAuth(redirectUrls.getAfterSignUpUrl()); diff --git a/packages/clerk-js/src/utils/__tests__/redirectUrls.test.ts b/packages/clerk-js/src/utils/__tests__/redirectUrls.test.ts index bcc95c1a96..8f7a3c4c51 100644 --- a/packages/clerk-js/src/utils/__tests__/redirectUrls.test.ts +++ b/packages/clerk-js/src/utils/__tests__/redirectUrls.test.ts @@ -244,6 +244,21 @@ describe('redirectUrls', () => { expect(redirectUrls.getAfterSignInUrl()).toBe(`${mockWindowLocation.href}search-param-redirect-url`); expect(redirectUrls.getAfterSignUpUrl()).toBe(`${mockWindowLocation.href}search-param-redirect-url`); }); + + it('returns to `/` when no redirect_url is found', () => { + const redirectUrls = new RedirectUrls({}, {}, {}); + expect(redirectUrls.getAfterSignInUrl()).toBe('/'); + expect(redirectUrls.getAfterSignUpUrl()).toBe('/'); + }); + + it('returns current window location when in modal mode and no redirect_url is found', () => { + const aboutPageUrl = 'https://www.clerk.com/about'; + mockWindowLocation = new URL(aboutPageUrl) as any as Window['location']; + Object.defineProperty(global.window, 'location', { value: mockWindowLocation }); + const redirectUrls = new RedirectUrls({}, {}, {}, 'modal'); + expect(redirectUrls.getAfterSignInUrl()).toBe(aboutPageUrl); + expect(redirectUrls.getAfterSignUpUrl()).toBe(aboutPageUrl); + }); }); describe('search params', () => { diff --git a/packages/clerk-js/src/utils/redirectUrls.ts b/packages/clerk-js/src/utils/redirectUrls.ts index b31b728cd8..e4b2a32ec0 100644 --- a/packages/clerk-js/src/utils/redirectUrls.ts +++ b/packages/clerk-js/src/utils/redirectUrls.ts @@ -5,6 +5,8 @@ import type { ClerkOptions, RedirectOptions } from '@clerk/types'; import { assertNoLegacyProp, warnForNewPropShadowingLegacyProp } from './assertNoLegacyProp'; import { isAllowedRedirect, relativeToAbsoluteUrl } from './url'; +type ComponentMode = 'modal' | 'mounted'; + export class RedirectUrls { private static keys: (keyof RedirectOptions)[] = [ 'signInForceRedirectUrl', @@ -22,12 +24,14 @@ export class RedirectUrls { private readonly fromOptions: RedirectOptions; private readonly fromProps: RedirectOptions; private readonly fromSearchParams: RedirectOptions & { redirectUrl?: string | null }; + private readonly mode?: ComponentMode; - constructor(options: ClerkOptions, props: RedirectOptions = {}, searchParams: any = {}) { + constructor(options: ClerkOptions, props: RedirectOptions = {}, searchParams: any = {}, mode?: ComponentMode) { this.options = options; this.fromOptions = this.#parse(options || {}); this.fromProps = this.#parse(props || {}); this.fromSearchParams = this.#parseSearchParams(searchParams || {}); + this.mode = mode; } getAfterSignInUrl() { @@ -136,6 +140,10 @@ export class RedirectUrls { warnForNewPropShadowingLegacyProp(newKeyInUse, result, legacyPropKey, legacyValue); result ||= legacyValue; + if (!result && this.mode === 'modal') { + return window.location.href; + } + return result || '/'; } From 1677fa46862accd25d4837c9abd9a7a70c5b7858 Mon Sep 17 00:00:00 2001 From: dikaioAI <141150993+dikaioai@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:53:07 +0200 Subject: [PATCH 09/10] fix(localizations): Improve `el-GR` localization (#4757) Co-authored-by: Stefanos Anagnostou Co-authored-by: Stefanos Anagnostou --- .changeset/loud-keys-smash.md | 5 ++ packages/localizations/src/el-GR.ts | 77 +++++++++++++++-------------- 2 files changed, 44 insertions(+), 38 deletions(-) create mode 100644 .changeset/loud-keys-smash.md diff --git a/.changeset/loud-keys-smash.md b/.changeset/loud-keys-smash.md new file mode 100644 index 0000000000..57167792b6 --- /dev/null +++ b/.changeset/loud-keys-smash.md @@ -0,0 +1,5 @@ +--- +"@clerk/localizations": patch +--- + +Improve `el-GR` localization. diff --git a/packages/localizations/src/el-GR.ts b/packages/localizations/src/el-GR.ts index 0b69da0e26..80b6b3dc27 100644 --- a/packages/localizations/src/el-GR.ts +++ b/packages/localizations/src/el-GR.ts @@ -53,20 +53,20 @@ export const elGR: LocalizationResource = { formFieldHintText__slug: 'A slug is a human-readable ID that must be unique. It’s often used in URLs.', formFieldInputPlaceholder__backupCode: undefined, formFieldInputPlaceholder__confirmDeletionUserAccount: 'Delete account', - formFieldInputPlaceholder__emailAddress: undefined, - formFieldInputPlaceholder__emailAddress_username: undefined, + formFieldInputPlaceholder__emailAddress: 'Εισάγετε τη διεύθυνση email σας', + formFieldInputPlaceholder__emailAddress_username: 'Εισάγετε email ή όνομα χρήστη', formFieldInputPlaceholder__emailAddresses: 'Εισαγάγετε ή επικολλήστε μία ή περισσότερες διευθύνσεις email, χωρισμένες με κενά ή κόμματα', - formFieldInputPlaceholder__firstName: undefined, - formFieldInputPlaceholder__lastName: undefined, - formFieldInputPlaceholder__organizationDomain: undefined, - formFieldInputPlaceholder__organizationDomainEmailAddress: undefined, - formFieldInputPlaceholder__organizationName: undefined, - formFieldInputPlaceholder__organizationSlug: undefined, - formFieldInputPlaceholder__password: undefined, - formFieldInputPlaceholder__phoneNumber: undefined, + formFieldInputPlaceholder__firstName: 'Όνομα', + formFieldInputPlaceholder__lastName: 'Επώνυμο', + formFieldInputPlaceholder__organizationDomain: 'example.com', + formFieldInputPlaceholder__organizationDomainEmailAddress: 'you@example.com', + formFieldInputPlaceholder__organizationName: 'Όνομα οργανισμού', + formFieldInputPlaceholder__organizationSlug: 'my-org', formFieldInputPlaceholder__username: undefined, - formFieldLabel__automaticInvitations: 'Enable automatic invitations for this domain', + formFieldInputPlaceholder__password: 'Εισάγετε τον κωδικό σας', + formFieldInputPlaceholder__phoneNumber: 'Εισάγετε τον αριθμό τηλεφώνου σας', + formFieldLabel__automaticInvitations: 'Ενεργοποίηση αυτόματων προσκλήσεων για αυτόν τον τομέα', formFieldLabel__backupCode: 'Αντίγραφο ασφαλείας κωδικού', formFieldLabel__confirmDeletion: 'Επιβεβαίωση', formFieldLabel__confirmPassword: 'Επιβεβαίωση κωδικού πρόσβασης', @@ -78,10 +78,10 @@ export const elGR: LocalizationResource = { formFieldLabel__lastName: 'Επώνυμο', formFieldLabel__newPassword: 'Νέος κωδικός πρόσβασης', formFieldLabel__organizationDomain: 'Domain', - formFieldLabel__organizationDomainDeletePending: 'Delete pending invitations and suggestions', - formFieldLabel__organizationDomainEmailAddress: 'Verification email address', + formFieldLabel__organizationDomainDeletePending: 'Διαγραφή εκκρεμών προσκλήσεων και προτάσεων', + formFieldLabel__organizationDomainEmailAddress: 'Διεύθυνση email επαλήθευσης', formFieldLabel__organizationDomainEmailAddressDescription: - 'Enter an email address under this domain to receive a code and verify this domain.', + 'Εισάγετε μια διεύθυνση email σε αυτόν τον τομέα για να λάβετε κωδικό και να επαληθεύσετε τον τομέα.', formFieldLabel__organizationName: 'Όνομα οργανισμού', formFieldLabel__organizationSlug: 'Συντόμευση URL', formFieldLabel__passkeyName: undefined, @@ -99,31 +99,31 @@ export const elGR: LocalizationResource = { membershipRole__basicMember: 'Μέλος', membershipRole__guestMember: 'Επισκέπτης', organizationList: { - action__createOrganization: 'Create organization', - action__invitationAccept: 'Join', - action__suggestionsAccept: 'Request to join', - createOrganization: 'Create Organization', - invitationAcceptedLabel: 'Joined', - subtitle: 'to continue to {{applicationName}}', - suggestionsAcceptedLabel: 'Pending approval', - title: 'Choose an account', - titleWithoutPersonal: 'Choose an organization', + action__createOrganization: 'Δημιουργία οργανισμού', + action__invitationAccept: 'Συμμετοχή', + action__suggestionsAccept: 'Αίτηση συμμετοχής', + createOrganization: 'Δημιουργία Οργανισμού', + invitationAcceptedLabel: 'Συμμετέχετε', + subtitle: 'για να συνεχίσετε στο {{applicationName}}', + suggestionsAcceptedLabel: 'Εκκρεμεί έγκριση', + title: 'Επιλέξτε λογαριασμό', + titleWithoutPersonal: 'Επιλέξτε οργανισμό', }, organizationProfile: { - badge__automaticInvitation: 'Automatic invitations', - badge__automaticSuggestion: 'Automatic suggestions', - badge__manualInvitation: 'No automatic enrollment', - badge__unverified: 'Unverified', + badge__automaticInvitation: 'Αυτόματες προσκλήσεις', + badge__automaticSuggestion: 'Αυτόματες προτάσεις', + badge__manualInvitation: 'Χωρίς αυτόματη εγγραφή', + badge__unverified: 'Μη επαληθευμένο', createDomainPage: { subtitle: - 'Add the domain to verify. Users with email addresses at this domain can join the organization automatically or request to join.', - title: 'Add domain', + 'Προσθέστε τον τομέα για επαλήθευση. Χρήστες με διευθύνσεις email σε αυτόν τον τομέα μπορούν να συμμετάσχουν στον οργανισμό αυτόματα ή να αιτηθούν συμμετοχή.', + title: 'Προσθήκη τομέα', }, invitePage: { detailsTitle__inviteFailed: 'Οι προσκλήσεις δεν μπορούσαν να σταλούν. Διορθώστε τα παρακάτω στοιχεία και δοκιμάστε ξανά:', formButtonPrimary__continue: 'Αποστολή προσκλήσεων', - selectDropdown__role: 'Select role', + selectDropdown__role: 'Επιλογή ρόλου', subtitle: 'Προσκαλέστε νέα μέλη σε αυτόν τον οργανισμό', successMessage: 'Οι προσκλήσεις εστάλησαν με επιτυχία', title: 'Πρόσκληση μελών', @@ -132,7 +132,7 @@ export const elGR: LocalizationResource = { action__invite: 'Πρόσκληση', activeMembersTab: { menuAction__remove: 'Αφαίρεση μέλους', - tableHeader__actions: undefined, + tableHeader__actions: 'Ενέργειες', tableHeader__joined: 'Εγγραφήκατε', tableHeader__role: 'Ρόλος', tableHeader__user: 'Χρήστης', @@ -417,8 +417,9 @@ export const elGR: LocalizationResource = { title: 'Δεν είναι δυνατή η σύνδεση', }, passkey: { - subtitle: undefined, - title: undefined, + subtitle: + 'Η χρήση του passkey σας επιβεβαιώνει την ταυτότητά σας. Η συσκευή σας μπορεί να ζητήσει δακτυλικό αποτύπωμα, αναγνώριση προσώπου ή κλείδωμα οθόνης.', + title: 'Χρησιμοποιήστε το passkey σας', }, password: { actionLink: 'Χρήση άλλης μεθόδου', @@ -426,7 +427,7 @@ export const elGR: LocalizationResource = { title: 'Εισαγωγή κωδικού πρόσβασης', }, passwordPwned: { - title: undefined, + title: 'Παραβιασμένος κωδικός', }, phoneCode: { formTitle: 'Κωδικός επαλήθευσης', @@ -452,17 +453,17 @@ export const elGR: LocalizationResource = { }, start: { actionLink: 'Εγγραφή', - actionLink__join_waitlist: undefined, + actionLink__join_waitlist: 'Εγγραφή στη λίστα αναμονής', actionLink__use_email: 'Χρήση email', actionLink__use_email_username: 'Χρήση email ή ονόματος χρήστη', - actionLink__use_passkey: undefined, + actionLink__use_passkey: 'Χρήση passkey', actionLink__use_phone: 'Χρήση τηλεφώνου', actionLink__use_username: 'Χρήση ονόματος χρήστη', actionText: 'Δεν έχετε λογαριασμό;', - actionText__join_waitlist: undefined, + actionText__join_waitlist: 'Θέλετε πρώιμη πρόσβαση;', subtitle: 'για να συνεχίσετε στο {{applicationName}}', title: 'Σύνδεση', - __experimental_titleCombined: undefined, + __experimental_titleCombined: 'Συνέχεια στο {{applicationName}}', }, totpMfa: { formTitle: 'Κωδικός επαλήθευσης', From dcd2f3973ca90500fda9e52c4f81e631c49e87fc Mon Sep 17 00:00:00 2001 From: Jack <59290502+mic0ishere@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:53:42 +0100 Subject: [PATCH 10/10] fix(localizations): Improve `pl-PL` localization (#4781) Co-authored-by: Stefanos Anagnostou --- .changeset/ninety-wasps-rush.md | 5 ++ packages/localizations/src/pl-PL.ts | 106 +++++++++++++++------------- 2 files changed, 61 insertions(+), 50 deletions(-) create mode 100644 .changeset/ninety-wasps-rush.md diff --git a/.changeset/ninety-wasps-rush.md b/.changeset/ninety-wasps-rush.md new file mode 100644 index 0000000000..83e194077e --- /dev/null +++ b/.changeset/ninety-wasps-rush.md @@ -0,0 +1,5 @@ +--- +"@clerk/localizations": patch +--- + +Improve `pl-PL` localization. diff --git a/packages/localizations/src/pl-PL.ts b/packages/localizations/src/pl-PL.ts index d6bdb6b7db..3d5f319b8e 100644 --- a/packages/localizations/src/pl-PL.ts +++ b/packages/localizations/src/pl-PL.ts @@ -51,20 +51,20 @@ export const plPL: LocalizationResource = { formFieldError__verificationLinkExpired: 'Link weryfikacyjny wygasł. Spróbuj ponownie.', formFieldHintText__optional: 'Opcjonalne', formFieldHintText__slug: 'Jest to unikalne ID, które jest czytelne dla człowieka, często używane w adresach URL.', - formFieldInputPlaceholder__backupCode: undefined, + formFieldInputPlaceholder__backupCode: 'Wprowadź kod zapasowy', formFieldInputPlaceholder__confirmDeletionUserAccount: 'Usuń konto', - formFieldInputPlaceholder__emailAddress: undefined, - formFieldInputPlaceholder__emailAddress_username: undefined, + formFieldInputPlaceholder__emailAddress: 'Wprowadź adres email', + formFieldInputPlaceholder__emailAddress_username: 'Adres e-mail lub nazwa użytkownika', formFieldInputPlaceholder__emailAddresses: 'Wprowadź lub wklej jeden lub więcej adresów e-mail, oddzielonych spacjami lub przecinkami', - formFieldInputPlaceholder__firstName: undefined, - formFieldInputPlaceholder__lastName: undefined, - formFieldInputPlaceholder__organizationDomain: undefined, - formFieldInputPlaceholder__organizationDomainEmailAddress: undefined, - formFieldInputPlaceholder__organizationName: undefined, - formFieldInputPlaceholder__organizationSlug: undefined, - formFieldInputPlaceholder__password: undefined, - formFieldInputPlaceholder__phoneNumber: undefined, + formFieldInputPlaceholder__firstName: 'Imię', + formFieldInputPlaceholder__lastName: 'Nazwisko', + formFieldInputPlaceholder__organizationDomain: 'example.com', + formFieldInputPlaceholder__organizationDomainEmailAddress: 'jan.kowalski@example.com', + formFieldInputPlaceholder__organizationName: 'Nazwa organizacji', + formFieldInputPlaceholder__organizationSlug: 'moja-organizacja', + formFieldInputPlaceholder__password: 'Wprowadź swoje hasło', + formFieldInputPlaceholder__phoneNumber: 'Wprowadź numer telefonu', formFieldInputPlaceholder__username: undefined, formFieldLabel__automaticInvitations: 'Włącz automatyczne zaproszenia dla tej domeny', formFieldLabel__backupCode: 'Kod zapasowy', @@ -84,7 +84,7 @@ export const plPL: LocalizationResource = { 'Enter an email address under this domain to receive a code and verify this domain.', formFieldLabel__organizationName: 'Nazwa organizacji', formFieldLabel__organizationSlug: 'Slug URL', - formFieldLabel__passkeyName: undefined, + formFieldLabel__passkeyName: 'Nazwa klucza dostępu', formFieldLabel__password: 'Hasło', formFieldLabel__phoneNumber: 'Numer telefonu', formFieldLabel__role: 'Rola', @@ -94,7 +94,7 @@ export const plPL: LocalizationResource = { action__signOut: 'Wyloguj', title: 'Zalogowano jako {{identifier}}', }, - maintenanceMode: undefined, + maintenanceMode: 'Aktualnie trwają prace konserwacyjne, ale nie powinno to zająć dłużej niż kilka minut.', membershipRole__admin: 'Administrator', membershipRole__basicMember: 'Użytkownik', membershipRole__guestMember: 'Gość', @@ -339,7 +339,7 @@ export const plPL: LocalizationResource = { blockButton__backupCode: 'Użyj kodu zapasowego', blockButton__emailCode: 'Wyślij kod do {{identifier}}', blockButton__emailLink: 'Wyślij link do {{identifier}}', - blockButton__passkey: undefined, + blockButton__passkey: 'Zaloguj się za pomocą klucza dostępowego', blockButton__password: 'Zaloguj się za pomocą hasła', blockButton__phoneCode: 'Wyślij kod do {{identifier}}', blockButton__totp: 'Użyj aplikacji uwierzytelniającej', @@ -364,8 +364,9 @@ export const plPL: LocalizationResource = { }, emailLink: { clientMismatch: { - subtitle: undefined, - title: undefined, + subtitle: + 'Aby kontynuować, otwórz link weryfikacyjny na urządzeniu i w przeglądarce, w której rozpocząłeś logowanie', + title: 'Link weryfikacyjny jest nieprawidłowy dla tego urządzenia', }, expired: { subtitle: 'Powróć do oryginalnej karty, aby kontynuować.', @@ -416,8 +417,9 @@ export const plPL: LocalizationResource = { title: 'Nie można się zalogować', }, passkey: { - subtitle: undefined, - title: undefined, + subtitle: + 'Użycie klucza dostępu potwierdza, że to Ty. Urządzenie może poprosić o twój odcisk palca, twarz lub blokadę ekranu.', + title: 'Użyj swojego klucza dostępowego', }, password: { actionLink: 'Użyj innego sposobu', @@ -425,7 +427,7 @@ export const plPL: LocalizationResource = { title: 'Wprowadź swoje hasło', }, passwordPwned: { - title: undefined, + title: 'Hasło skompromitowane', }, phoneCode: { formTitle: 'Kod weryfikacyjny', @@ -436,7 +438,7 @@ export const plPL: LocalizationResource = { phoneCodeMfa: { formTitle: 'Kod weryfikacyjny', resendButton: 'Wyślij kod ponownie', - subtitle: undefined, + subtitle: 'Aby kontynuować, wprowadź kod weryfikacyjny wysłany na Twój telefon', title: 'Sprawdź swój telefon', }, resetPassword: { @@ -449,22 +451,22 @@ export const plPL: LocalizationResource = { detailsLabel: 'We need to verify your identity before resetting your password.', }, start: { + __experimental_titleCombined: 'Kontynuuj do {{applicationName}}', actionLink: 'Zarejestruj się', - actionLink__join_waitlist: undefined, + actionLink__join_waitlist: 'Dołącz do listy oczekujących', actionLink__use_email: 'Użyj adresu e-mail', actionLink__use_email_username: 'Użyj adresu e-mail lub nazwy użytkownika', - actionLink__use_passkey: undefined, + actionLink__use_passkey: 'Użyj klucza dostępowego', actionLink__use_phone: 'Użyj numeru telefonu', actionLink__use_username: 'Użyj nazwy użytkownika', actionText: 'Nie masz konta?', - actionText__join_waitlist: undefined, + actionText__join_waitlist: 'Chcesz otrzymać wczesny dostęp?', subtitle: 'aby przejść do {{applicationName}}', title: 'Zaloguj się', - __experimental_titleCombined: undefined, }, totpMfa: { formTitle: 'Kod weryfikacyjny', - subtitle: undefined, + subtitle: 'Aby kontynuować, wprowadź kod weryfikacyjny wygenerowany przez aplikację uwierzytelniającą', title: 'Weryfikacja dwustopniowa', }, }, @@ -485,8 +487,9 @@ export const plPL: LocalizationResource = { }, emailLink: { clientMismatch: { - subtitle: undefined, - title: undefined, + subtitle: + 'Aby kontynuować, otwórz link weryfikacyjny na urządzeniu i w przeglądarce, w której rozpocząłeś rejestrację', + title: 'Link weryfikacyjny jest nieprawidłowy dla tego urządzenia', }, formSubtitle: 'Użyj linku weryfikacyjnego wysłanego na Twój adres e-mail', formTitle: 'Link weryfikacyjny', @@ -507,13 +510,14 @@ export const plPL: LocalizationResource = { }, legalConsent: { checkbox: { - label__onlyPrivacyPolicy: undefined, - label__onlyTermsOfService: undefined, - label__termsOfServiceAndPrivacyPolicy: undefined, + label__onlyPrivacyPolicy: 'Akceptuję {{ privacyPolicyLink || link("Polityką prywatności") }}', + label__onlyTermsOfService: 'Akceptuję {{ termsOfServiceLink || link("Warunki świadczenia usługi") }}"', + label__termsOfServiceAndPrivacyPolicy: + 'Akceptuję {{ termsOfServiceLink || link("Warunki świadczenia usługi") }} i {{ privacyPolicyLink || link("Politykę prywatności") }}', }, continue: { - subtitle: undefined, - title: undefined, + subtitle: 'Przeczytaj i zaakceptuj warunki, aby kontynuować', + title: 'Zgadzam się', }, }, phoneCode: { @@ -524,18 +528,20 @@ export const plPL: LocalizationResource = { title: 'Zweryfikuj swój numer telefonu', }, restrictedAccess: { - actionLink: undefined, - actionText: undefined, - blockButton__emailSupport: undefined, - blockButton__joinWaitlist: undefined, - subtitle: undefined, - subtitleWaitlist: undefined, - title: undefined, + actionLink: 'Zaloguj się', + actionText: 'Masz już konto?', + blockButton__emailSupport: 'Skontaktuj się z pomocą', + blockButton__joinWaitlist: 'Dołącz do listy oczekujących', + subtitle: + 'Rejestracja jest obecnie wyłączona. Jeśli uważasz, że powinieneś mieć dostęp, skontaktuj się z pomocą techniczną.', + subtitleWaitlist: + 'Rejestracja jest obecnie wyłączona. Aby dowiedzieć się jako pierwszy o naszym starcie, dołącz do listy oczekujących.', + title: 'Access restricted', }, start: { actionLink: 'Zaloguj się', - actionLink__use_email: undefined, - actionLink__use_phone: undefined, + actionLink__use_email: 'Użyj adresu e-mail', + actionLink__use_phone: 'Użyj numeru telefonu', actionText: 'Masz już konto?', subtitle: 'aby kontynuować w {{applicationName}}', title: 'Utwórz swoje konto', @@ -768,11 +774,11 @@ export const plPL: LocalizationResource = { }, passkeyScreen: { removeResource: { - messageLine1: undefined, - title: undefined, + messageLine1: '{{name}} zostanie usunięty z tego konta.', + title: 'Usuń klucz dostępu', }, - subtitle__rename: undefined, - title__rename: undefined, + subtitle__rename: 'Możesz zmienić nazwę klucza dostępu aby go łatwiej znaleźć.', + title__rename: 'Zmień nazwę klucza dostępu', }, passwordPage: { checkboxInfoText__signOutOfOtherSessions: @@ -816,7 +822,7 @@ export const plPL: LocalizationResource = { actionLabel__reauthorize: 'Autoryzuj teraz', destructiveActionTitle: 'Odłącz', primaryButton: 'Połącz konto', - subtitle__disconnected: undefined, + subtitle__disconnected: 'To konto zostało odłączone', subtitle__reauthorize: 'The required scopes have been updated, and you may be experiencing limited functionality. Please re-authorize this application to avoid any issues', title: 'Połączone konta', @@ -858,9 +864,9 @@ export const plPL: LocalizationResource = { }, }, passkeysSection: { - menuAction__destructive: undefined, - menuAction__rename: undefined, - title: undefined, + menuAction__destructive: 'Usuń', + menuAction__rename: 'Zmień nazwę', + title: 'Klucze dostępu', }, passwordSection: { primaryButton__setPassword: 'Ustaw hasło', @@ -876,7 +882,7 @@ export const plPL: LocalizationResource = { title: 'Numery telefonów', }, profileSection: { - primaryButton: undefined, + primaryButton: 'Zaaktualizuj profil', title: 'Profil', }, usernameSection: {