@m4l/components 9.3.21-JAEBeta.0 → 9.3.21-JAEBeta.1

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.
@@ -30,7 +30,7 @@ function getDivScritId(prefix, moduleId) {
30
30
  };
31
31
  }
32
32
  function MFLoader(props) {
33
- const { prefix, moduleId, cache = true, debugPort, dynamicMFStore, windowTools, emergeType } = props;
33
+ const { prefix, moduleId, cache = true, debugPort, dynamicMFStore, windowTools, emergeType, loggedUser } = props;
34
34
  const { hostThemeOptions, fnComponentsOverrides } = useHostTheme();
35
35
  const { networkOperation } = useNetwork();
36
36
  const environment = useEnvironment();
@@ -64,6 +64,10 @@ function MFLoader(props) {
64
64
  }
65
65
  const renderMicroFrontend = useCallback(
66
66
  (newDScript) => {
67
+ const options = {
68
+ loggedUser,
69
+ emergeType
70
+ };
67
71
  try {
68
72
  window[`render_${prefix}_${newDScript.moduleId}`](
69
73
  newDScript.divContainerId,
@@ -75,13 +79,13 @@ function MFLoader(props) {
75
79
  formatter,
76
80
  dynamicMFStore,
77
81
  windowTools,
78
- emergeType
82
+ options
79
83
  );
80
84
  } catch (_e) {
81
85
  }
82
86
  },
83
87
  // eslint-disable-next-line react-hooks/exhaustive-deps
84
- [hostThemeOptions, currentLocale, formatter]
88
+ [hostThemeOptions, currentLocale, formatter, loggedUser]
85
89
  );
86
90
  const debouncedSetDivScript = useCallback(
87
91
  debounce(
@@ -2,10 +2,10 @@ import { styled } from "@mui/material";
2
2
  const MFLoaderRoot = styled("div")(() => ({
3
3
  width: "100%",
4
4
  height: "100%",
5
+ position: "relative",
5
6
  display: "flex",
6
7
  flexDirection: "column",
7
8
  alignItems: "center",
8
- overflow: "auto",
9
9
  "& .M4LMFLoader-containerLinearProgress": {
10
10
  width: "100%",
11
11
  height: "100%",
@@ -1,6 +1,7 @@
1
1
  import { DynamicMFStore } from '../WindowBase/contexts/DynamicMFParmsContext/store';
2
2
  import { WindowToolsMF } from '../WindowBase/contexts';
3
3
  import { EmergeType } from '../areas/types';
4
+ import { AuthUserType } from '@m4l/core';
4
5
  /**
5
6
  * Propiedades base de un microfrontend.
6
7
  */
@@ -38,4 +39,8 @@ export interface MFLoaderProps extends MFBaseProps {
38
39
  * Tipo de lanzamiento de la ventana, popup, layout, modal
39
40
  */
40
41
  emergeType?: EmergeType;
42
+ /**
43
+ * loggedUser: usuario logueado, para los microfrontends que necesitan el usuario logueado
44
+ */
45
+ loggedUser?: AuthUserType;
41
46
  }
@@ -1,3 +1,4 @@
1
+ import { AuthUserType } from '@m4l/core';
1
2
  import { EmergeType } from '../../../areas/types';
2
3
  import { MFBaseProps } from '../../../MFLoader/types';
3
4
  import { WindowToolsMF } from '../../contexts';
@@ -7,4 +8,5 @@ export interface MicroFrontendProps extends MFBaseProps {
7
8
  windowTools: WindowToolsMF;
8
9
  dynamicMFStore: DynamicMFStore;
9
10
  emergeType: EmergeType;
11
+ loggedUser: AuthUserType;
10
12
  }
@@ -33,7 +33,7 @@ const areasViewerStyles = {
33
33
  flexDirection: "row",
34
34
  inset: 0,
35
35
  overflow: "hidden",
36
- justifyContent: "top",
36
+ justifyContent: "flex-start",
37
37
  alignItems: "flex-start",
38
38
  visibility: "hidden",
39
39
  ...ownerState?.selected && {
@@ -30,7 +30,8 @@ const Window = (props) => {
30
30
  dynamicMFStore,
31
31
  windowTools,
32
32
  onTouch,
33
- memoizedActions
33
+ memoizedActions,
34
+ loggedUser
34
35
  } = useWindow(windowId, areaId);
35
36
  const maximizedId = useAreasStore(
36
37
  (state) => areaId ? state.hashAreas[areaId]?.maximizedId : void 0,
@@ -83,6 +84,7 @@ const Window = (props) => {
83
84
  moduleId,
84
85
  dynamicMFStore,
85
86
  windowTools,
87
+ loggedUser,
86
88
  ...mfProps
87
89
  }
88
90
  ) : /* @__PURE__ */ jsx(
@@ -31,4 +31,5 @@ export declare const useWindow: (windowId: string, areaId?: string) => {
31
31
  windowTools: WindowToolsMF;
32
32
  onTouch: () => void;
33
33
  memoizedActions: import('../../../../../../../../WindowBase/types').WindowBaseAction[];
34
+ loggedUser: import('@m4l/core').Maybe<import('@m4l/core').UserAuth>;
34
35
  };
@@ -3,6 +3,7 @@ import { shallow } from "zustand/shallow";
3
3
  import { u as useAreasStore } from "../../../../../../../hooks/useAreas/index.js";
4
4
  import { u as useHeaderActions } from "./useHeaderActions.js";
5
5
  import { u as usePopupsStore } from "../../../../../../../../popups/components/PopupsProvider/hooks/usePopupsStore.js";
6
+ import { useAuth } from "@m4l/core";
6
7
  import { c as createToaster } from "../../../../../../../../ToastContainer/helpers/toaster.js";
7
8
  const useWindow = (windowId, areaId) => {
8
9
  const [
@@ -41,6 +42,7 @@ const useWindow = (windowId, areaId) => {
41
42
  ];
42
43
  }, shallow);
43
44
  const mfProps = useAreasStore((state) => state.hashWindows[windowId]?.mfProps, shallow);
45
+ const { user: loggedUser } = useAuth();
44
46
  const component = useAreasStore(
45
47
  (state) => state.hashWindows[windowId]?.component,
46
48
  shallow
@@ -115,7 +117,8 @@ const useWindow = (windowId, areaId) => {
115
117
  dynamicMFStore,
116
118
  windowTools,
117
119
  onTouch,
118
- memoizedActions
120
+ memoizedActions,
121
+ loggedUser
119
122
  };
120
123
  };
121
124
  export {
@@ -7,7 +7,7 @@ import { u as useSizeContainer } from "../../../../hooks/useSizeContainer/index.
7
7
  import { R as RootStyled } from "./slots/popupsViewerSlots.js";
8
8
  import { useRef, createRef, useEffect, memo } from "react";
9
9
  const PopupsViewer = (props) => {
10
- const { groupId = "global", onResizeStart, onResizeStop, onDragStart, onDragStop, containerElement, className } = props;
10
+ const { groupId = "global", onResizeStart, onResizeStop, onDragStart, onDragStop, containerElement, className, loggedUser } = props;
11
11
  const popupsIds = usePopupsStore(
12
12
  (state) => state.popupsIds.filter((pId) => groupId === state.hashPopups[pId].groupId && state.hashPopups[pId].status !== "closing"),
13
13
  shallow
@@ -57,7 +57,8 @@ const PopupsViewer = (props) => {
57
57
  "data-testid": "popup",
58
58
  popupId: id,
59
59
  containerElement,
60
- containerSize
60
+ containerSize,
61
+ loggedUser
61
62
  },
62
63
  id
63
64
  )
@@ -11,7 +11,7 @@ import { M as MemonizedWindowBaseMicroFrontend } from "../../../../../WindowBase
11
11
  import { W as WindowBaseComponent } from "../../../../../WindowBase/subcomponents/Component/index.js";
12
12
  import { W as WindowBase } from "../../../../../WindowBase/WindowBase.js";
13
13
  const Popup = forwardRef((props, ref) => {
14
- const { popupId, containerElement, containerSize, style, onResizeStart, onResizeStop, onDragStart, onDragStop } = props;
14
+ const { popupId, containerElement, containerSize, style, onResizeStart, onResizeStop, onDragStart, onDragStop, loggedUser } = props;
15
15
  const popup = usePopupsStore((state) => state.hashPopups[popupId], shallow);
16
16
  const { bringPopupOnFront } = usePopupsStore((state) => state.popupsActions, shallow);
17
17
  const { close } = usePopupsStore((state) => state.popupActions, shallow);
@@ -133,6 +133,7 @@ const Popup = forwardRef((props, ref) => {
133
133
  moduleId,
134
134
  dynamicMFStore,
135
135
  windowTools,
136
+ loggedUser,
136
137
  ...mfProps ?? { debugPort: 0, prefix: "" }
137
138
  }
138
139
  ) : /* @__PURE__ */ jsx(
@@ -1,5 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { ContainerSize } from '../../../../../../utils/types';
3
+ import { AuthUserType } from '@m4l/core';
3
4
  export type ResizeReason = 'start' | 'resize' | 'stop';
4
5
  export interface PopupProps {
5
6
  /**
@@ -34,4 +35,8 @@ export interface PopupProps {
34
35
  * "onDragStop" Función que se ejecuta cuando se termina de arrastrar el popup
35
36
  */
36
37
  onDragStop?: () => void;
38
+ /**
39
+ * "loggedUser" Usuario logueado
40
+ */
41
+ loggedUser?: AuthUserType;
37
42
  }
@@ -3,6 +3,7 @@ import { PopupViewerSlots } from './slots/slots';
3
3
  import { POPUPS_VIEWER_KEY_COMPONENT } from './constants';
4
4
  import { PopupStoreProps, PopupsProviderStoreState } from '../PopupsProvider/contexts/PopupsContext/types';
5
5
  import { M4LOverridesStyleRules } from '../../../../@types/augmentations';
6
+ import { AuthUserType } from '@m4l/core';
6
7
  export type PopupViewerSlotsType = keyof typeof PopupViewerSlots;
7
8
  export type PopupsViewerProps = {
8
9
  className?: string;
@@ -12,6 +13,7 @@ export type PopupsViewerProps = {
12
13
  onResizeStop?: () => void;
13
14
  onDragStart?: () => void;
14
15
  onDragStop?: () => void;
16
+ loggedUser?: AuthUserType;
15
17
  };
16
18
  export type PopupStatus = 'init' | 'closing' | 'hidden';
17
19
  export interface PopupOwnerState extends Pick<PopupStoreProps, 'status' | 'subTitle' | 'editionInfo' | 'zIndex' | 'variant'> {
@@ -5,4 +5,4 @@
5
5
  * @param initialValue
6
6
  * @returns
7
7
  */
8
- export declare function useStateRef<T>(initialValue: T | null): [T | null, (node: T | null) => void];
8
+ export declare function useStateRef<T extends HTMLElement | null>(initialValue: T | null): [T | null, (node: T | null) => void];
@@ -2,10 +2,10 @@ import { useState, useRef, useCallback } from "react";
2
2
  function useStateRef(initialValue) {
3
3
  const [refState, setRefState] = useState(initialValue);
4
4
  const nodeRef = useRef(null);
5
- const ref = useCallback((nodeElement) => {
6
- if (nodeElement && nodeRef.current !== nodeElement) {
7
- nodeRef.current = nodeElement;
8
- setRefState(nodeElement);
5
+ const ref = useCallback((current) => {
6
+ if (current && nodeRef.current !== current) {
7
+ nodeRef.current = current;
8
+ setRefState(current);
9
9
  }
10
10
  }, []);
11
11
  return [refState, ref];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.3.21-JAEBeta.0",
3
+ "version": "9.3.21-JAEBeta.1",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {
@@ -43,7 +43,6 @@
43
43
  "react-helmet-async": "^2.0.5",
44
44
  "react-hook-form": "^7.33.1",
45
45
  "react-intersection-observer": "^9.4.0",
46
- "react-leaflet": "^4.2.1",
47
46
  "react-resizable": "^3.0.4",
48
47
  "react-resizable-panels": "^2.1.8",
49
48
  "react-rnd": "^10.5.2",