@legalplace/wizardx-core 2.3.0 → 2.4.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.
- package/CHANGELOG.md +20 -0
- package/dist/App.d.ts +5 -5
- package/dist/App.js +22 -35
- package/dist/App.test.js +2 -2
- package/dist/Globals.d.ts +4 -0
- package/dist/Globals.js +9 -6
- package/dist/Loader.d.ts +1 -0
- package/dist/Loader.js +2 -0
- package/dist/PluginLoader.d.ts +3 -3
- package/dist/PluginLoader.js +22 -26
- package/dist/PluginLoader.test.js +6 -6
- package/dist/Shimmer.d.ts +1 -1
- package/dist/Shimmer.js +45 -47
- package/dist/ThemeLoader.d.ts +6 -5
- package/dist/ThemeLoader.js +21 -25
- package/dist/ThemeLoader.test.js +4 -3
- package/dist/components/PluginRoute.d.ts +3 -3
- package/dist/components/PluginRoute.js +8 -7
- package/dist/components/SmartScript.d.ts +7 -8
- package/dist/components/SmartScript.js +22 -21
- package/dist/components/UserLocked/UserLockedComponent.d.ts +1 -1
- package/dist/components/UserLocked/UserLockedComponent.js +5 -6
- package/dist/components/View.d.ts +8 -4
- package/dist/components/View.js +46 -55
- package/dist/components/View.test.js +6 -5
- package/dist/componentsConnectors/connectBox.d.ts +2 -3
- package/dist/componentsConnectors/connectBox.js +4 -4
- package/dist/componentsConnectors/connectBox.test.js +7 -7
- package/dist/componentsConnectors/connectDocument.d.ts +0 -1
- package/dist/componentsConnectors/connectDocument.js +6 -6
- package/dist/componentsConnectors/connectDocument.test.js +5 -5
- package/dist/componentsConnectors/connectHeader.d.ts +0 -1
- package/dist/componentsConnectors/connectHeader.js +2 -2
- package/dist/componentsConnectors/connectMetaTitle.d.ts +0 -1
- package/dist/componentsConnectors/connectMetaTitle.js +2 -2
- package/dist/componentsConnectors/connectMetaTitle.test.js +3 -3
- package/dist/componentsConnectors/connectOption.d.ts +2 -3
- package/dist/componentsConnectors/connectOption.js +9 -9
- package/dist/componentsConnectors/connectPagination.d.ts +0 -1
- package/dist/componentsConnectors/connectPagination.js +3 -3
- package/dist/componentsConnectors/connectPreview.d.ts +0 -1
- package/dist/componentsConnectors/connectPreview.js +2 -2
- package/dist/componentsConnectors/connectProgress.d.ts +0 -1
- package/dist/componentsConnectors/connectProgress.js +3 -3
- package/dist/componentsConnectors/connectRootOption.d.ts +2 -3
- package/dist/componentsConnectors/connectRootOption.js +2 -2
- package/dist/componentsConnectors/connectSection.d.ts +0 -1
- package/dist/componentsConnectors/connectSection.js +4 -4
- package/dist/componentsConnectors/connectSummary.d.ts +0 -1
- package/dist/componentsConnectors/connectSummary.js +2 -2
- package/dist/componentsConnectors/connectSummaryItem.d.ts +0 -1
- package/dist/componentsConnectors/connectSummaryItem.js +6 -6
- package/dist/componentsConnectors/connectTermsheet.d.ts +2 -2
- package/dist/componentsConnectors/connectTermsheet.js +43 -46
- package/dist/componentsConnectors/connectVariable.d.ts +1 -2
- package/dist/componentsConnectors/connectVariable.js +10 -10
- package/dist/componentsConnectors/connectWizardWrapper.d.ts +0 -1
- package/dist/componentsConnectors/connectWizardWrapper.js +4 -4
- package/dist/componentsConnectors/connector/componentConnector.d.ts +8 -8
- package/dist/componentsConnectors/connector/componentConnector.js +16 -19
- package/dist/componentsConnectors/library.d.ts +61 -0
- package/dist/componentsConnectors/library.js +34 -0
- package/dist/config.d.ts +1 -1
- package/dist/constants/phoneValidation.d.ts +3 -0
- package/dist/constants/phoneValidation.js +3 -0
- package/dist/helpers/outputsParsing.d.ts +1 -1
- package/dist/helpers/outputsParsing.js +25 -25
- package/dist/helpers/preloadTheme.js +1 -1
- package/dist/helpers/scriptsLoader.d.ts +1 -0
- package/dist/helpers/scriptsLoader.js +24 -0
- package/dist/helpers/sendinblueHelper.d.ts +3 -3
- package/dist/helpers/sendinblueHelper.js +29 -18
- package/dist/hooks/usePrevious.js +1 -1
- package/dist/libs/ConditionsInitiator.d.ts +1 -1
- package/dist/libs/ConditionsInitiator.js +2 -2
- package/dist/libs/ConditionsRunner/DataPopulator.js +7 -7
- package/dist/libs/ConditionsRunner.d.ts +3 -3
- package/dist/libs/ConditionsRunner.js +43 -43
- package/dist/libs/DocumentsOutputs.d.ts +2 -2
- package/dist/libs/DocumentsOutputs.js +5 -5
- package/dist/libs/Eval/EvalBase.js +17 -17
- package/dist/libs/Eval/EvalFunctions.d.ts +1 -1
- package/dist/libs/Eval/EvalFunctions.js +100 -100
- package/dist/libs/Eval/NumbersToLetters.js +46 -46
- package/dist/libs/EvalVariable.d.ts +2 -2
- package/dist/libs/EvalVariable.js +30 -29
- package/dist/libs/EventsTracking.js +32 -32
- package/dist/libs/Extracts.js +20 -20
- package/dist/libs/InputsInitiator.d.ts +1 -1
- package/dist/libs/InputsInitiator.js +15 -15
- package/dist/libs/NumAuto.js +1 -1
- package/dist/libs/OvcConverter.d.ts +1 -1
- package/dist/libs/OvcConverter.js +23 -23
- package/dist/libs/PathReader.d.ts +1 -1
- package/dist/libs/PathReader.js +22 -22
- package/dist/libs/SectionValidity.js +3 -3
- package/dist/libs/SmartScriptStore.d.ts +6 -6
- package/dist/libs/SmartScriptStore.js +33 -33
- package/dist/misc/test_model.d.ts +2 -2
- package/dist/misc/test_model.js +3807 -3807
- package/dist/polyfills/index.d.ts +5 -0
- package/dist/polyfills/index.js +5 -0
- package/dist/polyfills/prepend.js +2 -2
- package/dist/polyfills/stringRepeat.js +4 -4
- package/dist/redux/actions/app.d.ts +12 -12
- package/dist/redux/actions/app.js +1 -1
- package/dist/redux/actions/conditions.d.ts +2 -2
- package/dist/redux/actions/conditions.js +1 -1
- package/dist/redux/actions/inputs.d.ts +1 -1
- package/dist/redux/actions/inputs.js +1 -1
- package/dist/redux/actions/library.d.ts +73 -0
- package/dist/redux/actions/library.js +11 -0
- package/dist/redux/actions/mandatories.d.ts +1 -1
- package/dist/redux/actions/mandatories.js +1 -1
- package/dist/redux/actions/references.d.ts +4 -4
- package/dist/redux/actions/references.js +1 -1
- package/dist/redux/actions/sagas/data.d.ts +1 -1
- package/dist/redux/actions/sagas/data.js +1 -1
- package/dist/redux/actions/sagas/model.d.ts +3 -3
- package/dist/redux/actions/sagas/model.js +3 -3
- package/dist/redux/actions/sagas/user.d.ts +1 -1
- package/dist/redux/actions/sagas/user.js +1 -1
- package/dist/redux/actions/smartscript.d.ts +3 -3
- package/dist/redux/actions/smartscript.js +1 -1
- package/dist/redux/actions/user.d.ts +4 -4
- package/dist/redux/actions/user.js +1 -1
- package/dist/redux/constants/app.js +22 -22
- package/dist/redux/constants/conditions.js +8 -8
- package/dist/redux/constants/inputs.js +6 -6
- package/dist/redux/constants/mandatories.js +6 -6
- package/dist/redux/constants/references.js +3 -3
- package/dist/redux/constants/sagas/data.js +1 -1
- package/dist/redux/constants/sagas/model.js +2 -2
- package/dist/redux/constants/sagas/user.js +2 -2
- package/dist/redux/constants/smartscript.js +4 -4
- package/dist/redux/constants/user.js +3 -3
- package/dist/redux/listeners/subscriber.d.ts +2 -2
- package/dist/redux/middlewares/conditionsWatcherMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/conditionsWatcherMiddleware.js +28 -28
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.d.ts +4 -2
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.js +10 -10
- package/dist/redux/middlewares/mandatoriesWatcherMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/mandatoriesWatcherMiddleware.js +13 -13
- package/dist/redux/middlewares/multiplesActionsMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/multiplesActionsMiddleware.js +2 -2
- package/dist/redux/middlewares/paginationWatcherMiddleware.d.ts +3 -3
- package/dist/redux/middlewares/paginationWatcherMiddleware.js +24 -24
- package/dist/redux/middlewares/pluginsHookMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/pluginsHookMiddleware.js +1 -1
- package/dist/redux/middlewares/prefillerWatcherMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/prefillerWatcherMiddleware.js +28 -28
- package/dist/redux/middlewares/smartscriptMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/smartscriptMiddleware.js +15 -15
- package/dist/redux/middlewares/thirdpartyScriptsMiddleware.d.ts +5 -0
- package/dist/redux/middlewares/thirdpartyScriptsMiddleware.js +16 -0
- package/dist/redux/reducers/app/customizations/initCustomizationAutoDefault.d.ts +2 -2
- package/dist/redux/reducers/app/customizations/initCustomizationMeta.d.ts +2 -2
- package/dist/redux/reducers/app/instance/initInstance.d.ts +2 -2
- package/dist/redux/reducers/app/instance/setDataStatus.d.ts +2 -2
- package/dist/redux/reducers/app/instance/updateInstance.d.ts +2 -2
- package/dist/redux/reducers/app/instance/updateInstancePaid.d.ts +2 -2
- package/dist/redux/reducers/app/meta/fetchModelFailed.d.ts +1 -1
- package/dist/redux/reducers/app/meta/fetchModelFailed.js +1 -1
- package/dist/redux/reducers/app/meta/fetchModelNonBlocking.d.ts +1 -1
- package/dist/redux/reducers/app/meta/fetchModelNonBlocking.js +1 -1
- package/dist/redux/reducers/app/meta/fetchModelSucceeded.d.ts +1 -1
- package/dist/redux/reducers/app/meta/fetchModelSucceeded.js +1 -1
- package/dist/redux/reducers/app/meta/fetchModelUnhealthy.d.ts +2 -2
- package/dist/redux/reducers/app/meta/fetchModelUnhealthy.js +1 -1
- package/dist/redux/reducers/app/meta/fetchModelUserLocked.d.ts +1 -1
- package/dist/redux/reducers/app/meta/fetchModelUserLocked.js +1 -1
- package/dist/redux/reducers/app/meta/initMeta.d.ts +2 -2
- package/dist/redux/reducers/app/meta/setModelUuid.d.ts +2 -2
- package/dist/redux/reducers/app/pagination/goNextPage.d.ts +1 -1
- package/dist/redux/reducers/app/pagination/goNextPage.js +1 -1
- package/dist/redux/reducers/app/pagination/goPage.d.ts +2 -2
- package/dist/redux/reducers/app/pagination/goPage.js +2 -2
- package/dist/redux/reducers/app/pagination/goPreviousPage.d.ts +1 -1
- package/dist/redux/reducers/app/pagination/goPreviousPage.js +1 -1
- package/dist/redux/reducers/app/pagination/initPagination.d.ts +2 -2
- package/dist/redux/reducers/app/pagination/initPagination.js +1 -1
- package/dist/redux/reducers/app/pagination/updateAvailableAppStates.d.ts +2 -2
- package/dist/redux/reducers/app/pagination/updateAvailableAppStates.js +5 -5
- package/dist/redux/reducers/app/wizard/updateAvailableSections.d.ts +2 -2
- package/dist/redux/reducers/app/wizard/updateAvailableSections.js +2 -2
- package/dist/redux/reducers/app.d.ts +2 -2
- package/dist/redux/reducers/app.js +30 -30
- package/dist/redux/reducers/conditions/addMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/conditions/addMultipleOccurency.js +3 -3
- package/dist/redux/reducers/conditions/deleteMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/conditions/deleteMultipleOccurency.js +2 -2
- package/dist/redux/reducers/conditions/initConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updateDocumentConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updateOptionConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updateOptionValidatorCondition.d.ts +2 -2
- package/dist/redux/reducers/conditions/updatePrefillerConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updatePrefillerConditions.js +2 -2
- package/dist/redux/reducers/conditions/updateSectionConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updateVariableConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updateVariableValidatorCondition.d.ts +2 -2
- package/dist/redux/reducers/conditions.d.ts +2 -2
- package/dist/redux/reducers/conditions.js +13 -13
- package/dist/redux/reducers/inputs/addMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/inputs/addMultipleOccurency.js +4 -4
- package/dist/redux/reducers/inputs/deleteMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/inputs/deleteMultipleOccurency.js +2 -2
- package/dist/redux/reducers/inputs/initOption.d.ts +2 -2
- package/dist/redux/reducers/inputs/initVariable.d.ts +2 -2
- package/dist/redux/reducers/inputs/updateOptionInput.d.ts +2 -2
- package/dist/redux/reducers/inputs/updateVariableInput.d.ts +2 -2
- package/dist/redux/reducers/inputs.d.ts +2 -2
- package/dist/redux/reducers/inputs.js +8 -8
- package/dist/redux/reducers/mandatories/addMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/mandatories/addMultipleOccurency.js +2 -2
- package/dist/redux/reducers/mandatories/deleteMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/mandatories/deleteMultipleOccurency.js +2 -2
- package/dist/redux/reducers/mandatories/initMandatoryOption.d.ts +2 -2
- package/dist/redux/reducers/mandatories/initMandatoryVariable.d.ts +2 -2
- package/dist/redux/reducers/mandatories/setMandatoryIgnore.d.ts +2 -2
- package/dist/redux/reducers/mandatories/setMandatoryOption.d.ts +2 -2
- package/dist/redux/reducers/mandatories/setMandatorySection.d.ts +2 -2
- package/dist/redux/reducers/mandatories/setMandatoryVariable.d.ts +2 -2
- package/dist/redux/reducers/mandatories.d.ts +2 -2
- package/dist/redux/reducers/mandatories.js +11 -11
- package/dist/redux/reducers/references/initReferences.d.ts +2 -2
- package/dist/redux/reducers/references/updateOptionMeta.d.ts +2 -2
- package/dist/redux/reducers/references/updateOptionMeta.js +2 -2
- package/dist/redux/reducers/references/updateVariableMeta.d.ts +2 -2
- package/dist/redux/reducers/references/updateVariableMeta.js +2 -2
- package/dist/redux/reducers/references.d.ts +2 -2
- package/dist/redux/reducers/references.js +5 -5
- package/dist/redux/reducers/smartscript/enableSmartScript.d.ts +1 -1
- package/dist/redux/reducers/smartscript/initSmartScriptTriggers.d.ts +2 -2
- package/dist/redux/reducers/smartscript/updateSmartscriptOptionHidden.d.ts +2 -2
- package/dist/redux/reducers/smartscript/updateSmartscriptVariableHidden.d.ts +2 -2
- package/dist/redux/reducers/smartscript.d.ts +2 -2
- package/dist/redux/reducers/smartscript.js +6 -6
- package/dist/redux/reducers/user/initUser.d.ts +2 -2
- package/dist/redux/reducers/user/setUserStatus.d.ts +2 -2
- package/dist/redux/reducers/user/setUserValidToken.d.ts +2 -2
- package/dist/redux/reducers/user.d.ts +2 -2
- package/dist/redux/reducers/user.js +9 -9
- package/dist/redux/routerHistory.d.ts +2 -2
- package/dist/redux/routerHistory.js +5 -5
- package/dist/redux/sagas/fetchModel.d.ts +4 -4
- package/dist/redux/sagas/fetchModel.js +84 -88
- package/dist/redux/sagas/fetchModel.test.js +2 -3
- package/dist/redux/sagas/homogeneousRadioInputsSaga.js +5 -5
- package/dist/redux/sagas/runner.d.ts +1 -1
- package/dist/redux/sagas/runner.js +5 -5
- package/dist/redux/sagas/saveData.js +34 -25
- package/dist/redux/sagas/setDefaults.js +8 -8
- package/dist/redux/sagas/setUserEmail.js +43 -43
- package/dist/redux/selectors/app.d.ts +1 -0
- package/dist/redux/selectors/app.js +26 -25
- package/dist/redux/selectors/conditions.js +34 -34
- package/dist/redux/selectors/inputs.d.ts +1 -1
- package/dist/redux/selectors/inputs.js +8 -8
- package/dist/{componentsConnectors/connector/connectorSelectors.d.ts → redux/selectors/library.d.ts} +16 -16
- package/dist/redux/selectors/library.js +8 -0
- package/dist/redux/selectors/mandatories.js +10 -10
- package/dist/redux/selectors/references.js +19 -19
- package/dist/redux/selectors/selectors.d.ts +2 -2
- package/dist/redux/selectors/selectors.js +2 -2
- package/dist/redux/selectors/smartscript.js +5 -5
- package/dist/redux/selectors/user.js +5 -5
- package/dist/redux/store.d.ts +6 -2
- package/dist/redux/store.js +31 -31
- package/dist/service/api.manager.d.ts +2 -2
- package/dist/service/api.manager.js +46 -46
- package/dist/service/auth.service.js +2 -2
- package/dist/service/pardot.service.js +2 -2
- package/dist/tests-misc/plugins/jestTestPlugin/after.d.ts +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/after.js +2 -2
- package/dist/tests-misc/plugins/jestTestPlugin/before.d.ts +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/before.js +2 -5
- package/dist/tests-misc/plugins/jestTestPlugin/index.js +4 -4
- package/dist/tests-misc/plugins/jestTestPlugin/title.d.ts +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/title.js +2 -2
- package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.d.ts +0 -1
- package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.js +2 -2
- package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.d.ts +0 -1
- package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.js +2 -2
- package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.d.ts +0 -1
- package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.js +2 -2
- package/dist/tests-misc/themes/jestTestTheme/faltyIndex.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/faltyIndexLoader.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/index.js +4 -4
- package/dist/types/Actions.type.d.ts +37 -37
- package/dist/types/Components.type.d.ts +4 -5
- package/dist/types/State.type.d.ts +9 -9
- package/dist/types/Termsheet.type.d.ts +4 -4
- package/dist/types/api.type.d.ts +4 -4
- package/dist/types/config.type.d.ts +2 -3
- package/dist/types/getActions.type.d.ts +2 -2
- package/dist/types/getConnectors.type.d.ts +2 -3
- package/dist/types/getSelectors.type.d.ts +2 -2
- package/dist/wizard-params.d.ts +1 -1
- package/dist/wizard-params.js +16 -16
- package/jest.config.ts +1 -1
- package/package.json +16 -8
- package/setupJest.ts +8 -0
- package/src/App.tsx +22 -25
- package/src/Globals.ts +12 -8
- package/src/Loader.tsx +8 -0
- package/src/PluginLoader.tsx +20 -37
- package/src/Shimmer.tsx +58 -45
- package/src/ThemeLoader.test.tsx +1 -0
- package/src/ThemeLoader.tsx +27 -42
- package/src/components/PluginRoute.tsx +8 -6
- package/src/components/SmartScript.tsx +29 -28
- package/src/components/UserLocked/UserLockedComponent.tsx +3 -3
- package/src/components/View.test.tsx +3 -0
- package/src/components/View.tsx +52 -54
- package/src/componentsConnectors/connectBox.tsx +6 -6
- package/src/componentsConnectors/connectDocument.tsx +6 -6
- package/src/componentsConnectors/connectHeader.tsx +2 -2
- package/src/componentsConnectors/connectMetaTitle.tsx +2 -2
- package/src/componentsConnectors/connectOption.tsx +11 -11
- package/src/componentsConnectors/connectPagination.tsx +3 -3
- package/src/componentsConnectors/connectPreview.tsx +2 -2
- package/src/componentsConnectors/connectProgress.tsx +3 -3
- package/src/componentsConnectors/connectRootOption.tsx +4 -4
- package/src/componentsConnectors/connectSection.tsx +4 -4
- package/src/componentsConnectors/connectSummary.tsx +2 -2
- package/src/componentsConnectors/connectSummaryItem.tsx +6 -6
- package/src/componentsConnectors/connectTermsheet.tsx +46 -46
- package/src/componentsConnectors/connectVariable.tsx +11 -11
- package/src/componentsConnectors/connectWizardWrapper.tsx +4 -4
- package/src/componentsConnectors/connector/componentConnector.tsx +22 -20
- package/src/componentsConnectors/library.ts +35 -0
- package/src/config.test.ts +2 -1
- package/src/config.ts +1 -1
- package/src/constants/phoneValidation.ts +6 -0
- package/src/definitions/path.join.d.ts +1 -1
- package/src/helpers/outputsParsing.ts +26 -26
- package/src/helpers/preloadTheme.ts +2 -2
- package/src/helpers/scriptsLoader.ts +20 -0
- package/src/helpers/sendinblueHelper.ts +23 -17
- package/src/hooks/usePrevious.ts +1 -1
- package/src/libs/ConditionsInitiator.ts +3 -3
- package/src/libs/ConditionsRunner/DataPopulator.ts +7 -7
- package/src/libs/ConditionsRunner.ts +53 -53
- package/src/libs/DocumentsOutputs.ts +7 -7
- package/src/libs/Eval/EvalBase.ts +17 -17
- package/src/libs/Eval/EvalFunctions.ts +100 -100
- package/src/libs/Eval/NumbersToLetters.ts +48 -48
- package/src/libs/EvalVariable.ts +34 -31
- package/src/libs/EventsTracking.ts +38 -38
- package/src/libs/Extracts.ts +21 -21
- package/src/libs/InputsInitiator.ts +16 -16
- package/src/libs/NumAuto.ts +1 -1
- package/src/libs/OvcConverter.ts +25 -25
- package/src/libs/PathReader.ts +23 -23
- package/src/libs/SectionValidity.ts +3 -3
- package/src/libs/SmartScriptStore.ts +40 -40
- package/src/misc/test_model.ts +3809 -3809
- package/src/polyfills/index.ts +5 -0
- package/src/polyfills/prepend.ts +2 -2
- package/src/polyfills/stringRepeat.ts +4 -4
- package/src/redux/actions/app.ts +13 -13
- package/src/redux/actions/conditions.ts +3 -3
- package/src/redux/actions/inputs.ts +2 -2
- package/src/redux/actions/library.ts +23 -0
- package/src/redux/actions/mandatories.ts +2 -2
- package/src/redux/actions/references.ts +5 -5
- package/src/redux/actions/sagas/data.ts +2 -2
- package/src/redux/actions/sagas/model.ts +6 -6
- package/src/redux/actions/sagas/user.ts +2 -2
- package/src/redux/actions/smartscript.ts +4 -4
- package/src/redux/actions/user.ts +5 -5
- package/src/redux/constants/app.ts +22 -22
- package/src/redux/constants/conditions.ts +8 -8
- package/src/redux/constants/inputs.ts +6 -6
- package/src/redux/constants/mandatories.ts +6 -6
- package/src/redux/constants/references.ts +3 -3
- package/src/redux/constants/sagas/data.ts +1 -1
- package/src/redux/constants/sagas/model.ts +2 -2
- package/src/redux/constants/sagas/user.ts +2 -2
- package/src/redux/constants/smartscript.ts +4 -4
- package/src/redux/constants/user.ts +3 -3
- package/src/redux/listeners/subscriber.ts +2 -2
- package/src/redux/middlewares/conditionsWatcherMiddleware.ts +31 -31
- package/src/redux/middlewares/evaluationsWatcherMiddleware.test.ts +1 -1
- package/src/redux/middlewares/evaluationsWatcherMiddleware.ts +13 -13
- package/src/redux/middlewares/mandatoriesWatcherMiddleware.ts +16 -16
- package/src/redux/middlewares/multiplesActionsMiddleware.ts +6 -6
- package/src/redux/middlewares/paginationWatcherMiddleware.ts +27 -27
- package/src/redux/middlewares/pluginsHookMiddleware.ts +2 -2
- package/src/redux/middlewares/prefillerWatcherMiddleware.ts +31 -31
- package/src/redux/middlewares/smartscriptMiddleware.ts +20 -20
- package/src/redux/middlewares/thirdpartyScriptsMiddleware.ts +41 -0
- package/src/redux/reducers/app/customizations/initCustomizationAutoDefault.ts +2 -2
- package/src/redux/reducers/app/customizations/initCustomizationMeta.ts +2 -2
- package/src/redux/reducers/app/instance/initInstance.ts +2 -2
- package/src/redux/reducers/app/instance/setDataStatus.ts +2 -2
- package/src/redux/reducers/app/instance/updateInstance.ts +2 -2
- package/src/redux/reducers/app/instance/updateInstancePaid.ts +2 -2
- package/src/redux/reducers/app/meta/fetchModelFailed.ts +2 -2
- package/src/redux/reducers/app/meta/fetchModelNonBlocking.ts +2 -2
- package/src/redux/reducers/app/meta/fetchModelSucceeded.ts +2 -2
- package/src/redux/reducers/app/meta/fetchModelUnhealthy.ts +3 -3
- package/src/redux/reducers/app/meta/fetchModelUserLocked.ts +2 -2
- package/src/redux/reducers/app/meta/initMeta.ts +2 -2
- package/src/redux/reducers/app/meta/setModelUuid.ts +2 -2
- package/src/redux/reducers/app/pagination/goNextPage.ts +2 -2
- package/src/redux/reducers/app/pagination/goPage.ts +4 -4
- package/src/redux/reducers/app/pagination/goPreviousPage.ts +2 -2
- package/src/redux/reducers/app/pagination/initPagination.ts +3 -3
- package/src/redux/reducers/app/pagination/updateAvailableAppStates.ts +7 -7
- package/src/redux/reducers/app/wizard/updateAvailableSections.ts +4 -4
- package/src/redux/reducers/app.ts +32 -32
- package/src/redux/reducers/conditions/addMultipleOccurency.ts +5 -5
- package/src/redux/reducers/conditions/deleteMultipleOccurency.ts +4 -4
- package/src/redux/reducers/conditions/initConditions.ts +2 -2
- package/src/redux/reducers/conditions/updateDocumentConditions.ts +2 -2
- package/src/redux/reducers/conditions/updateOptionConditions.ts +2 -2
- package/src/redux/reducers/conditions/updateOptionValidatorCondition.ts +2 -2
- package/src/redux/reducers/conditions/updatePrefillerConditions.ts +4 -4
- package/src/redux/reducers/conditions/updateSectionConditions.ts +2 -2
- package/src/redux/reducers/conditions/updateVariableConditions.ts +2 -2
- package/src/redux/reducers/conditions/updateVariableValidatorCondition.ts +2 -2
- package/src/redux/reducers/conditions.ts +15 -15
- package/src/redux/reducers/inputs/addMultipleOccurency.ts +6 -6
- package/src/redux/reducers/inputs/deleteMultipleOccurency.ts +4 -4
- package/src/redux/reducers/inputs/initOption.ts +2 -2
- package/src/redux/reducers/inputs/initVariable.ts +2 -2
- package/src/redux/reducers/inputs/updateOptionInput.ts +2 -2
- package/src/redux/reducers/inputs/updateVariableInput.ts +2 -2
- package/src/redux/reducers/inputs.ts +10 -10
- package/src/redux/reducers/mandatories/addMultipleOccurency.ts +4 -4
- package/src/redux/reducers/mandatories/deleteMultipleOccurency.ts +4 -4
- package/src/redux/reducers/mandatories/initMandatoryOption.ts +2 -2
- package/src/redux/reducers/mandatories/initMandatoryVariable.ts +2 -2
- package/src/redux/reducers/mandatories/setMandatoryIgnore.ts +2 -2
- package/src/redux/reducers/mandatories/setMandatoryOption.ts +2 -2
- package/src/redux/reducers/mandatories/setMandatorySection.ts +2 -2
- package/src/redux/reducers/mandatories/setMandatoryVariable.ts +2 -2
- package/src/redux/reducers/mandatories.ts +13 -13
- package/src/redux/reducers/references/initReferences.ts +2 -2
- package/src/redux/reducers/references/updateOptionMeta.ts +4 -4
- package/src/redux/reducers/references/updateVariableMeta.ts +4 -4
- package/src/redux/reducers/references.ts +7 -7
- package/src/redux/reducers/smartscript/enableSmartScript.ts +1 -1
- package/src/redux/reducers/smartscript/initSmartScriptTriggers.ts +2 -2
- package/src/redux/reducers/smartscript/updateSmartscriptOptionHidden.ts +2 -2
- package/src/redux/reducers/smartscript/updateSmartscriptVariableHidden.ts +2 -2
- package/src/redux/reducers/smartscript.ts +8 -8
- package/src/redux/reducers/user/initUser.ts +2 -2
- package/src/redux/reducers/user/setUserStatus.ts +2 -2
- package/src/redux/reducers/user/setUserValidToken.ts +2 -2
- package/src/redux/reducers/user.ts +11 -11
- package/src/redux/routerHistory.ts +6 -6
- package/src/redux/sagas/fetchModel.test.ts +2 -5
- package/src/redux/sagas/fetchModel.ts +91 -100
- package/src/redux/sagas/homogeneousRadioInputsSaga.ts +6 -6
- package/src/redux/sagas/runner.ts +6 -6
- package/src/redux/sagas/saveData.ts +32 -28
- package/src/redux/sagas/setDefaults.ts +8 -8
- package/src/redux/sagas/setUserEmail.ts +46 -45
- package/src/redux/selectors/app.ts +34 -28
- package/src/redux/selectors/conditions.ts +41 -41
- package/src/redux/selectors/inputs.ts +10 -10
- package/src/redux/selectors/library.ts +17 -0
- package/src/redux/selectors/mandatories.ts +10 -10
- package/src/redux/selectors/references.ts +21 -21
- package/src/redux/selectors/selectors.ts +4 -4
- package/src/redux/selectors/smartscript.ts +6 -6
- package/src/redux/selectors/user.ts +8 -8
- package/src/redux/store.ts +42 -32
- package/src/service/api.manager.ts +53 -53
- package/src/service/auth.service.ts +2 -2
- package/src/service/pardot.service.ts +2 -2
- package/src/tests-misc/plugins/jestTestPlugin/after.tsx +1 -1
- package/src/tests-misc/plugins/jestTestPlugin/before.tsx +1 -1
- package/src/tests-misc/plugins/jestTestPlugin/index.ts +4 -4
- package/src/tests-misc/plugins/jestTestPlugin/title.tsx +2 -2
- package/src/tests-misc/themes/jestTestTheme/components/EmailComponent.tsx +1 -1
- package/src/tests-misc/themes/jestTestTheme/components/TermsheetComponent.tsx +1 -1
- package/src/tests-misc/themes/jestTestTheme/components/WizardComponent.tsx +1 -1
- package/src/tests-misc/themes/jestTestTheme/faltyIndex.ts +1 -1
- package/src/tests-misc/themes/jestTestTheme/faltyIndexLoader.ts +1 -1
- package/src/tests-misc/themes/jestTestTheme/index.ts +4 -4
- package/src/types/Actions.type.ts +55 -55
- package/src/types/Components.type.ts +4 -4
- package/src/types/State.type.ts +14 -14
- package/src/types/Termsheet.type.ts +4 -4
- package/src/types/api.type.ts +4 -4
- package/src/types/config.type.ts +3 -3
- package/src/types/getActions.type.ts +2 -2
- package/src/types/getConnectors.type.ts +2 -2
- package/src/types/getSelectors.type.ts +2 -2
- package/src/wizard-params.ts +17 -17
- package/tsconfig.json +1 -1
- package/dist/componentsConnectors/connector/connectorSelectors.js +0 -9
- package/dist/componentsConnectors/index.d.ts +0 -16
- package/dist/componentsConnectors/index.js +0 -16
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.js +0 -1
- package/dist/helpers/index.d.ts +0 -2
- package/dist/helpers/index.js +0 -2
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.js +0 -1
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -23
- package/dist/libs/index.d.ts +0 -12
- package/dist/libs/index.js +0 -12
- package/dist/redux/actions/index.d.ts +0 -8
- package/dist/redux/actions/index.js +0 -8
- package/dist/redux/actions/sagas/index.d.ts +0 -3
- package/dist/redux/actions/sagas/index.js +0 -3
- package/dist/redux/constants/index.d.ts +0 -8
- package/dist/redux/constants/index.js +0 -8
- package/dist/redux/constants/sagas/index.d.ts +0 -3
- package/dist/redux/constants/sagas/index.js +0 -3
- package/dist/redux/index.d.ts +0 -4
- package/dist/redux/index.js +0 -4
- package/dist/redux/selectors/index.d.ts +0 -7
- package/dist/redux/selectors/index.js +0 -7
- package/dist/service/index.d.ts +0 -3
- package/dist/service/index.js +0 -3
- package/dist/types/index.d.ts +0 -10
- package/dist/types/index.js +0 -10
- package/src/componentsConnectors/connector/connectorSelectors.ts +0 -19
- package/src/componentsConnectors/index.ts +0 -16
- package/src/constants/index.ts +0 -1
- package/src/helpers/index.ts +0 -2
- package/src/hooks/index.ts +0 -1
- package/src/index.ts +0 -47
- package/src/libs/index.ts +0 -12
- package/src/redux/actions/index.ts +0 -8
- package/src/redux/actions/sagas/index.ts +0 -3
- package/src/redux/constants/index.ts +0 -8
- package/src/redux/constants/sagas/index.ts +0 -3
- package/src/redux/index.ts +0 -4
- package/src/redux/selectors/index.ts +0 -7
- package/src/service/index.ts +0 -3
- package/src/types/index.ts +0 -10
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const loadScripts = () => {
|
|
2
|
+
if (Array.isArray(window.wizardxLoadAfterLcp)) {
|
|
3
|
+
setTimeout(
|
|
4
|
+
() =>
|
|
5
|
+
window.wizardxLoadAfterLcp.forEach(async (script) => {
|
|
6
|
+
if (typeof script === "function") {
|
|
7
|
+
(async () => script())();
|
|
8
|
+
} else if (
|
|
9
|
+
typeof script === "object" &&
|
|
10
|
+
Object.keys(script).length === 1 &&
|
|
11
|
+
typeof script.src === "string"
|
|
12
|
+
) {
|
|
13
|
+
const element = document.createElement("script");
|
|
14
|
+
element.src = script.src;
|
|
15
|
+
}
|
|
16
|
+
}),
|
|
17
|
+
1000
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -1,41 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Extracts from
|
|
3
|
-
import { pardotAttributes } from
|
|
1
|
+
import { FRENCH_OVERSEAS_NUMBERS_REGEX } from "../constants/phoneValidation";
|
|
2
|
+
import Extracts from "../libs/Extracts";
|
|
3
|
+
import { pardotAttributes } from "../service/pardot.service";
|
|
4
4
|
|
|
5
|
-
const formatMobilePhone = (
|
|
6
|
-
const
|
|
5
|
+
const formatMobilePhone = async (number: string): Promise<string> => {
|
|
6
|
+
const phoneNumber = new (await (
|
|
7
|
+
await import("awesome-phonenumber")
|
|
8
|
+
).default)(number, "FR");
|
|
9
|
+
const sanitizedNumber = phoneNumber.getNumber();
|
|
7
10
|
|
|
8
|
-
return !sanitizedNumber?.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
return !sanitizedNumber?.length ||
|
|
12
|
+
(!phoneNumber.isValid() &&
|
|
13
|
+
// Overseas number aren't considerate as valid mobile number by the core library whereas it should
|
|
14
|
+
!FRENCH_OVERSEAS_NUMBERS_REGEX.test(sanitizedNumber))
|
|
15
|
+
? ""
|
|
16
|
+
: sanitizedNumber;
|
|
11
17
|
};
|
|
12
18
|
|
|
13
|
-
export const getSIBExtract = () => {
|
|
19
|
+
export const getSIBExtract = async () => {
|
|
14
20
|
let sibExtract;
|
|
15
21
|
try {
|
|
16
22
|
Extracts.extractData();
|
|
17
23
|
sibExtract = Extracts.getSibExtractedData();
|
|
18
24
|
if (sibExtract.TEL) {
|
|
19
25
|
try {
|
|
20
|
-
sibExtract.SMS = formatMobilePhone(sibExtract.TEL);
|
|
26
|
+
sibExtract.SMS = await formatMobilePhone(sibExtract.TEL);
|
|
21
27
|
} catch (error) {
|
|
22
28
|
// the lib we use to format phone can throw exception
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
} catch (error) {
|
|
26
32
|
// eslint-disable-next-line no-console
|
|
27
|
-
console.error(
|
|
33
|
+
console.error("Error while extracting sendiblue data", error);
|
|
28
34
|
}
|
|
29
35
|
return sibExtract;
|
|
30
36
|
};
|
|
31
37
|
|
|
32
|
-
export const getSendinblueIdentifyAttributes = (
|
|
38
|
+
export const getSendinblueIdentifyAttributes = async (
|
|
33
39
|
uniqid: string,
|
|
34
40
|
documentTitle: string,
|
|
35
41
|
nbFilledVars: number,
|
|
36
42
|
VALIDATION_Q2 = false,
|
|
37
|
-
domain =
|
|
38
|
-
): Record<string, string | number | undefined | boolean | null
|
|
43
|
+
domain = "www.legalplace.fr"
|
|
44
|
+
): Promise<Record<string, string | number | undefined | boolean | null>> => {
|
|
39
45
|
// Identifying client into Sendinblue
|
|
40
46
|
const sendinblueVars: {
|
|
41
47
|
[k: string]: string | undefined | boolean | number | null;
|
|
@@ -46,13 +52,13 @@ export const getSendinblueIdentifyAttributes = (
|
|
|
46
52
|
TELECHARGEMENT: `${domain}/rt/${uniqid}`,
|
|
47
53
|
DOCUMENT: documentTitle,
|
|
48
54
|
WIZZARD_FILLED_FIELDS: nbFilledVars,
|
|
49
|
-
...getSIBExtract(),
|
|
55
|
+
...(await getSIBExtract()),
|
|
50
56
|
...pardotAttributes(),
|
|
51
57
|
VALIDATION_Q2,
|
|
52
58
|
};
|
|
53
59
|
|
|
54
|
-
if (localStorage && localStorage.getItem(
|
|
55
|
-
sendinblueVars.URL_ENTREE = localStorage.getItem(
|
|
60
|
+
if (localStorage && localStorage.getItem("entranceUrl")) {
|
|
61
|
+
sendinblueVars.URL_ENTREE = localStorage.getItem("entranceUrl");
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
return sendinblueVars;
|
package/src/hooks/usePrevious.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StateType } from
|
|
1
|
+
import { StateType } from "../types/State.type";
|
|
2
2
|
|
|
3
3
|
export class ConditionsInitiator {
|
|
4
4
|
private conditions: StateType.Conditions = {
|
|
@@ -44,7 +44,7 @@ export class ConditionsInitiator {
|
|
|
44
44
|
const rootParent = parents[parents.length - 1] || optionId;
|
|
45
45
|
const rootReference = this.references.options[rootParent];
|
|
46
46
|
const occurenciesOptionId =
|
|
47
|
-
rootReference.meta.type ===
|
|
47
|
+
rootReference.meta.type === "repeated" &&
|
|
48
48
|
rootReference.meta.repeatOption !== undefined
|
|
49
49
|
? rootReference.meta.repeatOption
|
|
50
50
|
: rootParent;
|
|
@@ -62,7 +62,7 @@ export class ConditionsInitiator {
|
|
|
62
62
|
const rootParent = parents[parents.length - 1];
|
|
63
63
|
const rootReference = this.references.options[rootParent];
|
|
64
64
|
const occurenciesOptionId =
|
|
65
|
-
rootReference.meta.type ===
|
|
65
|
+
rootReference.meta.type === "repeated" &&
|
|
66
66
|
rootReference.meta.repeatOption !== undefined
|
|
67
67
|
? rootReference.meta.repeatOption
|
|
68
68
|
: rootParent;
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
selectVariableParents,
|
|
4
4
|
selectOptionRelations,
|
|
5
5
|
selectOptionParents,
|
|
6
|
-
} from
|
|
6
|
+
} from "../../redux/selectors/references";
|
|
7
7
|
import {
|
|
8
8
|
selectVariableInput,
|
|
9
9
|
selectOptionInput,
|
|
10
|
-
} from
|
|
10
|
+
} from "../../redux/selectors/inputs";
|
|
11
11
|
import {
|
|
12
12
|
selectVariableConditionValue,
|
|
13
13
|
selectOptionConditionValue,
|
|
14
14
|
selectSectionConditionValue,
|
|
15
|
-
} from
|
|
15
|
+
} from "../../redux/selectors/conditions";
|
|
16
16
|
|
|
17
17
|
class DataPopulator {
|
|
18
18
|
private id?: number;
|
|
@@ -140,10 +140,10 @@ class DataPopulator {
|
|
|
140
140
|
let values = this.getVariableValues(variableId);
|
|
141
141
|
|
|
142
142
|
// If variable is of type number
|
|
143
|
-
if (variableReference.type ===
|
|
143
|
+
if (variableReference.type === "number") {
|
|
144
144
|
values = values
|
|
145
|
-
.map((v) => (typeof v ===
|
|
146
|
-
.map((v) => (Number.isNaN(v) ?
|
|
145
|
+
.map((v) => (typeof v === "number" ? v : parseFloat(v)))
|
|
146
|
+
.map((v) => (Number.isNaN(v) ? "" : v));
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
// Adding variables
|
|
@@ -192,7 +192,7 @@ class DataPopulator {
|
|
|
192
192
|
private cleanArrayFromNullValues(
|
|
193
193
|
arr: (string | number | null)[]
|
|
194
194
|
): (string | number)[] {
|
|
195
|
-
return arr.map((v) => (v === null ?
|
|
195
|
+
return arr.map((v) => (v === null ? "" : v));
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable max-len */
|
|
2
|
-
import { Dispatch } from
|
|
3
|
-
import LpLogic from
|
|
4
|
-
import { selectOptionInput } from
|
|
2
|
+
import { Dispatch } from "redux";
|
|
3
|
+
import LpLogic from "@legalplace/lplogic/dist/LpLogic";
|
|
4
|
+
import { selectOptionInput } from "../redux/selectors/inputs";
|
|
5
5
|
import {
|
|
6
6
|
selectOptionRelations,
|
|
7
7
|
selectVariableRelations,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
selectDocumentConditionsObject,
|
|
17
17
|
selectOptionReference,
|
|
18
18
|
selectSectionRelations,
|
|
19
|
-
} from
|
|
19
|
+
} from "../redux/selectors/references";
|
|
20
20
|
import {
|
|
21
21
|
updateOptionConditionsAction,
|
|
22
22
|
updateVariableConditionsAction,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
updateOptionValidatorConditionsAction,
|
|
26
26
|
updateVariableValidatorConditionsAction,
|
|
27
27
|
updateDocumentConditionsAction,
|
|
28
|
-
} from
|
|
28
|
+
} from "../redux/actions/conditions";
|
|
29
29
|
import {
|
|
30
30
|
selectOptionConditionValue,
|
|
31
31
|
selectVariableConditionValue,
|
|
@@ -34,9 +34,9 @@ import {
|
|
|
34
34
|
selectOptionValidatorConditionValue,
|
|
35
35
|
selectVariableValidatorConditionValue,
|
|
36
36
|
selectDocumentConditionValue,
|
|
37
|
-
} from
|
|
38
|
-
import { StateType, MAPPED_CONDITIONS } from
|
|
39
|
-
import DataPopulator from
|
|
37
|
+
} from "../redux/selectors/conditions";
|
|
38
|
+
import { StateType, MAPPED_CONDITIONS } from "../types/State.type";
|
|
39
|
+
import DataPopulator from "./ConditionsRunner/DataPopulator";
|
|
40
40
|
|
|
41
41
|
// eslint-disable-next-line max-len
|
|
42
42
|
export type AllConditions =
|
|
@@ -189,13 +189,13 @@ export class ConditionsRunner {
|
|
|
189
189
|
if (optionParents.length > 0) {
|
|
190
190
|
const parentReference = selectOptionReference(optionParents[0]);
|
|
191
191
|
if (
|
|
192
|
-
parentReference.meta.type ===
|
|
192
|
+
parentReference.meta.type === "repeated" &&
|
|
193
193
|
parentReference.meta.repeatOption !== undefined
|
|
194
194
|
) {
|
|
195
195
|
inputId = parentReference.meta.repeatOption;
|
|
196
196
|
}
|
|
197
197
|
} else if (
|
|
198
|
-
optionReference.meta.type ===
|
|
198
|
+
optionReference.meta.type === "repeated" &&
|
|
199
199
|
optionReference.meta.repeatOption !== undefined
|
|
200
200
|
) {
|
|
201
201
|
inputId = optionReference.meta.repeatOption;
|
|
@@ -218,7 +218,7 @@ export class ConditionsRunner {
|
|
|
218
218
|
if (optionParents.length > 0) {
|
|
219
219
|
const parentReference = selectOptionReference(optionParents[0]);
|
|
220
220
|
if (
|
|
221
|
-
parentReference.meta.type ===
|
|
221
|
+
parentReference.meta.type === "repeated" &&
|
|
222
222
|
parentReference.meta.repeatOption !== undefined
|
|
223
223
|
) {
|
|
224
224
|
inputId = parentReference.meta.repeatOption;
|
|
@@ -231,7 +231,7 @@ export class ConditionsRunner {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
executeHooks(
|
|
234
|
-
type:
|
|
234
|
+
type: "variables" | "options" | "sections",
|
|
235
235
|
id: number,
|
|
236
236
|
index: number
|
|
237
237
|
) {
|
|
@@ -240,13 +240,13 @@ export class ConditionsRunner {
|
|
|
240
240
|
| StateType.References.Relations.Variables
|
|
241
241
|
| StateType.References.Relations.Sections;
|
|
242
242
|
switch (type) {
|
|
243
|
-
case
|
|
243
|
+
case "options":
|
|
244
244
|
hooks = selectOptionRelations(id);
|
|
245
245
|
break;
|
|
246
|
-
case
|
|
246
|
+
case "variables":
|
|
247
247
|
hooks = selectVariableRelations(id);
|
|
248
248
|
break;
|
|
249
|
-
case
|
|
249
|
+
case "sections":
|
|
250
250
|
hooks = selectSectionRelations(id);
|
|
251
251
|
break;
|
|
252
252
|
default:
|
|
@@ -254,35 +254,35 @@ export class ConditionsRunner {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
type SubTypeTypes =
|
|
257
|
-
|
|
|
258
|
-
|
|
|
259
|
-
|
|
|
260
|
-
|
|
|
261
|
-
|
|
|
262
|
-
|
|
|
263
|
-
|
|
|
257
|
+
| "options"
|
|
258
|
+
| "variables"
|
|
259
|
+
| "sections"
|
|
260
|
+
| "prefillers"
|
|
261
|
+
| "optionValidator"
|
|
262
|
+
| "variableValidator"
|
|
263
|
+
| "documents";
|
|
264
264
|
|
|
265
265
|
const subTypesList: SubTypeTypes[] = [
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
266
|
+
"options",
|
|
267
|
+
"variables",
|
|
268
|
+
"sections",
|
|
269
|
+
"prefillers",
|
|
270
|
+
"optionValidator",
|
|
271
|
+
"variableValidator",
|
|
272
|
+
"documents",
|
|
273
273
|
];
|
|
274
274
|
|
|
275
275
|
subTypesList.forEach((subType) => {
|
|
276
|
-
if (subType ===
|
|
276
|
+
if (subType === "sections") {
|
|
277
277
|
return this.executeSectionsHooks(hooks, index);
|
|
278
278
|
}
|
|
279
279
|
let currentHooks: any[];
|
|
280
280
|
|
|
281
281
|
// Validators hooks
|
|
282
|
-
if (subType ===
|
|
282
|
+
if (subType === "optionValidator" || subType === "variableValidator") {
|
|
283
283
|
currentHooks =
|
|
284
284
|
hooks.validators[
|
|
285
|
-
subType ===
|
|
285
|
+
subType === "optionValidator" ? "options" : "variables"
|
|
286
286
|
];
|
|
287
287
|
} else {
|
|
288
288
|
currentHooks = hooks[subType];
|
|
@@ -290,23 +290,23 @@ export class ConditionsRunner {
|
|
|
290
290
|
|
|
291
291
|
// Executing hooks conditions
|
|
292
292
|
currentHooks.forEach((currentId: number) => {
|
|
293
|
-
const execId = subType ===
|
|
294
|
-
const updateId = subType ===
|
|
293
|
+
const execId = subType === "documents" ? 0 : currentId;
|
|
294
|
+
const updateId = subType === "documents" ? currentId : currentId;
|
|
295
295
|
|
|
296
296
|
// Update indexes
|
|
297
297
|
let execIndexes: number[] = [];
|
|
298
298
|
|
|
299
299
|
if (
|
|
300
|
-
[
|
|
301
|
-
typeof updateId ===
|
|
300
|
+
["options", "optionValidator"].includes(subType) &&
|
|
301
|
+
typeof updateId === "number"
|
|
302
302
|
) {
|
|
303
303
|
if (
|
|
304
|
-
type ===
|
|
304
|
+
type === "options" &&
|
|
305
305
|
this.isOptionRelatedToOption(updateId, id)
|
|
306
306
|
) {
|
|
307
307
|
execIndexes = [index];
|
|
308
308
|
} else if (
|
|
309
|
-
type ===
|
|
309
|
+
type === "variables" &&
|
|
310
310
|
this.isVariableRelatedToOption(id, updateId)
|
|
311
311
|
) {
|
|
312
312
|
execIndexes = [index];
|
|
@@ -314,16 +314,16 @@ export class ConditionsRunner {
|
|
|
314
314
|
execIndexes = this.getInputsForOption(updateId);
|
|
315
315
|
}
|
|
316
316
|
} else if (
|
|
317
|
-
[
|
|
318
|
-
typeof updateId ===
|
|
317
|
+
["variables", "prefillers", "variableValidator"].includes(subType) &&
|
|
318
|
+
typeof updateId === "number"
|
|
319
319
|
) {
|
|
320
320
|
if (
|
|
321
|
-
type ===
|
|
321
|
+
type === "options" &&
|
|
322
322
|
this.isVariableRelatedToOption(updateId, id)
|
|
323
323
|
) {
|
|
324
324
|
execIndexes = [index];
|
|
325
325
|
} else if (
|
|
326
|
-
type ===
|
|
326
|
+
type === "variables" &&
|
|
327
327
|
this.isVariableRelatedToVariable(id, updateId)
|
|
328
328
|
) {
|
|
329
329
|
execIndexes = [index];
|
|
@@ -381,7 +381,7 @@ export class ConditionsRunner {
|
|
|
381
381
|
condition,
|
|
382
382
|
parseInt(currentId, 10),
|
|
383
383
|
index,
|
|
384
|
-
|
|
384
|
+
"sections"
|
|
385
385
|
);
|
|
386
386
|
|
|
387
387
|
// Current condition
|
|
@@ -416,8 +416,8 @@ export class ConditionsRunner {
|
|
|
416
416
|
// Returning true of condition is empty
|
|
417
417
|
if (
|
|
418
418
|
!(
|
|
419
|
-
typeof condition ===
|
|
420
|
-
typeof condition.conditions ===
|
|
419
|
+
typeof condition === "object" &&
|
|
420
|
+
typeof condition.conditions === "object" &&
|
|
421
421
|
Object.keys(condition.conditions).length > 0
|
|
422
422
|
)
|
|
423
423
|
)
|
|
@@ -425,12 +425,12 @@ export class ConditionsRunner {
|
|
|
425
425
|
|
|
426
426
|
// Populating Data
|
|
427
427
|
let currentData;
|
|
428
|
-
if (conditionType ===
|
|
428
|
+
if (conditionType === "options" || conditionType === "optionValidator") {
|
|
429
429
|
currentData = new DataPopulator(condition.dataMap, id, index).getData();
|
|
430
430
|
} else if (
|
|
431
|
-
conditionType ===
|
|
432
|
-
conditionType ===
|
|
433
|
-
conditionType ===
|
|
431
|
+
conditionType === "variables" ||
|
|
432
|
+
conditionType === "prefillers" ||
|
|
433
|
+
conditionType === "variableValidator"
|
|
434
434
|
) {
|
|
435
435
|
const dataId = selectVariableParents(id)[0];
|
|
436
436
|
currentData = new DataPopulator(
|
|
@@ -439,9 +439,9 @@ export class ConditionsRunner {
|
|
|
439
439
|
index
|
|
440
440
|
).getData();
|
|
441
441
|
} else if (
|
|
442
|
-
conditionType ===
|
|
443
|
-
conditionType ===
|
|
444
|
-
conditionType ===
|
|
442
|
+
conditionType === "sections" ||
|
|
443
|
+
conditionType === "documents" ||
|
|
444
|
+
conditionType === "raw"
|
|
445
445
|
) {
|
|
446
446
|
currentData = new DataPopulator(condition.dataMap).getData();
|
|
447
447
|
}
|
|
@@ -449,6 +449,6 @@ export class ConditionsRunner {
|
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
executeRawCondition(condition: MAPPED_CONDITIONS | MAPPED_CONDITIONS[]) {
|
|
452
|
-
return this.executeCondition(condition, 0, 0,
|
|
452
|
+
return this.executeCondition(condition, 0, 0, "raw");
|
|
453
453
|
}
|
|
454
454
|
}
|
|
@@ -2,16 +2,16 @@ import type {
|
|
|
2
2
|
SectionV3,
|
|
3
3
|
OptionV3,
|
|
4
4
|
VariableV3,
|
|
5
|
-
} from
|
|
5
|
+
} from "@legalplace/models-v3-types";
|
|
6
6
|
import type {
|
|
7
7
|
ReferencesSingleOutputType,
|
|
8
8
|
ReferencesSectionsDocumentType,
|
|
9
|
-
} from
|
|
10
|
-
import { NumAuto } from
|
|
9
|
+
} from "@legalplace/referencesparser/dist/libs/References.type";
|
|
10
|
+
import { NumAuto } from "./NumAuto";
|
|
11
11
|
import {
|
|
12
12
|
getRelatedVariablesValues,
|
|
13
13
|
parseOutputWithVariables,
|
|
14
|
-
} from
|
|
14
|
+
} from "../helpers/outputsParsing";
|
|
15
15
|
|
|
16
16
|
export interface GettersType {
|
|
17
17
|
// References
|
|
@@ -82,10 +82,10 @@ export class DocumentsOutputs {
|
|
|
82
82
|
|
|
83
83
|
private parseOption(id: number): void {
|
|
84
84
|
const option = this.getters.optionReference(id);
|
|
85
|
-
if (![
|
|
85
|
+
if (!["hidden", "repeated"].includes(option.meta.type)) return;
|
|
86
86
|
|
|
87
87
|
// If it's a repeated
|
|
88
|
-
if (option.meta.type ===
|
|
88
|
+
if (option.meta.type === "repeated") this.parseRepeated(option);
|
|
89
89
|
else this.parseHidden(option);
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -150,7 +150,7 @@ export class DocumentsOutputs {
|
|
|
150
150
|
const [type, catalog, tag] = currentAn;
|
|
151
151
|
|
|
152
152
|
const currentNum =
|
|
153
|
-
type ===
|
|
153
|
+
type === "numauto-pre"
|
|
154
154
|
? NumAuto.getNumPre(catalog, index, siblingsCount)
|
|
155
155
|
: NumAuto.getNum(catalog, tag);
|
|
156
156
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
selectVariableInputByIndex,
|
|
3
3
|
selectVariableInput,
|
|
4
|
-
} from
|
|
4
|
+
} from "../../redux/selectors/inputs";
|
|
5
5
|
import {
|
|
6
6
|
areVariablesSiblings,
|
|
7
7
|
selectVariableReference,
|
|
8
|
-
} from
|
|
9
|
-
import { selectIsVariableDisplayed } from
|
|
8
|
+
} from "../../redux/selectors/references";
|
|
9
|
+
import { selectIsVariableDisplayed } from "../../redux/selectors/conditions";
|
|
10
10
|
|
|
11
11
|
export class EvalBase {
|
|
12
12
|
index: number;
|
|
@@ -33,11 +33,11 @@ export class EvalBase {
|
|
|
33
33
|
|
|
34
34
|
getVariableValue(varRef: string | number, full = false) {
|
|
35
35
|
let variableId: number;
|
|
36
|
-
if (typeof varRef ===
|
|
37
|
-
variableId = typeof varRef ===
|
|
36
|
+
if (typeof varRef === "number" || varRef.match(/^([0-9]+)$/))
|
|
37
|
+
variableId = typeof varRef === "number" ? varRef : parseInt(varRef, 10);
|
|
38
38
|
else {
|
|
39
39
|
const matchId = varRef.match(/([0-9]+)/);
|
|
40
|
-
if (matchId === null) return full === true ? [
|
|
40
|
+
if (matchId === null) return full === true ? [""] : "";
|
|
41
41
|
|
|
42
42
|
variableId = parseInt(matchId[0], 10);
|
|
43
43
|
}
|
|
@@ -47,7 +47,7 @@ export class EvalBase {
|
|
|
47
47
|
let value;
|
|
48
48
|
if (full === false) {
|
|
49
49
|
value = selectVariableInputByIndex(variableId, index);
|
|
50
|
-
if (selectIsVariableDisplayed(variableId, index) === false) return
|
|
50
|
+
if (selectIsVariableDisplayed(variableId, index) === false) return "";
|
|
51
51
|
return this.parseNumber(value);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -56,46 +56,46 @@ export class EvalBase {
|
|
|
56
56
|
value = value.map((v, i) =>
|
|
57
57
|
selectIsVariableDisplayed(variableId, i) === true
|
|
58
58
|
? this.parseNumber(v)
|
|
59
|
-
:
|
|
59
|
+
: ""
|
|
60
60
|
);
|
|
61
61
|
return value;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
parseNumber(value: string | number) {
|
|
65
|
-
if (typeof value ===
|
|
65
|
+
if (typeof value === "number") return value;
|
|
66
66
|
|
|
67
67
|
// If it's a display evaluation (D=) we keep values starting by 0 as strings
|
|
68
|
-
if (this.isDisplay && typeof value ===
|
|
68
|
+
if (this.isDisplay && typeof value === "string" && /^0/.test(value.trim()))
|
|
69
69
|
return value;
|
|
70
70
|
|
|
71
71
|
// Otherwise we convert values to float numbers and make
|
|
72
72
|
// sure to replace commas by dots
|
|
73
73
|
if (/^([0-9,.]+)$/.test(value.trim()))
|
|
74
|
-
return parseFloat(value.replace(
|
|
74
|
+
return parseFloat(value.replace(",", ".").trim());
|
|
75
75
|
return value;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
setEmpty(value: string | number, replacer: string | number) {
|
|
79
|
-
return typeof value ===
|
|
79
|
+
return typeof value === "string"
|
|
80
80
|
? value.replace(
|
|
81
81
|
/___EMPTY___/g,
|
|
82
|
-
typeof replacer ===
|
|
82
|
+
typeof replacer === "string" ? replacer : replacer.toString()
|
|
83
83
|
)
|
|
84
84
|
: value;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
setCommas(value: string | number) {
|
|
88
|
-
const stringValue = typeof value ===
|
|
88
|
+
const stringValue = typeof value === "number" ? value.toString() : value;
|
|
89
89
|
|
|
90
90
|
return /^([0-9,.]+)$/.test(stringValue.trim())
|
|
91
|
-
? stringValue.replace(
|
|
91
|
+
? stringValue.replace(".", ",").trim()
|
|
92
92
|
: value;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
isVariableEditable(varRef: string | number) {
|
|
96
96
|
let variableId: number;
|
|
97
|
-
if (typeof varRef ===
|
|
98
|
-
variableId = typeof varRef ===
|
|
97
|
+
if (typeof varRef === "number" || varRef.match(/^([0-9]+)$/))
|
|
98
|
+
variableId = typeof varRef === "number" ? varRef : parseInt(varRef, 10);
|
|
99
99
|
else {
|
|
100
100
|
const matchId = varRef.match(/([0-9]+)/);
|
|
101
101
|
if (matchId === null) return false;
|