Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const SecuritySettingsPage: FC = () => {

<SecuritySettingsPageView
options={deploymentConfig.options}
isBrowserOnlyEntitled={
entitlements.features.browser_only.entitlement !== "not_entitled"
}
featureBrowserOnlyEnabled={entitlements.features.browser_only.enabled}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const meta: Meta<typeof SecuritySettingsPageView> = {
hidden: false,
},
],
isBrowserOnlyEntitled: true,
featureBrowserOnlyEnabled: true,
},
};
Expand All @@ -66,6 +67,50 @@ export const Page: Story = {
"href",
docs("/admin/networking#browser-only-connections"),
);
await expect(
canvas.getByRole("heading", {
name: /Browser-Only Connections Enabled/,
}),
).toBeInTheDocument();
await expect(
canvas.queryByRole("link", { name: /Start trial for free/ }),
).not.toBeInTheDocument();
},
};

export const EntitledAndTurnedOff: Story = {
args: {
isBrowserOnlyEntitled: true,
featureBrowserOnlyEnabled: false,
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await expect(
canvas.getByRole("heading", {
name: /Browser-Only Connections Disabled/,
}),
).toBeInTheDocument();
await expect(
canvas.queryByRole("link", { name: /Start trial for free/ }),
).not.toBeInTheDocument();
},
};

export const NotEntitled: Story = {
args: {
isBrowserOnlyEntitled: false,
featureBrowserOnlyEnabled: false,
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await expect(
canvas.getByRole("heading", {
name: /Browser-Only Connections Disabled/,
}),
).toBeInTheDocument();
await expect(
canvas.getByRole("link", { name: /Start trial for free/ }),
).toBeInTheDocument();
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ import OptionsTable from "../OptionsTable";

type SecuritySettingsPageViewProps = {
options: SerpentOption[];
/** True when the license covers browser-only connections. */
isBrowserOnlyEntitled: boolean;
/** True when the deployment has browser-only connections turned on. */
featureBrowserOnlyEnabled: boolean;
};

export const SecuritySettingsPageView: FC<SecuritySettingsPageViewProps> = ({
options,
isBrowserOnlyEntitled,
featureBrowserOnlyEnabled,
}) => {
const tlsOptions = options.filter((o) =>
Expand Down Expand Up @@ -78,7 +82,7 @@ export const SecuritySettingsPageView: FC<SecuritySettingsPageViewProps> = ({
</SettingsHeaderDescription>
</SettingsHeader>

{!featureBrowserOnlyEnabled ? (
{!isBrowserOnlyEntitled ? (
<PremiumPaywallSmall
source="browser_only"
message="Browser-Only Connections"
Expand Down
Loading