Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 20 additions & 34 deletions apps/console/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,51 +15,37 @@ const nextConfig = {
svgr: false,
},
async rewrites() {
// PostHog reverse proxy (EU region). posthog-js is configured with
// api_host: '/analytics' so the browser only ever hits this first-party
// path (ad-blocker resistant); Next forwards server-side to PostHog.
//
// IMPORTANT: PostHog retired `eu.posthog.com` for ingestion. Static assets
// must go to `eu-assets.i.posthog.com` and everything else (event capture,
// /decide, session recording /s) to `eu.i.posthog.com`. The dedicated
// ingestion subdomain is the supported, durable target.
return [
// Posthog
// Static assets (array.js, recorder.js, ...) -> assets host.
{
source: '/analytics/:path*',
destination: 'https://eu.posthog.com/:path*',
source: '/analytics/static/:path*',
destination: 'https://eu-assets.i.posthog.com/static/:path*',
},
// Event ingestion / decide / session recording -> ingestion host.
// posthog-js sends to `/e/`, `/decide/`, `/s/` WITH a trailing slash, so
// both the trailing-slash and bare variants are required (a single
// `:path*` rule does not match `/analytics/e/`).
{
source: '/analytics/:path*/',
destination: 'https://eu.posthog.com/:path*/',
destination: 'https://eu.i.posthog.com/:path*/',
},
];
},
skipTrailingSlashRedirect: true,
async headers() {
async function getMyIp() {
const x = await fetch('https://api.ipify.org');
// const x = await fetch('https://api.my-ip.io/ip')
return await x.text();
}
const ip = await getMyIp();
return [
{
source: '/analytics/:path*',
headers: [
{ key: 'X-Forwarded-Proto', value: 'https' },
{
key: 'X-Forwarded-Host',
value: 'https://www.useflytrap.com',
},
{ key: 'X-Forwarded-For', value: ip },
],
},
{
source: '/analytics/:path*/',
headers: [
{ key: 'X-Forwarded-Proto', value: 'https' },
{
key: 'X-Forwarded-Host',
value: 'https://www.useflytrap.com',
},
{ key: 'X-Forwarded-For', value: ip },
],
destination: 'https://eu.i.posthog.com/:path*',
},
];
},
// Prevent Next from 308-redirecting `/analytics/e/` -> `/analytics/e`, which
// would strip the trailing slash posthog-js depends on.
skipTrailingSlashRedirect: true,
experimental: {
serverComponentsExternalPackages: ['@xmtp/user-preferences-bindings-wasm'],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
export const ENS_BY_API_KEY_CALLED = 'ENS_BY_API_KEY_CALLED';

export interface EnsByApiKeyCalledPayload {}
export interface EnsByApiKeyCalledPayload {
/** Where in the UI the lookup was triggered (e.g. 'claim_section'). */
location: string;
/** Number of domains returned for the supplied API key. */
domainCount: number;
}
9 changes: 8 additions & 1 deletion apps/console/src/analytics/events/code/code-copied.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
export const CODE_COPIED = 'CODE_COPIED';

export interface CodeCopiedPayload {}
export type CodeSnippet = 'integration' | 'dependencies';

export interface CodeCopiedPayload {
/** Where in the UI the copy happened (e.g. 'code_section'). */
location: string;
/** Which snippet was copied: the integration code or the install command. */
snippet: CodeSnippet;
}

This file was deleted.

This file was deleted.

12 changes: 3 additions & 9 deletions apps/console/src/analytics/events/navigation/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import {
DASHBOARD_LINK_CLICKED,
DashboardLinkClickedPayload,
} from './dashboard-link-clicked';
import { DOCS_LINK_CLICKED, DocsLinkClickedPayload } from './docs-link-clicked';
import { LINK_CLICKED, LinkClickedPayload } from './link-clicked';
import { PROFILE_VIEWED, ProfileViewedPayload } from './profile-viewed';

export const NAVIGATION_EVENTS = {
DOCS_LINK_CLICKED,
LINK_CLICKED,
PROFILE_VIEWED,
DASHBOARD_LINK_CLICKED,
} as const;

export interface NavigationEventPayload {
[DOCS_LINK_CLICKED]: DocsLinkClickedPayload;
[LINK_CLICKED]: LinkClickedPayload;
[PROFILE_VIEWED]: ProfileViewedPayload;
[DASHBOARD_LINK_CLICKED]: DashboardLinkClickedPayload;
}
10 changes: 10 additions & 0 deletions apps/console/src/analytics/events/navigation/link-clicked.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const LINK_CLICKED = 'LINK_CLICKED';

export type LinkTarget = 'docs' | 'dashboard';

export interface LinkClickedPayload {
/** Which external destination the user navigated to. */
target: LinkTarget;
/** Where in the UI the link lives (e.g. 'navbar', 'claim_section'). */
location: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ export const PROFILE_VIEWED = 'PROFILE_VIEWED';

export interface ProfileViewedPayload {
ens: string;
/** Where the profile was opened from (e.g. 'demo_card'). */
location: string;
chainId?: number;
}
4 changes: 4 additions & 0 deletions apps/console/src/analytics/events/network/network-changed.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export const NETWORK_CHANGED = 'NETWORK_CHANGED';

export type NetworkName = 'mainnet' | 'sepolia';

export interface NetworkChangedPayload {
chainId: number;
/** Human-readable network the user switched to. */
network: NetworkName;
}
3 changes: 0 additions & 3 deletions apps/console/src/analytics/events/plugins/dentity-disabled.ts

This file was deleted.

3 changes: 0 additions & 3 deletions apps/console/src/analytics/events/plugins/dentity-enabled.ts

This file was deleted.

3 changes: 0 additions & 3 deletions apps/console/src/analytics/events/plugins/efp-disabled.ts

This file was deleted.

3 changes: 0 additions & 3 deletions apps/console/src/analytics/events/plugins/efp-enabled.ts

This file was deleted.

50 changes: 9 additions & 41 deletions apps/console/src/analytics/events/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,15 @@
import { DENTITY_ENABLED, DentityEnabledPayload } from './dentity-enabled';
import { DENTITY_DISABLED, DentityDisabledPayload } from './dentity-disabled';
import { EFP_DISABLED, EfpDisabledPayload } from './efp-disabled';
import { EFP_ENABLED, EfpEnabledPayload } from './efp-enabled';
import { PLUGIN_TOGGLED, PluginToggledPayload } from './plugin-toggled';
import {
JUST_VERIFIED_DISABLED,
JustVerifiedDisabledPayload,
} from './just-verified-disabled';
import {
JUST_VERIFIED_ENABLED,
JustVerifiedEnabledPayload,
} from './just-verified-enabled';
import {
JUST_VERIFIED_EVENTS,
JustVerifiedEventsPayload,
} from './justVerified';
import { POAP_DISABLED, PoapDisabledPayload } from './poap-disabled';
import { POAP_ENABLED, PoapEnabledPayload } from './poap-enabled';
import { XMTP_DISABLED, XmtpDisabledPayload } from './xmtp-disabled';
import { XMTP_ENABLED, XmtpEnabledPayload } from './xmtp-enabled';
VERIFICATION_TOGGLED,
VerificationToggledPayload,
} from './verification-toggled';

export const PLUGINS_EVENTS = {
JUST_VERIFIED_DISABLED,
JUST_VERIFIED_ENABLED,
EFP_DISABLED,
EFP_ENABLED,
POAP_DISABLED,
POAP_ENABLED,
XMTP_DISABLED,
XMTP_ENABLED,
DENTITY_DISABLED,
DENTITY_ENABLED,
...JUST_VERIFIED_EVENTS,
PLUGIN_TOGGLED,
VERIFICATION_TOGGLED,
} as const;

export interface PluginsEventPayload extends JustVerifiedEventsPayload {
[JUST_VERIFIED_DISABLED]: JustVerifiedDisabledPayload;
[JUST_VERIFIED_ENABLED]: JustVerifiedEnabledPayload;
[EFP_DISABLED]: EfpDisabledPayload;
[EFP_ENABLED]: EfpEnabledPayload;
[POAP_DISABLED]: PoapDisabledPayload;
[POAP_ENABLED]: PoapEnabledPayload;
[XMTP_DISABLED]: XmtpDisabledPayload;
[XMTP_ENABLED]: XmtpEnabledPayload;
[DENTITY_DISABLED]: DentityDisabledPayload;
[DENTITY_ENABLED]: DentityEnabledPayload;
export interface PluginsEventPayload {
[PLUGIN_TOGGLED]: PluginToggledPayload;
[VERIFICATION_TOGGLED]: VerificationToggledPayload;
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

39 changes: 0 additions & 39 deletions apps/console/src/analytics/events/plugins/justVerified/index.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 13 additions & 0 deletions apps/console/src/analytics/events/plugins/plugin-toggled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const PLUGIN_TOGGLED = 'PLUGIN_TOGGLED';

export type PluginName =
| 'efp'
| 'poap'
| 'xmtp'
| 'dentity'
| 'just_verified';

export interface PluginToggledPayload {
plugin: PluginName;
enabled: boolean;
}
3 changes: 0 additions & 3 deletions apps/console/src/analytics/events/plugins/poap-disabled.ts

This file was deleted.

3 changes: 0 additions & 3 deletions apps/console/src/analytics/events/plugins/poap-enabled.ts

This file was deleted.

13 changes: 13 additions & 0 deletions apps/console/src/analytics/events/plugins/verification-toggled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const VERIFICATION_TOGGLED = 'VERIFICATION_TOGGLED';

export type VerificationProvider =
| 'twitter'
| 'telegram'
| 'github'
| 'discord'
| 'email';

export interface VerificationToggledPayload {
provider: VerificationProvider;
enabled: boolean;
}
3 changes: 0 additions & 3 deletions apps/console/src/analytics/events/plugins/xmtp-disabled.ts

This file was deleted.

3 changes: 0 additions & 3 deletions apps/console/src/analytics/events/plugins/xmtp-enabled.ts

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const ENS_SELECTION_CHANGED = 'ENS_SELECTION_CHANGED';

export type EnsSelectionMode = 'any' | 'claimable' | 'specific';

export interface EnsSelectionChangedPayload {
/** Which sign-in allow-list mode the user picked. */
mode: EnsSelectionMode;
/** The specific ENS entered, only present when mode === 'specific'. */
ens?: string;
}
Loading
Loading