Skip to content

fix: batch analytics events, unique pool slugs, keep UTM on share links, flag high fee bumps - #852

Merged
ritaifeoluwa merged 2 commits into
SmartDropLabs:mainfrom
benfoster-dev:fix/analytics-slugs-share-feebump-750-751-752-753
Nov 18, 2026
Merged

ritaifeoluwa merged 2 commits into
SmartDropLabs:mainfrom
benfoster-dev:fix/analytics-slugs-share-feebump-750-751-752-753

Conversation

@benfoster-dev

Copy link
Copy Markdown
Contributor

Closes #750
Closes #751
Closes #752
Closes #753

What changed

  • analytics.ts: event batching not implemented #750 analytics.ts: trackEvent now queues events instead of calling the provider once per event. The queue flushes when it reaches ANALYTICS_BATCH_SIZE (10), ANALYTICS_FLUSH_INTERVAL_MS (5s) after the first queued event, or on pagehide/visibilitychange: hidden, so queued events aren't lost on navigation. flushAnalytics() is exported, and public-key hashing is unchanged. New analytics.test.ts.
  • pool-slugs.ts: slug collision handling missing #751 pool-slugs.ts: new generateUniquePoolSlugs(pools). Pools with a unique short slug keep it unchanged; pools that share one get the shortest longer id tail that tells them apart. That depends only on the colliding ids, not on list order, so slugs don't swap when the list is reordered. extractPoolIdFromSlug and generateStaticParams use these slugs, and a short slug shared by two pools no longer resolves to whichever was listed last. Tests added.
  • share-url.ts: UTM parameters not preserved #752 share-url.ts: buildShareUrl adds the visit's utm_* params to the link unless the link already sets them. rememberUtmParams() stores the landing page's UTM params in sessionStorage; AppShell calls it on each navigation, so attribution survives moving away from the landing page. New share-url.utm.test.ts.
  • feeBumpGuard.ts: no warning for high fee bump amounts #753 feeBumpGuard.ts: adds HIGH_FEE_BUMP_STROOPS (1 XLM), isHighFeeBump and highFeeBumpWarning. /api/sign-fee-bump logs an unusually high bump fee server-side and returns a warning field, which requestFeeBump logs. The bump fee scales with the caller-supplied inner fee, so this flags inflated inner fees. Tests added; the route test's feeBumpGuard mock gains the new export.

Why

  • One provider call per event.
  • Two pools could share a URL.
  • Campaign attribution was lost after the first navigation.
  • An inflated sponsored fee passed silently.

How to test

  • npm test -- src/lib/analytics src/lib/pool-slugs src/lib/share-url src/lib/feeBumpGuard src/app/api/sign-fee-bump

Note: not run locally; I'm relying on CI. Three choices worth calling out:

  • Pool slugs: FarmPoolRow still builds its links row by row from symbol and contractAddress, so for a colliding pair the list link now resolves to "not found" rather than the wrong pool. A full fix needs the farm page to pass list-aware slugs into FarmPoolRow.
  • Fee warning: the high-fee warning is logged, not shown in a dialog; a UI prompt needs changes to the submit flow.
  • Pre-existing fix: AppShell.tsx on main rendered <ServiceWorkerRegistrar> without importing it; the import is added here because this PR edits that file.

Also seen on main and not touched: src/app/layout.tsx imports AppShell twice and renders it twice, which looks like a merge leftover.

@netlify

netlify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

👷 Deploy request for smart-drop pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit bbb2cd7

@netlify

netlify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

👷 Deploy request for spiffy-melomakarona-eb1e8a pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit bbb2cd7

@drips-wave

drips-wave Bot commented Nov 18, 2026

Copy link
Copy Markdown

@benfoster-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@ritaifeoluwa
ritaifeoluwa merged commit be49264 into SmartDropLabs:main Nov 18, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants