mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-21 19:39:28 -05:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0992c182a3 |
@@ -12,18 +12,18 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@chromatic-com/storybook": "^5.0.1",
|
||||
"@storybook/addon-a11y": "10.2.17",
|
||||
"@storybook/addon-links": "10.2.17",
|
||||
"@storybook/addon-onboarding": "10.2.17",
|
||||
"@storybook/react-vite": "10.2.17",
|
||||
"@typescript-eslint/eslint-plugin": "8.57.0",
|
||||
"@storybook/addon-a11y": "10.2.15",
|
||||
"@storybook/addon-links": "10.2.15",
|
||||
"@storybook/addon-onboarding": "10.2.15",
|
||||
"@storybook/react-vite": "10.2.15",
|
||||
"@typescript-eslint/eslint-plugin": "8.56.1",
|
||||
"@tailwindcss/vite": "4.2.1",
|
||||
"@typescript-eslint/parser": "8.57.0",
|
||||
"@typescript-eslint/parser": "8.56.1",
|
||||
"@vitejs/plugin-react": "5.1.4",
|
||||
"eslint-plugin-react-refresh": "0.4.26",
|
||||
"eslint-plugin-storybook": "10.2.17",
|
||||
"storybook": "10.2.17",
|
||||
"eslint-plugin-storybook": "10.2.14",
|
||||
"storybook": "10.2.15",
|
||||
"vite": "7.3.1",
|
||||
"@storybook/addon-docs": "10.2.17"
|
||||
"@storybook/addon-docs": "10.2.15"
|
||||
}
|
||||
}
|
||||
|
||||
+3
-6
@@ -122,11 +122,8 @@ RUN chown -R nextjs:nextjs ./node_modules/.prisma && chmod -R 755 ./node_modules
|
||||
COPY --from=installer /app/node_modules/@paralleldrive/cuid2 ./node_modules/@paralleldrive/cuid2
|
||||
RUN chmod -R 755 ./node_modules/@paralleldrive/cuid2
|
||||
|
||||
# Runtime migrations import uuid v7 from the database package, so copy the
|
||||
# database package's resolved install instead of the repo-root hoisted version.
|
||||
COPY --from=installer /app/packages/database/node_modules/uuid ./node_modules/uuid
|
||||
RUN chmod -R 755 ./node_modules/uuid \
|
||||
&& node --input-type=module -e "import('uuid').then((module) => { if (typeof module.v7 !== 'function') throw new Error('uuid v7 missing in runtime image'); })"
|
||||
COPY --from=installer /app/node_modules/uuid ./node_modules/uuid
|
||||
RUN chmod -R 755 ./node_modules/uuid
|
||||
|
||||
COPY --from=installer /app/node_modules/@noble/hashes ./node_modules/@noble/hashes
|
||||
RUN chmod -R 755 ./node_modules/@noble/hashes
|
||||
@@ -169,4 +166,4 @@ RUN mkdir -p /home/nextjs/apps/web/uploads/ && \
|
||||
VOLUME /home/nextjs/apps/web/uploads/
|
||||
VOLUME /home/nextjs/apps/web/saml-connection
|
||||
|
||||
CMD ["/home/nextjs/start.sh"]
|
||||
CMD ["/home/nextjs/start.sh"]
|
||||
@@ -22,10 +22,12 @@ export const getTeamsByOrganizationId = reactCache(
|
||||
},
|
||||
});
|
||||
|
||||
return teams.map((team: TOrganizationTeam) => ({
|
||||
const projectTeams = teams.map((team) => ({
|
||||
id: team.id,
|
||||
name: team.name,
|
||||
}));
|
||||
|
||||
return projectTeams;
|
||||
} catch (error) {
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError) {
|
||||
throw new DatabaseError(error.message);
|
||||
|
||||
-14
@@ -1,12 +1,8 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { TCloudBillingPlan } from "@formbricks/types/organizations";
|
||||
import { IS_FORMBRICKS_CLOUD } from "@/lib/constants";
|
||||
import { getOrganizationBillingWithReadThroughSync } from "@/modules/ee/billing/lib/organization-billing";
|
||||
import { getOrganizationAuth } from "@/modules/organization/lib/utils";
|
||||
import { SelectPlanOnboarding } from "./components/select-plan-onboarding";
|
||||
|
||||
const PAID_PLANS = new Set<TCloudBillingPlan>(["pro", "scale", "custom"]);
|
||||
|
||||
interface PlanPageProps {
|
||||
params: Promise<{
|
||||
organizationId: string;
|
||||
@@ -26,16 +22,6 @@ const Page = async (props: PlanPageProps) => {
|
||||
return redirect(`/auth/login`);
|
||||
}
|
||||
|
||||
// Users with an existing paid/trial subscription should not be shown the trial page.
|
||||
// Redirect them directly to the next onboarding step.
|
||||
const billing = await getOrganizationBillingWithReadThroughSync(params.organizationId);
|
||||
const currentPlan = billing?.stripe?.plan;
|
||||
const hasExistingSubscription = currentPlan !== undefined && PAID_PLANS.has(currentPlan);
|
||||
|
||||
if (hasExistingSubscription) {
|
||||
return redirect(`/organizations/${params.organizationId}/workspaces/new/mode`);
|
||||
}
|
||||
|
||||
return <SelectPlanOnboarding organizationId={params.organizationId} />;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import FBLogo from "@/images/formbricks-wordmark.svg";
|
||||
import { cn } from "@/lib/cn";
|
||||
import { getAccessFlags } from "@/lib/membership/utils";
|
||||
import { useSignOut } from "@/modules/auth/hooks/use-sign-out";
|
||||
import { TrialAlert } from "@/modules/ee/billing/components/trial-alert";
|
||||
import { getLatestStableFbReleaseAction } from "@/modules/projects/settings/(setup)/app-connection/actions";
|
||||
import { ProfileAvatar } from "@/modules/ui/components/avatars";
|
||||
import { Button } from "@/modules/ui/components/button";
|
||||
@@ -168,20 +167,6 @@ export const MainNavigation = ({
|
||||
if (isOwnerOrManager) loadReleases();
|
||||
}, [isOwnerOrManager]);
|
||||
|
||||
const trialDaysRemaining = useMemo(() => {
|
||||
if (!isFormbricksCloud || organization.billing?.stripe?.subscriptionStatus !== "trialing") return null;
|
||||
const trialEnd = organization.billing.stripe.trialEnd;
|
||||
if (!trialEnd) return null;
|
||||
const ts = new Date(trialEnd).getTime();
|
||||
if (!Number.isFinite(ts)) return null;
|
||||
const msPerDay = 86_400_000;
|
||||
return Math.ceil((ts - Date.now()) / msPerDay);
|
||||
}, [
|
||||
isFormbricksCloud,
|
||||
organization.billing?.stripe?.subscriptionStatus,
|
||||
organization.billing?.stripe?.trialEnd,
|
||||
]);
|
||||
|
||||
const mainNavigationLink = `/environments/${environment.id}/${isBilling ? "settings/billing/" : "surveys/"}`;
|
||||
|
||||
return (
|
||||
@@ -256,13 +241,6 @@ export const MainNavigation = ({
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{/* Trial Days Remaining */}
|
||||
{!isCollapsed && isFormbricksCloud && trialDaysRemaining !== null && (
|
||||
<Link href={`/environments/${environment.id}/settings/billing`} className="m-2 block">
|
||||
<TrialAlert trialDaysRemaining={trialDaysRemaining} size="small" />
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{/* User Switch */}
|
||||
<div className="flex items-center">
|
||||
<DropdownMenu>
|
||||
|
||||
@@ -60,7 +60,7 @@ const Page = async (props: { params: Promise<{ environmentId: string }> }) => {
|
||||
buttons={[
|
||||
{
|
||||
text: IS_FORMBRICKS_CLOUD
|
||||
? t("common.upgrade_plan")
|
||||
? t("common.start_free_trial")
|
||||
: t("common.request_trial_license"),
|
||||
href: IS_FORMBRICKS_CLOUD
|
||||
? `/environments/${params.environmentId}/settings/billing`
|
||||
|
||||
+4
-17
@@ -7,20 +7,21 @@ import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { recheckLicenseAction } from "@/modules/ee/license-check/actions";
|
||||
import type { TLicenseStatus } from "@/modules/ee/license-check/types/enterprise-license";
|
||||
import { Alert, AlertDescription } from "@/modules/ui/components/alert";
|
||||
import { Badge } from "@/modules/ui/components/badge";
|
||||
import { Button } from "@/modules/ui/components/button";
|
||||
import { SettingsCard } from "../../../components/SettingsCard";
|
||||
|
||||
type LicenseStatus = "active" | "expired" | "unreachable" | "invalid_license";
|
||||
|
||||
interface EnterpriseLicenseStatusProps {
|
||||
status: TLicenseStatus;
|
||||
status: LicenseStatus;
|
||||
gracePeriodEnd?: Date;
|
||||
environmentId: string;
|
||||
}
|
||||
|
||||
const getBadgeConfig = (
|
||||
status: TLicenseStatus,
|
||||
status: LicenseStatus,
|
||||
t: TFunction
|
||||
): { type: "success" | "error" | "warning" | "gray"; label: string } => {
|
||||
switch (status) {
|
||||
@@ -28,11 +29,6 @@ const getBadgeConfig = (
|
||||
return { type: "success", label: t("environments.settings.enterprise.license_status_active") };
|
||||
case "expired":
|
||||
return { type: "error", label: t("environments.settings.enterprise.license_status_expired") };
|
||||
case "instance_mismatch":
|
||||
return {
|
||||
type: "error",
|
||||
label: t("environments.settings.enterprise.license_status_instance_mismatch"),
|
||||
};
|
||||
case "unreachable":
|
||||
return { type: "warning", label: t("environments.settings.enterprise.license_status_unreachable") };
|
||||
case "invalid_license":
|
||||
@@ -63,8 +59,6 @@ export const EnterpriseLicenseStatus = ({
|
||||
if (result?.data) {
|
||||
if (result.data.status === "unreachable") {
|
||||
toast.error(t("environments.settings.enterprise.recheck_license_unreachable"));
|
||||
} else if (result.data.status === "instance_mismatch") {
|
||||
toast.error(t("environments.settings.enterprise.recheck_license_instance_mismatch"));
|
||||
} else if (result.data.status === "invalid_license") {
|
||||
toast.error(t("environments.settings.enterprise.recheck_license_invalid"));
|
||||
} else {
|
||||
@@ -134,13 +128,6 @@ export const EnterpriseLicenseStatus = ({
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
{status === "instance_mismatch" && (
|
||||
<Alert variant="error" size="small">
|
||||
<AlertDescription className="overflow-visible whitespace-normal">
|
||||
{t("environments.settings.enterprise.license_instance_mismatch_description")}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
<p className="border-t border-slate-100 pt-4 text-sm text-slate-500">
|
||||
{t("environments.settings.enterprise.questions_please_reach_out_to")}{" "}
|
||||
<a
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ const Page = async (props: { params: Promise<{ environmentId: string }> }) => {
|
||||
</PageHeader>
|
||||
{hasLicense ? (
|
||||
<EnterpriseLicenseStatus
|
||||
status={licenseState.status}
|
||||
status={licenseState.status as "active" | "expired" | "unreachable" | "invalid_license"}
|
||||
gracePeriodEnd={
|
||||
licenseState.status === "unreachable"
|
||||
? new Date(licenseState.lastChecked.getTime() + GRACE_PERIOD_MS)
|
||||
|
||||
+1
-1
@@ -165,7 +165,7 @@ export const PersonalLinksTab = ({
|
||||
description={t("environments.surveys.share.personal_links.upgrade_prompt_description")}
|
||||
buttons={[
|
||||
{
|
||||
text: isFormbricksCloud ? t("common.upgrade_plan") : t("common.request_trial_license"),
|
||||
text: isFormbricksCloud ? t("common.start_free_trial") : t("common.request_trial_license"),
|
||||
href: isFormbricksCloud
|
||||
? `/environments/${environmentId}/settings/billing`
|
||||
: "https://formbricks.com/upgrade-self-hosting-license",
|
||||
|
||||
@@ -190,7 +190,7 @@ export const PUT = withV1ApiWrapper({
|
||||
};
|
||||
}
|
||||
|
||||
const featureCheckResult = await checkFeaturePermissions(surveyUpdate, organization, result.survey);
|
||||
const featureCheckResult = await checkFeaturePermissions(surveyUpdate, organization);
|
||||
if (featureCheckResult) {
|
||||
return {
|
||||
response: featureCheckResult,
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import { afterEach, describe, expect, test, vi } from "vitest";
|
||||
import { describe, expect, test, vi } from "vitest";
|
||||
import { TOrganization } from "@formbricks/types/organizations";
|
||||
import {
|
||||
TSurvey,
|
||||
TSurveyCreateInputWithEnvironmentId,
|
||||
TSurveyQuestionTypeEnum,
|
||||
} from "@formbricks/types/surveys/types";
|
||||
import { responses } from "@/app/lib/api/response";
|
||||
import { getIsSpamProtectionEnabled } from "@/modules/ee/license-check/lib/utils";
|
||||
import { getSurveyFollowUpsPermission } from "@/modules/survey/follow-ups/lib/utils";
|
||||
import { getExternalUrlsPermission } from "@/modules/survey/lib/permission";
|
||||
import { checkFeaturePermissions } from "./utils";
|
||||
|
||||
// Mock dependencies
|
||||
@@ -26,14 +24,6 @@ vi.mock("@/modules/survey/follow-ups/lib/utils", () => ({
|
||||
getSurveyFollowUpsPermission: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@/modules/survey/lib/permission", () => ({
|
||||
getExternalUrlsPermission: vi.fn().mockResolvedValue(true),
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/survey/utils", () => ({
|
||||
getElementsFromBlocks: vi.fn((blocks: any[]) => blocks.flatMap((block: any) => block.elements)),
|
||||
}));
|
||||
|
||||
const mockOrganization: TOrganization = {
|
||||
id: "test-org",
|
||||
name: "Test Organization",
|
||||
@@ -108,13 +98,6 @@ const baseSurveyData: TSurveyCreateInputWithEnvironmentId = {
|
||||
};
|
||||
|
||||
describe("checkFeaturePermissions", () => {
|
||||
vi.mocked(getExternalUrlsPermission).mockResolvedValue(true);
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(getExternalUrlsPermission).mockResolvedValue(true);
|
||||
});
|
||||
|
||||
test("should return null if no restricted features are used", async () => {
|
||||
const surveyData = { ...baseSurveyData };
|
||||
const result = await checkFeaturePermissions(surveyData, mockOrganization);
|
||||
@@ -214,315 +197,4 @@ describe("checkFeaturePermissions", () => {
|
||||
);
|
||||
expect(responses.forbiddenResponse).toHaveBeenCalledTimes(1); // Ensure it stops at the first failure
|
||||
});
|
||||
|
||||
// External URLs - ending card button link tests
|
||||
test("should return forbiddenResponse when adding new ending with buttonLink without permission", async () => {
|
||||
vi.mocked(getExternalUrlsPermission).mockResolvedValue(false);
|
||||
const surveyData = {
|
||||
...baseSurveyData,
|
||||
endings: [
|
||||
{
|
||||
id: "ending1",
|
||||
type: "endScreen" as const,
|
||||
headline: { default: "Thanks" },
|
||||
subheader: { default: "" },
|
||||
buttonLink: "https://example.com",
|
||||
buttonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
};
|
||||
const result = await checkFeaturePermissions(surveyData, mockOrganization);
|
||||
expect(result).toBeInstanceOf(Response);
|
||||
expect(result?.status).toBe(403);
|
||||
expect(responses.forbiddenResponse).toHaveBeenCalledWith(
|
||||
"External URLs are not enabled for this organization. Upgrade to use external button links."
|
||||
);
|
||||
});
|
||||
|
||||
test("should return forbiddenResponse when changing ending buttonLink without permission", async () => {
|
||||
vi.mocked(getExternalUrlsPermission).mockResolvedValue(false);
|
||||
const surveyData = {
|
||||
...baseSurveyData,
|
||||
endings: [
|
||||
{
|
||||
id: "ending1",
|
||||
type: "endScreen" as const,
|
||||
headline: { default: "Thanks" },
|
||||
subheader: { default: "" },
|
||||
buttonLink: "https://new-url.com",
|
||||
buttonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
};
|
||||
const oldSurvey = {
|
||||
endings: [
|
||||
{
|
||||
id: "ending1",
|
||||
type: "endScreen" as const,
|
||||
headline: { default: "Thanks" },
|
||||
subheader: { default: "" },
|
||||
buttonLink: "https://old-url.com",
|
||||
buttonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
} as unknown as TSurvey;
|
||||
const result = await checkFeaturePermissions(surveyData, mockOrganization, oldSurvey);
|
||||
expect(result).toBeInstanceOf(Response);
|
||||
expect(result?.status).toBe(403);
|
||||
});
|
||||
|
||||
test("should allow keeping existing ending buttonLink without permission (grandfathering)", async () => {
|
||||
vi.mocked(getExternalUrlsPermission).mockResolvedValue(false);
|
||||
const surveyData = {
|
||||
...baseSurveyData,
|
||||
endings: [
|
||||
{
|
||||
id: "ending1",
|
||||
type: "endScreen" as const,
|
||||
headline: { default: "Thanks" },
|
||||
subheader: { default: "" },
|
||||
buttonLink: "https://existing-url.com",
|
||||
buttonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
};
|
||||
const oldSurvey = {
|
||||
endings: [
|
||||
{
|
||||
id: "ending1",
|
||||
type: "endScreen" as const,
|
||||
headline: { default: "Thanks" },
|
||||
subheader: { default: "" },
|
||||
buttonLink: "https://existing-url.com",
|
||||
buttonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
} as unknown as TSurvey;
|
||||
const result = await checkFeaturePermissions(surveyData, mockOrganization, oldSurvey);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
test("should allow ending buttonLink when permission is granted", async () => {
|
||||
vi.mocked(getExternalUrlsPermission).mockResolvedValue(true);
|
||||
const surveyData = {
|
||||
...baseSurveyData,
|
||||
endings: [
|
||||
{
|
||||
id: "ending1",
|
||||
type: "endScreen" as const,
|
||||
headline: { default: "Thanks" },
|
||||
subheader: { default: "" },
|
||||
buttonLink: "https://example.com",
|
||||
buttonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
};
|
||||
const result = await checkFeaturePermissions(surveyData, mockOrganization);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
// External URLs - CTA external button tests
|
||||
test("should return forbiddenResponse when adding CTA with external button without permission", async () => {
|
||||
vi.mocked(getExternalUrlsPermission).mockResolvedValue(false);
|
||||
const surveyData = {
|
||||
...baseSurveyData,
|
||||
blocks: [
|
||||
{
|
||||
id: "block1",
|
||||
name: "Block 1",
|
||||
elements: [
|
||||
{
|
||||
id: "cta1",
|
||||
type: TSurveyQuestionTypeEnum.CTA,
|
||||
headline: { default: "CTA" },
|
||||
required: false,
|
||||
buttonExternal: true,
|
||||
buttonUrl: "https://example.com",
|
||||
ctaButtonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
buttonLabel: { default: "Next" },
|
||||
},
|
||||
],
|
||||
};
|
||||
const result = await checkFeaturePermissions(surveyData, mockOrganization);
|
||||
expect(result).toBeInstanceOf(Response);
|
||||
expect(result?.status).toBe(403);
|
||||
expect(responses.forbiddenResponse).toHaveBeenCalledWith(
|
||||
"External URLs are not enabled for this organization. Upgrade to use external CTA buttons."
|
||||
);
|
||||
});
|
||||
|
||||
test("should return forbiddenResponse when changing CTA external button URL without permission", async () => {
|
||||
vi.mocked(getExternalUrlsPermission).mockResolvedValue(false);
|
||||
const surveyData = {
|
||||
...baseSurveyData,
|
||||
blocks: [
|
||||
{
|
||||
id: "block1",
|
||||
name: "Block 1",
|
||||
elements: [
|
||||
{
|
||||
id: "cta1",
|
||||
type: TSurveyQuestionTypeEnum.CTA,
|
||||
headline: { default: "CTA" },
|
||||
required: false,
|
||||
buttonExternal: true,
|
||||
buttonUrl: "https://new-url.com",
|
||||
ctaButtonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
buttonLabel: { default: "Next" },
|
||||
},
|
||||
],
|
||||
};
|
||||
const oldSurvey = {
|
||||
blocks: [
|
||||
{
|
||||
id: "block1",
|
||||
name: "Block 1",
|
||||
elements: [
|
||||
{
|
||||
id: "cta1",
|
||||
type: TSurveyQuestionTypeEnum.CTA,
|
||||
headline: { default: "CTA" },
|
||||
required: false,
|
||||
buttonExternal: true,
|
||||
buttonUrl: "https://old-url.com",
|
||||
ctaButtonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
buttonLabel: { default: "Next" },
|
||||
},
|
||||
],
|
||||
endings: [],
|
||||
} as unknown as TSurvey;
|
||||
const result = await checkFeaturePermissions(surveyData, mockOrganization, oldSurvey);
|
||||
expect(result).toBeInstanceOf(Response);
|
||||
expect(result?.status).toBe(403);
|
||||
});
|
||||
|
||||
test("should allow keeping existing CTA external button without permission (grandfathering)", async () => {
|
||||
vi.mocked(getExternalUrlsPermission).mockResolvedValue(false);
|
||||
const surveyData = {
|
||||
...baseSurveyData,
|
||||
blocks: [
|
||||
{
|
||||
id: "block1",
|
||||
name: "Block 1",
|
||||
elements: [
|
||||
{
|
||||
id: "cta1",
|
||||
type: TSurveyQuestionTypeEnum.CTA,
|
||||
headline: { default: "CTA" },
|
||||
required: false,
|
||||
buttonExternal: true,
|
||||
buttonUrl: "https://existing-url.com",
|
||||
ctaButtonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
buttonLabel: { default: "Next" },
|
||||
},
|
||||
],
|
||||
};
|
||||
const oldSurvey = {
|
||||
blocks: [
|
||||
{
|
||||
id: "block1",
|
||||
name: "Block 1",
|
||||
elements: [
|
||||
{
|
||||
id: "cta1",
|
||||
type: TSurveyQuestionTypeEnum.CTA,
|
||||
headline: { default: "CTA" },
|
||||
required: false,
|
||||
buttonExternal: true,
|
||||
buttonUrl: "https://existing-url.com",
|
||||
ctaButtonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
buttonLabel: { default: "Next" },
|
||||
},
|
||||
],
|
||||
endings: [],
|
||||
} as unknown as TSurvey;
|
||||
const result = await checkFeaturePermissions(surveyData, mockOrganization, oldSurvey);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
test("should allow CTA external button when permission is granted", async () => {
|
||||
vi.mocked(getExternalUrlsPermission).mockResolvedValue(true);
|
||||
const surveyData = {
|
||||
...baseSurveyData,
|
||||
blocks: [
|
||||
{
|
||||
id: "block1",
|
||||
name: "Block 1",
|
||||
elements: [
|
||||
{
|
||||
id: "cta1",
|
||||
type: TSurveyQuestionTypeEnum.CTA,
|
||||
headline: { default: "CTA" },
|
||||
required: false,
|
||||
buttonExternal: true,
|
||||
buttonUrl: "https://example.com",
|
||||
ctaButtonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
buttonLabel: { default: "Next" },
|
||||
},
|
||||
],
|
||||
};
|
||||
const result = await checkFeaturePermissions(surveyData, mockOrganization);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
test("should return forbiddenResponse when switching CTA from internal to external without permission", async () => {
|
||||
vi.mocked(getExternalUrlsPermission).mockResolvedValue(false);
|
||||
const surveyData = {
|
||||
...baseSurveyData,
|
||||
blocks: [
|
||||
{
|
||||
id: "block1",
|
||||
name: "Block 1",
|
||||
elements: [
|
||||
{
|
||||
id: "cta1",
|
||||
type: TSurveyQuestionTypeEnum.CTA,
|
||||
headline: { default: "CTA" },
|
||||
required: false,
|
||||
buttonExternal: true,
|
||||
buttonUrl: "https://example.com",
|
||||
ctaButtonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
buttonLabel: { default: "Next" },
|
||||
},
|
||||
],
|
||||
};
|
||||
const oldSurvey = {
|
||||
blocks: [
|
||||
{
|
||||
id: "block1",
|
||||
name: "Block 1",
|
||||
elements: [
|
||||
{
|
||||
id: "cta1",
|
||||
type: TSurveyQuestionTypeEnum.CTA,
|
||||
headline: { default: "CTA" },
|
||||
required: false,
|
||||
buttonExternal: false,
|
||||
buttonUrl: "",
|
||||
ctaButtonLabel: { default: "Click" },
|
||||
},
|
||||
],
|
||||
buttonLabel: { default: "Next" },
|
||||
},
|
||||
],
|
||||
endings: [],
|
||||
} as unknown as TSurvey;
|
||||
const result = await checkFeaturePermissions(surveyData, mockOrganization, oldSurvey);
|
||||
expect(result).toBeInstanceOf(Response);
|
||||
expect(result?.status).toBe(403);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
import { TOrganization } from "@formbricks/types/organizations";
|
||||
import { TSurvey, TSurveyCreateInputWithEnvironmentId } from "@formbricks/types/surveys/types";
|
||||
import { TSurveyCreateInputWithEnvironmentId } from "@formbricks/types/surveys/types";
|
||||
import { responses } from "@/app/lib/api/response";
|
||||
import { getElementsFromBlocks } from "@/lib/survey/utils";
|
||||
import { getIsSpamProtectionEnabled } from "@/modules/ee/license-check/lib/utils";
|
||||
import { getSurveyFollowUpsPermission } from "@/modules/survey/follow-ups/lib/utils";
|
||||
import { getExternalUrlsPermission } from "@/modules/survey/lib/permission";
|
||||
|
||||
export const checkFeaturePermissions = async (
|
||||
surveyData: TSurveyCreateInputWithEnvironmentId,
|
||||
organization: TOrganization,
|
||||
oldSurvey?: TSurvey
|
||||
organization: TOrganization
|
||||
): Promise<Response | null> => {
|
||||
if (surveyData.recaptcha?.enabled) {
|
||||
const isSpamProtectionEnabled = await getIsSpamProtectionEnabled(organization.id);
|
||||
@@ -25,46 +22,5 @@ export const checkFeaturePermissions = async (
|
||||
}
|
||||
}
|
||||
|
||||
const isExternalUrlsAllowed = await getExternalUrlsPermission(organization.id);
|
||||
if (!isExternalUrlsAllowed) {
|
||||
// Check ending cards for new/changed button links
|
||||
if (surveyData.endings) {
|
||||
for (const newEnding of surveyData.endings) {
|
||||
const oldEnding = oldSurvey?.endings.find((e) => e.id === newEnding.id);
|
||||
|
||||
if (newEnding.type === "endScreen" && newEnding.buttonLink) {
|
||||
if (!oldEnding || oldEnding.type !== "endScreen" || oldEnding.buttonLink !== newEnding.buttonLink) {
|
||||
return responses.forbiddenResponse(
|
||||
"External URLs are not enabled for this organization. Upgrade to use external button links."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check CTA elements for new/changed external button URLs
|
||||
if (surveyData.blocks) {
|
||||
const newElements = getElementsFromBlocks(surveyData.blocks);
|
||||
const oldElements = oldSurvey?.blocks ? getElementsFromBlocks(oldSurvey.blocks) : [];
|
||||
|
||||
for (const newElement of newElements) {
|
||||
const oldElement = oldElements.find((e) => e.id === newElement.id);
|
||||
|
||||
if (newElement.type === "cta" && newElement.buttonExternal) {
|
||||
if (
|
||||
!oldElement ||
|
||||
oldElement.type !== "cta" ||
|
||||
!oldElement.buttonExternal ||
|
||||
oldElement.buttonUrl !== newElement.buttonUrl
|
||||
) {
|
||||
return responses.forbiddenResponse(
|
||||
"External URLs are not enabled for this organization. Upgrade to use external CTA buttons."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
"use server";
|
||||
|
||||
import { z } from "zod";
|
||||
import { logger } from "@formbricks/logger";
|
||||
import { OperationNotAllowedError } from "@formbricks/types/errors";
|
||||
import { IS_FORMBRICKS_CLOUD } from "@/lib/constants";
|
||||
import { gethasNoOrganizations } from "@/lib/instance/service";
|
||||
import { createMembership } from "@/lib/membership/service";
|
||||
import { createOrganization } from "@/lib/organization/service";
|
||||
import { authenticatedActionClient } from "@/lib/utils/action-client";
|
||||
import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler";
|
||||
import { ensureCloudStripeSetupForOrganization } from "@/modules/ee/billing/lib/organization-billing";
|
||||
import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils";
|
||||
|
||||
const ZCreateOrganizationAction = z.object({
|
||||
@@ -36,16 +33,6 @@ export const createOrganizationAction = authenticatedActionClient
|
||||
accepted: true,
|
||||
});
|
||||
|
||||
// Stripe setup must run AFTER membership is created so the owner email is available
|
||||
if (IS_FORMBRICKS_CLOUD) {
|
||||
ensureCloudStripeSetupForOrganization(newOrganization.id).catch((error) => {
|
||||
logger.error(
|
||||
{ error, organizationId: newOrganization.id },
|
||||
"Stripe setup failed after organization creation"
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
ctx.auditLoggingCtx.organizationId = newOrganization.id;
|
||||
ctx.auditLoggingCtx.newObject = newOrganization;
|
||||
|
||||
|
||||
+8
-20
@@ -372,7 +372,7 @@ checksums:
|
||||
common/something_went_wrong: a3cd2f01c073f1f5ff436d4b132d39cf
|
||||
common/something_went_wrong_please_try_again: c62a7718d9a1e9c4ffb707807550f836
|
||||
common/sort_by: 8adf3dbc5668379558957662f0c43563
|
||||
common/upgrade_plan: 4fab76a3fc5d5c94e3248cd279cfdd14
|
||||
common/start_free_trial: 4fab76a3fc5d5c94e3248cd279cfdd14
|
||||
common/status: 4e1fcce15854d824919b4a582c697c90
|
||||
common/step_by_step_manual: 2894a07952a4fd11d98d5d8f1088690c
|
||||
common/storage_not_configured: b0c3e339f6d71f23fdd189e7bcb076f6
|
||||
@@ -407,9 +407,6 @@ checksums:
|
||||
common/title: 344e64395eaff6822a57d18623853e1a
|
||||
common/top_left: aa61bb29b56df3e046b6d68d89ee8986
|
||||
common/top_right: 241f95c923846911aaf13af6109333e5
|
||||
common/trial_days_remaining: 914ff3132895e410bf0f862433ccb49e
|
||||
common/trial_expired: ca9f0532ac40ca427ca1ba4c86454e07
|
||||
common/trial_one_day_remaining: 2d64d39fca9589c4865357817bcc24d5
|
||||
common/try_again: 33dd8820e743e35a66e6977f69e9d3b5
|
||||
common/type: f04471a7ddac844b9ad145eb9911ef75
|
||||
common/unknown_survey: dd8f6985e17ccf19fac1776e18b2c498
|
||||
@@ -916,7 +913,6 @@ checksums:
|
||||
environments/settings/api_keys/add_api_key: 1c11117b1d4665ccdeb68530381c6a9d
|
||||
environments/settings/api_keys/add_permission: 4f0481d26a32aef6137ee6f18aaf8e89
|
||||
environments/settings/api_keys/api_keys_description: 42c2d587834d54f124b9541b32ff7133
|
||||
environments/settings/billing/add_payment_method: 38ad2a7f6bc599bf596eab394b379c02
|
||||
environments/settings/billing/cancelling: 6e46e789720395bfa1e3a4b3b1519634
|
||||
environments/settings/billing/failed_to_start_trial: 43e28223f51af382042b3a753d9e4380
|
||||
environments/settings/billing/manage_subscription: b83a75127b8eabc21dfa1e0f7104db56
|
||||
@@ -941,20 +937,15 @@ checksums:
|
||||
environments/settings/billing/stripe_setup_incomplete_description: 9f28a542729cc719bca2ca08e7406284
|
||||
environments/settings/billing/subscription: ba9f3675e18987d067d48533c8897343
|
||||
environments/settings/billing/subscription_description: b03618508e576666198d4adf3c2cb9a9
|
||||
environments/settings/billing/trial_alert_description: aba3076cc6814cc6128d425d3d1957e8
|
||||
environments/settings/billing/trial_already_used: 5433347ff7647fe0aba0fe91a44560ba
|
||||
environments/settings/billing/trial_feature_api_access: 8c6d03728c3d9470616eb5cee5f9f65d
|
||||
environments/settings/billing/trial_feature_attribute_segmentation: 90087da973ae48e32ec6d863516fc8c9
|
||||
environments/settings/billing/trial_feature_contact_segment_management: 27f17a039ebed6413811ab3a461db2f4
|
||||
environments/settings/billing/trial_feature_email_followups: 0cc02dc14aa28ce94ca6153c306924e5
|
||||
environments/settings/billing/trial_feature_hide_branding: b8dbcb24e50e0eb4aeb0c97891cac61d
|
||||
environments/settings/billing/trial_feature_mobile_sdks: 0963480a27df49657c1b7507adec9a06
|
||||
environments/settings/billing/trial_feature_respondent_identification: a82e24ab4c27c5e485326678d9b7bd79
|
||||
environments/settings/billing/trial_feature_unlimited_seats: a3257d5b6a23bfbc4b7fd1108087a823
|
||||
environments/settings/billing/trial_feature_webhooks: 5ead39fba97fbd37835a476ee67fdd94
|
||||
environments/settings/billing/trial_feature_api_access: d7aabb2de18beb5bd30c274cd768a2a9
|
||||
environments/settings/billing/trial_feature_collaboration: a43509fffe319e14d69a981ef2791517
|
||||
environments/settings/billing/trial_feature_email_followups: add368efdd84c5aef8886f369d54cbed
|
||||
environments/settings/billing/trial_feature_quotas: 3a67818b3901bdaa72abc62db72ab170
|
||||
environments/settings/billing/trial_feature_webhooks: 8d7f034e006b2fe0eb8fa9b8f1abef51
|
||||
environments/settings/billing/trial_feature_whitelabel: 624a7aeca6a0fa65935c63fd7a8e9638
|
||||
environments/settings/billing/trial_no_credit_card: 01c70aa6e1001815a9a11951394923ca
|
||||
environments/settings/billing/trial_payment_method_added_description: 872a5c557f56bafc9b7ec4895f9c33e8
|
||||
environments/settings/billing/trial_title: f2c3791c1fb2970617ec0f2d243a931b
|
||||
environments/settings/billing/trial_title: 23d0d2cbe306ae0f784b8289bf66a2c7
|
||||
environments/settings/billing/unlimited_responses: 25bd1cd99bc08c66b8d7d3380b2812e1
|
||||
environments/settings/billing/unlimited_workspaces: f7433bc693ee6d177e76509277f5c173
|
||||
environments/settings/billing/upgrade: 63c3b52882e0d779859307d672c178c2
|
||||
@@ -981,13 +972,11 @@ checksums:
|
||||
environments/settings/enterprise/enterprise_features: 3271476140733924b2a2477c4fdf3d12
|
||||
environments/settings/enterprise/get_an_enterprise_license_to_get_access_to_all_features: afd3c00f19097e88ed051800979eea44
|
||||
environments/settings/enterprise/keep_full_control_over_your_data_privacy_and_security: 43aa041cc3e2b2fdd35d2d34659a6b7a
|
||||
environments/settings/enterprise/license_instance_mismatch_description: 00f47e33ff54fca52ce9b125cd77fda5
|
||||
environments/settings/enterprise/license_invalid_description: b500c22ab17893fdf9532d2bd94aa526
|
||||
environments/settings/enterprise/license_status: f6f85c59074ca2455321bd5288d94be8
|
||||
environments/settings/enterprise/license_status_active: 3e1ec025c4a50830bbb9ad57a176630a
|
||||
environments/settings/enterprise/license_status_description: 828e4527f606471cd8cf58b55ff824f6
|
||||
environments/settings/enterprise/license_status_expired: 63b27cccba4ab2143e0f5f3d46e4168a
|
||||
environments/settings/enterprise/license_status_instance_mismatch: 2c85ca34eef67c5ca34477dc1eda68c0
|
||||
environments/settings/enterprise/license_status_invalid: a4bfd3787fc0bf0a38db61745bd25cec
|
||||
environments/settings/enterprise/license_status_unreachable: 202b110dab099f1167b13c326349e570
|
||||
environments/settings/enterprise/license_unreachable_grace_period: c0587c9d79ac55ff2035fb8b8eec4433
|
||||
@@ -998,7 +987,6 @@ checksums:
|
||||
environments/settings/enterprise/questions_please_reach_out_to: ac4be65ffef9349eaeb137c254d3fee7
|
||||
environments/settings/enterprise/recheck_license: b913b64f89df184b5059710f4a0b26fa
|
||||
environments/settings/enterprise/recheck_license_failed: dd410acbb8887625cf194189f832dd7c
|
||||
environments/settings/enterprise/recheck_license_instance_mismatch: 655cd1cce2f25b100439d8725c1e72f2
|
||||
environments/settings/enterprise/recheck_license_invalid: 58f41bc208692b7d53b975dfcf9f4ad8
|
||||
environments/settings/enterprise/recheck_license_success: 700ddd805be904a415f614de3df1da78
|
||||
environments/settings/enterprise/recheck_license_unreachable: 0ca81bd89595a9da24bc94dcef132175
|
||||
|
||||
@@ -55,7 +55,7 @@ describe("Crypto Utils", () => {
|
||||
// But both should verify correctly
|
||||
expect(await verifySecret(secret, hash1)).toBe(true);
|
||||
expect(await verifySecret(secret, hash2)).toBe(true);
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
test("should use custom cost factor", async () => {
|
||||
const secret = "test-secret-123";
|
||||
|
||||
@@ -308,7 +308,12 @@ export const deleteOrganization = async (organizationId: string) => {
|
||||
|
||||
const stripeCustomerId = deletedOrganization.billing?.stripeCustomerId;
|
||||
if (IS_FORMBRICKS_CLOUD && stripeCustomerId) {
|
||||
await cleanupStripeCustomer(stripeCustomerId);
|
||||
cleanupStripeCustomer(stripeCustomerId).catch((error) => {
|
||||
logger.error(
|
||||
{ error, organizationId, stripeCustomerId },
|
||||
"Failed to clean up Stripe customer after organization deletion"
|
||||
);
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError) {
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "Titel",
|
||||
"top_left": "Oben links",
|
||||
"top_right": "Oben rechts",
|
||||
"trial_days_remaining": "Noch {count} Tage in deiner Testphase",
|
||||
"trial_expired": "Deine Testphase ist abgelaufen",
|
||||
"trial_one_day_remaining": "Noch 1 Tag in deiner Testphase",
|
||||
"try_again": "Versuch's nochmal",
|
||||
"type": "Typ",
|
||||
"unknown_survey": "Unbekannte Umfrage",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "Verwalte API-Schlüssel, um auf die Formbricks-Management-APIs zuzugreifen"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "Zahlungsmethode hinzufügen",
|
||||
"cancelling": "Wird storniert",
|
||||
"failed_to_start_trial": "Die Testversion konnte nicht gestartet werden. Bitte versuche es erneut.",
|
||||
"manage_subscription": "Abonnement verwalten",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "Die Abrechnungseinrichtung war nicht erfolgreich. Bitte versuche es erneut, um Dein Abo zu aktivieren.",
|
||||
"subscription": "Abonnement",
|
||||
"subscription_description": "Verwalte Dein Abonnement und behalte Deine Nutzung im Blick",
|
||||
"trial_alert_description": "Füge eine Zahlungsmethode hinzu, um weiterhin Zugriff auf alle Funktionen zu behalten.",
|
||||
"trial_already_used": "Für diese E-Mail-Adresse wurde bereits eine kostenlose Testversion genutzt. Bitte upgraden Sie stattdessen auf einen kostenpflichtigen Plan.",
|
||||
"trial_feature_api_access": "API-Zugriff",
|
||||
"trial_feature_attribute_segmentation": "Attributbasierte Segmentierung",
|
||||
"trial_feature_contact_segment_management": "Kontakt- & Segmentverwaltung",
|
||||
"trial_feature_email_followups": "E-Mail-Nachfassaktionen",
|
||||
"trial_feature_hide_branding": "Formbricks-Branding ausblenden",
|
||||
"trial_feature_mobile_sdks": "iOS & Android SDKs",
|
||||
"trial_feature_respondent_identification": "Befragten-Identifikation",
|
||||
"trial_feature_unlimited_seats": "Unbegrenzte Benutzerplätze",
|
||||
"trial_feature_webhooks": "Individuelle Webhooks",
|
||||
"trial_feature_api_access": "Vollen API-Zugriff erhalten",
|
||||
"trial_feature_collaboration": "Alle Team- und Kollaborationsfunktionen",
|
||||
"trial_feature_email_followups": "E-Mail-Nachfassaktionen einrichten",
|
||||
"trial_feature_quotas": "Kontingente verwalten",
|
||||
"trial_feature_webhooks": "Benutzerdefinierte Webhooks einrichten",
|
||||
"trial_feature_whitelabel": "Vollständig white-labeled Umfragen",
|
||||
"trial_no_credit_card": "14 Tage Testversion, keine Kreditkarte erforderlich",
|
||||
"trial_payment_method_added_description": "Alles bereit! Dein Pro-Tarif läuft nach Ende der Testphase automatisch weiter.",
|
||||
"trial_title": "Hol dir Formbricks Pro kostenlos!",
|
||||
"trial_title": "Pro-Funktionen kostenlos testen!",
|
||||
"unlimited_responses": "Unbegrenzte Antworten",
|
||||
"unlimited_workspaces": "Unbegrenzte Projekte",
|
||||
"upgrade": "Upgrade",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "Unternehmensfunktionen",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "Hol dir eine Enterprise-Lizenz, um Zugriff auf alle Funktionen zu erhalten.",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "Behalte die volle Kontrolle über deine Daten, Privatsphäre und Sicherheit.",
|
||||
"license_instance_mismatch_description": "Diese Lizenz ist derzeit an eine andere Formbricks-Instanz gebunden. Falls diese Installation neu aufgebaut oder verschoben wurde, bitte den Formbricks-Support, die vorherige Instanzbindung zu entfernen.",
|
||||
"license_invalid_description": "Der Lizenzschlüssel in deiner ENTERPRISE_LICENSE_KEY-Umgebungsvariable ist nicht gültig. Bitte überprüfe auf Tippfehler oder fordere einen neuen Schlüssel an.",
|
||||
"license_status": "Lizenzstatus",
|
||||
"license_status_active": "Aktiv",
|
||||
"license_status_description": "Status deiner Enterprise-Lizenz.",
|
||||
"license_status_expired": "Abgelaufen",
|
||||
"license_status_instance_mismatch": "An andere Instanz gebunden",
|
||||
"license_status_invalid": "Ungültige Lizenz",
|
||||
"license_status_unreachable": "Nicht erreichbar",
|
||||
"license_unreachable_grace_period": "Der Lizenzserver ist nicht erreichbar. Deine Enterprise-Funktionen bleiben während einer 3-tägigen Kulanzfrist bis zum {gracePeriodEnd} aktiv.",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "Fragen? Bitte melde Dich bei",
|
||||
"recheck_license": "Lizenz erneut prüfen",
|
||||
"recheck_license_failed": "Lizenzprüfung fehlgeschlagen. Der Lizenzserver ist möglicherweise nicht erreichbar.",
|
||||
"recheck_license_instance_mismatch": "Diese Lizenz ist an eine andere Formbricks-Instanz gebunden. Bitte den Formbricks-Support, die vorherige Bindung zu entfernen.",
|
||||
"recheck_license_invalid": "Der Lizenzschlüssel ist ungültig. Bitte überprüfe deinen ENTERPRISE_LICENSE_KEY.",
|
||||
"recheck_license_success": "Lizenzprüfung erfolgreich",
|
||||
"recheck_license_unreachable": "Lizenzserver ist nicht erreichbar. Bitte versuche es später erneut.",
|
||||
|
||||
@@ -399,7 +399,7 @@
|
||||
"something_went_wrong": "Something went wrong",
|
||||
"something_went_wrong_please_try_again": "Something went wrong. Please try again.",
|
||||
"sort_by": "Sort by",
|
||||
"start_free_trial": "Upgrade plan",
|
||||
"start_free_trial": "Start Free Trial",
|
||||
"status": "Status",
|
||||
"step_by_step_manual": "Step by step manual",
|
||||
"storage_not_configured": "File storage not set up, uploads will likely fail",
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "Title",
|
||||
"top_left": "Top Left",
|
||||
"top_right": "Top Right",
|
||||
"trial_days_remaining": "{count} days left in your trial",
|
||||
"trial_expired": "Your trial has expired",
|
||||
"trial_one_day_remaining": "1 day left in your trial",
|
||||
"try_again": "Try again",
|
||||
"type": "Type",
|
||||
"unknown_survey": "Unknown survey",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "Manage API keys to access Formbricks management APIs"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "Add payment method",
|
||||
"cancelling": "Cancelling",
|
||||
"failed_to_start_trial": "Failed to start trial. Please try again.",
|
||||
"manage_subscription": "Manage subscription",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "Billing setup did not complete successfully. Please retry to activate your subscription.",
|
||||
"subscription": "Subscription",
|
||||
"subscription_description": "Manage your subscription plan and monitor your usage",
|
||||
"trial_alert_description": "Add a payment method to keep access to all features.",
|
||||
"trial_already_used": "A free trial has already been used for this email address. Please upgrade to a paid plan instead.",
|
||||
"trial_feature_api_access": "API Access",
|
||||
"trial_feature_attribute_segmentation": "Attribute-based Segmentation",
|
||||
"trial_feature_contact_segment_management": "Contact & Segment Management",
|
||||
"trial_feature_email_followups": "Email Follow-ups",
|
||||
"trial_feature_hide_branding": "Hide Formbricks Branding",
|
||||
"trial_feature_mobile_sdks": "iOS & Android SDKs",
|
||||
"trial_feature_respondent_identification": "Respondent Identification",
|
||||
"trial_feature_unlimited_seats": "Unlimited Seats",
|
||||
"trial_feature_webhooks": "Custom Webhooks",
|
||||
"trial_feature_api_access": "Get full API access",
|
||||
"trial_feature_collaboration": "All team & collaboration features",
|
||||
"trial_feature_email_followups": "Setup email follow-ups",
|
||||
"trial_feature_quotas": "Manage quotas",
|
||||
"trial_feature_webhooks": "Setup custom webhooks",
|
||||
"trial_feature_whitelabel": "Fully white-labeled surveys",
|
||||
"trial_no_credit_card": "14 days trial, no credit card required",
|
||||
"trial_payment_method_added_description": "You're all set! Your Pro plan will continue automatically after the trial ends.",
|
||||
"trial_title": "Get Formbricks Pro for free!",
|
||||
"trial_title": "Try Pro features for free!",
|
||||
"unlimited_responses": "Unlimited Responses",
|
||||
"unlimited_workspaces": "Unlimited Workspaces",
|
||||
"upgrade": "Upgrade",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "Enterprise Features",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "Get an Enterprise license to get access to all features.",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "Keep full control over your data privacy and security.",
|
||||
"license_instance_mismatch_description": "This license is currently bound to a different Formbricks instance. If this installation was rebuilt or moved, ask Formbricks support to disconnect the previous instance binding.",
|
||||
"license_invalid_description": "The license key in your ENTERPRISE_LICENSE_KEY environment variable is not valid. Please check for typos or request a new key.",
|
||||
"license_status": "License Status",
|
||||
"license_status_active": "Active",
|
||||
"license_status_description": "Status of your enterprise license.",
|
||||
"license_status_expired": "Expired",
|
||||
"license_status_instance_mismatch": "Bound to Another Instance",
|
||||
"license_status_invalid": "Invalid License",
|
||||
"license_status_unreachable": "Unreachable",
|
||||
"license_unreachable_grace_period": "License server cannot be reached. Your enterprise features remain active during a 3-day grace period ending {gracePeriodEnd}.",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "Questions? Please reach out to",
|
||||
"recheck_license": "Recheck license",
|
||||
"recheck_license_failed": "License check failed. The license server may be unreachable.",
|
||||
"recheck_license_instance_mismatch": "This license is bound to a different Formbricks instance. Ask Formbricks support to disconnect the previous binding.",
|
||||
"recheck_license_invalid": "The license key is invalid. Please verify your ENTERPRISE_LICENSE_KEY.",
|
||||
"recheck_license_success": "License check successful",
|
||||
"recheck_license_unreachable": "License server is unreachable. Please try again later.",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "Título",
|
||||
"top_left": "Superior izquierda",
|
||||
"top_right": "Superior derecha",
|
||||
"trial_days_remaining": "{count} días restantes en tu prueba",
|
||||
"trial_expired": "Tu prueba ha expirado",
|
||||
"trial_one_day_remaining": "1 día restante en tu prueba",
|
||||
"try_again": "Intentar de nuevo",
|
||||
"type": "Tipo",
|
||||
"unknown_survey": "Encuesta desconocida",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "Gestiona las claves API para acceder a las APIs de gestión de Formbricks"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "Añadir método de pago",
|
||||
"cancelling": "Cancelando",
|
||||
"failed_to_start_trial": "No se pudo iniciar la prueba. Por favor, inténtalo de nuevo.",
|
||||
"manage_subscription": "Gestionar suscripción",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "La configuración de facturación no se completó correctamente. Por favor, vuelve a intentarlo para activar tu suscripción.",
|
||||
"subscription": "Suscripción",
|
||||
"subscription_description": "Gestiona tu plan de suscripción y monitorea tu uso",
|
||||
"trial_alert_description": "Añade un método de pago para mantener el acceso a todas las funciones.",
|
||||
"trial_already_used": "Ya se ha utilizado una prueba gratuita para esta dirección de correo electrónico. Por favor, actualiza a un plan de pago.",
|
||||
"trial_feature_api_access": "Acceso a la API",
|
||||
"trial_feature_attribute_segmentation": "Segmentación basada en atributos",
|
||||
"trial_feature_contact_segment_management": "Gestión de contactos y segmentos",
|
||||
"trial_feature_email_followups": "Seguimientos por correo electrónico",
|
||||
"trial_feature_hide_branding": "Ocultar la marca Formbricks",
|
||||
"trial_feature_mobile_sdks": "SDKs para iOS y Android",
|
||||
"trial_feature_respondent_identification": "Identificación de encuestados",
|
||||
"trial_feature_unlimited_seats": "Asientos ilimitados",
|
||||
"trial_feature_webhooks": "Webhooks personalizados",
|
||||
"trial_feature_api_access": "Acceso completo a la API",
|
||||
"trial_feature_collaboration": "Todas las funciones de equipo y colaboración",
|
||||
"trial_feature_email_followups": "Configurar seguimientos por correo electrónico",
|
||||
"trial_feature_quotas": "Gestionar cuotas",
|
||||
"trial_feature_webhooks": "Configurar webhooks personalizados",
|
||||
"trial_feature_whitelabel": "Encuestas totalmente personalizadas",
|
||||
"trial_no_credit_card": "Prueba de 14 días, sin tarjeta de crédito",
|
||||
"trial_payment_method_added_description": "¡Todo listo! Tu plan Pro continuará automáticamente cuando termine el periodo de prueba.",
|
||||
"trial_title": "¡Consigue Formbricks Pro gratis!",
|
||||
"trial_title": "¡Prueba las funciones Pro gratis!",
|
||||
"unlimited_responses": "Respuestas ilimitadas",
|
||||
"unlimited_workspaces": "Proyectos ilimitados",
|
||||
"upgrade": "Actualizar",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "Características empresariales",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "Obtén una licencia empresarial para acceder a todas las características.",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "Mantén el control total sobre la privacidad y seguridad de tus datos.",
|
||||
"license_instance_mismatch_description": "Esta licencia está actualmente vinculada a una instancia diferente de Formbricks. Si esta instalación fue reconstruida o migrada, solicita al soporte de Formbricks que desconecte la vinculación de la instancia anterior.",
|
||||
"license_invalid_description": "La clave de licencia en tu variable de entorno ENTERPRISE_LICENSE_KEY no es válida. Por favor, comprueba si hay errores tipográficos o solicita una clave nueva.",
|
||||
"license_status": "Estado de la licencia",
|
||||
"license_status_active": "Activa",
|
||||
"license_status_description": "Estado de tu licencia enterprise.",
|
||||
"license_status_expired": "Caducada",
|
||||
"license_status_instance_mismatch": "Vinculada a Otra Instancia",
|
||||
"license_status_invalid": "Licencia no válida",
|
||||
"license_status_unreachable": "Inaccesible",
|
||||
"license_unreachable_grace_period": "No se puede acceder al servidor de licencias. Tus funciones empresariales permanecen activas durante un período de gracia de 3 días que finaliza el {gracePeriodEnd}.",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "¿Preguntas? Por favor, contacta con",
|
||||
"recheck_license": "Volver a comprobar licencia",
|
||||
"recheck_license_failed": "Error al comprobar la licencia. Es posible que el servidor de licencias no esté disponible.",
|
||||
"recheck_license_instance_mismatch": "Esta licencia está vinculada a una instancia diferente de Formbricks. Solicita al soporte de Formbricks que desconecte la vinculación anterior.",
|
||||
"recheck_license_invalid": "La clave de licencia no es válida. Por favor, verifica tu ENTERPRISE_LICENSE_KEY.",
|
||||
"recheck_license_success": "Comprobación de licencia correcta",
|
||||
"recheck_license_unreachable": "El servidor de licencias no está disponible. Inténtalo de nuevo más tarde.",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "Titre",
|
||||
"top_left": "En haut à gauche",
|
||||
"top_right": "En haut à droite",
|
||||
"trial_days_remaining": "{count} jours restants dans votre période d'essai",
|
||||
"trial_expired": "Votre période d'essai a expiré",
|
||||
"trial_one_day_remaining": "1 jour restant dans votre période d'essai",
|
||||
"try_again": "Réessayer",
|
||||
"type": "Type",
|
||||
"unknown_survey": "Enquête inconnue",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "Les clés d'API permettent d'accéder aux API de gestion de Formbricks."
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "Ajouter un moyen de paiement",
|
||||
"cancelling": "Annulation en cours",
|
||||
"failed_to_start_trial": "Échec du démarrage de l'essai. Réessaye.",
|
||||
"manage_subscription": "Gérer l'abonnement",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "La configuration de la facturation n’a pas abouti. Merci de réessayer pour activer ton abonnement.",
|
||||
"subscription": "Abonnement",
|
||||
"subscription_description": "Gère ton abonnement et surveille ta consommation",
|
||||
"trial_alert_description": "Ajoute un moyen de paiement pour conserver l'accès à toutes les fonctionnalités.",
|
||||
"trial_already_used": "Un essai gratuit a déjà été utilisé pour cette adresse e-mail. Passe plutôt à un plan payant.",
|
||||
"trial_feature_api_access": "Accès API",
|
||||
"trial_feature_attribute_segmentation": "Segmentation basée sur les attributs",
|
||||
"trial_feature_contact_segment_management": "Gestion des contacts et segments",
|
||||
"trial_feature_email_followups": "Relances par e-mail",
|
||||
"trial_feature_hide_branding": "Masquer l'image de marque Formbricks",
|
||||
"trial_feature_mobile_sdks": "SDKs iOS et Android",
|
||||
"trial_feature_respondent_identification": "Identification des répondants",
|
||||
"trial_feature_unlimited_seats": "Places illimitées",
|
||||
"trial_feature_webhooks": "Webhooks personnalisés",
|
||||
"trial_feature_api_access": "Accès complet à l'API",
|
||||
"trial_feature_collaboration": "Toutes les fonctionnalités d'équipe et de collaboration",
|
||||
"trial_feature_email_followups": "Configure des relances par e-mail",
|
||||
"trial_feature_quotas": "Gère les quotas",
|
||||
"trial_feature_webhooks": "Configure des webhooks personnalisés",
|
||||
"trial_feature_whitelabel": "Enquêtes entièrement en marque blanche",
|
||||
"trial_no_credit_card": "Essai de 14 jours, aucune carte bancaire requise",
|
||||
"trial_payment_method_added_description": "Tout est prêt ! Votre abonnement Pro se poursuivra automatiquement après la fin de la période d'essai.",
|
||||
"trial_title": "Obtenez Formbricks Pro gratuitement !",
|
||||
"trial_title": "Essaie les fonctionnalités Pro gratuitement !",
|
||||
"unlimited_responses": "Réponses illimitées",
|
||||
"unlimited_workspaces": "Projets illimités",
|
||||
"upgrade": "Mise à niveau",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "Fonctionnalités d'entreprise",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "Obtenez une licence Entreprise pour accéder à toutes les fonctionnalités.",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "Gardez un contrôle total sur la confidentialité et la sécurité de vos données.",
|
||||
"license_instance_mismatch_description": "Cette licence est actuellement liée à une autre instance Formbricks. Si cette installation a été reconstruite ou déplacée, demande au support Formbricks de déconnecter la liaison de l'instance précédente.",
|
||||
"license_invalid_description": "La clé de licence dans votre variable d'environnement ENTERPRISE_LICENSE_KEY n'est pas valide. Veuillez vérifier les fautes de frappe ou demander une nouvelle clé.",
|
||||
"license_status": "Statut de la licence",
|
||||
"license_status_active": "Active",
|
||||
"license_status_description": "Statut de votre licence entreprise.",
|
||||
"license_status_expired": "Expirée",
|
||||
"license_status_instance_mismatch": "Liée à une autre instance",
|
||||
"license_status_invalid": "Licence invalide",
|
||||
"license_status_unreachable": "Inaccessible",
|
||||
"license_unreachable_grace_period": "Le serveur de licence est injoignable. Vos fonctionnalités entreprise restent actives pendant une période de grâce de 3 jours se terminant le {gracePeriodEnd}.",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "Des questions ? Veuillez contacter",
|
||||
"recheck_license": "Revérifier la licence",
|
||||
"recheck_license_failed": "La vérification de la licence a échoué. Le serveur de licences est peut-être inaccessible.",
|
||||
"recheck_license_instance_mismatch": "Cette licence est liée à une autre instance Formbricks. Demande au support Formbricks de déconnecter la liaison précédente.",
|
||||
"recheck_license_invalid": "La clé de licence est invalide. Veuillez vérifier votre ENTERPRISE_LICENSE_KEY.",
|
||||
"recheck_license_success": "Vérification de la licence réussie",
|
||||
"recheck_license_unreachable": "Le serveur de licences est inaccessible. Veuillez réessayer plus tard.",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "Cím",
|
||||
"top_left": "Balra fent",
|
||||
"top_right": "Jobbra fent",
|
||||
"trial_days_remaining": "{count} nap van hátra a próbaidőszakból",
|
||||
"trial_expired": "A próbaidőszak lejárt",
|
||||
"trial_one_day_remaining": "1 nap van hátra a próbaidőszakból",
|
||||
"try_again": "Próbálja újra",
|
||||
"type": "Típus",
|
||||
"unknown_survey": "Ismeretlen kérdőív",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "API-kulcsok kezelése a Formbricks kezelő API-jaihoz való hozzáféréshez"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "Fizetési mód hozzáadása",
|
||||
"cancelling": "Lemondás folyamatban",
|
||||
"failed_to_start_trial": "A próbaidőszak indítása sikertelen. Kérjük, próbálja meg újra.",
|
||||
"manage_subscription": "Előfizetés kezelése",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "A számlázás beállítása nem sikerült teljesen. Aktiválja előfizetését az újrapróbálkozással.",
|
||||
"subscription": "Előfizetés",
|
||||
"subscription_description": "Kezelje előfizetését és kövesse nyomon a használatot",
|
||||
"trial_alert_description": "Adjon hozzá fizetési módot, hogy megtarthassa a hozzáférést az összes funkcióhoz.",
|
||||
"trial_already_used": "Ehhez az e-mail címhez már igénybe vettek ingyenes próbaidőszakot. Kérjük, válasszon helyette fizetős csomagot.",
|
||||
"trial_feature_api_access": "API-hozzáférés",
|
||||
"trial_feature_attribute_segmentation": "Attribútumalapú szegmentálás",
|
||||
"trial_feature_contact_segment_management": "Kapcsolat- és szegmenskezelés",
|
||||
"trial_feature_email_followups": "E-mail követések",
|
||||
"trial_feature_hide_branding": "Formbricks márkajelzés elrejtése",
|
||||
"trial_feature_mobile_sdks": "iOS és Android SDK-k",
|
||||
"trial_feature_respondent_identification": "Válaszadó-azonosítás",
|
||||
"trial_feature_unlimited_seats": "Korlátlan számú felhasználói hely",
|
||||
"trial_feature_webhooks": "Egyéni webhookok",
|
||||
"trial_feature_api_access": "Teljes API-hozzáférés megszerzése",
|
||||
"trial_feature_collaboration": "Minden csapat- és együttműködési funkció",
|
||||
"trial_feature_email_followups": "E-mail követések beállítása",
|
||||
"trial_feature_quotas": "Kvóták kezelése",
|
||||
"trial_feature_webhooks": "Egyéni webhookok beállítása",
|
||||
"trial_feature_whitelabel": "Teljesen fehércímkés felmérések",
|
||||
"trial_no_credit_card": "14 napos próbaidőszak, bankkártya nélkül",
|
||||
"trial_payment_method_added_description": "Minden rendben! A Pro csomag automatikusan folytatódik a próbaidőszak lejárta után.",
|
||||
"trial_title": "Szerezze meg a Formbricks Pro-t ingyen!",
|
||||
"trial_title": "Próbálja ki a Pro funkciókat ingyen!",
|
||||
"unlimited_responses": "Korlátlan válaszok",
|
||||
"unlimited_workspaces": "Korlátlan munkaterület",
|
||||
"upgrade": "Frissítés",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "Vállalati funkciók",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "Vállalati licenc megszerzése az összes funkcióhoz való hozzáféréshez.",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "Az adatvédelem és biztonság fölötti rendelkezés teljes kézben tartása.",
|
||||
"license_instance_mismatch_description": "Ez a licenc jelenleg egy másik Formbricks példányhoz van kötve. Amennyiben ez a telepítés újra lett építve vagy áthelyezésre került, kérje a Formbricks ügyfélszolgálatát, hogy bontsa fel az előző példány kötését.",
|
||||
"license_invalid_description": "Az ENTERPRISE_LICENSE_KEY környezeti változóban lévő licenckulcs nem érvényes. Ellenőrizze, hogy nem gépelte-e el, vagy kérjen új kulcsot.",
|
||||
"license_status": "Licencállapot",
|
||||
"license_status_active": "Aktív",
|
||||
"license_status_description": "A vállalati licenc állapota.",
|
||||
"license_status_expired": "Lejárt",
|
||||
"license_status_instance_mismatch": "Másik Példányhoz Kötve",
|
||||
"license_status_invalid": "Érvénytelen licenc",
|
||||
"license_status_unreachable": "Nem érhető el",
|
||||
"license_unreachable_grace_period": "A licenckiszolgálót nem lehet elérni. A vállalati funkciók egy 3 napos türelmi időszak alatt aktívak maradnak, egészen eddig: {gracePeriodEnd}.",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "Kérdése van? Írjon nekünk erre az e-mail-címre:",
|
||||
"recheck_license": "Licenc újraellenőrzése",
|
||||
"recheck_license_failed": "A licencellenőrzés nem sikerült. Lehet, hogy a licenckiszolgáló nem érhető el.",
|
||||
"recheck_license_instance_mismatch": "Ez a licenc egy másik Formbricks példányhoz van kötve. Kérje a Formbricks ügyfélszolgálatát, hogy bontsa fel az előző kötést.",
|
||||
"recheck_license_invalid": "A licenckulcs érvénytelen. Ellenőrizze az ENTERPRISE_LICENSE_KEY értékét.",
|
||||
"recheck_license_success": "A licencellenőrzés sikeres",
|
||||
"recheck_license_unreachable": "A licenckiszolgáló nem érhető el. Próbálja meg később újra.",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "タイトル",
|
||||
"top_left": "左上",
|
||||
"top_right": "右上",
|
||||
"trial_days_remaining": "トライアル期間の残り{count}日",
|
||||
"trial_expired": "トライアル期間が終了しました",
|
||||
"trial_one_day_remaining": "トライアル期間の残り1日",
|
||||
"try_again": "もう一度お試しください",
|
||||
"type": "種類",
|
||||
"unknown_survey": "不明なフォーム",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "Formbricks管理APIにアクセスするためのAPIキーを管理します"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "支払い方法を追加",
|
||||
"cancelling": "キャンセル中",
|
||||
"failed_to_start_trial": "トライアルの開始に失敗しました。もう一度お試しください。",
|
||||
"manage_subscription": "サブスクリプションを管理",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "請求情報の設定が正常に完了しませんでした。もう一度やり直してサブスクリプションを有効化してください。",
|
||||
"subscription": "サブスクリプション",
|
||||
"subscription_description": "サブスクリプションプランの管理や利用状況の確認はこちら",
|
||||
"trial_alert_description": "すべての機能へのアクセスを維持するには、支払い方法を追加してください。",
|
||||
"trial_already_used": "このメールアドレスでは既に無料トライアルが使用されています。代わりに有料プランにアップグレードしてください。",
|
||||
"trial_feature_api_access": "APIアクセス",
|
||||
"trial_feature_attribute_segmentation": "属性ベースのセグメンテーション",
|
||||
"trial_feature_contact_segment_management": "連絡先とセグメントの管理",
|
||||
"trial_feature_email_followups": "メールフォローアップ",
|
||||
"trial_feature_hide_branding": "Formbricksブランディングを非表示",
|
||||
"trial_feature_mobile_sdks": "iOS & Android SDK",
|
||||
"trial_feature_respondent_identification": "回答者の識別",
|
||||
"trial_feature_unlimited_seats": "無制限のシート数",
|
||||
"trial_feature_webhooks": "カスタムWebhook",
|
||||
"trial_feature_api_access": "フルAPIアクセスを利用",
|
||||
"trial_feature_collaboration": "すべてのチーム・コラボレーション機能",
|
||||
"trial_feature_email_followups": "メールフォローアップの設定",
|
||||
"trial_feature_quotas": "クォータの管理",
|
||||
"trial_feature_webhooks": "カスタムWebhookの設定",
|
||||
"trial_feature_whitelabel": "完全ホワイトラベル対応のアンケート",
|
||||
"trial_no_credit_card": "14日間トライアル、クレジットカード不要",
|
||||
"trial_payment_method_added_description": "準備完了です!トライアル終了後、Proプランが自動的に継続されます。",
|
||||
"trial_title": "Formbricks Proを無料で入手しよう!",
|
||||
"trial_title": "Pro機能を無料でお試し!",
|
||||
"unlimited_responses": "無制限の回答",
|
||||
"unlimited_workspaces": "無制限ワークスペース",
|
||||
"upgrade": "アップグレード",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "エンタープライズ機能",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "すべての機能にアクセスするには、エンタープライズライセンスを取得してください。",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "データのプライバシーとセキュリティを完全に制御できます。",
|
||||
"license_instance_mismatch_description": "このライセンスは現在、別のFormbricksインスタンスに紐付けられています。このインストールが再構築または移動された場合は、Formbricksサポートに連絡して、以前のインスタンスの紐付けを解除してもらってください。",
|
||||
"license_invalid_description": "ENTERPRISE_LICENSE_KEY環境変数のライセンスキーが無効です。入力ミスがないか確認するか、新しいキーをリクエストしてください。",
|
||||
"license_status": "ライセンスステータス",
|
||||
"license_status_active": "有効",
|
||||
"license_status_description": "エンタープライズライセンスのステータス。",
|
||||
"license_status_expired": "期限切れ",
|
||||
"license_status_instance_mismatch": "別のインスタンスに紐付け済み",
|
||||
"license_status_invalid": "無効なライセンス",
|
||||
"license_status_unreachable": "接続不可",
|
||||
"license_unreachable_grace_period": "ライセンスサーバーに接続できません。エンタープライズ機能は{gracePeriodEnd}までの3日間の猶予期間中は引き続き利用できます。",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "質問はありますか?こちらまでお問い合わせください",
|
||||
"recheck_license": "ライセンスを再確認",
|
||||
"recheck_license_failed": "ライセンスの確認に失敗しました。ライセンスサーバーに接続できない可能性があります。",
|
||||
"recheck_license_instance_mismatch": "このライセンスは別のFormbricksインスタンスに紐付けられています。Formbricksサポートに連絡して、以前の紐付けを解除してもらってください。",
|
||||
"recheck_license_invalid": "ライセンスキーが無効です。ENTERPRISE_LICENSE_KEYを確認してください。",
|
||||
"recheck_license_success": "ライセンスの確認に成功しました",
|
||||
"recheck_license_unreachable": "ライセンスサーバーに接続できません。後ほど再度お試しください。",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "Titel",
|
||||
"top_left": "Linksboven",
|
||||
"top_right": "Rechtsboven",
|
||||
"trial_days_remaining": "{count} dagen over in je proefperiode",
|
||||
"trial_expired": "Je proefperiode is verlopen",
|
||||
"trial_one_day_remaining": "1 dag over in je proefperiode",
|
||||
"try_again": "Probeer het opnieuw",
|
||||
"type": "Type",
|
||||
"unknown_survey": "Onbekende enquête",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "Beheer API-sleutels om toegang te krijgen tot Formbricks-beheer-API's"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "Betaalmethode toevoegen",
|
||||
"cancelling": "Bezig met annuleren",
|
||||
"failed_to_start_trial": "Proefperiode starten mislukt. Probeer het opnieuw.",
|
||||
"manage_subscription": "Abonnement beheren",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "Het instellen van de facturatie is niet gelukt. Probeer het opnieuw om je abonnement te activeren.",
|
||||
"subscription": "Abonnement",
|
||||
"subscription_description": "Beheer je abonnement en houd je gebruik bij",
|
||||
"trial_alert_description": "Voeg een betaalmethode toe om toegang te houden tot alle functies.",
|
||||
"trial_already_used": "Er is al een gratis proefperiode gebruikt voor dit e-mailadres. Upgrade in plaats daarvan naar een betaald abonnement.",
|
||||
"trial_feature_api_access": "API-toegang",
|
||||
"trial_feature_attribute_segmentation": "Segmentatie op basis van attributen",
|
||||
"trial_feature_contact_segment_management": "Contact- en segmentbeheer",
|
||||
"trial_feature_email_followups": "E-mail follow-ups",
|
||||
"trial_feature_hide_branding": "Verberg Formbricks-branding",
|
||||
"trial_feature_mobile_sdks": "iOS- en Android-SDK's",
|
||||
"trial_feature_respondent_identification": "Identificatie van respondenten",
|
||||
"trial_feature_unlimited_seats": "Onbeperkt aantal gebruikers",
|
||||
"trial_feature_webhooks": "Aangepaste webhooks",
|
||||
"trial_feature_api_access": "Krijg volledige API-toegang",
|
||||
"trial_feature_collaboration": "Alle team- en samenwerkingsfuncties",
|
||||
"trial_feature_email_followups": "E-mail follow-ups instellen",
|
||||
"trial_feature_quotas": "Quota's beheren",
|
||||
"trial_feature_webhooks": "Aangepaste webhooks instellen",
|
||||
"trial_feature_whitelabel": "Volledig white-label enquêtes",
|
||||
"trial_no_credit_card": "14 dagen proefperiode, geen creditcard vereist",
|
||||
"trial_payment_method_added_description": "Je bent helemaal klaar! Je Pro-abonnement wordt automatisch voortgezet na afloop van de proefperiode.",
|
||||
"trial_title": "Krijg Formbricks Pro gratis!",
|
||||
"trial_title": "Probeer Pro-functies gratis!",
|
||||
"unlimited_responses": "Onbeperkte reacties",
|
||||
"unlimited_workspaces": "Onbeperkt werkruimtes",
|
||||
"upgrade": "Upgraden",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "Enterprise-functies",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "Ontvang een Enterprise-licentie om toegang te krijgen tot alle functies.",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "Houd de volledige controle over de privacy en beveiliging van uw gegevens.",
|
||||
"license_instance_mismatch_description": "Deze licentie is momenteel gekoppeld aan een andere Formbricks-instantie. Als deze installatie is herbouwd of verplaatst, vraag dan Formbricks-support om de vorige instantiekoppeling te verbreken.",
|
||||
"license_invalid_description": "De licentiesleutel in je ENTERPRISE_LICENSE_KEY omgevingsvariabele is niet geldig. Controleer op typefouten of vraag een nieuwe sleutel aan.",
|
||||
"license_status": "Licentiestatus",
|
||||
"license_status_active": "Actief",
|
||||
"license_status_description": "Status van je enterprise-licentie.",
|
||||
"license_status_expired": "Verlopen",
|
||||
"license_status_instance_mismatch": "Gekoppeld aan Andere Instantie",
|
||||
"license_status_invalid": "Ongeldige licentie",
|
||||
"license_status_unreachable": "Niet bereikbaar",
|
||||
"license_unreachable_grace_period": "Licentieserver is niet bereikbaar. Je enterprise functies blijven actief tijdens een respijtperiode van 3 dagen die eindigt op {gracePeriodEnd}.",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "Vragen? Neem contact op met",
|
||||
"recheck_license": "Licentie opnieuw controleren",
|
||||
"recheck_license_failed": "Licentiecontrole mislukt. De licentieserver is mogelijk niet bereikbaar.",
|
||||
"recheck_license_instance_mismatch": "Deze licentie is gekoppeld aan een andere Formbricks-instantie. Vraag Formbricks-support om de vorige koppeling te verbreken.",
|
||||
"recheck_license_invalid": "De licentiesleutel is ongeldig. Controleer je ENTERPRISE_LICENSE_KEY.",
|
||||
"recheck_license_success": "Licentiecontrole geslaagd",
|
||||
"recheck_license_unreachable": "Licentieserver is niet bereikbaar. Probeer het later opnieuw.",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "Título",
|
||||
"top_left": "Canto superior esquerdo",
|
||||
"top_right": "Canto Superior Direito",
|
||||
"trial_days_remaining": "{count} dias restantes no seu período de teste",
|
||||
"trial_expired": "Seu período de teste expirou",
|
||||
"trial_one_day_remaining": "1 dia restante no seu período de teste",
|
||||
"try_again": "Tenta de novo",
|
||||
"type": "Tipo",
|
||||
"unknown_survey": "Pesquisa desconhecida",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "Gerencie chaves de API para acessar as APIs de gerenciamento do Formbricks"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "Adicionar forma de pagamento",
|
||||
"cancelling": "Cancelando",
|
||||
"failed_to_start_trial": "Falha ao iniciar o período de teste. Por favor, tente novamente.",
|
||||
"manage_subscription": "Gerenciar assinatura",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "A configuração de cobrança não foi concluída com sucesso. Tente novamente para ativar sua assinatura.",
|
||||
"subscription": "Assinatura",
|
||||
"subscription_description": "Gerencie seu plano de assinatura e acompanhe seu uso",
|
||||
"trial_alert_description": "Adicione uma forma de pagamento para manter o acesso a todos os recursos.",
|
||||
"trial_already_used": "Um período de teste gratuito já foi usado para este endereço de e-mail. Por favor, faça upgrade para um plano pago.",
|
||||
"trial_feature_api_access": "Acesso à API",
|
||||
"trial_feature_attribute_segmentation": "Segmentação Baseada em Atributos",
|
||||
"trial_feature_contact_segment_management": "Gerenciamento de Contatos e Segmentos",
|
||||
"trial_feature_email_followups": "Follow-ups por E-mail",
|
||||
"trial_feature_hide_branding": "Ocultar Marca Formbricks",
|
||||
"trial_feature_mobile_sdks": "SDKs para iOS e Android",
|
||||
"trial_feature_respondent_identification": "Identificação de Respondentes",
|
||||
"trial_feature_unlimited_seats": "Assentos Ilimitados",
|
||||
"trial_feature_webhooks": "Webhooks Personalizados",
|
||||
"trial_feature_api_access": "Obtenha acesso completo à API",
|
||||
"trial_feature_collaboration": "Todos os recursos de equipe e colaboração",
|
||||
"trial_feature_email_followups": "Configure acompanhamentos por e-mail",
|
||||
"trial_feature_quotas": "Gerencie cotas",
|
||||
"trial_feature_webhooks": "Configure webhooks personalizados",
|
||||
"trial_feature_whitelabel": "Pesquisas totalmente personalizadas",
|
||||
"trial_no_credit_card": "14 dias de teste, sem necessidade de cartão de crédito",
|
||||
"trial_payment_method_added_description": "Tudo pronto! Seu plano Pro continuará automaticamente após o término do período de teste.",
|
||||
"trial_title": "Ganhe o Formbricks Pro gratuitamente!",
|
||||
"trial_title": "Experimente os recursos Pro gratuitamente!",
|
||||
"unlimited_responses": "Respostas Ilimitadas",
|
||||
"unlimited_workspaces": "Projetos ilimitados",
|
||||
"upgrade": "Atualizar",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "Recursos Empresariais",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "Adquira uma licença Enterprise para ter acesso a todos os recursos.",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "Mantenha controle total sobre a privacidade e segurança dos seus dados.",
|
||||
"license_instance_mismatch_description": "Esta licença está atualmente vinculada a uma instância diferente do Formbricks. Se esta instalação foi reconstruída ou movida, peça ao suporte do Formbricks para desconectar a vinculação da instância anterior.",
|
||||
"license_invalid_description": "A chave de licença na sua variável de ambiente ENTERPRISE_LICENSE_KEY não é válida. Verifique se há erros de digitação ou solicite uma nova chave.",
|
||||
"license_status": "Status da licença",
|
||||
"license_status_active": "Ativa",
|
||||
"license_status_description": "Status da sua licença enterprise.",
|
||||
"license_status_expired": "Expirada",
|
||||
"license_status_instance_mismatch": "Vinculada a Outra Instância",
|
||||
"license_status_invalid": "Licença inválida",
|
||||
"license_status_unreachable": "Inacessível",
|
||||
"license_unreachable_grace_period": "O servidor de licenças não pode ser alcançado. Seus recursos empresariais permanecem ativos durante um período de carência de 3 dias que termina em {gracePeriodEnd}.",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "Perguntas? Entre em contato com",
|
||||
"recheck_license": "Verificar licença novamente",
|
||||
"recheck_license_failed": "Falha na verificação da licença. O servidor de licenças pode estar inacessível.",
|
||||
"recheck_license_instance_mismatch": "Esta licença está vinculada a uma instância diferente do Formbricks. Peça ao suporte do Formbricks para desconectar a vinculação anterior.",
|
||||
"recheck_license_invalid": "A chave de licença é inválida. Verifique sua ENTERPRISE_LICENSE_KEY.",
|
||||
"recheck_license_success": "Verificação da licença bem-sucedida",
|
||||
"recheck_license_unreachable": "Servidor de licenças inacessível. Por favor, tente novamente mais tarde.",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "Título",
|
||||
"top_left": "Superior Esquerdo",
|
||||
"top_right": "Superior Direito",
|
||||
"trial_days_remaining": "{count} dias restantes no teu período de teste",
|
||||
"trial_expired": "O teu período de teste expirou",
|
||||
"trial_one_day_remaining": "1 dia restante no teu período de teste",
|
||||
"try_again": "Tente novamente",
|
||||
"type": "Tipo",
|
||||
"unknown_survey": "Inquérito desconhecido",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "Faça a gestão das suas chaves API para aceder às APIs de gestão do Formbricks"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "Adicionar método de pagamento",
|
||||
"cancelling": "A cancelar",
|
||||
"failed_to_start_trial": "Falha ao iniciar o período de teste. Por favor, tenta novamente.",
|
||||
"manage_subscription": "Gerir subscrição",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "A configuração de faturação não foi concluída com sucesso. Por favor, tenta novamente para ativar a tua subscrição.",
|
||||
"subscription": "Subscrição",
|
||||
"subscription_description": "Gere o teu plano de subscrição e acompanha a tua utilização",
|
||||
"trial_alert_description": "Adiciona um método de pagamento para manteres acesso a todas as funcionalidades.",
|
||||
"trial_already_used": "Já foi utilizado um período de teste gratuito para este endereço de email. Por favor, atualiza para um plano pago.",
|
||||
"trial_feature_api_access": "Acesso à API",
|
||||
"trial_feature_attribute_segmentation": "Segmentação Baseada em Atributos",
|
||||
"trial_feature_contact_segment_management": "Gestão de Contactos e Segmentos",
|
||||
"trial_feature_email_followups": "Seguimentos por E-mail",
|
||||
"trial_feature_hide_branding": "Ocultar Marca Formbricks",
|
||||
"trial_feature_mobile_sdks": "SDKs para iOS e Android",
|
||||
"trial_feature_respondent_identification": "Identificação de Inquiridos",
|
||||
"trial_feature_unlimited_seats": "Lugares Ilimitados",
|
||||
"trial_feature_webhooks": "Webhooks Personalizados",
|
||||
"trial_feature_api_access": "Obtém acesso completo à API",
|
||||
"trial_feature_collaboration": "Todas as funcionalidades de equipa e colaboração",
|
||||
"trial_feature_email_followups": "Configura acompanhamentos por email",
|
||||
"trial_feature_quotas": "Gere quotas",
|
||||
"trial_feature_webhooks": "Configura webhooks personalizados",
|
||||
"trial_feature_whitelabel": "Inquéritos totalmente personalizados",
|
||||
"trial_no_credit_card": "14 dias de teste, sem necessidade de cartão de crédito",
|
||||
"trial_payment_method_added_description": "Está tudo pronto! O teu plano Pro continuará automaticamente após o fim do período experimental.",
|
||||
"trial_title": "Obtém o Formbricks Pro gratuitamente!",
|
||||
"trial_title": "Experimenta as funcionalidades Pro gratuitamente!",
|
||||
"unlimited_responses": "Respostas Ilimitadas",
|
||||
"unlimited_workspaces": "Projetos ilimitados",
|
||||
"upgrade": "Atualizar",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "Funcionalidades da Empresa",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "Obtenha uma licença Enterprise para ter acesso a todas as funcionalidades.",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "Mantenha controlo total sobre a privacidade e segurança dos seus dados.",
|
||||
"license_instance_mismatch_description": "Esta licença está atualmente associada a uma instância Formbricks diferente. Se esta instalação foi reconstruída ou movida, pede ao suporte da Formbricks para desconectar a associação da instância anterior.",
|
||||
"license_invalid_description": "A chave de licença na sua variável de ambiente ENTERPRISE_LICENSE_KEY não é válida. Por favor, verifique se existem erros de digitação ou solicite uma nova chave.",
|
||||
"license_status": "Estado da licença",
|
||||
"license_status_active": "Ativa",
|
||||
"license_status_description": "Estado da sua licença empresarial.",
|
||||
"license_status_expired": "Expirada",
|
||||
"license_status_instance_mismatch": "Associada a Outra Instância",
|
||||
"license_status_invalid": "Licença inválida",
|
||||
"license_status_unreachable": "Inacessível",
|
||||
"license_unreachable_grace_period": "Não é possível contactar o servidor de licenças. As suas funcionalidades empresariais permanecem ativas durante um período de tolerância de 3 dias que termina a {gracePeriodEnd}.",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "Questões? Por favor entre em contacto com",
|
||||
"recheck_license": "Verificar licença novamente",
|
||||
"recheck_license_failed": "A verificação da licença falhou. O servidor de licenças pode estar inacessível.",
|
||||
"recheck_license_instance_mismatch": "Esta licença está associada a uma instância Formbricks diferente. Pede ao suporte da Formbricks para desconectar a associação anterior.",
|
||||
"recheck_license_invalid": "A chave de licença é inválida. Por favor, verifique a sua ENTERPRISE_LICENSE_KEY.",
|
||||
"recheck_license_success": "Verificação da licença bem-sucedida",
|
||||
"recheck_license_unreachable": "O servidor de licenças está inacessível. Por favor, tenta novamente mais tarde.",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "Titlu",
|
||||
"top_left": "Stânga Sus",
|
||||
"top_right": "Dreapta Sus",
|
||||
"trial_days_remaining": "{count} zile rămase în perioada ta de probă",
|
||||
"trial_expired": "Perioada ta de probă a expirat",
|
||||
"trial_one_day_remaining": "1 zi rămasă în perioada ta de probă",
|
||||
"try_again": "Încearcă din nou",
|
||||
"type": "Tip",
|
||||
"unknown_survey": "Chestionar necunoscut",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "Gestionați cheile API pentru a accesa API-urile de administrare Formbricks"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "Adaugă o metodă de plată",
|
||||
"cancelling": "Anulare în curs",
|
||||
"failed_to_start_trial": "Nu am putut porni perioada de probă. Te rugăm să încerci din nou.",
|
||||
"manage_subscription": "Gestionează abonamentul",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "Configurarea facturării nu a fost finalizată cu succes. Încearcă din nou pentru a activa abonamentul.",
|
||||
"subscription": "Abonament",
|
||||
"subscription_description": "Gestionează-ți abonamentul și monitorizează-ți consumul",
|
||||
"trial_alert_description": "Adaugă o metodă de plată pentru a păstra accesul la toate funcționalitățile.",
|
||||
"trial_already_used": "O perioadă de probă gratuită a fost deja utilizată pentru această adresă de email. Te rugăm să treci la un plan plătit în schimb.",
|
||||
"trial_feature_api_access": "Acces API",
|
||||
"trial_feature_attribute_segmentation": "Segmentare bazată pe atribute",
|
||||
"trial_feature_contact_segment_management": "Gestionare contacte și segmente",
|
||||
"trial_feature_email_followups": "Urmăriri prin email",
|
||||
"trial_feature_hide_branding": "Ascunde branding-ul Formbricks",
|
||||
"trial_feature_mobile_sdks": "SDK-uri iOS și Android",
|
||||
"trial_feature_respondent_identification": "Identificarea respondenților",
|
||||
"trial_feature_unlimited_seats": "Locuri nelimitate",
|
||||
"trial_feature_webhooks": "Webhook-uri personalizate",
|
||||
"trial_feature_api_access": "Obține acces complet la API",
|
||||
"trial_feature_collaboration": "Toate funcțiile de echipă și colaborare",
|
||||
"trial_feature_email_followups": "Configurează urmăriri prin email",
|
||||
"trial_feature_quotas": "Gestionează cotele",
|
||||
"trial_feature_webhooks": "Configurează webhook-uri personalizate",
|
||||
"trial_feature_whitelabel": "Chestionare complet personalizate (white-label)",
|
||||
"trial_no_credit_card": "14 zile de probă, fără card necesar",
|
||||
"trial_payment_method_added_description": "Totul este pregătit! Planul tău Pro va continua automat după ce se încheie perioada de probă.",
|
||||
"trial_title": "Obține Formbricks Pro gratuit!",
|
||||
"trial_title": "Încearcă funcțiile Pro gratuit!",
|
||||
"unlimited_responses": "Răspunsuri nelimitate",
|
||||
"unlimited_workspaces": "Workspaces nelimitate",
|
||||
"upgrade": "Actualizare",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "Funcții Enterprise",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "Obțineți o licență Enterprise pentru a avea acces la toate funcționalitățile.",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "Mențineți controlul complet asupra confidențialității și securității datelor dumneavoastră.",
|
||||
"license_instance_mismatch_description": "Această licență este în prezent asociată cu o altă instanță Formbricks. Dacă această instalare a fost reconstruită sau mutată, solicită echipei de suport Formbricks să deconecteze asocierea cu instanța anterioară.",
|
||||
"license_invalid_description": "Cheia de licență din variabila de mediu ENTERPRISE_LICENSE_KEY nu este validă. Te rugăm să verifici dacă există greșeli de scriere sau să soliciți o cheie nouă.",
|
||||
"license_status": "Stare licență",
|
||||
"license_status_active": "Activă",
|
||||
"license_status_description": "Starea licenței tale enterprise.",
|
||||
"license_status_expired": "Expirată",
|
||||
"license_status_instance_mismatch": "Asociată cu Altă Instanță",
|
||||
"license_status_invalid": "Licență invalidă",
|
||||
"license_status_unreachable": "Indisponibilă",
|
||||
"license_unreachable_grace_period": "Serverul de licențe nu poate fi contactat. Funcționalitățile enterprise rămân active timp de 3 zile, până la data de {gracePeriodEnd}.",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "Întrebări? Vă rugăm să trimiteți mesaj către",
|
||||
"recheck_license": "Verifică din nou licența",
|
||||
"recheck_license_failed": "Verificarea licenței a eșuat. Serverul de licențe poate fi indisponibil.",
|
||||
"recheck_license_instance_mismatch": "Această licență este asociată cu o altă instanță Formbricks. Solicită echipei de suport Formbricks să deconecteze asocierea anterioară.",
|
||||
"recheck_license_invalid": "Cheia de licență este invalidă. Te rugăm să verifici variabila ENTERPRISE_LICENSE_KEY.",
|
||||
"recheck_license_success": "Licența a fost verificată cu succes",
|
||||
"recheck_license_unreachable": "Serverul de licențe este indisponibil. Te rugăm să încerci din nou mai târziu.",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "Заголовок",
|
||||
"top_left": "Вверху слева",
|
||||
"top_right": "Вверху справа",
|
||||
"trial_days_remaining": "{count, plural, one {Остался # день пробного периода} few {Осталось # дня пробного периода} many {Осталось # дней пробного периода} other {Осталось # дней пробного периода}}",
|
||||
"trial_expired": "Пробный период истёк",
|
||||
"trial_one_day_remaining": "Остался 1 день пробного периода",
|
||||
"try_again": "Попробуйте ещё раз",
|
||||
"type": "Тип",
|
||||
"unknown_survey": "Неизвестный опрос",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "Управляйте API-ключами для доступа к управляющим API Formbricks"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "Добавить способ оплаты",
|
||||
"cancelling": "Отмена",
|
||||
"failed_to_start_trial": "Не удалось запустить пробный период. Попробуйте снова.",
|
||||
"manage_subscription": "Управление подпиской",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "Настройка оплаты не была завершена. Пожалуйста, повторите попытку, чтобы активировать вашу подписку.",
|
||||
"subscription": "Подписка",
|
||||
"subscription_description": "Управляйте своим тарифом и следите за использованием",
|
||||
"trial_alert_description": "Добавьте способ оплаты, чтобы сохранить доступ ко всем функциям.",
|
||||
"trial_already_used": "Бесплатный пробный период уже был использован для этого адреса электронной почты. Пожалуйста, перейдите на платный тариф.",
|
||||
"trial_feature_api_access": "Доступ к API",
|
||||
"trial_feature_attribute_segmentation": "Сегментация на основе атрибутов",
|
||||
"trial_feature_contact_segment_management": "Управление контактами и сегментами",
|
||||
"trial_feature_email_followups": "Email-уведомления",
|
||||
"trial_feature_hide_branding": "Скрыть брендинг Formbricks",
|
||||
"trial_feature_mobile_sdks": "iOS и Android SDK",
|
||||
"trial_feature_respondent_identification": "Идентификация респондентов",
|
||||
"trial_feature_unlimited_seats": "Неограниченное количество мест",
|
||||
"trial_feature_webhooks": "Пользовательские вебхуки",
|
||||
"trial_feature_api_access": "Получите полный доступ к API",
|
||||
"trial_feature_collaboration": "Все функции для работы в команде и совместной работы",
|
||||
"trial_feature_email_followups": "Настройте последующие письма",
|
||||
"trial_feature_quotas": "Управляйте квотами",
|
||||
"trial_feature_webhooks": "Настройте собственные вебхуки",
|
||||
"trial_feature_whitelabel": "Полностью персонализированные опросы без брендинга",
|
||||
"trial_no_credit_card": "14 дней пробного периода, кредитная карта не требуется",
|
||||
"trial_payment_method_added_description": "Всё готово! Твой тарифный план Pro продолжится автоматически после окончания пробного периода.",
|
||||
"trial_title": "Получите Formbricks Pro бесплатно!",
|
||||
"trial_title": "Попробуйте Pro функции бесплатно!",
|
||||
"unlimited_responses": "Неограниченное количество ответов",
|
||||
"unlimited_workspaces": "Неограниченное количество рабочих пространств",
|
||||
"upgrade": "Обновить",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "Функции для предприятий",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "Получите корпоративную лицензию для доступа ко всем функциям.",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "Полный контроль над конфиденциальностью и безопасностью ваших данных.",
|
||||
"license_instance_mismatch_description": "Эта лицензия в данный момент привязана к другому экземпляру Formbricks. Если эта установка была пересобрана или перемещена, обратитесь в службу поддержки Formbricks для отключения предыдущей привязки экземпляра.",
|
||||
"license_invalid_description": "Ключ лицензии в переменной окружения ENTERPRISE_LICENSE_KEY недействителен. Проверь, нет ли опечаток, или запроси новый ключ.",
|
||||
"license_status": "Статус лицензии",
|
||||
"license_status_active": "Активна",
|
||||
"license_status_description": "Статус вашей корпоративной лицензии.",
|
||||
"license_status_expired": "Срок действия истёк",
|
||||
"license_status_instance_mismatch": "Привязана к другому экземпляру",
|
||||
"license_status_invalid": "Недействительная лицензия",
|
||||
"license_status_unreachable": "Недоступна",
|
||||
"license_unreachable_grace_period": "Не удаётся подключиться к серверу лицензий. Корпоративные функции останутся активными в течение 3-дневного льготного периода, который закончится {gracePeriodEnd}.",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "Вопросы? Свяжитесь с",
|
||||
"recheck_license": "Проверить лицензию ещё раз",
|
||||
"recheck_license_failed": "Не удалось проверить лицензию. Сервер лицензий может быть недоступен.",
|
||||
"recheck_license_instance_mismatch": "Эта лицензия привязана к другому экземпляру Formbricks. Обратитесь в службу поддержки Formbricks для отключения предыдущей привязки.",
|
||||
"recheck_license_invalid": "Ключ лицензии недействителен. Пожалуйста, проверь свою переменную ENTERPRISE_LICENSE_KEY.",
|
||||
"recheck_license_success": "Проверка лицензии прошла успешно",
|
||||
"recheck_license_unreachable": "Сервер лицензий недоступен. Пожалуйста, попробуй позже.",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "Titel",
|
||||
"top_left": "Övre vänster",
|
||||
"top_right": "Övre höger",
|
||||
"trial_days_remaining": "{count} dagar kvar av din provperiod",
|
||||
"trial_expired": "Din provperiod har gått ut",
|
||||
"trial_one_day_remaining": "1 dag kvar av din provperiod",
|
||||
"try_again": "Försök igen",
|
||||
"type": "Typ",
|
||||
"unknown_survey": "Okänd enkät",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "Hantera API-nycklar för åtkomst till Formbricks hanterings-API:er"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "Lägg till betalningsmetod",
|
||||
"cancelling": "Avbryter",
|
||||
"failed_to_start_trial": "Kunde inte starta provperioden. Försök igen.",
|
||||
"manage_subscription": "Hantera prenumeration",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "Faktureringsinställningen slutfördes inte riktigt. Försök igen för att aktivera ditt abonnemang.",
|
||||
"subscription": "Abonnemang",
|
||||
"subscription_description": "Hantera din abonnemangsplan och följ din användning",
|
||||
"trial_alert_description": "Lägg till en betalningsmetod för att behålla tillgång till alla funktioner.",
|
||||
"trial_already_used": "En gratis provperiod har redan använts för denna e-postadress. Uppgradera till en betald plan istället.",
|
||||
"trial_feature_api_access": "API-åtkomst",
|
||||
"trial_feature_attribute_segmentation": "Attributbaserad segmentering",
|
||||
"trial_feature_contact_segment_management": "Kontakt- och segmenthantering",
|
||||
"trial_feature_email_followups": "E-postuppföljningar",
|
||||
"trial_feature_hide_branding": "Dölj Formbricks-branding",
|
||||
"trial_feature_mobile_sdks": "iOS- och Android-SDK:er",
|
||||
"trial_feature_respondent_identification": "Respondentidentifiering",
|
||||
"trial_feature_unlimited_seats": "Obegränsade platser",
|
||||
"trial_feature_webhooks": "Anpassade webhooks",
|
||||
"trial_feature_api_access": "Få full API-åtkomst",
|
||||
"trial_feature_collaboration": "Alla team- och samarbetsfunktioner",
|
||||
"trial_feature_email_followups": "Konfigurera uppföljningsmejl",
|
||||
"trial_feature_quotas": "Hantera kvoter",
|
||||
"trial_feature_webhooks": "Konfigurera anpassade webhooks",
|
||||
"trial_feature_whitelabel": "Helt white-label-anpassade enkäter",
|
||||
"trial_no_credit_card": "14 dagars provperiod, inget kreditkort krävs",
|
||||
"trial_payment_method_added_description": "Du är redo! Din Pro-plan kommer att fortsätta automatiskt efter att provperioden slutar.",
|
||||
"trial_title": "Få Formbricks Pro gratis!",
|
||||
"trial_title": "Testa Pro-funktioner gratis!",
|
||||
"unlimited_responses": "Obegränsade svar",
|
||||
"unlimited_workspaces": "Obegränsat antal arbetsytor",
|
||||
"upgrade": "Uppgradera",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "Enterprise-funktioner",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "Skaffa en Enterprise-licens för att få tillgång till alla funktioner.",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "Behåll full kontroll över din datasekretess och säkerhet.",
|
||||
"license_instance_mismatch_description": "Den här licensen är för närvarande kopplad till en annan Formbricks-instans. Om den här installationen har återuppbyggts eller flyttats, be Formbricks support att koppla bort den tidigare instansbindningen.",
|
||||
"license_invalid_description": "Licensnyckeln i din ENTERPRISE_LICENSE_KEY-miljövariabel är ogiltig. Kontrollera om det finns stavfel eller begär en ny nyckel.",
|
||||
"license_status": "Licensstatus",
|
||||
"license_status_active": "Aktiv",
|
||||
"license_status_description": "Status för din företagslicens.",
|
||||
"license_status_expired": "Utgången",
|
||||
"license_status_instance_mismatch": "Kopplad till en annan instans",
|
||||
"license_status_invalid": "Ogiltig licens",
|
||||
"license_status_unreachable": "Otillgänglig",
|
||||
"license_unreachable_grace_period": "Licensservern kan inte nås. Dina enterprise-funktioner är aktiva under en 3-dagars respitperiod som slutar {gracePeriodEnd}.",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "Frågor? Kontakta",
|
||||
"recheck_license": "Kontrollera licensen igen",
|
||||
"recheck_license_failed": "Licenskontrollen misslyckades. Licensservern kan vara otillgänglig.",
|
||||
"recheck_license_instance_mismatch": "Den här licensen är kopplad till en annan Formbricks-instans. Be Formbricks support att koppla bort den tidigare bindningen.",
|
||||
"recheck_license_invalid": "Licensnyckeln är ogiltig. Kontrollera din ENTERPRISE_LICENSE_KEY.",
|
||||
"recheck_license_success": "Licenskontrollen lyckades",
|
||||
"recheck_license_unreachable": "Licensservern är otillgänglig. Försök igen senare.",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "标题",
|
||||
"top_left": "左上",
|
||||
"top_right": "右上",
|
||||
"trial_days_remaining": "试用期还剩 {count} 天",
|
||||
"trial_expired": "您的试用期已过期",
|
||||
"trial_one_day_remaining": "试用期还剩 1 天",
|
||||
"try_again": "再试一次",
|
||||
"type": "类型",
|
||||
"unknown_survey": "未知调查",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "管理 API 密钥 以 访问 Formbricks 管理 API"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "添加支付方式",
|
||||
"cancelling": "正在取消",
|
||||
"failed_to_start_trial": "试用启动失败,请重试。",
|
||||
"manage_subscription": "管理订阅",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "账单设置未成功完成。请重试以激活订阅。",
|
||||
"subscription": "订阅",
|
||||
"subscription_description": "管理你的订阅套餐并监控用量",
|
||||
"trial_alert_description": "添加支付方式以继续使用所有功能。",
|
||||
"trial_already_used": "该邮箱地址已使用过免费试用。请升级至付费计划。",
|
||||
"trial_feature_api_access": "API 访问",
|
||||
"trial_feature_attribute_segmentation": "基于属性的细分",
|
||||
"trial_feature_contact_segment_management": "联系人和细分管理",
|
||||
"trial_feature_email_followups": "电子邮件跟进",
|
||||
"trial_feature_hide_branding": "隐藏 Formbricks 品牌标识",
|
||||
"trial_feature_mobile_sdks": "iOS 和 Android SDK",
|
||||
"trial_feature_respondent_identification": "受访者识别",
|
||||
"trial_feature_unlimited_seats": "无限席位",
|
||||
"trial_feature_webhooks": "自定义 Webhook",
|
||||
"trial_feature_api_access": "获取完整 API 访问权限",
|
||||
"trial_feature_collaboration": "所有团队和协作功能",
|
||||
"trial_feature_email_followups": "设置邮件跟进",
|
||||
"trial_feature_quotas": "管理配额",
|
||||
"trial_feature_webhooks": "设置自定义 Webhook",
|
||||
"trial_feature_whitelabel": "完全白标化的问卷调查",
|
||||
"trial_no_credit_card": "14 天试用,无需信用卡",
|
||||
"trial_payment_method_added_description": "一切就绪!试用期结束后,您的专业版计划将自动继续。",
|
||||
"trial_title": "免费获取 Formbricks Pro!",
|
||||
"trial_title": "免费试用专业版功能!",
|
||||
"unlimited_responses": "无限反馈",
|
||||
"unlimited_workspaces": "无限工作区",
|
||||
"upgrade": "升级",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "企业 功能",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "获取 企业 许可证 来 访问 所有 功能。",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "保持 对 您 的 数据 隐私 和 安全 的 完全 控制。",
|
||||
"license_instance_mismatch_description": "此许可证目前绑定到另一个 Formbricks 实例。如果此安装已重建或迁移,请联系 Formbricks 支持团队解除先前的实例绑定。",
|
||||
"license_invalid_description": "你在 ENTERPRISE_LICENSE_KEY 环境变量中填写的许可证密钥无效。请检查是否有拼写错误,或者申请一个新的密钥。",
|
||||
"license_status": "许可证状态",
|
||||
"license_status_active": "已激活",
|
||||
"license_status_description": "你的企业许可证状态。",
|
||||
"license_status_expired": "已过期",
|
||||
"license_status_instance_mismatch": "已绑定到其他实例",
|
||||
"license_status_invalid": "许可证无效",
|
||||
"license_status_unreachable": "无法访问",
|
||||
"license_unreachable_grace_period": "无法连接到许可证服务器。在为期 3 天的宽限期内,你的企业功能仍然可用,宽限期将于 {gracePeriodEnd} 结束。",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "问题 ? 请 联系",
|
||||
"recheck_license": "重新检查许可证",
|
||||
"recheck_license_failed": "许可证检查失败。许可证服务器可能无法访问。",
|
||||
"recheck_license_instance_mismatch": "此许可证已绑定到另一个 Formbricks 实例。请联系 Formbricks 支持团队解除先前的绑定。",
|
||||
"recheck_license_invalid": "许可证密钥无效。请确认你的 ENTERPRISE_LICENSE_KEY。",
|
||||
"recheck_license_success": "许可证检查成功",
|
||||
"recheck_license_unreachable": "许可证服务器无法访问,请稍后再试。",
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
"title": "標題",
|
||||
"top_left": "左上",
|
||||
"top_right": "右上",
|
||||
"trial_days_remaining": "試用期剩餘 {count} 天",
|
||||
"trial_expired": "您的試用期已結束",
|
||||
"trial_one_day_remaining": "試用期剩餘 1 天",
|
||||
"try_again": "再試一次",
|
||||
"type": "類型",
|
||||
"unknown_survey": "未知問卷",
|
||||
@@ -971,7 +968,6 @@
|
||||
"api_keys_description": "管理 API 金鑰以存取 Formbricks 管理 API"
|
||||
},
|
||||
"billing": {
|
||||
"add_payment_method": "新增付款方式",
|
||||
"cancelling": "正在取消",
|
||||
"failed_to_start_trial": "無法開始試用。請再試一次。",
|
||||
"manage_subscription": "管理訂閱",
|
||||
@@ -996,20 +992,15 @@
|
||||
"stripe_setup_incomplete_description": "帳單設定未成功完成,請重新操作以啟用訂閱。",
|
||||
"subscription": "訂閱",
|
||||
"subscription_description": "管理您的訂閱方案並監控用量",
|
||||
"trial_alert_description": "新增付款方式以繼續使用所有功能。",
|
||||
"trial_already_used": "此電子郵件地址已使用過免費試用。請改為升級至付費方案。",
|
||||
"trial_feature_api_access": "API 存取",
|
||||
"trial_feature_attribute_segmentation": "基於屬性的分群",
|
||||
"trial_feature_contact_segment_management": "聯絡人與分群管理",
|
||||
"trial_feature_email_followups": "電子郵件追蹤",
|
||||
"trial_feature_hide_branding": "隱藏 Formbricks 品牌標識",
|
||||
"trial_feature_mobile_sdks": "iOS 與 Android SDK",
|
||||
"trial_feature_respondent_identification": "受訪者識別",
|
||||
"trial_feature_unlimited_seats": "無限座位數",
|
||||
"trial_feature_webhooks": "自訂 Webhook",
|
||||
"trial_feature_api_access": "獲得完整 API 存取權限",
|
||||
"trial_feature_collaboration": "所有團隊與協作功能",
|
||||
"trial_feature_email_followups": "設定電子郵件追蹤",
|
||||
"trial_feature_quotas": "管理配額",
|
||||
"trial_feature_webhooks": "設定自訂 Webhook",
|
||||
"trial_feature_whitelabel": "完全白標問卷調查",
|
||||
"trial_no_credit_card": "14 天試用,無需信用卡",
|
||||
"trial_payment_method_added_description": "一切就緒!試用期結束後,您的 Pro 方案將自動繼續。",
|
||||
"trial_title": "免費獲得 Formbricks Pro!",
|
||||
"trial_title": "免費試用 Pro 功能!",
|
||||
"unlimited_responses": "無限回應",
|
||||
"unlimited_workspaces": "無限工作區",
|
||||
"upgrade": "升級",
|
||||
@@ -1040,13 +1031,11 @@
|
||||
"enterprise_features": "企業版功能",
|
||||
"get_an_enterprise_license_to_get_access_to_all_features": "取得企業授權以存取所有功能。",
|
||||
"keep_full_control_over_your_data_privacy_and_security": "完全掌控您的資料隱私權和安全性。",
|
||||
"license_instance_mismatch_description": "此授權目前綁定至不同的 Formbricks 執行個體。如果此安裝已重建或移動,請聯繫 Formbricks 支援以解除先前執行個體的綁定。",
|
||||
"license_invalid_description": "你在 ENTERPRISE_LICENSE_KEY 環境變數中填寫的授權金鑰無效。請檢查是否有輸入錯誤,或申請新的金鑰。",
|
||||
"license_status": "授權狀態",
|
||||
"license_status_active": "有效",
|
||||
"license_status_description": "你的企業授權狀態。",
|
||||
"license_status_expired": "已過期",
|
||||
"license_status_instance_mismatch": "已綁定至其他執行個體",
|
||||
"license_status_invalid": "授權無效",
|
||||
"license_status_unreachable": "無法連線",
|
||||
"license_unreachable_grace_period": "無法連線至授權伺服器。在 3 天的寬限期內,你的企業功能仍可使用,寬限期將於 {gracePeriodEnd} 結束。",
|
||||
@@ -1057,7 +1046,6 @@
|
||||
"questions_please_reach_out_to": "有任何問題?請聯絡",
|
||||
"recheck_license": "重新檢查授權",
|
||||
"recheck_license_failed": "授權檢查失敗。授權伺服器可能無法連線。",
|
||||
"recheck_license_instance_mismatch": "此授權已綁定至不同的 Formbricks 執行個體。請聯繫 Formbricks 支援以解除先前的綁定。",
|
||||
"recheck_license_invalid": "授權金鑰無效。請確認你的 ENTERPRISE_LICENSE_KEY。",
|
||||
"recheck_license_success": "授權檢查成功",
|
||||
"recheck_license_unreachable": "授權伺服器無法連線,請稍後再試。",
|
||||
|
||||
-13
@@ -1,4 +1,3 @@
|
||||
import { getOrganizationIdFromSurveyId } from "@/lib/utils/helper";
|
||||
import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client";
|
||||
import { responses } from "@/modules/api/v2/lib/response";
|
||||
import { handleApiError } from "@/modules/api/v2/lib/utils";
|
||||
@@ -14,7 +13,6 @@ import {
|
||||
import { calculateExpirationDate } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/lib/utils";
|
||||
import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error";
|
||||
import { getContactSurveyLink } from "@/modules/ee/contacts/lib/contact-survey-link";
|
||||
import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils";
|
||||
import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils";
|
||||
|
||||
export const GET = async (request: Request, props: { params: Promise<TContactLinkParams> }) =>
|
||||
@@ -49,17 +47,6 @@ export const GET = async (request: Request, props: { params: Promise<TContactLin
|
||||
});
|
||||
}
|
||||
|
||||
const organizationId = await getOrganizationIdFromSurveyId(params.surveyId);
|
||||
const isContactsEnabled = await getIsContactsEnabled(organizationId);
|
||||
if (!isContactsEnabled) {
|
||||
return handleApiError(request, {
|
||||
type: "forbidden",
|
||||
details: [
|
||||
{ field: "contacts", issue: "Contacts are only enabled for Enterprise Edition, please upgrade." },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
const surveyResult = await getSurvey(params.surveyId);
|
||||
|
||||
if (!surveyResult.ok) {
|
||||
|
||||
@@ -125,7 +125,7 @@ describe("Auth Utils", () => {
|
||||
expect(hash1).not.toBe(hash2);
|
||||
expect(await verifyPassword(password, hash1)).toBe(true);
|
||||
expect(await verifyPassword(password, hash2)).toBe(true);
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
test("should hash complex passwords correctly", async () => {
|
||||
const complexPassword = "MyC0mpl3x!P@ssw0rd#2024$%^&*()";
|
||||
|
||||
@@ -10,10 +10,9 @@ import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-clie
|
||||
import { getOrganizationIdFromEnvironmentId } from "@/lib/utils/helper";
|
||||
import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler";
|
||||
import { createCustomerPortalSession } from "@/modules/ee/billing/api/lib/create-customer-portal-session";
|
||||
import { createSetupCheckoutSession } from "@/modules/ee/billing/api/lib/create-setup-checkout-session";
|
||||
import { isSubscriptionCancelled } from "@/modules/ee/billing/api/lib/is-subscription-cancelled";
|
||||
import {
|
||||
createProTrialSubscription,
|
||||
createScaleTrialSubscription,
|
||||
ensureCloudStripeSetupForOrganization,
|
||||
reconcileCloudStripeSubscriptionsForOrganization,
|
||||
syncOrganizationBillingFromStripe,
|
||||
@@ -146,59 +145,11 @@ export const retryStripeSetupAction = authenticatedActionClient
|
||||
return { success: true };
|
||||
});
|
||||
|
||||
const ZCreateTrialPaymentCheckoutAction = z.object({
|
||||
environmentId: ZId,
|
||||
});
|
||||
|
||||
export const createTrialPaymentCheckoutAction = authenticatedActionClient
|
||||
.inputSchema(ZCreateTrialPaymentCheckoutAction)
|
||||
.action(
|
||||
withAuditLogging("subscriptionAccessed", "organization", async ({ ctx, parsedInput }) => {
|
||||
const organizationId = await getOrganizationIdFromEnvironmentId(parsedInput.environmentId);
|
||||
await checkAuthorizationUpdated({
|
||||
userId: ctx.user.id,
|
||||
organizationId,
|
||||
access: [
|
||||
{
|
||||
type: "organization",
|
||||
roles: ["owner", "manager", "billing"],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const organization = await getOrganization(organizationId);
|
||||
if (!organization) {
|
||||
throw new ResourceNotFoundError("organization", organizationId);
|
||||
}
|
||||
|
||||
if (!organization.billing.stripeCustomerId) {
|
||||
throw new AuthorizationError("You do not have an associated Stripe CustomerId");
|
||||
}
|
||||
|
||||
const subscriptionId = organization.billing.stripe?.subscriptionId;
|
||||
if (!subscriptionId) {
|
||||
throw new ResourceNotFoundError("subscription", organizationId);
|
||||
}
|
||||
|
||||
ctx.auditLoggingCtx.organizationId = organizationId;
|
||||
const returnUrl = `${WEBAPP_URL}/environments/${parsedInput.environmentId}/settings/billing`;
|
||||
const checkoutUrl = await createSetupCheckoutSession(
|
||||
organization.billing.stripeCustomerId,
|
||||
subscriptionId,
|
||||
returnUrl,
|
||||
organizationId
|
||||
);
|
||||
|
||||
ctx.auditLoggingCtx.newObject = { checkoutUrl };
|
||||
return checkoutUrl;
|
||||
})
|
||||
);
|
||||
|
||||
const ZStartScaleTrialAction = z.object({
|
||||
organizationId: ZId,
|
||||
});
|
||||
|
||||
export const startProTrialAction = authenticatedActionClient
|
||||
export const startScaleTrialAction = authenticatedActionClient
|
||||
.inputSchema(ZStartScaleTrialAction)
|
||||
.action(async ({ ctx, parsedInput }) => {
|
||||
await checkAuthorizationUpdated({
|
||||
@@ -221,8 +172,8 @@ export const startProTrialAction = authenticatedActionClient
|
||||
throw new ResourceNotFoundError("OrganizationBilling", parsedInput.organizationId);
|
||||
}
|
||||
|
||||
await createProTrialSubscription(parsedInput.organizationId, organization.billing.stripeCustomerId);
|
||||
await reconcileCloudStripeSubscriptionsForOrganization(parsedInput.organizationId, "pro-trial");
|
||||
await createScaleTrialSubscription(parsedInput.organizationId, organization.billing.stripeCustomerId);
|
||||
await reconcileCloudStripeSubscriptionsForOrganization(parsedInput.organizationId, "scale-trial");
|
||||
await syncOrganizationBillingFromStripe(parsedInput.organizationId);
|
||||
return { success: true };
|
||||
});
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
import Stripe from "stripe";
|
||||
import { STRIPE_API_VERSION } from "@/lib/constants";
|
||||
import { env } from "@/lib/env";
|
||||
|
||||
/**
|
||||
* Creates a Stripe Checkout Session in `setup` mode so the customer can enter
|
||||
* a payment method, billing address, and tax ID — without creating a new subscription.
|
||||
* After completion the webhook handler attaches the payment method to the existing
|
||||
* trial subscription.
|
||||
*/
|
||||
export const createSetupCheckoutSession = async (
|
||||
stripeCustomerId: string,
|
||||
subscriptionId: string,
|
||||
returnUrl: string,
|
||||
organizationId: string
|
||||
): Promise<string> => {
|
||||
if (!env.STRIPE_SECRET_KEY) throw new Error("Stripe is not enabled; STRIPE_SECRET_KEY is not set.");
|
||||
|
||||
const stripe = new Stripe(env.STRIPE_SECRET_KEY, {
|
||||
apiVersion: STRIPE_API_VERSION as Stripe.LatestApiVersion,
|
||||
});
|
||||
|
||||
const subscription = await stripe.subscriptions.retrieve(subscriptionId);
|
||||
const currency = subscription.currency ?? "usd";
|
||||
|
||||
const session = await stripe.checkout.sessions.create({
|
||||
mode: "setup",
|
||||
customer: stripeCustomerId,
|
||||
currency,
|
||||
billing_address_collection: "required",
|
||||
tax_id_collection: {
|
||||
enabled: true,
|
||||
required: "if_supported",
|
||||
},
|
||||
customer_update: {
|
||||
address: "auto",
|
||||
name: "auto",
|
||||
},
|
||||
success_url: `${returnUrl}?checkout_success=1`,
|
||||
cancel_url: returnUrl,
|
||||
metadata: {
|
||||
organizationId,
|
||||
subscriptionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!session.url) {
|
||||
throw new Error("Stripe did not return a Checkout Session URL");
|
||||
}
|
||||
|
||||
return session.url;
|
||||
};
|
||||
@@ -16,47 +16,6 @@ const relevantEvents = new Set([
|
||||
"entitlements.active_entitlement_summary.updated",
|
||||
]);
|
||||
|
||||
/**
|
||||
* When a setup-mode Checkout Session completes, the customer has just provided a
|
||||
* payment method + billing address. We attach that payment method as the default
|
||||
* on the customer (for future invoices) and on the trial subscription so Stripe
|
||||
* can charge it when the trial ends.
|
||||
*/
|
||||
const handleSetupCheckoutCompleted = async (
|
||||
session: Stripe.Checkout.Session,
|
||||
stripe: Stripe
|
||||
): Promise<void> => {
|
||||
if (session.mode !== "setup" || !session.setup_intent) return;
|
||||
|
||||
const setupIntentId =
|
||||
typeof session.setup_intent === "string" ? session.setup_intent : session.setup_intent.id;
|
||||
|
||||
const setupIntent = await stripe.setupIntents.retrieve(setupIntentId);
|
||||
const paymentMethodId =
|
||||
typeof setupIntent.payment_method === "string"
|
||||
? setupIntent.payment_method
|
||||
: setupIntent.payment_method?.id;
|
||||
|
||||
if (!paymentMethodId) {
|
||||
logger.warn({ sessionId: session.id }, "Setup checkout completed but no payment method found");
|
||||
return;
|
||||
}
|
||||
|
||||
const customerId = typeof session.customer === "string" ? session.customer : session.customer?.id;
|
||||
if (customerId) {
|
||||
await stripe.customers.update(customerId, {
|
||||
invoice_settings: { default_payment_method: paymentMethodId },
|
||||
});
|
||||
}
|
||||
|
||||
const subscriptionId = session.metadata?.subscriptionId;
|
||||
if (subscriptionId) {
|
||||
await stripe.subscriptions.update(subscriptionId, {
|
||||
default_payment_method: paymentMethodId,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const getMetadataOrganizationId = (eventObject: Stripe.Event.Data.Object): string | null => {
|
||||
if (!("metadata" in eventObject) || !eventObject.metadata) {
|
||||
return null;
|
||||
@@ -142,10 +101,6 @@ export const webhookHandler = async (requestBody: string, stripeSignature: strin
|
||||
}
|
||||
|
||||
try {
|
||||
if (event.type === "checkout.session.completed") {
|
||||
await handleSetupCheckoutCompleted(event.data.object, stripe);
|
||||
}
|
||||
|
||||
await reconcileCloudStripeSubscriptionsForOrganization(organizationId, event.id);
|
||||
await syncOrganizationBillingFromStripe(organizationId, {
|
||||
id: event.id,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useRouter } from "next/navigation";
|
||||
import Script from "next/script";
|
||||
import { createElement, useEffect, useMemo, useState } from "react";
|
||||
import { toast } from "react-hot-toast";
|
||||
@@ -12,12 +12,10 @@ import { Badge } from "@/modules/ui/components/badge";
|
||||
import { Button } from "@/modules/ui/components/button";
|
||||
import {
|
||||
createPricingTableCustomerSessionAction,
|
||||
createTrialPaymentCheckoutAction,
|
||||
isSubscriptionCancelledAction,
|
||||
manageSubscriptionAction,
|
||||
retryStripeSetupAction,
|
||||
} from "../actions";
|
||||
import { TrialAlert } from "./trial-alert";
|
||||
import { UsageCard } from "./usage-card";
|
||||
|
||||
const STRIPE_SUPPORTED_LOCALES = new Set([
|
||||
@@ -94,7 +92,6 @@ interface PricingTableProps {
|
||||
stripePublishableKey: string | null;
|
||||
stripePricingTableId: string | null;
|
||||
isStripeSetupIncomplete: boolean;
|
||||
trialDaysRemaining: number | null;
|
||||
}
|
||||
|
||||
const getCurrentCloudPlanLabel = (
|
||||
@@ -121,11 +118,9 @@ export const PricingTable = ({
|
||||
stripePublishableKey,
|
||||
stripePricingTableId,
|
||||
isStripeSetupIncomplete,
|
||||
trialDaysRemaining,
|
||||
}: PricingTableProps) => {
|
||||
const { t, i18n } = useTranslation();
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const [isRetryingStripeSetup, setIsRetryingStripeSetup] = useState(false);
|
||||
const [cancellingOn, setCancellingOn] = useState<Date | null>(null);
|
||||
const [pricingTableCustomerSessionClientSecret, setPricingTableCustomerSessionClientSecret] = useState<
|
||||
@@ -133,9 +128,8 @@ export const PricingTable = ({
|
||||
>(null);
|
||||
|
||||
const isUpgradeablePlan = currentCloudPlan === "hobby" || currentCloudPlan === "unknown";
|
||||
const isTrialing = currentSubscriptionStatus === "trialing";
|
||||
const showPricingTable =
|
||||
hasBillingRights && isUpgradeablePlan && !isTrialing && !!stripePublishableKey && !!stripePricingTableId;
|
||||
hasBillingRights && isUpgradeablePlan && !!stripePublishableKey && !!stripePricingTableId;
|
||||
const canManageSubscription =
|
||||
hasBillingRights && !isUpgradeablePlan && !!organization.billing.stripeCustomerId;
|
||||
const stripeLocaleOverride = useMemo(
|
||||
@@ -167,13 +161,6 @@ export const PricingTable = ({
|
||||
stripePublishableKey,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (searchParams.get("checkout_success")) {
|
||||
const timer = setTimeout(() => router.refresh(), 2500);
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
}, [searchParams, router]);
|
||||
|
||||
useEffect(() => {
|
||||
const checkSubscriptionStatus = async () => {
|
||||
if (!hasBillingRights || !canManageSubscription) {
|
||||
@@ -226,20 +213,6 @@ export const PricingTable = ({
|
||||
}
|
||||
};
|
||||
|
||||
const openTrialPaymentCheckout = async () => {
|
||||
try {
|
||||
const response = await createTrialPaymentCheckoutAction({ environmentId });
|
||||
if (response?.data && typeof response.data === "string") {
|
||||
globalThis.location.href = response.data;
|
||||
} else {
|
||||
toast.error(t("common.something_went_wrong_please_try_again"));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to create checkout session:", error);
|
||||
toast.error(t("common.something_went_wrong_please_try_again"));
|
||||
}
|
||||
};
|
||||
|
||||
const retryStripeSetup = async () => {
|
||||
setIsRetryingStripeSetup(true);
|
||||
try {
|
||||
@@ -273,25 +246,6 @@ export const PricingTable = ({
|
||||
return (
|
||||
<main>
|
||||
<div className="flex max-w-4xl flex-col gap-4">
|
||||
{trialDaysRemaining !== null &&
|
||||
(organization.billing.stripe?.hasPaymentMethod ? (
|
||||
<TrialAlert trialDaysRemaining={trialDaysRemaining} hasPaymentMethod>
|
||||
<AlertDescription>
|
||||
{t("environments.settings.billing.trial_payment_method_added_description")}
|
||||
</AlertDescription>
|
||||
</TrialAlert>
|
||||
) : (
|
||||
<TrialAlert trialDaysRemaining={trialDaysRemaining}>
|
||||
<AlertDescription>
|
||||
{t("environments.settings.billing.trial_alert_description")}
|
||||
</AlertDescription>
|
||||
{hasBillingRights && (
|
||||
<AlertButton onClick={() => void openTrialPaymentCheckout()}>
|
||||
{t("environments.settings.billing.add_payment_method")}
|
||||
</AlertButton>
|
||||
)}
|
||||
</TrialAlert>
|
||||
))}
|
||||
{isStripeSetupIncomplete && hasBillingRights && (
|
||||
<Alert variant="warning">
|
||||
<AlertTitle>{t("environments.settings.billing.stripe_setup_incomplete")}</AlertTitle>
|
||||
@@ -307,8 +261,7 @@ export const PricingTable = ({
|
||||
title={t("environments.settings.billing.subscription")}
|
||||
description={t("environments.settings.billing.subscription_description")}
|
||||
buttonInfo={
|
||||
(canManageSubscription && currentSubscriptionStatus !== "trialing") ||
|
||||
(hasBillingRights && !!organization.billing.stripe?.hasPaymentMethod)
|
||||
canManageSubscription
|
||||
? {
|
||||
text: t("environments.settings.billing.manage_subscription"),
|
||||
onClick: () => void openCustomerPortal(),
|
||||
@@ -371,7 +324,7 @@ export const PricingTable = ({
|
||||
</div>
|
||||
</SettingsCard>
|
||||
|
||||
{currentCloudPlan === "pro" && !isTrialing && (
|
||||
{currentCloudPlan === "pro" && (
|
||||
<div className="w-full max-w-4xl rounded-xl border border-slate-200 bg-slate-800 p-6 shadow-sm">
|
||||
<div className="flex items-center justify-between gap-6">
|
||||
<div className="flex flex-col gap-1.5">
|
||||
|
||||
@@ -11,7 +11,7 @@ import ethereumLogo from "@/images/customer-logos/ethereum-logo.png";
|
||||
import flixbusLogo from "@/images/customer-logos/flixbus-white.svg";
|
||||
import githubLogo from "@/images/customer-logos/github-logo.png";
|
||||
import siemensLogo from "@/images/customer-logos/siemens.png";
|
||||
import { startProTrialAction } from "@/modules/ee/billing/actions";
|
||||
import { startScaleTrialAction } from "@/modules/ee/billing/actions";
|
||||
import { Button } from "@/modules/ui/components/button";
|
||||
|
||||
interface SelectPlanCardProps {
|
||||
@@ -34,21 +34,18 @@ export const SelectPlanCard = ({ nextUrl, organizationId }: SelectPlanCardProps)
|
||||
const { t } = useTranslation();
|
||||
|
||||
const TRIAL_FEATURE_KEYS = [
|
||||
t("environments.settings.billing.trial_feature_unlimited_seats"),
|
||||
t("environments.settings.billing.trial_feature_hide_branding"),
|
||||
t("environments.settings.billing.trial_feature_respondent_identification"),
|
||||
t("environments.settings.billing.trial_feature_contact_segment_management"),
|
||||
t("environments.settings.billing.trial_feature_attribute_segmentation"),
|
||||
t("environments.settings.billing.trial_feature_mobile_sdks"),
|
||||
t("environments.settings.billing.trial_feature_email_followups"),
|
||||
t("environments.settings.billing.trial_feature_whitelabel"),
|
||||
t("environments.settings.billing.trial_feature_collaboration"),
|
||||
t("environments.settings.billing.trial_feature_webhooks"),
|
||||
t("environments.settings.billing.trial_feature_api_access"),
|
||||
t("environments.settings.billing.trial_feature_email_followups"),
|
||||
t("environments.settings.billing.trial_feature_quotas"),
|
||||
] as const;
|
||||
|
||||
const handleStartTrial = async () => {
|
||||
setIsStartingTrial(true);
|
||||
try {
|
||||
const result = await startProTrialAction({ organizationId });
|
||||
const result = await startScaleTrialAction({ organizationId });
|
||||
if (result?.data) {
|
||||
router.push(nextUrl);
|
||||
} else if (result?.serverError === "trial_already_used") {
|
||||
@@ -99,7 +96,7 @@ export const SelectPlanCard = ({ nextUrl, organizationId }: SelectPlanCardProps)
|
||||
className="mt-4 w-full"
|
||||
loading={isStartingTrial}
|
||||
disabled={isStartingTrial}>
|
||||
{t("common.upgrade_plan")}
|
||||
{t("common.start_free_trial")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Alert, AlertTitle } from "@/modules/ui/components/alert";
|
||||
|
||||
type TrialAlertVariant = "error" | "warning" | "info" | "success";
|
||||
|
||||
const getTrialVariant = (daysRemaining: number): TrialAlertVariant => {
|
||||
if (daysRemaining <= 3) return "error";
|
||||
if (daysRemaining <= 7) return "warning";
|
||||
return "info";
|
||||
};
|
||||
|
||||
interface TrialAlertProps {
|
||||
trialDaysRemaining: number;
|
||||
size?: "small";
|
||||
hasPaymentMethod?: boolean;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export const TrialAlert = ({
|
||||
trialDaysRemaining,
|
||||
size,
|
||||
hasPaymentMethod = false,
|
||||
children,
|
||||
}: TrialAlertProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const title = useMemo(() => {
|
||||
if (trialDaysRemaining <= 0) return t("common.trial_expired");
|
||||
if (trialDaysRemaining === 1) return t("common.trial_one_day_remaining");
|
||||
return t("common.trial_days_remaining", { count: trialDaysRemaining });
|
||||
}, [trialDaysRemaining, t]);
|
||||
|
||||
const variant = hasPaymentMethod ? "success" : getTrialVariant(trialDaysRemaining);
|
||||
|
||||
return (
|
||||
<Alert variant={variant} size={size}>
|
||||
<AlertTitle>{title}</AlertTitle>
|
||||
{children}
|
||||
</Alert>
|
||||
);
|
||||
};
|
||||
@@ -30,7 +30,6 @@ describe("cloud-billing-display", () => {
|
||||
organizationId: "org_1",
|
||||
currentCloudPlan: "pro",
|
||||
currentSubscriptionStatus: null,
|
||||
trialDaysRemaining: null,
|
||||
usageCycleStart: new Date("2026-01-15T00:00:00.000Z"),
|
||||
usageCycleEnd: new Date("2026-02-15T00:00:00.000Z"),
|
||||
billing,
|
||||
|
||||
@@ -10,7 +10,6 @@ export type TCloudBillingDisplayContext = {
|
||||
organizationId: string;
|
||||
currentCloudPlan: TCloudBillingDisplayPlan;
|
||||
currentSubscriptionStatus: TOrganizationStripeSubscriptionStatus | null;
|
||||
trialDaysRemaining: number | null;
|
||||
usageCycleStart: Date;
|
||||
usageCycleEnd: Date;
|
||||
billing: NonNullable<Awaited<ReturnType<typeof getOrganizationBillingWithReadThroughSync>>>;
|
||||
@@ -28,22 +27,6 @@ const resolveCurrentSubscriptionStatus = (
|
||||
return billing.stripe?.subscriptionStatus ?? null;
|
||||
};
|
||||
|
||||
const MS_PER_DAY = 86_400_000;
|
||||
|
||||
const resolveTrialDaysRemaining = (
|
||||
billing: NonNullable<Awaited<ReturnType<typeof getOrganizationBillingWithReadThroughSync>>>
|
||||
): number | null => {
|
||||
if (billing.stripe?.subscriptionStatus !== "trialing" || !billing.stripe.trialEnd) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const trialEndDate = new Date(billing.stripe.trialEnd);
|
||||
if (!Number.isFinite(trialEndDate.getTime())) {
|
||||
return null;
|
||||
}
|
||||
return Math.ceil((trialEndDate.getTime() - Date.now()) / MS_PER_DAY);
|
||||
};
|
||||
|
||||
export const getCloudBillingDisplayContext = async (
|
||||
organizationId: string
|
||||
): Promise<TCloudBillingDisplayContext> => {
|
||||
@@ -59,7 +42,6 @@ export const getCloudBillingDisplayContext = async (
|
||||
organizationId,
|
||||
currentCloudPlan: resolveCurrentCloudPlan(billing),
|
||||
currentSubscriptionStatus: resolveCurrentSubscriptionStatus(billing),
|
||||
trialDaysRemaining: resolveTrialDaysRemaining(billing),
|
||||
usageCycleStart: usageCycleWindow.start,
|
||||
usageCycleEnd: usageCycleWindow.end,
|
||||
billing,
|
||||
|
||||
@@ -35,7 +35,6 @@ const mocks = vi.hoisted(() => ({
|
||||
customersUpdate: vi.fn(),
|
||||
prismaMembershipFindFirst: vi.fn(),
|
||||
loggerInfo: vi.fn(),
|
||||
loggerError: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/constants", async (importOriginal) => {
|
||||
@@ -84,7 +83,6 @@ vi.mock("@formbricks/logger", () => ({
|
||||
logger: {
|
||||
warn: mocks.loggerWarn,
|
||||
info: mocks.loggerInfo,
|
||||
error: mocks.loggerError,
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -183,7 +181,7 @@ describe("organization-billing", () => {
|
||||
name: "Org 1",
|
||||
});
|
||||
mocks.prismaMembershipFindFirst.mockResolvedValue({
|
||||
user: { email: "owner@example.com", name: "Owner Name" },
|
||||
user: { email: "owner@example.com" },
|
||||
});
|
||||
mocks.customersList.mockResolvedValue({
|
||||
data: [{ id: "cus_existing", deleted: false }],
|
||||
@@ -195,8 +193,8 @@ describe("organization-billing", () => {
|
||||
expect(result).toEqual({ customerId: "cus_existing" });
|
||||
expect(mocks.customersCreate).not.toHaveBeenCalled();
|
||||
expect(mocks.customersUpdate).toHaveBeenCalledWith("cus_existing", {
|
||||
name: "Owner Name",
|
||||
metadata: { organizationId: "org_1", organizationName: "Org 1" },
|
||||
name: "Org 1",
|
||||
metadata: { organizationId: "org_1" },
|
||||
});
|
||||
expect(mocks.prismaOrganizationBillingUpsert).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
@@ -212,9 +210,6 @@ describe("organization-billing", () => {
|
||||
id: "org_1",
|
||||
name: "Org 1",
|
||||
});
|
||||
mocks.prismaMembershipFindFirst.mockResolvedValue({
|
||||
user: { email: "owner@example.com", name: "Owner Name" },
|
||||
});
|
||||
mocks.prismaOrganizationBillingFindUnique.mockResolvedValue({
|
||||
stripeCustomerId: null,
|
||||
limits: {
|
||||
@@ -233,9 +228,8 @@ describe("organization-billing", () => {
|
||||
expect(result).toEqual({ customerId: "cus_new" });
|
||||
expect(mocks.customersCreate).toHaveBeenCalledWith(
|
||||
{
|
||||
name: "Owner Name",
|
||||
email: "owner@example.com",
|
||||
metadata: { organizationId: "org_1", organizationName: "Org 1" },
|
||||
name: "Org 1",
|
||||
metadata: { organizationId: "org_1" },
|
||||
},
|
||||
{ idempotencyKey: "ensure-customer-org_1" }
|
||||
);
|
||||
@@ -773,30 +767,26 @@ describe("organization-billing", () => {
|
||||
stripe: {},
|
||||
});
|
||||
mocks.customersCreate.mockResolvedValue({ id: "cus_new" });
|
||||
mocks.subscriptionsList
|
||||
.mockResolvedValueOnce({ data: [] }) // reconciliation initial list (status: "all")
|
||||
.mockResolvedValueOnce({ data: [] }) // fresh re-check before hobby creation (status: "active")
|
||||
.mockResolvedValueOnce({
|
||||
// sync reads subscriptions after hobby is created
|
||||
data: [
|
||||
{
|
||||
id: "sub_hobby",
|
||||
created: 1739923200,
|
||||
status: "active",
|
||||
billing_cycle_anchor: 1739923200,
|
||||
items: {
|
||||
data: [
|
||||
{
|
||||
price: {
|
||||
product: { id: "prod_hobby" },
|
||||
recurring: { usage_type: "licensed", interval: "month" },
|
||||
},
|
||||
mocks.subscriptionsList.mockResolvedValueOnce({ data: [] }).mockResolvedValueOnce({
|
||||
data: [
|
||||
{
|
||||
id: "sub_hobby",
|
||||
created: 1739923200,
|
||||
status: "active",
|
||||
billing_cycle_anchor: 1739923200,
|
||||
items: {
|
||||
data: [
|
||||
{
|
||||
price: {
|
||||
product: { id: "prod_hobby" },
|
||||
recurring: { usage_type: "licensed", interval: "month" },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
await ensureCloudStripeSetupForOrganization("org_1");
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export const invalidateOrganizationBillingCache = async (organizationId: string)
|
||||
await cache.del([getBillingCacheKey(organizationId)]);
|
||||
};
|
||||
|
||||
export const getDefaultOrganizationBilling = (): TOrganizationBilling => ({
|
||||
const getDefaultOrganizationBilling = (): TOrganizationBilling => ({
|
||||
limits: {
|
||||
projects: IS_FORMBRICKS_CLOUD ? 1 : 3,
|
||||
monthly: {
|
||||
@@ -300,10 +300,10 @@ const ensureHobbySubscription = async (
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks whether the given email has already used a Pro trial on any Stripe customer.
|
||||
* Checks whether the given email has already used a Scale trial on any Stripe customer.
|
||||
* Searches all customers with that email and inspects their subscription history.
|
||||
*/
|
||||
const hasEmailUsedProTrial = async (email: string, proProductId: string): Promise<boolean> => {
|
||||
const hasEmailUsedScaleTrial = async (email: string, scaleProductId: string): Promise<boolean> => {
|
||||
if (!stripeClient) return false;
|
||||
|
||||
const customers = await stripeClient.customers.list({
|
||||
@@ -318,23 +318,23 @@ const hasEmailUsedProTrial = async (email: string, proProductId: string): Promis
|
||||
limit: 100,
|
||||
});
|
||||
|
||||
const hadProTrial = subscriptions.data.some(
|
||||
const hadScaleTrial = subscriptions.data.some(
|
||||
(sub) =>
|
||||
sub.trial_start != null &&
|
||||
sub.items.data.some((item) => {
|
||||
const productId =
|
||||
typeof item.price.product === "string" ? item.price.product : item.price.product.id;
|
||||
return productId === proProductId;
|
||||
return productId === scaleProductId;
|
||||
})
|
||||
);
|
||||
|
||||
if (hadProTrial) return true;
|
||||
if (hadScaleTrial) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
export const createProTrialSubscription = async (
|
||||
export const createScaleTrialSubscription = async (
|
||||
organizationId: string,
|
||||
customerId: string
|
||||
): Promise<void> => {
|
||||
@@ -345,29 +345,30 @@ export const createProTrialSubscription = async (
|
||||
limit: 100,
|
||||
});
|
||||
|
||||
const proProduct = products.data.find((product) => product.metadata.formbricks_plan === "pro");
|
||||
if (!proProduct) {
|
||||
throw new Error("Stripe product metadata formbricks_plan=pro not found");
|
||||
const scaleProduct = products.data.find((product) => product.metadata.formbricks_plan === "scale");
|
||||
if (!scaleProduct) {
|
||||
throw new Error("Stripe product metadata formbricks_plan=scale not found");
|
||||
}
|
||||
|
||||
// Check if the email has already used a Scale trial across any Stripe customer
|
||||
const customer = await stripeClient.customers.retrieve(customerId);
|
||||
if (!customer.deleted && customer.email) {
|
||||
const alreadyUsed = await hasEmailUsedProTrial(customer.email, proProduct.id);
|
||||
const alreadyUsed = await hasEmailUsedScaleTrial(customer.email, scaleProduct.id);
|
||||
if (alreadyUsed) {
|
||||
throw new OperationNotAllowedError("trial_already_used");
|
||||
}
|
||||
}
|
||||
|
||||
const defaultPrice =
|
||||
typeof proProduct.default_price === "string" ? null : (proProduct.default_price ?? null);
|
||||
typeof scaleProduct.default_price === "string" ? null : (scaleProduct.default_price ?? null);
|
||||
|
||||
const fallbackPrices = await stripeClient.prices.list({
|
||||
product: proProduct.id,
|
||||
product: scaleProduct.id,
|
||||
active: true,
|
||||
limit: 100,
|
||||
});
|
||||
|
||||
const proPrice =
|
||||
const scalePrice =
|
||||
defaultPrice ??
|
||||
fallbackPrices.data.find(
|
||||
(price) => price.recurring?.interval === "month" && price.recurring.usage_type === "licensed"
|
||||
@@ -375,14 +376,14 @@ export const createProTrialSubscription = async (
|
||||
fallbackPrices.data[0] ??
|
||||
null;
|
||||
|
||||
if (!proPrice) {
|
||||
throw new Error(`No active price found for Stripe pro product ${proProduct.id}`);
|
||||
if (!scalePrice) {
|
||||
throw new Error(`No active price found for Stripe scale product ${scaleProduct.id}`);
|
||||
}
|
||||
|
||||
await stripeClient.subscriptions.create(
|
||||
{
|
||||
customer: customerId,
|
||||
items: [{ price: proPrice.id, quantity: 1 }],
|
||||
items: [{ price: scalePrice.id, quantity: 1 }],
|
||||
trial_period_days: 14,
|
||||
trial_settings: {
|
||||
end_behavior: {
|
||||
@@ -394,7 +395,7 @@ export const createProTrialSubscription = async (
|
||||
},
|
||||
metadata: { organizationId },
|
||||
},
|
||||
{ idempotencyKey: `create-pro-trial-${organizationId}` }
|
||||
{ idempotencyKey: `create-scale-trial-${organizationId}` }
|
||||
);
|
||||
};
|
||||
|
||||
@@ -439,15 +440,12 @@ const ensureOrganizationBillingRecord = async (
|
||||
* Finds the email of the organization owner by looking up the membership with role "owner"
|
||||
* and joining to the user table.
|
||||
*/
|
||||
const getOrganizationOwner = async (
|
||||
organizationId: string
|
||||
): Promise<{ email: string; name: string | null } | null> => {
|
||||
const getOrganizationOwnerEmail = async (organizationId: string): Promise<string | null> => {
|
||||
const membership = await prisma.membership.findFirst({
|
||||
where: { organizationId, role: "owner" },
|
||||
select: { user: { select: { email: true, name: true } } },
|
||||
select: { user: { select: { email: true } } },
|
||||
});
|
||||
if (!membership) return null;
|
||||
return { email: membership.user.email, name: membership.user.name };
|
||||
return membership?.user.email ?? null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -485,16 +483,10 @@ export const ensureStripeCustomerForOrganization = async (
|
||||
return { customerId: null };
|
||||
}
|
||||
|
||||
// Look up the org owner's email/name and check if a Stripe customer already exists for it.
|
||||
// Look up the org owner's email and check if a Stripe customer already exists for it.
|
||||
// This reuses the old customer (and its trial history) when a user deletes their account
|
||||
// and signs up again with the same email.
|
||||
const owner = await getOrganizationOwner(organization.id);
|
||||
if (!owner) {
|
||||
logger.error({ organizationId }, "Cannot set up Stripe customer: organization has no owner");
|
||||
return { customerId: null };
|
||||
}
|
||||
|
||||
const { email: ownerEmail, name: ownerName } = owner;
|
||||
const ownerEmail = await getOrganizationOwnerEmail(organization.id);
|
||||
let existingCustomer: Stripe.Customer | null = null;
|
||||
|
||||
if (ownerEmail) {
|
||||
@@ -505,8 +497,8 @@ export const ensureStripeCustomerForOrganization = async (
|
||||
if (!existingBillingOwner || existingBillingOwner === organizationId) {
|
||||
existingCustomer = foundCustomer;
|
||||
await stripeClient.customers.update(existingCustomer.id, {
|
||||
name: ownerName ?? undefined,
|
||||
metadata: { organizationId: organization.id, organizationName: organization.name },
|
||||
name: organization.name,
|
||||
metadata: { organizationId: organization.id },
|
||||
});
|
||||
logger.info(
|
||||
{ organizationId, customerId: existingCustomer.id, email: ownerEmail },
|
||||
@@ -520,9 +512,9 @@ export const ensureStripeCustomerForOrganization = async (
|
||||
existingCustomer ??
|
||||
(await stripeClient.customers.create(
|
||||
{
|
||||
name: ownerName ?? undefined,
|
||||
email: ownerEmail,
|
||||
metadata: { organizationId: organization.id, organizationName: organization.name },
|
||||
name: organization.name,
|
||||
email: ownerEmail ?? undefined,
|
||||
metadata: { organizationId: organization.id },
|
||||
},
|
||||
{ idempotencyKey: `ensure-customer-${organization.id}` }
|
||||
));
|
||||
@@ -628,14 +620,10 @@ export const syncOrganizationBillingFromStripe = async (
|
||||
plan: cloudPlan,
|
||||
subscriptionStatus,
|
||||
subscriptionId: subscription?.id ?? null,
|
||||
hasPaymentMethod: subscription?.default_payment_method != null,
|
||||
features: featureLookupKeys,
|
||||
lastStripeEventCreatedAt: toIsoStringOrNull(incomingEventDate ?? previousEventDate),
|
||||
lastSyncedAt: new Date().toISOString(),
|
||||
lastSyncedEventId: event?.id ?? existingStripeSnapshot?.lastSyncedEventId ?? null,
|
||||
trialEnd: subscription?.trial_end
|
||||
? new Date(subscription.trial_end * 1000).toISOString()
|
||||
: (existingStripeSnapshot?.trialEnd ?? null),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -790,17 +778,7 @@ export const reconcileCloudStripeSubscriptionsForOrganization = async (
|
||||
}
|
||||
|
||||
if (subscriptionsWithPlanLevel.length === 0) {
|
||||
// Re-check active subscriptions to guard against concurrent reconciliation calls
|
||||
// (e.g. webhook + bootstrap) both seeing 0 and creating duplicate hobbies.
|
||||
const freshSubscriptions = await client.subscriptions.list({
|
||||
customer: customerId,
|
||||
status: "active",
|
||||
limit: 1,
|
||||
});
|
||||
|
||||
if (freshSubscriptions.data.length === 0) {
|
||||
await ensureHobbySubscription(organizationId, customerId, idempotencySuffix);
|
||||
}
|
||||
await ensureHobbySubscription(organizationId, customerId, idempotencySuffix);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ export const PricingPage = async (props: { params: Promise<{ environmentId: stri
|
||||
stripePublishableKey={env.STRIPE_PUBLISHABLE_KEY ?? null}
|
||||
stripePricingTableId={env.STRIPE_PRICING_TABLE_ID ?? null}
|
||||
isStripeSetupIncomplete={!organizationWithSyncedBilling.billing.stripeCustomerId}
|
||||
trialDaysRemaining={cloudBillingDisplayContext.trialDaysRemaining}
|
||||
/>
|
||||
</PageContentWrapper>
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ export const ContactsPageLayout = async ({
|
||||
description={upgradePromptDescription ?? t("environments.contacts.unlock_contacts_description")}
|
||||
buttons={[
|
||||
{
|
||||
text: IS_FORMBRICKS_CLOUD ? t("common.upgrade_plan") : t("common.request_trial_license"),
|
||||
text: IS_FORMBRICKS_CLOUD ? t("common.start_free_trial") : t("common.request_trial_license"),
|
||||
href: IS_FORMBRICKS_CLOUD
|
||||
? `/environments/${environmentId}/settings/billing`
|
||||
: "https://formbricks.com/upgrade-self-hosting-license",
|
||||
|
||||
@@ -75,13 +75,9 @@ export const recheckLicenseAction = authenticatedActionClient
|
||||
try {
|
||||
freshLicense = await fetchLicenseFresh();
|
||||
} catch (error) {
|
||||
// 400 = invalid license key, 403 = license bound to another instance.
|
||||
// Return directly so the UI shows the correct message.
|
||||
if (error instanceof LicenseApiError && (error.status === 400 || error.status === 403)) {
|
||||
return {
|
||||
active: false,
|
||||
status: error.status === 400 ? ("invalid_license" as const) : ("instance_mismatch" as const),
|
||||
};
|
||||
// 400 = invalid license key — return directly so the UI shows the correct message
|
||||
if (error instanceof LicenseApiError && error.status === 400) {
|
||||
return { active: false, status: "invalid_license" as const };
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -462,37 +462,6 @@ describe("License Core Logic", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("should return instance_mismatch when API returns 403", async () => {
|
||||
vi.resetModules();
|
||||
vi.doMock("@/lib/env", () => ({
|
||||
env: {
|
||||
ENTERPRISE_LICENSE_KEY: "test-license-key",
|
||||
ENVIRONMENT: "production",
|
||||
VERCEL_URL: "some.vercel.url",
|
||||
FORMBRICKS_COM_URL: "https://app.formbricks.com",
|
||||
HTTPS_PROXY: undefined,
|
||||
HTTP_PROXY: undefined,
|
||||
},
|
||||
}));
|
||||
|
||||
const { getEnterpriseLicense } = await import("./license");
|
||||
const fetch = (await import("node-fetch")).default as Mock;
|
||||
|
||||
mockCache.get.mockResolvedValue({ ok: true, data: null });
|
||||
fetch.mockResolvedValueOnce({ ok: false, status: 403 } as any);
|
||||
|
||||
const license = await getEnterpriseLicense();
|
||||
|
||||
expect(license).toEqual({
|
||||
active: false,
|
||||
features: expect.objectContaining({ projects: 3 }),
|
||||
lastChecked: expect.any(Date),
|
||||
isPendingDowngrade: false,
|
||||
fallbackLevel: "default" as const,
|
||||
status: "instance_mismatch" as const,
|
||||
});
|
||||
});
|
||||
|
||||
test("should skip polling and fetch directly when Redis is unavailable (tryLock error)", async () => {
|
||||
vi.resetModules();
|
||||
vi.doMock("@/lib/env", () => ({
|
||||
|
||||
@@ -14,7 +14,7 @@ import { getInstanceId } from "@/lib/instance";
|
||||
import {
|
||||
TEnterpriseLicenseDetails,
|
||||
TEnterpriseLicenseFeatures,
|
||||
TLicenseStatus,
|
||||
TEnterpriseLicenseStatusReturn,
|
||||
} from "@/modules/ee/license-check/types/enterprise-license";
|
||||
|
||||
// Configuration
|
||||
@@ -52,7 +52,7 @@ type TEnterpriseLicenseResult = {
|
||||
lastChecked: Date;
|
||||
isPendingDowngrade: boolean;
|
||||
fallbackLevel: FallbackLevel;
|
||||
status: TLicenseStatus;
|
||||
status: TEnterpriseLicenseStatusReturn;
|
||||
};
|
||||
|
||||
type TPreviousResult = {
|
||||
@@ -407,9 +407,8 @@ const fetchLicenseFromServerInternal = async (retryCount = 0): Promise<TEnterpri
|
||||
return fetchLicenseFromServerInternal(retryCount + 1);
|
||||
}
|
||||
|
||||
// 400 = invalid license key, 403 = license bound to another instance.
|
||||
// Propagate both so callers can distinguish them from unreachable.
|
||||
if (res.status === 400 || res.status === 403) {
|
||||
// 400 = invalid license key — propagate so callers can distinguish from unreachable
|
||||
if (res.status === 400) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -586,7 +585,7 @@ const computeLicenseState = async (
|
||||
lastChecked: previousResult.lastChecked,
|
||||
isPendingDowngrade: true,
|
||||
fallbackLevel: "grace" as const,
|
||||
status: liveLicenseDetails?.status ?? "unreachable",
|
||||
status: (liveLicenseDetails?.status as TEnterpriseLicenseStatusReturn) ?? "unreachable",
|
||||
};
|
||||
memoryCache = { data: graceResult, timestamp: Date.now() };
|
||||
return graceResult;
|
||||
@@ -633,15 +632,14 @@ export const getEnterpriseLicense = reactCache(async (): Promise<TEnterpriseLice
|
||||
try {
|
||||
liveLicenseDetails = await fetchLicense();
|
||||
} catch (error) {
|
||||
if (error instanceof LicenseApiError && (error.status === 400 || error.status === 403)) {
|
||||
const status = error.status === 400 ? "invalid_license" : "instance_mismatch";
|
||||
if (error instanceof LicenseApiError && error.status === 400) {
|
||||
const invalidResult: TEnterpriseLicenseResult = {
|
||||
active: false,
|
||||
features: DEFAULT_FEATURES,
|
||||
lastChecked: new Date(),
|
||||
isPendingDowngrade: false,
|
||||
fallbackLevel: "default" as const,
|
||||
status,
|
||||
status: "invalid_license" as const,
|
||||
};
|
||||
memoryCache = { data: invalidResult, timestamp: Date.now() };
|
||||
return invalidResult;
|
||||
|
||||
@@ -29,10 +29,9 @@ export const ZEnterpriseLicenseDetails = z.object({
|
||||
|
||||
export type TEnterpriseLicenseDetails = z.infer<typeof ZEnterpriseLicenseDetails>;
|
||||
|
||||
export type TLicenseStatus =
|
||||
export type TEnterpriseLicenseStatusReturn =
|
||||
| "active"
|
||||
| "expired"
|
||||
| "instance_mismatch"
|
||||
| "unreachable"
|
||||
| "invalid_license"
|
||||
| "no-license";
|
||||
|
||||
@@ -174,7 +174,9 @@ export const QuotasCard = ({
|
||||
description={t("common.quotas_description")}
|
||||
buttons={[
|
||||
{
|
||||
text: isFormbricksCloud ? t("common.upgrade_plan") : t("common.request_trial_license"),
|
||||
text: isFormbricksCloud
|
||||
? t("common.start_free_trial")
|
||||
: t("common.request_trial_license"),
|
||||
href: isFormbricksCloud
|
||||
? `/environments/${environmentId}/settings/billing`
|
||||
: "https://formbricks.com/upgrade-self-hosting-license",
|
||||
|
||||
@@ -37,7 +37,7 @@ export const TeamsView = async ({
|
||||
|
||||
const buttons: [ModalButton, ModalButton] = [
|
||||
{
|
||||
text: IS_FORMBRICKS_CLOUD ? t("common.upgrade_plan") : t("common.request_trial_license"),
|
||||
text: IS_FORMBRICKS_CLOUD ? t("common.start_free_trial") : t("common.request_trial_license"),
|
||||
href: IS_FORMBRICKS_CLOUD
|
||||
? `/environments/${environmentId}/settings/billing`
|
||||
: "https://formbricks.com/docs/self-hosting/license#30-day-trial-license-request",
|
||||
|
||||
+1
-1
@@ -181,7 +181,7 @@ export const EmailCustomizationSettings = ({
|
||||
|
||||
const buttons: [ModalButton, ModalButton] = [
|
||||
{
|
||||
text: isFormbricksCloud ? t("common.upgrade_plan") : t("common.request_trial_license"),
|
||||
text: isFormbricksCloud ? t("common.start_free_trial") : t("common.request_trial_license"),
|
||||
href: isFormbricksCloud
|
||||
? `/environments/${environmentId}/settings/billing`
|
||||
: "https://formbricks.com/upgrade-self-hosting-license",
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ export const FaviconCustomizationSettings = ({
|
||||
|
||||
const buttons: [ModalButton, ModalButton] = [
|
||||
{
|
||||
text: t("common.upgrade_plan"),
|
||||
text: t("common.start_free_trial"),
|
||||
href: `/environments/${environmentId}/settings/billing`,
|
||||
},
|
||||
{
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ export const BrandingSettingsCard = async ({
|
||||
|
||||
const buttons: [ModalButton, ModalButton] = [
|
||||
{
|
||||
text: IS_FORMBRICKS_CLOUD ? t("common.upgrade_plan") : t("common.request_trial_license"),
|
||||
text: IS_FORMBRICKS_CLOUD ? t("common.start_free_trial") : t("common.request_trial_license"),
|
||||
href: IS_FORMBRICKS_CLOUD
|
||||
? `/environments/${environmentId}/settings/billing`
|
||||
: "https://formbricks.com/upgrade-self-hosting-license",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { beforeEach, describe, expect, test, vi } from "vitest";
|
||||
import { ResourceNotFoundError } from "@formbricks/types/errors";
|
||||
import type { TOrganizationBilling } from "@formbricks/types/organizations";
|
||||
import { getOrganizationBillingWithReadThroughSync } from "@/modules/ee/billing/lib/organization-billing";
|
||||
import { getEnterpriseLicense } from "@/modules/ee/license-check/lib/license";
|
||||
@@ -6,17 +7,8 @@ import { getCloudOrganizationEntitlementsContext } from "./cloud-provider";
|
||||
|
||||
vi.mock("server-only", () => ({}));
|
||||
|
||||
vi.mock("@formbricks/logger", () => ({
|
||||
logger: { warn: vi.fn() },
|
||||
}));
|
||||
|
||||
vi.mock("@/modules/ee/billing/lib/organization-billing", () => ({
|
||||
getOrganizationBillingWithReadThroughSync: vi.fn(),
|
||||
getDefaultOrganizationBilling: () => ({
|
||||
limits: { projects: 1, monthly: { responses: 250 } },
|
||||
stripeCustomerId: null,
|
||||
usageCycleAnchor: null,
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("@/modules/ee/license-check/lib/license", () => ({
|
||||
@@ -43,23 +35,11 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
describe("getCloudOrganizationEntitlementsContext", () => {
|
||||
test("returns default entitlements when billing is null", async () => {
|
||||
test("throws ResourceNotFoundError when billing is null", async () => {
|
||||
mockGetBilling.mockResolvedValue(null);
|
||||
mockGetLicense.mockResolvedValue({ status: "no-license", features: null, active: false });
|
||||
|
||||
const result = await getCloudOrganizationEntitlementsContext("org1");
|
||||
|
||||
expect(result).toEqual({
|
||||
organizationId: "org1",
|
||||
source: "cloud_stripe",
|
||||
features: [],
|
||||
limits: { projects: 1, monthlyResponses: 250 },
|
||||
licenseStatus: "no-license",
|
||||
licenseFeatures: null,
|
||||
stripeCustomerId: null,
|
||||
subscriptionStatus: null,
|
||||
usageCycleAnchor: null,
|
||||
});
|
||||
await expect(getCloudOrganizationEntitlementsContext("org1")).rejects.toThrow(ResourceNotFoundError);
|
||||
});
|
||||
|
||||
test("returns context with billing data", async () => {
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import "server-only";
|
||||
import { logger } from "@formbricks/logger";
|
||||
import {
|
||||
getDefaultOrganizationBilling,
|
||||
getOrganizationBillingWithReadThroughSync,
|
||||
} from "@/modules/ee/billing/lib/organization-billing";
|
||||
import { ResourceNotFoundError } from "@formbricks/types/errors";
|
||||
import { getOrganizationBillingWithReadThroughSync } from "@/modules/ee/billing/lib/organization-billing";
|
||||
import { getEnterpriseLicense } from "@/modules/ee/license-check/lib/license";
|
||||
import { type TOrganizationEntitlementsContext, isEntitlementFeature } from "./types";
|
||||
|
||||
@@ -22,23 +19,7 @@ export const getCloudOrganizationEntitlementsContext = async (
|
||||
]);
|
||||
|
||||
if (!billing) {
|
||||
logger.warn({ organizationId }, "Organization billing not found, using default entitlements");
|
||||
const defaultBilling = getDefaultOrganizationBilling();
|
||||
|
||||
return {
|
||||
organizationId,
|
||||
source: "cloud_stripe",
|
||||
features: [],
|
||||
limits: {
|
||||
projects: defaultBilling.limits?.projects ?? null,
|
||||
monthlyResponses: defaultBilling.limits?.monthly?.responses ?? null,
|
||||
},
|
||||
licenseStatus: license.status,
|
||||
licenseFeatures: license.features,
|
||||
stripeCustomerId: null,
|
||||
subscriptionStatus: null,
|
||||
usageCycleAnchor: null,
|
||||
};
|
||||
throw new ResourceNotFoundError("OrganizationBilling", organizationId);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { TOrganizationStripeSubscriptionStatus } from "@formbricks/types/or
|
||||
import { CLOUD_STRIPE_FEATURE_LOOKUP_KEYS } from "@/modules/billing/lib/stripe-catalog";
|
||||
import type {
|
||||
TEnterpriseLicenseFeatures,
|
||||
TLicenseStatus,
|
||||
TEnterpriseLicenseStatusReturn,
|
||||
} from "@/modules/ee/license-check/types/enterprise-license";
|
||||
|
||||
export type TEntitlementSource = "cloud_stripe" | "self_hosted_license";
|
||||
@@ -33,7 +33,7 @@ export type TOrganizationEntitlementsContext = {
|
||||
source: TEntitlementSource;
|
||||
features: TEntitlementFeature[];
|
||||
limits: TEntitlementLimits;
|
||||
licenseStatus: TLicenseStatus;
|
||||
licenseStatus: TEnterpriseLicenseStatusReturn;
|
||||
licenseFeatures: TEnterpriseLicenseFeatures | null;
|
||||
stripeCustomerId: string | null;
|
||||
subscriptionStatus: TOrganizationStripeSubscriptionStatus | null;
|
||||
|
||||
@@ -5,10 +5,7 @@ import { TMembership, ZMembership } from "@formbricks/types/memberships";
|
||||
import { TOrganization, ZOrganization } from "@formbricks/types/organizations";
|
||||
import { TProject, ZProject } from "@formbricks/types/project";
|
||||
import { TUser, ZUser } from "@formbricks/types/user";
|
||||
import {
|
||||
TEnterpriseLicenseFeatures,
|
||||
TLicenseStatus,
|
||||
} from "@/modules/ee/license-check/types/enterprise-license";
|
||||
import { TEnterpriseLicenseFeatures } from "@/modules/ee/license-check/types/enterprise-license";
|
||||
import { TTeamPermission, ZTeamPermission } from "@/modules/ee/teams/project-teams/types/team";
|
||||
|
||||
// Type for the enterprise license returned by getEnterpriseLicense()
|
||||
@@ -18,7 +15,7 @@ type TEnterpriseLicense = {
|
||||
lastChecked: Date;
|
||||
isPendingDowngrade: boolean;
|
||||
fallbackLevel: string;
|
||||
status: TLicenseStatus;
|
||||
status: "active" | "expired" | "unreachable" | "no-license" | "invalid_license";
|
||||
};
|
||||
|
||||
export const ZEnvironmentAuth = z.object({
|
||||
|
||||
+1
-1
@@ -193,7 +193,7 @@ export const IndividualInviteTab = ({
|
||||
? `/environments/${environmentId}/settings/billing`
|
||||
: "https://formbricks.com/upgrade-self-hosting-license"
|
||||
}>
|
||||
{t("common.upgrade_plan")}
|
||||
{t("common.start_free_trial")}
|
||||
</Link>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
@@ -43,7 +43,7 @@ export const TargetingLockedCard = ({ isFormbricksCloud, environmentId }: Target
|
||||
description={t("environments.surveys.edit.unlock_targeting_description")}
|
||||
buttons={[
|
||||
{
|
||||
text: isFormbricksCloud ? t("common.upgrade_plan") : t("common.request_trial_license"),
|
||||
text: isFormbricksCloud ? t("common.start_free_trial") : t("common.request_trial_license"),
|
||||
href: isFormbricksCloud
|
||||
? `/environments/${environmentId}/settings/billing`
|
||||
: "https://formbricks.com/upgrade-self-hosting-license",
|
||||
|
||||
@@ -94,17 +94,6 @@ export const ValidationRulesEditor = ({
|
||||
|
||||
const handleDisable = () => {
|
||||
onUpdateValidation({ rules: [], logic: validationLogic });
|
||||
// Reset inputType to "text" when disabling validation for OpenText elements.
|
||||
// Without this, the HTML input keeps its type (e.g. "url"), which still enforces
|
||||
// browser-native format validation even though the user toggled validation off.
|
||||
if (
|
||||
elementType === TSurveyElementTypeEnum.OpenText &&
|
||||
onUpdateInputType &&
|
||||
inputType !== undefined &&
|
||||
inputType !== "text"
|
||||
) {
|
||||
onUpdateInputType("text");
|
||||
}
|
||||
};
|
||||
|
||||
const handleAddRule = (insertAfterIndex: number) => {
|
||||
|
||||
@@ -10,11 +10,7 @@ import { renderSurvey } from "@/modules/survey/link/components/survey-renderer";
|
||||
import { getExistingContactResponse } from "@/modules/survey/link/lib/data";
|
||||
import { getEnvironmentContextForLinkSurvey } from "@/modules/survey/link/lib/environment";
|
||||
import { checkAndValidateSingleUseId } from "@/modules/survey/link/lib/helper";
|
||||
import {
|
||||
getBasicSurveyMetadata,
|
||||
getMetadataBrandColor,
|
||||
getSurveyOpenGraphMetadata,
|
||||
} from "@/modules/survey/link/lib/metadata-utils";
|
||||
import { getBasicSurveyMetadata, getSurveyOpenGraphMetadata } from "@/modules/survey/link/lib/metadata-utils";
|
||||
import { getProjectByEnvironmentId } from "@/modules/survey/link/lib/project";
|
||||
|
||||
interface ContactSurveyPageProps {
|
||||
@@ -52,8 +48,9 @@ export const generateMetadata = async (props: ContactSurveyPageProps): Promise<M
|
||||
const environmentContext = await getEnvironmentContextForLinkSurvey(survey.environmentId);
|
||||
const customFaviconUrl = environmentContext.organizationWhitelabel?.faviconUrl;
|
||||
|
||||
const brandColor = getMetadataBrandColor(environmentContext.project.styling, survey.styling);
|
||||
const baseMetadata = getSurveyOpenGraphMetadata(survey.id, title, brandColor);
|
||||
// Get OpenGraph metadata
|
||||
const surveyBrandColor = survey.styling?.brandColor?.light;
|
||||
const baseMetadata = getSurveyOpenGraphMetadata(survey.id, title, surveyBrandColor);
|
||||
|
||||
// Override with the custom image URL
|
||||
if (baseMetadata.openGraph) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { getProjectByEnvironmentId } from "@/modules/survey/link/lib/project";
|
||||
import {
|
||||
getBasicSurveyMetadata,
|
||||
getBrandColorForURL,
|
||||
getMetadataBrandColor,
|
||||
getNameForURL,
|
||||
getSurveyOpenGraphMetadata,
|
||||
} from "./metadata-utils";
|
||||
@@ -254,35 +253,6 @@ describe("Metadata Utils", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("getMetadataBrandColor", () => {
|
||||
test("returns survey brand color when project allows override and survey overrides theme", () => {
|
||||
const projectStyling = { allowStyleOverwrite: true, brandColor: { light: "#ff0000" } };
|
||||
const surveyStyling = { overwriteThemeStyling: true, brandColor: { light: "#0000ff" } };
|
||||
|
||||
expect(getMetadataBrandColor(projectStyling, surveyStyling as any)).toBe("#0000ff");
|
||||
});
|
||||
|
||||
test("returns project brand color when survey does not override theme", () => {
|
||||
const projectStyling = { allowStyleOverwrite: true, brandColor: { light: "#ff0000" } };
|
||||
const surveyStyling = { overwriteThemeStyling: false, brandColor: { light: "#0000ff" } };
|
||||
|
||||
expect(getMetadataBrandColor(projectStyling, surveyStyling as any)).toBe("#ff0000");
|
||||
});
|
||||
|
||||
test("returns project brand color when project disallows style overwrite", () => {
|
||||
const projectStyling = { allowStyleOverwrite: false, brandColor: { light: "#ff0000" } };
|
||||
const surveyStyling = { overwriteThemeStyling: true, brandColor: { light: "#0000ff" } };
|
||||
|
||||
expect(getMetadataBrandColor(projectStyling, surveyStyling as any)).toBe("#ff0000");
|
||||
});
|
||||
|
||||
test("returns project brand color when survey styling is null", () => {
|
||||
const projectStyling = { allowStyleOverwrite: true, brandColor: { light: "#ff0000" } };
|
||||
|
||||
expect(getMetadataBrandColor(projectStyling, null)).toBe("#ff0000");
|
||||
});
|
||||
});
|
||||
|
||||
describe("getSurveyOpenGraphMetadata", () => {
|
||||
test("generates correct OpenGraph metadata", () => {
|
||||
const surveyId = "survey-123";
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { Metadata } from "next";
|
||||
import { TProjectStyling } from "@formbricks/types/project";
|
||||
import { TSurveyStyling } from "@formbricks/types/surveys/types";
|
||||
import { getTextContent } from "@formbricks/types/surveys/validation";
|
||||
import { IS_FORMBRICKS_CLOUD } from "@/lib/constants";
|
||||
import { getPublicDomain } from "@/lib/getPublicUrl";
|
||||
@@ -86,23 +84,6 @@ export const getBasicSurveyMetadata = async (
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines the brand color for OG metadata based on project and survey styling settings.
|
||||
* Uses project brand color unless the project allows style overwrite AND the survey overrides the theme.
|
||||
*/
|
||||
export const getMetadataBrandColor = (
|
||||
projectStyling: TProjectStyling,
|
||||
surveyStyling?: TSurveyStyling | null
|
||||
): string | undefined => {
|
||||
if (!projectStyling.allowStyleOverwrite) {
|
||||
return projectStyling.brandColor?.light;
|
||||
}
|
||||
|
||||
return surveyStyling?.overwriteThemeStyling
|
||||
? surveyStyling.brandColor?.light
|
||||
: projectStyling.brandColor?.light;
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate Open Graph metadata for survey
|
||||
*/
|
||||
|
||||
@@ -17,14 +17,10 @@ vi.mock("next/navigation", () => ({
|
||||
notFound: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("./lib/metadata-utils", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("./lib/metadata-utils")>();
|
||||
return {
|
||||
...actual,
|
||||
getSurveyOpenGraphMetadata: vi.fn(),
|
||||
getBasicSurveyMetadata: vi.fn(),
|
||||
};
|
||||
});
|
||||
vi.mock("./lib/metadata-utils", () => ({
|
||||
getSurveyOpenGraphMetadata: vi.fn(),
|
||||
getBasicSurveyMetadata: vi.fn(),
|
||||
}));
|
||||
|
||||
describe("getMetadataForLinkSurvey", () => {
|
||||
const mockSurveyId = "survey-123";
|
||||
@@ -57,7 +53,7 @@ describe("getMetadataForLinkSurvey", () => {
|
||||
project: {
|
||||
id: "project-123",
|
||||
name: "Test Project",
|
||||
styling: { allowStyleOverwrite: true },
|
||||
styling: null,
|
||||
logo: null,
|
||||
linkSurveyBranding: true,
|
||||
customHeadScripts: null,
|
||||
|
||||
@@ -2,11 +2,7 @@ import { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { getSurveyWithMetadata } from "@/modules/survey/link/lib/data";
|
||||
import { getEnvironmentContextForLinkSurvey } from "@/modules/survey/link/lib/environment";
|
||||
import {
|
||||
getBasicSurveyMetadata,
|
||||
getMetadataBrandColor,
|
||||
getSurveyOpenGraphMetadata,
|
||||
} from "./lib/metadata-utils";
|
||||
import { getBasicSurveyMetadata, getSurveyOpenGraphMetadata } from "./lib/metadata-utils";
|
||||
|
||||
export const getMetadataForLinkSurvey = async (
|
||||
surveyId: string,
|
||||
@@ -19,14 +15,14 @@ export const getMetadataForLinkSurvey = async (
|
||||
}
|
||||
|
||||
const { title, description, ogImage } = await getBasicSurveyMetadata(surveyId, languageCode, survey);
|
||||
const surveyBrandColor = survey.styling?.brandColor?.light;
|
||||
|
||||
// Fetch organization whitelabel data for custom favicon
|
||||
const environmentContext = await getEnvironmentContextForLinkSurvey(survey.environmentId);
|
||||
const customFaviconUrl = environmentContext.organizationWhitelabel?.faviconUrl;
|
||||
|
||||
// Use the shared function for creating the base metadata but override with custom data
|
||||
const brandColor = getMetadataBrandColor(environmentContext.project.styling, survey.styling);
|
||||
const baseMetadata = getSurveyOpenGraphMetadata(survey.id, title, brandColor);
|
||||
const baseMetadata = getSurveyOpenGraphMetadata(survey.id, title, surveyBrandColor);
|
||||
|
||||
// Override with the custom image URL
|
||||
if (baseMetadata.openGraph) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { TUserLocale } from "@formbricks/types/user";
|
||||
import type { TLicenseStatus } from "@/modules/ee/license-check/types/enterprise-license";
|
||||
|
||||
interface PendingDowngradeBannerProps {
|
||||
lastChecked: Date;
|
||||
@@ -13,7 +12,7 @@ interface PendingDowngradeBannerProps {
|
||||
isPendingDowngrade: boolean;
|
||||
environmentId: string;
|
||||
locale: TUserLocale;
|
||||
status: TLicenseStatus;
|
||||
status: "active" | "expired" | "unreachable" | "no-license" | "invalid_license";
|
||||
}
|
||||
|
||||
export const PendingDowngradeBanner = ({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@formbricks/web",
|
||||
"version": "0.0.0",
|
||||
"packageManager": "pnpm@10.32.1",
|
||||
"packageManager": "pnpm@10.30.3",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"clean": "rimraf .turbo node_modules .next coverage",
|
||||
@@ -68,7 +68,7 @@
|
||||
"@radix-ui/react-switch": "1.2.6",
|
||||
"@radix-ui/react-tabs": "1.1.13",
|
||||
"@radix-ui/react-tooltip": "1.2.8",
|
||||
"@sentry/nextjs": "10.43.0",
|
||||
"@sentry/nextjs": "10.42.0",
|
||||
"@t3-oss/env-nextjs": "0.13.10",
|
||||
"@tailwindcss/forms": "0.5.11",
|
||||
"@tailwindcss/typography": "0.5.19",
|
||||
@@ -82,11 +82,11 @@
|
||||
"csv-parse": "6.1.0",
|
||||
"date-fns": "4.1.0",
|
||||
"file-loader": "6.2.0",
|
||||
"framer-motion": "12.35.2",
|
||||
"framer-motion": "12.35.0",
|
||||
"googleapis": "171.4.0",
|
||||
"heic-convert": "2.1.0",
|
||||
"https-proxy-agent": "7.0.6",
|
||||
"i18next": "25.8.18",
|
||||
"i18next": "25.8.14",
|
||||
"i18next-icu": "2.4.3",
|
||||
"i18next-resources-to-backend": "1.2.1",
|
||||
"jiti": "2.6.1",
|
||||
@@ -97,9 +97,9 @@
|
||||
"markdown-it": "14.1.1",
|
||||
"next": "16.1.6",
|
||||
"next-auth": "4.24.13",
|
||||
"next-safe-action": "8.1.8",
|
||||
"next-safe-action": "8.1.5",
|
||||
"node-fetch": "3.3.2",
|
||||
"nodemailer": "8.0.2",
|
||||
"nodemailer": "8.0.1",
|
||||
"otplib": "12.0.1",
|
||||
"papaparse": "5.5.3",
|
||||
"posthog-js": "1.360.0",
|
||||
@@ -114,13 +114,13 @@
|
||||
"react-dom": "19.2.4",
|
||||
"react-hook-form": "7.71.2",
|
||||
"react-hot-toast": "2.6.0",
|
||||
"react-i18next": "16.5.8",
|
||||
"react-i18next": "16.5.4",
|
||||
"react-turnstile": "1.1.5",
|
||||
"react-use": "17.6.0",
|
||||
"sanitize-html": "2.17.1",
|
||||
"server-only": "0.0.1",
|
||||
"sharp": "0.34.5",
|
||||
"stripe": "20.4.1",
|
||||
"stripe": "20.4.0",
|
||||
"tailwind-merge": "3.5.0",
|
||||
"tailwindcss": "3.4.19",
|
||||
"ua-parser-js": "2.0.9",
|
||||
@@ -142,7 +142,7 @@
|
||||
"@types/nodemailer": "7.0.11",
|
||||
"@types/papaparse": "5.5.2",
|
||||
"@types/qrcode": "1.5.6",
|
||||
"@types/sanitize-html": "2.16.1",
|
||||
"@types/sanitize-html": "2.16.0",
|
||||
"@types/ungap__structured-clone": "1.2.0",
|
||||
"@vitest/coverage-v8": "4.0.18",
|
||||
"autoprefixer": "10.4.27",
|
||||
|
||||
@@ -181,7 +181,7 @@ afterEach(() => {
|
||||
export const testInputValidation = async (service: Function, ...args: any[]): Promise<void> => {
|
||||
test("throws a ValidationError if the inputs are invalid", async () => {
|
||||
await expect(service(...args)).rejects.toThrow(ValidationError);
|
||||
}, 15000);
|
||||
});
|
||||
};
|
||||
|
||||
vi.mock("@/lib/constants", () => ({
|
||||
|
||||
@@ -0,0 +1,365 @@
|
||||
/**
|
||||
* Backbone.js Collection Merge Fix Example
|
||||
*
|
||||
* This file demonstrates the fix for the error:
|
||||
* "TypeError: Object [object Object] has no method 'updateFrom'"
|
||||
*
|
||||
* Issue: FORMBRICKS-RN
|
||||
* Error occurs when using collection.add() with merge: true on models
|
||||
* that don't have an updateFrom method.
|
||||
*/
|
||||
|
||||
// ============================================================================
|
||||
// PROBLEM: Model without updateFrom method (will cause TypeError)
|
||||
// ============================================================================
|
||||
|
||||
var MemberBroken = Backbone.Model.extend({
|
||||
defaults: {
|
||||
id: null,
|
||||
name: '',
|
||||
email: '',
|
||||
version: 1
|
||||
}
|
||||
// Missing updateFrom method - will cause error with merge: true
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// SOLUTION: Model with updateFrom method (fixed)
|
||||
// ============================================================================
|
||||
|
||||
var Member = Backbone.Model.extend({
|
||||
defaults: {
|
||||
id: null,
|
||||
name: '',
|
||||
email: '',
|
||||
version: 1
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates this model's attributes from another model instance
|
||||
* This method is required when using collection.add with merge: true
|
||||
*
|
||||
* @param {Backbone.Model|Object} model - The source model or attributes object
|
||||
* @param {Object} options - Options to pass to set() method
|
||||
* @return {Backbone.Model} Returns this model for chaining
|
||||
*/
|
||||
updateFrom: function(model, options) {
|
||||
if (!model) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Extract attributes from model or use object directly
|
||||
var attrs = model.attributes ? model.attributes : model;
|
||||
|
||||
// Optionally validate before updating
|
||||
if (options && options.validate && !this.isValid(attrs)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Update this model with the new attributes
|
||||
this.set(attrs, options);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Optional: Validate model attributes
|
||||
*/
|
||||
validate: function(attrs) {
|
||||
if (attrs.email && !this.isValidEmail(attrs.email)) {
|
||||
return "Invalid email format";
|
||||
}
|
||||
},
|
||||
|
||||
isValidEmail: function(email) {
|
||||
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
return emailRegex.test(email);
|
||||
}
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// Collection Definition
|
||||
// ============================================================================
|
||||
|
||||
var MemberCollection = Backbone.Collection.extend({
|
||||
model: Member,
|
||||
|
||||
/**
|
||||
* Merge a member into the collection with version checking
|
||||
* Only updates if the new version is newer than existing version
|
||||
*/
|
||||
mergeMember: function(member, options) {
|
||||
options = options || {};
|
||||
|
||||
var existing = this.get(member.id);
|
||||
|
||||
// Check if existing version is newer - skip update if so
|
||||
if (existing && existing.get('version') > member.get('version')) {
|
||||
console.log('Skipping merge: existing version is newer');
|
||||
return existing;
|
||||
}
|
||||
|
||||
// Add or merge the member
|
||||
// This will call updateFrom() if the model exists
|
||||
return this.add(member, {
|
||||
merge: true,
|
||||
sort: options.sort !== false
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// Example View Implementation
|
||||
// ============================================================================
|
||||
|
||||
var MemberListView = Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
this.collection = new MemberCollection();
|
||||
this.options = options || {};
|
||||
this.cursor = null;
|
||||
|
||||
// Listen for collection changes
|
||||
this.listenTo(this.collection, 'add', this.onMemberAdded);
|
||||
this.listenTo(this.collection, 'change', this.onMemberChanged);
|
||||
this.listenTo(this.collection, 'remove', this.onMemberRemoved);
|
||||
},
|
||||
|
||||
/**
|
||||
* Polling function to fetch updates from server
|
||||
* This is the function from the error stack trace
|
||||
*/
|
||||
poll: function() {
|
||||
var self = this;
|
||||
var data;
|
||||
|
||||
if (!this.options.realtime || !this.options.pollUrl) {
|
||||
return window.setTimeout(function() {
|
||||
self.poll();
|
||||
}, this.options.pollTime);
|
||||
}
|
||||
|
||||
data = app.utils.getQueryParams();
|
||||
data.cursor = this.cursor || undefined;
|
||||
|
||||
$.ajax({
|
||||
url: this.options.pollUrl,
|
||||
data: data,
|
||||
success: function(response) {
|
||||
self.handlePollResponse(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Poll failed:', error);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle poll response and merge new members
|
||||
*/
|
||||
handlePollResponse: function(response) {
|
||||
var self = this;
|
||||
|
||||
if (response.cursor) {
|
||||
this.cursor = response.cursor;
|
||||
}
|
||||
|
||||
// Process each member from response
|
||||
_.each(response.members, function(memberData) {
|
||||
var member = new Member(memberData);
|
||||
self.merge(member);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Merge a member into the collection
|
||||
* This is the function from the error stack trace (line 268)
|
||||
*/
|
||||
merge: function(member, options) {
|
||||
options = options || {};
|
||||
|
||||
var existing = this.collection.get(member.id);
|
||||
|
||||
// Version check - only update if new version is newer
|
||||
if (existing && existing.get('version') > member.get('version')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// This line caused the original error when updateFrom was missing
|
||||
// Now it works because Member model has updateFrom method
|
||||
this.collection.add(member, {
|
||||
merge: true,
|
||||
sort: options.sort !== false ? true : false
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove a member from collection
|
||||
*/
|
||||
removeMember: function(member) {
|
||||
this.collection.remove(member);
|
||||
},
|
||||
|
||||
/**
|
||||
* Render a member in the container
|
||||
* This is the function from the error stack trace (line 283)
|
||||
*/
|
||||
renderMemberInContainer: function(member) {
|
||||
var new_pos = this.collection.indexOf(member);
|
||||
var $el, $rel;
|
||||
|
||||
this.$parent.find('li.empty').remove();
|
||||
|
||||
$el = $('#' + this.id + member.id);
|
||||
|
||||
if ($el.length) {
|
||||
// Update existing element
|
||||
$el.replaceWith(this.renderMember(member));
|
||||
} else {
|
||||
// Insert new element at correct position
|
||||
if (new_pos === 0) {
|
||||
this.$parent.prepend(this.renderMember(member));
|
||||
} else {
|
||||
$rel = this.$parent.find('li').eq(new_pos - 1);
|
||||
$rel.after(this.renderMember(member));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
renderMember: function(member) {
|
||||
return '<li id="' + this.id + member.id + '">' +
|
||||
'<span>' + member.get('name') + '</span>' +
|
||||
'<span>' + member.get('email') + '</span>' +
|
||||
'</li>';
|
||||
},
|
||||
|
||||
onMemberAdded: function(member) {
|
||||
console.log('Member added:', member.toJSON());
|
||||
this.renderMemberInContainer(member);
|
||||
},
|
||||
|
||||
onMemberChanged: function(member) {
|
||||
console.log('Member changed:', member.toJSON());
|
||||
this.renderMemberInContainer(member);
|
||||
},
|
||||
|
||||
onMemberRemoved: function(member) {
|
||||
$('#' + this.id + member.id).remove();
|
||||
}
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
// Usage Example
|
||||
// ============================================================================
|
||||
|
||||
// Initialize the view
|
||||
var memberListView = new MemberListView({
|
||||
el: '#member-list',
|
||||
realtime: true,
|
||||
pollUrl: '/api/members',
|
||||
pollTime: 5000
|
||||
});
|
||||
|
||||
// Example: Adding a member
|
||||
var newMember = new Member({
|
||||
id: 1,
|
||||
name: 'John Doe',
|
||||
email: 'john@example.com',
|
||||
version: 1
|
||||
});
|
||||
|
||||
memberListView.merge(newMember); // Works correctly
|
||||
|
||||
// Example: Updating the same member with new version
|
||||
var updatedMember = new Member({
|
||||
id: 1,
|
||||
name: 'John Doe',
|
||||
email: 'john.doe@example.com',
|
||||
version: 2
|
||||
});
|
||||
|
||||
memberListView.merge(updatedMember); // Works correctly - calls updateFrom()
|
||||
|
||||
// Example: Trying to update with older version (should be skipped)
|
||||
var olderMember = new Member({
|
||||
id: 1,
|
||||
name: 'Old Name',
|
||||
email: 'old@example.com',
|
||||
version: 1
|
||||
});
|
||||
|
||||
memberListView.merge(olderMember); // Skipped - version is older
|
||||
|
||||
// ============================================================================
|
||||
// Testing the Fix
|
||||
// ============================================================================
|
||||
|
||||
if (typeof describe !== 'undefined') {
|
||||
describe('Backbone Collection Merge Fix', function() {
|
||||
it('should have updateFrom method on Member model', function() {
|
||||
var member = new Member({ id: 1, name: 'Test' });
|
||||
expect(member.updateFrom).toBeDefined();
|
||||
expect(typeof member.updateFrom).toBe('function');
|
||||
});
|
||||
|
||||
it('should update model attributes using updateFrom', function() {
|
||||
var member1 = new Member({ id: 1, name: 'John', version: 1 });
|
||||
var member2 = new Member({ id: 1, name: 'John Doe', version: 2 });
|
||||
|
||||
member1.updateFrom(member2);
|
||||
|
||||
expect(member1.get('name')).toBe('John Doe');
|
||||
expect(member1.get('version')).toBe(2);
|
||||
});
|
||||
|
||||
it('should merge models in collection without error', function() {
|
||||
var collection = new MemberCollection([
|
||||
{ id: 1, name: 'John', email: 'john@test.com', version: 1 }
|
||||
]);
|
||||
|
||||
var updatedMember = new Member({
|
||||
id: 1,
|
||||
name: 'John Doe',
|
||||
email: 'john.doe@test.com',
|
||||
version: 2
|
||||
});
|
||||
|
||||
expect(function() {
|
||||
collection.add(updatedMember, { merge: true });
|
||||
}).not.toThrow();
|
||||
|
||||
expect(collection.get(1).get('name')).toBe('John Doe');
|
||||
expect(collection.get(1).get('email')).toBe('john.doe@test.com');
|
||||
});
|
||||
|
||||
it('should respect version checking when merging', function() {
|
||||
var collection = new MemberCollection([
|
||||
{ id: 1, name: 'John Doe', version: 2 }
|
||||
]);
|
||||
|
||||
var view = new MemberListView({
|
||||
el: $('<div>'),
|
||||
realtime: false
|
||||
});
|
||||
view.collection = collection;
|
||||
|
||||
var olderMember = new Member({ id: 1, name: 'Old Name', version: 1 });
|
||||
view.merge(olderMember);
|
||||
|
||||
// Should still have the newer version
|
||||
expect(collection.get(1).get('name')).toBe('John Doe');
|
||||
expect(collection.get(1).get('version')).toBe(2);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Export for Node.js/CommonJS environments
|
||||
// ============================================================================
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = {
|
||||
Member: Member,
|
||||
MemberCollection: MemberCollection,
|
||||
MemberListView: MemberListView
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
---
|
||||
title: "Backbone Collection Merge Fix"
|
||||
description: "How to fix the 'updateFrom method not found' error when using Backbone.Collection with merge option"
|
||||
icon: "code"
|
||||
---
|
||||
|
||||
## Problem Description
|
||||
|
||||
When using Backbone.js Collections with the `merge: true` option, you may encounter the following error:
|
||||
|
||||
```
|
||||
TypeError: Object [object Object] has no method 'updateFrom'
|
||||
```
|
||||
|
||||
This error occurs when calling `collection.add(model, { merge: true })` on a model that doesn't have an `updateFrom` method defined.
|
||||
|
||||
## Root Cause
|
||||
|
||||
In Backbone.js, when you add a model to a collection with `merge: true`, Backbone attempts to merge the new data with existing models in the collection. Some Backbone implementations or plugins expect models to have an `updateFrom` method to handle the merging logic.
|
||||
|
||||
### Example of the Problem
|
||||
|
||||
```javascript
|
||||
// Problem: Model without updateFrom method
|
||||
var Member = Backbone.Model.extend({
|
||||
defaults: {
|
||||
id: null,
|
||||
name: '',
|
||||
version: 1
|
||||
}
|
||||
});
|
||||
|
||||
var MemberCollection = Backbone.Collection.extend({
|
||||
model: Member
|
||||
});
|
||||
|
||||
// In your view
|
||||
merge: function(member) {
|
||||
var existing = this.collection.get(member.id);
|
||||
if (existing && existing.get('version') > member.get('version')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// This will fail if the model doesn't have updateFrom method
|
||||
this.collection.add(member, {
|
||||
merge: true,
|
||||
sort: options.sort !== false ? true : false
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
## Solution
|
||||
|
||||
Add the `updateFrom` method to your Backbone Model definition. This method should handle merging attributes from another model instance.
|
||||
|
||||
### Fixed Implementation
|
||||
|
||||
```javascript
|
||||
// Solution: Model with updateFrom method
|
||||
var Member = Backbone.Model.extend({
|
||||
defaults: {
|
||||
id: null,
|
||||
name: '',
|
||||
version: 1
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates this model's attributes from another model instance
|
||||
* @param {Backbone.Model} model - The source model to update from
|
||||
* @param {Object} options - Options to pass to set()
|
||||
*/
|
||||
updateFrom: function(model, options) {
|
||||
if (!model) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Get the attributes from the source model
|
||||
var attrs = model.attributes ? model.attributes : model;
|
||||
|
||||
// Update this model with the new attributes
|
||||
this.set(attrs, options);
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
var MemberCollection = Backbone.Collection.extend({
|
||||
model: Member
|
||||
});
|
||||
|
||||
// Now this will work correctly
|
||||
merge: function(member) {
|
||||
var existing = this.collection.get(member.id);
|
||||
if (existing && existing.get('version') > member.get('version')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// This will now successfully merge using the updateFrom method
|
||||
this.collection.add(member, {
|
||||
merge: true,
|
||||
sort: options.sort !== false ? true : false
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
## Alternative Solution: Using Standard Backbone Merge
|
||||
|
||||
If you're using standard Backbone.js (without custom plugins), you can rely on Backbone's built-in merge functionality:
|
||||
|
||||
```javascript
|
||||
var Member = Backbone.Model.extend({
|
||||
defaults: {
|
||||
id: null,
|
||||
name: '',
|
||||
version: 1
|
||||
}
|
||||
});
|
||||
|
||||
var MemberCollection = Backbone.Collection.extend({
|
||||
model: Member
|
||||
});
|
||||
|
||||
// Standard Backbone merge behavior
|
||||
merge: function(member) {
|
||||
var existing = this.collection.get(member.id);
|
||||
|
||||
// Check version before merging
|
||||
if (existing && existing.get('version') > member.get('version')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Backbone will automatically call set() on existing models
|
||||
this.collection.add(member, {
|
||||
merge: true,
|
||||
sort: options.sort !== false
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### 1. Version Control
|
||||
|
||||
Always check version numbers before merging to prevent outdated data from overwriting newer data:
|
||||
|
||||
```javascript
|
||||
merge: function(member) {
|
||||
var existing = this.collection.get(member.id);
|
||||
if (existing && existing.get('version') > member.get('version')) {
|
||||
return; // Skip outdated updates
|
||||
}
|
||||
this.collection.add(member, { merge: true });
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Validation
|
||||
|
||||
Validate incoming model data before merging:
|
||||
|
||||
```javascript
|
||||
updateFrom: function(model, options) {
|
||||
if (!model || !model.id) {
|
||||
throw new Error('Invalid model: missing id');
|
||||
}
|
||||
|
||||
var attrs = model.attributes || model;
|
||||
this.set(attrs, _.extend({ validate: true }, options));
|
||||
|
||||
return this;
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Silent Updates
|
||||
|
||||
Consider using `silent: true` in options if you don't want to trigger change events during batch updates:
|
||||
|
||||
```javascript
|
||||
this.collection.add(members, {
|
||||
merge: true,
|
||||
silent: true
|
||||
});
|
||||
```
|
||||
|
||||
### 4. Error Handling
|
||||
|
||||
Wrap merge operations in try-catch blocks:
|
||||
|
||||
```javascript
|
||||
try {
|
||||
this.collection.add(member, { merge: true });
|
||||
} catch (e) {
|
||||
console.error('Failed to merge member:', e);
|
||||
// Handle error appropriately
|
||||
}
|
||||
```
|
||||
|
||||
## Testing the Fix
|
||||
|
||||
Here's a test case to verify the fix works correctly:
|
||||
|
||||
```javascript
|
||||
describe('Member Model', function() {
|
||||
it('should have updateFrom method', function() {
|
||||
var member = new Member({ id: 1, name: 'John' });
|
||||
expect(member.updateFrom).toBeDefined();
|
||||
expect(typeof member.updateFrom).toBe('function');
|
||||
});
|
||||
|
||||
it('should update attributes from another model', function() {
|
||||
var member1 = new Member({ id: 1, name: 'John', version: 1 });
|
||||
var member2 = new Member({ id: 1, name: 'John Doe', version: 2 });
|
||||
|
||||
member1.updateFrom(member2);
|
||||
|
||||
expect(member1.get('name')).toBe('John Doe');
|
||||
expect(member1.get('version')).toBe(2);
|
||||
});
|
||||
|
||||
it('should merge models in collection', function() {
|
||||
var collection = new MemberCollection([
|
||||
{ id: 1, name: 'John', version: 1 }
|
||||
]);
|
||||
|
||||
var updatedMember = new Member({ id: 1, name: 'John Doe', version: 2 });
|
||||
|
||||
// This should not throw an error
|
||||
expect(function() {
|
||||
collection.add(updatedMember, { merge: true });
|
||||
}).not.toThrow();
|
||||
|
||||
expect(collection.get(1).get('name')).toBe('John Doe');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Complete Example
|
||||
|
||||
A complete working example is available in [backbone-collection-merge-fix.js](./backbone-collection-merge-fix.js).
|
||||
|
||||
## Related Resources
|
||||
|
||||
- [Backbone.js Collection.add documentation](http://backbonejs.org/#Collection-add)
|
||||
- [Backbone.js Model.set documentation](http://backbonejs.org/#Model-set)
|
||||
- Stack Overflow: "Backbone Collection merge option"
|
||||
|
||||
## Issue Reference
|
||||
|
||||
**Fixes FORMBRICKS-RN**: This fix resolves the error `TypeError: Object [object Object] has no method 'updateFrom'` that occurs when using `Backbone.Collection.add()` with `merge: true` on models lacking the `updateFrom` method.
|
||||
+13
-5
@@ -54,10 +54,10 @@
|
||||
"@playwright/test": "1.58.2",
|
||||
"eslint": "8.57.1",
|
||||
"husky": "9.1.7",
|
||||
"lint-staged": "16.3.3",
|
||||
"lint-staged": "16.3.2",
|
||||
"rimraf": "6.1.3",
|
||||
"tsx": "4.21.0",
|
||||
"turbo": "2.8.16"
|
||||
"turbo": "2.8.13"
|
||||
},
|
||||
"lint-staged": {
|
||||
"(apps|packages)/**/*.{js,ts,jsx,tsx}": [
|
||||
@@ -73,7 +73,7 @@
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"packageManager": "pnpm@10.32.1",
|
||||
"packageManager": "pnpm@10.30.3",
|
||||
"nextBundleAnalysis": {
|
||||
"budget": 358400,
|
||||
"budgetPercentIncreaseRed": 20,
|
||||
@@ -83,14 +83,22 @@
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"axios": ">=1.12.2",
|
||||
"uuid": "11.1.0",
|
||||
"node-forge": ">=1.3.2",
|
||||
"tar-fs": "2.1.4",
|
||||
"tar": ">=7.5.11",
|
||||
"minimatch@~9.0": "9.0.9",
|
||||
"typeorm": ">=0.3.26",
|
||||
"systeminformation": "5.27.14",
|
||||
"qs": ">=6.14.1",
|
||||
"preact": ">=10.26.10",
|
||||
"fast-xml-parser": "5.4.2",
|
||||
"diff": ">=8.0.3"
|
||||
"diff": ">=8.0.3",
|
||||
"@isaacs/brace-expansion": ">=5.0.1",
|
||||
"@microsoft/api-extractor": ">=7.57.6"
|
||||
},
|
||||
"comments": {
|
||||
"overrides": "Security fixes for transitive dependencies. Remove when upstream packages update: axios (CVE-2025-58754) - awaiting @boxyhq/saml-jackson update | node-forge (Dependabot #230) - awaiting @boxyhq/saml-jackson update | tar (CVE-2026-23745/23950/24842/26960) - awaiting @boxyhq/saml-jackson/sqlite3 dependency updates | typeorm (Dependabot #223) - awaiting @boxyhq/saml-jackson update | fast-xml-parser (CVE-2026-25896/26278) - awaiting exact upstream pin updates | diff (Dependabot #269) - awaiting upstream patch range adoption"
|
||||
"overrides": "Security fixes for transitive dependencies. Remove when upstream packages update: axios (CVE-2025-58754) - awaiting @boxyhq/saml-jackson update | node-forge (Dependabot #230) - awaiting @boxyhq/saml-jackson update | tar-fs (Dependabot #205) - awaiting upstream dependency updates | tar (CVE-2026-23745/23950/24842/26960) - awaiting @boxyhq/saml-jackson/sqlite3 dependency updates | typeorm (Dependabot #223) - awaiting @boxyhq/saml-jackson update | systeminformation (Dependabot #241) - awaiting @opentelemetry/host-metrics update | qs (Dependabot #245) - awaiting googleapis-common and stripe updates | preact (Dependabot #247) - awaiting next-auth update | fast-xml-parser (CVE-2026-25896/26278) - awaiting @boxyhq/saml-jackson update | diff (Dependabot #269) - awaiting @microsoft/api-extractor update | @isaacs/brace-expansion (Dependabot #271) - awaiting upstream updates | @microsoft/api-extractor - overridden until vite-plugin-dts lock resolution catches up | minimatch (CVE-2026-26996/27903/27904) - awaiting upstream updates"
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"next-auth@4.24.13": "patches/next-auth@4.24.13.patch"
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@next/eslint-plugin-next": "15.5.12",
|
||||
"@typescript-eslint/eslint-plugin": "8.57.0",
|
||||
"@typescript-eslint/parser": "8.57.0",
|
||||
"@typescript-eslint/eslint-plugin": "8.56.1",
|
||||
"@typescript-eslint/parser": "8.56.1",
|
||||
"@vercel/style-guide": "6.0.0",
|
||||
"eslint-config-next": "15.5.12",
|
||||
"eslint-config-prettier": "10.1.8",
|
||||
"eslint-config-turbo": "2.8.16",
|
||||
"eslint-config-turbo": "2.8.12",
|
||||
"eslint-plugin-react": "7.37.5",
|
||||
"eslint-plugin-react-hooks": "5.2.0",
|
||||
"eslint-plugin-react-refresh": "0.5.2",
|
||||
"@vitest/eslint-plugin": "1.6.10"
|
||||
"eslint-plugin-react-refresh": "0.4.20",
|
||||
"@vitest/eslint-plugin": "1.6.9"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"clean": "rimraf node_modules dist turbo"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "25.4.0",
|
||||
"@types/node": "25.3.3",
|
||||
"@types/react": "19.2.14",
|
||||
"@types/react-dom": "19.2.3",
|
||||
"typescript": "5.9.3"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@formbricks/database",
|
||||
"packageManager": "pnpm@10.32.1",
|
||||
"packageManager": "pnpm@10.30.3",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"main": "./dist/index.cjs",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"clean": "rimraf .turbo node_modules dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-email/components": "1.0.9",
|
||||
"@react-email/components": "1.0.8",
|
||||
"react-email": "5.2.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
"devDependencies": {
|
||||
"@formbricks/config-typescript": "workspace:*",
|
||||
"@formbricks/eslint-config": "workspace:*",
|
||||
"@types/node": "^25.4.0",
|
||||
"@types/node": "^25.3.3",
|
||||
"tsx": "^4.21.0",
|
||||
"vite": "7.3.1",
|
||||
"vite-plugin-dts": "4.5.4",
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
"go": "vite build --watch --mode dev",
|
||||
"lint": "eslint . --ext .ts,.js,.tsx,.jsx",
|
||||
"clean": "rimraf .turbo node_modules dist coverage",
|
||||
"test": "vitest run",
|
||||
"test": "vitest",
|
||||
"test:coverage": "vitest run --coverage"
|
||||
},
|
||||
"author": "Formbricks <hola@formbricks.com>",
|
||||
|
||||
@@ -175,16 +175,6 @@ export const addPageUrlEventListeners = (): void => {
|
||||
window.dispatchEvent(event);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method -- We need to access the original method
|
||||
const originalReplaceState = history.replaceState;
|
||||
|
||||
// eslint-disable-next-line func-names -- We need an anonymous function here
|
||||
history.replaceState = function (...args) {
|
||||
originalReplaceState.apply(this, args);
|
||||
const event = new Event("replacestate");
|
||||
window.dispatchEvent(event);
|
||||
};
|
||||
|
||||
isHistoryPatched = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
removeExitIntentListener,
|
||||
removePageUrlEventListeners,
|
||||
removeScrollDepthListener,
|
||||
setIsHistoryPatched,
|
||||
} from "@/lib/survey/no-code-action";
|
||||
import { setIsSurveyRunning } from "@/lib/survey/widget";
|
||||
import { type TActionClassNoCodeConfig } from "@/types/survey";
|
||||
@@ -639,32 +638,6 @@ describe("addPageUrlEventListeners additional cases", () => {
|
||||
(window.addEventListener as Mock).mockRestore();
|
||||
dispatchEventSpy.mockRestore();
|
||||
});
|
||||
|
||||
test("patched history.replaceState dispatches a 'replacestate' event", () => {
|
||||
const addEventListenerMock = vi.fn();
|
||||
const removeEventListenerMock = vi.fn();
|
||||
const originalReplaceState = vi.fn();
|
||||
const dispatchEventMock = vi.fn();
|
||||
vi.stubGlobal("window", {
|
||||
addEventListener: addEventListenerMock,
|
||||
removeEventListener: removeEventListenerMock,
|
||||
dispatchEvent: dispatchEventMock,
|
||||
});
|
||||
vi.stubGlobal("history", { pushState: vi.fn(), replaceState: originalReplaceState });
|
||||
|
||||
// Reset patching state so addPageUrlEventListeners patches history fresh
|
||||
setIsHistoryPatched(false);
|
||||
removePageUrlEventListeners();
|
||||
addPageUrlEventListeners();
|
||||
|
||||
// Call the patched replaceState
|
||||
history.replaceState({}, "", "/replaced-url");
|
||||
|
||||
expect(originalReplaceState).toHaveBeenCalledWith({}, "", "/replaced-url");
|
||||
expect(dispatchEventMock).toHaveBeenCalledWith(expect.objectContaining({ type: "replacestate" }));
|
||||
|
||||
(window.addEventListener as Mock).mockRestore();
|
||||
});
|
||||
});
|
||||
|
||||
describe("removePageUrlEventListeners additional cases", () => {
|
||||
|
||||
@@ -37,9 +37,9 @@
|
||||
"author": "Formbricks <hola@formbricks.com>",
|
||||
"dependencies": {
|
||||
"@formbricks/logger": "workspace:*",
|
||||
"@aws-sdk/client-s3": "3.1007.0",
|
||||
"@aws-sdk/s3-presigned-post": "3.1007.0",
|
||||
"@aws-sdk/s3-request-presigner": "3.1007.0"
|
||||
"@aws-sdk/client-s3": "3.1002.0",
|
||||
"@aws-sdk/s3-presigned-post": "3.1002.0",
|
||||
"@aws-sdk/s3-request-presigner": "3.1002.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@formbricks/config-typescript": "workspace:*",
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
"preview": "vite preview",
|
||||
"clean": "rimraf .turbo node_modules dist coverage",
|
||||
"ui:add": "npx shadcn@latest add",
|
||||
"test": "vitest run",
|
||||
"test": "vitest",
|
||||
"test:coverage": "vitest run --coverage"
|
||||
},
|
||||
"peerDependencies": {
|
||||
@@ -77,7 +77,7 @@
|
||||
"class-variance-authority": "0.7.1",
|
||||
"clsx": "2.1.1",
|
||||
"date-fns": "4.1.0",
|
||||
"isomorphic-dompurify": "3.1.0",
|
||||
"isomorphic-dompurify": "3.0.0",
|
||||
"lucide-react": "0.577.0",
|
||||
"react-day-picker": "9.14.0",
|
||||
"tailwind-merge": "3.5.0"
|
||||
@@ -85,8 +85,8 @@
|
||||
"devDependencies": {
|
||||
"@formbricks/config-typescript": "workspace:*",
|
||||
"@formbricks/eslint-config": "workspace:*",
|
||||
"@storybook/react": "10.2.17",
|
||||
"@storybook/react-vite": "10.2.17",
|
||||
"@storybook/react": "10.2.15",
|
||||
"@storybook/react-vite": "10.2.15",
|
||||
"@tailwindcss/postcss": "4.2.1",
|
||||
"@tailwindcss/vite": "4.2.1",
|
||||
"@types/react": "19.2.14",
|
||||
|
||||
@@ -103,7 +103,7 @@ function Matrix({
|
||||
{/* Column headers */}
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="p-2 text-start" />
|
||||
<th className="p-2 text-left" />
|
||||
{columns.map((column) => (
|
||||
<th key={column.id} className="p-2 text-center font-normal">
|
||||
<Label className="justify-center">{column.label}</Label>
|
||||
@@ -130,9 +130,9 @@ function Matrix({
|
||||
disabled={disabled}
|
||||
aria-required={required}
|
||||
aria-invalid={Boolean(errorMessage)}>
|
||||
<tr className={cn("relative", baseBgColor)} dir={dir}>
|
||||
<tr className={cn("relative", baseBgColor)}>
|
||||
{/* Row label */}
|
||||
<th scope="row" className={cn("rounded-s-input p-2 align-middle")}>
|
||||
<th scope="row" className={cn("rounded-l-input p-2 align-middle")}>
|
||||
<div className="flex flex-col gap-0 leading-none">
|
||||
<Label>{row.label}</Label>
|
||||
</div>
|
||||
@@ -145,7 +145,7 @@ function Matrix({
|
||||
return (
|
||||
<td
|
||||
key={column.id}
|
||||
className={cn("p-2 text-center align-middle", isLastColumn && "rounded-e-input")}>
|
||||
className={cn("p-2 text-center align-middle", isLastColumn && "rounded-r-input")}>
|
||||
<Label htmlFor={cellId} className="flex cursor-pointer justify-center">
|
||||
<RadioGroupItem
|
||||
value={column.id}
|
||||
|
||||
@@ -45,11 +45,11 @@
|
||||
"dependencies": {
|
||||
"@calcom/embed-snippet": "1.3.3",
|
||||
"@formbricks/survey-ui": "workspace:*",
|
||||
"i18next": "25.8.18",
|
||||
"i18next": "25.8.14",
|
||||
"i18next-icu": "2.4.3",
|
||||
"isomorphic-dompurify": "3.1.0",
|
||||
"preact": "10.29.0",
|
||||
"react-i18next": "16.5.8"
|
||||
"isomorphic-dompurify": "3.0.0",
|
||||
"preact": "10.28.4",
|
||||
"react-i18next": "16.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@formbricks/config-typescript": "workspace:*",
|
||||
|
||||
@@ -19,12 +19,10 @@ export const ZOrganizationStripeBilling = z.object({
|
||||
plan: ZCloudBillingPlan.optional(),
|
||||
subscriptionStatus: ZOrganizationStripeSubscriptionStatus.nullable().optional(),
|
||||
subscriptionId: z.string().nullable().optional(),
|
||||
hasPaymentMethod: z.boolean().optional(),
|
||||
features: z.array(z.string()).optional(),
|
||||
lastStripeEventCreatedAt: z.string().nullable().optional(),
|
||||
lastSyncedAt: z.string().nullable().optional(),
|
||||
lastSyncedEventId: z.string().nullable().optional(),
|
||||
trialEnd: z.string().nullable().optional(),
|
||||
});
|
||||
export type TOrganizationStripeBilling = z.infer<typeof ZOrganizationStripeBilling>;
|
||||
|
||||
|
||||
Generated
+1210
-1026
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user