Skip to content

Commit 68e51b4

Browse files
authored
feat(onboarding) - enable onboarding reserves (#795)
* feat(onboarding-reserves) - add feature flag to test onboarding reserves * fix endpoint
1 parent 08f6ce5 commit 68e51b4

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

example/src/Onboarding.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ const OnboardingWithProps = ({
264264
employmentId={employmentId}
265265
externalId={externalId}
266266
options={{
267+
features: ['onboarding_reserves'],
267268
jsonSchemaVersionByCountry: {
268269
DEU: {
269270
contract_details: 1,

src/flows/Onboarding/hooks.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,10 @@ export const useOnboarding = ({
213213
refetch: refetchCompany,
214214
} = useCompany(companyId);
215215

216-
// TODO: remove this once the onboarding reserves are enabled, change this to stepState.currentStep.name === 'review'
217-
// TODO: Go to src/flows/Onboarding/tests/OnboardingInvite.test.tsx and unskip test should render "Create Reserve" button when onboardingReservesStatus is deposit_required
218-
const isOnboardingReservesEnabled = false;
216+
const isOnboardingReservesEnabled =
217+
(options?.features?.includes('onboarding_reserves') &&
218+
stepState.currentStep.name === 'review') ||
219+
false;
219220

220221
const { data: onboardingReservesStatus } =
221222
useEmploymentOnboardingReservesStatus(

src/flows/Onboarding/tests/OnboardingInvite.test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,7 @@ describe('OnboardingInvite', () => {
630630
});
631631
});
632632

633-
// TODO: unskip this test once the onboarding reserves are enabled
634-
it.skip('should render "Create Reserve" button when onboardingReservesStatus is deposit_required', async () => {
633+
it('should render "Create Reserve" button when onboardingReservesStatus is deposit_required', async () => {
635634
let onboardingBagRef: OnboardingRenderProps['onboardingBag'] | null = null;
636635

637636
const testRender = ({
@@ -685,6 +684,9 @@ describe('OnboardingInvite', () => {
685684
{...defaultProps}
686685
skipSteps={['select_country']}
687686
render={testRender}
687+
options={{
688+
features: ['onboarding_reserves'],
689+
}}
688690
/>,
689691
{ wrapper: TestProviders },
690692
);

src/flows/Onboarding/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ export type OnboardingRenderProps = {
4949
};
5050
};
5151

52+
type OnboardingFeatures = 'onboarding_reserves';
53+
5254
export type OnboardingFlowProps = {
5355
/**
5456
* The country code to use for the onboarding.
@@ -102,6 +104,12 @@ export type OnboardingFlowProps = {
102104
contract_details?: number | 'latest';
103105
};
104106
};
107+
/**
108+
* The features to use for the onboarding.
109+
* This is used to enable or disable features for the onboarding.
110+
* Currently only supports enabling the onboarding reserves feature.
111+
*/
112+
features?: OnboardingFeatures[];
105113
};
106114
/**
107115
* The render prop function with the params passed by the useOnboarding hook and the components available to use for this flow

0 commit comments

Comments
 (0)