mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 11:41:08 +02:00
Move inactive projects out of active workspace: - bauntown (community website) - maerchenzauber (AI story generation) - memoro (voice memo app) - news (news aggregation) - nutriphi (nutrition tracking) - reader (reading app) - uload (URL shortener) - wisekeep (AI wisdom extraction) Update CLAUDE.md documentation: - Add presi to active projects - Document archived projects section - Update workspace configuration Archived apps can be re-activated by moving back to apps/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
94 lines
2 KiB
TypeScript
94 lines
2 KiB
TypeScript
import { Platform } from 'react-native';
|
|
import * as Device from 'expo-device';
|
|
import Constants from 'expo-constants';
|
|
|
|
/**
|
|
* Get device information for analytics
|
|
*/
|
|
export const getDeviceInfo = () => ({
|
|
platform: Platform.OS,
|
|
platform_version: Platform.Version,
|
|
device_type: Device.deviceType,
|
|
device_name: Device.deviceName,
|
|
device_brand: Device.brand,
|
|
device_model: Device.modelName,
|
|
is_device: Device.isDevice,
|
|
app_version: Constants.expoConfig?.version,
|
|
app_build: Constants.expoConfig?.ios?.buildNumber || Constants.expoConfig?.android?.versionCode,
|
|
expo_version: Constants.expoVersion,
|
|
});
|
|
|
|
/**
|
|
* Get common event properties
|
|
*/
|
|
export const getCommonEventProperties = () => ({
|
|
timestamp: new Date().toISOString(),
|
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
...getDeviceInfo(),
|
|
});
|
|
|
|
/**
|
|
* Track error with standardized properties
|
|
*/
|
|
export const trackError = (
|
|
track: (event: string, properties?: any) => void,
|
|
error: Error | unknown,
|
|
context: {
|
|
screen?: string;
|
|
action?: string;
|
|
userId?: string;
|
|
[key: string]: any;
|
|
}
|
|
) => {
|
|
const errorData =
|
|
error instanceof Error
|
|
? {
|
|
error_name: error.name,
|
|
error_message: error.message,
|
|
error_stack: __DEV__ ? error.stack : undefined,
|
|
}
|
|
: {
|
|
error_type: 'unknown',
|
|
error_details: String(error),
|
|
};
|
|
|
|
track('error_occurred', {
|
|
...errorData,
|
|
...context,
|
|
...getCommonEventProperties(),
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Track performance metric
|
|
*/
|
|
export const trackPerformance = (
|
|
track: (event: string, properties?: any) => void,
|
|
metricName: string,
|
|
duration: number,
|
|
metadata?: Record<string, any>
|
|
) => {
|
|
track('performance_metric', {
|
|
metric_name: metricName,
|
|
duration_ms: Math.round(duration),
|
|
...metadata,
|
|
...getCommonEventProperties(),
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Track user interaction
|
|
*/
|
|
export const trackInteraction = (
|
|
track: (event: string, properties?: any) => void,
|
|
element: string,
|
|
action: string,
|
|
metadata?: Record<string, any>
|
|
) => {
|
|
track('user_interaction', {
|
|
element,
|
|
action,
|
|
...metadata,
|
|
...getCommonEventProperties(),
|
|
});
|
|
};
|