Skip to content

Commit 8cf047f

Browse files
committed
fix: address review feedback
- Restore version 11.14.0 (stale package.json from the spike branch) - Matomo config fetch: hourly revalidate instead of force-cache, so dashboard changes propagate without a deploy - Skip Secure cookie attribute on plain-http localhost (Safari rejects) - Complete defineABFlag JSDoc
1 parent a3079b9 commit 8cf047f

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ethereum-org-website",
3-
"version": "11.13.0",
3+
"version": "11.14.0",
44
"license": "MIT",
55
"private": true,
66
"scripts": {

src/components/AB/TestDebugPanel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ function getCookie(name: string): string | null {
2929

3030
/** Set a cookie with path=/ and security attributes */
3131
function setCookie(name: string, value: string) {
32-
document.cookie = `${name}=${value}; path=/; max-age=86400; Secure; SameSite=Strict`
32+
// Safari rejects Secure cookies on plain-http localhost (pnpm dev)
33+
const secure = window.location.protocol === "https:" ? "; Secure" : ""
34+
document.cookie = `${name}=${value}; path=/; max-age=86400${secure}; SameSite=Strict`
3335
}
3436

3537
/** Delete a cookie */

src/lib/ab-testing/flags.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export type ABFlag = ReturnType<typeof flag<number, MatomoEntities>>
6565
*
6666
* @param key Must exactly match the experiment name in Matomo - a mismatch
6767
* doesn't error, everyone silently gets the original variant.
68+
* @param description Human-readable summary shown in Flags SDK tooling.
6869
* @param numVariants Total variant count including the original (default 2).
6970
*/
7071
export const defineABFlag = (

src/lib/ab-testing/matomo-adapter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ async function fetchMatomoExperiments(): Promise<Record<string, ABTestConfig>> {
4747
`${matomoUrl}/index.php?module=API&method=AbTesting.getAllExperiments&idSite=${siteId}&format=json&token_auth=${apiToken}`,
4848
{
4949
headers: { "User-Agent": "ethereum.org-flags-adapter/1.0" },
50-
cache: "force-cache",
50+
// Refresh hourly so Matomo dashboard changes (pause, re-weight)
51+
// propagate without a deploy
52+
next: { revalidate: 3600 },
5153
}
5254
)
5355

0 commit comments

Comments
 (0)