@legalplace/wizardx-core 2.3.0 → 2.5.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 +37 -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 +3 -1
- package/dist/redux/actions/inputs.js +6 -1
- package/dist/redux/actions/library.d.ts +74 -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.d.ts +1 -0
- package/dist/redux/constants/inputs.js +7 -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 +33 -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 +79 -131
- package/dist/redux/sagas/fetchModel.test.js +2 -3
- package/dist/redux/sagas/homogeneousRadioInputsSaga.js +5 -5
- package/dist/redux/sagas/initInputs.d.ts +5 -0
- package/dist/redux/sagas/initInputs.js +63 -0
- package/dist/redux/sagas/runner.d.ts +1 -1
- package/dist/redux/sagas/runner.js +7 -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} +17 -16
- package/dist/redux/selectors/library.js +8 -0
- package/dist/redux/selectors/mandatories.js +10 -10
- package/dist/redux/selectors/references.d.ts +1 -0
- package/dist/redux/selectors/references.js +20 -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 +42 -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 +18 -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 +8 -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 +61 -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 +86 -187
- package/src/redux/sagas/homogeneousRadioInputsSaga.ts +6 -6
- package/src/redux/sagas/initInputs.ts +110 -0
- package/src/redux/sagas/runner.ts +8 -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 +25 -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 +63 -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
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { UPDATE_OPTION_INPUT, UPDATE_VARIABLE_INPUT, ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, } from
|
|
2
|
-
import { selectOptionInput, selectOptionInputByIndex, selectVariableInputByIndex, selectVariableInput, } from
|
|
3
|
-
import { ConditionsRunner } from
|
|
4
|
-
import { INIT_CONDITIONS, UPDATE_SECTION_CONDITION, UPDATE_OPTION_CONDITION, UPDATE_VARIABLE_CONDITION, } from
|
|
5
|
-
import { selectOptionRelations, selectOptionConditionsObject, selectVariableConditionsObject, } from
|
|
6
|
-
import { setDataStatus } from
|
|
7
|
-
import { selectSectionConditionValue, selectOptionConditionValue, selectVariableConditionValue, } from
|
|
1
|
+
import { UPDATE_OPTION_INPUT, UPDATE_VARIABLE_INPUT, ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, } from "../constants/inputs";
|
|
2
|
+
import { selectOptionInput, selectOptionInputByIndex, selectVariableInputByIndex, selectVariableInput, } from "../selectors/inputs";
|
|
3
|
+
import { ConditionsRunner } from "../../libs/ConditionsRunner";
|
|
4
|
+
import { INIT_CONDITIONS, UPDATE_SECTION_CONDITION, UPDATE_OPTION_CONDITION, UPDATE_VARIABLE_CONDITION, } from "../constants/conditions";
|
|
5
|
+
import { selectOptionRelations, selectOptionConditionsObject, selectVariableConditionsObject, } from "../selectors/references";
|
|
6
|
+
import { setDataStatus } from "../actions/app";
|
|
7
|
+
import { selectSectionConditionValue, selectOptionConditionValue, selectVariableConditionValue, } from "../selectors/conditions";
|
|
8
8
|
const watchUpdateOptionInput = (mpi, next, action) => {
|
|
9
9
|
const { id, index, value } = action;
|
|
10
10
|
const oldValue = selectOptionInputByIndex(id, index);
|
|
11
11
|
const nextResult = next(action);
|
|
12
12
|
if (value !== oldValue) {
|
|
13
|
-
mpi.dispatch(setDataStatus(
|
|
13
|
+
mpi.dispatch(setDataStatus("unsaved"));
|
|
14
14
|
const Conditions = new ConditionsRunner(mpi.dispatch);
|
|
15
|
-
Conditions.executeHooks(
|
|
15
|
+
Conditions.executeHooks("options", id, index);
|
|
16
16
|
}
|
|
17
17
|
return nextResult;
|
|
18
18
|
};
|
|
@@ -21,9 +21,9 @@ const watchUpdateOptionCondition = (mpi, next, action) => {
|
|
|
21
21
|
const oldValue = selectOptionConditionValue(id, index);
|
|
22
22
|
const nextResult = next(action);
|
|
23
23
|
if (value !== oldValue) {
|
|
24
|
-
mpi.dispatch(setDataStatus(
|
|
24
|
+
mpi.dispatch(setDataStatus("unsaved"));
|
|
25
25
|
const Conditions = new ConditionsRunner(mpi.dispatch);
|
|
26
|
-
Conditions.executeHooks(
|
|
26
|
+
Conditions.executeHooks("options", id, index);
|
|
27
27
|
}
|
|
28
28
|
return nextResult;
|
|
29
29
|
};
|
|
@@ -32,9 +32,9 @@ const watchUpdateVariableInput = (mpi, next, action) => {
|
|
|
32
32
|
const oldValue = selectVariableInputByIndex(id, index);
|
|
33
33
|
const nextResult = next(action);
|
|
34
34
|
if (value !== oldValue) {
|
|
35
|
-
mpi.dispatch(setDataStatus(
|
|
35
|
+
mpi.dispatch(setDataStatus("unsaved"));
|
|
36
36
|
const Conditions = new ConditionsRunner(mpi.dispatch);
|
|
37
|
-
Conditions.executeHooks(
|
|
37
|
+
Conditions.executeHooks("variables", id, index);
|
|
38
38
|
}
|
|
39
39
|
return nextResult;
|
|
40
40
|
};
|
|
@@ -43,29 +43,29 @@ const watchUpdateVariableCondition = (mpi, next, action) => {
|
|
|
43
43
|
const oldValue = selectVariableConditionValue(id, index);
|
|
44
44
|
const nextResult = next(action);
|
|
45
45
|
if (value !== oldValue) {
|
|
46
|
-
mpi.dispatch(setDataStatus(
|
|
46
|
+
mpi.dispatch(setDataStatus("unsaved"));
|
|
47
47
|
const Conditions = new ConditionsRunner(mpi.dispatch);
|
|
48
|
-
Conditions.executeHooks(
|
|
48
|
+
Conditions.executeHooks("variables", id, index);
|
|
49
49
|
}
|
|
50
50
|
return nextResult;
|
|
51
51
|
};
|
|
52
52
|
const watchUpdateSectionCondition = (mpi, next, action) => {
|
|
53
53
|
const Conditions = new ConditionsRunner(mpi.dispatch);
|
|
54
|
-
if (action.document !==
|
|
54
|
+
if (action.document !== "main") {
|
|
55
55
|
return next(action);
|
|
56
56
|
}
|
|
57
57
|
const { id, value } = action;
|
|
58
58
|
const oldValue = selectSectionConditionValue(id);
|
|
59
59
|
const nextResult = next(action);
|
|
60
60
|
if (value !== oldValue) {
|
|
61
|
-
Conditions.executeHooks(
|
|
61
|
+
Conditions.executeHooks("sections", id, 0);
|
|
62
62
|
}
|
|
63
63
|
return nextResult;
|
|
64
64
|
};
|
|
65
65
|
const watchMultipleOccurenciesChange = (mpi, next, action) => {
|
|
66
66
|
const nextResult = next(action);
|
|
67
67
|
const Conditions = new ConditionsRunner(mpi.dispatch);
|
|
68
|
-
mpi.dispatch(setDataStatus(
|
|
68
|
+
mpi.dispatch(setDataStatus("unsaved"));
|
|
69
69
|
const { id } = action;
|
|
70
70
|
const optionRelations = selectOptionRelations(id);
|
|
71
71
|
if (optionRelations === undefined)
|
|
@@ -78,29 +78,29 @@ const watchMultipleOccurenciesChange = (mpi, next, action) => {
|
|
|
78
78
|
const { variables } = optionRelations.children;
|
|
79
79
|
for (let i = 0; i < options.length; i += 1) {
|
|
80
80
|
const condition = selectOptionConditionsObject(options[i]);
|
|
81
|
-
if (typeof condition ===
|
|
81
|
+
if (typeof condition === "object") {
|
|
82
82
|
condition.dataMap.o.forEach((optionId) => {
|
|
83
|
-
selectOptionInput(optionId).forEach((input, index) => Conditions.executeHooks(
|
|
83
|
+
selectOptionInput(optionId).forEach((input, index) => Conditions.executeHooks("options", optionId, index));
|
|
84
84
|
});
|
|
85
|
-
condition.dataMap.v.forEach((variableId) => selectVariableInput(variableId).forEach((input, index) => Conditions.executeHooks(
|
|
85
|
+
condition.dataMap.v.forEach((variableId) => selectVariableInput(variableId).forEach((input, index) => Conditions.executeHooks("variables", variableId, index)));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
for (let i = 0; i < variables.length; i += 1) {
|
|
89
89
|
const condition = selectVariableConditionsObject(variables[i]);
|
|
90
|
-
if (typeof condition ===
|
|
91
|
-
condition.dataMap.o.forEach((optionId) => selectOptionInput(optionId).forEach((input, index) => Conditions.executeHooks(
|
|
92
|
-
condition.dataMap.v.forEach((variableId) => selectVariableInput(variableId).forEach((input, index) => Conditions.executeHooks(
|
|
90
|
+
if (typeof condition === "object") {
|
|
91
|
+
condition.dataMap.o.forEach((optionId) => selectOptionInput(optionId).forEach((input, index) => Conditions.executeHooks("options", optionId, index)));
|
|
92
|
+
condition.dataMap.v.forEach((variableId) => selectVariableInput(variableId).forEach((input, index) => Conditions.executeHooks("variables", variableId, index)));
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
const occurencies = selectOptionInput(id).length;
|
|
96
96
|
for (let i = 0; i < options.length; i += 1) {
|
|
97
97
|
for (let index = 0; index < occurencies; index += 1) {
|
|
98
|
-
Conditions.executeHooks(
|
|
98
|
+
Conditions.executeHooks("options", options[i], index);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
for (let i = 0; i < variables.length; i += 1) {
|
|
102
102
|
for (let index = 0; index < occurencies; index += 1) {
|
|
103
|
-
Conditions.executeHooks(
|
|
103
|
+
Conditions.executeHooks("variables", variables[i], index);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
return nextResult;
|
|
@@ -114,13 +114,13 @@ const watchInitConditions = (mpi, next, action) => {
|
|
|
114
114
|
for (let i = 0; i < options.length; i += 1) {
|
|
115
115
|
const values = mpi.getState().inputs.options[parseInt(options[i], 10)];
|
|
116
116
|
for (let index = 0; index < values.length; index += 1) {
|
|
117
|
-
Conditions.executeHooks(
|
|
117
|
+
Conditions.executeHooks("options", parseInt(options[i], 10), index);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
for (let i = 0; i < variables.length; i += 1) {
|
|
121
121
|
const values = mpi.getState().inputs.variables[parseInt(variables[i], 10)];
|
|
122
122
|
for (let index = 0; index < values.length; index += 1) {
|
|
123
|
-
Conditions.executeHooks(
|
|
123
|
+
Conditions.executeHooks("variables", parseInt(variables[i], 10), index);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
return nextResult;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { MiddlewareAPI, Dispatch } from
|
|
2
|
-
import { ActionsType } from
|
|
1
|
+
import { MiddlewareAPI, Dispatch } from "redux";
|
|
2
|
+
import { ActionsType } from "../../types/Actions.type";
|
|
3
|
+
import { StateType } from "../../types/State.type";
|
|
4
|
+
export declare const watchUpdateVariable: (mpi: MiddlewareAPI<Dispatch, StateType>, next: Dispatch, action: ActionsType.Inputs.updateVariableInput | ActionsType.Conditions.updateVariableCondition) => ActionsType.Inputs.updateVariableInput | ActionsType.Conditions.updateVariableCondition;
|
|
3
5
|
export declare type WatcherActions = ActionsType.Conditions.updateVariableCondition | ActionsType.Conditions.updateOptionCondition | ActionsType.Inputs.updateOptionInput | ActionsType.Inputs.updateVariableInput | ActionsType.App.fetchModelSucceeded;
|
|
4
6
|
declare const evaluationsWatcherMiddleware: (mpi: MiddlewareAPI) => (next: Dispatch) => (action: WatcherActions) => void | WatcherActions;
|
|
5
7
|
export default evaluationsWatcherMiddleware;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { selectVariableReference, selectOptionRelations, } from
|
|
2
|
-
import { updateVariableAction } from
|
|
3
|
-
import { UPDATE_VARIABLE_INPUT, UPDATE_OPTION_INPUT, } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
const watchUpdateVariable = (mpi, next, action) => {
|
|
1
|
+
import { selectVariableReference, selectOptionRelations, } from "../selectors/references";
|
|
2
|
+
import { updateVariableAction } from "../actions/inputs";
|
|
3
|
+
import { UPDATE_VARIABLE_INPUT, UPDATE_OPTION_INPUT, } from "../constants/inputs";
|
|
4
|
+
import { UPDATE_VARIABLE_CONDITION, UPDATE_OPTION_CONDITION, UPDATE_SECTION_CONDITION, } from "../constants/conditions";
|
|
5
|
+
import { FETCH_MODEL_SUCCEEDED } from "../constants/app";
|
|
6
|
+
import { EvalVariable } from "../../libs/EvalVariable";
|
|
7
|
+
export const watchUpdateVariable = (mpi, next, action) => {
|
|
8
8
|
const result = next(action);
|
|
9
9
|
const state = mpi.getState();
|
|
10
10
|
if (Object.prototype.hasOwnProperty.call(state.references.evaluations, action.id)) {
|
|
@@ -83,9 +83,9 @@ const watchFetchModelSuceeded = (mpi, next, action) => {
|
|
|
83
83
|
Object.keys(state.references.variables).forEach((variableId) => {
|
|
84
84
|
var _a, _b;
|
|
85
85
|
const variableReference = state.references.variables[variableId];
|
|
86
|
-
const variableInput = state.inputs.variables[variableId] || [
|
|
87
|
-
if (variableReference.type ===
|
|
88
|
-
typeof ((_a = variableReference.eval) === null || _a === void 0 ? void 0 : _a.formula) ===
|
|
86
|
+
const variableInput = state.inputs.variables[variableId] || [""];
|
|
87
|
+
if (variableReference.type === "eval" &&
|
|
88
|
+
typeof ((_a = variableReference.eval) === null || _a === void 0 ? void 0 : _a.formula) === "string" &&
|
|
89
89
|
((_b = variableReference.eval) === null || _b === void 0 ? void 0 : _b.formula.length) > 0) {
|
|
90
90
|
variableInput.forEach((oldValue, index) => {
|
|
91
91
|
const varEval = new EvalVariable(variableReference, index);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Dispatch, MiddlewareAPI } from
|
|
2
|
-
import { ActionsType } from
|
|
1
|
+
import { Dispatch, MiddlewareAPI } from "redux";
|
|
2
|
+
import { ActionsType } from "../../types/Actions.type";
|
|
3
3
|
export declare type WatcherActions = ActionsType.Inputs.updateOptionInput | ActionsType.Inputs.updateVariableInput | ActionsType.Inputs.addMultipleOccurency | ActionsType.Inputs.deleteMultipleOccurency | ActionsType.Mandatories.setMandatoryOption | ActionsType.Mandatories.setMandatoryVariable;
|
|
4
4
|
declare const mandatoriesWatcherMiddleware: (mpi: MiddlewareAPI) => (next: Dispatch) => (action: WatcherActions) => void | WatcherActions;
|
|
5
5
|
export default mandatoriesWatcherMiddleware;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { UPDATE_OPTION_INPUT, UPDATE_VARIABLE_INPUT, ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, } from
|
|
2
|
-
import { selectVariableInputByIndex, selectOptionInputByIndex, selectOptionInput, } from
|
|
3
|
-
import { SET_MANDATORY_OPTION, SET_MANDATORY_VARIABLE, } from
|
|
4
|
-
import { selectOptionRelations, selectOptionReference, selectSectionReference, selectVariableRelations, selectAllSectionsReferences, selectRadioSiblings, } from
|
|
5
|
-
import { selectMandatoryOption, selectMandatoryVariable, } from
|
|
6
|
-
import { setMandatoryOptionAction, setMandatorySectionAction, setMandatoryVariableAction, } from
|
|
7
|
-
import { UPDATE_OPTION_CONDITION, UPDATE_VARIABLE_CONDITION, UPDATE_SECTION_CONDITION, } from
|
|
8
|
-
import { selectOptionConditionValue, selectVariableConditionValue, selectIsOptionDisplayed, selectIsVariableDisplayed, } from
|
|
9
|
-
import { FETCH_MODEL_SUCCEEDED } from
|
|
1
|
+
import { UPDATE_OPTION_INPUT, UPDATE_VARIABLE_INPUT, ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, } from "../constants/inputs";
|
|
2
|
+
import { selectVariableInputByIndex, selectOptionInputByIndex, selectOptionInput, } from "../selectors/inputs";
|
|
3
|
+
import { SET_MANDATORY_OPTION, SET_MANDATORY_VARIABLE, } from "../constants/mandatories";
|
|
4
|
+
import { selectOptionRelations, selectOptionReference, selectSectionReference, selectVariableRelations, selectAllSectionsReferences, selectRadioSiblings, } from "../selectors/references";
|
|
5
|
+
import { selectMandatoryOption, selectMandatoryVariable, } from "../selectors/mandatories";
|
|
6
|
+
import { setMandatoryOptionAction, setMandatorySectionAction, setMandatoryVariableAction, } from "../actions/mandatories";
|
|
7
|
+
import { UPDATE_OPTION_CONDITION, UPDATE_VARIABLE_CONDITION, UPDATE_SECTION_CONDITION, } from "../constants/conditions";
|
|
8
|
+
import { selectOptionConditionValue, selectVariableConditionValue, selectIsOptionDisplayed, selectIsVariableDisplayed, } from "../selectors/conditions";
|
|
9
|
+
import { FETCH_MODEL_SUCCEEDED } from "../constants/app";
|
|
10
10
|
const validateSectionMandatory = (mpi, sectionId) => {
|
|
11
11
|
const parentSection = selectSectionReference(sectionId);
|
|
12
12
|
let childOptions = [...parentSection.options];
|
|
@@ -18,7 +18,7 @@ const validateSectionMandatory = (mpi, sectionId) => {
|
|
|
18
18
|
childReferenceOption.options.forEach((subChildOptionId) => {
|
|
19
19
|
const optionReference = selectOptionReference(subChildOptionId);
|
|
20
20
|
const { type: optionType } = optionReference.meta;
|
|
21
|
-
if ([
|
|
21
|
+
if (["radio"].includes(optionType)) {
|
|
22
22
|
if (selectOptionInput(subChildOptionId).every((v) => v === true))
|
|
23
23
|
childOptionSelectedId = subChildOptionId;
|
|
24
24
|
}
|
|
@@ -139,7 +139,7 @@ const watchUpdateOptionInputCondition = (mpi, next, action, ignoreNext) => {
|
|
|
139
139
|
next(action);
|
|
140
140
|
const optionReference = selectOptionReference(id);
|
|
141
141
|
const { type: optionType } = optionReference.meta;
|
|
142
|
-
if ([
|
|
142
|
+
if (["radio", "checkbox"].includes(optionType)) {
|
|
143
143
|
const inputValue = type === UPDATE_OPTION_INPUT
|
|
144
144
|
? value
|
|
145
145
|
: selectOptionInputByIndex(id, index) === true;
|
|
@@ -147,12 +147,12 @@ const watchUpdateOptionInputCondition = (mpi, next, action, ignoreNext) => {
|
|
|
147
147
|
? value
|
|
148
148
|
: selectOptionConditionValue(id, index) !== false;
|
|
149
149
|
const mandatoryValue = !conditionValue || (conditionValue && inputValue);
|
|
150
|
-
if (optionType ===
|
|
150
|
+
if (optionType === "radio") {
|
|
151
151
|
const { parents } = selectOptionRelations(id);
|
|
152
152
|
const [parentId] = parents;
|
|
153
153
|
const parentOption = selectOptionReference(parentId);
|
|
154
154
|
const siblingsMandatoryValues = (_a = parentOption === null || parentOption === void 0 ? void 0 : parentOption.options) === null || _a === void 0 ? void 0 : _a.filter((optionId) => optionId !== id &&
|
|
155
|
-
selectOptionReference(optionId).meta.type ===
|
|
155
|
+
selectOptionReference(optionId).meta.type === "radio").map((optionId) => {
|
|
156
156
|
const siblingInputValue = selectOptionInputByIndex(optionId, index) === true;
|
|
157
157
|
const siblingConditionValue = selectOptionConditionValue(id, index) !== false;
|
|
158
158
|
return (!siblingConditionValue ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MiddlewareAPI, Dispatch } from
|
|
2
|
-
import { ActionsType } from
|
|
1
|
+
import { MiddlewareAPI, Dispatch } from "redux";
|
|
2
|
+
import { ActionsType } from "../../types/Actions.type";
|
|
3
3
|
export declare type WatcherActions = ActionsType.Inputs.addMultipleOccurency | ActionsType.Inputs.deleteMultipleOccurency;
|
|
4
4
|
declare const multiplesActionsMiddleware: (mpi: MiddlewareAPI) => (next: Dispatch) => (action: WatcherActions) => void | WatcherActions;
|
|
5
5
|
export default multiplesActionsMiddleware;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, } from
|
|
2
|
-
import { selectOptionRelations, selectOptionReference, selectVariableReference, } from
|
|
1
|
+
import { ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, } from "../constants/inputs";
|
|
2
|
+
import { selectOptionRelations, selectOptionReference, selectVariableReference, } from "../selectors/references";
|
|
3
3
|
const completeAddMultipleOccurency = (mpi, next, action) => {
|
|
4
4
|
const { id } = action;
|
|
5
5
|
const optionRelations = selectOptionRelations(id);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LocationChangeAction } from
|
|
2
|
-
import { MiddlewareAPI, Dispatch } from
|
|
3
|
-
import { ActionsType } from
|
|
1
|
+
import { LocationChangeAction } from "connected-react-router";
|
|
2
|
+
import { MiddlewareAPI, Dispatch } from "redux";
|
|
3
|
+
import { ActionsType } from "../../types/Actions.type";
|
|
4
4
|
export declare type WatcherActions = ActionsType.Conditions.updateSectionCondition | LocationChangeAction;
|
|
5
5
|
declare const paginationWatcherMiddleware: (mpi: MiddlewareAPI) => (next: Dispatch) => (action: WatcherActions) => void | WatcherActions;
|
|
6
6
|
export default paginationWatcherMiddleware;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { LOCATION_CHANGE } from
|
|
2
|
-
import { goPageAction, updateAvailableSectionsAction, initMetaAction, initInstanceAction, } from
|
|
3
|
-
import { UPDATE_SECTION_CONDITION } from
|
|
4
|
-
import { selectAllSectionsReferences, selectUserEmailSectionVariableIds, } from
|
|
5
|
-
import { selectSectionConditionValue } from
|
|
6
|
-
import { isLevelAccessibleForUser, selectUserEmail } from
|
|
7
|
-
import { selectAvailableSections, selectPermalink, selectCurrentPage, isStepAvailable, selectCurrentSectionId, } from
|
|
8
|
-
import { GO_PAGE, GO_NEXT_PAGE, GO_PREVIOUS_PAGE, FETCH_MODEL_SUCCEEDED, } from
|
|
9
|
-
import { getHistory } from
|
|
10
|
-
import { PathReader } from
|
|
11
|
-
import { selectVariableInputByIndex } from
|
|
12
|
-
import { setUserEmail } from
|
|
1
|
+
import { LOCATION_CHANGE } from "connected-react-router";
|
|
2
|
+
import { goPageAction, updateAvailableSectionsAction, initMetaAction, initInstanceAction, } from "../actions/app";
|
|
3
|
+
import { UPDATE_SECTION_CONDITION } from "../constants/conditions";
|
|
4
|
+
import { selectAllSectionsReferences, selectUserEmailSectionVariableIds, } from "../selectors/references";
|
|
5
|
+
import { selectSectionConditionValue } from "../selectors/conditions";
|
|
6
|
+
import { isLevelAccessibleForUser, selectUserEmail } from "../selectors/user";
|
|
7
|
+
import { selectAvailableSections, selectPermalink, selectCurrentPage, isStepAvailable, selectCurrentSectionId, } from "../selectors/app";
|
|
8
|
+
import { GO_PAGE, GO_NEXT_PAGE, GO_PREVIOUS_PAGE, FETCH_MODEL_SUCCEEDED, } from "../constants/app";
|
|
9
|
+
import { getHistory } from "../routerHistory";
|
|
10
|
+
import { PathReader } from "../../libs/PathReader";
|
|
11
|
+
import { selectVariableInputByIndex } from "../selectors/inputs";
|
|
12
|
+
import { setUserEmail } from "../actions/sagas/user";
|
|
13
13
|
const watchFetchModelSucceeded = (mpi, next, action) => {
|
|
14
14
|
const result = next(action);
|
|
15
15
|
const pathReader = new PathReader(mpi.getState());
|
|
@@ -19,25 +19,25 @@ const watchFetchModelSucceeded = (mpi, next, action) => {
|
|
|
19
19
|
const watchLocationChange = (mpi, next, action) => {
|
|
20
20
|
const result = next(action);
|
|
21
21
|
const pathReader = new PathReader(mpi.getState());
|
|
22
|
-
if (selectPermalink() ===
|
|
22
|
+
if (selectPermalink() === "") {
|
|
23
23
|
mpi.dispatch(initMetaAction({
|
|
24
24
|
permalink: pathReader.currentPermalink,
|
|
25
25
|
prefix: pathReader.prefix,
|
|
26
26
|
id: 0,
|
|
27
|
-
title:
|
|
27
|
+
title: "",
|
|
28
28
|
modelVersion: 0,
|
|
29
|
-
productType:
|
|
29
|
+
productType: "",
|
|
30
30
|
}));
|
|
31
31
|
if (pathReader.currentUniqid !== undefined) {
|
|
32
32
|
mpi.dispatch(initInstanceAction({
|
|
33
|
-
dataStatus:
|
|
33
|
+
dataStatus: "saved",
|
|
34
34
|
uniqid: pathReader.currentUniqid,
|
|
35
35
|
steps: [1],
|
|
36
36
|
}));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
mpi.dispatch(goPageAction(pathReader.currentPage, false));
|
|
40
|
-
mpi.dispatch({ type:
|
|
40
|
+
mpi.dispatch({ type: "SET_DEFAULTS" });
|
|
41
41
|
return result;
|
|
42
42
|
};
|
|
43
43
|
const watchSectionConditionUpdate = (mpi, next, action) => {
|
|
@@ -51,14 +51,14 @@ const watchSectionConditionUpdate = (mpi, next, action) => {
|
|
|
51
51
|
const sectionReference = sectionsReferences[sectionId];
|
|
52
52
|
const sectionGrantLevel = sectionReference.grantLevel
|
|
53
53
|
? sectionReference.grantLevel
|
|
54
|
-
:
|
|
54
|
+
: "GUEST";
|
|
55
55
|
const grant = isLevelAccessibleForUser(sectionGrantLevel);
|
|
56
56
|
const availableStep = isStepAvailable(sectionReference.step);
|
|
57
57
|
return condition && grant && availableStep;
|
|
58
58
|
})
|
|
59
59
|
.map((c) => parseInt(c, 10));
|
|
60
|
-
const currentAvailableSectionsReduced = selectAvailableSections().reduce((p, c) => `${p} ${c.toString()}`,
|
|
61
|
-
const nextvailableSectionsReduced = availableSections.reduce((p, c) => `${p} ${c.toString()}`,
|
|
60
|
+
const currentAvailableSectionsReduced = selectAvailableSections().reduce((p, c) => `${p} ${c.toString()}`, "");
|
|
61
|
+
const nextvailableSectionsReduced = availableSections.reduce((p, c) => `${p} ${c.toString()}`, "");
|
|
62
62
|
if (currentAvailableSectionsReduced !== nextvailableSectionsReduced) {
|
|
63
63
|
mpi.dispatch(updateAvailableSectionsAction(availableSections));
|
|
64
64
|
}
|
|
@@ -66,8 +66,8 @@ const watchSectionConditionUpdate = (mpi, next, action) => {
|
|
|
66
66
|
};
|
|
67
67
|
const watchGoPage = (mpi, next, action) => {
|
|
68
68
|
const state = mpi.getState();
|
|
69
|
-
if (state.app.pagination.currentAppState ===
|
|
70
|
-
mpi.dispatch({ type:
|
|
69
|
+
if (state.app.pagination.currentAppState === "wizard") {
|
|
70
|
+
mpi.dispatch({ type: "SET_DEFAULTS" });
|
|
71
71
|
}
|
|
72
72
|
const result = next(action);
|
|
73
73
|
if (action.pushHistory === true) {
|
|
@@ -80,8 +80,8 @@ const watchGoPage = (mpi, next, action) => {
|
|
|
80
80
|
};
|
|
81
81
|
const watchNextPreviousPage = (mpi, next, action) => {
|
|
82
82
|
const state = mpi.getState();
|
|
83
|
-
if (state.app.pagination.currentAppState ===
|
|
84
|
-
mpi.dispatch({ type:
|
|
83
|
+
if (state.app.pagination.currentAppState === "wizard") {
|
|
84
|
+
mpi.dispatch({ type: "SET_DEFAULTS" });
|
|
85
85
|
}
|
|
86
86
|
const sectionUserEmailVariables = selectUserEmailSectionVariableIds(selectCurrentSectionId());
|
|
87
87
|
if (sectionUserEmailVariables.length && !selectUserEmail()) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RunActionAnchor, RunOverrideActionAnchor } from
|
|
1
|
+
import { RunActionAnchor, RunOverrideActionAnchor } from "../../PluginLoader";
|
|
2
2
|
const pluginsHookMiddleware = (mpi) => (next) => (action) => {
|
|
3
3
|
const previousState = mpi.getState();
|
|
4
4
|
const overridenAction = RunOverrideActionAnchor(action);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MiddlewareAPI, Dispatch } from
|
|
2
|
-
import { ActionsType } from
|
|
1
|
+
import { MiddlewareAPI, Dispatch } from "redux";
|
|
2
|
+
import { ActionsType } from "../../types/Actions.type";
|
|
3
3
|
export declare type WatcherActions = ActionsType.Conditions.updatePrefillerCondition;
|
|
4
4
|
declare const prefillerWatcherMiddleware: (mpi: MiddlewareAPI) => (next: Dispatch) => (action: WatcherActions) => void | ActionsType.Conditions.updatePrefillerCondition;
|
|
5
5
|
export default prefillerWatcherMiddleware;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { filterXSS } from
|
|
2
|
-
import ConditionsMapper from
|
|
3
|
-
import { UPDATE_PREFILLER_CONDITION } from
|
|
4
|
-
import { selectVariableInputByIndex, selectVariableInput, selectOptionInput, } from
|
|
5
|
-
import { areVariablesSiblings, selectOptionRelations, selectVariableReference, selectVariableRelations, } from
|
|
6
|
-
import { updateVariableAction } from
|
|
7
|
-
import { ADD_MULTIPLE_OCCURENCY, UPDATE_VARIABLE_INPUT, } from
|
|
8
|
-
import { selectPrefillerConditionValue } from
|
|
9
|
-
import { FETCH_MODEL_SUCCEEDED } from
|
|
1
|
+
import { filterXSS } from "xss";
|
|
2
|
+
import ConditionsMapper from "@legalplace/referencesparser/dist/libs/ConditionsMapper";
|
|
3
|
+
import { UPDATE_PREFILLER_CONDITION } from "../constants/conditions";
|
|
4
|
+
import { selectVariableInputByIndex, selectVariableInput, selectOptionInput, } from "../selectors/inputs";
|
|
5
|
+
import { areVariablesSiblings, selectOptionRelations, selectVariableReference, selectVariableRelations, } from "../selectors/references";
|
|
6
|
+
import { updateVariableAction } from "../actions/inputs";
|
|
7
|
+
import { ADD_MULTIPLE_OCCURENCY, UPDATE_VARIABLE_INPUT, } from "../constants/inputs";
|
|
8
|
+
import { selectPrefillerConditionValue } from "../selectors/conditions";
|
|
9
|
+
import { FETCH_MODEL_SUCCEEDED } from "../constants/app";
|
|
10
10
|
const parsePrefillerValue = (variableId, inputIndex, prefillerIndex) => {
|
|
11
11
|
var _a, _b, _c;
|
|
12
12
|
const prefillerValue = (_c = (_b = (_a = selectVariableReference(variableId)) === null || _a === void 0 ? void 0 : _a.prefillings) === null || _b === void 0 ? void 0 : _b[prefillerIndex]) === null || _c === void 0 ? void 0 : _c.value;
|
|
13
13
|
if (!prefillerValue)
|
|
14
|
-
return
|
|
14
|
+
return "";
|
|
15
15
|
if (/\[var:([0-9]+)\]/gi.test(prefillerValue)) {
|
|
16
16
|
const tagsMatch = prefillerValue.match(/\[var:([0-9]+)\]/gi);
|
|
17
17
|
let variables = [];
|
|
@@ -34,8 +34,8 @@ const parsePrefillerValue = (variableId, inputIndex, prefillerIndex) => {
|
|
|
34
34
|
const value = selectVariableInputByIndex(currentVariableId, index);
|
|
35
35
|
if (value === undefined ||
|
|
36
36
|
value === null ||
|
|
37
|
-
(typeof value ===
|
|
38
|
-
variablesValues[currentVariableId] =
|
|
37
|
+
(typeof value === "string" && value.trim().length === 0)) {
|
|
38
|
+
variablesValues[currentVariableId] = "";
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
41
|
variablesValues[currentVariableId] = value.toString();
|
|
@@ -44,7 +44,7 @@ const parsePrefillerValue = (variableId, inputIndex, prefillerIndex) => {
|
|
|
44
44
|
let parsedPrefillerValue = `${prefillerValue}`;
|
|
45
45
|
variables.forEach((currentVariableId) => {
|
|
46
46
|
const value = variablesValues[currentVariableId];
|
|
47
|
-
parsedPrefillerValue = parsedPrefillerValue.replace(new RegExp(`\\[var:${currentVariableId}\\]`,
|
|
47
|
+
parsedPrefillerValue = parsedPrefillerValue.replace(new RegExp(`\\[var:${currentVariableId}\\]`, "gi"), filterXSS(value));
|
|
48
48
|
});
|
|
49
49
|
return parsedPrefillerValue;
|
|
50
50
|
}
|
|
@@ -61,8 +61,8 @@ const watchUpdatePrefillerCondition = (mpi, next, action) => {
|
|
|
61
61
|
const firstTrueIndex = prefillerConditions.indexOf(true);
|
|
62
62
|
let currentValue = selectVariableInputByIndex(variableId, variableIndex);
|
|
63
63
|
currentValue =
|
|
64
|
-
typeof currentValue ===
|
|
65
|
-
currentValue = typeof currentValue ===
|
|
64
|
+
typeof currentValue === "number" ? currentValue.toString() : currentValue;
|
|
65
|
+
currentValue = typeof currentValue === "string" ? currentValue : "";
|
|
66
66
|
const firstUnconditionnedIndex = variableReference.prefillings
|
|
67
67
|
? variableReference.prefillings
|
|
68
68
|
.map((c) => c.conditions === undefined ||
|
|
@@ -71,19 +71,19 @@ const watchUpdatePrefillerCondition = (mpi, next, action) => {
|
|
|
71
71
|
: -1;
|
|
72
72
|
let prefillersValues = variableReference.prefillings
|
|
73
73
|
? variableReference.prefillings
|
|
74
|
-
: new Array(prefillerConditions.length).fill(
|
|
74
|
+
: new Array(prefillerConditions.length).fill("");
|
|
75
75
|
prefillersValues = prefillersValues.map((prefiller) => prefiller.value);
|
|
76
76
|
prefillersValues = prefillersValues.map((prefillerValue, prefillerIndex) => {
|
|
77
77
|
if (/\[var:([0-9]+)\]/gi.test(prefillerValue))
|
|
78
78
|
return parsePrefillerValue(variableId, variableIndex, prefillerIndex);
|
|
79
|
-
return prefillerValue.replace(/^\s+|\s+$/g,
|
|
79
|
+
return prefillerValue.replace(/^\s+|\s+$/g, "");
|
|
80
80
|
});
|
|
81
81
|
const newPrefillerValue = firstTrueIndex > -1
|
|
82
82
|
? prefillersValues[firstTrueIndex]
|
|
83
83
|
: firstUnconditionnedIndex > -1
|
|
84
84
|
? prefillersValues[firstUnconditionnedIndex]
|
|
85
|
-
:
|
|
86
|
-
if (currentValue ===
|
|
85
|
+
: "";
|
|
86
|
+
if (currentValue === "" ||
|
|
87
87
|
(prefillersValues.includes(currentValue) &&
|
|
88
88
|
currentValue !== newPrefillerValue)) {
|
|
89
89
|
mpi.dispatch(updateVariableAction(variableId, newPrefillerValue, variableIndex));
|
|
@@ -108,10 +108,10 @@ const watchAddMultipleOccurency = (mpi, next, action) => {
|
|
|
108
108
|
const firstTrueIndex = prefillerConditions.indexOf(true);
|
|
109
109
|
let currentValue = selectVariableInputByIndex(variableId, variableIndex);
|
|
110
110
|
currentValue =
|
|
111
|
-
typeof currentValue ===
|
|
111
|
+
typeof currentValue === "number"
|
|
112
112
|
? currentValue.toString()
|
|
113
113
|
: currentValue;
|
|
114
|
-
currentValue = typeof currentValue ===
|
|
114
|
+
currentValue = typeof currentValue === "string" ? currentValue : "";
|
|
115
115
|
currentValue = currentValue.trim();
|
|
116
116
|
const firstUndefinedCondition = variableReference.prefillings
|
|
117
117
|
? variableReference.prefillings
|
|
@@ -120,7 +120,7 @@ const watchAddMultipleOccurency = (mpi, next, action) => {
|
|
|
120
120
|
: -1;
|
|
121
121
|
let prefillersValues = variableReference.prefillings
|
|
122
122
|
? variableReference.prefillings
|
|
123
|
-
: new Array(prefillerConditions.length).fill(
|
|
123
|
+
: new Array(prefillerConditions.length).fill("");
|
|
124
124
|
prefillersValues = prefillersValues.map((prefiller) => prefiller.value);
|
|
125
125
|
prefillersValues = prefillersValues.map((prefillerValue) => {
|
|
126
126
|
if (/\[var:([0-9]+)\]/gi.test(prefillerValue)) {
|
|
@@ -145,8 +145,8 @@ const watchAddMultipleOccurency = (mpi, next, action) => {
|
|
|
145
145
|
const value = selectVariableInputByIndex(currentVariableId, index);
|
|
146
146
|
if (value === undefined ||
|
|
147
147
|
value === null ||
|
|
148
|
-
(typeof value ===
|
|
149
|
-
variablesValues[currentVariableId] =
|
|
148
|
+
(typeof value === "string" && value.trim().length === 0)) {
|
|
149
|
+
variablesValues[currentVariableId] = "";
|
|
150
150
|
}
|
|
151
151
|
else {
|
|
152
152
|
variablesValues[currentVariableId] = value.toString();
|
|
@@ -155,18 +155,18 @@ const watchAddMultipleOccurency = (mpi, next, action) => {
|
|
|
155
155
|
let parsedPrefillerValue = `${prefillerValue}`;
|
|
156
156
|
variables.forEach((currentVariableId) => {
|
|
157
157
|
const value = variablesValues[currentVariableId];
|
|
158
|
-
parsedPrefillerValue = parsedPrefillerValue.replace(new RegExp(`\\[var:${currentVariableId}\\]`,
|
|
158
|
+
parsedPrefillerValue = parsedPrefillerValue.replace(new RegExp(`\\[var:${currentVariableId}\\]`, "gi"), filterXSS(value));
|
|
159
159
|
});
|
|
160
160
|
return parsedPrefillerValue;
|
|
161
161
|
}
|
|
162
|
-
return prefillerValue.replace(/^\s+|\s+$/g,
|
|
162
|
+
return prefillerValue.replace(/^\s+|\s+$/g, "");
|
|
163
163
|
});
|
|
164
164
|
const newPrefillerValue = firstTrueIndex > -1
|
|
165
165
|
? prefillersValues[firstTrueIndex]
|
|
166
166
|
: firstUndefinedCondition > -1
|
|
167
167
|
? prefillersValues[firstUndefinedCondition]
|
|
168
|
-
:
|
|
169
|
-
if (currentValue ===
|
|
168
|
+
: "";
|
|
169
|
+
if (currentValue === "" ||
|
|
170
170
|
(prefillersValues.includes(currentValue) &&
|
|
171
171
|
currentValue !== newPrefillerValue)) {
|
|
172
172
|
mpi.dispatch(updateVariableAction(variableId, newPrefillerValue, variableIndex));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MiddlewareAPI, Dispatch } from
|
|
2
|
-
import { ActionsType } from
|
|
1
|
+
import { MiddlewareAPI, Dispatch } from "redux";
|
|
2
|
+
import { ActionsType } from "../../types/Actions.type";
|
|
3
3
|
export declare type WatcherActions = ActionsType.SmartScript.enableSmartScript | ActionsType.Inputs.updateOptionInput | ActionsType.Inputs.updateVariableInput;
|
|
4
4
|
declare const smartscriptMiddleware: (mpi: MiddlewareAPI) => (next: Dispatch) => (action: WatcherActions) => void | WatcherActions;
|
|
5
5
|
export default smartscriptMiddleware;
|