From 6c7d6f3fc5db1c8d9123b96fa2d9223cd4cc3727 Mon Sep 17 00:00:00 2001 From: dsatpm Date: Mon, 19 Oct 2026 12:33:48 -0700 Subject: [PATCH] feat(site): add support page for the store Support URL Adds site/support/index.html, generated from src/legal/supportPageHtml.ts with a shared pageShell also used by the privacy page. Contact address comes from the privacy policy; FAQ answers are checked against real UI labels by tests/supportPage.test.ts. Published at /birthmark/support/ by pages.yml. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/pages.yml | 10 ++-- site/support/index.html | 41 ++++++++++++++++ src/legal/pageShell.ts | 42 ++++++++++++++++ src/legal/privacyPolicyHtml.ts | 44 +++-------------- src/legal/supportPageHtml.ts | 75 ++++++++++++++++++++++++++++ tests/supportPage.test.ts | 89 ++++++++++++++++++++++++++++++++++ 6 files changed, 261 insertions(+), 40 deletions(-) create mode 100644 site/support/index.html create mode 100644 src/legal/pageShell.ts create mode 100644 src/legal/supportPageHtml.ts create mode 100644 tests/supportPage.test.ts diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 0ac7f53..c68e3a1 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,10 +1,12 @@ name: Pages -# Publishes site/ (the privacy policy) to GitHub Pages: +# Publishes site/ to GitHub Pages: # https://htpdevs.github.io/birthmark/privacy-policy/ is the privacy policy URL -# for the Play Console and App Store Connect. site/privacy-policy/index.html is -# generated from src/legal/privacyPolicy.ts; tests/privacyPolicy.test.ts (run by -# ci.yml on every PR) fails if it drifts from the in-app text. +# and https://htpdevs.github.io/birthmark/support/ is the support URL for the +# Play Console and App Store Connect. site/privacy-policy/index.html is +# generated from src/legal/privacyPolicy.ts and site/support/index.html from +# src/legal/supportPageHtml.ts; tests/privacyPolicy.test.ts and +# tests/supportPage.test.ts (run by ci.yml on every PR) fail if they drift. on: push: diff --git a/site/support/index.html b/site/support/index.html new file mode 100644 index 0000000..615d118 --- /dev/null +++ b/site/support/index.html @@ -0,0 +1,41 @@ + + + + + +Birthmark support + + + +
+

Birthmark support

+

Birthmark is published by HTPdevs. For help with the app, a bug report, or a question, email support@htpdevs.tech.

+

In your email, include your device model, its operating system version, and the Birthmark version. Please do not include names or other identifying details about any birth.

+

How do I export a report?

+

Tap Finish on the recording screen and confirm. The report opens. Tap Export PDF, then choose where to save or share it.

+

How do I correct a mistake or add a missed moment?

+

Open the report and tap a row to edit it, or tap Add to timeline for a moment you missed. The original capture is kept next to every correction.

+

Can I change the clock between 24-hour and 12-hour?

+

Yes. Tap the clock on the recording screen. Reports always use the 24-hour clock.

+

What happens if I lock the screen, switch apps, or restart the phone?

+

Elapsed time keeps counting through screen lock, backgrounding, and closing the app, and an active session is waiting when you reopen Birthmark. If the phone restarted during a session, Birthmark estimates the timing from its last saved clock reading and flags it "Timing estimated after recovery" in the PDF appendix.

+

What does the Emergency button do?

+

After you confirm, it opens your phone app with 911 entered. Your phone app and carrier place the call, not Birthmark, and it needs working phone service. The button does not record anything in your session.

+

Where is my data, and can you recover it?

+

Sessions are stored only on your device. Birthmark has no accounts and no backend, so we cannot see or recover them. Session data is excluded from device backups, and uninstalling Birthmark removes it.

+

How do I delete a session?

+

Open the finished session from History, then tap Delete session on its report. This removes the session and its cached exports from the device. It cannot remove PDFs you already saved or shared elsewhere.

+

Privacy

+

Read the Birthmark privacy policy.

+

Birthmark records observations you choose. It gives no clinical guidance and is not certified for HIPAA or any other medical records standard.

+
+ + diff --git a/src/legal/pageShell.ts b/src/legal/pageShell.ts new file mode 100644 index 0000000..01951fe --- /dev/null +++ b/src/legal/pageShell.ts @@ -0,0 +1,42 @@ +import { colors } from '../ui/theme'; + +/** + * Shared chrome for the standalone pages under site/ (privacy policy, support), + * published by .github/workflows/pages.yml. Self-contained: inline CSS, no + * scripts, no external requests. + */ + +export const escapeHtml = (s: string) => + s.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); + +const EMAIL = /([^\s@]+@[^\s@]+\.[a-z]{2,})/g; + +/** Escapes a paragraph and links any email address in it. */ +export const paragraph = (text: string) => + `

${escapeHtml(text).replace(EMAIL, (m) => `${m}`)}

`; + +export function pageShell(title: string, body: string): string { + return ` + + + + +${escapeHtml(title)} + + + +
+${body} +
+ + +`; +} diff --git a/src/legal/privacyPolicyHtml.ts b/src/legal/privacyPolicyHtml.ts index 15ae724..5db9ab0 100644 --- a/src/legal/privacyPolicyHtml.ts +++ b/src/legal/privacyPolicyHtml.ts @@ -1,5 +1,5 @@ -import { colors } from '../ui/theme'; import { PRIVACY_EFFECTIVE_DATE, PRIVACY_INTRO, PRIVACY_SECTIONS, PRIVACY_TITLE } from './privacyPolicy'; +import { escapeHtml, pageShell, paragraph } from './pageShell'; /** * The privacy policy as a standalone HTML page: site/privacy-policy/index.html, @@ -9,43 +9,15 @@ import { PRIVACY_EFFECTIVE_DATE, PRIVACY_INTRO, PRIVACY_SECTIONS, PRIVACY_TITLE * with UPDATE_PRIVACY_MD=1 npx jest tests/privacyPolicy.test.ts */ -const escape = (s: string) => - s.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); - -const EMAIL = /([^\s@]+@[^\s@]+\.[a-z]{2,})/g; - -/** Escapes a paragraph and links any email address in it. */ -const paragraph = (text: string) => - `

${escape(text).replace(EMAIL, (m) => `${m}`)}

`; - export function privacyPolicyHtml(): string { const sections = PRIVACY_SECTIONS.map( - (s) => `

${escape(s.heading)}

\n${s.paragraphs.map(paragraph).join('\n')}`, + (s) => `

${escapeHtml(s.heading)}

\n${s.paragraphs.map(paragraph).join('\n')}`, ).join('\n'); - return ` - - - - -${escape(PRIVACY_TITLE)} - - - -
-

${escape(PRIVACY_TITLE)}

-

Effective ${escape(PRIVACY_EFFECTIVE_DATE)}

+ return pageShell( + PRIVACY_TITLE, + `

${escapeHtml(PRIVACY_TITLE)}

+

Effective ${escapeHtml(PRIVACY_EFFECTIVE_DATE)}

${paragraph(PRIVACY_INTRO)} -${sections} -
- - -`; +${sections}`, + ); } diff --git a/src/legal/supportPageHtml.ts b/src/legal/supportPageHtml.ts new file mode 100644 index 0000000..005e7bc --- /dev/null +++ b/src/legal/supportPageHtml.ts @@ -0,0 +1,75 @@ +import { PRIVACY_CONTACT, PRIVACY_DEVELOPER } from './privacyPolicy'; +import { escapeHtml, pageShell, paragraph } from './pageShell'; + +/** + * The support page: site/support/index.html, published by + * .github/workflows/pages.yml as the Support URL for App Store Connect and the + * Play Console. Contact address comes from the privacy policy so the two never + * disagree. tests/supportPage.test.ts fails if the committed file drifts; + * regenerate with UPDATE_SUPPORT_PAGE=1 npx jest tests/supportPage.test.ts + */ + +export const SUPPORT_TITLE = 'Birthmark support'; + +export const SUPPORT_INTRO = `Birthmark is published by ${PRIVACY_DEVELOPER}. For help with the app, a bug report, or a question, email ${PRIVACY_CONTACT}.`; + +export const SUPPORT_EMAIL_TIPS = + 'In your email, include your device model, its operating system version, and the Birthmark version. Please do not include names or other identifying details about any birth.'; + +export type SupportQuestion = { question: string; answer: string }; + +export const SUPPORT_QUESTIONS: SupportQuestion[] = [ + { + question: 'How do I export a report?', + answer: + 'Tap Finish on the recording screen and confirm. The report opens. Tap Export PDF, then choose where to save or share it.', + }, + { + question: 'How do I correct a mistake or add a missed moment?', + answer: + 'Open the report and tap a row to edit it, or tap Add to timeline for a moment you missed. The original capture is kept next to every correction.', + }, + { + question: 'Can I change the clock between 24-hour and 12-hour?', + answer: 'Yes. Tap the clock on the recording screen. Reports always use the 24-hour clock.', + }, + { + question: 'What happens if I lock the screen, switch apps, or restart the phone?', + answer: + 'Elapsed time keeps counting through screen lock, backgrounding, and closing the app, and an active session is waiting when you reopen Birthmark. If the phone restarted during a session, Birthmark estimates the timing from its last saved clock reading and flags it "Timing estimated after recovery" in the PDF appendix.', + }, + { + question: 'What does the Emergency button do?', + answer: + 'After you confirm, it opens your phone app with 911 entered. Your phone app and carrier place the call, not Birthmark, and it needs working phone service. The button does not record anything in your session.', + }, + { + question: 'Where is my data, and can you recover it?', + answer: + 'Sessions are stored only on your device. Birthmark has no accounts and no backend, so we cannot see or recover them. Session data is excluded from device backups, and uninstalling Birthmark removes it.', + }, + { + question: 'How do I delete a session?', + answer: + 'Open the finished session from History, then tap Delete session on its report. This removes the session and its cached exports from the device. It cannot remove PDFs you already saved or shared elsewhere.', + }, +]; + +export const SUPPORT_NOTICE = + 'Birthmark records observations you choose. It gives no clinical guidance and is not certified for HIPAA or any other medical records standard.'; + +export function supportPageHtml(): string { + const questions = SUPPORT_QUESTIONS.map( + (q) => `

${escapeHtml(q.question)}

\n${paragraph(q.answer)}`, + ).join('\n'); + return pageShell( + SUPPORT_TITLE, + `

${escapeHtml(SUPPORT_TITLE)}

+${paragraph(SUPPORT_INTRO)} +${paragraph(SUPPORT_EMAIL_TIPS)} +${questions} +

Privacy

+

Read the Birthmark privacy policy.

+${paragraph(SUPPORT_NOTICE)}`, + ); +} diff --git a/tests/supportPage.test.ts b/tests/supportPage.test.ts new file mode 100644 index 0000000..15064aa --- /dev/null +++ b/tests/supportPage.test.ts @@ -0,0 +1,89 @@ +import { mkdirSync, readFileSync, writeFileSync } from 'fs'; +import { join } from 'path'; + +import { EMERGENCY_NUMBER } from '@/domain/emergency'; +import { PRIVACY_CONTACT } from '@/legal/privacyPolicy'; +import { + SUPPORT_NOTICE, + SUPPORT_QUESTIONS, + SUPPORT_TITLE, + supportPageHtml, +} from '@/legal/supportPageHtml'; + +const ROOT = join(__dirname, '..'); +const PAGE = join(ROOT, 'site', 'support', 'index.html'); +const read = (p: string) => readFileSync(join(ROOT, p), 'utf8'); +const esc = (s: string) => s.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); +const html = supportPageHtml(); + +// The Support URL for App Store Connect and the Play Console +// (.github/workflows/pages.yml publishes site/). +describe('support page', () => { + it('site/support/index.html matches the generated page', () => { + if (process.env.UPDATE_SUPPORT_PAGE) { + mkdirSync(join(ROOT, 'site', 'support'), { recursive: true }); + writeFileSync(PAGE, html); + } + // On failure: UPDATE_SUPPORT_PAGE=1 npx jest tests/supportPage.test.ts + expect(readFileSync(PAGE, 'utf8')).toBe(html); + }); + + it('shows a contact address that is the privacy policy contact, as a mailto link', () => { + expect(html).toContain(`${PRIVACY_CONTACT}`); + }); + + it('is titled and lists every question and answer, escaped', () => { + expect(html).toContain(`${esc(SUPPORT_TITLE)}`); + for (const q of SUPPORT_QUESTIONS) { + expect(html).toContain(`

${esc(q.question)}

`); + expect(html).toContain(esc(q.answer)); + } + }); + + it('links the privacy policy with a relative path that resolves on the published site', () => { + expect(html).toContain(''); + expect(read('site/privacy-policy/index.html')).toContain('Birthmark privacy policy'); + }); + + it('is self-contained: no scripts and no external requests', () => { + expect(html).not.toMatch(/ { + const text = SUPPORT_QUESTIONS.map((q) => q.answer).join('\n') + SUPPORT_NOTICE; + expect(text).not.toMatch(/\b(is|are) (anonymous|anonymized|HIPAA[- ]compliant|HIPAA approved)\b/i); + expect(SUPPORT_NOTICE).toContain('not certified for HIPAA'); + }); + + // Each answer names UI the app has. If one of these fails, the app changed + // and the page has to change with it. + describe('answers match the app', () => { + const answers = SUPPORT_QUESTIONS.map((q) => q.answer).join('\n'); + const report = read('src/app/report/[id].tsx'); + + it('names the real report buttons', () => { + for (const label of ['Export PDF', 'Add to timeline', 'Delete session']) { + expect(answers).toContain(label); + expect(report).toContain(`label="${label}"`); + } + }); + + it('names the real finish button', () => { + expect(answers).toContain('Finish'); + expect(read('src/app/record.tsx')).toContain('label="Finish"'); + }); + + it('the clock tap toggles the display format', () => { + expect(read('src/app/record.tsx')).toContain('onToggle={() => appStore.toggleClockFormat()}'); + }); + + it('quotes the recovery flag text exactly', () => { + expect(answers).toContain('"Timing estimated after recovery"'); + expect(read('src/report/reportModel.ts')).toContain("'Timing estimated after recovery'"); + }); + + it('emergency number', () => { + expect(answers).toContain(`with ${EMERGENCY_NUMBER} entered`); + }); + }); +});