Skip to content

Commit 294da82

Browse files
refactor(clerk-js,types): Use RootBox for pricing table components (#5747)
1 parent 3d7384f commit 294da82

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

.changeset/rich-geckos-strive.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
'@clerk/types': patch
4+
---
5+
6+
Refactor PricingTable components to use RootBox component for top level element.

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {
77
import { useState } from 'react';
88

99
import { usePlansContext, usePricingTableContext, useSubscriberTypeContext } from '../../contexts';
10+
import { Flow } from '../../customizables';
1011
import { useFetch } from '../../hooks/useFetch';
1112
import { FreePlanRow } from './FreePlanRow';
1213
import { PricingTableDefault } from './PricingTableDefault';
@@ -44,7 +45,12 @@ const PricingTable = (props: __experimental_PricingTableProps) => {
4445
);
4546

4647
return (
47-
<>
48+
<Flow.Root
49+
flow='pricingTable'
50+
sx={{
51+
width: '100%',
52+
}}
53+
>
4854
<FreePlanRow />
4955
{mode !== 'modal' && (props as any).layout === 'matrix' ? (
5056
<PricingTableMatrix
@@ -64,7 +70,7 @@ const PricingTable = (props: __experimental_PricingTableProps) => {
6470
props={props}
6571
/>
6672
)}
67-
</>
73+
</Flow.Root>
6874
);
6975
};
7076

packages/clerk-js/src/ui/components/PricingTable/PricingTableMatrix.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function PricingTableMatrix({
7373
return (
7474
<InternalThemeProvider>
7575
<Box
76-
elementDescriptor={descriptors.pricingTableMatrixRoot}
76+
elementDescriptor={descriptors.pricingTableMatrix}
7777
sx={t => ({
7878
position: 'relative',
7979
minWidth: '100%',

packages/clerk-js/src/ui/customizables/elementDescriptors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export const APPEARANCE_KEYS = containsAllElementsConfigKeys([
264264
'pricingTableCardFeePeriodNoticeInner',
265265
'pricingTableCardFeePeriodNoticeLabel',
266266

267-
'pricingTableMatrixRoot',
267+
'pricingTableMatrix',
268268
'pricingTableMatrixTable',
269269
'pricingTableMatrixRowGroup',
270270
'pricingTableMatrixRowGroupHeader',

packages/clerk-js/src/ui/elements/contexts/FlowMetadataContext.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ type FlowMetadata = {
1616
| 'blankCaptcha'
1717
| 'waitlist'
1818
| 'checkout'
19-
| 'planDetails';
19+
| 'planDetails'
20+
| 'pricingTable';
2021
part?:
2122
| 'start'
2223
| 'emailCode'

packages/types/src/appearance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ export type ElementsConfig = {
391391
pricingTableCardFeePeriodNoticeInner: WithOptions;
392392
pricingTableCardFeePeriodNoticeLabel: WithOptions;
393393

394-
pricingTableMatrixRoot: WithOptions;
394+
pricingTableMatrix: WithOptions;
395395
pricingTableMatrixTable: WithOptions;
396396
pricingTableMatrixRowGroup: WithOptions;
397397
pricingTableMatrixRowGroupHeader: WithOptions;

0 commit comments

Comments
 (0)