diff --git a/README.md b/README.md index b9c12b8c..7e31ee9b 100644 --- a/README.md +++ b/README.md @@ -276,7 +276,8 @@ GRIST_FORCE_LOGIN | Much like GRIST_ANON_PLAYGROUND but don't support anonymo GRIST_SINGLE_ORG | set to an org "domain" to pin client to that org GRIST_TEMPLATE_ORG | set to an org "domain" to show public docs from that org GRIST_HELP_CENTER | set the help center link ref -FREE_COACHING_CALL_URL | set the link to the human help (example: email or meeting scheduling tool) +FREE_COACHING_CALL_URL | set the link to the human help (example: email adress or meeting scheduling tool) +GRIST_CONTACT_SUPPORT_URL | set the link to contact support on error pages (example: email adress or online form) GRIST_SUPPORT_ANON | if set to 'true', show UI for anonymous access (not shown by default) GRIST_SUPPORT_EMAIL | if set, give a user with the specified email support powers. The main extra power is the ability to share sites, workspaces, and docs with all users in a listed way. GRIST_TELEMETRY_LEVEL | the telemetry level. Can be set to: `off` (default), `limited`, or `full`. diff --git a/app/client/ui/WelcomeCoachingCall.ts b/app/client/ui/WelcomeCoachingCall.ts index 2aa91818..04fe34c3 100644 --- a/app/client/ui/WelcomeCoachingCall.ts +++ b/app/client/ui/WelcomeCoachingCall.ts @@ -8,6 +8,7 @@ import {cardPopup, cssPopupBody, cssPopupButtons, cssPopupCloseButton, import {icon} from 'app/client/ui2018/icons'; import {getGristConfig} from 'app/common/urlUtils'; import {dom, styled} from 'grainjs'; +import { commonUrls } from 'app/common/gristUrls'; const t = makeT('WelcomeCoachingCall'); @@ -103,7 +104,7 @@ We can show you the Grist basics, or start working with your data right away to logTelemetryEvent('clickedScheduleCoachingCall'); }), { - href: getGristConfig().freeCoachingCallUrl, + href: commonUrls.freeCoachingCall, target: '_blank', }, testId('popup-primary-button'), diff --git a/app/client/ui/errorPages.ts b/app/client/ui/errorPages.ts index 569ad2ac..b21ac106 100644 --- a/app/client/ui/errorPages.ts +++ b/app/client/ui/errorPages.ts @@ -7,7 +7,7 @@ import {pagePanels} from 'app/client/ui/PagePanels'; import {createTopBarHome} from 'app/client/ui/TopBar'; import {bigBasicButtonLink, bigPrimaryButtonLink} from 'app/client/ui2018/buttons'; import {theme, vars} from 'app/client/ui2018/cssVars'; -import {getPageTitleSuffix} from 'app/common/gristUrls'; +import {commonUrls, getPageTitleSuffix} from 'app/common/gristUrls'; import {getGristConfig} from 'app/common/urlUtils'; import {dom, DomElementArg, makeTestId, observable, styled} from 'grainjs'; @@ -94,7 +94,7 @@ export function createNotFoundPage(appModel: AppModel, message?: string) { })), cssButtonWrap(bigPrimaryButtonLink(t("Go to main page"), testId('error-primary-btn'), urlState().setLinkUrl({}))), - cssButtonWrap(bigBasicButtonLink(t("Contact support"), {href: 'https://getgrist.com/contact'})), + cssButtonWrap(bigBasicButtonLink(t("Contact support"), {href: commonUrls.contactSupport})), ]); } @@ -109,7 +109,7 @@ export function createOtherErrorPage(appModel: AppModel, message?: string) { t('There was an unknown error.')), cssButtonWrap(bigPrimaryButtonLink(t("Go to main page"), testId('error-primary-btn'), urlState().setLinkUrl({}))), - cssButtonWrap(bigBasicButtonLink(t("Contact support"), {href: 'https://getgrist.com/contact'})), + cssButtonWrap(bigBasicButtonLink(t("Contact support"), {href: commonUrls.contactSupport})), ]); } diff --git a/app/common/gristUrls.ts b/app/common/gristUrls.ts index b9b2d308..c56440d3 100644 --- a/app/common/gristUrls.ts +++ b/app/common/gristUrls.ts @@ -86,6 +86,8 @@ export const commonUrls = { helpTelemetryLimited: "https://support.getgrist.com/telemetry-limited", helpCalendarWidget: "https://support.getgrist.com/widget-calendar", helpLinkKeys: "https://support.getgrist.com/examples/2021-04-link-keys", + freeCoachingCall: getFreeCoachingCallUrl(), + contactSupport: getContactSupportUrl(), plans: "https://www.getgrist.com/pricing", sproutsProgram: "https://www.getgrist.com/sprouts-program", contact: "https://www.getgrist.com/contact", @@ -670,6 +672,9 @@ export interface GristLoadConfig { // Url for free coaching call scheduling for the browser client to use. freeCoachingCallUrl?: string; + // Url for "contact support" button on Grist's "not found" error page + contactSupportUrl?: string; + // When set, this directs the client to encode org information in path, not in domain. pathOnly?: boolean; @@ -865,21 +870,33 @@ export function getKnownOrg(): string|null { } } -export function getHelpCenterUrl(): string|null { +export function getHelpCenterUrl(): string { + const defaultUrl = "https://support.getgrist.com"; + if(isClient()) { + const gristConfig: GristLoadConfig = (window as any).gristConfig; + return gristConfig && gristConfig.helpCenterUrl || defaultUrl; + } else { + return process.env.GRIST_HELP_CENTER || defaultUrl; + } +} + +export function getFreeCoachingCallUrl(): string { + const defaultUrl = "https://calendly.com/grist-team/grist-free-coaching-call"; if(isClient()) { const gristConfig: GristLoadConfig = (window as any).gristConfig; - return gristConfig && gristConfig.helpCenterUrl || null; + return gristConfig && gristConfig.freeCoachingCallUrl || defaultUrl; } else { - return process.env.GRIST_HELP_CENTER || null; + return process.env.FREE_COACHING_CALL_URL || defaultUrl; } } -export function getFreeCoachingCallUrl(): string|null { +export function getContactSupportUrl(): string { + const defaultUrl = "https://www.getgrist.com/contact/"; if(isClient()) { const gristConfig: GristLoadConfig = (window as any).gristConfig; - return gristConfig && gristConfig.freeCoachingCallUrl || null; + return gristConfig && gristConfig.contactSupportUrl || defaultUrl; } else { - return process.env.FREE_COACHING_CALL_URL || null; + return process.env.GRIST_CONTACT_SUPPORT_URL || defaultUrl; } } diff --git a/app/server/lib/sendAppPage.ts b/app/server/lib/sendAppPage.ts index 1647b4d4..c2a92680 100644 --- a/app/server/lib/sendAppPage.ts +++ b/app/server/lib/sendAppPage.ts @@ -1,4 +1,12 @@ -import {Features, getPageTitleSuffix, GristLoadConfig, IFeature} from 'app/common/gristUrls'; +import { + Features, + getContactSupportUrl, + getFreeCoachingCallUrl, + getHelpCenterUrl, + getPageTitleSuffix, + GristLoadConfig, + IFeature +} from 'app/common/gristUrls'; import {isAffirmative} from 'app/common/gutil'; import {getTagManagerSnippet} from 'app/common/tagManager'; import {Document} from 'app/common/UserAPI'; @@ -53,8 +61,9 @@ export function makeGristConfig(options: MakeGristConfigOptions): GristLoadConfi org: process.env.GRIST_SINGLE_ORG || (mreq && mreq.org), baseDomain, singleOrg: process.env.GRIST_SINGLE_ORG, - helpCenterUrl: process.env.GRIST_HELP_CENTER || "https://support.getgrist.com", - freeCoachingCallUrl: process.env.FREE_COACHING_CALL_URL || "https://calendly.com/grist-team/grist-free-coaching-call", + helpCenterUrl: getHelpCenterUrl(), + freeCoachingCallUrl: getFreeCoachingCallUrl(), + contactSupportUrl: getContactSupportUrl(), pathOnly, supportAnon: shouldSupportAnon(), enableAnonPlayground: isAffirmative(process.env.GRIST_ANON_PLAYGROUND ?? true),