@arquimedes.co/eureka-forms 2.0.101 → 2.0.104

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 (38) hide show
  1. package/dist/@Types/FormStep.d.ts +7 -3
  2. package/dist/@Types/GenericFormSteps.d.ts +1 -0
  3. package/dist/App/App.css +11 -0
  4. package/dist/App/App.d.ts +2 -0
  5. package/dist/App/App.js +2 -1
  6. package/dist/App/AppFunctions.d.ts +4 -4
  7. package/dist/App/AppHooks.js +1 -17
  8. package/dist/Form/Form.d.ts +2 -0
  9. package/dist/Form/FormFunctions.js +2 -0
  10. package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +33 -30
  11. package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.js +26 -23
  12. package/dist/FormSteps/AYFStepMapper.js +45 -42
  13. package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +57 -54
  14. package/dist/FormSteps/CBRStepMapper.js +80 -65
  15. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +64 -57
  16. package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +5 -2
  17. package/dist/FormSteps/SmartSelectStep/SmartSelectStep.d.ts +4 -1
  18. package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +30 -9
  19. package/dist/Services/DraftService.d.ts +21 -0
  20. package/dist/Services/DraftService.js +71 -0
  21. package/dist/Shared/SmartDraftRenderer.d.ts +8 -0
  22. package/dist/Shared/SmartDraftRenderer.js +17 -0
  23. package/dist/States/GlobalSlice.d.ts +2 -0
  24. package/dist/Utils/AxiosAPI.d.ts +11 -0
  25. package/dist/Utils/AxiosAPI.js +72 -0
  26. package/dist/Utils/StoreContext.d.ts +2 -0
  27. package/dist/Utils/StoreContext.js +2 -0
  28. package/dist/Utils/TestUtils.d.ts +22 -2
  29. package/dist/Utils/TestUtils.js +11 -4
  30. package/dist/Utils/_api.d.ts +8 -0
  31. package/dist/Utils/_api.js +13 -0
  32. package/dist/Utils/store.d.ts +10 -2
  33. package/dist/Utils/store.js +12 -2
  34. package/dist/constants/FormStepTypes.d.ts +2 -1
  35. package/dist/constants/FormStepTypes.js +1 -0
  36. package/dist/hooks.d.ts +0 -2
  37. package/dist/hooks.js +2 -3
  38. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const StoreContext: React.Context<any>;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export var StoreContext = React.createContext({});
@@ -60,7 +60,17 @@ export declare function renderWithProviders(ui: React.ReactElement, { store, ...
60
60
  queryAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
61
61
  findByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
62
62
  findAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
63
- store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<import("./store").EurekaFormsState, import("redux").AnyAction, [import("@reduxjs/toolkit").ThunkMiddleware<import("./store").EurekaFormsState, import("redux").AnyAction, undefined>]>;
63
+ store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<import("redux").EmptyObject & {
64
+ forms: {
65
+ [x: string]: import("./store").RootState;
66
+ };
67
+ api: import("@reduxjs/toolkit/query").CombinedState<{}, never, "api">;
68
+ }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<import("redux").CombinedState<{
69
+ forms: {
70
+ [x: string]: import("./store").RootState;
71
+ };
72
+ api: import("@reduxjs/toolkit/query").CombinedState<{}, never, "api">;
73
+ }>, import("redux").AnyAction, undefined>, import("redux").Middleware<{}, import("@reduxjs/toolkit/query").RootState<{}, string, "api">, import("@reduxjs/toolkit").ThunkDispatch<any, any, import("redux").AnyAction>>]>>;
64
74
  };
65
75
  interface ExtendedRenderHookOptions<TProps> extends Omit<RenderHookOptions<TProps>, 'wrapper'> {
66
76
  store?: AppStore;
@@ -72,6 +82,16 @@ export declare function renderHookWithProviders<TProps, TResult>(callback: (prop
72
82
  waitFor: import("@testing-library/react-hooks").WaitFor;
73
83
  waitForValueToChange: import("@testing-library/react-hooks").WaitForValueToChange;
74
84
  waitForNextUpdate: import("@testing-library/react-hooks").WaitForNextUpdate;
75
- store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<import("./store").EurekaFormsState, import("redux").AnyAction, [import("@reduxjs/toolkit").ThunkMiddleware<import("./store").EurekaFormsState, import("redux").AnyAction, undefined>]>;
85
+ store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<import("redux").EmptyObject & {
86
+ forms: {
87
+ [x: string]: import("./store").RootState;
88
+ };
89
+ api: import("@reduxjs/toolkit/query").CombinedState<{}, never, "api">;
90
+ }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<import("redux").CombinedState<{
91
+ forms: {
92
+ [x: string]: import("./store").RootState;
93
+ };
94
+ api: import("@reduxjs/toolkit/query").CombinedState<{}, never, "api">;
95
+ }>, import("redux").AnyAction, undefined>, import("redux").Middleware<{}, import("@reduxjs/toolkit/query").RootState<{}, string, "api">, import("@reduxjs/toolkit").ThunkDispatch<any, any, import("redux").AnyAction>>]>>;
76
96
  };
77
97
  export {};
@@ -23,13 +23,14 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import React from 'react';
25
25
  import { render } from '@testing-library/react';
26
- import { configureStore, nanoid } from '@reduxjs/toolkit';
26
+ import { combineReducers, configureStore, nanoid } from '@reduxjs/toolkit';
27
27
  import { Provider } from 'react-redux';
28
28
  // As a basic setup, import your same slice reducers
29
29
  import { EurekaFormsReducer } from './store';
30
30
  import { renderHook } from '@testing-library/react-hooks';
31
31
  import { IdFormContext } from '../App/App';
32
- import { StoreContext } from '../hooks';
32
+ import { RootApi } from './_api';
33
+ import { StoreContext } from './StoreContext';
33
34
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
34
35
  export function renderWithProviders(ui, _a) {
35
36
  if (_a === void 0) { _a = {}; }
@@ -38,7 +39,10 @@ export function renderWithProviders(ui, _a) {
38
39
  _b = _a.store,
39
40
  // Automatically create a store instance if no store was passed in
40
41
  store = _b === void 0 ? configureStore({
41
- reducer: EurekaFormsReducer,
42
+ reducer: combineReducers({
43
+ forms: EurekaFormsReducer,
44
+ api: RootApi.reducer,
45
+ }),
42
46
  }) : _b, renderOptions = __rest(_a, ["store"]);
43
47
  // eslint-disable-next-line @typescript-eslint/ban-types
44
48
  function Wrapper(_a) {
@@ -52,7 +56,10 @@ export function renderWithProviders(ui, _a) {
52
56
  export function renderHookWithProviders(callback, _a) {
53
57
  if (_a === void 0) { _a = {}; }
54
58
  var _b = _a.store, store = _b === void 0 ? configureStore({
55
- reducer: EurekaFormsReducer,
59
+ reducer: combineReducers({
60
+ forms: EurekaFormsReducer,
61
+ api: RootApi.reducer,
62
+ }),
56
63
  }) : _b, renderHookOptions = __rest(_a, ["store"]);
57
64
  // eslint-disable-next-line @typescript-eslint/ban-types
58
65
  function Wrapper(_a) {
@@ -0,0 +1,8 @@
1
+ export declare const RootApi: import("@reduxjs/toolkit/query/react").Api<import("@reduxjs/toolkit/query/react").BaseQueryFn<{
2
+ url: string;
3
+ timeout?: number | undefined;
4
+ method?: string | undefined;
5
+ body?: any;
6
+ params?: any;
7
+ headers?: Record<string, any> | undefined;
8
+ }, unknown, unknown, {}, {}>, {}, "api", never, typeof import("@reduxjs/toolkit/query/react").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
@@ -0,0 +1,13 @@
1
+ import { buildCreateApi, coreModule, reactHooksModule, } from '@reduxjs/toolkit/query/react';
2
+ import { axiosBaseQuery } from './AxiosAPI';
3
+ import { createDispatchHook, createSelectorHook, createStoreHook, } from 'react-redux';
4
+ import { StoreContext } from './StoreContext';
5
+ var customCreateApi = buildCreateApi(coreModule(), reactHooksModule({
6
+ useDispatch: createDispatchHook(StoreContext),
7
+ useSelector: createSelectorHook(StoreContext),
8
+ useStore: createStoreHook(StoreContext),
9
+ }));
10
+ export var RootApi = customCreateApi({
11
+ baseQuery: axiosBaseQuery(),
12
+ endpoints: function () { return ({}); },
13
+ });
@@ -8,11 +8,18 @@ export interface RootState {
8
8
  widthStats: WidthStats;
9
9
  }
10
10
  export declare const defaultRootState: RootState;
11
- export type EurekaFormsState = Record<string, RootState>;
11
+ type EurekaFormsState = Record<string, RootState>;
12
12
  export declare function EurekaFormsReducer(state: EurekaFormsState | undefined, action: AnyAction): EurekaFormsState;
13
- export declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<EurekaFormsState, AnyAction, [import("@reduxjs/toolkit").ThunkMiddleware<EurekaFormsState, AnyAction, undefined>]>;
13
+ export declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<import("redux").EmptyObject & {
14
+ forms: EurekaFormsState;
15
+ api: import("@reduxjs/toolkit/query").CombinedState<{}, never, "api">;
16
+ }, AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<import("redux").CombinedState<{
17
+ forms: EurekaFormsState;
18
+ api: import("@reduxjs/toolkit/query").CombinedState<{}, never, "api">;
19
+ }>, AnyAction, undefined>, import("redux").Middleware<{}, import("@reduxjs/toolkit/query").RootState<{}, string, "api">, import("@reduxjs/toolkit").ThunkDispatch<any, any, AnyAction>>]>>;
14
20
  export type AppDispatch = typeof store.dispatch;
15
21
  export type AppStore = typeof store;
22
+ export type AppState = ReturnType<typeof store.getState>;
16
23
  export declare const getAppState: import("@reduxjs/toolkit").AsyncThunk<RootState, {
17
24
  idForm: string;
18
25
  }, {
@@ -25,3 +32,4 @@ export declare const getAppState: import("@reduxjs/toolkit").AsyncThunk<RootStat
25
32
  fulfilledMeta?: unknown;
26
33
  rejectedMeta?: unknown;
27
34
  }>;
35
+ export {};
@@ -45,15 +45,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var _a;
48
49
  import { combineReducers, configureStore, createAsyncThunk, } from '@reduxjs/toolkit';
49
50
  import GlobalSlice from '../States/GlobalSlice';
50
51
  import SiteSlice from '../States/SiteSlice';
51
52
  import WidthStatsSlice from '../States/WidthStatsSlice';
53
+ import { RootApi } from './_api';
52
54
  export var defaultRootState = {
53
55
  global: GlobalSlice.getInitialState(),
54
56
  site: SiteSlice.getInitialState(),
55
57
  widthStats: WidthStatsSlice.getInitialState(),
56
58
  };
59
+ var reducer = combineReducers((_a = {
60
+ forms: EurekaFormsReducer
61
+ },
62
+ _a[RootApi.reducerPath] = RootApi.reducer,
63
+ _a));
57
64
  var FormReducer = combineReducers({
58
65
  global: GlobalSlice.reducer,
59
66
  site: SiteSlice.reducer,
@@ -72,13 +79,16 @@ export function EurekaFormsReducer(state, action) {
72
79
  return __assign(__assign({}, state), (_b = {}, _b[idForm] = FormReducer(state[idForm], action), _b));
73
80
  }
74
81
  export var store = configureStore({
75
- reducer: EurekaFormsReducer,
82
+ reducer: reducer,
83
+ middleware: function (getDefaultMiddleware) {
84
+ return getDefaultMiddleware().concat(RootApi.middleware);
85
+ },
76
86
  });
77
87
  export var getAppState = createAsyncThunk('get/state', function (_a, thunkAPI) {
78
88
  var idForm = _a.idForm;
79
89
  return __awaiter(void 0, void 0, void 0, function () {
80
90
  return __generator(this, function (_b) {
81
- return [2 /*return*/, thunkAPI.getState()[idForm]];
91
+ return [2 /*return*/, thunkAPI.getState().forms[idForm]];
82
92
  });
83
93
  });
84
94
  });
@@ -56,7 +56,8 @@ export declare enum MapperStyleTypes {
56
56
  }
57
57
  export declare enum EntityValueDataTypes {
58
58
  STEP = "STEP",
59
- VALUE = "VALUE"
59
+ VALUE = "VALUE",
60
+ CURRENT_AGENT = "CURRENT_AGENT"
60
61
  }
61
62
  export declare enum ApiSelectorParamTypes {
62
63
  STEP = "STEP",
@@ -67,6 +67,7 @@ export var EntityValueDataTypes;
67
67
  (function (EntityValueDataTypes) {
68
68
  EntityValueDataTypes["STEP"] = "STEP";
69
69
  EntityValueDataTypes["VALUE"] = "VALUE";
70
+ EntityValueDataTypes["CURRENT_AGENT"] = "CURRENT_AGENT";
70
71
  })(EntityValueDataTypes || (EntityValueDataTypes = {}));
71
72
  export var ApiSelectorParamTypes;
72
73
  (function (ApiSelectorParamTypes) {
package/dist/hooks.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import type { TypedUseSelectorHook } from 'react-redux';
2
2
  import { type RootState, type AppDispatch } from './Utils/store';
3
- import React from 'react';
4
- export declare const StoreContext: React.Context<any>;
5
3
  export declare const useAppDispatch: () => AppDispatch;
6
4
  export declare const useAppSelector: TypedUseSelectorHook<RootState>;
7
5
  export declare const selectBreakPoint: (state: RootState) => number;
package/dist/hooks.js CHANGED
@@ -2,8 +2,7 @@ import { createDispatchHook, createSelectorHook } from 'react-redux';
2
2
  import { defaultRootState, } from './Utils/store';
3
3
  import { useContext } from 'react';
4
4
  import { IdFormContext } from './App/App';
5
- import React from 'react';
6
- export var StoreContext = React.createContext({});
5
+ import { StoreContext } from './Utils/StoreContext';
7
6
  var useSelector = createSelectorHook(StoreContext);
8
7
  var useDispatch = createDispatchHook(StoreContext);
9
8
  // Use throughout your app instead of plain `useDispatch` and `useSelector`
@@ -18,7 +17,7 @@ export var useAppDispatch = function () {
18
17
  };
19
18
  export var useAppSelector = function (selector, options) {
20
19
  var idForm = useContext(IdFormContext);
21
- return useSelector(function (state) { var _a; return selector((_a = state[idForm]) !== null && _a !== void 0 ? _a : defaultRootState); }, options);
20
+ return useSelector(function (state) { var _a; return selector((_a = state.forms[idForm]) !== null && _a !== void 0 ? _a : defaultRootState); }, options);
22
21
  };
23
22
  export var selectBreakPoint = function (state) {
24
23
  return state.widthStats.currentBreakPoint;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version": "2.0.101",
4
+ "version": "2.0.104",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",