@legalplace/wizardx-core 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -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.d.ts +1 -0
- package/dist/libs/EventsTracking.js +38 -32
- package/dist/libs/Extracts.js +20 -20
- package/dist/libs/InputsInitiator.d.ts +1 -1
- package/dist/libs/InputsInitiator.js +15 -15
- package/dist/libs/NumAuto.js +1 -1
- package/dist/libs/OvcConverter.d.ts +1 -1
- package/dist/libs/OvcConverter.js +23 -23
- package/dist/libs/PathReader.d.ts +1 -1
- package/dist/libs/PathReader.js +22 -22
- package/dist/libs/SectionValidity.js +3 -3
- package/dist/libs/SmartScriptStore.d.ts +6 -6
- package/dist/libs/SmartScriptStore.js +33 -33
- package/dist/misc/test_model.d.ts +2 -2
- package/dist/misc/test_model.js +3807 -3807
- package/dist/polyfills/index.d.ts +5 -0
- package/dist/polyfills/index.js +5 -0
- package/dist/polyfills/prepend.js +2 -2
- package/dist/polyfills/stringRepeat.js +4 -4
- package/dist/redux/actions/app.d.ts +12 -12
- package/dist/redux/actions/app.js +1 -1
- package/dist/redux/actions/conditions.d.ts +2 -2
- package/dist/redux/actions/conditions.js +1 -1
- package/dist/redux/actions/inputs.d.ts +1 -1
- package/dist/redux/actions/inputs.js +1 -1
- package/dist/redux/actions/library.d.ts +73 -0
- package/dist/redux/actions/library.js +11 -0
- package/dist/redux/actions/mandatories.d.ts +1 -1
- package/dist/redux/actions/mandatories.js +1 -1
- package/dist/redux/actions/references.d.ts +4 -4
- package/dist/redux/actions/references.js +1 -1
- package/dist/redux/actions/sagas/data.d.ts +1 -1
- package/dist/redux/actions/sagas/data.js +1 -1
- package/dist/redux/actions/sagas/model.d.ts +3 -3
- package/dist/redux/actions/sagas/model.js +3 -3
- package/dist/redux/actions/sagas/user.d.ts +1 -1
- package/dist/redux/actions/sagas/user.js +1 -1
- package/dist/redux/actions/smartscript.d.ts +3 -3
- package/dist/redux/actions/smartscript.js +1 -1
- package/dist/redux/actions/user.d.ts +4 -4
- package/dist/redux/actions/user.js +1 -1
- package/dist/redux/constants/app.js +22 -22
- package/dist/redux/constants/conditions.js +8 -8
- package/dist/redux/constants/inputs.js +6 -6
- package/dist/redux/constants/mandatories.js +6 -6
- package/dist/redux/constants/references.js +3 -3
- package/dist/redux/constants/sagas/data.js +1 -1
- package/dist/redux/constants/sagas/model.js +2 -2
- package/dist/redux/constants/sagas/user.js +2 -2
- package/dist/redux/constants/smartscript.js +4 -4
- package/dist/redux/constants/user.js +3 -3
- package/dist/redux/listeners/subscriber.d.ts +2 -2
- package/dist/redux/middlewares/conditionsWatcherMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/conditionsWatcherMiddleware.js +28 -28
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.d.ts +4 -2
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.js +10 -10
- package/dist/redux/middlewares/mandatoriesWatcherMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/mandatoriesWatcherMiddleware.js +13 -13
- package/dist/redux/middlewares/multiplesActionsMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/multiplesActionsMiddleware.js +2 -2
- package/dist/redux/middlewares/paginationWatcherMiddleware.d.ts +3 -3
- package/dist/redux/middlewares/paginationWatcherMiddleware.js +24 -24
- package/dist/redux/middlewares/pluginsHookMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/pluginsHookMiddleware.js +1 -1
- package/dist/redux/middlewares/prefillerWatcherMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/prefillerWatcherMiddleware.js +28 -28
- package/dist/redux/middlewares/smartscriptMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/smartscriptMiddleware.js +15 -15
- package/dist/redux/middlewares/thirdpartyScriptsMiddleware.d.ts +5 -0
- package/dist/redux/middlewares/thirdpartyScriptsMiddleware.js +16 -0
- package/dist/redux/reducers/app/customizations/initCustomizationAutoDefault.d.ts +2 -2
- package/dist/redux/reducers/app/customizations/initCustomizationMeta.d.ts +2 -2
- package/dist/redux/reducers/app/instance/initInstance.d.ts +2 -2
- package/dist/redux/reducers/app/instance/setDataStatus.d.ts +2 -2
- package/dist/redux/reducers/app/instance/updateInstance.d.ts +2 -2
- package/dist/redux/reducers/app/instance/updateInstancePaid.d.ts +2 -2
- package/dist/redux/reducers/app/meta/fetchModelFailed.d.ts +1 -1
- package/dist/redux/reducers/app/meta/fetchModelFailed.js +1 -1
- package/dist/redux/reducers/app/meta/fetchModelNonBlocking.d.ts +1 -1
- package/dist/redux/reducers/app/meta/fetchModelNonBlocking.js +1 -1
- package/dist/redux/reducers/app/meta/fetchModelSucceeded.d.ts +1 -1
- package/dist/redux/reducers/app/meta/fetchModelSucceeded.js +1 -1
- package/dist/redux/reducers/app/meta/fetchModelUnhealthy.d.ts +2 -2
- package/dist/redux/reducers/app/meta/fetchModelUnhealthy.js +1 -1
- package/dist/redux/reducers/app/meta/fetchModelUserLocked.d.ts +1 -1
- package/dist/redux/reducers/app/meta/fetchModelUserLocked.js +1 -1
- package/dist/redux/reducers/app/meta/initMeta.d.ts +2 -2
- package/dist/redux/reducers/app/meta/setModelUuid.d.ts +2 -2
- package/dist/redux/reducers/app/pagination/goNextPage.d.ts +1 -1
- package/dist/redux/reducers/app/pagination/goNextPage.js +1 -1
- package/dist/redux/reducers/app/pagination/goPage.d.ts +2 -2
- package/dist/redux/reducers/app/pagination/goPage.js +2 -2
- package/dist/redux/reducers/app/pagination/goPreviousPage.d.ts +1 -1
- package/dist/redux/reducers/app/pagination/goPreviousPage.js +1 -1
- package/dist/redux/reducers/app/pagination/initPagination.d.ts +2 -2
- package/dist/redux/reducers/app/pagination/initPagination.js +1 -1
- package/dist/redux/reducers/app/pagination/updateAvailableAppStates.d.ts +2 -2
- package/dist/redux/reducers/app/pagination/updateAvailableAppStates.js +5 -5
- package/dist/redux/reducers/app/wizard/updateAvailableSections.d.ts +2 -2
- package/dist/redux/reducers/app/wizard/updateAvailableSections.js +2 -2
- package/dist/redux/reducers/app.d.ts +2 -2
- package/dist/redux/reducers/app.js +30 -30
- package/dist/redux/reducers/conditions/addMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/conditions/addMultipleOccurency.js +3 -3
- package/dist/redux/reducers/conditions/deleteMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/conditions/deleteMultipleOccurency.js +2 -2
- package/dist/redux/reducers/conditions/initConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updateDocumentConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updateOptionConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updateOptionValidatorCondition.d.ts +2 -2
- package/dist/redux/reducers/conditions/updatePrefillerConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updatePrefillerConditions.js +2 -2
- package/dist/redux/reducers/conditions/updateSectionConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updateVariableConditions.d.ts +2 -2
- package/dist/redux/reducers/conditions/updateVariableValidatorCondition.d.ts +2 -2
- package/dist/redux/reducers/conditions.d.ts +2 -2
- package/dist/redux/reducers/conditions.js +13 -13
- package/dist/redux/reducers/inputs/addMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/inputs/addMultipleOccurency.js +4 -4
- package/dist/redux/reducers/inputs/deleteMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/inputs/deleteMultipleOccurency.js +2 -2
- package/dist/redux/reducers/inputs/initOption.d.ts +2 -2
- package/dist/redux/reducers/inputs/initVariable.d.ts +2 -2
- package/dist/redux/reducers/inputs/updateOptionInput.d.ts +2 -2
- package/dist/redux/reducers/inputs/updateVariableInput.d.ts +2 -2
- package/dist/redux/reducers/inputs.d.ts +2 -2
- package/dist/redux/reducers/inputs.js +8 -8
- package/dist/redux/reducers/mandatories/addMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/mandatories/addMultipleOccurency.js +2 -2
- package/dist/redux/reducers/mandatories/deleteMultipleOccurency.d.ts +2 -2
- package/dist/redux/reducers/mandatories/deleteMultipleOccurency.js +2 -2
- package/dist/redux/reducers/mandatories/initMandatoryOption.d.ts +2 -2
- package/dist/redux/reducers/mandatories/initMandatoryVariable.d.ts +2 -2
- package/dist/redux/reducers/mandatories/setMandatoryIgnore.d.ts +2 -2
- package/dist/redux/reducers/mandatories/setMandatoryOption.d.ts +2 -2
- package/dist/redux/reducers/mandatories/setMandatorySection.d.ts +2 -2
- package/dist/redux/reducers/mandatories/setMandatoryVariable.d.ts +2 -2
- package/dist/redux/reducers/mandatories.d.ts +2 -2
- package/dist/redux/reducers/mandatories.js +11 -11
- package/dist/redux/reducers/references/initReferences.d.ts +2 -2
- package/dist/redux/reducers/references/updateOptionMeta.d.ts +2 -2
- package/dist/redux/reducers/references/updateOptionMeta.js +2 -2
- package/dist/redux/reducers/references/updateVariableMeta.d.ts +2 -2
- package/dist/redux/reducers/references/updateVariableMeta.js +2 -2
- package/dist/redux/reducers/references.d.ts +2 -2
- package/dist/redux/reducers/references.js +5 -5
- package/dist/redux/reducers/smartscript/enableSmartScript.d.ts +1 -1
- package/dist/redux/reducers/smartscript/initSmartScriptTriggers.d.ts +2 -2
- package/dist/redux/reducers/smartscript/updateSmartscriptOptionHidden.d.ts +2 -2
- package/dist/redux/reducers/smartscript/updateSmartscriptVariableHidden.d.ts +2 -2
- package/dist/redux/reducers/smartscript.d.ts +2 -2
- package/dist/redux/reducers/smartscript.js +6 -6
- package/dist/redux/reducers/user/initUser.d.ts +2 -2
- package/dist/redux/reducers/user/setUserStatus.d.ts +2 -2
- package/dist/redux/reducers/user/setUserValidToken.d.ts +2 -2
- package/dist/redux/reducers/user.d.ts +2 -2
- package/dist/redux/reducers/user.js +9 -9
- package/dist/redux/routerHistory.d.ts +2 -2
- package/dist/redux/routerHistory.js +5 -5
- package/dist/redux/sagas/fetchModel.d.ts +4 -4
- package/dist/redux/sagas/fetchModel.js +84 -88
- package/dist/redux/sagas/fetchModel.test.js +2 -3
- package/dist/redux/sagas/homogeneousRadioInputsSaga.js +5 -5
- package/dist/redux/sagas/runner.d.ts +1 -1
- package/dist/redux/sagas/runner.js +5 -5
- package/dist/redux/sagas/saveData.js +34 -25
- package/dist/redux/sagas/setDefaults.js +8 -8
- package/dist/redux/sagas/setUserEmail.js +43 -43
- package/dist/redux/selectors/app.d.ts +1 -0
- package/dist/redux/selectors/app.js +26 -25
- package/dist/redux/selectors/conditions.js +34 -34
- package/dist/redux/selectors/inputs.d.ts +1 -1
- package/dist/redux/selectors/inputs.js +8 -8
- package/dist/{componentsConnectors/connector/connectorSelectors.d.ts → redux/selectors/library.d.ts} +16 -16
- package/dist/redux/selectors/library.js +8 -0
- package/dist/redux/selectors/mandatories.js +10 -10
- package/dist/redux/selectors/references.js +19 -19
- package/dist/redux/selectors/selectors.d.ts +2 -2
- package/dist/redux/selectors/selectors.js +2 -2
- package/dist/redux/selectors/smartscript.js +5 -5
- package/dist/redux/selectors/user.js +5 -5
- package/dist/redux/store.d.ts +6 -2
- package/dist/redux/store.js +31 -31
- package/dist/service/api.manager.d.ts +2 -2
- package/dist/service/api.manager.js +46 -46
- package/dist/service/auth.service.js +2 -2
- package/dist/service/pardot.service.js +2 -2
- package/dist/tests-misc/plugins/jestTestPlugin/after.d.ts +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/after.js +2 -2
- package/dist/tests-misc/plugins/jestTestPlugin/before.d.ts +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/before.js +2 -5
- package/dist/tests-misc/plugins/jestTestPlugin/index.js +4 -4
- package/dist/tests-misc/plugins/jestTestPlugin/title.d.ts +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/title.js +2 -2
- package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.d.ts +0 -1
- package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.js +2 -2
- package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.d.ts +0 -1
- package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.js +2 -2
- package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.d.ts +0 -1
- package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.js +2 -2
- package/dist/tests-misc/themes/jestTestTheme/faltyIndex.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/faltyIndexLoader.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/index.js +4 -4
- package/dist/types/Actions.type.d.ts +37 -37
- package/dist/types/Components.type.d.ts +4 -5
- package/dist/types/State.type.d.ts +9 -9
- package/dist/types/Termsheet.type.d.ts +4 -4
- package/dist/types/api.type.d.ts +4 -4
- package/dist/types/config.type.d.ts +2 -3
- package/dist/types/getActions.type.d.ts +2 -2
- package/dist/types/getConnectors.type.d.ts +2 -3
- package/dist/types/getSelectors.type.d.ts +2 -2
- package/dist/wizard-params.d.ts +1 -1
- package/dist/wizard-params.js +16 -16
- package/jest.config.ts +1 -1
- package/package.json +16 -8
- package/setupJest.ts +8 -0
- package/src/App.tsx +22 -25
- package/src/Globals.ts +12 -8
- package/src/Loader.tsx +8 -0
- package/src/PluginLoader.tsx +20 -37
- package/src/Shimmer.tsx +58 -45
- package/src/ThemeLoader.test.tsx +1 -0
- package/src/ThemeLoader.tsx +27 -42
- package/src/components/PluginRoute.tsx +8 -6
- package/src/components/SmartScript.tsx +29 -28
- package/src/components/UserLocked/UserLockedComponent.tsx +3 -3
- package/src/components/View.test.tsx +3 -0
- package/src/components/View.tsx +52 -54
- package/src/componentsConnectors/connectBox.tsx +6 -6
- package/src/componentsConnectors/connectDocument.tsx +6 -6
- package/src/componentsConnectors/connectHeader.tsx +2 -2
- package/src/componentsConnectors/connectMetaTitle.tsx +2 -2
- package/src/componentsConnectors/connectOption.tsx +11 -11
- package/src/componentsConnectors/connectPagination.tsx +3 -3
- package/src/componentsConnectors/connectPreview.tsx +2 -2
- package/src/componentsConnectors/connectProgress.tsx +3 -3
- package/src/componentsConnectors/connectRootOption.tsx +4 -4
- package/src/componentsConnectors/connectSection.tsx +4 -4
- package/src/componentsConnectors/connectSummary.tsx +2 -2
- package/src/componentsConnectors/connectSummaryItem.tsx +6 -6
- package/src/componentsConnectors/connectTermsheet.tsx +46 -46
- package/src/componentsConnectors/connectVariable.tsx +11 -11
- package/src/componentsConnectors/connectWizardWrapper.tsx +4 -4
- package/src/componentsConnectors/connector/componentConnector.tsx +22 -20
- package/src/componentsConnectors/library.ts +35 -0
- package/src/config.test.ts +2 -1
- package/src/config.ts +1 -1
- package/src/constants/phoneValidation.ts +6 -0
- package/src/definitions/path.join.d.ts +1 -1
- package/src/helpers/outputsParsing.ts +26 -26
- package/src/helpers/preloadTheme.ts +2 -2
- package/src/helpers/scriptsLoader.ts +20 -0
- package/src/helpers/sendinblueHelper.ts +23 -17
- package/src/hooks/usePrevious.ts +1 -1
- package/src/libs/ConditionsInitiator.ts +3 -3
- package/src/libs/ConditionsRunner/DataPopulator.ts +7 -7
- package/src/libs/ConditionsRunner.ts +53 -53
- package/src/libs/DocumentsOutputs.ts +7 -7
- package/src/libs/Eval/EvalBase.ts +17 -17
- package/src/libs/Eval/EvalFunctions.ts +100 -100
- package/src/libs/Eval/NumbersToLetters.ts +48 -48
- package/src/libs/EvalVariable.ts +34 -31
- package/src/libs/EventsTracking.ts +48 -34
- package/src/libs/Extracts.ts +21 -21
- package/src/libs/InputsInitiator.ts +16 -16
- package/src/libs/NumAuto.ts +1 -1
- package/src/libs/OvcConverter.ts +25 -25
- package/src/libs/PathReader.ts +23 -23
- package/src/libs/SectionValidity.ts +3 -3
- package/src/libs/SmartScriptStore.ts +40 -40
- package/src/misc/test_model.ts +3809 -3809
- package/src/polyfills/index.ts +5 -0
- package/src/polyfills/prepend.ts +2 -2
- package/src/polyfills/stringRepeat.ts +4 -4
- package/src/redux/actions/app.ts +13 -13
- package/src/redux/actions/conditions.ts +3 -3
- package/src/redux/actions/inputs.ts +2 -2
- package/src/redux/actions/library.ts +23 -0
- package/src/redux/actions/mandatories.ts +2 -2
- package/src/redux/actions/references.ts +5 -5
- package/src/redux/actions/sagas/data.ts +2 -2
- package/src/redux/actions/sagas/model.ts +6 -6
- package/src/redux/actions/sagas/user.ts +2 -2
- package/src/redux/actions/smartscript.ts +4 -4
- package/src/redux/actions/user.ts +5 -5
- package/src/redux/constants/app.ts +22 -22
- package/src/redux/constants/conditions.ts +8 -8
- package/src/redux/constants/inputs.ts +6 -6
- package/src/redux/constants/mandatories.ts +6 -6
- package/src/redux/constants/references.ts +3 -3
- package/src/redux/constants/sagas/data.ts +1 -1
- package/src/redux/constants/sagas/model.ts +2 -2
- package/src/redux/constants/sagas/user.ts +2 -2
- package/src/redux/constants/smartscript.ts +4 -4
- package/src/redux/constants/user.ts +3 -3
- package/src/redux/listeners/subscriber.ts +2 -2
- package/src/redux/middlewares/conditionsWatcherMiddleware.ts +31 -31
- package/src/redux/middlewares/evaluationsWatcherMiddleware.test.ts +1 -1
- package/src/redux/middlewares/evaluationsWatcherMiddleware.ts +13 -13
- package/src/redux/middlewares/mandatoriesWatcherMiddleware.ts +16 -16
- package/src/redux/middlewares/multiplesActionsMiddleware.ts +6 -6
- package/src/redux/middlewares/paginationWatcherMiddleware.ts +27 -27
- package/src/redux/middlewares/pluginsHookMiddleware.ts +2 -2
- package/src/redux/middlewares/prefillerWatcherMiddleware.ts +31 -31
- package/src/redux/middlewares/smartscriptMiddleware.ts +20 -20
- package/src/redux/middlewares/thirdpartyScriptsMiddleware.ts +41 -0
- package/src/redux/reducers/app/customizations/initCustomizationAutoDefault.ts +2 -2
- package/src/redux/reducers/app/customizations/initCustomizationMeta.ts +2 -2
- package/src/redux/reducers/app/instance/initInstance.ts +2 -2
- package/src/redux/reducers/app/instance/setDataStatus.ts +2 -2
- package/src/redux/reducers/app/instance/updateInstance.ts +2 -2
- package/src/redux/reducers/app/instance/updateInstancePaid.ts +2 -2
- package/src/redux/reducers/app/meta/fetchModelFailed.ts +2 -2
- package/src/redux/reducers/app/meta/fetchModelNonBlocking.ts +2 -2
- package/src/redux/reducers/app/meta/fetchModelSucceeded.ts +2 -2
- package/src/redux/reducers/app/meta/fetchModelUnhealthy.ts +3 -3
- package/src/redux/reducers/app/meta/fetchModelUserLocked.ts +2 -2
- package/src/redux/reducers/app/meta/initMeta.ts +2 -2
- package/src/redux/reducers/app/meta/setModelUuid.ts +2 -2
- package/src/redux/reducers/app/pagination/goNextPage.ts +2 -2
- package/src/redux/reducers/app/pagination/goPage.ts +4 -4
- package/src/redux/reducers/app/pagination/goPreviousPage.ts +2 -2
- package/src/redux/reducers/app/pagination/initPagination.ts +3 -3
- package/src/redux/reducers/app/pagination/updateAvailableAppStates.ts +7 -7
- package/src/redux/reducers/app/wizard/updateAvailableSections.ts +4 -4
- package/src/redux/reducers/app.ts +32 -32
- package/src/redux/reducers/conditions/addMultipleOccurency.ts +5 -5
- package/src/redux/reducers/conditions/deleteMultipleOccurency.ts +4 -4
- package/src/redux/reducers/conditions/initConditions.ts +2 -2
- package/src/redux/reducers/conditions/updateDocumentConditions.ts +2 -2
- package/src/redux/reducers/conditions/updateOptionConditions.ts +2 -2
- package/src/redux/reducers/conditions/updateOptionValidatorCondition.ts +2 -2
- package/src/redux/reducers/conditions/updatePrefillerConditions.ts +4 -4
- package/src/redux/reducers/conditions/updateSectionConditions.ts +2 -2
- package/src/redux/reducers/conditions/updateVariableConditions.ts +2 -2
- package/src/redux/reducers/conditions/updateVariableValidatorCondition.ts +2 -2
- package/src/redux/reducers/conditions.ts +15 -15
- package/src/redux/reducers/inputs/addMultipleOccurency.ts +6 -6
- package/src/redux/reducers/inputs/deleteMultipleOccurency.ts +4 -4
- package/src/redux/reducers/inputs/initOption.ts +2 -2
- package/src/redux/reducers/inputs/initVariable.ts +2 -2
- package/src/redux/reducers/inputs/updateOptionInput.ts +2 -2
- package/src/redux/reducers/inputs/updateVariableInput.ts +2 -2
- package/src/redux/reducers/inputs.ts +10 -10
- package/src/redux/reducers/mandatories/addMultipleOccurency.ts +4 -4
- package/src/redux/reducers/mandatories/deleteMultipleOccurency.ts +4 -4
- package/src/redux/reducers/mandatories/initMandatoryOption.ts +2 -2
- package/src/redux/reducers/mandatories/initMandatoryVariable.ts +2 -2
- package/src/redux/reducers/mandatories/setMandatoryIgnore.ts +2 -2
- package/src/redux/reducers/mandatories/setMandatoryOption.ts +2 -2
- package/src/redux/reducers/mandatories/setMandatorySection.ts +2 -2
- package/src/redux/reducers/mandatories/setMandatoryVariable.ts +2 -2
- package/src/redux/reducers/mandatories.ts +13 -13
- package/src/redux/reducers/references/initReferences.ts +2 -2
- package/src/redux/reducers/references/updateOptionMeta.ts +4 -4
- package/src/redux/reducers/references/updateVariableMeta.ts +4 -4
- package/src/redux/reducers/references.ts +7 -7
- package/src/redux/reducers/smartscript/enableSmartScript.ts +1 -1
- package/src/redux/reducers/smartscript/initSmartScriptTriggers.ts +2 -2
- package/src/redux/reducers/smartscript/updateSmartscriptOptionHidden.ts +2 -2
- package/src/redux/reducers/smartscript/updateSmartscriptVariableHidden.ts +2 -2
- package/src/redux/reducers/smartscript.ts +8 -8
- package/src/redux/reducers/user/initUser.ts +2 -2
- package/src/redux/reducers/user/setUserStatus.ts +2 -2
- package/src/redux/reducers/user/setUserValidToken.ts +2 -2
- package/src/redux/reducers/user.ts +11 -11
- package/src/redux/routerHistory.ts +6 -6
- package/src/redux/sagas/fetchModel.test.ts +2 -5
- package/src/redux/sagas/fetchModel.ts +91 -100
- package/src/redux/sagas/homogeneousRadioInputsSaga.ts +6 -6
- package/src/redux/sagas/runner.ts +6 -6
- package/src/redux/sagas/saveData.ts +32 -28
- package/src/redux/sagas/setDefaults.ts +8 -8
- package/src/redux/sagas/setUserEmail.ts +46 -45
- package/src/redux/selectors/app.ts +34 -28
- package/src/redux/selectors/conditions.ts +41 -41
- package/src/redux/selectors/inputs.ts +10 -10
- package/src/redux/selectors/library.ts +17 -0
- package/src/redux/selectors/mandatories.ts +10 -10
- package/src/redux/selectors/references.ts +21 -21
- package/src/redux/selectors/selectors.ts +4 -4
- package/src/redux/selectors/smartscript.ts +6 -6
- package/src/redux/selectors/user.ts +8 -8
- package/src/redux/store.ts +42 -32
- package/src/service/api.manager.ts +53 -53
- package/src/service/auth.service.ts +2 -2
- package/src/service/pardot.service.ts +2 -2
- package/src/tests-misc/plugins/jestTestPlugin/after.tsx +1 -1
- package/src/tests-misc/plugins/jestTestPlugin/before.tsx +1 -1
- package/src/tests-misc/plugins/jestTestPlugin/index.ts +4 -4
- package/src/tests-misc/plugins/jestTestPlugin/title.tsx +2 -2
- package/src/tests-misc/themes/jestTestTheme/components/EmailComponent.tsx +1 -1
- package/src/tests-misc/themes/jestTestTheme/components/TermsheetComponent.tsx +1 -1
- package/src/tests-misc/themes/jestTestTheme/components/WizardComponent.tsx +1 -1
- package/src/tests-misc/themes/jestTestTheme/faltyIndex.ts +1 -1
- package/src/tests-misc/themes/jestTestTheme/faltyIndexLoader.ts +1 -1
- package/src/tests-misc/themes/jestTestTheme/index.ts +4 -4
- package/src/types/Actions.type.ts +55 -55
- package/src/types/Components.type.ts +4 -4
- package/src/types/State.type.ts +14 -14
- package/src/types/Termsheet.type.ts +4 -4
- package/src/types/api.type.ts +4 -4
- package/src/types/config.type.ts +3 -3
- package/src/types/getActions.type.ts +2 -2
- package/src/types/getConnectors.type.ts +2 -2
- package/src/types/getSelectors.type.ts +2 -2
- package/src/wizard-params.ts +17 -17
- package/tsconfig.json +1 -1
- package/dist/componentsConnectors/connector/connectorSelectors.js +0 -9
- package/dist/componentsConnectors/index.d.ts +0 -16
- package/dist/componentsConnectors/index.js +0 -16
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.js +0 -1
- package/dist/helpers/index.d.ts +0 -2
- package/dist/helpers/index.js +0 -2
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.js +0 -1
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -23
- package/dist/libs/index.d.ts +0 -12
- package/dist/libs/index.js +0 -12
- package/dist/redux/actions/index.d.ts +0 -8
- package/dist/redux/actions/index.js +0 -8
- package/dist/redux/actions/sagas/index.d.ts +0 -3
- package/dist/redux/actions/sagas/index.js +0 -3
- package/dist/redux/constants/index.d.ts +0 -8
- package/dist/redux/constants/index.js +0 -8
- package/dist/redux/constants/sagas/index.d.ts +0 -3
- package/dist/redux/constants/sagas/index.js +0 -3
- package/dist/redux/index.d.ts +0 -4
- package/dist/redux/index.js +0 -4
- package/dist/redux/selectors/index.d.ts +0 -7
- package/dist/redux/selectors/index.js +0 -7
- package/dist/service/index.d.ts +0 -3
- package/dist/service/index.js +0 -3
- package/dist/types/index.d.ts +0 -10
- package/dist/types/index.js +0 -10
- package/src/componentsConnectors/connector/connectorSelectors.ts +0 -19
- package/src/componentsConnectors/index.ts +0 -16
- package/src/constants/index.ts +0 -1
- package/src/helpers/index.ts +0 -2
- package/src/hooks/index.ts +0 -1
- package/src/index.ts +0 -47
- package/src/libs/index.ts +0 -12
- package/src/redux/actions/index.ts +0 -8
- package/src/redux/actions/sagas/index.ts +0 -3
- package/src/redux/constants/index.ts +0 -8
- package/src/redux/constants/sagas/index.ts +0 -3
- package/src/redux/index.ts +0 -4
- package/src/redux/selectors/index.ts +0 -7
- package/src/service/index.ts +0 -3
- package/src/types/index.ts +0 -10
|
@@ -14,62 +14,62 @@ export class NumberToLetter {
|
|
|
14
14
|
decimals: string | false = false
|
|
15
15
|
): string {
|
|
16
16
|
const letter: Record<number, string> = {
|
|
17
|
-
0:
|
|
18
|
-
1:
|
|
19
|
-
2:
|
|
20
|
-
3:
|
|
21
|
-
4:
|
|
22
|
-
5:
|
|
23
|
-
6:
|
|
24
|
-
7:
|
|
25
|
-
8:
|
|
26
|
-
9:
|
|
27
|
-
10:
|
|
28
|
-
11:
|
|
29
|
-
12:
|
|
30
|
-
13:
|
|
31
|
-
14:
|
|
32
|
-
15:
|
|
33
|
-
16:
|
|
34
|
-
17:
|
|
35
|
-
18:
|
|
36
|
-
19:
|
|
37
|
-
20:
|
|
38
|
-
30:
|
|
39
|
-
40:
|
|
40
|
-
50:
|
|
41
|
-
60:
|
|
42
|
-
70:
|
|
43
|
-
80:
|
|
44
|
-
90:
|
|
17
|
+
0: "zéro",
|
|
18
|
+
1: "un",
|
|
19
|
+
2: "deux",
|
|
20
|
+
3: "trois",
|
|
21
|
+
4: "quatre",
|
|
22
|
+
5: "cinq",
|
|
23
|
+
6: "six",
|
|
24
|
+
7: "sept",
|
|
25
|
+
8: "huit",
|
|
26
|
+
9: "neuf",
|
|
27
|
+
10: "dix",
|
|
28
|
+
11: "onze",
|
|
29
|
+
12: "douze",
|
|
30
|
+
13: "treize",
|
|
31
|
+
14: "quatorze",
|
|
32
|
+
15: "quinze",
|
|
33
|
+
16: "seize",
|
|
34
|
+
17: "dix-sept",
|
|
35
|
+
18: "dix-huit",
|
|
36
|
+
19: "dix-neuf",
|
|
37
|
+
20: "vingt",
|
|
38
|
+
30: "trente",
|
|
39
|
+
40: "quarante",
|
|
40
|
+
50: "cinquante",
|
|
41
|
+
60: "soixante",
|
|
42
|
+
70: "soixante-dix",
|
|
43
|
+
80: "quatre-vingt",
|
|
44
|
+
90: "quatre-vingt-dix",
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
let quotient;
|
|
48
48
|
let left;
|
|
49
|
-
let numberToLetter =
|
|
49
|
+
let numberToLetter = "";
|
|
50
50
|
|
|
51
51
|
// Validating number before proceeding
|
|
52
|
-
if (number.toString().replace(/ /gi,
|
|
53
|
-
throw new Error(
|
|
54
|
-
if (Number.isNaN(number.toString().replace(/ /gi,
|
|
55
|
-
throw new Error(
|
|
52
|
+
if (number.toString().replace(/ /gi, "").length > 15)
|
|
53
|
+
throw new Error("Capacity overrun");
|
|
54
|
+
if (Number.isNaN(number.toString().replace(/ /gi, "")))
|
|
55
|
+
throw new Error("Unvalid number");
|
|
56
56
|
|
|
57
57
|
// Parsing number
|
|
58
|
-
const nb = parseFloat(number.toString().replace(/ /gi,
|
|
58
|
+
const nb = parseFloat(number.toString().replace(/ /gi, ""));
|
|
59
59
|
|
|
60
60
|
// Handling commas
|
|
61
61
|
if (Math.ceil(nb) !== nb) {
|
|
62
|
-
const [wholeNumberPart, decimalPart] = number.toString().split(
|
|
63
|
-
const decimalNumber = decimalPart?.startsWith(
|
|
62
|
+
const [wholeNumberPart, decimalPart] = number.toString().split(".");
|
|
63
|
+
const decimalNumber = decimalPart?.startsWith("0")
|
|
64
64
|
? Array.from(decimalPart)
|
|
65
65
|
.map((decimal) => this.French(decimal))
|
|
66
|
-
.join(
|
|
66
|
+
.join(" ")
|
|
67
67
|
: this.French(decimalPart);
|
|
68
68
|
return (
|
|
69
69
|
this.French(wholeNumberPart) +
|
|
70
|
-
(units ? ` ${units} et ` :
|
|
70
|
+
(units ? ` ${units} et ` : " virgule ") +
|
|
71
71
|
decimalNumber +
|
|
72
|
-
(decimals ? ` ${decimals}` :
|
|
72
|
+
(decimals ? ` ${decimals}` : "")
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -100,7 +100,7 @@ export class NumberToLetter {
|
|
|
100
100
|
case 3:
|
|
101
101
|
quotient = Math.floor(nb / 100);
|
|
102
102
|
left = nb % 100;
|
|
103
|
-
if (quotient === 1 && left === 0) numberToLetter =
|
|
103
|
+
if (quotient === 1 && left === 0) numberToLetter = "cent";
|
|
104
104
|
if (quotient === 1 && left !== 0)
|
|
105
105
|
numberToLetter = `cent ${this.French(left)}`;
|
|
106
106
|
if (quotient > 1 && left === 0)
|
|
@@ -113,7 +113,7 @@ export class NumberToLetter {
|
|
|
113
113
|
case 6:
|
|
114
114
|
quotient = Math.floor(nb / 1000);
|
|
115
115
|
left = nb - quotient * 1000;
|
|
116
|
-
if (quotient === 1 && left === 0) numberToLetter =
|
|
116
|
+
if (quotient === 1 && left === 0) numberToLetter = "mille";
|
|
117
117
|
if (quotient === 1 && left !== 0)
|
|
118
118
|
numberToLetter = `mille ${this.French(left)}`;
|
|
119
119
|
if (quotient > 1 && left === 0)
|
|
@@ -128,7 +128,7 @@ export class NumberToLetter {
|
|
|
128
128
|
case 9:
|
|
129
129
|
quotient = Math.floor(nb / 1000000);
|
|
130
130
|
left = nb % 1000000;
|
|
131
|
-
if (quotient === 1 && left === 0) numberToLetter =
|
|
131
|
+
if (quotient === 1 && left === 0) numberToLetter = "un million";
|
|
132
132
|
if (quotient === 1 && left !== 0)
|
|
133
133
|
numberToLetter = `un million ${this.French(left)}`;
|
|
134
134
|
if (quotient > 1 && left === 0)
|
|
@@ -143,7 +143,7 @@ export class NumberToLetter {
|
|
|
143
143
|
case 12:
|
|
144
144
|
quotient = Math.floor(nb / 1000000000);
|
|
145
145
|
left = nb - quotient * 1000000000;
|
|
146
|
-
if (quotient === 1 && left === 0) numberToLetter =
|
|
146
|
+
if (quotient === 1 && left === 0) numberToLetter = "un milliard";
|
|
147
147
|
if (quotient === 1 && left !== 0)
|
|
148
148
|
numberToLetter = `un milliard ${this.French(left)}`;
|
|
149
149
|
if (quotient > 1 && left === 0)
|
|
@@ -158,7 +158,7 @@ export class NumberToLetter {
|
|
|
158
158
|
case 15:
|
|
159
159
|
quotient = Math.floor(nb / 1000000000000);
|
|
160
160
|
left = nb - quotient * 1000000000000;
|
|
161
|
-
if (quotient === 1 && left === 0) numberToLetter =
|
|
161
|
+
if (quotient === 1 && left === 0) numberToLetter = "un billion";
|
|
162
162
|
if (quotient === 1 && left !== 0)
|
|
163
163
|
numberToLetter = `un billion ${this.French(left)}`;
|
|
164
164
|
if (quotient > 1 && left === 0)
|
|
@@ -174,11 +174,11 @@ export class NumberToLetter {
|
|
|
174
174
|
|
|
175
175
|
if (
|
|
176
176
|
numberToLetter.substr(
|
|
177
|
-
numberToLetter.length -
|
|
178
|
-
|
|
179
|
-
) ===
|
|
177
|
+
numberToLetter.length - "quatre-vingt".length,
|
|
178
|
+
"quatre-vingt".length
|
|
179
|
+
) === "quatre-vingt"
|
|
180
180
|
)
|
|
181
|
-
numberToLetter +=
|
|
181
|
+
numberToLetter += "s";
|
|
182
182
|
|
|
183
183
|
return numberToLetter;
|
|
184
184
|
}
|
package/src/libs/EvalVariable.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
/* eslint-disable no-await-in-loop */
|
|
2
|
+
import type { VariableV3 } from "@legalplace/models-v3-types";
|
|
3
|
+
import { selectVariableReference } from "../redux/selectors/references";
|
|
4
|
+
import { EvalFunctions } from "./Eval/EvalFunctions";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* EvalVariable class
|
|
@@ -27,7 +28,7 @@ export class EvalVariable extends EvalFunctions {
|
|
|
27
28
|
super(variable.id, index);
|
|
28
29
|
|
|
29
30
|
this.evaluation =
|
|
30
|
-
typeof variable.eval?.formula ===
|
|
31
|
+
typeof variable.eval?.formula === "string" ? variable.eval?.formula : "0";
|
|
31
32
|
this.rawEvaluation = this.evaluation;
|
|
32
33
|
this.index = index;
|
|
33
34
|
|
|
@@ -66,8 +67,8 @@ export class EvalVariable extends EvalFunctions {
|
|
|
66
67
|
// Getting values
|
|
67
68
|
evalVariablesIds.forEach((variableId) => {
|
|
68
69
|
let value = this.getVariableValue(variableId, false);
|
|
69
|
-
if (typeof value ===
|
|
70
|
-
value =
|
|
70
|
+
if (typeof value === "string" && value.trim().length === 0) {
|
|
71
|
+
value = "___EMPTY___";
|
|
71
72
|
|
|
72
73
|
if (this.isVariableEditable(variableId)) this.abortEvaluation = true;
|
|
73
74
|
}
|
|
@@ -83,9 +84,9 @@ export class EvalVariable extends EvalFunctions {
|
|
|
83
84
|
let operation = `${this.evaluation}`;
|
|
84
85
|
Object.keys(this.variablesValues).forEach((variableId) => {
|
|
85
86
|
let value = this.variablesValues[variableId];
|
|
86
|
-
value = typeof value ===
|
|
87
|
+
value = typeof value === "number" ? value.toString() : value;
|
|
87
88
|
operation = operation.replace(
|
|
88
|
-
new RegExp(`\\[var:${variableId}\\]`,
|
|
89
|
+
new RegExp(`\\[var:${variableId}\\]`, "g"),
|
|
89
90
|
value
|
|
90
91
|
);
|
|
91
92
|
});
|
|
@@ -132,8 +133,10 @@ export class EvalVariable extends EvalFunctions {
|
|
|
132
133
|
|
|
133
134
|
// Keep the loop running until we detect no more functions
|
|
134
135
|
while (formulas && this.doNotEvaluate === false) {
|
|
135
|
-
formulas.
|
|
136
|
-
const
|
|
136
|
+
for (let i = 0; i < formulas.length; i += 1) {
|
|
137
|
+
const formula = formulas[i];
|
|
138
|
+
|
|
139
|
+
const reg = new RegExp(regex, "gi");
|
|
137
140
|
const extract = reg.exec(formula);
|
|
138
141
|
if (extract === null) return;
|
|
139
142
|
|
|
@@ -142,10 +145,10 @@ export class EvalVariable extends EvalFunctions {
|
|
|
142
145
|
|
|
143
146
|
const functionName = extract[1];
|
|
144
147
|
const args = extract[2]
|
|
145
|
-
.split(extract[2].indexOf(
|
|
148
|
+
.split(extract[2].indexOf(";") > -1 ? ";" : ",")
|
|
146
149
|
.map((v) => v.trim());
|
|
147
150
|
|
|
148
|
-
let result =
|
|
151
|
+
let result = "";
|
|
149
152
|
if (Object.keys(functionsList).includes(functionName)) {
|
|
150
153
|
result = functionsList[functionName].apply(this, args).toString();
|
|
151
154
|
this.hasFunctions = true;
|
|
@@ -153,14 +156,14 @@ export class EvalVariable extends EvalFunctions {
|
|
|
153
156
|
// eslint-disable-next-line no-console
|
|
154
157
|
console.error(
|
|
155
158
|
`Erreur de modélisation: la fonction %c"${functionName}" %cest inconnue dans la formule: ${this.rawEvaluation}`,
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
"font-weight: bold;",
|
|
160
|
+
"font-weight: initial"
|
|
158
161
|
);
|
|
159
162
|
this.doNotEvaluate = true;
|
|
160
163
|
}
|
|
161
164
|
|
|
162
165
|
this.evaluation = this.evaluation.replace(formula, result);
|
|
163
|
-
}
|
|
166
|
+
}
|
|
164
167
|
|
|
165
168
|
formulas = this.evaluation.match(regex);
|
|
166
169
|
}
|
|
@@ -172,15 +175,15 @@ export class EvalVariable extends EvalFunctions {
|
|
|
172
175
|
evaluate(): string | number {
|
|
173
176
|
// Stoping evaluation in case the functions processing decided so
|
|
174
177
|
if (this.doNotEvaluate === true) {
|
|
175
|
-
this.result =
|
|
176
|
-
return
|
|
178
|
+
this.result = "";
|
|
179
|
+
return "";
|
|
177
180
|
}
|
|
178
181
|
if (
|
|
179
|
-
typeof this.evaluation !==
|
|
182
|
+
typeof this.evaluation !== "string" ||
|
|
180
183
|
this.evaluation.trim().length === 0
|
|
181
184
|
) {
|
|
182
|
-
this.result =
|
|
183
|
-
return
|
|
185
|
+
this.result = "";
|
|
186
|
+
return "";
|
|
184
187
|
}
|
|
185
188
|
|
|
186
189
|
let result;
|
|
@@ -189,35 +192,35 @@ export class EvalVariable extends EvalFunctions {
|
|
|
189
192
|
if (/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/.test(this.evaluation)) {
|
|
190
193
|
result = this.evaluation;
|
|
191
194
|
} else if (/^D=(.*)/i.test(this.evaluation)) {
|
|
192
|
-
result = this.setEmpty(this.evaluation.replace(/^D=/i,
|
|
195
|
+
result = this.setEmpty(this.evaluation.replace(/^D=/i, ""), "");
|
|
193
196
|
} else if (this.abortEvaluation === true) {
|
|
194
|
-
result =
|
|
197
|
+
result = "";
|
|
195
198
|
} else {
|
|
196
199
|
const cleanEvaluation = this.setEmpty(this.evaluation, 0);
|
|
197
200
|
// eslint-disable-next-line no-eval
|
|
198
201
|
result = eval(
|
|
199
|
-
typeof cleanEvaluation ===
|
|
202
|
+
typeof cleanEvaluation === "string"
|
|
200
203
|
? cleanEvaluation
|
|
201
204
|
: cleanEvaluation.toString()
|
|
202
205
|
);
|
|
203
206
|
if (result === Infinity || Number.isNaN(result)) {
|
|
204
|
-
result = this.hasFunctions === true ?
|
|
207
|
+
result = this.hasFunctions === true ? "" : 0;
|
|
205
208
|
}
|
|
206
209
|
}
|
|
207
210
|
} catch (e) {
|
|
208
211
|
result =
|
|
209
|
-
this.hasFunctions === true || this.abortEvaluation === true ?
|
|
212
|
+
this.hasFunctions === true || this.abortEvaluation === true ? "" : 0;
|
|
210
213
|
}
|
|
211
214
|
|
|
212
215
|
// Rounding
|
|
213
|
-
if (typeof result ===
|
|
216
|
+
if (typeof result === "number") {
|
|
214
217
|
const variableReference = selectVariableReference(this.id);
|
|
215
218
|
if (variableReference?.eval === undefined)
|
|
216
219
|
throw new Error(`Variable ${this.id} does not exist`);
|
|
217
220
|
const { decimals, round } = variableReference.eval;
|
|
218
221
|
const evalDecimal =
|
|
219
|
-
(typeof decimals ===
|
|
220
|
-
typeof decimals ===
|
|
222
|
+
(typeof decimals === "number" && !Number.isNaN(decimals)) ||
|
|
223
|
+
typeof decimals === "string"
|
|
221
224
|
? decimals
|
|
222
225
|
: undefined;
|
|
223
226
|
|
|
@@ -225,7 +228,7 @@ export class EvalVariable extends EvalFunctions {
|
|
|
225
228
|
let numberOfDecimals = 0;
|
|
226
229
|
if (evalDecimal !== undefined) {
|
|
227
230
|
numberOfDecimals =
|
|
228
|
-
typeof evalDecimal ===
|
|
231
|
+
typeof evalDecimal === "string"
|
|
229
232
|
? parseInt(evalDecimal, 10)
|
|
230
233
|
: evalDecimal;
|
|
231
234
|
}
|
|
@@ -252,8 +255,8 @@ export class EvalVariable extends EvalFunctions {
|
|
|
252
255
|
}
|
|
253
256
|
|
|
254
257
|
if (result === undefined) {
|
|
255
|
-
this.result =
|
|
256
|
-
return
|
|
258
|
+
this.result = "";
|
|
259
|
+
return "";
|
|
257
260
|
}
|
|
258
261
|
|
|
259
262
|
this.result = result.toString();
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Cookies from "universal-cookie";
|
|
2
|
+
import Globals from "../Globals";
|
|
2
3
|
|
|
3
4
|
export type EventsPropsType = Record<
|
|
4
5
|
string,
|
|
5
6
|
string | number | boolean | Record<string, string | number | boolean>
|
|
6
7
|
>;
|
|
7
8
|
|
|
9
|
+
const cookie = new Cookies();
|
|
10
|
+
|
|
8
11
|
class _EventsTracking {
|
|
9
12
|
private initiated = false;
|
|
10
13
|
|
|
@@ -48,12 +51,23 @@ class _EventsTracking {
|
|
|
48
51
|
private init() {
|
|
49
52
|
this.initiated = true;
|
|
50
53
|
this.register({
|
|
51
|
-
|
|
52
|
-
process.env.REACT_APP_COMMIT ||
|
|
53
|
-
Environement: Globals.
|
|
54
|
-
|
|
54
|
+
"WizardX Build Commit":
|
|
55
|
+
process.env.REACT_APP_COMMIT || "Unkown build commit",
|
|
56
|
+
Environement: Globals.appEnv,
|
|
57
|
+
"Powered By": "WizardX",
|
|
58
|
+
...this.getXSource(),
|
|
55
59
|
});
|
|
56
|
-
this.trigger(
|
|
60
|
+
this.trigger("wizardx");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private getXSource(): Record<string, string> {
|
|
64
|
+
const xSource = cookie.get("X-Source");
|
|
65
|
+
|
|
66
|
+
return typeof xSource === "string" && xSource.trim().length > 0
|
|
67
|
+
? {
|
|
68
|
+
"X-Source": xSource,
|
|
69
|
+
}
|
|
70
|
+
: {};
|
|
57
71
|
}
|
|
58
72
|
|
|
59
73
|
/**
|
|
@@ -73,25 +87,25 @@ class _EventsTracking {
|
|
|
73
87
|
let fn: (...a: any) => any;
|
|
74
88
|
|
|
75
89
|
switch (fnName) {
|
|
76
|
-
case
|
|
90
|
+
case "trackMix":
|
|
77
91
|
fn = this.trackMix.bind(this);
|
|
78
92
|
break;
|
|
79
|
-
case
|
|
93
|
+
case "trackFB":
|
|
80
94
|
fn = this.trackFB.bind(this);
|
|
81
95
|
break;
|
|
82
|
-
case
|
|
96
|
+
case "trackGA":
|
|
83
97
|
fn = this.trackGA.bind(this);
|
|
84
98
|
break;
|
|
85
|
-
case
|
|
99
|
+
case "trackSIB":
|
|
86
100
|
fn = this.trackSIB.bind(this);
|
|
87
101
|
break;
|
|
88
|
-
case
|
|
102
|
+
case "registerMix":
|
|
89
103
|
fn = this.registerMix.bind(this);
|
|
90
104
|
break;
|
|
91
|
-
case
|
|
105
|
+
case "registerFB":
|
|
92
106
|
fn = this.registerFB.bind(this);
|
|
93
107
|
break;
|
|
94
|
-
case
|
|
108
|
+
case "triggerHj":
|
|
95
109
|
fn = this.triggerHj.bind(this);
|
|
96
110
|
break;
|
|
97
111
|
default:
|
|
@@ -124,14 +138,14 @@ class _EventsTracking {
|
|
|
124
138
|
) {
|
|
125
139
|
if (!this.initiated) this.init();
|
|
126
140
|
|
|
127
|
-
if (typeof window.mixpanel !==
|
|
141
|
+
if (typeof window.mixpanel !== "undefined") {
|
|
128
142
|
if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
|
|
129
143
|
window.mixpanel.track(eventName, eventProps);
|
|
130
144
|
return true;
|
|
131
145
|
}
|
|
132
146
|
|
|
133
147
|
if (doNotPushToQueue === false)
|
|
134
|
-
this.queue.push([
|
|
148
|
+
this.queue.push(["trackMix", [eventName, eventProps]]);
|
|
135
149
|
|
|
136
150
|
this.queueTimeout();
|
|
137
151
|
return false;
|
|
@@ -144,14 +158,14 @@ class _EventsTracking {
|
|
|
144
158
|
) {
|
|
145
159
|
if (!this.initiated) this.init();
|
|
146
160
|
|
|
147
|
-
if (typeof window.sendinblue !==
|
|
161
|
+
if (typeof window.sendinblue !== "undefined") {
|
|
148
162
|
if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
|
|
149
163
|
window.sendinblue.track(eventName, eventProps);
|
|
150
164
|
return true;
|
|
151
165
|
}
|
|
152
166
|
|
|
153
167
|
if (doNotPushToQueue === false)
|
|
154
|
-
this.queue.push([
|
|
168
|
+
this.queue.push(["trackSIB", [eventName, eventProps]]);
|
|
155
169
|
|
|
156
170
|
this.queueTimeout();
|
|
157
171
|
return false;
|
|
@@ -162,14 +176,14 @@ class _EventsTracking {
|
|
|
162
176
|
eventProps?: EventsPropsType,
|
|
163
177
|
doNotPushToQueue = false
|
|
164
178
|
) {
|
|
165
|
-
if (typeof window.fbq !==
|
|
179
|
+
if (typeof window.fbq !== "undefined") {
|
|
166
180
|
if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
|
|
167
|
-
window.fbq(
|
|
181
|
+
window.fbq("trackCustom", eventName, eventProps);
|
|
168
182
|
return true;
|
|
169
183
|
}
|
|
170
184
|
|
|
171
185
|
if (doNotPushToQueue === false)
|
|
172
|
-
this.queue.push([
|
|
186
|
+
this.queue.push(["trackFB", [eventName, eventProps]]);
|
|
173
187
|
|
|
174
188
|
this.queueTimeout();
|
|
175
189
|
return false;
|
|
@@ -180,13 +194,13 @@ class _EventsTracking {
|
|
|
180
194
|
eventProps?: EventsPropsType,
|
|
181
195
|
doNotPushToQueue = false
|
|
182
196
|
) {
|
|
183
|
-
if (typeof window.ga !==
|
|
197
|
+
if (typeof window.ga !== "undefined") {
|
|
184
198
|
if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
|
|
185
199
|
window.ga(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
200
|
+
"send",
|
|
201
|
+
"event",
|
|
202
|
+
"lpTracking",
|
|
203
|
+
"track",
|
|
190
204
|
eventName,
|
|
191
205
|
1,
|
|
192
206
|
eventProps
|
|
@@ -195,43 +209,43 @@ class _EventsTracking {
|
|
|
195
209
|
}
|
|
196
210
|
|
|
197
211
|
if (doNotPushToQueue === false)
|
|
198
|
-
this.queue.push([
|
|
212
|
+
this.queue.push(["trackGA", [eventName, eventProps]]);
|
|
199
213
|
|
|
200
214
|
this.queueTimeout();
|
|
201
215
|
return false;
|
|
202
216
|
}
|
|
203
217
|
|
|
204
218
|
private registerMix(props: EventsPropsType, doNotPushToQueue = false) {
|
|
205
|
-
if (typeof window.mixpanel !==
|
|
219
|
+
if (typeof window.mixpanel !== "undefined") {
|
|
206
220
|
if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
|
|
207
221
|
window.mixpanel.register(props);
|
|
208
222
|
return true;
|
|
209
223
|
}
|
|
210
|
-
if (doNotPushToQueue === false) this.queue.push([
|
|
224
|
+
if (doNotPushToQueue === false) this.queue.push(["registerMix", [props]]);
|
|
211
225
|
|
|
212
226
|
this.queueTimeout();
|
|
213
227
|
return false;
|
|
214
228
|
}
|
|
215
229
|
|
|
216
230
|
private registerFB(props: EventsPropsType, doNotPushToQueue = false) {
|
|
217
|
-
if (typeof window.fbq !==
|
|
231
|
+
if (typeof window.fbq !== "undefined") {
|
|
218
232
|
if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
|
|
219
|
-
window.fbq(
|
|
233
|
+
window.fbq("trackCustom", "GeneralProps", props);
|
|
220
234
|
return true;
|
|
221
235
|
}
|
|
222
|
-
if (doNotPushToQueue === false) this.queue.push([
|
|
236
|
+
if (doNotPushToQueue === false) this.queue.push(["registerFB", [props]]);
|
|
223
237
|
|
|
224
238
|
this.queueTimeout();
|
|
225
239
|
return false;
|
|
226
240
|
}
|
|
227
241
|
|
|
228
242
|
private triggerHj(name: string, doNotPushToQueue = false) {
|
|
229
|
-
if (typeof window.hj !==
|
|
243
|
+
if (typeof window.hj !== "undefined") {
|
|
230
244
|
if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
|
|
231
|
-
window.hj(
|
|
245
|
+
window.hj("trigger", name);
|
|
232
246
|
return true;
|
|
233
247
|
}
|
|
234
|
-
if (doNotPushToQueue === false) this.queue.push([
|
|
248
|
+
if (doNotPushToQueue === false) this.queue.push(["triggerHj", [name]]);
|
|
235
249
|
|
|
236
250
|
this.queueTimeout();
|
|
237
251
|
return false;
|
package/src/libs/Extracts.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { ExtractV3 } from
|
|
2
|
-
import { selectCustomizationMeta } from
|
|
3
|
-
import { selectUserEmail } from
|
|
1
|
+
import type { ExtractV3 } from "@legalplace/models-v3-types";
|
|
2
|
+
import { selectCustomizationMeta } from "../redux/selectors/app";
|
|
3
|
+
import { selectUserEmail } from "../redux/selectors/user";
|
|
4
4
|
import {
|
|
5
5
|
selectOptionInput,
|
|
6
6
|
selectVariableInput,
|
|
7
|
-
} from
|
|
7
|
+
} from "../redux/selectors/inputs";
|
|
8
8
|
import {
|
|
9
9
|
selectOptionReference,
|
|
10
10
|
selectVariableReference,
|
|
11
|
-
} from
|
|
12
|
-
import { EventsTracking } from
|
|
11
|
+
} from "../redux/selectors/references";
|
|
12
|
+
import { EventsTracking } from "./EventsTracking";
|
|
13
13
|
|
|
14
14
|
export interface ExtractObject {
|
|
15
15
|
name: string;
|
|
@@ -31,7 +31,7 @@ class Extracts {
|
|
|
31
31
|
const customizationMeta = selectCustomizationMeta();
|
|
32
32
|
if (
|
|
33
33
|
!(
|
|
34
|
-
typeof customizationMeta ===
|
|
34
|
+
typeof customizationMeta === "object" &&
|
|
35
35
|
Array.isArray(customizationMeta.extracts) &&
|
|
36
36
|
customizationMeta.extracts.length > 0
|
|
37
37
|
)
|
|
@@ -55,12 +55,12 @@ class Extracts {
|
|
|
55
55
|
let defaultName: string;
|
|
56
56
|
|
|
57
57
|
// Getting inputs
|
|
58
|
-
if (type ===
|
|
58
|
+
if (type === "option") {
|
|
59
59
|
inputs = selectOptionInput(id).map((value) =>
|
|
60
|
-
value === true ?
|
|
60
|
+
value === true ? "True" : "False"
|
|
61
61
|
);
|
|
62
62
|
defaultName = selectOptionReference(id).meta.label;
|
|
63
|
-
} else if (type ===
|
|
63
|
+
} else if (type === "variable") {
|
|
64
64
|
inputs = selectVariableInput(id).map((value) => value.toString());
|
|
65
65
|
defaultName = selectVariableReference(id, true).label;
|
|
66
66
|
} else {
|
|
@@ -73,12 +73,12 @@ class Extracts {
|
|
|
73
73
|
|
|
74
74
|
// Joining inputs
|
|
75
75
|
const value =
|
|
76
|
-
inputs.length > 1 ? inputs.join(
|
|
76
|
+
inputs.length > 1 ? inputs.join(", ").slice(0, -2) : inputs[0];
|
|
77
77
|
|
|
78
78
|
// Slack
|
|
79
79
|
if (
|
|
80
|
-
typeof destination.slack ===
|
|
81
|
-
typeof destination.slack.channel ===
|
|
80
|
+
typeof destination.slack === "object" &&
|
|
81
|
+
typeof destination.slack.channel === "string" &&
|
|
82
82
|
destination.slack.channel.trim().length > 0
|
|
83
83
|
) {
|
|
84
84
|
const { name, channel } = destination.slack;
|
|
@@ -93,7 +93,7 @@ class Extracts {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
// Sendinblue
|
|
96
|
-
if (typeof destination.sendinblue ===
|
|
96
|
+
if (typeof destination.sendinblue === "object" && value && value.trim()) {
|
|
97
97
|
const name = destination.sendinblue.name || defaultName;
|
|
98
98
|
|
|
99
99
|
this.sendinblueExtracts = {
|
|
@@ -103,7 +103,7 @@ class Extracts {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// Mixpanel
|
|
106
|
-
if (typeof destination.mixpanel ===
|
|
106
|
+
if (typeof destination.mixpanel === "object") {
|
|
107
107
|
const name = destination.mixpanel.name || defaultName;
|
|
108
108
|
|
|
109
109
|
this.mixpanelExtracts = {
|
|
@@ -119,8 +119,8 @@ class Extracts {
|
|
|
119
119
|
channels.forEach((currentChannel) => {
|
|
120
120
|
const text = this.formatSlackMessage(currentChannel);
|
|
121
121
|
const json = {
|
|
122
|
-
username:
|
|
123
|
-
icon_emoji:
|
|
122
|
+
username: "WizardX Extract Bot",
|
|
123
|
+
icon_emoji: ":robot_face:",
|
|
124
124
|
channel: currentChannel,
|
|
125
125
|
attachments: [
|
|
126
126
|
{
|
|
@@ -131,10 +131,10 @@ class Extracts {
|
|
|
131
131
|
|
|
132
132
|
// Sending Slack Message
|
|
133
133
|
fetch(
|
|
134
|
-
|
|
134
|
+
"https://hooks.slack.com/services/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",
|
|
135
135
|
{
|
|
136
136
|
body: JSON.stringify(json),
|
|
137
|
-
method:
|
|
137
|
+
method: "POST",
|
|
138
138
|
}
|
|
139
139
|
).catch(async (err) => {
|
|
140
140
|
throw new Error(err);
|
|
@@ -143,7 +143,7 @@ class Extracts {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
private sendMixpanel() {
|
|
146
|
-
EventsTracking.trackMix(
|
|
146
|
+
EventsTracking.trackMix("Variable Extraction", this.mixpanelExtracts);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
private formatSlackMessage(channel: string) {
|
|
@@ -152,7 +152,7 @@ class Extracts {
|
|
|
152
152
|
const { name, value } = extract;
|
|
153
153
|
lines.push(`*${name}:* ${value}`);
|
|
154
154
|
});
|
|
155
|
-
return lines.join(
|
|
155
|
+
return lines.join("\n");
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|