@umituz/web-dashboard 3.1.9 → 3.1.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-dashboard",
3
- "version": "3.1.9",
3
+ "version": "3.1.10",
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",
@@ -219,7 +219,7 @@ export function getDateRangePresets(): DateRangePreset[] {
219
219
  export function aggregateByPeriod(
220
220
  data: Array<{ date: string; [key: string]: number | string }>,
221
221
  period: "day" | "week" | "month" = "day"
222
- ): Array<{ date: string; [key: string]: number }> {
222
+ ): Array<{ date: string; [key: string]: number | string }> {
223
223
  const grouped = new Map<string, Array<typeof data[0]>>();
224
224
 
225
225
  data.forEach((item) => {
@@ -228,15 +228,25 @@ export function useAuth(options: UseAuthOptions = {}) {
228
228
 
229
229
  try {
230
230
  // Update local user state
231
- setAuthState((prev) => ({
232
- ...prev,
233
- user: prev.user ? { ...prev.user, ...data } : null,
234
- isLoading: false,
235
- error: null,
236
- }));
231
+ let updatedUser: User | null = null;
232
+ setAuthState((prev) => {
233
+ updatedUser = prev.user ? { ...prev.user, ...data } : null;
234
+ return {
235
+ ...prev,
236
+ user: updatedUser,
237
+ isLoading: false,
238
+ error: null,
239
+ };
240
+ });
237
241
 
238
242
  // In production, call your API here
239
243
  // await authProvider?.updateProfile(data);
244
+
245
+ if (!updatedUser) {
246
+ throw new Error("No user to update");
247
+ }
248
+
249
+ return updatedUser;
240
250
  } catch (error) {
241
251
  const errorMessage = error instanceof Error ? error.message : "Failed to update profile";
242
252
  updateState({
@@ -91,9 +91,9 @@ export interface User {
91
91
  */
92
92
  export interface AuthActions {
93
93
  /** Login with email/password */
94
- login: (credentials: LoginCredentials) => Promise<void>;
94
+ login: (credentials: LoginCredentials) => Promise<User>;
95
95
  /** Register new account */
96
- register: (data: RegisterData) => Promise<void>;
96
+ register: (data: RegisterData) => Promise<User>;
97
97
  /** Logout current user */
98
98
  logout: () => Promise<void>;
99
99
  /** Send password reset email */
@@ -101,9 +101,9 @@ export interface AuthActions {
101
101
  /** Reset password with token */
102
102
  resetPassword: (data: ResetPasswordData) => Promise<void>;
103
103
  /** Update user profile */
104
- updateProfile: (data: Partial<User>) => Promise<void>;
104
+ updateProfile: (data: Partial<User>) => Promise<User>;
105
105
  /** Refresh authentication session */
106
- refresh: () => Promise<void>;
106
+ refresh: () => Promise<User | null>;
107
107
  }
108
108
 
109
109
  /**
@@ -62,7 +62,7 @@ export function validateLogin(credentials: LoginCredentials): {
62
62
  * @returns Validation result with error message
63
63
  */
64
64
  export function validateRegister(
65
- data: RegisterData,
65
+ data: RegisterData & { confirmPassword?: string },
66
66
  requireName: boolean = false,
67
67
  requirePasswordConfirm?: boolean
68
68
  ): {
@@ -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,
@@ -9,6 +9,7 @@ import type {
9
9
  Currency,
10
10
  PlanTier,
11
11
  Subscription,
12
+ SubscriptionStatus,
12
13
  PaymentMethod,
13
14
  Invoice,
14
15
  InvoiceStatus,
@@ -125,6 +126,7 @@ export function getStatusColor(status: SubscriptionStatus): string {
125
126
  canceled: "text-gray-600 dark:text-gray-500",
126
127
  unpaid: "text-red-600 dark:text-red-500",
127
128
  incomplete: "text-yellow-600 dark:text-yellow-500",
129
+ revoked: "text-purple-600 dark:text-purple-500",
128
130
  };
129
131
 
130
132
  return colorMap[status] || "text-gray-600";
@@ -144,6 +146,7 @@ export function getStatusLabel(status: SubscriptionStatus): string {
144
146
  canceled: "Canceled",
145
147
  unpaid: "Unpaid",
146
148
  incomplete: "Incomplete",
149
+ revoked: "Revoked",
147
150
  };
148
151
 
149
152
  return labelMap[status] || status;
@@ -162,6 +165,7 @@ export function getInvoiceStatusColor(status: InvoiceStatus): string {
162
165
  paid: "text-green-600 dark:text-green-500",
163
166
  void: "text-gray-600 dark:text-gray-500",
164
167
  uncollectible: "text-red-600 dark:text-red-500",
168
+ refunded: "text-blue-600 dark:text-blue-500",
165
169
  };
166
170
 
167
171
  return colorMap[status] || "text-gray-600";
@@ -180,6 +184,7 @@ export function getInvoiceStatusLabel(status: InvoiceStatus): string {
180
184
  paid: "Paid",
181
185
  void: "Void",
182
186
  uncollectible: "Uncollectible",
187
+ refunded: "Refunded",
183
188
  };
184
189
 
185
190
  return labelMap[status] || status;
package/src/index.ts CHANGED
@@ -64,11 +64,6 @@ export {
64
64
  roundTo,
65
65
  generateColor,
66
66
  generateChartColors,
67
- // Services
68
- AnalyticsEngineService,
69
- analyticsEngineService,
70
- PerformanceService,
71
- performanceService,
72
67
  // Types
73
68
  type Metric,
74
69
  type TimeSeriesData,
@@ -87,16 +82,6 @@ export {
87
82
  type DateRangePreset,
88
83
  type DateRangeValue,
89
84
  type AnalyticsExportOptions,
90
- type ConversionPath,
91
- type HeatmapData,
92
- type UserBehaviorPrediction,
93
- type UserData,
94
- type ConversionData,
95
- type FunnelItem,
96
- type ActivityItem,
97
- type PerformanceMetric,
98
- type DashboardMetrics,
99
- type RealtimeMetrics,
100
85
  } from './domains/analytics';
101
86
 
102
87
  // Calendar