@remoteoss/remote-flows 0.18.1 → 0.20.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 (313) hide show
  1. package/dist/{chunk-ANXYPRBG.js → chunk-2I5DIIJP.js} +2 -2
  2. package/dist/{chunk-7VUILYZ3.js → chunk-2QGDCMCE.js} +2 -2
  3. package/dist/chunk-32GSS4UM.js +2 -0
  4. package/dist/{chunk-NBCZF2FO.js.map → chunk-32GSS4UM.js.map} +1 -1
  5. package/dist/{chunk-E5YN6OT3.js → chunk-3PCSFTM3.js} +2 -2
  6. package/dist/{chunk-JB55FFG6.js → chunk-4C6O4QTI.js} +2 -2
  7. package/dist/{chunk-A522V6XF.js → chunk-4KA5AP7X.js} +2 -2
  8. package/dist/chunk-54KJP7WD.js +2 -0
  9. package/dist/chunk-54KJP7WD.js.map +1 -0
  10. package/dist/{chunk-63HVO7J5.js → chunk-5CGII7CZ.js} +2 -2
  11. package/dist/{chunk-H4KE45NG.js → chunk-5T25IMZ3.js} +2 -2
  12. package/dist/{chunk-U4NWXPI5.js → chunk-5TUFZVWO.js} +2 -2
  13. package/dist/{chunk-U4NWXPI5.js.map → chunk-5TUFZVWO.js.map} +1 -1
  14. package/dist/chunk-663AKXTN.js +2 -0
  15. package/dist/chunk-663AKXTN.js.map +1 -0
  16. package/dist/{chunk-QQ7KPOLK.js → chunk-6O6CNAMF.js} +2 -2
  17. package/dist/chunk-6TSSHWBM.js +2 -0
  18. package/dist/chunk-6TSSHWBM.js.map +1 -0
  19. package/dist/{chunk-4R3ITKOA.js → chunk-756MHC7A.js} +2 -2
  20. package/dist/{chunk-RZTT3MEP.js → chunk-76VMCRDE.js} +2 -2
  21. package/dist/{chunk-TXSJL3HC.js → chunk-7IHBNPZK.js} +2 -2
  22. package/dist/{chunk-QW4JPW6J.js → chunk-7XRPOR7L.js} +1 -1
  23. package/dist/chunk-7XRPOR7L.js.map +1 -0
  24. package/dist/{chunk-6NKUEDYP.js → chunk-A42AGGNH.js} +2 -2
  25. package/dist/{chunk-N5I33LIN.js → chunk-A76UTPRW.js} +2 -2
  26. package/dist/{chunk-DCRLPAJL.js → chunk-A7ZEA2WU.js} +2 -2
  27. package/dist/{chunk-UHS3QRA3.js → chunk-ASKKS4Z3.js} +2 -2
  28. package/dist/{chunk-TLC5WQY2.js → chunk-ATC4YO7K.js} +2 -2
  29. package/dist/chunk-AVSWJUYN.js +2 -0
  30. package/dist/chunk-AVSWJUYN.js.map +1 -0
  31. package/dist/{chunk-DBDVBJDV.js → chunk-B3WXLC2R.js} +2 -2
  32. package/dist/chunk-BITHG5X4.js +2 -0
  33. package/dist/chunk-BITHG5X4.js.map +1 -0
  34. package/dist/{chunk-2RZABLV2.js → chunk-BP2JYRI7.js} +2 -2
  35. package/dist/chunk-CKVQ4PIK.js +2 -0
  36. package/dist/chunk-CKVQ4PIK.js.map +1 -0
  37. package/dist/{chunk-A6EYY3FO.js → chunk-CVDZ35YA.js} +2 -2
  38. package/dist/{chunk-4RULC3AZ.js → chunk-CWEPL5J3.js} +2 -2
  39. package/dist/chunk-E5PSJ75C.js +2 -0
  40. package/dist/chunk-E5PSJ75C.js.map +1 -0
  41. package/dist/{chunk-CEUBVUKV.js → chunk-EGVWFZBR.js} +2 -2
  42. package/dist/chunk-FB2QGVI2.js +2 -0
  43. package/dist/chunk-FB2QGVI2.js.map +1 -0
  44. package/dist/{chunk-MLB2I27G.js → chunk-FCRW2EG3.js} +2 -2
  45. package/dist/chunk-FHHAGWU5.js +2 -0
  46. package/dist/chunk-FHHAGWU5.js.map +1 -0
  47. package/dist/chunk-FZ7FWFJX.js +1 -0
  48. package/dist/chunk-GC23RRCI.js +2 -0
  49. package/dist/chunk-GC23RRCI.js.map +1 -0
  50. package/dist/{chunk-ZSDJZMQW.js → chunk-GGXKORRZ.js} +2 -2
  51. package/dist/{chunk-ZSDJZMQW.js.map → chunk-GGXKORRZ.js.map} +1 -1
  52. package/dist/{chunk-HQI6W7PR.js → chunk-GNZJOPIS.js} +2 -2
  53. package/dist/{chunk-CYKK3LPJ.js → chunk-GS5NA664.js} +2 -2
  54. package/dist/{chunk-LBUNJ5J3.js → chunk-HRA6BY3O.js} +2 -2
  55. package/dist/chunk-JB6XA3P6.js +2 -0
  56. package/dist/chunk-JB6XA3P6.js.map +1 -0
  57. package/dist/chunk-JBUNDNKJ.js +2 -0
  58. package/dist/chunk-JBUNDNKJ.js.map +1 -0
  59. package/dist/{chunk-ITSQE6EW.js → chunk-JWZIWG4T.js} +2 -2
  60. package/dist/{chunk-7C2Z2EE5.js → chunk-K4VWUMNO.js} +2 -2
  61. package/dist/chunk-KN4F5TMS.js +2 -0
  62. package/dist/chunk-KN4F5TMS.js.map +1 -0
  63. package/dist/{chunk-73H6SO2E.js → chunk-LCIBPBLY.js} +2 -2
  64. package/dist/{chunk-CRXPRR3R.js → chunk-M4EVWRWB.js} +2 -2
  65. package/dist/{chunk-7JQPHRUK.js → chunk-MCAK5KPI.js} +2 -2
  66. package/dist/chunk-MDQ6YJMV.js +2 -0
  67. package/dist/chunk-MDQ6YJMV.js.map +1 -0
  68. package/dist/{chunk-QXPWESEW.js → chunk-MGOT272R.js} +2 -2
  69. package/dist/{chunk-NVMZDPMF.js → chunk-MORMQBAF.js} +2 -2
  70. package/dist/chunk-N6G4VZXF.js +2 -0
  71. package/dist/chunk-N6G4VZXF.js.map +1 -0
  72. package/dist/chunk-NO2TRS5O.js +2 -0
  73. package/dist/chunk-NO2TRS5O.js.map +1 -0
  74. package/dist/chunk-OIBVTGB4.js +2 -0
  75. package/dist/chunk-OIBVTGB4.js.map +1 -0
  76. package/dist/{chunk-OZ63OC3N.js → chunk-OJNWWRD5.js} +2 -2
  77. package/dist/chunk-OZCQ6AOF.js +2 -0
  78. package/dist/chunk-OZCQ6AOF.js.map +1 -0
  79. package/dist/{chunk-I2A4EFDY.js → chunk-PLWXRCGQ.js} +2 -2
  80. package/dist/{chunk-XJVYASHX.js → chunk-QFZ3XVDT.js} +2 -2
  81. package/dist/{chunk-BFOGH4SF.js → chunk-QGGKDM3N.js} +2 -2
  82. package/dist/{chunk-MRMVBBVZ.js → chunk-QIN5BLVI.js} +2 -2
  83. package/dist/{chunk-GP237GUO.js → chunk-R2VVXLL7.js} +2 -2
  84. package/dist/{chunk-PHN4XMPV.js → chunk-R4LFNFC2.js} +2 -2
  85. package/dist/{chunk-ALYKEN3E.js → chunk-RJZ426NO.js} +2 -2
  86. package/dist/{chunk-4B36XRKA.js → chunk-RNNZ5ZKE.js} +2 -2
  87. package/dist/{chunk-BF2D5O5H.js → chunk-RUMP764Z.js} +2 -2
  88. package/dist/{chunk-XGEKV3FC.js → chunk-SERAGBDA.js} +2 -2
  89. package/dist/{chunk-3BREUYLG.js → chunk-U23SN7CM.js} +2 -2
  90. package/dist/{chunk-53NFLDRX.js → chunk-UBLE2J7V.js} +2 -2
  91. package/dist/chunk-UH3E6HSQ.js +2 -0
  92. package/dist/{chunk-7P5B6XHM.js → chunk-UQYM3PBZ.js} +2 -2
  93. package/dist/{chunk-56DXHJNR.js → chunk-V2PBVCRH.js} +2 -2
  94. package/dist/{chunk-A4KEKMEQ.js → chunk-X4GAGLFN.js} +2 -2
  95. package/dist/{chunk-2VS6B3PC.js → chunk-XGMQPLVG.js} +2 -2
  96. package/dist/{chunk-BI6U55BD.js → chunk-XVW2URFK.js} +2 -2
  97. package/dist/{chunk-NCA3UCCX.js → chunk-Y7QVIBFX.js} +2 -2
  98. package/dist/{chunk-ZTDKPUB5.js → chunk-ZJ3JHILJ.js} +2 -2
  99. package/dist/{chunk-GGBEM452.js → chunk-ZTVYWMBY.js} +2 -2
  100. package/dist/chunk-ZX5OIIJX.js +1 -0
  101. package/dist/chunk-ZX5OIIJX.js.map +1 -0
  102. package/dist/flows/ContractAmendment/ContractAmendmentBack.js +1 -1
  103. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +1 -1
  104. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js +1 -1
  105. package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +5 -2
  106. package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
  107. package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +1 -1
  108. package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
  109. package/dist/flows/ContractAmendment/ContractAmendmentSubmit.js +1 -1
  110. package/dist/flows/ContractAmendment/context.d.ts +5 -5
  111. package/dist/flows/ContractAmendment/hooks.d.ts +7 -4
  112. package/dist/flows/ContractAmendment/hooks.js +1 -1
  113. package/dist/flows/ContractAmendment/index.d.ts +5 -2
  114. package/dist/flows/ContractAmendment/index.js +1 -1
  115. package/dist/flows/ContractAmendment/utils.d.ts +1 -1
  116. package/dist/flows/CostCalculator/CostCalculatorDisclaimer.js +1 -1
  117. package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +25 -3
  118. package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
  119. package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +17 -2
  120. package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
  121. package/dist/flows/CostCalculator/CostCalculatorResetButton.js +1 -1
  122. package/dist/flows/CostCalculator/CostCalculatorSubmitButton.js +1 -1
  123. package/dist/flows/CostCalculator/EstimationResults/EstimationResults.d.ts +1 -1
  124. package/dist/flows/CostCalculator/EstimationResults/EstimationResults.js +1 -1
  125. package/dist/flows/CostCalculator/Results/CostCalculatorBenefitsBreakdown.js +1 -1
  126. package/dist/flows/CostCalculator/Results/CostCalculatorContributionsBreakdown.js +1 -1
  127. package/dist/flows/CostCalculator/Results/CostCalculatorExtraStatutoryPaymentsBreakdown.js +1 -1
  128. package/dist/flows/CostCalculator/Results/CostCalculatorGrossSalary.js +1 -1
  129. package/dist/flows/CostCalculator/Results/CostCalculatorIndirectTax.js +1 -1
  130. package/dist/flows/CostCalculator/Results/CostCalculatorResults.d.ts +1 -1
  131. package/dist/flows/CostCalculator/Results/CostCalculatorResults.js +1 -1
  132. package/dist/flows/CostCalculator/Results/CostCalculatorResultsChart.js +1 -1
  133. package/dist/flows/CostCalculator/Results/CostCalculatorTotalCost.js +1 -1
  134. package/dist/flows/CostCalculator/SummaryResults/SummaryResults.d.ts +1 -1
  135. package/dist/flows/CostCalculator/SummaryResults/SummaryResults.js +1 -1
  136. package/dist/flows/CostCalculator/api.d.ts +17 -2
  137. package/dist/flows/CostCalculator/api.js +1 -1
  138. package/dist/flows/CostCalculator/components/SalaryField.d.ts +2 -2
  139. package/dist/flows/CostCalculator/components/SalaryField.js +1 -1
  140. package/dist/flows/CostCalculator/context.d.ts +20 -7
  141. package/dist/flows/CostCalculator/hooks.d.ts +24 -4
  142. package/dist/flows/CostCalculator/hooks.js +1 -1
  143. package/dist/flows/CostCalculator/index.d.ts +7 -6
  144. package/dist/flows/CostCalculator/index.js +1 -1
  145. package/dist/flows/CostCalculator/types.d.ts +1 -1
  146. package/dist/flows/CostCalculator/utils.d.ts +4 -3
  147. package/dist/flows/CostCalculator/utils.js +1 -1
  148. package/dist/flows/Onboarding/OnboardingFlow.d.ts +6 -6
  149. package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
  150. package/dist/flows/Onboarding/api.d.ts +2 -2
  151. package/dist/flows/Onboarding/api.js +1 -1
  152. package/dist/flows/Onboarding/components/AnnualGrossSalary.d.ts +2 -2
  153. package/dist/flows/Onboarding/components/AnnualGrossSalary.js +1 -1
  154. package/dist/flows/Onboarding/components/BasicInformationStep.d.ts +7 -2
  155. package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
  156. package/dist/flows/Onboarding/components/BenefitsStep.d.ts +3 -3
  157. package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
  158. package/dist/flows/Onboarding/components/ContractDetailsStep.d.ts +7 -2
  159. package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
  160. package/dist/flows/Onboarding/components/OnboardingBack.js +1 -1
  161. package/dist/flows/Onboarding/components/OnboardingForm.d.ts +2 -2
  162. package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
  163. package/dist/flows/Onboarding/components/OnboardingInvite.d.ts +6 -2
  164. package/dist/flows/Onboarding/components/OnboardingInvite.js +1 -1
  165. package/dist/flows/Onboarding/components/OnboardingSubmit.js +1 -1
  166. package/dist/flows/Onboarding/components/ReviewStep.d.ts +1 -1
  167. package/dist/flows/Onboarding/components/SaveDraftButton.d.ts +6 -1
  168. package/dist/flows/Onboarding/components/SelectCountryStep.d.ts +7 -2
  169. package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
  170. package/dist/flows/Onboarding/context.d.ts +4 -4
  171. package/dist/flows/Onboarding/hooks.d.ts +4 -4
  172. package/dist/flows/Onboarding/hooks.js +1 -1
  173. package/dist/flows/Onboarding/index.d.ts +7 -7
  174. package/dist/flows/Onboarding/index.js +1 -1
  175. package/dist/flows/Onboarding/types.d.ts +2 -9
  176. package/dist/flows/Onboarding/utils.d.ts +3 -10
  177. package/dist/flows/Onboarding/utils.js +1 -1
  178. package/dist/flows/Termination/AdditionalDetailsForm.d.ts +1 -1
  179. package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
  180. package/dist/flows/Termination/EmployeeComunicationForm.d.ts +1 -1
  181. package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
  182. package/dist/flows/Termination/PaidTimeOffForm.d.ts +1 -1
  183. package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
  184. package/dist/flows/Termination/TerminationBack.js +1 -1
  185. package/dist/flows/Termination/TerminationDetailsForm.d.ts +1 -1
  186. package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
  187. package/dist/flows/Termination/TerminationDialogInfoContent/TerminationDialogInfoContent.d.ts +5 -0
  188. package/dist/flows/Termination/TerminationDialogInfoContent/TerminationDialogInfoContent.js +2 -0
  189. package/dist/flows/Termination/TerminationDialogInfoContent/TerminationDialogInfoContent.js.map +1 -0
  190. package/dist/flows/Termination/TerminationFlow.d.ts +7 -4
  191. package/dist/flows/Termination/TerminationFlow.js +1 -1
  192. package/dist/flows/Termination/TerminationForm.d.ts +1 -1
  193. package/dist/flows/Termination/TerminationForm.js +1 -1
  194. package/dist/flows/Termination/TerminationReasonsDetailContent/TerminationReasonsDetailContent.d.ts +5 -0
  195. package/dist/flows/Termination/TerminationReasonsDetailContent/TerminationReasonsDetailContent.js +2 -0
  196. package/dist/flows/Termination/TerminationReasonsDetailContent/TerminationReasonsDetailContent.js.map +1 -0
  197. package/dist/flows/Termination/TerminationSubmit.js +1 -1
  198. package/dist/flows/Termination/TimeOff.d.ts +1 -1
  199. package/dist/flows/Termination/TimeOff.js +1 -1
  200. package/dist/flows/Termination/context.d.ts +3 -3
  201. package/dist/flows/Termination/hooks.d.ts +9 -5
  202. package/dist/flows/Termination/hooks.js +1 -1
  203. package/dist/flows/Termination/index.d.ts +8 -3
  204. package/dist/flows/Termination/index.js +1 -1
  205. package/dist/flows/Termination/json-schemas/employeeComunication.d.ts +1 -0
  206. package/dist/flows/Termination/json-schemas/employeeComunication.js +1 -1
  207. package/dist/flows/Termination/json-schemas/jsonSchema.d.ts +17 -1
  208. package/dist/flows/Termination/json-schemas/jsonSchema.js +1 -1
  209. package/dist/flows/Termination/json-schemas/schema.js +1 -1
  210. package/dist/flows/Termination/json-schemas/terminationDetails.d.ts +16 -0
  211. package/dist/flows/Termination/json-schemas/terminationDetails.js +1 -1
  212. package/dist/flows/Termination/types.d.ts +1 -1
  213. package/dist/flows/api.d.ts +23 -0
  214. package/dist/flows/api.js +2 -0
  215. package/dist/flows/api.js.map +1 -0
  216. package/dist/index.css +1 -1
  217. package/dist/index.css.map +1 -1
  218. package/dist/index.d.ts +14 -10
  219. package/dist/index.js +1 -1
  220. package/dist/index.js.map +1 -1
  221. package/dist/internals.js +1 -1
  222. package/dist/internals.js.map +1 -1
  223. package/dist/{mutations-B6HWH-rZ.d.ts → mutations-BHTJydCx.d.ts} +2 -0
  224. package/dist/{remoteFlows-BdsVZGGF.d.ts → remoteFlows-bfHFRZSe.d.ts} +9 -2
  225. package/dist/{types.gen-nWJIP4db.d.ts → types.gen-BWjuA7VH.d.ts} +43 -5
  226. package/package.json +2 -2
  227. package/dist/chunk-3LOVCTCN.js +0 -2
  228. package/dist/chunk-3LOVCTCN.js.map +0 -1
  229. package/dist/chunk-3O2RD3RK.js +0 -2
  230. package/dist/chunk-3O2RD3RK.js.map +0 -1
  231. package/dist/chunk-6GMGXSKN.js +0 -2
  232. package/dist/chunk-6ZPISRAG.js +0 -2
  233. package/dist/chunk-6ZPISRAG.js.map +0 -1
  234. package/dist/chunk-EGQJ7UBR.js +0 -2
  235. package/dist/chunk-EGQJ7UBR.js.map +0 -1
  236. package/dist/chunk-F66G33YT.js +0 -2
  237. package/dist/chunk-F66G33YT.js.map +0 -1
  238. package/dist/chunk-FTW6Z4IF.js +0 -2
  239. package/dist/chunk-FTW6Z4IF.js.map +0 -1
  240. package/dist/chunk-JODJFARP.js +0 -2
  241. package/dist/chunk-JODJFARP.js.map +0 -1
  242. package/dist/chunk-JUJZENG7.js +0 -2
  243. package/dist/chunk-JUJZENG7.js.map +0 -1
  244. package/dist/chunk-M22FKNEY.js +0 -1
  245. package/dist/chunk-NBCZF2FO.js +0 -2
  246. package/dist/chunk-QW4JPW6J.js.map +0 -1
  247. package/dist/chunk-R2UI3WAJ.js +0 -2
  248. package/dist/chunk-R2UI3WAJ.js.map +0 -1
  249. package/dist/chunk-UWIFE5LJ.js +0 -2
  250. package/dist/chunk-UWIFE5LJ.js.map +0 -1
  251. package/dist/chunk-V2YORDAL.js +0 -2
  252. package/dist/chunk-V2YORDAL.js.map +0 -1
  253. package/dist/chunk-VX2UC3HG.js +0 -2
  254. package/dist/chunk-VX2UC3HG.js.map +0 -1
  255. package/dist/chunk-WWANHPT7.js +0 -2
  256. package/dist/chunk-WWANHPT7.js.map +0 -1
  257. package/dist/chunk-ZOKSYPOP.js +0 -2
  258. package/dist/chunk-ZOKSYPOP.js.map +0 -1
  259. /package/dist/{chunk-ANXYPRBG.js.map → chunk-2I5DIIJP.js.map} +0 -0
  260. /package/dist/{chunk-7VUILYZ3.js.map → chunk-2QGDCMCE.js.map} +0 -0
  261. /package/dist/{chunk-E5YN6OT3.js.map → chunk-3PCSFTM3.js.map} +0 -0
  262. /package/dist/{chunk-JB55FFG6.js.map → chunk-4C6O4QTI.js.map} +0 -0
  263. /package/dist/{chunk-A522V6XF.js.map → chunk-4KA5AP7X.js.map} +0 -0
  264. /package/dist/{chunk-63HVO7J5.js.map → chunk-5CGII7CZ.js.map} +0 -0
  265. /package/dist/{chunk-H4KE45NG.js.map → chunk-5T25IMZ3.js.map} +0 -0
  266. /package/dist/{chunk-QQ7KPOLK.js.map → chunk-6O6CNAMF.js.map} +0 -0
  267. /package/dist/{chunk-4R3ITKOA.js.map → chunk-756MHC7A.js.map} +0 -0
  268. /package/dist/{chunk-RZTT3MEP.js.map → chunk-76VMCRDE.js.map} +0 -0
  269. /package/dist/{chunk-TXSJL3HC.js.map → chunk-7IHBNPZK.js.map} +0 -0
  270. /package/dist/{chunk-6NKUEDYP.js.map → chunk-A42AGGNH.js.map} +0 -0
  271. /package/dist/{chunk-N5I33LIN.js.map → chunk-A76UTPRW.js.map} +0 -0
  272. /package/dist/{chunk-DCRLPAJL.js.map → chunk-A7ZEA2WU.js.map} +0 -0
  273. /package/dist/{chunk-UHS3QRA3.js.map → chunk-ASKKS4Z3.js.map} +0 -0
  274. /package/dist/{chunk-TLC5WQY2.js.map → chunk-ATC4YO7K.js.map} +0 -0
  275. /package/dist/{chunk-DBDVBJDV.js.map → chunk-B3WXLC2R.js.map} +0 -0
  276. /package/dist/{chunk-2RZABLV2.js.map → chunk-BP2JYRI7.js.map} +0 -0
  277. /package/dist/{chunk-A6EYY3FO.js.map → chunk-CVDZ35YA.js.map} +0 -0
  278. /package/dist/{chunk-4RULC3AZ.js.map → chunk-CWEPL5J3.js.map} +0 -0
  279. /package/dist/{chunk-CEUBVUKV.js.map → chunk-EGVWFZBR.js.map} +0 -0
  280. /package/dist/{chunk-MLB2I27G.js.map → chunk-FCRW2EG3.js.map} +0 -0
  281. /package/dist/{chunk-M22FKNEY.js.map → chunk-FZ7FWFJX.js.map} +0 -0
  282. /package/dist/{chunk-HQI6W7PR.js.map → chunk-GNZJOPIS.js.map} +0 -0
  283. /package/dist/{chunk-CYKK3LPJ.js.map → chunk-GS5NA664.js.map} +0 -0
  284. /package/dist/{chunk-LBUNJ5J3.js.map → chunk-HRA6BY3O.js.map} +0 -0
  285. /package/dist/{chunk-ITSQE6EW.js.map → chunk-JWZIWG4T.js.map} +0 -0
  286. /package/dist/{chunk-7C2Z2EE5.js.map → chunk-K4VWUMNO.js.map} +0 -0
  287. /package/dist/{chunk-73H6SO2E.js.map → chunk-LCIBPBLY.js.map} +0 -0
  288. /package/dist/{chunk-CRXPRR3R.js.map → chunk-M4EVWRWB.js.map} +0 -0
  289. /package/dist/{chunk-7JQPHRUK.js.map → chunk-MCAK5KPI.js.map} +0 -0
  290. /package/dist/{chunk-QXPWESEW.js.map → chunk-MGOT272R.js.map} +0 -0
  291. /package/dist/{chunk-NVMZDPMF.js.map → chunk-MORMQBAF.js.map} +0 -0
  292. /package/dist/{chunk-OZ63OC3N.js.map → chunk-OJNWWRD5.js.map} +0 -0
  293. /package/dist/{chunk-I2A4EFDY.js.map → chunk-PLWXRCGQ.js.map} +0 -0
  294. /package/dist/{chunk-XJVYASHX.js.map → chunk-QFZ3XVDT.js.map} +0 -0
  295. /package/dist/{chunk-BFOGH4SF.js.map → chunk-QGGKDM3N.js.map} +0 -0
  296. /package/dist/{chunk-MRMVBBVZ.js.map → chunk-QIN5BLVI.js.map} +0 -0
  297. /package/dist/{chunk-GP237GUO.js.map → chunk-R2VVXLL7.js.map} +0 -0
  298. /package/dist/{chunk-PHN4XMPV.js.map → chunk-R4LFNFC2.js.map} +0 -0
  299. /package/dist/{chunk-ALYKEN3E.js.map → chunk-RJZ426NO.js.map} +0 -0
  300. /package/dist/{chunk-4B36XRKA.js.map → chunk-RNNZ5ZKE.js.map} +0 -0
  301. /package/dist/{chunk-BF2D5O5H.js.map → chunk-RUMP764Z.js.map} +0 -0
  302. /package/dist/{chunk-XGEKV3FC.js.map → chunk-SERAGBDA.js.map} +0 -0
  303. /package/dist/{chunk-3BREUYLG.js.map → chunk-U23SN7CM.js.map} +0 -0
  304. /package/dist/{chunk-53NFLDRX.js.map → chunk-UBLE2J7V.js.map} +0 -0
  305. /package/dist/{chunk-6GMGXSKN.js.map → chunk-UH3E6HSQ.js.map} +0 -0
  306. /package/dist/{chunk-7P5B6XHM.js.map → chunk-UQYM3PBZ.js.map} +0 -0
  307. /package/dist/{chunk-56DXHJNR.js.map → chunk-V2PBVCRH.js.map} +0 -0
  308. /package/dist/{chunk-A4KEKMEQ.js.map → chunk-X4GAGLFN.js.map} +0 -0
  309. /package/dist/{chunk-2VS6B3PC.js.map → chunk-XGMQPLVG.js.map} +0 -0
  310. /package/dist/{chunk-BI6U55BD.js.map → chunk-XVW2URFK.js.map} +0 -0
  311. /package/dist/{chunk-NCA3UCCX.js.map → chunk-Y7QVIBFX.js.map} +0 -0
  312. /package/dist/{chunk-ZTDKPUB5.js.map → chunk-ZJ3JHILJ.js.map} +0 -0
  313. /package/dist/{chunk-GGBEM452.js.map → chunk-ZTVYWMBY.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/CostCalculator/utils.ts","../src/flows/CostCalculator/hooks.tsx"],"sourcesContent":["import type {\n CostCalculatorEmploymentParam,\n CostCalculatorEstimateParams,\n} from '@/src/client';\n\nimport { $TSFixMe } from '@/src/types/remoteFlows';\nimport { AnyObjectSchema, number, object } from 'yup';\nimport { CostCalculatorVersion, defaultEstimationOptions } from './hooks';\nimport type {\n CostCalculatorEstimationOptions,\n CostCalculatorEstimationSubmitValues,\n CurrencyKey,\n} from './types';\nimport { BASE_RATES } from '@/src/flows/CostCalculator/constants';\n\n/**\n * Build the validation schema for the form.\n * @returns\n */\nexport function buildValidationSchema(\n fields: $TSFixMe[],\n employerBillingCurrency: string,\n includeEstimationTitle?: boolean,\n) {\n const fieldsSchema = fields.reduce<Record<string, AnyObjectSchema>>(\n (fieldsSchemaAcc, field) => {\n // Special handling for salary fields\n if (field.name === 'salary' || field.name === 'salary_conversion') {\n fieldsSchemaAcc[field.name] = (field.schema as AnyObjectSchema).when(\n 'salary_converted',\n {\n is: (val: string | null) => val === field.name,\n then: (schema) => schema.required('Required field'),\n otherwise: (schema) => schema.optional(),\n },\n );\n } else if (field.name === 'management') {\n fieldsSchemaAcc[field.name] = object({\n management_fee: number()\n .transform((value) => {\n return isNaN(value) ? undefined : value;\n })\n .min(0, 'Management fee must be greater than or equal to 0')\n .max(\n employerBillingCurrency\n ? BASE_RATES[employerBillingCurrency as CurrencyKey]\n : BASE_RATES.USD,\n () => {\n const maxValue = employerBillingCurrency\n ? BASE_RATES[employerBillingCurrency as CurrencyKey]\n : BASE_RATES.USD;\n const displayValue = maxValue / 100;\n return `Management fee cannot exceed ${displayValue} ${employerBillingCurrency}`;\n },\n ),\n });\n } else if (field.name === 'estimation_title' && includeEstimationTitle) {\n // Make estimation_title required when includeEstimationTitle is true\n fieldsSchemaAcc[field.name] = (\n field.schema as AnyObjectSchema\n ).required('Required field');\n } else {\n fieldsSchemaAcc[field.name] = field.schema as AnyObjectSchema;\n }\n return fieldsSchemaAcc;\n },\n {},\n );\n return object(fieldsSchema) as AnyObjectSchema;\n}\n\n/**\n * Format the benefits to the expected format by the API.\n * @param benefits\n * @returns\n */\nfunction formatBenefits(benefits: Record<string, string>) {\n const needle = 'benefit-';\n return Object.keys(benefits).reduce<\n Array<{ benefit_group_slug: string; benefit_tier_slug: string }>\n >((acc, key) => {\n const benefitTierSlug = benefits[key];\n if (benefitTierSlug === 'none') {\n return acc;\n }\n const benefitGroupSlug = key.replace(needle, '');\n const benefitEntry = {\n benefit_group_slug: benefitGroupSlug,\n benefit_tier_slug: benefitTierSlug,\n };\n return [...acc, benefitEntry];\n }, []);\n}\n\nfunction mapValueToEmployment(\n value: CostCalculatorEstimationSubmitValues,\n estimationOptions: CostCalculatorEstimationOptions,\n version: CostCalculatorVersion,\n): CostCalculatorEmploymentParam {\n const managementFee = Number(value.management?.management_fee);\n const currencyCode = value.currency_code;\n\n const base: CostCalculatorEmploymentParam = {\n region_slug: value.region || value.country,\n employment_term: value.contract_duration_type ?? 'fixed',\n title: value.estimation_title || estimationOptions.title,\n age: value.age ?? undefined,\n ...(value.benefits && { benefits: formatBenefits(value.benefits) }),\n ...(estimationOptions.includeManagementFee &&\n managementFee && {\n discount: {\n quoted_amount: estimationOptions.showManagementFee\n ? managementFee\n : BASE_RATES[currencyCode as keyof typeof BASE_RATES] ||\n BASE_RATES.USD,\n text: '',\n },\n }),\n };\n\n return {\n ...base,\n ...getSalaryFields(value, version),\n };\n}\n\nfunction getSalaryFields(\n value: CostCalculatorEstimationSubmitValues,\n version: CostCalculatorVersion,\n): Partial<CostCalculatorEmploymentParam> {\n const isMarketing =\n version === 'marketing' || value.salary_converted === 'salary_conversion';\n const isStandard =\n version === 'standard' && value.salary_converted === 'salary';\n const useHiringBudget = value.hiring_budget === 'my_hiring_budget';\n\n if (isMarketing) {\n const useEmployerCurrency = value.salary_converted === 'salary_conversion';\n return useHiringBudget\n ? {\n annual_total_cost_in_employer_currency: value.salary,\n }\n : {\n [useEmployerCurrency\n ? 'annual_gross_salary_in_employer_currency'\n : 'annual_gross_salary']: value.salary,\n };\n }\n\n if (isStandard) {\n return useHiringBudget\n ? {\n annual_total_cost: value.salary,\n }\n : {\n annual_gross_salary: value.salary,\n };\n }\n\n return {};\n}\n\n/**\n * Build the payload for the cost calculator estimation.\n * @param values\n * @param estimationOptions\n * @returns\n */\nexport function buildPayload(\n values:\n | CostCalculatorEstimationSubmitValues\n | CostCalculatorEstimationSubmitValues[],\n estimationOptions: CostCalculatorEstimationOptions = defaultEstimationOptions,\n version: CostCalculatorVersion = 'standard',\n): CostCalculatorEstimateParams {\n const employments = Array.isArray(values) ? values : [values];\n\n if (employments.length === 0) {\n throw new Error('At least one employment value is required');\n }\n\n if (employments.length > 1) {\n const currencies = new Set(employments.map((v) => v.currency));\n if (currencies.size > 1) {\n console.warn(\n 'Multiple currencies detected in array. Using currency from first employment.',\n );\n }\n }\n\n return {\n employer_currency_slug: employments[0].currency,\n include_benefits: estimationOptions.includeBenefits,\n include_cost_breakdowns: estimationOptions.includeCostBreakdowns,\n include_premium_benefits: estimationOptions.includePremiumBenefits,\n include_management_fee: estimationOptions.includeManagementFee,\n employments: employments.map((value) =>\n mapValueToEmployment(value, estimationOptions, version),\n ),\n };\n}\n","import {\n CostCalculatorEstimateResponse,\n MinimalRegion,\n PostCreateEstimationError,\n} from '@/src/client';\nimport { jsonSchema } from '@/src/flows/CostCalculator/jsonSchema';\nimport type {\n CostCalculatorEstimationFormValues,\n CostCalculatorEstimationOptions,\n CostCalculatorEstimationSubmitValues,\n EstimationError,\n UseCostCalculatorOptions,\n} from '@/src/flows/CostCalculator/types';\nimport type { JSFModify, Result } from '@/src/flows/types';\n\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { iterateErrors } from '@/src/components/form/yupValidationResolver';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { string, ValidationError } from 'yup';\nimport { buildPayload, buildValidationSchema } from './utils';\nimport {\n useCompanyCurrencies,\n useCostCalculatorCountries,\n useCostCalculatorEstimation,\n useRegionFields,\n} from '@/src/flows/CostCalculator/api';\nimport { $TSFixMe, JSFField } from '@/src/types/remoteFlows';\nimport { SalaryField } from '@/src/flows/CostCalculator/components/SalaryField';\nimport {\n FieldSetField,\n FieldSetProps,\n} from '@/src/components/form/fields/FieldSetField';\n\nexport type CostCalculatorVersion = 'standard' | 'marketing';\n\ntype CostCalculatorCountry = {\n value: string;\n label: string;\n childRegions: MinimalRegion[];\n hasAdditionalFields: boolean | undefined;\n regionSlug: string;\n currency: string;\n};\n\ntype JSFValidationError = {\n formErrors: Record<\n string,\n {\n type: string;\n message: string;\n }\n >;\n yupError: ValidationError;\n};\n\nexport const defaultEstimationOptions: CostCalculatorEstimationOptions = {\n title: 'Estimation',\n includeBenefits: false,\n includeCostBreakdowns: false,\n includePremiumBenefits: false,\n enableCurrencyConversion: false,\n includeEstimationTitle: false,\n includeManagementFee: false,\n};\n\ntype UseCostCalculatorParams = {\n /**\n * The default region slug to preselect a country and a region.\n */\n defaultRegion?: string;\n /**\n * The default currency slug to preselect a currency.\n */\n defaultCurrency?: string;\n\n /**\n * The default salary to preselect a salary.\n */\n defaultSalary?: string;\n /**\n * The estimation options.\n */\n estimationOptions: CostCalculatorEstimationOptions;\n options?: UseCostCalculatorOptions;\n version?: CostCalculatorVersion;\n};\n\nconst useStaticSchema = (options?: { jsfModify?: JSFModify }) => {\n const { schema: jsonSchemaModified } = modify(\n jsonSchema.data.schema,\n options?.jsfModify || {},\n );\n\n return createHeadlessForm(jsonSchemaModified);\n};\n\ntype HiringBudget = 'my_hiring_budget' | 'employee_annual_salary';\n\nfunction getSalaryTitle(\n salaryField: unknown,\n hiringBudget?: HiringBudget,\n): string {\n if (\n typeof salaryField === 'object' &&\n salaryField !== null &&\n 'title' in salaryField\n ) {\n const title = (salaryField as { title?: string }).title;\n if (title) return title;\n }\n return hiringBudget === 'my_hiring_budget'\n ? 'Hiring budget'\n : \"Employee's annual salary\";\n}\n\n/**\n * Hook to use the cost calculator.\n */\nexport const useCostCalculator = (\n {\n defaultRegion,\n defaultCurrency,\n defaultSalary,\n estimationOptions,\n options,\n version,\n }: UseCostCalculatorParams = {\n estimationOptions: defaultEstimationOptions,\n },\n) => {\n const [selectedRegion, setSelectedRegion] = useState<string | undefined>(\n defaultRegion,\n );\n const [selectedCountry, setSelectedCountry] =\n useState<CostCalculatorCountry>();\n const [employerBillingCurrency, setEmployerBillingCurrency] = useState<\n string | undefined\n >();\n const [hiringBudget, setHiringBudget] = useState<HiringBudget>();\n const { data: countries, isLoading: isLoadingCountries } =\n useCostCalculatorCountries({\n includePremiumBenefits: estimationOptions.includePremiumBenefits,\n });\n const { data: currencies, isLoading: isLoadingCurrencies } =\n useCompanyCurrencies();\n\n const jsonSchemaRegionSlug = selectedRegion || selectedCountry?.value;\n\n const { data: jsonSchemaRegionFields, isLoading: isLoadingRegionFields } =\n useRegionFields(jsonSchemaRegionSlug, {\n includePremiumBenefits: estimationOptions.includePremiumBenefits,\n options,\n });\n const costCalculatorEstimationMutation = useCostCalculatorEstimation();\n const employeeBillingCurrency = selectedCountry?.currency;\n\n const salaryField = options?.jsfModify?.fields?.salary;\n const salaryFieldPresentation =\n salaryField &&\n typeof salaryField === 'object' &&\n 'presentation' in salaryField\n ? (\n salaryField as {\n presentation?: {\n salary_conversion_properties?: {\n label?: string;\n description?: string;\n };\n };\n }\n ).presentation\n : undefined;\n\n const getCurrencies = useCallback(() => {\n const shouldSwapOrder =\n employeeBillingCurrency && employerBillingCurrency\n ? employeeBillingCurrency !== employerBillingCurrency\n : false;\n\n if (employeeBillingCurrency !== employerBillingCurrency) {\n return {\n from: employerBillingCurrency,\n to: employeeBillingCurrency,\n shouldSwapOrder,\n };\n }\n\n return {\n from: employeeBillingCurrency,\n to: employerBillingCurrency,\n shouldSwapOrder,\n };\n }, [employeeBillingCurrency, employerBillingCurrency]);\n\n const showManagementField = estimationOptions.showManagementFee;\n const showEstimationTitleField = estimationOptions.includeEstimationTitle;\n const customFields = useMemo(() => {\n const { from, to, shouldSwapOrder } = getCurrencies();\n const salaryTitle = getSalaryTitle(salaryField, hiringBudget);\n\n return {\n fields: {\n salary: {\n ...salaryField,\n title: salaryTitle,\n presentation: {\n salary_conversion_properties: {\n label:\n salaryFieldPresentation?.salary_conversion_properties?.label,\n description:\n salaryFieldPresentation?.salary_conversion_properties\n ?.description,\n },\n currencies: { from, to },\n Component: (\n props: JSFField & { currencies: { from: string; to: string } },\n ) => {\n return (\n <SalaryField\n {...props}\n shouldSwapOrder={shouldSwapOrder}\n conversionType={\n version === 'marketing' ? 'no_spread' : 'spread'\n }\n defaultValue={defaultSalary}\n />\n );\n },\n },\n },\n hiring_budget: {\n ...options?.jsfModify?.fields?.hiring_budget,\n presentation: {\n hidden: version == 'marketing',\n },\n },\n management: {\n ...options?.jsfModify?.fields?.management,\n properties: {\n ...(options?.jsfModify?.fields?.management as $TSFixMe)?.properties,\n management_fee: {\n ...(options?.jsfModify?.fields?.management as $TSFixMe)\n ?.properties?.management_fee,\n 'x-jsf-presentation': {\n inputType: 'money',\n additionalProps: {\n currency: employerBillingCurrency || 'USD',\n },\n },\n },\n },\n presentation: {\n ...(typeof options?.jsfModify?.fields?.management === 'object'\n ? (\n options?.jsfModify?.fields?.management as Record<\n string,\n $TSFixMe\n >\n )['x-jsf-presentation']\n : {}),\n hidden: !showManagementField,\n Component: (props: FieldSetProps) => {\n return (\n <FieldSetField\n {...props}\n variant='inset'\n features={{\n toggle: {\n enabled: true,\n stateField: 'management._expanded',\n labels: {\n expand: 'Define',\n collapse: 'Remove',\n },\n },\n }}\n />\n );\n },\n },\n },\n estimation_title: {\n ...options?.jsfModify?.fields?.estimation_title,\n 'x-jsf-presentation': {\n hidden: !showEstimationTitleField,\n },\n },\n },\n };\n }, [\n employerBillingCurrency,\n salaryField,\n hiringBudget,\n salaryFieldPresentation?.salary_conversion_properties?.description,\n salaryFieldPresentation?.salary_conversion_properties?.label,\n defaultSalary,\n getCurrencies,\n options?.jsfModify?.fields?.management,\n showManagementField,\n version,\n showEstimationTitleField,\n options?.jsfModify?.fields?.estimation_title,\n ]);\n\n const fieldsJSONSchema = useStaticSchema({\n jsfModify: {\n fields: {\n ...options?.jsfModify?.fields,\n ...customFields?.fields,\n },\n },\n });\n\n useEffect(() => {\n // Initialize selectedCountry from defaultRegion\n if (defaultRegion && countries) {\n const defaultCountry = countries.find(\n ({ value }) => value === defaultRegion,\n );\n if (defaultCountry) {\n setSelectedCountry(defaultCountry);\n }\n }\n }, [defaultRegion, countries]);\n\n useEffect(() => {\n // Initialize selectedCurrency from defaultCurrency\n if (defaultCurrency && currencies) {\n const defaultCurrencyObj = currencies.find(\n ({ value }) => value === defaultCurrency,\n );\n if (defaultCurrencyObj) {\n setEmployerBillingCurrency(defaultCurrencyObj.label);\n }\n }\n }, [defaultCurrency, currencies]);\n\n /**\n * Submit the estimation form with the given values.\n * @param values\n */\n async function onSubmit(\n values: CostCalculatorEstimationSubmitValues,\n ): Promise<Result<CostCalculatorEstimateResponse, EstimationError>> {\n try {\n await validationSchema.validate(values, { abortEarly: false });\n } catch (err) {\n return {\n data: null,\n error: err as ValidationError,\n };\n }\n\n return new Promise((resolve, reject) => {\n costCalculatorEstimationMutation.mutate(\n buildPayload(values, estimationOptions, version),\n {\n onSuccess: (response) => {\n if (response.data) {\n resolve({\n data: response.data,\n error: null,\n });\n } else {\n reject({\n data: null,\n error: response.error as PostCreateEstimationError,\n });\n }\n },\n onError: (error) => {\n reject({\n data: null,\n error: error as PostCreateEstimationError,\n });\n },\n },\n );\n });\n }\n\n /**\n * If the selected country has no child regions and has additional fields,\n * set the current region to the country's region slug and fetch the region fields.\n * @param country\n */\n function onCountryChange(country: string) {\n const currentCountry = countries?.find(({ value }) => value === country);\n\n if (\n currentCountry &&\n currentCountry.childRegions.length === 0 &&\n currentCountry.hasAdditionalFields\n ) {\n setSelectedRegion(currentCountry.regionSlug);\n } else {\n setSelectedRegion(undefined);\n }\n setSelectedCountry(currentCountry);\n }\n\n /**\n * Update the selected region and fetch the region fields.\n * @param region\n */\n function onRegionChange(region: string) {\n setSelectedRegion(region);\n }\n\n function onHiringBudgetChange(event: React.ChangeEvent<HTMLInputElement>) {\n setHiringBudget(event.target.value as HiringBudget);\n }\n\n function onChangeCurrency(currency: string) {\n const selectedCurrency = currencies?.find(\n (c) => c.value === currency,\n )?.label;\n setEmployerBillingCurrency(selectedCurrency);\n options?.onCurrencyChange?.(selectedCurrency || '');\n }\n\n const regionField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'region',\n );\n\n if (regionField) {\n const regions =\n selectedCountry?.childRegions.map((region) => ({\n value: region.slug,\n label: region.name,\n })) ?? [];\n regionField.options = regions;\n regionField.isVisible = regions.length > 0;\n regionField.required = regions.length > 0;\n regionField.onChange = onRegionChange;\n regionField.schema =\n regions.length > 0\n ? string()\n .transform((value) => (typeof value === 'string' ? value : ''))\n .required('Region is required')\n : string();\n }\n\n if (currencies) {\n const currencyField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'currency',\n );\n if (currencyField) {\n currencyField.options = currencies;\n currencyField.onChange = onChangeCurrency;\n }\n }\n\n const hiringBudgetField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'hiring_budget',\n );\n if (hiringBudgetField) {\n hiringBudgetField.onChange = onHiringBudgetChange;\n }\n\n if (countries) {\n const countryField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'country',\n );\n if (countryField) {\n countryField.options = countries;\n countryField.onChange = onCountryChange;\n }\n }\n\n const resetForm = () => {\n setSelectedCountry(undefined);\n setSelectedRegion(defaultRegion);\n };\n\n const allFields = [\n ...fieldsJSONSchema.fields.filter((field) => field.name !== 'management'),\n ...(jsonSchemaRegionFields?.fields || []),\n ...fieldsJSONSchema.fields.filter((field) => field.name === 'management'),\n ];\n\n const validationSchema = buildValidationSchema(\n fieldsJSONSchema.fields,\n employerBillingCurrency || 'USD',\n estimationOptions.includeEstimationTitle,\n );\n\n async function handleValidation(values: CostCalculatorEstimationFormValues) {\n let errors: JSFValidationError | null = null;\n\n options?.onValidation?.(values);\n const parsedValues = parseJSFToValidate(values, allFields);\n\n // 1. validate static fields first using Yup validate function\n try {\n await validationSchema.validate(parsedValues, {\n abortEarly: false,\n });\n errors = {\n formErrors: {},\n yupError: new ValidationError([], values),\n };\n } catch (error) {\n const iterateResult = iterateErrors(error as ValidationError);\n\n errors = {\n // convert the errors to a format that can be used in the form\n formErrors: Object.entries(iterateResult).reduce(\n (acc, [key, value]) => ({ ...acc, [key]: value.message }),\n {},\n ),\n yupError: error as ValidationError,\n };\n }\n\n // 2. validate json schema fields using the handleValidation (from json-schema-form)\n const handleValidationResult =\n jsonSchemaRegionFields?.handleValidation(parsedValues);\n\n // 3. combine the errors from both validations\n const combinedInnerErrors = [\n ...(errors?.yupError.inner || []),\n ...(handleValidationResult?.yupError?.inner || []),\n ];\n const combinedValues = {\n ...(errors?.yupError?.value || {}),\n ...(handleValidationResult?.yupError?.value || {}),\n };\n\n return {\n formErrors: {\n ...(errors?.formErrors || {}),\n ...(handleValidationResult?.formErrors || {}),\n },\n yupError: new ValidationError(combinedInnerErrors, combinedValues),\n };\n }\n\n return {\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState: {\n current: 0,\n total: 1,\n isLastStep: true,\n },\n /**\n * Array of form fields from the cost calculator schema + dynamic region fields like benefits, age, etc.\n */\n fields: allFields,\n /**\n * Validation schema for the cost calculator form\n */\n validationSchema,\n /**\n * Function to parse form values before submission\n * @param values - Form values to parse\n * @returns Parsed form values\n */\n parseFormValues: (\n values: CostCalculatorEstimationFormValues,\n ): CostCalculatorEstimationSubmitValues => {\n const {\n country,\n region,\n currency,\n salary_converted,\n hiring_budget,\n salary_conversion,\n management,\n estimation_title,\n ...rest\n } = values;\n\n // If the salary has been converted, we take the one the user has inputted\n let salary = values.salary;\n if (salary_converted === 'salary_conversion') {\n salary = salary_conversion;\n }\n\n const jsonSchemaStaticFieldValues = {\n country,\n region,\n salary,\n salary_converted,\n salary_conversion,\n hiring_budget,\n currency,\n management,\n estimation_title,\n };\n\n const parsedStaticFields = parseJSFToValidate(\n jsonSchemaStaticFieldValues,\n fieldsJSONSchema.fields,\n );\n\n const parsedRegionFields = parseJSFToValidate(\n rest,\n jsonSchemaRegionFields?.fields || [],\n );\n\n const additionalFields = {\n currency_code: currencies?.find((c) => c.value === currency)?.label,\n };\n\n return {\n ...parsedStaticFields,\n ...parsedRegionFields,\n ...additionalFields,\n } as CostCalculatorEstimationSubmitValues;\n },\n /**\n * Function to handle validation of the cost calculator form\n * @param values - Form values to validate\n * @returns Validation result\n */\n handleValidation,\n /**\n * Whether the cost calculator form is currently being submitted\n */\n isSubmitting: costCalculatorEstimationMutation.isPending,\n /**\n * Whether the cost calculator form is currently loading\n */\n isLoading:\n isLoadingCountries && isLoadingCurrencies && isLoadingRegionFields,\n /**\n * Function to submit the cost calculator form\n */\n onSubmit,\n /**\n * Function to reset the cost calculator form\n */\n resetForm,\n\n /**\n * Currencies data useful to get the currency if you have a currencySlug\n */\n currencies,\n };\n};\n"],"mappings":"qVAMA,OAA0B,UAAAA,GAAQ,UAAAC,OAAc,MCWhD,OAAS,sBAAAC,GAAoB,UAAAC,OAAc,8BAC3C,OAAS,eAAAC,GAAa,aAAAC,EAAW,WAAAC,GAAS,YAAAC,MAAgB,QAC1D,OAAS,UAAAC,EAAQ,mBAAAC,OAAuB,MAwMxB,cAAAC,OAAA,oBAnKT,IAAMC,EAA4D,CACvE,MAAO,aACP,gBAAiB,GACjB,sBAAuB,GACvB,uBAAwB,GACxB,yBAA0B,GAC1B,uBAAwB,GACxB,qBAAsB,EACxB,EAwBMC,GAAkBC,EAACC,GAAwC,CAC/D,GAAM,CAAE,OAAQC,CAAmB,EAAIC,GACrCC,EAAW,KAAK,OAChBH,GAAS,WAAa,CAAC,CACzB,EAEA,OAAOI,GAAmBH,CAAkB,CAC9C,EAPwB,mBAWxB,SAASI,GACPC,EACAC,EACQ,CACR,GACE,OAAOD,GAAgB,UACvBA,IAAgB,MAChB,UAAWA,EACX,CACA,IAAME,EAASF,EAAmC,MAClD,GAAIE,EAAO,OAAOA,CACpB,CACA,OAAOD,IAAiB,mBACpB,gBACA,0BACN,CAfSR,EAAAM,GAAA,kBAoBF,IAAMI,GAAoBV,EAAA,CAC/B,CACE,cAAAW,EACA,gBAAAC,EACA,cAAAC,EACA,kBAAAC,EACA,QAAAb,EACA,QAAAc,CACF,EAA6B,CAC3B,kBAAmBjB,CACrB,IACG,CACH,GAAM,CAACkB,EAAgBC,CAAiB,EAAIC,EAC1CP,CACF,EACM,CAACQ,EAAiBC,CAAkB,EACxCF,EAAgC,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CACnC,CACF,CA9BShB,EAAAc,GAAA,wBAgCT,SAASK,GACPd,EACAW,EACwC,CACxC,IAAMI,EACJJ,IAAY,aAAeX,EAAM,mBAAqB,oBAClDgB,EACJL,IAAY,YAAcX,EAAM,mBAAqB,SACjDiB,EAAkBjB,EAAM,gBAAkB,mBAEhD,GAAIe,EAAa,CACf,IAAMG,EAAsBlB,EAAM,mBAAqB,oBACvD,OAAOiB,EACH,CACE,uCAAwCjB,EAAM,MAChD,EACA,CACE,CAACkB,EACG,2CACA,qBAAqB,EAAGlB,EAAM,MACpC,CACN,CAEA,OAAIgB,EACKC,EACH,CACE,kBAAmBjB,EAAM,MAC3B,EACA,CACE,oBAAqBA,EAAM,MAC7B,EAGC,CAAC,CACV,CAlCSL,EAAAmB,GAAA,mBA0CF,SAASK,GACdC,EAGAV,EAAqDW,EACrDV,EAAiC,WACH,CAC9B,IAAMW,EAAc,MAAM,QAAQF,CAAM,EAAIA,EAAS,CAACA,CAAM,EAE5D,GAAIE,EAAY,SAAW,EACzB,MAAM,IAAI,MAAM,2CAA2C,EAG7D,OAAIA,EAAY,OAAS,GACJ,IAAI,IAAIA,EAAY,IAAKC,GAAMA,EAAE,QAAQ,CAAC,EAC9C,KAAO,GACpB,QAAQ,KACN,8EACF,EAIG,CACL,uBAAwBD,EAAY,CAAC,EAAE,SACvC,iBAAkBZ,EAAkB,gBACpC,wBAAyBA,EAAkB,sBAC3C,yBAA0BA,EAAkB,uBAC5C,uBAAwBA,EAAkB,qBAC1C,YAAaY,EAAY,IAAKtB,GAC5BS,GAAqBT,EAAOU,EAAmBC,CAAO,CACxD,CACF,CACF,CAhCgBhB,EAAAwB,GAAA","names":["number","object","createHeadlessForm","modify","useCallback","useEffect","useMemo","useState","string","ValidationError","jsx","defaultEstimationOptions","useStaticSchema","__name","options","jsonSchemaModified","modify","jsonSchema","createHeadlessForm","getSalaryTitle","salaryField","hiringBudget","title","useCostCalculator","defaultRegion","defaultCurrency","defaultSalary","estimationOptions","version","selectedRegion","setSelectedRegion","useState","selectedCountry","setSelectedCountry","employerBillingCurrency","setEmployerBillingCurrency","setHiringBudget","countries","isLoadingCountries","useCostCalculatorCountries","currencies","isLoadingCurrencies","useCompanyCurrencies","jsonSchemaRegionSlug","jsonSchemaRegionFields","isLoadingRegionFields","useRegionFields","costCalculatorEstimationMutation","useCostCalculatorEstimation","employeeBillingCurrency","salaryFieldPresentation","getCurrencies","useCallback","shouldSwapOrder","showManagementField","showEstimationTitleField","customFields","useMemo","from","to","salaryTitle","props","SalaryField","FieldSetField","fieldsJSONSchema","useEffect","defaultCountry","value","defaultCurrencyObj","onSubmit","values","validationSchema","err","resolve","reject","buildPayload","response","error","onCountryChange","country","currentCountry","onRegionChange","region","onHiringBudgetChange","event","onChangeCurrency","currency","selectedCurrency","c","regionField","field","regions","string","currencyField","hiringBudgetField","countryField","resetForm","allFields","buildValidationSchema","handleValidation","errors","parsedValues","parseJSFToValidate","ValidationError","iterateResult","iterateErrors","acc","key","handleValidationResult","combinedInnerErrors","combinedValues","salary_converted","hiring_budget","salary_conversion","management","estimation_title","rest","salary","parsedStaticFields","parsedRegionFields","additionalFields","buildValidationSchema","fields","employerBillingCurrency","includeEstimationTitle","fieldsSchema","fieldsSchemaAcc","field","__name","val","schema","object","number","value","BASE_RATES","formatBenefits","benefits","needle","acc","key","benefitTierSlug","benefitEntry","mapValueToEmployment","estimationOptions","version","managementFee","currencyCode","getSalaryFields","isMarketing","isStandard","useHiringBudget","useEmployerCurrency","buildPayload","values","defaultEstimationOptions","employments","v"]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-M22FKNEY.js.map
@@ -1,2 +0,0 @@
1
- var e={disclaimerCostCalculator:4668194326797,employeeOnboardingTimeline:4411262104589,extraPayments:4466822781709,internationalPricing:4410698586893,remoteFxRate:33271144977421};export{e as a};
2
- //# sourceMappingURL=chunk-NBCZF2FO.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/mutations.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Meta } from '@/src/flows/Onboarding/types';\nimport { UseMutationResult } from '@tanstack/react-query';\n\ntype MutationData<T> =\n T extends UseMutationResult<infer R, any, any, any> ? R : never;\ntype MutationVariables<T> =\n T extends UseMutationResult<any, any, infer V, any> ? V : never;\ntype MutationError<T> =\n T extends UseMutationResult<any, infer E, any, any> ? E : never;\n\nexport interface SuccessResponse<D> {\n data: D;\n error: null;\n}\n\nexport interface FieldError {\n field: string;\n messages: string[];\n}\n\nexport interface ErrorResponse<E> {\n data: null;\n error: E;\n rawError: Record<string, unknown>;\n fieldErrors: FieldError[];\n}\n\ntype PromiseResult<D, E> = SuccessResponse<D> | ErrorResponse<E>;\n\n/**\n * Extracts field errors from error response into a structured format\n * @param error - The error response object\n * @returns Array of field errors with field name and messages\n */\nexport function extractFieldErrors(error: any): FieldError[] {\n if (!error || !error.errors || typeof error.errors !== 'object') return [];\n\n const fieldErrors: FieldError[] = [];\n\n Object.entries(error.errors).forEach(([key, value]) => {\n if (Array.isArray(value)) {\n fieldErrors.push({\n field: key,\n messages: value.map((msg: any) => String(msg)),\n });\n return;\n }\n if (value && typeof value === 'object') {\n Object.entries(value).forEach(([nestedKey, nestedValue]) => {\n if (Array.isArray(nestedValue)) {\n fieldErrors.push({\n field: nestedKey,\n messages: nestedValue.map((msg: any) => String(msg)),\n });\n }\n });\n }\n });\n return fieldErrors;\n}\n/**\n * Converts a mutation to a promise-based API. We avoid using the\n * `mutateAsync` method from react-query for 2 reasons:\n * 1. We lose the isPending state of the mutation\n * 2. We want to return the data and error in a consistent way\n * (either data or error is null)\n * @param mutation\n * @returns\n */\nexport function mutationToPromise<\n T extends UseMutationResult<any, any, any, any>,\n>(mutation: T) {\n type Data = MutationData<T>;\n type Variables = MutationVariables<T>;\n type Error = MutationError<T>;\n\n return {\n mutateAsync: (values: Variables): Promise<PromiseResult<Data, Error>> => {\n return new Promise((resolve, reject) => {\n mutation.mutate(values, {\n onSuccess: (response) => {\n if (response.data) {\n resolve({\n data: response.data as Data,\n error: null,\n });\n } else {\n const fieldErrors = extractFieldErrors(response.error);\n resolve({\n data: null,\n error: response.error?.message\n ? (new Error(response.error.message) as unknown as Error)\n : (new Error(\n 'Something went wrong. Please try again later.',\n ) as unknown as Error),\n rawError: response.error,\n fieldErrors,\n });\n }\n },\n onError: (error) => {\n const fieldErrors = extractFieldErrors(error);\n reject({\n data: null,\n error: error as Error,\n rawError: error,\n fieldErrors,\n });\n },\n });\n });\n },\n };\n}\n\n/**\n * Enhanced FieldError interface with user-friendly labels\n */\nexport interface NormalizedFieldError extends FieldError {\n userFriendlyLabel: string;\n}\n\n/**\n * Utility function to normalize field errors using field metadata\n * @param fieldErrors - Array of field errors from API response\n * @param meta - Field metadata containing field names and labels\n * @returns Normalized field errors with user-friendly labels\n */\nexport function normalizeFieldErrors(\n fieldErrors: FieldError[],\n meta?: Meta,\n): NormalizedFieldError[] {\n if (!fieldErrors || fieldErrors.length === 0) {\n return [];\n }\n\n return fieldErrors.map((fieldError) => {\n const fieldMeta = meta?.[fieldError.field];\n const userFriendlyLabel = fieldMeta?.label || fieldError.field;\n\n return {\n ...fieldError,\n userFriendlyLabel,\n // Keep the original field name for form integration\n field: fieldError.field,\n messages: fieldError.messages,\n };\n });\n}\n"],"mappings":"wCAmCO,SAASA,EAAmBC,EAA0B,CAC3D,GAAI,CAACA,GAAS,CAACA,EAAM,QAAU,OAAOA,EAAM,QAAW,SAAU,MAAO,CAAC,EAEzE,IAAMC,EAA4B,CAAC,EAEnC,cAAO,QAAQD,EAAM,MAAM,EAAE,QAAQ,CAAC,CAACE,EAAKC,CAAK,IAAM,CACrD,GAAI,MAAM,QAAQA,CAAK,EAAG,CACxBF,EAAY,KAAK,CACf,MAAOC,EACP,SAAUC,EAAM,IAAKC,GAAa,OAAOA,CAAG,CAAC,CAC/C,CAAC,EACD,MACF,CACID,GAAS,OAAOA,GAAU,UAC5B,OAAO,QAAQA,CAAK,EAAE,QAAQ,CAAC,CAACE,EAAWC,CAAW,IAAM,CACtD,MAAM,QAAQA,CAAW,GAC3BL,EAAY,KAAK,CACf,MAAOI,EACP,SAAUC,EAAY,IAAKF,GAAa,OAAOA,CAAG,CAAC,CACrD,CAAC,CAEL,CAAC,CAEL,CAAC,EACMH,CACT,CAzBgBM,EAAAR,EAAA,sBAmCT,SAASS,EAEdC,EAAa,CAKb,MAAO,CACL,YAAaF,EAACG,GACL,IAAI,QAAQ,CAACC,EAASC,IAAW,CACtCH,EAAS,OAAOC,EAAQ,CACtB,UAAWH,EAACM,GAAa,CACvB,GAAIA,EAAS,KACXF,EAAQ,CACN,KAAME,EAAS,KACf,MAAO,IACT,CAAC,MACI,CACL,IAAMZ,EAAcF,EAAmBc,EAAS,KAAK,EACrDF,EAAQ,CACN,KAAM,KACN,MAAOE,EAAS,OAAO,QAClB,IAAI,MAAMA,EAAS,MAAM,OAAO,EAChC,IAAI,MACH,+CACF,EACJ,SAAUA,EAAS,MACnB,YAAAZ,CACF,CAAC,CACH,CACF,EAnBW,aAoBX,QAASM,EAACP,GAAU,CAClB,IAAMC,EAAcF,EAAmBC,CAAK,EAC5CY,EAAO,CACL,KAAM,KACN,MAAOZ,EACP,SAAUA,EACV,YAAAC,CACF,CAAC,CACH,EARS,UASX,CAAC,CACH,CAAC,EAjCU,cAmCf,CACF,CA5CgBM,EAAAC,EAAA,qBA2DT,SAASM,EACdb,EACAc,EACwB,CACxB,MAAI,CAACd,GAAeA,EAAY,SAAW,EAClC,CAAC,EAGHA,EAAY,IAAKe,GAAe,CAErC,IAAMC,EADYF,IAAOC,EAAW,KAAK,GACJ,OAASA,EAAW,MAEzD,MAAO,CACL,GAAGA,EACH,kBAAAC,EAEA,MAAOD,EAAW,MAClB,SAAUA,EAAW,QACvB,CACF,CAAC,CACH,CApBgBT,EAAAO,EAAA","names":["extractFieldErrors","error","fieldErrors","key","value","msg","nestedKey","nestedValue","__name","mutationToPromise","mutation","values","resolve","reject","response","normalizeFieldErrors","meta","fieldError","userFriendlyLabel"]}
@@ -1,2 +0,0 @@
1
- import{a as d,b as p,c as g,d as x}from"./chunk-4RULC3AZ.js";import{a as N}from"./chunk-UHS3QRA3.js";import{a as i,b as y}from"./chunk-3LOVCTCN.js";import{a as c}from"./chunk-P37U34EQ.js";import{ChevronDown as b,Globe as _}from"lucide-react";import{useState as A}from"react";import{Fragment as C,jsx as e,jsxs as r}from"react/jsx-runtime";var w=c(s=>{if(s.length<2)return{currency:null,costsPerCountry:[],employeesCost:null};let t=s[0]?.employer_currency_costs.currency,m=s.reduce((o,a)=>{let l=a.country.name;return o[l]={country:a.country,monthlyTotal:(o[l]?.monthlyTotal||0)+a.employer_currency_costs.monthly_total,annualTotal:(o[l]?.annualTotal||0)+a.employer_currency_costs.annual_total},o},{}),n=Object.values(m).map(({country:o,monthlyTotal:a,annualTotal:l})=>({country:o,monthlyCost:y(a,t.symbol),annualCost:y(l,t.symbol)})),u={monthlyTotal:y(s.reduce((o,a)=>o+a.employer_currency_costs.monthly_total,0),t.symbol),annualTotal:y(s.reduce((o,a)=>o+a.employer_currency_costs.annual_total,0),t.symbol)};return{currency:t,costsPerCountry:n,employeesCost:u}},"useSummaryResults"),T=c(({currency:s,title:t})=>e("div",{className:"flex items-center justify-between w-full",children:r("div",{className:"flex flex-row items-center gap-6",children:[e("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-[#F4F4F5]",children:e(_,{className:"h-6 w-6 text-[#000000]"})}),r("div",{className:"space-y-1",children:[e("h2",{className:"text-lg font-medium leading-none text-[#181818]",children:t}),r("p",{className:"text-xs text-[#71717A]",children:["Employer billing currency: ",s.code]})]})]})}),"SummaryHeader"),f=c(({label:s,columns:t,rows:m,defaultValue:n="accordion",className:u})=>{let o=t.length===1?"grid-cols-2":"grid-cols-3";return e(d,{type:"single",collapsible:!0,defaultValue:n,className:i("w-full",u),children:r(p,{value:n,className:"border-none",children:[e(g,{className:"hover:no-underline px-0 py-3 [&>svg]:hidden group",children:r("div",{className:i("grid items-center w-full",o),children:[r("div",{className:"flex items-center gap-2",children:[s,e(b,{className:"h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),t.length===1?e("span",{className:"text-xs text-[#27272A] text-right",children:t[0]}):t.map((a,l)=>e("span",{className:"text-xs text-[#27272A] text-right",children:a},l))]})}),e(x,{className:"px-0 pb-4",children:e("div",{className:"space-y-3",children:m.map((a,l)=>r("div",{className:i("grid items-center",o),children:[e("div",{className:"flex items-center gap-2",children:a.label}),t.length===1?e("span",{className:"text-sm text-[#09090B] text-right",children:a.values[0]}):a.values.map((h,v)=>e("span",{className:"text-sm text-[#09090B] text-right",children:h},v))]},l))})})]})})},"MultiColumnAccordion"),R=c(({employeesCost:s})=>e(f,{label:e("span",{className:"text-sm font-medium text-[#0F172A]",children:"Cost for all employees"}),columns:["Total cost"],rows:[{label:r(C,{children:[e("span",{className:"w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0"}),e("span",{className:"text-sm text-[#09090B]",children:"Monthly cost"})]}),values:[s.monthlyTotal]},{label:r(C,{children:[e("span",{className:"w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0"}),e("span",{className:"text-sm text-[#09090B]",children:"Annual cost"})]}),values:[s.annualTotal]}],defaultValue:"cost-breakdown"}),"CostForAllEmployees"),S=c(({costsPerCountry:s})=>e(f,{label:e("span",{className:"text-sm font-medium text-[#0F172A]",children:"Cost per country"}),columns:["Monthly cost","Annual cost"],rows:s.map(t=>({label:r(C,{children:[e("span",{className:"w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0"}),e("span",{className:"text-sm text-[#09090B]",children:t.country.name})]}),values:[t.monthlyCost,t.annualCost]})),defaultValue:"country-breakdown"}),"CostsPerCountry"),E=c(({estimations:s})=>{let{currency:t,costsPerCountry:m,employeesCost:n}=w(s),[u,o]=A("summary");return!t||m.length===0||Object.keys(n).length===0?null:e(N,{className:"RemoteFlows__SummaryResults__Card p-10",children:e(d,{type:"single",collapsible:!0,defaultValue:u,onValueChange:o,className:"RemoteFlows__SummaryResults__Accordion w-full",children:r(p,{value:"summary",className:"border-border",children:[e("div",{className:i({RemoteFlows__Separator:u==="summary"}),children:e(g,{iconClassName:"size-6",className:"hover:no-underline px-0 py-4",children:e(T,{currency:t,title:"Summary Overview"})})}),r(x,{className:"px-0 pb-4 mt-6",children:[e("div",{className:"RemoteFlows__Separator",children:e(R,{employeesCost:n})}),e("div",{className:"mt-6",children:e(S,{costsPerCountry:m})})]})]})})})},"SummaryResults");export{E as a};
2
- //# sourceMappingURL=chunk-R2UI3WAJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/CostCalculator/SummaryResults/SummaryResults.tsx"],"sourcesContent":["import { Currency } from '@/src/client';\nimport {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n} from '@/src/components/ui/accordion';\nimport { Card } from '@/src/components/ui/card';\nimport { CostCalculatorEstimation } from '@/src/flows/CostCalculator/types';\nimport { cn, formatCurrency } from '@/src/lib/utils';\nimport { ChevronDown, Globe } from 'lucide-react';\nimport { useState } from 'react';\n\nconst useSummaryResults = (estimations: CostCalculatorEstimation[]) => {\n if (estimations.length < 2) {\n return {\n currency: null,\n costsPerCountry: [],\n employeesCost: null,\n };\n }\n const currency = estimations[0]?.employer_currency_costs.currency;\n const costsPerCountry = estimations.reduce(\n (acc, estimation) => {\n const countryName = estimation.country.name;\n\n acc[countryName] = {\n country: estimation.country,\n monthlyTotal:\n (acc[countryName]?.monthlyTotal || 0) +\n estimation.employer_currency_costs.monthly_total,\n annualTotal:\n (acc[countryName]?.annualTotal || 0) +\n estimation.employer_currency_costs.annual_total,\n };\n\n return acc;\n },\n {} as Record<\n string,\n {\n country: (typeof estimations)[0]['country'];\n monthlyTotal: number;\n annualTotal: number;\n }\n >,\n );\n\n const groupedCostsPerCountry = Object.values(costsPerCountry).map(\n ({ country, monthlyTotal, annualTotal }) => ({\n country,\n monthlyCost: formatCurrency(monthlyTotal, currency.symbol),\n annualCost: formatCurrency(annualTotal, currency.symbol),\n }),\n );\n\n const employeesCost = {\n monthlyTotal: formatCurrency(\n estimations.reduce((acc, estimation) => {\n return acc + estimation.employer_currency_costs.monthly_total;\n }, 0),\n currency.symbol,\n ),\n annualTotal: formatCurrency(\n estimations.reduce((acc, estimation) => {\n return acc + estimation.employer_currency_costs.annual_total;\n }, 0),\n currency.symbol,\n ),\n };\n return { currency, costsPerCountry: groupedCostsPerCountry, employeesCost };\n};\n\nconst SummaryHeader = ({\n currency,\n title,\n}: {\n currency: Currency;\n title: string;\n}) => {\n return (\n <div className='flex items-center justify-between w-full'>\n <div className='flex flex-row items-center gap-6'>\n <div className='flex h-12 w-12 items-center justify-center rounded-lg bg-[#F4F4F5]'>\n <Globe className='h-6 w-6 text-[#000000]' />\n </div>\n <div className='space-y-1'>\n <h2 className='text-lg font-medium leading-none text-[#181818]'>\n {title}\n </h2>\n <p className='text-xs text-[#71717A]'>\n Employer billing currency: {currency.code}\n </p>\n </div>\n </div>\n </div>\n );\n};\n\nconst MultiColumnAccordion = ({\n label,\n columns,\n rows,\n defaultValue = 'accordion',\n className,\n}: {\n label: React.ReactNode;\n columns: string[];\n rows: Array<{\n label: React.ReactNode;\n values: string[];\n }>;\n defaultValue?: string;\n className?: string;\n}) => {\n const gridCols = columns.length === 1 ? 'grid-cols-2' : 'grid-cols-3';\n\n return (\n <Accordion\n type='single'\n collapsible\n defaultValue={defaultValue}\n className={cn('w-full', className)}\n >\n <AccordionItem value={defaultValue} className='border-none'>\n <AccordionTrigger className='hover:no-underline px-0 py-3 [&>svg]:hidden group'>\n <div className={cn('grid items-center w-full', gridCols)}>\n <div className='flex items-center gap-2'>\n {label}\n <ChevronDown className='h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180' />\n </div>\n {columns.length === 1 ? (\n <span className='text-xs text-[#27272A] text-right'>\n {columns[0]}\n </span>\n ) : (\n columns.map((column, index) => (\n <span key={index} className='text-xs text-[#27272A] text-right'>\n {column}\n </span>\n ))\n )}\n </div>\n </AccordionTrigger>\n\n <AccordionContent className='px-0 pb-4'>\n <div className='space-y-3'>\n {rows.map((row, index) => (\n <div key={index} className={cn('grid items-center', gridCols)}>\n <div className='flex items-center gap-2'>{row.label}</div>\n {columns.length === 1 ? (\n <span className='text-sm text-[#09090B] text-right'>\n {row.values[0]}\n </span>\n ) : (\n row.values.map((value, valueIndex) => (\n <span\n key={valueIndex}\n className='text-sm text-[#09090B] text-right'\n >\n {value}\n </span>\n ))\n )}\n </div>\n ))}\n </div>\n </AccordionContent>\n </AccordionItem>\n </Accordion>\n );\n};\n\nconst CostForAllEmployees = ({\n employeesCost,\n}: {\n employeesCost: { monthlyTotal: string; annualTotal: string };\n}) => {\n return (\n <MultiColumnAccordion\n label={\n <span className='text-sm font-medium text-[#0F172A]'>\n Cost for all employees\n </span>\n }\n columns={['Total cost']}\n rows={[\n {\n label: (\n <>\n <span className='w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0' />\n <span className='text-sm text-[#09090B]'>Monthly cost</span>\n </>\n ),\n values: [employeesCost.monthlyTotal],\n },\n {\n label: (\n <>\n <span className='w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0' />\n <span className='text-sm text-[#09090B]'>Annual cost</span>\n </>\n ),\n values: [employeesCost.annualTotal],\n },\n ]}\n defaultValue='cost-breakdown'\n />\n );\n};\n\nconst CostsPerCountry = ({\n costsPerCountry,\n}: {\n costsPerCountry: Array<{\n country: { name: string };\n monthlyCost: string;\n annualCost: string;\n }>;\n}) => {\n return (\n <MultiColumnAccordion\n label={\n <span className='text-sm font-medium text-[#0F172A]'>\n Cost per country\n </span>\n }\n columns={['Monthly cost', 'Annual cost']}\n rows={costsPerCountry.map((cost) => ({\n label: (\n <>\n <span className='w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0' />\n <span className='text-sm text-[#09090B]'>{cost.country.name}</span>\n </>\n ),\n values: [cost.monthlyCost, cost.annualCost],\n }))}\n defaultValue='country-breakdown'\n />\n );\n};\n\ntype SummaryResultsProps = {\n /**\n * Array of employments to compare costs for.\n * 2 estimations required for the component to render\n */\n estimations: CostCalculatorEstimation[];\n};\n\n/**\n * Displays a summary comparison of costs across multiple estimations.\n * The component will return null if you pass less than 2 estimations.\n */\nexport const SummaryResults = ({ estimations }: SummaryResultsProps) => {\n const { currency, costsPerCountry, employeesCost } =\n useSummaryResults(estimations);\n\n const [accordionValue, setAccordionValue] = useState('summary');\n\n if (\n !currency ||\n costsPerCountry.length === 0 ||\n Object.keys(employeesCost).length === 0\n ) {\n return null;\n }\n\n return (\n <Card className='RemoteFlows__SummaryResults__Card p-10'>\n <Accordion\n type='single'\n collapsible\n defaultValue={accordionValue}\n onValueChange={setAccordionValue}\n className='RemoteFlows__SummaryResults__Accordion w-full'\n >\n <AccordionItem value='summary' className='border-border'>\n <div\n className={cn({\n RemoteFlows__Separator: accordionValue === 'summary',\n })}\n >\n <AccordionTrigger\n iconClassName='size-6'\n className='hover:no-underline px-0 py-4'\n >\n <SummaryHeader currency={currency} title='Summary Overview' />\n </AccordionTrigger>\n </div>\n <AccordionContent className='px-0 pb-4 mt-6'>\n <div className='RemoteFlows__Separator'>\n <CostForAllEmployees employeesCost={employeesCost} />\n </div>\n <div className='mt-6'>\n <CostsPerCountry costsPerCountry={costsPerCountry} />\n </div>\n </AccordionContent>\n </AccordionItem>\n </Accordion>\n </Card>\n );\n};\n"],"mappings":"4LAUA,OAAS,eAAAA,EAAa,SAAAC,MAAa,eACnC,OAAS,YAAAC,MAAgB,QAyEf,OAyGE,YAAAC,EAzGF,OAAAC,EAMA,QAAAC,MANA,oBAvEV,IAAMC,EAAoBC,EAACC,GAA4C,CACrE,GAAIA,EAAY,OAAS,EACvB,MAAO,CACL,SAAU,KACV,gBAAiB,CAAC,EAClB,cAAe,IACjB,EAEF,IAAMC,EAAWD,EAAY,CAAC,GAAG,wBAAwB,SACnDE,EAAkBF,EAAY,OAClC,CAACG,EAAKC,IAAe,CACnB,IAAMC,EAAcD,EAAW,QAAQ,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A7B,EAACgB,EAAA,CAAc,SAAUX,EAAU,MAAM,mBAAmB,EAC9D,EACF,EACAJ,EAACgC,EAAA,CAAiB,UAAU,iBAC1B,UAAAjC,EAAC,OAAI,UAAU,yBACb,SAAAA,EAACqC,EAAA,CAAoB,cAAetB,EAAe,EACrD,EACAf,EAAC,OAAI,UAAU,OACb,SAAAA,EAACsC,EAAA,CAAgB,gBAAiBhC,EAAiB,EACrD,GACF,GACF,EACF,EACF,CAEJ,EAhD8B","names":["ChevronDown","Globe","useState","Fragment","jsx","jsxs","useSummaryResults","__name","estimations","currency","costsPerCountry","acc","estimation","countryName","groupedCostsPerCountry","country","monthlyTotal","annualTotal","formatCurrency","employeesCost","SummaryHeader","title","Globe","MultiColumnAccordion","label","columns","rows","defaultValue","className","gridCols","Accordion","cn","AccordionItem","AccordionTrigger","ChevronDown","column","index","AccordionContent","row","value","valueIndex","CostForAllEmployees","CostsPerCountry","cost","SummaryResults","accordionValue","setAccordionValue","useState","Card"]}
@@ -1,2 +0,0 @@
1
- import{a as g}from"./chunk-WWANHPT7.js";import{a as P}from"./chunk-6GMGXSKN.js";import{a as S}from"./chunk-XFD3ULUF.js";import{a as F}from"./chunk-S4XU4SE7.js";import{a as y}from"./chunk-Z5WMKCRJ.js";import{a as V}from"./chunk-QW4JPW6J.js";import{b as p}from"./chunk-EGQJ7UBR.js";import{a as T}from"./chunk-PJBAQZ6G.js";import{d as _}from"./chunk-3ZWDIEEM.js";import{c as s}from"./chunk-PAQW5BFW.js";import{a as e}from"./chunk-P37U34EQ.js";import{createHeadlessForm as h,modify as x}from"@remoteoss/json-schema-form";import{useMutation as K,useQuery as L}from"@tanstack/react-query";import q from"lodash.omitby";import A from"lodash.isnull";import R from"lodash.omit";function z(o){return{confidential:"",customer_informed_employee:"",customer_informed_employee_date:"",customer_informed_employee_description:"",personal_email:"",termination_reason:void 0,reason_description:"",termination_reason_files:[],will_challenge_termination:"",will_challenge_termination_description:null,agrees_to_pto_amount:"",agrees_to_pto_amount_notes:null,acknowledge_termination_procedure:!1,additional_comments:"",proposed_termination_date:"",risk_assessment_reasons:[],timesheet_file:void 0,...o}}e(z,"buildInitialValues");var B=e(()=>{let{client:o}=_();return K({mutationFn:e(n=>p({client:o,body:n}),"mutationFn")})},"useCreateTermination"),I=e(({formValues:o,jsfModify:n,step:m})=>L({queryKey:["rmt-flows-termination-schema",m],queryFn:e(()=>P[m]??S,"queryFn"),select:e(({data:u})=>{let i=u?.schema||{};if(n){let{schema:d}=x(i,n);i=d}return h(i||{},{initialValues:o||{}})},"select")}),"useTerminationSchema"),ue=e(({employmentId:o,options:n})=>{let{fieldValues:m,setFieldValues:u,stepState:i,previousStep:f,nextStep:d}=T(F),k={...i.values?.[i.currentStep.name],...m},{data:r,isLoading:w}=I({formValues:k,jsfModify:n?.jsfModify,step:i.currentStep.name}),l=h(g.data.schema),c=B(),{mutateAsync:b}=V(c);async function C(a){if(!o)throw new Error("Employment id is missing");if(r){let t=s(a,l.fields,{isPartialValidation:!0}),{customer_informed_employee:j}=t,D=j==="yes"?{employee_awareness:{date:t.customer_informed_employee_date,note:t.customer_informed_employee_description}}:void 0,H=y(t,["agrees_to_pto_amount","confidential","customer_informed_employee","will_challenge_termination"]),J=R(H,"customer_informed_employee_date","customer_informed_employee_description"),O=q({...J,...D},A);return b({employment_id:o,termination_details:O,type:"termination"})}}e(C,"onSubmit");function M(){f()}e(M,"back");function v(){d()}e(v,"next");let E=z({...i.values?.employee_communication,...i.values?.termination_details,...i.values?.paid_time_off,...i.values?.additional_information});return{employmentId:o,stepState:i,fields:r?.fields||[],isLoading:w,isSubmitting:c.isPending,initialValues:E,handleValidation:e(a=>{if(r){let t=s(a,r?.fields);return r?.handleValidation(t)}return null},"handleValidation"),checkFieldUpdates:e(a=>{if(l){let t=s(a,l?.fields,{isPartialValidation:!0});u(t)}},"checkFieldUpdates"),parseFormValues:e(a=>s(a,l.fields,{isPartialValidation:!0}),"parseFormValues"),onSubmit:C,back:M,next:v}},"useTermination");export{ue as a};
2
- //# sourceMappingURL=chunk-UWIFE5LJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Termination/hooks.ts"],"sourcesContent":["import {\n CreateOffboardingParams,\n postCreateOffboarding,\n TerminationDetailsParams,\n} from '@/src/client';\nimport { mutationToPromise } from '@/src/lib/mutations';\nimport { Client } from '@hey-api/client-fetch';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport omitBy from 'lodash.omitby';\nimport isNull from 'lodash.isnull';\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { TerminationFormValues } from '@/src/flows/Termination/types';\nimport { useClient } from '@/src/context';\nimport omit from 'lodash.omit';\nimport { parseFormRadioValues } from '@/src/flows/utils';\nimport { useStepState } from '@/src/flows/useStepState';\nimport { STEPS } from '@/src/flows/Termination/utils';\nimport { defaultSchema } from '@/src/flows/Termination/json-schemas/defaultSchema';\nimport { schema } from '@/src/flows/Termination/json-schemas/schema';\nimport { jsonSchema } from '@/src/flows/Termination/json-schemas/jsonSchema';\nimport { JSFModify } from '@/src/flows/types';\n\nfunction buildInitialValues(\n stepsInitialValues: Partial<TerminationFormValues>,\n): TerminationFormValues {\n const initialValues: TerminationFormValues = {\n confidential: '',\n customer_informed_employee: '',\n customer_informed_employee_date: '',\n customer_informed_employee_description: '',\n personal_email: '',\n termination_reason: undefined,\n reason_description: '',\n termination_reason_files: [],\n will_challenge_termination: '',\n will_challenge_termination_description: null,\n agrees_to_pto_amount: '',\n agrees_to_pto_amount_notes: null,\n acknowledge_termination_procedure: false,\n additional_comments: '',\n proposed_termination_date: '',\n risk_assessment_reasons: [],\n timesheet_file: undefined,\n ...stepsInitialValues,\n };\n\n return initialValues;\n}\n\nconst useCreateTermination = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateOffboardingParams) => {\n return postCreateOffboarding({\n client: client as Client,\n body: payload,\n });\n },\n });\n};\n\nconst useTerminationSchema = ({\n formValues,\n jsfModify,\n step,\n}: {\n formValues?: TerminationFormValues;\n jsfModify?: JSFModify;\n step?: string;\n}) => {\n return useQuery({\n queryKey: ['rmt-flows-termination-schema', step],\n queryFn: () => {\n return schema[step as keyof typeof schema] ?? defaultSchema;\n },\n select: ({ data }) => {\n let jsfSchema = data?.schema || {};\n if (jsfModify) {\n const { schema } = modify(jsfSchema, jsfModify);\n jsfSchema = schema;\n }\n const form = createHeadlessForm(jsfSchema || {}, {\n initialValues: formValues || {},\n });\n return form;\n },\n });\n};\n\ntype TerminationHookProps = {\n employmentId: string;\n options?: {\n jsfModify?: JSFModify;\n };\n};\n\nexport const useTermination = ({\n employmentId,\n options,\n}: TerminationHookProps) => {\n const { fieldValues, setFieldValues, stepState, previousStep, nextStep } =\n useStepState<keyof typeof STEPS, TerminationFormValues>(STEPS);\n\n const formValues = {\n ...stepState.values?.[stepState.currentStep.name as keyof typeof STEPS], // Restore values for the current step\n ...fieldValues,\n };\n\n const { data: terminationHeadlessForm, isLoading: isLoadingTermination } =\n useTerminationSchema({\n formValues: formValues,\n jsfModify: options?.jsfModify,\n step: stepState.currentStep.name,\n });\n\n const entireTerminationSchema = createHeadlessForm(jsonSchema.data.schema);\n\n const createTermination = useCreateTermination();\n const { mutateAsync } = mutationToPromise(createTermination);\n\n async function onSubmit(values: TerminationFormValues) {\n if (!employmentId) {\n throw new Error('Employment id is missing');\n }\n\n if (terminationHeadlessForm) {\n // this is a hack because I need to validate all form values with the entire schema\n const parsedValues = parseJSFToValidate(\n values,\n entireTerminationSchema.fields,\n { isPartialValidation: true },\n );\n\n const { customer_informed_employee: customerInformedEmployee } =\n parsedValues;\n\n const employeeAwareness =\n customerInformedEmployee === 'yes'\n ? {\n employee_awareness: {\n date: parsedValues.customer_informed_employee_date,\n note: parsedValues.customer_informed_employee_description,\n },\n }\n : undefined;\n\n const radioFieldKeys = [\n 'agrees_to_pto_amount',\n 'confidential',\n 'customer_informed_employee',\n 'will_challenge_termination',\n ];\n\n const parsedRadioValues = parseFormRadioValues(\n parsedValues,\n radioFieldKeys,\n );\n\n const normalizedValues = omit(\n parsedRadioValues,\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n );\n\n const terminationDetails: TerminationDetailsParams = omitBy(\n {\n ...normalizedValues,\n ...employeeAwareness,\n },\n isNull,\n ) as unknown as TerminationDetailsParams;\n\n const terminationPayload: CreateOffboardingParams = {\n employment_id: employmentId,\n termination_details: terminationDetails,\n type: 'termination',\n };\n\n return mutateAsync(terminationPayload);\n }\n\n return;\n }\n\n function back() {\n previousStep();\n }\n\n function next() {\n nextStep();\n }\n\n const initialValues = buildInitialValues({\n ...stepState.values?.employee_communication,\n ...stepState.values?.termination_details,\n ...stepState.values?.paid_time_off,\n ...stepState.values?.additional_information,\n });\n\n return {\n /**\n * Employment id passed useful to be used between components\n */\n employmentId,\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState,\n /**\n * Array of form fields from the contract amendment schema\n */\n fields: terminationHeadlessForm?.fields || [],\n /**\n * Loading state indicating if the termination schema is being fetched\n */\n isLoading: isLoadingTermination,\n /**\n * Loading state indicating if a contract amendment mutation is in progress\n */\n isSubmitting: createTermination.isPending,\n /**\n * Initial form values\n */\n initialValues: initialValues,\n /**\n * Function to validate form values against the contract amendment schema\n * @param values - Form values to validate\n * @returns Validation result or null if no schema is available\n */\n handleValidation: (values: TerminationFormValues) => {\n if (terminationHeadlessForm) {\n const parsedValues = parseJSFToValidate(\n values,\n terminationHeadlessForm?.fields,\n );\n return terminationHeadlessForm?.handleValidation(parsedValues);\n }\n return null;\n },\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: (values: Partial<TerminationFormValues>) => {\n if (entireTerminationSchema) {\n const parsedValues = parseJSFToValidate(\n values,\n entireTerminationSchema?.fields,\n { isPartialValidation: true },\n );\n setFieldValues(parsedValues as TerminationFormValues);\n }\n },\n /**\n * Function to parse form values before submission\n * @param values - Form values to parse\n * @returns Parsed form values\n */\n parseFormValues: (values: TerminationFormValues) => {\n return parseJSFToValidate(values, entireTerminationSchema.fields, {\n isPartialValidation: true,\n });\n },\n /**\n * Function to handle form submission\n * @param values - Form values to submit\n * @returns Promise resolving to the mutation result\n */\n onSubmit,\n\n /**\n * Function to handle going back to the previous step\n * @returns {void}\n */\n back,\n\n /**\n * Function to handle going to the next step\n * @returns {void}\n */\n next,\n };\n};\n"],"mappings":"wbAOA,OAAS,sBAAAA,EAAoB,UAAAC,MAAc,8BAC3C,OAAS,eAAAC,EAAa,YAAAC,MAAgB,wBACtC,OAAOC,MAAY,gBACnB,OAAOC,MAAY,gBAInB,OAAOC,MAAU,cASjB,SAASC,EACPC,EACuB,CAsBvB,MArB6C,CAC3C,aAAc,GACd,2BAA4B,GAC5B,gCAAiC,GACjC,uCAAwC,GACxC,eAAgB,GAChB,mBAAoB,OACpB,mBAAoB,GACpB,yBAA0B,CAAC,EAC3B,2BAA4B,GAC5B,uCAAwC,KACxC,qBAAsB,GACtB,2BAA4B,KAC5B,kCAAmC,GACnC,oBAAqB,GACrB,0BAA2B,GAC3B,wBAAyB,CAAC,EAC1B,eAAgB,OAChB,GAAGA,CACL,CAGF,CAzBSC,EAAAF,EAAA,sBA2BT,IAAMG,EAAuBD,EAAA,IAAM,CACjC,GAAM,CAAE,OAAAE,CAAO,EAAIC,EAAU,EAC7B,OAAOC,EAAY,CACjB,WAAYJ,EAACK,GACJC,EAAsB,CAC3B,OAAQJ,EACR,KAAMG,CACR,CAAC,EAJS,aAMd,CAAC,CACH,EAV6B,wBAYvBE,EAAuBP,EAAA,CAAC,CAC5B,WAAAQ,EACA,UAAAC,EACA,KAAAC,CACF,IAKSC,EAAS,CACd,SAAU,CAAC,+BAAgCD,CAAI,EAC/C,QAASV,EAAA,IACAY,EAAOF,CAA2B,GAAKG,EADvC,WAGT,OAAQb,EAAA,CAAC,CAAE,KAAAc,CAAK,IAAM,CACpB,IAAIC,EAAYD,GAAM,QAAU,CAAC,EACjC,GAAIL,EAAW,CACb,G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ACvC,CAGF,CA9De7C,EAAAmC,EAAA,YAgEf,SAASa,GAAO,CACdxB,EAAa,CACf,CAFSxB,EAAAgD,EAAA,QAIT,SAASC,GAAO,CACdxB,EAAS,CACX,CAFSzB,EAAAiD,EAAA,QAIT,IAAMC,EAAgBpD,EAAmB,CACvC,GAAGyB,EAAU,QAAQ,uBACrB,GAAGA,EAAU,QAAQ,oBACrB,GAAGA,EAAU,QAAQ,cACrB,GAAGA,EAAU,QAAQ,sBACvB,CAAC,EAED,MAAO,CAIL,aAAAJ,EAIA,UAAAI,EAIA,OAAQK,GAAyB,QAAU,CAAC,EAI5C,UAAWC,EAIX,aAAcG,EAAkB,UAIhC,cAAekB,EAMf,iBAAkBlD,EAACoC,GAAkC,CACnD,GAAIR,EAAyB,CAC3B,IAAMS,EAAeC,EACnBF,EACAR,GAAyB,MAC3B,EACA,OAAOA,GAAyB,iBAAiBS,CAAY,CAC/D,CACA,OAAO,IACT,EATkB,oBAclB,kBAAmBrC,EAACoC,GAA2C,CAC7D,GAAIN,EAAyB,CAC3B,IAAMO,EAAeC,EACnBF,EACAN,GAAyB,OACzB,CAAE,oBAAqB,EAAK,CAC9B,EACAR,EAAee,CAAqC,CACtD,CACF,EATmB,qBAenB,gBAAiBrC,EAACoC,GACTE,EAAmBF,EAAQN,EAAwB,OAAQ,CAChE,oBAAqB,EACvB,CAAC,EAHc,mBAUjB,SAAAK,EAMA,KAAAa,EAMA,KAAAC,CACF,CACF,EA1L8B","names":["createHeadlessForm","modify","useMutation","useQuery","omitBy","isNull","omit","buildInitialValues","stepsInitialValues","__name","useCreateTermination","client","useClient","useMutation","payload","postCreateOffboarding","useTerminationSchema","formValues","jsfModify","step","useQuery","schema","defaultSchema","data","jsfSchema","modify","createHeadlessForm","useTermination","employmentId","options","fieldValues","setFieldValues","stepState","previousStep","nextStep","useStepState","STEPS","terminationHeadlessForm","isLoadingTermination","entireTerminationSchema","jsonSchema","createTermination","mutateAsync","mutationToPromise","onSubmit","values","parsedValues","parseJSFToValidate","customerInformedEmployee","employeeAwareness","parsedRadioValues","parseFormRadioValues","normalizedValues","omit","terminationDetails","omitBy","isNull","back","next","initialValues"]}
@@ -1,2 +0,0 @@
1
- import{g as l,k as u,p as c,t as m,y as d}from"./chunk-EGQJ7UBR.js";import{d as s}from"./chunk-3ZWDIEEM.js";import{a as e}from"./chunk-P37U34EQ.js";import{useMutation as C,useQuery as r}from"@tanstack/react-query";import{createHeadlessForm as y,modify as g}from"@remoteoss/json-schema-form";var q=e(({includePremiumBenefits:t})=>{let{client:i}=s();return r({queryKey:["cost-calculator-countries",t],queryFn:e(()=>c({client:i,query:{include_premium_benefits:t}}),"queryFn"),select:e(o=>o.data?.data.filter(n=>n.availability==="active").map(n=>({value:n.region_slug,label:n.name,childRegions:n.child_regions,hasAdditionalFields:n.has_additional_fields,regionSlug:n.region_slug,currency:n.currency.code})),"select")})},"useCostCalculatorCountries"),x=e(()=>{let{client:t}=s();return r({queryKey:["company-currencies"],queryFn:e(()=>d({client:t}),"queryFn"),select:e(i=>i.data?.data?.company_currencies.map(o=>({value:o.slug,label:o.code})),"select")})},"useCompanyCurrencies"),P=e(()=>{let{client:t}=s();return C({mutationFn:e(i=>l({client:t,body:i}),"mutationFn")})},"useCostCalculatorEstimation"),M=e(()=>{let{client:t}=s();return C({mutationFn:e(i=>u({client:t,body:i}),"mutationFn")})},"useCostCalculatorEstimationPdf"),S=e((t,{includePremiumBenefits:i,options:o})=>{let{client:n}=s();return r({queryKey:["cost-calculator-region-fields",t,i],queryFn:e(()=>m({client:n,path:{slug:t},query:{include_premium_benefits:i}}),"queryFn"),enabled:!!t,select:e(({data:f})=>{let a=f?.data?.schema||{};if(o&&o.jsfModify){let{schema:p}=g(a,o.jsfModify);a=p}return y(a)},"select")})},"useRegionFields");export{q as a,x as b,P as c,M as d,S as e};
2
- //# sourceMappingURL=chunk-V2YORDAL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/CostCalculator/api.ts"],"sourcesContent":["import {\n CostCalculatorEstimateParams,\n getIndexCompanyCurrency,\n getIndexCountry,\n getShowRegionField,\n postCreateEstimation,\n postCreateEstimationPdf,\n} from '@/src/client';\nimport { Client } from '@hey-api/client-fetch';\nimport { useClient } from '@/src/context';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { CostCalculatorEstimationOptions } from '@/src/flows/CostCalculator/types';\nimport { JSFModify } from '@/src/flows/types';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\n\n/**\n * Hook to fetch the countries for the cost calculator.\n * @returns\n */\nexport const useCostCalculatorCountries = ({\n includePremiumBenefits,\n}: {\n includePremiumBenefits: CostCalculatorEstimationOptions['includePremiumBenefits'];\n}) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['cost-calculator-countries', includePremiumBenefits],\n queryFn: () => {\n return getIndexCountry({\n client: client as Client,\n query: {\n include_premium_benefits: includePremiumBenefits,\n },\n });\n },\n select: (data) =>\n data.data?.data\n .filter((country) => country.availability === 'active')\n .map((country) => ({\n value: country.region_slug,\n label: country.name,\n childRegions: country.child_regions,\n hasAdditionalFields: country.has_additional_fields,\n regionSlug: country.region_slug,\n currency: country.currency.code,\n })),\n });\n};\n\n/**\n * Hook to fetch the company currencies.\n * @returns\n */\nexport const useCompanyCurrencies = () => {\n const { client } = useClient();\n\n return useQuery({\n queryKey: ['company-currencies'],\n queryFn: () => {\n return getIndexCompanyCurrency({\n client: client as Client,\n });\n },\n select: (data) =>\n data.data?.data?.company_currencies.map((currency) => ({\n value: currency.slug,\n label: currency.code,\n })),\n });\n};\n\n/**\n * Hook to create an estimation.\n * @returns\n */\nexport const useCostCalculatorEstimation = () => {\n const { client } = useClient();\n\n return useMutation({\n mutationFn: (payload: CostCalculatorEstimateParams) => {\n return postCreateEstimation({\n client: client as Client,\n body: payload,\n });\n },\n });\n};\n\n/**\n * Custom hook to create a PDF estimation.\n *\n * @returns\n */\nexport const useCostCalculatorEstimationPdf = () => {\n const { client } = useClient();\n\n return useMutation({\n mutationFn: (payload: CostCalculatorEstimateParams) => {\n return postCreateEstimationPdf({\n client: client as Client,\n body: payload,\n });\n },\n });\n};\n\n/**\n * Hook to fetch the region fields.\n * @param region\n * @returns\n */\nexport const useRegionFields = (\n region: string | undefined,\n {\n includePremiumBenefits,\n options,\n }: {\n includePremiumBenefits: CostCalculatorEstimationOptions['includePremiumBenefits'];\n options?: {\n jsfModify?: JSFModify;\n };\n },\n) => {\n const { client } = useClient();\n\n return useQuery({\n queryKey: ['cost-calculator-region-fields', region, includePremiumBenefits],\n queryFn: () => {\n return getShowRegionField({\n client: client as Client,\n path: { slug: region as string },\n query: {\n include_premium_benefits: includePremiumBenefits,\n },\n });\n },\n enabled: !!region,\n select: ({ data }) => {\n let jsfSchema = data?.data?.schema || {};\n if (options && options.jsfModify) {\n const { schema } = modify(jsfSchema, options.jsfModify);\n jsfSchema = schema;\n }\n return createHeadlessForm(jsfSchema);\n },\n });\n};\n"],"mappings":"oJAUA,OAAS,eAAAA,EAAa,YAAAC,MAAgB,wBAGtC,OAAS,sBAAAC,EAAoB,UAAAC,MAAc,8BAMpC,IAAMC,EAA6BC,EAAA,CAAC,CACzC,uBAAAC,CACF,IAEM,CACJ,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAU,EAC7B,OAAOC,EAAS,CACd,SAAU,CAAC,4BAA6BH,CAAsB,EAC9D,QAASD,EAAA,IACAK,EAAgB,CACrB,OAAQH,EACR,MAAO,CACL,yBAA0BD,CAC5B,CACF,CAAC,EANM,WAQT,OAAQD,EAACM,GACPA,EAAK,MAAM,KACR,OAAQC,GAAYA,EAAQ,eAAiB,QAAQ,EACrD,IAAKA,IAAa,CACjB,MAAOA,EAAQ,YACf,MAAOA,EAAQ,KACf,aAAcA,EAAQ,cACtB,oBAAqBA,EAAQ,sBAC7B,WAAYA,EAAQ,YACpB,SAAUA,EAAQ,SAAS,IAC7B,EAAE,EAVE,SAWV,CAAC,CACH,EA5B0C,8BAkC7BC,EAAuBR,EAAA,IAA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,SAAS,EACtDE,EAAYC,CACd,CACA,OAAOE,EAAmBH,CAAS,CACrC,EAPQ,SAQV,CAAC,CACH,EAnC+B","names":["useMutation","useQuery","createHeadlessForm","modify","useCostCalculatorCountries","__name","includePremiumBenefits","client","useClient","useQuery","getIndexCountry","data","country","useCompanyCurrencies","getIndexCompanyCurrency","currency","useCostCalculatorEstimation","useMutation","payload","postCreateEstimation","useCostCalculatorEstimationPdf","postCreateEstimationPdf","useRegionFields","region","options","getShowRegionField","jsfSchema","schema","modify","createHeadlessForm"]}
@@ -1,2 +0,0 @@
1
- var e={data:{version:7,schema:{additionalProperties:!1,allOf:[{if:{properties:{will_challenge_termination:{const:"yes"}},required:["will_challenge_termination"]},then:{properties:{will_challenge_termination_description:{type:"string"}},required:["will_challenge_termination_description"]},else:{properties:{will_challenge_termination_description:!1}}}],properties:{termination_reason:{title:"Termination reason",description:"Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.",type:"string",oneOf:[{const:"gross_misconduct",title:"Gross misconduct"},{const:"performance",title:"Performance"},{const:"workforce_reduction",title:"Workforce Reduction"},{const:"values",title:"Values"},{const:"compliance_issue",title:"Compliance issue"},{const:"incapacity_to_perform_inherent_duties",title:"Incapacity To perform inherent duties"},{const:"mutual_agreement",title:"Mutual agreement"},{const:"cancellation_before_start_date",title:"Decision to cancel hiring before the employee starts"},{const:"job_abandonment",title:"Job abandonment"},{const:"dissatisfaction_with_remote_service",title:"Dissatisfaction with EOR service"},{const:"end_of_fixed_term_contract_compliance_issue",title:"End of fixed-term contract"},{const:"other",title:"Other"}],"x-jsf-presentation":{inputType:"select"}},reason_description:{description:"",maxLength:1e3,title:"Termination reason details",type:"string","x-jsf-presentation":{inputType:"textarea"}},additional_comments:{description:"",maxLength:1e3,title:"Additional details regarding this termination process.",type:"string","x-jsf-presentation":{inputType:"textarea"}},termination_reason_files:{description:"Please upload any supporting documents regarding the termination reason.",title:"Termination reason files",type:"string","x-jsf-presentation":{inputType:"file",accept:".pdf",multiple:!0}},risk_assessment_reasons:{description:"",title:"This employee is...",type:"array",items:{anyOf:[{const:"sick_leave",title:"Currently on or recently returned from sick leave"},{const:"family_leave",title:"Currently on or recently returned from maternity, paternity, or other family leave"},{const:"pregnant_or_breastfeeding",title:"Pregnant or breastfeeding"},{const:"requested_medical_or_family_leave",title:"Requested medical or family leave"},{const:"disabled_or_health_condition",title:"Disabled or has a health condition"},{const:"member_of_union_or_works_council",title:"A member of a union or works council"},{const:"caring_responsibilities",title:"Caring responsibilities"},{const:"reported_concerns_with_workplace",title:"Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions"},{const:"none_of_these",title:"To the best of my knowledge, I am not aware of any of these"}]},"x-jsf-presentation":{inputType:"checkbox",direction:"column"}},will_challenge_termination:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Do you consider it is likely that the employee will challenge their termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},will_challenge_termination_description:{description:"",maxLength:1e3,title:"Please explain how the employee will challenge their termination",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},proposed_termination_date:{description:"",format:"date",maxLength:255,title:"Proposed termination date",type:"string","x-jsf-presentation":{inputType:"date"}}},required:["termination_reason","reason_description","risk_assessment_reasons","will_challenge_termination","proposed_termination_date"],type:"object","x-jsf-order":["termination_reason","reason_description","additional_comments","termination_reason_files","risk_assessment_reasons","will_challenge_termination","will_challenge_termination_description","proposed_termination_date"]}}};export{e as a};
2
- //# sourceMappingURL=chunk-VX2UC3HG.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Termination/json-schemas/terminationDetails.ts"],"sourcesContent":["export const terminationDetailsSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n will_challenge_termination: {\n const: 'yes',\n },\n },\n required: ['will_challenge_termination'],\n },\n then: {\n properties: {\n will_challenge_termination_description: {\n type: 'string',\n },\n },\n required: ['will_challenge_termination_description'],\n },\n else: {\n properties: {\n will_challenge_termination_description: false,\n },\n },\n },\n ],\n properties: {\n termination_reason: {\n title: 'Termination reason',\n description:\n 'Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.',\n type: 'string',\n oneOf: [\n {\n const: 'gross_misconduct',\n title: 'Gross misconduct',\n },\n {\n const: 'performance',\n title: 'Performance',\n },\n {\n const: 'workforce_reduction',\n title: 'Workforce Reduction',\n },\n {\n const: 'values',\n title: 'Values',\n },\n {\n const: 'compliance_issue',\n title: 'Compliance issue',\n },\n {\n const: 'incapacity_to_perform_inherent_duties',\n title: 'Incapacity To perform inherent duties',\n },\n {\n const: 'mutual_agreement',\n title: 'Mutual agreement',\n },\n {\n const: 'cancellation_before_start_date',\n title: 'Decision to cancel hiring before the employee starts',\n },\n {\n const: 'job_abandonment',\n title: 'Job abandonment',\n },\n {\n const: 'dissatisfaction_with_remote_service',\n title: 'Dissatisfaction with EOR service',\n },\n {\n const: 'end_of_fixed_term_contract_compliance_issue',\n title: 'End of fixed-term contract',\n },\n {\n const: 'other',\n title: 'Other',\n },\n ],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n reason_description: {\n description: '',\n maxLength: 1000,\n title: 'Termination reason details',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n additional_comments: {\n description: '',\n maxLength: 1000,\n title: 'Additional details regarding this termination process.',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n termination_reason_files: {\n description:\n 'Please upload any supporting documents regarding the termination reason.',\n title: 'Termination reason files',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n multiple: true,\n },\n },\n risk_assessment_reasons: {\n description: '',\n title: 'This employee is...',\n type: 'array',\n items: {\n anyOf: [\n {\n const: 'sick_leave',\n title: 'Currently on or recently returned from sick leave',\n },\n {\n const: 'family_leave',\n title:\n 'Currently on or recently returned from maternity, paternity, or other family leave',\n },\n {\n const: 'pregnant_or_breastfeeding',\n title: 'Pregnant or breastfeeding',\n },\n {\n const: 'requested_medical_or_family_leave',\n title: 'Requested medical or family leave',\n },\n {\n const: 'disabled_or_health_condition',\n title: 'Disabled or has a health condition',\n },\n {\n const: 'member_of_union_or_works_council',\n title: 'A member of a union or works council',\n },\n {\n const: 'caring_responsibilities',\n title: 'Caring responsibilities',\n },\n {\n const: 'reported_concerns_with_workplace',\n title:\n 'Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions',\n },\n {\n const: 'none_of_these',\n title:\n 'To the best of my knowledge, I am not aware of any of these',\n },\n ],\n },\n 'x-jsf-presentation': {\n inputType: 'checkbox',\n direction: 'column',\n },\n },\n will_challenge_termination: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title:\n 'Do you consider it is likely that the employee will challenge their termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n will_challenge_termination_description: {\n description: '',\n maxLength: 1000,\n title:\n 'Please explain how the employee will challenge their termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n proposed_termination_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'Proposed termination date',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n },\n required: [\n 'termination_reason',\n 'reason_description',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'proposed_termination_date',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'termination_reason',\n 'reason_description',\n 'additional_comments',\n 'termination_reason_files',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'will_challenge_termination_description',\n 'proposed_termination_date',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAA2B,CACtC,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CACL,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CAAC,wCAAwC,CACrD,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,EAC1C,CACF,CACF,CACF,EACA,WAAY,CACV,mBAAoB,CAClB,MAAO,qBACP,YACE,oGACF,KAAM,SACN,MAAO,CACL,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,cACP,MAAO,aACT,EACA,CACE,MAAO,sBACP,MAAO,qBACT,EACA,CACE,MAAO,SACP,MAAO,QACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,wCACP,MAAO,uCACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,iCACP,MAAO,sDACT,EACA,CACE,MAAO,kBACP,MAAO,iBACT,EACA,CACE,MAAO,sCACP,MAAO,kCACT,EACA,CACE,MAAO,8CACP,MAAO,4BACT,EACA,CACE,MAAO,QACP,MAAO,OACT,CACF,EACA,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,mBAAoB,CAClB,YAAa,GACb,UAAW,IACX,MAAO,6BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,oBAAqB,CACnB,YAAa,GACb,UAAW,IACX,MAAO,yDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,yBAA0B,CACxB,YACE,2EACF,MAAO,2BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,OACX,OAAQ,OACR,SAAU,EACZ,CACF,EACA,wBAAyB,CACvB,YAAa,GACb,MAAO,sBACP,KAAM,QACN,MAAO,CACL,MAAO,CACL,CACE,MAAO,aACP,MAAO,mDACT,EACA,CACE,MAAO,eACP,MACE,oFACJ,EACA,CACE,MAAO,4BACP,MAAO,2BACT,EACA,CACE,MAAO,oCACP,MAAO,mCACT,EACA,CACE,MAAO,+BACP,MAAO,oCACT,EACA,CACE,MAAO,mCACP,MAAO,sCACT,EACA,CACE,MAAO,0BACP,MAAO,yBACT,EACA,CACE,MAAO,mCACP,MACE,2LACJ,EACA,CACE,MAAO,gBACP,MACE,6DACJ,CACF,CACF,EACA,qBAAsB,CACpB,UAAW,WACX,UAAW,QACb,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MACE,mFACF,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MACE,mEACF,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,0BAA2B,CACzB,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,4BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,MACb,CACF,CACF,EACA,SAAU,CACR,qBACA,qBACA,0BACA,6BACA,2BACF,EACA,KAAM,SACN,cAAe,CACb,qBACA,qBACA,sBACA,2BACA,0BACA,6BACA,yCACA,2BACF,CACF,CACF,CACF","names":["terminationDetailsSchema"]}
@@ -1,2 +0,0 @@
1
- var e={data:{version:7,schema:{additionalProperties:!1,allOf:[{if:{properties:{personal_email:{pattern:"^[a-zA-Z0-9 .]+$"}}},then:{properties:{personal_email:{"x-jsf-presentation":{statement:{title:"Please make sure to add the employee personal email so we can get in contact with the employee after the termination process takes effect.",inputType:"statement",severity:"warning"}}}}}},{if:{properties:{customer_informed_employee:{const:"yes"}},required:["customer_informed_employee"]},then:{properties:{customer_informed_employee_date:{type:"string"},customer_informed_employee_description:{type:"string"}},required:["customer_informed_employee_date","customer_informed_employee_description"]},else:{properties:{customer_informed_employee_date:!1,customer_informed_employee_description:!1}}},{if:{properties:{will_challenge_termination:{const:"yes"}},required:["will_challenge_termination"]},then:{properties:{will_challenge_termination_description:{type:"string"}},required:["will_challenge_termination_description"]},else:{properties:{will_challenge_termination_description:!1}}},{if:{properties:{agrees_to_pto_amount:{const:"no"}},required:["agrees_to_pto_amount"]},then:{properties:{agrees_to_pto_amount_notes:{type:"string"}},required:["agrees_to_pto_amount_notes"]},else:{properties:{agrees_to_pto_amount_notes:!1,timesheet_file:!1}}}],properties:{confidential:{description:"Confidential requests are visible only to you. Non-confidential requests are visible to all admins in your company.",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Is this request confidential?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio",statement:{title:"Please do not inform the employee of their termination until we review your request for legal risks. When we approve your request, you can inform the employee and we'll take it from there.",inputType:"statement",severity:"warning"}}},customer_informed_employee:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Have you informed the employee of the termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},customer_informed_employee_date:{description:"",format:"date",maxLength:255,title:"When the employee was told about the termination",type:["string","null"],"x-jsf-presentation":{inputType:"date"}},customer_informed_employee_description:{description:"",maxLength:1e3,title:"How did you share this information?",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},personal_email:{description:"",maxLength:255,title:"Employee's personal email",format:"email",type:"string","x-jsf-presentation":{inputType:"email"}},termination_reason:{title:"Termination reason",description:"Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.",type:"string",oneOf:[{const:"gross_misconduct",title:"Gross misconduct"},{const:"performance",title:"Performance"},{const:"workforce_reduction",title:"Workforce Reduction"},{const:"values",title:"Values"},{const:"compliance_issue",title:"Compliance issue"},{const:"incapacity_to_perform_inherent_duties",title:"Incapacity To perform inherent duties"},{const:"mutual_agreement",title:"Mutual agreement"},{const:"cancellation_before_start_date",title:"Decision to cancel hiring before the employee starts"},{const:"job_abandonment",title:"Job abandonment"},{const:"dissatisfaction_with_remote_service",title:"Dissatisfaction with EOR service"},{const:"end_of_fixed_term_contract_compliance_issue",title:"End of fixed-term contract"},{const:"other",title:"Other"}],"x-jsf-presentation":{inputType:"select"}},reason_description:{description:"",maxLength:1e3,title:"Termination reason details",type:"string","x-jsf-presentation":{inputType:"textarea"}},additional_comments:{description:"",maxLength:1e3,title:"Additional details regarding this termination process.",type:"string","x-jsf-presentation":{inputType:"textarea"}},termination_reason_files:{description:"Please upload any supporting documents regarding the termination reason.",title:"Termination reason files",type:"string","x-jsf-presentation":{inputType:"file",accept:".pdf",multiple:!0}},risk_assessment_reasons:{description:"",title:"This employee is...",type:"array",items:{anyOf:[{const:"sick_leave",title:"Currently on or recently returned from sick leave"},{const:"family_leave",title:"Currently on or recently returned from maternity, paternity, or other family leave"},{const:"pregnant_or_breastfeeding",title:"Pregnant or breastfeeding"},{const:"requested_medical_or_family_leave",title:"Requested medical or family leave"},{const:"disabled_or_health_condition",title:"Disabled or has a health condition"},{const:"member_of_union_or_works_council",title:"A member of a union or works council"},{const:"caring_responsibilities",title:"Caring responsibilities"},{const:"reported_concerns_with_workplace",title:"Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions"},{const:"none_of_these",title:"To the best of my knowledge, I am not aware of any of these"}]},"x-jsf-presentation":{inputType:"checkbox",direction:"column"}},will_challenge_termination:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Do you consider it is likely that the employee will challenge their termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},will_challenge_termination_description:{description:"",maxLength:1e3,title:"Please explain how the employee will challenge their termination",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},proposed_termination_date:{description:"",format:"date",maxLength:255,title:"Proposed termination date",type:"string","x-jsf-presentation":{inputType:"date"}},agrees_to_pto_amount:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Are these paid time off records correct?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},agrees_to_pto_amount_notes:{description:"Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.",maxLength:1e3,title:"Provide time off details",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},timesheet_file:{description:"Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.",title:"Timesheet document",type:["string","null"],"x-jsf-presentation":{inputType:"file",accept:".pdf"}},acknowledge_termination_procedure:{description:"",title:"I, {{requesterName}} have read and agree to the procedures as defined in the termination form.",type:"boolean","x-jsf-presentation":{direction:"column",inputType:"checkbox"}}},required:["confidential","customer_informed_employee","personal_email","termination_reason","reason_description","risk_assessment_reasons","will_challenge_termination","proposed_termination_date","agrees_to_pto_amount","acknowledge_termination_procedure"],type:"object","x-jsf-order":["is_confidential","customer_informed_employee","customer_informed_employee_date","customer_informed_employee_description","personal_email","termination_reason","reason_description","additional_comments","termination_reason_files","risk_assessment_reasons","will_challenge_termination","will_challenge_termination_description","proposed_termination_date","agrees_to_pto_amount","agrees_to_pto_amount_notes","timesheet_file","acknowledge_termination_procedure"]}}};export{e as a};
2
- //# sourceMappingURL=chunk-WWANHPT7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Termination/json-schemas/jsonSchema.ts"],"sourcesContent":["export const jsonSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n personal_email: {\n pattern: '^[a-zA-Z0-9 .]+$',\n },\n },\n },\n then: {\n properties: {\n personal_email: {\n 'x-jsf-presentation': {\n statement: {\n title:\n 'Please make sure to add the employee personal email so we can get in contact with the employee after the termination process takes effect.',\n inputType: 'statement',\n severity: 'warning',\n },\n },\n },\n },\n },\n },\n {\n if: {\n properties: {\n customer_informed_employee: {\n const: 'yes',\n },\n },\n required: ['customer_informed_employee'],\n },\n then: {\n properties: {\n customer_informed_employee_date: {\n type: 'string',\n },\n customer_informed_employee_description: {\n type: 'string',\n },\n },\n required: [\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n ],\n },\n else: {\n properties: {\n customer_informed_employee_date: false,\n customer_informed_employee_description: false,\n },\n },\n },\n {\n if: {\n properties: {\n will_challenge_termination: {\n const: 'yes',\n },\n },\n required: ['will_challenge_termination'],\n },\n then: {\n properties: {\n will_challenge_termination_description: {\n type: 'string',\n },\n },\n required: ['will_challenge_termination_description'],\n },\n else: {\n properties: {\n will_challenge_termination_description: false,\n },\n },\n },\n {\n if: {\n properties: {\n agrees_to_pto_amount: {\n const: 'no',\n },\n },\n required: ['agrees_to_pto_amount'],\n },\n then: {\n properties: {\n agrees_to_pto_amount_notes: {\n type: 'string',\n },\n },\n required: ['agrees_to_pto_amount_notes'],\n },\n else: {\n properties: {\n agrees_to_pto_amount_notes: false,\n timesheet_file: false,\n },\n },\n },\n ],\n properties: {\n confidential: {\n description:\n 'Confidential requests are visible only to you. Non-confidential requests are visible to all admins in your company.',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Is this request confidential?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n statement: {\n title:\n \"Please do not inform the employee of their termination until we review your request for legal risks. When we approve your request, you can inform the employee and we'll take it from there.\",\n inputType: 'statement',\n severity: 'warning',\n },\n },\n },\n customer_informed_employee: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Have you informed the employee of the termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n customer_informed_employee_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'When the employee was told about the termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n customer_informed_employee_description: {\n description: '',\n maxLength: 1000,\n title: 'How did you share this information?',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n personal_email: {\n description: '',\n maxLength: 255,\n title: \"Employee's personal email\",\n format: 'email',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'email',\n },\n },\n termination_reason: {\n title: 'Termination reason',\n description:\n 'Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.',\n type: 'string',\n oneOf: [\n {\n const: 'gross_misconduct',\n title: 'Gross misconduct',\n },\n {\n const: 'performance',\n title: 'Performance',\n },\n {\n const: 'workforce_reduction',\n title: 'Workforce Reduction',\n },\n {\n const: 'values',\n title: 'Values',\n },\n {\n const: 'compliance_issue',\n title: 'Compliance issue',\n },\n {\n const: 'incapacity_to_perform_inherent_duties',\n title: 'Incapacity To perform inherent duties',\n },\n {\n const: 'mutual_agreement',\n title: 'Mutual agreement',\n },\n {\n const: 'cancellation_before_start_date',\n title: 'Decision to cancel hiring before the employee starts',\n },\n {\n const: 'job_abandonment',\n title: 'Job abandonment',\n },\n {\n const: 'dissatisfaction_with_remote_service',\n title: 'Dissatisfaction with EOR service',\n },\n {\n const: 'end_of_fixed_term_contract_compliance_issue',\n title: 'End of fixed-term contract',\n },\n {\n const: 'other',\n title: 'Other',\n },\n ],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n reason_description: {\n description: '',\n maxLength: 1000,\n title: 'Termination reason details',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n additional_comments: {\n description: '',\n maxLength: 1000,\n title: 'Additional details regarding this termination process.',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n termination_reason_files: {\n description:\n 'Please upload any supporting documents regarding the termination reason.',\n title: 'Termination reason files',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n multiple: true,\n },\n },\n risk_assessment_reasons: {\n description: '',\n title: 'This employee is...',\n type: 'array',\n items: {\n anyOf: [\n {\n const: 'sick_leave',\n title: 'Currently on or recently returned from sick leave',\n },\n {\n const: 'family_leave',\n title:\n 'Currently on or recently returned from maternity, paternity, or other family leave',\n },\n {\n const: 'pregnant_or_breastfeeding',\n title: 'Pregnant or breastfeeding',\n },\n {\n const: 'requested_medical_or_family_leave',\n title: 'Requested medical or family leave',\n },\n {\n const: 'disabled_or_health_condition',\n title: 'Disabled or has a health condition',\n },\n {\n const: 'member_of_union_or_works_council',\n title: 'A member of a union or works council',\n },\n {\n const: 'caring_responsibilities',\n title: 'Caring responsibilities',\n },\n {\n const: 'reported_concerns_with_workplace',\n title:\n 'Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions',\n },\n {\n const: 'none_of_these',\n title:\n 'To the best of my knowledge, I am not aware of any of these',\n },\n ],\n },\n 'x-jsf-presentation': {\n inputType: 'checkbox',\n direction: 'column',\n },\n },\n will_challenge_termination: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title:\n 'Do you consider it is likely that the employee will challenge their termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n will_challenge_termination_description: {\n description: '',\n maxLength: 1000,\n title:\n 'Please explain how the employee will challenge their termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n proposed_termination_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'Proposed termination date',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n agrees_to_pto_amount: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Are these paid time off records correct?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n agrees_to_pto_amount_notes: {\n description:\n 'Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.',\n maxLength: 1000,\n title: 'Provide time off details',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n timesheet_file: {\n description:\n 'Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.',\n title: 'Timesheet document',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n },\n },\n acknowledge_termination_procedure: {\n description: '',\n title:\n 'I, {{requesterName}} have read and agree to the procedures as defined in the termination form.',\n type: 'boolean',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'checkbox',\n },\n },\n },\n required: [\n 'confidential',\n 'customer_informed_employee',\n 'personal_email',\n 'termination_reason',\n 'reason_description',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'proposed_termination_date',\n 'agrees_to_pto_amount',\n 'acknowledge_termination_procedure',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'is_confidential',\n 'customer_informed_employee',\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n 'personal_email',\n 'termination_reason',\n 'reason_description',\n 'additional_comments',\n 'termination_reason_files',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'will_challenge_termination_description',\n 'proposed_termination_date',\n 'agrees_to_pto_amount',\n 'agrees_to_pto_amount_notes',\n 'timesheet_file',\n 'acknowledge_termination_procedure',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAAa,CACxB,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CACL,CACE,GAAI,CACF,WAAY,CACV,eAAgB,CACd,QAAS,kBACX,CACF,CACF,EACA,KAAM,CACJ,WAAY,CACV,eAAgB,CACd,qBAAsB,CACpB,UAAW,CACT,MACE,6IACF,UAAW,YACX,SAAU,SACZ,CACF,CACF,CACF,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,gCAAiC,CAC/B,KAAM,QACR,EACA,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CACR,kCACA,wCACF,CACF,EACA,KAAM,CACJ,WAAY,CACV,gCAAiC,GACjC,uCAAwC,EAC1C,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CAAC,wCAAwC,CACrD,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,EAC1C,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,qBAAsB,CACpB,MAAO,IACT,CACF,EACA,SAAU,CAAC,sBAAsB,CACnC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,CAC1B,KAAM,QACR,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,GAC5B,eAAgB,EAClB,CACF,CACF,CACF,EACA,WAAY,CACV,aAAc,CACZ,YACE,sHACF,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,gCACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,QACX,UAAW,CACT,MACE,+LACF,UAAW,YACX,SAAU,SACZ,CACF,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,qDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,gCAAiC,CAC/B,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,mDACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,MACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MAAO,sCACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,eAAgB,CACd,YAAa,GACb,UAAW,IACX,MAAO,4BACP,OAAQ,QACR,KAAM,SACN,qBAAsB,CACpB,UAAW,OACb,CACF,EACA,mBAAoB,CAClB,MAAO,qBACP,YACE,oGACF,KAAM,SACN,MAAO,CACL,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,cACP,MAAO,aACT,EACA,CACE,MAAO,sBACP,MAAO,qBACT,EACA,CACE,MAAO,SACP,MAAO,QACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,wCACP,MAAO,uCACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,iCACP,MAAO,sDACT,EACA,CACE,MAAO,kBACP,MAAO,iBACT,EACA,CACE,MAAO,sCACP,MAAO,kCACT,EACA,CACE,MAAO,8CACP,MAAO,4BACT,EACA,CACE,MAAO,QACP,MAAO,OACT,CACF,EACA,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,mBAAoB,CAClB,YAAa,GACb,UAAW,IACX,MAAO,6BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,oBAAqB,CACnB,YAAa,GACb,UAAW,IACX,MAAO,yDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,yBAA0B,CACxB,YACE,2EACF,MAAO,2BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,OACX,OAAQ,OACR,SAAU,EACZ,CACF,EACA,wBAAyB,CACvB,YAAa,GACb,MAAO,sBACP,KAAM,QACN,MAAO,CACL,MAAO,CACL,CACE,MAAO,aACP,MAAO,mDACT,EACA,CACE,MAAO,eACP,MACE,oFACJ,EACA,CACE,MAAO,4BACP,MAAO,2BACT,EACA,CACE,MAAO,oCACP,MAAO,mCACT,EACA,CACE,MAAO,+BACP,MAAO,oCACT,EACA,CACE,MAAO,mCACP,MAAO,sCACT,EACA,CACE,MAAO,0BACP,MAAO,yBACT,EACA,CACE,MAAO,mCACP,MACE,2LACJ,EACA,CACE,MAAO,gBACP,MACE,6DACJ,CACF,CACF,EACA,qBAAsB,CACpB,UAAW,WACX,UAAW,QACb,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MACE,mFACF,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MACE,mEACF,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,0BAA2B,CACzB,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,4BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,MACb,CACF,EACA,qBAAsB,CACpB,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,2CACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,2BAA4B,CAC1B,YACE,sIACF,UAAW,IACX,MAAO,2BACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,eAAgB,CACd,YACE,4HACF,MAAO,qBACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,OACX,OAAQ,MACV,CACF,EACA,kCAAmC,CACjC,YAAa,GACb,MACE,iGACF,KAAM,UACN,qBAAsB,CACpB,UAAW,SACX,UAAW,UACb,CACF,CACF,EACA,SAAU,CACR,eACA,6BACA,iBACA,qBACA,qBACA,0BACA,6BACA,4BACA,uBACA,mCACF,EACA,KAAM,SACN,cAAe,CACb,kBACA,6BACA,kCACA,yCACA,iBACA,qBACA,qBACA,sBACA,2BACA,0BACA,6BACA,yCACA,4BACA,uBACA,6BACA,iBACA,mCACF,CACF,CACF,CACF","names":["jsonSchema"]}
@@ -1,2 +0,0 @@
1
- import{a as Te}from"./chunk-VAIBLWOY.js";import{a as Me}from"./chunk-7C2Z2EE5.js";import{a as Ce,b as Oe,c as O,d as Ve,e as Pe}from"./chunk-F66G33YT.js";import{a as fe,b as ue,c as ye,f as pe,g as _e,h as Se,i as be,j as ge,l as Fe,n as Ee}from"./chunk-BFOGH4SF.js";import{a as j}from"./chunk-QW4JPW6J.js";import{a as he}from"./chunk-PJBAQZ6G.js";import{c as C,d as L,f as H}from"./chunk-PAQW5BFW.js";import{a as l}from"./chunk-P37U34EQ.js";import{useEffect as nt,useMemo as d,useRef as ot,useState as Le}from"react";import it from"lodash.mergewith";import{jsx as ke}from"react/jsx-runtime";var at={employment_basic_information:"basic_information",contract_details:"contract_details"},st={select_country:null,basic_information:"employment_basic_information",contract_details:"contract_details",benefits:null,review:null},rt=l(({isLoadingBasicInformationForm:y,isLoadingContractDetailsForm:I,isLoadingEmployment:J,isLoadingBenefitsOffersSchema:N,isLoadingBenefitOffers:a,isLoadingCompany:D,isLoadingCountries:V,employmentStatus:s,employmentId:_,currentStepName:r,basicInformationFields:A,contractDetailsFields:c})=>{let P=y||I||J||N||a||D||V,o=s&&Ve.includes(s),k=s&&!Pe.includes(s),B=!!(_&&o&&r!=="review"),q=P||B,w=!!(B&&!P&&A.length>0&&c.length>0);return{isLoading:q,isNavigatingToReview:w,isEmploymentReadOnly:o,canInvite:k}},"getLoadingStates"),bt=l(({employmentId:y,companyId:I,countryCode:J,type:N,options:a,skipSteps:D,externalId:V,initialValues:s})=>{let _=ot({select_country:{},basic_information:{},contract_details:{},benefits:{}}),[r,A]=Le(y),[c,P]=Le(J||null),{data:o,isLoading:k,refetch:B}=fe(r);o?.country?.code&&c!==o.country.code&&P(o.country.code);let{data:q,isLoading:w}=ye(r),{data:v,isLoading:W,refetch:Be}=ue(I),qe=D?.includes("select_country")?Oe:Ce,{fieldValues:S,stepState:n,setFieldValues:we,previousStep:ve,nextStep:Re,goToStep:x,setStepValues:z}=he(qe),{selectCountryForm:R,isLoading:G}=Fe({jsfModify:a?.jsfModify?.select_country,jsonSchemaVersion:a?.jsonSchemaVersion,queryOptions:{enabled:n.currentStep.name==="select_country"}}),$=Se(a),K=be(a),Y=ge(a),je=Ee(),{mutateAsync:Ie}=j($),{mutateAsync:Q}=j(K),{mutateAsync:Je}=j(Y),Ne=st[n.currentStep.name]||"employment_basic_information",De=at[Ne],Ae=o?.[De]||{},X=l(({form:e,options:i={},query:m={}})=>{let h=Object.keys(S).length>0?{...s,...n.values?.[n.currentStep.name],...S}:{...s,...Ae};return pe({countryCode:c,form:e,fieldValues:h,query:m,options:{...i,queryOptions:{enabled:i.queryOptions?.enabled??!0}}})},"useJSONSchema"),xe=!!(c&&(n.currentStep.name==="basic_information"||y)),Ue=!!(c&&(n.currentStep.name==="contract_details"||y)),{data:f,isLoading:Z}=X({form:"employment_basic_information",options:{jsfModify:a?.jsfModify?.basic_information,queryOptions:{enabled:xe}}}),b=a?.jsfModify?.contract_details?.fields?.annual_gross_salary,U=b&&typeof b=="object"&&"presentation"in b?b.presentation:void 0,ee=a?.jsfModify?.contract_details?.fields?.equity_compensation,He=d(()=>({fields:{annual_gross_salary:{...b,presentation:{annual_gross_salary_conversion_properties:{label:U?.annual_gross_salary_conversion_properties?.label,description:U?.annual_gross_salary_conversion_properties?.description},desiredCurrency:v?.desired_currency,Component:l(e=>ke(Me,{desiredCurrency:v?.desired_currency||"",...e}),"Component")}},equity_compensation:{...ee,presentation:{calculateDynamicProperties:l((e,i)=>{let m=e.equity_compensation?.offer_equity_compensation,h=i?.meta?.cost;return{extra:ke(Te,{offerEquity:m,equityCost:h})}},"calculateDynamicProperties")}}}}),[b,U,v?.desired_currency,ee]),{data:u,isLoading:te}=X({form:"contract_details",query:{employment_id:r},options:{jsfModify:{...a?.jsfModify?.contract_details,fields:{...a?.jsfModify?.contract_details?.fields,...He.fields}},queryOptions:{enabled:Ue}}}),{data:M,isLoading:ne}=_e(r,S,a),oe=d(()=>{if(n.currentStep.name==="benefits"){let e={...n.values?.[n.currentStep.name],...S};return it({},q,e)}return{}},[n.currentStep.name,q,n.values,S]),t=d(()=>({select_country:R?.fields||[],basic_information:f?.fields||[],contract_details:u?.fields||[],benefits:M?.fields||[],review:[]}),[R?.fields,f?.fields,u?.fields,M?.fields]),We={select_country:null,basic_information:f?.meta["x-jsf-fieldsets"],contract_details:u?.meta["x-jsf-fieldsets"],benefits:null,review:null},{country:{code:ie}={},basic_information:ae={},contract_details:se={},status:re}=o||{},ce=n.currentStep.name,g=d(()=>L(t.select_country,{country:c||ie||""}),[t.select_country,c,ie]),F=d(()=>{let e={...s,...ae};return L(t.basic_information,e)},[t.basic_information,ae,s]),p=d(()=>{let e={...s,...se};return L(t.contract_details,e)},[t.contract_details,se,s]),E=d(()=>{let e={...s,...oe};return L(t.benefits,e)},[t.benefits,oe,s]),ze=d(()=>o?{select_country:g,basic_information:H(t.basic_information,F),contract_details:o?.contract_details!==null?H(t.contract_details,p):p,benefits:E}:{select_country:g,basic_information:F,contract_details:p,benefits:E},[g,F,p,E,o,t]),{isLoading:Ge,isNavigatingToReview:le,isEmploymentReadOnly:$e,canInvite:Ke}=d(()=>rt({isLoadingBasicInformationForm:Z,isLoadingContractDetailsForm:te,isLoadingEmployment:k,isLoadingBenefitsOffersSchema:ne,isLoadingBenefitOffers:w,isLoadingCompany:W,isLoadingCountries:G,employmentId:y,employmentStatus:re,basicInformationFields:t.basic_information,contractDetailsFields:t.contract_details,currentStepName:ce}),[Z,te,k,ne,w,W,G,y,re,t.basic_information,t.contract_details,ce]);nt(()=>{le&&(_.current={select_country:O(g,t.select_country),basic_information:O(F,t.basic_information),contract_details:O(p,t.contract_details),benefits:O(E,t.benefits)},z({select_country:g,basic_information:F,contract_details:p,benefits:E,review:{}}),x("review"))},[F,E,p,x,le,g,z,t.basic_information,t.benefits,t.contract_details,t.select_country]);let me=l(e=>R&&n.currentStep.name==="select_country"?e:f&&n.currentStep.name==="basic_information"?C(e,f?.fields,{isPartialValidation:!1}):u&&n.currentStep.name==="contract_details"?C(e,u?.fields,{isPartialValidation:!1}):{},"parseFormValues");async function Ye(e){let i=n.currentStep.name;i in _.current&&(_.current[i]=O(e,t[i]));let m=me(e);switch(Be(),n.currentStep.name){case"select_country":return P(m.country),Promise.resolve({data:{countryCode:m.country}});case"basic_information":{let h=!r&&c,et=r&&c&&o?.country&&o?.country.code!==c;if(h||et){let tt={basic_information:m,type:N,country_code:c,external_id:V};try{let T=await Ie(tt),de=T.data?.data?.employment?.id;return A(de),await je.mutateAsync({employmentId:de,eligible_to_work_in_residing_country:"citizen",employer_or_work_restrictions:!1}),T}catch(T){throw console.error("Error creating onboarding:",T),T}}else if(r)return Q({employmentId:r,basic_information:m,pricing_plan_details:{frequency:"monthly"},external_id:V});return}case"contract_details":return Q({employmentId:r,external_id:V,...{contract_details:m,pricing_plan_details:{frequency:"monthly"}}});case"benefits":return Je({employmentId:r,...e})}}l(Ye,"onSubmit");function Qe(){ve()}l(Qe,"back");function Xe(){Re()}l(Xe,"next");function Ze(e){x(e)}return l(Ze,"goTo"),{employmentId:r,creditRiskStatus:v?.default_legal_entity_credit_risk_status,fieldValues:S,stepState:n,fields:t[n.currentStep.name],isLoading:Ge,isSubmitting:$.isPending||K.isPending||Y.isPending,initialValues:ze,handleValidation:l(e=>{if(n.currentStep.name==="select_country")return R.handleValidation(e);if(n.currentStep.name==="benefits"&&M){let i=C(e,M?.fields,{isPartialValidation:!1});return M?.handleValidation(i)}if(f&&n.currentStep.name==="basic_information"){let i=C(e,f?.fields,{isPartialValidation:!1});return f?.handleValidation(i)}if(u&&n.currentStep.name==="contract_details"){let i=C(e,u?.fields,{isPartialValidation:!1});return u?.handleValidation(i)}return null},"handleValidation"),checkFieldUpdates:we,parseFormValues:me,onSubmit:Ye,back:Qe,next:Xe,goTo:Ze,meta:{fields:_.current,fieldsets:We[n.currentStep.name]},refetchEmployment:B,employment:o,isEmploymentReadOnly:$e,canInvite:Ke}},"useOnboarding");export{bt as a};
2
- //# sourceMappingURL=chunk-ZOKSYPOP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Onboarding/hooks.tsx"],"sourcesContent":["import {\n Employment,\n EmploymentCreateParams,\n EmploymentFullParams,\n} from '@/src/client';\nimport { Fields } from '@remoteoss/json-schema-form';\n\nimport { useStepState, Step } from '@/src/flows/useStepState';\nimport {\n disabledInviteButtonEmploymentStatus,\n prettifyFormValues,\n reviewStepAllowedEmploymentStatus,\n STEPS,\n STEPS_WITHOUT_SELECT_COUNTRY,\n} from '@/src/flows/Onboarding/utils';\nimport {\n getInitialValues,\n enableAckFields,\n parseJSFToValidate,\n} from '@/src/components/form/utils';\nimport { mutationToPromise } from '@/src/lib/mutations';\nimport { FieldValues } from 'react-hook-form';\nimport { Meta, OnboardingFlowParams } from '@/src/flows/Onboarding/types';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport mergeWith from 'lodash.mergewith';\nimport {\n useBenefitOffers,\n useBenefitOffersSchema,\n useCompany,\n useCountriesSchemaField,\n useCreateEmployment,\n useEmployment,\n useJSONSchemaForm,\n useUpdateBenefitsOffers,\n useUpdateEmployment,\n useUpsertContractEligibility,\n} from '@/src/flows/Onboarding/api';\nimport { JSFModify, JSONSchemaFormType } from '@/src/flows/types';\nimport { AnnualGrossSalary } from '@/src/flows/Onboarding/components/AnnualGrossSalary';\nimport { $TSFixMe, JSFField, JSFFieldset } from '@/src/types/remoteFlows';\nimport { EquityPriceDetails } from '@/src/flows/Onboarding/components/EquityPriceDetails';\n\ntype OnboardingHookProps = OnboardingFlowParams;\n\nconst jsonSchemaToEmployment: Partial<\n Record<JSONSchemaFormType, keyof Employment>\n> = {\n employment_basic_information: 'basic_information',\n contract_details: 'contract_details',\n};\n\nconst stepToFormSchemaMap: Record<\n keyof typeof STEPS,\n JSONSchemaFormType | null\n> = {\n select_country: null,\n basic_information: 'employment_basic_information',\n contract_details: 'contract_details',\n benefits: null,\n review: null,\n};\n\nconst getLoadingStates = ({\n isLoadingBasicInformationForm,\n isLoadingContractDetailsForm,\n isLoadingEmployment,\n isLoadingBenefitsOffersSchema,\n isLoadingBenefitOffers,\n isLoadingCompany,\n isLoadingCountries,\n employmentStatus,\n employmentId,\n currentStepName,\n basicInformationFields,\n contractDetailsFields,\n}: {\n isLoadingBasicInformationForm: boolean;\n isLoadingContractDetailsForm: boolean;\n isLoadingEmployment: boolean;\n isLoadingBenefitsOffersSchema: boolean;\n isLoadingBenefitOffers: boolean;\n isLoadingCompany: boolean;\n isLoadingCountries: boolean;\n employmentStatus?: Employment['status'];\n employmentId?: string;\n currentStepName: string;\n basicInformationFields: Fields;\n contractDetailsFields: Fields;\n}) => {\n const initialLoading =\n isLoadingBasicInformationForm ||\n isLoadingContractDetailsForm ||\n isLoadingEmployment ||\n isLoadingBenefitsOffersSchema ||\n isLoadingBenefitOffers ||\n isLoadingCompany ||\n isLoadingCountries;\n\n const isEmploymentReadOnly =\n employmentStatus &&\n reviewStepAllowedEmploymentStatus.includes(employmentStatus);\n\n const canInvite =\n employmentStatus &&\n !disabledInviteButtonEmploymentStatus.includes(employmentStatus);\n\n const shouldHandleReadOnlyEmployment = Boolean(\n employmentId && isEmploymentReadOnly && currentStepName !== 'review',\n );\n\n const isLoading = initialLoading || shouldHandleReadOnlyEmployment;\n\n const isNavigatingToReview = Boolean(\n shouldHandleReadOnlyEmployment &&\n !initialLoading &&\n basicInformationFields.length > 0 &&\n contractDetailsFields.length > 0,\n );\n\n return {\n isLoading,\n isNavigatingToReview,\n isEmploymentReadOnly,\n canInvite,\n };\n};\n\nexport const useOnboarding = ({\n employmentId,\n companyId,\n countryCode,\n type,\n options,\n skipSteps,\n externalId,\n initialValues: onboardingInitialValues,\n}: OnboardingHookProps) => {\n const fieldsMetaRef = useRef<{\n select_country: Meta;\n basic_information: Meta;\n contract_details: Meta;\n benefits: Meta;\n }>({\n select_country: {},\n basic_information: {},\n contract_details: {},\n benefits: {},\n });\n const [internalEmploymentId, setInternalEmploymentId] = useState<\n string | undefined\n >(employmentId);\n const [internalCountryCode, setInternalCountryCode] = useState<string | null>(\n countryCode || null,\n );\n const {\n data: employment,\n isLoading: isLoadingEmployment,\n refetch: refetchEmployment,\n } = useEmployment(internalEmploymentId);\n\n // if the employment is loaded, country code has not been set yet\n // we set the internal country code with the employment country code\n if (\n employment?.country?.code &&\n internalCountryCode !== employment.country.code\n ) {\n setInternalCountryCode(employment.country.code);\n }\n\n const { data: benefitOffers, isLoading: isLoadingBenefitOffers } =\n useBenefitOffers(internalEmploymentId);\n const {\n data: company,\n isLoading: isLoadingCompany,\n refetch: refetchCompany,\n } = useCompany(companyId);\n const stepsToUse = skipSteps?.includes('select_country')\n ? STEPS_WITHOUT_SELECT_COUNTRY\n : STEPS;\n\n const {\n fieldValues,\n stepState,\n setFieldValues,\n previousStep,\n nextStep,\n goToStep,\n setStepValues,\n } = useStepState(\n stepsToUse as Record<keyof typeof STEPS, Step<keyof typeof STEPS>>,\n );\n\n const { selectCountryForm, isLoading: isLoadingCountries } =\n useCountriesSchemaField({\n jsfModify: options?.jsfModify?.select_country,\n jsonSchemaVersion: options?.jsonSchemaVersion,\n queryOptions: {\n enabled: stepState.currentStep.name === 'select_country',\n },\n });\n\n const createEmploymentMutation = useCreateEmployment(options);\n const updateEmploymentMutation = useUpdateEmployment(options);\n const updateBenefitsOffersMutation = useUpdateBenefitsOffers(options);\n const updateContractEligibilityMutation = useUpsertContractEligibility();\n const { mutateAsync: createEmploymentMutationAsync } = mutationToPromise(\n createEmploymentMutation,\n );\n const { mutateAsync: updateEmploymentMutationAsync } = mutationToPromise(\n updateEmploymentMutation,\n );\n const { mutateAsync: updateBenefitsOffersMutationAsync } = mutationToPromise(\n updateBenefitsOffersMutation,\n );\n\n const formType =\n stepToFormSchemaMap[stepState.currentStep.name] ||\n 'employment_basic_information';\n const employmentKey = jsonSchemaToEmployment[formType] as keyof Employment;\n const serverEmploymentData = (employment?.[employmentKey] || {}) as Record<\n string,\n unknown\n >;\n\n const useJSONSchema = ({\n form,\n options: jsonSchemaOptions = {},\n query = {},\n }: {\n form: JSONSchemaFormType;\n options?: {\n jsfModify?: JSFModify;\n queryOptions?: { enabled?: boolean };\n };\n query?: Record<string, string>;\n }) => {\n // when you write on the fields, the values are stored in the fieldValues state\n // when values are stored in the stepState is when the user has navigated to the step\n // and then we have the values from the server and the onboardingInitialValues that the user can inject,\n const memoizedFieldValues =\n Object.keys(fieldValues).length > 0\n ? {\n ...onboardingInitialValues,\n ...stepState.values?.[stepState.currentStep.name], // Restore values for the current step\n ...fieldValues,\n }\n : {\n ...onboardingInitialValues,\n ...serverEmploymentData,\n };\n\n return useJSONSchemaForm({\n countryCode: internalCountryCode as string,\n form: form,\n fieldValues: memoizedFieldValues,\n query,\n options: {\n ...jsonSchemaOptions,\n queryOptions: {\n enabled: jsonSchemaOptions.queryOptions?.enabled ?? true,\n },\n },\n });\n };\n\n const isBasicInformationDetailsEnabled = Boolean(\n internalCountryCode &&\n (stepState.currentStep.name === 'basic_information' ||\n Boolean(employmentId)),\n );\n\n const isContractDetailsEnabled = Boolean(\n internalCountryCode &&\n (stepState.currentStep.name === 'contract_details' ||\n Boolean(employmentId)),\n );\n\n const {\n data: basicInformationForm,\n isLoading: isLoadingBasicInformationForm,\n } = useJSONSchema({\n form: 'employment_basic_information',\n options: {\n jsfModify: options?.jsfModify?.basic_information,\n queryOptions: {\n enabled: isBasicInformationDetailsEnabled,\n },\n },\n });\n\n const annualGrossSalaryField =\n options?.jsfModify?.contract_details?.fields?.annual_gross_salary;\n const annualSalaryFieldPresentation =\n annualGrossSalaryField &&\n typeof annualGrossSalaryField === 'object' &&\n 'presentation' in annualGrossSalaryField\n ? (\n annualGrossSalaryField as {\n presentation?: {\n annual_gross_salary_conversion_properties?: {\n label?: string;\n description?: string;\n };\n };\n }\n ).presentation\n : undefined;\n\n const equityCompensationField =\n options?.jsfModify?.contract_details?.fields?.equity_compensation;\n\n const customFields = useMemo(\n () => ({\n fields: {\n annual_gross_salary: {\n ...annualGrossSalaryField,\n presentation: {\n annual_gross_salary_conversion_properties: {\n label:\n annualSalaryFieldPresentation\n ?.annual_gross_salary_conversion_properties?.label,\n description:\n annualSalaryFieldPresentation\n ?.annual_gross_salary_conversion_properties?.description,\n },\n desiredCurrency: company?.desired_currency,\n Component: (props: JSFField & { currency: string }) => {\n return (\n <AnnualGrossSalary\n desiredCurrency={company?.desired_currency || ''}\n {...props}\n />\n );\n },\n },\n },\n equity_compensation: {\n ...equityCompensationField,\n presentation: {\n calculateDynamicProperties: (\n values: FieldValues,\n field: JSFField,\n ) => {\n const offerEquity =\n values.equity_compensation?.offer_equity_compensation;\n const equityCost = field?.meta?.cost;\n\n return {\n extra: (\n <EquityPriceDetails\n offerEquity={offerEquity}\n equityCost={equityCost as $TSFixMe}\n />\n ),\n };\n },\n },\n },\n },\n }),\n [\n annualGrossSalaryField,\n annualSalaryFieldPresentation,\n company?.desired_currency,\n equityCompensationField,\n ],\n );\n\n const { data: contractDetailsForm, isLoading: isLoadingContractDetailsForm } =\n useJSONSchema({\n form: 'contract_details',\n query: {\n employment_id: internalEmploymentId as string,\n },\n options: {\n jsfModify: {\n ...options?.jsfModify?.contract_details,\n fields: {\n ...options?.jsfModify?.contract_details?.fields,\n ...customFields.fields,\n },\n },\n queryOptions: {\n enabled: isContractDetailsEnabled,\n },\n },\n });\n\n const {\n data: benefitOffersSchema,\n isLoading: isLoadingBenefitsOffersSchema,\n } = useBenefitOffersSchema(\n internalEmploymentId as string,\n fieldValues,\n options,\n );\n\n const initialValuesBenefitOffers = useMemo(() => {\n if (stepState.currentStep.name === 'benefits') {\n const benefitsFormValues = {\n ...stepState.values?.[stepState.currentStep.name as keyof typeof STEPS], // Restore values for the current step\n ...fieldValues,\n };\n return mergeWith({}, benefitOffers, benefitsFormValues);\n }\n return {};\n }, [\n stepState.currentStep.name,\n benefitOffers,\n stepState.values,\n fieldValues,\n ]);\n\n const stepFields: Record<keyof typeof STEPS, Fields> = useMemo(\n () => ({\n select_country: selectCountryForm?.fields || [],\n basic_information: basicInformationForm?.fields || [],\n contract_details: contractDetailsForm?.fields || [],\n benefits: benefitOffersSchema?.fields || [],\n review: [],\n }),\n [\n selectCountryForm?.fields,\n basicInformationForm?.fields,\n contractDetailsForm?.fields,\n benefitOffersSchema?.fields,\n ],\n );\n\n const stepFieldsWithFlatFieldsets: Record<\n keyof typeof STEPS,\n JSFFieldset | null | undefined\n > = {\n select_country: null,\n basic_information: basicInformationForm?.meta['x-jsf-fieldsets'],\n contract_details: contractDetailsForm?.meta['x-jsf-fieldsets'],\n benefits: null,\n review: null,\n };\n\n const {\n country: { code: employmentCountryCode } = {},\n basic_information: employmentBasicInformation = {},\n contract_details: employmentContractDetails = {},\n status: employmentStatus,\n } = employment || {};\n const currentStepName = stepState.currentStep.name;\n\n const selectCountryInitialValues = useMemo(\n () =>\n getInitialValues(stepFields.select_country, {\n country: internalCountryCode || employmentCountryCode || '',\n }),\n [stepFields.select_country, internalCountryCode, employmentCountryCode],\n );\n\n const basicInformationInitialValues = useMemo(() => {\n const initialValues = {\n ...onboardingInitialValues,\n ...employmentBasicInformation,\n };\n\n return getInitialValues(stepFields.basic_information, initialValues);\n }, [\n stepFields.basic_information,\n employmentBasicInformation,\n onboardingInitialValues,\n ]);\n\n const contractDetailsInitialValues = useMemo(() => {\n const initialValues = {\n ...onboardingInitialValues,\n ...employmentContractDetails,\n };\n\n return getInitialValues(stepFields.contract_details, initialValues);\n }, [\n stepFields.contract_details,\n employmentContractDetails,\n onboardingInitialValues,\n ]);\n\n const benefitsInitialValues = useMemo(() => {\n const initialValues = {\n ...onboardingInitialValues,\n ...initialValuesBenefitOffers,\n };\n\n return getInitialValues(stepFields.benefits, initialValues);\n }, [\n stepFields.benefits,\n initialValuesBenefitOffers,\n onboardingInitialValues,\n ]);\n\n const initialValues = useMemo(() => {\n if (employment) {\n return {\n select_country: selectCountryInitialValues,\n // We don't store ack fields in the db, eg \"ack_start_date_ammendment\" for Argentina, and therefore is not returned in the employment response\n // So when an employmentId exists, it means that the user has already started the onboarding process, and we need to enable the ack fields\n basic_information: enableAckFields(\n stepFields['basic_information'],\n basicInformationInitialValues,\n ),\n contract_details:\n // if contract details is null, it means it has not been filled yet, so we can't enable the ack fields\n employment?.contract_details !== null\n ? enableAckFields(\n stepFields['contract_details'],\n contractDetailsInitialValues,\n )\n : contractDetailsInitialValues,\n benefits: benefitsInitialValues,\n };\n }\n return {\n select_country: selectCountryInitialValues,\n basic_information: basicInformationInitialValues,\n contract_details: contractDetailsInitialValues,\n benefits: benefitsInitialValues,\n };\n }, [\n selectCountryInitialValues,\n basicInformationInitialValues,\n contractDetailsInitialValues,\n benefitsInitialValues,\n employment,\n stepFields,\n ]);\n\n const { isLoading, isNavigatingToReview, isEmploymentReadOnly, canInvite } =\n useMemo(\n () =>\n getLoadingStates({\n isLoadingBasicInformationForm,\n isLoadingContractDetailsForm,\n isLoadingEmployment,\n isLoadingBenefitsOffersSchema,\n isLoadingBenefitOffers,\n isLoadingCompany,\n isLoadingCountries,\n employmentId,\n employmentStatus: employmentStatus,\n basicInformationFields: stepFields.basic_information,\n contractDetailsFields: stepFields.contract_details,\n currentStepName: currentStepName,\n }),\n [\n isLoadingBasicInformationForm,\n isLoadingContractDetailsForm,\n isLoadingEmployment,\n isLoadingBenefitsOffersSchema,\n isLoadingBenefitOffers,\n isLoadingCompany,\n isLoadingCountries,\n employmentId,\n employmentStatus,\n stepFields.basic_information,\n stepFields.contract_details,\n currentStepName,\n ],\n );\n\n useEffect(() => {\n if (isNavigatingToReview) {\n fieldsMetaRef.current = {\n select_country: prettifyFormValues(\n selectCountryInitialValues,\n stepFields.select_country,\n ),\n basic_information: prettifyFormValues(\n basicInformationInitialValues,\n stepFields.basic_information,\n ),\n contract_details: prettifyFormValues(\n contractDetailsInitialValues,\n stepFields.contract_details,\n ),\n benefits: prettifyFormValues(\n benefitsInitialValues,\n stepFields.benefits,\n ),\n };\n\n setStepValues({\n select_country: selectCountryInitialValues,\n basic_information: basicInformationInitialValues,\n contract_details: contractDetailsInitialValues,\n benefits: benefitsInitialValues,\n review: {},\n });\n\n goToStep('review');\n }\n }, [\n basicInformationInitialValues,\n benefitsInitialValues,\n contractDetailsInitialValues,\n goToStep,\n isNavigatingToReview,\n selectCountryInitialValues,\n setStepValues,\n stepFields.basic_information,\n stepFields.benefits,\n stepFields.contract_details,\n stepFields.select_country,\n ]);\n\n const parseFormValues = (values: FieldValues) => {\n if (selectCountryForm && stepState.currentStep.name === 'select_country') {\n return values;\n }\n if (\n basicInformationForm &&\n stepState.currentStep.name === 'basic_information'\n ) {\n return parseJSFToValidate(values, basicInformationForm?.fields, {\n isPartialValidation: false,\n });\n }\n\n if (\n contractDetailsForm &&\n stepState.currentStep.name === 'contract_details'\n ) {\n return parseJSFToValidate(values, contractDetailsForm?.fields, {\n isPartialValidation: false,\n });\n }\n\n return {};\n };\n\n async function onSubmit(values: FieldValues) {\n // Prettify values for the current step\n const currentStepName = stepState.currentStep.name;\n if (currentStepName in fieldsMetaRef.current) {\n fieldsMetaRef.current[\n currentStepName as keyof typeof fieldsMetaRef.current\n ] = prettifyFormValues(values, stepFields[currentStepName]);\n }\n\n const parsedValues = parseFormValues(values);\n refetchCompany();\n switch (stepState.currentStep.name) {\n case 'select_country': {\n setInternalCountryCode(parsedValues.country);\n return Promise.resolve({ data: { countryCode: parsedValues.country } });\n }\n case 'basic_information': {\n const isEmploymentNotLoaded =\n !internalEmploymentId && internalCountryCode;\n const hasChangedCountry =\n internalEmploymentId &&\n internalCountryCode &&\n employment?.country &&\n employment?.country.code !== internalCountryCode;\n if (isEmploymentNotLoaded || hasChangedCountry) {\n const payload: EmploymentCreateParams = {\n basic_information: parsedValues,\n type: type,\n country_code: internalCountryCode,\n external_id: externalId,\n };\n try {\n const response = await createEmploymentMutationAsync(payload);\n // @ts-expect-error the types from the response are not matching\n const employmentId = response.data?.data?.employment?.id;\n setInternalEmploymentId(employmentId);\n await updateContractEligibilityMutation.mutateAsync({\n employmentId: employmentId,\n eligible_to_work_in_residing_country: 'citizen',\n employer_or_work_restrictions: false,\n });\n\n return response;\n } catch (error) {\n console.error('Error creating onboarding:', error);\n throw error;\n }\n } else if (internalEmploymentId) {\n return updateEmploymentMutationAsync({\n employmentId: internalEmploymentId,\n basic_information: parsedValues,\n pricing_plan_details: {\n frequency: 'monthly',\n },\n external_id: externalId,\n });\n }\n\n return;\n }\n case 'contract_details': {\n const payload: EmploymentFullParams = {\n contract_details: parsedValues,\n pricing_plan_details: {\n frequency: 'monthly',\n },\n };\n return updateEmploymentMutationAsync({\n employmentId: internalEmploymentId as string,\n external_id: externalId,\n ...payload,\n });\n }\n\n case 'benefits': {\n return updateBenefitsOffersMutationAsync({\n employmentId: internalEmploymentId as string,\n ...values,\n });\n }\n }\n return;\n }\n\n function back() {\n previousStep();\n }\n\n function next() {\n nextStep();\n }\n\n function goTo(step: keyof typeof STEPS) {\n goToStep(step);\n }\n\n return {\n /**\n * Employment id passed useful to be used between components\n */\n employmentId: internalEmploymentId,\n\n /**\n * Credit risk status of the company, useful to know what to to show in the review step\n * The possible values are:\n * - not_started\n * - ready\n * - in_progress\n * - referred\n * - fail\n * - deposit_required\n * - no_deposit_required\n */\n\n creditRiskStatus: company?.default_legal_entity_credit_risk_status,\n /**\n * Current state of the form fields for the current step.\n */\n fieldValues,\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState,\n /**\n * Array of form fields from the onboarding schema\n */\n fields: stepFields[stepState.currentStep.name],\n /**\n * Loading state indicating if the onboarding schema is being fetched\n */\n isLoading: isLoading,\n /**\n * Loading state indicating if the onboarding mutation is in progress\n */\n isSubmitting:\n createEmploymentMutation.isPending ||\n updateEmploymentMutation.isPending ||\n updateBenefitsOffersMutation.isPending,\n /**\n * Initial form values\n */\n initialValues,\n /**\n * Function to validate form values against the onboarding schema\n * @param values - Form values to validate\n * @returns Validation result or null if no schema is available\n */\n handleValidation: (values: FieldValues) => {\n if (stepState.currentStep.name === 'select_country') {\n return selectCountryForm.handleValidation(values);\n }\n if (stepState.currentStep.name === 'benefits' && benefitOffersSchema) {\n const parsedValues = parseJSFToValidate(\n values,\n benefitOffersSchema?.fields,\n { isPartialValidation: false },\n );\n\n return benefitOffersSchema?.handleValidation(parsedValues);\n }\n if (\n basicInformationForm &&\n stepState.currentStep.name === 'basic_information'\n ) {\n const parsedValues = parseJSFToValidate(\n values,\n basicInformationForm?.fields,\n { isPartialValidation: false },\n );\n return basicInformationForm?.handleValidation(parsedValues);\n }\n\n if (\n contractDetailsForm &&\n stepState.currentStep.name === 'contract_details'\n ) {\n const parsedValues = parseJSFToValidate(\n values,\n contractDetailsForm?.fields,\n { isPartialValidation: false },\n );\n return contractDetailsForm?.handleValidation(parsedValues);\n }\n\n return null;\n },\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: setFieldValues,\n\n /**\n * Function to parse form values before submission\n * @param values - Form values to parse\n * @returns Parsed form values\n */\n parseFormValues,\n\n /**\n * Function to handle form submission\n * @param values - Form values to submit\n * @returns Promise resolving to the mutation result\n */\n onSubmit,\n\n /**\n * Function to handle going back to the previous step\n * @returns {void}\n */\n back,\n\n /**\n * Function to handle going to the next step\n * @returns {void}\n */\n next,\n\n /**\n * Function to handle going to a specific step\n * @param step The step to go to.\n * @returns {void}\n */\n goTo,\n\n /**\n * Fields metadata for each step\n */\n meta: {\n fields: fieldsMetaRef.current,\n fieldsets: stepFieldsWithFlatFieldsets[stepState.currentStep.name],\n },\n\n /**\n * Function to refetch the employment data\n * @returns {void}\n */\n refetchEmployment,\n /**\n * Employment data\n */\n employment,\n\n /**\n * let's the user know that the employment cannot be edited, happens when employment.status is invited, created_awaiting_reserve or created_reserve_paid\n * @returns {boolean}\n */\n isEmploymentReadOnly,\n\n /**\n * let's the user know if the company can invite employees\n * @retur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,aACEsC,EAAyB,WACzBE,EAAyB,WACzBE,EAA6B,UAI/B,cAAA8C,GAMA,iBAAkB3G,EAACwF,GAAwB,CACzC,GAAIxC,EAAU,YAAY,OAAS,iBACjC,OAAOO,EAAkB,iBAAiBiC,CAAM,EAElD,GAAIxC,EAAU,YAAY,OAAS,YAAc8C,EAAqB,CACpE,IAAMsB,EAAeF,EACnB1B,EACAM,GAAqB,OACrB,CAAE,oBAAqB,EAAM,CAC/B,EAEA,OAAOA,GAAqB,iBAAiBsB,CAAY,CAC3D,CACA,GACEpC,GACAhC,EAAU,YAAY,OAAS,oBAC/B,CACA,IAAMoE,EAAeF,EACnB1B,EACAR,GAAsB,OACtB,CAAE,oBAAqB,EAAM,CAC/B,EACA,OAAOA,GAAsB,iBAAiBoC,CAAY,CAC5D,CAEA,GACEvB,GACA7C,EAAU,YAAY,OAAS,mBAC/B,CACA,IAAMoE,EAAeF,EACnB1B,EACAK,GAAqB,OACrB,CAAE,oBAAqB,EAAM,CAC/B,EACA,OAAOA,GAAqB,iBAAiBuB,CAAY,CAC3D,CAEA,OAAO,IACT,EAtCkB,oBA2ClB,kBAAmBnE,GAOnB,gBAAAgE,GAOA,SAAAE,GAMA,KAAAO,GAMA,KAAAC,GAOA,KAAAC,GAKA,KAAM,CACJ,OAAQ/F,EAAc,QACtB,UAAWuE,GAA4BpD,EAAU,YAAY,IAAI,CACnE,EAMA,kBAAAX,EAIA,WAAAD,EAMA,qBAAAtB,GAMA,UAAAE,EACF,CACF,EA1vB6B","names":["useEffect","useMemo","useRef","useState","mergeWith","jsx","jsonSchemaToEmployment","stepToFormSchemaMap","getLoadingStates","__name","isLoadingBasicInformationForm","isLoadingContractDetailsForm","isLoadingEmployment","isLoadingBenefitsOffersSchema","isLoadingBenefitOffers","isLoadingCompany","isLoadingCountries","employmentStatus","employmentId","currentStepName","basicInformationFields","contractDetailsFields","initialLoading","isEmploymentReadOnly","reviewStepAllowedEmploymentStatus","canInvite","disabledInviteButtonEmploymentStatus","shouldHandleReadOnlyEmployment","isLoading","isNavigatingToReview","useOnboarding","companyId","countryCode","type","options","skipSteps","externalId","onboardingInitialValues","fieldsMetaRef","useRef","internalEmploymentId","setInternalEmploymentId","useState","internalCountryCode","setInternalCountryCode","employment","refetchEmployment","useEmployment","benefitOffers","useBenefitOffers","company","refetchCompany","useCompany","stepsToUse","STEPS_WITHOUT_SELECT_COUNTRY","STEPS","fieldValues","stepState","setFieldValues","previousStep","nextStep","goToStep","setStepValues","useStepState","selectCountryForm","useCountriesSchemaField","createEmploymentMutation","useCreateEmployment","updateEmploymentMutation","useUpdateEmployment","updateBenefitsOffersMutation","useUpdateBenefitsOffers","updateContractEligibilityMutation","useUpsertContractEligibility","createEmploymentMutationAsync","mutationToPromise","updateEmploymentMutationAsync","updateBenefitsOffersMutationAsync","formType","employmentKey","serverEmploymentData","useJSONSchema","form","jsonSchemaOptions","query","memoizedFieldValues","useJSONSchemaForm","isBasicInformationDetailsEnabled","isContractDetailsEnabled","basicInformationForm","annualGrossSalaryField","annualSalaryFieldPresentation","equityCompensationField","customFields","useMemo","props","AnnualGrossSalary","values","field","offerEquity","equityCost","EquityPriceDetails","contractDetailsForm","benefitOffersSchema","useBenefitOffersSchema","initialValuesBenefitOffers","benefitsFormValues","mergeWith","stepFields","stepFieldsWithFlatFieldsets","employmentCountryCode","employmentBasicInformation","employmentContractDetails","selectCountryInitialValues","getInitialValues","basicInformationInitialValues","initialValues","contractDetailsInitialValues","benefitsInitialValues","enableAckFields","useEffect","prettifyFormValues","parseFormValues","parseJSFToValidate","onSubmit","parsedValues","isEmploymentNotLoaded","hasChangedCountry","payload","response","error","back","next","goTo","step"]}