@legalplace/wizardx-core 2.3.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (543) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/App.d.ts +5 -5
  3. package/dist/App.js +22 -35
  4. package/dist/App.test.js +2 -2
  5. package/dist/Globals.d.ts +4 -0
  6. package/dist/Globals.js +9 -6
  7. package/dist/Loader.d.ts +1 -0
  8. package/dist/Loader.js +2 -0
  9. package/dist/PluginLoader.d.ts +3 -3
  10. package/dist/PluginLoader.js +22 -26
  11. package/dist/PluginLoader.test.js +6 -6
  12. package/dist/Shimmer.d.ts +1 -1
  13. package/dist/Shimmer.js +45 -47
  14. package/dist/ThemeLoader.d.ts +6 -5
  15. package/dist/ThemeLoader.js +21 -25
  16. package/dist/ThemeLoader.test.js +4 -3
  17. package/dist/components/PluginRoute.d.ts +3 -3
  18. package/dist/components/PluginRoute.js +8 -7
  19. package/dist/components/SmartScript.d.ts +7 -8
  20. package/dist/components/SmartScript.js +22 -21
  21. package/dist/components/UserLocked/UserLockedComponent.d.ts +1 -1
  22. package/dist/components/UserLocked/UserLockedComponent.js +5 -6
  23. package/dist/components/View.d.ts +8 -4
  24. package/dist/components/View.js +46 -55
  25. package/dist/components/View.test.js +6 -5
  26. package/dist/componentsConnectors/connectBox.d.ts +2 -3
  27. package/dist/componentsConnectors/connectBox.js +4 -4
  28. package/dist/componentsConnectors/connectBox.test.js +7 -7
  29. package/dist/componentsConnectors/connectDocument.d.ts +0 -1
  30. package/dist/componentsConnectors/connectDocument.js +6 -6
  31. package/dist/componentsConnectors/connectDocument.test.js +5 -5
  32. package/dist/componentsConnectors/connectHeader.d.ts +0 -1
  33. package/dist/componentsConnectors/connectHeader.js +2 -2
  34. package/dist/componentsConnectors/connectMetaTitle.d.ts +0 -1
  35. package/dist/componentsConnectors/connectMetaTitle.js +2 -2
  36. package/dist/componentsConnectors/connectMetaTitle.test.js +3 -3
  37. package/dist/componentsConnectors/connectOption.d.ts +2 -3
  38. package/dist/componentsConnectors/connectOption.js +9 -9
  39. package/dist/componentsConnectors/connectPagination.d.ts +0 -1
  40. package/dist/componentsConnectors/connectPagination.js +3 -3
  41. package/dist/componentsConnectors/connectPreview.d.ts +0 -1
  42. package/dist/componentsConnectors/connectPreview.js +2 -2
  43. package/dist/componentsConnectors/connectProgress.d.ts +0 -1
  44. package/dist/componentsConnectors/connectProgress.js +3 -3
  45. package/dist/componentsConnectors/connectRootOption.d.ts +2 -3
  46. package/dist/componentsConnectors/connectRootOption.js +2 -2
  47. package/dist/componentsConnectors/connectSection.d.ts +0 -1
  48. package/dist/componentsConnectors/connectSection.js +4 -4
  49. package/dist/componentsConnectors/connectSummary.d.ts +0 -1
  50. package/dist/componentsConnectors/connectSummary.js +2 -2
  51. package/dist/componentsConnectors/connectSummaryItem.d.ts +0 -1
  52. package/dist/componentsConnectors/connectSummaryItem.js +6 -6
  53. package/dist/componentsConnectors/connectTermsheet.d.ts +2 -2
  54. package/dist/componentsConnectors/connectTermsheet.js +43 -46
  55. package/dist/componentsConnectors/connectVariable.d.ts +1 -2
  56. package/dist/componentsConnectors/connectVariable.js +10 -10
  57. package/dist/componentsConnectors/connectWizardWrapper.d.ts +0 -1
  58. package/dist/componentsConnectors/connectWizardWrapper.js +4 -4
  59. package/dist/componentsConnectors/connector/componentConnector.d.ts +8 -8
  60. package/dist/componentsConnectors/connector/componentConnector.js +16 -19
  61. package/dist/componentsConnectors/library.d.ts +61 -0
  62. package/dist/componentsConnectors/library.js +34 -0
  63. package/dist/config.d.ts +1 -1
  64. package/dist/constants/phoneValidation.d.ts +3 -0
  65. package/dist/constants/phoneValidation.js +3 -0
  66. package/dist/helpers/outputsParsing.d.ts +1 -1
  67. package/dist/helpers/outputsParsing.js +25 -25
  68. package/dist/helpers/preloadTheme.js +1 -1
  69. package/dist/helpers/scriptsLoader.d.ts +1 -0
  70. package/dist/helpers/scriptsLoader.js +24 -0
  71. package/dist/helpers/sendinblueHelper.d.ts +3 -3
  72. package/dist/helpers/sendinblueHelper.js +29 -18
  73. package/dist/hooks/usePrevious.js +1 -1
  74. package/dist/libs/ConditionsInitiator.d.ts +1 -1
  75. package/dist/libs/ConditionsInitiator.js +2 -2
  76. package/dist/libs/ConditionsRunner/DataPopulator.js +7 -7
  77. package/dist/libs/ConditionsRunner.d.ts +3 -3
  78. package/dist/libs/ConditionsRunner.js +43 -43
  79. package/dist/libs/DocumentsOutputs.d.ts +2 -2
  80. package/dist/libs/DocumentsOutputs.js +5 -5
  81. package/dist/libs/Eval/EvalBase.js +17 -17
  82. package/dist/libs/Eval/EvalFunctions.d.ts +1 -1
  83. package/dist/libs/Eval/EvalFunctions.js +100 -100
  84. package/dist/libs/Eval/NumbersToLetters.js +46 -46
  85. package/dist/libs/EvalVariable.d.ts +2 -2
  86. package/dist/libs/EvalVariable.js +30 -29
  87. package/dist/libs/EventsTracking.js +32 -32
  88. package/dist/libs/Extracts.js +20 -20
  89. package/dist/libs/InputsInitiator.d.ts +1 -1
  90. package/dist/libs/InputsInitiator.js +15 -15
  91. package/dist/libs/NumAuto.js +1 -1
  92. package/dist/libs/OvcConverter.d.ts +1 -1
  93. package/dist/libs/OvcConverter.js +23 -23
  94. package/dist/libs/PathReader.d.ts +1 -1
  95. package/dist/libs/PathReader.js +22 -22
  96. package/dist/libs/SectionValidity.js +3 -3
  97. package/dist/libs/SmartScriptStore.d.ts +6 -6
  98. package/dist/libs/SmartScriptStore.js +33 -33
  99. package/dist/misc/test_model.d.ts +2 -2
  100. package/dist/misc/test_model.js +3807 -3807
  101. package/dist/polyfills/index.d.ts +5 -0
  102. package/dist/polyfills/index.js +5 -0
  103. package/dist/polyfills/prepend.js +2 -2
  104. package/dist/polyfills/stringRepeat.js +4 -4
  105. package/dist/redux/actions/app.d.ts +12 -12
  106. package/dist/redux/actions/app.js +1 -1
  107. package/dist/redux/actions/conditions.d.ts +2 -2
  108. package/dist/redux/actions/conditions.js +1 -1
  109. package/dist/redux/actions/inputs.d.ts +3 -1
  110. package/dist/redux/actions/inputs.js +6 -1
  111. package/dist/redux/actions/library.d.ts +74 -0
  112. package/dist/redux/actions/library.js +11 -0
  113. package/dist/redux/actions/mandatories.d.ts +1 -1
  114. package/dist/redux/actions/mandatories.js +1 -1
  115. package/dist/redux/actions/references.d.ts +4 -4
  116. package/dist/redux/actions/references.js +1 -1
  117. package/dist/redux/actions/sagas/data.d.ts +1 -1
  118. package/dist/redux/actions/sagas/data.js +1 -1
  119. package/dist/redux/actions/sagas/model.d.ts +3 -3
  120. package/dist/redux/actions/sagas/model.js +3 -3
  121. package/dist/redux/actions/sagas/user.d.ts +1 -1
  122. package/dist/redux/actions/sagas/user.js +1 -1
  123. package/dist/redux/actions/smartscript.d.ts +3 -3
  124. package/dist/redux/actions/smartscript.js +1 -1
  125. package/dist/redux/actions/user.d.ts +4 -4
  126. package/dist/redux/actions/user.js +1 -1
  127. package/dist/redux/constants/app.js +22 -22
  128. package/dist/redux/constants/conditions.js +8 -8
  129. package/dist/redux/constants/inputs.d.ts +1 -0
  130. package/dist/redux/constants/inputs.js +7 -6
  131. package/dist/redux/constants/mandatories.js +6 -6
  132. package/dist/redux/constants/references.js +3 -3
  133. package/dist/redux/constants/sagas/data.js +1 -1
  134. package/dist/redux/constants/sagas/model.js +2 -2
  135. package/dist/redux/constants/sagas/user.js +2 -2
  136. package/dist/redux/constants/smartscript.js +4 -4
  137. package/dist/redux/constants/user.js +3 -3
  138. package/dist/redux/listeners/subscriber.d.ts +2 -2
  139. package/dist/redux/middlewares/conditionsWatcherMiddleware.d.ts +2 -2
  140. package/dist/redux/middlewares/conditionsWatcherMiddleware.js +28 -28
  141. package/dist/redux/middlewares/evaluationsWatcherMiddleware.d.ts +4 -2
  142. package/dist/redux/middlewares/evaluationsWatcherMiddleware.js +10 -10
  143. package/dist/redux/middlewares/mandatoriesWatcherMiddleware.d.ts +2 -2
  144. package/dist/redux/middlewares/mandatoriesWatcherMiddleware.js +13 -13
  145. package/dist/redux/middlewares/multiplesActionsMiddleware.d.ts +2 -2
  146. package/dist/redux/middlewares/multiplesActionsMiddleware.js +2 -2
  147. package/dist/redux/middlewares/paginationWatcherMiddleware.d.ts +3 -3
  148. package/dist/redux/middlewares/paginationWatcherMiddleware.js +24 -24
  149. package/dist/redux/middlewares/pluginsHookMiddleware.d.ts +1 -1
  150. package/dist/redux/middlewares/pluginsHookMiddleware.js +1 -1
  151. package/dist/redux/middlewares/prefillerWatcherMiddleware.d.ts +2 -2
  152. package/dist/redux/middlewares/prefillerWatcherMiddleware.js +28 -28
  153. package/dist/redux/middlewares/smartscriptMiddleware.d.ts +2 -2
  154. package/dist/redux/middlewares/smartscriptMiddleware.js +33 -15
  155. package/dist/redux/middlewares/thirdpartyScriptsMiddleware.d.ts +5 -0
  156. package/dist/redux/middlewares/thirdpartyScriptsMiddleware.js +16 -0
  157. package/dist/redux/reducers/app/customizations/initCustomizationAutoDefault.d.ts +2 -2
  158. package/dist/redux/reducers/app/customizations/initCustomizationMeta.d.ts +2 -2
  159. package/dist/redux/reducers/app/instance/initInstance.d.ts +2 -2
  160. package/dist/redux/reducers/app/instance/setDataStatus.d.ts +2 -2
  161. package/dist/redux/reducers/app/instance/updateInstance.d.ts +2 -2
  162. package/dist/redux/reducers/app/instance/updateInstancePaid.d.ts +2 -2
  163. package/dist/redux/reducers/app/meta/fetchModelFailed.d.ts +1 -1
  164. package/dist/redux/reducers/app/meta/fetchModelFailed.js +1 -1
  165. package/dist/redux/reducers/app/meta/fetchModelNonBlocking.d.ts +1 -1
  166. package/dist/redux/reducers/app/meta/fetchModelNonBlocking.js +1 -1
  167. package/dist/redux/reducers/app/meta/fetchModelSucceeded.d.ts +1 -1
  168. package/dist/redux/reducers/app/meta/fetchModelSucceeded.js +1 -1
  169. package/dist/redux/reducers/app/meta/fetchModelUnhealthy.d.ts +2 -2
  170. package/dist/redux/reducers/app/meta/fetchModelUnhealthy.js +1 -1
  171. package/dist/redux/reducers/app/meta/fetchModelUserLocked.d.ts +1 -1
  172. package/dist/redux/reducers/app/meta/fetchModelUserLocked.js +1 -1
  173. package/dist/redux/reducers/app/meta/initMeta.d.ts +2 -2
  174. package/dist/redux/reducers/app/meta/setModelUuid.d.ts +2 -2
  175. package/dist/redux/reducers/app/pagination/goNextPage.d.ts +1 -1
  176. package/dist/redux/reducers/app/pagination/goNextPage.js +1 -1
  177. package/dist/redux/reducers/app/pagination/goPage.d.ts +2 -2
  178. package/dist/redux/reducers/app/pagination/goPage.js +2 -2
  179. package/dist/redux/reducers/app/pagination/goPreviousPage.d.ts +1 -1
  180. package/dist/redux/reducers/app/pagination/goPreviousPage.js +1 -1
  181. package/dist/redux/reducers/app/pagination/initPagination.d.ts +2 -2
  182. package/dist/redux/reducers/app/pagination/initPagination.js +1 -1
  183. package/dist/redux/reducers/app/pagination/updateAvailableAppStates.d.ts +2 -2
  184. package/dist/redux/reducers/app/pagination/updateAvailableAppStates.js +5 -5
  185. package/dist/redux/reducers/app/wizard/updateAvailableSections.d.ts +2 -2
  186. package/dist/redux/reducers/app/wizard/updateAvailableSections.js +2 -2
  187. package/dist/redux/reducers/app.d.ts +2 -2
  188. package/dist/redux/reducers/app.js +30 -30
  189. package/dist/redux/reducers/conditions/addMultipleOccurency.d.ts +2 -2
  190. package/dist/redux/reducers/conditions/addMultipleOccurency.js +3 -3
  191. package/dist/redux/reducers/conditions/deleteMultipleOccurency.d.ts +2 -2
  192. package/dist/redux/reducers/conditions/deleteMultipleOccurency.js +2 -2
  193. package/dist/redux/reducers/conditions/initConditions.d.ts +2 -2
  194. package/dist/redux/reducers/conditions/updateDocumentConditions.d.ts +2 -2
  195. package/dist/redux/reducers/conditions/updateOptionConditions.d.ts +2 -2
  196. package/dist/redux/reducers/conditions/updateOptionValidatorCondition.d.ts +2 -2
  197. package/dist/redux/reducers/conditions/updatePrefillerConditions.d.ts +2 -2
  198. package/dist/redux/reducers/conditions/updatePrefillerConditions.js +2 -2
  199. package/dist/redux/reducers/conditions/updateSectionConditions.d.ts +2 -2
  200. package/dist/redux/reducers/conditions/updateVariableConditions.d.ts +2 -2
  201. package/dist/redux/reducers/conditions/updateVariableValidatorCondition.d.ts +2 -2
  202. package/dist/redux/reducers/conditions.d.ts +2 -2
  203. package/dist/redux/reducers/conditions.js +13 -13
  204. package/dist/redux/reducers/inputs/addMultipleOccurency.d.ts +2 -2
  205. package/dist/redux/reducers/inputs/addMultipleOccurency.js +4 -4
  206. package/dist/redux/reducers/inputs/deleteMultipleOccurency.d.ts +2 -2
  207. package/dist/redux/reducers/inputs/deleteMultipleOccurency.js +2 -2
  208. package/dist/redux/reducers/inputs/initOption.d.ts +2 -2
  209. package/dist/redux/reducers/inputs/initVariable.d.ts +2 -2
  210. package/dist/redux/reducers/inputs/updateOptionInput.d.ts +2 -2
  211. package/dist/redux/reducers/inputs/updateVariableInput.d.ts +2 -2
  212. package/dist/redux/reducers/inputs.d.ts +2 -2
  213. package/dist/redux/reducers/inputs.js +8 -8
  214. package/dist/redux/reducers/mandatories/addMultipleOccurency.d.ts +2 -2
  215. package/dist/redux/reducers/mandatories/addMultipleOccurency.js +2 -2
  216. package/dist/redux/reducers/mandatories/deleteMultipleOccurency.d.ts +2 -2
  217. package/dist/redux/reducers/mandatories/deleteMultipleOccurency.js +2 -2
  218. package/dist/redux/reducers/mandatories/initMandatoryOption.d.ts +2 -2
  219. package/dist/redux/reducers/mandatories/initMandatoryVariable.d.ts +2 -2
  220. package/dist/redux/reducers/mandatories/setMandatoryIgnore.d.ts +2 -2
  221. package/dist/redux/reducers/mandatories/setMandatoryOption.d.ts +2 -2
  222. package/dist/redux/reducers/mandatories/setMandatorySection.d.ts +2 -2
  223. package/dist/redux/reducers/mandatories/setMandatoryVariable.d.ts +2 -2
  224. package/dist/redux/reducers/mandatories.d.ts +2 -2
  225. package/dist/redux/reducers/mandatories.js +11 -11
  226. package/dist/redux/reducers/references/initReferences.d.ts +2 -2
  227. package/dist/redux/reducers/references/updateOptionMeta.d.ts +2 -2
  228. package/dist/redux/reducers/references/updateOptionMeta.js +2 -2
  229. package/dist/redux/reducers/references/updateVariableMeta.d.ts +2 -2
  230. package/dist/redux/reducers/references/updateVariableMeta.js +2 -2
  231. package/dist/redux/reducers/references.d.ts +2 -2
  232. package/dist/redux/reducers/references.js +5 -5
  233. package/dist/redux/reducers/smartscript/enableSmartScript.d.ts +1 -1
  234. package/dist/redux/reducers/smartscript/initSmartScriptTriggers.d.ts +2 -2
  235. package/dist/redux/reducers/smartscript/updateSmartscriptOptionHidden.d.ts +2 -2
  236. package/dist/redux/reducers/smartscript/updateSmartscriptVariableHidden.d.ts +2 -2
  237. package/dist/redux/reducers/smartscript.d.ts +2 -2
  238. package/dist/redux/reducers/smartscript.js +6 -6
  239. package/dist/redux/reducers/user/initUser.d.ts +2 -2
  240. package/dist/redux/reducers/user/setUserStatus.d.ts +2 -2
  241. package/dist/redux/reducers/user/setUserValidToken.d.ts +2 -2
  242. package/dist/redux/reducers/user.d.ts +2 -2
  243. package/dist/redux/reducers/user.js +9 -9
  244. package/dist/redux/routerHistory.d.ts +2 -2
  245. package/dist/redux/routerHistory.js +5 -5
  246. package/dist/redux/sagas/fetchModel.d.ts +4 -4
  247. package/dist/redux/sagas/fetchModel.js +79 -131
  248. package/dist/redux/sagas/fetchModel.test.js +2 -3
  249. package/dist/redux/sagas/homogeneousRadioInputsSaga.js +5 -5
  250. package/dist/redux/sagas/initInputs.d.ts +5 -0
  251. package/dist/redux/sagas/initInputs.js +63 -0
  252. package/dist/redux/sagas/runner.d.ts +1 -1
  253. package/dist/redux/sagas/runner.js +7 -5
  254. package/dist/redux/sagas/saveData.js +34 -25
  255. package/dist/redux/sagas/setDefaults.js +8 -8
  256. package/dist/redux/sagas/setUserEmail.js +43 -43
  257. package/dist/redux/selectors/app.d.ts +1 -0
  258. package/dist/redux/selectors/app.js +26 -25
  259. package/dist/redux/selectors/conditions.js +34 -34
  260. package/dist/redux/selectors/inputs.d.ts +1 -1
  261. package/dist/redux/selectors/inputs.js +8 -8
  262. package/dist/{componentsConnectors/connector/connectorSelectors.d.ts → redux/selectors/library.d.ts} +17 -16
  263. package/dist/redux/selectors/library.js +8 -0
  264. package/dist/redux/selectors/mandatories.js +10 -10
  265. package/dist/redux/selectors/references.d.ts +1 -0
  266. package/dist/redux/selectors/references.js +20 -19
  267. package/dist/redux/selectors/selectors.d.ts +2 -2
  268. package/dist/redux/selectors/selectors.js +2 -2
  269. package/dist/redux/selectors/smartscript.js +5 -5
  270. package/dist/redux/selectors/user.js +5 -5
  271. package/dist/redux/store.d.ts +6 -2
  272. package/dist/redux/store.js +31 -31
  273. package/dist/service/api.manager.d.ts +2 -2
  274. package/dist/service/api.manager.js +46 -46
  275. package/dist/service/auth.service.js +2 -2
  276. package/dist/service/pardot.service.js +2 -2
  277. package/dist/tests-misc/plugins/jestTestPlugin/after.d.ts +1 -1
  278. package/dist/tests-misc/plugins/jestTestPlugin/after.js +2 -2
  279. package/dist/tests-misc/plugins/jestTestPlugin/before.d.ts +1 -1
  280. package/dist/tests-misc/plugins/jestTestPlugin/before.js +2 -5
  281. package/dist/tests-misc/plugins/jestTestPlugin/index.js +4 -4
  282. package/dist/tests-misc/plugins/jestTestPlugin/title.d.ts +1 -1
  283. package/dist/tests-misc/plugins/jestTestPlugin/title.js +2 -2
  284. package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.d.ts +0 -1
  285. package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.js +2 -2
  286. package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.d.ts +0 -1
  287. package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.js +2 -2
  288. package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.d.ts +0 -1
  289. package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.js +2 -2
  290. package/dist/tests-misc/themes/jestTestTheme/faltyIndex.js +1 -1
  291. package/dist/tests-misc/themes/jestTestTheme/faltyIndexLoader.js +1 -1
  292. package/dist/tests-misc/themes/jestTestTheme/index.js +4 -4
  293. package/dist/types/Actions.type.d.ts +42 -37
  294. package/dist/types/Components.type.d.ts +4 -5
  295. package/dist/types/State.type.d.ts +9 -9
  296. package/dist/types/Termsheet.type.d.ts +4 -4
  297. package/dist/types/api.type.d.ts +4 -4
  298. package/dist/types/config.type.d.ts +2 -3
  299. package/dist/types/getActions.type.d.ts +2 -2
  300. package/dist/types/getConnectors.type.d.ts +2 -3
  301. package/dist/types/getSelectors.type.d.ts +2 -2
  302. package/dist/wizard-params.d.ts +1 -1
  303. package/dist/wizard-params.js +16 -16
  304. package/jest.config.ts +1 -1
  305. package/package.json +16 -8
  306. package/setupJest.ts +8 -0
  307. package/src/App.tsx +22 -25
  308. package/src/Globals.ts +12 -8
  309. package/src/Loader.tsx +8 -0
  310. package/src/PluginLoader.tsx +20 -37
  311. package/src/Shimmer.tsx +58 -45
  312. package/src/ThemeLoader.test.tsx +1 -0
  313. package/src/ThemeLoader.tsx +27 -42
  314. package/src/components/PluginRoute.tsx +8 -6
  315. package/src/components/SmartScript.tsx +29 -28
  316. package/src/components/UserLocked/UserLockedComponent.tsx +3 -3
  317. package/src/components/View.test.tsx +3 -0
  318. package/src/components/View.tsx +52 -54
  319. package/src/componentsConnectors/connectBox.tsx +6 -6
  320. package/src/componentsConnectors/connectDocument.tsx +6 -6
  321. package/src/componentsConnectors/connectHeader.tsx +2 -2
  322. package/src/componentsConnectors/connectMetaTitle.tsx +2 -2
  323. package/src/componentsConnectors/connectOption.tsx +11 -11
  324. package/src/componentsConnectors/connectPagination.tsx +3 -3
  325. package/src/componentsConnectors/connectPreview.tsx +2 -2
  326. package/src/componentsConnectors/connectProgress.tsx +3 -3
  327. package/src/componentsConnectors/connectRootOption.tsx +4 -4
  328. package/src/componentsConnectors/connectSection.tsx +4 -4
  329. package/src/componentsConnectors/connectSummary.tsx +2 -2
  330. package/src/componentsConnectors/connectSummaryItem.tsx +6 -6
  331. package/src/componentsConnectors/connectTermsheet.tsx +46 -46
  332. package/src/componentsConnectors/connectVariable.tsx +11 -11
  333. package/src/componentsConnectors/connectWizardWrapper.tsx +4 -4
  334. package/src/componentsConnectors/connector/componentConnector.tsx +22 -20
  335. package/src/componentsConnectors/library.ts +35 -0
  336. package/src/config.test.ts +2 -1
  337. package/src/config.ts +1 -1
  338. package/src/constants/phoneValidation.ts +6 -0
  339. package/src/definitions/path.join.d.ts +1 -1
  340. package/src/helpers/outputsParsing.ts +26 -26
  341. package/src/helpers/preloadTheme.ts +2 -2
  342. package/src/helpers/scriptsLoader.ts +20 -0
  343. package/src/helpers/sendinblueHelper.ts +23 -17
  344. package/src/hooks/usePrevious.ts +1 -1
  345. package/src/libs/ConditionsInitiator.ts +3 -3
  346. package/src/libs/ConditionsRunner/DataPopulator.ts +7 -7
  347. package/src/libs/ConditionsRunner.ts +53 -53
  348. package/src/libs/DocumentsOutputs.ts +7 -7
  349. package/src/libs/Eval/EvalBase.ts +17 -17
  350. package/src/libs/Eval/EvalFunctions.ts +100 -100
  351. package/src/libs/Eval/NumbersToLetters.ts +48 -48
  352. package/src/libs/EvalVariable.ts +34 -31
  353. package/src/libs/EventsTracking.ts +38 -38
  354. package/src/libs/Extracts.ts +21 -21
  355. package/src/libs/InputsInitiator.ts +16 -16
  356. package/src/libs/NumAuto.ts +1 -1
  357. package/src/libs/OvcConverter.ts +25 -25
  358. package/src/libs/PathReader.ts +23 -23
  359. package/src/libs/SectionValidity.ts +3 -3
  360. package/src/libs/SmartScriptStore.ts +40 -40
  361. package/src/misc/test_model.ts +3809 -3809
  362. package/src/polyfills/index.ts +5 -0
  363. package/src/polyfills/prepend.ts +2 -2
  364. package/src/polyfills/stringRepeat.ts +4 -4
  365. package/src/redux/actions/app.ts +13 -13
  366. package/src/redux/actions/conditions.ts +3 -3
  367. package/src/redux/actions/inputs.ts +18 -2
  368. package/src/redux/actions/library.ts +23 -0
  369. package/src/redux/actions/mandatories.ts +2 -2
  370. package/src/redux/actions/references.ts +5 -5
  371. package/src/redux/actions/sagas/data.ts +2 -2
  372. package/src/redux/actions/sagas/model.ts +6 -6
  373. package/src/redux/actions/sagas/user.ts +2 -2
  374. package/src/redux/actions/smartscript.ts +4 -4
  375. package/src/redux/actions/user.ts +5 -5
  376. package/src/redux/constants/app.ts +22 -22
  377. package/src/redux/constants/conditions.ts +8 -8
  378. package/src/redux/constants/inputs.ts +8 -6
  379. package/src/redux/constants/mandatories.ts +6 -6
  380. package/src/redux/constants/references.ts +3 -3
  381. package/src/redux/constants/sagas/data.ts +1 -1
  382. package/src/redux/constants/sagas/model.ts +2 -2
  383. package/src/redux/constants/sagas/user.ts +2 -2
  384. package/src/redux/constants/smartscript.ts +4 -4
  385. package/src/redux/constants/user.ts +3 -3
  386. package/src/redux/listeners/subscriber.ts +2 -2
  387. package/src/redux/middlewares/conditionsWatcherMiddleware.ts +31 -31
  388. package/src/redux/middlewares/evaluationsWatcherMiddleware.test.ts +1 -1
  389. package/src/redux/middlewares/evaluationsWatcherMiddleware.ts +13 -13
  390. package/src/redux/middlewares/mandatoriesWatcherMiddleware.ts +16 -16
  391. package/src/redux/middlewares/multiplesActionsMiddleware.ts +6 -6
  392. package/src/redux/middlewares/paginationWatcherMiddleware.ts +27 -27
  393. package/src/redux/middlewares/pluginsHookMiddleware.ts +2 -2
  394. package/src/redux/middlewares/prefillerWatcherMiddleware.ts +31 -31
  395. package/src/redux/middlewares/smartscriptMiddleware.ts +61 -20
  396. package/src/redux/middlewares/thirdpartyScriptsMiddleware.ts +41 -0
  397. package/src/redux/reducers/app/customizations/initCustomizationAutoDefault.ts +2 -2
  398. package/src/redux/reducers/app/customizations/initCustomizationMeta.ts +2 -2
  399. package/src/redux/reducers/app/instance/initInstance.ts +2 -2
  400. package/src/redux/reducers/app/instance/setDataStatus.ts +2 -2
  401. package/src/redux/reducers/app/instance/updateInstance.ts +2 -2
  402. package/src/redux/reducers/app/instance/updateInstancePaid.ts +2 -2
  403. package/src/redux/reducers/app/meta/fetchModelFailed.ts +2 -2
  404. package/src/redux/reducers/app/meta/fetchModelNonBlocking.ts +2 -2
  405. package/src/redux/reducers/app/meta/fetchModelSucceeded.ts +2 -2
  406. package/src/redux/reducers/app/meta/fetchModelUnhealthy.ts +3 -3
  407. package/src/redux/reducers/app/meta/fetchModelUserLocked.ts +2 -2
  408. package/src/redux/reducers/app/meta/initMeta.ts +2 -2
  409. package/src/redux/reducers/app/meta/setModelUuid.ts +2 -2
  410. package/src/redux/reducers/app/pagination/goNextPage.ts +2 -2
  411. package/src/redux/reducers/app/pagination/goPage.ts +4 -4
  412. package/src/redux/reducers/app/pagination/goPreviousPage.ts +2 -2
  413. package/src/redux/reducers/app/pagination/initPagination.ts +3 -3
  414. package/src/redux/reducers/app/pagination/updateAvailableAppStates.ts +7 -7
  415. package/src/redux/reducers/app/wizard/updateAvailableSections.ts +4 -4
  416. package/src/redux/reducers/app.ts +32 -32
  417. package/src/redux/reducers/conditions/addMultipleOccurency.ts +5 -5
  418. package/src/redux/reducers/conditions/deleteMultipleOccurency.ts +4 -4
  419. package/src/redux/reducers/conditions/initConditions.ts +2 -2
  420. package/src/redux/reducers/conditions/updateDocumentConditions.ts +2 -2
  421. package/src/redux/reducers/conditions/updateOptionConditions.ts +2 -2
  422. package/src/redux/reducers/conditions/updateOptionValidatorCondition.ts +2 -2
  423. package/src/redux/reducers/conditions/updatePrefillerConditions.ts +4 -4
  424. package/src/redux/reducers/conditions/updateSectionConditions.ts +2 -2
  425. package/src/redux/reducers/conditions/updateVariableConditions.ts +2 -2
  426. package/src/redux/reducers/conditions/updateVariableValidatorCondition.ts +2 -2
  427. package/src/redux/reducers/conditions.ts +15 -15
  428. package/src/redux/reducers/inputs/addMultipleOccurency.ts +6 -6
  429. package/src/redux/reducers/inputs/deleteMultipleOccurency.ts +4 -4
  430. package/src/redux/reducers/inputs/initOption.ts +2 -2
  431. package/src/redux/reducers/inputs/initVariable.ts +2 -2
  432. package/src/redux/reducers/inputs/updateOptionInput.ts +2 -2
  433. package/src/redux/reducers/inputs/updateVariableInput.ts +2 -2
  434. package/src/redux/reducers/inputs.ts +10 -10
  435. package/src/redux/reducers/mandatories/addMultipleOccurency.ts +4 -4
  436. package/src/redux/reducers/mandatories/deleteMultipleOccurency.ts +4 -4
  437. package/src/redux/reducers/mandatories/initMandatoryOption.ts +2 -2
  438. package/src/redux/reducers/mandatories/initMandatoryVariable.ts +2 -2
  439. package/src/redux/reducers/mandatories/setMandatoryIgnore.ts +2 -2
  440. package/src/redux/reducers/mandatories/setMandatoryOption.ts +2 -2
  441. package/src/redux/reducers/mandatories/setMandatorySection.ts +2 -2
  442. package/src/redux/reducers/mandatories/setMandatoryVariable.ts +2 -2
  443. package/src/redux/reducers/mandatories.ts +13 -13
  444. package/src/redux/reducers/references/initReferences.ts +2 -2
  445. package/src/redux/reducers/references/updateOptionMeta.ts +4 -4
  446. package/src/redux/reducers/references/updateVariableMeta.ts +4 -4
  447. package/src/redux/reducers/references.ts +7 -7
  448. package/src/redux/reducers/smartscript/enableSmartScript.ts +1 -1
  449. package/src/redux/reducers/smartscript/initSmartScriptTriggers.ts +2 -2
  450. package/src/redux/reducers/smartscript/updateSmartscriptOptionHidden.ts +2 -2
  451. package/src/redux/reducers/smartscript/updateSmartscriptVariableHidden.ts +2 -2
  452. package/src/redux/reducers/smartscript.ts +8 -8
  453. package/src/redux/reducers/user/initUser.ts +2 -2
  454. package/src/redux/reducers/user/setUserStatus.ts +2 -2
  455. package/src/redux/reducers/user/setUserValidToken.ts +2 -2
  456. package/src/redux/reducers/user.ts +11 -11
  457. package/src/redux/routerHistory.ts +6 -6
  458. package/src/redux/sagas/fetchModel.test.ts +2 -5
  459. package/src/redux/sagas/fetchModel.ts +86 -187
  460. package/src/redux/sagas/homogeneousRadioInputsSaga.ts +6 -6
  461. package/src/redux/sagas/initInputs.ts +110 -0
  462. package/src/redux/sagas/runner.ts +8 -6
  463. package/src/redux/sagas/saveData.ts +32 -28
  464. package/src/redux/sagas/setDefaults.ts +8 -8
  465. package/src/redux/sagas/setUserEmail.ts +46 -45
  466. package/src/redux/selectors/app.ts +34 -28
  467. package/src/redux/selectors/conditions.ts +41 -41
  468. package/src/redux/selectors/inputs.ts +10 -10
  469. package/src/redux/selectors/library.ts +17 -0
  470. package/src/redux/selectors/mandatories.ts +10 -10
  471. package/src/redux/selectors/references.ts +25 -21
  472. package/src/redux/selectors/selectors.ts +4 -4
  473. package/src/redux/selectors/smartscript.ts +6 -6
  474. package/src/redux/selectors/user.ts +8 -8
  475. package/src/redux/store.ts +42 -32
  476. package/src/service/api.manager.ts +53 -53
  477. package/src/service/auth.service.ts +2 -2
  478. package/src/service/pardot.service.ts +2 -2
  479. package/src/tests-misc/plugins/jestTestPlugin/after.tsx +1 -1
  480. package/src/tests-misc/plugins/jestTestPlugin/before.tsx +1 -1
  481. package/src/tests-misc/plugins/jestTestPlugin/index.ts +4 -4
  482. package/src/tests-misc/plugins/jestTestPlugin/title.tsx +2 -2
  483. package/src/tests-misc/themes/jestTestTheme/components/EmailComponent.tsx +1 -1
  484. package/src/tests-misc/themes/jestTestTheme/components/TermsheetComponent.tsx +1 -1
  485. package/src/tests-misc/themes/jestTestTheme/components/WizardComponent.tsx +1 -1
  486. package/src/tests-misc/themes/jestTestTheme/faltyIndex.ts +1 -1
  487. package/src/tests-misc/themes/jestTestTheme/faltyIndexLoader.ts +1 -1
  488. package/src/tests-misc/themes/jestTestTheme/index.ts +4 -4
  489. package/src/types/Actions.type.ts +63 -55
  490. package/src/types/Components.type.ts +4 -4
  491. package/src/types/State.type.ts +14 -14
  492. package/src/types/Termsheet.type.ts +4 -4
  493. package/src/types/api.type.ts +4 -4
  494. package/src/types/config.type.ts +3 -3
  495. package/src/types/getActions.type.ts +2 -2
  496. package/src/types/getConnectors.type.ts +2 -2
  497. package/src/types/getSelectors.type.ts +2 -2
  498. package/src/wizard-params.ts +17 -17
  499. package/tsconfig.json +1 -1
  500. package/dist/componentsConnectors/connector/connectorSelectors.js +0 -9
  501. package/dist/componentsConnectors/index.d.ts +0 -16
  502. package/dist/componentsConnectors/index.js +0 -16
  503. package/dist/constants/index.d.ts +0 -1
  504. package/dist/constants/index.js +0 -1
  505. package/dist/helpers/index.d.ts +0 -2
  506. package/dist/helpers/index.js +0 -2
  507. package/dist/hooks/index.d.ts +0 -1
  508. package/dist/hooks/index.js +0 -1
  509. package/dist/index.d.ts +0 -23
  510. package/dist/index.js +0 -23
  511. package/dist/libs/index.d.ts +0 -12
  512. package/dist/libs/index.js +0 -12
  513. package/dist/redux/actions/index.d.ts +0 -8
  514. package/dist/redux/actions/index.js +0 -8
  515. package/dist/redux/actions/sagas/index.d.ts +0 -3
  516. package/dist/redux/actions/sagas/index.js +0 -3
  517. package/dist/redux/constants/index.d.ts +0 -8
  518. package/dist/redux/constants/index.js +0 -8
  519. package/dist/redux/constants/sagas/index.d.ts +0 -3
  520. package/dist/redux/constants/sagas/index.js +0 -3
  521. package/dist/redux/index.d.ts +0 -4
  522. package/dist/redux/index.js +0 -4
  523. package/dist/redux/selectors/index.d.ts +0 -7
  524. package/dist/redux/selectors/index.js +0 -7
  525. package/dist/service/index.d.ts +0 -3
  526. package/dist/service/index.js +0 -3
  527. package/dist/types/index.d.ts +0 -10
  528. package/dist/types/index.js +0 -10
  529. package/src/componentsConnectors/connector/connectorSelectors.ts +0 -19
  530. package/src/componentsConnectors/index.ts +0 -16
  531. package/src/constants/index.ts +0 -1
  532. package/src/helpers/index.ts +0 -2
  533. package/src/hooks/index.ts +0 -1
  534. package/src/index.ts +0 -47
  535. package/src/libs/index.ts +0 -12
  536. package/src/redux/actions/index.ts +0 -8
  537. package/src/redux/actions/sagas/index.ts +0 -3
  538. package/src/redux/constants/index.ts +0 -8
  539. package/src/redux/constants/sagas/index.ts +0 -3
  540. package/src/redux/index.ts +0 -4
  541. package/src/redux/selectors/index.ts +0 -7
  542. package/src/service/index.ts +0 -3
  543. 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: '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',
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, '').length > 15)
53
- throw new Error('Capacity overrun');
54
- if (Number.isNaN(number.toString().replace(/ /gi, '')))
55
- throw new Error('Unvalid number');
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('0')
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 ` : ' virgule ') +
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 = 'cent';
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 = 'mille';
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 = 'un million';
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 = 'un milliard';
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 = 'un billion';
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 - 'quatre-vingt'.length,
178
- 'quatre-vingt'.length
179
- ) === 'quatre-vingt'
177
+ numberToLetter.length - "quatre-vingt".length,
178
+ "quatre-vingt".length
179
+ ) === "quatre-vingt"
180
180
  )
181
- numberToLetter += 's';
181
+ numberToLetter += "s";
182
182
 
183
183
  return numberToLetter;
184
184
  }
@@ -1,6 +1,7 @@
1
- import type { VariableV3 } from '@legalplace/models-v3-types';
2
- import { selectVariableReference } from '../redux/selectors/references';
3
- import { EvalFunctions } from './Eval/EvalFunctions';
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 === 'string' ? variable.eval?.formula : '0';
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 === 'string' && value.trim().length === 0) {
70
- value = '___EMPTY___';
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 === 'number' ? value.toString() : value;
87
+ value = typeof value === "number" ? value.toString() : value;
87
88
  operation = operation.replace(
88
- new RegExp(`\\[var:${variableId}\\]`, 'g'),
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.forEach((formula) => {
136
- const reg = new RegExp(regex, 'gi');
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(';') > -1 ? ';' : ',')
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
- 'font-weight: bold;',
157
- 'font-weight: initial'
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 !== 'string' ||
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 === 'string'
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 ? '' : 0;
207
+ result = this.hasFunctions === true ? "" : 0;
205
208
  }
206
209
  }
207
210
  } catch (e) {
208
211
  result =
209
- this.hasFunctions === true || this.abortEvaluation === true ? '' : 0;
212
+ this.hasFunctions === true || this.abortEvaluation === true ? "" : 0;
210
213
  }
211
214
 
212
215
  // Rounding
213
- if (typeof result === 'number') {
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 === 'number' && !Number.isNaN(decimals)) ||
220
- typeof decimals === 'string'
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 === 'string'
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,5 +1,5 @@
1
- import Cookies from 'universal-cookie';
2
- import Globals from '../Globals';
1
+ import Cookies from "universal-cookie";
2
+ import Globals from "../Globals";
3
3
 
4
4
  export type EventsPropsType = Record<
5
5
  string,
@@ -51,21 +51,21 @@ class _EventsTracking {
51
51
  private init() {
52
52
  this.initiated = true;
53
53
  this.register({
54
- 'WizardX Build Commit':
55
- process.env.REACT_APP_COMMIT || 'Unkown build commit',
56
- Environement: Globals.env,
57
- 'Powered By': 'WizardX',
54
+ "WizardX Build Commit":
55
+ process.env.REACT_APP_COMMIT || "Unkown build commit",
56
+ Environement: Globals.appEnv,
57
+ "Powered By": "WizardX",
58
58
  ...this.getXSource(),
59
59
  });
60
- this.trigger('wizardx');
60
+ this.trigger("wizardx");
61
61
  }
62
62
 
63
63
  private getXSource(): Record<string, string> {
64
- const xSource = cookie.get('X-Source');
64
+ const xSource = cookie.get("X-Source");
65
65
 
66
- return typeof xSource === 'string' && xSource.trim().length > 0
66
+ return typeof xSource === "string" && xSource.trim().length > 0
67
67
  ? {
68
- 'X-Source': xSource,
68
+ "X-Source": xSource,
69
69
  }
70
70
  : {};
71
71
  }
@@ -87,25 +87,25 @@ class _EventsTracking {
87
87
  let fn: (...a: any) => any;
88
88
 
89
89
  switch (fnName) {
90
- case 'trackMix':
90
+ case "trackMix":
91
91
  fn = this.trackMix.bind(this);
92
92
  break;
93
- case 'trackFB':
93
+ case "trackFB":
94
94
  fn = this.trackFB.bind(this);
95
95
  break;
96
- case 'trackGA':
96
+ case "trackGA":
97
97
  fn = this.trackGA.bind(this);
98
98
  break;
99
- case 'trackSIB':
99
+ case "trackSIB":
100
100
  fn = this.trackSIB.bind(this);
101
101
  break;
102
- case 'registerMix':
102
+ case "registerMix":
103
103
  fn = this.registerMix.bind(this);
104
104
  break;
105
- case 'registerFB':
105
+ case "registerFB":
106
106
  fn = this.registerFB.bind(this);
107
107
  break;
108
- case 'triggerHj':
108
+ case "triggerHj":
109
109
  fn = this.triggerHj.bind(this);
110
110
  break;
111
111
  default:
@@ -138,14 +138,14 @@ class _EventsTracking {
138
138
  ) {
139
139
  if (!this.initiated) this.init();
140
140
 
141
- if (typeof window.mixpanel !== 'undefined') {
141
+ if (typeof window.mixpanel !== "undefined") {
142
142
  if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
143
143
  window.mixpanel.track(eventName, eventProps);
144
144
  return true;
145
145
  }
146
146
 
147
147
  if (doNotPushToQueue === false)
148
- this.queue.push(['trackMix', [eventName, eventProps]]);
148
+ this.queue.push(["trackMix", [eventName, eventProps]]);
149
149
 
150
150
  this.queueTimeout();
151
151
  return false;
@@ -158,14 +158,14 @@ class _EventsTracking {
158
158
  ) {
159
159
  if (!this.initiated) this.init();
160
160
 
161
- if (typeof window.sendinblue !== 'undefined') {
161
+ if (typeof window.sendinblue !== "undefined") {
162
162
  if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
163
163
  window.sendinblue.track(eventName, eventProps);
164
164
  return true;
165
165
  }
166
166
 
167
167
  if (doNotPushToQueue === false)
168
- this.queue.push(['trackSIB', [eventName, eventProps]]);
168
+ this.queue.push(["trackSIB", [eventName, eventProps]]);
169
169
 
170
170
  this.queueTimeout();
171
171
  return false;
@@ -176,14 +176,14 @@ class _EventsTracking {
176
176
  eventProps?: EventsPropsType,
177
177
  doNotPushToQueue = false
178
178
  ) {
179
- if (typeof window.fbq !== 'undefined') {
179
+ if (typeof window.fbq !== "undefined") {
180
180
  if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
181
- window.fbq('trackCustom', eventName, eventProps);
181
+ window.fbq("trackCustom", eventName, eventProps);
182
182
  return true;
183
183
  }
184
184
 
185
185
  if (doNotPushToQueue === false)
186
- this.queue.push(['trackFB', [eventName, eventProps]]);
186
+ this.queue.push(["trackFB", [eventName, eventProps]]);
187
187
 
188
188
  this.queueTimeout();
189
189
  return false;
@@ -194,13 +194,13 @@ class _EventsTracking {
194
194
  eventProps?: EventsPropsType,
195
195
  doNotPushToQueue = false
196
196
  ) {
197
- if (typeof window.ga !== 'undefined') {
197
+ if (typeof window.ga !== "undefined") {
198
198
  if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
199
199
  window.ga(
200
- 'send',
201
- 'event',
202
- 'lpTracking',
203
- 'track',
200
+ "send",
201
+ "event",
202
+ "lpTracking",
203
+ "track",
204
204
  eventName,
205
205
  1,
206
206
  eventProps
@@ -209,43 +209,43 @@ class _EventsTracking {
209
209
  }
210
210
 
211
211
  if (doNotPushToQueue === false)
212
- this.queue.push(['trackGA', [eventName, eventProps]]);
212
+ this.queue.push(["trackGA", [eventName, eventProps]]);
213
213
 
214
214
  this.queueTimeout();
215
215
  return false;
216
216
  }
217
217
 
218
218
  private registerMix(props: EventsPropsType, doNotPushToQueue = false) {
219
- if (typeof window.mixpanel !== 'undefined') {
219
+ if (typeof window.mixpanel !== "undefined") {
220
220
  if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
221
221
  window.mixpanel.register(props);
222
222
  return true;
223
223
  }
224
- if (doNotPushToQueue === false) this.queue.push(['registerMix', [props]]);
224
+ if (doNotPushToQueue === false) this.queue.push(["registerMix", [props]]);
225
225
 
226
226
  this.queueTimeout();
227
227
  return false;
228
228
  }
229
229
 
230
230
  private registerFB(props: EventsPropsType, doNotPushToQueue = false) {
231
- if (typeof window.fbq !== 'undefined') {
231
+ if (typeof window.fbq !== "undefined") {
232
232
  if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
233
- window.fbq('trackCustom', 'GeneralProps', props);
233
+ window.fbq("trackCustom", "GeneralProps", props);
234
234
  return true;
235
235
  }
236
- if (doNotPushToQueue === false) this.queue.push(['registerFB', [props]]);
236
+ if (doNotPushToQueue === false) this.queue.push(["registerFB", [props]]);
237
237
 
238
238
  this.queueTimeout();
239
239
  return false;
240
240
  }
241
241
 
242
242
  private triggerHj(name: string, doNotPushToQueue = false) {
243
- if (typeof window.hj !== 'undefined') {
243
+ if (typeof window.hj !== "undefined") {
244
244
  if (this.queue.length > 0 && !doNotPushToQueue) this.executeQueue();
245
- window.hj('trigger', name);
245
+ window.hj("trigger", name);
246
246
  return true;
247
247
  }
248
- if (doNotPushToQueue === false) this.queue.push(['triggerHj', [name]]);
248
+ if (doNotPushToQueue === false) this.queue.push(["triggerHj", [name]]);
249
249
 
250
250
  this.queueTimeout();
251
251
  return false;
@@ -1,15 +1,15 @@
1
- import type { ExtractV3 } from '@legalplace/models-v3-types';
2
- import { selectCustomizationMeta } from '../redux/selectors/app';
3
- import { selectUserEmail } from '../redux/selectors/user';
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 '../redux/selectors/inputs';
7
+ } from "../redux/selectors/inputs";
8
8
  import {
9
9
  selectOptionReference,
10
10
  selectVariableReference,
11
- } from '../redux/selectors/references';
12
- import { EventsTracking } from './EventsTracking';
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 === 'object' &&
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 === 'option') {
58
+ if (type === "option") {
59
59
  inputs = selectOptionInput(id).map((value) =>
60
- value === true ? 'True' : 'False'
60
+ value === true ? "True" : "False"
61
61
  );
62
62
  defaultName = selectOptionReference(id).meta.label;
63
- } else if (type === 'variable') {
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(', ').slice(0, -2) : inputs[0];
76
+ inputs.length > 1 ? inputs.join(", ").slice(0, -2) : inputs[0];
77
77
 
78
78
  // Slack
79
79
  if (
80
- typeof destination.slack === 'object' &&
81
- typeof destination.slack.channel === 'string' &&
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 === 'object' && value && value.trim()) {
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 === 'object') {
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: 'WizardX Extract Bot',
123
- icon_emoji: ':robot_face:',
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
- 'https://hooks.slack.com/services/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',
134
+ "https://hooks.slack.com/services/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",
135
135
  {
136
136
  body: JSON.stringify(json),
137
- method: 'POST',
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('Variable Extraction', this.mixpanelExtracts);
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('\n');
155
+ return lines.join("\n");
156
156
  }
157
157
  }
158
158