Include form fields as redirect URL parameters on an embedded form

I do not have the redirectUrl as part of the form’s hs_context value. Do you know if this has changed, or if there is something I need to do in order to have it as part of the value?

** Update **

I found where I could get the redirectUrl off of the event data. Thought I’d share this script. It goes through the form and appends all non-hidden form fields as query params to the redirect url. Thought it might be useful for someone else running into the same issue I did.

window.addEventListener('message', (event) => {
 if (event.data.type === 'hsFormCallback') {
 if (event.data.eventName === 'onFormSubmitted') {
 if (event?.data?.data?.redirectUrl && event?.data?.id) {
 const redirectUrl = new URL(event.data.data.redirectUrl);
 const formId = `hsForm_${event.data.id}`;
 const form = document.getElementById(formId);
 if (form) {
 Array.from(form.elements)
 .filter(
 (input) =>
 input.type !== 'hidden' &&
 input.type !== 'submit',
 )
 .forEach((field) =>
 redirectUrl.searchParams.append(
 field.name,
 field.value,
 ),
 );

 window.location = redirectUrl.toString();
 }
 }
 }
 }
});