Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/tall-dryers-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@clerk/clerk-js': minor
'@clerk/shared': minor
'@clerk/types': minor
---

[Billing Beta] Replace `redirectUrl` with `navigate` in `checkout.finalize()`
7 changes: 4 additions & 3 deletions packages/clerk-js/src/core/modules/checkout/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
__experimental_CheckoutCacheState,
__experimental_CheckoutInstance,
__experimental_CheckoutOptions,
SetActiveNavigate,
} from '@clerk/types';

import type { Clerk } from '../../clerk';
Expand Down Expand Up @@ -62,9 +63,9 @@ function createCheckoutInstance(
});
};

const finalize = (params?: { redirectUrl: string }) => {
const { redirectUrl } = params || {};
return clerk.setActive({ session: clerk.session?.id, redirectUrl });
const finalize = (params?: { navigate?: SetActiveNavigate }) => {
const { navigate } = params || {};
return clerk.setActive({ session: clerk.session?.id, navigate });
};

const clear = () => manager.clearCheckout();
Expand Down
3 changes: 2 additions & 1 deletion packages/shared/src/react/hooks/useCheckout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
__experimental_CheckoutCacheState,
__experimental_CheckoutInstance,
CommerceCheckoutResource,
SetActiveNavigate,
} from '@clerk/types';
import { useMemo, useSyncExternalStore } from 'react';

Expand Down Expand Up @@ -57,7 +58,7 @@ type __experimental_UseCheckoutReturn = {
confirm: __experimental_CheckoutInstance['confirm'];
start: __experimental_CheckoutInstance['start'];
clear: () => void;
finalize: (params?: { redirectUrl: string }) => void;
finalize: (params?: { navigate?: SetActiveNavigate }) => void;
getState: () => __experimental_CheckoutCacheState;
isStarting: boolean;
isConfirming: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
confirm: (params: ConfirmCheckoutParams) => Promise<CheckoutResult>;
start: () => Promise<CheckoutResult>;
clear: () => void;
finalize: (params?: { redirectUrl: string }) => Promise<void>;
finalize: (params?: { navigate?: SetActiveNavigate }) => Promise<void>;
subscribe: (listener: (state: __experimental_CheckoutCacheState) => void) => () => void;
getState: () => __experimental_CheckoutCacheState;
};
Expand Down Expand Up @@ -1144,7 +1144,7 @@
*/
windowNavigate: (to: URL | string) => void;
},
) => Promise<unknown> | unknown;

Check warning on line 1147 in packages/types/src/clerk.ts

View workflow job for this annotation

GitHub Actions / Static analysis

'unknown' overrides all other types in this union type

export type WithoutRouting<T> = Omit<T, 'path' | 'routing'>;

Expand Down
Loading