@djangocfg/layouts 2.1.226 → 2.1.228

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 (97) hide show
  1. package/README.md +3 -17
  2. package/package.json +18 -18
  3. package/src/components/errors/ErrorLayout.tsx +2 -2
  4. package/src/components/errors/ErrorsTracker/index.ts +1 -0
  5. package/src/components/errors/ErrorsTracker/utils/formatters.ts +23 -1
  6. package/src/hooks/useLogout.ts +9 -12
  7. package/src/layouts/AppLayout/AppLayout.tsx +20 -8
  8. package/src/layouts/AppLayout/BaseApp.tsx +5 -28
  9. package/src/layouts/AuthLayout/AuthLayout.tsx +51 -22
  10. package/src/layouts/AuthLayout/README.md +78 -0
  11. package/src/layouts/AuthLayout/components/shared/AuthDivider.tsx +2 -2
  12. package/src/layouts/AuthLayout/components/shared/AuthError.tsx +10 -2
  13. package/src/layouts/AuthLayout/components/shared/AuthFooter.tsx +2 -2
  14. package/src/layouts/AuthLayout/components/shared/AuthHeader.tsx +3 -2
  15. package/src/layouts/AuthLayout/components/shared/AuthOTPInput.tsx +4 -1
  16. package/src/layouts/AuthLayout/components/shared/TermsCheckbox.tsx +2 -2
  17. package/src/layouts/AuthLayout/components/shared/index.ts +0 -2
  18. package/src/layouts/AuthLayout/components/steps/IdentifierStep.tsx +25 -80
  19. package/src/layouts/AuthLayout/components/steps/OTPStep.tsx +8 -13
  20. package/src/layouts/AuthLayout/components/steps/SetupStep/SetupComplete.tsx +2 -2
  21. package/src/layouts/AuthLayout/components/steps/SetupStep/SetupLoading.tsx +2 -2
  22. package/src/layouts/AuthLayout/components/steps/SetupStep/SetupQRCode.tsx +2 -2
  23. package/src/layouts/AuthLayout/components/steps/TwoFactorStep.tsx +61 -42
  24. package/src/layouts/AuthLayout/context.tsx +0 -2
  25. package/src/layouts/AuthLayout/index.ts +9 -6
  26. package/src/layouts/AuthLayout/styles/auth.css +265 -120
  27. package/src/layouts/AuthLayout/types.ts +60 -7
  28. package/src/layouts/ProfileLayout/.claude/.sidecar/activity.jsonl +2 -0
  29. package/src/layouts/ProfileLayout/.claude/.sidecar/history/2026-03-15.md +35 -0
  30. package/src/layouts/ProfileLayout/.claude/.sidecar/review.md +35 -0
  31. package/src/layouts/ProfileLayout/.claude/.sidecar/scan.log +3 -0
  32. package/src/layouts/ProfileLayout/.claude/.sidecar/tasks/T-001.md +18 -0
  33. package/src/layouts/ProfileLayout/.claude/.sidecar/tasks/T-002.md +19 -0
  34. package/src/layouts/ProfileLayout/.claude/.sidecar/tasks/T-003.md +18 -0
  35. package/src/layouts/ProfileLayout/.claude/.sidecar/tasks/T-004.md +18 -0
  36. package/src/layouts/ProfileLayout/.claude/.sidecar/tasks/T-005.md +18 -0
  37. package/src/layouts/ProfileLayout/.claude/.sidecar/usage.json +5 -0
  38. package/src/layouts/ProfileLayout/ProfileLayout.tsx +52 -403
  39. package/src/layouts/ProfileLayout/components/ActionButton.tsx +38 -0
  40. package/src/layouts/ProfileLayout/components/DeleteAccountSection.tsx +109 -148
  41. package/src/layouts/ProfileLayout/components/EditableField.tsx +119 -0
  42. package/src/layouts/ProfileLayout/components/Section.tsx +22 -0
  43. package/src/layouts/ProfileLayout/components/index.ts +4 -1
  44. package/src/layouts/ProfileLayout/context.tsx +31 -0
  45. package/src/layouts/PublicLayout/components/PublicMobileDrawer.tsx +2 -2
  46. package/src/layouts/PublicLayout/components/PublicNavigation.tsx +2 -2
  47. package/src/layouts/_components/UserMenu.tsx +2 -2
  48. package/src/layouts/types/README.md +0 -20
  49. package/src/layouts/types/index.ts +2 -2
  50. package/src/layouts/types/layout.types.ts +2 -5
  51. package/src/layouts/types/providers.types.ts +0 -27
  52. package/src/snippets/AuthDialog/AuthDialog.tsx +2 -2
  53. package/src/snippets/Breadcrumbs.tsx +2 -2
  54. package/src/snippets/index.ts +0 -67
  55. package/src/layouts/AuthLayout/components/shared/ChannelToggle.tsx +0 -56
  56. package/src/snippets/McpChat/README.md +0 -441
  57. package/src/snippets/McpChat/components/AIChatWidget.tsx +0 -361
  58. package/src/snippets/McpChat/components/AskAIButton.tsx +0 -92
  59. package/src/snippets/McpChat/components/ChatMessages.tsx +0 -138
  60. package/src/snippets/McpChat/components/ChatPanel.tsx +0 -131
  61. package/src/snippets/McpChat/components/ChatSidebar.tsx +0 -156
  62. package/src/snippets/McpChat/components/ChatWidget.tsx +0 -115
  63. package/src/snippets/McpChat/components/MessageBubble.tsx +0 -142
  64. package/src/snippets/McpChat/components/MessageInput.tsx +0 -140
  65. package/src/snippets/McpChat/components/index.ts +0 -24
  66. package/src/snippets/McpChat/config.ts +0 -94
  67. package/src/snippets/McpChat/context/AIChatContext.tsx +0 -327
  68. package/src/snippets/McpChat/context/ChatContext.tsx +0 -361
  69. package/src/snippets/McpChat/context/index.ts +0 -7
  70. package/src/snippets/McpChat/hooks/index.ts +0 -6
  71. package/src/snippets/McpChat/hooks/useAIChat.ts +0 -503
  72. package/src/snippets/McpChat/hooks/useChatLayout.ts +0 -442
  73. package/src/snippets/McpChat/hooks/useMcpChat.ts +0 -90
  74. package/src/snippets/McpChat/index.ts +0 -79
  75. package/src/snippets/McpChat/types.ts +0 -189
  76. package/src/snippets/PWAInstall/@docs/README.md +0 -92
  77. package/src/snippets/PWAInstall/@docs/research/ios-android-install-flows.md +0 -576
  78. package/src/snippets/PWAInstall/README.md +0 -235
  79. package/src/snippets/PWAInstall/components/A2HSHint.tsx +0 -236
  80. package/src/snippets/PWAInstall/components/DesktopGuide.tsx +0 -234
  81. package/src/snippets/PWAInstall/components/IOSGuide.tsx +0 -29
  82. package/src/snippets/PWAInstall/components/IOSGuideDrawer.tsx +0 -103
  83. package/src/snippets/PWAInstall/components/IOSGuideModal.tsx +0 -103
  84. package/src/snippets/PWAInstall/components/PWAPageResumeManager.tsx +0 -33
  85. package/src/snippets/PWAInstall/context/InstallContext.tsx +0 -102
  86. package/src/snippets/PWAInstall/hooks/useInstallPrompt.ts +0 -168
  87. package/src/snippets/PWAInstall/hooks/useIsPWA.ts +0 -116
  88. package/src/snippets/PWAInstall/hooks/usePWAPageResume.ts +0 -163
  89. package/src/snippets/PWAInstall/index.ts +0 -80
  90. package/src/snippets/PWAInstall/types/components.ts +0 -95
  91. package/src/snippets/PWAInstall/types/config.ts +0 -29
  92. package/src/snippets/PWAInstall/types/index.ts +0 -26
  93. package/src/snippets/PWAInstall/types/install.ts +0 -38
  94. package/src/snippets/PWAInstall/types/platform.ts +0 -29
  95. package/src/snippets/PWAInstall/utils/localStorage.ts +0 -181
  96. package/src/snippets/PWAInstall/utils/logger.ts +0 -149
  97. package/src/snippets/PWAInstall/utils/platform.ts +0 -151
@@ -1,149 +0,0 @@
1
- /**
2
- * PWA Logger with Conditional Logging
3
- *
4
- * Provides logging utilities that respect environment and debug settings:
5
- * - In production: Only errors are logged
6
- * - In development: All levels are logged
7
- * - Debug mode: Can be enabled in production via localStorage
8
- *
9
- * @example
10
- * ```typescript
11
- * import { pwaLogger } from '../utils/logger';
12
- *
13
- * pwaLogger.info('Info message'); // Only in dev
14
- * pwaLogger.warn('Warning message'); // Only in dev
15
- * pwaLogger.error('Error message'); // Always logged
16
- * pwaLogger.debug('Debug message'); // Only when debug enabled
17
- * ```
18
- *
19
- * Enable debug mode in production:
20
- * ```typescript
21
- * import { enablePWADebug } from '../utils/logger';
22
- * enablePWADebug();
23
- * // or in console:
24
- * localStorage.setItem('pwa_debug', 'true');
25
- * ```
26
- */
27
-
28
- import { consola } from 'consola';
29
-
30
- const isDevelopment = process.env.NODE_ENV === 'development';
31
-
32
- /**
33
- * Check if debug mode is enabled via localStorage
34
- */
35
- function isDebugEnabled(): boolean {
36
- if (typeof window === 'undefined') return false;
37
- try {
38
- return localStorage.getItem('pwa_debug') === 'true';
39
- } catch {
40
- return false;
41
- }
42
- }
43
-
44
- /**
45
- * PWA Logger instance with conditional logging
46
- */
47
- export const pwaLogger = {
48
- /**
49
- * Info level logging
50
- * Only logs in development or when debug is enabled
51
- */
52
- info: (...args: Parameters<typeof consola.info>): void => {
53
- if (isDevelopment || isDebugEnabled()) {
54
- consola.info(...args);
55
- }
56
- },
57
-
58
- /**
59
- * Warning level logging
60
- * Only logs in development or when debug is enabled
61
- */
62
- warn: (...args: Parameters<typeof consola.warn>): void => {
63
- if (isDevelopment || isDebugEnabled()) {
64
- consola.warn(...args);
65
- }
66
- },
67
-
68
- /**
69
- * Error level logging
70
- * Always logs (production + development)
71
- */
72
- error: (...args: Parameters<typeof consola.error>): void => {
73
- consola.error(...args);
74
- },
75
-
76
- /**
77
- * Debug level logging
78
- * Only logs when debug is explicitly enabled
79
- */
80
- debug: (...args: Parameters<typeof consola.debug>): void => {
81
- if (isDebugEnabled()) {
82
- consola.debug(...args);
83
- }
84
- },
85
-
86
- /**
87
- * Success level logging
88
- * Only logs in development or when debug is enabled
89
- */
90
- success: (...args: Parameters<typeof consola.success>): void => {
91
- if (isDevelopment || isDebugEnabled()) {
92
- consola.success(...args);
93
- }
94
- },
95
- };
96
-
97
- /**
98
- * Enable debug mode
99
- *
100
- * This allows seeing debug logs in production.
101
- * Call this function or set localStorage manually:
102
- * `localStorage.setItem('pwa_debug', 'true')`
103
- *
104
- * @example
105
- * ```typescript
106
- * import { enablePWADebug } from '@djangocfg/layouts/snippets';
107
- * enablePWADebug();
108
- * // Reload page to see debug logs
109
- * ```
110
- */
111
- export function enablePWADebug(): void {
112
- if (typeof window !== 'undefined') {
113
- try {
114
- localStorage.setItem('pwa_debug', 'true');
115
- consola.info('[PWA] Debug mode enabled. Reload page to see debug logs.');
116
- } catch (e) {
117
- consola.error('[PWA] Failed to enable debug mode:', e);
118
- }
119
- }
120
- }
121
-
122
- /**
123
- * Disable debug mode
124
- *
125
- * @example
126
- * ```typescript
127
- * import { disablePWADebug } from '@djangocfg/layouts/snippets';
128
- * disablePWADebug();
129
- * ```
130
- */
131
- export function disablePWADebug(): void {
132
- if (typeof window !== 'undefined') {
133
- try {
134
- localStorage.removeItem('pwa_debug');
135
- consola.info('[PWA] Debug mode disabled.');
136
- } catch (e) {
137
- consola.error('[PWA] Failed to disable debug mode:', e);
138
- }
139
- }
140
- }
141
-
142
- /**
143
- * Check if debug mode is currently active
144
- *
145
- * @returns true if debug mode is enabled
146
- */
147
- export function isPWADebugEnabled(): boolean {
148
- return isDebugEnabled();
149
- }
@@ -1,151 +0,0 @@
1
- /**
2
- * Platform Detection Utilities
3
- *
4
- * Centralized utilities for detecting PWA state, platform, and capabilities.
5
- * Used by hooks to avoid code duplication.
6
- */
7
-
8
- /**
9
- * Check if running as PWA (standalone mode)
10
- *
11
- * Checks if the app is running in standalone mode (added to home screen).
12
- * This is the primary indicator that a PWA has been installed.
13
- *
14
- * @returns true if app is running in standalone mode
15
- *
16
- * @example
17
- * ```typescript
18
- * if (isStandalone()) {
19
- * console.log('Running as PWA');
20
- * }
21
- * ```
22
- */
23
- export function isStandalone(): boolean {
24
- if (typeof window === 'undefined') return false;
25
-
26
- // Fallback for older browsers without matchMedia
27
- if (!window.matchMedia) {
28
- // Use legacy iOS check only
29
- const nav = navigator as Navigator & { standalone?: boolean };
30
- return nav.standalone === true;
31
- }
32
-
33
- // Check display-mode media query (modern approach)
34
- const isStandaloneDisplay = window.matchMedia('(display-mode: standalone)').matches;
35
-
36
- // Legacy iOS check (navigator.standalone)
37
- const nav = navigator as Navigator & { standalone?: boolean };
38
- const isStandaloneNavigator = nav.standalone === true;
39
-
40
- return isStandaloneDisplay || isStandaloneNavigator;
41
- }
42
-
43
- /**
44
- * Check if device is mobile
45
- *
46
- * @returns true if device is mobile (iOS, Android, etc.)
47
- */
48
- export function isMobileDevice(): boolean {
49
- if (typeof window === 'undefined') return false;
50
- return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
51
- }
52
-
53
- /**
54
- * Check if web app manifest exists and is valid
55
- *
56
- * @returns true if manifest link exists in document head
57
- */
58
- export function hasValidManifest(): boolean {
59
- if (typeof document === 'undefined') return false;
60
- const manifestLink = document.querySelector('link[rel="manifest"]');
61
- return !!manifestLink;
62
- }
63
-
64
- /**
65
- * Reliable check for PWA mode with edge case handling
66
- *
67
- * This function provides additional validation for desktop browsers
68
- * to avoid false positives (e.g., Safari macOS "Add to Dock").
69
- *
70
- * For mobile devices, standard standalone check is sufficient.
71
- * For desktop, additionally validates that a manifest exists.
72
- *
73
- * @returns true if app is running as a genuine PWA
74
- *
75
- * @example
76
- * ```typescript
77
- * // Use this for more reliable detection
78
- * if (isStandaloneReliable()) {
79
- * console.log('Definitely running as PWA');
80
- * }
81
- * ```
82
- */
83
- export function isStandaloneReliable(): boolean {
84
- const standalone = isStandalone();
85
- if (!standalone) return false;
86
-
87
- // For mobile devices, standalone check is sufficient
88
- if (isMobileDevice()) return true;
89
-
90
- // For desktop browsers, additionally check for valid manifest
91
- // This prevents false positives like Safari macOS "Add to Dock"
92
- return hasValidManifest();
93
- }
94
-
95
- /**
96
- * Get display mode from media query
97
- *
98
- * @returns Current display mode: 'standalone', 'fullscreen', 'minimal-ui', or 'browser'
99
- */
100
- export function getDisplayMode(): 'standalone' | 'fullscreen' | 'minimal-ui' | 'browser' {
101
- if (typeof window === 'undefined') return 'browser';
102
-
103
- if (!window.matchMedia) return 'browser';
104
-
105
- const modes: Array<'standalone' | 'fullscreen' | 'minimal-ui'> = [
106
- 'fullscreen',
107
- 'standalone',
108
- 'minimal-ui',
109
- ];
110
-
111
- for (const mode of modes) {
112
- if (window.matchMedia(`(display-mode: ${mode})`).matches) {
113
- return mode;
114
- }
115
- }
116
-
117
- return 'browser';
118
- }
119
-
120
- /**
121
- * Create a media query listener for display-mode changes
122
- *
123
- * @param callback - Function to call when display mode changes
124
- * @returns Cleanup function to remove listener
125
- *
126
- * @example
127
- * ```typescript
128
- * const cleanup = onDisplayModeChange((isStandalone) => {
129
- * console.log('Display mode changed:', isStandalone);
130
- * });
131
- *
132
- * // Later: cleanup();
133
- * ```
134
- */
135
- export function onDisplayModeChange(callback: (isStandalone: boolean) => void): () => void {
136
- if (typeof window === 'undefined' || !window.matchMedia) {
137
- return () => {}; // No-op cleanup
138
- }
139
-
140
- const mediaQuery = window.matchMedia('(display-mode: standalone)');
141
-
142
- const handleChange = (e: MediaQueryListEvent) => {
143
- callback(e.matches);
144
- };
145
-
146
- mediaQuery.addEventListener('change', handleChange);
147
-
148
- return () => {
149
- mediaQuery.removeEventListener('change', handleChange);
150
- };
151
- }