Skip to content

Commit 6e9c5a3

Browse files
committed
Support saving without branding
Fix unsaved changes text persisting after saving without branding
1 parent f534cb7 commit 6e9c5a3

4 files changed

Lines changed: 65 additions & 1 deletion

File tree

services/backend-api/client/src/features/templates/components/TemplateGalleryModal/UpgradePrompt.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface UpgradePromptProps {
2828
isPaddleLoaded?: boolean;
2929
onCheckout: (priceId: string) => void;
3030
onBackToEditor: () => void;
31+
onSaveWithoutBranding: () => void;
3132
}
3233

3334
export const UpgradePrompt = ({
@@ -39,6 +40,7 @@ export const UpgradePrompt = ({
3940
isPaddleLoaded,
4041
onCheckout,
4142
onBackToEditor,
43+
onSaveWithoutBranding,
4244
}: UpgradePromptProps) => {
4345
return (
4446
<Box
@@ -74,7 +76,7 @@ export const UpgradePrompt = ({
7476
(f) =>
7577
f.name === ProductFeature.Webhooks ||
7678
f.name === ProductFeature.Feeds ||
77-
f.name === ProductFeature.RefreshRate
79+
f.name === ProductFeature.RefreshRate,
7880
)
7981
.map((feature) => (
8082
<HStack as="li" key={feature.name} spacing={2}>
@@ -141,6 +143,9 @@ export const UpgradePrompt = ({
141143
>
142144
Get {PRODUCT_NAMES[ProductKey.Tier1]}
143145
</Button>
146+
<Button variant="outline" size="sm" mb={2} onClick={onSaveWithoutBranding}>
147+
Save without branding
148+
</Button>
144149
<Box mb={4}>
145150
<ChakraLink fontSize="sm" color="whiteAlpha.700" onClick={onBackToEditor} cursor="pointer">
146151
Back to editor

services/backend-api/client/src/features/templates/components/TemplateGalleryModal/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,14 @@ const TemplateGalleryModalInner = (props: TemplateGalleryModalProps) => {
343343
});
344344
}}
345345
onBackToEditor={() => setModalView("editor")}
346+
onSaveWithoutBranding={() => {
347+
clearBranding();
348+
if (props.mode === "editor") {
349+
props.onSave();
350+
} else if (selectedTemplateId) {
351+
props.onPrimaryAction(selectedTemplateId);
352+
}
353+
}}
346354
/>
347355
);
348356

services/backend-api/client/src/pages/MessageBuilder.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,11 @@ const MessageBuilderContent: React.FC = () => {
324324
details: connectionDetails,
325325
});
326326

327+
if (!webhooksAllowed) {
328+
setBrandingDisplayName(existingWebhookName);
329+
setBrandingAvatarUrl(existingWebhookIconUrl);
330+
}
331+
327332
createSuccessAlert({
328333
title: "Successfully saved message format",
329334
description: "Your Discord message format has been updated.",

services/backend-api/e2e/tests/13-branding-fields.spec.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ test.describe("Branding Fields - Template Gallery Modal", () => {
169169
upgradeRegion.getByText(/Payments handled by Paddle/),
170170
).toBeVisible();
171171

172+
// Verify "Save without branding" button is visible on upgrade prompt
173+
await expect(
174+
upgradeRegion.getByRole("button", { name: "Save without branding" }),
175+
).toBeVisible();
176+
172177
// Verify "Back to editor" link works
173178
await upgradeRegion.getByText("Back to editor").click();
174179
await expect(upgradeRegion).not.toBeVisible();
@@ -192,6 +197,47 @@ test.describe("Branding Fields - Template Gallery Modal", () => {
192197
await expect(paddleFrame.first()).toBeVisible({ timeout: 15000 });
193198
});
194199

200+
test("saves without branding from upgrade prompt screen", async ({
201+
page,
202+
testFeed,
203+
}) => {
204+
const serverName = getTestServerName();
205+
const channelName = getTestChannelName();
206+
207+
test.skip(
208+
!serverName || !channelName,
209+
"serverName and channelName must be configured in e2econfig.json",
210+
);
211+
212+
const modal = await navigateToTemplateModal(
213+
page,
214+
testFeed.id,
215+
serverName!,
216+
channelName!,
217+
);
218+
219+
// Fill branding then go to upgrade prompt
220+
await modal.getByLabel("Display Name").fill("My Custom Bot");
221+
await modal
222+
.getByRole("button", { name: "Upgrade to save with branding" })
223+
.click();
224+
225+
const upgradeRegion = modal.getByRole("region", {
226+
name: "Upgrade to save custom branding",
227+
});
228+
await expect(upgradeRegion).toBeVisible();
229+
230+
// Click "Save without branding" on the upgrade prompt
231+
await upgradeRegion
232+
.getByRole("button", { name: "Save without branding" })
233+
.click();
234+
235+
// Connection should save successfully
236+
await expect(page.getByText("You're all set")).toBeVisible({
237+
timeout: 10000,
238+
});
239+
});
240+
195241
test("saves without branding when clicking save without branding", async ({
196242
page,
197243
testFeed,

0 commit comments

Comments
 (0)