@legalplace/wizardx-core 4.42.10-nightly.20251125120616 → 4.42.11

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 (211) hide show
  1. package/README.md +1 -376
  2. package/dist/App.d.ts +6 -1
  3. package/dist/App.js +7 -2
  4. package/dist/App.test.js +37 -0
  5. package/dist/Loader.d.ts +1 -1
  6. package/dist/Loader.js +1 -1
  7. package/dist/PluginLoader.d.ts +36 -21
  8. package/dist/PluginLoader.js +227 -90
  9. package/dist/PluginLoader.test.d.ts +1 -0
  10. package/dist/PluginLoader.test.js +52 -0
  11. package/dist/Shimmer.d.ts +11 -8
  12. package/dist/Shimmer.js +4 -4
  13. package/dist/ThemeLoader.d.ts +8 -8
  14. package/dist/ThemeLoader.test.d.ts +2 -0
  15. package/dist/ThemeLoader.test.js +65 -0
  16. package/dist/components/PluginRoute.d.ts +2 -2
  17. package/dist/components/PluginRoute.js +4 -3
  18. package/dist/components/SmartScript.d.ts +6 -2
  19. package/dist/components/SmartScript.js +1 -1
  20. package/dist/components/UserLocked/UserLockedComponent.js +2 -2
  21. package/dist/components/View.d.ts +3 -3
  22. package/dist/components/View.js +7 -5
  23. package/dist/components/View.test.d.ts +2 -0
  24. package/dist/components/View.test.js +84 -0
  25. package/dist/componentsConnectors/connectBox.d.ts +6 -4
  26. package/dist/componentsConnectors/connectBox.test.d.ts +1 -0
  27. package/dist/componentsConnectors/connectBox.test.js +218 -0
  28. package/dist/componentsConnectors/connectDocument.d.ts +6 -4
  29. package/dist/componentsConnectors/connectDocument.test.d.ts +1 -0
  30. package/dist/componentsConnectors/connectDocument.test.js +95 -0
  31. package/dist/componentsConnectors/connectHeader.d.ts +6 -4
  32. package/dist/componentsConnectors/connectMetaTitle.d.ts +7 -3
  33. package/dist/componentsConnectors/connectMetaTitle.test.d.ts +1 -0
  34. package/dist/componentsConnectors/connectMetaTitle.test.js +32 -0
  35. package/dist/componentsConnectors/connectOption.d.ts +7 -5
  36. package/dist/componentsConnectors/connectPagination.d.ts +7 -5
  37. package/dist/componentsConnectors/connectPreview.d.ts +7 -3
  38. package/dist/componentsConnectors/connectProgress.d.ts +6 -4
  39. package/dist/componentsConnectors/connectRootOption.d.ts +7 -5
  40. package/dist/componentsConnectors/connectSection.d.ts +6 -4
  41. package/dist/componentsConnectors/connectSummary.d.ts +9 -5
  42. package/dist/componentsConnectors/connectSummaryItem.d.ts +6 -4
  43. package/dist/componentsConnectors/connectTermsheet.js +1 -1
  44. package/dist/componentsConnectors/connectVariable.d.ts +8 -6
  45. package/dist/componentsConnectors/connectWizardWrapper.d.ts +6 -4
  46. package/dist/componentsConnectors/connector/componentConnector.d.ts +10 -7
  47. package/dist/componentsConnectors/connector/componentConnector.js +3 -3
  48. package/dist/componentsConnectors/library.d.ts +81 -47
  49. package/dist/config.test.d.ts +1 -0
  50. package/dist/config.test.js +54 -0
  51. package/dist/helpers/activitiesHelper.d.ts +3 -3
  52. package/dist/helpers/autocomplete.helper.d.ts +2 -2
  53. package/dist/helpers/autocomplete.helper.js +1 -1
  54. package/dist/helpers/autosave.helper.d.ts +13 -3
  55. package/dist/helpers/autosave.helper.js +70 -3
  56. package/dist/helpers/inpiCitiesHelper.js +1 -1
  57. package/dist/helpers/outputsParsing.d.ts +9 -9
  58. package/dist/hooks/useDispatch.d.ts +1 -1
  59. package/dist/hooks/usePrevious.js +1 -1
  60. package/dist/index.d.ts +0 -3
  61. package/dist/index.js +0 -3
  62. package/dist/libs/ConditionsRunner.d.ts +1 -1
  63. package/dist/libs/Formatter/FormatAddress.d.ts +1 -1
  64. package/dist/libs/InputsInitiator.d.ts +1 -1
  65. package/dist/libs/NumAuto.test.d.ts +1 -0
  66. package/dist/libs/NumAuto.test.js +43 -0
  67. package/dist/libs/PathReader.d.ts +1 -96
  68. package/dist/libs/PathReader.js +2 -1
  69. package/dist/libs/SectionValidity.test.d.ts +1 -0
  70. package/dist/libs/SectionValidity.test.js +116 -0
  71. package/dist/libs/SmartScriptStore.d.ts +6 -6
  72. package/dist/redux/actions/app.d.ts +1 -1
  73. package/dist/redux/actions/app.test.d.ts +1 -0
  74. package/dist/redux/actions/app.test.js +90 -0
  75. package/dist/redux/actions/conditions.test.d.ts +1 -0
  76. package/dist/redux/actions/conditions.test.js +68 -0
  77. package/dist/redux/actions/inputs.d.ts +1 -1
  78. package/dist/redux/actions/inputs.test.d.ts +1 -0
  79. package/dist/redux/actions/inputs.test.js +53 -0
  80. package/dist/redux/actions/library.d.ts +21 -15
  81. package/dist/redux/actions/references.d.ts +2 -2
  82. package/dist/redux/actions/references.test.d.ts +1 -0
  83. package/dist/redux/actions/references.test.js +43 -0
  84. package/dist/redux/actions/sagas/data.d.ts +1 -1
  85. package/dist/redux/actions/sagas/data.test.d.ts +1 -0
  86. package/dist/redux/actions/sagas/data.test.js +11 -0
  87. package/dist/redux/actions/sagas/model.test.d.ts +1 -0
  88. package/dist/redux/actions/sagas/model.test.js +11 -0
  89. package/dist/redux/actions/sagas/user.d.ts +1 -1
  90. package/dist/redux/actions/user.test.d.ts +1 -0
  91. package/dist/redux/actions/user.test.js +16 -0
  92. package/dist/redux/listeners/subscriber.d.ts +1 -1
  93. package/dist/redux/listeners/subscriber.test.d.ts +1 -0
  94. package/dist/redux/listeners/subscriber.test.js +31 -0
  95. package/dist/redux/middlewares/conditionsWatcherMiddleware.d.ts +1 -1
  96. package/dist/redux/middlewares/conditionsWatcherMiddleware.test.d.ts +1 -0
  97. package/dist/redux/middlewares/conditionsWatcherMiddleware.test.js +330 -0
  98. package/dist/redux/middlewares/evaluationsWatcherMiddleware.d.ts +1 -1
  99. package/dist/redux/middlewares/evaluationsWatcherMiddleware.test.d.ts +1 -0
  100. package/dist/redux/middlewares/evaluationsWatcherMiddleware.test.js +242 -0
  101. package/dist/redux/middlewares/mandatoriesWatcherMiddleware.d.ts +1 -1
  102. package/dist/redux/middlewares/multiplesActionsMiddleware.d.ts +1 -1
  103. package/dist/redux/middlewares/multiplesActionsMiddleware.test.d.ts +1 -0
  104. package/dist/redux/middlewares/multiplesActionsMiddleware.test.js +209 -0
  105. package/dist/redux/middlewares/paginationWatcherMiddleware.d.ts +2 -2
  106. package/dist/redux/middlewares/pluginsHookMiddleware.d.ts +2 -1
  107. package/dist/redux/middlewares/pluginsHookMiddleware.js +7 -1
  108. package/dist/redux/middlewares/prefillerWatcherMiddleware.d.ts +1 -1
  109. package/dist/redux/middlewares/prefillerWatcherMiddleware.test.d.ts +1 -0
  110. package/dist/redux/middlewares/prefillerWatcherMiddleware.test.js +84 -0
  111. package/dist/redux/middlewares/smartscriptMiddleware.d.ts +1 -1
  112. package/dist/redux/middlewares/smartscriptMiddleware.js +2 -2
  113. package/dist/redux/middlewares/thirdpartyScriptsMiddleware.d.ts +1 -1
  114. package/dist/redux/reducers/app/instance.test.d.ts +1 -0
  115. package/dist/redux/reducers/app/instance.test.js +75 -0
  116. package/dist/redux/reducers/app/meta.test.d.ts +1 -0
  117. package/dist/redux/reducers/app/meta.test.js +70 -0
  118. package/dist/redux/reducers/app/pagination/updateAvailableAppStates.js +2 -1
  119. package/dist/redux/reducers/app/pagination.test.d.ts +1 -0
  120. package/dist/redux/reducers/app/pagination.test.js +134 -0
  121. package/dist/redux/reducers/app/wizard.test.d.ts +1 -0
  122. package/dist/redux/reducers/app/wizard.test.js +53 -0
  123. package/dist/redux/reducers/app.d.ts +6 -6
  124. package/dist/redux/reducers/app.test.d.ts +1 -0
  125. package/dist/redux/reducers/app.test.js +175 -0
  126. package/dist/redux/reducers/conditions/addMultipleOccurency.test.d.ts +1 -0
  127. package/dist/redux/reducers/conditions/addMultipleOccurency.test.js +108 -0
  128. package/dist/redux/reducers/conditions/deleteMultipleOccurency.test.d.ts +1 -0
  129. package/dist/redux/reducers/conditions/deleteMultipleOccurency.test.js +77 -0
  130. package/dist/redux/reducers/conditions/updateDocumentConditions.test.d.ts +1 -0
  131. package/dist/redux/reducers/conditions/updateDocumentConditions.test.js +35 -0
  132. package/dist/redux/reducers/conditions/updateOptionValidatorCondition.test.d.ts +1 -0
  133. package/dist/redux/reducers/conditions/updateOptionValidatorCondition.test.js +35 -0
  134. package/dist/redux/reducers/conditions/updateVariableValidatorCondition.test.d.ts +1 -0
  135. package/dist/redux/reducers/conditions/updateVariableValidatorCondition.test.js +35 -0
  136. package/dist/redux/reducers/conditions.test.d.ts +1 -0
  137. package/dist/redux/reducers/conditions.test.js +196 -0
  138. package/dist/redux/reducers/inputs/addMultipleOccurency.test.d.ts +1 -0
  139. package/dist/redux/reducers/inputs/addMultipleOccurency.test.js +101 -0
  140. package/dist/redux/reducers/inputs/deleteMultipleOccurency.test.d.ts +1 -0
  141. package/dist/redux/reducers/inputs/deleteMultipleOccurency.test.js +56 -0
  142. package/dist/redux/reducers/inputs.test.d.ts +1 -0
  143. package/dist/redux/reducers/inputs.test.js +171 -0
  144. package/dist/redux/reducers/references.js +0 -2
  145. package/dist/redux/reducers/user.test.d.ts +1 -0
  146. package/dist/redux/reducers/user.test.js +42 -0
  147. package/dist/redux/routerHistore.test.d.ts +1 -0
  148. package/dist/redux/routerHistore.test.js +15 -0
  149. package/dist/redux/sagas/fetchModel.test.d.ts +1 -0
  150. package/dist/redux/sagas/fetchModel.test.js +127 -0
  151. package/dist/redux/sagas/runner.test.d.ts +1 -0
  152. package/dist/redux/sagas/runner.test.js +10 -0
  153. package/dist/redux/sagas/saveData.test.d.ts +1 -0
  154. package/dist/redux/sagas/saveData.test.js +74 -0
  155. package/dist/redux/sagas/setDefaults.test.d.ts +1 -0
  156. package/dist/redux/sagas/setDefaults.test.js +73 -0
  157. package/dist/redux/selectors/app.test.d.ts +1 -0
  158. package/dist/redux/selectors/app.test.js +99 -0
  159. package/dist/redux/selectors/conditions.test.d.ts +1 -0
  160. package/dist/redux/selectors/conditions.test.js +70 -0
  161. package/dist/redux/selectors/inputs.d.ts +1 -1
  162. package/dist/redux/selectors/inputs.test.d.ts +1 -0
  163. package/dist/redux/selectors/inputs.test.js +44 -0
  164. package/dist/redux/selectors/references.test.d.ts +1 -0
  165. package/dist/redux/selectors/references.test.js +471 -0
  166. package/dist/redux/selectors/selectors.d.ts +4 -4
  167. package/dist/redux/selectors/selectors.test.d.ts +1 -0
  168. package/dist/redux/selectors/selectors.test.js +16 -0
  169. package/dist/redux/selectors/user.test.d.ts +1 -0
  170. package/dist/redux/selectors/user.test.js +29 -0
  171. package/dist/redux/store.d.ts +3 -5
  172. package/dist/redux/store.js +1 -2
  173. package/dist/redux/store.test.d.ts +1 -0
  174. package/dist/redux/store.test.js +16 -0
  175. package/dist/service/api.manager.d.ts +2 -2
  176. package/dist/service/autocomplete.manager.d.ts +3 -3
  177. package/dist/service/autocomplete.manager.js +3 -3
  178. package/dist/tests-misc/plugins/jestTestPlugin/after.js +1 -1
  179. package/dist/tests-misc/plugins/jestTestPlugin/before.js +1 -1
  180. package/dist/tests-misc/plugins/jestTestPlugin/title.js +1 -1
  181. package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.d.ts +1 -1
  182. package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.js +1 -1
  183. package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.d.ts +1 -1
  184. package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.js +1 -1
  185. package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.d.ts +1 -1
  186. package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.js +1 -1
  187. package/dist/types/Actions.type.d.ts +6 -70
  188. package/dist/types/Components.type.d.ts +2 -3
  189. package/dist/types/PluginConfig.type.d.ts +52 -18
  190. package/dist/types/State.type.d.ts +2 -2
  191. package/dist/types/config.type.d.ts +1 -1
  192. package/dist/types/getActions.type.d.ts +1 -1
  193. package/dist/types/getConnectors.type.d.ts +2 -2
  194. package/dist/types/getSelectors.type.d.ts +1 -1
  195. package/package.json +22 -45
  196. package/dist/WizardCore.d.ts +0 -29
  197. package/dist/WizardCore.js +0 -153
  198. package/dist/app.entry.d.ts +0 -2
  199. package/dist/app.entry.js +0 -1
  200. package/dist/routing/adapters/nextjs.adapter.d.ts +0 -3
  201. package/dist/routing/adapters/nextjs.adapter.js +0 -61
  202. package/dist/routing/adapters/reactRouter.adapter.d.ts +0 -2
  203. package/dist/routing/adapters/reactRouter.adapter.js +0 -16
  204. package/dist/routing/context.d.ts +0 -14
  205. package/dist/routing/context.js +0 -23
  206. package/dist/routing/index.d.ts +0 -4
  207. package/dist/routing/index.js +0 -4
  208. package/dist/routing/types.d.ts +0 -26
  209. package/dist/wizardcore.entry.d.ts +0 -3
  210. package/dist/wizardcore.entry.js +0 -2
  211. /package/dist/{routing/types.js → App.test.d.ts} +0 -0
@@ -1 +1 @@
1
- export declare function useDispatch(): import("redux").Dispatch<any>;
1
+ export declare function useDispatch(): import("redux").Dispatch<import("redux").AnyAction>;
@@ -3,6 +3,6 @@ export const usePrevious = (value) => {
3
3
  const ref = useRef();
4
4
  useEffect(() => {
5
5
  ref.current = value;
6
- }, []);
6
+ });
7
7
  return ref.current;
8
8
  };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,5 @@
1
1
  export { default as App } from "./App";
2
2
  export * from "./App";
3
- export { default as WizardCore } from "./WizardCore";
4
- export * from "./WizardCore";
5
- export * from "./routing";
6
3
  export * from "./config";
7
4
  export * from "./Globals";
8
5
  export * from "./PluginLoader";
package/dist/index.js CHANGED
@@ -1,8 +1,5 @@
1
1
  export { default as App } from "./App";
2
2
  export * from "./App";
3
- export { default as WizardCore } from "./WizardCore";
4
- export * from "./WizardCore";
5
- export * from "./routing";
6
3
  export * from "./config";
7
4
  export * from "./Globals";
8
5
  export * from "./PluginLoader";
@@ -1,6 +1,6 @@
1
1
  import type { Dispatch } from "redux";
2
2
  import type { StateType, MAPPED_CONDITIONS } from "../types/State.type";
3
- export type AllConditions = StateType.Conditions.Options | StateType.Conditions.Variables | StateType.Conditions.Validators | StateType.Conditions.Prefillers | StateType.Conditions.Sections | any[];
3
+ export declare type AllConditions = StateType.Conditions.Options | StateType.Conditions.Variables | StateType.Conditions.Validators | StateType.Conditions.Prefillers | StateType.Conditions.Sections | any[];
4
4
  export declare class ConditionsRunner {
5
5
  dispatch: Dispatch;
6
6
  constructor(dispatch: Dispatch);
@@ -1 +1 @@
1
- export declare const cleanString: (str?: string) => string;
1
+ export declare const cleanString: (str?: string | undefined) => string;
@@ -1,5 +1,5 @@
1
1
  import type { StateType } from "../types/State.type";
2
- export type OptionsVariablesType = {
2
+ export declare type OptionsVariablesType = {
3
3
  options: {
4
4
  [key: string]: boolean[];
5
5
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ import { NumAuto } from './NumAuto';
2
+ describe('NumAuto Test Suit', () => {
3
+ it('Resets properly', () => {
4
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(1);
5
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(2);
6
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(3);
7
+ NumAuto.resetNums();
8
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(1);
9
+ NumAuto.resetNums();
10
+ });
11
+ it('It increments indexes correctly', () => {
12
+ NumAuto.resetNums();
13
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(1);
14
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(2);
15
+ expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(1);
16
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(3);
17
+ expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(2);
18
+ });
19
+ it('It tags properly', () => {
20
+ NumAuto.resetNums();
21
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(1);
22
+ expect(NumAuto.getNum('myTestIndex', 'myTestTag')).toEqual(2);
23
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(3);
24
+ expect(NumAuto.getNumPre('myTestTag', 0, 0)).toEqual(2);
25
+ expect(NumAuto.getNum('myTestTag', null)).toEqual(2);
26
+ });
27
+ it('It returns previous indexes correctly', () => {
28
+ NumAuto.resetNums();
29
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(1);
30
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(2);
31
+ expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(1);
32
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(3);
33
+ expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(2);
34
+ expect(NumAuto.getNumPre('myTestIndex', 0, 1)).toEqual(3);
35
+ expect(NumAuto.getNumPre('myOtherTestIndex', 0, 0)).toEqual(2);
36
+ expect(NumAuto.getNum('myTestIndex', null)).toEqual(4);
37
+ expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(3);
38
+ expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(4);
39
+ expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(5);
40
+ expect(NumAuto.getNumPre('myTestIndex', 0, 0)).toEqual(4);
41
+ expect(NumAuto.getNumPre('myOtherTestIndex', 0, 1)).toEqual(5);
42
+ });
43
+ });
@@ -21,102 +21,7 @@ export declare class PathReader {
21
21
  appStates: string[];
22
22
  };
23
23
  getAppStatesPages(): {
24
- length: number;
25
- toString(): string;
26
- toLocaleString(): string;
27
- toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
28
- pop(): string | undefined;
29
- push(...items: string[]): number;
30
- concat(...items: ConcatArray<string>[]): string[];
31
- concat(...items: (string | ConcatArray<string>)[]): string[];
32
- join(separator?: string): string;
33
- reverse(): string[];
34
- shift(): string | undefined;
35
- slice(start?: number, end?: number): string[];
36
- sort(compareFn?: ((a: string, b: string) => number) | undefined): string[];
37
- splice(start: number, deleteCount?: number): string[];
38
- splice(start: number, deleteCount: number, ...items: string[]): string[];
39
- unshift(...items: string[]): number;
40
- indexOf(searchElement: string, fromIndex?: number): number;
41
- lastIndexOf(searchElement: string, fromIndex?: number): number;
42
- every<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
43
- every(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
44
- some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
45
- forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void;
46
- map<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any): U[];
47
- filter<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
48
- filter(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
49
- reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
50
- reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
51
- reduce<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
52
- reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
53
- reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
54
- reduceRight<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
55
- find<S extends string>(predicate: (value: string, index: number, obj: string[]) => value is S, thisArg?: any): S | undefined;
56
- find(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
57
- findIndex(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): number;
58
- fill(value: string, start?: number, end?: number): string[];
59
- copyWithin(target: number, start: number, end?: number): string[];
60
- entries(): ArrayIterator<[number, string]>;
61
- keys(): ArrayIterator<number>;
62
- values(): ArrayIterator<string>;
63
- includes(searchElement: string, fromIndex?: number): boolean;
64
- flatMap<U, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[], thisArg?: This | undefined): U[];
65
- flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
66
- at(index: number): string | undefined;
67
- findLast<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S | undefined;
68
- findLast(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string | undefined;
69
- findLastIndex(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): number;
70
- toReversed(): string[];
71
- toSorted(compareFn?: ((a: string, b: string) => number) | undefined): string[];
72
- toSpliced(start: number, deleteCount: number, ...items: string[]): string[];
73
- toSpliced(start: number, deleteCount?: number): string[];
74
- with(index: number, value: string): string[];
75
- [Symbol.iterator](): ArrayIterator<string>;
76
- [Symbol.unscopables]: {
77
- [x: number]: boolean | undefined;
78
- length?: boolean | undefined;
79
- toString?: boolean | undefined;
80
- toLocaleString?: boolean | undefined;
81
- pop?: boolean | undefined;
82
- push?: boolean | undefined;
83
- concat?: boolean | undefined;
84
- join?: boolean | undefined;
85
- reverse?: boolean | undefined;
86
- shift?: boolean | undefined;
87
- slice?: boolean | undefined;
88
- sort?: boolean | undefined;
89
- splice?: boolean | undefined;
90
- unshift?: boolean | undefined;
91
- indexOf?: boolean | undefined;
92
- lastIndexOf?: boolean | undefined;
93
- every?: boolean | undefined;
94
- some?: boolean | undefined;
95
- forEach?: boolean | undefined;
96
- map?: boolean | undefined;
97
- filter?: boolean | undefined;
98
- reduce?: boolean | undefined;
99
- reduceRight?: boolean | undefined;
100
- find?: boolean | undefined;
101
- findIndex?: boolean | undefined;
102
- fill?: boolean | undefined;
103
- copyWithin?: boolean | undefined;
104
- entries?: boolean | undefined;
105
- keys?: boolean | undefined;
106
- values?: boolean | undefined;
107
- includes?: boolean | undefined;
108
- flatMap?: boolean | undefined;
109
- flat?: boolean | undefined;
110
- at?: boolean | undefined;
111
- findLast?: boolean | undefined;
112
- findLastIndex?: boolean | undefined;
113
- toReversed?: boolean | undefined;
114
- toSorted?: boolean | undefined;
115
- toSpliced?: boolean | undefined;
116
- with?: boolean | undefined;
117
- [Symbol.iterator]?: boolean | undefined;
118
- readonly [Symbol.unscopables]?: boolean | undefined;
119
- };
24
+ [x: string]: string;
120
25
  };
121
26
  parsePath(page?: number, uniqid?: string | undefined, modelVersion?: string | undefined): string;
122
27
  static isWizardInstancePath(): boolean;
@@ -2,6 +2,7 @@ import { createMatchSelector } from "connected-react-router";
2
2
  import queryString from "query-string";
3
3
  import { matchPath, generatePath } from "react-router";
4
4
  import { getConfig } from "../config";
5
+ import { getPluginsPageAppStates } from "../PluginLoader";
5
6
  import { selectAvailableSections, selectAvailableAppStates, selectInstanceUniqid, selectMetaFetchStatus, } from "../redux/selectors/app";
6
7
  import { selectSectionReference } from "../redux/selectors/references";
7
8
  import Globals from "../Globals";
@@ -124,7 +125,7 @@ export class PathReader {
124
125
  }
125
126
  getAppStatesPages() {
126
127
  const globalAppStates = getConfig().router.appStatesPages || {};
127
- const pluginsAppStates = [];
128
+ const pluginsAppStates = getPluginsPageAppStates();
128
129
  return Object.assign(Object.assign({}, globalAppStates), pluginsAppStates);
129
130
  }
130
131
  parsePath(page = this.currentPage, uniqid = this.currentUniqid, modelVersion = this.modelVersion) {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,116 @@
1
+ import { SectionValidity } from './SectionValidity';
2
+ const mockInputs = {
3
+ options: {
4
+ 1: [true],
5
+ 2: [true],
6
+ 3: [true],
7
+ 1032: [true],
8
+ },
9
+ variables: {},
10
+ };
11
+ const mockReferences = {
12
+ sections: {
13
+ main: {
14
+ 1: {
15
+ id: 1,
16
+ label: 'Section 1 - Valid Section',
17
+ options: [1],
18
+ },
19
+ 2: {
20
+ id: 2,
21
+ label: 'Section 2 - Unvalid Section',
22
+ options: [2],
23
+ },
24
+ 3: {
25
+ id: 3,
26
+ label: 'Section 3 - Has inexistant child',
27
+ options: [1032],
28
+ },
29
+ },
30
+ },
31
+ options: {
32
+ 1: {
33
+ meta: {
34
+ type: 'checkbox',
35
+ id: 1,
36
+ label: 'Option 1',
37
+ step: '*',
38
+ },
39
+ options: [],
40
+ variables: [1],
41
+ },
42
+ 2: {
43
+ meta: {
44
+ type: 'checkbox',
45
+ id: 2,
46
+ label: 'Option 2',
47
+ step: '*',
48
+ },
49
+ options: [3],
50
+ variables: [2],
51
+ },
52
+ 3: {
53
+ meta: {
54
+ type: 'checkbox',
55
+ id: 3,
56
+ label: 'Option 3',
57
+ step: '*',
58
+ },
59
+ options: [],
60
+ variables: [],
61
+ },
62
+ },
63
+ };
64
+ const mockConditions = {
65
+ options: {
66
+ 1: [true],
67
+ 2: [true],
68
+ 3: [true],
69
+ },
70
+ variables: {
71
+ 1: [true],
72
+ 2: [true],
73
+ },
74
+ validators: {
75
+ options: {
76
+ 1: [true],
77
+ 2: [true],
78
+ 3: [false],
79
+ },
80
+ variables: {
81
+ 1: [true],
82
+ 2: [false],
83
+ },
84
+ },
85
+ };
86
+ jest.mock('../redux/selectors/inputs', () => ({
87
+ __esModule: true,
88
+ selectOptionInput: (id) => mockInputs.options[id],
89
+ selectOptionInputByIndex: (id, index) => mockInputs.options[id][index],
90
+ }));
91
+ jest.mock('../redux/selectors/references', () => ({
92
+ __esModule: true,
93
+ selectSectionReference: (id) => mockReferences.sections.main[id],
94
+ selectOptionReference: (id) => mockReferences.options[id],
95
+ }));
96
+ jest.mock('../redux/selectors/conditions', () => ({
97
+ __esModule: true,
98
+ selectOptionConditionValue: (id, index) => mockConditions.options[id][index],
99
+ selectOptionValidatorConditionValue: (id, index) => mockConditions.validators.options[id][index],
100
+ selectVariableConditionValue: (id, index) => mockConditions.variables[id][index],
101
+ selectVariableValidatorConditionValue: (id, index) => mockConditions.validators.variables[id][index],
102
+ }));
103
+ describe('SectionValidity library test suit', () => {
104
+ it('Checks valid section', () => {
105
+ expect(new SectionValidity(1).validity).toBeTruthy();
106
+ });
107
+ it('Checks unvalid section', () => {
108
+ expect(new SectionValidity(2).validity).toBeFalsy();
109
+ });
110
+ it('Should throw an error if option reference does not exist', () => {
111
+ expect(() => new SectionValidity(3).validity).toThrowError('Option 1032 does not exist');
112
+ });
113
+ it('Should throw an error if section does not exist', () => {
114
+ expect(() => new SectionValidity(4).validity).toThrowError('Section 4 does not exist');
115
+ });
116
+ });
@@ -1,7 +1,7 @@
1
1
  import type { Action } from "redux";
2
2
  import type { ActionsType } from "../types/Actions.type";
3
3
  import type { StateType } from "../types/State.type";
4
- export type CallbackType = () => void;
4
+ export declare type CallbackType = () => void;
5
5
  export declare class SmartScriptStore {
6
6
  static hooks: {
7
7
  variables: Record<string, CallbackType[]>;
@@ -29,11 +29,11 @@ export declare class SmartScriptStore {
29
29
  static onVariableChange(id: number | number[], callback: CallbackType): void;
30
30
  static updateVariableInput: (id: number, value: string | number, index?: number) => void;
31
31
  static updateOptionInput: (id: number, value: boolean, index?: number) => void;
32
- static updateVariableMeta: (id: number, _meta: ActionsType.References.updateVariableMeta["meta"], index?: number) => void;
32
+ static updateVariableMeta: (id: number, _meta: ActionsType.References.updateVariableMeta["meta"], index?: number | undefined) => void;
33
33
  static updateOptionMeta: (id: number, _meta: ActionsType.References.updateOptionMeta["meta"]) => void;
34
34
  static retrieveExternalData: () => Readonly<false | any[]>;
35
- static hideOption: (id: number, index?: number) => void;
36
- static displayOption: (id: number, index?: number) => void;
37
- static hideVariable: (id: number, index?: number) => void;
38
- static displayVariable: (id: number, index?: number) => void;
35
+ static hideOption: (id: number, index?: number | undefined) => void;
36
+ static displayOption: (id: number, index?: number | undefined) => void;
37
+ static hideVariable: (id: number, index?: number | undefined) => void;
38
+ static displayVariable: (id: number, index?: number | undefined) => void;
39
39
  }
@@ -13,7 +13,7 @@ export declare const setFetchStatus: (fetchStatus: "waiting" | "succeeded" | "fa
13
13
  export declare const initInstanceAction: (instance: StateType.App.Instance) => ActionsType.App.initInstance;
14
14
  export declare const updateInstanceAction: (instance: Partial<StateType.App.Instance>) => ActionsType.App.updateInstance;
15
15
  export declare const updateInstancePaidAction: (isPaid: boolean) => ActionsType.App.updateInstancePaid;
16
- export type initPaginationActionPropsType = Omit<ActionsType.App.initPagination, "type">;
16
+ export declare type initPaginationActionPropsType = Omit<ActionsType.App.initPagination, "type">;
17
17
  export declare const initPaginationAction: (pagination: initPaginationActionPropsType) => ActionsType.App.initPagination;
18
18
  export declare const updateAvailableAppStatesAction: (availableAppStates: StateType.App.Pagination["availableAppStates"], ingorePluginAppStateReset?: boolean) => ActionsType.App.updateAvailableAppStates;
19
19
  export declare const goPageAction: (page: number, pushHistory?: boolean) => ActionsType.App.goPage;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,90 @@
1
+ import { initMetaAction, initInstanceAction, updateInstancePaidAction, initPaginationAction, goPageAction, goNextPageAction, goPreviousPageAction, updateAvailableSectionsAction, } from './app';
2
+ describe('App actions test suit', () => {
3
+ it('initMeta Action', () => {
4
+ const action = initMetaAction({
5
+ id: 123,
6
+ prefix: '',
7
+ permalink: 'document-permalink',
8
+ title: 'Title',
9
+ modelVersion: 1,
10
+ productType: 'demarche',
11
+ });
12
+ return expect(action).toStrictEqual({
13
+ type: 'INIT_META',
14
+ id: 123,
15
+ prefix: '',
16
+ permalink: 'document-permalink',
17
+ title: 'Title',
18
+ modelVersion: 1,
19
+ productType: 'demarche',
20
+ });
21
+ });
22
+ it('initInstance Action', () => {
23
+ const action = initInstanceAction({
24
+ dataStatus: 'saved',
25
+ uniqid: 'ubsd989ded3',
26
+ isPaid: false,
27
+ steps: '*',
28
+ });
29
+ return expect(action).toStrictEqual({
30
+ type: 'INIT_INSTANCE',
31
+ dataStatus: 'saved',
32
+ uniqid: 'ubsd989ded3',
33
+ isPaid: false,
34
+ steps: '*',
35
+ });
36
+ });
37
+ it('updateInstancePaid Action', () => {
38
+ const action = updateInstancePaidAction(true);
39
+ return expect(action).toStrictEqual({
40
+ type: 'UPDATE_INSTANCE_PAID',
41
+ isPaid: true,
42
+ });
43
+ });
44
+ it('initPagination Action', () => {
45
+ const action = initPaginationAction({
46
+ currentSectionId: 1,
47
+ currentPage: 1,
48
+ greatestPage: 1,
49
+ availableSections: [1, 2, 3],
50
+ availableAppStates: ['wizard'],
51
+ currentAppState: 'wizard',
52
+ });
53
+ return expect(action).toStrictEqual({
54
+ type: 'INIT_PAGINATION',
55
+ currentSectionId: 1,
56
+ currentPage: 1,
57
+ greatestPage: 1,
58
+ availableSections: [1, 2, 3],
59
+ availableAppStates: ['wizard'],
60
+ currentAppState: 'wizard',
61
+ });
62
+ });
63
+ it('goPage Action', () => {
64
+ const action = goPageAction(9);
65
+ return expect(action).toStrictEqual({
66
+ type: 'GO_PAGE',
67
+ currentPage: 9,
68
+ pushHistory: true,
69
+ });
70
+ });
71
+ it('goNextPage Action', () => {
72
+ const action = goNextPageAction();
73
+ return expect(action).toStrictEqual({
74
+ type: 'GO_NEXT_PAGE',
75
+ });
76
+ });
77
+ it('goPreviousPage Action', () => {
78
+ const action = goPreviousPageAction();
79
+ return expect(action).toStrictEqual({
80
+ type: 'GO_PREVIOUS_PAGE',
81
+ });
82
+ });
83
+ it('updateAvailableSections Action', () => {
84
+ const action = updateAvailableSectionsAction([1, 2, 3]);
85
+ return expect(action).toStrictEqual({
86
+ type: 'UPDATE_AVAILABLE_SECTIONS',
87
+ availableSections: [1, 2, 3],
88
+ });
89
+ });
90
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,68 @@
1
+ import { initConditionsAction, updateOptionConditionsAction, updateVariableConditionsAction, updateSectionConditionsAction, updatePrefillersConditionsAction, } from './conditions';
2
+ describe('Conditions actions test suit', () => {
3
+ it('initConditions Action', () => {
4
+ const action = initConditionsAction({
5
+ options: {},
6
+ variables: {},
7
+ prefillers: {},
8
+ validators: {
9
+ options: {},
10
+ variables: {},
11
+ },
12
+ sections: {
13
+ main: {},
14
+ },
15
+ documents: {},
16
+ });
17
+ expect(action).toEqual({
18
+ type: 'INIT_CONDITIONS',
19
+ options: {},
20
+ variables: {},
21
+ prefillers: {},
22
+ validators: {
23
+ options: {},
24
+ variables: {},
25
+ },
26
+ sections: {
27
+ main: {},
28
+ },
29
+ documents: {},
30
+ });
31
+ });
32
+ it('updateOptionConditions Action', () => {
33
+ const action = updateOptionConditionsAction(1, 0, true);
34
+ expect(action).toEqual({
35
+ type: 'UPDATE_OPTION_CONDITION',
36
+ id: 1,
37
+ index: 0,
38
+ value: true,
39
+ });
40
+ });
41
+ it('updateVariableConditions Action', () => {
42
+ const action = updateVariableConditionsAction(1, 0, true);
43
+ expect(action).toEqual({
44
+ type: 'UPDATE_VARIABLE_CONDITION',
45
+ id: 1,
46
+ index: 0,
47
+ value: true,
48
+ });
49
+ });
50
+ it('updateSectionConditions Action', () => {
51
+ const action = updateSectionConditionsAction(1, 'main', true);
52
+ expect(action).toEqual({
53
+ type: 'UPDATE_SECTION_CONDITION',
54
+ id: 1,
55
+ document: 'main',
56
+ value: true,
57
+ });
58
+ });
59
+ it('updatePrefillersConditions Action', () => {
60
+ const action = updatePrefillersConditionsAction(1, 0, [true]);
61
+ expect(action).toEqual({
62
+ type: 'UPDATE_PREFILLER_CONDITION',
63
+ id: 1,
64
+ index: 0,
65
+ value: [true],
66
+ });
67
+ });
68
+ });
@@ -1,6 +1,6 @@
1
1
  import type { StateType } from "../../types/State.type";
2
2
  import type { ActionsType } from "../../types/Actions.type";
3
- export declare const initInputsAction: (inputs: StateType.Inputs, references?: StateType.References) => ActionsType.Inputs.initInputs;
3
+ export declare const initInputsAction: (inputs: StateType.Inputs, references?: StateType.References | undefined) => ActionsType.Inputs.initInputs;
4
4
  export declare const initOptionAction: (id: number, values: boolean[]) => ActionsType.Inputs.initOption;
5
5
  export declare const updateOptionAction: (id: number, value: boolean, index: number) => ActionsType.Inputs.updateOptionInput;
6
6
  export declare const initVariableAction: (id: number, values: (string | number)[]) => ActionsType.Inputs.initVariable;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,53 @@
1
+ import { initOptionAction, initVariableAction, updateOptionAction, updateVariableAction, addMultipleOccurencyAction, deleteMultipleOccurencyAction, } from './inputs';
2
+ import { UPDATE_OPTION_INPUT, INIT_VARIABLE, INIT_OPTION, UPDATE_VARIABLE_INPUT, ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, } from '../constants/inputs';
3
+ describe('Inputs actions test suit', () => {
4
+ it('initOption Action', () => {
5
+ const action = initOptionAction(123, [true]);
6
+ return expect(action).toStrictEqual({
7
+ type: INIT_OPTION,
8
+ id: 123,
9
+ values: [true],
10
+ });
11
+ });
12
+ it('initVariable Action', () => {
13
+ const action = initVariableAction(123, ['']);
14
+ return expect(action).toStrictEqual({
15
+ type: INIT_VARIABLE,
16
+ id: 123,
17
+ values: [''],
18
+ });
19
+ });
20
+ it('updateOption Action', () => {
21
+ const action = updateOptionAction(123, true, 3);
22
+ return expect(action).toStrictEqual({
23
+ type: UPDATE_OPTION_INPUT,
24
+ id: 123,
25
+ value: true,
26
+ index: 3,
27
+ });
28
+ });
29
+ it('updateVariable Action', () => {
30
+ const action = updateVariableAction(123, 'Hello', 1);
31
+ return expect(action).toStrictEqual({
32
+ type: UPDATE_VARIABLE_INPUT,
33
+ id: 123,
34
+ value: 'Hello',
35
+ index: 1,
36
+ });
37
+ });
38
+ it('addMultipleOccurency Action', () => {
39
+ const action = addMultipleOccurencyAction(123);
40
+ return expect(action).toStrictEqual({
41
+ type: ADD_MULTIPLE_OCCURENCY,
42
+ id: 123,
43
+ });
44
+ });
45
+ it('deleteMultipleOccurency Action', () => {
46
+ const action = deleteMultipleOccurencyAction(123, 1);
47
+ return expect(action).toStrictEqual({
48
+ type: DELETE_MULTIPLE_OCCURENCY,
49
+ id: 123,
50
+ index: 1,
51
+ });
52
+ });
53
+ });