@qhr123/sa2kit 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/analytics/index.d.mts +130 -1
- package/dist/analytics/index.d.ts +130 -1
- package/dist/analytics/index.js +699 -13
- package/dist/analytics/index.js.map +1 -1
- package/dist/analytics/index.mjs +678 -2
- package/dist/analytics/index.mjs.map +1 -1
- package/package.json +2 -1
- package/tailwind.animations.js +34 -0
package/README.md
CHANGED
|
@@ -205,10 +205,12 @@ import { LanguageSwitcher } from '@qhr123/sa2kit/i18n';
|
|
|
205
205
|
|
|
206
206
|
**Requirements:**
|
|
207
207
|
- ✅ React >= 18.0.0
|
|
208
|
-
- ✅ Tailwind CSS configured in your project
|
|
208
|
+
- ✅ Tailwind CSS configured in your project ([Setup Guide](./docs/tailwind-setup.md))
|
|
209
209
|
- ✅ Next.js App Router compatible ('use client' included)
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
+
**Note:** UI components use Tailwind CSS. See the [Tailwind Setup Guide](./docs/tailwind-setup.md) for configuration instructions.
|
|
213
|
+
|
|
212
214
|
### Analytics
|
|
213
215
|
|
|
214
216
|
```typescript
|
|
@@ -258,6 +260,7 @@ function MyComponent() {
|
|
|
258
260
|
|
|
259
261
|
## Documentation
|
|
260
262
|
|
|
263
|
+
- [Tailwind CSS Setup](./docs/tailwind-setup.md) - **UI Components Configuration**
|
|
261
264
|
- [Logger Documentation](./docs/logger.md)
|
|
262
265
|
- [Utility Functions](./docs/utils.md)
|
|
263
266
|
- [React Hooks](./docs/hooks.md)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* 埋点系统类型定义
|
|
3
5
|
* Analytics System Type Definitions
|
|
@@ -923,6 +925,133 @@ declare class DesktopDeviceAdapter implements AnalyticsDeviceAdapter {
|
|
|
923
925
|
private getOSVersion;
|
|
924
926
|
}
|
|
925
927
|
|
|
928
|
+
/**
|
|
929
|
+
* 埋点管理界面组件类型
|
|
930
|
+
* Analytics Dashboard Component Types
|
|
931
|
+
*/
|
|
932
|
+
interface DashboardEvent {
|
|
933
|
+
id: string;
|
|
934
|
+
eventType: string;
|
|
935
|
+
eventName: string;
|
|
936
|
+
timestamp: string;
|
|
937
|
+
priority: number;
|
|
938
|
+
userId?: string | null;
|
|
939
|
+
sessionId: string;
|
|
940
|
+
deviceId: string;
|
|
941
|
+
pageUrl?: string | null;
|
|
942
|
+
pageTitle?: string | null;
|
|
943
|
+
referrer?: string | null;
|
|
944
|
+
properties?: Record<string, any>;
|
|
945
|
+
platform: string;
|
|
946
|
+
appVersion: string;
|
|
947
|
+
sdkVersion: string;
|
|
948
|
+
}
|
|
949
|
+
interface DashboardStats {
|
|
950
|
+
totalEvents: number;
|
|
951
|
+
uniqueUsers: number;
|
|
952
|
+
uniqueSessions: number;
|
|
953
|
+
uniqueDevices: number;
|
|
954
|
+
eventsByType: {
|
|
955
|
+
eventType: string;
|
|
956
|
+
count: number;
|
|
957
|
+
}[];
|
|
958
|
+
eventsByPlatform: {
|
|
959
|
+
platform: string;
|
|
960
|
+
count: number;
|
|
961
|
+
}[];
|
|
962
|
+
topPages: {
|
|
963
|
+
pageUrl: string;
|
|
964
|
+
count: number;
|
|
965
|
+
}[];
|
|
966
|
+
}
|
|
967
|
+
interface DateRange {
|
|
968
|
+
startDate: string;
|
|
969
|
+
endDate: string;
|
|
970
|
+
}
|
|
971
|
+
interface FilterOptions {
|
|
972
|
+
dateRange?: DateRange;
|
|
973
|
+
eventType?: string;
|
|
974
|
+
platform?: string;
|
|
975
|
+
userId?: string;
|
|
976
|
+
}
|
|
977
|
+
interface ChartDataPoint {
|
|
978
|
+
name: string;
|
|
979
|
+
value: number;
|
|
980
|
+
[key: string]: any;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* 统计卡片组件
|
|
985
|
+
* Statistics Card Component
|
|
986
|
+
*/
|
|
987
|
+
|
|
988
|
+
interface StatCardProps {
|
|
989
|
+
title: string;
|
|
990
|
+
value: string | number;
|
|
991
|
+
subtitle?: string;
|
|
992
|
+
icon?: React__default.ReactNode;
|
|
993
|
+
trend?: {
|
|
994
|
+
value: number;
|
|
995
|
+
isPositive: boolean;
|
|
996
|
+
};
|
|
997
|
+
className?: string;
|
|
998
|
+
}
|
|
999
|
+
declare const StatCard: React__default.FC<StatCardProps>;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* 事件列表组件
|
|
1003
|
+
* Events List Component
|
|
1004
|
+
*/
|
|
1005
|
+
|
|
1006
|
+
interface EventListProps {
|
|
1007
|
+
events: DashboardEvent[];
|
|
1008
|
+
loading?: boolean;
|
|
1009
|
+
onEventClick?: (event: DashboardEvent) => void;
|
|
1010
|
+
className?: string;
|
|
1011
|
+
}
|
|
1012
|
+
declare const EventList: React__default.FC<EventListProps>;
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* 筛选面板组件
|
|
1016
|
+
* Filter Panel Component
|
|
1017
|
+
*/
|
|
1018
|
+
|
|
1019
|
+
interface FilterPanelProps {
|
|
1020
|
+
onFilterChange: (filters: FilterOptions) => void;
|
|
1021
|
+
initialFilters?: FilterOptions;
|
|
1022
|
+
className?: string;
|
|
1023
|
+
}
|
|
1024
|
+
declare const FilterPanel: React__default.FC<FilterPanelProps>;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* 图表组件
|
|
1028
|
+
* Charts Component
|
|
1029
|
+
*/
|
|
1030
|
+
|
|
1031
|
+
interface PieChartProps {
|
|
1032
|
+
data: ChartDataPoint[];
|
|
1033
|
+
title?: string;
|
|
1034
|
+
className?: string;
|
|
1035
|
+
}
|
|
1036
|
+
declare const PieChart: React__default.FC<PieChartProps>;
|
|
1037
|
+
interface BarChartProps {
|
|
1038
|
+
data: ChartDataPoint[];
|
|
1039
|
+
title?: string;
|
|
1040
|
+
className?: string;
|
|
1041
|
+
}
|
|
1042
|
+
declare const BarChart: React__default.FC<BarChartProps>;
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* 埋点数据仪表板组件
|
|
1046
|
+
* Analytics Dashboard Component
|
|
1047
|
+
*/
|
|
1048
|
+
|
|
1049
|
+
interface AnalyticsDashboardProps {
|
|
1050
|
+
apiBaseUrl?: string;
|
|
1051
|
+
className?: string;
|
|
1052
|
+
}
|
|
1053
|
+
declare const AnalyticsDashboard: React__default.FC<AnalyticsDashboardProps>;
|
|
1054
|
+
|
|
926
1055
|
/**
|
|
927
1056
|
* Analytics 埋点分析模块
|
|
928
1057
|
*
|
|
@@ -932,4 +1061,4 @@ declare class DesktopDeviceAdapter implements AnalyticsDeviceAdapter {
|
|
|
932
1061
|
|
|
933
1062
|
declare const ANALYTICS_VERSION = "1.0.0";
|
|
934
1063
|
|
|
935
|
-
export { ANALYTICS_VERSION, Analytics, type AnalyticsConfig, type AnalyticsDeviceAdapter, type AnalyticsEvent, type AnalyticsNetworkAdapter, type AnalyticsStorageAdapter, type ApiCallEvent, type BaseEvent, CatchError, type ClickEvent, DesktopDeviceAdapter, DesktopNetworkAdapter, DesktopStorageAdapter, type DeviceInfo, type ErrorEvent, EventPriority, EventQueue, EventType, MiniappDeviceAdapter, MiniappNetworkAdapter, MiniappStorageAdapter, MobileDeviceAdapter, MobileNetworkAdapter, MobileStorageAdapter, type PageViewEvent, type PerformanceEvent, Track, TrackClick, TrackPerformance, type UploadResponse, Uploader, WebDeviceAdapter, WebNetworkAdapter, WebStorageAdapter, createAnalytics, createDesktopConfig, createMiniappConfig, createMobileConfig, createWebConfig, debounce, deepClone, formatEvent, formatTimestamp, generateUniqueId, getAllInstanceKeys, getAnalyticsInstance, getBatchSize, getCurrentPageTitle, getCurrentPageUrl, getEventSize, getGlobalAnalytics, getPageDuration, getReferrer, isAnalyticsInitialized, isDevelopment, isMobile, mergeEventProperties, resetAllAnalytics, resetAnalytics, safeParse, safeStringify, sanitizeEvent, setGlobalAnalytics, throttle, useAnalytics, useAutoTracking, useErrorTracking, usePageDuration, usePageView, usePerformanceTracking, useTrackClick, useTrackEvent, validateEvent, validateEvents, webAdapter };
|
|
1064
|
+
export { ANALYTICS_VERSION, Analytics, type AnalyticsConfig, AnalyticsDashboard, type AnalyticsDashboardProps, type AnalyticsDeviceAdapter, type AnalyticsEvent, type AnalyticsNetworkAdapter, type AnalyticsStorageAdapter, type ApiCallEvent, BarChart, type BaseEvent, CatchError, type ChartDataPoint, type ClickEvent, type DashboardEvent, type DashboardStats, DesktopDeviceAdapter, DesktopNetworkAdapter, DesktopStorageAdapter, type DeviceInfo, type ErrorEvent, EventList, type EventListProps, EventPriority, EventQueue, EventType, type FilterOptions, FilterPanel, type FilterPanelProps, MiniappDeviceAdapter, MiniappNetworkAdapter, MiniappStorageAdapter, MobileDeviceAdapter, MobileNetworkAdapter, MobileStorageAdapter, type PageViewEvent, type PerformanceEvent, PieChart, StatCard, type StatCardProps, Track, TrackClick, TrackPerformance, type UploadResponse, Uploader, WebDeviceAdapter, WebNetworkAdapter, WebStorageAdapter, createAnalytics, createDesktopConfig, createMiniappConfig, createMobileConfig, createWebConfig, debounce, deepClone, formatEvent, formatTimestamp, generateUniqueId, getAllInstanceKeys, getAnalyticsInstance, getBatchSize, getCurrentPageTitle, getCurrentPageUrl, getEventSize, getGlobalAnalytics, getPageDuration, getReferrer, isAnalyticsInitialized, isDevelopment, isMobile, mergeEventProperties, resetAllAnalytics, resetAnalytics, safeParse, safeStringify, sanitizeEvent, setGlobalAnalytics, throttle, useAnalytics, useAutoTracking, useErrorTracking, usePageDuration, usePageView, usePerformanceTracking, useTrackClick, useTrackEvent, validateEvent, validateEvents, webAdapter };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* 埋点系统类型定义
|
|
3
5
|
* Analytics System Type Definitions
|
|
@@ -923,6 +925,133 @@ declare class DesktopDeviceAdapter implements AnalyticsDeviceAdapter {
|
|
|
923
925
|
private getOSVersion;
|
|
924
926
|
}
|
|
925
927
|
|
|
928
|
+
/**
|
|
929
|
+
* 埋点管理界面组件类型
|
|
930
|
+
* Analytics Dashboard Component Types
|
|
931
|
+
*/
|
|
932
|
+
interface DashboardEvent {
|
|
933
|
+
id: string;
|
|
934
|
+
eventType: string;
|
|
935
|
+
eventName: string;
|
|
936
|
+
timestamp: string;
|
|
937
|
+
priority: number;
|
|
938
|
+
userId?: string | null;
|
|
939
|
+
sessionId: string;
|
|
940
|
+
deviceId: string;
|
|
941
|
+
pageUrl?: string | null;
|
|
942
|
+
pageTitle?: string | null;
|
|
943
|
+
referrer?: string | null;
|
|
944
|
+
properties?: Record<string, any>;
|
|
945
|
+
platform: string;
|
|
946
|
+
appVersion: string;
|
|
947
|
+
sdkVersion: string;
|
|
948
|
+
}
|
|
949
|
+
interface DashboardStats {
|
|
950
|
+
totalEvents: number;
|
|
951
|
+
uniqueUsers: number;
|
|
952
|
+
uniqueSessions: number;
|
|
953
|
+
uniqueDevices: number;
|
|
954
|
+
eventsByType: {
|
|
955
|
+
eventType: string;
|
|
956
|
+
count: number;
|
|
957
|
+
}[];
|
|
958
|
+
eventsByPlatform: {
|
|
959
|
+
platform: string;
|
|
960
|
+
count: number;
|
|
961
|
+
}[];
|
|
962
|
+
topPages: {
|
|
963
|
+
pageUrl: string;
|
|
964
|
+
count: number;
|
|
965
|
+
}[];
|
|
966
|
+
}
|
|
967
|
+
interface DateRange {
|
|
968
|
+
startDate: string;
|
|
969
|
+
endDate: string;
|
|
970
|
+
}
|
|
971
|
+
interface FilterOptions {
|
|
972
|
+
dateRange?: DateRange;
|
|
973
|
+
eventType?: string;
|
|
974
|
+
platform?: string;
|
|
975
|
+
userId?: string;
|
|
976
|
+
}
|
|
977
|
+
interface ChartDataPoint {
|
|
978
|
+
name: string;
|
|
979
|
+
value: number;
|
|
980
|
+
[key: string]: any;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* 统计卡片组件
|
|
985
|
+
* Statistics Card Component
|
|
986
|
+
*/
|
|
987
|
+
|
|
988
|
+
interface StatCardProps {
|
|
989
|
+
title: string;
|
|
990
|
+
value: string | number;
|
|
991
|
+
subtitle?: string;
|
|
992
|
+
icon?: React__default.ReactNode;
|
|
993
|
+
trend?: {
|
|
994
|
+
value: number;
|
|
995
|
+
isPositive: boolean;
|
|
996
|
+
};
|
|
997
|
+
className?: string;
|
|
998
|
+
}
|
|
999
|
+
declare const StatCard: React__default.FC<StatCardProps>;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* 事件列表组件
|
|
1003
|
+
* Events List Component
|
|
1004
|
+
*/
|
|
1005
|
+
|
|
1006
|
+
interface EventListProps {
|
|
1007
|
+
events: DashboardEvent[];
|
|
1008
|
+
loading?: boolean;
|
|
1009
|
+
onEventClick?: (event: DashboardEvent) => void;
|
|
1010
|
+
className?: string;
|
|
1011
|
+
}
|
|
1012
|
+
declare const EventList: React__default.FC<EventListProps>;
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* 筛选面板组件
|
|
1016
|
+
* Filter Panel Component
|
|
1017
|
+
*/
|
|
1018
|
+
|
|
1019
|
+
interface FilterPanelProps {
|
|
1020
|
+
onFilterChange: (filters: FilterOptions) => void;
|
|
1021
|
+
initialFilters?: FilterOptions;
|
|
1022
|
+
className?: string;
|
|
1023
|
+
}
|
|
1024
|
+
declare const FilterPanel: React__default.FC<FilterPanelProps>;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* 图表组件
|
|
1028
|
+
* Charts Component
|
|
1029
|
+
*/
|
|
1030
|
+
|
|
1031
|
+
interface PieChartProps {
|
|
1032
|
+
data: ChartDataPoint[];
|
|
1033
|
+
title?: string;
|
|
1034
|
+
className?: string;
|
|
1035
|
+
}
|
|
1036
|
+
declare const PieChart: React__default.FC<PieChartProps>;
|
|
1037
|
+
interface BarChartProps {
|
|
1038
|
+
data: ChartDataPoint[];
|
|
1039
|
+
title?: string;
|
|
1040
|
+
className?: string;
|
|
1041
|
+
}
|
|
1042
|
+
declare const BarChart: React__default.FC<BarChartProps>;
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* 埋点数据仪表板组件
|
|
1046
|
+
* Analytics Dashboard Component
|
|
1047
|
+
*/
|
|
1048
|
+
|
|
1049
|
+
interface AnalyticsDashboardProps {
|
|
1050
|
+
apiBaseUrl?: string;
|
|
1051
|
+
className?: string;
|
|
1052
|
+
}
|
|
1053
|
+
declare const AnalyticsDashboard: React__default.FC<AnalyticsDashboardProps>;
|
|
1054
|
+
|
|
926
1055
|
/**
|
|
927
1056
|
* Analytics 埋点分析模块
|
|
928
1057
|
*
|
|
@@ -932,4 +1061,4 @@ declare class DesktopDeviceAdapter implements AnalyticsDeviceAdapter {
|
|
|
932
1061
|
|
|
933
1062
|
declare const ANALYTICS_VERSION = "1.0.0";
|
|
934
1063
|
|
|
935
|
-
export { ANALYTICS_VERSION, Analytics, type AnalyticsConfig, type AnalyticsDeviceAdapter, type AnalyticsEvent, type AnalyticsNetworkAdapter, type AnalyticsStorageAdapter, type ApiCallEvent, type BaseEvent, CatchError, type ClickEvent, DesktopDeviceAdapter, DesktopNetworkAdapter, DesktopStorageAdapter, type DeviceInfo, type ErrorEvent, EventPriority, EventQueue, EventType, MiniappDeviceAdapter, MiniappNetworkAdapter, MiniappStorageAdapter, MobileDeviceAdapter, MobileNetworkAdapter, MobileStorageAdapter, type PageViewEvent, type PerformanceEvent, Track, TrackClick, TrackPerformance, type UploadResponse, Uploader, WebDeviceAdapter, WebNetworkAdapter, WebStorageAdapter, createAnalytics, createDesktopConfig, createMiniappConfig, createMobileConfig, createWebConfig, debounce, deepClone, formatEvent, formatTimestamp, generateUniqueId, getAllInstanceKeys, getAnalyticsInstance, getBatchSize, getCurrentPageTitle, getCurrentPageUrl, getEventSize, getGlobalAnalytics, getPageDuration, getReferrer, isAnalyticsInitialized, isDevelopment, isMobile, mergeEventProperties, resetAllAnalytics, resetAnalytics, safeParse, safeStringify, sanitizeEvent, setGlobalAnalytics, throttle, useAnalytics, useAutoTracking, useErrorTracking, usePageDuration, usePageView, usePerformanceTracking, useTrackClick, useTrackEvent, validateEvent, validateEvents, webAdapter };
|
|
1064
|
+
export { ANALYTICS_VERSION, Analytics, type AnalyticsConfig, AnalyticsDashboard, type AnalyticsDashboardProps, type AnalyticsDeviceAdapter, type AnalyticsEvent, type AnalyticsNetworkAdapter, type AnalyticsStorageAdapter, type ApiCallEvent, BarChart, type BaseEvent, CatchError, type ChartDataPoint, type ClickEvent, type DashboardEvent, type DashboardStats, DesktopDeviceAdapter, DesktopNetworkAdapter, DesktopStorageAdapter, type DeviceInfo, type ErrorEvent, EventList, type EventListProps, EventPriority, EventQueue, EventType, type FilterOptions, FilterPanel, type FilterPanelProps, MiniappDeviceAdapter, MiniappNetworkAdapter, MiniappStorageAdapter, MobileDeviceAdapter, MobileNetworkAdapter, MobileStorageAdapter, type PageViewEvent, type PerformanceEvent, PieChart, StatCard, type StatCardProps, Track, TrackClick, TrackPerformance, type UploadResponse, Uploader, WebDeviceAdapter, WebNetworkAdapter, WebStorageAdapter, createAnalytics, createDesktopConfig, createMiniappConfig, createMobileConfig, createWebConfig, debounce, deepClone, formatEvent, formatTimestamp, generateUniqueId, getAllInstanceKeys, getAnalyticsInstance, getBatchSize, getCurrentPageTitle, getCurrentPageUrl, getEventSize, getGlobalAnalytics, getPageDuration, getReferrer, isAnalyticsInitialized, isDevelopment, isMobile, mergeEventProperties, resetAllAnalytics, resetAnalytics, safeParse, safeStringify, sanitizeEvent, setGlobalAnalytics, throttle, useAnalytics, useAutoTracking, useErrorTracking, usePageDuration, usePageView, usePerformanceTracking, useTrackClick, useTrackEvent, validateEvent, validateEvents, webAdapter };
|