@pushwoosh/smart-components-kit 1.0.32 → 1.0.33
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 => {
|
package/package.json
CHANGED