Skip to content

Commit 631743b

Browse files
authored
feat: remove free domains (#5426)
<img width="357" height="297" alt="Screenshot 2025-10-15 at 11 54 23" src="https://github.com/user-attachments/assets/f4fa0c5f-89b4-4f9b-9152-bf339c2e8f55" />
1 parent 4640cea commit 631743b

File tree

5 files changed

+20
-109
lines changed

5 files changed

+20
-109
lines changed

apps/builder/app/builder/features/topbar/publish.tsx

Lines changed: 16 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ import {
5555
$instances,
5656
$pages,
5757
$project,
58-
$propsIndex,
5958
$publishedOrigin,
6059
$userPlanFeatures,
6160
} from "~/shared/nano-states";
@@ -78,7 +77,6 @@ import { AddDomain } from "./add-domain";
7877
import { humanizeString } from "~/shared/string-utils";
7978
import { trpcClient, nativeClient } from "~/shared/trpc/trpc-client";
8079
import {
81-
findTreeInstanceIds,
8280
isPathnamePattern,
8381
parseComponentName,
8482
type Templates,
@@ -87,10 +85,6 @@ import { DomainCheckbox, domainToPublishName } from "./domain-checkbox";
8785
import { CopyToClipboard } from "~/builder/shared/copy-to-clipboard";
8886
import { $openProjectSettings } from "~/shared/nano-states/project-settings";
8987
import { RelativeTime } from "~/builder/shared/relative-time";
90-
import { showAttribute } from "@webstudio-is/react-sdk";
91-
import { type CssProperty } from "@webstudio-is/css-engine";
92-
import { getComputedStyleDecl } from "~/shared/style-object-model";
93-
import { $styleObjectModel } from "../style-panel/shared/model";
9488
import cmsUpgradeBanner from "../settings-panel/cms-upgrade-banner.svg?url";
9589

9690
type ChangeProjectDomainProps = {
@@ -243,8 +237,8 @@ const ChangeProjectDomain = ({
243237
};
244238

245239
const $usedProFeatures = computed(
246-
[$pages, $dataSources, $instances, $propsIndex, $styleObjectModel],
247-
(pages, dataSources, instances, propsIndex, styleObjectModel) => {
240+
[$pages, $dataSources, $instances],
241+
(pages, dataSources, instances) => {
248242
const features = new Map<
249243
string,
250244
| undefined
@@ -291,90 +285,9 @@ const $usedProFeatures = computed(
291285
}
292286
}
293287

294-
const badgeFeature = 'No "Built with Webstudio" badge';
295-
// Badge should be rendered on free sites on every page.
296-
features.set(badgeFeature, {
297-
info: (
298-
<Text>
299-
Adding the badge to your "home" page helps us offer a free version of
300-
the service. Please open the Components panel by clicking the “+” icon
301-
on the left, and add the “Built with Webstudio” component to your
302-
page.
303-
<br />
304-
- Feel free to adjust the badge's style to match your design - after
305-
all, it's just a link, and you can place it wherever you like.
306-
<br />
307-
- Please don’t add that badge to every page, because search engines
308-
will view it negatively.
309-
<br />- Hiding the link in any way is considered a violation of the
310-
terms.
311-
</Text>
312-
),
313-
});
314-
// We want to check the badge only on the home page
315-
const homePageInstanceIds = findTreeInstanceIds(
316-
instances,
317-
pages.homePage.rootInstanceId
318-
);
319-
for (const instanceId of homePageInstanceIds) {
320-
const instance = instances.get(instanceId);
321-
// Find a potential link that looks like a badge.
322-
if (instance?.tag === "a") {
323-
const props = propsIndex.propsByInstanceId.get(instance.id);
324-
let hasWsHref = false;
325-
let highTrust = true;
326-
let show = true;
327-
328-
for (const prop of props ?? []) {
329-
if (
330-
prop.name === "href" &&
331-
prop.type === "string" &&
332-
prop.value.includes("https://webstudio.is")
333-
) {
334-
hasWsHref = true;
335-
}
336-
if (prop.name === "rel" && prop.type === "string") {
337-
if (
338-
prop.value.includes("nofollow") ||
339-
prop.value.includes("ugc") ||
340-
prop.value.includes("sponsored")
341-
) {
342-
highTrust = false;
343-
}
344-
}
345-
if (prop.name === showAttribute) {
346-
show = prop.type === "boolean" && prop.value;
347-
}
348-
}
349-
350-
const getValue = (property: CssProperty) => {
351-
const value = getComputedStyleDecl({
352-
model: styleObjectModel,
353-
instanceSelector: [instance.id],
354-
property,
355-
}).usedValue;
356-
return "value" in value ? value.value : undefined;
357-
};
358-
359-
// Check styles.
360-
if (
361-
getValue("display") === "none" ||
362-
getValue("visibility") === "hidden" ||
363-
getValue("opacity") === 0 ||
364-
getValue("width") === 0 ||
365-
getValue("height") === 0
366-
) {
367-
show = false;
368-
}
369-
370-
// @todo check all parents
371-
if (hasWsHref && highTrust && show) {
372-
features.delete(badgeFeature);
373-
break;
374-
}
375-
}
376-
}
377-
return features;
288+
// temporary ignore features checks
289+
// return features;
290+
return new Map() as typeof features;
378291
}
379292
);
380293

@@ -792,7 +705,7 @@ const buttonLinkClass = css({
792705

793706
const UpgradeBanner = () => {
794707
const usedProFeatures = useStore($usedProFeatures);
795-
const { canAddDomain, maxDomainsAllowedPerUser } = useCanAddDomain();
708+
const { canAddDomain } = useCanAddDomain();
796709
const { userPublishCount, maxPublishesAllowedPerUser } =
797710
useUserPublishCount();
798711

@@ -875,24 +788,22 @@ const UpgradeBanner = () => {
875788
if (canAddDomain === false) {
876789
return (
877790
<PanelBanner>
878-
<Text variant="regularBold">Free domains limit reached</Text>
879791
<Text variant="regular">
880-
You have reached the limit of {maxDomainsAllowedPerUser} custom
881-
domains on your account.{" "}
882792
<Text variant="regularBold" inline>
883793
Upgrade to a Pro account
884794
</Text>{" "}
885795
to add unlimited domains and publish to each domain individually.
886796
</Text>
887-
<Link
888-
className={buttonStyle({ color: "gradient" })}
889-
color="contrast"
890-
underline="none"
891-
href="https://webstudio.is/pricing"
892-
target="_blank"
893-
>
894-
Upgrade
895-
</Link>
797+
<Flex align="center" gap={1}>
798+
<UpgradeIcon />
799+
<Link
800+
color="inherit"
801+
target="_blank"
802+
href="https://webstudio.is/pricing"
803+
>
804+
Upgrade to Pro
805+
</Link>
806+
</Flex>
896807
</PanelBanner>
897808
);
898809
}

apps/builder/app/dashboard/dashboard.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const userPlanFeatures: UserPlanFeatures = {
3131
allowShareAdminLinks: false,
3232
allowDynamicData: false,
3333
maxContactEmails: 0,
34-
maxDomainsAllowedPerUser: 1,
34+
maxDomainsAllowedPerUser: 0,
3535
maxPublishesAllowedPerUser: 1,
3636
};
3737

apps/builder/app/shared/db/user-plan-features.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const getUserPlanFeatures = async (
8585
allowShareAdminLinks: false,
8686
allowDynamicData: false,
8787
maxContactEmails: 0,
88-
maxDomainsAllowedPerUser: 1,
88+
maxDomainsAllowedPerUser: 0,
8989
maxPublishesAllowedPerUser: 10,
9090
hasSubscription: false,
9191
hasProPlan: false,

apps/builder/app/shared/nano-states/misc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export const $userPlanFeatures = atom<UserPlanFeatures>({
315315
allowShareAdminLinks: false,
316316
allowDynamicData: false,
317317
maxContactEmails: 0,
318-
maxDomainsAllowedPerUser: 1,
318+
maxDomainsAllowedPerUser: 0,
319319
maxPublishesAllowedPerUser: 1,
320320
hasSubscription: false,
321321
hasProPlan: false,

packages/domain/src/db/domain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const create = async (
4949
return {
5050
success: false,
5151
error:
52-
"You have reached the maximum number of allowed domains. Please upgrade to the Pro plan or higher.",
52+
"You have reached the maximum number of allowed domains. Please upgrade to the Pro plan or higher to add unlimited domains.",
5353
};
5454
}
5555

0 commit comments

Comments
 (0)