mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-06 11:20:56 -05:00
Store current Url in the responses meta data (#566)
* url add to link-survey * fixed * fixed * fixed * fixed * ran pnpm format * make url optional in response input to not break existing integrations --------- Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
This commit is contained in:
@@ -45,6 +45,7 @@ export async function POST(request: Request): Promise<NextResponse> {
|
||||
let response: TResponse;
|
||||
try {
|
||||
const meta = {
|
||||
url: responseInput?.meta?.url ?? "",
|
||||
userAgent: {
|
||||
browser: agent?.browser.name,
|
||||
device: agent?.device.type,
|
||||
|
||||
@@ -108,6 +108,9 @@ export const useLinkSurveyUtils = (survey: Survey) => {
|
||||
personId: personId,
|
||||
finished,
|
||||
data,
|
||||
meta: {
|
||||
url: window.location.href,
|
||||
},
|
||||
};
|
||||
if (!responseId && !isPreview) {
|
||||
const response = await createResponse(
|
||||
|
||||
@@ -187,6 +187,9 @@ export default function SurveyView({ config, survey, close, errorHandler }: Surv
|
||||
personId: config.state.person.id,
|
||||
finished,
|
||||
data,
|
||||
meta: {
|
||||
url: window.location.href,
|
||||
},
|
||||
};
|
||||
if (!responseId) {
|
||||
const [response, _] = await Promise.all([
|
||||
|
||||
@@ -28,6 +28,7 @@ const ZResponseNote = z.object({
|
||||
export type TResponseNote = z.infer<typeof ZResponseNote>;
|
||||
|
||||
export const ZResponseMeta = z.object({
|
||||
url: z.string(),
|
||||
userAgent: z.object({
|
||||
browser: z.string().optional(),
|
||||
os: z.string().optional(),
|
||||
@@ -67,6 +68,7 @@ export const ZResponseInput = z.object({
|
||||
data: ZResponseData,
|
||||
meta: z
|
||||
.object({
|
||||
url: z.string().optional(),
|
||||
userAgent: z
|
||||
.object({
|
||||
browser: z.string().optional(),
|
||||
|
||||
Reference in New Issue
Block a user