@flowerforce/flower-react 3.7.2 → 4.0.1-beta.0

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.
Files changed (61) hide show
  1. package/README.md +290 -199
  2. package/dist/index.cjs.js +427 -670
  3. package/dist/index.esm.js +409 -654
  4. package/dist/src/components/Flower.d.ts +3 -15
  5. package/dist/src/components/FlowerAction.d.ts +2 -3
  6. package/dist/src/components/FlowerComponent.d.ts +2 -4
  7. package/dist/src/components/FlowerFlow.d.ts +2 -3
  8. package/dist/src/components/FlowerNavigate/FlowerNavigate.d.ts +3 -0
  9. package/dist/src/components/FlowerNavigate/WrapperComponent.d.ts +3 -3
  10. package/dist/src/components/FlowerNavigate/index.d.ts +2 -4
  11. package/dist/src/components/FlowerNavigate/useFlowerNavigate.d.ts +1 -1
  12. package/dist/src/components/FlowerNode.d.ts +2 -3
  13. package/dist/src/components/FlowerRoute.d.ts +2 -3
  14. package/dist/src/components/FlowerServer.d.ts +2 -3
  15. package/dist/src/components/FlowerStart.d.ts +3 -4
  16. package/dist/src/components/hooks/eventsHandlers.d.ts +5 -0
  17. package/dist/src/components/hooks/index.d.ts +5 -0
  18. package/dist/src/components/hooks/types/index.d.ts +29 -0
  19. package/dist/src/components/hooks/useBrowserNavigationSync.d.ts +12 -0
  20. package/dist/src/components/hooks/useDestroyFlow.d.ts +2 -0
  21. package/dist/src/components/hooks/useInitDevtools.d.ts +2 -0
  22. package/dist/src/components/hooks/useInitNodes.d.ts +2 -0
  23. package/dist/src/components/hooks/useSelectorsClient.d.ts +6 -0
  24. package/dist/src/components/index.d.ts +10 -0
  25. package/dist/src/components/{useFlower.d.ts → useFlower/index.d.ts} +2 -3
  26. package/dist/src/components/useFlower/utils.d.ts +22 -0
  27. package/dist/src/features/index.d.ts +2 -0
  28. package/dist/src/features/reducer/flowerReducer.d.ts +7 -0
  29. package/dist/src/{selectors.d.ts → features/selectors/selectors.d.ts} +669 -383
  30. package/dist/src/index.d.ts +6 -33
  31. package/dist/src/provider/createSliceWithFlower.d.ts +2 -0
  32. package/dist/src/provider/createStoreWithFlower.d.ts +8 -0
  33. package/dist/src/provider/index.d.ts +3 -0
  34. package/dist/src/provider/provider.d.ts +7 -0
  35. package/dist/src/types/FlowContext.d.ts +6 -0
  36. package/dist/src/types/Flower.d.ts +15 -0
  37. package/dist/src/types/FlowerHooks.d.ts +27 -0
  38. package/dist/src/{components/types → types}/FlowerProvider.d.ts +3 -3
  39. package/dist/src/types/index.d.ts +10 -0
  40. package/dist/src/types/middlewares.d.ts +16 -0
  41. package/dist/src/types/utilsTypes.d.ts +4 -0
  42. package/dist/src/utils.d.ts +2 -10
  43. package/package.json +15 -7
  44. package/dist/src/components/FlowerField.d.ts +0 -4
  45. package/dist/src/components/FlowerRule.d.ts +0 -4
  46. package/dist/src/components/FlowerValue.d.ts +0 -4
  47. package/dist/src/components/types/FlowerField.d.ts +0 -124
  48. package/dist/src/components/types/FlowerHooks.d.ts +0 -72
  49. package/dist/src/components/types/FlowerRule.d.ts +0 -35
  50. package/dist/src/components/types/FlowerValue.d.ts +0 -33
  51. package/dist/src/components/useFlowerForm.d.ts +0 -26
  52. package/dist/src/context.d.ts +0 -10
  53. package/dist/src/provider.d.ts +0 -25
  54. package/dist/src/reducer.d.ts +0 -7
  55. /package/dist/src/{components/types → types}/DefaultNode.d.ts +0 -0
  56. /package/dist/src/{components/types → types}/FlowerComponent.d.ts +0 -0
  57. /package/dist/src/{components/types → types}/FlowerFlow.d.ts +0 -0
  58. /package/dist/src/{components/types → types}/FlowerNavigate.d.ts +0 -0
  59. /package/dist/src/{components/types → types}/FlowerNode.d.ts +0 -0
  60. /package/dist/src/{components/types → types}/FlowerRoute.d.ts +0 -0
  61. /package/dist/src/{components/types → types}/FlowerServer.d.ts +0 -0
@@ -1,15 +1,3 @@
1
- import React, { PropsWithChildren } from 'react';
2
- type FlowerInitalState = {
3
- startId?: string;
4
- current?: string;
5
- history?: string[];
6
- };
7
- type FlowerClientProps = PropsWithChildren & {
8
- name: string;
9
- destroyOnUnmount?: boolean;
10
- startId?: string | null;
11
- initialData?: any;
12
- initialState?: FlowerInitalState;
13
- };
14
- declare const component: React.MemoExoticComponent<({ children, name, destroyOnUnmount, startId, initialData, initialState }: FlowerClientProps) => React.JSX.Element | null>;
15
- export default component;
1
+ import React from 'react';
2
+ import { FlowerClientProps } from '../types/Flower';
3
+ export declare const Flower: ({ children, name, destroyOnUnmount, persist, startId, initialState, initialData }: FlowerClientProps) => React.JSX.Element | null;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { FlowerNodeDefaultProps } from './types/DefaultNode';
3
- declare const component: React.MemoExoticComponent<({ children, onEnter, onExit }: FlowerNodeDefaultProps) => React.ReactNode>;
4
- export default component;
2
+ import { FlowerNodeDefaultProps } from '../types/DefaultNode';
3
+ export declare const FlowerAction: ({ children, onEnter, onExit }: FlowerNodeDefaultProps) => React.JSX.Element;
@@ -1,4 +1,2 @@
1
- import React from 'react';
2
- import { FlowerComponentProps } from './types/FlowerComponent';
3
- declare const component: React.MemoExoticComponent<({ children }: FlowerComponentProps) => React.ReactNode>;
4
- export default component;
1
+ import { FlowerComponentProps } from '../types/FlowerComponent';
2
+ export declare const FlowerComponent: ({ children }: FlowerComponentProps) => import("react").ReactNode;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { FlowerFlowProps } from './types/FlowerFlow';
3
- declare const component: React.MemoExoticComponent<({ children, onEnter, onExit }: FlowerFlowProps) => React.ReactNode>;
4
- export default component;
2
+ import { FlowerFlowProps } from '../types/FlowerFlow';
3
+ export declare const FlowerFlow: ({ children, onEnter, onExit }: FlowerFlowProps) => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { FlowerNavigateProps } from '../../types/FlowerNavigate';
3
+ export declare const FlowerNavigate: ({ children, flowName: forceFlowName, action, route, node, rules, alwaysDisplay }: FlowerNavigateProps) => React.JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- declare function FlowerNavigateWrapper({ hidden, Component, onNavigate, ...props }: any): any;
3
- declare const component: React.MemoExoticComponent<typeof FlowerNavigateWrapper>;
4
- export default component;
2
+ declare function _FlowerNavigateWrapper({ hidden, Component, onNavigate, ...props }: any): any;
3
+ export declare const FlowerNavigateWrapper: React.MemoExoticComponent<typeof _FlowerNavigateWrapper>;
4
+ export {};
@@ -1,4 +1,2 @@
1
- import React from 'react';
2
- import { FlowerNavigateProps } from '../types/FlowerNavigate';
3
- declare const component: React.MemoExoticComponent<({ children, flowName: forceFlowName, action, route, node, rules, alwaysDisplay, }: FlowerNavigateProps) => React.JSX.Element | (string | number | Iterable<React.ReactNode> | React.JSX.Element)[] | null | undefined>;
4
- export default component;
1
+ export * from './FlowerNavigate';
2
+ export * from './useFlowerNavigate';
@@ -1,4 +1,4 @@
1
- import { FlowerNavigateProps } from '../types/FlowerNavigate';
1
+ import { FlowerNavigateProps } from '../../types/FlowerNavigate';
2
2
  type UseFlowerNavigateProps = Pick<FlowerNavigateProps, 'flowName' | 'node' | 'route' | 'action'>;
3
3
  export declare const useFlowerNavigate: ({ flowName, action, route, node }: UseFlowerNavigateProps) => {
4
4
  onNavigate: () => void;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { FlowerNodeProps } from './types/FlowerNode';
3
- declare const component: React.MemoExoticComponent<({ children, onEnter, onExit }: FlowerNodeProps) => React.ReactNode>;
4
- export default component;
2
+ import { FlowerNodeProps } from '../types/FlowerNode';
3
+ export declare const FlowerNode: ({ children, onEnter, onExit }: FlowerNodeProps) => React.JSX.Element;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { FlowerRouteProps } from './types/FlowerRoute';
3
- declare const component: React.MemoExoticComponent<({ autostart, children, onEnter, onExit }: FlowerRouteProps) => React.ReactNode>;
4
- export default component;
2
+ import { FlowerRouteProps } from '../types/FlowerRoute';
3
+ export declare const FlowerRoute: ({ autostart, children, onEnter, onExit }: FlowerRouteProps) => React.JSX.Element;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { FlowerServerProps } from './types/FlowerServer';
3
- declare const component: React.MemoExoticComponent<({ children }: FlowerServerProps) => React.ReactNode>;
4
- export default component;
2
+ import { FlowerServerProps } from '../types/FlowerServer';
3
+ export declare const FlowerServer: ({ children }: FlowerServerProps) => React.JSX.Element;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
- declare function FlowerStart(): null;
3
- declare const component: React.MemoExoticComponent<typeof FlowerStart>;
4
- export default component;
1
+ declare function _FlowerStart(): null;
2
+ export declare const FlowerStart: typeof _FlowerStart;
3
+ export {};
@@ -0,0 +1,5 @@
1
+ import { UseClientInitEventProps, UseFlowerNavigateEventProps, UseSetCurrentEventProps, UseSetHistoryEventProps } from './types';
2
+ export declare const useClientInitEvent: ({ flowName, isInitialized, wsDevtools }: UseClientInitEventProps) => void;
3
+ export declare const useSetHistoryEvent: ({ flowName, isInitialized, wsDevtools }: UseSetHistoryEventProps) => void;
4
+ export declare const useSetCurrentEvent: ({ current, flowName, isInitialized, wsDevtools }: UseSetCurrentEventProps) => void;
5
+ export declare const useFlowerNavigateEvent: ({ current, flowName, isInitialized, wsDevtools, isDisabled }: UseFlowerNavigateEventProps) => void;
@@ -0,0 +1,5 @@
1
+ export * from './useInitNodes';
2
+ export * from './useInitDevtools';
3
+ export * from './useDestroyFlow';
4
+ export * from './eventsHandlers';
5
+ export * from './useSelectorsClient';
@@ -0,0 +1,29 @@
1
+ import { NodeConfig } from '@flowerforce/flower-core';
2
+ import { FlowerClientProps } from '../../../types/Flower';
3
+ import { MutableRefObject } from 'react';
4
+ export type UseClientInitEventProps = {
5
+ isInitialized: string;
6
+ wsDevtools: boolean;
7
+ flowName: string;
8
+ };
9
+ export type UseSetHistoryEventProps = UseClientInitEventProps;
10
+ export type UseSetCurrentEventProps = UseClientInitEventProps & {
11
+ current: string;
12
+ };
13
+ export type UseFlowerNavigateEventProps = UseSetCurrentEventProps & {
14
+ isDisabled: boolean;
15
+ };
16
+ export type UseDestroyFlowProps = {
17
+ one: MutableRefObject<boolean>;
18
+ persist: boolean;
19
+ flowName: string;
20
+ };
21
+ export type UseInitDevtoolsProps = {
22
+ devtoolState: Object;
23
+ flowName: string;
24
+ setWsDevtools: (value: boolean) => void;
25
+ };
26
+ export type UseInitNodesProps = {
27
+ one: MutableRefObject<boolean>;
28
+ nodes: NodeConfig[];
29
+ } & Omit<FlowerClientProps, 'destroyOnUnmount'>;
@@ -0,0 +1,12 @@
1
+ import { useFlowerActions } from '../../types';
2
+ /**
3
+ * Hook centralizzato per sincronizzare la navigazione browser con Redux
4
+ * @param {function} backAction - Azione Redux da chiamare quando si fa "indietro"
5
+ * @param {function} nextAction - Azione Redux da chiamare quando si fa "avanti"
6
+ */
7
+ type UseHistorySyncProps = {
8
+ backAction: () => ReturnType<useFlowerActions['back']>;
9
+ nextAction: () => ReturnType<useFlowerActions['next']>;
10
+ };
11
+ export declare const useHistorySync: ({ backAction, nextAction }: UseHistorySyncProps) => void;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import { UseDestroyFlowProps } from './types';
2
+ export declare const useDestroyFlow: ({ flowName, one, persist }: UseDestroyFlowProps) => void;
@@ -0,0 +1,2 @@
1
+ import { UseInitDevtoolsProps } from './types';
2
+ export declare const useInitDevtools: ({ devtoolState, setWsDevtools, flowName, }: UseInitDevtoolsProps) => void;
@@ -0,0 +1,2 @@
1
+ import { UseInitNodesProps } from './types';
2
+ export declare const useInitNodes: ({ one, nodes, name, startId, persist, initialData, initialState }: UseInitNodesProps) => void;
@@ -0,0 +1,6 @@
1
+ export declare const useSelectorsClient: (flowName: string) => {
2
+ isInitialized: string;
3
+ current: string;
4
+ isDisabled: boolean;
5
+ prevFlowerNodeId: string | undefined;
6
+ };
@@ -0,0 +1,10 @@
1
+ export * from './Flower';
2
+ export * from './FlowerAction';
3
+ export * from './FlowerComponent';
4
+ export * from './FlowerFlow';
5
+ export * from './FlowerNavigate';
6
+ export * from './FlowerNode';
7
+ export * from './FlowerRoute';
8
+ export * from './FlowerServer';
9
+ export * from './FlowerStart';
10
+ export * from './useFlower';
@@ -1,4 +1,4 @@
1
- import { UseFlower } from './types/FlowerHooks';
1
+ import { UseFlower } from '../../types';
2
2
  /** This hook allows you to read flow informations, such as the flowName and ID of the current node.
3
3
  *
4
4
  * It also exposes all the functions to navigate within the flow:
@@ -17,5 +17,4 @@ import { UseFlower } from './types/FlowerHooks';
17
17
  *
18
18
  * @param {string} name - optional parameter, if flowName exist, name is not used
19
19
  */
20
- declare const useFlower: UseFlower;
21
- export default useFlower;
20
+ export declare const useFlower: UseFlower;
@@ -0,0 +1,22 @@
1
+ import { INode } from '@flowerforce/flower-core';
2
+ export declare const makeActionPayloadOnBack: (flowName: string | undefined, params: any) => {
3
+ type: string;
4
+ payload: Record<string, any>;
5
+ };
6
+ export declare const makeActionPayloadOnReset: (flowName: string | undefined, params: any) => {
7
+ type: string;
8
+ payload: Record<string, any>;
9
+ };
10
+ export declare const makeActionPayloadOnNode: (flowName: string | undefined, params: any) => {
11
+ type: string;
12
+ payload: Record<string, any>;
13
+ };
14
+ export declare const makeActionPayloadOnNext: (flowName: string | undefined, params: any) => {
15
+ type: string;
16
+ payload: Record<string, any>;
17
+ };
18
+ export declare const makeActionPayloadOnRestart: (flowName: string | undefined, params: any) => {
19
+ type: string;
20
+ payload: Record<string, any>;
21
+ };
22
+ export declare const handleHistoryStackChange: (currentIndex: number, currentNode: INode, flowName: string, withUrl?: boolean) => number;
@@ -0,0 +1,2 @@
1
+ export * from './reducer/flowerReducer';
2
+ export * from './selectors/selectors';
@@ -0,0 +1,7 @@
1
+ import { REDUCER_NAME } from '@flowerforce/flower-core';
2
+ import { REDUCERS_TYPES } from '@flowerforce/flower-react-store';
3
+ export declare const flowerReducer: import("@reduxjs/toolkit").Slice<{}, import("@flowerforce/flower-core").CoreReducersFunctions, REDUCER_NAME.FLOWER_FLOW, REDUCER_NAME.FLOWER_FLOW, import("@reduxjs/toolkit").SliceSelectors<{}>>;
4
+ export declare const flowerActions: import("@reduxjs/toolkit").CaseReducerActions<import("@flowerforce/flower-core").CoreReducersFunctions, REDUCER_NAME.FLOWER_FLOW>;
5
+ export declare const flowerFlowReducer: import("redux").Reducer<{}>;
6
+ export declare const reducerFlower: REDUCERS_TYPES;
7
+ export declare const flowerReducers: {};