@@ -10,6 +10,9 @@ import {
1010 SelectCountrySuccess ,
1111 SelectCountryFormPayload ,
1212 NormalizedFieldError ,
13+ EngagementAgreementDetailsFormPayload ,
14+ ZendeskTriggerButton ,
15+ zendeskArticles ,
1316} from '@remoteoss/remote-flows' ;
1417import React , { useState } from 'react' ;
1518import { ReviewOnboardingStep } from './ReviewOnboardingStep' ;
@@ -49,6 +52,7 @@ const MultiStepForm = ({ components, onboardingBag }: MultiStepFormProps) => {
4952 SubmitButton,
5053 BackButton,
5154 SelectCountryStep,
55+ EngagementAgreementDetailsStep,
5256 } = components ;
5357 const [ errors , setErrors ] = useState < {
5458 apiError : string ;
@@ -118,6 +122,35 @@ const MultiStepForm = ({ components, onboardingBag }: MultiStepFormProps) => {
118122 </ div >
119123 </ >
120124 ) ;
125+ case 'engagement_agreement_details' :
126+ return (
127+ < >
128+ < EngagementAgreementDetailsStep
129+ onSubmit = { ( payload : EngagementAgreementDetailsFormPayload ) =>
130+ console . log ( 'payload' , payload )
131+ }
132+ onSuccess = { ( data : SuccessResponse ) => console . log ( 'data' , data ) }
133+ onError = { ( { error, fieldErrors } ) =>
134+ setErrors ( { apiError : error . message , fieldErrors } )
135+ }
136+ />
137+ < AlertError errors = { errors } />
138+ < div className = 'buttons-container' >
139+ < BackButton
140+ className = 'back-button'
141+ onClick = { ( ) => setErrors ( { apiError : '' , fieldErrors : [ ] } ) }
142+ >
143+ Previous Step
144+ </ BackButton >
145+ < SubmitButton
146+ className = 'submit-button'
147+ onClick = { ( ) => setErrors ( { apiError : '' , fieldErrors : [ ] } ) }
148+ >
149+ Continue
150+ </ SubmitButton >
151+ </ div >
152+ </ >
153+ ) ;
121154 case 'contract_details' :
122155 return (
123156 < >
@@ -208,6 +241,42 @@ const MultiStepForm = ({ components, onboardingBag }: MultiStepFormProps) => {
208241 'Review & Invite',
209242];
210243 */
244+
245+ const getStepTitle = (
246+ step : OnboardingRenderProps [ 'onboardingBag' ] [ 'steps' ] [ number ] ,
247+ selectedCountryCode : string | null ,
248+ ) => {
249+ if (
250+ selectedCountryCode === 'DEU' &&
251+ step . name === 'engagement_agreement_details'
252+ ) {
253+ return 'Labor leasing in Germany' ;
254+ }
255+ return step . label ;
256+ } ;
257+
258+ const getStepDescription = (
259+ step : OnboardingRenderProps [ 'onboardingBag' ] [ 'steps' ] [ number ] ,
260+ selectedCountryCode : string | null ,
261+ ) => {
262+ if (
263+ selectedCountryCode === 'DEU' &&
264+ step . name === 'engagement_agreement_details'
265+ ) {
266+ return (
267+ < >
268+ Provide some details about your < strong > current workforce</ strong > to
269+ make sure this employee is hired compliantly according to Germany’s AÜG
270+ labor leasing model.
271+ < ZendeskTriggerButton zendeskId = { zendeskArticles . germanyLaborLeasing } >
272+ Learn more
273+ </ ZendeskTriggerButton >
274+ </ >
275+ ) ;
276+ }
277+ return '' ;
278+ } ;
279+
211280const OnBoardingRender = ( {
212281 onboardingBag,
213282 components,
@@ -217,12 +286,20 @@ const OnBoardingRender = ({
217286 // When using dynamic_steps feature, you need to filter and use step.index for comparison
218287 // Otherwise, you can use the steps array directly with sequential indices
219288 //const stepTitle = STEPS[currentStepIndex];
220- const stepTitle = onboardingBag . steps [ currentStepIndex ] . label ;
289+ const stepTitle = getStepTitle (
290+ onboardingBag . steps [ currentStepIndex ] ,
291+ onboardingBag . selectedCountry ?. code ?? null ,
292+ ) ;
221293
222294 if ( onboardingBag . isLoading ) {
223295 return < p > Loading...</ p > ;
224296 }
225297
298+ const stepDescription = getStepDescription (
299+ onboardingBag . steps [ currentStepIndex ] ,
300+ onboardingBag . selectedCountry ?. code ?? null ,
301+ ) ;
302+
226303 return (
227304 < >
228305 < div className = 'steps-navigation' >
@@ -242,14 +319,22 @@ const OnBoardingRender = ({
242319 key = { step . name }
243320 className = { `step-item ${ step . index === currentStepIndex ? 'active' : '' } ` }
244321 >
245- { index + 1 } . { step . label }
322+ { index + 1 } .{ ' ' }
323+ { getStepTitle (
324+ step ,
325+ onboardingBag . selectedCountry ?. code ?? null ,
326+ ) }
246327 </ li >
247328 ) ) }
248329 </ ul >
249330 </ div >
250331
251332 < div className = 'card' style = { { marginBottom : '20px' } } >
252333 < h1 className = 'heading' > { stepTitle } </ h1 >
334+
335+ { stepDescription && (
336+ < p className = 'text-sm text-[#71717A]' > { stepDescription } </ p >
337+ ) }
253338 < MultiStepForm onboardingBag = { onboardingBag } components = { components } />
254339 </ div >
255340 </ >
0 commit comments