🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots 📖
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
feat(extension): open the thank-you letter once for existing users
Luis Ortiz77e5681b33d1
diff --git a/apps/extension/src/entrypoints/background/index.ts b/apps/extension/src/entrypoints/background/index.tsindex 5e678f3..70fa9e9 100644--- a/apps/extension/src/entrypoints/background/index.ts+++ b/apps/extension/src/entrypoints/background/index.ts@@ -23,6 +23,7 @@ import { sendMessageToTab } from '@/lib/browser-api/send-message-to-tab';import { setSidePanelBehavior } from '@/lib/browser-api/set-side-panel-behavior';import { toggleSidebar } from '@/lib/browser-api/toggle-sidebar';import { updateTab } from '@/lib/browser-api/update-tab';+import { recordInstall } from '@/lib/letter-notice/record-install';import { onMessage } from '@/lib/messaging';import { broadcastStateToPanel } from '@/lib/port/broadcast-state-to-panel';import { setupPortListener } from '@/lib/port/setup-port-listener';@@ -72,6 +73,7 @@ export default defineBackground(() => {browser.runtime.onInstalled.addListener(async (details) => {await recordUpdate(details.reason);+ await recordInstall(details.reason);if (details.reason !== 'install') return;if (import.meta.env.BROWSER === 'firefox') {try {diff --git a/apps/extension/src/lib/__tests__/letter-notice.test.ts b/apps/extension/src/lib/__tests__/letter-notice.test.tsnew file mode 100644index 0000000..315d195--- /dev/null+++ b/apps/extension/src/lib/__tests__/letter-notice.test.ts@@ -0,0 +1,34 @@+import { beforeEach, describe, expect, it } from 'vitest';+import { browser } from '#imports';+import { LETTER_NOTICE_KEY } from '../letter-notice/constants';+import { dismissLetterNotice } from '../letter-notice/dismiss-letter-notice';+import { isLetterUnread } from '../letter-notice/is-letter-unread';+import { recordInstall } from '../letter-notice/record-install';+import { recordUpdate } from '../update-notice/record-update';++describe('letter notice', () => {+ beforeEach(async () => {+ await browser.storage.local.remove(LETTER_NOTICE_KEY);+ });++ it('opens for someone who already had Mimik before the letter existed', async () => {+ await recordUpdate('update');+ expect(await isLetterUnread()).toBe(true);+ });++ it('stays shut on a fresh install, which reads the letter in onboarding', async () => {+ await recordInstall('install');+ expect(await isLetterUnread()).toBe(false);+ });++ it('does not come back once dismissed', async () => {+ await dismissLetterNotice();+ expect(await isLetterUnread()).toBe(false);+ });++ it('stays shut through later updates, which overwrite the update notice but not this', async () => {+ await dismissLetterNotice();+ await recordUpdate('update');+ expect(await isLetterUnread()).toBe(false);+ });+});diff --git a/apps/extension/src/lib/letter-notice/constants.ts b/apps/extension/src/lib/letter-notice/constants.tsnew file mode 100644index 0000000..bd51747--- /dev/null+++ b/apps/extension/src/lib/letter-notice/constants.ts@@ -0,0 +1 @@+export const LETTER_NOTICE_KEY = 'letterSeen';diff --git a/apps/extension/src/lib/letter-notice/dismiss-letter-notice.ts b/apps/extension/src/lib/letter-notice/dismiss-letter-notice.tsnew file mode 100644index 0000000..b52f720--- /dev/null+++ b/apps/extension/src/lib/letter-notice/dismiss-letter-notice.ts@@ -0,0 +1,6 @@+import { browser } from '#imports';+import { LETTER_NOTICE_KEY } from './constants';++export function dismissLetterNotice(): Promise<void> {+ return browser.storage.local.set({ [LETTER_NOTICE_KEY]: true });+}diff --git a/apps/extension/src/lib/letter-notice/is-letter-unread.ts b/apps/extension/src/lib/letter-notice/is-letter-unread.tsnew file mode 100644index 0000000..93c0d99--- /dev/null+++ b/apps/extension/src/lib/letter-notice/is-letter-unread.ts@@ -0,0 +1,7 @@+import { browser } from '#imports';+import { LETTER_NOTICE_KEY } from './constants';++export async function isLetterUnread(): Promise<boolean> {+ const data = await browser.storage.local.get([LETTER_NOTICE_KEY]);+ return data?.[LETTER_NOTICE_KEY] !== true;+}diff --git a/apps/extension/src/lib/letter-notice/record-install.ts b/apps/extension/src/lib/letter-notice/record-install.tsnew file mode 100644index 0000000..2f91ed6--- /dev/null+++ b/apps/extension/src/lib/letter-notice/record-install.ts@@ -0,0 +1,7 @@+import { browser } from '#imports';+import { LETTER_NOTICE_KEY } from './constants';++export async function recordInstall(reason: string): Promise<void> {+ if (reason !== 'install') return;+ await browser.storage.local.set({ [LETTER_NOTICE_KEY]: true });+}diff --git a/apps/extension/src/ui/fullview/App.tsx b/apps/extension/src/ui/fullview/App.tsxindex 8e001ac..dc43246 100644--- a/apps/extension/src/ui/fullview/App.tsx+++ b/apps/extension/src/ui/fullview/App.tsx@@ -5,7 +5,9 @@ import { browser } from '#imports';import { startRecordingInTab } from '@/capture/start-recording-in-tab';import { openSidebar } from '@/lib/browser-api/open-sidebar';import { sendMessage } from '@/lib/messaging';+import { useLetterNotice } from '@/ui/shared/hooks/use-letter-notice';import { useUpdateNotice } from '@/ui/shared/hooks/use-update-notice';+import { LetterDialog } from '@/ui/shared/LetterDialog';import { BackgroundVoiceNotice } from './components/BackgroundVoiceNotice';import { CaptureTabDialog } from './components/CaptureTabDialog';@@ -13,6 +15,7 @@ export function FullViewApp() {const route = useRoute();const [pendingCapture, setPendingCapture] = useState<{ insert?: CaptureInsert } | null>(null);const updateNotice = useUpdateNotice();+ const letterNotice = useLetterNotice();return (<TooltipProvider>@@ -24,6 +27,7 @@ export function FullViewApp() {><SearchModal /><UpdateNotice {...updateNotice} className="fixed bottom-6 left-1/2 -translate-x-1/2 z-50" />+ <LetterDialog {...letterNotice} />{route.page === 'library' && (<main className="flex-1 flex flex-col p-8">diff --git a/apps/extension/src/ui/shared/LetterDialog.tsx b/apps/extension/src/ui/shared/LetterDialog.tsxnew file mode 100644index 0000000..79a5691--- /dev/null+++ b/apps/extension/src/ui/shared/LetterDialog.tsx@@ -0,0 +1,17 @@+import { Dialog, DialogContent, DialogTitle, LetterStep } from '@mimik/ui';+import { i18n } from '#imports';++export function LetterDialog({ open, onDismiss }: { open: boolean; onDismiss: () => void }) {+ return (+ <Dialog open={open} onOpenChange={(next) => !next && onDismiss()}>+ <DialogContent showCloseButton={false} className="gap-3.5 p-4 sm:max-w-[760px]">+ <DialogTitle className="sr-only">{i18n.t('onboarding.letterNote')}</DialogTitle>+ <LetterStep+ onFinish={onDismiss}+ heading={i18n.t('onboarding.letterNote')}+ finishLabel={i18n.t('common.close')}+ />+ </DialogContent>+ </Dialog>+ );+}diff --git a/apps/extension/src/ui/shared/hooks/use-letter-notice.ts b/apps/extension/src/ui/shared/hooks/use-letter-notice.tsnew file mode 100644index 0000000..a944d11--- /dev/null+++ b/apps/extension/src/ui/shared/hooks/use-letter-notice.ts@@ -0,0 +1,19 @@+import { useEffect, useState } from 'react';+import { dismissLetterNotice } from '@/lib/letter-notice/dismiss-letter-notice';+import { isLetterUnread } from '@/lib/letter-notice/is-letter-unread';++export function useLetterNotice(): { open: boolean; onDismiss: () => void } {+ const [open, setOpen] = useState(false);++ useEffect(() => {+ isLetterUnread().then(setOpen);+ }, []);++ return {+ open,+ onDismiss: () => {+ setOpen(false);+ void dismissLetterNotice();+ },+ };+}diff --git a/apps/extension/src/ui/sidepanel/App.tsx b/apps/extension/src/ui/sidepanel/App.tsxindex 40ba742..872cc5a 100644--- a/apps/extension/src/ui/sidepanel/App.tsx+++ b/apps/extension/src/ui/sidepanel/App.tsx@@ -19,7 +19,9 @@ import { sendMessage } from '@/lib/messaging';import { getVoiceStatus } from '@/lib/offscreen/get-voice-status';import { connectToBackground } from '@/lib/port/connect-to-background';import type { PanelAiUpdate, PanelVoiceUpdate } from '@/lib/port/types';+import { useLetterNotice } from '@/ui/shared/hooks/use-letter-notice';import { useUpdateNotice } from '@/ui/shared/hooks/use-update-notice';+import { LetterDialog } from '@/ui/shared/LetterDialog';import { SettingsView } from '@/ui/shared/SettingsView';import { GuideEditor } from './GuideEditor';import { GuideMeCompletion } from './GuideMeCompletion';@@ -39,6 +41,7 @@ type View =export function App() {const [isAlive, setIsAlive] = useState(false);const updateNotice = useUpdateNotice();+ const letterNotice = useLetterNotice();const [view, setView] = useState<View>({ name: 'library' });const [search, setSearch] = useState('');const [activeUrl, setActiveUrl] = useState<string>();@@ -274,6 +277,7 @@ export function App() {<div className="flex-1 px-5 pt-5"><UpdateNotice {...updateNotice} className="mb-4" />+ <LetterDialog {...letterNotice} /><div className="relative mb-5"><Search size={15} className="absolute left-3.5 top-1/2 -translate-y-1/2 text-purple" />diff --git a/packages/locales/de.yml b/packages/locales/de.ymlindex 0658f36..4bf6215 100644--- a/packages/locales/de.yml+++ b/packages/locales/de.yml@@ -517,6 +517,7 @@ onboarding:blurTitle: Smart BluropenMimik: Mimik öffnenletterHello: "Noch eine Sache 👋"+ letterNote: "Ein Wort vom Team 👋"letterThanks: "Das müssen wir einfach loswerden: $1 In den letzten Wochen sind die GitHub-Sterne von Mimik regelrecht explodiert, und das verdanken wir ganz allein euch. Ihr habt Mimik mit Freunden, Teams und Communitys geteilt, und wir sind überwältigt."letterThankYou: "Danke."letterWorld: "Das Schönste an der Arbeit an Mimik ist zu sehen, wie Menschen auf der ganzen Welt es nutzen. Wir hoffen, dass es euch weiter Zeit und Geld spart und eure Daten dort lässt, wo sie hingehören: bei euch. Ihr habt eine Idee, einen Feature-Wunsch oder Feedback? $1. Wir lesen jede einzelne Nachricht."diff --git a/packages/locales/en.yml b/packages/locales/en.ymlindex 3db1623..8f88218 100644--- a/packages/locales/en.yml+++ b/packages/locales/en.yml@@ -587,6 +587,7 @@ onboarding:blurTitle: "Smart blur"openMimik: Open MimikletterHello: "One more thing 👋"+ letterNote: "A note from the team 👋"letterThanks: "We have to say it: $1 Over the last couple of weeks, Mimik's GitHub stars have exploded, and that's all because of you. You've been sharing it with friends, teammates and communities, and we're blown away."letterThankYou: "thank you."letterWorld: "The best part of building Mimik has been seeing how people all over the world use it. We hope it keeps saving you time and money and keeps your data where it belongs: with you. Got an idea, a feature request or feedback? $1. We read every single one."diff --git a/packages/locales/es.yml b/packages/locales/es.ymlindex 34d15ae..e53a868 100644--- a/packages/locales/es.yml+++ b/packages/locales/es.yml@@ -587,6 +587,7 @@ onboarding:blurTitle: Desenfoque inteligenteopenMimik: Abrir MimikletterHello: "Una cosa más 👋"+ letterNote: "Unas palabras del equipo 👋"letterThanks: "Tenemos que decirlo: $1 En las últimas semanas, las estrellas de Mimik en GitHub se han disparado, y todo es gracias a ti. Lo has compartido con amigos, compañeros y comunidades, y no nos lo creemos."letterThankYou: "gracias."letterWorld: "Lo mejor de crear Mimik ha sido ver cómo lo usa gente de todo el mundo. Esperamos que te siga ahorrando tiempo y dinero y que tus datos sigan donde deben estar: contigo. ¿Tienes una idea, una petición o comentarios? $1. Leemos todos y cada uno."diff --git a/packages/locales/fr.yml b/packages/locales/fr.ymlindex 092f83d..138efbc 100644--- a/packages/locales/fr.yml+++ b/packages/locales/fr.yml@@ -587,6 +587,7 @@ onboarding:blurTitle: Flou intelligentopenMimik: Ouvrir MimikletterHello: "Encore une chose 👋"+ letterNote: "Un mot de l'équipe 👋"letterThanks: "Il fallait qu'on vous le dise : $1 Ces dernières semaines, les étoiles GitHub de Mimik ont explosé, et c'est entièrement grâce à vous. Vous l'avez partagé avec vos amis, vos collègues et vos communautés, et nous n'en revenons pas."letterThankYou: "merci."letterWorld: "Le plus beau dans l'aventure Mimik, c'est de voir comment des gens du monde entier l'utilisent. Nous espérons qu'il continuera à vous faire gagner du temps et de l'argent, et à garder vos données là où elles doivent être : chez vous. Une idée, une demande de fonctionnalité ou un retour ? $1. Nous lisons absolument tout."diff --git a/packages/locales/pt-BR.yml b/packages/locales/pt-BR.ymlindex dd240a3..e470902 100644--- a/packages/locales/pt-BR.yml+++ b/packages/locales/pt-BR.yml@@ -587,6 +587,7 @@ onboarding:blurTitle: Desfoque inteligenteopenMimik: "Abrir o Mimik"letterHello: "Mais uma coisa 👋"+ letterNote: "Um recado do time 👋"letterThanks: "A gente precisa dizer: $1 Nas últimas semanas, as estrelas do Mimik no GitHub explodiram, e é tudo graças a vocês. Vocês compartilharam o Mimik com amigos, colegas e comunidades, e a gente ficou de queixo caído."letterThankYou: "obrigado."letterWorld: "A melhor parte de criar o Mimik tem sido ver como pessoas do mundo todo usam ele. Esperamos que ele continue economizando tempo e dinheiro para vocês e mantendo seus dados onde eles devem ficar: com vocês. Tem uma ideia, um pedido de recurso ou feedback? $1. A gente lê cada mensagem."diff --git a/packages/locales/ru.yml b/packages/locales/ru.ymlindex b25ec9f..e3ec984 100644--- a/packages/locales/ru.yml+++ b/packages/locales/ru.yml@@ -587,6 +587,7 @@ onboarding:blurTitle: Умное размытиеopenMimik: Открыть MimikletterHello: "И ещё кое-что 👋"+ letterNote: "Пара слов от команды 👋"letterThanks: "Не можем не сказать: $1 За последние пару недель число звёзд Mimik на GitHub просто взлетело, и всё это благодаря вам. Вы делились им с друзьями, коллегами и сообществами, и мы в полном восторге."letterThankYou: "спасибо."letterWorld: "Больше всего в работе над Mimik нас радует то, как им пользуются люди по всему миру. Надеемся, он и дальше будет экономить вам время и деньги, а ваши данные останутся там, где им место: у вас. Есть идея, пожелание или отзыв? $1. Мы читаем каждое сообщение."diff --git a/packages/locales/zh-CN.yml b/packages/locales/zh-CN.ymlindex a912e47..4e9e647 100644--- a/packages/locales/zh-CN.yml+++ b/packages/locales/zh-CN.yml@@ -587,6 +587,7 @@ onboarding:blurTitle: 智能模糊openMimik: 打开 MimikletterHello: "还有一件事 👋"+ letterNote: "来自团队的一封信 👋"letterThanks: "有句话我们一定要说:$1过去几周,Mimik 在 GitHub 上的星标数一路暴涨,这全靠你们。你们把它分享给朋友、同事和各个社区,我们真的又惊又喜。"letterThankYou: "谢谢你们!"letterWorld: "打造 Mimik 最开心的事,就是看到世界各地的人都在用它。希望它继续帮你们省时省钱,也让你们的数据留在该在的地方:你们自己手里。有想法、功能需求或反馈?$1,每一条我们都会认真看。"diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.tsindex 613a76c..6b71ed3 100644--- a/packages/ui/src/index.ts+++ b/packages/ui/src/index.ts@@ -41,6 +41,7 @@ export { AppFrame } from './navigation/components/AppFrame';export { useRoute } from './navigation/hooks/use-route';export { navigate } from './navigation/lib/navigate';export { DemoCursor } from './onboarding/components/DemoCursor';+export { LetterStep } from './onboarding/components/LetterStep';export { OnboardingFlow } from './onboarding/components/OnboardingFlow';export { OnboardingRow } from './onboarding/components/OnboardingRow';export { FinishButton } from './recording/components/FinishButton';diff --git a/packages/ui/src/onboarding/components/LetterStep.tsx b/packages/ui/src/onboarding/components/LetterStep.tsxindex b3be55a..01e9aef 100644--- a/packages/ui/src/onboarding/components/LetterStep.tsx+++ b/packages/ui/src/onboarding/components/LetterStep.tsx@@ -16,7 +16,15 @@ const ASKS = [['💬', 'onboarding.letterAskFriend'],] as const;-export function LetterStep({ onFinish }: { onFinish: () => void }) {+export function LetterStep({+ onFinish,+ heading,+ finishLabel,+}: {+ onFinish: () => void;+ heading?: string;+ finishLabel?: string;+}) {const withSlot = (key: string, slot: ReactNode) => {const [before, after] = i18n.t(key, [SLOT]).split(SLOT);return (@@ -39,7 +47,9 @@ export function LetterStep({ onFinish }: { onFinish: () => void }) {<div className="mx-auto"><MascotIcon size={84} /></div>- <h1 className="text-center text-[23px] font-bold text-foreground">{i18n.t('onboarding.letterHello')}</h1>+ <h1 className="text-center text-[23px] font-bold text-foreground">+ {heading ?? i18n.t('onboarding.letterHello')}+ </h1><p className={PARAGRAPH}>{withSlot('onboarding.letterThanks',@@ -96,7 +106,7 @@ export function LetterStep({ onFinish }: { onFinish: () => void }) {</span></p></section>- <StepNav onNext={onFinish} nextLabel={i18n.t('onboarding.openMimik')} />+ <StepNav onNext={onFinish} nextLabel={finishLabel ?? i18n.t('onboarding.openMimik')} /></>);}