@pushwoosh/smart-components-kit 1.0.32 → 1.0.34

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.
@@ -1,9 +1,12 @@
1
1
  import { type FC, type ReactNode } from 'react';
2
+ import { type VariedDynamicContent } from '../DynamicContentPickerForm/types';
2
3
  import { type RenderDynamicContentProps } from './types';
4
+ type State = Record<string, VariedDynamicContent>;
3
5
  type DynamicContentPickerProps = {
4
6
  applicationCode: string;
5
7
  text: string;
6
8
  title?: string;
9
+ initState?: State;
7
10
  renderDynamicContent?: (props: RenderDynamicContentProps) => ReactNode;
8
11
  };
9
12
  export declare const DynamicContentPicker: FC<DynamicContentPickerProps>;
@@ -23,6 +23,7 @@ export const DynamicContentPicker = ({
23
23
  applicationCode,
24
24
  text,
25
25
  title,
26
+ initState,
26
27
  renderDynamicContent
27
28
  }) => {
28
29
  var _middlewareData$arrow, _middlewareData$arrow2;
@@ -42,7 +43,7 @@ export const DynamicContentPicker = ({
42
43
  element: arrowRef
43
44
  })]
44
45
  });
45
- const [state, dispatch] = useReducer(reducer, initialState);
46
+ const [state, dispatch] = useReducer(reducer, initState || initialState);
46
47
  const parsedLines = useMemo(() => {
47
48
  const lines = text.split('\n');
48
49
  return lines.map(line => {
@@ -11,7 +11,7 @@ export type ExportTask = {
11
11
  type ExportCsvBannerProps = {
12
12
  exportTask: ExportTask | undefined;
13
13
  updateExportTask: (exportTask: Partial<ExportTask>) => void;
14
- showLastExportLocalStorageKey: string;
14
+ showLastExportLocalStorageKey?: string;
15
15
  lastTasksParams?: GetLastTasksRequest;
16
16
  };
17
17
  export declare const ExportCsvBanner: ({ exportTask, updateExportTask, showLastExportLocalStorageKey, lastTasksParams, }: ExportCsvBannerProps) => React.JSX.Element | null;
@@ -1,4 +1,4 @@
1
- export declare const useExportVisibility: (key: string) => {
1
+ export declare const useExportVisibility: (key?: string) => {
2
2
  isHidden: boolean;
3
3
  hide: () => void;
4
4
  show: () => void;
@@ -1,13 +1,18 @@
1
1
  import { useCallback, useState } from 'react';
2
2
  export const useExportVisibility = key => {
3
- const [isHidden, setIsHidden] = useState(() => Boolean(+(localStorage.getItem(key) ?? 0)));
3
+ const [isHidden, setIsHidden] = useState(() => {
4
+ if (!key) return false;
5
+ return Boolean(+(localStorage.getItem(key) ?? 0));
6
+ });
4
7
  const hide = useCallback(() => {
5
- localStorage.setItem(key, '1');
6
8
  setIsHidden(true);
9
+ if (!key) return;
10
+ localStorage.setItem(key, '1');
7
11
  }, [key]);
8
12
  const show = useCallback(() => {
9
- localStorage.setItem(key, '0');
10
13
  setIsHidden(false);
14
+ if (!key) return;
15
+ localStorage.setItem(key, '0');
11
16
  }, [key]);
12
17
  return {
13
18
  isHidden,
@@ -47,6 +47,7 @@ export const usePresetOpenActions = pushPreset => {
47
47
  defaultDeeplinkUrl = deeplinkManual.url;
48
48
  }
49
49
  // setTimeout нужен, чтобы не получать ошибку 'ResizeObserver loop completed with undelivered notifications.'
50
+ // Она возникает, когда этот хук вызывается ВНУТРИ Modal и с пересчетом её размера. Подробности в тикете FRONT-750
50
51
  setTimeout(() => {
51
52
  setOpenActions({
52
53
  webPageUrl,
package/package.json CHANGED
@@ -42,8 +42,8 @@
42
42
  "peerDependencies": {
43
43
  "@pushwoosh/grpc-bridge": "^1.5.36",
44
44
  "@pushwoosh/http-client": "^2.5.0",
45
- "@pushwoosh/rpc-v2-http-api-data": "^0.1.501",
46
45
  "@pushwoosh/rpc-gateway-journey-data": "^0.26.206",
46
+ "@pushwoosh/rpc-v2-http-api-data": "^0.1.566",
47
47
  "@pushwoosh/session-store": "^2.5.0",
48
48
  "react": "^16.14.0 || ^18.0.0",
49
49
  "react-dom": "^16.14.0 || ^18.0.0"
@@ -51,5 +51,5 @@
51
51
  "engines": {
52
52
  "node": ">= 18"
53
53
  },
54
- "version": "1.0.32"
54
+ "version": "1.0.34"
55
55
  }