Files
web/libs/base-ui/utils/logEvent.ts
Matthew Bunday d41b9e5938 Feat/homepage revamp (#962)
* Add dependencies

* Add assets

* Working with their mesh

* Not really working shimmer cards

* implement shimmer card without motion/framer

* Fix TagChip

* add button component

* Add Title and move Card

* add Title headline

* try new component

* Add large button and text component

* fix ecosystem page

* wasm free loading?

* Checkpoint, cleaning up lint errors

* New model attempt

* home and jobs page with new section/components

* New mesh export

* Add Base Grantee badge

* script to pull blog posts to display

* blog section

* new top navigation

* mobile blog

* navigation margin

* about page

* Adapt ecosystem page

* adapt builder-anniversary-nft

* adapt jobs page

* remove unused views

* remove unused views / frame / motion

* adapt get started

* i love wagmi

* mobile optimization

* tidy up get started page

* fix alignment

* add connect wallet button & transaction animation

* blog effect tidy up & new job page

* try catch

* fix display

* Load all the objects in a unit sphere

* Add wasm-unsafe-eval to CSP

* gradient circle animation

* Dynamic ThreeHero

* Add gltf and glb to file-loader

* Try combined GLB file

* button fix

* lineheight and text selection styles

* blog section optimizations

* intersection observer

* fix console errors

* blog post optimization, css over state

* one card provider = one event tracking

* we like mobile too

* ecosystem tweaks + mobile friendly

* margin & padding

* overflow fix

* Remove transparency

* use correct buttons & prefer canvas over svg animation

* mobile navigation

* latest optimize 3D pass

* tweak balloon effect

* fixed 3D hero header

* Progress on physics sim

* Link to retrofunding

* Remove brand kit link for now

* First pass at gravity scene

* Added physics pause when a user scrolls.

* fix fog and colors

* Update next to allow draco loading and added noggles to scene

* new light mouse trail

* new light

* mobile sizing

* fix mobile scaling alignment

* remove three card

* remove noggles

* Remove second OP logo

* new logo and lightning

* light intensity

* Lighting

* change switch network button text

* optimize effects

* less harsh light

* latest models and video sections

* sugar cube

* animated menus

* optimize instances in scene and make video hoverable

* Add stats

* add scroll test

* Fix weird flash at the loading + updated menus

* Add cursor

* Remove shimmer

* Mint button

* adjust the bloom a little

* new logo

* fix mint button

* remove orbit controls

* remove stats

* device vh

* mess with device height

* add analytics

* generic events

* eslint pass

* load draco file locally

* remove wasm exceptions

* scene mobile pass: performance fixes

* scene lint pass

* scene lint pass

* fix wasm

* fix card effect

* eslint pass

* cleanup

* linter

* local import

* local import

* Team feedback round 1

* Team feedback round 2

* toggle menu on click

* fixes

* Team feedback round 2

* Team feedback round 3

* og image

* 3D Header

* Team feedback round 4

* Team feedback round 4

* Replace cube video

* og image

* RIght click to mint

* use link component for tracking

* fix active/inactive state

* remove maath

* Team feedback round 5

* Team feedback round 6

* background tweaks

---------

Co-authored-by: Léo Galley <contact@kirkas.ch>
Co-authored-by: Mike Bodge <mbodge@gmail.com>
2024-10-11 15:05:50 -04:00

129 lines
2.6 KiB
TypeScript

import { isDevelopment } from '../constants';
declare const window: Window &
typeof globalThis & {
ClientAnalytics: {
logEvent: LogEvent;
};
};
enum ComponentType {
unknown = 'unknown',
banner = 'banner',
button = 'button',
card = 'card',
chart = 'chart',
content_script = 'content_script',
dropdown = 'dropdown',
link = 'link',
page = 'page',
modal = 'modal',
table = 'table',
search_bar = 'search_bar',
service_worker = 'service_worker',
text = 'text',
text_input = 'text_input',
tray = 'tray',
checkbox = 'checkbox',
icon = 'icon',
}
enum ActionType {
unknown = 'unknown',
blur = 'blur',
click = 'click',
change = 'change',
dismiss = 'dismiss',
focus = 'focus',
hover = 'hover',
select = 'select',
measurement = 'measurement',
move = 'move',
process = 'process',
render = 'render',
scroll = 'scroll',
view = 'view',
search = 'search',
keyPress = 'keyPress',
error = 'error',
}
enum AnalyticsEventImportance {
low = 'low',
high = 'high',
}
type CCAEventData = {
// Standard Attributes
action?: ActionType;
componentType?: ComponentType;
// Custom Attributes
doc_helpful?: boolean;
doc_feedback_reason?: string | null;
page_path?: string;
conversation_id?: number;
message_id?: number;
response_helpful?: boolean;
address?: string;
context?: string;
userId?: string;
error?: string;
wallet_type?: string;
wallet_connector_id?: string;
flag_key?: string;
variant?: string | undefined;
experiment_key?: string | undefined;
href?: string;
hostname?: string;
origin?: string;
pathname?: string;
search?: string;
};
type AnalyticsEventData = {
name: string;
event: CCAEventData;
importance: AnalyticsEventImportance;
};
type LogEvent = (
eventName: string,
eventData: CCAEventData,
importance?: AnalyticsEventImportance,
) => void;
export default function logEvent(
name: string,
event: CCAEventData,
importance: AnalyticsEventImportance | undefined,
) {
if (isDevelopment) {
return console.log('logEvent: ', {
name,
event,
importance,
});
}
const CCA = window.ClientAnalytics;
if (CCA) {
CCA?.logEvent(name, event, importance);
}
}
export function identify(event: CCAEventData) {
if (isDevelopment) {
return console.log('identify: ', {
event,
});
}
const CCA = window.ClientAnalytics;
if (CCA) {
CCA?.logEvent('identify', event, AnalyticsEventImportance.low);
}
}
export { ActionType, AnalyticsEventImportance, ComponentType };
export type { AnalyticsEventData, LogEvent, CCAEventData };