mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-12 11:28:58 -05:00
d103499496
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com>
16 lines
679 B
TypeScript
16 lines
679 B
TypeScript
import { TJsEnvironmentStateSurvey } from "@formbricks/types/js";
|
|
import { TSurvey } from "@formbricks/types/surveys/types";
|
|
|
|
/**
|
|
* Adapts a full management-side `TSurvey` into the minimal
|
|
* `TJsEnvironmentStateSurvey` shape that the SDK widget / shared SDK utilities
|
|
* expect. Only the segment shape needs reshaping — the rest of `TSurvey` is a
|
|
* structural superset of the SDK survey type.
|
|
*/
|
|
export const toJsEnvironmentStateSurvey = (survey: TSurvey): TJsEnvironmentStateSurvey => {
|
|
return {
|
|
...survey,
|
|
segment: survey.segment ? { id: survey.segment.id, hasFilters: survey.segment.filters.length > 0 } : null,
|
|
} as unknown as TJsEnvironmentStateSurvey;
|
|
};
|