@umituz/web-dashboard 3.1.4 → 3.1.6
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/package.json +6 -2
- 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 +3 -2
- package/src/domains/auth/types/auth.ts +5 -3
- package/src/domains/auth/utils/auth.ts +1 -1
- package/src/domains/billing/components/BillingPortal.tsx +1 -1
- package/src/domains/billing/utils/billing.ts +4 -0
- package/src/domains/calendar/services/CalendarService.ts +10 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-dashboard",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.6",
|
|
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",
|
|
@@ -61,7 +61,9 @@
|
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"react": "^18.0.0 || ^19.0.0",
|
|
63
63
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
64
|
-
"react-router-dom": "^7.0.0"
|
|
64
|
+
"react-router-dom": "^6.0.0 || ^7.0.0",
|
|
65
|
+
"firebase": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
66
|
+
"@umituz/web-firebase": "^3.0.0"
|
|
65
67
|
},
|
|
66
68
|
"dependencies": {
|
|
67
69
|
"class-variance-authority": "^0.7.1",
|
|
@@ -76,7 +78,9 @@
|
|
|
76
78
|
"@typescript-eslint/eslint-plugin": "^8.57.2",
|
|
77
79
|
"@typescript-eslint/parser": "^8.57.2",
|
|
78
80
|
"@umituz/web-design-system": "^3.1.11",
|
|
81
|
+
"@umituz/web-firebase": "^3.6.0",
|
|
79
82
|
"eslint": "^10.0.2",
|
|
83
|
+
"firebase": "^12.0.0",
|
|
80
84
|
"react-i18next": "^16.5.4",
|
|
81
85
|
"react-router-dom": "^7.13.1",
|
|
82
86
|
"typescript": "^5.9.3"
|
|
@@ -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, 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: import("../services/AnalyticsEngineService").UserData[]) => {
|
|
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: import("../services/AnalyticsEngineService").FunnelItem[], 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: import("../services/AnalyticsEngineService").UserData[]) => {
|
|
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: Record<string, unknown>, historicalData:
|
|
228
|
+
(user: Record<string, unknown>, historicalData: import("../services/AnalyticsEngineService").UserData[]) => {
|
|
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?: import("../services/PerformanceService").RealtimeMetrics) => {
|
|
250
250
|
try {
|
|
251
251
|
return performanceService.simulateRealtimeMetrics(previous);
|
|
252
252
|
} catch (err) {
|
|
@@ -244,13 +244,14 @@ export function aggregateByPeriod(
|
|
|
244
244
|
});
|
|
245
245
|
|
|
246
246
|
return Array.from(grouped.entries()).map(([date, items]) => {
|
|
247
|
-
const aggregated:
|
|
247
|
+
const aggregated: { date: string; [key: string]: string | number } = { date };
|
|
248
248
|
|
|
249
249
|
// Sum all numeric fields
|
|
250
250
|
items.forEach((item) => {
|
|
251
251
|
Object.entries(item).forEach(([key, value]) => {
|
|
252
252
|
if (key !== "date" && typeof value === "number") {
|
|
253
|
-
|
|
253
|
+
const currentValue = aggregated[key];
|
|
254
|
+
aggregated[key] = typeof currentValue === "number" ? currentValue + value : value;
|
|
254
255
|
}
|
|
255
256
|
});
|
|
256
257
|
});
|
|
@@ -24,6 +24,8 @@ export interface RegisterData {
|
|
|
24
24
|
email: string;
|
|
25
25
|
/** Password */
|
|
26
26
|
password: string;
|
|
27
|
+
/** Password confirmation */
|
|
28
|
+
confirmPassword?: string;
|
|
27
29
|
/** Full name */
|
|
28
30
|
name?: string;
|
|
29
31
|
/** Additional user data */
|
|
@@ -91,9 +93,9 @@ export interface User {
|
|
|
91
93
|
*/
|
|
92
94
|
export interface AuthActions {
|
|
93
95
|
/** Login with email/password */
|
|
94
|
-
login: (credentials: LoginCredentials) => Promise<
|
|
96
|
+
login: (credentials: LoginCredentials) => Promise<User>;
|
|
95
97
|
/** Register new account */
|
|
96
|
-
register: (data: RegisterData) => Promise<
|
|
98
|
+
register: (data: RegisterData) => Promise<User>;
|
|
97
99
|
/** Logout current user */
|
|
98
100
|
logout: () => Promise<void>;
|
|
99
101
|
/** Send password reset email */
|
|
@@ -103,7 +105,7 @@ export interface AuthActions {
|
|
|
103
105
|
/** Update user profile */
|
|
104
106
|
updateProfile: (data: Partial<User>) => Promise<void>;
|
|
105
107
|
/** Refresh authentication session */
|
|
106
|
-
refresh: () => Promise<
|
|
108
|
+
refresh: () => Promise<User | null>;
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
/**
|
|
@@ -195,7 +195,7 @@ export function isEmailVerified(user: User | null): boolean {
|
|
|
195
195
|
* @returns Formatted date string or empty string
|
|
196
196
|
*/
|
|
197
197
|
export function formatUserCreatedAt(user: User | null, locale: string = "en-US"): string {
|
|
198
|
-
if (!user.createdAt) return "";
|
|
198
|
+
if (!user || !user.createdAt) return "";
|
|
199
199
|
return new Date(user.createdAt).toLocaleDateString(locale, {
|
|
200
200
|
year: "numeric",
|
|
201
201
|
month: "long",
|
|
@@ -11,7 +11,7 @@ import type { BillingPortalProps } from "../types/billing";
|
|
|
11
11
|
import { UsageCard } from "./UsageCard";
|
|
12
12
|
import { PaymentMethodsList } from "./PaymentMethodsList";
|
|
13
13
|
import { InvoiceCard } from "./InvoiceCard";
|
|
14
|
-
import { getDaysRemaining, getStatusColor, getStatusLabel, formatPrice } from "../utils/billing";
|
|
14
|
+
import { getDaysRemaining, getStatusColor, getStatusLabel, formatPrice, getPlanPrice } from "../utils/billing";
|
|
15
15
|
|
|
16
16
|
export const BillingPortal = ({
|
|
17
17
|
billing,
|
|
@@ -135,6 +135,7 @@ export function getStatusColor(status: SubscriptionStatus): string {
|
|
|
135
135
|
canceled: "text-gray-600 dark:text-gray-500",
|
|
136
136
|
unpaid: "text-red-600 dark:text-red-500",
|
|
137
137
|
incomplete: "text-yellow-600 dark:text-yellow-500",
|
|
138
|
+
revoked: "text-purple-600 dark:text-purple-500",
|
|
138
139
|
};
|
|
139
140
|
|
|
140
141
|
return colorMap[status] || "text-gray-600";
|
|
@@ -154,6 +155,7 @@ export function getStatusLabel(status: SubscriptionStatus): string {
|
|
|
154
155
|
canceled: "Canceled",
|
|
155
156
|
unpaid: "Unpaid",
|
|
156
157
|
incomplete: "Incomplete",
|
|
158
|
+
revoked: "Revoked",
|
|
157
159
|
};
|
|
158
160
|
|
|
159
161
|
return labelMap[status] || status;
|
|
@@ -172,6 +174,7 @@ export function getInvoiceStatusColor(status: InvoiceStatus): string {
|
|
|
172
174
|
paid: "text-green-600 dark:text-green-500",
|
|
173
175
|
void: "text-gray-600 dark:text-gray-500",
|
|
174
176
|
uncollectible: "text-red-600 dark:text-red-500",
|
|
177
|
+
refunded: "text-blue-600 dark:text-blue-500",
|
|
175
178
|
};
|
|
176
179
|
|
|
177
180
|
return colorMap[status] || "text-gray-600";
|
|
@@ -190,6 +193,7 @@ export function getInvoiceStatusLabel(status: InvoiceStatus): string {
|
|
|
190
193
|
paid: "Paid",
|
|
191
194
|
void: "Void",
|
|
192
195
|
uncollectible: "Uncollectible",
|
|
196
|
+
refunded: "Refunded",
|
|
193
197
|
};
|
|
194
198
|
|
|
195
199
|
return labelMap[status] || status;
|
|
@@ -31,7 +31,8 @@ class FirebaseCalendarDatabase implements ICalendarDatabase {
|
|
|
31
31
|
async getItems(userId: string): Promise<ContentItem[]> {
|
|
32
32
|
// Lazy load Firebase
|
|
33
33
|
const { collection, query, where, getDocs } = await import('firebase/firestore');
|
|
34
|
-
const {
|
|
34
|
+
const { getFirebaseDB } = await import('@umituz/web-firebase');
|
|
35
|
+
const db = getFirebaseDB();
|
|
35
36
|
|
|
36
37
|
const calendarQuery = query(
|
|
37
38
|
collection(db as any, 'calendar_items'),
|
|
@@ -76,7 +77,8 @@ class FirebaseCalendarDatabase implements ICalendarDatabase {
|
|
|
76
77
|
|
|
77
78
|
async getItemById(id: string): Promise<ContentItem | null> {
|
|
78
79
|
const { doc, getDoc } = await import('firebase/firestore');
|
|
79
|
-
const {
|
|
80
|
+
const { getFirebaseDB } = await import('@umituz/web-firebase');
|
|
81
|
+
const db = getFirebaseDB();
|
|
80
82
|
|
|
81
83
|
const docRef = doc(db as any, 'calendar_items', id);
|
|
82
84
|
const snap = await getDoc(docRef);
|
|
@@ -93,7 +95,8 @@ class FirebaseCalendarDatabase implements ICalendarDatabase {
|
|
|
93
95
|
|
|
94
96
|
async createItem(userId: string, item: CreateContentItemParams): Promise<ContentItem> {
|
|
95
97
|
const { collection, addDoc, serverTimestamp } = await import('firebase/firestore');
|
|
96
|
-
const {
|
|
98
|
+
const { getFirebaseDB } = await import('@umituz/web-firebase');
|
|
99
|
+
const db = getFirebaseDB();
|
|
97
100
|
|
|
98
101
|
const docRef = await addDoc(collection(db as any, 'calendar_items'), {
|
|
99
102
|
...item,
|
|
@@ -114,7 +117,8 @@ class FirebaseCalendarDatabase implements ICalendarDatabase {
|
|
|
114
117
|
|
|
115
118
|
async updateItem(id: string, updates: UpdateContentItemParams): Promise<void> {
|
|
116
119
|
const { doc, updateDoc, serverTimestamp } = await import('firebase/firestore');
|
|
117
|
-
const {
|
|
120
|
+
const { getFirebaseDB } = await import('@umituz/web-firebase');
|
|
121
|
+
const db = getFirebaseDB();
|
|
118
122
|
|
|
119
123
|
const docRef = doc(db as any, 'calendar_items', id);
|
|
120
124
|
|
|
@@ -133,7 +137,8 @@ class FirebaseCalendarDatabase implements ICalendarDatabase {
|
|
|
133
137
|
|
|
134
138
|
async deleteItem(id: string): Promise<void> {
|
|
135
139
|
const { doc, deleteDoc } = await import('firebase/firestore');
|
|
136
|
-
const {
|
|
140
|
+
const { getFirebaseDB } = await import('@umituz/web-firebase');
|
|
141
|
+
const db = getFirebaseDB();
|
|
137
142
|
|
|
138
143
|
const docRef = doc(db as any, 'calendar_items', id);
|
|
139
144
|
await deleteDoc(docRef);
|