Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions .changeset/rare-rules-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-js': patch
'@clerk/types': patch
---

Wrap nested `<Checkout />` component in its own AppearanceProvider to recieve its own appearance object.
58 changes: 32 additions & 26 deletions packages/clerk-js/src/ui/components/PricingTable/PricingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useState } from 'react';

import { PROFILE_CARD_SCROLLBOX_ID } from '../../constants';
import { __experimental_CheckoutContext, usePricingTableContext } from '../../contexts';
import { AppearanceProvider } from '../../customizables';
import { useFetch } from '../../hooks';
import { __experimental_Checkout } from '../Checkout';
import { PlanDetailDrawer } from './PlanDetailDrawer';
Expand Down Expand Up @@ -54,33 +55,38 @@ export const __experimental_PricingTable = (props: __experimental_PricingTablePr
/>
)}

<__experimental_CheckoutContext.Provider
value={{
componentName: 'Checkout',
mode,
isOpen: showCheckout,
setIsOpen: setShowCheckout,
}}
<AppearanceProvider
appearanceKey='checkout'
appearance={props.checkoutProps?.appearance}
>
{/*TODO: Used by InvisibleRootBox, can we simplify? */}
<div>
<__experimental_Checkout
planPeriod={planPeriod}
planId={selectedPlan?.id}
/>
</div>
</__experimental_CheckoutContext.Provider>
<PlanDetailDrawer
isOpen={showPlanDetail}
setIsOpen={setShowPlanDetail}
plan={selectedPlan}
planPeriod={planPeriod}
setPlanPeriod={setPlanPeriod}
strategy={mode === 'mounted' ? 'fixed' : 'absolute'}
portalProps={{
id: mode === 'modal' ? PROFILE_CARD_SCROLLBOX_ID : undefined,
}}
/>
<__experimental_CheckoutContext.Provider
value={{
componentName: 'Checkout',
mode,
isOpen: showCheckout,
setIsOpen: setShowCheckout,
}}
>
{/*TODO: Used by InvisibleRootBox, can we simplify? */}
<div>
<__experimental_Checkout
planPeriod={planPeriod}
planId={selectedPlan?.id}
/>
</div>
</__experimental_CheckoutContext.Provider>
<PlanDetailDrawer
isOpen={showPlanDetail}
setIsOpen={setShowPlanDetail}
plan={selectedPlan}
planPeriod={planPeriod}
setPlanPeriod={setPlanPeriod}
strategy={mode === 'mounted' ? 'fixed' : 'absolute'}
portalProps={{
id: mode === 'modal' ? PROFILE_CARD_SCROLLBOX_ID : undefined,
}}
/>
</AppearanceProvider>
</>
);
};
1 change: 1 addition & 0 deletions packages/types/src/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,7 @@ type __experimental_PricingTableMatrixProps = {

type __experimental_PricingTableBaseProps = {
appearance?: PricingTableTheme;
checkoutProps?: Pick<__experimental_CheckoutProps, 'appearance'>;
};

export type __experimental_PricingTableProps = __experimental_PricingTableBaseProps &
Expand Down