diff --git a/apps/web/app/api/v1/client/[environmentId]/identify/people/[userId]/lib/personState.ts b/apps/web/app/api/v1/client/[environmentId]/identify/people/[userId]/lib/personState.ts index da8fd44ed0..52c1aa8aa2 100644 --- a/apps/web/app/api/v1/client/[environmentId]/identify/people/[userId]/lib/personState.ts +++ b/apps/web/app/api/v1/client/[environmentId]/identify/people/[userId]/lib/personState.ts @@ -1,6 +1,5 @@ import { prisma } from "@formbricks/database"; import { attributeCache } from "@formbricks/lib/attribute/cache"; -import { getAttributesByUserId } from "@formbricks/lib/attribute/service"; import { cache } from "@formbricks/lib/cache"; import { IS_FORMBRICKS_CLOUD } from "@formbricks/lib/constants"; import { displayCache } from "@formbricks/lib/display/cache"; diff --git a/packages/js-core/src/lib/attributes.ts b/packages/js-core/src/lib/attributes.ts index faaf9d58c2..34d34594a7 100644 --- a/packages/js-core/src/lib/attributes.ts +++ b/packages/js-core/src/lib/attributes.ts @@ -42,6 +42,7 @@ export const updateAttribute = async ( const res = await api.client.attribute.update({ userId, attributes: { [key]: value } }); if (!res.ok) { + // @ts-expect-error if (res.error.details?.ignore) { logger.error(res.error.message ?? `Error updating person with userId ${userId}`); return { @@ -54,7 +55,7 @@ export const updateAttribute = async ( } return err({ code: "network_error", - status: res.error.status ?? 500, + status: 500, message: res.error.message ?? `Error updating person with userId ${userId}`, url: `${config.get().apiHost}/api/v1/client/${environmentId}/people/${userId}/attributes`, responseMessage: res.error.message, @@ -121,6 +122,7 @@ export const updateAttributes = async ( if (res.ok) { return ok(updatedAttributes); } else { + // @ts-expect-error if (res.error.details?.ignore) { logger.error(res.error.message ?? `Error updating person with userId ${userId}`); return ok(updatedAttributes); diff --git a/packages/js-core/src/lib/person.ts b/packages/js-core/src/lib/person.ts index b94905e25f..3be233ae60 100644 --- a/packages/js-core/src/lib/person.ts +++ b/packages/js-core/src/lib/person.ts @@ -22,7 +22,7 @@ export const resetPerson = async (): Promise> => { environmentId: config.get().environmentId, apiHost: config.get().apiHost, ...(userId && { userId }), - attributes: config.get().personState.data.attributes, + attributes: config.get().attributes, }; await logoutPerson(); try { diff --git a/packages/js-core/src/lib/personState.ts b/packages/js-core/src/lib/personState.ts index ddfc4abe68..f3982e4e5c 100644 --- a/packages/js-core/src/lib/personState.ts +++ b/packages/js-core/src/lib/personState.ts @@ -15,7 +15,6 @@ export const DEFAULT_PERSON_STATE_NO_USER_ID: TJsPersonState = { segments: [], displays: [], responses: [], - attributes: {}, lastDisplayAt: null, }, } as const; @@ -68,7 +67,6 @@ export const fetchPersonState = async ( segments: [], displays: [], responses: [], - attributes: {}, lastDisplayAt: null, }, }; diff --git a/packages/js-core/src/lib/widget.ts b/packages/js-core/src/lib/widget.ts index 6955a0d19d..f541c8d405 100644 --- a/packages/js-core/src/lib/widget.ts +++ b/packages/js-core/src/lib/widget.ts @@ -65,7 +65,7 @@ const renderWidget = async ( } const { product } = config.get().environmentState.data ?? {}; - const { attributes } = config.get().personState.data ?? {}; + const { attributes } = config.get() ?? {}; const isMultiLanguageSurvey = survey.languages.length > 1; let languageCode = "default";