@@ -25,7 +25,6 @@ import { PatchProfileRequestSchema } from "@/app/schemas/api/auth/profile/patch"
2525import { isOnboardingFieldRequired } from "@/app/config/onboarding" ;
2626import { getOnboardingFormSchema } from "@/app/onboarding/schema" ;
2727import { showApiError } from "@/app/hooks/useErrorHandler" ;
28- import { submitToOrtto } from "@/app/actions/ortto" ;
2928import LclLogo from "../components/LclLogo" ;
3029import { ArrowLeftIcon } from "@phosphor-icons/react" ;
3130import { sendGAEventAsync } from "@/app/utils/analytics" ;
@@ -217,22 +216,31 @@ export default function OnboardingForm() {
217216 throw new Error ( "Failed to save profile" ) ;
218217 }
219218
220- // Submit to Ortto
219+ // Submit to Ortto directly from client (no secrets needed)
221220 const topicLabels = form . topics . map (
222221 ( code ) => config ?. topics ?. [ code ] || code
223222 ) ;
224223
225- await submitToOrtto ( {
226- email : form . email ,
227- firstName : form . firstName ,
228- lastName : form . lastName ,
229- sector : form . sector ,
230- jobTitle : form . jobTitle ,
231- companyOrganization : form . company ,
232- countryCode : form . country ,
233- Topics : topicLabels ,
234- receiveNewsEmails : form . receiveNewsEmails ,
235- } ) . catch ( ( e ) => console . error ( "Ortto submission error" , e ) ) ;
224+ try {
225+ const orttoRes = await fetch ( "https://ortto.wri.org/custom-forms/gnw/" , {
226+ method : "POST" ,
227+ headers : { "Content-Type" : "application/json" } ,
228+ body : JSON . stringify ( {
229+ email : form . email ,
230+ firstName : form . firstName ,
231+ lastName : form . lastName ,
232+ sector : form . sector ,
233+ jobTitle : form . jobTitle ,
234+ companyOrganization : form . company ,
235+ countryCode : form . country ,
236+ Topics : topicLabels ,
237+ receiveNewsEmails : form . receiveNewsEmails ,
238+ } ) ,
239+ } ) ;
240+ console . log ( "[Client] Ortto submission status:" , orttoRes . status , orttoRes . ok ? "OK" : "FAILED" ) ;
241+ } catch ( e ) {
242+ console . error ( "[Client] Ortto submission error:" , e ) ;
243+ }
236244
237245 // Poll for hasProfile to avoid middleware redirect race
238246 const waitForProfileCompletion = async (
0 commit comments