l-min-components 1.7.1500 → 1.7.1501

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.1501",
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
 
@@ -202,6 +202,50 @@ const HeaderComponent = (props) => {
202
202
  }
203
203
  }
204
204
  }
205
+ // when we get the default account type (getDefaultAccount?.data?.type),
206
+ // if url is not containing settings, notifications or help,
207
+ // check if url contains default account type and if it doesn't
208
+ // navigate the user using href to /default account type in lower case
209
+ const currentUrl = window.location.pathname;
210
+ const defaultAccountType =
211
+ generalData?.selectedAccount?.type?.toLowerCase();
212
+
213
+ const excludedPaths = ["settings", "notifications", "help"];
214
+ const shouldSkipNavigation = excludedPaths.some((path) =>
215
+ currentUrl.includes(path)
216
+ );
217
+
218
+ console.log("getDefaultAccount?.data received:", {
219
+ currentUrl,
220
+ defaultAccountType,
221
+ shouldSkipNavigation,
222
+ hostname: window.location.hostname,
223
+ data: generalData?.selectedAccount,
224
+ });
225
+
226
+ if (!shouldSkipNavigation && defaultAccountType) {
227
+ const urlContainsAccountType = currentUrl.includes(defaultAccountType);
228
+
229
+ console.log("Navigation check:", {
230
+ urlContainsAccountType,
231
+ willNavigate: !urlContainsAccountType,
232
+ });
233
+
234
+ if (!urlContainsAccountType) {
235
+ // Use setTimeout to ensure navigation happens after React Router is ready
236
+ setTimeout(() => {
237
+ const targetUrl = `/${defaultAccountType}`;
238
+ console.log(`Navigating to: ${targetUrl}`);
239
+
240
+ // Try using window.location.replace for staging compatibility
241
+ if (window.location.hostname.includes("staging")) {
242
+ window.location.replace(targetUrl);
243
+ } else {
244
+ window.location.href = targetUrl;
245
+ }
246
+ }, 100);
247
+ }
248
+ }
205
249
  }, [generalData?.selectedAccount, userAccountsDetail?.data]);
206
250
 
207
251
  //console.log("Accounts===", userAccountsDetail?.data?.results)
@@ -472,7 +516,7 @@ const HeaderComponent = (props) => {
472
516
  window.location.pathname.includes("help") ? "active" : ""
473
517
  }
474
518
  >
475
- <QuestionMark /> {props?.findText("Helps")}
519
+ <QuestionMark /> {props?.findText("Helpx")}
476
520
  </a>
477
521
  </li>
478
522
  </Nav>