The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
add abTesting flag
Kiran Kc09d651e31b1
diff --git a/apps/web/lib/edge-config/get-feature-flags.ts b/apps/web/lib/edge-config/get-feature-flags.tsindex c85d427942..b969d2a9a9 100644--- a/apps/web/lib/edge-config/get-feature-flags.ts+++ b/apps/web/lib/edge-config/get-feature-flags.ts@@ -18,6 +18,7 @@ export const getFeatureFlags = async ({const workspaceFeatures: Record<BetaFeatures, boolean> = {noDubLink: false,linkFolders: false,+ abTesting: false,};if (!process.env.NEXT_PUBLIC_IS_DUB || !process.env.EDGE_CONFIG) {diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.tsindex f681be4533..11b3bfb9a6 100644--- a/apps/web/lib/types.ts+++ b/apps/web/lib/types.ts@@ -39,7 +39,10 @@ import {leadEventResponseSchema,trackLeadResponseSchema,} from "./zod/schemas/leads";-import { createLinkBodySchema, ABTestVariantsSchema } from "./zod/schemas/links";+import {+ ABTestVariantsSchema,+ createLinkBodySchema,+} from "./zod/schemas/links";import { createOAuthAppSchema, oAuthAppSchema } from "./zod/schemas/oauth";import {createPartnerSchema,@@ -134,7 +137,7 @@ export type PlanProps = (typeof plans)[number];export type RoleProps = (typeof roles)[number];-export type BetaFeatures = "noDubLink" | "linkFolders";+export type BetaFeatures = "noDubLink" | "linkFolders" | "abTesting";export interface WorkspaceProps extends Project {logo: string | null;diff --git a/apps/web/ui/modals/link-builder/constants.ts b/apps/web/ui/modals/link-builder/constants.tsindex 11a0c8511e..1dbca95e83 100644--- a/apps/web/ui/modals/link-builder/constants.ts+++ b/apps/web/ui/modals/link-builder/constants.ts@@ -100,7 +100,7 @@ export const MOBILE_MORE_ITEMS: MoreItem[] = [{key: "testVariants",icon: Flask,- label: "A/B Testing",+ label: "A/B Test",badgeLabel: getABTestingLabel,shortcutKey: "b",enabled: (data) => Boolean(data.testVariants && data.testCompletedAt),diff --git a/apps/web/ui/modals/link-builder/index.tsx b/apps/web/ui/modals/link-builder/index.tsxindex 2e894c1a96..2425d061e7 100644--- a/apps/web/ui/modals/link-builder/index.tsx+++ b/apps/web/ui/modals/link-builder/index.tsx@@ -223,7 +223,7 @@ function LinkBuilderInner({<><UTMModal /><TargetingModal />- {conversionsEnabled && <ABTestingModal />}+ {conversionsEnabled && flags?.abTesting && <ABTestingModal />}<PasswordModal /><ExpirationModal /><Modal@@ -524,7 +524,9 @@ function LinkBuilderInner({<UTMButton /><div className="flex items-center gap-2 max-sm:hidden"><TargetingButton />- {conversionsEnabled && <ABTestingButton />}+ {conversionsEnabled && flags?.abTesting && (+ <ABTestingButton />+ )}<PasswordButton /><ExpirationButton /></div>diff --git a/apps/web/ui/modals/link-builder/more-dropdown.tsx b/apps/web/ui/modals/link-builder/more-dropdown.tsxindex 4c4db8bd88..071271ea6f 100644--- a/apps/web/ui/modals/link-builder/more-dropdown.tsx+++ b/apps/web/ui/modals/link-builder/more-dropdown.tsx@@ -1,3 +1,4 @@+import useWorkspace from "@/lib/swr/use-workspace";import { ProBadgeTooltip } from "@/ui/shared/pro-badge-tooltip";import {Button,@@ -20,6 +21,7 @@ import { useTargetingModal } from "./targeting-modal";import { useWebhooksModal } from "./webhooks-modal";export function MoreDropdown() {+ const { flags } = useWorkspace();const { isMobile } = useMediaQuery();const { watch, setValue } = useFormContext<LinkFormData>();@@ -28,8 +30,10 @@ export function MoreDropdown() {const [openPopover, setOpenPopover] = useState(false);const options = useMemo(() => {- return [...(isMobile ? MOBILE_MORE_ITEMS : []), ...MORE_ITEMS];- }, [data, isMobile]);+ return [...(isMobile ? MOBILE_MORE_ITEMS : []), ...MORE_ITEMS].filter(+ (option) => (option.key === "testVariants" ? flags?.abTesting : true),+ );+ }, [data, isMobile, flags]);const { ABTestingModal, setShowABTestingModal } = useABTestingModal();const { PasswordModal, setShowPasswordModal } = usePasswordModal();