canvasframework 0.5.16 → 0.5.18

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.
Files changed (112) hide show
  1. package/dist/canvasframework.js +2 -0
  2. package/dist/canvasframework.js.LICENSE.txt +1 -0
  3. package/package.json +18 -17
  4. package/components/Accordion.js +0 -265
  5. package/components/AndroidDatePickerDialog.js +0 -406
  6. package/components/AppBar.js +0 -398
  7. package/components/AudioPlayer.js +0 -611
  8. package/components/Avatar.js +0 -202
  9. package/components/Banner.js +0 -342
  10. package/components/BottomNavigationBar.js +0 -433
  11. package/components/BottomSheet.js +0 -234
  12. package/components/Button.js +0 -360
  13. package/components/Camera.js +0 -644
  14. package/components/Card.js +0 -193
  15. package/components/Chart.js +0 -700
  16. package/components/Checkbox.js +0 -166
  17. package/components/Chip.js +0 -212
  18. package/components/CircularProgress.js +0 -327
  19. package/components/ContextMenu.js +0 -116
  20. package/components/DatePicker.js +0 -298
  21. package/components/Dialog.js +0 -337
  22. package/components/Divider.js +0 -125
  23. package/components/Drawer.js +0 -276
  24. package/components/FAB.js +0 -270
  25. package/components/FileUpload.js +0 -315
  26. package/components/FloatedCamera.js +0 -644
  27. package/components/IOSDatePickerWheel.js +0 -430
  28. package/components/ImageCarousel.js +0 -219
  29. package/components/ImageComponent.js +0 -223
  30. package/components/Input.js +0 -831
  31. package/components/InputDatalist.js +0 -723
  32. package/components/InputTags.js +0 -624
  33. package/components/List.js +0 -95
  34. package/components/ListItem.js +0 -269
  35. package/components/Modal.js +0 -364
  36. package/components/MorphingFAB.js +0 -428
  37. package/components/MultiSelectDialog.js +0 -206
  38. package/components/NumberInput.js +0 -271
  39. package/components/PasswordInput.js +0 -462
  40. package/components/ProgressBar.js +0 -88
  41. package/components/QRCodeReader.js +0 -539
  42. package/components/RadioButton.js +0 -151
  43. package/components/SearchInput.js +0 -315
  44. package/components/SegmentedControl.js +0 -357
  45. package/components/Select.js +0 -199
  46. package/components/SelectDialog.js +0 -255
  47. package/components/Slider.js +0 -113
  48. package/components/SliverAppBar.js +0 -139
  49. package/components/Snackbar.js +0 -243
  50. package/components/SpeedDialFAB.js +0 -397
  51. package/components/Stepper.js +0 -281
  52. package/components/SwipeableListItem.js +0 -327
  53. package/components/Switch.js +0 -147
  54. package/components/Table.js +0 -492
  55. package/components/Tabs.js +0 -423
  56. package/components/Text.js +0 -141
  57. package/components/TextField.js +0 -151
  58. package/components/TimePicker.js +0 -934
  59. package/components/Toast.js +0 -236
  60. package/components/TreeView.js +0 -420
  61. package/components/Video.js +0 -397
  62. package/components/View.js +0 -140
  63. package/components/VirtualList.js +0 -120
  64. package/core/CanvasFramework.js +0 -3034
  65. package/core/Component.js +0 -243
  66. package/core/ThemeManager.js +0 -358
  67. package/core/UIBuilder.js +0 -267
  68. package/core/WebGLCanvasAdapter.js +0 -782
  69. package/features/Column.js +0 -43
  70. package/features/Grid.js +0 -47
  71. package/features/LayoutComponent.js +0 -43
  72. package/features/OpenStreetMap.js +0 -310
  73. package/features/Positioned.js +0 -33
  74. package/features/PullToRefresh.js +0 -328
  75. package/features/Row.js +0 -40
  76. package/features/SignaturePad.js +0 -257
  77. package/features/Skeleton.js +0 -193
  78. package/features/Stack.js +0 -21
  79. package/index.js +0 -119
  80. package/manager/AccessibilityManager.js +0 -107
  81. package/manager/ErrorHandler.js +0 -59
  82. package/manager/FeatureFlags.js +0 -60
  83. package/manager/MemoryManager.js +0 -107
  84. package/manager/PerformanceMonitor.js +0 -84
  85. package/manager/SecurityManager.js +0 -54
  86. package/utils/AnimationEngine.js +0 -734
  87. package/utils/CryptoManager.js +0 -303
  88. package/utils/DataStore.js +0 -403
  89. package/utils/DevTools.js +0 -1618
  90. package/utils/DevToolsConsole.js +0 -201
  91. package/utils/EventBus.js +0 -407
  92. package/utils/FetchClient.js +0 -74
  93. package/utils/FirebaseAuth.js +0 -653
  94. package/utils/FirebaseCore.js +0 -246
  95. package/utils/FirebaseFirestore.js +0 -581
  96. package/utils/FirebaseFunctions.js +0 -97
  97. package/utils/FirebaseRealtimeDB.js +0 -498
  98. package/utils/FirebaseStorage.js +0 -612
  99. package/utils/FormValidator.js +0 -355
  100. package/utils/GeoLocationService.js +0 -62
  101. package/utils/I18n.js +0 -207
  102. package/utils/IndexedDBManager.js +0 -273
  103. package/utils/InspectionOverlay.js +0 -308
  104. package/utils/NotificationManager.js +0 -60
  105. package/utils/OfflineSyncManager.js +0 -342
  106. package/utils/PayPalPayment.js +0 -678
  107. package/utils/QueryBuilder.js +0 -478
  108. package/utils/SafeArea.js +0 -64
  109. package/utils/SecureStorage.js +0 -289
  110. package/utils/StateManager.js +0 -207
  111. package/utils/StripePayment.js +0 -552
  112. package/utils/WebSocketClient.js +0 -66
@@ -1,653 +0,0 @@
1
- /**
2
- * FirebaseAuth - Utilitaire pour Firebase Authentication
3
- *
4
- * @example
5
- * const firebaseAuth = new FirebaseAuth(firebaseCore);
6
- * await firebaseAuth.signUpWithEmail('user@example.com', 'password123');
7
- * await firebaseAuth.signInWithEmail('user@example.com', 'password123');
8
- * firebaseAuth.onAuthStateChanged((user) => console.log('User:', user));
9
- */
10
- class FirebaseAuth {
11
- constructor(firebaseCore) {
12
- this.core = firebaseCore;
13
- this.auth = null;
14
- this.currentUser = null;
15
- this.authStateListeners = [];
16
- }
17
-
18
- /**
19
- * Initialiser Authentication
20
- */
21
- initialize() {
22
- if (!this.auth) {
23
- this.auth = this.core.getAuth();
24
- }
25
- return this.auth;
26
- }
27
-
28
- // ==================== EMAIL / PASSWORD ====================
29
-
30
- /**
31
- * Créer un compte avec email/mot de passe
32
- */
33
- async signUpWithEmail(email, password, displayName = null) {
34
- try {
35
- if (!this.auth) this.initialize();
36
-
37
- const userCredential = await this.auth.createUserWithEmailAndPassword(email, password);
38
-
39
- // Mettre à jour le profil si displayName fourni
40
- if (displayName && userCredential.user) {
41
- await userCredential.user.updateProfile({ displayName });
42
- }
43
-
44
- // Envoyer email de vérification
45
- await userCredential.user.sendEmailVerification();
46
-
47
- this.currentUser = userCredential.user;
48
-
49
- return {
50
- success: true,
51
- user: this.formatUser(userCredential.user)
52
- };
53
- } catch (error) {
54
- console.error('❌ Erreur signUpWithEmail:', error);
55
- throw this.formatError(error);
56
- }
57
- }
58
-
59
- /**
60
- * Connexion avec email/mot de passe
61
- */
62
- async signInWithEmail(email, password) {
63
- try {
64
- if (!this.auth) this.initialize();
65
-
66
- const userCredential = await this.auth.signInWithEmailAndPassword(email, password);
67
- this.currentUser = userCredential.user;
68
-
69
- return {
70
- success: true,
71
- user: this.formatUser(userCredential.user)
72
- };
73
- } catch (error) {
74
- console.error('❌ Erreur signInWithEmail:', error);
75
- throw this.formatError(error);
76
- }
77
- }
78
-
79
- /**
80
- * Connexion anonyme
81
- */
82
- async signInAnonymously() {
83
- try {
84
- if (!this.auth) this.initialize();
85
-
86
- const userCredential = await this.auth.signInAnonymously();
87
- this.currentUser = userCredential.user;
88
-
89
- return {
90
- success: true,
91
- user: this.formatUser(userCredential.user)
92
- };
93
- } catch (error) {
94
- console.error('❌ Erreur signInAnonymously:', error);
95
- throw this.formatError(error);
96
- }
97
- }
98
-
99
- // ==================== SOCIAL AUTH ====================
100
-
101
- /**
102
- * Connexion avec Google
103
- */
104
- async signInWithGoogle() {
105
- try {
106
- if (!this.auth) this.initialize();
107
-
108
- const provider = new firebase.auth.GoogleAuthProvider();
109
- provider.addScope('profile');
110
- provider.addScope('email');
111
-
112
- const result = await this.auth.signInWithPopup(provider);
113
- this.currentUser = result.user;
114
-
115
- return {
116
- success: true,
117
- user: this.formatUser(result.user),
118
- credential: result.credential
119
- };
120
- } catch (error) {
121
- console.error('❌ Erreur signInWithGoogle:', error);
122
- throw this.formatError(error);
123
- }
124
- }
125
-
126
- /**
127
- * Connexion avec Facebook
128
- */
129
- async signInWithFacebook() {
130
- try {
131
- if (!this.auth) this.initialize();
132
-
133
- const provider = new firebase.auth.FacebookAuthProvider();
134
- provider.addScope('email');
135
- provider.addScope('public_profile');
136
-
137
- const result = await this.auth.signInWithPopup(provider);
138
- this.currentUser = result.user;
139
-
140
- return {
141
- success: true,
142
- user: this.formatUser(result.user),
143
- credential: result.credential
144
- };
145
- } catch (error) {
146
- console.error('❌ Erreur signInWithFacebook:', error);
147
- throw this.formatError(error);
148
- }
149
- }
150
-
151
- /**
152
- * Connexion avec Twitter
153
- */
154
- async signInWithTwitter() {
155
- try {
156
- if (!this.auth) this.initialize();
157
-
158
- const provider = new firebase.auth.TwitterAuthProvider();
159
-
160
- const result = await this.auth.signInWithPopup(provider);
161
- this.currentUser = result.user;
162
-
163
- return {
164
- success: true,
165
- user: this.formatUser(result.user),
166
- credential: result.credential
167
- };
168
- } catch (error) {
169
- console.error('❌ Erreur signInWithTwitter:', error);
170
- throw this.formatError(error);
171
- }
172
- }
173
-
174
- /**
175
- * Connexion avec GitHub
176
- */
177
- async signInWithGithub() {
178
- try {
179
- if (!this.auth) this.initialize();
180
-
181
- const provider = new firebase.auth.GithubAuthProvider();
182
- provider.addScope('user');
183
-
184
- const result = await this.auth.signInWithPopup(provider);
185
- this.currentUser = result.user;
186
-
187
- return {
188
- success: true,
189
- user: this.formatUser(result.user),
190
- credential: result.credential
191
- };
192
- } catch (error) {
193
- console.error('❌ Erreur signInWithGithub:', error);
194
- throw this.formatError(error);
195
- }
196
- }
197
-
198
- /**
199
- * Connexion avec Microsoft
200
- */
201
- async signInWithMicrosoft() {
202
- try {
203
- if (!this.auth) this.initialize();
204
-
205
- const provider = new firebase.auth.OAuthProvider('microsoft.com');
206
-
207
- const result = await this.auth.signInWithPopup(provider);
208
- this.currentUser = result.user;
209
-
210
- return {
211
- success: true,
212
- user: this.formatUser(result.user),
213
- credential: result.credential
214
- };
215
- } catch (error) {
216
- console.error('❌ Erreur signInWithMicrosoft:', error);
217
- throw this.formatError(error);
218
- }
219
- }
220
-
221
- /**
222
- * Connexion avec Apple
223
- */
224
- async signInWithApple() {
225
- try {
226
- if (!this.auth) this.initialize();
227
-
228
- const provider = new firebase.auth.OAuthProvider('apple.com');
229
- provider.addScope('email');
230
- provider.addScope('name');
231
-
232
- const result = await this.auth.signInWithPopup(provider);
233
- this.currentUser = result.user;
234
-
235
- return {
236
- success: true,
237
- user: this.formatUser(result.user),
238
- credential: result.credential
239
- };
240
- } catch (error) {
241
- console.error('❌ Erreur signInWithApple:', error);
242
- throw this.formatError(error);
243
- }
244
- }
245
-
246
- // ==================== PHONE AUTH ====================
247
-
248
- /**
249
- * Envoyer un code de vérification SMS
250
- */
251
- async sendPhoneVerification(phoneNumber, recaptchaContainerId) {
252
- try {
253
- if (!this.auth) this.initialize();
254
-
255
- // Créer le reCAPTCHA verifier
256
- window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier(recaptchaContainerId, {
257
- size: 'invisible',
258
- callback: () => {
259
- console.log('✅ reCAPTCHA résolu');
260
- }
261
- });
262
-
263
- const confirmationResult = await this.auth.signInWithPhoneNumber(
264
- phoneNumber,
265
- window.recaptchaVerifier
266
- );
267
-
268
- return {
269
- success: true,
270
- confirmationResult
271
- };
272
- } catch (error) {
273
- console.error('❌ Erreur sendPhoneVerification:', error);
274
- throw this.formatError(error);
275
- }
276
- }
277
-
278
- /**
279
- * Vérifier le code SMS
280
- */
281
- async verifyPhoneCode(confirmationResult, code) {
282
- try {
283
- const result = await confirmationResult.confirm(code);
284
- this.currentUser = result.user;
285
-
286
- return {
287
- success: true,
288
- user: this.formatUser(result.user)
289
- };
290
- } catch (error) {
291
- console.error('❌ Erreur verifyPhoneCode:', error);
292
- throw this.formatError(error);
293
- }
294
- }
295
-
296
- // ==================== CUSTOM TOKEN ====================
297
-
298
- /**
299
- * Connexion avec custom token
300
- */
301
- async signInWithCustomToken(token) {
302
- try {
303
- if (!this.auth) this.initialize();
304
-
305
- const userCredential = await this.auth.signInWithCustomToken(token);
306
- this.currentUser = userCredential.user;
307
-
308
- return {
309
- success: true,
310
- user: this.formatUser(userCredential.user)
311
- };
312
- } catch (error) {
313
- console.error('❌ Erreur signInWithCustomToken:', error);
314
- throw this.formatError(error);
315
- }
316
- }
317
-
318
- // ==================== PASSWORD MANAGEMENT ====================
319
-
320
- /**
321
- * Envoyer email de réinitialisation de mot de passe
322
- */
323
- async sendPasswordResetEmail(email) {
324
- try {
325
- if (!this.auth) this.initialize();
326
-
327
- await this.auth.sendPasswordResetEmail(email);
328
-
329
- return { success: true };
330
- } catch (error) {
331
- console.error('❌ Erreur sendPasswordResetEmail:', error);
332
- throw this.formatError(error);
333
- }
334
- }
335
-
336
- /**
337
- * Confirmer la réinitialisation du mot de passe
338
- */
339
- async confirmPasswordReset(code, newPassword) {
340
- try {
341
- if (!this.auth) this.initialize();
342
-
343
- await this.auth.confirmPasswordReset(code, newPassword);
344
-
345
- return { success: true };
346
- } catch (error) {
347
- console.error('❌ Erreur confirmPasswordReset:', error);
348
- throw this.formatError(error);
349
- }
350
- }
351
-
352
- /**
353
- * Changer le mot de passe
354
- */
355
- async updatePassword(newPassword) {
356
- try {
357
- const user = this.getCurrentUser();
358
- if (!user) throw new Error('Utilisateur non connecté');
359
-
360
- await user.updatePassword(newPassword);
361
-
362
- return { success: true };
363
- } catch (error) {
364
- console.error('❌ Erreur updatePassword:', error);
365
- throw this.formatError(error);
366
- }
367
- }
368
-
369
- // ==================== EMAIL MANAGEMENT ====================
370
-
371
- /**
372
- * Envoyer email de vérification
373
- */
374
- async sendEmailVerification() {
375
- try {
376
- const user = this.getCurrentUser();
377
- if (!user) throw new Error('Utilisateur non connecté');
378
-
379
- await user.sendEmailVerification();
380
-
381
- return { success: true };
382
- } catch (error) {
383
- console.error('❌ Erreur sendEmailVerification:', error);
384
- throw this.formatError(error);
385
- }
386
- }
387
-
388
- /**
389
- * Vérifier le code de vérification d'email
390
- */
391
- async applyActionCode(code) {
392
- try {
393
- if (!this.auth) this.initialize();
394
-
395
- await this.auth.applyActionCode(code);
396
- return { success: true };
397
- } catch (error) {
398
- console.error('❌ Erreur applyActionCode:', error);
399
- throw this.formatError(error);
400
- }
401
- }
402
-
403
- /**
404
- * Changer l'email
405
- */
406
- async updateEmail(newEmail) {
407
- try {
408
- const user = this.getCurrentUser();
409
- if (!user) throw new Error('Utilisateur non connecté');
410
-
411
- await user.updateEmail(newEmail);
412
-
413
- return { success: true };
414
- } catch (error) {
415
- console.error('❌ Erreur updateEmail:', error);
416
- throw this.formatError(error);
417
- }
418
- }
419
-
420
- // ==================== PROFILE MANAGEMENT ====================
421
-
422
- /**
423
- * Mettre à jour le profil
424
- */
425
- async updateProfile(updates) {
426
- try {
427
- const user = this.getCurrentUser();
428
- if (!user) throw new Error('Utilisateur non connecté');
429
-
430
- await user.updateProfile(updates);
431
- return { success: true };
432
- } catch (error) {
433
- console.error('❌ Erreur updateProfile:', error);
434
- throw this.formatError(error);
435
- }
436
- }
437
-
438
- /**
439
- * Supprimer le compte
440
- */
441
- async deleteAccount() {
442
- try {
443
- const user = this.getCurrentUser();
444
- if (!user) throw new Error('Utilisateur non connecté');
445
-
446
- await user.delete();
447
- this.currentUser = null;
448
- return { success: true };
449
- } catch (error) {
450
- console.error('❌ Erreur deleteAccount:', error);
451
- throw this.formatError(error);
452
- }
453
- }
454
-
455
- /**
456
- * Ré-authentifier l'utilisateur
457
- */
458
- async reauthenticateWithEmail(email, password) {
459
- try {
460
- const user = this.getCurrentUser();
461
- if (!user) throw new Error('Utilisateur non connecté');
462
-
463
- const credential = firebase.auth.EmailAuthProvider.credential(email, password);
464
- await user.reauthenticateWithCredential(credential);
465
-
466
- return { success: true };
467
- } catch (error) {
468
- console.error('❌ Erreur reauthenticateWithEmail:', error);
469
- throw this.formatError(error);
470
- }
471
- }
472
-
473
- // ==================== TOKEN MANAGEMENT ====================
474
-
475
- /**
476
- * Obtenir le token ID
477
- */
478
- async getIdToken(forceRefresh = false) {
479
- try {
480
- const user = this.getCurrentUser();
481
- if (!user) throw new Error('Utilisateur non connecté');
482
-
483
- const token = await user.getIdToken(forceRefresh);
484
- return token;
485
- } catch (error) {
486
- console.error('❌ Erreur getIdToken:', error);
487
- throw this.formatError(error);
488
- }
489
- }
490
-
491
- /**
492
- * Rafraîchir le token
493
- */
494
- async refreshToken() {
495
- return this.getIdToken(true);
496
- }
497
-
498
- // ==================== STATE MANAGEMENT ====================
499
-
500
- /**
501
- * Écouter les changements d'état d'authentification
502
- */
503
- onAuthStateChanged(callback) {
504
- if (!this.auth) this.initialize();
505
-
506
- const unsubscribe = this.auth.onAuthStateChanged((user) => {
507
- this.currentUser = user;
508
- callback(user ? this.formatUser(user) : null);
509
- });
510
-
511
- this.authStateListeners.push(unsubscribe);
512
-
513
- return unsubscribe;
514
- }
515
-
516
- /**
517
- * Déconnexion
518
- */
519
- async signOut() {
520
- try {
521
- if (!this.auth) this.initialize();
522
-
523
- await this.auth.signOut();
524
- this.currentUser = null;
525
-
526
- return { success: true };
527
- } catch (error) {
528
- console.error('❌ Erreur signOut:', error);
529
- throw this.formatError(error);
530
- }
531
- }
532
-
533
- /**
534
- * Obtenir l'utilisateur actuel
535
- */
536
- getCurrentUser() {
537
- if (!this.auth) this.initialize();
538
- return this.auth.currentUser;
539
- }
540
-
541
- /**
542
- * Vérifier si l'utilisateur est connecté
543
- */
544
- isSignedIn() {
545
- return this.getCurrentUser() !== null;
546
- }
547
-
548
- // ==================== LINKING ACCOUNTS ====================
549
-
550
- /**
551
- * Lier un compte email/password
552
- */
553
- async linkWithEmail(email, password) {
554
- try {
555
- const user = this.getCurrentUser();
556
- if (!user) throw new Error('Utilisateur non connecté');
557
-
558
- const credential = firebase.auth.EmailAuthProvider.credential(email, password);
559
- const result = await user.linkWithCredential(credential);
560
-
561
-
562
- return {
563
- success: true,
564
- user: this.formatUser(result.user)
565
- };
566
- } catch (error) {
567
- console.error('❌ Erreur linkWithEmail:', error);
568
- throw this.formatError(error);
569
- }
570
- }
571
-
572
- /**
573
- * Délier un fournisseur
574
- */
575
- async unlinkProvider(providerId) {
576
- try {
577
- const user = this.getCurrentUser();
578
- if (!user) throw new Error('Utilisateur non connecté');
579
-
580
- await user.unlink(providerId);
581
-
582
- return { success: true };
583
- } catch (error) {
584
- console.error('❌ Erreur unlinkProvider:', error);
585
- throw this.formatError(error);
586
- }
587
- }
588
-
589
- // ==================== HELPERS ====================
590
-
591
- /**
592
- * Formater l'objet utilisateur
593
- */
594
- formatUser(user) {
595
- if (!user) return null;
596
-
597
- return {
598
- uid: user.uid,
599
- email: user.email,
600
- displayName: user.displayName,
601
- photoURL: user.photoURL,
602
- phoneNumber: user.phoneNumber,
603
- emailVerified: user.emailVerified,
604
- isAnonymous: user.isAnonymous,
605
- metadata: {
606
- creationTime: user.metadata.creationTime,
607
- lastSignInTime: user.metadata.lastSignInTime
608
- },
609
- providerId: user.providerId,
610
- providerData: user.providerData
611
- };
612
- }
613
-
614
- /**
615
- * Formater les erreurs
616
- */
617
- formatError(error) {
618
- const errorMessages = {
619
- 'auth/email-already-in-use': 'Cet email est déjà utilisé',
620
- 'auth/invalid-email': 'Email invalide',
621
- 'auth/operation-not-allowed': 'Opération non autorisée',
622
- 'auth/weak-password': 'Mot de passe trop faible',
623
- 'auth/user-disabled': 'Compte désactivé',
624
- 'auth/user-not-found': 'Utilisateur introuvable',
625
- 'auth/wrong-password': 'Mot de passe incorrect',
626
- 'auth/too-many-requests': 'Trop de tentatives, réessayez plus tard',
627
- 'auth/network-request-failed': 'Erreur réseau',
628
- 'auth/popup-closed-by-user': 'Popup fermée par l\'utilisateur',
629
- 'auth/account-exists-with-different-credential': 'Un compte existe déjà avec cet email',
630
- 'auth/requires-recent-login': 'Ré-authentification requise'
631
- };
632
-
633
- return {
634
- code: error.code,
635
- message: errorMessages[error.code] || error.message,
636
- originalError: error
637
- };
638
- }
639
-
640
- // ==================== CLEANUP ====================
641
-
642
- /**
643
- * Nettoyer les ressources
644
- */
645
- destroy() {
646
- this.authStateListeners.forEach(unsubscribe => unsubscribe());
647
- this.authStateListeners = [];
648
- this.auth = null;
649
- this.currentUser = null;
650
- }
651
- }
652
-
653
- export default FirebaseAuth;