@remoteoss/remote-flows 1.2.0 → 1.2.2

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 (277) hide show
  1. package/dist/chunk-23OYALRY.js +2 -0
  2. package/dist/chunk-23OYALRY.js.map +1 -0
  3. package/dist/{chunk-ZSX2O4ZJ.js → chunk-3ALAJXRV.js} +2 -2
  4. package/dist/{chunk-D3YUACHO.js → chunk-3TZG2IN7.js} +2 -2
  5. package/dist/{chunk-KDMBZNAE.js → chunk-46FT5RHQ.js} +2 -2
  6. package/dist/{chunk-O6YXA5AM.js → chunk-4STFNBEP.js} +2 -2
  7. package/dist/{chunk-BGWVXKFX.js → chunk-5FYGD7NK.js} +2 -2
  8. package/dist/{chunk-TVPY6KPQ.js → chunk-5JLTIH7G.js} +2 -2
  9. package/dist/chunk-5S66VYFD.js +2 -0
  10. package/dist/chunk-5S66VYFD.js.map +1 -0
  11. package/dist/{chunk-XEUZL7O2.js → chunk-65HLULDL.js} +2 -2
  12. package/dist/chunk-6GTRAHWJ.js +2 -0
  13. package/dist/chunk-6GTRAHWJ.js.map +1 -0
  14. package/dist/chunk-6P4DTWYK.js +2 -0
  15. package/dist/chunk-6P4DTWYK.js.map +1 -0
  16. package/dist/{chunk-M2EKZ2FC.js → chunk-6SRDRMBU.js} +2 -2
  17. package/dist/chunk-6SRDRMBU.js.map +1 -0
  18. package/dist/chunk-7RREQLI5.js +2 -0
  19. package/dist/chunk-7RREQLI5.js.map +1 -0
  20. package/dist/{chunk-VUY7ZZAD.js → chunk-A3K4Q2U6.js} +2 -2
  21. package/dist/{chunk-5VPMZXGU.js → chunk-BAWJZ6MA.js} +2 -2
  22. package/dist/{chunk-ALRODBM2.js → chunk-BEWGN2JK.js} +2 -2
  23. package/dist/{chunk-3SAV2OEE.js → chunk-BHYFPY64.js} +2 -2
  24. package/dist/{chunk-77EBKLW6.js → chunk-C74N2AWG.js} +2 -2
  25. package/dist/{chunk-RNULWNWR.js → chunk-CULOWG5X.js} +2 -2
  26. package/dist/chunk-DRGQQXWZ.js +2 -0
  27. package/dist/chunk-DRGQQXWZ.js.map +1 -0
  28. package/dist/chunk-E25DZ75Z.js +2 -0
  29. package/dist/chunk-E25DZ75Z.js.map +1 -0
  30. package/dist/chunk-E5PHO3SS.js +2 -0
  31. package/dist/chunk-E5PHO3SS.js.map +1 -0
  32. package/dist/chunk-EDVJBPCB.js +2 -0
  33. package/dist/chunk-EDVJBPCB.js.map +1 -0
  34. package/dist/chunk-ERRQIROU.js +2 -0
  35. package/dist/chunk-ERRQIROU.js.map +1 -0
  36. package/dist/chunk-F3KEIVSE.js +2 -0
  37. package/dist/chunk-F3KEIVSE.js.map +1 -0
  38. package/dist/{chunk-F53TRJ4K.js → chunk-FKLQBAJ5.js} +2 -2
  39. package/dist/{chunk-DS5MV4BA.js → chunk-GBZXVNGQ.js} +2 -2
  40. package/dist/chunk-H6YNMT4M.js +2 -0
  41. package/dist/chunk-H6YNMT4M.js.map +1 -0
  42. package/dist/{chunk-UVA4PFNM.js → chunk-HAV7FPRM.js} +2 -2
  43. package/dist/{chunk-Z47XN6ZT.js → chunk-IOZFJ65G.js} +2 -2
  44. package/dist/{chunk-7YY7DH4I.js → chunk-KCXAXVC5.js} +2 -2
  45. package/dist/{chunk-WUZ5OZ42.js → chunk-KY2JSZI3.js} +2 -2
  46. package/dist/{chunk-T4KJKYPC.js → chunk-LJUHIEEZ.js} +2 -2
  47. package/dist/chunk-LQBVRVXH.js +2 -0
  48. package/dist/chunk-LQBVRVXH.js.map +1 -0
  49. package/dist/chunk-M2TLNSTK.js +2 -0
  50. package/dist/chunk-M2TLNSTK.js.map +1 -0
  51. package/dist/{chunk-ASSO5FYG.js → chunk-MNSIBSAM.js} +2 -2
  52. package/dist/{chunk-L23UIJDU.js → chunk-O37C4LZF.js} +2 -2
  53. package/dist/{chunk-COKMRJQ7.js → chunk-OUI554QS.js} +2 -2
  54. package/dist/{chunk-PTHW7GI4.js → chunk-QJ5MCAIN.js} +2 -2
  55. package/dist/{chunk-GT6DVQEB.js → chunk-QYWA5XM4.js} +2 -2
  56. package/dist/{chunk-NVZHJOA3.js → chunk-RNM46ZUE.js} +2 -2
  57. package/dist/{chunk-BP4PHE44.js → chunk-RTKKWC4M.js} +2 -2
  58. package/dist/{chunk-NCWPOV3B.js → chunk-RVIGZOGF.js} +2 -2
  59. package/dist/{chunk-MUILMUKC.js → chunk-S2FD3J22.js} +2 -2
  60. package/dist/chunk-SIYKTLFS.js +2 -0
  61. package/dist/chunk-SIYKTLFS.js.map +1 -0
  62. package/dist/chunk-T6HCUFYI.js +2 -0
  63. package/dist/chunk-T6HCUFYI.js.map +1 -0
  64. package/dist/{chunk-FLNGPYQ2.js → chunk-TVJYCR33.js} +2 -2
  65. package/dist/chunk-TVJYCR33.js.map +1 -0
  66. package/dist/{chunk-OL7SFTJV.js → chunk-UTWP5CJZ.js} +2 -2
  67. package/dist/chunk-XGVSEXYA.js +2 -0
  68. package/dist/chunk-XGVSEXYA.js.map +1 -0
  69. package/dist/chunk-XRI6PRXK.js +2 -0
  70. package/dist/chunk-XRI6PRXK.js.map +1 -0
  71. package/dist/chunk-Y2NSR2N6.js +2 -0
  72. package/dist/chunk-Y2NSR2N6.js.map +1 -0
  73. package/dist/chunk-Y5P5IJRN.js +2 -0
  74. package/dist/chunk-Y5P5IJRN.js.map +1 -0
  75. package/dist/{chunk-LD2UDBK4.js → chunk-ZP2BE7U6.js} +2 -2
  76. package/dist/flows/ContractAmendment/ContractAmendmentBack.js +1 -1
  77. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +1 -1
  78. package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +3 -3
  79. package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
  80. package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +1 -1
  81. package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
  82. package/dist/flows/ContractAmendment/ContractAmendmentSubmit.js +1 -1
  83. package/dist/flows/ContractAmendment/context.d.ts +3 -3
  84. package/dist/flows/ContractAmendment/hooks.d.ts +3 -3
  85. package/dist/flows/ContractAmendment/index.d.ts +3 -3
  86. package/dist/flows/ContractAmendment/index.js +1 -1
  87. package/dist/flows/ContractAmendment/types.d.ts +2 -2
  88. package/dist/flows/ContractAmendment/utils.d.ts +1 -1
  89. package/dist/flows/ContractorOnboarding/ContractorOnboarding.d.ts +5 -5
  90. package/dist/flows/ContractorOnboarding/ContractorOnboarding.js +1 -1
  91. package/dist/flows/ContractorOnboarding/api.d.ts +2 -2
  92. package/dist/flows/ContractorOnboarding/components/BasicInformationStep.d.ts +4 -4
  93. package/dist/flows/ContractorOnboarding/components/BasicInformationStep.js +1 -1
  94. package/dist/flows/ContractorOnboarding/components/ContractDetailsStep.d.ts +5 -5
  95. package/dist/flows/ContractorOnboarding/components/ContractDetailsStep.js +1 -1
  96. package/dist/flows/ContractorOnboarding/components/ContractPreviewStep.d.ts +5 -5
  97. package/dist/flows/ContractorOnboarding/components/ContractPreviewStep.js +1 -1
  98. package/dist/flows/ContractorOnboarding/components/ContractorOnboardingForm.d.ts +5 -5
  99. package/dist/flows/ContractorOnboarding/components/ContractorOnboardingForm.js +1 -1
  100. package/dist/flows/ContractorOnboarding/components/OnboardingBack.js +1 -1
  101. package/dist/flows/ContractorOnboarding/components/OnboardingInvite.d.ts +3 -3
  102. package/dist/flows/ContractorOnboarding/components/OnboardingInvite.js +1 -1
  103. package/dist/flows/ContractorOnboarding/components/OnboardingSubmit.js +1 -1
  104. package/dist/flows/ContractorOnboarding/components/PricingPlan.d.ts +5 -5
  105. package/dist/flows/ContractorOnboarding/components/PricingPlan.js +1 -1
  106. package/dist/flows/ContractorOnboarding/components/SelectCountryStep.d.ts +4 -4
  107. package/dist/flows/ContractorOnboarding/components/SelectCountryStep.js +1 -1
  108. package/dist/flows/ContractorOnboarding/context.d.ts +5 -5
  109. package/dist/flows/ContractorOnboarding/hooks.d.ts +5 -5
  110. package/dist/flows/ContractorOnboarding/hooks.js +1 -1
  111. package/dist/flows/ContractorOnboarding/index.d.ts +5 -5
  112. package/dist/flows/ContractorOnboarding/index.js +1 -1
  113. package/dist/flows/ContractorOnboarding/types.d.ts +5 -5
  114. package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +3 -3
  115. package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
  116. package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +3 -3
  117. package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
  118. package/dist/flows/CostCalculator/CostCalculatorResetButton.js +1 -1
  119. package/dist/flows/CostCalculator/CostCalculatorSubmitButton.js +1 -1
  120. package/dist/flows/CostCalculator/EstimationResults/EstimationResults.d.ts +2 -2
  121. package/dist/flows/CostCalculator/EstimationResults/EstimationResults.js +1 -1
  122. package/dist/flows/CostCalculator/SummaryResults/SummaryResults.d.ts +2 -2
  123. package/dist/flows/CostCalculator/api.d.ts +2 -2
  124. package/dist/flows/CostCalculator/components/SalaryField.d.ts +2 -2
  125. package/dist/flows/CostCalculator/components/SalaryField.js +1 -1
  126. package/dist/flows/CostCalculator/context.d.ts +3 -3
  127. package/dist/flows/CostCalculator/hooks.d.ts +3 -3
  128. package/dist/flows/CostCalculator/hooks.js +1 -1
  129. package/dist/flows/CostCalculator/index.d.ts +3 -3
  130. package/dist/flows/CostCalculator/index.js +1 -1
  131. package/dist/flows/CostCalculator/types.d.ts +2 -2
  132. package/dist/flows/CostCalculator/utils.d.ts +3 -3
  133. package/dist/flows/CostCalculator/utils.js +1 -1
  134. package/dist/flows/Onboarding/OnboardingFlow.d.ts +4 -4
  135. package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
  136. package/dist/flows/Onboarding/api.d.ts +6 -6
  137. package/dist/flows/Onboarding/api.js +1 -1
  138. package/dist/flows/Onboarding/components/AnnualGrossSalary.d.ts +2 -2
  139. package/dist/flows/Onboarding/components/AnnualGrossSalary.js +1 -1
  140. package/dist/flows/Onboarding/components/BasicInformationStep.d.ts +4 -4
  141. package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
  142. package/dist/flows/Onboarding/components/BenefitsStep.d.ts +4 -4
  143. package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
  144. package/dist/flows/Onboarding/components/ContractDetailsStep.d.ts +4 -4
  145. package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
  146. package/dist/flows/Onboarding/components/OnboardingBack.js +1 -1
  147. package/dist/flows/Onboarding/components/OnboardingForm.d.ts +4 -4
  148. package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
  149. package/dist/flows/Onboarding/components/OnboardingInvite.d.ts +3 -3
  150. package/dist/flows/Onboarding/components/OnboardingInvite.js +1 -1
  151. package/dist/flows/Onboarding/components/OnboardingSubmit.js +1 -1
  152. package/dist/flows/Onboarding/components/ReviewStep.d.ts +4 -4
  153. package/dist/flows/Onboarding/components/SaveDraftButton.d.ts +3 -3
  154. package/dist/flows/Onboarding/components/SaveDraftButton.js +1 -1
  155. package/dist/flows/Onboarding/components/SelectCountryStep.d.ts +4 -4
  156. package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
  157. package/dist/flows/Onboarding/context.d.ts +4 -4
  158. package/dist/flows/Onboarding/hooks.d.ts +4 -4
  159. package/dist/flows/Onboarding/hooks.js +1 -1
  160. package/dist/flows/Onboarding/index.d.ts +4 -4
  161. package/dist/flows/Onboarding/index.js +1 -1
  162. package/dist/flows/Onboarding/types.d.ts +4 -4
  163. package/dist/flows/Onboarding/utils.d.ts +4 -4
  164. package/dist/flows/Onboarding/utils.js +1 -1
  165. package/dist/flows/Termination/AdditionalDetailsForm.d.ts +4 -4
  166. package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
  167. package/dist/flows/Termination/EmployeeComunicationForm.d.ts +4 -4
  168. package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
  169. package/dist/flows/Termination/PaidTimeOffForm.d.ts +4 -4
  170. package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
  171. package/dist/flows/Termination/TerminationBack.js +1 -1
  172. package/dist/flows/Termination/TerminationDetailsForm.d.ts +4 -4
  173. package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
  174. package/dist/flows/Termination/TerminationFlow.d.ts +4 -4
  175. package/dist/flows/Termination/TerminationFlow.js +1 -1
  176. package/dist/flows/Termination/TerminationForm.d.ts +4 -4
  177. package/dist/flows/Termination/TerminationForm.js +1 -1
  178. package/dist/flows/Termination/TerminationSubmit.js +1 -1
  179. package/dist/flows/Termination/api.d.ts +5 -5
  180. package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInformationFees.js +1 -1
  181. package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOff.d.ts +6 -6
  182. package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOff.js +1 -1
  183. package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOffContainer.d.ts +6 -6
  184. package/dist/flows/Termination/components/PaidTimeOff/types.d.ts +6 -6
  185. package/dist/flows/Termination/components/TerminationDialogInfoContent/TerminationDialogInfoContent.js +1 -1
  186. package/dist/flows/Termination/context.d.ts +4 -4
  187. package/dist/flows/Termination/hooks.d.ts +4 -4
  188. package/dist/flows/Termination/hooks.js +1 -1
  189. package/dist/flows/Termination/index.d.ts +6 -6
  190. package/dist/flows/Termination/index.js +1 -1
  191. package/dist/flows/Termination/json-schemas/schema.d.ts +4 -4
  192. package/dist/flows/Termination/types.d.ts +4 -4
  193. package/dist/flows/Termination/utils.d.ts +4 -4
  194. package/dist/flows/types.d.ts +5 -6
  195. package/dist/index.d.ts +8 -8
  196. package/dist/index.js +1 -1
  197. package/dist/index.js.map +1 -1
  198. package/dist/internals.js +1 -1
  199. package/dist/{mutations-9qiDR92y.d.ts → mutations-CPqUOEmz.d.ts} +1 -1
  200. package/dist/{remoteFlows-MePlSSWv.d.ts → remoteFlows-CLgJcdkS.d.ts} +36 -18
  201. package/dist/{types-VZNnRHGB.d.ts → types-BGV7PQbp.d.ts} +2 -2
  202. package/dist/{types-BFDVSvVP.d.ts → types-B_ZvICFS.d.ts} +4 -5
  203. package/dist/{types-DDcdRWu_.d.ts → types-Ckh2r3F3.d.ts} +2 -2
  204. package/dist/{types-BTxMhXje.d.ts → types-epJRqrJU.d.ts} +4 -4
  205. package/dist/{types.gen-UyEyxhzQ.d.ts → types.gen-D2nbxMA0.d.ts} +1 -1
  206. package/package.json +6 -2
  207. package/dist/chunk-26DGUFCY.js +0 -2
  208. package/dist/chunk-26DGUFCY.js.map +0 -1
  209. package/dist/chunk-3JVRFY6F.js +0 -2
  210. package/dist/chunk-3JVRFY6F.js.map +0 -1
  211. package/dist/chunk-4P5BLP5U.js +0 -2
  212. package/dist/chunk-4P5BLP5U.js.map +0 -1
  213. package/dist/chunk-6YXSWOKH.js +0 -2
  214. package/dist/chunk-6YXSWOKH.js.map +0 -1
  215. package/dist/chunk-7FMR3EIX.js +0 -2
  216. package/dist/chunk-7FMR3EIX.js.map +0 -1
  217. package/dist/chunk-7WTIUK53.js +0 -2
  218. package/dist/chunk-7WTIUK53.js.map +0 -1
  219. package/dist/chunk-BZUYUGQF.js +0 -2
  220. package/dist/chunk-BZUYUGQF.js.map +0 -1
  221. package/dist/chunk-ELXVVBRD.js +0 -2
  222. package/dist/chunk-ELXVVBRD.js.map +0 -1
  223. package/dist/chunk-FLNGPYQ2.js.map +0 -1
  224. package/dist/chunk-FXRIYGSV.js +0 -2
  225. package/dist/chunk-FXRIYGSV.js.map +0 -1
  226. package/dist/chunk-KG63T7OU.js +0 -2
  227. package/dist/chunk-KG63T7OU.js.map +0 -1
  228. package/dist/chunk-M2EKZ2FC.js.map +0 -1
  229. package/dist/chunk-MDDI5GLL.js +0 -2
  230. package/dist/chunk-MDDI5GLL.js.map +0 -1
  231. package/dist/chunk-MKE27NUF.js +0 -2
  232. package/dist/chunk-MKE27NUF.js.map +0 -1
  233. package/dist/chunk-NIGMIGF6.js +0 -2
  234. package/dist/chunk-NIGMIGF6.js.map +0 -1
  235. package/dist/chunk-OA7477F5.js +0 -2
  236. package/dist/chunk-OA7477F5.js.map +0 -1
  237. package/dist/chunk-QIZEGFKJ.js +0 -2
  238. package/dist/chunk-QIZEGFKJ.js.map +0 -1
  239. package/dist/chunk-QP3VWGCS.js +0 -2
  240. package/dist/chunk-QP3VWGCS.js.map +0 -1
  241. package/dist/chunk-SGFXAOTZ.js +0 -2
  242. package/dist/chunk-SGFXAOTZ.js.map +0 -1
  243. package/dist/chunk-STPJXT2A.js +0 -2
  244. package/dist/chunk-STPJXT2A.js.map +0 -1
  245. package/dist/chunk-V2L3UV7M.js +0 -2
  246. package/dist/chunk-V2L3UV7M.js.map +0 -1
  247. /package/dist/{chunk-ZSX2O4ZJ.js.map → chunk-3ALAJXRV.js.map} +0 -0
  248. /package/dist/{chunk-D3YUACHO.js.map → chunk-3TZG2IN7.js.map} +0 -0
  249. /package/dist/{chunk-KDMBZNAE.js.map → chunk-46FT5RHQ.js.map} +0 -0
  250. /package/dist/{chunk-O6YXA5AM.js.map → chunk-4STFNBEP.js.map} +0 -0
  251. /package/dist/{chunk-BGWVXKFX.js.map → chunk-5FYGD7NK.js.map} +0 -0
  252. /package/dist/{chunk-TVPY6KPQ.js.map → chunk-5JLTIH7G.js.map} +0 -0
  253. /package/dist/{chunk-XEUZL7O2.js.map → chunk-65HLULDL.js.map} +0 -0
  254. /package/dist/{chunk-VUY7ZZAD.js.map → chunk-A3K4Q2U6.js.map} +0 -0
  255. /package/dist/{chunk-5VPMZXGU.js.map → chunk-BAWJZ6MA.js.map} +0 -0
  256. /package/dist/{chunk-ALRODBM2.js.map → chunk-BEWGN2JK.js.map} +0 -0
  257. /package/dist/{chunk-3SAV2OEE.js.map → chunk-BHYFPY64.js.map} +0 -0
  258. /package/dist/{chunk-77EBKLW6.js.map → chunk-C74N2AWG.js.map} +0 -0
  259. /package/dist/{chunk-RNULWNWR.js.map → chunk-CULOWG5X.js.map} +0 -0
  260. /package/dist/{chunk-F53TRJ4K.js.map → chunk-FKLQBAJ5.js.map} +0 -0
  261. /package/dist/{chunk-DS5MV4BA.js.map → chunk-GBZXVNGQ.js.map} +0 -0
  262. /package/dist/{chunk-UVA4PFNM.js.map → chunk-HAV7FPRM.js.map} +0 -0
  263. /package/dist/{chunk-Z47XN6ZT.js.map → chunk-IOZFJ65G.js.map} +0 -0
  264. /package/dist/{chunk-7YY7DH4I.js.map → chunk-KCXAXVC5.js.map} +0 -0
  265. /package/dist/{chunk-WUZ5OZ42.js.map → chunk-KY2JSZI3.js.map} +0 -0
  266. /package/dist/{chunk-T4KJKYPC.js.map → chunk-LJUHIEEZ.js.map} +0 -0
  267. /package/dist/{chunk-ASSO5FYG.js.map → chunk-MNSIBSAM.js.map} +0 -0
  268. /package/dist/{chunk-L23UIJDU.js.map → chunk-O37C4LZF.js.map} +0 -0
  269. /package/dist/{chunk-COKMRJQ7.js.map → chunk-OUI554QS.js.map} +0 -0
  270. /package/dist/{chunk-PTHW7GI4.js.map → chunk-QJ5MCAIN.js.map} +0 -0
  271. /package/dist/{chunk-GT6DVQEB.js.map → chunk-QYWA5XM4.js.map} +0 -0
  272. /package/dist/{chunk-NVZHJOA3.js.map → chunk-RNM46ZUE.js.map} +0 -0
  273. /package/dist/{chunk-BP4PHE44.js.map → chunk-RTKKWC4M.js.map} +0 -0
  274. /package/dist/{chunk-NCWPOV3B.js.map → chunk-RVIGZOGF.js.map} +0 -0
  275. /package/dist/{chunk-MUILMUKC.js.map → chunk-S2FD3J22.js.map} +0 -0
  276. /package/dist/{chunk-OL7SFTJV.js.map → chunk-UTWP5CJZ.js.map} +0 -0
  277. /package/dist/{chunk-LD2UDBK4.js.map → chunk-ZP2BE7U6.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/ContractorOnboarding/hooks.tsx"],"sourcesContent":["import {\n CreateContractDocument,\n Employment,\n EmploymentCreateParams,\n} from '@/src/client/types.gen';\nimport {\n getInitialValues,\n parseJSFToValidate,\n} from '@/src/components/form/utils';\nimport { ValidationResult } from '@remoteoss/remote-json-schema-form-kit';\nimport {\n useContractorOnboardingDetailsSchema,\n useCreateContractorContractDocument,\n useGetContractDocumentSignatureSchema,\n usePostManageContractorSubscriptions,\n useContractorSubscriptionSchemaField,\n useGetShowContractDocument,\n useSignContractDocument,\n} from '@/src/flows/ContractorOnboarding/api';\nimport { ContractorOnboardingFlowProps } from '@/src/flows/ContractorOnboarding/types';\nimport {\n STEPS,\n STEPS_WITHOUT_SELECT_COUNTRY,\n} from '@/src/flows/ContractorOnboarding/utils';\nimport {\n useCountriesSchemaField,\n useCreateEmployment,\n useEmployment,\n useJSONSchemaForm,\n} from '@/src/flows/Onboarding/api';\nimport {\n disabledInviteButtonEmploymentStatus,\n reviewStepAllowedEmploymentStatus,\n} from '@/src/flows/Onboarding/utils';\nimport { FlowOptions, JSFModify, JSONSchemaFormType } from '@/src/flows/types';\nimport { Step, useStepState } from '@/src/flows/useStepState';\nimport { mutationToPromise } from '@/src/lib/mutations';\nimport { prettifyFormValues } from '@/src/lib/utils';\nimport { $TSFixMe, JSFFieldset, Meta } from '@/src/types/remoteFlows';\nimport { Fields } from '@remoteoss/json-schema-form-old';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { FieldValues } from 'react-hook-form';\nimport {\n contractorStandardProductIdentifier,\n contractorPlusProductIdentifier,\n} from '@/src/flows/ContractorOnboarding/constants';\n\ntype useContractorOnboardingProps = Omit<\n ContractorOnboardingFlowProps,\n 'render'\n>;\n\nconst stepToFormSchemaMap: Record<\n keyof typeof STEPS,\n JSONSchemaFormType | null\n> = {\n select_country: null,\n basic_information: 'employment_basic_information',\n contract_details: null,\n pricing_plan: null,\n contract_preview: null,\n review: null,\n};\n\nconst jsonSchemaToEmployment: Partial<\n Record<JSONSchemaFormType, keyof Employment>\n> = {\n employment_basic_information: 'basic_information',\n};\n\nexport const useContractorOnboarding = ({\n countryCode,\n externalId,\n employmentId,\n skipSteps,\n options,\n initialValues: onboardingInitialValues,\n}: useContractorOnboardingProps) => {\n const [internalCountryCode, setInternalCountryCode] = useState<string | null>(\n countryCode || null,\n );\n const [internalEmploymentId, setInternalEmploymentId] = useState<\n string | undefined\n >(employmentId);\n const [internalContractDocumentId, setInternalContractDocumentId] = useState<\n string | undefined\n >(undefined);\n const fieldsMetaRef = useRef<{\n select_country: Meta;\n basic_information: Meta;\n contract_details: Meta;\n contract_preview: Meta;\n pricing_plan: Meta;\n }>({\n select_country: {},\n basic_information: {},\n contract_details: {},\n contract_preview: {},\n pricing_plan: {},\n });\n\n const stepsToUse = skipSteps?.includes('select_country')\n ? STEPS_WITHOUT_SELECT_COUNTRY\n : STEPS;\n\n const {\n fieldValues,\n stepState,\n setFieldValues,\n previousStep,\n nextStep,\n goToStep,\n setStepValues,\n } = useStepState(\n stepsToUse as Record<keyof typeof STEPS, Step<keyof typeof STEPS>>,\n );\n\n const {\n data: employment,\n isLoading: isLoadingEmployment,\n refetch: refetchEmployment,\n } = useEmployment(internalEmploymentId);\n\n const { status: employmentStatus } = employment || {};\n\n const isEmploymentReadOnly =\n employmentStatus &&\n reviewStepAllowedEmploymentStatus.includes(employmentStatus);\n\n const canInvite =\n employmentStatus &&\n !disabledInviteButtonEmploymentStatus.includes(employmentStatus);\n\n const invitedStatus: 'invited' | 'not_invited' = useMemo(() => {\n const isInvited = employmentStatus === 'invited';\n\n return isInvited ? 'invited' : 'not_invited';\n }, [employmentStatus]);\n\n const createEmploymentMutation = useCreateEmployment();\n const createContractorContractDocumentMutation =\n useCreateContractorContractDocument();\n const signContractDocumentMutation = useSignContractDocument();\n const manageContractorSubscriptionMutation =\n usePostManageContractorSubscriptions();\n\n const { mutateAsync: createEmploymentMutationAsync } = mutationToPromise(\n createEmploymentMutation,\n );\n\n const { mutateAsync: createContractorContractDocumentMutationAsync } =\n mutationToPromise(createContractorContractDocumentMutation);\n\n const { mutateAsync: signContractDocumentMutationAsync } = mutationToPromise(\n signContractDocumentMutation,\n );\n\n const { mutateAsync: manageContractorSubscriptionMutationAsync } =\n mutationToPromise(manageContractorSubscriptionMutation);\n\n // if the employment is loaded, country code has not been set yet\n // we set the internal country code with the employment country code\n if (employmentId && employment?.country?.code && !internalCountryCode) {\n setInternalCountryCode(employment.country.code);\n }\n\n const { selectCountryForm, isLoading: isLoadingCountries } =\n useCountriesSchemaField({\n jsfModify: options?.jsfModify?.select_country,\n queryOptions: {\n enabled: stepState.currentStep.name === 'select_country',\n },\n });\n\n const {\n form: selectContractorSubscriptionForm,\n isLoading: isLoadingContractorSubscriptions,\n } = useContractorSubscriptionSchemaField(internalEmploymentId as string, {\n jsonSchemaVersion: options?.jsonSchemaVersion,\n queryOptions: {\n enabled: stepState.currentStep.name === 'pricing_plan',\n },\n });\n\n const formType =\n stepToFormSchemaMap[stepState.currentStep.name] ||\n 'contractor_basic_information';\n const employmentKey = jsonSchemaToEmployment[formType] as keyof Employment;\n const serverEmploymentData = (employment?.[employmentKey] || {}) as Record<\n string,\n unknown\n >;\n\n const useJSONSchema = ({\n form,\n options: jsonSchemaOptions = {},\n query = {},\n }: {\n form: JSONSchemaFormType;\n options?: {\n jsfModify?: JSFModify;\n queryOptions?: { enabled?: boolean };\n jsonSchemaVersion?: FlowOptions['jsonSchemaVersion'];\n };\n query?: Record<string, string>;\n }) => {\n const hasUserEnteredAnyValues = Object.keys(fieldValues).length > 0;\n // when you write on the fields, the values are stored in the fieldValues state\n // when values are stored in the stepState is when the user has navigated to the step\n // and then we have the values from the server and the onboardingInitialValues that the user can inject,\n const mergedFormValues = hasUserEnteredAnyValues\n ? {\n ...onboardingInitialValues,\n ...stepState.values?.[stepState.currentStep.name], // Restore values for the current step\n ...fieldValues,\n }\n : {\n ...onboardingInitialValues,\n ...serverEmploymentData,\n };\n\n return useJSONSchemaForm({\n countryCode: internalCountryCode as string,\n form: form,\n fieldValues: mergedFormValues,\n query,\n options: {\n ...jsonSchemaOptions,\n queryOptions: {\n enabled: jsonSchemaOptions.queryOptions?.enabled ?? true,\n },\n },\n });\n };\n\n const isBasicInformationDetailsEnabled = Boolean(\n internalCountryCode &&\n (stepState.currentStep.name === 'basic_information' ||\n Boolean(employmentId)),\n );\n\n const isContractorOnboardingDetailsEnabled = Boolean(\n internalCountryCode &&\n (stepState.currentStep.name === 'contract_details' ||\n Boolean(employmentId)),\n );\n\n const {\n data: basicInformationForm,\n isLoading: isLoadingBasicInformationForm,\n } = useJSONSchema({\n form: 'contractor_basic_information',\n options: {\n jsfModify: options?.jsfModify?.basic_information,\n queryOptions: {\n enabled: isBasicInformationDetailsEnabled,\n },\n jsonSchemaVersion: options?.jsonSchemaVersion,\n },\n });\n\n const {\n data: contractorOnboardingDetailsForm,\n isLoading: isLoadingContractorOnboardingDetailsForm,\n } = useContractorOnboardingDetailsSchema({\n countryCode: internalCountryCode as string,\n fieldValues: fieldValues,\n options: {\n queryOptions: {\n enabled: isContractorOnboardingDetailsEnabled,\n },\n jsfModify: options?.jsfModify?.contract_details,\n jsonSchemaVersion: options?.jsonSchemaVersion,\n },\n });\n\n const { data: signatureSchemaForm } = useGetContractDocumentSignatureSchema({\n fieldValues: fieldValues,\n options: {\n queryOptions: {\n enabled: stepState.currentStep.name === 'contract_preview',\n },\n },\n });\n const { data: documentPreviewPdf, isLoading: isLoadingDocumentPreviewForm } =\n useGetShowContractDocument({\n employmentId: internalEmploymentId as string,\n contractDocumentId: internalContractDocumentId as string,\n options: {\n queryOptions: {\n enabled: Boolean(internalContractDocumentId),\n },\n },\n });\n\n const stepFields: Record<keyof typeof STEPS, Fields> = useMemo(\n () => ({\n select_country: selectCountryForm?.fields || [],\n basic_information: basicInformationForm?.fields || [],\n pricing_plan: selectContractorSubscriptionForm?.fields || [],\n contract_details: contractorOnboardingDetailsForm?.fields || [],\n contract_preview: signatureSchemaForm?.fields || [],\n review: [],\n }),\n [\n selectCountryForm?.fields,\n basicInformationForm?.fields,\n selectContractorSubscriptionForm?.fields,\n contractorOnboardingDetailsForm?.fields,\n signatureSchemaForm?.fields,\n ],\n );\n\n const stepFieldsWithFlatFieldsets: Record<\n keyof typeof STEPS,\n JSFFieldset | null | undefined\n > = {\n select_country: null,\n basic_information: basicInformationForm?.meta['x-jsf-fieldsets'],\n pricing_plan: null,\n contract_details: contractorOnboardingDetailsForm?.meta['x-jsf-fieldsets'],\n contract_preview: null,\n review: null,\n };\n\n const {\n country,\n basic_information: employmentBasicInformation = {},\n contract_details: employmentContractDetails = {},\n } = employment || {};\n\n const employmentCountryCode = country?.code;\n\n const selectCountryInitialValues = useMemo(\n () =>\n getInitialValues(stepFields.select_country, {\n country: internalCountryCode || employmentCountryCode || '',\n }),\n [stepFields.select_country, internalCountryCode, employmentCountryCode],\n );\n\n const basicInformationInitialValues = useMemo(() => {\n const initialValues = {\n ...onboardingInitialValues,\n ...employmentBasicInformation,\n };\n\n return getInitialValues(stepFields.basic_information, initialValues);\n }, [\n stepFields.basic_information,\n employmentBasicInformation,\n onboardingInitialValues,\n ]);\n\n const contractDetailsInitialValues = useMemo(() => {\n const initialValues = {\n ...onboardingInitialValues,\n ...employmentContractDetails,\n };\n\n return getInitialValues(stepFields.contract_details, initialValues);\n }, [\n stepFields.contract_details,\n employmentContractDetails,\n onboardingInitialValues,\n ]);\n\n const contractPreviewInitialValues = useMemo(() => {\n // TODO: TBD not sure if contract preview needs to be populated with anything\n const initialValues = {\n ...onboardingInitialValues,\n ...employmentContractDetails,\n };\n\n return getInitialValues(stepFields.contract_preview, initialValues);\n }, [\n stepFields.contract_preview,\n employmentContractDetails,\n onboardingInitialValues,\n ]);\n\n const pricingPlanInitialValues = useMemo(() => {\n const initialValues = {\n ...onboardingInitialValues,\n ...employmentContractDetails,\n };\n\n return getInitialValues(\n stepFields.pricing_plan,\n (initialValues?.pricing_plan ?? {}) as Record<string, unknown>,\n );\n }, [\n stepFields.pricing_plan,\n employmentContractDetails,\n onboardingInitialValues,\n ]);\n\n const initialValues = useMemo(() => {\n return {\n select_country: selectCountryInitialValues,\n basic_information: basicInformationInitialValues,\n contract_details: contractDetailsInitialValues,\n contract_preview: contractPreviewInitialValues,\n pricing_plan: pricingPlanInitialValues,\n };\n }, [\n selectCountryInitialValues,\n basicInformationInitialValues,\n contractDetailsInitialValues,\n contractPreviewInitialValues,\n pricingPlanInitialValues,\n ]);\n\n const isNavigatingToReview = useMemo(() => {\n const shouldHandleReadOnlyEmployment = Boolean(\n employmentId &&\n isEmploymentReadOnly &&\n stepState.currentStep.name !== 'review',\n );\n\n return Boolean(\n shouldHandleReadOnlyEmployment &&\n !isLoadingEmployment &&\n stepFields.basic_information.length > 0 &&\n stepFields.contract_details.length > 0,\n );\n }, [\n employmentId,\n isEmploymentReadOnly,\n isLoadingEmployment,\n stepFields.basic_information.length,\n stepFields.contract_details.length,\n stepState.currentStep.name,\n ]);\n\n useEffect(() => {\n if (isNavigatingToReview) {\n fieldsMetaRef.current = {\n select_country: prettifyFormValues(\n selectCountryInitialValues,\n stepFields.select_country,\n ),\n basic_information: prettifyFormValues(\n basicInformationInitialValues,\n stepFields.basic_information,\n ),\n contract_details: prettifyFormValues(\n contractDetailsInitialValues,\n stepFields.contract_details,\n ),\n // TODO: TBD\n contract_preview: {},\n // TODO: TBD\n pricing_plan: {},\n };\n\n setStepValues({\n select_country: selectCountryInitialValues,\n basic_information: basicInformationInitialValues,\n contract_details: contractDetailsInitialValues,\n contract_preview: {},\n pricing_plan: {},\n review: {},\n });\n goToStep('review');\n }\n }, [\n isNavigatingToReview,\n goToStep,\n selectCountryInitialValues,\n basicInformationInitialValues,\n contractDetailsInitialValues,\n setStepValues,\n stepFields.select_country,\n stepFields.basic_information,\n stepFields.contract_details,\n ]);\n\n const goTo = (step: keyof typeof STEPS) => {\n goToStep(step);\n };\n\n const parseFormValues = async (values: FieldValues) => {\n if (selectCountryForm && stepState.currentStep.name === 'select_country') {\n return values;\n }\n\n if (\n basicInformationForm &&\n stepState.currentStep.name === 'basic_information'\n ) {\n return await parseJSFToValidate(values, basicInformationForm?.fields, {\n isPartialValidation: false,\n });\n }\n\n if (\n contractorOnboardingDetailsForm &&\n stepState.currentStep.name === 'contract_details'\n ) {\n return await parseJSFToValidate(\n values,\n contractorOnboardingDetailsForm?.fields,\n {\n isPartialValidation: false,\n },\n );\n }\n\n if (\n signatureSchemaForm &&\n stepState.currentStep.name === 'contract_preview'\n ) {\n return await parseJSFToValidate(values, signatureSchemaForm?.fields, {\n isPartialValidation: false,\n });\n }\n\n if (stepState.currentStep.name === 'pricing_plan') {\n return values;\n }\n\n return {};\n };\n\n async function onSubmit(values: FieldValues) {\n const currentStepName = stepState.currentStep.name;\n if (currentStepName in fieldsMetaRef.current) {\n fieldsMetaRef.current[\n currentStepName as keyof typeof fieldsMetaRef.current\n ] = prettifyFormValues(values, stepFields[currentStepName]);\n }\n const parsedValues = await parseFormValues(values);\n switch (stepState.currentStep.name) {\n case 'select_country': {\n setInternalCountryCode(parsedValues.country);\n return Promise.resolve({ data: { countryCode: parsedValues.country } });\n }\n case 'basic_information': {\n const isEmploymentNotLoaded =\n !internalEmploymentId && internalCountryCode;\n const hasChangedCountry =\n internalEmploymentId &&\n internalCountryCode &&\n employment?.country &&\n employment?.country.code !== internalCountryCode;\n\n if (isEmploymentNotLoaded || hasChangedCountry) {\n const payload: EmploymentCreateParams = {\n basic_information: parsedValues,\n type: 'contractor',\n country_code: internalCountryCode,\n external_id: externalId,\n };\n try {\n const response = await createEmploymentMutationAsync(payload);\n // @ts-expect-error the types from the response are not matching\n const employmentId = response.data?.data?.employment?.id;\n setInternalEmploymentId(employmentId);\n\n return response;\n } catch (error) {\n console.error('Error creating onboarding:', error);\n throw error;\n }\n } else if (internalEmploymentId) {\n // TODO: Provisional it seems you cannot update a contractor employment\n return Promise.resolve({\n data: { employmentId: internalEmploymentId },\n });\n }\n\n return;\n }\n case 'contract_details': {\n const payload: CreateContractDocument = {\n contract_document: parsedValues,\n };\n const response: $TSFixMe =\n await createContractorContractDocumentMutationAsync({\n employmentId: internalEmploymentId as string,\n payload,\n });\n\n const contractDocumentId = response.data?.data?.contract_document?.id;\n setInternalContractDocumentId(contractDocumentId);\n return response;\n }\n\n case 'contract_preview': {\n return signContractDocumentMutationAsync({\n employmentId: internalEmploymentId as string,\n contractDocumentId: internalContractDocumentId as string,\n payload: {\n signature: values.signature,\n },\n });\n }\n case 'pricing_plan': {\n if (values.subscription == contractorStandardProductIdentifier) {\n return manageContractorSubscriptionMutationAsync({\n employmentId: internalEmploymentId as string,\n payload: {\n operation: 'downgrade',\n },\n });\n } else if (values.subscription == contractorPlusProductIdentifier) {\n return manageContractorSubscriptionMutationAsync({\n employmentId: internalEmploymentId as string,\n payload: {\n operation: 'upgrade',\n },\n });\n }\n return Promise.reject({ error: 'invalid selection' });\n }\n\n default: {\n throw new Error('Invalid step state');\n }\n }\n }\n\n const isLoading =\n isLoadingCountries ||\n isLoadingBasicInformationForm ||\n isLoadingEmployment ||\n isLoadingContractorOnboardingDetailsForm ||\n isLoadingContractorSubscriptions ||\n isLoadingDocumentPreviewForm;\n\n return {\n /**\n * Loading state indicating if the flow is loading data\n */\n isLoading,\n\n /**\n * Current state of the form fields for the current step.\n */\n fieldValues,\n\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState,\n\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: setFieldValues,\n\n /**\n * Function to handle going back to the previous step\n * @returns {void}\n */\n back: previousStep,\n\n /**\n * Function to handle going to the next step\n * @returns {void}\n */\n next: nextStep,\n\n /**\n * Function to handle going to a specific step\n * @param step The step to go to.\n * @returns {void}\n */\n goTo: goTo,\n\n /**\n * Function to handle form submission\n * @param values - Form values to submit\n * @returns Promise resolving to the mutation result\n */\n onSubmit,\n\n /**\n * Array of form fields from the onboarding schema\n */\n fields: stepFields[stepState.currentStep.name],\n\n /**\n * Fields metadata for each step\n */\n meta: {\n fields: fieldsMetaRef.current,\n fieldsets: stepFieldsWithFlatFieldsets[stepState.currentStep.name],\n },\n\n /**\n * Function to parse form values before submission\n * @param values - Form values to parse\n * @returns Parsed form values\n */\n parseFormValues,\n\n /**\n * Function to validate form values against the onboarding schema\n * @param values - Form values to validate\n * @returns Validation result or null if no schema is available\n */\n handleValidation: async (\n values: FieldValues,\n ): Promise<ValidationResult | null> => {\n if (stepState.currentStep.name === 'select_country') {\n return selectCountryForm.handleValidation(values);\n }\n\n if (\n basicInformationForm &&\n stepState.currentStep.name === 'basic_information'\n ) {\n const parsedValues = await parseJSFToValidate(\n values,\n basicInformationForm?.fields,\n { isPartialValidation: false },\n );\n return basicInformationForm?.handleValidation(parsedValues);\n }\n\n if (\n contractorOnboardingDetailsForm &&\n stepState.currentStep.name === 'contract_details'\n ) {\n const parsedValues = await parseJSFToValidate(\n values,\n contractorOnboardingDetailsForm?.fields,\n { isPartialValidation: false },\n );\n return contractorOnboardingDetailsForm?.handleValidation(parsedValues);\n }\n\n if (\n signatureSchemaForm &&\n stepState.currentStep.name === 'contract_preview'\n ) {\n const parsedValues = await parseJSFToValidate(\n values,\n signatureSchemaForm?.fields,\n { isPartialValidation: false },\n );\n return signatureSchemaForm?.handleValidation(parsedValues);\n }\n\n if (stepState.currentStep.name === 'pricing_plan') {\n // TODO: TBD\n return {\n formErrors: {},\n };\n }\n\n return null;\n },\n\n /**\n * Initial form values\n */\n initialValues,\n\n /**\n * Employment id\n */\n employmentId: internalEmploymentId,\n\n /**\n * Function to refetch the employment data\n * @returns {void}\n */\n refetchEmployment: refetchEmployment,\n\n /**\n * Loading state indicating if the onboarding mutation is in progress\n */\n isSubmitting:\n createEmploymentMutation.isPending ||\n createContractorContractDocumentMutation.isPending ||\n signContractDocumentMutation.isPending,\n\n /**\n * Document preview PDF data\n */\n documentPreviewPdf,\n\n /**\n * let's the user know if the company can invite employees\n * @returns {boolean}\n */\n canInvite,\n\n /**\n * let's the user know that the employment cannot be edited, happens when employment.status is invited\n * @returns {boolean}\n */\n isEmploymentReadOnly,\n /**\n * let's the user know if the employment is invited or not\n * @returns {'invited' | 'not_invited'}\n */\n invitedStatus,\n\n /**\n * Employment data\n * @returns {Employment}\n */\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C","names":["useEffect","useMemo","useRef","useState","stepToFormSchemaMap","jsonSchemaToEmployment","useContractorOnboarding","__name","countryCode","externalId","employmentId","skipSteps","options","onboardingInitialValues","internalCountryCode","setInternalCountryCode","useState","internalEmploymentId","setInternalEmploymentId","internalContractDocumentId","setInternalContractDocumentId","fieldsMetaRef","useRef","stepsToUse","STEPS_WITHOUT_SELECT_COUNTRY","STEPS","fieldValues","stepState","setFieldValues","previousStep","nextStep","goToStep","setStepValues","useStepState","employment","isLoadingEmployment","refetchEmployment","useEmployment","employmentStatus","isEmploymentReadOnly","reviewStepAllowedEmploymentStatus","canInvite","disabledInviteButtonEmploymentStatus","invitedStatus","useMemo","createEmploymentMutation","useCreateEmployment","createContractorContractDocumentMutation","useCreateContractorContractDocument","signContractDocumentMutation","useSignContractDocument","manageContractorSubscriptionMutation","usePostManageContractorSubscriptions","createEmploymentMutationAsync","mutationToPromise","createContractorContractDocumentMutationAsync","signContractDocumentMutationAsync","manageContractorSubscriptionMutationAsync","selectCountryForm","isLoadingCountries","useCountriesSchemaField","selectContractorSubscriptionForm","isLoadingContractorSubscriptions","useContractorSubscriptionSchemaField","formType","employmentKey","serverEmploymentData","useJSONSchema","form","jsonSchemaOptions","query","mergedFormValues","useJSONSchemaForm","isBasicInformationDetailsEnabled","isContractorOnboardingDetailsEnabled","basicInformationForm","isLoadingBasicInformationForm","contractorOnboardingDetailsForm","isLoadingContractorOnboardingDetailsForm","useContractorOnboardingDetailsSchema","signatureSchemaForm","useGetContractDocumentSignatureSchema","documentPreviewPdf","isLoadingDocumentPreviewForm","useGetShowContractDocument","stepFields","stepFieldsWithFlatFieldsets","country","employmentBasicInformation","employmentContractDetails","employmentCountryCode","selectCountryInitialValues","getInitialValues","basicInformationInitialValues","initialValues","contractDetailsInitialValues","contractPreviewInitialValues","pricingPlanInitialValues","isNavigatingToReview","useEffect","prettifyFormValues","goTo","step","parseFormValues","values","parseJSFToValidate","onSubmit","currentStepName","parsedValues","isEmploymentNotLoaded","hasChangedCountry","payload","response","error","contractDocumentId","contractorStandardProductIdentifier","contractorPlusProductIdentifier"]}
@@ -0,0 +1,2 @@
1
+ import{l as V}from"./chunk-23OYALRY.js";import{a as F}from"./chunk-KGKDSOER.js";import{a as X}from"./chunk-6GTRAHWJ.js";import{b as K}from"./chunk-KQPDXXG3.js";import{c as J,l as U}from"./chunk-66N57DKF.js";import{a as t,b as d,c as ke}from"./chunk-P37U34EQ.js";var L=d((It,z)=>{"use strict";function we(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}t(we,"isObject");z.exports=we});var Y=d((Mt,Q)=>{"use strict";var Fe=typeof global=="object"&&global&&global.Object===Object&&global;Q.exports=Fe});var D=d((Pt,Z)=>{"use strict";var Le=Y(),De=typeof self=="object"&&self&&self.Object===Object&&self,Ae=Le||De||Function("return this")();Z.exports=Ae});var te=d((_t,ee)=>{"use strict";var Ne=D(),We=t(function(){return Ne.Date.now()},"now");ee.exports=We});var re=d((wt,ne)=>{"use strict";var Be=/\s/;function He(e){for(var n=e.length;n--&&Be.test(e.charAt(n)););return n}t(He,"trimmedEndIndex");ne.exports=He});var ie=d((Lt,oe)=>{"use strict";var Ge=re(),Je=/^\s+/;function Ke(e){return e&&e.slice(0,Ge(e)+1).replace(Je,"")}t(Ke,"baseTrim");oe.exports=Ke});var A=d((At,se)=>{"use strict";var Ue=D(),Ve=Ue.Symbol;se.exports=Ve});var fe=d((Nt,ue)=>{"use strict";var ae=A(),ce=Object.prototype,Xe=ce.hasOwnProperty,ze=ce.toString,O=ae?ae.toStringTag:void 0;function Qe(e){var n=Xe.call(e,O),r=e[O];try{e[O]=void 0;var i=!0}catch{}var a=ze.call(e);return i&&(n?e[O]=r:delete e[O]),a}t(Qe,"getRawTag");ue.exports=Qe});var le=d((Bt,de)=>{"use strict";var Ye=Object.prototype,Ze=Ye.toString;function et(e){return Ze.call(e)}t(et,"objectToString");de.exports=et});var be=d((Gt,pe)=>{"use strict";var me=A(),tt=fe(),nt=le(),rt="[object Null]",ot="[object Undefined]",ge=me?me.toStringTag:void 0;function it(e){return e==null?e===void 0?ot:rt:ge&&ge in Object(e)?tt(e):nt(e)}t(it,"baseGetTag");pe.exports=it});var ye=d((Kt,ve)=>{"use strict";function st(e){return e!=null&&typeof e=="object"}t(st,"isObjectLike");ve.exports=st});var xe=d((Vt,he)=>{"use strict";var at=be(),ct=ye(),ut="[object Symbol]";function ft(e){return typeof e=="symbol"||ct(e)&&at(e)==ut}t(ft,"isSymbol");he.exports=ft});var je=d((zt,Se)=>{"use strict";var dt=ie(),Te=L(),lt=xe(),Ce=NaN,mt=/^[-+]0x[0-9a-f]+$/i,gt=/^0b[01]+$/i,pt=/^0o[0-7]+$/i,bt=parseInt;function vt(e){if(typeof e=="number")return e;if(lt(e))return Ce;if(Te(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=Te(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=dt(e);var r=gt.test(e);return r||pt.test(e)?bt(e.slice(2),r?2:8):mt.test(e)?Ce:+e}t(vt,"toNumber");Se.exports=vt});var Re=d((Yt,Ee)=>{"use strict";var yt=L(),N=te(),Oe=je(),ht="Expected a function",xt=Math.max,Tt=Math.min;function Ct(e,n,r){var i,a,p,l,c,s,m=0,E=!1,u=!1,h=!0;if(typeof e!="function")throw new TypeError(ht);n=Oe(n)||0,yt(r)&&(E=!!r.leading,u="maxWait"in r,p=u?xt(Oe(r.maxWait)||0,n):p,h="trailing"in r?!!r.trailing:h);function x(o){var g=i,y=a;return i=a=void 0,m=o,l=e.apply(y,g),l}t(x,"invokeFunc");function R(o){return m=o,c=setTimeout(v,n),E?x(o):l}t(R,"leadingEdge");function C(o){var g=o-s,y=o-m,M=n-g;return u?Tt(M,p-y):M}t(C,"remainingWait");function q(o){var g=o-s,y=o-m;return s===void 0||g>=n||g<0||u&&y>=p}t(q,"shouldInvoke");function v(){var o=N();if(q(o))return b(o);c=setTimeout(v,C(o))}t(v,"timerExpired");function b(o){return c=void 0,h&&i?x(o):(i=a=void 0,l)}t(b,"trailingEdge");function I(){c!==void 0&&clearTimeout(c),m=0,i=s=a=c=void 0}t(I,"cancel");function $(){return c===void 0?l:b(N())}t($,"flush");function S(){var o=N(),g=q(o);if(i=arguments,a=this,s=o,g){if(c===void 0)return R(s);if(u)return clearTimeout(c),c=setTimeout(v,n),x(s)}return c===void 0&&(c=setTimeout(v,n)),l}return t(S,"debounced"),S.cancel=I,S.flush=$,S}t(Ct,"debounce");Ee.exports=Ct});import{useState as Ot,useCallback as Et,useEffect as $e,useRef as Me}from"react";var Ie=ke(Re(),1);import{useCallback as St,useEffect as jt,useRef as qe}from"react";function W(e,n){let r=qe(e);jt(()=>{r.current=e},[e]);let i=qe((0,Ie.default)(a=>{r.current(a)},n)).current;return St(a=>{i(a)},[i])}t(W,"useDebounce");import{Fragment as qt,jsx as T,jsxs as Pe}from"react/jsx-runtime";var Rt=t(({description:e,showConversion:n,targetCurrency:r,className:i,onClick:a})=>{let{components:p}=K(),l=n?`Hide ${r} conversion`:`Show ${r} conversion`,c=p?.button||X;return Pe("span",{className:i,children:[T(U,{as:"span",children:e})," ",T(c,{className:`${i.replace("-description","-button")}`,"data-type":"inline",onClick:a,children:l})]})},"DescriptionWithConversion"),mn=t(({sourceCurrency:e,targetCurrency:n,mainFieldName:r,conversionFieldName:i,conversionProperties:a,classNamePrefix:p,description:l,conversionType:c="spread",...s})=>{let[m,E]=Ot(!1),{setValue:u,watch:h}=J(),x=h(r||s.name),R=Me(!0),C=Me(new Map),q=e&&n&&e!==n,{mutateAsync:v}=V({type:c}),b=`${s.name}_converted`;$e(()=>{u(b,r||s.name)},[u,r,s.name,b]),$e(()=>{if(R.current){R.current=!1;return}u(i,"")},[e,i,u]);let I=Et(async(f,j,k,B)=>{let w=Number(f);if(!f||isNaN(w)||w<=0)return;let H=`${j}_${k}_${f}`,G=C.current.get(H);if(G){u(B,G.targetAmount);return}try{let P=await v({source_currency:j,target_currency:k,amount:w});if(P.data?.data?.conversion_data?.target_amount){let _=P.data.data.conversion_data.target_amount;if(_){u(B,_?.toString()),C.current.set(H,{targetAmount:_.toString()});let _e=`${k}_${j}_${_}`;C.current.set(_e,{targetAmount:f.toString()})}}}catch(P){console.error("Error converting currency:",P)}},[v,u]),$=W(f=>I(f,e,n,i),500),S=W(f=>I(f,n,e,r||s.name),500),o=t(f=>{u(b,r||s.name),m&&$(f.target.value)},"handleMainFieldChange"),g=t(f=>{u(b,i),S(f.target.value)},"handleConversionFieldChange"),y=t(f=>{f.preventDefault(),E(j=>!j),!m&&x&&$(x)},"toggleConversion"),M=q?T(Rt,{targetCurrency:n,description:l,showConversion:m,className:`${p}-description`,onClick:y}):l;return Pe(qt,{children:[T(F,{...s,name:r||s.name,additionalProps:{currency:e},description:M,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$",maxLength:15,onChange:o}),m&&T(F,{additionalProps:{currency:n},name:i,label:a?.label||"Conversion",description:a?.description,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$",maxLength:15,onChange:g}),T("input",{type:"hidden",name:b,value:h(b)||r||s.name})]})},"CurrencyConversionField");export{mn as a};
2
+ //# sourceMappingURL=chunk-E25DZ75Z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../node_modules/lodash/isObject.js","../node_modules/lodash/_freeGlobal.js","../node_modules/lodash/_root.js","../node_modules/lodash/now.js","../node_modules/lodash/_trimmedEndIndex.js","../node_modules/lodash/_baseTrim.js","../node_modules/lodash/_Symbol.js","../node_modules/lodash/_getRawTag.js","../node_modules/lodash/_objectToString.js","../node_modules/lodash/_baseGetTag.js","../node_modules/lodash/isObjectLike.js","../node_modules/lodash/isSymbol.js","../node_modules/lodash/toNumber.js","../node_modules/lodash/debounce.js","../src/components/form/fields/CurrencyConversionField.tsx","../src/common/hooks.ts"],"sourcesContent":["/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","import { ReactNode, useState, useCallback, useEffect, useRef } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { TextField } from '@/src/components/form/fields/TextField';\nimport { useConvertCurrency } from '@/src/flows/Onboarding/api';\nimport { JSFField } from '@/src/types/remoteFlows';\nimport { useFormFields } from '@/src/context';\nimport { useDebounce } from '@/src/common/hooks';\nimport { FormDescription } from '@/src/components/ui/form';\nimport { ButtonDefault } from '@/src/components/form/fields/default/ButtonDefault';\n\ntype DescriptionWithConversionProps = {\n description: ReactNode;\n showConversion: boolean;\n targetCurrency: string;\n className: string;\n onClick: (evt: React.MouseEvent<HTMLButtonElement>) => void;\n};\n\nconst DescriptionWithConversion = ({\n description,\n showConversion,\n targetCurrency,\n className,\n onClick,\n}: DescriptionWithConversionProps) => {\n const { components } = useFormFields();\n const label = showConversion\n ? `Hide ${targetCurrency} conversion`\n : `Show ${targetCurrency} conversion`;\n\n const CustomButton = components?.button || ButtonDefault;\n return (\n <span className={className}>\n <FormDescription as='span'>{description}</FormDescription>{' '}\n <CustomButton\n className={`${className.replace('-description', '-button')}`}\n data-type='inline'\n onClick={onClick}\n >\n {label}\n </CustomButton>\n </span>\n );\n};\n\nexport type CurrencyConversionFieldProps = JSFField & {\n sourceCurrency: string;\n targetCurrency: string;\n mainFieldName?: string;\n conversionFieldName: string;\n conversionProperties?: {\n label?: string;\n description?: ReactNode;\n };\n useProxy?: boolean;\n classNamePrefix: string;\n conversionType?: 'spread' | 'no_spread';\n};\n\nexport const CurrencyConversionField = ({\n sourceCurrency,\n targetCurrency,\n mainFieldName,\n conversionFieldName,\n conversionProperties,\n classNamePrefix,\n description,\n conversionType = 'spread',\n ...props\n}: CurrencyConversionFieldProps) => {\n const [showConversion, setShowConversion] = useState(false);\n const { setValue, watch } = useFormContext();\n const fieldValue = watch(mainFieldName || props.name);\n const isFirstRender = useRef(true);\n\n const conversionCache = useRef<Map<string, { targetAmount: string }>>(\n new Map(),\n );\n\n const canShowConversion =\n sourceCurrency && targetCurrency && sourceCurrency !== targetCurrency;\n\n const { mutateAsync: convertCurrency } = useConvertCurrency({\n type: conversionType,\n });\n\n // we keep track of the last input the user used, so we can make sure\n // we keep consistent currency rates\n const lastInputFieldName = `${props.name}_converted`;\n useEffect(() => {\n setValue(lastInputFieldName, mainFieldName || props.name);\n }, [setValue, mainFieldName, props.name, lastInputFieldName]);\n\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false;\n return;\n }\n\n // when source currency changes, reset the conversion field\n setValue(conversionFieldName, '');\n }, [sourceCurrency, conversionFieldName, setValue]);\n\n const convertCurrencyCallback = useCallback(\n async (\n value: string,\n fromCurrency: string,\n toCurrency: string,\n targetField: string,\n ) => {\n const amount = Number(value);\n\n if (!value || isNaN(amount) || amount <= 0) return;\n\n const cacheKey = `${fromCurrency}_${toCurrency}_${value}`;\n const cached = conversionCache.current.get(cacheKey);\n\n if (cached) {\n setValue(targetField, cached.targetAmount);\n return;\n }\n\n try {\n const response = await convertCurrency({\n source_currency: fromCurrency,\n target_currency: toCurrency,\n amount,\n });\n if (response.data?.data?.conversion_data?.target_amount) {\n const amount = response.data.data.conversion_data.target_amount;\n if (amount) {\n setValue(targetField, amount?.toString());\n // Cache both directions\n conversionCache.current.set(cacheKey, {\n targetAmount: amount.toString(),\n });\n const reverseKey = `${toCurrency}_${fromCurrency}_${amount}`;\n conversionCache.current.set(reverseKey, {\n targetAmount: value.toString(),\n });\n }\n }\n } catch (error) {\n console.error('Error converting currency:', error);\n }\n },\n [convertCurrency, setValue],\n );\n\n const debouncedConvertCurrency = useDebounce(\n (value: string) =>\n convertCurrencyCallback(\n value,\n sourceCurrency,\n targetCurrency,\n conversionFieldName,\n ),\n 500,\n );\n const debouncedConvertCurrencyReverse = useDebounce(\n (value: string) =>\n convertCurrencyCallback(\n value,\n targetCurrency,\n sourceCurrency,\n mainFieldName || props.name,\n ),\n 500,\n );\n\n const handleMainFieldChange = (evt: React.ChangeEvent<HTMLInputElement>) => {\n setValue(lastInputFieldName, mainFieldName || props.name);\n if (showConversion) {\n debouncedConvertCurrency(evt.target.value);\n }\n };\n\n const handleConversionFieldChange = (\n evt: React.ChangeEvent<HTMLInputElement>,\n ) => {\n setValue(lastInputFieldName, conversionFieldName);\n debouncedConvertCurrencyReverse(evt.target.value);\n };\n\n const toggleConversion = (evt: React.MouseEvent<HTMLButtonElement>) => {\n evt.preventDefault();\n setShowConversion((prev) => !prev);\n\n if (!showConversion && fieldValue) {\n debouncedConvertCurrency(fieldValue);\n }\n };\n\n const extraDescription = canShowConversion ? (\n <DescriptionWithConversion\n targetCurrency={targetCurrency}\n description={description}\n showConversion={showConversion}\n className={`${classNamePrefix}-description`}\n onClick={toggleConversion}\n />\n ) : (\n description\n );\n\n return (\n <>\n <TextField\n {...props}\n name={mainFieldName || props.name}\n additionalProps={{ currency: sourceCurrency }}\n description={extraDescription}\n type='text'\n inputMode='decimal'\n pattern='^[0-9.]*$'\n maxLength={15}\n onChange={handleMainFieldChange}\n />\n {showConversion && (\n <TextField\n additionalProps={{ currency: targetCurrency }}\n name={conversionFieldName}\n label={conversionProperties?.label || 'Conversion'}\n description={conversionProperties?.description}\n type='text'\n inputMode='decimal'\n pattern='^[0-9.]*$'\n maxLength={15}\n onChange={handleConversionFieldChange}\n />\n )}\n <input\n type='hidden'\n name={lastInputFieldName}\n value={watch(lastInputFieldName) || mainFieldName || props.name}\n />\n </>\n );\n};\n","import { useCallback, useEffect, useRef } from 'react';\nimport debounce from 'lodash/debounce';\n\nexport function useDebounce(\n callback: (value: string) => Promise<void>,\n delay: number,\n) {\n const callbackRef = useRef(callback);\n\n useEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n\n const debouncedFn = useRef(\n debounce((value: string) => {\n callbackRef.current(value);\n }, delay),\n ).current;\n\n return useCallback(\n (value: string) => {\n debouncedFn(value);\n },\n [debouncedFn],\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iBK,EAAM,IAAI,EACpDjB,GACF4C,EAAyBI,EAAI,OAAO,KAAK,CAE7C,EAL8B,yBAOxBC,EAA8BnD,EAClCkD,GACG,CACH5B,EAASU,EAAoBjB,CAAmB,EAChDiC,EAAgCE,EAAI,OAAO,KAAK,CAClD,EALoC,+BAO9BE,EAAmBpD,EAACkD,GAA6C,CACrEA,EAAI,eAAe,EACnB9B,EAAmBiC,GAAS,CAACA,CAAI,EAE7B,CAACnD,GAAkBuB,GACrBqB,EAAyBrB,CAAU,CAEvC,EAPyB,oBASnB6B,EAAmBzB,EACvBhC,EAACE,GAAA,CACC,eAAgBI,EAChB,YAAaF,EACb,eAAgBC,EAChB,UAAW,GAAGe,CAAe,eAC7B,QAASmC,EACX,EAEAnD,EAGF,OACEH,GAAAF,GAAA,CACE,UAAAC,EAAC0D,EAAA,CACE,GAAGpC,EACJ,KAAML,GAAiBK,EAAM,KAC7B,gBAAiB,CAAE,SAAUN,CAAe,EAC5C,YAAayC,EACb,KAAK,OACL,UAAU,UACV,QAAQ,YACR,UAAW,GACX,SAAUL,EACZ,EACC/C,GACCL,EAAC0D,EAAA,CACC,gBAAiB,CAAE,SAAUpD,CAAe,EAC5C,KAAMY,EACN,MAAOC,GAAsB,OAAS,aACtC,YAAaA,GAAsB,YACnC,KAAK,OACL,UAAU,UACV,QAAQ,YACR,UAAW,GACX,SAAUmC,EACZ,EAEFtD,EAAC,SACC,KAAK,SACL,KAAMmC,EACN,MAAOT,EAAMS,CAAkB,GAAKlB,GAAiBK,EAAM,KAC7D,GACF,CAEJ,EAnLuC","names":["require_isObject","__commonJSMin","exports","module","isObject","value","type","__name","require_freeGlobal","__commonJSMin","exports","module","freeGlobal","require_root","__commonJSMin","exports","module","freeGlobal","freeSelf","root","require_now","__commonJSMin","exports","module","root","now","__name","require_trimmedEndIndex","__commonJSMin","exports","module","reWhitespace","trimmedEndIndex","string","index","__name","require_baseTrim","__commonJSMin","exports","module","trimmedEndIndex","reTrimStart","baseTrim","string","__name","require_Symbol","__commonJSMin","exports","module","root","Symbol","require_getRawTag","__commonJSMin","exports","module","Symbol","objectProto","hasOwnProperty","nativeObjectToString","symToStringTag","getRawTag","value","isOwn","tag","unmasked","result","__name","require_objectToString","__commonJSMin","exports","module","objectProto","nativeObjectToString","objectToString","value","__name","require_baseGetTag","__commonJSMin","exports","module","Symbol","getRawTag","objectToString","nullTag","undefinedTag","symToStringTag","baseGetTag","value","__name","require_isObjectLike","__commonJSMin","exports","module","isObjectLike","value","__name","require_isSymbol","__commonJSMin","exports","module","baseGetTag","isObjectLike","symbolTag","isSymbol","value","__name","require_toNumber","__commonJSMin","exports","module","baseTrim","isObject","isSymbol","NAN","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","toNumber","value","other","isBinary","__name","require_debounce","__commonJSMin","exports","module","isObject","now","toNumber","FUNC_ERROR_TEXT","nativeMax","nativeMin","debounce","func","wait","options","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","invokeFunc","time","args","thisArg","__name","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","timeWaiting","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","useState","useCallback","useEffect","useRef","import_debounce","useCallback","useEffect","useRef","useDebounce","callback","delay","callbackRef","useRef","useEffect","debouncedFn","debounce","value","useCallback","__name","Fragment","jsx","jsxs","DescriptionWithConversion","__name","description","showConversion","targetCurrency","className","onClick","components","useFormFields","label","CustomButton","ButtonDefault","FormDescription","CurrencyConversionField","sourceCurrency","mainFieldName","conversionFieldName","conversionProperties","classNamePrefix","conversionType","props","setShowConversion","useState","setValue","watch","useFormContext","fieldValue","isFirstRender","useRef","conversionCache","canShowConversion","convertCurrency","useConvertCurrency","lastInputFieldName","useEffect","convertCurrencyCallback","useCallback","value","fromCurrency","toCurrency","targetField","amount","cacheKey","cached","response","reverseKey","error","debouncedConvertCurrency","useDebounce","debouncedConvertCurrencyReverse","handleMainFieldChange","evt","handleConversionFieldChange","toggleConversion","prev","extraDescription","TextField"]}
@@ -0,0 +1,2 @@
1
+ import{h as f}from"./chunk-NFUP6BFU.js";import{a as b,b as D,c as C,d as h,e as Z,f as y}from"./chunk-UOOUV52J.js";import{b as g,d as w}from"./chunk-KQPDXXG3.js";import{a as p,f as k}from"./chunk-L3Z2G32A.js";import{a as e}from"./chunk-P37U34EQ.js";var H={disclaimerCostCalculator:4668194326797,employeeOnboardingTimeline:4411262104589,extraPayments:4466822781709,internationalPricing:4410698586893,remoteFxRate:33271144977421,terminationEmployeeCommunication:4411585179661,terminationNoticePeriods:5831900985613,involuntaryOffboardingServiceCharge:4406932229133,reconciliationInvoice:17604014808589},m=e(r=>`https://support.remote.com/hc/en-us/articles/${r}`,"buildZendeskURL");import{useQuery as L}from"@tanstack/react-query";var v=e((r,n)=>{let{client:i}=w();return L({queryKey:["zendesk-article",r],queryFn:e(async()=>{let o=await f({client:i,path:{id:Number(r)}});if(o.error)throw new Error(o.error.message||"Failed to fetch article");return o},"queryFn"),select:e(o=>{let t=o.data?.data.help_center_article;return t&&{...t,body:k(t.body||"")}},"select"),retry:!1,...n})},"useZendeskArticle");import{jsx as a,jsxs as c}from"react/jsx-runtime";function x({open:r,onClose:n,data:i,isLoading:o,error:t,zendeskURL:d,Trigger:s}){return c(b,{open:r,onOpenChange:l=>!l&&n(),direction:"right",children:[a(D,{asChild:!0,children:s}),a(C,{className:"h-full w-[540px] mt-0 ml-auto RemoteFlows_ZendeskDrawer",children:c("div",{className:"h-full flex flex-col",children:[c(h,{children:[a(Z,{children:i?.title}),c(y,{children:["For more details see our"," ",a("a",{href:d,target:"_blank",rel:"noopener noreferrer",children:"help article"})," "]})]}),o&&a("div",{children:"Loading..."}),t&&a("div",{className:"text-sm p-4 text-red-500",children:"Error loading article"}),a("div",{className:"flex-1 overflow-y-auto p-4 RemoteFlows_ZendeskDrawer__Content",dangerouslySetInnerHTML:{__html:i?.body||""}})]})})]})}e(x,"ZendeskDrawerDefault");import{jsx as P}from"react/jsx-runtime";var R=e(({Trigger:r,zendeskId:n,open:i,onClose:o})=>{let{components:t}=g(),d=m(n),s=e(()=>{o?.()},"handleClose"),{data:l,isLoading:_,error:N}=v(n,{enabled:i}),F=t?.zendeskDrawer||x;return P(F,{open:i,onClose:s,data:l,isLoading:_,error:N,zendeskURL:d,Trigger:r})},"ZendeskDrawer");import{useState as z}from"react";import{jsx as u}from"react/jsx-runtime";var T="RemoteFlows__ZendeskTriggerButton text-blue-500 hover:underline inline-block text-xs bg-transparent border-none cursor-pointer p-0";function ne({zendeskId:r,className:n,onClick:i,children:o,external:t=!1}){let[d,s]=z(!1),l=e(()=>{t||s(!0),i?.(r)},"handleClick");return t?u("a",{href:m(r),target:"_blank",rel:"noopener noreferrer",onClick:l,className:p(T,n),children:o}):u(R,{zendeskId:r,open:d,onClose:()=>s(!1),Trigger:u("button",{onClick:l,className:p(T,n),children:o})})}e(ne,"ZendeskTriggerButton");export{H as a,ne as b};
2
+ //# sourceMappingURL=chunk-E5PHO3SS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/shared/zendesk-drawer/utils.ts","../src/components/shared/zendesk-drawer/api.ts","../src/components/shared/zendesk-drawer/ZendeskDrawerDefault.tsx","../src/components/shared/zendesk-drawer/ZendeskDrawer.tsx","../src/components/shared/zendesk-drawer/ZendeskTriggerButton.tsx"],"sourcesContent":["export const zendeskArticles = {\n /**\n * Disclaimer for Cost Calculator\n * Access: Private (Need Remote account to access)\n * https://support.remote.com/hc/en-us/articles/4668194326797\n */\n disclaimerCostCalculator: 4668194326797,\n /**\n * Employee Onboarding Timeline\n * Access: Private (Need Remote account to access)\n * https://support.remote.com/hc/en-us/articles/4411262104589\n */\n employeeOnboardingTimeline: 4411262104589,\n /**\n * Extra Payments\n * Access: Public (Everyone can access)\n * https://support.remote.com/hc/en-us/articles/4466822781709\n */\n extraPayments: 4466822781709,\n /**\n * International Pricing\n * Access: Public (Everyone can access)\n * https://support.remote.com/hc/en-us/articles/4410698586893\n */\n internationalPricing: 4410698586893,\n /**\n * Remote FX Rate\n * Access: Public (Everyone can access)\n * https://support.remote.com/hc/en-us/articles/33271144977421\n */\n remoteFxRate: 33271144977421,\n /**\n * Employee Communication for Terminations\n * Access: Public (Everyone can access)\n * https://support.remote.com/hc/en-us/articles/4411585179661\n */\n terminationEmployeeCommunication: 4411585179661,\n /**\n * Notice Period for Terminations by Country\n * Access: Public (Everyone can access)\n * https://support.remote.com/hc/en-us/articles/5831900985613\n */\n terminationNoticePeriods: 5831900985613,\n /**\n * Involuntary Offboarding Service Charge\n * Access: Private (Need Remote account to access)\n * https://support.remote.com/hc/en-us/articles/4406932229133\n */\n involuntaryOffboardingServiceCharge: 4406932229133,\n /**\n * Reconciliation Invoice\n * Access: Public (Everyone can access)\n * https://support.remote.com/hc/en-us/articles/17604014808589\n */\n reconciliationInvoice: 17604014808589,\n};\n\nexport const buildZendeskURL = (zendeskId: number) => {\n return `https://support.remote.com/hc/en-us/articles/${zendeskId}`;\n};\n","import { getShowHelpCenterArticle } from '@/src/client';\nimport { useClient } from '@/src/context';\nimport { sanitizeHtmlWithImageErrorHandling } from '@/src/lib/utils';\nimport { Client } from '@/src/client/client';\nimport { useQuery } from '@tanstack/react-query';\n\nexport const useZendeskArticle = (\n zendeskId: number | null,\n queryOptions?: { enabled?: boolean },\n) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['zendesk-article', zendeskId],\n queryFn: async () => {\n const response = await getShowHelpCenterArticle({\n client: client as Client,\n path: {\n id: Number(zendeskId),\n },\n });\n\n if (response.error) {\n throw new Error(response.error.message || 'Failed to fetch article');\n }\n\n return response;\n },\n select: (data) => {\n const article = data.data?.data.help_center_article;\n if (article) {\n return {\n ...article,\n body: sanitizeHtmlWithImageErrorHandling(article.body || ''),\n };\n }\n return article;\n },\n retry: false,\n ...queryOptions,\n });\n};\n","import {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from '@/src/components/ui/drawer';\nimport { ZendeskDrawerComponentProps } from '@/src/types/remoteFlows';\n\nexport function ZendeskDrawerDefault({\n open,\n onClose,\n data,\n isLoading,\n error,\n zendeskURL,\n Trigger,\n}: ZendeskDrawerComponentProps) {\n return (\n <Drawer\n open={open}\n onOpenChange={(open) => !open && onClose()}\n direction='right'\n >\n <DrawerTrigger asChild>{Trigger}</DrawerTrigger>\n <DrawerContent className='h-full w-[540px] mt-0 ml-auto RemoteFlows_ZendeskDrawer'>\n <div className='h-full flex flex-col'>\n <DrawerHeader>\n <DrawerTitle>{data?.title}</DrawerTitle>\n <DrawerDescription>\n For more details see our{' '}\n <a href={zendeskURL} target='_blank' rel='noopener noreferrer'>\n help article\n </a>{' '}\n </DrawerDescription>\n </DrawerHeader>\n {isLoading && <div>Loading...</div>}\n {error && (\n <div className='text-sm p-4 text-red-500'>\n Error loading article\n </div>\n )}\n <div\n className='flex-1 overflow-y-auto p-4 RemoteFlows_ZendeskDrawer__Content'\n dangerouslySetInnerHTML={{\n __html: data?.body || '',\n }}\n ></div>\n </div>\n </DrawerContent>\n </Drawer>\n );\n}\n","import { useZendeskArticle } from '@/src/components/shared/zendesk-drawer/api';\nimport { useFormFields } from '@/src/context';\nimport { buildZendeskURL } from '@/src/components/shared/zendesk-drawer/utils';\nimport { ZendeskDrawerDefault } from './ZendeskDrawerDefault';\n\nexport type ZendeskDrawerProps = {\n Trigger: React.ReactElement;\n zendeskId: number;\n open: boolean;\n onClose: () => void;\n};\n\nexport const ZendeskDrawer = ({\n Trigger,\n zendeskId,\n open,\n onClose,\n}: ZendeskDrawerProps) => {\n const { components } = useFormFields();\n const zendeskURL = buildZendeskURL(zendeskId);\n\n const handleClose = () => {\n onClose?.();\n };\n\n const { data, isLoading, error } = useZendeskArticle(zendeskId, {\n enabled: open,\n });\n\n const CustomZendeskDrawer = components?.zendeskDrawer || ZendeskDrawerDefault;\n\n return (\n <CustomZendeskDrawer\n open={open}\n onClose={handleClose}\n data={data}\n isLoading={isLoading}\n error={error}\n zendeskURL={zendeskURL}\n Trigger={Trigger}\n />\n );\n};\n","import { cn } from '@/src/lib/utils';\nimport { ZendeskDrawer } from './ZendeskDrawer';\nimport { buildZendeskURL } from './utils';\nimport { useState } from 'react';\n\ninterface ZendeskTriggerButtonProps {\n /**\n * The Zendesk ID for the help article\n */\n zendeskId: number;\n /**\n * The class name for the button\n */\n className?: string;\n /**\n * The callback function to be called when the button is clicked\n */\n onClick?: (zendeskId: number) => void;\n /**\n * The children to be rendered inside the button\n */\n children?: React.ReactNode;\n /**\n * Whether to open the help article in a new tab\n */\n external?: boolean;\n}\n\nconst baseClassName =\n 'RemoteFlows__ZendeskTriggerButton text-blue-500 hover:underline inline-block text-xs bg-transparent border-none cursor-pointer p-0';\n\nexport function ZendeskTriggerButton({\n zendeskId,\n className,\n onClick,\n children,\n external = false,\n}: ZendeskTriggerButtonProps) {\n const [isOpen, setIsOpen] = useState(false);\n\n const handleClick = () => {\n if (!external) {\n setIsOpen(true);\n }\n onClick?.(zendeskId);\n };\n\n if (external) {\n return (\n <a\n href={buildZendeskURL(zendeskId)}\n target='_blank'\n rel='noopener noreferrer'\n onClick={handleClick}\n className={cn(baseClassName, className)}\n >\n {children}\n </a>\n );\n }\n\n return (\n <ZendeskDrawer\n zendeskId={zendeskId}\n open={isOpen}\n onClose={() => setIsOpen(false)}\n Trigger={\n <button onClick={handleClick} className={cn(baseClassName, className)}>\n {children}\n </button>\n }\n />\n );\n}\n"],"mappings":"yPAAO,IAAMA,EAAkB,CAM7B,yBAA0B,cAM1B,2BAA4B,cAM5B,cAAe,cAMf,qBAAsB,cAMtB,aAAc,eAMd,iCAAkC,cAMlC,yBAA0B,cAM1B,oCAAqC,cAMrC,sBAAuB,cACzB,EAEaC,EAAkBC,EAACC,GACvB,gDAAgDA,CAAS,GADnC,mBCrD/B,OAAS,YAAAC,MAAgB,wBAElB,IAAMC,EAAoBC,EAAA,CAC/BC,EACAC,IACG,CACH,GAAM,CAAE,OAAAC,CAAO,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3CgBW,EAAAd,EAAA,wBCsBZ,cAAAe,MAAA,oBApBG,IAAMC,EAAgBC,EAAA,CAAC,CAC5B,QAAAC,EACA,UAAAC,EACA,KAAAC,EACA,QAAAC,CACF,IAA0B,CACxB,GAAM,CAAE,WAAAC,CAAW,EAAIC,EAAc,EAC/BC,EAAaC,EAAgBN,CAAS,EAEtCO,EAAcT,EAAA,IAAM,CACxBI,IAAU,CACZ,EAFoB,eAId,CAAE,KAAAM,EAAM,UAAAC,EAAW,MAAAC,CAAM,EAAIC,EAAkBX,EAAW,CAC9D,QAASC,CACX,CAAC,EAEKW,EAAsBT,GAAY,eAAiBU,EAEzD,OACEjB,EAACgB,EAAA,CACC,KAAMX,EACN,QAASM,EACT,KAAMC,EACN,UAAWC,EACX,MAAOC,EACP,WAAYL,EACZ,QAASN,EACX,CAEJ,EA9B6B,iBCT7B,OAAS,YAAAe,MAAgB,QA8CnB,cAAAC,MAAA,oBArBN,IAAMC,EACJ,qIAEK,SAASC,GAAqB,CACnC,UAAAC,EACA,UAAAC,EACA,QAAAC,EACA,SAAAC,EACA,SAAAC,EAAW,EACb,EAA8B,CAC5B,GAAM,CAACC,EAAQC,CAAS,EAAIC,EAAS,EAAK,EAEpCC,EAAcC,EAAA,IAAM,CACnBL,GACHE,EAAU,EAAI,EAEhBJ,IAAUF,CAAS,CACrB,EALoB,eAOpB,OAAII,EAEAP,EAAC,KACC,KAAMa,EAAgBV,CAAS,EAC/B,OAAO,SACP,IAAI,sBACJ,QAASQ,EACT,UAAWG,EAAGb,EAAeG,CAAS,EAErC,SAAAE,EACH,EAKFN,EAACe,EAAA,CACC,UAAWZ,EACX,KAAMK,EACN,QAAS,IAAMC,EAAU,EAAK,EAC9B,QACET,EAAC,UAAO,QAASW,EAAa,UAAWG,EAAGb,EAAeG,CAAS,EACjE,SAAAE,EACH,EAEJ,CAEJ,CA1CgBM,EAAAV,GAAA","names":["zendeskArticles","buildZendeskURL","__name","zendeskId","useQuery","useZendeskArticle","__name","zendeskId","queryOptions","client","useClient","useQuery","response","getShowHelpCenterArticle","data","article","sanitizeHtmlWithImageErrorHandling","jsx","jsxs","ZendeskDrawerDefault","open","onClose","data","isLoading","error","zendeskURL","Trigger","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","__name","jsx","ZendeskDrawer","__name","Trigger","zendeskId","open","onClose","components","useFormFields","zendeskURL","buildZendeskURL","handleClose","data","isLoading","error","useZendeskArticle","CustomZendeskDrawer","ZendeskDrawerDefault","useState","jsx","baseClassName","ZendeskTriggerButton","zendeskId","className","onClick","children","external","isOpen","setIsOpen","useState","handleClick","__name","buildZendeskURL","cn","ZendeskDrawer"]}
@@ -0,0 +1,2 @@
1
+ import{b as r}from"./chunk-PGWKJ6FK.js";import{a as n}from"./chunk-6GTRAHWJ.js";import{b as o}from"./chunk-KQPDXXG3.js";import{a as t}from"./chunk-P37U34EQ.js";import{jsx as f}from"react/jsx-runtime";function B({children:u,...i}){let{formId:m}=r(),{components:e}=o(),s=e?.button||n;return f(s,{...i,form:m,children:u})}t(B,"OnboardingSubmit");export{B as a};
2
+ //# sourceMappingURL=chunk-EDVJBPCB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Onboarding/components/OnboardingSubmit.tsx"],"sourcesContent":["import { ButtonHTMLAttributes, PropsWithChildren } from 'react';\nimport { ButtonDefault } from '@/src/components/form/fields/default/ButtonDefault';\nimport { useOnboardingContext } from '@/src/flows/Onboarding/context';\nimport { useFormFields } from '@/src/context';\n\nexport function OnboardingSubmit({\n children,\n ...props\n}: PropsWithChildren<\n ButtonHTMLAttributes<HTMLButtonElement> & Record<string, unknown>\n>) {\n const { formId } = useOnboardingContext();\n const { components } = useFormFields();\n\n const CustomButton = components?.button || ButtonDefault;\n return (\n <CustomButton {...props} form={formId}>\n {children}\n </CustomButton>\n );\n}\n"],"mappings":"gKAgBI,cAAAA,MAAA,oBAXG,SAASC,EAAiB,CAC/B,SAAAC,EACA,GAAGC,CACL,EAEG,CACD,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAqB,EAClC,CAAE,WAAAC,CAAW,EAAIC,EAAc,EAE/BC,EAAeF,GAAY,QAAUG,EAC3C,OACET,EAACQ,EAAA,CAAc,GAAGL,EAAO,KAAMC,EAC5B,SAAAF,EACH,CAEJ,CAfgBQ,EAAAT,EAAA","names":["jsx","OnboardingSubmit","children","props","formId","useOnboardingContext","components","useFormFields","CustomButton","ButtonDefault","__name"]}
@@ -0,0 +1,2 @@
1
+ import{b as r}from"./chunk-TOA3JILU.js";import{a as n}from"./chunk-6GTRAHWJ.js";import{b as o}from"./chunk-KQPDXXG3.js";import{a as t}from"./chunk-P37U34EQ.js";import{jsx as f}from"react/jsx-runtime";function c({children:u,...i}){let{formId:m}=r(),{components:e}=o(),s=e?.button||n;return f(s,{...i,form:m,children:u})}t(c,"OnboardingSubmit");export{c as a};
2
+ //# sourceMappingURL=chunk-ERRQIROU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/ContractorOnboarding/components/OnboardingSubmit.tsx"],"sourcesContent":["import { ButtonHTMLAttributes, PropsWithChildren } from 'react';\nimport { useContractorOnboardingContext } from '@/src/flows/ContractorOnboarding/context';\nimport { useFormFields } from '@/src/context';\nimport { ButtonDefault } from '@/src/components/form/fields/default/ButtonDefault';\n\nexport function OnboardingSubmit({\n children,\n ...props\n}: PropsWithChildren<\n ButtonHTMLAttributes<HTMLButtonElement> & Record<string, unknown>\n>) {\n const { formId } = useContractorOnboardingContext();\n const { components } = useFormFields();\n\n const CustomButton = components?.button || ButtonDefault;\n\n return (\n <CustomButton {...props} form={formId}>\n {children}\n </CustomButton>\n );\n}\n"],"mappings":"gKAiBI,cAAAA,MAAA,oBAZG,SAASC,EAAiB,CAC/B,SAAAC,EACA,GAAGC,CACL,EAEG,CACD,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAA+B,EAC5C,CAAE,WAAAC,CAAW,EAAIC,EAAc,EAE/BC,EAAeF,GAAY,QAAUG,EAE3C,OACET,EAACQ,EAAA,CAAc,GAAGL,EAAO,KAAMC,EAC5B,SAAAF,EACH,CAEJ,CAhBgBQ,EAAAT,EAAA","names":["jsx","OnboardingSubmit","children","props","formId","useContractorOnboardingContext","components","useFormFields","CustomButton","ButtonDefault","__name"]}
@@ -0,0 +1,2 @@
1
+ import{a as r}from"./chunk-6GTRAHWJ.js";import{b as n}from"./chunk-KQPDXXG3.js";import{b as e}from"./chunk-TVZAFTPT.js";import{a as o}from"./chunk-P37U34EQ.js";import{jsx as C}from"react/jsx-runtime";function f({children:m,...t}){let{contractAmendment:{back:u}}=e(),{components:i}=n(),c=i?.button||r;return C(c,{...t,onClick:s=>{u(),t.onClick?.(s)},children:m})}o(f,"ContractAmendmentBack");export{f as a};
2
+ //# sourceMappingURL=chunk-F3KEIVSE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/ContractAmendment/ContractAmendmentBack.tsx"],"sourcesContent":["import { ButtonHTMLAttributes, PropsWithChildren } from 'react';\nimport { useContractAmendmentContext } from './context';\nimport { useFormFields } from '@/src/context';\nimport { ButtonDefault } from '@/src/components/form/fields/default/ButtonDefault';\n\nexport function ContractAmendmentBack({\n children,\n ...props\n}: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>> &\n Record<string, unknown>) {\n const {\n contractAmendment: { back },\n } = useContractAmendmentContext();\n\n const { components } = useFormFields();\n\n const CustomButton = components?.button || ButtonDefault;\n return (\n <CustomButton\n {...props}\n onClick={(evt) => {\n back();\n props.onClick?.(evt);\n }}\n >\n {children}\n </CustomButton>\n );\n}\n"],"mappings":"gKAkBI,cAAAA,MAAA,oBAbG,SAASC,EAAsB,CACpC,SAAAC,EACA,GAAGC,CACL,EAC2B,CACzB,GAAM,CACJ,kBAAmB,CAAE,KAAAC,CAAK,CAC5B,EAAIC,EAA4B,EAE1B,CAAE,WAAAC,CAAW,EAAIC,EAAc,EAE/BC,EAAeF,GAAY,QAAUG,EAC3C,OACET,EAACQ,EAAA,CACE,GAAGL,EACJ,QAAUO,GAAQ,CAChBN,EAAK,EACLD,EAAM,UAAUO,CAAG,CACrB,EAEC,SAAAR,EACH,CAEJ,CAvBgBS,EAAAV,EAAA","names":["jsx","ContractAmendmentBack","children","props","back","useContractAmendmentContext","components","useFormFields","CustomButton","ButtonDefault","evt","__name"]}
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-QIZEGFKJ.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as i}from"react/jsx-runtime";var l=e(({currency:n,desiredCurrency:o,annual_gross_salary_conversion_properties:r,...a})=>i(s,{...a,sourceCurrency:n,targetCurrency:o,conversionFieldName:"annual_gross_salary_conversion",conversionProperties:{...r,description:r?.description||"Estimated amount. This is an estimation. We calculate conversions based on spot rates that are subject to fluctuation over time."},classNamePrefix:"RemoteFlows-AnnualGrossSalary",conversionType:"no_spread"}),"AnnualGrossSalary");export{l as a};
2
- //# sourceMappingURL=chunk-F53TRJ4K.js.map
1
+ import{a as s}from"./chunk-E25DZ75Z.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as i}from"react/jsx-runtime";var l=e(({currency:n,desiredCurrency:o,annual_gross_salary_conversion_properties:r,...a})=>i(s,{...a,sourceCurrency:n,targetCurrency:o,conversionFieldName:"annual_gross_salary_conversion",conversionProperties:{...r,description:r?.description||"Estimated amount. This is an estimation. We calculate conversions based on spot rates that are subject to fluctuation over time."},classNamePrefix:"RemoteFlows-AnnualGrossSalary",conversionType:"no_spread"}),"AnnualGrossSalary");export{l as a};
2
+ //# sourceMappingURL=chunk-FKLQBAJ5.js.map
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-ASSO5FYG.js";import{b as e}from"./chunk-MRYRNB7Y.js";import{a as m}from"./chunk-P37U34EQ.js";import{jsx as u}from"react/jsx-runtime";function p({onSubmit:n}){let{terminationBag:o}=e(),a=m(async t=>{let r=await o?.parseFormValues(t);await n?.(r),o?.next()},"handleSubmit");return u(i,{defaultValues:o.fieldValues,onSubmit:a})}m(p,"EmployeeCommunicationForm");export{p as a};
2
- //# sourceMappingURL=chunk-DS5MV4BA.js.map
1
+ import{a as i}from"./chunk-MNSIBSAM.js";import{b as e}from"./chunk-MRYRNB7Y.js";import{a as m}from"./chunk-P37U34EQ.js";import{jsx as u}from"react/jsx-runtime";function p({onSubmit:n}){let{terminationBag:o}=e(),a=m(async t=>{let r=await o?.parseFormValues(t);await n?.(r),o?.next()},"handleSubmit");return u(i,{defaultValues:o.fieldValues,onSubmit:a})}m(p,"EmployeeCommunicationForm");export{p as a};
2
+ //# sourceMappingURL=chunk-GBZXVNGQ.js.map
@@ -0,0 +1,2 @@
1
+ import{a as s}from"./chunk-P37U34EQ.js";var d={select_country:{index:0,name:"select_country"},basic_information:{index:1,name:"basic_information"},contract_details:{index:2,name:"contract_details"},benefits:{index:3,name:"benefits"},review:{index:4,name:"review"}},_={basic_information:{index:0,name:"basic_information"},contract_details:{index:1,name:"contract_details"},benefits:{index:2,name:"benefits"},review:{index:3,name:"review"}},p=["invited","created_awaiting_reserve","created_reserve_paid"],S=["created_awaiting_reserve","invited"],r=1,o={DEU:[1,2]},a=s(t=>t?o[t]?.[0]??r:r,"getDefaultContractDetailsSchemaVersion"),l=s((t,e)=>{let n=a(e);if(!e||!o[e]||!t)return n;let i=o[e];return i.includes(t)?t:(console.warn(`[RemoteFlows] JSON Schema version ${t} is not allowed for country ${e}. Allowed versions: [${i.join(", ")}]. Using default version ${n}.`),n)},"getValidatedContractDetailsSchemaVersion"),f=s((t,e)=>{let n=t?.jsonSchemaVersionByCountry,i=e?n?.[e]?.contract_details:void 0,c=i||a(e);return l(c,e)},"getContractDetailsSchemaVersion");export{d as a,_ as b,p as c,S as d,r as e,f};
2
+ //# sourceMappingURL=chunk-H6YNMT4M.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Onboarding/utils.ts"],"sourcesContent":["import { Employment, OnboardingFlowProps } from '@/src/flows/Onboarding/types';\nimport { Step } from '@/src/flows/useStepState';\n\ntype StepKeys =\n | 'select_country'\n | 'basic_information'\n | 'contract_details'\n | 'benefits'\n | 'review';\n\nexport const STEPS: Record<StepKeys, Step<StepKeys>> = {\n select_country: {\n index: 0,\n name: 'select_country',\n },\n basic_information: { index: 1, name: 'basic_information' },\n contract_details: { index: 2, name: 'contract_details' },\n benefits: { index: 3, name: 'benefits' },\n review: { index: 4, name: 'review' },\n} as const;\n\nexport const STEPS_WITHOUT_SELECT_COUNTRY: Record<\n Exclude<StepKeys, 'select_country'>,\n Step<Exclude<StepKeys, 'select_country'>>\n> = {\n basic_information: { index: 0, name: 'basic_information' },\n contract_details: { index: 1, name: 'contract_details' },\n benefits: { index: 2, name: 'benefits' },\n review: { index: 3, name: 'review' },\n} as const;\n\n/**\n * Array of employment statuses that are allowed to proceed to the review step.\n * These statuses indicate that the employment is in a final state and the employment cannot be modified further.\n * @type {Employment['status'][]}\n * @constant\n */\nexport const reviewStepAllowedEmploymentStatus: Employment['status'][] = [\n 'invited',\n 'created_awaiting_reserve',\n 'created_reserve_paid',\n];\n\nexport const disabledInviteButtonEmploymentStatus: Employment['status'][] = [\n 'created_awaiting_reserve',\n 'invited',\n];\n\nexport const DEFAULT_VERSION = 1;\n\n/**\n * Defines allowed JSON schema versions per country for contract_details\n * Key: country code, Value: array of allowed versions (first is default/recommended)\n */\nconst COUNTRY_CONTRACT_DETAILS_VERSION_ALLOWLIST: Record<string, number[]> = {\n DEU: [1, 2], // Germany: allows v1 (default) and v2\n};\n\n/**\n * Gets the default (recommended) contract details schema version for a country\n */\nconst getDefaultContractDetailsSchemaVersion = (\n countryCode: string | null,\n): number => {\n if (!countryCode) return DEFAULT_VERSION;\n const allowedVersions =\n COUNTRY_CONTRACT_DETAILS_VERSION_ALLOWLIST[countryCode];\n return allowedVersions?.[0] ?? DEFAULT_VERSION; // First version is the default\n};\n\n/**\n * Validates if a version is allowed for a given country\n * Returns the version if valid, otherwise returns the default\n */\nconst getValidatedContractDetailsSchemaVersion = (\n requestedVersion: number | undefined,\n countryCode: string | null,\n): number => {\n const defaultVersion = getDefaultContractDetailsSchemaVersion(countryCode);\n\n // If there is no country code, no allowlist for country, or no requested version, return the default version\n if (\n !countryCode ||\n !COUNTRY_CONTRACT_DETAILS_VERSION_ALLOWLIST[countryCode] ||\n !requestedVersion\n ) {\n return defaultVersion;\n }\n\n const allowedVersions =\n COUNTRY_CONTRACT_DETAILS_VERSION_ALLOWLIST[countryCode];\n\n // Check if requested version is allowed\n if (allowedVersions.includes(requestedVersion)) {\n return requestedVersion;\n }\n\n // Version not allowed, return default with console warning\n console.warn(\n `[RemoteFlows] JSON Schema version ${requestedVersion} is not allowed for country ${countryCode}. ` +\n `Allowed versions: [${allowedVersions.join(', ')}]. Using default version ${defaultVersion}.`,\n );\n\n return defaultVersion;\n};\n\n/**\n * Resolves the effective contract details schema version for a country\n * Priority: country-specific > global > default by country\n *\n * @param options - The flow options containing version configurations\n * @param countryCode - The country code to resolve version for\n * @returns The effective jsonSchemaVersion configuration\n */\nexport const getContractDetailsSchemaVersion = (\n options: OnboardingFlowProps['options'],\n countryCode: string | null,\n) => {\n const jsonSchemaVersionByCountry = options?.jsonSchemaVersionByCountry;\n const countrySpecificVersion = countryCode\n ? jsonSchemaVersionByCountry?.[countryCode]?.contract_details\n : undefined;\n\n const requestedVersion = countrySpecificVersion\n ? countrySpecificVersion\n : getDefaultContractDetailsSchemaVersion(countryCode);\n const effectiveVersion = getValidatedContractDetailsSchemaVersion(\n requestedVersion,\n countryCode,\n );\n\n return effectiveVersion;\n};\n"],"mappings":"wCAUO,IAAMA,EAA0C,CACrD,eAAgB,CACd,MAAO,EACP,KAAM,gBACR,EACA,kBAAmB,CAAE,MAAO,EAAG,KAAM,mBAAoB,EACzD,iBAAkB,CAAE,MAAO,EAAG,KAAM,kBAAmB,EACvD,SAAU,CAAE,MAAO,EAAG,KAAM,UAAW,EACvC,OAAQ,CAAE,MAAO,EAAG,KAAM,QAAS,CACrC,EAEaC,EAGT,CACF,kBAAmB,CAAE,MAAO,EAAG,KAAM,mBAAoB,EACzD,iBAAkB,CAAE,MAAO,EAAG,KAAM,kBAAmB,EACvD,SAAU,CAAE,MAAO,EAAG,KAAM,UAAW,EACvC,OAAQ,CAAE,MAAO,EAAG,KAAM,QAAS,CACrC,EAQaC,EAA4D,CACvE,UACA,2BACA,sBACF,EAEaC,EAA+D,CAC1E,2BACA,SACF,EAEaC,EAAkB,EAMzBC,EAAuE,CAC3E,IAAK,CAAC,EAAG,CAAC,CACZ,EAKMC,EAAyCC,EAC7CC,GAEKA,EAEHH,EAA2CG,CAAW,IAC/B,CAAC,GAAKJ,EAHNA,EAHoB,0CAazCK,EAA2CF,EAAA,CAC/CG,EACAF,IACW,CACX,IAAMG,EAAiBL,EAAuCE,CAAW,EAGzE,GACE,CAACA,GACD,CAACH,EAA2CG,CAAW,GACvD,CAACE,EAED,OAAOC,EAGT,IAAMC,EACJP,EAA2CG,CAAW,EAGxD,OAAII,EAAgB,SAASF,CAAgB,EACpCA,GAIT,QAAQ,KACN,qCAAqCA,CAAgB,+BAA+BF,CAAW,wBACvEI,EAAgB,KAAK,IAAI,CAAC,4BAA4BD,CAAc,GAC9F,EAEOA,EACT,EA9BiD,4CAwCpCE,EAAkCN,EAAA,CAC7CO,EACAN,IACG,CACH,IAAMO,EAA6BD,GAAS,2BACtCE,EAAyBR,EAC3BO,IAA6BP,CAAW,GAAG,iBAC3C,OAEEE,EAAmBM,GAErBV,EAAuCE,CAAW,EAMtD,OALyBC,EACvBC,EACAF,CACF,CAGF,EAlB+C","names":["STEPS","STEPS_WITHOUT_SELECT_COUNTRY","reviewStepAllowedEmploymentStatus","disabledInviteButtonEmploymentStatus","DEFAULT_VERSION","COUNTRY_CONTRACT_DETAILS_VERSION_ALLOWLIST","getDefaultContractDetailsSchemaVersion","__name","countryCode","getValidatedContractDetailsSchemaVersion","requestedVersion","defaultVersion","allowedVersions","getContractDetailsSchemaVersion","options","jsonSchemaVersionByCountry","countrySpecificVersion"]}
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-O6YXA5AM.js";import{b as c}from"./chunk-TOA3JILU.js";import{b as d}from"./chunk-2YTBWEC7.js";import{a as t}from"./chunk-P37U34EQ.js";import{Suspense as u,lazy as F}from"react";import{jsx as i}from"react/jsx-runtime";var E=F(()=>import("./PdfPreview-6C3GGXIN.js").then(o=>({default:o.PDFPreview}))),l=t(o=>i(u,{fallback:i("div",{className:"animate-pulse",children:"Loading PDF..."}),children:i(E,{...o})}),"LazyPdfPreview");import{jsx as p,jsxs as S}from"react/jsx-runtime";function M({onSubmit:o,onSuccess:P,onError:n}){let{contractorOnboardingBag:r}=c(),w=t(async s=>{try{let a=await r.parseFormValues(s);await o?.(a);let e=await r.onSubmit(s);if(e?.data){await P?.(e?.data),r?.next();return}if(e?.error){let f=d(e?.fieldErrors||[],r.meta?.fields?.contract_preview);n?.({error:e?.error,rawError:e?.rawError,fieldErrors:f})}}catch(a){n?.({error:a,rawError:a,fieldErrors:[]})}},"handleSubmit"),v=r.stepState.values?.contract_preview||r.initialValues.contract_preview;return S("div",{className:"space-y-4",children:[p(l,{base64Data:r.documentPreviewPdf?.contract_document.content}),p(m,{defaultValues:v,onSubmit:w})]})}t(M,"ContractPreviewStep");export{M as a};
2
- //# sourceMappingURL=chunk-UVA4PFNM.js.map
1
+ import{a as m}from"./chunk-4STFNBEP.js";import{b as c}from"./chunk-TOA3JILU.js";import{b as d}from"./chunk-2YTBWEC7.js";import{a as t}from"./chunk-P37U34EQ.js";import{Suspense as u,lazy as F}from"react";import{jsx as i}from"react/jsx-runtime";var E=F(()=>import("./PdfPreview-6C3GGXIN.js").then(o=>({default:o.PDFPreview}))),l=t(o=>i(u,{fallback:i("div",{className:"animate-pulse",children:"Loading PDF..."}),children:i(E,{...o})}),"LazyPdfPreview");import{jsx as p,jsxs as S}from"react/jsx-runtime";function M({onSubmit:o,onSuccess:P,onError:n}){let{contractorOnboardingBag:r}=c(),w=t(async s=>{try{let a=await r.parseFormValues(s);await o?.(a);let e=await r.onSubmit(s);if(e?.data){await P?.(e?.data),r?.next();return}if(e?.error){let f=d(e?.fieldErrors||[],r.meta?.fields?.contract_preview);n?.({error:e?.error,rawError:e?.rawError,fieldErrors:f})}}catch(a){n?.({error:a,rawError:a,fieldErrors:[]})}},"handleSubmit"),v=r.stepState.values?.contract_preview||r.initialValues.contract_preview;return S("div",{className:"space-y-4",children:[p(l,{base64Data:r.documentPreviewPdf?.contract_document.content}),p(m,{defaultValues:v,onSubmit:w})]})}t(M,"ContractPreviewStep");export{M as a};
2
+ //# sourceMappingURL=chunk-HAV7FPRM.js.map
@@ -1,2 +1,2 @@
1
- import{a as l}from"./chunk-XEUZL7O2.js";import{b as s}from"./chunk-PGWKJ6FK.js";import{b as n}from"./chunk-2YTBWEC7.js";import{a as t}from"./chunk-P37U34EQ.js";import{jsx as E}from"react/jsx-runtime";function S({onSubmit:d,onError:a,onSuccess:m}){let{onboardingBag:r}=s(),c=t(async i=>{try{let e=await r.parseFormValues(i);await d?.(e);let o=await r.onSubmit(i);if(o?.data){await m?.(o.data),r?.next();return}if(o?.error){let p=n(o?.fieldErrors||[],r.meta?.fields?.contract_details);a?.({error:o.error,rawError:o.rawError,fieldErrors:p})}}catch(e){a?.({error:e,rawError:e,fieldErrors:[]})}},"handleSubmit");return E(l,{defaultValues:r.stepState.values?.contract_details||r.initialValues.contract_details,onSubmit:c})}t(S,"ContractDetailsStep");export{S as a};
2
- //# sourceMappingURL=chunk-Z47XN6ZT.js.map
1
+ import{a as l}from"./chunk-65HLULDL.js";import{b as s}from"./chunk-PGWKJ6FK.js";import{b as n}from"./chunk-2YTBWEC7.js";import{a as t}from"./chunk-P37U34EQ.js";import{jsx as E}from"react/jsx-runtime";function S({onSubmit:d,onError:a,onSuccess:m}){let{onboardingBag:r}=s(),c=t(async i=>{try{let e=await r.parseFormValues(i);await d?.(e);let o=await r.onSubmit(i);if(o?.data){await m?.(o.data),r?.next();return}if(o?.error){let p=n(o?.fieldErrors||[],r.meta?.fields?.contract_details);a?.({error:o.error,rawError:o.rawError,fieldErrors:p})}}catch(e){a?.({error:e,rawError:e,fieldErrors:[]})}},"handleSubmit");return E(l,{defaultValues:r.stepState.values?.contract_details||r.initialValues.contract_details,onSubmit:c})}t(S,"ContractDetailsStep");export{S as a};
2
+ //# sourceMappingURL=chunk-IOZFJ65G.js.map
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-XEUZL7O2.js";import{b as s}from"./chunk-PGWKJ6FK.js";import{b as t}from"./chunk-2YTBWEC7.js";import{a}from"./chunk-P37U34EQ.js";import{jsx as E}from"react/jsx-runtime";function b({onSubmit:d,onSuccess:l,onError:n}){let{onboardingBag:r}=s(),f=a(async e=>{try{let i=await r.parseFormValues(e);await d?.(i);let o=await r.onSubmit(e);if(o?.data){await l?.(o?.data),r?.next();return}if(o?.error){let c=t(o?.fieldErrors||[],r.meta?.fields?.basic_information);n?.({error:o?.error,rawError:o?.rawError,fieldErrors:c})}}catch(i){n?.({error:i,rawError:i,fieldErrors:[]})}},"handleSubmit"),p=r.stepState.values?.basic_information||r.initialValues.basic_information;return E(m,{defaultValues:p,onSubmit:f})}a(b,"BasicInformationStep");export{b as a};
2
- //# sourceMappingURL=chunk-7YY7DH4I.js.map
1
+ import{a as m}from"./chunk-65HLULDL.js";import{b as s}from"./chunk-PGWKJ6FK.js";import{b as t}from"./chunk-2YTBWEC7.js";import{a}from"./chunk-P37U34EQ.js";import{jsx as E}from"react/jsx-runtime";function b({onSubmit:d,onSuccess:l,onError:n}){let{onboardingBag:r}=s(),f=a(async e=>{try{let i=await r.parseFormValues(e);await d?.(i);let o=await r.onSubmit(e);if(o?.data){await l?.(o?.data),r?.next();return}if(o?.error){let c=t(o?.fieldErrors||[],r.meta?.fields?.basic_information);n?.({error:o?.error,rawError:o?.rawError,fieldErrors:c})}}catch(i){n?.({error:i,rawError:i,fieldErrors:[]})}},"handleSubmit"),p=r.stepState.values?.basic_information||r.initialValues.basic_information;return E(m,{defaultValues:p,onSubmit:f})}a(b,"BasicInformationStep");export{b as a};
2
+ //# sourceMappingURL=chunk-KCXAXVC5.js.map
@@ -1,2 +1,2 @@
1
- import{a as r}from"./chunk-5VPMZXGU.js";import{a}from"./chunk-V2L3UV7M.js";import{a as c}from"./chunk-CDCKGIF5.js";import{a as e}from"./chunk-BZUYUGQF.js";import{a as m}from"./chunk-FUMA5UUB.js";import{a as o}from"./chunk-TVZAFTPT.js";import{a as n}from"./chunk-P37U34EQ.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-WUZ5OZ42.js.map
1
+ import{a as r}from"./chunk-BAWJZ6MA.js";import{a}from"./chunk-Y2NSR2N6.js";import{a as c}from"./chunk-CDCKGIF5.js";import{a as e}from"./chunk-F3KEIVSE.js";import{a as m}from"./chunk-FUMA5UUB.js";import{a as o}from"./chunk-TVZAFTPT.js";import{a as n}from"./chunk-P37U34EQ.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-KY2JSZI3.js.map
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-O6YXA5AM.js";import{b as a}from"./chunk-TOA3JILU.js";import{a as t}from"./chunk-P37U34EQ.js";import{jsx as d}from"react/jsx-runtime";function y({onSubmit:c,onSuccess:s,onError:e}){let{contractorOnboardingBag:o}=a(),u=t(async n=>{try{await c?.({countryCode:n.country});let r=await o.onSubmit(n);if(r?.data){await s?.(r?.data),o?.next();return}r?.error&&e?.({error:r.error,rawError:r.rawError,fieldErrors:[]})}catch(r){e?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit"),l=o.stepState.values?.select_country||o.initialValues.select_country;return d(i,{defaultValues:l,onSubmit:u})}t(y,"SelectCountryStep");export{y as a};
2
- //# sourceMappingURL=chunk-T4KJKYPC.js.map
1
+ import{a as i}from"./chunk-4STFNBEP.js";import{b as a}from"./chunk-TOA3JILU.js";import{a as t}from"./chunk-P37U34EQ.js";import{jsx as d}from"react/jsx-runtime";function y({onSubmit:c,onSuccess:s,onError:e}){let{contractorOnboardingBag:o}=a(),u=t(async n=>{try{await c?.({countryCode:n.country});let r=await o.onSubmit(n);if(r?.data){await s?.(r?.data),o?.next();return}r?.error&&e?.({error:r.error,rawError:r.rawError,fieldErrors:[]})}catch(r){e?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit"),l=o.stepState.values?.select_country||o.initialValues.select_country;return d(i,{defaultValues:l,onSubmit:u})}t(y,"SelectCountryStep");export{y as a};
2
+ //# sourceMappingURL=chunk-LJUHIEEZ.js.map
@@ -0,0 +1,2 @@
1
+ import{b as r}from"./chunk-MRYRNB7Y.js";import{a as n}from"./chunk-6GTRAHWJ.js";import{b as o}from"./chunk-KQPDXXG3.js";import{a as t}from"./chunk-P37U34EQ.js";import{jsx as f}from"react/jsx-runtime";function d({children:i,...m}){let{formId:u}=r(),{components:e}=o(),s=e?.button||n;return f(s,{...m,form:u,children:i})}t(d,"TerminationSubmit");export{d as a};
2
+ //# sourceMappingURL=chunk-LQBVRVXH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Termination/TerminationSubmit.tsx"],"sourcesContent":["import { ButtonHTMLAttributes, PropsWithChildren } from 'react';\nimport { useTerminationContext } from './context';\nimport { useFormFields } from '@/src/context';\nimport { ButtonDefault } from '@/src/components/form/fields/default/ButtonDefault';\n\nexport function TerminationSubmit({\n children,\n ...props\n}: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>> &\n Record<string, unknown>) {\n const { formId } = useTerminationContext();\n const { components } = useFormFields();\n\n const CustomButton = components?.button || ButtonDefault;\n return (\n <CustomButton {...props} form={formId}>\n {children}\n </CustomButton>\n );\n}\n"],"mappings":"gKAeI,cAAAA,MAAA,oBAVG,SAASC,EAAkB,CAChC,SAAAC,EACA,GAAGC,CACL,EAC2B,CACzB,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAsB,EACnC,CAAE,WAAAC,CAAW,EAAIC,EAAc,EAE/BC,EAAeF,GAAY,QAAUG,EAC3C,OACET,EAACQ,EAAA,CAAc,GAAGL,EAAO,KAAMC,EAC5B,SAAAF,EACH,CAEJ,CAdgBQ,EAAAT,EAAA","names":["jsx","TerminationSubmit","children","props","formId","useTerminationContext","components","useFormFields","CustomButton","ButtonDefault","__name"]}
@@ -0,0 +1,2 @@
1
+ import{b as r}from"./chunk-MRYRNB7Y.js";import{a as i}from"./chunk-6GTRAHWJ.js";import{b as n}from"./chunk-KQPDXXG3.js";import{a as o}from"./chunk-P37U34EQ.js";import{jsx as B}from"react/jsx-runtime";function f({children:e,...t}){let{terminationBag:{back:u}}=r(),{components:m}=n(),s=m?.button||i;return B(s,{...t,onClick:c=>{u(),t.onClick?.(c)},children:e})}o(f,"TerminationBack");export{f as a};
2
+ //# sourceMappingURL=chunk-M2TLNSTK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Termination/TerminationBack.tsx"],"sourcesContent":["import { ButtonHTMLAttributes, PropsWithChildren } from 'react';\nimport { useTerminationContext } from '@/src/flows/Termination/context';\nimport { useFormFields } from '@/src/context';\nimport { ButtonDefault } from '@/src/components/form/fields/default/ButtonDefault';\n\nexport function TerminationBack({\n children,\n ...props\n}: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>> &\n Record<string, unknown>) {\n const {\n terminationBag: { back },\n } = useTerminationContext();\n\n const { components } = useFormFields();\n\n const CustomButton = components?.button || ButtonDefault;\n return (\n <CustomButton\n {...props}\n onClick={(evt) => {\n back();\n props.onClick?.(evt);\n }}\n >\n {children}\n </CustomButton>\n );\n}\n"],"mappings":"gKAkBI,cAAAA,MAAA,oBAbG,SAASC,EAAgB,CAC9B,SAAAC,EACA,GAAGC,CACL,EAC2B,CACzB,GAAM,CACJ,eAAgB,CAAE,KAAAC,CAAK,CACzB,EAAIC,EAAsB,EAEpB,CAAE,WAAAC,CAAW,EAAIC,EAAc,EAE/BC,EAAeF,GAAY,QAAUG,EAC3C,OACET,EAACQ,EAAA,CACE,GAAGL,EACJ,QAAUO,GAAQ,CAChBN,EAAK,EACLD,EAAM,UAAUO,CAAG,CACrB,EAEC,SAAAR,EACH,CAEJ,CAvBgBS,EAAAV,EAAA","names":["jsx","TerminationBack","children","props","back","useTerminationContext","components","useFormFields","CustomButton","ButtonDefault","evt","__name"]}
@@ -1,2 +1,2 @@
1
- import{b as u}from"./chunk-MRYRNB7Y.js";import{a as f}from"./chunk-LD2UDBK4.js";import{b as a}from"./chunk-LNV36S6D.js";import{f as s,g as l}from"./chunk-66N57DKF.js";import{a as t}from"./chunk-P37U34EQ.js";import{useEffect as y}from"react";import{jsx as r}from"react/jsx-runtime";function B({defaultValues:F,fields:m,onSubmit:d}){let{formId:c,terminationBag:o}=u(),p=a(o.handleValidation),e=s({resolver:p,defaultValues:F,shouldUnregister:!1,mode:"onBlur"});y(()=>{let V=e?.watch(i=>{Object.keys(i).some(n=>i[n]!==o?.initialValues?.[n])&&o?.checkFieldUpdates(i)});return()=>V?.unsubscribe()},[]);let T=m||(o?.fields??[]);return r(l,{...e,children:r("form",{id:c,onSubmit:e.handleSubmit(d),className:"space-y-4 RemoteFlows__TerminationForm",children:r(f,{fields:T})})})}t(B,"TerminationForm");export{B as a};
2
- //# sourceMappingURL=chunk-ASSO5FYG.js.map
1
+ import{b as u}from"./chunk-MRYRNB7Y.js";import{a as f}from"./chunk-ZP2BE7U6.js";import{b as a}from"./chunk-LNV36S6D.js";import{f as s,g as l}from"./chunk-66N57DKF.js";import{a as t}from"./chunk-P37U34EQ.js";import{useEffect as y}from"react";import{jsx as r}from"react/jsx-runtime";function B({defaultValues:F,fields:m,onSubmit:d}){let{formId:c,terminationBag:o}=u(),p=a(o.handleValidation),e=s({resolver:p,defaultValues:F,shouldUnregister:!1,mode:"onBlur"});y(()=>{let V=e?.watch(i=>{Object.keys(i).some(n=>i[n]!==o?.initialValues?.[n])&&o?.checkFieldUpdates(i)});return()=>V?.unsubscribe()},[]);let T=m||(o?.fields??[]);return r(l,{...e,children:r("form",{id:c,onSubmit:e.handleSubmit(d),className:"space-y-4 RemoteFlows__TerminationForm",children:r(f,{fields:T})})})}t(B,"TerminationForm");export{B as a};
2
+ //# sourceMappingURL=chunk-MNSIBSAM.js.map
@@ -1,2 +1,2 @@
1
- import{a as Z}from"./chunk-NS4FRCEH.js";import{a as K}from"./chunk-IWA5B4U6.js";import{a as Q}from"./chunk-AT7VHJMW.js";import{a as J}from"./chunk-3SAV2OEE.js";import{a as R}from"./chunk-MKE27NUF.js";import{a as z}from"./chunk-I4XJ764Y.js";import{c as H,d as L}from"./chunk-2TILNBMK.js";import{a as A}from"./chunk-ZXGAFQXW.js";import{a as S,b as E,c as N,d as B,e as q}from"./chunk-QUQLW5YW.js";import{a as D}from"./chunk-Z5WMKCRJ.js";import{a as O}from"./chunk-JA7UP6GN.js";import{a as u,b as $}from"./chunk-7FMR3EIX.js";import{a as v}from"./chunk-2YTBWEC7.js";import{m as b}from"./chunk-NFUP6BFU.js";import{a as I}from"./chunk-PJBAQZ6G.js";import{d as w}from"./chunk-KQPDXXG3.js";import{c as p}from"./chunk-2SO4LW7V.js";import{a as h}from"./chunk-L3Z2G32A.js";import{a as o}from"./chunk-P37U34EQ.js";import{createHeadlessForm as ye}from"@remoteoss/json-schema-form-old";import Te from"lodash.omitby";import Fe from"lodash.isnull";import{format as g,isFuture as Me,parseISO as x,subDays as Se}from"date-fns";import{useMemo as j}from"react";import ge from"lodash.omit";import{useQuery as ce}from"@tanstack/react-query";var U=o(({query:t,options:e})=>{let{client:_}=w();return ce({queryKey:["payroll-calendars"],queryFn:o(()=>b({client:_,query:{year:t?.year,country_code:t?.countryCode}}),"queryFn"),enabled:e?.enabled,select:o(c=>c.data?.data?.payroll_calendars?.[0],"select")})},"usePayrollCalendars");import{isFuture as pe,isToday as ue,parseISO as _e}from"date-fns";var W=o(t=>{if(!t)return!1;let e=_e(t);return pe(e)||ue(e)},"isInProbationPeriod");import{Fragment as xe,jsx as d,jsxs as je}from"react/jsx-runtime";var so=o(({employmentId:t,options:e,initialValues:_})=>{let{fieldValues:c,setFieldValues:Y,stepState:a,previousStep:G,nextStep:X}=I(E),{data:n}=O({employmentId:t}),{data:ee}=U({query:{year:new Date().getFullYear().toString(),countryCode:n?.country?.code},options:{enabled:!!n?.country?.code}}),y=W(n?.probation_period_end_date),T=N(ee),P=j(()=>y?g(new Date,"yyyy-MM-dd"):g(T,"yyyy-MM-dd"),[y,T]),F=!!(n?.provisional_start_date&&Me(x(n.provisional_start_date))),M=q({...a.values?.employee_communication,...a.values?.termination_details,...a.values?.paid_time_off,...a.values?.additional_information,..._},F),f=j(()=>({...M,...a.values?.[a.currentStep.name],...c}),[a.values,a.currentStep.name,c,M]),V=B({minTerminationDate:T,isEmployeeInProbationPeriod:y,selectedDate:x(f.proposed_termination_date)}),oe=j(()=>{let m=A.data.schema.properties.termination_reason.oneOf,r=F?m.filter(i=>i.const==="cancellation_before_start_date"):m.filter(i=>i.const!=="cancellation_before_start_date");return{fields:{risk_assesment_info:S("Offboarding risk assessment","Employees may be protected from termination if they fall into certain categories. To help avoid claims from employees, let us know if the employee is part of one or more of these categories. Select all that apply.",{className:e?.jsfModify?.fields?.risk_assesment_info?.["x-jsf-presentation"]?.className}),termination_reason:{...e?.jsfModify?.fields?.termination_reason,oneOf:r},proposed_termination_date_info:S("Proposed termination date",je(xe,{children:["In most cases, we must provide notice to the employee before termination. The required notice period depends on local labor laws, the employment agreement, and other factors. We'll use those factors to determine the required notice period.",d($,{external:!0,zendeskId:u.terminationNoticePeriods,className:h("text-sm",e?.jsfModify?.fields?.proposed_termination_date_info?.["x-jsf-presentation"]?.zendeskTriggerButtonClassName),children:"Learn about notice periods"})]}),{className:e?.jsfModify?.fields?.proposed_termination_date_info?.["x-jsf-presentation"]?.className}),proposed_termination_date:{...e?.jsfModify?.fields?.proposed_termination_date,"x-jsf-presentation":{...e?.jsfModify?.fields?.proposed_termination_date?.["x-jsf-presentation"],minDate:P,...f.termination_reason==="cancellation_before_start_date"&&n?.provisional_start_date?{maxDate:g(Se(x(n.provisional_start_date),1),"yyyy-MM-dd")}:{},...V},...f.termination_reason==="cancellation_before_start_date"?{"x-jsf-errorMessage":{maximum:"The proposed termination date must be before the employee's start date."}}:{}},paid_time_off_info:{...e?.jsfModify?.fields?.paid_time_off_info,"x-jsf-presentation":{...e?.jsfModify?.fields?.paid_time_off_info?.["x-jsf-presentation"],Component:o(()=>{let i=e?.jsfModify?.fields?.paid_time_off_info?.["x-jsf-presentation"]?.Component;return d(Z,{employeeName:n?.basic_information?.name,proposedTerminationDate:f.proposed_termination_date,employmentId:t,employment:n,render:s=>i?d(i,{...s}):d(R,{...s})})},"Component")}},acknowledge_termination_procedure_info:{...e?.jsfModify?.fields?.acknowledge_termination_procedure_info,"x-jsf-presentation":{...e?.jsfModify?.fields?.acknowledge_termination_procedure_info?.["x-jsf-presentation"],Component:o(()=>{let i=e?.jsfModify?.fields?.acknowledge_termination_procedure_info?.["x-jsf-presentation"]?.Component;return d(K,{render:s=>i?d(i,{...s}):d(Q,{...s})})},"Component")}},acknowledge_termination_procedure_fees_info:{...e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info,"x-jsf-presentation":{...e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info?.["x-jsf-presentation"],Component:o(()=>{let i={involuntaryOffboardingServiceChargeZendeskId:u.involuntaryOffboardingServiceCharge,reconciliationInvoiceZendeskId:u.reconciliationInvoice},s=e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info?.["x-jsf-presentation"]?.Component;return s?d(s,{...i}):d(J,{...i})},"Component")}}}}},[n,t,f.proposed_termination_date,f.termination_reason,F,P,e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info,e?.jsfModify?.fields?.acknowledge_termination_procedure_info,e?.jsfModify?.fields?.paid_time_off_info,e?.jsfModify?.fields?.proposed_termination_date,e?.jsfModify?.fields?.proposed_termination_date_info,e?.jsfModify?.fields?.risk_assesment_info,e?.jsfModify?.fields?.termination_reason,V]),{data:l,isLoading:ie}=L({formValues:f,jsfModify:{...e?.jsfModify,fields:{...e?.jsfModify?.fields,...oe?.fields}},step:a.currentStep.name}),te=ye(z.data.schema),k=H(),{mutateAsync:ne}=v(k);async function ae(m){if(!t)throw new Error("Employment id is missing");if(l){let r=await C(m,!0),{customer_informed_employee:i}=r,s=i==="yes"?{employee_awareness:{date:r.customer_informed_employee_date,note:r.customer_informed_employee_description}}:void 0,de=await D(r,["agrees_to_pto_amount","confidential","customer_informed_employee","will_challenge_termination"]),fe=ge(de,"customer_informed_employee_date","customer_informed_employee_description"),le=Te({...fe,...s},Fe);return ne({employment_id:t,termination_details:le,type:"termination"})}}o(ae,"onSubmit");function re(){G()}o(re,"back");function se(){X()}o(se,"next");let me=Object.keys(c).length>0,C=o(async(m,r=!1)=>r?await p(m,te.fields,{isPartialValidation:!0}):l?await p(m,l?.fields,{isPartialValidation:!0}):{},"parseFormValues");return{employmentId:t,employment:n,fieldValues:f,isDirty:me,stepState:a,fields:l?.fields||[],isLoading:ie,isSubmitting:k.isPending,initialValues:M,handleValidation:o(async m=>{if(l){let r=await p(m,l?.fields);return l?.handleValidation(r)}return null},"handleValidation"),checkFieldUpdates:Y,parseFormValues:C,onSubmit:ae,back:re,next:se}},"useTermination");export{so as a};
2
- //# sourceMappingURL=chunk-L23UIJDU.js.map
1
+ import{a as Z}from"./chunk-NS4FRCEH.js";import{a as K}from"./chunk-IWA5B4U6.js";import{a as Q}from"./chunk-AT7VHJMW.js";import{a as J}from"./chunk-BHYFPY64.js";import{a as R}from"./chunk-XRI6PRXK.js";import{a as z}from"./chunk-I4XJ764Y.js";import{c as H,d as L}from"./chunk-2TILNBMK.js";import{a as A}from"./chunk-ZXGAFQXW.js";import{a as S,b as E,c as N,d as B,e as q}from"./chunk-QUQLW5YW.js";import{a as D}from"./chunk-Z5WMKCRJ.js";import{a as O}from"./chunk-JA7UP6GN.js";import{a as u,b as $}from"./chunk-E5PHO3SS.js";import{a as v}from"./chunk-2YTBWEC7.js";import{m as b}from"./chunk-NFUP6BFU.js";import{a as I}from"./chunk-PJBAQZ6G.js";import{d as w}from"./chunk-KQPDXXG3.js";import{c as p}from"./chunk-2SO4LW7V.js";import{a as h}from"./chunk-L3Z2G32A.js";import{a as o}from"./chunk-P37U34EQ.js";import{createHeadlessForm as ye}from"@remoteoss/json-schema-form-old";import Te from"lodash.omitby";import Fe from"lodash.isnull";import{format as g,isFuture as Me,parseISO as x,subDays as Se}from"date-fns";import{useMemo as j}from"react";import ge from"lodash.omit";import{useQuery as ce}from"@tanstack/react-query";var U=o(({query:t,options:e})=>{let{client:_}=w();return ce({queryKey:["payroll-calendars"],queryFn:o(()=>b({client:_,query:{year:t?.year,country_code:t?.countryCode}}),"queryFn"),enabled:e?.enabled,select:o(c=>c.data?.data?.payroll_calendars?.[0],"select")})},"usePayrollCalendars");import{isFuture as pe,isToday as ue,parseISO as _e}from"date-fns";var W=o(t=>{if(!t)return!1;let e=_e(t);return pe(e)||ue(e)},"isInProbationPeriod");import{Fragment as xe,jsx as d,jsxs as je}from"react/jsx-runtime";var so=o(({employmentId:t,options:e,initialValues:_})=>{let{fieldValues:c,setFieldValues:Y,stepState:a,previousStep:G,nextStep:X}=I(E),{data:n}=O({employmentId:t}),{data:ee}=U({query:{year:new Date().getFullYear().toString(),countryCode:n?.country?.code},options:{enabled:!!n?.country?.code}}),y=W(n?.probation_period_end_date),T=N(ee),P=j(()=>y?g(new Date,"yyyy-MM-dd"):g(T,"yyyy-MM-dd"),[y,T]),F=!!(n?.provisional_start_date&&Me(x(n.provisional_start_date))),M=q({...a.values?.employee_communication,...a.values?.termination_details,...a.values?.paid_time_off,...a.values?.additional_information,..._},F),f=j(()=>({...M,...a.values?.[a.currentStep.name],...c}),[a.values,a.currentStep.name,c,M]),V=B({minTerminationDate:T,isEmployeeInProbationPeriod:y,selectedDate:x(f.proposed_termination_date)}),oe=j(()=>{let m=A.data.schema.properties.termination_reason.oneOf,r=F?m.filter(i=>i.const==="cancellation_before_start_date"):m.filter(i=>i.const!=="cancellation_before_start_date");return{fields:{risk_assesment_info:S("Offboarding risk assessment","Employees may be protected from termination if they fall into certain categories. To help avoid claims from employees, let us know if the employee is part of one or more of these categories. Select all that apply.",{className:e?.jsfModify?.fields?.risk_assesment_info?.["x-jsf-presentation"]?.className}),termination_reason:{...e?.jsfModify?.fields?.termination_reason,oneOf:r},proposed_termination_date_info:S("Proposed termination date",je(xe,{children:["In most cases, we must provide notice to the employee before termination. The required notice period depends on local labor laws, the employment agreement, and other factors. We'll use those factors to determine the required notice period.",d($,{external:!0,zendeskId:u.terminationNoticePeriods,className:h("text-sm",e?.jsfModify?.fields?.proposed_termination_date_info?.["x-jsf-presentation"]?.zendeskTriggerButtonClassName),children:"Learn about notice periods"})]}),{className:e?.jsfModify?.fields?.proposed_termination_date_info?.["x-jsf-presentation"]?.className}),proposed_termination_date:{...e?.jsfModify?.fields?.proposed_termination_date,"x-jsf-presentation":{...e?.jsfModify?.fields?.proposed_termination_date?.["x-jsf-presentation"],minDate:P,...f.termination_reason==="cancellation_before_start_date"&&n?.provisional_start_date?{maxDate:g(Se(x(n.provisional_start_date),1),"yyyy-MM-dd")}:{},...V},...f.termination_reason==="cancellation_before_start_date"?{"x-jsf-errorMessage":{maximum:"The proposed termination date must be before the employee's start date."}}:{}},paid_time_off_info:{...e?.jsfModify?.fields?.paid_time_off_info,"x-jsf-presentation":{...e?.jsfModify?.fields?.paid_time_off_info?.["x-jsf-presentation"],Component:o(()=>{let i=e?.jsfModify?.fields?.paid_time_off_info?.["x-jsf-presentation"]?.Component;return d(Z,{employeeName:n?.basic_information?.name,proposedTerminationDate:f.proposed_termination_date,employmentId:t,employment:n,render:s=>i?d(i,{...s}):d(R,{...s})})},"Component")}},acknowledge_termination_procedure_info:{...e?.jsfModify?.fields?.acknowledge_termination_procedure_info,"x-jsf-presentation":{...e?.jsfModify?.fields?.acknowledge_termination_procedure_info?.["x-jsf-presentation"],Component:o(()=>{let i=e?.jsfModify?.fields?.acknowledge_termination_procedure_info?.["x-jsf-presentation"]?.Component;return d(K,{render:s=>i?d(i,{...s}):d(Q,{...s})})},"Component")}},acknowledge_termination_procedure_fees_info:{...e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info,"x-jsf-presentation":{...e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info?.["x-jsf-presentation"],Component:o(()=>{let i={involuntaryOffboardingServiceChargeZendeskId:u.involuntaryOffboardingServiceCharge,reconciliationInvoiceZendeskId:u.reconciliationInvoice},s=e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info?.["x-jsf-presentation"]?.Component;return s?d(s,{...i}):d(J,{...i})},"Component")}}}}},[n,t,f.proposed_termination_date,f.termination_reason,F,P,e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info,e?.jsfModify?.fields?.acknowledge_termination_procedure_info,e?.jsfModify?.fields?.paid_time_off_info,e?.jsfModify?.fields?.proposed_termination_date,e?.jsfModify?.fields?.proposed_termination_date_info,e?.jsfModify?.fields?.risk_assesment_info,e?.jsfModify?.fields?.termination_reason,V]),{data:l,isLoading:ie}=L({formValues:f,jsfModify:{...e?.jsfModify,fields:{...e?.jsfModify?.fields,...oe?.fields}},step:a.currentStep.name}),te=ye(z.data.schema),k=H(),{mutateAsync:ne}=v(k);async function ae(m){if(!t)throw new Error("Employment id is missing");if(l){let r=await C(m,!0),{customer_informed_employee:i}=r,s=i==="yes"?{employee_awareness:{date:r.customer_informed_employee_date,note:r.customer_informed_employee_description}}:void 0,de=await D(r,["agrees_to_pto_amount","confidential","customer_informed_employee","will_challenge_termination"]),fe=ge(de,"customer_informed_employee_date","customer_informed_employee_description"),le=Te({...fe,...s},Fe);return ne({employment_id:t,termination_details:le,type:"termination"})}}o(ae,"onSubmit");function re(){G()}o(re,"back");function se(){X()}o(se,"next");let me=Object.keys(c).length>0,C=o(async(m,r=!1)=>r?await p(m,te.fields,{isPartialValidation:!0}):l?await p(m,l?.fields,{isPartialValidation:!0}):{},"parseFormValues");return{employmentId:t,employment:n,fieldValues:f,isDirty:me,stepState:a,fields:l?.fields||[],isLoading:ie,isSubmitting:k.isPending,initialValues:M,handleValidation:o(async m=>{if(l){let r=await p(m,l?.fields);return l?.handleValidation(r)}return null},"handleValidation"),checkFieldUpdates:Y,parseFormValues:C,onSubmit:ae,back:re,next:se}},"useTermination");export{so as a};
2
+ //# sourceMappingURL=chunk-O37C4LZF.js.map
@@ -1,2 +1,2 @@
1
- import{a as r}from"./chunk-QP3VWGCS.js";import{a as t}from"./chunk-L23UIJDU.js";import{a as f}from"./chunk-D3YUACHO.js";import{a as e}from"./chunk-DS5MV4BA.js";import{a as p}from"./chunk-RNULWNWR.js";import{a as n}from"./chunk-STPJXT2A.js";import{a}from"./chunk-KDMBZNAE.js";import{a as m}from"./chunk-MRYRNB7Y.js";import{a as i}from"./chunk-P37U34EQ.js";import{useId as c}from"react";import{jsx as F}from"react/jsx-runtime";var k=i(({employmentId:l,render:T,options:d,initialValues:s})=>{let u=c(),o=t({employmentId:l,options:d,initialValues:s});return F(m.Provider,{value:{formId:u,terminationBag:o},children:T({terminationBag:o,components:{SubmitButton:r,Back:n,EmployeeComunicationStep:e,TerminationDetailsStep:a,PaidTimeOffStep:p,AdditionalDetailsStep:f}})})},"TerminationFlow");export{k as a};
2
- //# sourceMappingURL=chunk-COKMRJQ7.js.map
1
+ import{a as r}from"./chunk-LQBVRVXH.js";import{a as t}from"./chunk-O37C4LZF.js";import{a as f}from"./chunk-3TZG2IN7.js";import{a as e}from"./chunk-GBZXVNGQ.js";import{a as p}from"./chunk-CULOWG5X.js";import{a as n}from"./chunk-M2TLNSTK.js";import{a}from"./chunk-46FT5RHQ.js";import{a as m}from"./chunk-MRYRNB7Y.js";import{a as i}from"./chunk-P37U34EQ.js";import{useId as c}from"react";import{jsx as F}from"react/jsx-runtime";var k=i(({employmentId:l,render:T,options:d,initialValues:s})=>{let u=c(),o=t({employmentId:l,options:d,initialValues:s});return F(m.Provider,{value:{formId:u,terminationBag:o},children:T({terminationBag:o,components:{SubmitButton:r,Back:n,EmployeeComunicationStep:e,TerminationDetailsStep:a,PaidTimeOffStep:p,AdditionalDetailsStep:f}})})},"TerminationFlow");export{k as a};
2
+ //# sourceMappingURL=chunk-OUI554QS.js.map
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-O6YXA5AM.js";import{b as s}from"./chunk-TOA3JILU.js";import{b as e}from"./chunk-2YTBWEC7.js";import{a as i}from"./chunk-P37U34EQ.js";import{jsx as E}from"react/jsx-runtime";function b({onSubmit:d,onSuccess:l,onError:n}){let{contractorOnboardingBag:r}=s(),c=i(async t=>{try{let a=await r.parseFormValues(t);await d?.(a);let o=await r.onSubmit(t);if(o?.data){await l?.(o?.data),r?.next();return}if(o?.error){let p=e(o?.fieldErrors||[],r.meta?.fields?.basic_information);n?.({error:o?.error,rawError:o?.rawError,fieldErrors:p})}}catch(a){n?.({error:a,rawError:a,fieldErrors:[]})}},"handleSubmit"),f=r.stepState.values?.basic_information||r.initialValues.basic_information;return E(m,{defaultValues:f,onSubmit:c})}i(b,"BasicInformationStep");export{b as a};
2
- //# sourceMappingURL=chunk-PTHW7GI4.js.map
1
+ import{a as m}from"./chunk-4STFNBEP.js";import{b as s}from"./chunk-TOA3JILU.js";import{b as e}from"./chunk-2YTBWEC7.js";import{a as i}from"./chunk-P37U34EQ.js";import{jsx as E}from"react/jsx-runtime";function b({onSubmit:d,onSuccess:l,onError:n}){let{contractorOnboardingBag:r}=s(),c=i(async t=>{try{let a=await r.parseFormValues(t);await d?.(a);let o=await r.onSubmit(t);if(o?.data){await l?.(o?.data),r?.next();return}if(o?.error){let p=e(o?.fieldErrors||[],r.meta?.fields?.basic_information);n?.({error:o?.error,rawError:o?.rawError,fieldErrors:p})}}catch(a){n?.({error:a,rawError:a,fieldErrors:[]})}},"handleSubmit"),f=r.stepState.values?.basic_information||r.initialValues.basic_information;return E(m,{defaultValues:f,onSubmit:c})}i(b,"BasicInformationStep");export{b as a};
2
+ //# sourceMappingURL=chunk-QJ5MCAIN.js.map
@@ -1,2 +1,2 @@
1
- import{a as X}from"./chunk-NCWPOV3B.js";import{a as G}from"./chunk-VFRHMNLJ.js";import{a as I,b as z,c as Q,f as W}from"./chunk-XQL5I2GC.js";import{a as C}from"./chunk-HN5HLFTB.js";import{a as K}from"./chunk-LNV36S6D.js";import{c as Y}from"./chunk-26DGUFCY.js";import{a as Z}from"./chunk-2YTBWEC7.js";import{c as V}from"./chunk-2SO4LW7V.js";import{a as o}from"./chunk-P37U34EQ.js";import{number as Te,object as oe}from"yup";import{createHeadlessForm as Ve,modify as je}from"@remoteoss/json-schema-form-old";import{useCallback as we,useEffect as ee,useMemo as Re,useRef as Pe,useState as j}from"react";import{string as te,ValidationError as ne}from"yup";import{jsx as re}from"react/jsx-runtime";var O={title:"Estimation",includeBenefits:!1,includeCostBreakdowns:!1,includePremiumBenefits:!1,enableCurrencyConversion:!1,includeEstimationTitle:!1,includeManagementFee:!1},xe=o(t=>{let{schema:i}=je(G.data.schema,t?.jsfModify||{});return Ve(i)},"useStaticSchema");function Be(t,i){if(typeof t=="object"&&t!==null&&"title"in t){let l=t.title;if(l)return l}return i==="my_hiring_budget"?"Hiring budget":"Employee's annual salary"}o(Be,"getSalaryTitle");var Qe=o(({defaultRegion:t,defaultCurrency:i,defaultSalary:l,estimationOptions:s,options:n,version:a}={estimationOptions:O})=>{let c=Pe({fields:{}}),[k,E]=j(t),[w,R]=j(),[m,q]=j(),[H,se]=j(),{data:_,isLoading:le}=I({includePremiumBenefits:s.includePremiumBenefits}),{data:d,isLoading:ce}=z(),ue=k||w?.value,{data:P,isLoading:me}=W(ue,{includePremiumBenefits:s.includePremiumBenefits,options:n}),U=Q(),{mutateAsync:de}=Z(U),b=w?.currency,p=n?.jsfModify?.fields?.salary,F=p&&typeof p=="object"&&"presentation"in p?p.presentation:void 0,L=we(()=>{let e=b&&m?b!==m:!1;return b!==m?{from:m,to:b,shouldSwapOrder:e}:{from:b,to:m,shouldSwapOrder:e}},[b,m]),J=s.showManagementFee,$=s.includeEstimationTitle,fe=Re(()=>{let{from:e,to:r,shouldSwapOrder:u}=L(),g=Be(p,H);return{fields:{salary:{...p,title:g,presentation:{salary_conversion_properties:{label:F?.salary_conversion_properties?.label,description:F?.salary_conversion_properties?.description},currencies:{from:e,to:r},Component:o(y=>re(X,{...y,shouldSwapOrder:u,conversionType:a==="marketing"?"no_spread":"spread",defaultValue:l}),"Component")}},hiring_budget:{...n?.jsfModify?.fields?.hiring_budget,presentation:{hidden:a=="marketing"}},management:{...n?.jsfModify?.fields?.management,properties:{...n?.jsfModify?.fields?.management?.properties,management_fee:{...n?.jsfModify?.fields?.management?.properties?.management_fee,"x-jsf-presentation":{inputType:"money",additionalProps:{currency:m||"USD"}}}},presentation:{...typeof n?.jsfModify?.fields?.management=="object"?(n?.jsfModify?.fields?.management)["x-jsf-presentation"]:{},hidden:!J,Component:o(y=>re(Y,{...y,variant:"inset",features:{toggle:{enabled:!0,stateField:"management._expanded",labels:{expand:"Define",collapse:"Remove"}}}}),"Component")}},estimation_title:{...n?.jsfModify?.fields?.estimation_title,"x-jsf-presentation":{hidden:!$}}}}},[L,p,H,F?.salary_conversion_properties?.label,F?.salary_conversion_properties?.description,n?.jsfModify?.fields?.hiring_budget,n?.jsfModify?.fields?.management,n?.jsfModify?.fields?.estimation_title,a,m,J,$,l]),f=xe({jsfModify:{fields:{...n?.jsfModify?.fields,...fe?.fields}}});ee(()=>{if(t&&_){let e=_.find(({value:r})=>r===t);e&&R(e)}},[t,_]),ee(()=>{if(i&&d){let e=d.find(({value:r})=>r===i);e&&q(e.label)}},[i,d]);async function ge(e){return de(ae(e,s,a))}o(ge,"onSubmit");function ye(e){let r=_?.find(({value:u})=>u===e);r&&r.childRegions.length===0&&r.hasAdditionalFields?E(r.regionSlug):E(void 0),R(r)}o(ye,"onCountryChange");function pe(e){E(e)}o(pe,"onRegionChange");function Ce(e){se(e.target.value)}o(Ce,"onHiringBudgetChange");function _e(e){let r=d?.find(u=>u.value===e)?.label;q(r),n?.onCurrencyChange?.(r||"")}o(_e,"onChangeCurrency");let S=f.fields.find(e=>e.name==="region");if(S){let e=w?.childRegions.map(r=>({value:r.slug,label:r.name}))??[];S.options=e,S.isVisible=e.length>0,S.required=e.length>0,S.onChange=pe,S.schema=e.length>0?te().transform(r=>typeof r=="string"?r:"").required("Region is required"):te()}if(d){let e=f.fields.find(r=>r.name==="currency");e&&(e.options=d,e.onChange=_e)}let v=f.fields.find(e=>e.name==="hiring_budget");if(v&&(v.onChange=Ce),_){let e=f.fields.find(r=>r.name==="country");e&&(e.options=_,e.onChange=ye)}let be=o(()=>{R(void 0),E(t)},"resetForm"),D=[...f.fields.filter(e=>e.name!=="management"),...P?.fields||[],...f.fields.filter(e=>e.name==="management")],N=ie(f.fields,m||"USD",s.includeEstimationTitle);async function Se(e){let r=null;n?.onValidation?.(e);let u=await V(e,D);try{await N.validate(u,{abortEarly:!1}),r={formErrors:{},yupError:new ne([],e)}}catch(h){let B=K(h);r={formErrors:Object.entries(B).reduce((T,[A,M])=>({...T,[A]:M.message}),{}),yupError:h}}let g=P?.handleValidation(u),y=[...r?.yupError.inner||[],...g?.yupError?.inner||[]],x={...r?.yupError?.value||{},...g?.yupError?.value||{}};return{formErrors:{...r?.formErrors||{},...g?.formErrors||{}},yupError:new ne(y,x)}}return o(Se,"handleValidation"),{stepState:{current:0,total:1,isLastStep:!0},fields:D,validationSchema:N,parseFormValues:o(async e=>{let{country:r,region:u,currency:g,salary_converted:y,hiring_budget:x,salary_conversion:h,management:B,estimation_title:T,...A}=e,M=e.salary;y==="salary_conversion"&&(M=h);let he=await V({country:r,region:u,salary:M,salary_converted:y,salary_conversion:h,hiring_budget:x,currency:g,management:B,estimation_title:T},f.fields),Ee=await V(A,P?.fields||[]),Fe={currency_code:d?.find(Me=>Me.value===g)?.label};return{...he,...Ee,...Fe}},"parseFormValues"),handleValidation:Se,isSubmitting:U.isPending,isLoading:le&&ce&&me,onSubmit:ge,resetForm:be,currencies:d,meta:{fields:c.current?.fields}}},"useCostCalculator");function ie(t,i,l){let s=t.reduce((n,a)=>(a.name==="salary"||a.name==="salary_conversion"?n[a.name]=a.schema.when("salary_converted",{is:o(c=>c===a.name,"is"),then:o(c=>c.required("Required field"),"then"),otherwise:o(c=>c.optional(),"otherwise")}):a.name==="management"?n[a.name]=oe({management_fee:Te().transform(c=>isNaN(c)?void 0:c).min(0,"Management fee must be greater than or equal to 0").max(i?C[i]:C.USD,()=>`Management fee cannot exceed ${(i?C[i]:C.USD)/100} ${i}`)}):a.name==="estimation_title"&&l?n[a.name]=a.schema.required("Required field"):n[a.name]=a.schema,n),{});return oe(s)}o(ie,"buildValidationSchema");function Ae(t){let i="benefit-";return Object.keys(t).reduce((l,s)=>{let n=t[s];if(n==="none")return l;let c={benefit_group_slug:s.replace(i,""),benefit_tier_slug:n};return[...l,c]},[])}o(Ae,"formatBenefits");function Oe(t,i,l){let s=Number(t.management?.management_fee),n=t.currency_code;return{...{region_slug:t.region||t.country,employment_term:t.contract_duration_type??"fixed",title:t.estimation_title||i.title,age:t.age??void 0,...t.benefits&&{benefits:Ae(t.benefits)},...i.includeManagementFee&&s&&{discount:{quoted_amount:i.showManagementFee?s:C[n]||C.USD,text:""}}},...ke(t,l)}}o(Oe,"mapValueToEmployment");function ke(t,i){let l=i==="marketing"||t.salary_converted==="salary_conversion",s=i==="standard"&&t.salary_converted==="salary",n=t.hiring_budget==="my_hiring_budget";if(l){let a=t.salary_converted==="salary_conversion";return n?{annual_total_cost_in_employer_currency:t.salary}:{[a?"annual_gross_salary_in_employer_currency":"annual_gross_salary"]:t.salary}}return s?n?{annual_total_cost:t.salary}:{annual_gross_salary:t.salary}:{}}o(ke,"getSalaryFields");function ae(t,i=O,l="standard"){let s=Array.isArray(t)?t:[t];if(s.length===0)throw new Error("At least one employment value is required");return s.length>1&&new Set(s.map(a=>a.currency)).size>1&&console.warn("Multiple currencies detected in array. Using currency from first employment."),{employer_currency_slug:s[0].currency,include_benefits:i.includeBenefits,include_cost_breakdowns:i.includeCostBreakdowns,include_premium_benefits:i.includePremiumBenefits,include_management_fee:i.includeManagementFee,employments:s.map(n=>Oe(n,i,l))}}o(ae,"buildPayload");export{ie as a,ae as b,O as c,Qe as d};
2
- //# sourceMappingURL=chunk-GT6DVQEB.js.map
1
+ import{a as X}from"./chunk-RVIGZOGF.js";import{a as G}from"./chunk-VFRHMNLJ.js";import{a as I,b as z,c as Q,f as W}from"./chunk-XQL5I2GC.js";import{a as C}from"./chunk-HN5HLFTB.js";import{a as K}from"./chunk-LNV36S6D.js";import{c as Y}from"./chunk-5S66VYFD.js";import{a as Z}from"./chunk-2YTBWEC7.js";import{c as V}from"./chunk-2SO4LW7V.js";import{a as o}from"./chunk-P37U34EQ.js";import{number as Te,object as oe}from"yup";import{createHeadlessForm as Ve,modify as je}from"@remoteoss/json-schema-form-old";import{useCallback as we,useEffect as ee,useMemo as Re,useRef as Pe,useState as j}from"react";import{string as te,ValidationError as ne}from"yup";import{jsx as re}from"react/jsx-runtime";var O={title:"Estimation",includeBenefits:!1,includeCostBreakdowns:!1,includePremiumBenefits:!1,enableCurrencyConversion:!1,includeEstimationTitle:!1,includeManagementFee:!1},xe=o(t=>{let{schema:i}=je(G.data.schema,t?.jsfModify||{});return Ve(i)},"useStaticSchema");function Be(t,i){if(typeof t=="object"&&t!==null&&"title"in t){let l=t.title;if(l)return l}return i==="my_hiring_budget"?"Hiring budget":"Employee's annual salary"}o(Be,"getSalaryTitle");var Qe=o(({defaultRegion:t,defaultCurrency:i,defaultSalary:l,estimationOptions:s,options:n,version:a}={estimationOptions:O})=>{let c=Pe({fields:{}}),[k,E]=j(t),[w,R]=j(),[m,q]=j(),[H,se]=j(),{data:_,isLoading:le}=I({includePremiumBenefits:s.includePremiumBenefits}),{data:d,isLoading:ce}=z(),ue=k||w?.value,{data:P,isLoading:me}=W(ue,{includePremiumBenefits:s.includePremiumBenefits,options:n}),U=Q(),{mutateAsync:de}=Z(U),b=w?.currency,p=n?.jsfModify?.fields?.salary,F=p&&typeof p=="object"&&"presentation"in p?p.presentation:void 0,L=we(()=>{let e=b&&m?b!==m:!1;return b!==m?{from:m,to:b,shouldSwapOrder:e}:{from:b,to:m,shouldSwapOrder:e}},[b,m]),J=s.showManagementFee,$=s.includeEstimationTitle,fe=Re(()=>{let{from:e,to:r,shouldSwapOrder:u}=L(),g=Be(p,H);return{fields:{salary:{...p,title:g,presentation:{salary_conversion_properties:{label:F?.salary_conversion_properties?.label,description:F?.salary_conversion_properties?.description},currencies:{from:e,to:r},Component:o(y=>re(X,{...y,shouldSwapOrder:u,conversionType:a==="marketing"?"no_spread":"spread",defaultValue:l}),"Component")}},hiring_budget:{...n?.jsfModify?.fields?.hiring_budget,presentation:{hidden:a=="marketing"}},management:{...n?.jsfModify?.fields?.management,properties:{...n?.jsfModify?.fields?.management?.properties,management_fee:{...n?.jsfModify?.fields?.management?.properties?.management_fee,"x-jsf-presentation":{inputType:"money",additionalProps:{currency:m||"USD"}}}},presentation:{...typeof n?.jsfModify?.fields?.management=="object"?(n?.jsfModify?.fields?.management)["x-jsf-presentation"]:{},hidden:!J,Component:o(y=>re(Y,{...y,variant:"inset",features:{toggle:{enabled:!0,stateField:"management._expanded",labels:{expand:"Define",collapse:"Remove"}}}}),"Component")}},estimation_title:{...n?.jsfModify?.fields?.estimation_title,"x-jsf-presentation":{hidden:!$}}}}},[L,p,H,F?.salary_conversion_properties?.label,F?.salary_conversion_properties?.description,n?.jsfModify?.fields?.hiring_budget,n?.jsfModify?.fields?.management,n?.jsfModify?.fields?.estimation_title,a,m,J,$,l]),f=xe({jsfModify:{fields:{...n?.jsfModify?.fields,...fe?.fields}}});ee(()=>{if(t&&_){let e=_.find(({value:r})=>r===t);e&&R(e)}},[t,_]),ee(()=>{if(i&&d){let e=d.find(({value:r})=>r===i);e&&q(e.label)}},[i,d]);async function ge(e){return de(ae(e,s,a))}o(ge,"onSubmit");function ye(e){let r=_?.find(({value:u})=>u===e);r&&r.childRegions.length===0&&r.hasAdditionalFields?E(r.regionSlug):E(void 0),R(r)}o(ye,"onCountryChange");function pe(e){E(e)}o(pe,"onRegionChange");function Ce(e){se(e.target.value)}o(Ce,"onHiringBudgetChange");function _e(e){let r=d?.find(u=>u.value===e)?.label;q(r),n?.onCurrencyChange?.(r||"")}o(_e,"onChangeCurrency");let S=f.fields.find(e=>e.name==="region");if(S){let e=w?.childRegions.map(r=>({value:r.slug,label:r.name}))??[];S.options=e,S.isVisible=e.length>0,S.required=e.length>0,S.onChange=pe,S.schema=e.length>0?te().transform(r=>typeof r=="string"?r:"").required("Region is required"):te()}if(d){let e=f.fields.find(r=>r.name==="currency");e&&(e.options=d,e.onChange=_e)}let v=f.fields.find(e=>e.name==="hiring_budget");if(v&&(v.onChange=Ce),_){let e=f.fields.find(r=>r.name==="country");e&&(e.options=_,e.onChange=ye)}let be=o(()=>{R(void 0),E(t)},"resetForm"),D=[...f.fields.filter(e=>e.name!=="management"),...P?.fields||[],...f.fields.filter(e=>e.name==="management")],N=ie(f.fields,m||"USD",s.includeEstimationTitle);async function Se(e){let r=null;n?.onValidation?.(e);let u=await V(e,D);try{await N.validate(u,{abortEarly:!1}),r={formErrors:{},yupError:new ne([],e)}}catch(h){let B=K(h);r={formErrors:Object.entries(B).reduce((T,[A,M])=>({...T,[A]:M.message}),{}),yupError:h}}let g=P?.handleValidation(u),y=[...r?.yupError.inner||[],...g?.yupError?.inner||[]],x={...r?.yupError?.value||{},...g?.yupError?.value||{}};return{formErrors:{...r?.formErrors||{},...g?.formErrors||{}},yupError:new ne(y,x)}}return o(Se,"handleValidation"),{stepState:{current:0,total:1,isLastStep:!0},fields:D,validationSchema:N,parseFormValues:o(async e=>{let{country:r,region:u,currency:g,salary_converted:y,hiring_budget:x,salary_conversion:h,management:B,estimation_title:T,...A}=e,M=e.salary;y==="salary_conversion"&&(M=h);let he=await V({country:r,region:u,salary:M,salary_converted:y,salary_conversion:h,hiring_budget:x,currency:g,management:B,estimation_title:T},f.fields),Ee=await V(A,P?.fields||[]),Fe={currency_code:d?.find(Me=>Me.value===g)?.label};return{...he,...Ee,...Fe}},"parseFormValues"),handleValidation:Se,isSubmitting:U.isPending,isLoading:le&&ce&&me,onSubmit:ge,resetForm:be,currencies:d,meta:{fields:c.current?.fields}}},"useCostCalculator");function ie(t,i,l){let s=t.reduce((n,a)=>(a.name==="salary"||a.name==="salary_conversion"?n[a.name]=a.schema.when("salary_converted",{is:o(c=>c===a.name,"is"),then:o(c=>c.required("Required field"),"then"),otherwise:o(c=>c.optional(),"otherwise")}):a.name==="management"?n[a.name]=oe({management_fee:Te().transform(c=>isNaN(c)?void 0:c).min(0,"Management fee must be greater than or equal to 0").max(i?C[i]:C.USD,()=>`Management fee cannot exceed ${(i?C[i]:C.USD)/100} ${i}`)}):a.name==="estimation_title"&&l?n[a.name]=a.schema.required("Required field"):n[a.name]=a.schema,n),{});return oe(s)}o(ie,"buildValidationSchema");function Ae(t){let i="benefit-";return Object.keys(t).reduce((l,s)=>{let n=t[s];if(n==="none")return l;let c={benefit_group_slug:s.replace(i,""),benefit_tier_slug:n};return[...l,c]},[])}o(Ae,"formatBenefits");function Oe(t,i,l){let s=Number(t.management?.management_fee),n=t.currency_code;return{...{region_slug:t.region||t.country,employment_term:t.contract_duration_type??"fixed",title:t.estimation_title||i.title,age:t.age??void 0,...t.benefits&&{benefits:Ae(t.benefits)},...i.includeManagementFee&&s&&{discount:{quoted_amount:i.showManagementFee?s:C[n]||C.USD,text:""}}},...ke(t,l)}}o(Oe,"mapValueToEmployment");function ke(t,i){let l=i==="marketing"||t.salary_converted==="salary_conversion",s=i==="standard"&&t.salary_converted==="salary",n=t.hiring_budget==="my_hiring_budget";if(l){let a=t.salary_converted==="salary_conversion";return n?{annual_total_cost_in_employer_currency:t.salary}:{[a?"annual_gross_salary_in_employer_currency":"annual_gross_salary"]:t.salary}}return s?n?{annual_total_cost:t.salary}:{annual_gross_salary:t.salary}:{}}o(ke,"getSalaryFields");function ae(t,i=O,l="standard"){let s=Array.isArray(t)?t:[t];if(s.length===0)throw new Error("At least one employment value is required");return s.length>1&&new Set(s.map(a=>a.currency)).size>1&&console.warn("Multiple currencies detected in array. Using currency from first employment."),{employer_currency_slug:s[0].currency,include_benefits:i.includeBenefits,include_cost_breakdowns:i.includeCostBreakdowns,include_premium_benefits:i.includePremiumBenefits,include_management_fee:i.includeManagementFee,employments:s.map(n=>Oe(n,i,l))}}o(ae,"buildPayload");export{ie as a,ae as b,O as c,Qe as d};
2
+ //# sourceMappingURL=chunk-QYWA5XM4.js.map