@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
package/src/PluginLoader.tsx
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import React, { Props } from
|
|
2
|
-
import { Action } from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import { LoadableComponent } from
|
|
5
|
-
import { getConfig } from
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import { ComponentsConnectors } from './types/getConnectors.type';
|
|
11
|
-
import { SelectorsType } from './types/getSelectors.type';
|
|
12
|
-
import Globals from './Globals';
|
|
13
|
-
import * as selectorsList from './redux/selectors';
|
|
14
|
-
import * as connectorsList from './componentsConnectors';
|
|
1
|
+
import React, { Props } from "react";
|
|
2
|
+
import { Action } from "redux";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { LoadableComponent } from "@loadable/component";
|
|
5
|
+
import { getConfig } from "./config";
|
|
6
|
+
import { getStore } from "./redux/store";
|
|
7
|
+
import { getHistory } from "./redux/routerHistory";
|
|
8
|
+
import { EventsTracking } from "./libs/EventsTracking";
|
|
9
|
+
import Globals from "./Globals";
|
|
15
10
|
|
|
16
11
|
// This object will be used to contain all anchors
|
|
17
12
|
let globalAnchors: Record<string, React.FC[]> = {};
|
|
@@ -49,9 +44,9 @@ const pluginAppStates = (declaration: PluginsAppStatesDeclarations) => {
|
|
|
49
44
|
PluginsAppStatesRegistrers.push(declaration.register);
|
|
50
45
|
|
|
51
46
|
// Adding page app states
|
|
52
|
-
if (typeof declaration.pageAppState ===
|
|
47
|
+
if (typeof declaration.pageAppState === "object")
|
|
53
48
|
Object.keys(declaration.pageAppState).forEach((appState) => {
|
|
54
|
-
if (typeof declaration.pageAppState[appState] ===
|
|
49
|
+
if (typeof declaration.pageAppState[appState] === "string") {
|
|
55
50
|
const page = declaration.pageAppState[appState];
|
|
56
51
|
|
|
57
52
|
// Verifying if appState is already declared
|
|
@@ -135,11 +130,7 @@ export const getPluginsPageAppStates = (): Readonly<
|
|
|
135
130
|
typeof PluginsPageAppStates
|
|
136
131
|
> => PluginsPageAppStates;
|
|
137
132
|
|
|
138
|
-
const loadPluginFiles = async (
|
|
139
|
-
pluginsList: Record<string, string>,
|
|
140
|
-
connectorSelectors: SelectorsType,
|
|
141
|
-
connectors: ComponentsConnectors
|
|
142
|
-
) => {
|
|
133
|
+
const loadPluginFiles = async (pluginsList: Record<string, string>) => {
|
|
143
134
|
const plugins = Object.keys(pluginsList);
|
|
144
135
|
// We load all needed plugin first to continue in synchronous way
|
|
145
136
|
const pluginModules = await Promise.all(
|
|
@@ -153,20 +144,12 @@ const loadPluginFiles = async (
|
|
|
153
144
|
|
|
154
145
|
// Loading selectors if module has a loader function
|
|
155
146
|
if (loader !== undefined) {
|
|
156
|
-
loader(
|
|
157
|
-
connectorSelectors,
|
|
158
|
-
connectors,
|
|
159
|
-
getStore().dispatch,
|
|
160
|
-
connectorActions,
|
|
161
|
-
getHistory(),
|
|
162
|
-
getConfig(),
|
|
163
|
-
EventsTracking
|
|
164
|
-
);
|
|
147
|
+
loader(getStore().dispatch, getHistory(), getConfig(), EventsTracking);
|
|
165
148
|
}
|
|
166
149
|
|
|
167
150
|
// Looking for anchors inside the plugin
|
|
168
151
|
Object.keys(anchors).forEach((anchor) => {
|
|
169
|
-
if (anchor ===
|
|
152
|
+
if (anchor === "replace") {
|
|
170
153
|
Object.keys(anchors[anchor]).forEach((replacer) => {
|
|
171
154
|
// Adding current replacer
|
|
172
155
|
replacers[replacer] = anchors[anchor][replacer];
|
|
@@ -177,14 +160,14 @@ const loadPluginFiles = async (
|
|
|
177
160
|
/**
|
|
178
161
|
* App States
|
|
179
162
|
*/
|
|
180
|
-
if (anchor ===
|
|
163
|
+
if (anchor === "appstates") {
|
|
181
164
|
pluginAppStates(anchors.appstates);
|
|
182
165
|
}
|
|
183
166
|
|
|
184
167
|
/**
|
|
185
168
|
* Redux Anchors
|
|
186
169
|
*/
|
|
187
|
-
if (anchor ===
|
|
170
|
+
if (anchor === "redux") {
|
|
188
171
|
Object.keys(anchors[anchor]).forEach((action) => {
|
|
189
172
|
if (reduxAnchors[action] === undefined) reduxAnchors[action] = [];
|
|
190
173
|
// Adding current action
|
|
@@ -196,7 +179,7 @@ const loadPluginFiles = async (
|
|
|
196
179
|
/**
|
|
197
180
|
* Action Override
|
|
198
181
|
*/
|
|
199
|
-
if (anchor ===
|
|
182
|
+
if (anchor === "actionOverride") {
|
|
200
183
|
Object.keys(anchors[anchor]).forEach((action) => {
|
|
201
184
|
if (actionOverrideAnchor[action] === undefined)
|
|
202
185
|
actionOverrideAnchor[action] = [];
|
|
@@ -209,7 +192,7 @@ const loadPluginFiles = async (
|
|
|
209
192
|
/**
|
|
210
193
|
* Additional route
|
|
211
194
|
*/
|
|
212
|
-
if (anchor ===
|
|
195
|
+
if (anchor === "additionalRoutes") {
|
|
213
196
|
Object.keys(anchors[anchor]).forEach((route) => {
|
|
214
197
|
PluginAdditionRoutes[anchors[anchor][route].path] =
|
|
215
198
|
anchors[anchor][route].component;
|
|
@@ -241,7 +224,7 @@ export const loadPlugins = async (plugins?: Record<string, string>) => {
|
|
|
241
224
|
pluginsList = getConfig().plugins;
|
|
242
225
|
}
|
|
243
226
|
// We need to make sure all plugins are loaded before going on
|
|
244
|
-
await loadPluginFiles(pluginsList
|
|
227
|
+
await loadPluginFiles(pluginsList);
|
|
245
228
|
|
|
246
229
|
pluginsLoadingDone = true;
|
|
247
230
|
};
|
|
@@ -333,7 +316,7 @@ export function ReplaceComponent<T = {}>(
|
|
|
333
316
|
componentName ||
|
|
334
317
|
OriginalComponent.displayName ||
|
|
335
318
|
OriginalComponent.name ||
|
|
336
|
-
|
|
319
|
+
"Component";
|
|
337
320
|
const anchorsList = !Array.isArray(replacerName)
|
|
338
321
|
? [replacerName]
|
|
339
322
|
: replacerName;
|
package/src/Shimmer.tsx
CHANGED
|
@@ -1,75 +1,88 @@
|
|
|
1
|
-
import React, { CSSProperties } from
|
|
2
|
-
import { connect } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import UserLockedComponent from './components/UserLocked/UserLockedComponent';
|
|
1
|
+
import React, { CSSProperties, useState } from "react";
|
|
2
|
+
import { connect } from "react-redux";
|
|
3
|
+
import { StateType } from "./types/State.type";
|
|
4
|
+
import { addOnThemeLoadCallback, getThemeShimmer } from "./ThemeLoader";
|
|
5
|
+
import { PluginLoader } from "./PluginLoader";
|
|
6
|
+
import UserLockedComponent from "./components/UserLocked/UserLockedComponent";
|
|
8
7
|
|
|
9
8
|
const Shimmer: React.FC<{
|
|
10
|
-
fetchStatus: StateType.App.Meta[
|
|
11
|
-
report: StateType.App.Meta[
|
|
9
|
+
fetchStatus: StateType.App.Meta["fetchStatus"];
|
|
10
|
+
report: StateType.App.Meta["report"];
|
|
12
11
|
}> = (props) => {
|
|
12
|
+
const [themeLoaded, setThemeloaded] = useState(false);
|
|
13
|
+
|
|
13
14
|
if (
|
|
14
|
-
props.fetchStatus ===
|
|
15
|
-
props.fetchStatus ===
|
|
15
|
+
props.fetchStatus === "succeeded" ||
|
|
16
|
+
props.fetchStatus === "nonBlocking"
|
|
16
17
|
) {
|
|
17
18
|
return <>{props.children}</>;
|
|
18
19
|
}
|
|
20
|
+
|
|
21
|
+
addOnThemeLoadCallback(() => {
|
|
22
|
+
if (!themeLoaded) setThemeloaded(true);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if (!themeLoaded) return null;
|
|
26
|
+
|
|
19
27
|
const ThemeShimmer = getThemeShimmer();
|
|
20
28
|
|
|
21
29
|
const style: CSSProperties = {
|
|
22
|
-
position:
|
|
23
|
-
left:
|
|
24
|
-
top:
|
|
25
|
-
transform:
|
|
26
|
-
color:
|
|
27
|
-
fontWeight:
|
|
28
|
-
textTransform:
|
|
29
|
-
fontSize:
|
|
30
|
-
userSelect:
|
|
30
|
+
position: "absolute",
|
|
31
|
+
left: "50%",
|
|
32
|
+
top: "50%",
|
|
33
|
+
transform: "translate(-50%, -50%)",
|
|
34
|
+
color: "#AAA",
|
|
35
|
+
fontWeight: "bold",
|
|
36
|
+
textTransform: "uppercase",
|
|
37
|
+
fontSize: "12px",
|
|
38
|
+
userSelect: "none",
|
|
31
39
|
};
|
|
32
40
|
|
|
33
41
|
const unhealthyStyle: CSSProperties = {
|
|
34
|
-
color:
|
|
35
|
-
fontWeight:
|
|
36
|
-
textTransform:
|
|
37
|
-
fontSize:
|
|
38
|
-
width:
|
|
39
|
-
margin:
|
|
40
|
-
textAlign:
|
|
41
|
-
padding:
|
|
42
|
+
color: "#AAA",
|
|
43
|
+
fontWeight: "bold",
|
|
44
|
+
textTransform: "uppercase",
|
|
45
|
+
fontSize: "24px",
|
|
46
|
+
width: "700px",
|
|
47
|
+
margin: "auto",
|
|
48
|
+
textAlign: "center",
|
|
49
|
+
padding: "20px",
|
|
42
50
|
};
|
|
43
51
|
|
|
44
52
|
const unhealthyStylePre: CSSProperties = {
|
|
45
|
-
background:
|
|
46
|
-
textAlign:
|
|
47
|
-
fontSize:
|
|
48
|
-
color:
|
|
49
|
-
padding:
|
|
50
|
-
borderRadius:
|
|
53
|
+
background: "#FDDCD0",
|
|
54
|
+
textAlign: "left",
|
|
55
|
+
fontSize: "12px",
|
|
56
|
+
color: "#6B0435",
|
|
57
|
+
padding: "10px",
|
|
58
|
+
borderRadius: "4px",
|
|
51
59
|
};
|
|
52
|
-
if (ThemeShimmer !== null && props.fetchStatus ===
|
|
60
|
+
if (ThemeShimmer !== null && props.fetchStatus === "waiting") {
|
|
53
61
|
return <ThemeShimmer />;
|
|
54
62
|
}
|
|
55
63
|
return (
|
|
56
64
|
<>
|
|
57
|
-
{[
|
|
65
|
+
{["waiting", "failed"].includes(props.fetchStatus) && (
|
|
58
66
|
<div style={style}>
|
|
59
|
-
{props.fetchStatus ===
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
{props.fetchStatus === "waiting" && (
|
|
68
|
+
<div className="lds-ripple">
|
|
69
|
+
<div />
|
|
70
|
+
<div />
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
{props.fetchStatus === "failed" &&
|
|
74
|
+
"Une erreur a eu lieu pendant le chargement du questionnaire"}
|
|
62
75
|
</div>
|
|
63
76
|
)}
|
|
64
77
|
|
|
65
|
-
{props.fetchStatus ===
|
|
78
|
+
{props.fetchStatus === "userLocked" && (
|
|
66
79
|
<>
|
|
67
80
|
<PluginLoader anchor={[`userLockedScreen`]} props={props} />
|
|
68
81
|
<UserLockedComponent unhealthyStyle={unhealthyStyle} />
|
|
69
82
|
</>
|
|
70
83
|
)}
|
|
71
84
|
|
|
72
|
-
{props.fetchStatus ===
|
|
85
|
+
{props.fetchStatus === "unhealthy" && (
|
|
73
86
|
<div style={unhealthyStyle}>
|
|
74
87
|
Le modèle semble contenir des erreurs
|
|
75
88
|
<pre style={unhealthyStylePre}>{props.report?.raw}</pre>
|
|
@@ -82,12 +95,12 @@ const Shimmer: React.FC<{
|
|
|
82
95
|
const mapStateToProps = (
|
|
83
96
|
state: StateType
|
|
84
97
|
): {
|
|
85
|
-
fetchStatus: StateType.App.Meta[
|
|
86
|
-
report: StateType.App.Meta[
|
|
98
|
+
fetchStatus: StateType.App.Meta["fetchStatus"];
|
|
99
|
+
report: StateType.App.Meta["report"];
|
|
87
100
|
} => ({
|
|
88
101
|
fetchStatus:
|
|
89
|
-
state.app.meta.fetchStatus ===
|
|
90
|
-
?
|
|
102
|
+
state.app.meta.fetchStatus === "succeeded"
|
|
103
|
+
? "nonBlocking"
|
|
91
104
|
: state.app.meta.fetchStatus,
|
|
92
105
|
report: state.app.meta.report,
|
|
93
106
|
});
|
package/src/ThemeLoader.test.tsx
CHANGED
|
@@ -35,6 +35,7 @@ describe('<ThemeLoader />', () => {
|
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
it('Loads WizardComponent properly', async () => {
|
|
38
|
+
await loadTheme();
|
|
38
39
|
const WizardComponent = loadThemeComponent('WizardComponent');
|
|
39
40
|
const { container } = render(<WizardComponent />);
|
|
40
41
|
await waitFor(() =>
|
package/src/ThemeLoader.tsx
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getConfig, updateConfig } from
|
|
3
|
-
import { IWizardParamsTheme } from
|
|
4
|
-
|
|
5
|
-
* Connectors
|
|
6
|
-
*/
|
|
7
|
-
import * as connectorSelectors from './redux/selectors';
|
|
8
|
-
import * as connectors from './componentsConnectors';
|
|
9
|
-
import { SelectorsType } from './types/getSelectors.type';
|
|
10
|
-
import Globals from './Globals';
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { getConfig, updateConfig } from "./config";
|
|
3
|
+
import { IWizardParamsTheme } from "./types/config.type";
|
|
4
|
+
import Globals from "./Globals";
|
|
11
5
|
|
|
12
6
|
// Getting current theme from config
|
|
13
7
|
let wizardTheme: string;
|
|
14
|
-
let themeParams: IWizardParamsTheme[
|
|
8
|
+
let themeParams: IWizardParamsTheme["params"];
|
|
9
|
+
const themeLoadCallbacks: (() => void)[] = [];
|
|
15
10
|
|
|
16
11
|
// This variable will store our theme's index
|
|
17
|
-
let themeIndex: Record<string,
|
|
12
|
+
let themeIndex: Record<string, React.LazyExoticComponent<React.FC<{}>>>;
|
|
18
13
|
|
|
19
14
|
/**
|
|
20
15
|
* Theme loading function
|
|
@@ -38,58 +33,44 @@ export const loadTheme = async (theme?: string, force?: boolean) => {
|
|
|
38
33
|
|
|
39
34
|
// Importing theme's loader function
|
|
40
35
|
let themeLoader: {
|
|
41
|
-
|
|
42
|
-
| ((
|
|
43
|
-
p: any,
|
|
44
|
-
c: typeof connectors,
|
|
45
|
-
s: SelectorsType
|
|
46
|
-
) => Record<string, LoadableComponent<unknown>>)
|
|
47
|
-
| undefined;
|
|
48
|
-
default?: Record<string, LoadableComponent<unknown>>;
|
|
49
|
-
} = {
|
|
50
|
-
loader: undefined,
|
|
36
|
+
default?: Record<string, React.LazyExoticComponent<React.FC<{}>>>;
|
|
51
37
|
};
|
|
52
38
|
|
|
53
39
|
try {
|
|
54
40
|
themeLoader = await Globals.loadTheme(currentTheme);
|
|
55
41
|
} catch (e) {
|
|
56
42
|
throw new Error(
|
|
57
|
-
|
|
43
|
+
"We are unable to load the theme, please make sure the theme param is valid"
|
|
58
44
|
);
|
|
59
45
|
}
|
|
60
46
|
|
|
61
47
|
// Extracting loader & default
|
|
62
|
-
const {
|
|
48
|
+
const { default: themeDefault } = themeLoader;
|
|
63
49
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
throw new Error('Theme loader function not found');
|
|
67
|
-
|
|
68
|
-
if (typeof loader === 'function')
|
|
69
|
-
themeIndex = loader(themeParams, connectors, connectorSelectors);
|
|
70
|
-
else if (typeof themeDefault !== 'undefined') themeIndex = themeDefault;
|
|
71
|
-
else throw new Error('Unable to retrieve theme index');
|
|
50
|
+
if (typeof themeDefault !== "undefined") themeIndex = themeDefault;
|
|
51
|
+
else throw new Error("Unable to retrieve theme index");
|
|
72
52
|
|
|
73
53
|
// In case the theme still didn't load we throw an error
|
|
74
|
-
if (typeof themeIndex !==
|
|
75
|
-
throw new Error(
|
|
54
|
+
if (typeof themeIndex !== "object")
|
|
55
|
+
throw new Error("Theme loader function did not return components object");
|
|
56
|
+
|
|
57
|
+
themeLoadCallbacks.forEach((cb) => {
|
|
58
|
+
cb();
|
|
59
|
+
});
|
|
76
60
|
};
|
|
77
61
|
|
|
78
62
|
/**
|
|
79
63
|
* Theme component's loader
|
|
80
64
|
*/
|
|
81
|
-
const importThemeComponent =
|
|
65
|
+
const importThemeComponent = (
|
|
82
66
|
name: string
|
|
83
|
-
):
|
|
84
|
-
if (typeof themeIndex !== 'object') await loadTheme();
|
|
85
|
-
return themeIndex[name];
|
|
86
|
-
};
|
|
67
|
+
): React.LazyExoticComponent<React.FC<{}>> => themeIndex[name];
|
|
87
68
|
/**
|
|
88
69
|
* Theme component's loader
|
|
89
70
|
*/
|
|
90
71
|
export const getThemeShimmer = () =>
|
|
91
72
|
getConfig().theme?.shimmer === true
|
|
92
|
-
?
|
|
73
|
+
? importThemeComponent("ShimmerComponent")
|
|
93
74
|
: null;
|
|
94
75
|
|
|
95
76
|
export const setWizardTheme = async (theme: IWizardParamsTheme) => {
|
|
@@ -106,5 +87,9 @@ export const setWizardTheme = async (theme: IWizardParamsTheme) => {
|
|
|
106
87
|
|
|
107
88
|
export const getThemeParams = () => themeParams;
|
|
108
89
|
|
|
109
|
-
export const loadThemeComponent = (name: string) =>
|
|
110
|
-
|
|
90
|
+
export const loadThemeComponent = (name: string) => importThemeComponent(name);
|
|
91
|
+
|
|
92
|
+
export const addOnThemeLoadCallback = (cb: () => void) => {
|
|
93
|
+
if (themeIndex !== undefined) cb();
|
|
94
|
+
themeLoadCallbacks.push(cb);
|
|
95
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { Suspense, useCallback, useEffect, useState } from
|
|
2
|
-
import { RouteComponentProps } from
|
|
3
|
-
import { getPluginsAdditionalRoutes, loadPlugins } from
|
|
4
|
-
import Shimmer from
|
|
1
|
+
import React, { Suspense, useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { RouteComponentProps } from "react-router-dom";
|
|
3
|
+
import { getPluginsAdditionalRoutes, loadPlugins } from "../PluginLoader";
|
|
4
|
+
import Shimmer from "../Shimmer";
|
|
5
5
|
|
|
6
6
|
export interface IRouteProps {
|
|
7
7
|
path: string;
|
|
@@ -9,7 +9,7 @@ export interface IRouteProps {
|
|
|
9
9
|
|
|
10
10
|
export type IProps = RouteComponentProps<IRouteProps>;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const PluginRoute = ({
|
|
13
13
|
match: {
|
|
14
14
|
params: { path },
|
|
15
15
|
},
|
|
@@ -23,7 +23,7 @@ export const PluginRoute = ({
|
|
|
23
23
|
|
|
24
24
|
if (!routes.length) {
|
|
25
25
|
/** @TODO load plugin from backend instead of defaulting to authentication plugin */
|
|
26
|
-
await loadPlugins({ authentication:
|
|
26
|
+
await loadPlugins({ authentication: "1.0.0" });
|
|
27
27
|
routes = getPluginsAdditionalRoutes();
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -44,3 +44,5 @@ export const PluginRoute = ({
|
|
|
44
44
|
</Suspense>
|
|
45
45
|
);
|
|
46
46
|
};
|
|
47
|
+
|
|
48
|
+
export default PluginRoute;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React, { useEffect, useState } from
|
|
2
|
-
import { useParams } from
|
|
3
|
-
import queryString from
|
|
4
|
-
import { Action } from
|
|
5
|
-
import
|
|
6
|
-
import { getConfig } from
|
|
7
|
-
import { SmartScriptStore } from
|
|
8
|
-
import { StateType } from
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { useParams } from "react-router-dom";
|
|
3
|
+
import queryString from "query-string";
|
|
4
|
+
import { Action } from "redux";
|
|
5
|
+
import type { Moment } from "moment-business-days";
|
|
6
|
+
import { getConfig } from "../config";
|
|
7
|
+
import { SmartScriptStore } from "../libs/SmartScriptStore";
|
|
8
|
+
import { StateType } from "../types/State.type";
|
|
9
9
|
|
|
10
10
|
export type TInitTriggersCallback = (
|
|
11
|
-
triggers: StateType.SmartScript[
|
|
11
|
+
triggers: StateType.SmartScript["triggers"],
|
|
12
12
|
actions: Action[]
|
|
13
13
|
) => void;
|
|
14
14
|
|
|
@@ -30,9 +30,9 @@ declare global {
|
|
|
30
30
|
displayOption: typeof SmartScriptStore.displayOption;
|
|
31
31
|
hideVariable: typeof SmartScriptStore.hideVariable;
|
|
32
32
|
displayVariable: typeof SmartScriptStore.displayVariable;
|
|
33
|
-
moment:
|
|
33
|
+
moment: Moment;
|
|
34
34
|
triggerListeners: (
|
|
35
|
-
type:
|
|
35
|
+
type: "option" | "variable",
|
|
36
36
|
id: number,
|
|
37
37
|
inputs: StateType.Inputs
|
|
38
38
|
) => Action[];
|
|
@@ -74,13 +74,12 @@ const SmartScriptComponent = () => {
|
|
|
74
74
|
window.displayVariable = SmartScriptStore.displayVariable;
|
|
75
75
|
window.hideOption = SmartScriptStore.hideOption;
|
|
76
76
|
window.displayOption = SmartScriptStore.displayOption;
|
|
77
|
-
window.moment = moment;
|
|
78
77
|
|
|
79
78
|
// Loading SmartScript
|
|
80
79
|
|
|
81
80
|
// API Endpoint
|
|
82
81
|
const apiEndpoint =
|
|
83
|
-
getConfig().apiEndpoint + (/\/$/.test(getConfig().apiEndpoint) ?
|
|
82
|
+
getConfig().apiEndpoint + (/\/$/.test(getConfig().apiEndpoint) ? "" : "/");
|
|
84
83
|
|
|
85
84
|
// Permalink
|
|
86
85
|
const { permalink, uniqid } = useParams<{
|
|
@@ -97,20 +96,22 @@ const SmartScriptComponent = () => {
|
|
|
97
96
|
useEffect(() => {
|
|
98
97
|
if (!smartScriptLoaded) {
|
|
99
98
|
const src = `${apiEndpoint}wizard/contractv1/smartscript/${permalink}${
|
|
100
|
-
uniqid ? `/${uniqid}` :
|
|
101
|
-
}${modelVersion ? `?version=${modelVersion}` :
|
|
102
|
-
const scriptElement = document.createElement(
|
|
103
|
-
scriptElement.setAttribute(
|
|
99
|
+
uniqid ? `/${uniqid}` : ""
|
|
100
|
+
}${modelVersion ? `?version=${modelVersion}` : ""}`;
|
|
101
|
+
const scriptElement = document.createElement("script");
|
|
102
|
+
scriptElement.setAttribute("src", src);
|
|
104
103
|
scriptElement.onload = () => {
|
|
105
|
-
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
import("moment-business-days").then(() => {
|
|
105
|
+
if (typeof initTriggersCallback === "function") {
|
|
106
|
+
if (isNewInstance) SmartScriptStore.execOnInit();
|
|
107
|
+
SmartScriptStore.execOnLoad();
|
|
108
|
+
initTriggersCallback(
|
|
109
|
+
SmartScriptStore.triggers,
|
|
110
|
+
SmartScriptStore.grabActions()
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
setSmartScriptLoaded(true);
|
|
114
|
+
});
|
|
114
115
|
};
|
|
115
116
|
document.body.append(scriptElement);
|
|
116
117
|
}
|
|
@@ -142,7 +143,7 @@ const SmartScriptComponent = () => {
|
|
|
142
143
|
// Triggering listeners
|
|
143
144
|
window.triggerListeners = (type, id, inputs) => {
|
|
144
145
|
const hooks =
|
|
145
|
-
SmartScriptStore.hooks[type ===
|
|
146
|
+
SmartScriptStore.hooks[type === "option" ? "options" : "variables"];
|
|
146
147
|
const listeners = hooks[id];
|
|
147
148
|
|
|
148
149
|
if (Array.isArray(listeners)) {
|
|
@@ -152,7 +153,7 @@ const SmartScriptComponent = () => {
|
|
|
152
153
|
listeners.forEach((_cb) => _cb());
|
|
153
154
|
} catch (e) {
|
|
154
155
|
// eslint-disable-next-line no-console
|
|
155
|
-
console.error(
|
|
156
|
+
console.error("SmartScript (onInit) error: ", e.message);
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { CSSProperties } from
|
|
2
|
-
import { ReplaceComponent } from
|
|
1
|
+
import React, { CSSProperties } from "react";
|
|
2
|
+
import { ReplaceComponent } from "../../PluginLoader";
|
|
3
3
|
|
|
4
4
|
export interface IProps {
|
|
5
5
|
unhealthyStyle: CSSProperties;
|
|
@@ -20,7 +20,7 @@ const UserLockHooc =
|
|
|
20
20
|
// eslint-disable-next-line react/display-name
|
|
21
21
|
(props) => {
|
|
22
22
|
// Component replace
|
|
23
|
-
const replaceAnchors = [
|
|
23
|
+
const replaceAnchors = ["UserLockedComponent"];
|
|
24
24
|
const FinalComponent = ReplaceComponent(replaceAnchors, Component);
|
|
25
25
|
|
|
26
26
|
return (
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
goPageAction,
|
|
13
13
|
} from '../redux/actions/app';
|
|
14
14
|
import View from './View';
|
|
15
|
+
import { loadTheme } from '../ThemeLoader';
|
|
15
16
|
|
|
16
17
|
afterEach(cleanup);
|
|
17
18
|
|
|
@@ -79,6 +80,7 @@ describe('<View />', () => {
|
|
|
79
80
|
});
|
|
80
81
|
|
|
81
82
|
it('Loads WizardComponent properly', async () => {
|
|
83
|
+
await loadTheme();
|
|
82
84
|
const { container } = render(
|
|
83
85
|
<Provider store={store}>
|
|
84
86
|
<View />
|
|
@@ -93,6 +95,7 @@ describe('<View />', () => {
|
|
|
93
95
|
|
|
94
96
|
it('Loads TermsheetComponent properly', async () => {
|
|
95
97
|
store.dispatch(goPageAction(3));
|
|
98
|
+
await loadTheme();
|
|
96
99
|
const { container } = render(
|
|
97
100
|
<Provider store={store}>
|
|
98
101
|
<View />
|