Skip to content

Commit 982474b

Browse files
committed
fix(consent): address the first review round
- Add /cookie-policy to LANDING_ROUTES. It is an app/(landing) route, and every one of those must be exempt from COEP: the header is inherited across soft navigations, so an isolated landing page navigating into /demo leaves the Cal.com booker loading uncredentialed. - Render the withdrawal control as plain text on a self-hosted deployment, where the consent runtime is never mounted and the button had no listener. - Give ConsentPreferencesLink a named props interface.
1 parent 29874fc commit 982474b

3 files changed

Lines changed: 25 additions & 9 deletions

File tree

apps/sim/app/(landing)/cookie-policy/consent-preferences-link.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
'use client'
22

3+
import type { ReactNode } from 'react'
34
import { OPEN_CONSENT_PREFERENCES_EVENT } from '@/lib/consent/constants'
45
import { PROSE_TYPE } from '@/app/(landing)/components/prose-page/constants'
56

7+
interface ConsentPreferencesLinkProps {
8+
children: ReactNode
9+
}
10+
611
/**
712
* Inline control that reopens the consent banner with its category switches
813
* expanded, so a recorded choice can be withdrawn or changed. Wearing the
914
* prose link chrome, it reads as part of the sentence it sits in.
1015
*
11-
* On a self-hosted deployment the consent runtime is never mounted, so nothing
12-
* listens and the control is inert — but it is also unreachable, since the
13-
* Cookie Policy documents Sim's own hosted service.
16+
* Only rendered where the consent runtime is mounted — see the call site. On a
17+
* self-hosted deployment nothing would listen for the event, so the Cookie
18+
* Policy renders the phrase as plain text rather than a control that does
19+
* nothing when clicked.
1420
*/
15-
export function ConsentPreferencesLink({ children }: { children: React.ReactNode }) {
21+
export function ConsentPreferencesLink({ children }: ConsentPreferencesLinkProps) {
1622
return (
1723
<button
1824
type='button'

apps/sim/app/(landing)/cookie-policy/cookie-policy-content.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { ReactNode } from 'react'
2+
import { isHosted } from '@/lib/core/config/env-flags'
23
import {
34
type LegalBlock,
45
type LegalPageConfig,
@@ -11,6 +12,17 @@ import { ConsentPreferencesLink } from '@/app/(landing)/cookie-policy/consent-pr
1112
* One cookie-inventory table per consent category. The three share a header and
1213
* a column layout, so they are built from one shape rather than repeated.
1314
*/
15+
/**
16+
* The withdrawal control, or the bare phrase on a self-hosted deployment. The
17+
* consent runtime is hosted-only, so there the button would have no listener
18+
* and clicking it would do nothing.
19+
*/
20+
const CHANGE_CHOICES: ReactNode = isHosted ? (
21+
<ConsentPreferencesLink>change your cookie choices</ConsentPreferencesLink>
22+
) : (
23+
'change your cookie choices'
24+
)
25+
1426
function cookieTable(caption: string, rows: ReactNode[][]): LegalBlock {
1527
return {
1628
kind: 'table',
@@ -55,8 +67,7 @@ export const COOKIE_POLICY_CONFIG: LegalPageConfig = {
5567
content: (
5668
<>
5769
If you are in the EU, the UK, or another region where consent is required, we ask before
58-
setting anything that is not strictly necessary. You can{' '}
59-
<ConsentPreferencesLink>change your cookie choices</ConsentPreferencesLink> at any time.
70+
setting anything that is not strictly necessary. You can {CHANGE_CHOICES} at any time.
6071
</>
6172
),
6273
},
@@ -203,9 +214,7 @@ export const COOKIE_POLICY_CONFIG: LegalPageConfig = {
203214
Where consent is required, the banner appears on your first visit with accept and
204215
reject offered equally, and "Customize" lets you turn each category on or off
205216
individually. To revisit that decision later — including withdrawing consent you
206-
already gave —{' '}
207-
<ConsentPreferencesLink>change your cookie choices</ConsentPreferencesLink>. We ask
208-
again after 365 days.
217+
already gave — {CHANGE_CHOICES}. We ask again after 365 days.
209218
</>
210219
),
211220
},

apps/sim/next.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const LANDING_ROUTES = [
2323
'changelog',
2424
'comparisons',
2525
'contact',
26+
'cookie-policy',
2627
'demo',
2728
'enterprise',
2829
'files',

0 commit comments

Comments
 (0)