#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Re-add feedback system to app (#8727)
James Brunton4254ada13c59
diff --git a/app/common/src/main/java/stirling/software/common/model/ApplicationProperties.java b/app/common/src/main/java/stirling/software/common/model/ApplicationProperties.javaindex ea71baa940..e241399bc2 100644--- a/app/common/src/main/java/stirling/software/common/model/ApplicationProperties.java+++ b/app/common/src/main/java/stirling/software/common/model/ApplicationProperties.java@@ -1333,6 +1333,7 @@ public class ApplicationProperties {private Boolean enableScarf;private Boolean enableDesktopInstallSlide = true;private boolean enableEasterEggs = true;+ private boolean enableFeedback = true;private Datasource datasource;private boolean disableSanitize;private boolean stirlingOfficeConversion;diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ConfigController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ConfigController.javaindex c143ca5b1a..3d86667b65 100644--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ConfigController.java+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/misc/ConfigController.java@@ -346,6 +346,7 @@ public class ConfigController {applicationProperties.getSystem().getEnableDesktopInstallSlide());configData.put("enableEasterEggs", applicationProperties.getSystem().isEnableEasterEggs());+ configData.put("enableFeedback", applicationProperties.getSystem().isEnableFeedback());// Premium/Enterprise settingsconfigData.put("premiumEnabled", Boolean.TRUE.equals(isRunningProOrHigher()));diff --git a/app/core/src/main/resources/settings.yml.template b/app/core/src/main/resources/settings.yml.templateindex 33abf4b12b..ee78cd760e 100644--- a/app/core/src/main/resources/settings.yml.template+++ b/app/core/src/main/resources/settings.yml.template@@ -183,6 +183,7 @@ system:enableAnalytics: null # Master toggle for analytics: set to 'true' to enable all analytics, 'false' to disable all analytics, or leave as 'null' to prompt admin on first launchenableDesktopInstallSlide: true # Set to 'false' to hide the desktop app installation slide in the onboarding flowenableEasterEggs: true # Set to 'false' to remove the app's hidden novelty features+ enableFeedback: true # Set to 'false' to disable ability to send feedback to Stirling from the appenablePosthog: null # Enable PostHog analytics (open-source product analytics): set to 'true' to enable, 'false' to disable, or 'null' to enable by default when analytics is enabledenableScarf: null # Enable Scarf tracking pixel: set to 'true' to enable, 'false' to disable, or 'null' to enable by default when analytics is enabledenableUrlToPDF: false # Set to 'true' to enable URL to PDF, INTERNAL ONLY, known security issues, should not be used externallydiff --git a/frontend/.env b/frontend/.envindex 277b034861..1d98bf204f 100644--- a/frontend/.env+++ b/frontend/.env@@ -31,5 +31,8 @@ VITE_STRIPE_PUBLISHABLE_KEY=pk_live_51Q56W2P9mY5IAnSnp3kcxG50uyFMLuhM4fFs774DAP3VITE_PUBLIC_POSTHOG_KEY=phc_VOdeYnlevc2T63m3myFGjeBlRcIusRgmhfx6XL5a1izVITE_PUBLIC_POSTHOG_HOST=https://eu.i.posthog.com+# Where the app's feedback entry points send people; leave blank for none+VITE_FEEDBACK_URL=https://stirling.com/app/feedback+# Calendly scheduling link (portal "Schedule a call")VITE_CALENDLY_URL=https://calendly.com/d/cm4p-zz5-yy8/stirling-pdf-15-minute-group-discussiondiff --git a/frontend/public/locales/en-US/translation.toml b/frontend/public/locales/en-US/translation.tomlindex 3c9318e524..3aa356f010 100644--- a/frontend/public/locales/en-US/translation.toml+++ b/frontend/public/locales/en-US/translation.toml@@ -1328,6 +1328,10 @@ label = "Watched Folders Directories"description = "The default language for new users (e.g., en_US, es_ES)"label = "Default Locale"+[admin.settings.general.enableFeedback]+description = "Let users send feedback to the Stirling team"+label = "Enable Feedback"+[admin.settings.general.fileUploadLimit]description = "Maximum file upload size (e.g., 100MB, 1GB)"label = "File Upload Limit"@@ -4649,6 +4653,17 @@ title = "Settings"[extractPages.tooltip]description = "Extracts the selected pages into a new PDF, preserving order."+[feedback.page]+open = "Send feedback"+sendMore = "Send more feedback"+sent = "Thanks for your feedback"+title = "Help us improve Stirling"+unavailable = "Feedback is unavailable"++[feedback.tag]+dismiss = "Hide the feedback button"+label = "Feedback"+[fileCard]openInFileEditor = "Open in File Editor"viewInViewer = "View in Viewer"@@ -12023,6 +12038,13 @@ apiKeys = "API Keys"apiKeysDescription = "Personal keys for calling the Stirling API from scripts and integrations."title = "Developer"+[settings.feedback]+label = "Feedback"++[settings.feedback.send]+description = "Report a problem or suggest an improvement to the Stirling team."+label = "Send feedback"+[settings.general]autoUnzip = "Auto-unzip API responses"autoUnzipFileLimit = "Auto-unzip file limit"diff --git a/frontend/public/og-metadata.json b/frontend/public/og-metadata.jsonindex 66c7dbce18..8185278f9e 100644--- a/frontend/public/og-metadata.json+++ b/frontend/public/og-metadata.json@@ -608,6 +608,12 @@"description": "A free, private PDF editor you can run on any infrastructure.","noindex": true},+ "/settings/feedback": {+ "image": "/og_images/home.png",+ "title": "Feedback Settings - Stirling PDF",+ "description": "A free, private PDF editor you can run on any infrastructure.",+ "noindex": true+ },"/settings/legal": {"image": "/og_images/home.png","title": "Legal Settings - Stirling PDF",@@ -927,6 +933,7 @@"/settings/adminAiLimits": "/settings/adminAiLimits","/settings/adminAi": "/settings/adminAi","/settings/help": "/settings/help",+ "/settings/feedback": "/settings/feedback","/settings/legal": "/settings/legal","/settings/backendThirdPartyLicenses": "/settings/backendThirdPartyLicenses","/settings/frontendThirdPartyLicenses": "/settings/frontendThirdPartyLicenses",diff --git a/frontend/public/og-metadata.saas.json b/frontend/public/og-metadata.saas.jsonindex 976b387d46..fa8ff83bd2 100644--- a/frontend/public/og-metadata.saas.json+++ b/frontend/public/og-metadata.saas.json@@ -610,6 +610,12 @@"description": "A free, private PDF editor you can run on any infrastructure.","noindex": true},+ "/settings/feedback": {+ "image": "/og_images/home.png",+ "title": "Feedback Settings - Stirling PDF",+ "description": "A free, private PDF editor you can run on any infrastructure.",+ "noindex": true+ },"/settings/legal": {"image": "/og_images/home.png","title": "Legal Settings - Stirling PDF",@@ -935,6 +941,7 @@"/settings/adminAiLimits": "/settings/adminAiLimits","/settings/adminAi": "/settings/adminAi","/settings/help": "/settings/help",+ "/settings/feedback": "/settings/feedback","/settings/legal": "/settings/legal","/settings/backendThirdPartyLicenses": "/settings/backendThirdPartyLicenses","/settings/frontendThirdPartyLicenses": "/settings/frontendThirdPartyLicenses",diff --git a/frontend/src/editor/core/components/feedback/FeedbackTag.module.css b/frontend/src/editor/core/components/feedback/FeedbackTag.module.cssnew file mode 100644index 0000000000..43be74ab6f--- /dev/null+++ b/frontend/src/editor/core/components/feedback/FeedbackTag.module.css@@ -0,0 +1,60 @@+.tag {+ position: absolute;+ /* A page's 1.5rem padding inside its scrollbar gutter. */+ right: calc(var(--space-6) + var(--space-4));+ bottom: 0;+ z-index: 20;+ display: flex;+ align-items: stretch;+ border: 1px solid var(--c-border);+ border-bottom: none;+ border-radius: 6px 6px 0 0;+ background: var(--c-surface);+ color: var(--c-text-muted);+ box-shadow: 0 -1px 4px rgb(0 0 0 / 6%);+ overflow: hidden;+}++.open,+.dismiss {+ display: flex;+ align-items: center;+ border: none;+ background: transparent;+ color: inherit;+ font: inherit;+ cursor: pointer;+}++.open:hover,+.dismiss:hover {+ background: var(--c-hover);+ color: var(--c-text);+}++.open {+ gap: var(--space-1_5);+ height: 1.625rem;+ padding: 0 var(--space-1) 0 0.625rem;+ font-size: 0.75rem;+ font-weight: 600;+ letter-spacing: 0.01em;+}++.dismiss {+ padding: 0 var(--space-2) 0 var(--space-1);+ opacity: 0.75;+}++.dismiss:hover {+ opacity: 1;+}++/* The mark's two paths are filled by class, not currentColor. */+.mark :global(.sui-brandmark__a) {+ fill: var(--c-brand-mark-soft);+}++.mark :global(.sui-brandmark__b) {+ fill: var(--c-brand-mark);+}diff --git a/frontend/src/editor/core/components/feedback/FeedbackTag.test.tsx b/frontend/src/editor/core/components/feedback/FeedbackTag.test.tsxnew file mode 100644index 0000000000..4c2598a3a8--- /dev/null+++ b/frontend/src/editor/core/components/feedback/FeedbackTag.test.tsx@@ -0,0 +1,71 @@+import { fireEvent, render, screen } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { AppConfigProvider } from "@editor/contexts/AppConfigContext";+import { PreferencesProvider } from "@editor/contexts/PreferencesContext";+import { preferencesService } from "@editor/services/preferencesService";+import { FeedbackTag } from "@editor/components/feedback/FeedbackTag";++const openFeedback = vi.fn();++vi.mock("@editor/hooks/useOpenFeedback", () => ({+ useOpenFeedback: () => openFeedback,+}));++vi.mock("@editor/hooks/useIsMobile", () => ({+ useIsPhone: () => false,+}));++function renderTag(enableFeedback: boolean) {+ const client = new QueryClient({+ defaultOptions: { queries: { retry: false } },+ });+ return render(+ <QueryClientProvider client={client}>+ <AppConfigProvider autoFetch={false} initialConfig={{ enableFeedback }}>+ <PreferencesProvider>+ <FeedbackTag />+ </PreferencesProvider>+ </AppConfigProvider>+ </QueryClientProvider>,+ );+}++describe("FeedbackTag", () => {+ beforeEach(() => {+ localStorage.clear();+ openFeedback.mockClear();+ });++ afterEach(() => {+ localStorage.clear();+ });++ it("opens feedback when clicked", () => {+ renderTag(true);+ fireEvent.click(screen.getByRole("button", { name: "feedback.tag.label" }));+ expect(openFeedback).toHaveBeenCalledOnce();+ });++ it("renders nothing when the server has turned feedback off", () => {+ const { container } = renderTag(false);+ expect(container).toBeEmptyDOMElement();+ });++ it("stays hidden after being dismissed", () => {+ const { unmount } = renderTag(true);+ fireEvent.click(+ screen.getByRole("button", { name: "feedback.tag.dismiss" }),+ );+ expect(+ screen.queryByRole("button", { name: "feedback.tag.label" }),+ ).toBeNull();+ expect(preferencesService.getPreference("hasDismissedFeedbackTag")).toBe(+ true,+ );++ unmount();+ const { container } = renderTag(true);+ expect(container).toBeEmptyDOMElement();+ });+});diff --git a/frontend/src/editor/core/components/feedback/FeedbackTag.tsx b/frontend/src/editor/core/components/feedback/FeedbackTag.tsxnew file mode 100644index 0000000000..b46aea2e0c--- /dev/null+++ b/frontend/src/editor/core/components/feedback/FeedbackTag.tsx@@ -0,0 +1,43 @@+import { useTranslation } from "react-i18next";+import { Icon } from "@editor/ui/Icon";+import { usePreferences } from "@editor/contexts/PreferencesContext";+import { useFeedback } from "@editor/hooks/useFeedback";+import { useIsPhone } from "@editor/hooks/useIsMobile";+import styles from "@editor/components/feedback/FeedbackTag.module.css";++/**+ * Tab on the bottom edge of the workbench that opens feedback. Must render+ * inside a positioned container. Dismissing it is permanent for this browser;+ * Settings keeps an entry that cannot be dismissed.+ */+export function FeedbackTag() {+ const { t } = useTranslation();+ const openFeedback = useFeedback();+ const { preferences, updatePreference } = usePreferences();+ const isPhone = useIsPhone();++ // A phone has no edge to spare for it.+ if (!openFeedback || preferences.hasDismissedFeedbackTag || isPhone) {+ return null;+ }++ const dismissLabel = t("feedback.tag.dismiss", "Hide the feedback button");++ return (+ <div className={styles.tag}>+ <button type="button" className={styles.open} onClick={openFeedback}>+ <Icon name="stirling-mark" size="0.875rem" className={styles.mark} />+ {t("feedback.tag.label", "Feedback")}+ </button>+ <button+ type="button"+ className={styles.dismiss}+ onClick={() => updatePreference("hasDismissedFeedbackTag", true)}+ aria-label={dismissLabel}+ title={dismissLabel}+ >+ <Icon name="x" size="0.75rem" />+ </button>+ </div>+ );+}diff --git a/frontend/src/editor/core/components/home/HomePageExtensions.tsx b/frontend/src/editor/core/components/home/HomePageExtensions.tsxdeleted file mode 100644index 5bc8194a77..0000000000--- a/frontend/src/editor/core/components/home/HomePageExtensions.tsx+++ /dev/null@@ -1,7 +0,0 @@-/**- * Core stub for HomePage extensions.- */--export function HomePageExtensions() {- return null;-}diff --git a/frontend/src/editor/core/components/layout/Workbench.tsx b/frontend/src/editor/core/components/layout/Workbench.tsxindex cb7d8819d5..8ca423a6c4 100644--- a/frontend/src/editor/core/components/layout/Workbench.tsx+++ b/frontend/src/editor/core/components/layout/Workbench.tsx@@ -26,6 +26,7 @@ import WorkbenchFloatingSearch from "@editor/components/shared/WorkbenchFloatingimport LandingPage from "@editor/components/shared/LandingPage";import DismissAllErrorsButton from "@editor/components/shared/DismissAllErrorsButton";import { NotificationBell } from "@editor/components/notifications/NotificationBell";+import { FeedbackTag } from "@editor/components/feedback/FeedbackTag";// Workbench panels are loaded on demand. Viewer pulls in pdfjs-dist and the// full @embedpdf plugin set; FileEditor/PageTracks are only needed once a file@@ -296,6 +297,7 @@ export default function Workbench() {{renderMainContent()}</Suspense></Box>+ <FeedbackTag /></Box>);}diff --git a/frontend/src/editor/core/components/shared/config/configNavSections.tsx b/frontend/src/editor/core/components/shared/config/configNavSections.tsxindex 077675ccc7..52e73be808 100644--- a/frontend/src/editor/core/components/shared/config/configNavSections.tsx+++ b/frontend/src/editor/core/components/shared/config/configNavSections.tsx@@ -5,6 +5,8 @@ import PreferencesSection, {type PreferencesSectionProps,} from "@editor/components/shared/config/configSections/preferences/PreferencesSection";import AboutSection from "@editor/components/shared/config/configSections/AboutSection";+import FeedbackSection from "@editor/components/shared/config/configSections/FeedbackSection";+import { useFeedback } from "@editor/hooks/useFeedback";import type {ConfigNavItem,ConfigNavSection,@@ -31,6 +33,18 @@ export const PREFERENCES_ITEM_KEY = "general";* The Preferences group. A plain builder rather than a hook so the SaaS nav,* which is assembled outside a component, renders the same page.*/+/** Settings page for feedback; include it only when `useFeedback` offers a way to send it. */+export function createFeedbackNavItem(+ t: TFunction<"translation", undefined>,+): ConfigNavItem {+ return {+ key: "feedback",+ label: t("settings.feedback.label", "Feedback"),+ icon: "message-square",+ component: <FeedbackSection />,+ };+}+export function createPreferencesNavSection(t: TFunction<"translation", undefined>,props: PreferencesSectionProps = {},@@ -89,6 +103,7 @@ export const useConfigNavSections = (_showSettingsWhenNoLogin: boolean = true,): ConfigNavSection[] => {const { t } = useTranslation();+ const feedbackAvailable = useFeedback() !== null;const sections: ConfigNavSection[] = [createPreferencesNavSection(t),@@ -110,6 +125,7 @@ export const useConfigNavSections = (<AboutSection isAdmin={_isAdmin} onRequestClose={onRequestClose} />),},+ ...(feedbackAvailable ? [createFeedbackNavItem(t)] : []),],},];diff --git a/frontend/src/editor/core/components/shared/config/configSections/FeedbackSection.tsx b/frontend/src/editor/core/components/shared/config/configSections/FeedbackSection.tsxnew file mode 100644index 0000000000..9614c7d132--- /dev/null+++ b/frontend/src/editor/core/components/shared/config/configSections/FeedbackSection.tsx@@ -0,0 +1,30 @@+import { Group, Paper, Text } from "@mantine/core";+import { useTranslation } from "react-i18next";+import { Button } from "@editor/ui/Button";+import { useFeedback } from "@editor/hooks/useFeedback";++/** The Settings entry for feedback; renders nothing when feedback is unavailable. */+export default function FeedbackSection() {+ const { t } = useTranslation();+ const openFeedback = useFeedback();++ if (!openFeedback) {+ return null;+ }++ return (+ <Paper withBorder p="md" radius="md">+ <Group justify="space-between" align="center">+ <Text size="sm">+ {t(+ "settings.feedback.send.description",+ "Report a problem or suggest an improvement to the Stirling team.",+ )}+ </Text>+ <Button variant="secondary" size="sm" onClick={openFeedback}>+ {t("settings.feedback.send.label", "Send feedback")}+ </Button>+ </Group>+ </Paper>+ );+}diff --git a/frontend/src/editor/core/components/shared/config/types.ts b/frontend/src/editor/core/components/shared/config/types.tsindex a0bc5a2783..e60cb752d2 100644--- a/frontend/src/editor/core/components/shared/config/types.ts+++ b/frontend/src/editor/core/components/shared/config/types.ts@@ -41,6 +41,7 @@ export const VALID_NAV_KEYS = [// Holds all four AI rows above; they stay listed so their deep links alias."adminAi","help",+ "feedback","legal","backendThirdPartyLicenses","frontendThirdPartyLicenses",diff --git a/frontend/src/editor/core/hooks/useFeedback.ts b/frontend/src/editor/core/hooks/useFeedback.tsnew file mode 100644index 0000000000..66bc31a89d--- /dev/null+++ b/frontend/src/editor/core/hooks/useFeedback.ts@@ -0,0 +1,13 @@+import { useAppConfig } from "@editor/contexts/AppConfigContext";+import { useOpenFeedback } from "@editor/hooks/useOpenFeedback";++/**+ * Opens feedback, or null when the server admin has turned feedback off or the+ * build has nowhere to send it. Null until the server config has loaded, so an+ * entry point never shows only to vanish.+ */+export function useFeedback(): (() => void) | null {+ const { config } = useAppConfig();+ const openFeedback = useOpenFeedback();+ return config?.enableFeedback === true ? openFeedback : null;+}diff --git a/frontend/src/editor/core/hooks/useOpenFeedback.ts b/frontend/src/editor/core/hooks/useOpenFeedback.tsnew file mode 100644index 0000000000..3bdd55dca6--- /dev/null+++ b/frontend/src/editor/core/hooks/useOpenFeedback.ts@@ -0,0 +1,16 @@+import { openExternal } from "@editor/platform/openExternal";++const FEEDBACK_URL = import.meta.env.VITE_FEEDBACK_URL;++function openFeedbackPage(): void {+ void openExternal(FEEDBACK_URL);+}++/**+ * How this build takes someone to give feedback, or null when it has nowhere to+ * send them. Shadowed by builds that can collect feedback in the app itself.+ * Callers want `useFeedback`, which also honours the server's switch.+ */+export function useOpenFeedback(): (() => void) | null {+ return FEEDBACK_URL ? openFeedbackPage : null;+}diff --git a/frontend/src/editor/core/pages/HomePage.test.tsx b/frontend/src/editor/core/pages/HomePage.test.tsxindex a07d5e2a3b..da38a9b024 100644--- a/frontend/src/editor/core/pages/HomePage.test.tsx+++ b/frontend/src/editor/core/pages/HomePage.test.tsx@@ -88,9 +88,6 @@ vi.mock("@editor/components/shared/quickNav/QuickNavHostBridge", () => ({vi.mock("@editor/components/shared/signing/SignMenu", () => ({SignMenu: ({ children }: { children: ReactNode }) => children,}));-vi.mock("@editor/components/home/HomePageExtensions", () => ({- HomePageExtensions: () => null,-}));vi.mock("@editor/components/FileManager", () => ({ default: () => null }));vi.mock("@editor/components/shared/FileSidebar", () => ({default: () => null,diff --git a/frontend/src/editor/core/pages/HomePage.tsx b/frontend/src/editor/core/pages/HomePage.tsxindex 2fa1c17473..a67c2eeb69 100644--- a/frontend/src/editor/core/pages/HomePage.tsx+++ b/frontend/src/editor/core/pages/HomePage.tsx@@ -43,7 +43,6 @@ import {} from "@editor/utils/homePageNavigation";import { EDITOR_BASENAME } from "@editor/routes/editorBasename";import { READER_PATH } from "@editor/routes/readerRoute";-import { HomePageExtensions } from "@editor/components/home/HomePageExtensions";import { PolicyAutoRunController } from "@editor/components/policies/PolicyAutoRunController";import { usePoliciesEnabled } from "@editor/components/policies/usePoliciesEnabled";import { QuickNavHostBridge } from "@editor/components/shared/quickNav/QuickNavHostBridge";@@ -695,7 +694,6 @@ export default function HomePage() {return (<div className="h-screen overflow-hidden">- <HomePageExtensions />{processingFolderCreation.dialog}{policiesEnabled && <PolicyAutoRunController />}<QuickNavHostBridgediff --git a/frontend/src/editor/core/services/preferencesService.ts b/frontend/src/editor/core/services/preferencesService.tsindex e1bb178f46..b90da6beb2 100644--- a/frontend/src/editor/core/services/preferencesService.ts+++ b/frontend/src/editor/core/services/preferencesService.ts@@ -32,6 +32,7 @@ export interface UserPreferences {hasCompletedOnboarding: boolean;hasSeenIntroOnboarding: boolean;hasSeenCookieBanner: boolean;+ hasDismissedFeedbackTag: boolean;hideUnavailableTools: boolean;hideUnavailableConversions: boolean;pdfRenderMode: PdfRenderMode;@@ -50,6 +51,7 @@ export const DEFAULT_PREFERENCES: UserPreferences = {hasCompletedOnboarding: false,hasSeenIntroOnboarding: false,hasSeenCookieBanner: false,+ hasDismissedFeedbackTag: false,hideUnavailableTools: false,hideUnavailableConversions: false,pdfRenderMode: "normal",diff --git a/frontend/src/editor/core/types/appConfig.ts b/frontend/src/editor/core/types/appConfig.tsindex 4e783ce15f..0760174a77 100644--- a/frontend/src/editor/core/types/appConfig.ts+++ b/frontend/src/editor/core/types/appConfig.ts@@ -22,6 +22,7 @@ export interface AppConfig {enableDesktopInstallSlide?: boolean;/** False strips the hidden novelty features - see useSecretClicks. */enableEasterEggs?: boolean;+ enableFeedback?: boolean;premiumEnabled?: boolean;premiumKey?: string;paygEnabled?: boolean;diff --git a/frontend/src/editor/proprietary/components/shared/config/configSections/server/AdminSystemSection.tsx b/frontend/src/editor/proprietary/components/shared/config/configSections/server/AdminSystemSection.tsxindex 6fad83bc3b..e0640bc2b3 100644--- a/frontend/src/editor/proprietary/components/shared/config/configSections/server/AdminSystemSection.tsx+++ b/frontend/src/editor/proprietary/components/shared/config/configSections/server/AdminSystemSection.tsx@@ -177,6 +177,7 @@ export default function AdminSystemSection() {"system.defaultLocale": settings.system?.defaultLocale,"system.showUpdate": settings.system?.showUpdate,"system.showUpdateOnlyAdmin": settings.system?.showUpdateOnlyAdmin,+ "system.enableFeedback": settings.system?.enableFeedback,"system.customHTMLFiles": settings.system?.customHTMLFiles,"system.fileUploadLimit": settings.system?.fileUploadLimit,"system.frontendUrl": settings.system?.frontendUrl,diff --git a/frontend/src/editor/proprietary/components/shared/config/configSections/server/SystemCard.tsx b/frontend/src/editor/proprietary/components/shared/config/configSections/server/SystemCard.tsxindex acbfe2707a..30b050da21 100644--- a/frontend/src/editor/proprietary/components/shared/config/configSections/server/SystemCard.tsx+++ b/frontend/src/editor/proprietary/components/shared/config/configSections/server/SystemCard.tsx@@ -351,6 +351,29 @@ export function SystemCard({disabled={!loginEnabled}/>+ <SettingsToggleRow+ label={t(+ "admin.settings.general.enableFeedback.label",+ "Enable Feedback",+ )}+ info={t(+ "admin.settings.general.enableFeedback.description",+ "Let users send feedback to the Stirling team",+ )}+ pending={isFieldPending("system.enableFeedback")}+ checked={settings.system?.enableFeedback || false}+ onChange={(checked) =>+ setSettings({+ ...settings,+ system: {+ ...settings.system,+ enableFeedback: checked,+ },+ })+ }+ disabled={!loginEnabled}+ />+<SettingsToggleRowlabel={t("admin.settings.general.customHTMLFiles.label",diff --git a/frontend/src/editor/proprietary/components/shared/config/configSections/server/serverSettings.ts b/frontend/src/editor/proprietary/components/shared/config/configSections/server/serverSettings.tsindex 7269b1129a..96492e5a17 100644--- a/frontend/src/editor/proprietary/components/shared/config/configSections/server/serverSettings.ts+++ b/frontend/src/editor/proprietary/components/shared/config/configSections/server/serverSettings.ts@@ -23,6 +23,7 @@ export interface GeneralSettingsData {defaultLocale?: string;showUpdate?: boolean;showUpdateOnlyAdmin?: boolean;+ enableFeedback?: boolean;customHTMLFiles?: boolean;fileUploadLimit?: string;frontendUrl?: string;diff --git a/frontend/src/editor/saas/App.tsx b/frontend/src/editor/saas/App.tsxindex e6b0528ed2..dbe9c89c9f 100644--- a/frontend/src/editor/saas/App.tsx+++ b/frontend/src/editor/saas/App.tsx@@ -25,10 +25,12 @@ import { NoAppChrome } from "@editor/components/layout/NoAppChrome";import OnboardingBootstrap from "@editor/components/OnboardingBootstrap";import SignupRequiredBootstrap from "@editor/components/SignupRequiredBootstrap";import UsageLimitModalHost from "@editor/components/UsageLimitModalHost";+import UserbackWidget from "@editor/components/feedback/UserbackWidget";import { RootGate } from "@editor/routes/RootGate";const MobileScannerPage = lazy(() => import("@editor/pages/MobileScannerPage"));const MobileSignPage = lazy(() => import("@editor/pages/MobileSignPage"));+const FeedbackPage = lazy(() => import("@editor/pages/FeedbackPage"));// Import global stylesimport "@editor/styles/tailwind.css";@@ -58,6 +60,7 @@ function NonAuthBootstraps() {<OnboardingBootstrap /><SignupRequiredBootstrap /><UsageLimitModalHost />+ <UserbackWidget /></>);}@@ -121,6 +124,15 @@ export default function App() {}/>+ <Route+ path="/feedback"+ element={+ <PublicRouteProviders>+ <FeedbackPage />+ </PublicRouteProviders>+ }+ />+{/* Mobile signature drawing - reached from the Sign tool QR code */}<Routepath="/mobile-sign"diff --git a/frontend/src/editor/saas/components/feedback/UserbackWidget.test.tsx b/frontend/src/editor/saas/components/feedback/UserbackWidget.test.tsxnew file mode 100644index 0000000000..c6b28e3ceb--- /dev/null+++ b/frontend/src/editor/saas/components/feedback/UserbackWidget.test.tsx@@ -0,0 +1,107 @@+import { render } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++const { userback, appConfig, user } = vi.hoisted(() => ({+ userback: vi.fn((): Promise<unknown> => new Promise(() => {})),+ appConfig: { enableFeedback: false },+ user: {+ id: "user-1",+ email: "[email protected]",+ user_metadata: { full_name: "Ada" },+ },+}));++vi.mock("@userback/widget", () => ({ default: userback }));+vi.mock("@editor/auth/UseSession", () => ({+ useAuth: () => ({ user }),+}));+vi.mock("@editor/contexts/AppConfigContext", () => ({+ useAppConfig: () => ({ config: appConfig }),+}));++// The token is read at module load, so import only after stubbing it.+async function renderWidget() {+ const { default: UserbackWidget } =+ await import("@editor/components/feedback/UserbackWidget");+ const view = render(<UserbackWidget />);+ return {+ unmount: view.unmount,+ rerender: () => view.rerender(<UserbackWidget />),+ };+}++// Like the real loader, every call gets the same pending load.+function pendingLoad() {+ let resolve!: (instance: unknown) => void;+ const promise = new Promise<unknown>((r) => {+ resolve = r;+ });+ userback.mockReturnValue(promise);+ return { promise, resolve };+}++describe("UserbackWidget", () => {+ beforeEach(() => {+ vi.stubEnv("VITE_USERBACK_TOKEN", "token");+ });++ afterEach(() => {+ vi.resetModules();+ vi.unstubAllEnvs();+ userback.mockReset();+ user.email = "[email protected]";+ });++ it("does not load Userback while the server has feedback off", async () => {+ appConfig.enableFeedback = false;+ await renderWidget();+ expect(userback).not.toHaveBeenCalled();+ });++ it("loads Userback with the user's details when feedback is on", async () => {+ appConfig.enableFeedback = true;+ await renderWidget();+ expect(userback).toHaveBeenCalledWith(+ "token",+ expect.objectContaining({+ user_data: {+ id: "user-1",+ info: { name: "Ada", email: "[email protected]" },+ },+ }),+ );+ });++ it("destroys a load that finishes after the widget has gone", async () => {+ appConfig.enableFeedback = true;+ const load = pendingLoad();+ const { unmount } = await renderWidget();+ unmount();++ const instance = { destroy: vi.fn() };+ load.resolve(instance);+ await load.promise;++ expect(instance.destroy).toHaveBeenCalled();+ const { getUserbackInstance } =+ await import("@editor/components/feedback/userbackInstance");+ expect(getUserbackInstance()).toBeNull();+ });++ it("hands a pending load to the run that replaced the one that started it", async () => {+ appConfig.enableFeedback = true;+ const load = pendingLoad();+ const { rerender } = await renderWidget();+ user.email = "[email protected]";+ rerender();++ const instance = { destroy: vi.fn() };+ load.resolve(instance);+ await load.promise;++ expect(instance.destroy).not.toHaveBeenCalled();+ const { getUserbackInstance } =+ await import("@editor/components/feedback/userbackInstance");+ expect(getUserbackInstance()).toBe(instance);+ });+});diff --git a/frontend/src/editor/saas/components/feedback/UserbackWidget.tsx b/frontend/src/editor/saas/components/feedback/UserbackWidget.tsxindex d7fc4ee1b4..4c82bdb0ef 100644--- a/frontend/src/editor/saas/components/feedback/UserbackWidget.tsx+++ b/frontend/src/editor/saas/components/feedback/UserbackWidget.tsx@@ -1,60 +1,57 @@-import { useEffect, useRef } from "react";+import { useEffect } from "react";import Userback from "@userback/widget";import { useAuth } from "@editor/auth/UseSession";--interface UserbackWidgetProps {- token: string;-}--interface UserbackInstance {- destroy: () => void;-}--export default function UserbackWidget({ token }: UserbackWidgetProps) {+import { useAppConfig } from "@editor/contexts/AppConfigContext";+import {+ getUserbackInstance,+ setUserbackInstance,+} from "@editor/components/feedback/userbackInstance";++const USERBACK_TOKEN = import.meta.env.VITE_USERBACK_TOKEN;++// Module-level because the loader is: every run shares its one pending load.+let liveRun: symbol | null = null;++/**+ * Loads Userback for the signed-in user with its own launcher hidden; the app's+ * feedback entry points open it through `useFeedback`.+ */+export default function UserbackWidget() {const { user } = useAuth();- const userbackRef = useRef<UserbackInstance | null>(null);- const initializingRef = useRef(false);+ const { config } = useAppConfig();+ const feedbackEnabled = config?.enableFeedback === true;+ const userId = user?.id;+ const email = user?.email;+ const name: string | undefined = user?.user_metadata?.full_name;useEffect(() => {- if (!user || initializingRef.current) return;-- initializingRef.current = true;-- const initializeUserback = async () => {- try {- // Prepare user data options- const userInfo: { name?: string; email?: string } = {};- if (user.user_metadata?.full_name)- userInfo.name = user.user_metadata.full_name;- if (user.email) userInfo.email = user.email;-- const options = {- user_data: {- id: user.id,- info: userInfo,- },- };-- // Initialize Userback- userbackRef.current = await Userback(token, options);- } finally {- initializingRef.current = false;- }- };-- initializeUserback();+ if (!feedbackEnabled || !USERBACK_TOKEN || !userId) return;+ const run = Symbol("userback run");+ liveRun = run;++ Userback(USERBACK_TOKEN, {+ autohide: true,+ user_data: { id: userId, info: { name, email } },+ })+ .then((instance) => {+ // Every run gets the same instance, so the newest run keeps it; with no+ // run left it would stay loaded with this user's details for the next sign-in.+ if (liveRun === run) setUserbackInstance(instance);+ else if (liveRun === null) instance.destroy();+ })+ .catch((error: unknown) => {+ console.warn(+ "Userback did not load; feedback opens the feedback page instead",+ error,+ );+ });- // Cleanup functionreturn () => {- if (- userbackRef.current &&- typeof userbackRef.current.destroy === "function"- ) {- userbackRef.current.destroy();- }- initializingRef.current = false;+ if (liveRun === run) liveRun = null;+ getUserbackInstance()?.destroy();+ setUserbackInstance(null);};- }, [user, token]);+ }, [feedbackEnabled, userId, email, name]);- return null; // This component doesn't render anything visible+ return null;}diff --git a/frontend/src/editor/saas/components/feedback/userbackInstance.ts b/frontend/src/editor/saas/components/feedback/userbackInstance.tsnew file mode 100644index 0000000000..2cbed1be70--- /dev/null+++ b/frontend/src/editor/saas/components/feedback/userbackInstance.ts@@ -0,0 +1,21 @@+import type { UserbackWidget } from "@userback/widget";++let current: UserbackWidget | null = null;+const listeners = new Set<() => void>();++/** The loaded Userback widget, or null while none is ready to open. */+export function getUserbackInstance(): UserbackWidget | null {+ return current;+}++export function setUserbackInstance(instance: UserbackWidget | null): void {+ current = instance;+ listeners.forEach((listener) => listener());+}++export function subscribeUserbackInstance(listener: () => void): () => void {+ listeners.add(listener);+ return () => {+ listeners.delete(listener);+ };+}diff --git a/frontend/src/editor/saas/components/home/HomePageExtensions.tsx b/frontend/src/editor/saas/components/home/HomePageExtensions.tsxdeleted file mode 100644index 91ae324531..0000000000--- a/frontend/src/editor/saas/components/home/HomePageExtensions.tsx+++ /dev/null@@ -1,6 +0,0 @@-import UserbackWidget from "@editor/components/feedback/UserbackWidget";--export function HomePageExtensions() {- const userbackToken = import.meta.env.VITE_USERBACK_TOKEN;- return userbackToken ? <UserbackWidget token={userbackToken} /> : null;-}diff --git a/frontend/src/editor/saas/components/settings/useSettingsNav.tsx b/frontend/src/editor/saas/components/settings/useSettingsNav.tsxindex d833e7b3ea..5543d7cf1b 100644--- a/frontend/src/editor/saas/components/settings/useSettingsNav.tsx+++ b/frontend/src/editor/saas/components/settings/useSettingsNav.tsx@@ -19,6 +19,7 @@ import { mergeSettingsGroups } from "@editor/components/settings/mergeSettingsGrimport { useSaaSTeam } from "@editor/contexts/SaaSTeamContext";import { LoadingFallback } from "@editor/components/shared/LoadingFallback";import { BASE_SECTION_ALIASES } from "@editor/data/settingsAliases";+import { useFeedback } from "@editor/hooks/useFeedback";import type { NavKey } from "@editor/components/shared/config/types";const ConnectedInstancesSection = lazy(@@ -53,12 +54,14 @@ export function useSettingsNav(onLeave: () => void): SettingsNav {const [confirmOpen, setConfirmOpen] = useState(false);const openLogoutConfirm = useCallback(() => setConfirmOpen(true), []);const isAnonymous = user ? isUserAnonymous(user) : false;+ const feedbackAvailable = useFeedback() !== null;const sections = useMemo(() => {let own = createSaasConfigNavSections(Overview, openLogoutConfirm, {isAnonymous,t,onRequestClose: onLeave,+ feedbackAvailable,});if (isTeamLeader && !teamLoading && !isAnonymous) {own = mergeSettingsGroups(@@ -108,6 +111,7 @@ export function useSettingsNav(onLeave: () => void): SettingsNav {portalAccess,isTeamLeader,teamLoading,+ feedbackAvailable,]);const overlay = (diff --git a/frontend/src/editor/saas/components/shared/config/saasConfigNavSections.tsx b/frontend/src/editor/saas/components/shared/config/saasConfigNavSections.tsxindex 4242992981..38f6898c7d 100644--- a/frontend/src/editor/saas/components/shared/config/saasConfigNavSections.tsx+++ b/frontend/src/editor/saas/components/shared/config/saasConfigNavSections.tsx@@ -1,6 +1,7 @@import React from "react";import { type TFunction } from "i18next";import {+ createFeedbackNavItem,createPreferencesNavSection,type ConfigNavSection,} from "@editor-core/components/shared/config/configNavSections";@@ -22,6 +23,8 @@ interface CreateSaasConfigNavSectionsOptions {t: TFunction<"translation", undefined>;/** Leaves settings; the Help tours need the page out of the way to run. */onRequestClose?: () => void;+ /** From `useFeedback`: whether there is anywhere to send feedback. */+ feedbackAvailable?: boolean;}function appendDeveloperSection(@@ -123,6 +126,7 @@ function appendHelpSection(sections: ConfigNavSection[],t: TFunction<"translation", undefined>,onRequestClose: () => void,+ feedbackAvailable: boolean,): ConfigNavSection[] {const hasHelp = sections.some((section) =>section.items.some((item) => item.key === "help"),@@ -145,6 +149,7 @@ function appendHelpSection(<HelpSection isAdmin={false} onRequestClose={onRequestClose} />),},+ ...(feedbackAvailable ? [createFeedbackNavItem(t)] : []),],},];@@ -187,6 +192,7 @@ export function createSaasConfigNavSections(isAnonymous = false,t,onRequestClose = () => {},+ feedbackAvailable = false,}: CreateSaasConfigNavSectionsOptions,): ConfigNavSection[] {// Create Account section as the first section with Overview and Passwords & Security@@ -232,7 +238,7 @@ export function createSaasConfigNavSections(sections = appendBillingSection(sections, t);}- sections = appendHelpSection(sections, t, onRequestClose);+ sections = appendHelpSection(sections, t, onRequestClose, feedbackAvailable);sections = appendLegalSection(sections, t);return sections;diff --git a/frontend/src/editor/saas/hooks/useOpenFeedback.test.ts b/frontend/src/editor/saas/hooks/useOpenFeedback.test.tsnew file mode 100644index 0000000000..ee1272b040--- /dev/null+++ b/frontend/src/editor/saas/hooks/useOpenFeedback.test.ts@@ -0,0 +1,53 @@+import { act, renderHook } from "@testing-library/react";+import { afterEach, describe, expect, it, vi } from "vitest";+import type { UserbackWidget } from "@userback/widget";++const openFeedbackPage = vi.fn();++vi.mock("@editor-core/hooks/useOpenFeedback", () => ({+ useOpenFeedback: () => openFeedbackPage,+}));++// The token is read at module load, so import only after stubbing it.+async function loadWithToken(token: string) {+ vi.stubEnv("VITE_USERBACK_TOKEN", token);+ const { useOpenFeedback } = await import("@editor/hooks/useOpenFeedback");+ const { setUserbackInstance } =+ await import("@editor/components/feedback/userbackInstance");+ return { useOpenFeedback, setUserbackInstance };+}++describe("useOpenFeedback (saas)", () => {+ afterEach(() => {+ vi.resetModules();+ vi.unstubAllEnvs();+ openFeedbackPage.mockClear();+ });++ it("offers no feedback without a Userback token", async () => {+ const { useOpenFeedback } = await loadWithToken("");+ const { result } = renderHook(() => useOpenFeedback());+ expect(result.current).toBeNull();+ });++ it("opens the feedback page until Userback has loaded", async () => {+ const { useOpenFeedback } = await loadWithToken("token");+ const { result } = renderHook(() => useOpenFeedback());+ expect(result.current).toBe(openFeedbackPage);+ });++ it("opens the Userback form once Userback has loaded", async () => {+ const { useOpenFeedback, setUserbackInstance } =+ await loadWithToken("token");+ const open = vi.fn();+ const { result } = renderHook(() => useOpenFeedback());++ act(() => {+ setUserbackInstance({ open } as unknown as UserbackWidget);+ });+ result.current?.();++ expect(open).toHaveBeenCalledOnce();+ expect(openFeedbackPage).not.toHaveBeenCalled();+ });+});diff --git a/frontend/src/editor/saas/hooks/useOpenFeedback.ts b/frontend/src/editor/saas/hooks/useOpenFeedback.tsnew file mode 100644index 0000000000..68f6770135--- /dev/null+++ b/frontend/src/editor/saas/hooks/useOpenFeedback.ts@@ -0,0 +1,22 @@+import { useSyncExternalStore } from "react";+import { useOpenFeedback as useOpenFeedbackPage } from "@editor-core/hooks/useOpenFeedback";+import {+ getUserbackInstance,+ subscribeUserbackInstance,+} from "@editor/components/feedback/userbackInstance";++const USERBACK_TOKEN = import.meta.env.VITE_USERBACK_TOKEN;++/**+ * Opens the Userback form in place once it has loaded, and the feedback page+ * until then. Null when the build has no Userback token, which turns feedback off.+ */+export function useOpenFeedback(): (() => void) | null {+ const userback = useSyncExternalStore(+ subscribeUserbackInstance,+ getUserbackInstance,+ );+ const openFeedbackPage = useOpenFeedbackPage();+ if (!USERBACK_TOKEN) return null;+ return userback ? () => userback.open() : openFeedbackPage;+}diff --git a/frontend/src/editor/saas/pages/FeedbackPage.module.css b/frontend/src/editor/saas/pages/FeedbackPage.module.cssnew file mode 100644index 0000000000..1d16108690--- /dev/null+++ b/frontend/src/editor/saas/pages/FeedbackPage.module.css@@ -0,0 +1,14 @@+.header {+ display: flex;+ align-items: center;+ gap: var(--space-4);+ margin-bottom: var(--space-6);+}++.title {+ margin: 0;+ font-size: 1.25rem;+ font-weight: var(--font-weight-semibold);+ line-height: 1.3;+ color: var(--c-text);+}diff --git a/frontend/src/editor/saas/pages/FeedbackPage.tsx b/frontend/src/editor/saas/pages/FeedbackPage.tsxnew file mode 100644index 0000000000..17bc111a59--- /dev/null+++ b/frontend/src/editor/saas/pages/FeedbackPage.tsx@@ -0,0 +1,77 @@+import { useEffect, useState } from "react";+import { useTranslation } from "react-i18next";+import Userback, { getUserback } from "@userback/widget";+import { AuthShell } from "@editor/auth/ui/AuthShell";+import { Button } from "@editor/ui/Button";+import { Logo } from "@editor/ui/Logo";+import styles from "@editor/pages/FeedbackPage.module.css";++const USERBACK_TOKEN = import.meta.env.VITE_USERBACK_TOKEN;++type Stage = "loading" | "ready" | "sent" | "unavailable";++/**+ * Public page that builds without Userback link to for feedback. Userback only+ * loads on whitelisted domains, so a self-hosted or desktop app cannot open it+ * in place. Needs no session: the visitor may have no Stirling account.+ */+export default function FeedbackPage() {+ const { t } = useTranslation();+ const [stage, setStage] = useState<Stage>(+ USERBACK_TOKEN ? "loading" : "unavailable",+ );++ useEffect(() => {+ if (!USERBACK_TOKEN) return;+ // A cancelled run ignores the result rather than destroying it: the loader+ // hands every caller the same pending promise.+ let cancelled = false;++ Userback(USERBACK_TOKEN, {+ autohide: true,+ // Not on resolve: the loader resolves at init, before the form can open.+ on_load: () => getUserback()?.open(),+ after_send: () => setStage("sent"),+ })+ .then(() => {+ if (!cancelled) setStage("ready");+ })+ .catch(() => {+ if (!cancelled) setStage("unavailable");+ });++ return () => {+ cancelled = true;+ getUserback()?.destroy();+ };+ }, []);++ const title: Record<Stage, string> = {+ loading: t("feedback.page.title", "Help us improve Stirling"),+ ready: t("feedback.page.title", "Help us improve Stirling"),+ sent: t("feedback.page.sent", "Thanks for your feedback"),+ unavailable: t("feedback.page.unavailable", "Feedback is unavailable"),+ };++ return (+ <AuthShell>+ <header className={styles.header}>+ <Logo variant="iconOnly" iconHeight="2.5rem" />+ <h1 className={styles.title}>{title[stage]}</h1>+ </header>+ {stage !== "unavailable" && (+ <Button+ variant={stage === "sent" ? "secondary" : "primary"}+ fat+ fullWidth+ loading={stage === "loading"}+ onClick={() => getUserback()?.open()}+ >+ {stage === "sent"+ ? t("feedback.page.sendMore", "Send more feedback")+ : t("feedback.page.open", "Send feedback")}+ </Button>+ )}+ </AuthShell>+ );+}diff --git a/frontend/src/processor/proprietary/components/AppShell.tsx b/frontend/src/processor/proprietary/components/AppShell.tsxindex b3db7009bf..3474c626ca 100644--- a/frontend/src/processor/proprietary/components/AppShell.tsx+++ b/frontend/src/processor/proprietary/components/AppShell.tsx@@ -13,6 +13,8 @@ import "@processor/components/AppShell.css";import { NotificationBell } from "@editor/components/notifications/NotificationBell";import { useIsPhone } from "@editor/hooks/useIsMobile";import { ConnectAccountRail } from "@processor/components/ConnectAccountRail";+import { FeedbackTag } from "@editor/components/feedback/FeedbackTag";+import { PreferencesProvider } from "@editor/contexts/PreferencesContext";/*** Compact header shown only under the mobile breakpoint (CSS-hidden on@@ -109,6 +111,9 @@ export function AppShell({ children }: { children: ReactNode }) {<ConnectAccountRail />{children}</main>+ <PreferencesProvider>+ <FeedbackTag />+ </PreferencesProvider></div></div>);diff --git a/frontend/src/processor/saas/PortalProviders.test.tsx b/frontend/src/processor/saas/PortalProviders.test.tsxindex d9f189a99b..7790b13431 100644--- a/frontend/src/processor/saas/PortalProviders.test.tsx+++ b/frontend/src/processor/saas/PortalProviders.test.tsx@@ -14,6 +14,9 @@ vi.mock("@editor/contexts/CheckoutContext", () => ({vi.mock("@editor/components/startup/StartupPrompts", () => ({StartupPrompts: () => null,}));+vi.mock("@editor/components/feedback/UserbackWidget", () => ({+ default: () => null,+}));vi.mock("@editor/portal/components/PortalChrome", () => ({PortalChrome: () => <Trigger />,}));diff --git a/frontend/src/processor/saas/PortalProviders.tsx b/frontend/src/processor/saas/PortalProviders.tsxindex ff8753a884..3c1ab0ff68 100644--- a/frontend/src/processor/saas/PortalProviders.tsx+++ b/frontend/src/processor/saas/PortalProviders.tsx@@ -3,6 +3,7 @@ import { UIProvider } from "@processor/contexts/UIContext";import { PortalChrome } from "@processor/components/PortalChrome";import { StartupPrompts } from "@editor/components/startup/StartupPrompts";import { CheckoutProvider } from "@editor/contexts/CheckoutContext";+import UserbackWidget from "@editor/components/feedback/UserbackWidget";/*** SaaS provider stack. There is no account-link layer: the signed-in account IS@@ -19,6 +20,7 @@ export function PortalProviders() {<UIProvider><CheckoutProvider><StartupPrompts />+ <UserbackWidget /><PortalChrome /></CheckoutProvider></UIProvider>diff --git a/frontend/vite-env.d.ts b/frontend/vite-env.d.tsindex ca71e946df..93f7a08e78 100644--- a/frontend/vite-env.d.ts+++ b/frontend/vite-env.d.ts@@ -15,6 +15,7 @@ interface ImportMetaEnv {readonly VITE_STRIPE_PUBLISHABLE_KEY: string;readonly VITE_PUBLIC_POSTHOG_KEY: string;readonly VITE_PUBLIC_POSTHOG_HOST: string;+ readonly VITE_FEEDBACK_URL: string;// SaaS only (.env.saas)readonly VITE_USERBACK_TOKEN: string;