@umituz/web-firebase 2.1.1 → 3.0.0
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 +12 -39
- package/src/domains/auth/entities/index.ts +60 -0
- package/src/domains/auth/index.ts +13 -0
- package/src/domains/auth/services/auth.service.ts +245 -0
- package/src/domains/auth/services/index.ts +7 -0
- package/src/domains/auth/types/auth-service.interface.ts +72 -0
- package/src/domains/auth/types/index.ts +5 -0
- package/src/domains/firestore/entities/index.ts +82 -0
- package/src/domains/firestore/index.ts +13 -0
- package/src/domains/firestore/services/firestore.service.ts +191 -0
- package/src/domains/firestore/services/index.ts +7 -0
- package/src/domains/firestore/types/firestore-service.interface.ts +64 -0
- package/src/domains/firestore/types/index.ts +5 -0
- package/src/domains/storage/entities/index.ts +94 -0
- package/src/domains/storage/index.ts +13 -0
- package/src/domains/storage/services/index.ts +7 -0
- package/src/domains/storage/services/storage.service.ts +223 -0
- package/src/domains/storage/types/index.ts +5 -0
- package/src/domains/storage/types/storage-service.interface.ts +120 -0
- package/src/index.ts +12 -16
- package/src/presentation/hooks/useAuth.ts +69 -26
- package/src/presentation/providers/FirebaseProvider.tsx +9 -14
- package/dist/application/index.d.mts +0 -273
- package/dist/application/index.d.ts +0 -273
- package/dist/application/index.js +0 -490
- package/dist/application/index.mjs +0 -19
- package/dist/chunk-34DL2QWQ.mjs +0 -87
- package/dist/chunk-4FP2ELQ5.mjs +0 -96
- package/dist/chunk-7TX3OU3O.mjs +0 -721
- package/dist/chunk-I6WGBPFB.mjs +0 -439
- package/dist/chunk-RZ4QR6TB.mjs +0 -96
- package/dist/chunk-U2XI4MGO.mjs +0 -397
- package/dist/domain/index.d.mts +0 -325
- package/dist/domain/index.d.ts +0 -325
- package/dist/domain/index.js +0 -662
- package/dist/domain/index.mjs +0 -36
- package/dist/file.repository.interface-v5vHgVsZ.d.mts +0 -241
- package/dist/file.repository.interface-v5vHgVsZ.d.ts +0 -241
- package/dist/firebase.entity-xvfEPjXZ.d.mts +0 -15
- package/dist/firebase.entity-xvfEPjXZ.d.ts +0 -15
- package/dist/index.d.mts +0 -14
- package/dist/index.d.ts +0 -14
- package/dist/index.js +0 -1833
- package/dist/index.mjs +0 -98
- package/dist/infrastructure/index.d.mts +0 -170
- package/dist/infrastructure/index.d.ts +0 -170
- package/dist/infrastructure/index.js +0 -856
- package/dist/infrastructure/index.mjs +0 -46
- package/dist/presentation/index.d.mts +0 -25
- package/dist/presentation/index.d.ts +0 -25
- package/dist/presentation/index.js +0 -105
- package/dist/presentation/index.mjs +0 -6
- package/dist/user.repository.interface-DS74TsJ5.d.mts +0 -298
- package/dist/user.repository.interface-DS74TsJ5.d.ts +0 -298
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import { UserCredential, User as User$1 } from 'firebase/auth';
|
|
2
|
-
import { QueryConstraint } from 'firebase/firestore';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* User Domain Entities
|
|
6
|
-
* @description Core user-related entities following DDD principles
|
|
7
|
-
* Migrated from: /Users/umituz/Desktop/github/umituz/apps/web/app-growth-factory/src/domains/firebase/types/index.ts
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* User Profile Value Object
|
|
11
|
-
* Immutable user profile data
|
|
12
|
-
*/
|
|
13
|
-
interface UserProfile {
|
|
14
|
-
readonly id: string;
|
|
15
|
-
readonly email: string;
|
|
16
|
-
readonly displayName: string;
|
|
17
|
-
readonly photoURL?: string;
|
|
18
|
-
readonly phoneNumber?: string;
|
|
19
|
-
readonly createdAt: number;
|
|
20
|
-
readonly updatedAt: number;
|
|
21
|
-
readonly lastLoginAt: number;
|
|
22
|
-
readonly emailVerified: boolean;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* User Notifications Settings
|
|
26
|
-
*/
|
|
27
|
-
interface UserNotifications {
|
|
28
|
-
email: boolean;
|
|
29
|
-
push: boolean;
|
|
30
|
-
marketing: boolean;
|
|
31
|
-
security: boolean;
|
|
32
|
-
weeklyDigest: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* User Privacy Settings
|
|
36
|
-
*/
|
|
37
|
-
interface UserPrivacy {
|
|
38
|
-
profileVisibility: 'public' | 'private';
|
|
39
|
-
showEmail: boolean;
|
|
40
|
-
showPhone: boolean;
|
|
41
|
-
dataSharing: boolean;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* User Settings Value Object
|
|
45
|
-
*/
|
|
46
|
-
interface UserSettings {
|
|
47
|
-
theme: 'light' | 'dark' | 'system';
|
|
48
|
-
language: string;
|
|
49
|
-
timezone: string;
|
|
50
|
-
currency: string;
|
|
51
|
-
notifications: UserNotifications;
|
|
52
|
-
privacy: UserPrivacy;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* User Subscription Value Object
|
|
56
|
-
*/
|
|
57
|
-
interface UserSubscription {
|
|
58
|
-
plan: 'free' | 'standard' | 'professional' | 'business';
|
|
59
|
-
status: 'active' | 'inactive' | 'canceled' | 'past_due';
|
|
60
|
-
polarCustomerId?: string;
|
|
61
|
-
polarSubscriptionId?: string;
|
|
62
|
-
currentPeriodStart?: number;
|
|
63
|
-
currentPeriodEnd?: number;
|
|
64
|
-
cancelAtPeriodEnd: boolean;
|
|
65
|
-
readonly createdAt: number;
|
|
66
|
-
readonly updatedAt: number;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Account Metrics Value Object
|
|
70
|
-
*/
|
|
71
|
-
interface AccountMetrics {
|
|
72
|
-
followers: number;
|
|
73
|
-
following: number;
|
|
74
|
-
posts: number;
|
|
75
|
-
engagement: number;
|
|
76
|
-
lastSyncedAt: number;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* User Connected Account Entity
|
|
80
|
-
*/
|
|
81
|
-
interface UserConnectedAccount {
|
|
82
|
-
platform: 'twitter' | 'facebook' | 'instagram' | 'linkedin' | 'tiktok' | 'youtube' | 'pinterest' | 'reddit' | 'threads' | 'discord' | 'telegram' | 'mastodon' | 'medium';
|
|
83
|
-
connected: boolean;
|
|
84
|
-
readonly connectedAt: number;
|
|
85
|
-
username?: string;
|
|
86
|
-
profileId?: string;
|
|
87
|
-
accessToken?: string;
|
|
88
|
-
refreshToken?: string;
|
|
89
|
-
tokenExpiresAt?: number;
|
|
90
|
-
metrics?: AccountMetrics;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* User Content Entity
|
|
94
|
-
*/
|
|
95
|
-
interface UserContent {
|
|
96
|
-
readonly id: string;
|
|
97
|
-
type: 'post' | 'article' | 'video' | 'image' | 'story' | 'reel';
|
|
98
|
-
title: string;
|
|
99
|
-
content: string;
|
|
100
|
-
platforms: string[];
|
|
101
|
-
status: 'draft' | 'scheduled' | 'published' | 'failed';
|
|
102
|
-
scheduledFor?: number;
|
|
103
|
-
publishedAt?: number;
|
|
104
|
-
readonly createdAt: number;
|
|
105
|
-
readonly updatedAt: number;
|
|
106
|
-
mediaUrls?: string[];
|
|
107
|
-
metadata?: Record<string, unknown>;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Platform Breakdown for Analytics
|
|
111
|
-
*/
|
|
112
|
-
interface PlatformBreakdown {
|
|
113
|
-
[platform: string]: {
|
|
114
|
-
posts: number;
|
|
115
|
-
engagement: number;
|
|
116
|
-
reach: number;
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* User Analytics Value Object
|
|
121
|
-
*/
|
|
122
|
-
interface UserAnalytics {
|
|
123
|
-
totalPosts: number;
|
|
124
|
-
totalEngagement: number;
|
|
125
|
-
totalReach: number;
|
|
126
|
-
topPerformingPosts: string[];
|
|
127
|
-
platformBreakdown: PlatformBreakdown;
|
|
128
|
-
lastCalculatedAt: number;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* User Credits Value Object
|
|
132
|
-
*/
|
|
133
|
-
interface UserCredits {
|
|
134
|
-
standard: number;
|
|
135
|
-
professional: number;
|
|
136
|
-
total: number;
|
|
137
|
-
resetAt: number;
|
|
138
|
-
lastResetAt: number;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* User Aggregate Root
|
|
142
|
-
* Main user document containing all user-related data
|
|
143
|
-
* This is the aggregate root for the User domain
|
|
144
|
-
*/
|
|
145
|
-
interface User {
|
|
146
|
-
readonly profile: UserProfile;
|
|
147
|
-
settings: UserSettings;
|
|
148
|
-
subscription: UserSubscription;
|
|
149
|
-
connectedAccounts: UserConnectedAccount[];
|
|
150
|
-
content: UserContent[];
|
|
151
|
-
analytics: UserAnalytics;
|
|
152
|
-
credits: UserCredits;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Collection Constants
|
|
156
|
-
*/
|
|
157
|
-
declare const USER_COLLECTIONS: {
|
|
158
|
-
readonly USERS: "users";
|
|
159
|
-
readonly CONTENT: "content";
|
|
160
|
-
readonly ANALYTICS: "analytics";
|
|
161
|
-
readonly CONNECTED_ACCOUNTS: "connectedAccounts";
|
|
162
|
-
};
|
|
163
|
-
declare const USER_SUBCOLLECTIONS: {
|
|
164
|
-
readonly CONTENT: "content";
|
|
165
|
-
readonly ANALYTICS: "analytics";
|
|
166
|
-
readonly SCHEDULED: "scheduled";
|
|
167
|
-
readonly PUBLISHED: "published";
|
|
168
|
-
readonly DRAFTS: "drafts";
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Authentication Repository Interface
|
|
173
|
-
* @description Defines contract for authentication operations
|
|
174
|
-
*/
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Authentication Repository Interface
|
|
178
|
-
* Defines operations for user authentication and management
|
|
179
|
-
*/
|
|
180
|
-
interface IAuthRepository {
|
|
181
|
-
/**
|
|
182
|
-
* Sign in with email and password
|
|
183
|
-
*/
|
|
184
|
-
signIn(email: string, password: string): Promise<UserCredential>;
|
|
185
|
-
/**
|
|
186
|
-
* Sign up with email, password, and display name
|
|
187
|
-
*/
|
|
188
|
-
signUp(email: string, password: string, displayName: string): Promise<UserCredential>;
|
|
189
|
-
/**
|
|
190
|
-
* Sign in with Google OAuth
|
|
191
|
-
*/
|
|
192
|
-
signInWithGoogle(): Promise<UserCredential>;
|
|
193
|
-
/**
|
|
194
|
-
* Sign out current user
|
|
195
|
-
*/
|
|
196
|
-
signOut(): Promise<void>;
|
|
197
|
-
/**
|
|
198
|
-
* Send password reset email
|
|
199
|
-
*/
|
|
200
|
-
sendPasswordReset(email: string): Promise<void>;
|
|
201
|
-
/**
|
|
202
|
-
* Resend email verification
|
|
203
|
-
*/
|
|
204
|
-
resendEmailVerification(): Promise<void>;
|
|
205
|
-
/**
|
|
206
|
-
* Update user profile (displayName, photoURL)
|
|
207
|
-
*/
|
|
208
|
-
updateProfile(updates: Partial<Pick<User['profile'], 'displayName' | 'photoURL'>>): Promise<void>;
|
|
209
|
-
/**
|
|
210
|
-
* Update user email (requires password)
|
|
211
|
-
*/
|
|
212
|
-
updateEmail(newEmail: string, password: string): Promise<void>;
|
|
213
|
-
/**
|
|
214
|
-
* Update user password (requires current password)
|
|
215
|
-
*/
|
|
216
|
-
updatePassword(currentPassword: string, newPassword: string): Promise<void>;
|
|
217
|
-
/**
|
|
218
|
-
* Delete user account (requires password)
|
|
219
|
-
*/
|
|
220
|
-
deleteAccount(password: string): Promise<void>;
|
|
221
|
-
/**
|
|
222
|
-
* Get current authenticated user
|
|
223
|
-
*/
|
|
224
|
-
getCurrentUser(): User$1 | null;
|
|
225
|
-
/**
|
|
226
|
-
* Subscribe to auth state changes
|
|
227
|
-
*/
|
|
228
|
-
onAuthStateChanged(callback: (user: User$1 | null) => void): () => void;
|
|
229
|
-
/**
|
|
230
|
-
* Create user document in Firestore
|
|
231
|
-
*/
|
|
232
|
-
createUserDocument(userId: string, data: Partial<Omit<User, 'profile'>> & {
|
|
233
|
-
email: string;
|
|
234
|
-
displayName: string;
|
|
235
|
-
}): Promise<void>;
|
|
236
|
-
/**
|
|
237
|
-
* Update last login timestamp
|
|
238
|
-
*/
|
|
239
|
-
updateLastLogin(userId: string): Promise<void>;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* User Repository Interface
|
|
244
|
-
* @description Defines contract for user data operations
|
|
245
|
-
*/
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* User Repository Interface
|
|
249
|
-
* Defines operations for user data management
|
|
250
|
-
*/
|
|
251
|
-
interface IUserRepository {
|
|
252
|
-
/**
|
|
253
|
-
* Get user by ID
|
|
254
|
-
*/
|
|
255
|
-
getUser(userId: string): Promise<User | null>;
|
|
256
|
-
/**
|
|
257
|
-
* Get user by email
|
|
258
|
-
*/
|
|
259
|
-
getUserByEmail(email: string): Promise<User | null>;
|
|
260
|
-
/**
|
|
261
|
-
* Create user
|
|
262
|
-
*/
|
|
263
|
-
createUser(userId: string, data: Partial<User>): Promise<void>;
|
|
264
|
-
/**
|
|
265
|
-
* Update user
|
|
266
|
-
*/
|
|
267
|
-
updateUser(userId: string, data: Partial<User>): Promise<void>;
|
|
268
|
-
/**
|
|
269
|
-
* Delete user
|
|
270
|
-
*/
|
|
271
|
-
deleteUser(userId: string): Promise<void>;
|
|
272
|
-
/**
|
|
273
|
-
* Update user profile
|
|
274
|
-
*/
|
|
275
|
-
updateProfile(userId: string, updates: Partial<Pick<User['profile'], 'displayName' | 'photoURL' | 'phoneNumber'>>): Promise<void>;
|
|
276
|
-
/**
|
|
277
|
-
* Update user settings
|
|
278
|
-
*/
|
|
279
|
-
updateSettings(userId: string, settings: Partial<User['settings']>): Promise<void>;
|
|
280
|
-
/**
|
|
281
|
-
* Update user subscription
|
|
282
|
-
*/
|
|
283
|
-
updateSubscription(userId: string, subscription: Partial<User['subscription']>): Promise<void>;
|
|
284
|
-
/**
|
|
285
|
-
* Update last login timestamp
|
|
286
|
-
*/
|
|
287
|
-
updateLastLogin(userId: string): Promise<void>;
|
|
288
|
-
/**
|
|
289
|
-
* Query users with constraints
|
|
290
|
-
*/
|
|
291
|
-
queryUsers(constraints: QueryConstraint[]): Promise<User[]>;
|
|
292
|
-
/**
|
|
293
|
-
* Subscribe to user document changes
|
|
294
|
-
*/
|
|
295
|
-
subscribeToUser(userId: string, callback: (user: User | null) => void, onError?: (error: Error) => void): () => void;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export { type AccountMetrics as A, type IAuthRepository as I, type PlatformBreakdown as P, USER_COLLECTIONS as U, type IUserRepository as a, USER_SUBCOLLECTIONS as b, type User as c, type UserAnalytics as d, type UserConnectedAccount as e, type UserContent as f, type UserCredits as g, type UserNotifications as h, type UserPrivacy as i, type UserProfile as j, type UserSettings as k, type UserSubscription as l };
|