feat: ADD Terms of service link (#985)

Adds an optional terms of service link for sites that need it.

---------

Co-authored-by: Jonathan Perret <j-github@jonathanperret.net>
This commit is contained in:
Grégoire Cutzach
2024-05-16 17:31:37 +02:00
committed by GitHub
parent bb249ff462
commit d8f4e075fe
6 changed files with 63 additions and 1 deletions

View File

@@ -146,6 +146,14 @@ export function createHomeLeftPane(leftPanelOpen: Observable<boolean>, home: Hom
) : null
),
createHelpTools(home.app),
(commonUrls.termsOfService ?
cssPageEntry(
cssPageLink(cssPageIcon('Memo'), cssLinkText(t("Terms of service")),
{ href: commonUrls.termsOfService, target: '_blank' },
testId('dm-tos'),
),
) : null
),
)
)
);

View File

@@ -91,6 +91,7 @@ export const commonUrls = {
helpAPI: 'https://support.getgrist.com/api',
freeCoachingCall: getFreeCoachingCallUrl(),
contactSupport: getContactSupportUrl(),
termsOfService: getTermsOfServiceUrl(),
plans: "https://www.getgrist.com/pricing",
sproutsProgram: "https://www.getgrist.com/sprouts-program",
contact: "https://www.getgrist.com/contact",
@@ -689,6 +690,9 @@ export interface GristLoadConfig {
// Url for support for the browser client to use.
helpCenterUrl?: string;
// Url for terms of service for the browser client to use
termsOfServiceUrl?: string;
// Url for free coaching call scheduling for the browser client to use.
freeCoachingCallUrl?: string;
@@ -900,6 +904,15 @@ export function getHelpCenterUrl(): string {
}
}
export function getTermsOfServiceUrl(): string|undefined {
if(isClient()) {
const gristConfig: GristLoadConfig = (window as any).gristConfig;
return gristConfig && gristConfig.termsOfServiceUrl || undefined;
} else {
return process.env.GRIST_TERMS_OF_SERVICE_URL || undefined;
}
}
export function getFreeCoachingCallUrl(): string {
const defaultUrl = "https://calendly.com/grist-team/grist-free-coaching-call";
if(isClient()) {

View File

@@ -4,6 +4,7 @@ import {
getFreeCoachingCallUrl,
getHelpCenterUrl,
getPageTitleSuffix,
getTermsOfServiceUrl,
GristLoadConfig,
IFeature
} from 'app/common/gristUrls';
@@ -62,6 +63,7 @@ export function makeGristConfig(options: MakeGristConfigOptions): GristLoadConfi
baseDomain,
singleOrg: process.env.GRIST_SINGLE_ORG,
helpCenterUrl: getHelpCenterUrl(),
termsOfServiceUrl: getTermsOfServiceUrl(),
freeCoachingCallUrl: getFreeCoachingCallUrl(),
contactSupportUrl: getContactSupportUrl(),
pathOnly,