@churchapps/apphelper 0.5.11 → 0.6.1

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 (73) hide show
  1. package/dist/components/ErrorMessages.js +1 -1
  2. package/dist/components/ErrorMessages.js.map +1 -1
  3. package/dist/components/FormCardPayment.js +2 -2
  4. package/dist/components/FormCardPayment.js.map +1 -1
  5. package/dist/components/ImageEditor.d.ts.map +1 -1
  6. package/dist/components/ImageEditor.js +13 -8
  7. package/dist/components/ImageEditor.js.map +1 -1
  8. package/dist/components/PageHeader.js +1 -1
  9. package/dist/components/PageHeader.js.map +1 -1
  10. package/dist/components/QuestionEdit.js +2 -2
  11. package/dist/components/QuestionEdit.js.map +1 -1
  12. package/dist/components/SmallButton.js +1 -1
  13. package/dist/components/SmallButton.js.map +1 -1
  14. package/dist/components/gallery/GalleryModal.d.ts.map +1 -1
  15. package/dist/components/gallery/GalleryModal.js +2 -6
  16. package/dist/components/gallery/GalleryModal.js.map +1 -1
  17. package/dist/components/header/SecondaryMenu.js +2 -2
  18. package/dist/components/header/SecondaryMenu.js.map +1 -1
  19. package/dist/components/header/SiteHeader.d.ts.map +1 -1
  20. package/dist/components/header/SiteHeader.js +0 -3
  21. package/dist/components/header/SiteHeader.js.map +1 -1
  22. package/dist/components/notes/Note.js +1 -1
  23. package/dist/components/notes/Note.js.map +1 -1
  24. package/dist/components/wrapper/ChurchList.d.ts.map +1 -1
  25. package/dist/components/wrapper/ChurchList.js +0 -7
  26. package/dist/components/wrapper/ChurchList.js.map +1 -1
  27. package/dist/components/wrapper/NewPrivateMessage.d.ts.map +1 -1
  28. package/dist/components/wrapper/NewPrivateMessage.js +1 -2
  29. package/dist/components/wrapper/NewPrivateMessage.js.map +1 -1
  30. package/dist/components/wrapper/Notifications.js +1 -1
  31. package/dist/components/wrapper/Notifications.js.map +1 -1
  32. package/dist/components/wrapper/PrivateMessageDetails.d.ts.map +1 -1
  33. package/dist/components/wrapper/PrivateMessageDetails.js +1 -4
  34. package/dist/components/wrapper/PrivateMessageDetails.js.map +1 -1
  35. package/dist/components/wrapper/PrivateMessages.js +1 -1
  36. package/dist/components/wrapper/PrivateMessages.js.map +1 -1
  37. package/dist/components/wrapper/UserMenu.d.ts.map +1 -1
  38. package/dist/components/wrapper/UserMenu.js +0 -13
  39. package/dist/components/wrapper/UserMenu.js.map +1 -1
  40. package/dist/helpers/ErrorHelper.d.ts.map +1 -1
  41. package/dist/helpers/ErrorHelper.js +0 -2
  42. package/dist/helpers/ErrorHelper.js.map +1 -1
  43. package/dist/helpers/NotificationService.d.ts +0 -18
  44. package/dist/helpers/NotificationService.d.ts.map +1 -1
  45. package/dist/helpers/NotificationService.js +0 -65
  46. package/dist/helpers/NotificationService.js.map +1 -1
  47. package/dist/helpers/SocketHelper.d.ts.map +1 -1
  48. package/dist/helpers/SocketHelper.js +1 -53
  49. package/dist/helpers/SocketHelper.js.map +1 -1
  50. package/dist/helpers/UserHelper.d.ts.map +1 -1
  51. package/dist/helpers/UserHelper.js +0 -4
  52. package/dist/helpers/UserHelper.js.map +1 -1
  53. package/package.json +1 -1
  54. package/src/components/ErrorMessages.tsx +1 -1
  55. package/src/components/FormCardPayment.tsx +1 -1
  56. package/src/components/ImageEditor.tsx +14 -8
  57. package/src/components/PageHeader.tsx +2 -2
  58. package/src/components/QuestionEdit.tsx +2 -2
  59. package/src/components/SmallButton.tsx +1 -1
  60. package/src/components/gallery/GalleryModal.tsx +2 -6
  61. package/src/components/header/SecondaryMenu.tsx +2 -2
  62. package/src/components/header/SiteHeader.tsx +0 -3
  63. package/src/components/notes/Note.tsx +2 -2
  64. package/src/components/wrapper/ChurchList.tsx +5 -14
  65. package/src/components/wrapper/NewPrivateMessage.tsx +1 -2
  66. package/src/components/wrapper/Notifications.tsx +1 -1
  67. package/src/components/wrapper/PrivateMessageDetails.tsx +8 -14
  68. package/src/components/wrapper/PrivateMessages.tsx +1 -1
  69. package/src/components/wrapper/UserMenu.tsx +3 -17
  70. package/src/helpers/ErrorHelper.ts +0 -2
  71. package/src/helpers/NotificationService.ts +0 -64
  72. package/src/helpers/SocketHelper.ts +1 -50
  73. package/src/helpers/UserHelper.ts +2 -6
@@ -96,10 +96,8 @@ const UserMenuContent: React.FC<Props> = React.memo((props) => {
96
96
  };
97
97
 
98
98
  const handleSwitchChurch = () => {
99
- console.log('UserMenu - handleSwitchChurch called');
100
99
  removeCookie("lastChurchId", { path: "/" });
101
100
  setTabIndex(2);
102
- console.log('UserMenu - tabIndex set to 2');
103
101
  };
104
102
 
105
103
  const getMainLinks = () => {
@@ -151,7 +149,6 @@ const UserMenuContent: React.FC<Props> = React.memo((props) => {
151
149
  const [tabIndex, setTabIndex] = React.useState(0);
152
150
 
153
151
  const getTabs = () => {
154
- console.log('UserMenu getTabs - Current tabIndex:', tabIndex);
155
152
  return (
156
153
  <Box sx={{ borderBottom: 1, borderColor: "divider" }}>
157
154
  <TabPanel value={tabIndex} index={0}>
@@ -165,26 +162,16 @@ const UserMenuContent: React.FC<Props> = React.memo((props) => {
165
162
  <div style={{ maxHeight: '70vh', overflowY: "auto" }}>
166
163
  <NavItem label="Back" key="ChurchBack" icon="arrow_back" onClick={() => { setTabIndex(0); }} />
167
164
  {(() => {
168
- console.log('UserMenu Church Tab - Rendering church list section');
169
- console.log('UserMenu Church Tab - Full context:', props.context);
170
- console.log('UserMenu Church Tab - context.userChurches:', props.context?.userChurches);
171
- console.log('UserMenu Church Tab - context.userChurches[0]:', props.context?.userChurches?.[0]);
172
- console.log('UserMenu Church Tab - context.userChurch:', props.context?.userChurch);
173
- console.log('UserMenu Church Tab - userChurches type:', typeof props.context?.userChurches);
174
- console.log('UserMenu Church Tab - userChurches is array?', Array.isArray(props.context?.userChurches));
175
- console.log('UserMenu Church Tab - userChurches length:', props.context?.userChurches?.length);
176
-
177
165
  // Check if userChurches is actually the userChurch object
178
166
  if (props.context?.userChurches && !Array.isArray(props.context.userChurches) && (props.context.userChurches as any).id) {
179
167
  console.error('UserMenu - ERROR: context.userChurches contains a single church object instead of an array!');
180
- console.log('UserMenu - Attempting to use context.userChurch as single item array');
181
168
  const churchArray = props.context.userChurch ? [props.context.userChurch] : [];
182
169
  return <ChurchList userChurches={churchArray} currentUserChurch={props.context?.userChurch} context={props.context} onDelete={handleClose} onChurchChange={() => {
183
170
  handleClose();
184
171
  // Don't navigate - just close the menu and let the context update trigger re-renders
185
172
  }} />;
186
173
  }
187
-
174
+
188
175
  if (!props.context?.userChurches) {
189
176
  return <Typography sx={{ p: 2, color: 'text.secondary' }}>Loading churches...</Typography>;
190
177
  } else if (!Array.isArray(props.context.userChurches)) {
@@ -193,10 +180,9 @@ const UserMenuContent: React.FC<Props> = React.memo((props) => {
193
180
  return <Typography sx={{ p: 2, color: 'text.secondary' }}>No churches available</Typography>;
194
181
  } else {
195
182
  // Ensure we always pass an array
196
- const churchesArray = Array.isArray(props.context.userChurches)
197
- ? props.context.userChurches
183
+ const churchesArray = Array.isArray(props.context.userChurches)
184
+ ? props.context.userChurches
198
185
  : [props.context.userChurches];
199
- console.log('UserMenu - Passing to ChurchList:', churchesArray);
200
186
  return <ChurchList userChurches={churchesArray} currentUserChurch={props.context?.userChurch} context={props.context} onDelete={handleClose} onChurchChange={() => {
201
187
  handleClose();
202
188
  // Don't navigate - just close the menu and let the context update trigger re-renders
@@ -26,7 +26,6 @@ export class ErrorHelper {
26
26
  details: details
27
27
  }
28
28
 
29
- console.log("ERROR LOG", log);
30
29
 
31
30
  if (log.errorType === "401" && log.message.indexOf("/users/login") > -1) return;
32
31
  if (log.message.indexOf("clientErrors") > -1) return;
@@ -34,7 +33,6 @@ export class ErrorHelper {
34
33
  // Error posting to /errors endpoint disabled
35
34
  // ApiHelper.postAnonymous("/clientErrors", [log], "MembershipApi");
36
35
  } catch (error) {
37
- console.log(error)
38
36
  }
39
37
  if (ErrorHelper.customErrorHandler) ErrorHelper.customErrorHandler(log);
40
38
  }
@@ -23,38 +23,23 @@ export class NotificationService {
23
23
  return NotificationService.instance;
24
24
  }
25
25
 
26
- /**
27
- * Initialize the notification service with user context
28
- */
29
26
  /**
30
27
  * Initialize the notification service with user context
31
28
  */
32
29
  async initialize(context: UserContextInterface): Promise<void> {
33
30
  if (this.isInitialized) {
34
- console.log('🔔 NotificationService: Already initialized, skipping');
35
31
  return;
36
32
  }
37
33
 
38
- console.log('🔔 NotificationService: Starting initialization with context:', {
39
- hasUser: !!context?.user,
40
- hasPerson: !!context?.person,
41
- hasUserChurch: !!context?.userChurch,
42
- personId: context?.person?.id,
43
- churchId: context?.userChurch?.church?.id
44
- });
45
-
46
34
  try {
47
35
  // Store current person ID for conversation counting
48
36
  this.currentPersonId = context?.person?.id || null;
49
- console.log('👤 NotificationService: Set current person ID:', this.currentPersonId);
50
37
 
51
38
  // Initialize WebSocket connection
52
- console.log('🔌 NotificationService: Initializing SocketHelper...');
53
39
  await SocketHelper.init();
54
40
 
55
41
  // Set person/church context for websocket
56
42
  if (context?.person?.id && context?.userChurch?.church?.id) {
57
- console.log('🔗 NotificationService: Setting person/church context in SocketHelper');
58
43
  SocketHelper.setPersonChurch({
59
44
  personId: context.person.id,
60
45
  churchId: context.userChurch.church.id
@@ -64,15 +49,12 @@ export class NotificationService {
64
49
  }
65
50
 
66
51
  // Register handlers for notification updates
67
- console.log('📋 NotificationService: Registering WebSocket handlers');
68
52
  this.registerWebSocketHandlers();
69
53
 
70
54
  // Load initial notification counts
71
- console.log('📊 NotificationService: Loading initial notification counts');
72
55
  await this.loadNotificationCounts();
73
56
 
74
57
  this.isInitialized = true;
75
- console.log('✅ NotificationService: Initialization complete');
76
58
 
77
59
  } catch (error) {
78
60
  console.error("❌ Failed to initialize NotificationService:", error);
@@ -80,24 +62,14 @@ export class NotificationService {
80
62
  }
81
63
  }
82
64
 
83
- /**
84
- * Register websocket handlers for real-time notification updates
85
- */
86
- /**
87
- * Register websocket handlers for real-time notification updates
88
- */
89
65
  /**
90
66
  * Register websocket handlers for real-time notification updates
91
67
  */
92
68
  private registerWebSocketHandlers(): void {
93
69
  // Handler for new private messages
94
70
  SocketHelper.addHandler("privateMessage", "NotificationService-PM", (data: any) => {
95
- console.log('🔔 NotificationService: New private message received, updating counts');
96
- console.log('📨 Private message data:', data);
97
- console.log('🔄 NotificationService: About to call debouncedLoadNotificationCounts...');
98
71
  try {
99
72
  this.debouncedLoadNotificationCounts();
100
- console.log('✅ NotificationService: debouncedLoadNotificationCounts called successfully');
101
73
  } catch (error) {
102
74
  console.error('❌ NotificationService: Error calling debouncedLoadNotificationCounts:', error);
103
75
  }
@@ -105,12 +77,8 @@ export class NotificationService {
105
77
 
106
78
  // Handler for general notifications
107
79
  SocketHelper.addHandler("notification", "NotificationService-Notification", (data: any) => {
108
- console.log('🔔 NotificationService: New notification received, updating counts');
109
- console.log('📨 Notification data:', data);
110
- console.log('🔄 NotificationService: About to call debouncedLoadNotificationCounts...');
111
80
  try {
112
81
  this.debouncedLoadNotificationCounts();
113
- console.log('✅ NotificationService: debouncedLoadNotificationCounts called successfully');
114
82
  } catch (error) {
115
83
  console.error('❌ NotificationService: Error calling debouncedLoadNotificationCounts:', error);
116
84
  }
@@ -121,69 +89,48 @@ export class NotificationService {
121
89
  // Only update counts if the message update involves the current person
122
90
  if (data?.message?.personId === this.currentPersonId ||
123
91
  data?.notifyPersonId === this.currentPersonId) {
124
- console.log('🔔 NotificationService: Message update affecting current user, updating counts');
125
- console.log('📨 Message update data:', data);
126
- console.log('🔄 NotificationService: About to call debouncedLoadNotificationCounts...');
127
92
  try {
128
93
  this.debouncedLoadNotificationCounts();
129
- console.log('✅ NotificationService: debouncedLoadNotificationCounts called successfully');
130
94
  } catch (error) {
131
95
  console.error('❌ NotificationService: Error calling debouncedLoadNotificationCounts:', error);
132
96
  }
133
- } else {
134
- console.log('🔕 NotificationService: Message update not for current user, ignoring');
135
- console.log('📨 Message personId:', data?.message?.personId, 'Current personId:', this.currentPersonId);
136
97
  }
137
98
  });
138
99
 
139
100
  // Handler for reconnect events
140
101
  SocketHelper.addHandler("reconnect", "NotificationService-Reconnect", (data: any) => {
141
- console.log('🔔 NotificationService: WebSocket reconnected, refreshing counts');
142
102
  this.loadNotificationCounts(); // Don't debounce reconnect - need immediate update
143
103
  });
144
104
  }
145
105
 
146
- /**
147
- * Load notification counts from the API with debouncing
148
- */
149
106
  /**
150
107
  * Load notification counts from the API with debouncing
151
108
  */
152
109
  private debouncedLoadNotificationCounts(): void {
153
- console.log('⏰ NotificationService: Debounced load triggered');
154
110
 
155
111
  if (this.loadTimeout) {
156
- console.log('⏰ NotificationService: Clearing existing timeout');
157
112
  clearTimeout(this.loadTimeout);
158
113
  }
159
114
 
160
115
  this.loadTimeout = setTimeout(() => {
161
- console.log('⏰ NotificationService: Timeout expired, loading counts...');
162
116
  this.loadNotificationCounts();
163
117
  }, 300); // 300ms debounce
164
118
  }
165
119
 
166
- /**
167
- * Load notification counts from the API
168
- */
169
120
  /**
170
121
  * Load notification counts from the API
171
122
  */
172
123
  async loadNotificationCounts(): Promise<void> {
173
- console.log('📊 NotificationService: Loading notification counts from API...');
174
124
 
175
125
  try {
176
126
  // Use the unreadCount endpoint which returns both notification and PM counts
177
- console.log('🌐 NotificationService: Making API call to /notifications/unreadCount');
178
127
  const counts = await ApiHelper.get("/notifications/unreadCount", "MessagingApi");
179
- console.log('📊 NotificationService: API response:', counts);
180
128
 
181
129
  const newCounts = {
182
130
  notificationCount: counts?.notificationCount || 0,
183
131
  pmCount: counts?.pmCount || 0
184
132
  };
185
133
 
186
- console.log('🔄 NotificationService: Updating counts:', newCounts);
187
134
 
188
135
  // Update counts and notify listeners
189
136
  this.updateCounts(newCounts);
@@ -199,38 +146,27 @@ export class NotificationService {
199
146
  }
200
147
  }
201
148
 
202
- /**
203
- * Update counts and notify all listeners
204
- */
205
149
  /**
206
150
  * Update counts and notify all listeners
207
151
  */
208
152
  private updateCounts(newCounts: NotificationCounts): void {
209
- console.log('🔔 NotificationService: updateCounts called with:', newCounts);
210
- console.log('🔔 NotificationService: Current counts:', this.counts);
211
- console.log('🔔 NotificationService: Number of listeners:', this.listeners.length);
212
153
 
213
154
  const countsChanged =
214
155
  this.counts.notificationCount !== newCounts.notificationCount ||
215
156
  this.counts.pmCount !== newCounts.pmCount;
216
157
 
217
- console.log('🔄 NotificationService: Counts changed?', countsChanged);
218
158
 
219
159
  if (countsChanged) {
220
160
  this.counts = { ...newCounts };
221
- console.log('✅ NotificationService: Counts updated, notifying listeners...');
222
161
 
223
162
  // Notify all listeners
224
163
  this.listeners.forEach((listener, index) => {
225
164
  try {
226
- console.log(`📢 NotificationService: Calling listener ${index + 1}/${this.listeners.length}`);
227
165
  listener(this.counts);
228
166
  } catch (error) {
229
167
  console.error(`❌ Error in notification listener ${index}:`, error);
230
168
  }
231
169
  });
232
- } else {
233
- console.log('⚪ NotificationService: Counts unchanged, not notifying listeners');
234
170
  }
235
171
  }
236
172
 
@@ -8,22 +8,15 @@ export class SocketHelper {
8
8
  private static isCleanedUp: boolean = false;
9
9
 
10
10
  static setPersonChurch = (pc: { personId: string, churchId: string }) => {
11
- console.log('👤 SocketHelper: Setting person/church context:', pc);
12
11
 
13
12
  if (pc?.personId && pc.personId && pc.churchId !== this.personIdChurchId.churchId && pc.personId !== this.personIdChurchId.personId) {
14
13
  this.personIdChurchId = pc;
15
- console.log('🔗 SocketHelper: Person/church context updated, creating alert connection');
16
14
  this.createAlertConnection();
17
15
  } else {
18
- console.log('⚠️ SocketHelper: Person/church context unchanged or invalid');
19
16
  }
20
17
  }
21
18
 
22
19
  static createAlertConnection = () => {
23
- console.log('🔗 SocketHelper: Attempting to create alert connection...');
24
- console.log('🆔 Socket ID:', SocketHelper.socketId);
25
- console.log('👤 Person ID:', SocketHelper.personIdChurchId.personId);
26
- console.log('⛪ Church ID:', SocketHelper.personIdChurchId.churchId);
27
20
 
28
21
  if (SocketHelper.personIdChurchId.personId && SocketHelper.socketId) {
29
22
  const connection: ConnectionInterface = {
@@ -34,10 +27,8 @@ export class SocketHelper {
34
27
  personId: SocketHelper.personIdChurchId.personId
35
28
  }
36
29
 
37
- console.log('🔗 SocketHelper: Creating alert connection with data:', connection);
38
30
 
39
31
  ApiHelper.postAnonymous("/connections", [connection], "MessagingApi").then((response: any) => {
40
- console.log('✅ SocketHelper: Alert connection created successfully:', response);
41
32
  }).catch((error: any) => {
42
33
  console.error("❌ Failed to create alert connection:", error);
43
34
  console.error("❌ Error details:", {
@@ -57,12 +48,10 @@ export class SocketHelper {
57
48
  }
58
49
 
59
50
  static init = async () => {
60
- console.log('🔌 SocketHelper: Starting initialization...');
61
51
  SocketHelper.cleanup();
62
52
  SocketHelper.isCleanedUp = false;
63
53
 
64
54
  if (SocketHelper.socket && SocketHelper.socket.readyState !== SocketHelper.socket.CLOSED) {
65
- console.log('🔌 SocketHelper: Closing existing socket connection');
66
55
  try {
67
56
  SocketHelper.socket.close();
68
57
  } catch (e) {
@@ -70,7 +59,6 @@ export class SocketHelper {
70
59
  }
71
60
  }
72
61
 
73
- console.log('🔌 SocketHelper: Connecting to:', CommonEnvironmentHelper.MessagingApiSocket);
74
62
 
75
63
  await new Promise((resolve, reject) => {
76
64
  let hasReceivedSocketId = false;
@@ -80,44 +68,30 @@ export class SocketHelper {
80
68
  SocketHelper.socket = new WebSocket(CommonEnvironmentHelper.MessagingApiSocket);
81
69
 
82
70
  SocketHelper.socket.onmessage = (event) => {
83
- console.log("🔔 SocketHelper: onmessage event triggered");
84
71
  if (SocketHelper.isCleanedUp) return;
85
72
 
86
73
  messageCount++;
87
- console.log(`📨 SocketHelper: Raw message #${messageCount} received:`, event.data);
88
- console.log(`📨 SocketHelper: Message timestamp:`, new Date().toISOString());
89
- console.log(`📨 SocketHelper: Message size:`, event.data.length, 'characters');
90
74
 
91
75
  try {
92
76
  const payload = JSON.parse(event.data);
93
- console.log(`📨 SocketHelper: Parsed message #${messageCount}:`, payload);
94
- console.log(`📨 SocketHelper: Message action:`, payload.action);
95
- console.log(`📨 SocketHelper: Message data type:`, typeof payload.data);
96
77
 
97
78
  if (payload.action === 'socketId') {
98
79
  hasReceivedSocketId = true;
99
- console.log('🆔 SocketHelper: Socket ID received!', payload.data);
100
80
  }
101
81
 
102
82
  // Log all message types we receive
103
83
  switch (payload.action) {
104
84
  case 'socketId':
105
- console.log('🆔 Message type: Socket ID assignment');
106
85
  break;
107
86
  case 'privateMessage':
108
- console.log('💬 Message type: Private message notification');
109
87
  break;
110
88
  case 'notification':
111
- console.log('🔔 Message type: General notification');
112
89
  break;
113
90
  case 'message':
114
- console.log('📩 Message type: Message update');
115
91
  break;
116
92
  case 'reconnect':
117
- console.log('🔄 Message type: Reconnection signal');
118
93
  break;
119
94
  default:
120
- console.log('❓ Message type: Unknown action -', payload.action);
121
95
  }
122
96
 
123
97
  SocketHelper.handleMessage(payload);
@@ -128,40 +102,21 @@ export class SocketHelper {
128
102
  };
129
103
 
130
104
  SocketHelper.socket.onopen = async (e) => {
131
- console.log('✅ SocketHelper: WebSocket connection opened');
132
- console.log('🔌 SocketHelper: Connection URL:', SocketHelper.socket.url);
133
- console.log('🔌 SocketHelper: Connection protocol:', SocketHelper.socket.protocol);
134
105
 
135
106
  // Send the getId request
136
- console.log('🔌 SocketHelper: Sending getId request...');
137
107
  SocketHelper.socket.send("getId");
138
- console.log('🔌 SocketHelper: getId request sent');
139
108
 
140
109
  // Wait longer to see if we get a response
141
110
  setTimeout(() => {
142
111
  if (!hasReceivedSocketId) {
143
112
  console.warn('⚠️ SocketHelper: No socket ID received after 3 seconds');
144
- console.log('🔍 SocketHelper: Socket state:', SocketHelper.socket.readyState);
145
- console.log('🔍 SocketHelper: Messages received so far:', messageCount);
146
113
  }
147
114
  resolve(null);
148
115
  }, 3000);
149
116
  };
150
117
 
151
118
  SocketHelper.socket.onclose = async (e) => {
152
- console.log('🔒 SocketHelper: WebSocket connection closed', {
153
- code: e.code,
154
- reason: e.reason,
155
- wasClean: e.wasClean,
156
- timestamp: new Date().toISOString(),
157
- totalMessagesReceived: messageCount
158
- });
159
-
160
- // Log common close codes for debugging
161
- if (e.code === 1005) console.log('🔍 Close code 1005: No status received (normal for some servers)');
162
- else if (e.code === 1006) console.log('🔍 Close code 1006: Abnormal closure');
163
- else if (e.code === 1000) console.log('🔍 Close code 1000: Normal closure');
164
- else console.log('🔍 Close code:', e.code);
119
+ // Socket closed
165
120
  };
166
121
 
167
122
  SocketHelper.socket.onerror = (error) => {
@@ -202,20 +157,16 @@ export class SocketHelper {
202
157
  if (SocketHelper.isCleanedUp) return;
203
158
 
204
159
  try {
205
- console.log('🔄 SocketHelper: Processing message with action:', payload.action);
206
160
 
207
161
  if (payload.action === "socketId") {
208
- console.log('🆔 SocketHelper: Received socket ID:', payload.data);
209
162
  SocketHelper.socketId = payload.data;
210
163
  SocketHelper.createAlertConnection();
211
164
  }
212
165
  else {
213
166
  const matchingHandlers = ArrayHelper.getAll(SocketHelper.actionHandlers, "action", payload.action);
214
- console.log(`📬 SocketHelper: Found ${matchingHandlers.length} handlers for action: ${payload.action}`);
215
167
 
216
168
  matchingHandlers.forEach((handler) => {
217
169
  try {
218
- console.log(`🏃 SocketHelper: Executing handler ${handler.id} for action: ${payload.action}`);
219
170
  handler.handleMessage(payload.data);
220
171
  } catch (error) {
221
172
  console.error(`❌ Error in handler ${handler.id}:`, error);
@@ -16,7 +16,6 @@ export class UserHelper {
16
16
  console.error('UserHelper.userChurches is not initialized or not an array:', UserHelper.userChurches);
17
17
  // Try to get userChurches from context if available
18
18
  if (context?.userChurches && Array.isArray(context.userChurches)) {
19
- console.log('Using userChurches from context');
20
19
  UserHelper.userChurches = context.userChurches;
21
20
  } else {
22
21
  console.error('Cannot select church: no valid userChurches available');
@@ -38,18 +37,15 @@ export class UserHelper {
38
37
  // TODO - remove context code from here and perform the logic in the component itself.
39
38
  if (context) {
40
39
  if (context.userChurch !== null) UserHelper.churchChanged = true;
41
- console.log('UserHelper.selectChurch - Setting userChurch in context:', userChurch);
42
40
  context.setUserChurch(UserHelper.currentUserChurch);
43
-
41
+
44
42
  // Also ensure user is still set in context
45
43
  if (UserHelper.user && context.setUser) {
46
- console.log('UserHelper.selectChurch - Ensuring user is set in context:', UserHelper.user);
47
44
  context.setUser(UserHelper.user);
48
45
  }
49
-
46
+
50
47
  // Update person if available
51
48
  if (UserHelper.person && context.setPerson) {
52
- console.log('UserHelper.selectChurch - Ensuring person is set in context:', UserHelper.person);
53
49
  context.setPerson(UserHelper.person);
54
50
  }
55
51
  }