Skip to content

Commit b846a9a

Browse files
authored
refactor(types): Rename CheckoutProps and PlanDetailsProps to __internal_CheckoutProps and __internal_PlanDetailsProps (#5838)
1 parent 9c41091 commit b846a9a

File tree

12 files changed

+51
-40
lines changed

12 files changed

+51
-40
lines changed

.changeset/shiny-impalas-occur.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@clerk/clerk-js": patch
3+
"@clerk/clerk-react": patch
4+
"@clerk/types": patch
5+
---
6+
7+
Rename CheckoutProps and PlanDetailsProps to __internal_CheckoutProps and __internal_PlanDetailsProps

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ import {
1515
import { addClerkPrefix, isAbsoluteUrl, stripScheme } from '@clerk/shared/url';
1616
import { allSettled, handleValueOrFn, noop } from '@clerk/shared/utils';
1717
import type {
18+
__internal_CheckoutProps,
1819
__internal_ComponentNavigationContext,
20+
__internal_PlanDetailsProps,
1921
__internal_UserVerificationModalProps,
2022
AuthenticateWithCoinbaseWalletParams,
2123
AuthenticateWithGoogleOneTapParams,
2224
AuthenticateWithMetamaskParams,
2325
AuthenticateWithOKXWalletParams,
24-
CheckoutProps,
2526
Clerk as ClerkInterface,
2627
ClerkAPIError,
2728
ClerkAuthenticateWithWeb3Params,
@@ -49,7 +50,6 @@ import type {
4950
OrganizationResource,
5051
OrganizationSwitcherProps,
5152
PendingSessionResource,
52-
PlanDetailsProps,
5353
PricingTableProps,
5454
PublicKeyCredentialCreationOptionsWithoutExtensions,
5555
PublicKeyCredentialRequestOptionsWithoutExtensions,
@@ -546,7 +546,7 @@ export class Clerk implements ClerkInterface {
546546
void this.#componentControls.ensureMounted().then(controls => controls.closeModal('signIn'));
547547
};
548548

549-
public __internal_openCheckout = (props?: CheckoutProps): void => {
549+
public __internal_openCheckout = (props?: __internal_CheckoutProps): void => {
550550
this.assertComponentsReady(this.#componentControls);
551551
if (disabledBillingFeature(this, this.environment)) {
552552
if (this.#instanceType === 'development') {
@@ -575,7 +575,7 @@ export class Clerk implements ClerkInterface {
575575
void this.#componentControls.ensureMounted().then(controls => controls.closeDrawer('checkout'));
576576
};
577577

578-
public __internal_openPlanDetails = (props?: PlanDetailsProps): void => {
578+
public __internal_openPlanDetails = (props?: __internal_PlanDetailsProps): void => {
579579
this.assertComponentsReady(this.#componentControls);
580580
if (disabledBillingFeature(this, this.environment)) {
581581
if (this.#instanceType === 'development') {

packages/clerk-js/src/ui/Components.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { createDeferredPromise } from '@clerk/shared/utils';
22
import type {
3+
__internal_CheckoutProps,
4+
__internal_PlanDetailsProps,
35
__internal_UserVerificationProps,
46
Appearance,
5-
CheckoutProps,
67
Clerk,
78
ClerkOptions,
89
CreateOrganizationProps,
910
EnvironmentResource,
1011
GoogleOneTapProps,
1112
OrganizationProfileProps,
12-
PlanDetailsProps,
1313
SignInProps,
1414
SignUpProps,
1515
UserProfileProps,
@@ -108,7 +108,11 @@ export type ComponentControls = {
108108
) => void;
109109
openDrawer: <T extends 'checkout' | 'planDetails'>(
110110
drawer: T,
111-
props: T extends 'checkout' ? CheckoutProps : T extends 'planDetails' ? PlanDetailsProps : never,
111+
props: T extends 'checkout'
112+
? __internal_CheckoutProps
113+
: T extends 'planDetails'
114+
? __internal_PlanDetailsProps
115+
: never,
112116
) => void;
113117
closeDrawer: (
114118
drawer: 'checkout' | 'planDetails',
@@ -150,11 +154,11 @@ interface ComponentsState {
150154
waitlistModal: null | WaitlistProps;
151155
checkoutDrawer: {
152156
open: false;
153-
props: null | CheckoutProps;
157+
props: null | __internal_CheckoutProps;
154158
};
155159
planDetailsDrawer: {
156160
open: false;
157-
props: null | PlanDetailsProps;
161+
props: null | __internal_PlanDetailsProps;
158162
};
159163
nodes: Map<HTMLDivElement, HtmlNodeOptions>;
160164
impersonationFab: boolean;

packages/clerk-js/src/ui/components/Checkout/Checkout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { CheckoutProps } from '@clerk/types';
1+
import type { __internal_CheckoutProps } from '@clerk/types';
22

33
import { CheckoutContext, SubscriberTypeContext } from '../../contexts';
44
import { Flow } from '../../customizables';
55
import { Drawer } from '../../elements';
66
import { CheckoutPage } from './CheckoutPage';
77

8-
export const Checkout = (props: CheckoutProps) => {
8+
export const Checkout = (props: __internal_CheckoutProps) => {
99
return (
1010
<Flow.Root flow='checkout'>
1111
<Flow.Part>

packages/clerk-js/src/ui/components/Checkout/CheckoutPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CheckoutProps, ClerkAPIError, CommerceCheckoutResource } from '@clerk/types';
1+
import type { __internal_CheckoutProps, ClerkAPIError, CommerceCheckoutResource } from '@clerk/types';
22
import { useEffect } from 'react';
33

44
import { Alert, Box, Flex, localizationKeys, Spinner, useAppearance, useLocalizations } from '../../customizables';
@@ -8,7 +8,7 @@ import { EmailForm } from '../UserProfile/EmailForm';
88
import { CheckoutComplete } from './CheckoutComplete';
99
import { CheckoutForm } from './CheckoutForm';
1010

11-
export const CheckoutPage = (props: CheckoutProps) => {
11+
export const CheckoutPage = (props: __internal_CheckoutProps) => {
1212
const { translateError } = useLocalizations();
1313
const { planId, planPeriod, subscriberType, onSubscriptionComplete } = props;
1414
const { setIsOpen, isOpen } = useDrawerContext();

packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { useClerk, useOrganization } from '@clerk/shared/react';
22
import type {
3+
__internal_PlanDetailsProps,
34
ClerkAPIError,
45
ClerkRuntimeError,
56
CommercePlanResource,
67
CommerceSubscriptionPlanPeriod,
78
CommerceSubscriptionResource,
8-
PlanDetailsProps,
99
} from '@clerk/types';
1010
import * as React from 'react';
1111
import { useState } from 'react';
@@ -28,7 +28,7 @@ import { Alert, Avatar, Drawer, SegmentedControl, useDrawerContext } from '../..
2828
import { InformationCircle } from '../../icons';
2929
import { formatDate, handleError } from '../../utils';
3030

31-
export const PlanDetails = (props: PlanDetailsProps) => {
31+
export const PlanDetails = (props: __internal_PlanDetailsProps) => {
3232
return (
3333
<SubscriberTypeContext.Provider value={props.subscriberType || 'user'}>
3434
<PlansContextProvider>
@@ -43,7 +43,7 @@ const PlanDetailsInternal = ({
4343
onSubscriptionCancel,
4444
portalRoot,
4545
planPeriod: _planPeriod = 'month',
46-
}: PlanDetailsProps) => {
46+
}: __internal_PlanDetailsProps) => {
4747
const clerk = useClerk();
4848
const { organization } = useOrganization();
4949
const [showConfirmation, setShowConfirmation] = useState(false);
@@ -91,11 +91,11 @@ const PlanDetailsInternal = ({
9191
});
9292
};
9393

94-
type OpenCheckoutProps = {
94+
type Open__internal_CheckoutProps = {
9595
planPeriod?: CommerceSubscriptionPlanPeriod;
9696
};
9797

98-
const openCheckout = (props?: OpenCheckoutProps) => {
98+
const openCheckout = (props?: Open__internal_CheckoutProps) => {
9999
handleClose();
100100

101101
// if the plan doesn't support annual, use monthly

packages/clerk-js/src/ui/hooks/useCheckout.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { ClerkAPIResponseError } from '@clerk/shared/error';
22
import { useClerk, useOrganization, useUser } from '@clerk/shared/react';
3-
import type { CheckoutProps, CommerceCheckoutResource } from '@clerk/types';
3+
import type { __internal_CheckoutProps, CommerceCheckoutResource } from '@clerk/types';
44
import { useCallback, useEffect, useState } from 'react';
55

66
import { useFetch } from './useFetch';
77

8-
export const useCheckout = (props: CheckoutProps) => {
8+
export const useCheckout = (props: __internal_CheckoutProps) => {
99
const { planId, planPeriod, subscriberType = 'user' } = props;
1010
const clerk = useClerk();
1111
const { organization } = useOrganization();

packages/clerk-js/src/ui/lazyModules/MountedCheckoutDrawer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useUser } from '@clerk/shared/react';
2-
import type { Appearance, CheckoutProps } from '@clerk/types';
2+
import type { __internal_CheckoutProps, Appearance } from '@clerk/types';
33

44
import { Checkout } from './components';
55
import { LazyDrawerRenderer } from './providers';
@@ -13,7 +13,7 @@ export function MountedCheckoutDrawer({
1313
onOpenChange: (open: boolean) => void;
1414
checkoutDrawer: {
1515
open: false;
16-
props: null | CheckoutProps;
16+
props: null | __internal_CheckoutProps;
1717
};
1818
}) {
1919
const { user } = useUser();

packages/clerk-js/src/ui/lazyModules/MountedPlanDetailDrawer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useUser } from '@clerk/shared/react';
2-
import type { Appearance, PlanDetailsProps } from '@clerk/types';
2+
import type { __internal_PlanDetailsProps, Appearance } from '@clerk/types';
33

44
import { PlanDetails } from './components';
55
import { LazyDrawerRenderer } from './providers';
@@ -13,7 +13,7 @@ export function MountedPlanDetailDrawer({
1313
onOpenChange: (open: boolean) => void;
1414
planDetailsDrawer: {
1515
open: false;
16-
props: null | PlanDetailsProps;
16+
props: null | __internal_PlanDetailsProps;
1717
};
1818
}) {
1919
const { user } = useUser();

packages/clerk-js/src/ui/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {
2+
__internal_CheckoutProps,
3+
__internal_PlanDetailsProps,
24
__internal_UserVerificationProps,
3-
CheckoutProps,
45
CommerceInvoiceResource,
56
CommercePlanResource,
67
CommerceSubscriptionResource,
@@ -10,7 +11,6 @@ import type {
1011
OrganizationListProps,
1112
OrganizationProfileProps,
1213
OrganizationSwitcherProps,
13-
PlanDetailsProps,
1414
PricingTableProps,
1515
SignInFallbackRedirectUrl,
1616
SignInForceRedirectUrl,
@@ -48,9 +48,9 @@ export type AvailableComponentProps =
4848
| OrganizationListProps
4949
| WaitlistProps
5050
| PricingTableProps
51-
| CheckoutProps
51+
| __internal_CheckoutProps
5252
| __internal_UserVerificationProps
53-
| PlanDetailsProps;
53+
| __internal_PlanDetailsProps;
5454

5555
type ComponentMode = 'modal' | 'mounted';
5656

@@ -117,7 +117,7 @@ export type PricingTableCtx = PricingTableProps & {
117117
mode?: ComponentMode;
118118
};
119119

120-
export type CheckoutCtx = CheckoutProps & {
120+
export type CheckoutCtx = __internal_CheckoutProps & {
121121
componentName: 'Checkout';
122122
} & NewSubscriptionRedirectUrl;
123123

0 commit comments

Comments
 (0)