@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,8 +1,8 @@
|
|
|
1
|
-
import { call, put, takeLatest, select, fork, join } from
|
|
2
|
-
import Cookies from
|
|
3
|
-
import type { CustomizationMetaDefault } from
|
|
4
|
-
import type { HealthCheckReport } from
|
|
5
|
-
import {
|
|
1
|
+
import { call, put, takeLatest, select, fork, join } from "redux-saga/effects";
|
|
2
|
+
import Cookies from "universal-cookie";
|
|
3
|
+
import type { CustomizationMetaDefault } from "@legalplace/models-v3-types";
|
|
4
|
+
import type { HealthCheckReport } from "@legalplace/model-healthcheck/dist/libs/HealthCheck.type";
|
|
5
|
+
import { initInputsAction } from "../actions/inputs";
|
|
6
6
|
import {
|
|
7
7
|
initMetaAction,
|
|
8
8
|
initPaginationAction,
|
|
@@ -17,60 +17,44 @@ import {
|
|
|
17
17
|
goPageAction,
|
|
18
18
|
fetchModelNonBlockingAction,
|
|
19
19
|
setModelUuidAction,
|
|
20
|
-
} from
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} from
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import
|
|
34
|
-
import { PathReader } from '../../libs/PathReader';
|
|
35
|
-
import { IntputsInitiator } from '../../libs/InputsInitiator';
|
|
36
|
-
import { initUserAction, setUserStatusAction } from '../actions/user';
|
|
37
|
-
import { OvcConverter, OvcType } from '../../libs/OvcConverter';
|
|
38
|
-
import { StateType } from '../../types/State.type';
|
|
39
|
-
import Globals from '../../Globals';
|
|
20
|
+
} from "../actions/app";
|
|
21
|
+
import { initReferencesAction } from "../actions/references";
|
|
22
|
+
import { selectSectionConditionValue } from "../selectors/conditions";
|
|
23
|
+
import { selectAllSectionsReferences } from "../selectors/references";
|
|
24
|
+
import { ActionsType } from "../../types/Actions.type";
|
|
25
|
+
import { selectInstanceUniqid, isStepAvailable } from "../selectors/app";
|
|
26
|
+
import { getConfig, updateConfig } from "../../config";
|
|
27
|
+
import { isLevelAccessibleForUser } from "../selectors/user";
|
|
28
|
+
import { PathReader } from "../../libs/PathReader";
|
|
29
|
+
import { IntputsInitiator } from "../../libs/InputsInitiator";
|
|
30
|
+
import { initUserAction, setUserStatusAction } from "../actions/user";
|
|
31
|
+
import { OvcConverter, OvcType } from "../../libs/OvcConverter";
|
|
32
|
+
import { StateType } from "../../types/State.type";
|
|
33
|
+
import Globals from "../../Globals";
|
|
40
34
|
import {
|
|
41
35
|
getFetchModelArguments,
|
|
42
36
|
getCreateInstanceArguments,
|
|
43
37
|
getClientConfigArguments,
|
|
44
38
|
getWizardConfigArguments,
|
|
45
39
|
getModelInformationArguments,
|
|
46
|
-
} from
|
|
47
|
-
import { loadTheme, setWizardTheme } from
|
|
48
|
-
import { loadPlugins } from
|
|
49
|
-
import {
|
|
50
|
-
selectMandatoryOptionItem,
|
|
51
|
-
selectMandatoryOption,
|
|
52
|
-
} from '../selectors/mandatories';
|
|
53
|
-
import {
|
|
54
|
-
initMandatoryOptionAction,
|
|
55
|
-
initMandatoryVariableAction,
|
|
56
|
-
} from '../actions/mandatories';
|
|
57
|
-
import { enableSmartscriptAction } from '../actions/smartscript';
|
|
40
|
+
} from "../../service/api.manager";
|
|
41
|
+
import { loadTheme, setWizardTheme } from "../../ThemeLoader";
|
|
42
|
+
import { loadPlugins } from "../../PluginLoader";
|
|
43
|
+
import { enableSmartscriptAction } from "../actions/smartscript";
|
|
58
44
|
import {
|
|
59
45
|
FETCH_MODEL,
|
|
60
46
|
FETCH_MODEL_PREREQUISITES,
|
|
61
|
-
} from
|
|
62
|
-
import { fetchModelAction } from
|
|
47
|
+
} from "../constants/sagas/model";
|
|
48
|
+
import { fetchModelAction } from "../actions/sagas/model";
|
|
63
49
|
import {
|
|
64
50
|
ClientConfigResponse,
|
|
65
51
|
WizardConfigResponse,
|
|
66
52
|
CreateInstanceResponse,
|
|
67
|
-
} from
|
|
53
|
+
} from "../../types/api.type";
|
|
54
|
+
import { initInputsDecorator } from "./initInputs";
|
|
68
55
|
|
|
69
56
|
const cookies = new Cookies();
|
|
70
57
|
|
|
71
|
-
const getValues = (arr1: boolean[], arr2: boolean[]) =>
|
|
72
|
-
arr1.map((v, index) => arr2[index] || v);
|
|
73
|
-
|
|
74
58
|
function* setFetchModelToNonBlocking(firstCurrentAppState?: string) {
|
|
75
59
|
yield put(
|
|
76
60
|
initPaginationAction({
|
|
@@ -78,8 +62,8 @@ function* setFetchModelToNonBlocking(firstCurrentAppState?: string) {
|
|
|
78
62
|
greatestPage: 1,
|
|
79
63
|
currentSectionId: 0,
|
|
80
64
|
availableSections: [],
|
|
81
|
-
currentAppState: firstCurrentAppState ||
|
|
82
|
-
availableAppStates: [
|
|
65
|
+
currentAppState: firstCurrentAppState || "wizard",
|
|
66
|
+
availableAppStates: ["wizard"],
|
|
83
67
|
})
|
|
84
68
|
);
|
|
85
69
|
|
|
@@ -104,7 +88,7 @@ function* getClientConfig(permalink: string, uniqid: string) {
|
|
|
104
88
|
|
|
105
89
|
clientConfigResponse = yield call(
|
|
106
90
|
// @ts-ignore because of saga implementation of call function
|
|
107
|
-
[clientConfigResponse,
|
|
91
|
+
[clientConfigResponse, "json"]
|
|
108
92
|
);
|
|
109
93
|
|
|
110
94
|
if (clientConfigResponse.clientConfig.metadata?.apiEndpoint) {
|
|
@@ -133,7 +117,7 @@ function* getClientConfig(permalink: string, uniqid: string) {
|
|
|
133
117
|
// Loading compactTheme if we receive url param compactTheme
|
|
134
118
|
if (/compactTheme/.test(window.location.href)) {
|
|
135
119
|
// @ts-ignore: because of saga implementation of call function
|
|
136
|
-
yield call(setWizardTheme, { name:
|
|
120
|
+
yield call(setWizardTheme, { name: "compact" });
|
|
137
121
|
} else if (clientConfigResponse.clientConfig.metadata?.theme?.name) {
|
|
138
122
|
yield call(
|
|
139
123
|
setWizardTheme,
|
|
@@ -174,7 +158,6 @@ function* getWizardConfig(
|
|
|
174
158
|
queryParams: URLSearchParams
|
|
175
159
|
) {
|
|
176
160
|
let response: WizardConfigResponse = yield call(
|
|
177
|
-
// @ts-ignore because of saga implementation of call function
|
|
178
161
|
fetch,
|
|
179
162
|
...getWizardConfigArguments(permalink, uniqidParam, prefix, queryParams)
|
|
180
163
|
);
|
|
@@ -185,14 +168,14 @@ function* getWizardConfig(
|
|
|
185
168
|
}
|
|
186
169
|
response = yield call(
|
|
187
170
|
// @ts-ignore because of saga implementation of call function
|
|
188
|
-
[response,
|
|
171
|
+
[response, "json"]
|
|
189
172
|
);
|
|
190
173
|
if (response.redirect) {
|
|
191
174
|
window.onbeforeunload = null; // force redirection
|
|
192
175
|
window.location.href = `${response.redirect}${
|
|
193
176
|
response.redirectParams
|
|
194
177
|
? `?redirectUrl=${encodeURIComponent(window.location.href)}`
|
|
195
|
-
:
|
|
178
|
+
: ""
|
|
196
179
|
}`;
|
|
197
180
|
}
|
|
198
181
|
yield put(setModelUuidAction(response.modelUuid));
|
|
@@ -239,10 +222,10 @@ function* fetchModelInformation(
|
|
|
239
222
|
}
|
|
240
223
|
response = yield call(
|
|
241
224
|
// @ts-ignore because of saga implementation of call function
|
|
242
|
-
[response,
|
|
225
|
+
[response, "json"]
|
|
243
226
|
);
|
|
244
|
-
if (response.status ===
|
|
245
|
-
if (Globals.
|
|
227
|
+
if (response.status === "unhealthy") {
|
|
228
|
+
if (Globals.appEnv === "production") {
|
|
246
229
|
yield put(fetchModelFailedAction());
|
|
247
230
|
} else yield put(fetchModelUnhealthyAction(response.report));
|
|
248
231
|
return undefined;
|
|
@@ -257,7 +240,7 @@ function* fetchModelInformation(
|
|
|
257
240
|
yield put(initMetaAction(meta));
|
|
258
241
|
|
|
259
242
|
// Setting document title
|
|
260
|
-
document.title = `${meta.title} - ${getConfig().brand?.name ||
|
|
243
|
+
document.title = `${meta.title} - ${getConfig().brand?.name || "LegalPlace"}`;
|
|
261
244
|
|
|
262
245
|
const { references, customization, smartScript } = response;
|
|
263
246
|
/**
|
|
@@ -277,8 +260,8 @@ function* fetchModelInformation(
|
|
|
277
260
|
|
|
278
261
|
// Meta customizations
|
|
279
262
|
if (
|
|
280
|
-
typeof customization ===
|
|
281
|
-
typeof customization.meta ===
|
|
263
|
+
typeof customization === "object" &&
|
|
264
|
+
typeof customization.meta === "object"
|
|
282
265
|
)
|
|
283
266
|
yield put(initCustomizationMetaAction(customization.meta));
|
|
284
267
|
|
|
@@ -303,34 +286,34 @@ function* fetchInstanceInformation(
|
|
|
303
286
|
if (response === undefined) {
|
|
304
287
|
throw new Error(
|
|
305
288
|
`Unable to fetch ${permalink}${
|
|
306
|
-
uniqid && uniqid.trim().length > 0 ? `/${uniqid}` :
|
|
289
|
+
uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : ""
|
|
307
290
|
}, we did not recieve any response`
|
|
308
291
|
);
|
|
309
292
|
}
|
|
310
293
|
// @ts-ignore because of saga implementation of call function
|
|
311
|
-
response = yield call([response,
|
|
294
|
+
response = yield call([response, "json"]);
|
|
312
295
|
if (response.redirect) {
|
|
313
296
|
window.onbeforeunload = null; // force redirection
|
|
314
297
|
window.location.href = `${response.redirect}${
|
|
315
298
|
response.redirectParams
|
|
316
299
|
? `?redirectUrl=${encodeURIComponent(window.location.href)}`
|
|
317
|
-
:
|
|
300
|
+
: ""
|
|
318
301
|
}`;
|
|
319
302
|
}
|
|
320
|
-
if (response.errors || response.status ===
|
|
303
|
+
if (response.errors || response.status === "error") {
|
|
321
304
|
throw new Error(
|
|
322
305
|
`Unable to fetch ${permalink}${
|
|
323
|
-
uniqid && uniqid.trim().length > 0 ? `/${uniqid}` :
|
|
306
|
+
uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : ""
|
|
324
307
|
}`
|
|
325
308
|
);
|
|
326
309
|
}
|
|
327
310
|
|
|
328
311
|
// reload to legacy wizard if instance is of legacy type
|
|
329
|
-
if (response.instance && response.instance.appType ===
|
|
330
|
-
const abCookie = cookies.get(
|
|
331
|
-
if (abCookie && abCookie.split(
|
|
332
|
-
cookies.set(
|
|
333
|
-
path:
|
|
312
|
+
if (response.instance && response.instance.appType === "react") {
|
|
313
|
+
const abCookie = cookies.get("X-Source");
|
|
314
|
+
if (abCookie && abCookie.split("/").length > 1) {
|
|
315
|
+
cookies.set("X-Source", `${abCookie.split("/")[0]}/wizard`, {
|
|
316
|
+
path: "/",
|
|
334
317
|
encode: (value: string) => value,
|
|
335
318
|
});
|
|
336
319
|
window.onbeforeunload = () => {};
|
|
@@ -340,19 +323,19 @@ function* fetchInstanceInformation(
|
|
|
340
323
|
|
|
341
324
|
// Instance
|
|
342
325
|
const instance: StateType.App.Instance = {
|
|
343
|
-
dataStatus:
|
|
344
|
-
uniqid: uniqid ||
|
|
326
|
+
dataStatus: "saved",
|
|
327
|
+
uniqid: uniqid || "",
|
|
345
328
|
draft: response.instance && response.instance.draft,
|
|
346
329
|
companyId: response.instance?.companyId,
|
|
347
330
|
employeeId: response.instance?.employeeId,
|
|
348
331
|
isOrderHandled: response.instance && response.instance.isOrderHandled,
|
|
349
332
|
isPaid:
|
|
350
333
|
response.instance &&
|
|
351
|
-
(response.instance.isPaid.toString() ===
|
|
334
|
+
(response.instance.isPaid.toString() === "1" ||
|
|
352
335
|
response.instance.isPaid === true),
|
|
353
336
|
steps:
|
|
354
337
|
response.instance &&
|
|
355
|
-
(typeof response.instance.steps ===
|
|
338
|
+
(typeof response.instance.steps === "string" ||
|
|
356
339
|
Array.isArray(response.instance.steps))
|
|
357
340
|
? response.instance.steps
|
|
358
341
|
: [1],
|
|
@@ -365,7 +348,7 @@ function* fetchInstanceInformation(
|
|
|
365
348
|
// modelisator, this is a quick solution
|
|
366
349
|
// for the problem that is not quite secure
|
|
367
350
|
// review it
|
|
368
|
-
if (pathReader.modelVersion) instance.steps =
|
|
351
|
+
if (pathReader.modelVersion) instance.steps = "*";
|
|
369
352
|
|
|
370
353
|
yield put(initInstanceAction(instance));
|
|
371
354
|
|
|
@@ -377,10 +360,10 @@ function* fetchInstanceInformation(
|
|
|
377
360
|
* Initiating user
|
|
378
361
|
*/
|
|
379
362
|
if (
|
|
380
|
-
typeof response.user ===
|
|
381
|
-
typeof response.user.email ===
|
|
382
|
-
typeof response.user.displayName ===
|
|
383
|
-
typeof response.user.level ===
|
|
363
|
+
typeof response.user === "object" &&
|
|
364
|
+
typeof response.user.email === "string" &&
|
|
365
|
+
typeof response.user.displayName === "string" &&
|
|
366
|
+
typeof response.user.level === "string"
|
|
384
367
|
) {
|
|
385
368
|
yield put(
|
|
386
369
|
initUserAction({
|
|
@@ -389,15 +372,15 @@ function* fetchInstanceInformation(
|
|
|
389
372
|
level: response.user.level,
|
|
390
373
|
})
|
|
391
374
|
);
|
|
392
|
-
yield put(setUserStatusAction(
|
|
393
|
-
if (availableAppStates.includes(
|
|
394
|
-
availableAppStates.splice(availableAppStates.indexOf(
|
|
375
|
+
yield put(setUserStatusAction("authenticated"));
|
|
376
|
+
if (availableAppStates.includes("email"))
|
|
377
|
+
availableAppStates.splice(availableAppStates.indexOf("email"), 1);
|
|
395
378
|
}
|
|
396
379
|
|
|
397
380
|
/**
|
|
398
381
|
* If instance is locked for the user
|
|
399
382
|
*/
|
|
400
|
-
if (instance.draft === false && !isLevelAccessibleForUser(
|
|
383
|
+
if (instance.draft === false && !isLevelAccessibleForUser("USER")) {
|
|
401
384
|
yield put(fetchModelUserLockedAction());
|
|
402
385
|
}
|
|
403
386
|
|
|
@@ -418,14 +401,14 @@ function* createInstance(
|
|
|
418
401
|
* Unit/Organization params define if we allow shadow instance, we fallback to configuration if not defined
|
|
419
402
|
*/
|
|
420
403
|
const isShadowInstanceEnabled =
|
|
421
|
-
typeof enableShadowInstance !==
|
|
404
|
+
typeof enableShadowInstance !== "undefined"
|
|
422
405
|
? enableShadowInstance
|
|
423
406
|
: getConfig().enableShadowInstance;
|
|
424
407
|
|
|
425
408
|
// Instance
|
|
426
409
|
const instance: StateType.App.Instance = {
|
|
427
|
-
dataStatus:
|
|
428
|
-
uniqid: uniqid ||
|
|
410
|
+
dataStatus: "saved",
|
|
411
|
+
uniqid: uniqid || "",
|
|
429
412
|
draft: false,
|
|
430
413
|
companyId: undefined,
|
|
431
414
|
employeeId: undefined,
|
|
@@ -441,20 +424,20 @@ function* createInstance(
|
|
|
441
424
|
// modelisator, this is a quick solution
|
|
442
425
|
// for the problem that is not quite secure
|
|
443
426
|
// review it
|
|
444
|
-
if (pathReader.modelVersion) instance.steps =
|
|
427
|
+
if (pathReader.modelVersion) instance.steps = "*";
|
|
445
428
|
|
|
446
429
|
// Creating instance
|
|
447
430
|
if (
|
|
448
431
|
isShadowInstanceEnabled === true &&
|
|
449
432
|
(instance.uniqid === undefined ||
|
|
450
|
-
(typeof instance.uniqid ===
|
|
433
|
+
(typeof instance.uniqid === "string" && instance.uniqid.trim() === ""))
|
|
451
434
|
) {
|
|
452
435
|
const searchParams = `${
|
|
453
|
-
urlParams && urlParams.get(
|
|
436
|
+
urlParams && urlParams.get("contractName") && urlParams.get("userId")
|
|
454
437
|
? `?contractName=${urlParams.get(
|
|
455
|
-
|
|
456
|
-
)}&userId=${urlParams.get(
|
|
457
|
-
:
|
|
438
|
+
"contractName"
|
|
439
|
+
)}&userId=${urlParams.get("userId")}`
|
|
440
|
+
: ""
|
|
458
441
|
}`;
|
|
459
442
|
const res: CreateInstanceResponse = yield call(
|
|
460
443
|
// @ts-ignore because of saga implementation of call function
|
|
@@ -463,11 +446,11 @@ function* createInstance(
|
|
|
463
446
|
);
|
|
464
447
|
const instanceResponse: CreateInstanceResponse = yield call(
|
|
465
448
|
// @ts-ignore because of saga implementation of call function
|
|
466
|
-
[res,
|
|
449
|
+
[res, "json"]
|
|
467
450
|
);
|
|
468
451
|
|
|
469
|
-
if (instanceResponse.status !==
|
|
470
|
-
throw new Error(
|
|
452
|
+
if (instanceResponse.status !== "SUCCESS") {
|
|
453
|
+
throw new Error("Unable to create instance");
|
|
471
454
|
}
|
|
472
455
|
|
|
473
456
|
// Setting uniqid
|
|
@@ -481,7 +464,7 @@ function* createInstance(
|
|
|
481
464
|
|
|
482
465
|
// Setting steps
|
|
483
466
|
instance.steps =
|
|
484
|
-
typeof instanceResponse.steps ===
|
|
467
|
+
typeof instanceResponse.steps === "string" ||
|
|
485
468
|
Array.isArray(instanceResponse.steps)
|
|
486
469
|
? instanceResponse.steps
|
|
487
470
|
: [1];
|
|
@@ -499,10 +482,10 @@ function* fetchModelPrerequisites(
|
|
|
499
482
|
const { permalink, prefix } = action;
|
|
500
483
|
|
|
501
484
|
// TODO Fix Smartscript iFrame re-render (see issue #4130)
|
|
502
|
-
if (!permalink && window.location.href.includes(
|
|
485
|
+
if (!permalink && window.location.href.includes("smartscript")) return;
|
|
503
486
|
|
|
504
487
|
const uniqid = selectInstanceUniqid() || getConfig().uniqid;
|
|
505
|
-
const uniqidParam = uniqid && uniqid.trim().length > 0 ? `/${uniqid}` :
|
|
488
|
+
const uniqidParam = uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : "";
|
|
506
489
|
const urlParams = new URLSearchParams(window.location.search);
|
|
507
490
|
|
|
508
491
|
// Getting State
|
|
@@ -512,17 +495,15 @@ function* fetchModelPrerequisites(
|
|
|
512
495
|
const pathReader = new PathReader(state);
|
|
513
496
|
const queryParams = new URLSearchParams(window.location.search);
|
|
514
497
|
if (pathReader.modelVersion)
|
|
515
|
-
queryParams.set(
|
|
498
|
+
queryParams.set("version", pathReader.modelVersion);
|
|
516
499
|
|
|
517
|
-
const
|
|
518
|
-
// @ts-ignore because of saga implementation of fork function
|
|
500
|
+
const clientConfigReturnValue = yield call(
|
|
519
501
|
getClientConfig,
|
|
520
502
|
permalink,
|
|
521
|
-
uniqid
|
|
503
|
+
uniqid || ""
|
|
522
504
|
);
|
|
523
505
|
|
|
524
|
-
const
|
|
525
|
-
// @ts-ignore because of saga implementation of fork function
|
|
506
|
+
const wizardConfig = yield call(
|
|
526
507
|
getWizardConfig,
|
|
527
508
|
permalink,
|
|
528
509
|
uniqidParam,
|
|
@@ -530,11 +511,6 @@ function* fetchModelPrerequisites(
|
|
|
530
511
|
queryParams
|
|
531
512
|
);
|
|
532
513
|
|
|
533
|
-
const [clientConfigReturnValue, wizardConfig] = yield join([
|
|
534
|
-
clientConfigTask,
|
|
535
|
-
wizardConfigTask,
|
|
536
|
-
]);
|
|
537
|
-
|
|
538
514
|
yield put(
|
|
539
515
|
fetchModelAction(
|
|
540
516
|
permalink,
|
|
@@ -627,7 +603,7 @@ function* fetchModelDecorator(action: ActionsType.Sagas.Model.fetchModel): any {
|
|
|
627
603
|
|
|
628
604
|
// Setting OVC to null if it's an empty object
|
|
629
605
|
if (
|
|
630
|
-
typeof ovc ===
|
|
606
|
+
typeof ovc === "object" &&
|
|
631
607
|
ovc !== null &&
|
|
632
608
|
Object.keys(ovc).length === 0
|
|
633
609
|
)
|
|
@@ -639,91 +615,14 @@ function* fetchModelDecorator(action: ActionsType.Sagas.Model.fetchModel): any {
|
|
|
639
615
|
// Data
|
|
640
616
|
const inputs = new IntputsInitiator(references, ovc).getInputs();
|
|
641
617
|
|
|
642
|
-
|
|
643
|
-
const conditions = new ConditionsInitiator(
|
|
644
|
-
references,
|
|
645
|
-
inputs
|
|
646
|
-
).getConditions();
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* Initiating conditions first before initiating inputs
|
|
650
|
-
*/
|
|
651
|
-
yield put(initConditionsAction(conditions));
|
|
652
|
-
|
|
653
|
-
/**
|
|
654
|
-
* Initiating inputs
|
|
655
|
-
*/
|
|
656
|
-
|
|
657
|
-
// Options
|
|
658
|
-
const optionsIds = Object.keys(inputs.options);
|
|
659
|
-
for (let i = 0; i < optionsIds.length; i += 1) {
|
|
660
|
-
let optionId = parseInt(optionsIds[i], 10);
|
|
661
|
-
let values = inputs.options[optionId];
|
|
662
|
-
yield put(initOptionAction(optionId, values));
|
|
663
|
-
// If option is mandatory we initiate it
|
|
664
|
-
const { meta: meta2 } = references.options[optionId];
|
|
665
|
-
const { type } = meta2;
|
|
666
|
-
let { mandatory } = meta2;
|
|
667
|
-
let sendOptionAction = true;
|
|
668
|
-
if (['checkbox', 'radio'].includes(type)) {
|
|
669
|
-
if (type === 'radio') {
|
|
670
|
-
const { parents } = selectOptionRelations(optionId);
|
|
671
|
-
// Get parentId
|
|
672
|
-
const parentId = parents[0];
|
|
673
|
-
// check if optin exist on mandatory
|
|
674
|
-
const isMandatoryOption = selectMandatoryOptionItem(parentId);
|
|
675
|
-
// If parentId value = true don't send an action
|
|
676
|
-
if (typeof isMandatoryOption !== 'undefined') {
|
|
677
|
-
const mandatoryOption = selectMandatoryOption(parentId);
|
|
678
|
-
sendOptionAction = !mandatoryOption.every((v) => v === true);
|
|
679
|
-
// handle multiple
|
|
680
|
-
if (sendOptionAction === true && mandatoryOption) {
|
|
681
|
-
if (values.length >= mandatoryOption.length) {
|
|
682
|
-
values = getValues(values, [...mandatoryOption]);
|
|
683
|
-
} else {
|
|
684
|
-
values = getValues([...mandatoryOption], values);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
mandatory = references.options[parentId].meta.mandatory;
|
|
690
|
-
optionId = parentId;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
if (mandatory === true && sendOptionAction === true) {
|
|
694
|
-
yield put(initMandatoryOptionAction(optionId, values));
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
// Variables
|
|
700
|
-
const variablesIds = Object.keys(inputs.variables);
|
|
701
|
-
for (let i = 0; i < variablesIds.length; i += 1) {
|
|
702
|
-
const variableId = variablesIds[i];
|
|
703
|
-
const values = inputs.variables[variableId];
|
|
704
|
-
yield put(initVariableAction(parseInt(variableId, 10), values));
|
|
705
|
-
|
|
706
|
-
// If variable is mandatory we initiate it
|
|
707
|
-
if (references.variables[variableId].mandatory === true)
|
|
708
|
-
yield put(
|
|
709
|
-
initMandatoryVariableAction(
|
|
710
|
-
parseInt(variableId, 10),
|
|
711
|
-
values.map((value) => `${value}`.trim().length > 0)
|
|
712
|
-
)
|
|
713
|
-
);
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
/**
|
|
717
|
-
* Initiating conditions a second time after initiating inputs
|
|
718
|
-
*/
|
|
719
|
-
yield put(initConditionsAction(conditions));
|
|
618
|
+
yield call(initInputsDecorator, initInputsAction(inputs, references));
|
|
720
619
|
|
|
721
620
|
/**
|
|
722
621
|
* Initiating pagination
|
|
723
622
|
*/
|
|
724
623
|
const sectionsReferences = selectAllSectionsReferences();
|
|
725
624
|
if (sectionsReferences === undefined)
|
|
726
|
-
throw new Error(
|
|
625
|
+
throw new Error("Sections references not found");
|
|
727
626
|
const availableSections = Object.keys(sectionsReferences)
|
|
728
627
|
.filter((sectionId) => {
|
|
729
628
|
const condition =
|
|
@@ -731,7 +630,7 @@ function* fetchModelDecorator(action: ActionsType.Sagas.Model.fetchModel): any {
|
|
|
731
630
|
const sectionReference = sectionsReferences[sectionId];
|
|
732
631
|
const sectionGrantLevel = sectionReference.grantLevel
|
|
733
632
|
? sectionReference.grantLevel
|
|
734
|
-
:
|
|
633
|
+
: "GUEST";
|
|
735
634
|
const grant = isLevelAccessibleForUser(sectionGrantLevel);
|
|
736
635
|
const availableStep = isStepAvailable(sectionReference.step);
|
|
737
636
|
return condition && grant && availableStep;
|
|
@@ -744,7 +643,7 @@ function* fetchModelDecorator(action: ActionsType.Sagas.Model.fetchModel): any {
|
|
|
744
643
|
greatestPage: 1,
|
|
745
644
|
currentSectionId: availableSections[0],
|
|
746
645
|
availableSections,
|
|
747
|
-
currentAppState: firstCurrentAppState ||
|
|
646
|
+
currentAppState: firstCurrentAppState || "wizard",
|
|
748
647
|
availableAppStates,
|
|
749
648
|
})
|
|
750
649
|
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { put, takeLatest } from
|
|
2
|
-
import { UPDATE_OPTION_INPUT } from
|
|
3
|
-
import { ActionsType } from
|
|
4
|
-
import { selectRadioSiblings } from
|
|
5
|
-
import { updateOptionAction } from
|
|
6
|
-
import { selectOptionInputByIndex } from
|
|
1
|
+
import { put, takeLatest } from "redux-saga/effects";
|
|
2
|
+
import { UPDATE_OPTION_INPUT } from "../constants/inputs";
|
|
3
|
+
import { ActionsType } from "../../types/Actions.type";
|
|
4
|
+
import { selectRadioSiblings } from "../selectors/references";
|
|
5
|
+
import { updateOptionAction } from "../actions/inputs";
|
|
6
|
+
import { selectOptionInputByIndex } from "../selectors/inputs";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* This Saga helps make sure radio inputs are homogenous,
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { select, takeLatest, put } from "redux-saga/effects";
|
|
2
|
+
import { StateType } from "../../types/State.type";
|
|
3
|
+
import { ActionsType } from "../../types/Actions.type";
|
|
4
|
+
import { INIT_INPUTS } from "../constants/inputs";
|
|
5
|
+
import {
|
|
6
|
+
selectMandatoryOptionItem,
|
|
7
|
+
selectMandatoryOption,
|
|
8
|
+
} from "../selectors/mandatories";
|
|
9
|
+
import {
|
|
10
|
+
initMandatoryOptionAction,
|
|
11
|
+
initMandatoryVariableAction,
|
|
12
|
+
} from "../actions/mandatories";
|
|
13
|
+
import { initOptionAction, initVariableAction } from "../actions/inputs";
|
|
14
|
+
import { initConditionsAction } from "../actions/conditions";
|
|
15
|
+
import { ConditionsInitiator } from "../../libs/ConditionsInitiator";
|
|
16
|
+
import { selectOptionRelations } from "../selectors/references";
|
|
17
|
+
|
|
18
|
+
const getValues = (arr1: boolean[], arr2: boolean[]) =>
|
|
19
|
+
arr1.map((v, index) => arr2[index] || v);
|
|
20
|
+
|
|
21
|
+
export function* initInputsDecorator(action: ActionsType.Inputs.initInputs) {
|
|
22
|
+
const state: StateType = yield select((s) => s);
|
|
23
|
+
const references = action.references ? action.references : state.references;
|
|
24
|
+
const { inputs } = action;
|
|
25
|
+
|
|
26
|
+
// Initiating Conditions
|
|
27
|
+
const conditions = new ConditionsInitiator(
|
|
28
|
+
references,
|
|
29
|
+
inputs
|
|
30
|
+
).getConditions();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Initiating conditions first before initiating inputs
|
|
34
|
+
*/
|
|
35
|
+
yield put(initConditionsAction(conditions));
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Initiating inputs
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
// Options
|
|
42
|
+
const optionsIds = Object.keys(inputs.options);
|
|
43
|
+
for (let i = 0; i < optionsIds.length; i += 1) {
|
|
44
|
+
let optionId = parseInt(optionsIds[i], 10);
|
|
45
|
+
let values = inputs.options[optionId];
|
|
46
|
+
yield put(initOptionAction(optionId, values));
|
|
47
|
+
// If option is mandatory we initiate it
|
|
48
|
+
const { meta: meta2 } = references.options[optionId];
|
|
49
|
+
const { type } = meta2;
|
|
50
|
+
let { mandatory } = meta2;
|
|
51
|
+
let sendOptionAction = true;
|
|
52
|
+
if (["checkbox", "radio"].includes(type)) {
|
|
53
|
+
if (type === "radio") {
|
|
54
|
+
const { parents } = selectOptionRelations(optionId);
|
|
55
|
+
// Get parentId
|
|
56
|
+
const parentId = parents[0];
|
|
57
|
+
// check if optin exist on mandatory
|
|
58
|
+
const isMandatoryOption = selectMandatoryOptionItem(parentId);
|
|
59
|
+
// If parentId value = true don't send an action
|
|
60
|
+
if (typeof isMandatoryOption !== "undefined") {
|
|
61
|
+
const mandatoryOption = selectMandatoryOption(parentId);
|
|
62
|
+
sendOptionAction = !mandatoryOption.every((v) => v === true);
|
|
63
|
+
// handle multiple
|
|
64
|
+
if (sendOptionAction === true && mandatoryOption) {
|
|
65
|
+
if (values.length >= mandatoryOption.length) {
|
|
66
|
+
values = getValues(values, [...mandatoryOption]);
|
|
67
|
+
} else {
|
|
68
|
+
values = getValues([...mandatoryOption], values);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
mandatory = references.options[parentId].meta.mandatory;
|
|
74
|
+
optionId = parentId;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (mandatory === true && sendOptionAction === true) {
|
|
78
|
+
yield put(initMandatoryOptionAction(optionId, values));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Variables
|
|
84
|
+
const variablesIds = Object.keys(inputs.variables);
|
|
85
|
+
for (let i = 0; i < variablesIds.length; i += 1) {
|
|
86
|
+
const variableId = variablesIds[i];
|
|
87
|
+
const values = inputs.variables[variableId];
|
|
88
|
+
yield put(initVariableAction(parseInt(variableId, 10), values));
|
|
89
|
+
|
|
90
|
+
// If variable is mandatory we initiate it
|
|
91
|
+
if (references.variables[variableId].mandatory === true)
|
|
92
|
+
yield put(
|
|
93
|
+
initMandatoryVariableAction(
|
|
94
|
+
parseInt(variableId, 10),
|
|
95
|
+
values.map((value) => `${value}`.trim().length > 0)
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Initiating conditions a second time after initiating inputs
|
|
102
|
+
*/
|
|
103
|
+
yield put(initConditionsAction(conditions));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function* initInputsSaga() {
|
|
107
|
+
yield takeLatest(INIT_INPUTS, initInputsDecorator);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export default initInputsSaga;
|