@@ -16,21 +16,31 @@ import {
1616} from '@dailydotdev/shared/src/components/typography/Typography' ;
1717import { FlexCol } from '@dailydotdev/shared/src/components/utilities' ;
1818import { useRecruiterPaymentContext } from '@dailydotdev/shared/src/contexts/RecruiterPaymentContext/types' ;
19+ import {
20+ OpportunityPreviewProvider ,
21+ useOpportunityPreviewContext ,
22+ } from '@dailydotdev/shared/src/features/opportunity/context/OpportunityPreviewContext' ;
1923
2024const RecruiterPaymentPage = ( ) : ReactElement => {
2125 const router = useRouter ( ) ;
2226 const checkoutRef = useRef < HTMLDivElement > ( null ) ;
2327 const { openCheckout, selectedProduct } = useRecruiterPaymentContext ( ) ;
28+ const { opportunity } = useOpportunityPreviewContext ( ) ;
2429
2530 useEffect ( ( ) => {
31+ if ( ! opportunity ) {
32+ return ;
33+ }
34+
2635 if ( ! selectedProduct ) {
2736 return ;
2837 }
2938
3039 openCheckout ( {
3140 priceId : selectedProduct . id ,
41+ customData : { opportunity_id : opportunity . id } ,
3242 } ) ;
33- } , [ selectedProduct , openCheckout ] ) ;
43+ } , [ selectedProduct , openCheckout , opportunity ] ) ;
3444
3545 const handleBack = ( ) => {
3646 router . back ( ) ;
@@ -156,7 +166,11 @@ const RecruiterPaymentPage = (): ReactElement => {
156166RecruiterPaymentPage . getLayout = function getLayout (
157167 page : ReactNode ,
158168) : ReactNode {
159- return < RecruiterPaymentContext > { page } </ RecruiterPaymentContext > ;
169+ return (
170+ < OpportunityPreviewProvider >
171+ < RecruiterPaymentContext > { page } </ RecruiterPaymentContext >
172+ </ OpportunityPreviewProvider >
173+ ) ;
160174} ;
161175
162176export default RecruiterPaymentPage ;
0 commit comments