l-min-components 1.7.1501 → 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
|
@@ -190,6 +190,53 @@ const AppMainLayout = ({ children }) => {
|
|
|
190
190
|
handleSetDefaultAccount(getDefaultAccount?.data?.id);
|
|
191
191
|
|
|
192
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
|
+
}
|
|
193
240
|
}
|
|
194
241
|
}, [getDefaultAccount?.data]);
|
|
195
242
|
|
|
@@ -249,9 +296,20 @@ const AppMainLayout = ({ children }) => {
|
|
|
249
296
|
break;
|
|
250
297
|
}
|
|
251
298
|
}
|
|
299
|
+
console.log("Calling handleGetDefaultAccount on staging/local");
|
|
252
300
|
handleGetDefaultAccount();
|
|
253
301
|
}, [defaultAcct]);
|
|
254
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
|
+
|
|
255
313
|
// setting current environment type
|
|
256
314
|
useEffect(() => {
|
|
257
315
|
if (window.location.hostname.includes("staging")) {
|
|
@@ -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("
|
|
475
|
+
<QuestionMark /> {props?.findText("Helpxy")}
|
|
520
476
|
</a>
|
|
521
477
|
</li>
|
|
522
478
|
</Nav>
|