l-min-components 1.7.1500 → 1.7.1502

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": "l-min-components",
3
- "version": "1.7.1500",
3
+ "version": "1.7.1502",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -125,51 +125,7 @@ const AppMainLayout = ({ children }) => {
125
125
  }
126
126
  }, [generalData]);
127
127
 
128
- useEffect(() => {
129
- if (generalData?.selectedAccount?.type) {
130
- // when we get the default account type (getDefaultAccount?.data?.type),
131
- // if url is not containing settings, notifications or help,
132
- // check if url contains default account type and if it doesn't
133
- // navigate the user using href to /default account type in lower case
134
- const currentUrl = window.location.pathname;
135
- const defaultAccountType = getDefaultAccount?.data?.type?.toLowerCase();
136
-
137
- const excludedPaths = ["settings", "notifications", "help"];
138
- const shouldSkipNavigation = excludedPaths.some((path) =>
139
- currentUrl.includes(path)
140
- );
141
-
142
- if (!shouldSkipNavigation) {
143
- const urlContainsAccountType = currentUrl.includes(defaultAccountType);
144
-
145
- console.log(
146
- {
147
- currentUrl,
148
- defaultAccountType,
149
- urlContainsAccountType,
150
- shouldSkipNavigation,
151
- hostname: window.location.hostname,
152
- },
153
- "Navigation Debug"
154
- );
155
-
156
- if (!urlContainsAccountType) {
157
- // Use setTimeout to ensure navigation happens after React Router is ready
158
- setTimeout(() => {
159
- const targetUrl = `/${defaultAccountType}`;
160
- console.log(`Navigating to: ${targetUrl}`);
161
-
162
- // Try using window.location.replace for staging compatibility
163
- if (window.location.hostname.includes("staging")) {
164
- window.location.replace(targetUrl);
165
- } else {
166
- window.location.href = targetUrl;
167
- }
168
- }, 100);
169
- }
170
- }
171
- }
172
- }, [generalData?.selectedAccount?.type]);
128
+ // This useEffect was for other logic, navigation moved to correct useEffect below
173
129
 
174
130
  //find account name
175
131
 
@@ -234,6 +190,53 @@ const AppMainLayout = ({ children }) => {
234
190
  handleSetDefaultAccount(getDefaultAccount?.data?.id);
235
191
 
236
192
  setSelectedAccount(getDefaultAccount?.data);
193
+
194
+ // when we get the default account type (getDefaultAccount?.data?.type),
195
+ // if url is not containing settings, notifications or help,
196
+ // check if url contains default account type and if it doesn't
197
+ // navigate the user using href to /default account type in lower case
198
+ const currentUrl = window.location.pathname;
199
+ const defaultAccountType = getDefaultAccount?.data?.type?.toLowerCase();
200
+
201
+ const excludedPaths = ["settings", "notifications", "help"];
202
+ const shouldSkipNavigation = excludedPaths.some((path) =>
203
+ currentUrl.includes(path)
204
+ );
205
+
206
+ console.log(
207
+ "Navigation logic triggered - getDefaultAccount data received:",
208
+ {
209
+ currentUrl,
210
+ defaultAccountType,
211
+ shouldSkipNavigation,
212
+ hostname: window.location.hostname,
213
+ data: getDefaultAccount?.data,
214
+ }
215
+ );
216
+
217
+ if (!shouldSkipNavigation && defaultAccountType) {
218
+ const urlContainsAccountType = currentUrl.includes(defaultAccountType);
219
+
220
+ console.log("Navigation check:", {
221
+ urlContainsAccountType,
222
+ willNavigate: !urlContainsAccountType,
223
+ });
224
+
225
+ if (!urlContainsAccountType) {
226
+ // Use setTimeout to ensure navigation happens after React Router is ready
227
+ setTimeout(() => {
228
+ const targetUrl = `/${defaultAccountType}`;
229
+ console.log(`Navigating to: ${targetUrl}`);
230
+
231
+ // Try using window.location.replace for staging compatibility
232
+ if (window.location.hostname.includes("staging")) {
233
+ window.location.replace(targetUrl);
234
+ } else {
235
+ window.location.href = targetUrl;
236
+ }
237
+ }, 100);
238
+ }
239
+ }
237
240
  }
238
241
  }, [getDefaultAccount?.data]);
239
242
 
@@ -293,9 +296,20 @@ const AppMainLayout = ({ children }) => {
293
296
  break;
294
297
  }
295
298
  }
299
+ console.log("Calling handleGetDefaultAccount on staging/local");
296
300
  handleGetDefaultAccount();
297
301
  }, [defaultAcct]);
298
302
 
303
+ // Debug the API response
304
+ useEffect(() => {
305
+ console.log("getDefaultAccount state changed:", {
306
+ data: getDefaultAccount?.data,
307
+ loading: getDefaultAccount?.loading,
308
+ error: getDefaultAccount?.error,
309
+ response: getDefaultAccount?.response,
310
+ });
311
+ }, [getDefaultAccount]);
312
+
299
313
  // setting current environment type
300
314
  useEffect(() => {
301
315
  if (window.location.hostname.includes("staging")) {
@@ -472,7 +472,7 @@ const HeaderComponent = (props) => {
472
472
  window.location.pathname.includes("help") ? "active" : ""
473
473
  }
474
474
  >
475
- <QuestionMark /> {props?.findText("Helps")}
475
+ <QuestionMark /> {props?.findText("Helpxy")}
476
476
  </a>
477
477
  </li>
478
478
  </Nav>