@remoteoss/remote-flows 0.4.0-alpha.1 → 0.4.0-alpha.10

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 (336) hide show
  1. package/README.md +63 -1
  2. package/dist/chunk-2Y22JKVE.js +2 -0
  3. package/dist/{chunk-QOMUXX6W.js → chunk-3PH5E6CZ.js} +2 -2
  4. package/dist/chunk-4A6ZQNMB.js +2 -0
  5. package/dist/chunk-4A6ZQNMB.js.map +1 -0
  6. package/dist/chunk-4YNOSVYQ.js +2 -0
  7. package/dist/chunk-4YNOSVYQ.js.map +1 -0
  8. package/dist/chunk-55SA3TEF.js +2 -0
  9. package/dist/chunk-55SA3TEF.js.map +1 -0
  10. package/dist/chunk-6I6RMJXC.js +2 -0
  11. package/dist/chunk-6I6RMJXC.js.map +1 -0
  12. package/dist/chunk-6T3A6GWH.js +2 -0
  13. package/dist/chunk-6T3A6GWH.js.map +1 -0
  14. package/dist/chunk-7KUKFRKC.js +2 -0
  15. package/dist/chunk-7KUKFRKC.js.map +1 -0
  16. package/dist/chunk-B4SVITZI.js +2 -0
  17. package/dist/chunk-B4SVITZI.js.map +1 -0
  18. package/dist/chunk-DBIPVIBO.js +2 -0
  19. package/dist/{chunk-DE5FSFYL.js.map → chunk-DBIPVIBO.js.map} +1 -1
  20. package/dist/chunk-DP4SIYAC.js +2 -0
  21. package/dist/chunk-DP4SIYAC.js.map +1 -0
  22. package/dist/chunk-EGDD73PU.js +2 -0
  23. package/dist/chunk-EGDD73PU.js.map +1 -0
  24. package/dist/chunk-EMVYCKDC.js +2 -0
  25. package/dist/{chunk-56BNVYTD.js.map → chunk-EMVYCKDC.js.map} +1 -1
  26. package/dist/chunk-FB4QOGWE.js +2 -0
  27. package/dist/chunk-FB4QOGWE.js.map +1 -0
  28. package/dist/chunk-G7BISHWK.js +2 -0
  29. package/dist/chunk-G7BISHWK.js.map +1 -0
  30. package/dist/chunk-GFWQG4ZT.js +2 -0
  31. package/dist/chunk-GFWQG4ZT.js.map +1 -0
  32. package/dist/chunk-GMU3QGAR.js +2 -0
  33. package/dist/chunk-GMU3QGAR.js.map +1 -0
  34. package/dist/chunk-HBH2PSYQ.js +2 -0
  35. package/dist/chunk-HBH2PSYQ.js.map +1 -0
  36. package/dist/chunk-HJBXUPHM.js +2 -0
  37. package/dist/chunk-HJBXUPHM.js.map +1 -0
  38. package/dist/chunk-HSY5OO7D.js +2 -0
  39. package/dist/chunk-HSY5OO7D.js.map +1 -0
  40. package/dist/chunk-IAHI4OUM.js +2 -0
  41. package/dist/chunk-IAHI4OUM.js.map +1 -0
  42. package/dist/chunk-IKQ25VV5.js +2 -0
  43. package/dist/chunk-IKQ25VV5.js.map +1 -0
  44. package/dist/chunk-INAXCFVC.js +2 -0
  45. package/dist/chunk-INAXCFVC.js.map +1 -0
  46. package/dist/chunk-JJPI2YDM.js +2 -0
  47. package/dist/chunk-JJPI2YDM.js.map +1 -0
  48. package/dist/chunk-L5OIK2ZJ.js +2 -0
  49. package/dist/chunk-L5OIK2ZJ.js.map +1 -0
  50. package/dist/chunk-LJRUD43L.js +2 -0
  51. package/dist/chunk-LJRUD43L.js.map +1 -0
  52. package/dist/chunk-LTDDSH45.js +2 -0
  53. package/dist/chunk-LTDDSH45.js.map +1 -0
  54. package/dist/chunk-MGUDZTTV.js +2 -0
  55. package/dist/chunk-MGUDZTTV.js.map +1 -0
  56. package/dist/chunk-NEFNFYRS.js +2 -0
  57. package/dist/{chunk-GFBF55NR.js.map → chunk-NEFNFYRS.js.map} +1 -1
  58. package/dist/chunk-NF5IMQEW.js +2 -0
  59. package/dist/chunk-NF5IMQEW.js.map +1 -0
  60. package/dist/{chunk-UECSVYQ5.js → chunk-O3QLBSMV.js} +2 -2
  61. package/dist/chunk-O3QLBSMV.js.map +1 -0
  62. package/dist/chunk-O562EWKG.js +2 -0
  63. package/dist/chunk-O562EWKG.js.map +1 -0
  64. package/dist/chunk-OIXUBXFU.js +2 -0
  65. package/dist/{chunk-GMGKIQLI.js.map → chunk-OIXUBXFU.js.map} +1 -1
  66. package/dist/chunk-OKAOH4ER.js +2 -0
  67. package/dist/chunk-OKAOH4ER.js.map +1 -0
  68. package/dist/chunk-ONZPO4GN.js +2 -0
  69. package/dist/{chunk-IDSJI7KQ.js.map → chunk-ONZPO4GN.js.map} +1 -1
  70. package/dist/chunk-P5VTRXW3.js +2 -0
  71. package/dist/chunk-P5VTRXW3.js.map +1 -0
  72. package/dist/chunk-PH5CQN7X.js +2 -0
  73. package/dist/{chunk-MESREYTZ.js.map → chunk-PH5CQN7X.js.map} +1 -1
  74. package/dist/chunk-PJMKZ3HR.js +2 -0
  75. package/dist/chunk-PJMKZ3HR.js.map +1 -0
  76. package/dist/chunk-PMLMQNSO.js +2 -0
  77. package/dist/chunk-PMLMQNSO.js.map +1 -0
  78. package/dist/chunk-QHN4PPHD.js +2 -0
  79. package/dist/{chunk-3FVI5JIC.js.map → chunk-QHN4PPHD.js.map} +1 -1
  80. package/dist/chunk-RYEOLQIL.js +2 -0
  81. package/dist/chunk-RYEOLQIL.js.map +1 -0
  82. package/dist/{chunk-FZ2HS6G7.js → chunk-S4XU4SE7.js} +1 -1
  83. package/dist/chunk-S4XU4SE7.js.map +1 -0
  84. package/dist/chunk-SIJ5SUY6.js +2 -0
  85. package/dist/chunk-SIJ5SUY6.js.map +1 -0
  86. package/dist/chunk-SJPBIRXM.js +2 -0
  87. package/dist/chunk-SJPBIRXM.js.map +1 -0
  88. package/dist/chunk-T5NPHXFC.js +2 -0
  89. package/dist/chunk-T5NPHXFC.js.map +1 -0
  90. package/dist/chunk-TPRGCMIZ.js +2 -0
  91. package/dist/chunk-TPRGCMIZ.js.map +1 -0
  92. package/dist/chunk-TZFGLE7X.js +2 -0
  93. package/dist/chunk-TZFGLE7X.js.map +1 -0
  94. package/dist/chunk-U4M5QBBG.js +2 -0
  95. package/dist/chunk-U4M5QBBG.js.map +1 -0
  96. package/dist/chunk-UEKXODGJ.js +2 -0
  97. package/dist/chunk-UEKXODGJ.js.map +1 -0
  98. package/dist/chunk-V2NCE4LO.js +2 -0
  99. package/dist/chunk-V2NCE4LO.js.map +1 -0
  100. package/dist/chunk-VI7WS34A.js +2 -0
  101. package/dist/chunk-VI7WS34A.js.map +1 -0
  102. package/dist/chunk-W5DS5Q4J.js +2 -0
  103. package/dist/chunk-W5DS5Q4J.js.map +1 -0
  104. package/dist/{chunk-D3SD6MMV.js → chunk-WEIRXEXU.js} +2 -2
  105. package/dist/chunk-WU77JQYU.js +2 -0
  106. package/dist/chunk-WU77JQYU.js.map +1 -0
  107. package/dist/chunk-WVJDCDGZ.js +2 -0
  108. package/dist/chunk-WVJDCDGZ.js.map +1 -0
  109. package/dist/{chunk-OLJ2S6A6.js → chunk-YG5FFTC4.js} +1 -1
  110. package/dist/chunk-YG5FFTC4.js.map +1 -0
  111. package/dist/{chunk-GOLOL2V6.js → chunk-YSIEXMDD.js} +2 -2
  112. package/dist/chunk-YSIEXMDD.js.map +1 -0
  113. package/dist/chunk-YXVLPPO2.js +2 -0
  114. package/dist/{chunk-DZSZOC2G.js.map → chunk-YXVLPPO2.js.map} +1 -1
  115. package/dist/flows/ContractAmendment/ContractAmendmentBack.d.ts +3 -2
  116. package/dist/flows/ContractAmendment/ContractAmendmentBack.js +1 -1
  117. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +5 -5
  118. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js +1 -1
  119. package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +5 -4
  120. package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
  121. package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +5 -5
  122. package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
  123. package/dist/flows/ContractAmendment/ContractAmendmentSubmit.d.ts +3 -2
  124. package/dist/flows/ContractAmendment/ContractAmendmentSubmit.js +1 -1
  125. package/dist/flows/ContractAmendment/context.d.ts +5 -5
  126. package/dist/flows/ContractAmendment/hooks.d.ts +4 -4
  127. package/dist/flows/ContractAmendment/hooks.js +1 -1
  128. package/dist/flows/ContractAmendment/index.d.ts +3 -2
  129. package/dist/flows/ContractAmendment/index.js +1 -1
  130. package/dist/flows/ContractAmendment/types.d.ts +1 -1
  131. package/dist/flows/ContractAmendment/utils.d.ts +2 -2
  132. package/dist/flows/ContractAmendment/utils.js +1 -1
  133. package/dist/flows/CostCalculator/CostCalculatorDisclaimer.d.ts +2 -2
  134. package/dist/flows/CostCalculator/CostCalculatorDisclaimer.js +1 -1
  135. package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +5 -4
  136. package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
  137. package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +9 -5
  138. package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
  139. package/dist/flows/CostCalculator/CostCalculatorResetButton.d.ts +3 -2
  140. package/dist/flows/CostCalculator/CostCalculatorResetButton.js +1 -1
  141. package/dist/flows/CostCalculator/CostCalculatorSubmitButton.d.ts +3 -2
  142. package/dist/flows/CostCalculator/CostCalculatorSubmitButton.js +1 -1
  143. package/dist/flows/CostCalculator/Results/CostCalculatorBenefitsBreakdown.d.ts +2 -2
  144. package/dist/flows/CostCalculator/Results/CostCalculatorBenefitsBreakdown.js +1 -1
  145. package/dist/flows/CostCalculator/Results/CostCalculatorContributionsBreakdown.d.ts +2 -2
  146. package/dist/flows/CostCalculator/Results/CostCalculatorContributionsBreakdown.js +1 -1
  147. package/dist/flows/CostCalculator/Results/CostCalculatorGrossSalary.d.ts +2 -2
  148. package/dist/flows/CostCalculator/Results/CostCalculatorGrossSalary.js +1 -1
  149. package/dist/flows/CostCalculator/Results/CostCalculatorResults.d.ts +3 -3
  150. package/dist/flows/CostCalculator/Results/CostCalculatorResults.js +1 -1
  151. package/dist/flows/CostCalculator/Results/CostCalculatorResultsChart.d.ts +2 -2
  152. package/dist/flows/CostCalculator/Results/CostCalculatorResultsChart.js +1 -1
  153. package/dist/flows/CostCalculator/Results/CostCalculatorResultsChart.js.map +1 -1
  154. package/dist/flows/CostCalculator/Results/CostCalculatorTotalCost.d.ts +2 -2
  155. package/dist/flows/CostCalculator/Results/CostCalculatorTotalCost.js +1 -1
  156. package/dist/flows/CostCalculator/context.d.ts +9 -6
  157. package/dist/flows/CostCalculator/context.js +1 -1
  158. package/dist/flows/CostCalculator/hooks.d.ts +4 -3
  159. package/dist/flows/CostCalculator/hooks.js +1 -1
  160. package/dist/flows/CostCalculator/index.d.ts +5 -1
  161. package/dist/flows/CostCalculator/index.js +1 -1
  162. package/dist/flows/CostCalculator/types.d.ts +12 -2
  163. package/dist/flows/CostCalculator/utils.d.ts +8 -4
  164. package/dist/flows/CostCalculator/utils.js +1 -1
  165. package/dist/flows/Onboarding/BasicInformationStep.d.ts +4 -4
  166. package/dist/flows/Onboarding/BasicInformationStep.js +1 -1
  167. package/dist/flows/Onboarding/BenefitsStep.d.ts +8 -6
  168. package/dist/flows/Onboarding/BenefitsStep.js +1 -1
  169. package/dist/flows/Onboarding/ContractDetailsStep.d.ts +3 -3
  170. package/dist/flows/Onboarding/ContractDetailsStep.js +1 -1
  171. package/dist/flows/Onboarding/OnboardingBack.d.ts +4 -2
  172. package/dist/flows/Onboarding/OnboardingBack.js +1 -1
  173. package/dist/flows/Onboarding/OnboardingFlow.d.ts +17 -6
  174. package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
  175. package/dist/flows/Onboarding/OnboardingForm.d.ts +6 -4
  176. package/dist/flows/Onboarding/OnboardingForm.js +1 -1
  177. package/dist/flows/Onboarding/OnboardingInvite.d.ts +15 -8
  178. package/dist/flows/Onboarding/OnboardingInvite.js +1 -1
  179. package/dist/flows/Onboarding/OnboardingSubmit.d.ts +3 -2
  180. package/dist/flows/Onboarding/OnboardingSubmit.js +1 -1
  181. package/dist/flows/Onboarding/ReviewStep.d.ts +38 -0
  182. package/dist/flows/Onboarding/ReviewStep.js +2 -0
  183. package/dist/flows/Onboarding/ReviewStep.js.map +1 -0
  184. package/dist/flows/Onboarding/SelectCountryStep.d.ts +15 -0
  185. package/dist/flows/Onboarding/SelectCountryStep.js +2 -0
  186. package/dist/flows/Onboarding/SelectCountryStep.js.map +1 -0
  187. package/dist/flows/Onboarding/api.d.ts +113 -0
  188. package/dist/flows/Onboarding/api.js +2 -0
  189. package/dist/flows/Onboarding/api.js.map +1 -0
  190. package/dist/flows/Onboarding/context.d.ts +44 -8
  191. package/dist/flows/Onboarding/context.js +1 -1
  192. package/dist/flows/Onboarding/hooks.d.ts +59 -25
  193. package/dist/flows/Onboarding/hooks.js +1 -1
  194. package/dist/flows/Onboarding/index.d.ts +10 -5
  195. package/dist/flows/Onboarding/index.js +1 -1
  196. package/dist/flows/Onboarding/json-schemas/selectCountryStep.d.ts +24 -0
  197. package/dist/flows/Onboarding/json-schemas/selectCountryStep.js +2 -0
  198. package/dist/flows/Onboarding/json-schemas/selectCountryStep.js.map +1 -0
  199. package/dist/flows/Onboarding/types.d.ts +18 -3
  200. package/dist/flows/Onboarding/utils.d.ts +23 -3
  201. package/dist/flows/Onboarding/utils.js +1 -1
  202. package/dist/flows/Termination/AdditionalDetailsForm.d.ts +4 -4
  203. package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
  204. package/dist/flows/Termination/EmployeeComunicationForm.d.ts +3 -3
  205. package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
  206. package/dist/flows/Termination/PaidTimeOffForm.d.ts +3 -3
  207. package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
  208. package/dist/flows/Termination/TerminationBack.d.ts +3 -2
  209. package/dist/flows/Termination/TerminationBack.js +1 -1
  210. package/dist/flows/Termination/TerminationDetailsForm.d.ts +3 -3
  211. package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
  212. package/dist/flows/Termination/TerminationFlow.d.ts +6 -4
  213. package/dist/flows/Termination/TerminationFlow.js +1 -1
  214. package/dist/flows/Termination/TerminationForm.d.ts +3 -3
  215. package/dist/flows/Termination/TerminationForm.js +1 -1
  216. package/dist/flows/Termination/TerminationSubmit.d.ts +3 -2
  217. package/dist/flows/Termination/TerminationSubmit.js +1 -1
  218. package/dist/flows/Termination/TimeOff.d.ts +4 -4
  219. package/dist/flows/Termination/TimeOff.js +1 -1
  220. package/dist/flows/Termination/context.d.ts +5 -4
  221. package/dist/flows/Termination/hooks.d.ts +3 -2
  222. package/dist/flows/Termination/hooks.js +1 -1
  223. package/dist/flows/Termination/index.d.ts +3 -1
  224. package/dist/flows/Termination/index.js +1 -1
  225. package/dist/flows/Termination/json-schemas/schema.js +1 -1
  226. package/dist/flows/Termination/types.d.ts +1 -1
  227. package/dist/flows/Termination/utils.d.ts +1 -1
  228. package/dist/flows/Termination/utils.js +1 -1
  229. package/dist/flows/types.d.ts +1 -1
  230. package/dist/flows/useStepState.d.ts +19 -6
  231. package/dist/flows/useStepState.js +1 -1
  232. package/dist/flows/utils.d.ts +3 -11
  233. package/dist/flows/utils.js +1 -1
  234. package/dist/index.css +1 -1
  235. package/dist/index.css.map +1 -1
  236. package/dist/index.d.ts +16 -8
  237. package/dist/index.js +1 -1
  238. package/dist/index.js.map +1 -1
  239. package/dist/{remoteFlows-CswYencu.d.ts → remoteFlows-D0i6pVe5.d.ts} +49 -25
  240. package/dist/types-CxSFjQw5.d.ts +3 -0
  241. package/dist/{types.gen-CsMdyQkb.d.ts → types.gen-Ctv2nomK.d.ts} +268 -2
  242. package/package.json +18 -3
  243. package/dist/chunk-2PXGLWCY.js +0 -2
  244. package/dist/chunk-2PXGLWCY.js.map +0 -1
  245. package/dist/chunk-36UPHOJS.js +0 -2
  246. package/dist/chunk-36UPHOJS.js.map +0 -1
  247. package/dist/chunk-3FVI5JIC.js +0 -2
  248. package/dist/chunk-56BNVYTD.js +0 -2
  249. package/dist/chunk-6A3F6JG6.js +0 -2
  250. package/dist/chunk-6A3F6JG6.js.map +0 -1
  251. package/dist/chunk-6TYJC6YS.js +0 -2
  252. package/dist/chunk-6TYJC6YS.js.map +0 -1
  253. package/dist/chunk-7CYG2RHP.js +0 -2
  254. package/dist/chunk-7CYG2RHP.js.map +0 -1
  255. package/dist/chunk-ABR3B66K.js +0 -2
  256. package/dist/chunk-ABR3B66K.js.map +0 -1
  257. package/dist/chunk-ALRU77S5.js +0 -2
  258. package/dist/chunk-ALRU77S5.js.map +0 -1
  259. package/dist/chunk-CFRYIKSR.js +0 -2
  260. package/dist/chunk-CFRYIKSR.js.map +0 -1
  261. package/dist/chunk-CKEVRQRG.js +0 -2
  262. package/dist/chunk-CKEVRQRG.js.map +0 -1
  263. package/dist/chunk-DE5FSFYL.js +0 -2
  264. package/dist/chunk-DGPRFQYK.js +0 -2
  265. package/dist/chunk-DGPRFQYK.js.map +0 -1
  266. package/dist/chunk-DHRIURRT.js +0 -2
  267. package/dist/chunk-DHRIURRT.js.map +0 -1
  268. package/dist/chunk-DZSZOC2G.js +0 -2
  269. package/dist/chunk-EAAIAMTY.js +0 -2
  270. package/dist/chunk-EAAIAMTY.js.map +0 -1
  271. package/dist/chunk-ED3CBUQL.js +0 -2
  272. package/dist/chunk-ED3CBUQL.js.map +0 -1
  273. package/dist/chunk-FMT2OTOL.js +0 -2
  274. package/dist/chunk-FMT2OTOL.js.map +0 -1
  275. package/dist/chunk-FZ2HS6G7.js.map +0 -1
  276. package/dist/chunk-GFBF55NR.js +0 -2
  277. package/dist/chunk-GGAS4ZNQ.js +0 -2
  278. package/dist/chunk-GGAS4ZNQ.js.map +0 -1
  279. package/dist/chunk-GMGKIQLI.js +0 -2
  280. package/dist/chunk-GOLOL2V6.js.map +0 -1
  281. package/dist/chunk-GRYAM4FZ.js +0 -2
  282. package/dist/chunk-GRYAM4FZ.js.map +0 -1
  283. package/dist/chunk-HEPL5WDF.js +0 -2
  284. package/dist/chunk-HEPL5WDF.js.map +0 -1
  285. package/dist/chunk-HSW5HMHH.js +0 -2
  286. package/dist/chunk-IDSJI7KQ.js +0 -2
  287. package/dist/chunk-J55S4SEH.js +0 -2
  288. package/dist/chunk-J55S4SEH.js.map +0 -1
  289. package/dist/chunk-JBG4RVXQ.js +0 -2
  290. package/dist/chunk-JBG4RVXQ.js.map +0 -1
  291. package/dist/chunk-KH6QS5OU.js +0 -2
  292. package/dist/chunk-KH6QS5OU.js.map +0 -1
  293. package/dist/chunk-KQH5HLN5.js +0 -2
  294. package/dist/chunk-KQH5HLN5.js.map +0 -1
  295. package/dist/chunk-KSGPQCSG.js +0 -2
  296. package/dist/chunk-KSGPQCSG.js.map +0 -1
  297. package/dist/chunk-LNKYOAKF.js +0 -2
  298. package/dist/chunk-LNKYOAKF.js.map +0 -1
  299. package/dist/chunk-M7WCW7WD.js +0 -2
  300. package/dist/chunk-M7WCW7WD.js.map +0 -1
  301. package/dist/chunk-MESREYTZ.js +0 -2
  302. package/dist/chunk-MHKNAQLP.js +0 -2
  303. package/dist/chunk-MHKNAQLP.js.map +0 -1
  304. package/dist/chunk-MIHU6CEZ.js +0 -2
  305. package/dist/chunk-MIHU6CEZ.js.map +0 -1
  306. package/dist/chunk-NE547PW4.js +0 -2
  307. package/dist/chunk-NE547PW4.js.map +0 -1
  308. package/dist/chunk-OLJ2S6A6.js.map +0 -1
  309. package/dist/chunk-PNXZHV6W.js +0 -2
  310. package/dist/chunk-PNXZHV6W.js.map +0 -1
  311. package/dist/chunk-PWKM2R6V.js +0 -2
  312. package/dist/chunk-PWKM2R6V.js.map +0 -1
  313. package/dist/chunk-Q64URAIN.js +0 -2
  314. package/dist/chunk-Q64URAIN.js.map +0 -1
  315. package/dist/chunk-QSHYMFMY.js +0 -2
  316. package/dist/chunk-QSHYMFMY.js.map +0 -1
  317. package/dist/chunk-S4FKLPBB.js +0 -2
  318. package/dist/chunk-S4FKLPBB.js.map +0 -1
  319. package/dist/chunk-S56EWAS4.js +0 -2
  320. package/dist/chunk-S56EWAS4.js.map +0 -1
  321. package/dist/chunk-SLD7DFLW.js +0 -2
  322. package/dist/chunk-SLD7DFLW.js.map +0 -1
  323. package/dist/chunk-UECSVYQ5.js.map +0 -1
  324. package/dist/chunk-VRQXHCFR.js +0 -2
  325. package/dist/chunk-VRQXHCFR.js.map +0 -1
  326. package/dist/chunk-WQHKB5T7.js +0 -2
  327. package/dist/chunk-WQHKB5T7.js.map +0 -1
  328. package/dist/chunk-WS3C3WIJ.js +0 -2
  329. package/dist/chunk-WS3C3WIJ.js.map +0 -1
  330. package/dist/chunk-XLFHHYVS.js +0 -2
  331. package/dist/chunk-XLFHHYVS.js.map +0 -1
  332. package/dist/chunk-YOC3VDC7.js +0 -2
  333. package/dist/chunk-YOC3VDC7.js.map +0 -1
  334. /package/dist/{chunk-HSW5HMHH.js.map → chunk-2Y22JKVE.js.map} +0 -0
  335. /package/dist/{chunk-QOMUXX6W.js.map → chunk-3PH5E6CZ.js.map} +0 -0
  336. /package/dist/{chunk-D3SD6MMV.js.map → chunk-WEIRXEXU.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ import{a as t}from"./chunk-T5NPHXFC.js";import{b as a}from"./chunk-DZYFSFZ7.js";import{a as i}from"./chunk-AYDF3IFZ.js";import{jsx as p}from"react/jsx-runtime";function F({requesterName:n,onSubmit:s,onSuccess:m,onError:d}){let{terminationBag:e}=a(),l=i(async o=>{await s?.(e?.parseFormValues(o));let r=await e?.onSubmit(o);r?.error?d?.(r.error):r?.data&&await m?.(r.data)},"handleSubmit"),u=e?.fields.map(o=>o.name==="acknowledge_termination_procedure"?{...o,label:o.label.replace("{{requesterName}}",n)}:o);return p(t,{fields:u,onSubmit:l})}i(F,"AdditionalDetailsForm");export{F as a};
2
+ //# sourceMappingURL=chunk-V2NCE4LO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Termination/AdditionalDetailsForm.tsx"],"sourcesContent":["import { useTerminationContext } from './context';\nimport { TerminationFormValues } from '@/src/flows/Termination/types';\nimport { OffboardingResponse } from '@/src/client';\nimport { TerminationForm } from '@/src/flows/Termination/TerminationForm';\n\ntype AdditionalDetailsFormProps = {\n /*\n * The name of the person who initiates the termination, used to personalize the label of the\n * acknowledge_termination_procedure field.\n */\n requesterName: string;\n /*\n * The function is called when the form is submitted. It receives the form values as an argument.\n */\n onSubmit?: (payload: TerminationFormValues) => void | Promise<void>;\n /*\n * The function is called when the form submission has failed.\n */\n onError?: (error: Error) => void;\n /*\n * The function is called when the form submission is successful. It receives the response data as\n * an argument.\n */\n onSuccess?: (data: OffboardingResponse) => void | Promise<void>;\n};\n\nexport function AdditionalDetailsForm({\n requesterName,\n onSubmit,\n onSuccess,\n onError,\n}: AdditionalDetailsFormProps) {\n const { terminationBag } = useTerminationContext();\n\n const handleSubmit = async (values: TerminationFormValues) => {\n await onSubmit?.(\n terminationBag?.parseFormValues(values) as TerminationFormValues,\n );\n const terminationResult = await terminationBag?.onSubmit(values);\n\n if (terminationResult?.error) {\n onError?.(terminationResult.error);\n } else {\n if (terminationResult?.data) {\n await onSuccess?.(terminationResult.data as OffboardingResponse);\n }\n }\n };\n\n const updatedFields = terminationBag?.fields.map((field) => {\n if (field.name === 'acknowledge_termination_procedure') {\n return {\n ...field,\n label: (field.label as string).replace(\n '{{requesterName}}',\n requesterName,\n ),\n };\n }\n return field;\n });\n\n return <TerminationForm fields={updatedFields} onSubmit={handleSubmit} />;\n}\n"],"mappings":"wHA8DS,cAAAA,MAAA,oBApCF,SAASC,EAAsB,CACpC,cAAAC,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,CACF,EAA+B,CAC7B,GAAM,CAAE,eAAAC,CAAe,EAAIC,EAAsB,EAE3CC,EAAeC,EAAA,MAAOC,GAAkC,CAC5D,MAAMP,IACJG,GAAgB,gBAAgBI,CAAM,CACxC,EACA,IAAMC,EAAoB,MAAML,GAAgB,SAASI,CAAM,EAE3DC,GAAmB,MACrBN,IAAUM,EAAkB,KAAK,EAE7BA,GAAmB,MACrB,MAAMP,IAAYO,EAAkB,IAA2B,CAGrE,EAbqB,gBAefC,EAAgBN,GAAgB,OAAO,IAAKO,GAC5CA,EAAM,OAAS,oCACV,CACL,GAAGA,EACH,MAAQA,EAAM,MAAiB,QAC7B,oBACAX,CACF,CACF,EAEKW,CACR,EAED,OAAOb,EAACc,EAAA,CAAgB,OAAQF,EAAe,SAAUJ,EAAc,CACzE,CArCgBC,EAAAR,EAAA","names":["jsx","AdditionalDetailsForm","requesterName","onSubmit","onSuccess","onError","terminationBag","useTerminationContext","handleSubmit","__name","values","terminationResult","updatedFields","field","TerminationForm"]}
@@ -0,0 +1,2 @@
1
+ import{a as A}from"./chunk-WVJDCDGZ.js";import{b as z}from"./chunk-G7BISHWK.js";import{d as F,f as g,g as b,h as C,j as w,k as S,m as _,o as E,p as q,q as O,s as j,v}from"./chunk-GMU3QGAR.js";import{d as o}from"./chunk-WRDKLT4N.js";import{a as x}from"./chunk-TPRGCMIZ.js";import{a as n}from"./chunk-AYDF3IFZ.js";import{createHeadlessForm as d,modify as p}from"@remoteoss/json-schema-form";import{useMutation as l,useQuery as u}from"@tanstack/react-query";var Q=n(t=>{let{client:r}=o();return u({queryKey:["employment",t],retry:!1,enabled:!!t,select:n(({data:e})=>e?.data.employment,"select"),queryFn:n(async()=>{let e=await q({client:r,headers:{Authorization:""},path:{employment_id:t}});if(e.error||!e.data)throw new Error("Failed to fetch employment data");return e},"queryFn")})},"useEmployment"),G=n(t=>{let{client:r}=o();return u({queryKey:["company",t],retry:!1,enabled:!!t,queryFn:n(async()=>{let e=await S({client:r,headers:{Authorization:""},path:{company_id:t}});if(e.error||!e.data)throw new Error("Failed to fetch employment data");return e},"queryFn"),select:n(({data:e})=>e.data.company,"select")})},"useCompany"),H=n(t=>{let{client:r}=o();return u({queryKey:["benefit-offers",t],retry:!1,enabled:!!t,queryFn:n(async()=>g({client:r,headers:{Authorization:""},path:{employment_id:t}}).then(e=>{if(e.error||!e.data)throw new Error("Failed to fetch benefit offers data");return e}),"queryFn"),select:n(({data:e})=>e?.data?.reduce((s,c)=>({...s,[c.benefit_group.slug]:{value:c.benefit_tier?.slug??""}}),{}),"select")})},"useBenefitOffers"),W=n(()=>{let{client:t}=o();return l({mutationFn:n(r=>v({client:t,headers:{Authorization:""},path:r}),"mutationFn")})},"useEmploymentInvite"),X=n(()=>{let{client:t}=o();return l({mutationFn:n(r=>w({client:t,headers:{Authorization:""},body:r}),"mutationFn")})},"useCreateReserveInvoice"),Y=n(({countryCode:t,form:r,fieldValues:e,options:s})=>{let{client:c}=o(),i=s?.jsonSchemaVersion?.form_schema?.[r]?{json_schema_version:s.jsonSchemaVersion.form_schema[r]}:{};return u({queryKey:["onboarding-json-schema-form",t,r],retry:!1,queryFn:n(async()=>{let a=await _({client:c,headers:{Authorization:""},path:{country_code:t,form:r},query:{skip_benefits:!0,...i}});if(a.error||!a.data)throw new Error("Failed to fetch onboarding schema");return a},"queryFn"),enabled:s?.queryOptions?.enabled,select:n(({data:a})=>{let m=a?.data||{};if(s&&s.jsfModify){let{schema:f}=p(m,s.jsfModify);m=f}let y=z(m.properties||{},"money").reduce((f,h)=>(f[h]=x(e[h]),f),{});return d(m,{initialValues:{...e,...y}})},"select")})},"useJSONSchemaForm"),Z=n((t,r,e)=>{let s=e?.jsonSchemaVersion?.benefit_offers_form_schema?{json_schema_version:e.jsonSchemaVersion.benefit_offers_form_schema}:{},{client:c}=o();return u({queryKey:["benefit-offers-schema",t],retry:!1,enabled:!!t,queryFn:n(async()=>{let i=await E({client:c,headers:{Authorization:""},path:{employment_id:t},query:s});if(i.error||!i.data)throw new Error("Failed to fetch benefit offers schema");return i},"queryFn"),select:n(({data:i})=>{let a=i?.data?.schema||{};if(e&&e.jsfModify){let{schema:y}=p(a,e.jsfModify);a=y}let m=Object.keys(r).length>0;return d(a,{initialValues:m?{...r}:{}})},"select")})},"useBenefitOffersSchema"),$=n(()=>{let{client:t}=o();return l({mutationFn:n(r=>F({client:t,headers:{Authorization:""},body:r}),"mutationFn")})},"useCreateEmployment"),ee=n(()=>{let{client:t}=o();return l({mutationFn:n(({employmentId:r,...e})=>O({client:t,headers:{Authorization:""},body:e,path:{employment_id:r},query:{skip_benefits:!0}}),"mutationFn")})},"useUpdateEmployment"),te=n(()=>{let{client:t}=o();return l({mutationFn:n(({employmentId:r,...e})=>b({client:t,headers:{Authorization:""},body:e,path:{employment_id:r}}),"mutationFn")})},"useUpdateBenefitsOffers"),re=n(()=>{let{client:t}=o();return l({mutationFn:n(r=>C({client:t,headers:{Authorization:""},body:r}),"mutationFn")})},"useMagicLink"),M=n(()=>{let{client:t}=o();return u({queryKey:["countries"],retry:!1,queryFn:n(async()=>{let r=await j({client:t,headers:{Authorization:""}});if(r.error||!r.data)throw new Error("Failed to fetch supported countries");return r},"queryFn"),select:n(({data:r})=>r?.data?.map(e=>({label:e.name,value:e.code}))||[],"select")})},"useCountries"),ne=n(t=>{let{data:r,isLoading:e}=M(),{schema:s}=p(A.data.schema,t?.jsfModify||{}),c=d(s);if(r){let i=c.fields.find(a=>a.name==="country");i&&(i.options=r)}return{isLoading:e,selectCountryForm:c}},"useCountriesSchemaField");export{Q as a,G as b,H as c,W as d,X as e,Y as f,Z as g,$ as h,ee as i,te as j,re as k,ne as l};
2
+ //# sourceMappingURL=chunk-VI7WS34A.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Onboarding/api.ts"],"sourcesContent":["import {\n EmploymentCreateParams,\n EmploymentFullParams,\n getIndexBenefitOffer,\n getShowCompany,\n getShowEmployment,\n getShowFormCountry,\n getShowSchema,\n getSupportedCountry,\n MagicLinkParams,\n patchUpdateEmployment2,\n postCreateEmployment2,\n postCreateRiskReserve,\n postGenerateMagicLink,\n postInviteEmploymentInvitation,\n PostInviteEmploymentInvitationData,\n putUpdateBenefitOffer,\n UnifiedEmploymentUpsertBenefitOffersRequest,\n} from '@/src/client';\nimport { convertToCents } from '@/src/components/form/utils';\nimport { useClient } from '@/src/context';\nimport { selectCountryStepSchema } from '@/src/flows/Onboarding/json-schemas/selectCountryStep';\nimport { OnboardingFlowParams } from '@/src/flows/Onboarding/types';\nimport { FlowOptions, JSONSchemaFormType } from '@/src/flows/types';\nimport { findFieldsByType } from '@/src/flows/utils';\nimport { Client } from '@hey-api/client-fetch';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { FieldValues } from 'react-hook-form';\n\nexport const useEmployment = (employmentId: string | undefined) => {\n const { client } = useClient();\n\n return useQuery({\n queryKey: ['employment', employmentId],\n retry: false,\n enabled: !!employmentId,\n select: ({ data }) => {\n return data?.data.employment;\n },\n queryFn: async () => {\n const response = await getShowEmployment({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n path: {\n employment_id: employmentId as string,\n },\n });\n\n // If response status is 404 or other error, throw an error to trigger isError\n if (response.error || !response.data) {\n throw new Error('Failed to fetch employment data');\n }\n\n return response;\n },\n });\n};\n\nexport const useCompany = (companyId: string) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['company', companyId],\n retry: false,\n enabled: !!companyId,\n queryFn: async () => {\n const response = await getShowCompany({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n path: {\n company_id: companyId,\n },\n });\n\n if (response.error || !response.data) {\n throw new Error('Failed to fetch employment data');\n }\n\n return response;\n },\n select: ({ data }) => {\n return data.data.company;\n },\n });\n};\n\nexport const useBenefitOffers = (employmentId: string | undefined) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['benefit-offers', employmentId],\n retry: false,\n enabled: !!employmentId,\n queryFn: async () => {\n return getIndexBenefitOffer({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n path: {\n employment_id: employmentId as string,\n },\n }).then((response) => {\n // If response status is 404 or other error, throw an error to trigger isError\n if (response.error || !response.data) {\n throw new Error('Failed to fetch benefit offers data');\n }\n\n return response;\n });\n },\n select: ({ data }) =>\n data?.data?.reduce(\n (acc, item) => {\n return {\n ...acc,\n [item.benefit_group.slug]: {\n value: item.benefit_tier?.slug ?? '',\n },\n };\n },\n {} as Record<string, { value: string }>,\n ),\n });\n};\n/**\n * Use this hook to invite an employee to the onboarding flow\n * @returns\n */\nexport const useEmploymentInvite = () => {\n const { client } = useClient();\n\n return useMutation({\n mutationFn: (payload: PostInviteEmploymentInvitationData['path']) => {\n return postInviteEmploymentInvitation({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n path: payload,\n });\n },\n });\n};\n\nexport const useCreateReserveInvoice = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: { employment_slug: string }) => {\n return postCreateRiskReserve({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\n/**\n * Use this hook to get the JSON schema form for the onboarding flow\n * @param param0\n * @returns\n */\nexport const useJSONSchemaForm = ({\n countryCode,\n form,\n fieldValues,\n options,\n}: {\n countryCode: string;\n form: JSONSchemaFormType;\n fieldValues: FieldValues;\n options?: FlowOptions & { queryOptions?: { enabled?: boolean } };\n}) => {\n const { client } = useClient();\n const jsonSchemaQueryParam = options?.jsonSchemaVersion?.form_schema?.[form]\n ? {\n json_schema_version: options.jsonSchemaVersion.form_schema[form],\n }\n : {};\n return useQuery({\n queryKey: ['onboarding-json-schema-form', countryCode, form],\n retry: false,\n queryFn: async () => {\n const response = await getShowFormCountry({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n path: {\n country_code: countryCode,\n form: form,\n },\n query: {\n skip_benefits: true,\n ...jsonSchemaQueryParam,\n },\n });\n\n // If response status is 404 or other error, throw an error to trigger isError\n if (response.error || !response.data) {\n throw new Error('Failed to fetch onboarding schema');\n }\n\n return response;\n },\n enabled: options?.queryOptions?.enabled,\n select: ({ data }) => {\n let jsfSchema = data?.data || {};\n if (options && options.jsfModify) {\n const { schema } = modify(jsfSchema, options.jsfModify);\n jsfSchema = schema;\n }\n\n // Contract details contains x-jsf-logic that need to be calculated every time a form value changes\n // In particular there are calculations involving the annual_gross_salary field. However this field value doesn't get\n // here in cents. So we need to convert the money fields to cents, so that the calculations are correct.\n const moneyFields = findFieldsByType(jsfSchema.properties || {}, 'money');\n const moneyFieldsData = moneyFields.reduce<Record<string, number | null>>(\n (acc, field) => {\n acc[field] = convertToCents(fieldValues[field]);\n return acc;\n },\n {},\n );\n\n return createHeadlessForm(jsfSchema, {\n initialValues: {\n ...fieldValues,\n ...moneyFieldsData,\n },\n });\n },\n });\n};\n\nexport const useBenefitOffersSchema = (\n employmentId: string,\n fieldValues: FieldValues,\n options: OnboardingFlowParams['options'],\n) => {\n const jsonSchemaQueryParam = options?.jsonSchemaVersion\n ?.benefit_offers_form_schema\n ? {\n json_schema_version:\n options.jsonSchemaVersion.benefit_offers_form_schema,\n }\n : {};\n const { client } = useClient();\n return useQuery({\n queryKey: ['benefit-offers-schema', employmentId],\n retry: false,\n enabled: !!employmentId,\n queryFn: async () => {\n const response = await getShowSchema({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n path: {\n employment_id: employmentId,\n },\n query: jsonSchemaQueryParam,\n });\n\n // If response status is 404 or other error, throw an error to trigger isError\n if (response.error || !response.data) {\n throw new Error('Failed to fetch benefit offers schema');\n }\n\n return response;\n },\n select: ({ data }) => {\n let jsfSchema = data?.data?.schema || {};\n\n if (options && options.jsfModify) {\n const { schema } = modify(jsfSchema, options.jsfModify);\n jsfSchema = schema;\n }\n const hasFieldValues = Object.keys(fieldValues).length > 0;\n const result = createHeadlessForm(jsfSchema, {\n // we need to clone the fieldValues to prevent side effects\n // if we don't do this, the benefits get included in the other steps\n initialValues: hasFieldValues ? { ...fieldValues } : {},\n });\n return result;\n },\n });\n};\n\n/**\n * Use this hook to create an employment\n * @returns\n */\nexport const useCreateEmployment = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: EmploymentCreateParams) => {\n return postCreateEmployment2({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nexport const useUpdateEmployment = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: ({\n employmentId,\n ...payload\n }: EmploymentFullParams & { employmentId: string }) => {\n return patchUpdateEmployment2({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n path: {\n employment_id: employmentId,\n },\n query: {\n skip_benefits: true,\n },\n });\n },\n });\n};\n\nexport const useUpdateBenefitsOffers = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: ({\n employmentId,\n ...payload\n }: UnifiedEmploymentUpsertBenefitOffersRequest & {\n employmentId: string;\n }) => {\n return putUpdateBenefitOffer({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n path: {\n employment_id: employmentId,\n },\n });\n },\n });\n};\n\nexport const useMagicLink = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (params: MagicLinkParams) => {\n return postGenerateMagicLink({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: params,\n });\n },\n });\n};\n\nconst useCountries = () => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['countries'],\n retry: false,\n queryFn: async () => {\n const response = await getSupportedCountry({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n });\n\n // If response status is 404 or other error, throw an error to trigger isError\n if (response.error || !response.data) {\n throw new Error('Failed to fetch supported countries');\n }\n\n return response;\n },\n select: ({ data }) => {\n return (\n data?.data?.map((country) => {\n return {\n label: country.name,\n value: country.code,\n };\n }) || []\n );\n },\n });\n};\n\nexport const useCountriesSchemaField = (options?: FlowOptions) => {\n const { data: countries, isLoading } = useCountries();\n\n const { schema: selectCountrySchema } = modify(\n selectCountryStepSchema.data.schema,\n options?.jsfModify || {},\n );\n\n const selectCountryForm = createHeadlessForm(selectCountrySchema);\n\n if (countries) {\n const countryField = selectCountryForm.fields.find(\n (field) => field.name === 'country',\n );\n if (countryField) {\n countryField.options = countries;\n }\n }\n\n return {\n isLoading,\n selectCountryForm,\n };\n};\n"],"mappings":"wTA0BA,OAAS,sBAAAA,EAAoB,UAAAC,MAAc,8BAC3C,OAAS,eAAAC,EAAa,YAAAC,MAAgB,wBAG/B,IAAMC,EAAgBC,EAACC,GAAqC,CACjE,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAA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AM,CAChC,GAAM,CAAE,OAAAE,CAAO,EAAIC,EAAU,EAC7B,OAAOa,EAAY,CACjB,WAAYhB,EAAC8C,GACJC,EAAsB,CAC3B,OAAQ7C,EACR,QAAS,CACP,cAAe,EACjB,EACA,KAAM4C,CACR,CAAC,EAPS,aASd,CAAC,CACH,EAb4B,gBAetBE,EAAehD,EAAA,IAAM,CACzB,GAAM,CAAE,OAAAE,CAAO,EAAIC,EAAU,EAC7B,OAAOC,EAAS,CACd,SAAU,CAAC,WAAW,EACtB,MAAO,GACP,QAASJ,EAAA,SAAY,CACnB,IAAMM,EAAW,MAAM2C,EAAoB,CACzC,OAAQ/C,EACR,QAAS,CACP,cAAe,EACjB,CACF,CAAC,EAGD,GAAII,EAAS,OAAS,CAACA,EAAS,KAC9B,MAAM,IAAI,MAAM,qCAAqC,EAGvD,OAAOA,CACT,EAdS,WAeT,OAAQN,EAAA,CAAC,CAAE,KAAAK,CAAK,IAEZA,GAAM,MAAM,IAAK6C,IACR,CACL,MAAOA,EAAQ,KACf,MAAOA,EAAQ,IACjB,EACD,GAAK,CAAC,EAPH,SAUV,CAAC,CACH,EA/BqB,gBAiCRC,GAA0BnD,EAACyB,GAA0B,CAChE,GAAM,CAAE,KAAM2B,EAAW,UAAAC,CAAU,EAAIL,EAAa,EAE9C,CAAE,OAAQM,CAAoB,EAAIxB,EACtCyB,EAAwB,KAAK,OAC7B9B,GAAS,WAAa,CAAC,CACzB,EAEM+B,EAAoBrB,EAAmBmB,CAAmB,EAEhE,GAAIF,EAAW,CACb,IAAMK,EAAeD,EAAkB,OAAO,KAC3CvB,GAAUA,EAAM,OAAS,SAC5B,EACIwB,IACFA,EAAa,QAAUL,EAE3B,CAEA,MAAO,CACL,UAAAC,EACA,kBAAAG,CACF,CACF,EAvBuC","names":["createHeadlessForm","modify","useMutation","useQuery","useEmployment","__name","employmentId","client","useClient","useQuery","data","response","getShowEmployment","useCompany","companyId","getShowCompany","useBenefitOffers","getIndexBenefitOffer","acc","item","useEmploymentInvite","useMutation","payload","postInviteEmploymentInvitation","useCreateReserveInvoice","postCreateRiskReserve","useJSONSchemaForm","countryCode","form","fieldValues","options","jsonSchemaQueryParam","getShowFormCountry","jsfSchema","schema","modify","moneyFieldsData","findFieldsByType","field","convertToCents","createHeadlessForm","useBenefitOffersSchema","getShowSchema","hasFieldValues","useCreateEmployment","postCreateEmployment2","useUpdateEmployment","patchUpdateEmployment2","useUpdateBenefitsOffers","putUpdateBenefitOffer","useMagicLink","params","postGenerateMagicLink","useCountries","getSupportedCountry","country","useCountriesSchemaField","countries","isLoading","selectCountrySchema","selectCountryStepSchema","selectCountryForm","countryField"]}
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-NF5IMQEW.js";import{a as c}from"./chunk-YSIEXMDD.js";import{a as e}from"./chunk-GFWQG4ZT.js";import{a as m}from"./chunk-6T3A6GWH.js";import{a as r}from"./chunk-L5OIK2ZJ.js";import{a as o}from"./chunk-6HGUGIYJ.js";import{a as n}from"./chunk-AYDF3IFZ.js";import{useId as f}from"react";import{jsx as s}from"react/jsx-runtime";function k({employmentId:d,countryCode:C,options:p,render:A}){let t=c({employmentId:d,countryCode:C,options:p}),i=f();return s(o.Provider,{value:{formId:i,contractAmendmentBag:t},children:A({contractAmendmentBag:t,components:{Form:r,SubmitButton:a,ConfirmationForm:m,BackButton:e}})})}n(k,"ContractAmendmentFlow");export{k as a};
2
+ //# sourceMappingURL=chunk-W5DS5Q4J.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/ContractAmendment/ContractAmendmentFlow.tsx"],"sourcesContent":["import { useId } from 'react';\nimport { ContractAmendmentContext } from './context';\nimport { ContractAmendmentBack } from './ContractAmendmentBack';\nimport { ContractAmendmentConfirmationForm } from './ContractAmendmentConfirmationForm';\nimport { ContractAmendmentForm } from './ContractAmendmentForm';\nimport { ContractAmendmentSubmit } from './ContractAmendmentSubmit';\nimport { useContractAmendment } from './hooks';\nimport { ContractAmendmentParams } from './types';\n\ntype TUseContractAmendment = ReturnType<typeof useContractAmendment>;\n\nexport type ContractAmendmentRenderProps = {\n /**\n * The contract amendment bag returned by the useContractAmendment hook.\n * This bag contains all the methods and properties needed to handle the contract amendment flow.\n * @see {@link useContractAmendment}\n */\n contractAmendmentBag: TUseContractAmendment;\n /**\n * The components used in the contract amendment flow.\n * This includes the form, submit button, and confirmation form.\n * @see {@link ContractAmendmentForm}\n * @see {@link ContractAmendmentSubmit}\n * @see {@link ContractAmendmentConfirmationForm}\n */\n components: {\n Form: typeof ContractAmendmentForm;\n SubmitButton: typeof ContractAmendmentSubmit;\n ConfirmationForm: typeof ContractAmendmentConfirmationForm;\n BackButton: typeof ContractAmendmentBack;\n };\n};\n\ntype ContractAmendmentFlowProps = ContractAmendmentParams & {\n render: ({\n contractAmendmentBag,\n components,\n }: ContractAmendmentRenderProps) => React.ReactNode;\n};\n\nexport function ContractAmendmentFlow({\n employmentId,\n countryCode,\n options,\n render,\n}: ContractAmendmentFlowProps) {\n const contractAmendmentBag = useContractAmendment({\n employmentId,\n countryCode,\n options,\n });\n const formId = useId();\n\n return (\n <ContractAmendmentContext.Provider\n value={{\n formId: formId,\n contractAmendmentBag,\n }}\n >\n {render({\n contractAmendmentBag,\n components: {\n Form: ContractAmendmentForm,\n SubmitButton: ContractAmendmentSubmit,\n ConfirmationForm: ContractAmendmentConfirmationForm,\n BackButton: ContractAmendmentBack,\n },\n })}\n </ContractAmendmentContext.Provider>\n );\n}\n"],"mappings":"mRAAA,OAAS,SAAAA,MAAa,QAsDlB,cAAAC,MAAA,oBAdG,SAASC,EAAsB,CACpC,aAAAC,EACA,YAAAC,EACA,QAAAC,EACA,OAAAC,CACF,EAA+B,CAC7B,IAAMC,EAAuBC,EAAqB,CAChD,aAAAL,EACA,YAAAC,EACA,QAAAC,CACF,CAAC,EACKI,EAASC,EAAM,EAErB,OACET,EAACU,EAAyB,SAAzB,CACC,MAAO,CACL,OAAQF,EACR,qBAAAF,CACF,EAEC,SAAAD,EAAO,CACN,qBAAAC,EACA,WAAY,CACV,KAAMK,EACN,aAAcC,EACd,iBAAkBC,EAClB,WAAYC,CACd,CACF,CAAC,EACH,CAEJ,CA/BgBC,EAAAd,EAAA","names":["useId","jsx","ContractAmendmentFlow","employmentId","countryCode","options","render","contractAmendmentBag","useContractAmendment","formId","useId","ContractAmendmentContext","ContractAmendmentForm","ContractAmendmentSubmit","ContractAmendmentConfirmationForm","ContractAmendmentBack","__name"]}
@@ -1,2 +1,2 @@
1
- import{b as n}from"./chunk-DZYFSFZ7.js";import{a as t,b as m}from"./chunk-QOMUXX6W.js";import{a as o}from"./chunk-AYDF3IFZ.js";var a=o(({render:p})=>{let{terminationBag:e}=n(),{data:s}=t({employmentId:e.employmentId}),{data:f}=m({employmentId:e.employmentId,status:"taken"});return p({employment:s,timeoff:f})},"TimeOff");export{a};
2
- //# sourceMappingURL=chunk-D3SD6MMV.js.map
1
+ import{b as n}from"./chunk-DZYFSFZ7.js";import{a as t,b as m}from"./chunk-3PH5E6CZ.js";import{a as o}from"./chunk-AYDF3IFZ.js";var a=o(({render:p})=>{let{terminationBag:e}=n(),{data:s}=t({employmentId:e.employmentId}),{data:f}=m({employmentId:e.employmentId,status:"taken"});return p({employment:s,timeoff:f})},"TimeOff");export{a};
2
+ //# sourceMappingURL=chunk-WEIRXEXU.js.map
@@ -0,0 +1,2 @@
1
+ import{a as J}from"./chunk-UPRUP24B.js";import{e as O,i as x,n as A,r as q,u as L}from"./chunk-GMU3QGAR.js";import{a as B}from"./chunk-A4RX3KRZ.js";import{d as f}from"./chunk-WRDKLT4N.js";import{c as C}from"./chunk-TPRGCMIZ.js";import{a as r}from"./chunk-AYDF3IFZ.js";import{object as at}from"yup";import{createHeadlessForm as G,modify as U}from"@remoteoss/json-schema-form";import{useMutation as $,useQuery as F}from"@tanstack/react-query";import{useState as z}from"react";import{string as k,ValidationError as I}from"yup";var rt=r(({includePremiumBenefits:t})=>{let{client:i}=f();return F({queryKey:["cost-calculator-countries",t],queryFn:r(()=>A({client:i,headers:{Authorization:""},query:{include_premium_benefits:t}}),"queryFn"),select:r(n=>n.data?.data.map(a=>({value:a.region_slug,label:a.name,childRegions:a.child_regions,hasAdditionalFields:a.has_additional_fields,regionSlug:a.region_slug})),"select")})},"useCostCalculatorCountries"),ot=r(()=>{let{client:t}=f();return F({queryKey:["company-currencies"],queryFn:r(()=>L({client:t,headers:{Authorization:""}}),"queryFn"),select:r(i=>i.data?.data?.company_currencies.map(n=>({value:n.slug,label:n.code})),"select")})},"useCompanyCurrencies"),it=r(()=>{let{client:t}=f();return $({mutationFn:r(i=>O({client:t,headers:{Authorization:""},body:i}),"mutationFn")})},"useCostCalculatorEstimation"),_t=r(()=>{let{client:t}=f();return $({mutationFn:r(i=>x({client:t,headers:{Authorization:""},body:i}),"mutationFn")})},"useCostCalculatorEstimationPdf"),nt=r((t,{includePremiumBenefits:i,options:n})=>{let{client:a}=f();return F({queryKey:["cost-calculator-region-fields",t,i],queryFn:r(()=>q({client:a,headers:{Authorization:""},path:{slug:t},query:{include_premium_benefits:i}}),"queryFn"),enabled:!!t,select:r(({data:l})=>{let c=l?.data?.schema||{};if(n&&n.jsfModify){let{schema:m}=U(c,n.jsfModify);c=m}return G(c)},"select")})},"useRegionFields"),V={title:"Estimation",includeBenefits:!1,includeCostBreakdowns:!1,includePremiumBenefits:!1},Ft=r(({defaultRegion:t,estimationOptions:i,options:n}={estimationOptions:V})=>{let{schema:a}=U(J.data.schema,n?.jsfModify||{}),l=G(a),[c,m]=z(t),[P,R]=z(),{data:g,isLoading:H}=rt({includePremiumBenefits:i.includePremiumBenefits}),{data:j,isLoading:N}=ot(),Q=c||P?.value,{data:y,isLoading:D}=nt(Q,{includePremiumBenefits:i.includePremiumBenefits,options:n}),M=it();async function W(o){try{await p.validate(o,{abortEarly:!1})}catch(e){return{data:null,error:e}}return new Promise((e,u)=>{M.mutate(T(o,i),{onSuccess:r(s=>{s.data?e({data:s.data,error:null}):e({data:null,error:new Error("Something went wrong. Please try again later.")})},"onSuccess"),onError:r(s=>{u({data:null,error:s})},"onError")})})}r(W,"onSubmit");function X(o){let e=g?.find(({value:u})=>u===o);e&&e.childRegions.length===0&&e.hasAdditionalFields?m(e.regionSlug):m(void 0),R(e)}r(X,"onCountryChange");function Y(o){m(o)}r(Y,"onRegionChange");let d=l.fields.find(o=>o.name==="region");if(d){let o=P?.childRegions.map(e=>({value:e.slug,label:e.name}))??[];d.options=o,d.isVisible=o.length>0,d.required=o.length>0,d.onChange=Y,d.schema=o.length>0?k().transform(e=>typeof e=="string"?e:"").required("Region is required"):k()}if(j){let o=l.fields.find(e=>e.name==="currency");o&&(o.options=j)}if(g){let o=l.fields.find(e=>e.name==="country");o&&(o.options=g,o.onChange=X)}let Z=r(()=>{R(void 0),m(t)},"resetForm"),w=[...l.fields,...y?.fields||[]],p=K(l.fields);async function v(o){let e=null,u=C(o,w);try{await p.validate(u,{abortEarly:!1}),e={formErrors:{},yupError:new I([],o)}}catch(S){let b=B(S);e={formErrors:Object.entries(b).reduce((_,[tt,et])=>({..._,[tt]:et.message}),{}),yupError:S}}let s=y?.handleValidation(u),E=[...e?.yupError.inner||[],...s?.yupError?.inner||[]],h={...e?.yupError?.value||{},...s?.yupError?.value||{}};return{formErrors:{...e?.formErrors||{},...s?.formErrors||{}},yupError:new I(E,h)}}return r(v,"handleValidation"),{stepState:{current:0,total:1,isLastStep:!0},fields:w,validationSchema:p,parseFormValues:r(o=>{let{country:e,region:u,salary:s,currency:E,...h}=o,b=C({country:e,region:u,salary:s,currency:E},l.fields),_=C(h,y?.fields||[]);return{...b,..._}},"parseFormValues"),handleValidation:v,isSubmitting:M.isPending,isLoading:H&&N&&D,onSubmit:W,resetForm:Z}},"useCostCalculator");function K(t){let i=t.reduce((n,a)=>(n[a.name]=a.schema,n),{});return at(i)}r(K,"buildValidationSchema");function st(t){let i="benefit-";return Object.keys(t).reduce((n,a)=>{let c={benefit_group_slug:a.replace(i,""),benefit_tier_slug:t[a]};return[...n,c]},[])}r(st,"formatBenefits");function T(t,i=V){return{employer_currency_slug:t.currency,include_benefits:i.includeBenefits,include_cost_breakdowns:i.includeCostBreakdowns,include_premium_benefits:i.includePremiumBenefits,employments:[{region_slug:t.region||t.country,annual_gross_salary:t.salary,annual_gross_salary_in_employer_currency:t.salary,employment_term:t.contract_duration_type??"fixed",title:i.title,regional_to_employer_exchange_rate:"1",age:t.age??void 0,...t.benefits&&{benefits:st(t.benefits)}}]}}r(T,"buildPayload");export{K as a,T as b,_t as c,V as d,Ft as e};
2
+ //# sourceMappingURL=chunk-WU77JQYU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/CostCalculator/utils.ts","../src/flows/CostCalculator/hooks.ts"],"sourcesContent":["import type { CostCalculatorEstimateParams } from '@/src/client';\n\nimport { $TSFixMe } from '@/src/types/remoteFlows';\nimport { AnyObjectSchema, object } from 'yup';\nimport { defaultEstimationOptions } from './hooks';\nimport type {\n CostCalculatorEstimationOptions,\n CostCalculatorEstimationSubmitValues,\n} from './types';\n\n/**\n * Build the validation schema for the form.\n * @returns\n */\nexport function buildValidationSchema(fields: $TSFixMe[]) {\n const fieldsSchema = fields.reduce<Record<string, AnyObjectSchema>>(\n (fieldsSchemaAcc, field) => {\n fieldsSchemaAcc[field.name] = field.schema as AnyObjectSchema;\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 benefitGroupSlug = key.replace(needle, '');\n const benefitEntry = {\n benefit_group_slug: benefitGroupSlug,\n benefit_tier_slug: benefits[key],\n };\n return [...acc, benefitEntry];\n }, []);\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: CostCalculatorEstimationSubmitValues,\n estimationOptions: CostCalculatorEstimationOptions = defaultEstimationOptions,\n): CostCalculatorEstimateParams {\n return {\n employer_currency_slug: values.currency,\n include_benefits: estimationOptions.includeBenefits,\n include_cost_breakdowns: estimationOptions.includeCostBreakdowns,\n include_premium_benefits: estimationOptions.includePremiumBenefits,\n employments: [\n {\n region_slug: values.region || values.country,\n annual_gross_salary: values.salary,\n annual_gross_salary_in_employer_currency: values.salary,\n employment_term: values.contract_duration_type ?? 'fixed',\n title: estimationOptions.title,\n regional_to_employer_exchange_rate: '1',\n age: values.age ?? undefined,\n ...(values.benefits && { benefits: formatBenefits(values.benefits) }),\n },\n ],\n };\n}\n","import {\n CostCalculatorEstimateParams,\n CostCalculatorEstimateResponse,\n getIndexCompanyCurrency,\n getIndexCountry,\n getShowRegionField,\n MinimalRegion,\n postCreateEstimation,\n PostCreateEstimationError,\n postCreateEstimationPdf,\n} from '@/src/client';\nimport { jsonSchema } from '@/src/flows/CostCalculator/jsonSchema';\nimport type {\n CostCalculatorEstimationFormValues,\n CostCalculatorEstimationOptions,\n CostCalculatorEstimationSubmitValues,\n JSFModify,\n} from '@/src/flows/CostCalculator/types';\nimport type { Result } from '@/src/flows/types';\n\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { iterateErrors } from '@/src/components/form/yupValidationResolver';\nimport { useClient } from '@/src/context';\nimport { Client } from '@hey-api/client-fetch';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { useState } from 'react';\nimport { string, ValidationError } from 'yup';\nimport { buildPayload, buildValidationSchema } from './utils';\n\ntype CostCalculatorCountry = {\n value: string;\n label: string;\n childRegions: MinimalRegion[];\n hasAdditionalFields: boolean | undefined;\n regionSlug: string;\n};\n\ntype JSFValidationError = {\n formErrors: Record<\n string,\n {\n type: string;\n message: string;\n }\n >;\n yupError: ValidationError;\n};\n\n/**\n * Hook to fetch the countries for the cost calculator.\n * @returns\n */\nconst 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 headers: {\n Authorization: ``,\n },\n query: {\n include_premium_benefits: includePremiumBenefits,\n },\n });\n },\n select: (data) =>\n data.data?.data.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 })),\n });\n};\n\n/**\n * Hook to fetch the company currencies.\n * @returns\n */\nconst useCompanyCurrencies = () => {\n const { client } = useClient();\n\n return useQuery({\n queryKey: ['company-currencies'],\n queryFn: () => {\n return getIndexCompanyCurrency({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\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 */\nconst useCostCalculatorEstimation = () => {\n const { client } = useClient();\n\n return useMutation({\n mutationFn: (payload: CostCalculatorEstimateParams) => {\n return postCreateEstimation({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\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 headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\n/**\n * Hook to fetch the region fields.\n * @param region\n * @returns\n */\nconst 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 headers: {\n Authorization: ``,\n },\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\nexport const defaultEstimationOptions: CostCalculatorEstimationOptions = {\n title: 'Estimation',\n includeBenefits: false,\n includeCostBreakdowns: false,\n includePremiumBenefits: 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 estimation options.\n */\n estimationOptions: CostCalculatorEstimationOptions;\n options?: {\n jsfModify?: JSFModify;\n };\n};\n\nexport type EstimationError = PostCreateEstimationError | ValidationError;\n\n/**\n * Hook to use the cost calculator.\n */\nexport const useCostCalculator = (\n { defaultRegion, estimationOptions, options }: UseCostCalculatorParams = {\n estimationOptions: defaultEstimationOptions,\n },\n) => {\n const { schema: jsonSchemaModified } = modify(\n jsonSchema.data.schema,\n options?.jsfModify || {},\n );\n\n const fieldsJSONSchema = createHeadlessForm(jsonSchemaModified);\n\n const [selectedRegion, setSelectedRegion] = useState<string | undefined>(\n defaultRegion,\n );\n const [selectedCountry, setSelectedCountry] =\n useState<CostCalculatorCountry>();\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\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),\n {\n onSuccess: (response) => {\n if (response.data) {\n resolve({\n data: response.data,\n error: null,\n });\n } else {\n resolve({\n data: null,\n error: new Error(\n 'Something went wrong. Please try again later.',\n ),\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 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 }\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,\n ...(jsonSchemaRegionFields?.fields || []),\n ];\n\n const validationSchema = buildValidationSchema(fieldsJSONSchema.fields);\n\n async function handleValidation(values: CostCalculatorEstimationFormValues) {\n let errors: JSFValidationError | null = null;\n\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 stepState: {\n current: 0,\n total: 1,\n isLastStep: true,\n },\n fields: allFields,\n validationSchema,\n parseFormValues: (\n values: CostCalculatorEstimationFormValues,\n ): CostCalculatorEstimationSubmitValues => {\n const { country, region, salary, currency, ...rest } = values;\n const jsonSchemaStaticFieldValues = {\n country,\n region,\n salary,\n currency,\n };\n const parsedStaticFields = parseJSFToValidate(\n jsonSchemaStaticFieldValues,\n fieldsJSONSchema.fields,\n );\n\n const parsedRegionFields = parseJSFToValidate(\n rest,\n jsonSchemaRegionFields?.fields || [],\n );\n\n return {\n ...parsedStaticFields,\n ...parsedRegionFields,\n } as CostCalculatorEstimationSubmitValues;\n },\n handleValidation,\n isSubmitting: costCalculatorEstimationMutation.isPending,\n isLoading:\n isLoadingCountries && isLoadingCurrencies && isLoadingRegionFields,\n onSubmit,\n resetForm,\n };\n};\n"],"mappings":"4QAGA,OAA0B,UAAAA,OAAc,MCqBxC,OAAS,sBAAAC,EAAoB,UAAAC,MAAc,8BAC3C,OAAS,eAAAC,EAAa,YAAAC,MAAgB,wBACtC,OAAS,YAAAC,MAAgB,QACzB,OAAS,UAAAC,EAAQ,mBAAAC,MAAuB,MA0BxC,IAAMC,GAA6BC,EAAA,CAAC,CAClC,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,QAAS,CACP,cAAe,EACjB,EACA,MAAO,CACL,yBAA0BD,CAC5B,CACF,CAAC,EATM,WAWT,OAAQD,EAACM,GACPA,EAAK,MAAM,KAAK,IAAKC,IAAa,CAChC,MAAOA,EAAQ,YACf,MAAOA,EAAQ,KACf,aAAcA,EAAQ,cACtB,oBAAqBA,EAAQ,sBAC7B,WAAYA,EAAQ,WACtB,EAAE,EAPI,SAQV,CAAC,CACH,EA5BmC,8BAkC7BC,GAAuBR,EAAA,IAAM,CACjC,GAAM,CAAE,OAAAE,CAAO,EAAIC,EAAU,EAE7B,OAAOC,EAAS,CACd,SAAU,CAAC,oBAAoB,EAC/B,QAASJ,EAAA,IACAS,EAAwB,CAC7B,OAAQP,EACR,QAAS,CACP,cAAe,EACjB,CACF,CAAC,EANM,WAQT,OAAQF,EAACM,GACPA,EAAK,MAAM,MAAM,mBAAmB,IAAKI,IAAc,CACrD,M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GEqB,EAAiB,MACnB,EAEMmD,EAAqBZ,EACzBU,EACAtC,GAAwB,QAAU,CAAC,CACrC,EAEA,MAAO,CACL,GAAGuC,EACH,GAAGC,CACL,CACF,EAxBiB,mBAyBjB,iBAAAf,EACA,aAAcvB,EAAiC,UAC/C,UACEN,GAAsBE,GAAuBG,EAC/C,SAAAE,EACA,UAAAmB,CACF,CACF,EA1PiC,qBD9M1B,SAASmB,EAAsBC,EAAoB,CACxD,IAAMC,EAAeD,EAAO,OAC1B,CAACE,EAAiBC,KAChBD,EAAgBC,EAAM,IAAI,EAAIA,EAAM,OAC7BD,GAET,CAAC,CACH,EACA,OAAOE,GAAOH,CAAY,CAC5B,CATgBI,EAAAN,EAAA,yBAgBhB,SAASO,GAAeC,EAAkC,CACxD,IAAMC,EAAS,WACf,OAAO,OAAO,KAAKD,CAAQ,EAAE,OAE3B,CAACE,EAAKC,IAAQ,CAEd,IAAMC,EAAe,CACnB,mBAFuBD,EAAI,QAAQF,EAAQ,EAAE,EAG7C,kBAAmBD,EAASG,CAAG,CACjC,EACA,MAAO,CAAC,GAAGD,EAAKE,CAAY,CAC9B,EAAG,CAAC,CAAC,CACP,CAZSN,EAAAC,GAAA,kBAoBF,SAASM,EACdC,EACAC,EAAqDC,EACvB,CAC9B,MAAO,CACL,uBAAwBF,EAAO,SAC/B,iBAAkBC,EAAkB,gBACpC,wBAAyBA,EAAkB,sBAC3C,yBAA0BA,EAAkB,uBAC5C,YAAa,CACX,CACE,YAAaD,EAAO,QAAUA,EAAO,QACrC,oBAAqBA,EAAO,OAC5B,yCAA0CA,EAAO,OACjD,gBAAiBA,EAAO,wBAA0B,QAClD,MAAOC,EAAkB,MACzB,mCAAoC,IACpC,IAAKD,EAAO,KAAO,OACnB,GAAIA,EAAO,UAAY,CAAE,SAAUP,GAAeO,EAAO,QAAQ,CAAE,CACrE,CACF,CACF,CACF,CAtBgBR,EAAAO,EAAA","names":["object","createHeadlessForm","modify","useMutation","useQuery","useState","string","ValidationError","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","defaultEstimationOptions","useCostCalculator","defaultRegion","estimationOptions","jsonSchemaModified","jsonSchema","fieldsJSONSchema","selectedRegion","setSelectedRegion","useState","selectedCountry","setSelectedCountry","countries","isLoadingCountries","currencies","isLoadingCurrencies","jsonSchemaRegionSlug","jsonSchemaRegionFields","isLoadingRegionFields","costCalculatorEstimationMutation","onSubmit","values","validationSchema","err","resolve","reject","buildPayload","response","error","onCountryChange","currentCountry","value","onRegionChange","regionField","field","regions","string","currencyField","countryField","resetForm","allFields","buildValidationSchema","handleValidation","errors","parsedValues","parseJSFToValidate","ValidationError","iterateResult","iterateErrors","acc","key","handleValidationResult","combinedInnerErrors","combinedValues","salary","rest","parsedStaticFields","parsedRegionFields","buildValidationSchema","fields","fieldsSchema","fieldsSchemaAcc","field","object","__name","formatBenefits","benefits","needle","acc","key","benefitEntry","buildPayload","values","estimationOptions","defaultEstimationOptions"]}
@@ -0,0 +1,2 @@
1
+ var e={data:{version:7,schema:{additionalProperties:!1,properties:{country:{title:"Country",description:"",type:"string",oneOf:[],"x-jsf-presentation":{inputType:"select"}}},required:["country"],type:"object","x-jsf-order":["country"]}}};export{e as a};
2
+ //# sourceMappingURL=chunk-WVJDCDGZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Onboarding/json-schemas/selectCountryStep.ts"],"sourcesContent":["export const selectCountryStepSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n properties: {\n country: {\n title: 'Country',\n description: '',\n type: 'string',\n oneOf: [],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n },\n required: ['country'],\n type: 'object',\n 'x-jsf-order': ['country'],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAA0B,CACrC,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,WAAY,CACV,QAAS,CACP,MAAO,UACP,YAAa,GACb,KAAM,SACN,MAAO,CAAC,EACR,qBAAsB,CACpB,UAAW,QACb,CACF,CACF,EACA,SAAU,CAAC,SAAS,EACpB,KAAM,SACN,cAAe,CAAC,SAAS,CAC3B,CACF,CACF","names":["selectCountryStepSchema"]}
@@ -1,2 +1,2 @@
1
1
  import{a as t}from"./chunk-AYDF3IFZ.js";import{createContext as r,useContext as e}from"react";var a=r({form:null,formId:void 0,costCalculatorBag:void 0}),n=t(()=>{let o=e(a);if(!o.form)throw new Error("useCostCalculatorContext must be used within a CostCalculatorProvider");return{form:o.form,formId:o.formId,costCalculatorBag:o.costCalculatorBag}},"useCostCalculatorContext");export{a,n as b};
2
- //# sourceMappingURL=chunk-OLJ2S6A6.js.map
2
+ //# sourceMappingURL=chunk-YG5FFTC4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/CostCalculator/context.ts"],"sourcesContent":["import { useCostCalculator } from '@/src/flows/CostCalculator/hooks';\nimport { $TSFixMe } from '@/src/types/remoteFlows';\nimport { createContext, useContext } from 'react';\nimport { UseFormReturn } from 'react-hook-form';\n\nexport const CostCalculatorContext = createContext<{\n form: UseFormReturn<$TSFixMe> | null;\n formId: string | undefined;\n costCalculatorBag?: ReturnType<typeof useCostCalculator>;\n}>({\n form: null,\n formId: undefined,\n costCalculatorBag: undefined,\n});\n\nexport const useCostCalculatorContext = () => {\n const context = useContext(CostCalculatorContext);\n if (!context.form) {\n throw new Error(\n 'useCostCalculatorContext must be used within a CostCalculatorProvider',\n );\n }\n\n return {\n form: context.form,\n formId: context.formId,\n costCalculatorBag: context.costCalculatorBag,\n } as const;\n};\n"],"mappings":"wCAEA,OAAS,iBAAAA,EAAe,cAAAC,MAAkB,QAGnC,IAAMC,EAAwBC,EAIlC,CACD,KAAM,KACN,OAAQ,OACR,kBAAmB,MACrB,CAAC,EAEYC,EAA2BC,EAAA,IAAM,CAC5C,IAAMC,EAAUC,EAAWL,CAAqB,EAChD,GAAI,CAACI,EAAQ,KACX,MAAM,IAAI,MACR,uEACF,EAGF,MAAO,CACL,KAAMA,EAAQ,KACd,OAAQA,EAAQ,OAChB,kBAAmBA,EAAQ,iBAC7B,CACF,EAbwC","names":["createContext","useContext","CostCalculatorContext","createContext","useCostCalculatorContext","__name","context","useContext"]}
@@ -1,2 +1,2 @@
1
- import{a as v}from"./chunk-QOMUXX6W.js";import{a as S}from"./chunk-JRQSZHUU.js";import{c as F,i as b,p as w}from"./chunk-DHRIURRT.js";import{a as l,b as V}from"./chunk-UECSVYQ5.js";import{a as M}from"./chunk-S56EWAS4.js";import{d}from"./chunk-WRDKLT4N.js";import{a as j,c as A}from"./chunk-VRQXHCFR.js";import{a as e}from"./chunk-AYDF3IFZ.js";import{createHeadlessForm as R,modify as B}from"@remoteoss/json-schema-form";import{useMutation as T,useQuery as J}from"@tanstack/react-query";var K=e(({countryCode:a,employment:t,fieldValues:i,options:n})=>{let{client:u}=d(),s=n?.jsonSchemaVersion?.contract_amendments?{json_schema_version:n.jsonSchemaVersion.contract_amendments}:{};return J({queryKey:["contract-amendment-schema"],retry:!1,queryFn:e(async()=>{let r=await F({client:u,headers:{Authorization:""},query:{employment_id:t?.data?.employment?.id,country_code:a,...s}});if(r.error||!r.data)throw new Error("Failed to fetch contract amendment schema");return r},"queryFn"),enabled:!!t,select:e(({data:r})=>{let c=r?.data||{};if(n&&n.jsfModify){let{schema:p}=B(c,n.jsfModify);c=p}let o={...i,annual_gross_salary:i?.annual_gross_salary?j(i?.annual_gross_salary):void 0},f=Object.keys(o).length>0;return R(c,{initialValues:f?o:V(t)})},"select")})},"useContractAmendmentSchemaQuery"),O=e(()=>{let{client:a}=d();return T({mutationFn:e(t=>b({client:a,headers:{Authorization:""},body:t}),"mutationFn")})},"useCreateContractAmendmentMutation"),U=e(()=>{let{client:a}=d();return T({mutationFn:e(t=>w({client:a,headers:{Authorization:""},body:t}),"mutationFn")})},"useAutomatableContractAmendmentMutation"),ae=e(({employmentId:a,countryCode:t,options:i})=>{let{fieldValues:n,setFieldValues:u,stepState:s,nextStep:r,previousStep:c}=M(l),{data:o,isLoading:f,isError:_,error:p}=v({employmentId:a}),{data:m,isLoading:k,isError:L,error:Q}=K({employment:o,countryCode:t,fieldValues:{...s.values?.[s.currentStep.name],...n},options:i}),q=V(o,m?.fields),g=O(),E=U();async function z(y){let C=A(y,m?.fields||[],{isPartialValidation:!1}),P={employment_id:o?.data.employment?.id,amendment_contract_id:o?.data.employment?.active_contract_id,contract_amendment:{...C}};switch(s.currentStep.name){case l.form.name:{let{mutateAsync:h}=S(E),I=await h(P);return r(),I}case l.confirmation_form.name:{let{mutateAsync:h}=S(g);return h(P)}default:throw new Error("Invalid step state")}}e(z,"onSubmit");function x(y){if(m){let C=A(y,m?.fields);return m?.handleValidation(C)}return null}e(x,"handleValidation");function H(){c()}return e(H,"back"),{stepState:s,fields:m?.fields||[],isLoading:f||k,isError:_||L,error:p||Q,isSubmitting:E.isPending||g.isPending,initialValues:q,values:n,handleValidation:x,checkFieldUpdates:u,onSubmit:z,back:H}},"useContractAmendment");export{ae as a};
2
- //# sourceMappingURL=chunk-GOLOL2V6.js.map
1
+ import{a as v}from"./chunk-3PH5E6CZ.js";import{a as S}from"./chunk-JRQSZHUU.js";import{a as l,b as V}from"./chunk-O3QLBSMV.js";import{c as P,l as b,t as w}from"./chunk-GMU3QGAR.js";import{a as M}from"./chunk-INAXCFVC.js";import{d}from"./chunk-WRDKLT4N.js";import{a as j,c as A}from"./chunk-TPRGCMIZ.js";import{a as e}from"./chunk-AYDF3IFZ.js";import{createHeadlessForm as R,modify as B}from"@remoteoss/json-schema-form";import{useMutation as L,useQuery as J}from"@tanstack/react-query";var K=e(({countryCode:a,employment:t,fieldValues:i,options:n})=>{let{client:u}=d(),s=n?.jsonSchemaVersion?.contract_amendments?{json_schema_version:n.jsonSchemaVersion.contract_amendments}:{};return J({queryKey:["contract-amendment-schema"],retry:!1,queryFn:e(async()=>{let r=await P({client:u,headers:{Authorization:""},query:{employment_id:t?.data?.employment?.id,country_code:a,...s}});if(r.error||!r.data)throw new Error("Failed to fetch contract amendment schema");return r},"queryFn"),enabled:!!t,select:e(({data:r})=>{let c=r?.data||{};if(n&&n.jsfModify){let{schema:f}=B(c,n.jsfModify);c=f}let o={...i,annual_gross_salary:i?.annual_gross_salary?j(i?.annual_gross_salary):void 0},p=Object.keys(o).length>0;return R(c,{initialValues:p?o:V(t)})},"select")})},"useContractAmendmentSchemaQuery"),O=e(()=>{let{client:a}=d();return L({mutationFn:e(t=>b({client:a,headers:{Authorization:""},body:t}),"mutationFn")})},"useCreateContractAmendmentMutation"),U=e(()=>{let{client:a}=d();return L({mutationFn:e(t=>w({client:a,headers:{Authorization:""},body:t}),"mutationFn")})},"useAutomatableContractAmendmentMutation"),ae=e(({employmentId:a,countryCode:t,options:i})=>{let{fieldValues:n,setFieldValues:u,stepState:s,nextStep:r,previousStep:c}=M(l),{data:o,isLoading:p,isError:_,error:f}=v({employmentId:a}),{data:m,isLoading:T,isError:k,error:Q}=K({employment:o,countryCode:t,fieldValues:{...s.values?.[s.currentStep.name],...n},options:i}),q=V(o,m?.fields),g=O(),E=U();async function z(y){let C=A(y,m?.fields||[],{isPartialValidation:!1}),F={employment_id:o?.data.employment?.id,amendment_contract_id:o?.data.employment?.active_contract_id,contract_amendment:{...C}};switch(s.currentStep.name){case l.form.name:{let{mutateAsync:h}=S(E),I=await h(F);return r(),I}case l.confirmation_form.name:{let{mutateAsync:h}=S(g);return h(F)}default:throw new Error("Invalid step state")}}e(z,"onSubmit");function x(y){if(m){let C=A(y,m?.fields);return m?.handleValidation(C)}return null}e(x,"handleValidation");function H(){c()}return e(H,"back"),{stepState:s,fields:m?.fields||[],isLoading:p||T,isError:_||k,error:f||Q,isSubmitting:E.isPending||g.isPending,initialValues:q,values:n,handleValidation:x,checkFieldUpdates:u,onSubmit:z,back:H}},"useContractAmendment");export{ae as a};
2
+ //# sourceMappingURL=chunk-YSIEXMDD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/ContractAmendment/hooks.ts"],"sourcesContent":["import {\n CreateContractAmendmentParams,\n EmploymentShowResponse,\n getShowContractAmendmentSchema,\n postAutomatableContractAmendment,\n postCreateContractAmendment,\n} from '@/src/client';\n\nimport {\n convertToCents,\n parseJSFToValidate,\n} from '@/src/components/form/utils';\nimport { mutationToPromise } from '@/src/lib/mutations';\n\nimport { Client } from '@hey-api/client-fetch';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { ContractAmendmentParams } from './types';\n\nimport { useEmploymentQuery } from '@/src/common/hooks';\nimport { useClient } from '@/src/context';\nimport { FieldValues } from 'react-hook-form';\nimport { useStepState } from '../useStepState';\nimport { buildInitialValues, STEPS } from './utils';\n\ntype ContractAmendmentSchemaParams = {\n countryCode: string;\n employment: EmploymentShowResponse | undefined;\n fieldValues: FieldValues | undefined;\n options?: ContractAmendmentParams['options'];\n};\n\nconst useContractAmendmentSchemaQuery = ({\n countryCode,\n employment,\n fieldValues,\n options,\n}: ContractAmendmentSchemaParams) => {\n const { client } = useClient();\n const jsonSchemaQueryParam = options?.jsonSchemaVersion?.contract_amendments\n ? {\n json_schema_version: options.jsonSchemaVersion.contract_amendments,\n }\n : {};\n return useQuery({\n queryKey: ['contract-amendment-schema'],\n retry: false,\n queryFn: async () => {\n const response = await getShowContractAmendmentSchema({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n query: {\n employment_id: employment?.data?.employment?.id as string,\n country_code: countryCode,\n ...jsonSchemaQueryParam,\n },\n });\n\n // If response status is 404 or other error, throw an error to trigger isError\n if (response.error || !response.data) {\n throw new Error('Failed to fetch contract amendment schema');\n }\n\n return response;\n },\n enabled: Boolean(employment),\n select: ({ data }) => {\n let jsfSchema = data?.data || {};\n\n if (options && options.jsfModify) {\n const { schema } = modify(jsfSchema, options.jsfModify);\n jsfSchema = schema;\n }\n\n const copyFieldValues = {\n ...fieldValues,\n annual_gross_salary: fieldValues?.annual_gross_salary\n ? convertToCents(fieldValues?.annual_gross_salary)\n : undefined,\n };\n\n const hasFieldValues = Object.keys(copyFieldValues).length > 0;\n\n const result = createHeadlessForm(jsfSchema, {\n initialValues: hasFieldValues\n ? copyFieldValues\n : buildInitialValues(employment),\n });\n return result;\n },\n });\n};\n\nconst useCreateContractAmendmentMutation = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateContractAmendmentParams) => {\n return postCreateContractAmendment({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nconst useAutomatableContractAmendmentMutation = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateContractAmendmentParams) => {\n return postAutomatableContractAmendment({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nexport const useContractAmendment = ({\n employmentId,\n countryCode,\n options,\n}: ContractAmendmentParams) => {\n const { fieldValues, setFieldValues, stepState, nextStep, previousStep } =\n useStepState<keyof typeof STEPS>(STEPS);\n\n const {\n data: employment,\n isLoading: isLoadingEmployment,\n isError: isErrorEmployment,\n error: errorEmployment,\n } = useEmploymentQuery({\n employmentId,\n });\n\n const {\n data: contractAmendmentHeadlessForm,\n isLoading: isLoadingContractAmendments,\n isError: isErrorContractAmendmentSchema,\n error: errorContractAmendmentSchema,\n } = useContractAmendmentSchemaQuery({\n employment,\n countryCode,\n // In case the user is navigating back to the form step, we need to\n // pass the previous field values, so that the schema can be\n // generated with the correct values.\n fieldValues: {\n ...stepState.values?.[stepState.currentStep.name], // Restore values for the current step\n ...fieldValues,\n },\n options,\n });\n\n const initialValues = buildInitialValues(\n employment,\n contractAmendmentHeadlessForm?.fields,\n );\n\n const createContractAmendmentMutation = useCreateContractAmendmentMutation();\n const automatableContractAmendmentMutation =\n useAutomatableContractAmendmentMutation();\n\n async function onSubmit(values: FieldValues) {\n const parsedValues = parseJSFToValidate(\n values,\n contractAmendmentHeadlessForm?.fields || [],\n {\n isPartialValidation: false,\n },\n );\n\n const payload = {\n employment_id: employment?.data.employment?.id as string,\n amendment_contract_id: employment?.data.employment\n ?.active_contract_id as string,\n contract_amendment: {\n ...parsedValues,\n },\n };\n\n switch (stepState.currentStep.name) {\n case STEPS.form.name: {\n const { mutateAsync } = mutationToPromise(\n automatableContractAmendmentMutation,\n );\n\n const automatableContractAmendment = await mutateAsync(payload);\n\n nextStep();\n\n return automatableContractAmendment;\n }\n case STEPS.confirmation_form.name: {\n const { mutateAsync } = mutationToPromise(\n createContractAmendmentMutation,\n );\n\n return mutateAsync(payload);\n }\n\n default:\n throw new Error('Invalid step state');\n }\n }\n\n function handleValidation(values: FieldValues) {\n if (contractAmendmentHeadlessForm) {\n const parsedValues = parseJSFToValidate(\n values,\n contractAmendmentHeadlessForm?.fields,\n );\n\n return contractAmendmentHeadlessForm?.handleValidation(parsedValues);\n }\n return null;\n }\n\n function back() {\n previousStep();\n }\n\n return {\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: contractAmendmentHeadlessForm?.fields || [],\n /**\n * Loading state indicating if either employment or contract amendment data is being fetched\n */\n isLoading: isLoadingEmployment || isLoadingContractAmendments,\n /**\n * Error state indicating if there was an error fetching either employment or contract amendment data\n */\n isError: isErrorEmployment || isErrorContractAmendmentSchema,\n /**\n * Error object containing details about any errors that occurred during data fetching\n */\n error: errorEmployment || errorContractAmendmentSchema,\n /**\n * Loading state indicating if a contract amendment mutation is in progress\n */\n isSubmitting:\n automatableContractAmendmentMutation.isPending ||\n createContractAmendmentMutation.isPending,\n /**\n * Initial form values built from employment data and contract amendment fields\n */\n initialValues,\n /**\n * Current form field values\n */\n values: fieldValues,\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,\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: setFieldValues,\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 * Function to handle going back to the previous step\n * @returns {void}\n */\n back,\n };\n};\n"],"mappings":"uVAeA,OAAS,sBAAAA,EAAoB,UAAAC,MAAc,8BAC3C,OAAS,eAAAC,EAAa,YAAAC,MAAgB,wBAgBtC,IAAMC,EAAkCC,EAAA,CAAC,CACvC,YAAAC,EACA,WAAAC,EACA,YAAAC,EACA,QAAAC,CACF,IAAqC,CACnC,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAU,EACvBC,EAAuBH,GAAS,mBAAmB,oBACrD,CACE,oBAAqBA,EAAQ,kBAAkB,mBACjD,EACA,CAAC,EACL,OAAOI,EAAS,CACd,SAAU,CAAC,2BAA2B,EACtC,MAAO,GACP,QAASR,EAAA,SAAY,CACnB,IAAMS,EAAW,MAAMC,EAA+B,CACpD,OAAQL,EACR,QAAS,CACP,cAAe,EACjB,EACA,MAAO,CACL,cAAeH,GAAY,MAAM,YAAY,GAC7C,aAAcD,EACd,GAAGM,CACL,CACF,CAAC,EAGD,GAAIE,EAAS,OAAS,CAACA,EAAS,KAC9B,MAAM,IAAI,MAAM,2CAA2C,EAG7D,OAAOA,CACT,EAnBS,WAoBT,QAAS,EAAQP,EACjB,OAAQF,EAAA,CAAC,CAAE,KAAAW,CAAK,IAAM,CACpB,IAAIC,EAAYD,GAAM,MAAQ,CAAC,EAE/B,GAAIP,GAAWA,EAAQ,UAAW,CAChC,GAAM,CAAE,OAAAS,CAAO,EAAIC,EAAOF,EAAWR,EAAQ,SAAS,EACtDQ,EAAYC,CACd,CAEA,IAAME,EAAkB,CACtB,GAAGZ,EACH,oBAAqBA,GAAa,oBAC9Ba,EAAeb,GAAa,mBAAmB,EAC/C,MACN,EAEMc,EAAiB,OAAO,KAAKF,CAAe,EAAE,O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+B,QAAU,CAAC,EAC1C,CACE,oBAAqB,EACvB,CACF,EAEMhB,EAAU,CACd,cAAepB,GAAY,KAAK,YAAY,GAC5C,sBAAuBA,GAAY,KAAK,YACpC,mBACJ,mBAAoB,CAClB,GAAG6C,CACL,CACF,EAEA,OAAQlB,EAAU,YAAY,KAAM,CAClC,KAAKI,EAAM,KAAK,KAAM,CACpB,GAAM,CAAE,YAAAgB,CAAY,EAAIC,EACtBN,CACF,EAEMO,EAA+B,MAAMF,EAAY3B,CAAO,EAE9D,OAAAQ,EAAS,EAEFqB,CACT,CACA,KAAKlB,EAAM,kBAAkB,KAAM,CACjC,GAAM,CAAE,YAAAgB,CAAY,EAAIC,EACtBP,CACF,EAEA,OAAOM,EAAY3B,CAAO,CAC5B,CAEA,QACE,MAAM,IAAI,MAAM,oBAAoB,CACxC,CACF,CAzCetB,EAAA6C,EAAA,YA2Cf,SAASO,EAAiBN,EAAqB,CAC7C,GAAIR,EAA+B,CACjC,IAAMS,EAAeC,EACnBF,EACAR,GAA+B,MACjC,EAEA,OAAOA,GAA+B,iBAAiBS,CAAY,CACrE,CACA,OAAO,IACT,CAVS/C,EAAAoD,EAAA,oBAYT,SAASC,GAAO,CACdtB,EAAa,CACf,CAFS,OAAA/B,EAAAqD,EAAA,QAIF,CAIL,UAAAxB,EAIA,OAAQS,GAA+B,QAAU,CAAC,EAIlD,UAAWJ,GAAuBK,EAIlC,QAASJ,GAAqBK,EAI9B,MAAOJ,GAAmBK,EAI1B,aACEG,EAAqC,WACrCD,EAAgC,UAIlC,cAAAD,EAIA,OAAQvC,EAMR,iBAAAiD,EAKA,kBAAmBxB,EAMnB,SAAAiB,EAKA,KAAAQ,CACF,CACF,EAjKoC","names":["createHeadlessForm","modify","useMutation","useQuery","useContractAmendmentSchemaQuery","__name","countryCode","employment","fieldValues","options","client","useClient","jsonSchemaQueryParam","useQuery","response","getShowContractAmendmentSchema","data","jsfSchema","schema","modify","copyFieldValues","convertToCents","hasFieldValues","createHeadlessForm","buildInitialValues","useCreateContractAmendmentMutation","useMutation","payload","postCreateContractAmendment","useAutomatableContractAmendmentMutation","postAutomatableContractAmendment","useContractAmendment","employmentId","setFieldValues","stepState","nextStep","previousStep","useStepState","STEPS","isLoadingEmployment","isErrorEmployment","errorEmployment","useEmploymentQuery","contractAmendmentHeadlessForm","isLoadingContractAmendments","isErrorContractAmendmentSchema","errorContractAmendmentSchema","initialValues","createContractAmendmentMutation","automatableContractAmendmentMutation","onSubmit","values","parsedValues","parseJSFToValidate","mutateAsync","mutationToPromise","automatableContractAmendment","handleValidation","back"]}
@@ -0,0 +1,2 @@
1
+ import{a as m}from"./chunk-55SA3TEF.js";import{a as n}from"./chunk-WEIRXEXU.js";import{a as e}from"./chunk-DP4SIYAC.js";import{a as T}from"./chunk-V2NCE4LO.js";import{a}from"./chunk-OKAOH4ER.js";import{a as f}from"./chunk-7KUKFRKC.js";import{a as r}from"./chunk-UEKXODGJ.js";import{a as p}from"./chunk-B4SVITZI.js";import{a as t}from"./chunk-DZYFSFZ7.js";import{a as i}from"./chunk-AYDF3IFZ.js";import{useId as c}from"react";import{jsx as u}from"react/jsx-runtime";var A=i(({employmentId:d,render:s,options:l})=>{let y=c(),o=e({employmentId:d,options:l});return u(t.Provider,{value:{formId:y,terminationBag:o},children:s({terminationBag:o,components:{SubmitButton:m,TimeOff:n,Back:r,EmployeeComunicationStep:a,TerminationDetailsStep:p,PaidTimeOffStep:f,AdditionalDetailsStep:T}})})},"TerminationFlow");export{A as a};
2
+ //# sourceMappingURL=chunk-YXVLPPO2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/flows/Termination/TerminationFlow.tsx"],"sourcesContent":["import { TerminationContext } from '@/src/flows/Termination/context';\nimport React, { useId } from 'react';\nimport { useTermination } from '@/src/flows/Termination/hooks';\nimport { JSFModify } from '@/src/flows/CostCalculator/types';\nimport { TerminationSubmit } from '@/src/flows/Termination/TerminationSubmit';\nimport { TimeOff } from '@/src/flows/Termination/TimeOff';\nimport { TerminationBack } from '@/src/flows/Termination/TerminationBack';\nimport { EmployeeCommunicationForm } from '@/src/flows/Termination/EmployeeComunicationForm';\nimport { TerminationDetailsForm } from '@/src/flows/Termination/TerminationDetailsForm';\nimport { PaidTimeOffForm } from '@/src/flows/Termination/PaidTimeOffForm';\nimport { AdditionalDetailsForm } from '@/src/flows/Termination/AdditionalDetailsForm';\n\nexport type TerminationRenderProps = {\n /**\n * The termination bag returned by the useTermination hook.\n * This bag contains all the methods and properties needed to handle the termination flow.\n * @see {@link useTermination}\n */\n terminationBag: ReturnType<typeof useTermination>;\n /**\n * The components used in the termination flow.\n * This includes different steps, submit button, back button and timeoff.\n * @see {@link TerminationSubmit}\n * @see {@link TimeOff}\n * @see {@link TerminationBack}\n * @see {@link EmployeeCommunicationForm}\n * @see {@link TerminationDetailsForm}\n * @see {@link PaidTimeOffForm}\n * @see {@link AdditionalDetailsForm}\n */\n components: {\n SubmitButton: typeof TerminationSubmit;\n TimeOff: typeof TimeOff;\n Back: typeof TerminationBack;\n EmployeeComunicationStep: typeof EmployeeCommunicationForm;\n TerminationDetailsStep: typeof TerminationDetailsForm;\n PaidTimeOffStep: typeof PaidTimeOffForm;\n AdditionalDetailsStep: typeof AdditionalDetailsForm;\n };\n};\n\ntype TerminationFlowProps = {\n employmentId: string;\n render: ({\n terminationBag,\n components,\n }: TerminationRenderProps) => React.ReactNode;\n options?: {\n jsfModify?: JSFModify;\n };\n};\n\nexport const TerminationFlow = ({\n employmentId,\n render,\n options,\n}: TerminationFlowProps) => {\n const formId = useId();\n const terminationBag = useTermination({ employmentId, options });\n\n return (\n <TerminationContext.Provider\n value={{\n formId: formId,\n terminationBag,\n }}\n >\n {render({\n terminationBag,\n components: {\n SubmitButton: TerminationSubmit,\n TimeOff: TimeOff,\n Back: TerminationBack,\n EmployeeComunicationStep: EmployeeCommunicationForm,\n TerminationDetailsStep: TerminationDetailsForm,\n PaidTimeOffStep: PaidTimeOffForm,\n AdditionalDetailsStep: AdditionalDetailsForm,\n },\n })}\n </TerminationContext.Provider>\n );\n};\n"],"mappings":"2YACA,OAAOA,GAAS,SAAAC,MAAa,QAmDtB,IAAMC,EAAkBC,EAAA,CAAC,CAC9B,aAAAC,EACA,OAAAC,EACA,QAAAC,CACF,IAA4B,CAC1B,IAAMC,EAASC,EAAM,EACfC,EAAiBC,EAAe,CAAE,aAAAN,EAAc,QAAAE,CAAQ,CAAC,EAE/D,OACEK,EAAA,cAACC,EAAmB,SAAnB,CACC,MAAO,CACL,OAAQL,EACR,eAAAE,CACF,GAECJ,EAAO,CACN,eAAAI,EACA,WAAY,CACV,aAAcI,EACd,QAASC,EACT,KAAMC,EACN,yBAA0BC,EAC1B,uBAAwBC,EACxB,gBAAiBC,EACjB,sBAAuBC,CACzB,CACF,CAAC,CACH,CAEJ,EA7B+B","names":["React","useId","TerminationFlow","__name","employmentId","render","options","formId","useId","terminationBag","useTermination","React","TerminationContext","TerminationSubmit","TimeOff","TerminationBack","EmployeeCommunicationForm","TerminationDetailsForm","PaidTimeOffForm","AdditionalDetailsForm"]}
1
+ {"version":3,"sources":["../src/flows/Termination/TerminationFlow.tsx"],"sourcesContent":["import { TerminationContext } from '@/src/flows/Termination/context';\nimport React, { useId } from 'react';\nimport { useTermination } from '@/src/flows/Termination/hooks';\nimport { JSFModify } from '@/src/flows/CostCalculator/types';\nimport { TerminationSubmit } from '@/src/flows/Termination/TerminationSubmit';\nimport { TimeOff } from '@/src/flows/Termination/TimeOff';\nimport { TerminationBack } from '@/src/flows/Termination/TerminationBack';\nimport { EmployeeCommunicationForm } from '@/src/flows/Termination/EmployeeComunicationForm';\nimport { TerminationDetailsForm } from '@/src/flows/Termination/TerminationDetailsForm';\nimport { PaidTimeOffForm } from '@/src/flows/Termination/PaidTimeOffForm';\nimport { AdditionalDetailsForm } from '@/src/flows/Termination/AdditionalDetailsForm';\n\nexport type TerminationRenderProps = {\n /**\n * The termination bag returned by the useTermination hook.\n * This bag contains all the methods and properties needed to handle the termination flow.\n * @see {@link useTermination}\n */\n terminationBag: ReturnType<typeof useTermination>;\n /**\n * The components used in the termination flow.\n * This includes different steps, submit button, back button and timeoff.\n * @see {@link TerminationSubmit}\n * @see {@link TimeOff}\n * @see {@link TerminationBack}\n * @see {@link EmployeeCommunicationForm}\n * @see {@link TerminationDetailsForm}\n * @see {@link PaidTimeOffForm}\n * @see {@link AdditionalDetailsForm}\n */\n components: {\n SubmitButton: typeof TerminationSubmit;\n TimeOff: typeof TimeOff;\n Back: typeof TerminationBack;\n EmployeeComunicationStep: typeof EmployeeCommunicationForm;\n TerminationDetailsStep: typeof TerminationDetailsForm;\n PaidTimeOffStep: typeof PaidTimeOffForm;\n AdditionalDetailsStep: typeof AdditionalDetailsForm;\n };\n};\n\ntype TerminationFlowProps = {\n employmentId: string;\n render: ({\n terminationBag,\n components,\n }: TerminationRenderProps) => React.ReactNode;\n options?: {\n jsfModify?: JSFModify;\n };\n};\n\nexport const TerminationFlow = ({\n employmentId,\n render,\n options,\n}: TerminationFlowProps) => {\n const formId = useId();\n const terminationBag = useTermination({ employmentId, options });\n\n return (\n <TerminationContext.Provider\n value={{\n formId: formId,\n terminationBag,\n }}\n >\n {render({\n terminationBag,\n components: {\n SubmitButton: TerminationSubmit,\n TimeOff: TimeOff,\n Back: TerminationBack,\n EmployeeComunicationStep: EmployeeCommunicationForm,\n TerminationDetailsStep: TerminationDetailsForm,\n PaidTimeOffStep: PaidTimeOffForm,\n AdditionalDetailsStep: AdditionalDetailsForm,\n },\n })}\n </TerminationContext.Provider>\n );\n};\n"],"mappings":"2YACA,OAAgB,SAAAA,MAAa,QA4DzB,cAAAC,MAAA,oBATG,IAAMC,EAAkBC,EAAA,CAAC,CAC9B,aAAAC,EACA,OAAAC,EACA,QAAAC,CACF,IAA4B,CAC1B,IAAMC,EAASC,EAAM,EACfC,EAAiBC,EAAe,CAAE,aAAAN,EAAc,QAAAE,CAAQ,CAAC,EAE/D,OACEL,EAACU,EAAmB,SAAnB,CACC,MAAO,CACL,OAAQJ,EACR,eAAAE,CACF,EAEC,SAAAJ,EAAO,CACN,eAAAI,EACA,WAAY,CACV,aAAcG,EACd,QAASC,EACT,KAAMC,EACN,yBAA0BC,EAC1B,uBAAwBC,EACxB,gBAAiBC,EACjB,sBAAuBC,CACzB,CACF,CAAC,EACH,CAEJ,EA7B+B","names":["useId","jsx","TerminationFlow","__name","employmentId","render","options","formId","useId","terminationBag","useTermination","TerminationContext","TerminationSubmit","TimeOff","TerminationBack","EmployeeCommunicationForm","TerminationDetailsForm","PaidTimeOffForm","AdditionalDetailsForm"]}
@@ -1,5 +1,6 @@
1
- import React__default, { PropsWithChildren, ButtonHTMLAttributes } from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { PropsWithChildren, ButtonHTMLAttributes } from 'react';
2
3
 
3
- declare function ContractAmendmentBack({ children, ...props }: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>): React__default.JSX.Element;
4
+ declare function ContractAmendmentBack({ children, ...props }: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>> & Record<string, unknown>): react_jsx_runtime.JSX.Element;
4
5
 
5
6
  export { ContractAmendmentBack };
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-FMT2OTOL.js";import"../../chunk-56BNVYTD.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentBack};
1
+ import{a}from"../../chunk-GFWQG4ZT.js";import"../../chunk-EMVYCKDC.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentBack};
2
2
  //# sourceMappingURL=ContractAmendmentBack.js.map
@@ -1,5 +1,5 @@
1
- import { b as PostCreateContractAmendmentError, a as ContractAmendmentResponse } from '../../types.gen-CsMdyQkb.js';
2
- import React__default from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { b as PostCreateContractAmendmentError, a as ContractAmendmentResponse } from '../../types.gen-Ctv2nomK.js';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
 
5
5
  type ContractAmendmentConfirmationFormProps = {
@@ -11,7 +11,7 @@ type ContractAmendmentConfirmationFormProps = {
11
11
  * @param values
12
12
  * @returns
13
13
  */
14
- onSubmit?: (values: FieldValues) => Promise<void>;
14
+ onSubmit?: (values: FieldValues) => void | Promise<void>;
15
15
  /**
16
16
  * Callback function to be called when the contract amendment fails.
17
17
  * @param error
@@ -23,8 +23,8 @@ type ContractAmendmentConfirmationFormProps = {
23
23
  * @param data
24
24
  * @returns
25
25
  */
26
- onSuccess?: (data: ContractAmendmentResponse) => void;
26
+ onSuccess?: (data: ContractAmendmentResponse) => void | Promise<void>;
27
27
  };
28
- declare function ContractAmendmentConfirmationForm({ onSubmit, onError, onSuccess, }: ContractAmendmentConfirmationFormProps): React__default.JSX.Element | null;
28
+ declare function ContractAmendmentConfirmationForm({ onSubmit, onError, onSuccess, }: ContractAmendmentConfirmationFormProps): react_jsx_runtime.JSX.Element | null;
29
29
 
30
30
  export { ContractAmendmentConfirmationForm };
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-ABR3B66K.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentConfirmationForm};
1
+ import{a}from"../../chunk-6T3A6GWH.js";import"../../chunk-ONZPO4GN.js";import"../../chunk-TPRGCMIZ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentConfirmationForm};
2
2
  //# sourceMappingURL=ContractAmendmentConfirmationForm.js.map
@@ -1,12 +1,13 @@
1
1
  import { ContractAmendmentConfirmationForm } from './ContractAmendmentConfirmationForm.js';
2
- import React__default from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { ContractAmendmentBack } from './ContractAmendmentBack.js';
4
4
  import { ContractAmendmentForm } from './ContractAmendmentForm.js';
5
5
  import { ContractAmendmentSubmit } from './ContractAmendmentSubmit.js';
6
6
  import { useContractAmendment } from './hooks.js';
7
7
  import { ContractAmendmentParams } from './types.js';
8
- import '../../types.gen-CsMdyQkb.js';
8
+ import '../../types.gen-Ctv2nomK.js';
9
9
  import 'react-hook-form';
10
+ import 'react';
10
11
  import '../../mutations-v9H353tz.js';
11
12
  import '@remoteoss/json-schema-form';
12
13
  import '../useStepState.js';
@@ -36,8 +37,8 @@ type ContractAmendmentRenderProps = {
36
37
  };
37
38
  };
38
39
  type ContractAmendmentFlowProps = ContractAmendmentParams & {
39
- render: ({ contractAmendmentBag, components, }: ContractAmendmentRenderProps) => React__default.ReactNode;
40
+ render: ({ contractAmendmentBag, components, }: ContractAmendmentRenderProps) => React.ReactNode;
40
41
  };
41
- declare function ContractAmendmentFlow({ employmentId, countryCode, options, render, }: ContractAmendmentFlowProps): React__default.JSX.Element;
42
+ declare function ContractAmendmentFlow({ employmentId, countryCode, options, render, }: ContractAmendmentFlowProps): react_jsx_runtime.JSX.Element;
42
43
 
43
44
  export { ContractAmendmentFlow, type ContractAmendmentRenderProps };
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-KQH5HLN5.js";import"../../chunk-XLFHHYVS.js";import"../../chunk-GOLOL2V6.js";import"../../chunk-QOMUXX6W.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-DHRIURRT.js";import"../../chunk-UECSVYQ5.js";import"../../chunk-S56EWAS4.js";import"../../chunk-FMT2OTOL.js";import"../../chunk-ABR3B66K.js";import"../../chunk-HEPL5WDF.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentFlow};
1
+ import{a}from"../../chunk-W5DS5Q4J.js";import"../../chunk-NF5IMQEW.js";import"../../chunk-YSIEXMDD.js";import"../../chunk-3PH5E6CZ.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-O3QLBSMV.js";import"../../chunk-GMU3QGAR.js";import"../../chunk-INAXCFVC.js";import"../../chunk-GFWQG4ZT.js";import"../../chunk-6T3A6GWH.js";import"../../chunk-L5OIK2ZJ.js";import"../../chunk-EGDD73PU.js";import"../../chunk-NEFNFYRS.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-EMVYCKDC.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-ONZPO4GN.js";import"../../chunk-TPRGCMIZ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentFlow};
2
2
  //# sourceMappingURL=ContractAmendmentFlow.js.map
@@ -1,5 +1,5 @@
1
- import { P as PostAutomatableContractAmendmentError, C as ContractAmendmentAutomatableResponse } from '../../types.gen-CsMdyQkb.js';
2
- import React__default from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { P as PostAutomatableContractAmendmentError, C as ContractAmendmentAutomatableResponse } from '../../types.gen-Ctv2nomK.js';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
 
5
5
  type ContractAmendmentFormProps = {
@@ -11,7 +11,7 @@ type ContractAmendmentFormProps = {
11
11
  * @param values
12
12
  * @returns
13
13
  */
14
- onSubmit?: (values: FieldValues) => Promise<void>;
14
+ onSubmit?: (values: FieldValues) => void | Promise<void>;
15
15
  /**
16
16
  * Callback function to be called when the contract amendment fails.
17
17
  * @param error
@@ -26,8 +26,8 @@ type ContractAmendmentFormProps = {
26
26
  * @param data
27
27
  * @returns
28
28
  */
29
- onSuccess?: (data: ContractAmendmentAutomatableResponse) => void;
29
+ onSuccess?: (data: ContractAmendmentAutomatableResponse) => void | Promise<void>;
30
30
  };
31
- declare function ContractAmendmentForm({ onSubmit, onError, onSuccess, }: ContractAmendmentFormProps): React__default.JSX.Element;
31
+ declare function ContractAmendmentForm({ onSubmit, onError, onSuccess, }: ContractAmendmentFormProps): react_jsx_runtime.JSX.Element;
32
32
 
33
33
  export { ContractAmendmentForm };
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-HEPL5WDF.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentForm};
1
+ import{a}from"../../chunk-L5OIK2ZJ.js";import"../../chunk-EGDD73PU.js";import"../../chunk-NEFNFYRS.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-EMVYCKDC.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-ONZPO4GN.js";import"../../chunk-TPRGCMIZ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentForm};
2
2
  //# sourceMappingURL=ContractAmendmentForm.js.map
@@ -1,5 +1,6 @@
1
- import React__default, { PropsWithChildren, ButtonHTMLAttributes } from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { PropsWithChildren, ButtonHTMLAttributes } from 'react';
2
3
 
3
- declare function ContractAmendmentSubmit({ children, ...props }: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>): React__default.JSX.Element;
4
+ declare function ContractAmendmentSubmit({ children, ...props }: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>> & Record<string, unknown>): react_jsx_runtime.JSX.Element;
4
5
 
5
6
  export { ContractAmendmentSubmit };
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-XLFHHYVS.js";import"../../chunk-56BNVYTD.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentSubmit};
1
+ import{a}from"../../chunk-NF5IMQEW.js";import"../../chunk-EMVYCKDC.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentSubmit};
2
2
  //# sourceMappingURL=ContractAmendmentSubmit.js.map
@@ -1,7 +1,7 @@
1
1
  import { S as SuccessResponse, E as ErrorResponse } from '../../mutations-v9H353tz.js';
2
- import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-CsMdyQkb.js';
2
+ import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-Ctv2nomK.js';
3
3
  import * as _remoteoss_json_schema_form from '@remoteoss/json-schema-form';
4
- import * as React from 'react';
4
+ import * as react from 'react';
5
5
  import * as react_hook_form from 'react-hook-form';
6
6
  import { useContractAmendment } from './hooks.js';
7
7
  import { Step } from '../useStepState.js';
@@ -9,7 +9,7 @@ import './types.js';
9
9
  import '../types.js';
10
10
  import '../CostCalculator/types.js';
11
11
 
12
- declare const ContractAmendmentContext: React.Context<{
12
+ declare const ContractAmendmentContext: react.Context<{
13
13
  formId: string | undefined;
14
14
  contractAmendmentBag: ReturnType<typeof useContractAmendment> | null;
15
15
  }>;
@@ -17,7 +17,7 @@ declare const useContractAmendmentContext: () => {
17
17
  readonly formId: string | undefined;
18
18
  readonly contractAmendment: {
19
19
  stepState: {
20
- currentStep: Step;
20
+ currentStep: Step<"form" | "confirmation_form">;
21
21
  totalSteps: number;
22
22
  values: {
23
23
  form: react_hook_form.FieldValues;
@@ -35,7 +35,7 @@ declare const useContractAmendmentContext: () => {
35
35
  yupError: _remoteoss_json_schema_form.$TSFixMe;
36
36
  formErrors: _remoteoss_json_schema_form.$TSFixMe;
37
37
  } | null;
38
- checkFieldUpdates: React.Dispatch<React.SetStateAction<react_hook_form.FieldValues>>;
38
+ checkFieldUpdates: react.Dispatch<react.SetStateAction<react_hook_form.FieldValues>>;
39
39
  onSubmit: (values: react_hook_form.FieldValues) => Promise<SuccessResponse<({
40
40
  data: ContractAmendmentAutomatableResponse;
41
41
  error: undefined;
@@ -1,6 +1,6 @@
1
1
  import { S as SuccessResponse, E as ErrorResponse } from '../../mutations-v9H353tz.js';
2
- import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-CsMdyQkb.js';
3
- import * as React from 'react';
2
+ import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-Ctv2nomK.js';
3
+ import * as react from 'react';
4
4
  import * as _remoteoss_json_schema_form from '@remoteoss/json-schema-form';
5
5
  import { Step } from '../useStepState.js';
6
6
  import { ContractAmendmentParams } from './types.js';
@@ -13,7 +13,7 @@ declare const useContractAmendment: ({ employmentId, countryCode, options, }: Co
13
13
  * Current step state containing the current step and total number of steps
14
14
  */
15
15
  stepState: {
16
- currentStep: Step;
16
+ currentStep: Step<"form" | "confirmation_form">;
17
17
  totalSteps: number;
18
18
  values: {
19
19
  form: FieldValues;
@@ -61,7 +61,7 @@ declare const useContractAmendment: ({ employmentId, countryCode, options, }: Co
61
61
  * Function to update the current form field values
62
62
  * @param values - New form values to set
63
63
  */
64
- checkFieldUpdates: React.Dispatch<React.SetStateAction<FieldValues>>;
64
+ checkFieldUpdates: react.Dispatch<react.SetStateAction<FieldValues>>;
65
65
  /**
66
66
  * Function to handle form submission
67
67
  * @param values - Form values to submit
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-GOLOL2V6.js";import"../../chunk-QOMUXX6W.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-DHRIURRT.js";import"../../chunk-UECSVYQ5.js";import"../../chunk-S56EWAS4.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-AYDF3IFZ.js";export{a as useContractAmendment};
1
+ import{a}from"../../chunk-YSIEXMDD.js";import"../../chunk-3PH5E6CZ.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-O3QLBSMV.js";import"../../chunk-GMU3QGAR.js";import"../../chunk-INAXCFVC.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-TPRGCMIZ.js";import"../../chunk-AYDF3IFZ.js";export{a as useContractAmendment};
2
2
  //# sourceMappingURL=hooks.js.map
@@ -3,10 +3,11 @@ export { ContractAmendmentFlow, ContractAmendmentRenderProps } from './ContractA
3
3
  export { ContractAmendmentForm } from './ContractAmendmentForm.js';
4
4
  export { ContractAmendmentSubmit } from './ContractAmendmentSubmit.js';
5
5
  export { useContractAmendment } from './hooks.js';
6
- import '../../types.gen-CsMdyQkb.js';
7
- import 'react';
6
+ import 'react/jsx-runtime';
7
+ import '../../types.gen-Ctv2nomK.js';
8
8
  import 'react-hook-form';
9
9
  import './ContractAmendmentBack.js';
10
+ import 'react';
10
11
  import './types.js';
11
12
  import '../types.js';
12
13
  import '../CostCalculator/types.js';
@@ -1,2 +1,2 @@
1
- import"../../chunk-A7ZJQCNU.js";import{a as e}from"../../chunk-KQH5HLN5.js";import{a as c}from"../../chunk-XLFHHYVS.js";import{a as d}from"../../chunk-GOLOL2V6.js";import"../../chunk-QOMUXX6W.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-DHRIURRT.js";import"../../chunk-UECSVYQ5.js";import"../../chunk-S56EWAS4.js";import"../../chunk-FMT2OTOL.js";import{a}from"../../chunk-ABR3B66K.js";import{a as b}from"../../chunk-HEPL5WDF.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentConfirmationForm,e as ContractAmendmentFlow,b as ContractAmendmentForm,c as ContractAmendmentSubmit,d as useContractAmendment};
1
+ import"../../chunk-A7ZJQCNU.js";import{a as e}from"../../chunk-W5DS5Q4J.js";import{a as c}from"../../chunk-NF5IMQEW.js";import{a as d}from"../../chunk-YSIEXMDD.js";import"../../chunk-3PH5E6CZ.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-O3QLBSMV.js";import"../../chunk-GMU3QGAR.js";import"../../chunk-INAXCFVC.js";import"../../chunk-GFWQG4ZT.js";import{a}from"../../chunk-6T3A6GWH.js";import{a as b}from"../../chunk-L5OIK2ZJ.js";import"../../chunk-EGDD73PU.js";import"../../chunk-NEFNFYRS.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-EMVYCKDC.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-ONZPO4GN.js";import"../../chunk-TPRGCMIZ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentConfirmationForm,e as ContractAmendmentFlow,b as ContractAmendmentForm,c as ContractAmendmentSubmit,d as useContractAmendment};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import { FlowOptions } from '../types.js';
2
2
  import '../CostCalculator/types.js';
3
- import '../../types.gen-CsMdyQkb.js';
3
+ import '../../types.gen-Ctv2nomK.js';
4
4
  import '@remoteoss/json-schema-form';
5
5
 
6
6
  type ContractAmendmentParams = {
@@ -1,11 +1,11 @@
1
- import { E as EmploymentShowResponse } from '../../types.gen-CsMdyQkb.js';
1
+ import { E as EmploymentShowResponse } from '../../types.gen-Ctv2nomK.js';
2
2
  import { Fields } from '@remoteoss/json-schema-form';
3
3
  import { Step } from '../useStepState.js';
4
4
  import 'react';
5
5
  import 'react-hook-form';
6
6
 
7
7
  type StepKeys = 'form' | 'confirmation_form';
8
- declare const STEPS: Record<StepKeys, Step>;
8
+ declare const STEPS: Record<StepKeys, Step<StepKeys>>;
9
9
  declare function buildInitialValues(employment: EmploymentShowResponse | undefined, fields?: Fields | undefined): {};
10
10
 
11
11
  export { STEPS, buildInitialValues };
@@ -1,2 +1,2 @@
1
- import{a,b}from"../../chunk-UECSVYQ5.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-AYDF3IFZ.js";export{a as STEPS,b as buildInitialValues};
1
+ import{a,b}from"../../chunk-O3QLBSMV.js";import"../../chunk-TPRGCMIZ.js";import"../../chunk-AYDF3IFZ.js";export{a as STEPS,b as buildInitialValues};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1,8 +1,8 @@
1
- import React__default from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
3
  type CostCalculatorDisclaimerProps = {
4
4
  label?: string;
5
5
  };
6
- declare const CostCalculatorDisclaimer: ({ label, }: CostCalculatorDisclaimerProps) => React__default.JSX.Element;
6
+ declare const CostCalculatorDisclaimer: ({ label, }: CostCalculatorDisclaimerProps) => react_jsx_runtime.JSX.Element;
7
7
 
8
8
  export { CostCalculatorDisclaimer };
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-DGPRFQYK.js";import"../../chunk-DYB3RWP7.js";import"../../chunk-56BNVYTD.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as CostCalculatorDisclaimer};
1
+ import{a}from"../../chunk-U4M5QBBG.js";import"../../chunk-DYB3RWP7.js";import"../../chunk-EMVYCKDC.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as CostCalculatorDisclaimer};
2
2
  //# sourceMappingURL=CostCalculatorDisclaimer.js.map