Skip to content

Commit 6ec4a3a

Browse files
docs(msstore): add rating prompt feature documentation
Add comprehensive documentation for the MS Store day-7 rating prompt feature, covering visibility gates, persistence, theming, and i18n. Co-Authored-By: Hagicode <noreply@hagicode.com> Signed-off-by: newbe36524 <newbe36524@qq.com>
1 parent c142ab4 commit 6ec4a3a

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

docs/msstore-rating-prompt.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# MS Store Day-7 Rating Prompt
2+
3+
The desktop home screen shows a Microsoft Store rating prompt directly below the
4+
`HomeStoreOfferPanel`. The prompt is rendered by
5+
`src/renderer/components/HomeStoreRatingPrompt.tsx` and is gated by the pure
6+
function `shouldShowRatingPrompt` in
7+
`src/renderer/lib/msstore-rating-prompt.ts`.
8+
9+
## Visibility gate
10+
11+
The prompt renders only when **both** conditions hold:
12+
13+
1. The app is running in the Windows Store distribution channel
14+
(`distributionState.winStoreMode === true`).
15+
2. The persisted install timestamp is at least seven days before the current
16+
time (`now - installDate >= 7 days`).
17+
18+
In every other case the component returns `null` and renders nothing, so non
19+
`win-store` channels (`normal` / `fusion` / `steam`) and fresh installs are
20+
unaffected.
21+
22+
## No dismiss affordance
23+
24+
By design the prompt provides **no close, dismiss, or cancel control**. There is
25+
no top-right `×`, no "don't show again", and no "remind me later". As long as the
26+
visibility gate holds, the prompt stays on the home screen. The "Rate us" action
27+
opens the Microsoft Store review page through the existing `openExternal` IPC and
28+
shows a toast if the launch fails.
29+
30+
## Persistence
31+
32+
The install timestamp lives in `electron-store` under the `AppConfig` field:
33+
34+
```ts
35+
msstoreRatingPrompt?: {
36+
installDate?: string; // ISO8601, written on first launch
37+
};
38+
```
39+
40+
- `installDate` is written exactly once by
41+
`ConfigManager.ensureMsstoreRatingPromptInstallDate()`, which is called during
42+
`app.whenReady()` in `src/main/main.ts` after the config manager is created.
43+
- An existing `installDate` is never overwritten, so restarting the app never
44+
resets the seven-day countdown.
45+
46+
### Legacy / upgrading users
47+
48+
Users upgrading from a version that predates this feature will not have an
49+
`installDate`. On the first launch of the new version the current time is
50+
recorded, which effectively delays the prompt by seven days from that first
51+
launch. This is the intended fallback; it avoids surprising long-time users with
52+
an immediate prompt.
53+
54+
The persisted state is exposed to the renderer through the
55+
`get-msstore-rating-prompt-state` IPC handler and the
56+
`window.electronAPI.getMsstoreRatingPromptState()` preload bridge.
57+
58+
## Review URL
59+
60+
The review URL is derived from the existing store id constant in
61+
`src/types/store-license.ts`:
62+
63+
```ts
64+
HAGICODE_DESKTOP_WINDOWS_STORE_REVIEW_URL = HAGICODE_DESKTOP_WINDOWS_STORE_WEB_URL;
65+
```
66+
67+
It uses the web detail page form so that it always falls back to a browser if a
68+
native `ms-windows-store://` deeplink is unavailable on the current Windows
69+
version.
70+
71+
## Theming
72+
73+
The prompt uses the `msstore-rating-prompt-*` CSS classes defined in
74+
`src/renderer/index.css`. Light and dark theme variants are declared as CSS
75+
custom properties so the prompt stays vivid and legible under both desktop
76+
themes.
77+
78+
## i18n
79+
80+
All user-visible copy lives under the `pages.ratingPrompt.*` keys in
81+
`src/renderer/i18n/locales/*/pages.yml` and is included via the standard i18n
82+
generation flow.

0 commit comments

Comments
 (0)