l-min-components 1.7.1501 → 1.7.1503

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.1501",
3
+ "version": "1.7.1503",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -78,8 +78,19 @@ const AppMainLayout = ({ children }) => {
78
78
  useState(true);
79
79
  const [selectedAccount, setSelectedAccount] = useState();
80
80
  const [affilitateSearch, setAffilitateSearch] = useState("");
81
+ const [showChildren, setShowChildren] = useState(false);
81
82
 
82
83
  const [loading, setLoading] = useState(true);
84
+
85
+ // Add timeout for showing children
86
+ useEffect(() => {
87
+ const timer = setTimeout(() => {
88
+ setShowChildren(true);
89
+ }, 3000);
90
+
91
+ return () => clearTimeout(timer);
92
+ }, []);
93
+
83
94
  // for mobile view
84
95
  useEffect(() => {
85
96
  const handleResize = () => setDeviceWidth(window.innerWidth);
@@ -190,6 +201,53 @@ const AppMainLayout = ({ children }) => {
190
201
  handleSetDefaultAccount(getDefaultAccount?.data?.id);
191
202
 
192
203
  setSelectedAccount(getDefaultAccount?.data);
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 = getDefaultAccount?.data?.type?.toLowerCase();
211
+
212
+ const excludedPaths = ["settings", "notifications", "help"];
213
+ const shouldSkipNavigation = excludedPaths.some((path) =>
214
+ currentUrl.includes(path)
215
+ );
216
+
217
+ console.log(
218
+ "Navigation logic triggered - getDefaultAccount data received:",
219
+ {
220
+ currentUrl,
221
+ defaultAccountType,
222
+ shouldSkipNavigation,
223
+ hostname: window.location.hostname,
224
+ data: getDefaultAccount?.data,
225
+ }
226
+ );
227
+
228
+ if (!shouldSkipNavigation && defaultAccountType) {
229
+ const urlContainsAccountType = currentUrl.includes(defaultAccountType);
230
+
231
+ console.log("Navigation check:", {
232
+ urlContainsAccountType,
233
+ willNavigate: !urlContainsAccountType,
234
+ });
235
+
236
+ if (!urlContainsAccountType) {
237
+ // Use setTimeout to ensure navigation happens after React Router is ready
238
+ setTimeout(() => {
239
+ const targetUrl = `/${defaultAccountType}`;
240
+ console.log(`Navigating to: ${targetUrl}`);
241
+
242
+ // Try using window.location.replace for staging compatibility
243
+ if (window.location.hostname.includes("staging")) {
244
+ window.location.replace(targetUrl);
245
+ } else {
246
+ window.location.href = targetUrl;
247
+ }
248
+ }, 100);
249
+ }
250
+ }
193
251
  }
194
252
  }, [getDefaultAccount?.data]);
195
253
 
@@ -249,9 +307,20 @@ const AppMainLayout = ({ children }) => {
249
307
  break;
250
308
  }
251
309
  }
310
+ console.log("Calling handleGetDefaultAccount on staging/local");
252
311
  handleGetDefaultAccount();
253
312
  }, [defaultAcct]);
254
313
 
314
+ // Debug the API response
315
+ useEffect(() => {
316
+ console.log("getDefaultAccount state changed:", {
317
+ data: getDefaultAccount?.data,
318
+ loading: getDefaultAccount?.loading,
319
+ error: getDefaultAccount?.error,
320
+ response: getDefaultAccount?.response,
321
+ });
322
+ }, [getDefaultAccount]);
323
+
255
324
  // setting current environment type
256
325
  useEffect(() => {
257
326
  if (window.location.hostname.includes("staging")) {
@@ -566,8 +635,10 @@ const AppMainLayout = ({ children }) => {
566
635
  </div>
567
636
  </div>
568
637
  </div>
569
- ) : (
638
+ ) : showChildren ? (
570
639
  <ChildrenWrap>{children ?? <Outlet />}</ChildrenWrap>
640
+ ) : (
641
+ <FullPageLoader hasBackground fixed={true} />
571
642
  )}
572
643
  </>
573
644
  )}
@@ -202,50 +202,6 @@ 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
- }
249
205
  }, [generalData?.selectedAccount, userAccountsDetail?.data]);
250
206
 
251
207
  //console.log("Accounts===", userAccountsDetail?.data?.results)
@@ -516,7 +472,7 @@ const HeaderComponent = (props) => {
516
472
  window.location.pathname.includes("help") ? "active" : ""
517
473
  }
518
474
  >
519
- <QuestionMark /> {props?.findText("Helpx")}
475
+ <QuestionMark /> {props?.findText("Helpxyz")}
520
476
  </a>
521
477
  </li>
522
478
  </Nav>