@@ -88,7 +88,6 @@ export default function PricingTable({
8888 selectedPlan ?: string | null ;
8989} ) {
9090 const { attach } = useCustomer ( ) ;
91- const [ isAnnual , setIsAnnual ] = useState ( false ) ;
9291 const { products, isLoading, error, refetch } = usePricingTable ( {
9392 productDetails,
9493 } ) ;
@@ -123,60 +122,20 @@ export default function PricingTable({
123122 ) ;
124123 }
125124
126- const intervals = Array . from (
127- new Set ( products ?. map ( ( p ) => p . properties ?. interval_group ) . filter ( Boolean ) )
128- ) ;
129- const multiInterval = intervals . length > 1 ;
130-
131125 const intervalFilter = ( product : Product ) => {
132126 if ( ! product . properties ?. interval_group ) {
133127 return true ;
134128 }
135- if ( multiInterval ) {
136- return isAnnual
137- ? product . properties . interval_group === "year"
138- : product . properties . interval_group === "month" ;
139- }
140129 return true ;
141130 } ;
142131
143132 const filteredProducts =
144- products ?. filter ( ( p ) => p . id !== "free" && intervalFilter ( p ) ) ?? [ ] ;
133+ products ?. filter (
134+ ( p ) => p . id !== "free" && p . id !== "verification_fee" && intervalFilter ( p )
135+ ) ?? [ ] ;
145136
146137 return (
147138 < div >
148- { /* Header */ }
149- < div className = "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between" >
150- { multiInterval && (
151- < div className = "flex shrink-0 rounded border bg-muted p-1" >
152- < button
153- className = { cn (
154- "rounded px-4 py-1.5 font-medium text-sm transition" ,
155- isAnnual
156- ? "text-muted-foreground hover:text-foreground"
157- : "bg-background shadow-sm"
158- ) }
159- onClick = { ( ) => setIsAnnual ( false ) }
160- type = "button"
161- >
162- Monthly
163- </ button >
164- < button
165- className = { cn (
166- "rounded px-4 py-1.5 font-medium text-sm transition" ,
167- isAnnual
168- ? "bg-background shadow-sm"
169- : "text-muted-foreground hover:text-foreground"
170- ) }
171- onClick = { ( ) => setIsAnnual ( true ) }
172- type = "button"
173- >
174- Annual
175- </ button >
176- </ div >
177- ) }
178- </ div >
179-
180139 { /* Cards Grid */ }
181140 < PricingTableContext . Provider
182141 value = { { products : products ?? [ ] , selectedPlan } }
@@ -188,7 +147,7 @@ export default function PricingTable({
188147 disabled :
189148 plan . scenario === "active" || plan . scenario === "scheduled" ,
190149 onClick : async ( ) => {
191- await attach ( { productId : plan . id , dialog : AttachDialog } ) ;
150+ await attach ( { productIds : [ plan . id ] , dialog : AttachDialog } ) ;
192151 } ,
193152 } }
194153 isSelected = { selectedPlan === plan . id }
0 commit comments