Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib/utils/wave/wavePrograms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export async function batchApplyRepos(
waveProgramId: string,
orgRepoIds: string[],
formData: BatchApplyFormData,
turnstileToken?: string,
) {
return parseRes(
batchApplyResponseSchema,
Expand All @@ -77,6 +78,7 @@ export async function batchApplyRepos(
orgRepoIds,
formData,
}),
headers: turnstileToken ? { 'x-turnstile-token': turnstileToken } : {},
}),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import Plus from '$lib/components/icons/Plus.svelte';
import Trash from '$lib/components/icons/Trash.svelte';
import { batchApplyRepos } from '$lib/utils/wave/wavePrograms';
import Turnstile from '$lib/components/turnstile/turnstile.svelte';
import doWithErrorModal from '$lib/utils/do-with-error-modal';
import FlowStepWrapper from '../../../../shared/flow-step-wrapper.svelte';
import type { PreviousParticipation } from '$lib/utils/wave/types/waveProgram';
Expand Down Expand Up @@ -152,12 +153,15 @@
return null;
});

let turnstileToken = $state<string | undefined>(undefined);

let formValid = $derived(
plannedIssuesValid &&
repoRelationshipValid &&
upstreamRelationshipValid &&
forkJustificationValid &&
!limitViolation,
!limitViolation &&
!!turnstileToken,
);

let previousParticipationItems: Items = {
Expand Down Expand Up @@ -206,13 +210,21 @@

try {
await doWithErrorModal(async () => {
await batchApplyRepos(undefined, data.waveProgram.id, repoIds, {
previousParticipation: previousParticipation as PreviousParticipation[],
plannedIssuesDescription,
...(multipleReposSelected ? { repoRelationshipDescription } : {}),
...(anySelectedRepoIsFork ? { upstreamRelationshipDescription, forkJustification } : {}),
supportingLinks: supportingLinks.length > 0 ? supportingLinks : undefined,
});
await batchApplyRepos(
undefined,
data.waveProgram.id,
repoIds,
{
previousParticipation: previousParticipation as PreviousParticipation[],
plannedIssuesDescription,
...(multipleReposSelected ? { repoRelationshipDescription } : {}),
...(anySelectedRepoIsFork
? { upstreamRelationshipDescription, forkJustification }
: {}),
supportingLinks: supportingLinks.length > 0 ? supportingLinks : undefined,
},
turnstileToken,
);
});

submittedSuccessfully = true;
Expand Down Expand Up @@ -458,6 +470,19 @@ There's no wrong answer. We need this context to review forks accurately.`}
Inaccurate information may result in your application being rejected and could lead to
disqualification from the Drips Wave Program.
</AnnotationBox>

<FormField
title="Verification*"
description="Confirm you're not a robot with a quick check."
type="div"
disabled={!data.isKycVerified}
>
{#if data.isKycVerified}
<div class="turnstile-wrapper">
<Turnstile ontoken={(t) => (turnstileToken = t)} />
</div>
{/if}
</FormField>
{/if}

{#snippet leftActions()}
Expand Down Expand Up @@ -536,4 +561,9 @@ There's no wrong answer. We need this context to review forks accurately.`}
gap: 0.5rem;
align-items: flex-start;
}

.turnstile-wrapper {
display: flex;
justify-content: flex-start;
}
</style>
Loading