l-min-components 1.7.1292 → 1.7.1294

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.1292",
3
+ "version": "1.7.1294",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -130,8 +130,9 @@ const AppMainLayout = ({ children }) => {
130
130
  handleCurrentSubscription,
131
131
  getDefaultAccount,
132
132
  handleGetDefaultAccount,
133
- } = useHeader();
134
-
133
+ user,
134
+ userDetails,
135
+ } = useHeader({ default: true });
135
136
  // get current default account and store in cookie (from api)
136
137
 
137
138
  useEffect(() => {
@@ -304,8 +305,10 @@ const AppMainLayout = ({ children }) => {
304
305
  value={{
305
306
  messageKit,
306
307
  affiliateAccount,
308
+ userDetails,
307
309
  findAccountNames,
308
310
  accountName,
311
+ user,
309
312
  setRightComponent,
310
313
  setRightLayout,
311
314
  generalData,
@@ -1,9 +1,17 @@
1
1
  import useAxios from "axios-hooks";
2
2
  import { useEffect } from "react";
3
3
 
4
- const useHeader = () => {
4
+ const useHeader = (props = { default: false }) => {
5
5
  // get user details
6
- const [{ ...userDetails }, getUserDetails] = useAxios();
6
+ const [userDetails, getUserDetails] = useAxios(
7
+ {
8
+ method: "get",
9
+ url: "/iam/v1/users/me/",
10
+ },
11
+ {
12
+ manual: !props.default,
13
+ }
14
+ );
7
15
 
8
16
  const handleGetUserDetails = async () => {
9
17
  await getUserDetails({
@@ -369,15 +377,11 @@ const useHeader = () => {
369
377
  }
370
378
  };
371
379
 
372
- //defaults
373
- // get user info
374
- useEffect(() => {
375
- handleGetUserDetails();
376
- }, []);
377
-
378
380
  return {
379
381
  handleGetUserDetails,
380
382
  userDetails,
383
+ user: userDetails.data,
384
+ getUserDetails,
381
385
  handleGetUserAccountsDetail,
382
386
  userAccountsDetail,
383
387
  handleGetDefaultAccount,
@@ -398,7 +402,7 @@ const useHeader = () => {
398
402
  handleGetAllAffiliate,
399
403
  handleSetDefaultAffiliate,
400
404
  setDefaultAffiliateData,
401
-
405
+ plan: userPlanData?.data,
402
406
  userPlanData,
403
407
  handleGetUserPlan,
404
408
  getCurrentSubscriptionData,
@@ -56,9 +56,7 @@ const HeaderComponent = (props) => {
56
56
  // in general data find user info and replace where user details is being used
57
57
  const {
58
58
  handleGetUserAccountsDetail,
59
- handleGetUserDetails,
60
59
  userAccountsDetail,
61
- userDetails,
62
60
  // getDefaultAccount,
63
61
  // handleGetDefaultAccount,
64
62
  unreadNotificationData,
@@ -75,8 +73,13 @@ const HeaderComponent = (props) => {
75
73
  handleSetDefaultAccount,
76
74
  } = useHeader();
77
75
  const { pathname } = useLocation();
78
- const { setGeneralData, generalData, notificationMarkReadData, accountName } =
79
- useContext(OutletContext);
76
+ const {
77
+ setGeneralData,
78
+ generalData,
79
+ notificationMarkReadData,
80
+ accountName,
81
+ userDetails,
82
+ } = useContext(OutletContext);
80
83
  const [accountType, setAccountType] = useState("");
81
84
  const currentAccountType = props?.selectedAccount?.type
82
85
  ? props?.selectedAccount?.type?.toLowerCase()
@@ -91,7 +94,6 @@ const HeaderComponent = (props) => {
91
94
  useEffect(() => {
92
95
  setIsOpen(false);
93
96
  handleGetUserAccountsDetail();
94
- handleGetUserDetails();
95
97
  props?.handleGetDefaultAccount();
96
98
  }, []);
97
99
 
@@ -12,14 +12,12 @@ import Loader from "../../loader";
12
12
  import avatar from "../../../assets/images/avatar.png";
13
13
  import { OutletContext } from "../../AppMainLayout";
14
14
 
15
- const UserCard = ({ user, isOpen, findText }) => {
16
- const { handleGetUserDetails, userDetails, handleSetDefaultAccount } =
17
- useHeader();
15
+ const UserCard = ({ isOpen, findText }) => {
16
+ const { handleSetDefaultAccount } = useHeader();
18
17
  const [organizationName, setOrganizationName] = useState();
19
- const { generalData, accountName } = useContext(OutletContext);
18
+ const { generalData, accountName, userDetails } = useContext(OutletContext);
20
19
 
21
20
  useEffect(() => {
22
- handleGetUserDetails();
23
21
  if (generalData?.selectedAccount) {
24
22
  const date = new Date();
25
23
  date.setDate(date.getDate() + 28);