l-min-components 1.0.794 → 1.0.800
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
|
@@ -255,7 +255,7 @@ const AccountDropdown = (props) => {
|
|
|
255
255
|
))}
|
|
256
256
|
|
|
257
257
|
{envType === "staging" ||
|
|
258
|
-
(envType === "localhost" &&
|
|
258
|
+
(envType === "localhost" && !props?.hasDeveloperAccount && // dont show personal accounts for developer user
|
|
259
259
|
props?.personalAccountData?.length > 0 && (
|
|
260
260
|
<div>
|
|
261
261
|
<h3>Personal account</h3>
|
|
@@ -163,24 +163,37 @@ const HeaderComponent = (props) => {
|
|
|
163
163
|
// Checking for delete account
|
|
164
164
|
useEffect(() => {
|
|
165
165
|
if (userAccountsDetail?.data) {
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
// Filter for only valid developer accounts
|
|
167
|
+
const validDeveloperAccounts = userAccountsDetail.data?.results.filter(
|
|
168
|
+
(account) => account?.type === "DEVELOPER" && !account.pending_delete
|
|
168
169
|
);
|
|
169
|
-
|
|
170
|
+
|
|
170
171
|
if (
|
|
171
172
|
generalData?.selectedAccount &&
|
|
172
173
|
generalData?.selectedAccount?.pending_delete
|
|
173
174
|
) {
|
|
174
|
-
const nextValidAccount =
|
|
175
|
+
const nextValidAccount = validDeveloperAccounts[0];
|
|
175
176
|
if (nextValidAccount) {
|
|
176
177
|
setSelectedAccount(nextValidAccount);
|
|
177
|
-
} else {
|
|
178
|
-
// Fallback to personal account or some default setting
|
|
179
|
-
setSelectedAccount(personalAccountData[0]);
|
|
180
178
|
}
|
|
179
|
+
// If there is no valid developer account, do nothing (do not set a new selected account)
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
182
|
}, [generalData?.selectedAccount, userAccountsDetail?.data]);
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
console.log("Accounts===", userAccountsDetail?.data?.results)
|
|
186
|
+
|
|
187
|
+
const [hasDeveloperAccount, setHasDeveloperAccount] = useState(false);
|
|
188
|
+
// New useEffect to check for a DEVELOPER account
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
if (userAccountsDetail?.data) {
|
|
191
|
+
const hasDeveloper = userAccountsDetail.data.results.some(
|
|
192
|
+
(account) => account.type === "DEVELOPER"
|
|
193
|
+
);
|
|
194
|
+
setHasDeveloperAccount(hasDeveloper);
|
|
195
|
+
}
|
|
196
|
+
}, [userAccountsDetail?.data]);
|
|
184
197
|
|
|
185
198
|
const containerRef = useRef(null);
|
|
186
199
|
const secondContainerRef = useRef(null);
|
|
@@ -539,6 +552,7 @@ const HeaderComponent = (props) => {
|
|
|
539
552
|
setDefaultAccount={setDefaultAccount}
|
|
540
553
|
handleSetDefaultAccount={handleSetDefaultAccount}
|
|
541
554
|
ref={acctDropdownContainerRef}
|
|
555
|
+
hasDeveloperAccount={hasDeveloperAccount}
|
|
542
556
|
/>
|
|
543
557
|
)}
|
|
544
558
|
</Navbar>
|
|
@@ -49,6 +49,10 @@ const SideMenu = ({
|
|
|
49
49
|
generalData?.selectedAccount?.type === "PERSONAL" &&
|
|
50
50
|
window.location.hostname.includes("staging");
|
|
51
51
|
|
|
52
|
+
const isPendingDelete =
|
|
53
|
+
generalData?.selectedAccount?.pending_delete === true &&
|
|
54
|
+
window.location.hostname.includes("staging");
|
|
55
|
+
|
|
52
56
|
useEffect(() => {
|
|
53
57
|
if (userType) {
|
|
54
58
|
setFilteredRoutes(
|
|
@@ -327,7 +331,7 @@ const SideMenu = ({
|
|
|
327
331
|
>
|
|
328
332
|
<UserCard user={user} isOpen={isOpen} />
|
|
329
333
|
|
|
330
|
-
{!
|
|
334
|
+
{!isPendingDelete && (
|
|
331
335
|
<>
|
|
332
336
|
<NavigationContainer>
|
|
333
337
|
{routeFilter && routeFilter?.map(renderNavigationItem)}
|