@umituz/web-dashboard 3.1.1 → 3.1.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/LICENSE +21 -0
- package/README.md +32 -0
- package/package.json +1 -1
- package/src/domains/analytics/components/AnalyticsChart.tsx +1 -1
- package/src/domains/analytics/hooks/useAnalytics.ts +5 -5
- package/src/domains/analytics/utils/analytics.ts +1 -1
- package/src/domains/billing/hooks/useBilling.ts +10 -2
- package/src/domains/calendar/services/CalendarService.ts +4 -4
- package/src/domains/layouts/components/DashboardLayout.tsx +4 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 umituz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @umituz/web-dashboard
|
|
2
|
+
|
|
3
|
+
Comprehensive dashboard library with analytics, billing, calendar, and more.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Analytics dashboards with charts
|
|
8
|
+
- Billing and subscription management
|
|
9
|
+
- Calendar integration
|
|
10
|
+
- User management
|
|
11
|
+
- Real-time metrics
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @umituz/web-dashboard
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { useAnalytics } from '@umituz/web-dashboard';
|
|
23
|
+
|
|
24
|
+
function Dashboard() {
|
|
25
|
+
const { data, loading } = useAnalytics();
|
|
26
|
+
// ...
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-dashboard",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Dashboard Layout System - Comprehensive analytics, calendar, customizable layouts, and config-based architecture",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -145,7 +145,7 @@ export const AnalyticsChart = ({ config, className, height }: AnalyticsChartProp
|
|
|
145
145
|
innerRadius={config.type === "donut" ? 40 : 0}
|
|
146
146
|
dataKey="value"
|
|
147
147
|
>
|
|
148
|
-
{config.data.map((entry:
|
|
148
|
+
{config.data.map((entry: Record<string, unknown>, index: number) => (
|
|
149
149
|
<Cell key={`cell-${index}`} fill={colors[index % colors.length]} />
|
|
150
150
|
))}
|
|
151
151
|
</Pie>
|
|
@@ -189,7 +189,7 @@ export function useAnalytics(options: UseAnalyticsOptions = {}) {
|
|
|
189
189
|
|
|
190
190
|
// Advanced analytics methods
|
|
191
191
|
const calculateRetention = useCallback(
|
|
192
|
-
(userData:
|
|
192
|
+
(userData: unknown[]) => {
|
|
193
193
|
try {
|
|
194
194
|
return analyticsEngineService.calculateRetention(userData);
|
|
195
195
|
} catch (err) {
|
|
@@ -201,7 +201,7 @@ export function useAnalytics(options: UseAnalyticsOptions = {}) {
|
|
|
201
201
|
);
|
|
202
202
|
|
|
203
203
|
const calculateFunnel = useCallback(
|
|
204
|
-
(data:
|
|
204
|
+
(data: unknown[], steps: string[]) => {
|
|
205
205
|
try {
|
|
206
206
|
return analyticsEngineService.calculateFunnel(data, steps);
|
|
207
207
|
} catch (err) {
|
|
@@ -213,7 +213,7 @@ export function useAnalytics(options: UseAnalyticsOptions = {}) {
|
|
|
213
213
|
);
|
|
214
214
|
|
|
215
215
|
const segmentUsers = useCallback(
|
|
216
|
-
(userData:
|
|
216
|
+
(userData: unknown[]) => {
|
|
217
217
|
try {
|
|
218
218
|
return analyticsEngineService.segmentUsers(userData);
|
|
219
219
|
} catch (err) {
|
|
@@ -225,7 +225,7 @@ export function useAnalytics(options: UseAnalyticsOptions = {}) {
|
|
|
225
225
|
);
|
|
226
226
|
|
|
227
227
|
const predictUserBehavior = useCallback(
|
|
228
|
-
(user:
|
|
228
|
+
(user: Record<string, unknown>, historicalData: unknown[]) => {
|
|
229
229
|
try {
|
|
230
230
|
return analyticsEngineService.predictUserBehavior(user, historicalData);
|
|
231
231
|
} catch (err) {
|
|
@@ -246,7 +246,7 @@ export function useAnalytics(options: UseAnalyticsOptions = {}) {
|
|
|
246
246
|
}, [onError]);
|
|
247
247
|
|
|
248
248
|
const getRealtimeMetrics = useCallback(
|
|
249
|
-
(previous?:
|
|
249
|
+
(previous?: Record<string, unknown>) => {
|
|
250
250
|
try {
|
|
251
251
|
return performanceService.simulateRealtimeMetrics(previous);
|
|
252
252
|
} catch (err) {
|
|
@@ -244,7 +244,7 @@ export function aggregateByPeriod(
|
|
|
244
244
|
});
|
|
245
245
|
|
|
246
246
|
return Array.from(grouped.entries()).map(([date, items]) => {
|
|
247
|
-
const aggregated:
|
|
247
|
+
const aggregated: Record<string, string | number> = { date };
|
|
248
248
|
|
|
249
249
|
// Sum all numeric fields
|
|
250
250
|
items.forEach((item) => {
|
|
@@ -22,6 +22,14 @@ interface UseBillingOptions {
|
|
|
22
22
|
initialData?: BillingSummary;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
interface CardDetails {
|
|
26
|
+
last4: string;
|
|
27
|
+
brand: string;
|
|
28
|
+
expiryMonth: number;
|
|
29
|
+
expiryYear: number;
|
|
30
|
+
name?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
interface BillingActions {
|
|
26
34
|
/** Load billing summary */
|
|
27
35
|
loadBilling: () => Promise<void>;
|
|
@@ -32,7 +40,7 @@ interface BillingActions {
|
|
|
32
40
|
/** Update billing cycle */
|
|
33
41
|
updateCycle: (cycle: BillingCycle) => Promise<void>;
|
|
34
42
|
/** Add payment method */
|
|
35
|
-
addPaymentMethod: (paymentMethodDetails:
|
|
43
|
+
addPaymentMethod: (paymentMethodDetails: CardDetails) => Promise<PaymentMethod>;
|
|
36
44
|
/** Remove payment method */
|
|
37
45
|
removePaymentMethod: (methodId: string) => Promise<void>;
|
|
38
46
|
/** Set default payment method */
|
|
@@ -256,7 +264,7 @@ export function useBilling(options: UseBillingOptions = {}) {
|
|
|
256
264
|
}, [apiUrl]);
|
|
257
265
|
|
|
258
266
|
// Add payment method
|
|
259
|
-
const addPaymentMethod = useCallback(async (paymentMethodDetails:
|
|
267
|
+
const addPaymentMethod = useCallback(async (paymentMethodDetails: CardDetails) => {
|
|
260
268
|
setIsLoading(true);
|
|
261
269
|
setError(null);
|
|
262
270
|
|
|
@@ -48,19 +48,19 @@ class FirebaseCalendarDatabase implements ICalendarDatabase {
|
|
|
48
48
|
getDocs(postsQuery)
|
|
49
49
|
]);
|
|
50
50
|
|
|
51
|
-
const calendarItems = calendarSnap.docs.map((doc:
|
|
51
|
+
const calendarItems = calendarSnap.docs.map((doc: { id: string; data: () => Record<string, unknown> }) => ({
|
|
52
52
|
id: doc.id,
|
|
53
53
|
...doc.data()
|
|
54
54
|
} as ContentItem));
|
|
55
55
|
|
|
56
|
-
const postItems = postsSnap.docs.map((doc:
|
|
56
|
+
const postItems = postsSnap.docs.map((doc: { id: string; data: () => Record<string, unknown> }) => {
|
|
57
57
|
const data = doc.data();
|
|
58
58
|
return {
|
|
59
59
|
id: doc.id,
|
|
60
60
|
title: data.title || 'Untitled Post',
|
|
61
61
|
description: data.content || '',
|
|
62
62
|
scheduled_at: data.scheduledAt
|
|
63
|
-
? (typeof data.scheduledAt === 'string' ? data.scheduledAt : (data.scheduledAt as
|
|
63
|
+
? (typeof data.scheduledAt === 'string' ? data.scheduledAt : (data.scheduledAt as { toDate: () => Date })?.toDate?.().toISOString())
|
|
64
64
|
: new Date().toISOString(),
|
|
65
65
|
platforms: data.platform ? [data.platform] : [],
|
|
66
66
|
app_name: data.appName || 'My App',
|
|
@@ -118,7 +118,7 @@ class FirebaseCalendarDatabase implements ICalendarDatabase {
|
|
|
118
118
|
|
|
119
119
|
const docRef = doc(db as any, 'calendar_items', id);
|
|
120
120
|
|
|
121
|
-
const updateData:
|
|
121
|
+
const updateData: Record<string, unknown> = { ...updates };
|
|
122
122
|
if (updates.scheduled_at) {
|
|
123
123
|
updateData.scheduled_at = typeof updates.scheduled_at === 'string'
|
|
124
124
|
? updates.scheduled_at
|
|
@@ -27,6 +27,8 @@ interface DashboardLayoutProps {
|
|
|
27
27
|
onDismissNotification?: (id: string) => void;
|
|
28
28
|
/** Login route for redirect */
|
|
29
29
|
loginRoute?: string;
|
|
30
|
+
/** Children for routing */
|
|
31
|
+
children?: React.ReactNode;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
/**
|
|
@@ -54,6 +56,7 @@ export const DashboardLayout = ({
|
|
|
54
56
|
onMarkAllRead,
|
|
55
57
|
onDismissNotification,
|
|
56
58
|
loginRoute = "/login",
|
|
59
|
+
children,
|
|
57
60
|
}: DashboardLayoutProps) => {
|
|
58
61
|
const location = useLocation();
|
|
59
62
|
const { t } = useTranslation();
|
|
@@ -153,7 +156,7 @@ export const DashboardLayout = ({
|
|
|
153
156
|
<Skeleton className="h-64 rounded-[32px]" />
|
|
154
157
|
</div>
|
|
155
158
|
) : (
|
|
156
|
-
<Outlet />
|
|
159
|
+
children || <Outlet />
|
|
157
160
|
)}
|
|
158
161
|
</main>
|
|
159
162
|
</div>
|