@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.
Files changed (539) hide show
  1. package/CHANGELOG.md +31 -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.d.ts +1 -0
  88. package/dist/libs/EventsTracking.js +38 -32
  89. package/dist/libs/Extracts.js +20 -20
  90. package/dist/libs/InputsInitiator.d.ts +1 -1
  91. package/dist/libs/InputsInitiator.js +15 -15
  92. package/dist/libs/NumAuto.js +1 -1
  93. package/dist/libs/OvcConverter.d.ts +1 -1
  94. package/dist/libs/OvcConverter.js +23 -23
  95. package/dist/libs/PathReader.d.ts +1 -1
  96. package/dist/libs/PathReader.js +22 -22
  97. package/dist/libs/SectionValidity.js +3 -3
  98. package/dist/libs/SmartScriptStore.d.ts +6 -6
  99. package/dist/libs/SmartScriptStore.js +33 -33
  100. package/dist/misc/test_model.d.ts +2 -2
  101. package/dist/misc/test_model.js +3807 -3807
  102. package/dist/polyfills/index.d.ts +5 -0
  103. package/dist/polyfills/index.js +5 -0
  104. package/dist/polyfills/prepend.js +2 -2
  105. package/dist/polyfills/stringRepeat.js +4 -4
  106. package/dist/redux/actions/app.d.ts +12 -12
  107. package/dist/redux/actions/app.js +1 -1
  108. package/dist/redux/actions/conditions.d.ts +2 -2
  109. package/dist/redux/actions/conditions.js +1 -1
  110. package/dist/redux/actions/inputs.d.ts +1 -1
  111. package/dist/redux/actions/inputs.js +1 -1
  112. package/dist/redux/actions/library.d.ts +73 -0
  113. package/dist/redux/actions/library.js +11 -0
  114. package/dist/redux/actions/mandatories.d.ts +1 -1
  115. package/dist/redux/actions/mandatories.js +1 -1
  116. package/dist/redux/actions/references.d.ts +4 -4
  117. package/dist/redux/actions/references.js +1 -1
  118. package/dist/redux/actions/sagas/data.d.ts +1 -1
  119. package/dist/redux/actions/sagas/data.js +1 -1
  120. package/dist/redux/actions/sagas/model.d.ts +3 -3
  121. package/dist/redux/actions/sagas/model.js +3 -3
  122. package/dist/redux/actions/sagas/user.d.ts +1 -1
  123. package/dist/redux/actions/sagas/user.js +1 -1
  124. package/dist/redux/actions/smartscript.d.ts +3 -3
  125. package/dist/redux/actions/smartscript.js +1 -1
  126. package/dist/redux/actions/user.d.ts +4 -4
  127. package/dist/redux/actions/user.js +1 -1
  128. package/dist/redux/constants/app.js +22 -22
  129. package/dist/redux/constants/conditions.js +8 -8
  130. package/dist/redux/constants/inputs.js +6 -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 +15 -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 +84 -88
  248. package/dist/redux/sagas/fetchModel.test.js +2 -3
  249. package/dist/redux/sagas/homogeneousRadioInputsSaga.js +5 -5
  250. package/dist/redux/sagas/runner.d.ts +1 -1
  251. package/dist/redux/sagas/runner.js +5 -5
  252. package/dist/redux/sagas/saveData.js +34 -25
  253. package/dist/redux/sagas/setDefaults.js +8 -8
  254. package/dist/redux/sagas/setUserEmail.js +43 -43
  255. package/dist/redux/selectors/app.d.ts +1 -0
  256. package/dist/redux/selectors/app.js +26 -25
  257. package/dist/redux/selectors/conditions.js +34 -34
  258. package/dist/redux/selectors/inputs.d.ts +1 -1
  259. package/dist/redux/selectors/inputs.js +8 -8
  260. package/dist/{componentsConnectors/connector/connectorSelectors.d.ts → redux/selectors/library.d.ts} +16 -16
  261. package/dist/redux/selectors/library.js +8 -0
  262. package/dist/redux/selectors/mandatories.js +10 -10
  263. package/dist/redux/selectors/references.js +19 -19
  264. package/dist/redux/selectors/selectors.d.ts +2 -2
  265. package/dist/redux/selectors/selectors.js +2 -2
  266. package/dist/redux/selectors/smartscript.js +5 -5
  267. package/dist/redux/selectors/user.js +5 -5
  268. package/dist/redux/store.d.ts +6 -2
  269. package/dist/redux/store.js +31 -31
  270. package/dist/service/api.manager.d.ts +2 -2
  271. package/dist/service/api.manager.js +46 -46
  272. package/dist/service/auth.service.js +2 -2
  273. package/dist/service/pardot.service.js +2 -2
  274. package/dist/tests-misc/plugins/jestTestPlugin/after.d.ts +1 -1
  275. package/dist/tests-misc/plugins/jestTestPlugin/after.js +2 -2
  276. package/dist/tests-misc/plugins/jestTestPlugin/before.d.ts +1 -1
  277. package/dist/tests-misc/plugins/jestTestPlugin/before.js +2 -5
  278. package/dist/tests-misc/plugins/jestTestPlugin/index.js +4 -4
  279. package/dist/tests-misc/plugins/jestTestPlugin/title.d.ts +1 -1
  280. package/dist/tests-misc/plugins/jestTestPlugin/title.js +2 -2
  281. package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.d.ts +0 -1
  282. package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.js +2 -2
  283. package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.d.ts +0 -1
  284. package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.js +2 -2
  285. package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.d.ts +0 -1
  286. package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.js +2 -2
  287. package/dist/tests-misc/themes/jestTestTheme/faltyIndex.js +1 -1
  288. package/dist/tests-misc/themes/jestTestTheme/faltyIndexLoader.js +1 -1
  289. package/dist/tests-misc/themes/jestTestTheme/index.js +4 -4
  290. package/dist/types/Actions.type.d.ts +37 -37
  291. package/dist/types/Components.type.d.ts +4 -5
  292. package/dist/types/State.type.d.ts +9 -9
  293. package/dist/types/Termsheet.type.d.ts +4 -4
  294. package/dist/types/api.type.d.ts +4 -4
  295. package/dist/types/config.type.d.ts +2 -3
  296. package/dist/types/getActions.type.d.ts +2 -2
  297. package/dist/types/getConnectors.type.d.ts +2 -3
  298. package/dist/types/getSelectors.type.d.ts +2 -2
  299. package/dist/wizard-params.d.ts +1 -1
  300. package/dist/wizard-params.js +16 -16
  301. package/jest.config.ts +1 -1
  302. package/package.json +16 -8
  303. package/setupJest.ts +8 -0
  304. package/src/App.tsx +22 -25
  305. package/src/Globals.ts +12 -8
  306. package/src/Loader.tsx +8 -0
  307. package/src/PluginLoader.tsx +20 -37
  308. package/src/Shimmer.tsx +58 -45
  309. package/src/ThemeLoader.test.tsx +1 -0
  310. package/src/ThemeLoader.tsx +27 -42
  311. package/src/components/PluginRoute.tsx +8 -6
  312. package/src/components/SmartScript.tsx +29 -28
  313. package/src/components/UserLocked/UserLockedComponent.tsx +3 -3
  314. package/src/components/View.test.tsx +3 -0
  315. package/src/components/View.tsx +52 -54
  316. package/src/componentsConnectors/connectBox.tsx +6 -6
  317. package/src/componentsConnectors/connectDocument.tsx +6 -6
  318. package/src/componentsConnectors/connectHeader.tsx +2 -2
  319. package/src/componentsConnectors/connectMetaTitle.tsx +2 -2
  320. package/src/componentsConnectors/connectOption.tsx +11 -11
  321. package/src/componentsConnectors/connectPagination.tsx +3 -3
  322. package/src/componentsConnectors/connectPreview.tsx +2 -2
  323. package/src/componentsConnectors/connectProgress.tsx +3 -3
  324. package/src/componentsConnectors/connectRootOption.tsx +4 -4
  325. package/src/componentsConnectors/connectSection.tsx +4 -4
  326. package/src/componentsConnectors/connectSummary.tsx +2 -2
  327. package/src/componentsConnectors/connectSummaryItem.tsx +6 -6
  328. package/src/componentsConnectors/connectTermsheet.tsx +46 -46
  329. package/src/componentsConnectors/connectVariable.tsx +11 -11
  330. package/src/componentsConnectors/connectWizardWrapper.tsx +4 -4
  331. package/src/componentsConnectors/connector/componentConnector.tsx +22 -20
  332. package/src/componentsConnectors/library.ts +35 -0
  333. package/src/config.test.ts +2 -1
  334. package/src/config.ts +1 -1
  335. package/src/constants/phoneValidation.ts +6 -0
  336. package/src/definitions/path.join.d.ts +1 -1
  337. package/src/helpers/outputsParsing.ts +26 -26
  338. package/src/helpers/preloadTheme.ts +2 -2
  339. package/src/helpers/scriptsLoader.ts +20 -0
  340. package/src/helpers/sendinblueHelper.ts +23 -17
  341. package/src/hooks/usePrevious.ts +1 -1
  342. package/src/libs/ConditionsInitiator.ts +3 -3
  343. package/src/libs/ConditionsRunner/DataPopulator.ts +7 -7
  344. package/src/libs/ConditionsRunner.ts +53 -53
  345. package/src/libs/DocumentsOutputs.ts +7 -7
  346. package/src/libs/Eval/EvalBase.ts +17 -17
  347. package/src/libs/Eval/EvalFunctions.ts +100 -100
  348. package/src/libs/Eval/NumbersToLetters.ts +48 -48
  349. package/src/libs/EvalVariable.ts +34 -31
  350. package/src/libs/EventsTracking.ts +48 -34
  351. package/src/libs/Extracts.ts +21 -21
  352. package/src/libs/InputsInitiator.ts +16 -16
  353. package/src/libs/NumAuto.ts +1 -1
  354. package/src/libs/OvcConverter.ts +25 -25
  355. package/src/libs/PathReader.ts +23 -23
  356. package/src/libs/SectionValidity.ts +3 -3
  357. package/src/libs/SmartScriptStore.ts +40 -40
  358. package/src/misc/test_model.ts +3809 -3809
  359. package/src/polyfills/index.ts +5 -0
  360. package/src/polyfills/prepend.ts +2 -2
  361. package/src/polyfills/stringRepeat.ts +4 -4
  362. package/src/redux/actions/app.ts +13 -13
  363. package/src/redux/actions/conditions.ts +3 -3
  364. package/src/redux/actions/inputs.ts +2 -2
  365. package/src/redux/actions/library.ts +23 -0
  366. package/src/redux/actions/mandatories.ts +2 -2
  367. package/src/redux/actions/references.ts +5 -5
  368. package/src/redux/actions/sagas/data.ts +2 -2
  369. package/src/redux/actions/sagas/model.ts +6 -6
  370. package/src/redux/actions/sagas/user.ts +2 -2
  371. package/src/redux/actions/smartscript.ts +4 -4
  372. package/src/redux/actions/user.ts +5 -5
  373. package/src/redux/constants/app.ts +22 -22
  374. package/src/redux/constants/conditions.ts +8 -8
  375. package/src/redux/constants/inputs.ts +6 -6
  376. package/src/redux/constants/mandatories.ts +6 -6
  377. package/src/redux/constants/references.ts +3 -3
  378. package/src/redux/constants/sagas/data.ts +1 -1
  379. package/src/redux/constants/sagas/model.ts +2 -2
  380. package/src/redux/constants/sagas/user.ts +2 -2
  381. package/src/redux/constants/smartscript.ts +4 -4
  382. package/src/redux/constants/user.ts +3 -3
  383. package/src/redux/listeners/subscriber.ts +2 -2
  384. package/src/redux/middlewares/conditionsWatcherMiddleware.ts +31 -31
  385. package/src/redux/middlewares/evaluationsWatcherMiddleware.test.ts +1 -1
  386. package/src/redux/middlewares/evaluationsWatcherMiddleware.ts +13 -13
  387. package/src/redux/middlewares/mandatoriesWatcherMiddleware.ts +16 -16
  388. package/src/redux/middlewares/multiplesActionsMiddleware.ts +6 -6
  389. package/src/redux/middlewares/paginationWatcherMiddleware.ts +27 -27
  390. package/src/redux/middlewares/pluginsHookMiddleware.ts +2 -2
  391. package/src/redux/middlewares/prefillerWatcherMiddleware.ts +31 -31
  392. package/src/redux/middlewares/smartscriptMiddleware.ts +20 -20
  393. package/src/redux/middlewares/thirdpartyScriptsMiddleware.ts +41 -0
  394. package/src/redux/reducers/app/customizations/initCustomizationAutoDefault.ts +2 -2
  395. package/src/redux/reducers/app/customizations/initCustomizationMeta.ts +2 -2
  396. package/src/redux/reducers/app/instance/initInstance.ts +2 -2
  397. package/src/redux/reducers/app/instance/setDataStatus.ts +2 -2
  398. package/src/redux/reducers/app/instance/updateInstance.ts +2 -2
  399. package/src/redux/reducers/app/instance/updateInstancePaid.ts +2 -2
  400. package/src/redux/reducers/app/meta/fetchModelFailed.ts +2 -2
  401. package/src/redux/reducers/app/meta/fetchModelNonBlocking.ts +2 -2
  402. package/src/redux/reducers/app/meta/fetchModelSucceeded.ts +2 -2
  403. package/src/redux/reducers/app/meta/fetchModelUnhealthy.ts +3 -3
  404. package/src/redux/reducers/app/meta/fetchModelUserLocked.ts +2 -2
  405. package/src/redux/reducers/app/meta/initMeta.ts +2 -2
  406. package/src/redux/reducers/app/meta/setModelUuid.ts +2 -2
  407. package/src/redux/reducers/app/pagination/goNextPage.ts +2 -2
  408. package/src/redux/reducers/app/pagination/goPage.ts +4 -4
  409. package/src/redux/reducers/app/pagination/goPreviousPage.ts +2 -2
  410. package/src/redux/reducers/app/pagination/initPagination.ts +3 -3
  411. package/src/redux/reducers/app/pagination/updateAvailableAppStates.ts +7 -7
  412. package/src/redux/reducers/app/wizard/updateAvailableSections.ts +4 -4
  413. package/src/redux/reducers/app.ts +32 -32
  414. package/src/redux/reducers/conditions/addMultipleOccurency.ts +5 -5
  415. package/src/redux/reducers/conditions/deleteMultipleOccurency.ts +4 -4
  416. package/src/redux/reducers/conditions/initConditions.ts +2 -2
  417. package/src/redux/reducers/conditions/updateDocumentConditions.ts +2 -2
  418. package/src/redux/reducers/conditions/updateOptionConditions.ts +2 -2
  419. package/src/redux/reducers/conditions/updateOptionValidatorCondition.ts +2 -2
  420. package/src/redux/reducers/conditions/updatePrefillerConditions.ts +4 -4
  421. package/src/redux/reducers/conditions/updateSectionConditions.ts +2 -2
  422. package/src/redux/reducers/conditions/updateVariableConditions.ts +2 -2
  423. package/src/redux/reducers/conditions/updateVariableValidatorCondition.ts +2 -2
  424. package/src/redux/reducers/conditions.ts +15 -15
  425. package/src/redux/reducers/inputs/addMultipleOccurency.ts +6 -6
  426. package/src/redux/reducers/inputs/deleteMultipleOccurency.ts +4 -4
  427. package/src/redux/reducers/inputs/initOption.ts +2 -2
  428. package/src/redux/reducers/inputs/initVariable.ts +2 -2
  429. package/src/redux/reducers/inputs/updateOptionInput.ts +2 -2
  430. package/src/redux/reducers/inputs/updateVariableInput.ts +2 -2
  431. package/src/redux/reducers/inputs.ts +10 -10
  432. package/src/redux/reducers/mandatories/addMultipleOccurency.ts +4 -4
  433. package/src/redux/reducers/mandatories/deleteMultipleOccurency.ts +4 -4
  434. package/src/redux/reducers/mandatories/initMandatoryOption.ts +2 -2
  435. package/src/redux/reducers/mandatories/initMandatoryVariable.ts +2 -2
  436. package/src/redux/reducers/mandatories/setMandatoryIgnore.ts +2 -2
  437. package/src/redux/reducers/mandatories/setMandatoryOption.ts +2 -2
  438. package/src/redux/reducers/mandatories/setMandatorySection.ts +2 -2
  439. package/src/redux/reducers/mandatories/setMandatoryVariable.ts +2 -2
  440. package/src/redux/reducers/mandatories.ts +13 -13
  441. package/src/redux/reducers/references/initReferences.ts +2 -2
  442. package/src/redux/reducers/references/updateOptionMeta.ts +4 -4
  443. package/src/redux/reducers/references/updateVariableMeta.ts +4 -4
  444. package/src/redux/reducers/references.ts +7 -7
  445. package/src/redux/reducers/smartscript/enableSmartScript.ts +1 -1
  446. package/src/redux/reducers/smartscript/initSmartScriptTriggers.ts +2 -2
  447. package/src/redux/reducers/smartscript/updateSmartscriptOptionHidden.ts +2 -2
  448. package/src/redux/reducers/smartscript/updateSmartscriptVariableHidden.ts +2 -2
  449. package/src/redux/reducers/smartscript.ts +8 -8
  450. package/src/redux/reducers/user/initUser.ts +2 -2
  451. package/src/redux/reducers/user/setUserStatus.ts +2 -2
  452. package/src/redux/reducers/user/setUserValidToken.ts +2 -2
  453. package/src/redux/reducers/user.ts +11 -11
  454. package/src/redux/routerHistory.ts +6 -6
  455. package/src/redux/sagas/fetchModel.test.ts +2 -5
  456. package/src/redux/sagas/fetchModel.ts +91 -100
  457. package/src/redux/sagas/homogeneousRadioInputsSaga.ts +6 -6
  458. package/src/redux/sagas/runner.ts +6 -6
  459. package/src/redux/sagas/saveData.ts +32 -28
  460. package/src/redux/sagas/setDefaults.ts +8 -8
  461. package/src/redux/sagas/setUserEmail.ts +46 -45
  462. package/src/redux/selectors/app.ts +34 -28
  463. package/src/redux/selectors/conditions.ts +41 -41
  464. package/src/redux/selectors/inputs.ts +10 -10
  465. package/src/redux/selectors/library.ts +17 -0
  466. package/src/redux/selectors/mandatories.ts +10 -10
  467. package/src/redux/selectors/references.ts +21 -21
  468. package/src/redux/selectors/selectors.ts +4 -4
  469. package/src/redux/selectors/smartscript.ts +6 -6
  470. package/src/redux/selectors/user.ts +8 -8
  471. package/src/redux/store.ts +42 -32
  472. package/src/service/api.manager.ts +53 -53
  473. package/src/service/auth.service.ts +2 -2
  474. package/src/service/pardot.service.ts +2 -2
  475. package/src/tests-misc/plugins/jestTestPlugin/after.tsx +1 -1
  476. package/src/tests-misc/plugins/jestTestPlugin/before.tsx +1 -1
  477. package/src/tests-misc/plugins/jestTestPlugin/index.ts +4 -4
  478. package/src/tests-misc/plugins/jestTestPlugin/title.tsx +2 -2
  479. package/src/tests-misc/themes/jestTestTheme/components/EmailComponent.tsx +1 -1
  480. package/src/tests-misc/themes/jestTestTheme/components/TermsheetComponent.tsx +1 -1
  481. package/src/tests-misc/themes/jestTestTheme/components/WizardComponent.tsx +1 -1
  482. package/src/tests-misc/themes/jestTestTheme/faltyIndex.ts +1 -1
  483. package/src/tests-misc/themes/jestTestTheme/faltyIndexLoader.ts +1 -1
  484. package/src/tests-misc/themes/jestTestTheme/index.ts +4 -4
  485. package/src/types/Actions.type.ts +55 -55
  486. package/src/types/Components.type.ts +4 -4
  487. package/src/types/State.type.ts +14 -14
  488. package/src/types/Termsheet.type.ts +4 -4
  489. package/src/types/api.type.ts +4 -4
  490. package/src/types/config.type.ts +3 -3
  491. package/src/types/getActions.type.ts +2 -2
  492. package/src/types/getConnectors.type.ts +2 -2
  493. package/src/types/getSelectors.type.ts +2 -2
  494. package/src/wizard-params.ts +17 -17
  495. package/tsconfig.json +1 -1
  496. package/dist/componentsConnectors/connector/connectorSelectors.js +0 -9
  497. package/dist/componentsConnectors/index.d.ts +0 -16
  498. package/dist/componentsConnectors/index.js +0 -16
  499. package/dist/constants/index.d.ts +0 -1
  500. package/dist/constants/index.js +0 -1
  501. package/dist/helpers/index.d.ts +0 -2
  502. package/dist/helpers/index.js +0 -2
  503. package/dist/hooks/index.d.ts +0 -1
  504. package/dist/hooks/index.js +0 -1
  505. package/dist/index.d.ts +0 -23
  506. package/dist/index.js +0 -23
  507. package/dist/libs/index.d.ts +0 -12
  508. package/dist/libs/index.js +0 -12
  509. package/dist/redux/actions/index.d.ts +0 -8
  510. package/dist/redux/actions/index.js +0 -8
  511. package/dist/redux/actions/sagas/index.d.ts +0 -3
  512. package/dist/redux/actions/sagas/index.js +0 -3
  513. package/dist/redux/constants/index.d.ts +0 -8
  514. package/dist/redux/constants/index.js +0 -8
  515. package/dist/redux/constants/sagas/index.d.ts +0 -3
  516. package/dist/redux/constants/sagas/index.js +0 -3
  517. package/dist/redux/index.d.ts +0 -4
  518. package/dist/redux/index.js +0 -4
  519. package/dist/redux/selectors/index.d.ts +0 -7
  520. package/dist/redux/selectors/index.js +0 -7
  521. package/dist/service/index.d.ts +0 -3
  522. package/dist/service/index.js +0 -3
  523. package/dist/types/index.d.ts +0 -10
  524. package/dist/types/index.js +0 -10
  525. package/src/componentsConnectors/connector/connectorSelectors.ts +0 -19
  526. package/src/componentsConnectors/index.ts +0 -16
  527. package/src/constants/index.ts +0 -1
  528. package/src/helpers/index.ts +0 -2
  529. package/src/hooks/index.ts +0 -1
  530. package/src/index.ts +0 -47
  531. package/src/libs/index.ts +0 -12
  532. package/src/redux/actions/index.ts +0 -8
  533. package/src/redux/actions/sagas/index.ts +0 -3
  534. package/src/redux/constants/index.ts +0 -8
  535. package/src/redux/constants/sagas/index.ts +0 -3
  536. package/src/redux/index.ts +0 -4
  537. package/src/redux/selectors/index.ts +0 -7
  538. package/src/service/index.ts +0 -3
  539. package/src/types/index.ts +0 -10
@@ -1,8 +1,7 @@
1
- import { call, put, takeLatest, select, fork, join } from 'redux-saga/effects';
2
- import Cookies from 'universal-cookie';
3
- import type { CustomizationMetaDefault } from '@legalplace/models-v3-types';
4
- import type { HealthCheckReport } from '@legalplace/model-healthcheck/dist/libs/HealthCheck.type';
5
- import { Task } from '@redux-saga/core';
1
+ import { call, put, takeLatest, select, fork, join } from "redux-saga/effects";
2
+ import Cookies from "universal-cookie";
3
+ import type { CustomizationMetaDefault } from "@legalplace/models-v3-types";
4
+ import type { HealthCheckReport } from "@legalplace/model-healthcheck/dist/libs/HealthCheck.type";
6
5
  import {
7
6
  initMetaAction,
8
7
  initPaginationAction,
@@ -17,54 +16,54 @@ import {
17
16
  goPageAction,
18
17
  fetchModelNonBlockingAction,
19
18
  setModelUuidAction,
20
- } from '../actions/app';
21
- import { ConditionsInitiator } from '../../libs/ConditionsInitiator';
22
- import { initReferencesAction } from '../actions/references';
23
- import { initOptionAction, initVariableAction } from '../actions/inputs';
24
- import { initConditionsAction } from '../actions/conditions';
25
- import { selectSectionConditionValue } from '../selectors/conditions';
19
+ } from "../actions/app";
20
+ import { ConditionsInitiator } from "../../libs/ConditionsInitiator";
21
+ import { initReferencesAction } from "../actions/references";
22
+ import { initOptionAction, initVariableAction } from "../actions/inputs";
23
+ import { initConditionsAction } from "../actions/conditions";
24
+ import { selectSectionConditionValue } from "../selectors/conditions";
26
25
  import {
27
26
  selectAllSectionsReferences,
28
27
  selectOptionRelations,
29
- } from '../selectors/references';
30
- import { ActionsType } from '../../types/Actions.type';
31
- import { selectInstanceUniqid, isStepAvailable } from '../selectors/app';
32
- import { getConfig, updateConfig } from '../../config';
33
- import { isLevelAccessibleForUser } from '../selectors/user';
34
- import { PathReader } from '../../libs/PathReader';
35
- import { IntputsInitiator } from '../../libs/InputsInitiator';
36
- import { initUserAction, setUserStatusAction } from '../actions/user';
37
- import { OvcConverter, OvcType } from '../../libs/OvcConverter';
38
- import { StateType } from '../../types/State.type';
39
- import Globals from '../../Globals';
28
+ } from "../selectors/references";
29
+ import { ActionsType } from "../../types/Actions.type";
30
+ import { selectInstanceUniqid, isStepAvailable } from "../selectors/app";
31
+ import { getConfig, updateConfig } from "../../config";
32
+ import { isLevelAccessibleForUser } from "../selectors/user";
33
+ import { PathReader } from "../../libs/PathReader";
34
+ import { IntputsInitiator } from "../../libs/InputsInitiator";
35
+ import { initUserAction, setUserStatusAction } from "../actions/user";
36
+ import { OvcConverter, OvcType } from "../../libs/OvcConverter";
37
+ import { StateType } from "../../types/State.type";
38
+ import Globals from "../../Globals";
40
39
  import {
41
40
  getFetchModelArguments,
42
41
  getCreateInstanceArguments,
43
42
  getClientConfigArguments,
44
43
  getWizardConfigArguments,
45
44
  getModelInformationArguments,
46
- } from '../../service/api.manager';
47
- import { loadTheme, setWizardTheme } from '../../ThemeLoader';
48
- import { loadPlugins } from '../../PluginLoader';
45
+ } from "../../service/api.manager";
46
+ import { loadTheme, setWizardTheme } from "../../ThemeLoader";
47
+ import { loadPlugins } from "../../PluginLoader";
49
48
  import {
50
49
  selectMandatoryOptionItem,
51
50
  selectMandatoryOption,
52
- } from '../selectors/mandatories';
51
+ } from "../selectors/mandatories";
53
52
  import {
54
53
  initMandatoryOptionAction,
55
54
  initMandatoryVariableAction,
56
- } from '../actions/mandatories';
57
- import { enableSmartscriptAction } from '../actions/smartscript';
55
+ } from "../actions/mandatories";
56
+ import { enableSmartscriptAction } from "../actions/smartscript";
58
57
  import {
59
58
  FETCH_MODEL,
60
59
  FETCH_MODEL_PREREQUISITES,
61
- } from '../constants/sagas/model';
62
- import { fetchModelAction } from '../actions/sagas/model';
60
+ } from "../constants/sagas/model";
61
+ import { fetchModelAction } from "../actions/sagas/model";
63
62
  import {
64
63
  ClientConfigResponse,
65
64
  WizardConfigResponse,
66
65
  CreateInstanceResponse,
67
- } from '../../types/api.type';
66
+ } from "../../types/api.type";
68
67
 
69
68
  const cookies = new Cookies();
70
69
 
@@ -78,8 +77,8 @@ function* setFetchModelToNonBlocking(firstCurrentAppState?: string) {
78
77
  greatestPage: 1,
79
78
  currentSectionId: 0,
80
79
  availableSections: [],
81
- currentAppState: firstCurrentAppState || 'wizard',
82
- availableAppStates: ['wizard'],
80
+ currentAppState: firstCurrentAppState || "wizard",
81
+ availableAppStates: ["wizard"],
83
82
  })
84
83
  );
85
84
 
@@ -104,7 +103,7 @@ function* getClientConfig(permalink: string, uniqid: string) {
104
103
 
105
104
  clientConfigResponse = yield call(
106
105
  // @ts-ignore because of saga implementation of call function
107
- [clientConfigResponse, 'json']
106
+ [clientConfigResponse, "json"]
108
107
  );
109
108
 
110
109
  if (clientConfigResponse.clientConfig.metadata?.apiEndpoint) {
@@ -133,7 +132,7 @@ function* getClientConfig(permalink: string, uniqid: string) {
133
132
  // Loading compactTheme if we receive url param compactTheme
134
133
  if (/compactTheme/.test(window.location.href)) {
135
134
  // @ts-ignore: because of saga implementation of call function
136
- yield call(setWizardTheme, { name: 'compact' });
135
+ yield call(setWizardTheme, { name: "compact" });
137
136
  } else if (clientConfigResponse.clientConfig.metadata?.theme?.name) {
138
137
  yield call(
139
138
  setWizardTheme,
@@ -174,7 +173,6 @@ function* getWizardConfig(
174
173
  queryParams: URLSearchParams
175
174
  ) {
176
175
  let response: WizardConfigResponse = yield call(
177
- // @ts-ignore because of saga implementation of call function
178
176
  fetch,
179
177
  ...getWizardConfigArguments(permalink, uniqidParam, prefix, queryParams)
180
178
  );
@@ -185,14 +183,14 @@ function* getWizardConfig(
185
183
  }
186
184
  response = yield call(
187
185
  // @ts-ignore because of saga implementation of call function
188
- [response, 'json']
186
+ [response, "json"]
189
187
  );
190
188
  if (response.redirect) {
191
189
  window.onbeforeunload = null; // force redirection
192
190
  window.location.href = `${response.redirect}${
193
191
  response.redirectParams
194
192
  ? `?redirectUrl=${encodeURIComponent(window.location.href)}`
195
- : ''
193
+ : ""
196
194
  }`;
197
195
  }
198
196
  yield put(setModelUuidAction(response.modelUuid));
@@ -239,10 +237,10 @@ function* fetchModelInformation(
239
237
  }
240
238
  response = yield call(
241
239
  // @ts-ignore because of saga implementation of call function
242
- [response, 'json']
240
+ [response, "json"]
243
241
  );
244
- if (response.status === 'unhealthy') {
245
- if (Globals.env === 'production') {
242
+ if (response.status === "unhealthy") {
243
+ if (Globals.appEnv === "production") {
246
244
  yield put(fetchModelFailedAction());
247
245
  } else yield put(fetchModelUnhealthyAction(response.report));
248
246
  return undefined;
@@ -257,7 +255,7 @@ function* fetchModelInformation(
257
255
  yield put(initMetaAction(meta));
258
256
 
259
257
  // Setting document title
260
- document.title = `${meta.title} - ${getConfig().brand?.name || 'LegalPlace'}`;
258
+ document.title = `${meta.title} - ${getConfig().brand?.name || "LegalPlace"}`;
261
259
 
262
260
  const { references, customization, smartScript } = response;
263
261
  /**
@@ -277,8 +275,8 @@ function* fetchModelInformation(
277
275
 
278
276
  // Meta customizations
279
277
  if (
280
- typeof customization === 'object' &&
281
- typeof customization.meta === 'object'
278
+ typeof customization === "object" &&
279
+ typeof customization.meta === "object"
282
280
  )
283
281
  yield put(initCustomizationMetaAction(customization.meta));
284
282
 
@@ -303,34 +301,34 @@ function* fetchInstanceInformation(
303
301
  if (response === undefined) {
304
302
  throw new Error(
305
303
  `Unable to fetch ${permalink}${
306
- uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : ''
304
+ uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : ""
307
305
  }, we did not recieve any response`
308
306
  );
309
307
  }
310
308
  // @ts-ignore because of saga implementation of call function
311
- response = yield call([response, 'json']);
309
+ response = yield call([response, "json"]);
312
310
  if (response.redirect) {
313
311
  window.onbeforeunload = null; // force redirection
314
312
  window.location.href = `${response.redirect}${
315
313
  response.redirectParams
316
314
  ? `?redirectUrl=${encodeURIComponent(window.location.href)}`
317
- : ''
315
+ : ""
318
316
  }`;
319
317
  }
320
- if (response.errors || response.status === 'error') {
318
+ if (response.errors || response.status === "error") {
321
319
  throw new Error(
322
320
  `Unable to fetch ${permalink}${
323
- uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : ''
321
+ uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : ""
324
322
  }`
325
323
  );
326
324
  }
327
325
 
328
326
  // reload to legacy wizard if instance is of legacy type
329
- if (response.instance && response.instance.appType === 'react') {
330
- const abCookie = cookies.get('X-Source');
331
- if (abCookie && abCookie.split('/').length > 1) {
332
- cookies.set('X-Source', `${abCookie.split('/')[0]}/wizard`, {
333
- path: '/',
327
+ if (response.instance && response.instance.appType === "react") {
328
+ const abCookie = cookies.get("X-Source");
329
+ if (abCookie && abCookie.split("/").length > 1) {
330
+ cookies.set("X-Source", `${abCookie.split("/")[0]}/wizard`, {
331
+ path: "/",
334
332
  encode: (value: string) => value,
335
333
  });
336
334
  window.onbeforeunload = () => {};
@@ -340,19 +338,19 @@ function* fetchInstanceInformation(
340
338
 
341
339
  // Instance
342
340
  const instance: StateType.App.Instance = {
343
- dataStatus: 'saved',
344
- uniqid: uniqid || '',
341
+ dataStatus: "saved",
342
+ uniqid: uniqid || "",
345
343
  draft: response.instance && response.instance.draft,
346
344
  companyId: response.instance?.companyId,
347
345
  employeeId: response.instance?.employeeId,
348
346
  isOrderHandled: response.instance && response.instance.isOrderHandled,
349
347
  isPaid:
350
348
  response.instance &&
351
- (response.instance.isPaid.toString() === '1' ||
349
+ (response.instance.isPaid.toString() === "1" ||
352
350
  response.instance.isPaid === true),
353
351
  steps:
354
352
  response.instance &&
355
- (typeof response.instance.steps === 'string' ||
353
+ (typeof response.instance.steps === "string" ||
356
354
  Array.isArray(response.instance.steps))
357
355
  ? response.instance.steps
358
356
  : [1],
@@ -365,7 +363,7 @@ function* fetchInstanceInformation(
365
363
  // modelisator, this is a quick solution
366
364
  // for the problem that is not quite secure
367
365
  // review it
368
- if (pathReader.modelVersion) instance.steps = '*';
366
+ if (pathReader.modelVersion) instance.steps = "*";
369
367
 
370
368
  yield put(initInstanceAction(instance));
371
369
 
@@ -377,10 +375,10 @@ function* fetchInstanceInformation(
377
375
  * Initiating user
378
376
  */
379
377
  if (
380
- typeof response.user === 'object' &&
381
- typeof response.user.email === 'string' &&
382
- typeof response.user.displayName === 'string' &&
383
- typeof response.user.level === 'string'
378
+ typeof response.user === "object" &&
379
+ typeof response.user.email === "string" &&
380
+ typeof response.user.displayName === "string" &&
381
+ typeof response.user.level === "string"
384
382
  ) {
385
383
  yield put(
386
384
  initUserAction({
@@ -389,15 +387,15 @@ function* fetchInstanceInformation(
389
387
  level: response.user.level,
390
388
  })
391
389
  );
392
- yield put(setUserStatusAction('authenticated'));
393
- if (availableAppStates.includes('email'))
394
- availableAppStates.splice(availableAppStates.indexOf('email'), 1);
390
+ yield put(setUserStatusAction("authenticated"));
391
+ if (availableAppStates.includes("email"))
392
+ availableAppStates.splice(availableAppStates.indexOf("email"), 1);
395
393
  }
396
394
 
397
395
  /**
398
396
  * If instance is locked for the user
399
397
  */
400
- if (instance.draft === false && !isLevelAccessibleForUser('USER')) {
398
+ if (instance.draft === false && !isLevelAccessibleForUser("USER")) {
401
399
  yield put(fetchModelUserLockedAction());
402
400
  }
403
401
 
@@ -418,14 +416,14 @@ function* createInstance(
418
416
  * Unit/Organization params define if we allow shadow instance, we fallback to configuration if not defined
419
417
  */
420
418
  const isShadowInstanceEnabled =
421
- typeof enableShadowInstance !== 'undefined'
419
+ typeof enableShadowInstance !== "undefined"
422
420
  ? enableShadowInstance
423
421
  : getConfig().enableShadowInstance;
424
422
 
425
423
  // Instance
426
424
  const instance: StateType.App.Instance = {
427
- dataStatus: 'saved',
428
- uniqid: uniqid || '',
425
+ dataStatus: "saved",
426
+ uniqid: uniqid || "",
429
427
  draft: false,
430
428
  companyId: undefined,
431
429
  employeeId: undefined,
@@ -441,20 +439,20 @@ function* createInstance(
441
439
  // modelisator, this is a quick solution
442
440
  // for the problem that is not quite secure
443
441
  // review it
444
- if (pathReader.modelVersion) instance.steps = '*';
442
+ if (pathReader.modelVersion) instance.steps = "*";
445
443
 
446
444
  // Creating instance
447
445
  if (
448
446
  isShadowInstanceEnabled === true &&
449
447
  (instance.uniqid === undefined ||
450
- (typeof instance.uniqid === 'string' && instance.uniqid.trim() === ''))
448
+ (typeof instance.uniqid === "string" && instance.uniqid.trim() === ""))
451
449
  ) {
452
450
  const searchParams = `${
453
- urlParams && urlParams.get('contractName') && urlParams.get('userId')
451
+ urlParams && urlParams.get("contractName") && urlParams.get("userId")
454
452
  ? `?contractName=${urlParams.get(
455
- 'contractName'
456
- )}&userId=${urlParams.get('userId')}`
457
- : ''
453
+ "contractName"
454
+ )}&userId=${urlParams.get("userId")}`
455
+ : ""
458
456
  }`;
459
457
  const res: CreateInstanceResponse = yield call(
460
458
  // @ts-ignore because of saga implementation of call function
@@ -463,11 +461,11 @@ function* createInstance(
463
461
  );
464
462
  const instanceResponse: CreateInstanceResponse = yield call(
465
463
  // @ts-ignore because of saga implementation of call function
466
- [res, 'json']
464
+ [res, "json"]
467
465
  );
468
466
 
469
- if (instanceResponse.status !== 'SUCCESS') {
470
- throw new Error('Unable to create instance');
467
+ if (instanceResponse.status !== "SUCCESS") {
468
+ throw new Error("Unable to create instance");
471
469
  }
472
470
 
473
471
  // Setting uniqid
@@ -481,7 +479,7 @@ function* createInstance(
481
479
 
482
480
  // Setting steps
483
481
  instance.steps =
484
- typeof instanceResponse.steps === 'string' ||
482
+ typeof instanceResponse.steps === "string" ||
485
483
  Array.isArray(instanceResponse.steps)
486
484
  ? instanceResponse.steps
487
485
  : [1];
@@ -499,10 +497,10 @@ function* fetchModelPrerequisites(
499
497
  const { permalink, prefix } = action;
500
498
 
501
499
  // TODO Fix Smartscript iFrame re-render (see issue #4130)
502
- if (!permalink && window.location.href.includes('smartscript')) return;
500
+ if (!permalink && window.location.href.includes("smartscript")) return;
503
501
 
504
502
  const uniqid = selectInstanceUniqid() || getConfig().uniqid;
505
- const uniqidParam = uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : '';
503
+ const uniqidParam = uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : "";
506
504
  const urlParams = new URLSearchParams(window.location.search);
507
505
 
508
506
  // Getting State
@@ -512,17 +510,15 @@ function* fetchModelPrerequisites(
512
510
  const pathReader = new PathReader(state);
513
511
  const queryParams = new URLSearchParams(window.location.search);
514
512
  if (pathReader.modelVersion)
515
- queryParams.set('version', pathReader.modelVersion);
513
+ queryParams.set("version", pathReader.modelVersion);
516
514
 
517
- const clientConfigTask: Task = yield fork(
518
- // @ts-ignore because of saga implementation of fork function
515
+ const clientConfigReturnValue = yield call(
519
516
  getClientConfig,
520
517
  permalink,
521
- uniqid
518
+ uniqid || ""
522
519
  );
523
520
 
524
- const wizardConfigTask: Task = yield fork(
525
- // @ts-ignore because of saga implementation of fork function
521
+ const wizardConfig = yield call(
526
522
  getWizardConfig,
527
523
  permalink,
528
524
  uniqidParam,
@@ -530,11 +526,6 @@ function* fetchModelPrerequisites(
530
526
  queryParams
531
527
  );
532
528
 
533
- const [clientConfigReturnValue, wizardConfig] = yield join([
534
- clientConfigTask,
535
- wizardConfigTask,
536
- ]);
537
-
538
529
  yield put(
539
530
  fetchModelAction(
540
531
  permalink,
@@ -627,7 +618,7 @@ function* fetchModelDecorator(action: ActionsType.Sagas.Model.fetchModel): any {
627
618
 
628
619
  // Setting OVC to null if it's an empty object
629
620
  if (
630
- typeof ovc === 'object' &&
621
+ typeof ovc === "object" &&
631
622
  ovc !== null &&
632
623
  Object.keys(ovc).length === 0
633
624
  )
@@ -665,15 +656,15 @@ function* fetchModelDecorator(action: ActionsType.Sagas.Model.fetchModel): any {
665
656
  const { type } = meta2;
666
657
  let { mandatory } = meta2;
667
658
  let sendOptionAction = true;
668
- if (['checkbox', 'radio'].includes(type)) {
669
- if (type === 'radio') {
659
+ if (["checkbox", "radio"].includes(type)) {
660
+ if (type === "radio") {
670
661
  const { parents } = selectOptionRelations(optionId);
671
662
  // Get parentId
672
663
  const parentId = parents[0];
673
664
  // check if optin exist on mandatory
674
665
  const isMandatoryOption = selectMandatoryOptionItem(parentId);
675
666
  // If parentId value = true don't send an action
676
- if (typeof isMandatoryOption !== 'undefined') {
667
+ if (typeof isMandatoryOption !== "undefined") {
677
668
  const mandatoryOption = selectMandatoryOption(parentId);
678
669
  sendOptionAction = !mandatoryOption.every((v) => v === true);
679
670
  // handle multiple
@@ -723,7 +714,7 @@ function* fetchModelDecorator(action: ActionsType.Sagas.Model.fetchModel): any {
723
714
  */
724
715
  const sectionsReferences = selectAllSectionsReferences();
725
716
  if (sectionsReferences === undefined)
726
- throw new Error('Sections references not found');
717
+ throw new Error("Sections references not found");
727
718
  const availableSections = Object.keys(sectionsReferences)
728
719
  .filter((sectionId) => {
729
720
  const condition =
@@ -731,7 +722,7 @@ function* fetchModelDecorator(action: ActionsType.Sagas.Model.fetchModel): any {
731
722
  const sectionReference = sectionsReferences[sectionId];
732
723
  const sectionGrantLevel = sectionReference.grantLevel
733
724
  ? sectionReference.grantLevel
734
- : 'GUEST';
725
+ : "GUEST";
735
726
  const grant = isLevelAccessibleForUser(sectionGrantLevel);
736
727
  const availableStep = isStepAvailable(sectionReference.step);
737
728
  return condition && grant && availableStep;
@@ -744,7 +735,7 @@ function* fetchModelDecorator(action: ActionsType.Sagas.Model.fetchModel): any {
744
735
  greatestPage: 1,
745
736
  currentSectionId: availableSections[0],
746
737
  availableSections,
747
- currentAppState: firstCurrentAppState || 'wizard',
738
+ currentAppState: firstCurrentAppState || "wizard",
748
739
  availableAppStates,
749
740
  })
750
741
  );
@@ -1,9 +1,9 @@
1
- import { put, takeLatest } from 'redux-saga/effects';
2
- import { UPDATE_OPTION_INPUT } from '../constants/inputs';
3
- import { ActionsType } from '../../types/Actions.type';
4
- import { selectRadioSiblings } from '../selectors/references';
5
- import { updateOptionAction } from '../actions/inputs';
6
- import { selectOptionInputByIndex } from '../selectors/inputs';
1
+ import { put, takeLatest } from "redux-saga/effects";
2
+ import { UPDATE_OPTION_INPUT } from "../constants/inputs";
3
+ import { ActionsType } from "../../types/Actions.type";
4
+ import { selectRadioSiblings } from "../selectors/references";
5
+ import { updateOptionAction } from "../actions/inputs";
6
+ import { selectOptionInputByIndex } from "../selectors/inputs";
7
7
 
8
8
  /**
9
9
  * This Saga helps make sure radio inputs are homogenous,
@@ -1,9 +1,9 @@
1
- import { SagaMiddleware } from '@redux-saga/core';
2
- import fetchModelSaga from './fetchModel';
3
- import setDefaultsSaga from './setDefaults';
4
- import saveDataSaga from './saveData';
5
- import homogeneousRadioInputsSaga from './homogeneousRadioInputsSaga';
6
- import setUserEmailSaga from './setUserEmail';
1
+ import { SagaMiddleware } from "@redux-saga/core";
2
+ import fetchModelSaga from "./fetchModel";
3
+ import setDefaultsSaga from "./setDefaults";
4
+ import saveDataSaga from "./saveData";
5
+ import homogeneousRadioInputsSaga from "./homogeneousRadioInputsSaga";
6
+ import setUserEmailSaga from "./setUserEmail";
7
7
 
8
8
  const sagas: { (): any }[] = [
9
9
  fetchModelSaga,
@@ -1,25 +1,25 @@
1
- import { call, put, takeLatest } from 'redux-saga/effects';
2
- import { v4 as uuid } from 'uuid';
3
- import { setDataStatus } from '../actions/app';
1
+ import { call, put, takeLatest } from "redux-saga/effects";
2
+ import { v4 as uuid } from "uuid";
3
+ import { setDataStatus } from "../actions/app";
4
4
  import {
5
5
  selectPermalink,
6
6
  selectInstanceUniqid,
7
7
  selectDocumentTitle,
8
8
  selectInstanceIsPaid,
9
- } from '../selectors/app';
10
- import { SAVE_DATA } from '../constants/sagas/data';
11
- import { selectInputs } from '../selectors/inputs';
12
- import { OvcConverter } from '../../libs/OvcConverter';
13
- import { ActionsType } from '../../types/Actions.type';
14
- import { updateInstanceArguments } from '../../service/api.manager';
15
- import { getSendinblueIdentifyAttributes } from '../../helpers/sendinblueHelper';
16
- import { getConfig } from '../../config';
17
- import { selectUserEmail } from '../selectors/user';
9
+ } from "../selectors/app";
10
+ import { SAVE_DATA } from "../constants/sagas/data";
11
+ import { selectInputs } from "../selectors/inputs";
12
+ import { OvcConverter } from "../../libs/OvcConverter";
13
+ import { ActionsType } from "../../types/Actions.type";
14
+ import { updateInstanceArguments } from "../../service/api.manager";
15
+ import { getSendinblueIdentifyAttributes } from "../../helpers/sendinblueHelper";
16
+ import { getConfig } from "../../config";
17
+ import { selectUserEmail } from "../selectors/user";
18
18
 
19
- const getSendinblueData = (uniqid: string, paid: boolean) => {
19
+ const getSendinblueData = async (uniqid: string, paid: boolean) => {
20
20
  const email = selectUserEmail();
21
21
  const apiEndpoint =
22
- getConfig().apiEndpoint + (/\/$/.test(getConfig().apiEndpoint) ? '' : '/');
22
+ getConfig().apiEndpoint + (/\/$/.test(getConfig().apiEndpoint) ? "" : "/");
23
23
 
24
24
  // Getting OVC
25
25
  const ovc = OvcConverter.convertToOvc(selectInputs());
@@ -29,14 +29,14 @@ const getSendinblueData = (uniqid: string, paid: boolean) => {
29
29
  const currentValue = ovc.v[c];
30
30
  // eslint-disable-next-line no-nested-ternary
31
31
  const o: number = Array.isArray(currentValue)
32
- ? currentValue.reduce((_p: number, _c) => _p + (_c !== '' ? 1 : 0), 0)
33
- : currentValue !== ''
32
+ ? currentValue.reduce((_p: number, _c) => _p + (_c !== "" ? 1 : 0), 0)
33
+ : currentValue !== ""
34
34
  ? 1
35
35
  : 0;
36
36
  return p + o;
37
37
  }, 0);
38
38
  // if (typeof window.sendinblue !== 'undefined' && response.user) {
39
- const attributes = getSendinblueIdentifyAttributes(
39
+ const attributes = await getSendinblueIdentifyAttributes(
40
40
  uniqid as string,
41
41
  selectDocumentTitle(),
42
42
  nbFilledVars,
@@ -45,10 +45,13 @@ const getSendinblueData = (uniqid: string, paid: boolean) => {
45
45
  );
46
46
  return [apiEndpoint, email, attributes];
47
47
  };
48
- function* saveDataDecorator(action: ActionsType.Sagas.Data.saveData) {
48
+
49
+ function* saveDataDecorator(
50
+ action: ActionsType.Sagas.Data.saveData
51
+ ): Generator<any, any, any> {
49
52
  try {
50
53
  // eslint-disable-next-line no-console
51
- yield put(setDataStatus('saving'));
54
+ yield put(setDataStatus("saving"));
52
55
  const permalink = selectPermalink();
53
56
  const uniqid = selectInstanceUniqid();
54
57
  // @ts-ignore because of saga implementation
@@ -64,21 +67,22 @@ function* saveDataDecorator(action: ActionsType.Sagas.Data.saveData) {
64
67
  )
65
68
  );
66
69
  // @ts-ignore because of saga implementation
67
- const responseData = yield call([response, 'json']);
70
+ const responseData = yield call([response, "json"]);
68
71
  // Redirecting if we recieved order to
69
72
  if (action.redirect === true) {
70
73
  if (responseData.redirect_to) {
71
74
  try {
72
75
  // Get Data to send to sendinblue
73
- const [apiEndpoint, email, attributes] = getSendinblueData(
74
- uniqid as string,
75
- selectInstanceIsPaid()
76
+ const [apiEndpoint, email, attributes] = yield call(
77
+ // @ts-ignore: due to saga implementation
78
+ getSendinblueData,
79
+ [uniqid as string, selectInstanceIsPaid()]
76
80
  );
77
81
  yield call(fetch, `${apiEndpoint}event/create/${uniqid}/${uuid()}`, {
78
- method: 'POST',
79
- credentials: 'include',
82
+ method: "POST",
83
+ credentials: "include",
80
84
  headers: {
81
- 'Content-Type': 'application/json',
85
+ "Content-Type": "application/json",
82
86
  },
83
87
  body: JSON.stringify({
84
88
  email,
@@ -97,11 +101,11 @@ function* saveDataDecorator(action: ActionsType.Sagas.Data.saveData) {
97
101
  }
98
102
  }
99
103
 
100
- yield put(setDataStatus('saved'));
104
+ yield put(setDataStatus("saved"));
101
105
  } catch (e) {
102
106
  // eslint-disable-next-line no-console
103
107
  console.error(e);
104
- yield put(setDataStatus('failed'));
108
+ yield put(setDataStatus("failed"));
105
109
  }
106
110
  }
107
111
 
@@ -1,20 +1,20 @@
1
- import { call, put, takeLatest } from 'redux-saga/effects';
1
+ import { call, put, takeLatest } from "redux-saga/effects";
2
2
  import {
3
3
  selectCurrentPage,
4
4
  selectAvailableSections,
5
5
  selectCurrentSectionId,
6
- } from '../selectors/app';
6
+ } from "../selectors/app";
7
7
  import {
8
8
  selectSectionDefaults,
9
9
  selectRadioSiblings,
10
- } from '../selectors/references';
10
+ } from "../selectors/references";
11
11
  import {
12
12
  selectOptionInput,
13
13
  selectOptionInputByIndex,
14
- } from '../selectors/inputs';
15
- import { updateOptionAction } from '../actions/inputs';
16
- import { goPageAction } from '../actions/app';
17
- import { selectOptionConditionValue } from '../selectors/conditions';
14
+ } from "../selectors/inputs";
15
+ import { updateOptionAction } from "../actions/inputs";
16
+ import { goPageAction } from "../actions/app";
17
+ import { selectOptionConditionValue } from "../selectors/conditions";
18
18
 
19
19
  function setOptionsDefaults(
20
20
  id: number,
@@ -161,7 +161,7 @@ function* setDefaultOptions() {
161
161
  }
162
162
 
163
163
  function* setDefaultsSaga() {
164
- yield takeLatest('SET_DEFAULTS', setDefaultOptions);
164
+ yield takeLatest("SET_DEFAULTS", setDefaultOptions);
165
165
  }
166
166
 
167
167
  export default setDefaultsSaga;