@umituz/web-dashboard 3.1.8 → 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.8",
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,12 +9,24 @@ import type {
9
9
  Currency,
10
10
  PlanTier,
11
11
  Subscription,
12
+ SubscriptionStatus,
12
13
  PaymentMethod,
13
14
  Invoice,
14
15
  InvoiceStatus,
15
16
  UsageMetric,
16
17
  } from "../types/billing";
17
18
 
19
+ /**
20
+ * Format number with thousand separators
21
+ *
22
+ * @param num - Number to format
23
+ * @param locale - Locale (default: en-US)
24
+ * @returns Formatted number string
25
+ */
26
+ export function formatNumber(num: number, locale: string = "en-US"): string {
27
+ return new Intl.NumberFormat(locale).format(num);
28
+ }
29
+
18
30
  /**
19
31
  * Format price with currency
20
32
  *
@@ -114,6 +126,7 @@ export function getStatusColor(status: SubscriptionStatus): string {
114
126
  canceled: "text-gray-600 dark:text-gray-500",
115
127
  unpaid: "text-red-600 dark:text-red-500",
116
128
  incomplete: "text-yellow-600 dark:text-yellow-500",
129
+ revoked: "text-purple-600 dark:text-purple-500",
117
130
  };
118
131
 
119
132
  return colorMap[status] || "text-gray-600";
@@ -133,6 +146,7 @@ export function getStatusLabel(status: SubscriptionStatus): string {
133
146
  canceled: "Canceled",
134
147
  unpaid: "Unpaid",
135
148
  incomplete: "Incomplete",
149
+ revoked: "Revoked",
136
150
  };
137
151
 
138
152
  return labelMap[status] || status;
@@ -151,6 +165,7 @@ export function getInvoiceStatusColor(status: InvoiceStatus): string {
151
165
  paid: "text-green-600 dark:text-green-500",
152
166
  void: "text-gray-600 dark:text-gray-500",
153
167
  uncollectible: "text-red-600 dark:text-red-500",
168
+ refunded: "text-blue-600 dark:text-blue-500",
154
169
  };
155
170
 
156
171
  return colorMap[status] || "text-gray-600";
@@ -169,6 +184,7 @@ export function getInvoiceStatusLabel(status: InvoiceStatus): string {
169
184
  paid: "Paid",
170
185
  void: "Void",
171
186
  uncollectible: "Uncollectible",
187
+ refunded: "Refunded",
172
188
  };
173
189
 
174
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