@remoteoss/remote-flows 1.41.0 → 1.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/dist/CheckboxFieldDefault-OK7JODEG.js +2 -0
  2. package/dist/CountryFieldDefault-ORC6XVVK.js +2 -0
  3. package/dist/DatePickerFieldDefault-EUPACNZD.js +2 -0
  4. package/dist/RadioGroupFieldDefault-XR37OID5.js +2 -0
  5. package/dist/TextAreaFieldDefault-5YJYIBAO.js +2 -0
  6. package/dist/{chunk-SKQZ6BPK.js → chunk-2TAVZJPX.js} +2 -2
  7. package/dist/{chunk-O3KGCVBO.js → chunk-3QSHWQS3.js} +2 -2
  8. package/dist/{chunk-KRZGFZUS.js → chunk-3U4PZ4KB.js} +2 -2
  9. package/dist/{chunk-XFQS2BVE.js → chunk-44F5FY7C.js} +2 -2
  10. package/dist/{chunk-4WBEA4IY.js → chunk-4KKA35AX.js} +2 -2
  11. package/dist/chunk-4LQDSIUG.js +2 -0
  12. package/dist/chunk-4LQDSIUG.js.map +1 -0
  13. package/dist/{chunk-BLCINT3L.js → chunk-4QJUNKBR.js} +2 -2
  14. package/dist/chunk-4RVJJ33G.js +2 -0
  15. package/dist/{chunk-MQTRTRV6.js.map → chunk-4RVJJ33G.js.map} +1 -1
  16. package/dist/{chunk-7EKNQYS5.js → chunk-6NKXOUJW.js} +2 -2
  17. package/dist/{chunk-6YBDMERC.js → chunk-6TKWWM5A.js} +2 -2
  18. package/dist/{chunk-ZY7RAGEL.js → chunk-6WGW27VH.js} +2 -2
  19. package/dist/{chunk-2PMYCCWO.js → chunk-7XZP24UE.js} +2 -2
  20. package/dist/{chunk-MBOKEWSX.js → chunk-A5SRPVT2.js} +2 -2
  21. package/dist/{chunk-UBBUH2DE.js → chunk-A675PPWA.js} +2 -2
  22. package/dist/chunk-BFXBFGBH.js +2 -0
  23. package/dist/chunk-BFXBFGBH.js.map +1 -0
  24. package/dist/{chunk-OKSKBEIR.js → chunk-BJZXTS47.js} +2 -2
  25. package/dist/{chunk-B3OYZQSP.js → chunk-BS2B4OOE.js} +2 -2
  26. package/dist/{chunk-KWIWHDBS.js → chunk-BYDNNJHZ.js} +2 -2
  27. package/dist/chunk-BYDNNJHZ.js.map +1 -0
  28. package/dist/{chunk-HADEU7QX.js → chunk-C332PSLT.js} +2 -2
  29. package/dist/chunk-DN6BXTAC.js +2 -0
  30. package/dist/{chunk-GGULUMOP.js → chunk-EI44AIUW.js} +2 -2
  31. package/dist/{chunk-YXHSALDR.js → chunk-F74X2V2N.js} +2 -2
  32. package/dist/{chunk-6VODJDBH.js → chunk-FJGDFNEH.js} +2 -2
  33. package/dist/chunk-G7N6QIOB.js +2 -0
  34. package/dist/chunk-G7N6QIOB.js.map +1 -0
  35. package/dist/{chunk-PIIWY632.js → chunk-GHHMGTM4.js} +2 -2
  36. package/dist/{chunk-PMRAJKJ5.js → chunk-GNDFT5KG.js} +2 -2
  37. package/dist/{chunk-3PYZQWDY.js → chunk-GR6QMP4Z.js} +2 -2
  38. package/dist/{chunk-MZZFNRW5.js → chunk-H6Z54SNM.js} +2 -2
  39. package/dist/{chunk-ZTNH2YIM.js → chunk-HYNJ3ITY.js} +2 -2
  40. package/dist/{chunk-HGIMRQIZ.js → chunk-ID4S6FWD.js} +2 -2
  41. package/dist/{chunk-NEKE5PRJ.js → chunk-IF42CZJH.js} +2 -2
  42. package/dist/{chunk-KBUBBK2E.js → chunk-IVDF2PMA.js} +2 -2
  43. package/dist/{chunk-HHFDREGB.js → chunk-J3HIQRZO.js} +2 -2
  44. package/dist/{chunk-TJLXZ2ZK.js → chunk-K7HS55JD.js} +2 -2
  45. package/dist/chunk-K7HS55JD.js.map +1 -0
  46. package/dist/{chunk-B5KAHNYW.js → chunk-KSJLZDGY.js} +2 -2
  47. package/dist/{chunk-FEWMPYBF.js → chunk-L3ZVE4JS.js} +2 -2
  48. package/dist/{chunk-7R7AQHV2.js → chunk-LES7J6H4.js} +2 -2
  49. package/dist/{chunk-KFFTPU6V.js → chunk-LVTBMTOU.js} +2 -2
  50. package/dist/{chunk-GTU6MTZH.js → chunk-LXNEYPO5.js} +2 -2
  51. package/dist/{chunk-ICNC2RV5.js → chunk-MG6UYSCR.js} +2 -2
  52. package/dist/{chunk-VMZQN4WU.js → chunk-NRGNFMIO.js} +2 -2
  53. package/dist/{chunk-KEYWBQH2.js → chunk-NZHABET6.js} +2 -2
  54. package/dist/{chunk-XE6HQVLQ.js → chunk-O4CLVNOP.js} +2 -2
  55. package/dist/{chunk-SHOGXN3C.js → chunk-OPDKYPYM.js} +2 -2
  56. package/dist/{chunk-PJPYUB2R.js → chunk-PSCFVUJB.js} +2 -2
  57. package/dist/{chunk-7KMXTQ4C.js → chunk-Q7SMO5VI.js} +2 -2
  58. package/dist/{chunk-UFAQ7CQH.js → chunk-QGC2HCZG.js} +2 -2
  59. package/dist/{chunk-PET4EGTM.js → chunk-QK3FQD6C.js} +2 -2
  60. package/dist/{chunk-FOUXLCEA.js → chunk-QKSYPFRB.js} +2 -2
  61. package/dist/chunk-QQ3PZHXO.js +2 -0
  62. package/dist/chunk-QQ3PZHXO.js.map +1 -0
  63. package/dist/{chunk-MZXFOY5T.js → chunk-QZMSDP2S.js} +2 -2
  64. package/dist/{chunk-P6H7QMKK.js → chunk-RFVHV6RE.js} +2 -2
  65. package/dist/{chunk-OVU2VJM6.js → chunk-S4QKVG2B.js} +2 -2
  66. package/dist/{chunk-57G3ZAX3.js → chunk-SJO4XFQD.js} +2 -2
  67. package/dist/{chunk-VV3LCB77.js → chunk-T7QVVLKT.js} +2 -2
  68. package/dist/{chunk-ZSN43HMP.js → chunk-TMBL5YM4.js} +2 -2
  69. package/dist/{chunk-UD24LBJ6.js → chunk-TNGJKUUV.js} +2 -2
  70. package/dist/{chunk-QV7CEES3.js → chunk-TWULMMMY.js} +2 -2
  71. package/dist/{chunk-WRCHICCJ.js → chunk-TZGC6PWQ.js} +2 -2
  72. package/dist/{chunk-ABQLD4SS.js → chunk-UJWKHGH5.js} +2 -2
  73. package/dist/{chunk-INPMEOFL.js → chunk-UOWQ7UKA.js} +2 -2
  74. package/dist/{chunk-3D7HWCNX.js → chunk-UZBAOB4W.js} +2 -2
  75. package/dist/{chunk-FXJM54I4.js → chunk-V7YF7ICV.js} +2 -2
  76. package/dist/{chunk-I7JKBQHL.js → chunk-VCF327FJ.js} +2 -2
  77. package/dist/chunk-VUQH44VX.js +2 -0
  78. package/dist/chunk-VUQH44VX.js.map +1 -0
  79. package/dist/{chunk-ZMQTQ4UQ.js → chunk-W4BOTAD6.js} +2 -2
  80. package/dist/{chunk-YOFPHSYV.js → chunk-WKAVKFP6.js} +2 -2
  81. package/dist/{chunk-FAJ5I4Q4.js → chunk-WTVYMT5N.js} +2 -2
  82. package/dist/{chunk-XLURXRQT.js → chunk-X25ZOPO6.js} +2 -2
  83. package/dist/{chunk-UELAVKG5.js → chunk-X4IJ52GQ.js} +2 -2
  84. package/dist/{chunk-GJV6HJ3D.js → chunk-XEK3MUYF.js} +2 -2
  85. package/dist/chunk-XGXXXWTH.js +2 -0
  86. package/dist/chunk-XGXXXWTH.js.map +1 -0
  87. package/dist/chunk-XS5ASVWY.js +2 -0
  88. package/dist/chunk-XS5ASVWY.js.map +1 -0
  89. package/dist/{chunk-YQQHCS4S.js → chunk-YADHCTR7.js} +2 -2
  90. package/dist/chunk-YPLIXSIP.js +2 -0
  91. package/dist/chunk-YPLIXSIP.js.map +1 -0
  92. package/dist/{chunk-KH4DEFZT.js → chunk-YW4FHEYJ.js} +2 -2
  93. package/dist/{chunk-S7DDWZOR.js → chunk-ZF3JITFM.js} +2 -2
  94. package/dist/default-components.d.ts +2 -2
  95. package/dist/default-components.js +1 -1
  96. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +1 -1
  97. package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +3 -3
  98. package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
  99. package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +1 -1
  100. package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
  101. package/dist/flows/ContractAmendment/context.d.ts +3 -3
  102. package/dist/flows/ContractAmendment/hooks.d.ts +3 -3
  103. package/dist/flows/ContractAmendment/hooks.js +1 -1
  104. package/dist/flows/ContractAmendment/index.d.ts +3 -3
  105. package/dist/flows/ContractAmendment/index.js +1 -1
  106. package/dist/flows/ContractAmendment/types.d.ts +2 -2
  107. package/dist/flows/ContractAmendment/utils.d.ts +2 -2
  108. package/dist/flows/ContractorOnboarding/ContractorOnboarding.d.ts +7 -6
  109. package/dist/flows/ContractorOnboarding/ContractorOnboarding.js +1 -1
  110. package/dist/flows/ContractorOnboarding/api.d.ts +26 -3
  111. package/dist/flows/ContractorOnboarding/api.js +1 -1
  112. package/dist/flows/ContractorOnboarding/components/BasicInformationStep.d.ts +5 -5
  113. package/dist/flows/ContractorOnboarding/components/BasicInformationStep.js +1 -1
  114. package/dist/flows/ContractorOnboarding/components/ContractDetailsStep.d.ts +7 -6
  115. package/dist/flows/ContractorOnboarding/components/ContractDetailsStep.js +1 -1
  116. package/dist/flows/ContractorOnboarding/components/ContractOriginStep.d.ts +27 -0
  117. package/dist/flows/ContractorOnboarding/components/ContractOriginStep.js +2 -0
  118. package/dist/flows/ContractorOnboarding/components/ContractOriginStep.js.map +1 -0
  119. package/dist/flows/ContractorOnboarding/components/ContractPreviewHeader.d.ts +2 -2
  120. package/dist/flows/ContractorOnboarding/components/ContractPreviewStatement.d.ts +2 -2
  121. package/dist/flows/ContractorOnboarding/components/ContractPreviewStep.d.ts +7 -6
  122. package/dist/flows/ContractorOnboarding/components/ContractPreviewStep.js +1 -1
  123. package/dist/flows/ContractorOnboarding/components/ContractorOnboardingForm.d.ts +7 -6
  124. package/dist/flows/ContractorOnboarding/components/ContractorOnboardingForm.js +1 -1
  125. package/dist/flows/ContractorOnboarding/components/EligibilityQuestionnaireStep.d.ts +7 -6
  126. package/dist/flows/ContractorOnboarding/components/EligibilityQuestionnaireStep.js +1 -1
  127. package/dist/flows/ContractorOnboarding/components/OnboardingInvite.d.ts +3 -3
  128. package/dist/flows/ContractorOnboarding/components/OnboardingInvite.js +1 -1
  129. package/dist/flows/ContractorOnboarding/components/PricingPlan.d.ts +7 -6
  130. package/dist/flows/ContractorOnboarding/components/PricingPlan.js +1 -1
  131. package/dist/flows/ContractorOnboarding/components/SaveDraftButton.d.ts +3 -3
  132. package/dist/flows/ContractorOnboarding/components/SelectCountryStep.d.ts +5 -5
  133. package/dist/flows/ContractorOnboarding/components/SelectCountryStep.js +1 -1
  134. package/dist/flows/ContractorOnboarding/context.d.ts +14 -6
  135. package/dist/flows/ContractorOnboarding/hooks.d.ts +7 -6
  136. package/dist/flows/ContractorOnboarding/hooks.js +1 -1
  137. package/dist/flows/ContractorOnboarding/index.d.ts +7 -6
  138. package/dist/flows/ContractorOnboarding/index.js +1 -1
  139. package/dist/flows/ContractorOnboarding/jsfModify.d.ts +7 -6
  140. package/dist/flows/ContractorOnboarding/jsfModify.js +1 -1
  141. package/dist/flows/ContractorOnboarding/json-schemas/contractOrigin.d.ts +22 -0
  142. package/dist/flows/ContractorOnboarding/json-schemas/contractOrigin.js +2 -0
  143. package/dist/flows/ContractorOnboarding/json-schemas/contractOrigin.js.map +1 -0
  144. package/dist/flows/ContractorOnboarding/types.d.ts +7 -6
  145. package/dist/flows/ContractorOnboarding/utils.d.ts +8 -6
  146. package/dist/flows/ContractorOnboarding/utils.js +1 -1
  147. package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +3 -3
  148. package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
  149. package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +3 -3
  150. package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
  151. package/dist/flows/CostCalculator/EstimationResults/EstimationResults.d.ts +2 -2
  152. package/dist/flows/CostCalculator/EstimationResults/EstimationResults.js +1 -1
  153. package/dist/flows/CostCalculator/SummaryResults/SummaryResults.d.ts +2 -2
  154. package/dist/flows/CostCalculator/api.d.ts +2 -2
  155. package/dist/flows/CostCalculator/api.js +1 -1
  156. package/dist/flows/CostCalculator/components/SalaryField.d.ts +2 -2
  157. package/dist/flows/CostCalculator/components/SalaryField.js +1 -1
  158. package/dist/flows/CostCalculator/context.d.ts +3 -3
  159. package/dist/flows/CostCalculator/hooks.d.ts +3 -3
  160. package/dist/flows/CostCalculator/hooks.js +1 -1
  161. package/dist/flows/CostCalculator/index.d.ts +3 -3
  162. package/dist/flows/CostCalculator/index.js +1 -1
  163. package/dist/flows/CostCalculator/types.d.ts +2 -2
  164. package/dist/flows/CostCalculator/utils.d.ts +3 -3
  165. package/dist/flows/CostCalculator/utils.js +1 -1
  166. package/dist/flows/CreateCompany/CreateCompany.d.ts +4 -4
  167. package/dist/flows/CreateCompany/CreateCompany.js +1 -1
  168. package/dist/flows/CreateCompany/api.d.ts +2 -2
  169. package/dist/flows/CreateCompany/api.js +1 -1
  170. package/dist/flows/CreateCompany/components/AddressDetailsStep.d.ts +4 -4
  171. package/dist/flows/CreateCompany/components/AddressDetailsStep.js +1 -1
  172. package/dist/flows/CreateCompany/components/CompanyBasicInformationStep.d.ts +4 -4
  173. package/dist/flows/CreateCompany/components/CompanyBasicInformationStep.js +1 -1
  174. package/dist/flows/CreateCompany/components/CreateCompanyForm.d.ts +2 -2
  175. package/dist/flows/CreateCompany/components/CreateCompanyForm.js +1 -1
  176. package/dist/flows/CreateCompany/context.d.ts +4 -4
  177. package/dist/flows/CreateCompany/hooks.d.ts +4 -4
  178. package/dist/flows/CreateCompany/hooks.js +1 -1
  179. package/dist/flows/CreateCompany/index.d.ts +4 -4
  180. package/dist/flows/CreateCompany/index.js +1 -1
  181. package/dist/flows/CreateCompany/types.d.ts +4 -4
  182. package/dist/flows/Onboarding/OnboardingFlow.d.ts +5 -5
  183. package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
  184. package/dist/flows/Onboarding/api.d.ts +7 -267
  185. package/dist/flows/Onboarding/api.js +1 -1
  186. package/dist/flows/Onboarding/components/AnnualGrossSalary.d.ts +2 -2
  187. package/dist/flows/Onboarding/components/AnnualGrossSalary.js +1 -1
  188. package/dist/flows/Onboarding/components/BasicInformationStep.d.ts +5 -5
  189. package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
  190. package/dist/flows/Onboarding/components/BenefitsStep.d.ts +5 -5
  191. package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
  192. package/dist/flows/Onboarding/components/ContractDetailsStep.d.ts +5 -5
  193. package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
  194. package/dist/flows/Onboarding/components/EmploymentAgreementInfoContent.js +1 -1
  195. package/dist/flows/Onboarding/components/EngagementAgreementDetailsStep.d.ts +5 -5
  196. package/dist/flows/Onboarding/components/EngagementAgreementDetailsStep.js +1 -1
  197. package/dist/flows/Onboarding/components/OnboardingForm.d.ts +5 -5
  198. package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
  199. package/dist/flows/Onboarding/components/OnboardingInvite.d.ts +3 -3
  200. package/dist/flows/Onboarding/components/OnboardingInvite.js +1 -1
  201. package/dist/flows/Onboarding/components/PreOnboardingRequirements.d.ts +15 -30
  202. package/dist/flows/Onboarding/components/PreOnboardingRequirements.js +1 -1
  203. package/dist/flows/Onboarding/components/PreviewEmploymentAgreementStep.js +1 -1
  204. package/dist/flows/Onboarding/components/ReviewStep.d.ts +5 -5
  205. package/dist/flows/Onboarding/components/SaveDraftButton.d.ts +3 -3
  206. package/dist/flows/Onboarding/components/SelectCountryStep.d.ts +5 -5
  207. package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
  208. package/dist/flows/Onboarding/context.d.ts +8 -5
  209. package/dist/flows/Onboarding/hooks.d.ts +5 -5
  210. package/dist/flows/Onboarding/hooks.js +1 -1
  211. package/dist/flows/Onboarding/index.d.ts +5 -5
  212. package/dist/flows/Onboarding/index.js +1 -1
  213. package/dist/flows/Onboarding/types.d.ts +5 -5
  214. package/dist/flows/Onboarding/utils.d.ts +5 -5
  215. package/dist/flows/Onboarding/utils.js +1 -1
  216. package/dist/flows/PayrollAdminOnboarding/PayrollAdminOnboardingFlow.d.ts +3 -3
  217. package/dist/flows/PayrollAdminOnboarding/PayrollAdminOnboardingFlow.js +1 -1
  218. package/dist/flows/PayrollAdminOnboarding/context.d.ts +3 -3
  219. package/dist/flows/PayrollAdminOnboarding/hooks.d.ts +3 -3
  220. package/dist/flows/PayrollAdminOnboarding/hooks.js +1 -1
  221. package/dist/flows/PayrollAdminOnboarding/index.d.ts +3 -3
  222. package/dist/flows/PayrollAdminOnboarding/index.js +1 -1
  223. package/dist/flows/PayrollAdminOnboarding/types.d.ts +3 -3
  224. package/dist/flows/PayrollEmployeeOnboarding/PayrollEmployeeOnboardingFlow.d.ts +3 -3
  225. package/dist/flows/PayrollEmployeeOnboarding/PayrollEmployeeOnboardingFlow.js +1 -1
  226. package/dist/flows/PayrollEmployeeOnboarding/context.d.ts +3 -3
  227. package/dist/flows/PayrollEmployeeOnboarding/hooks.d.ts +3 -3
  228. package/dist/flows/PayrollEmployeeOnboarding/hooks.js +1 -1
  229. package/dist/flows/PayrollEmployeeOnboarding/index.d.ts +3 -3
  230. package/dist/flows/PayrollEmployeeOnboarding/index.js +1 -1
  231. package/dist/flows/PayrollEmployeeOnboarding/types.d.ts +3 -3
  232. package/dist/flows/Termination/AdditionalDetailsForm.d.ts +4 -4
  233. package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
  234. package/dist/flows/Termination/EmployeeComunicationForm.d.ts +4 -4
  235. package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
  236. package/dist/flows/Termination/PaidTimeOffForm.d.ts +4 -4
  237. package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
  238. package/dist/flows/Termination/TerminationDetailsForm.d.ts +4 -4
  239. package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
  240. package/dist/flows/Termination/TerminationFlow.d.ts +4 -4
  241. package/dist/flows/Termination/TerminationFlow.js +1 -1
  242. package/dist/flows/Termination/TerminationForm.d.ts +4 -4
  243. package/dist/flows/Termination/TerminationForm.js +1 -1
  244. package/dist/flows/Termination/api.d.ts +5 -6
  245. package/dist/flows/Termination/api.js +1 -1
  246. package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInformationFees.js +1 -1
  247. package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOff.d.ts +6 -7
  248. package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOffContainer.d.ts +6 -7
  249. package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOffContainer.js +1 -1
  250. package/dist/flows/Termination/components/PaidTimeOff/types.d.ts +6 -7
  251. package/dist/flows/Termination/components/TerminationDialogInfoContent/TerminationDialogInfoContent.js +1 -1
  252. package/dist/flows/Termination/context.d.ts +4 -4
  253. package/dist/flows/Termination/hooks.d.ts +4 -4
  254. package/dist/flows/Termination/hooks.js +1 -1
  255. package/dist/flows/Termination/index.d.ts +6 -7
  256. package/dist/flows/Termination/index.js +1 -1
  257. package/dist/flows/Termination/json-schemas/jsonSchema.js +1 -1
  258. package/dist/flows/Termination/json-schemas/schema.d.ts +4 -4
  259. package/dist/flows/Termination/json-schemas/schema.js +1 -1
  260. package/dist/flows/Termination/types.d.ts +4 -4
  261. package/dist/flows/Termination/utils.d.ts +4 -4
  262. package/dist/flows/types.d.ts +2 -2
  263. package/dist/flows/utils.d.ts +2 -2
  264. package/dist/index.d.ts +14 -14
  265. package/dist/index.js +2 -2
  266. package/dist/index.js.map +1 -1
  267. package/dist/internals.d.ts +3 -3
  268. package/dist/internals.js +1 -1
  269. package/dist/{mutations-CS4-N6rs.d.ts → mutations-HzXri7rU.d.ts} +1 -1
  270. package/dist/{remoteFlows-XblLRuXf.d.ts → remoteFlows-D6N3P-Z8.d.ts} +1 -1
  271. package/dist/{types-Cn2zpFdH.d.ts → types-BA5HatKg.d.ts} +1 -1
  272. package/dist/{types-D-BG15n_.d.ts → types-BxGIDgr8.d.ts} +2 -2
  273. package/dist/{types-DB-5lvAd.d.ts → types-CKY2s5Tl.d.ts} +15 -6
  274. package/dist/{types-DTBS32xf.d.ts → types-CeMJCc7f.d.ts} +3 -3
  275. package/dist/{types-d4sOtWU0.d.ts → types-OIG1NWJB.d.ts} +296 -7
  276. package/dist/{types-CoXYbvEX.d.ts → types-PiIfh75U.d.ts} +1 -1
  277. package/dist/{types-xaJ4vNIC.d.ts → types-SOAhi2Xb.d.ts} +1 -1
  278. package/dist/{types.gen-lBDxKNB_.d.ts → types.gen-DCswUxeu.d.ts} +24 -2
  279. package/dist/{utils-DC8X38CO.d.ts → utils-VhDQSRx8.d.ts} +1 -1
  280. package/package.json +3 -3
  281. package/dist/CheckboxFieldDefault-OBDOMMWQ.js +0 -2
  282. package/dist/CountryFieldDefault-NEFHRUUS.js +0 -2
  283. package/dist/DatePickerFieldDefault-NYHK6I2G.js +0 -2
  284. package/dist/RadioGroupFieldDefault-GF4XVARF.js +0 -2
  285. package/dist/TextAreaFieldDefault-HPEUG5UI.js +0 -2
  286. package/dist/chunk-COAJUZSE.js +0 -2
  287. package/dist/chunk-COAJUZSE.js.map +0 -1
  288. package/dist/chunk-IL3IFNO5.js +0 -2
  289. package/dist/chunk-IL3IFNO5.js.map +0 -1
  290. package/dist/chunk-KWIWHDBS.js.map +0 -1
  291. package/dist/chunk-MQTRTRV6.js +0 -2
  292. package/dist/chunk-NJNJACVL.js +0 -2
  293. package/dist/chunk-NJNJACVL.js.map +0 -1
  294. package/dist/chunk-RATFUMTL.js +0 -2
  295. package/dist/chunk-RATFUMTL.js.map +0 -1
  296. package/dist/chunk-SC7YWKOW.js +0 -2
  297. package/dist/chunk-TJLXZ2ZK.js.map +0 -1
  298. package/dist/chunk-UAMKMIHP.js +0 -2
  299. package/dist/chunk-UAMKMIHP.js.map +0 -1
  300. package/dist/chunk-VWO7PDZ4.js +0 -2
  301. package/dist/chunk-VWO7PDZ4.js.map +0 -1
  302. /package/dist/{CheckboxFieldDefault-OBDOMMWQ.js.map → CheckboxFieldDefault-OK7JODEG.js.map} +0 -0
  303. /package/dist/{CountryFieldDefault-NEFHRUUS.js.map → CountryFieldDefault-ORC6XVVK.js.map} +0 -0
  304. /package/dist/{DatePickerFieldDefault-NYHK6I2G.js.map → DatePickerFieldDefault-EUPACNZD.js.map} +0 -0
  305. /package/dist/{RadioGroupFieldDefault-GF4XVARF.js.map → RadioGroupFieldDefault-XR37OID5.js.map} +0 -0
  306. /package/dist/{TextAreaFieldDefault-HPEUG5UI.js.map → TextAreaFieldDefault-5YJYIBAO.js.map} +0 -0
  307. /package/dist/{chunk-SKQZ6BPK.js.map → chunk-2TAVZJPX.js.map} +0 -0
  308. /package/dist/{chunk-O3KGCVBO.js.map → chunk-3QSHWQS3.js.map} +0 -0
  309. /package/dist/{chunk-KRZGFZUS.js.map → chunk-3U4PZ4KB.js.map} +0 -0
  310. /package/dist/{chunk-XFQS2BVE.js.map → chunk-44F5FY7C.js.map} +0 -0
  311. /package/dist/{chunk-4WBEA4IY.js.map → chunk-4KKA35AX.js.map} +0 -0
  312. /package/dist/{chunk-BLCINT3L.js.map → chunk-4QJUNKBR.js.map} +0 -0
  313. /package/dist/{chunk-7EKNQYS5.js.map → chunk-6NKXOUJW.js.map} +0 -0
  314. /package/dist/{chunk-6YBDMERC.js.map → chunk-6TKWWM5A.js.map} +0 -0
  315. /package/dist/{chunk-ZY7RAGEL.js.map → chunk-6WGW27VH.js.map} +0 -0
  316. /package/dist/{chunk-2PMYCCWO.js.map → chunk-7XZP24UE.js.map} +0 -0
  317. /package/dist/{chunk-MBOKEWSX.js.map → chunk-A5SRPVT2.js.map} +0 -0
  318. /package/dist/{chunk-UBBUH2DE.js.map → chunk-A675PPWA.js.map} +0 -0
  319. /package/dist/{chunk-OKSKBEIR.js.map → chunk-BJZXTS47.js.map} +0 -0
  320. /package/dist/{chunk-B3OYZQSP.js.map → chunk-BS2B4OOE.js.map} +0 -0
  321. /package/dist/{chunk-HADEU7QX.js.map → chunk-C332PSLT.js.map} +0 -0
  322. /package/dist/{chunk-SC7YWKOW.js.map → chunk-DN6BXTAC.js.map} +0 -0
  323. /package/dist/{chunk-GGULUMOP.js.map → chunk-EI44AIUW.js.map} +0 -0
  324. /package/dist/{chunk-YXHSALDR.js.map → chunk-F74X2V2N.js.map} +0 -0
  325. /package/dist/{chunk-6VODJDBH.js.map → chunk-FJGDFNEH.js.map} +0 -0
  326. /package/dist/{chunk-PIIWY632.js.map → chunk-GHHMGTM4.js.map} +0 -0
  327. /package/dist/{chunk-PMRAJKJ5.js.map → chunk-GNDFT5KG.js.map} +0 -0
  328. /package/dist/{chunk-3PYZQWDY.js.map → chunk-GR6QMP4Z.js.map} +0 -0
  329. /package/dist/{chunk-MZZFNRW5.js.map → chunk-H6Z54SNM.js.map} +0 -0
  330. /package/dist/{chunk-ZTNH2YIM.js.map → chunk-HYNJ3ITY.js.map} +0 -0
  331. /package/dist/{chunk-HGIMRQIZ.js.map → chunk-ID4S6FWD.js.map} +0 -0
  332. /package/dist/{chunk-NEKE5PRJ.js.map → chunk-IF42CZJH.js.map} +0 -0
  333. /package/dist/{chunk-KBUBBK2E.js.map → chunk-IVDF2PMA.js.map} +0 -0
  334. /package/dist/{chunk-HHFDREGB.js.map → chunk-J3HIQRZO.js.map} +0 -0
  335. /package/dist/{chunk-B5KAHNYW.js.map → chunk-KSJLZDGY.js.map} +0 -0
  336. /package/dist/{chunk-FEWMPYBF.js.map → chunk-L3ZVE4JS.js.map} +0 -0
  337. /package/dist/{chunk-7R7AQHV2.js.map → chunk-LES7J6H4.js.map} +0 -0
  338. /package/dist/{chunk-KFFTPU6V.js.map → chunk-LVTBMTOU.js.map} +0 -0
  339. /package/dist/{chunk-GTU6MTZH.js.map → chunk-LXNEYPO5.js.map} +0 -0
  340. /package/dist/{chunk-ICNC2RV5.js.map → chunk-MG6UYSCR.js.map} +0 -0
  341. /package/dist/{chunk-VMZQN4WU.js.map → chunk-NRGNFMIO.js.map} +0 -0
  342. /package/dist/{chunk-KEYWBQH2.js.map → chunk-NZHABET6.js.map} +0 -0
  343. /package/dist/{chunk-XE6HQVLQ.js.map → chunk-O4CLVNOP.js.map} +0 -0
  344. /package/dist/{chunk-SHOGXN3C.js.map → chunk-OPDKYPYM.js.map} +0 -0
  345. /package/dist/{chunk-PJPYUB2R.js.map → chunk-PSCFVUJB.js.map} +0 -0
  346. /package/dist/{chunk-7KMXTQ4C.js.map → chunk-Q7SMO5VI.js.map} +0 -0
  347. /package/dist/{chunk-UFAQ7CQH.js.map → chunk-QGC2HCZG.js.map} +0 -0
  348. /package/dist/{chunk-PET4EGTM.js.map → chunk-QK3FQD6C.js.map} +0 -0
  349. /package/dist/{chunk-FOUXLCEA.js.map → chunk-QKSYPFRB.js.map} +0 -0
  350. /package/dist/{chunk-MZXFOY5T.js.map → chunk-QZMSDP2S.js.map} +0 -0
  351. /package/dist/{chunk-P6H7QMKK.js.map → chunk-RFVHV6RE.js.map} +0 -0
  352. /package/dist/{chunk-OVU2VJM6.js.map → chunk-S4QKVG2B.js.map} +0 -0
  353. /package/dist/{chunk-57G3ZAX3.js.map → chunk-SJO4XFQD.js.map} +0 -0
  354. /package/dist/{chunk-VV3LCB77.js.map → chunk-T7QVVLKT.js.map} +0 -0
  355. /package/dist/{chunk-ZSN43HMP.js.map → chunk-TMBL5YM4.js.map} +0 -0
  356. /package/dist/{chunk-UD24LBJ6.js.map → chunk-TNGJKUUV.js.map} +0 -0
  357. /package/dist/{chunk-QV7CEES3.js.map → chunk-TWULMMMY.js.map} +0 -0
  358. /package/dist/{chunk-WRCHICCJ.js.map → chunk-TZGC6PWQ.js.map} +0 -0
  359. /package/dist/{chunk-ABQLD4SS.js.map → chunk-UJWKHGH5.js.map} +0 -0
  360. /package/dist/{chunk-INPMEOFL.js.map → chunk-UOWQ7UKA.js.map} +0 -0
  361. /package/dist/{chunk-3D7HWCNX.js.map → chunk-UZBAOB4W.js.map} +0 -0
  362. /package/dist/{chunk-FXJM54I4.js.map → chunk-V7YF7ICV.js.map} +0 -0
  363. /package/dist/{chunk-I7JKBQHL.js.map → chunk-VCF327FJ.js.map} +0 -0
  364. /package/dist/{chunk-ZMQTQ4UQ.js.map → chunk-W4BOTAD6.js.map} +0 -0
  365. /package/dist/{chunk-YOFPHSYV.js.map → chunk-WKAVKFP6.js.map} +0 -0
  366. /package/dist/{chunk-FAJ5I4Q4.js.map → chunk-WTVYMT5N.js.map} +0 -0
  367. /package/dist/{chunk-XLURXRQT.js.map → chunk-X25ZOPO6.js.map} +0 -0
  368. /package/dist/{chunk-UELAVKG5.js.map → chunk-X4IJ52GQ.js.map} +0 -0
  369. /package/dist/{chunk-GJV6HJ3D.js.map → chunk-XEK3MUYF.js.map} +0 -0
  370. /package/dist/{chunk-YQQHCS4S.js.map → chunk-YADHCTR7.js.map} +0 -0
  371. /package/dist/{chunk-KH4DEFZT.js.map → chunk-YW4FHEYJ.js.map} +0 -0
  372. /package/dist/{chunk-S7DDWZOR.js.map → chunk-ZF3JITFM.js.map} +0 -0
@@ -1,2 +0,0 @@
1
- import{a as L,b as H,c as U,e as O}from"./chunk-N6XLGYRK.js";import{f as W}from"./chunk-ZMQTQ4UQ.js";import{a as oe}from"./chunk-HGIMRQIZ.js";import{a as ie}from"./chunk-UELAVKG5.js";import{a as _,c as I,d as k,e as J,f as j}from"./chunk-LJUWER2H.js";import{f as le,g as A,h as te}from"./chunk-Y3CJRZLA.js";import{n as g}from"./chunk-G2LZFGZA.js";import{e as ae}from"./chunk-H2O4CVKF.js";import{a as i}from"./chunk-P37U34EQ.js";import*as M from"@radix-ui/react-collapsible";var ge=M.Root,ye=M.CollapsibleTrigger,Se=M.CollapsibleContent;import*as y from"@radix-ui/react-dialog";import{XIcon as he}from"lucide-react";import{jsx as F,jsxs as K}from"react/jsx-runtime";function Ne({...e}){return F(y.Root,{"data-slot":"full-screen-dialog",...e})}i(Ne,"FullScreenDialog");function xe({...e}){return F(y.Trigger,{"data-slot":"full-screen-dialog-trigger",...e})}i(xe,"FullScreenDialogTrigger");function Te({...e}){return F(y.Portal,{"data-slot":"full-screen-dialog-portal",...e})}i(Te,"FullScreenDialogPortal");function Fe({className:e,...l}){return F(y.Overlay,{"data-slot":"full-screen-dialog-overlay",className:g("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...l})}i(Fe,"FullScreenDialogOverlay");function Ce({className:e,children:l,...a}){return K(Te,{"data-slot":"full-screen-dialog-portal",children:[F(Fe,{}),K(y.Content,{"data-slot":"full-screen-dialog-content",className:g("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 flex flex-col",e),...a,children:[l,K(y.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 RemoteFlows__FullScreenDialog__Close",children:[F(he,{}),F("span",{className:"sr-only",children:"Close"})]})]})]})}i(Ce,"FullScreenDialogContent");function De({className:e,...l}){return F("div",{"data-slot":"full-screen-dialog-header",className:g("flex flex-col gap-2 text-center sm:text-left",e),...l})}i(De,"FullScreenDialogHeader");function we({className:e,...l}){return F("div",{"data-slot":"full-screen-dialog-footer",className:g("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...l})}i(we,"FullScreenDialogFooter");function Re({className:e,...l}){return F(y.Title,{"data-slot":"full-screen-dialog-title",className:g("text-lg leading-none font-semibold",e),...l})}i(Re,"FullScreenDialogTitle");function Pe({className:e,...l}){return F(y.Description,{"data-slot":"full-screen-dialog-description",className:g("text-muted-foreground text-sm",e),...l})}i(Pe,"FullScreenDialogDescription");import*as R from"@radix-ui/react-tabs";import{jsx as B}from"react/jsx-runtime";function z({className:e,...l}){return B(R.Root,{"data-slot":"tabs",className:g("flex flex-col gap-2",e),...l})}i(z,"Tabs");function $({className:e,...l}){return B(R.List,{"data-slot":"tabs-list",className:g("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-1",e),...l})}i($,"TabsList");function X({className:e,...l}){return B(R.Trigger,{"data-slot":"tabs-trigger",className:g("data-[state=active]:bg-background data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring inline-flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...l})}i(X,"TabsTrigger");function Ve({className:e,...l}){return B(R.Content,{"data-slot":"tabs-content",className:g("flex-1 outline-none",e),...l})}i(Ve,"TabsContent");import*as Z from"react";import*as x from"@radix-ui/react-scroll-area";import{jsx as q,jsxs as Ae}from"react/jsx-runtime";var ne=Z.forwardRef(({className:e,children:l,...a},s)=>Ae(x.Root,{ref:s,className:g("relative overflow-hidden",e),...a,children:[q(x.Viewport,{className:"h-full w-full rounded-[inherit]",children:l}),q(se,{}),q(x.Corner,{})]}));ne.displayName=x.Root.displayName;var se=Z.forwardRef(({className:e,orientation:l="vertical",...a},s)=>q(x.ScrollAreaScrollbar,{ref:s,orientation:l,className:g("flex touch-none select-none transition-colors",l==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...a,children:q(x.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));se.displayName=x.ScrollAreaScrollbar.displayName;import{useState as Y,useEffect as ke,useMemo as Je}from"react";import{useQuery as je}from"@tanstack/react-query";import E from"fast-deep-equal";var re=i(e=>e.name?e.type?!0:(console.warn(`Field "${e.name}" missing required "type" property`),!1):(console.warn('Field missing required "name" property:',e),!1),"validateField"),Le=i((e,l)=>{if(E(e,l))return;let a=new Map((e||[]).map(t=>[t.value,t])),s=new Map((l||[]).map(t=>[t.value,t])),u=[],m=[],p=[];if(s.forEach((t,c)=>{a.has(c)||u.push({value:t.value,label:t.label})}),a.forEach((t,c)=>{if(!s.has(c))m.push({value:t.value,label:t.label});else{let S=s.get(c);if(!E(t,S)){let b={};t.label!==S.label&&(b.label={old:t.label,new:S.label}),Object.keys(b).length>0&&p.push({value:c,changes:b})}}}),!(u.length===0&&m.length===0&&p.length===0))return{added:u,removed:m,modified:p}},"compareOptions"),Oe=i((e,l)=>{let a=e.fields,s=l.fields;if(!a&&!s)return;let u=G(a||[],s||[]);if(u.added.length>0||u.removed.length>0||u.modified.length>0)return Array.from(u.fieldDiffs.values())},"compareNestedFields"),Me=i((e,l)=>{let a={label:e.label!==l.label,required:e.required!==l.required,inputType:e.inputType!==l.inputType,type:e.type!==l.type,jsonType:!E(e.jsonType,l.jsonType),name:e.name!==l.name,defaultValue:e.defaultValue!==l.defaultValue,minDate:e.minDate!==l.minDate,maxDate:e.maxDate!==l.maxDate,maxLength:e.maxLength!==l.maxLength,multiple:e.multiple!==l.multiple,isVisible:e.isVisible!==l.isVisible,options:!E(e.options,l.options)},s=(()=>{let m=e.fields,p=l.fields;if(!m&&!p)return!1;if(!m||!p)return!0;let t=G(m,p);return t.added.length>0||t.removed.length>0||t.modified.length>0})();return Object.values(a).some(m=>m)||s},"isFieldModified"),Ee=i((e,l)=>{let a={};e.label!==l.label&&(a.label={old:e.label,new:l.label}),e.required!==l.required&&(a.required={old:e.required,new:l.required}),e.type!==l.type&&(a.type={old:e.type,new:l.type}),e.inputType!==l.inputType&&(a.inputType={old:e.inputType,new:l.inputType}),E(e.jsonType,l.jsonType)||(a.jsonType={old:e.jsonType,new:l.jsonType}),E(e.defaultValue,l.defaultValue)||(a.defaultValue={old:e.defaultValue,new:l.defaultValue}),e.minDate!==l.minDate&&(a.minDate={old:e.minDate||"",new:l.minDate||""}),e.maxDate!==l.maxDate&&(a.maxDate={old:e.maxDate||"",new:l.maxDate||""}),e.maxLength!==l.maxLength&&(a.maxLength={old:e.maxLength||0,new:l.maxLength||0}),e.multiple!==l.multiple&&(a.multiple={old:e.multiple||!1,new:l.multiple||!1}),e.isVisible!==l.isVisible&&(a.isVisible={old:e.isVisible,new:l.isVisible});let s=Le(e.options,l.options);s&&(a.options=s);let u=Oe(e,l);return u&&(a.nestedFields=u),Object.keys(a).length>0?a:void 0},"getFieldChanges"),G=i((e=[],l=[])=>{let a=e.filter(re),s=l.filter(re),u=new Map(a.map(f=>[f.name,{field:f}])),m=new Map(s.map(f=>[f.name,{field:f}])),p=[],t=[],c=[],S=[],b=new Map;return m.forEach((f,d)=>{u.has(d)||(p.push(d),b.set(d,{fieldName:d,diffType:"added"}))}),u.forEach(({field:f},d)=>{if(!m.has(d))t.push(d),b.set(d,{fieldName:d,diffType:"removed"});else{let{field:N}=m.get(d);Me(f,N)?(c.push(d),b.set(d,{fieldName:d,diffType:"modified",changes:Ee(f,N)})):(S.push(d),b.set(d,{fieldName:d,diffType:"unchanged"}))}}),{added:p,removed:t,modified:c,unchanged:S,fieldDiffs:b}},"compareFormFields"),de=i(e=>{switch(e){case"added":return"bg-green-50 border-l-4 border-green-500";case"removed":return"bg-red-50 border-l-4 border-red-500";case"modified":return"bg-yellow-50 border-l-4 border-yellow-500";default:return""}},"getDiffStyles");import{useMemo as ve,useRef as Q,useEffect as _e}from"react";import{jsx as o,jsxs as v}from"react/jsx-runtime";var Ie=i(({children:e,diffType:l,changes:a})=>{let s=de(l);if(l==="unchanged")return o("div",{children:e});let m={added:o("span",{className:"text-xs font-semibold text-green-700 bg-green-100 px-2 py-1 rounded",children:"NEW"}),removed:o("span",{className:"text-xs font-semibold text-red-700 bg-red-100 px-2 py-1 rounded",children:"REMOVED"}),modified:o("span",{className:"text-xs font-semibold text-yellow-700 bg-yellow-100 px-2 py-1 rounded",children:"MODIFIED"})}[l],p=i(()=>{if(!a||l!=="modified")return null;let t=[];if(a.label&&t.push(v("div",{className:"text-xs",children:[o("span",{className:"font-semibold",children:"Label:"})," ",o("span",{className:"line-through text-red-600",children:a.label.old})," ","\u2192 ",o("span",{className:"text-green-600",children:a.label.new})]},"label")),a.required&&t.push(v("div",{className:"text-xs",children:[o("span",{className:"font-semibold",children:"Required:"})," ",o("span",{className:"line-through text-red-600",children:a.required.old?"Yes":"No"})," ","\u2192"," ",o("span",{className:"text-green-600",children:a.required.new?"Yes":"No"})]},"required")),a.type&&t.push(v("div",{className:"text-xs",children:[o("span",{className:"font-semibold",children:"Type:"})," ",o("span",{className:"line-through text-red-600",children:a.type.old})," ","\u2192 ",o("span",{className:"text-green-600",children:a.type.new})]},"type")),a.inputType&&t.push(v("div",{className:"text-xs",children:[o("span",{className:"font-semibold",children:"Input Type:"})," ",o("span",{className:"line-through text-red-600",children:a.inputType.old})," ","\u2192 ",o("span",{className:"text-green-600",children:a.inputType.new})]},"inputType")),a.jsonType){let c=Array.isArray(a.jsonType.old)?a.jsonType.old.join(" | "):a.jsonType.old,S=Array.isArray(a.jsonType.new)?a.jsonType.new.join(" | "):a.jsonType.new;t.push(v("div",{className:"text-xs",children:[o("span",{className:"font-semibold",children:"JSON Type:"})," ",o("span",{className:"line-through text-red-600",children:c})," \u2192"," ",o("span",{className:"text-green-600",children:S})]},"jsonType"))}return a.defaultValue!==void 0&&t.push(v("div",{className:"text-xs",children:[o("span",{className:"font-semibold",children:"Default Value:"})," ",o("span",{className:"line-through text-red-600",children:JSON.stringify(a.defaultValue.old)})," ","\u2192"," ",o("span",{className:"text-green-600",children:JSON.stringify(a.defaultValue.new)})]},"defaultValue")),a.options&&(a.options.added.length>0&&t.push(v("div",{className:"text-xs",children:[o("span",{className:"font-semibold text-green-700",children:"Options Added:"})," ",a.options.added.map(c=>c.label).join(", ")]},"options-added")),a.options.removed.length>0&&t.push(v("div",{className:"text-xs",children:[o("span",{className:"font-semibold text-red-700",children:"Options Removed:"})," ",a.options.removed.map(c=>c.label).join(", ")]},"options-removed")),a.options.modified.length>0&&t.push(v("div",{className:"text-xs",children:[o("span",{className:"font-semibold",children:"Options Modified:"})," ",a.options.modified.length," option(s)"]},"options-modified"))),a.nestedFields&&a.nestedFields.length>0&&t.push(v("div",{className:"text-xs",children:[o("span",{className:"font-semibold",children:"Nested Fields:"})," ",a.nestedFields.length," field(s) changed"]},"nestedFields")),t.length===0?null:v("div",{className:"mt-2 p-2 bg-yellow-50 rounded border border-yellow-200 space-y-1",children:[o("div",{className:"text-xs font-semibold text-yellow-800 mb-1",children:"Changes:"}),t]})},"renderChanges");return v("div",{className:`p-3 mb-2 rounded ${s} relative`,children:[o("div",{className:"absolute top-2 right-2",children:m}),e,p()]})},"FieldWrapper"),ue=i(({version:e,fields:l,fieldsets:a,diffMap:s,title:u,scrollRef:m})=>{let p=le({mode:"onBlur"}),t=ve(()=>{let c=i((S,b)=>S.map(f=>{let d=b.get(f.name),N=d?.diffType||"unchanged",T=d?.changes,C=f.fields,P=f;if(C&&Array.isArray(C)){let V=new Map;T&&typeof T=="object"&&"nestedFields"in T&&Array.isArray(T.nestedFields)&&T.nestedFields.forEach(n=>{V.set(n.fieldName,{diffType:n.diffType,changes:n.changes})});let D=c(C,V);P={...f,fields:D}}return{...P,WrapperComponent:i(({children:V})=>o(Ie,{diffType:N,fieldName:f.name,changes:T,children:V}),"WrapperComponent")}}),"applyWrappers");return c(l,s)},[l,s]);return v(L,{className:"h-full",children:[o(H,{children:v(U,{children:[u," - Version ",e]})}),o(O,{ref:m,className:"overflow-y-auto max-h-[600px]",children:o(te,{...p,children:o("form",{className:"space-y-4",children:o(ie,{fields:t,fieldsets:a,fieldValues:{}})})})})]})},"FormPanel"),me=i(({topVersion:e,bottomVersion:l,topFields:a,bottomFields:s,topFieldsets:u,bottomFieldsets:m,isLoading:p})=>{let t=ve(()=>G(a,s),[a,s]),c=Q(null),S=Q(null),b=Q(!1);if(_e(()=>{let d=c.current,N=S.current;if(!d||!N)return;let T=i(()=>{b.current||(b.current=!0,N.scrollTop=d.scrollTop,requestAnimationFrame(()=>{b.current=!1}))},"handleLeftScroll"),C=i(()=>{b.current||(b.current=!0,d.scrollTop=N.scrollTop,requestAnimationFrame(()=>{b.current=!1}))},"handleRightScroll");return d.addEventListener("scroll",T),N.addEventListener("scroll",C),()=>{d.removeEventListener("scroll",T),N.removeEventListener("scroll",C)}},[a,s]),p)return o("div",{className:"flex items-center justify-center h-96",children:v("div",{className:"text-center",children:[o("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-gray-900 mx-auto"}),o("p",{className:"mt-4 text-gray-600",children:"Loading schemas..."})]})});let f=t.added.length===0&&t.removed.length===0&&t.modified.length===0;return v("div",{className:"space-y-6",children:[o(L,{children:o(O,{className:"pt-6",children:f?o("p",{className:"text-center text-gray-600",children:"No differences detected between the two versions"}):v("div",{className:"flex gap-6 justify-center",children:[t.added.length>0&&v("div",{className:"flex items-center gap-2",children:[o("span",{className:"w-4 h-4 bg-green-500 rounded"}),v("span",{className:"text-sm",children:[t.added.length," field",t.added.length>1?"s":""," ","added"]})]}),t.removed.length>0&&v("div",{className:"flex items-center gap-2",children:[o("span",{className:"w-4 h-4 bg-red-500 rounded"}),v("span",{className:"text-sm",children:[t.removed.length," field",t.removed.length>1?"s":""," removed"]})]}),t.modified.length>0&&v("div",{className:"flex items-center gap-2",children:[o("span",{className:"w-4 h-4 bg-yellow-500 rounded"}),v("span",{className:"text-sm",children:[t.modified.length," field",t.modified.length>1?"s":""," modified"]})]})]})})}),v("div",{className:"grid grid-cols-2 gap-6",children:[o(ue,{version:e,fields:a,fieldsets:u,diffMap:t.fieldDiffs,title:"Left",scrollRef:c}),o(ue,{version:l,fields:s,fieldsets:m,diffMap:t.fieldDiffs,title:"Right",scrollRef:S})]})]})},"SchemaFormComparison");var pe=[{value:1,label:"v1 (Legacy)"},{value:3,label:"v3 (Recommended)"}],ee={ALB:[{value:1,label:"v1"}],ARE:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],ARG:[{value:1,label:"v1"}],ARM:[{value:1,label:"v1"}],AUS:[{value:1,label:"v1"}],AUT:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],BEL:[{value:1,label:"v1"},{value:2,label:"v2"}],BGD:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],BGR:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],BIH:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],BLR:[{value:1,label:"v1"},{value:2,label:"v2"}],BOL:[{value:1,label:"v1"}],BRA:[{value:1,label:"v1"}],CAN:[{value:1,label:"v1"},{value:2,label:"v2"}],CHE:[{value:1,label:"v1"},{value:2,label:"v2"}],CHL:[{value:1,label:"v1"}],CHN:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],COL:[{value:1,label:"v1"}],CRI:[{value:1,label:"v1"}],CYP:[{value:1,label:"v1"}],CZE:[{value:1,label:"v1"},{value:2,label:"v2"}],DEU:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],DNK:[{value:1,label:"v1"}],DOM:[{value:1,label:"v1"}],ECU:[{value:1,label:"v1"}],EGY:[{value:1,label:"v1"},{value:2,label:"v2"}],ESP:[{value:1,label:"v1"},{value:2,label:"v2"}],EST:[{value:1,label:"v1"}],FIN:[{value:1,label:"v1"}],FRA:[{value:1,label:"v1"},{value:2,label:"v2"}],GBR:[{value:1,label:"v1"},{value:2,label:"v2"}],GEO:[{value:1,label:"v1"}],GRC:[{value:1,label:"v1"}],GTM:[{value:1,label:"v1"}],HKG:[{value:1,label:"v1"},{value:2,label:"v2"}],HND:[{value:1,label:"v1"}],HRV:[{value:1,label:"v1"},{value:2,label:"v2"}],HUN:[{value:1,label:"v1"}],IDN:[{value:1,label:"v1"}],IND:[{value:1,label:"v1"},{value:2,label:"v2"}],IRL:[{value:1,label:"v1"}],ISL:[{value:1,label:"v1"},{value:2,label:"v2"}],ISR:[{value:1,label:"v1"}],ITA:[{value:1,label:"v1"}],JAM:[{value:1,label:"v1"},{value:2,label:"v2"}],JPN:[{value:1,label:"v1"},{value:2,label:"v2"}],KEN:[{value:1,label:"v1"},{value:2,label:"v2"}],KGZ:[{value:1,label:"v1"}],KHM:[{value:1,label:"v1"}],KOR:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],LBN:[{value:1,label:"v1"},{value:2,label:"v2"}],LKA:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],LTU:[{value:1,label:"v1"}],LUX:[{value:1,label:"v1"}],LVA:[{value:1,label:"v1"},{value:2,label:"v2"}],MAR:[{value:1,label:"v1"}],MDA:[{value:1,label:"v1"}],MEX:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],MKD:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],MLT:[{value:1,label:"v1"}],MNG:[{value:1,label:"v1"}],MUS:[{value:1,label:"v1"},{value:2,label:"v2"}],MYS:[{value:1,label:"v1"},{value:2,label:"v2"}],NGA:[{value:1,label:"v1"},{value:2,label:"v2"}],NIC:[{value:1,label:"v1"}],NLD:[{value:1,label:"v1"}],NOR:[{value:1,label:"v1"},{value:2,label:"v2"}],NZL:[{value:1,label:"v1"},{value:2,label:"v2"}],PAK:[{value:1,label:"v1"},{value:2,label:"v2"}],PAN:[{value:1,label:"v1"}],PER:[{value:1,label:"v1"}],PHL:[{value:1,label:"v1"}],POL:[{value:1,label:"v1"}],PRI:[{value:1,label:"v1"}],PRT:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],PRY:[{value:1,label:"v1"}],ROU:[{value:1,label:"v1"}],SAU:[{value:1,label:"v1"},{value:2,label:"v2"}],SGP:[{value:1,label:"v1"},{value:2,label:"v2"}],SLV:[{value:1,label:"v1"}],SRB:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],SVK:[{value:1,label:"v1"}],SVN:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],SWE:[{value:1,label:"v1"},{value:2,label:"v2"}],THA:[{value:1,label:"v1"},{value:2,label:"v2"}],TUN:[{value:1,label:"v1"},{value:2,label:"v2"},{value:3,label:"v3"}],TUR:[{value:1,label:"v1"}],TWN:[{value:1,label:"v1"}],UGA:[{value:1,label:"v1"}],UKR:[{value:1,label:"v1"}],URY:[{value:1,label:"v1"}],USA:[{value:1,label:"v1"}],VNM:[{value:1,label:"v1"},{value:2,label:"v2"}],XKX:[{value:1,label:"v1"}],ZAF:[{value:1,label:"v1"}],ZWE:[{value:1,label:"v1"}]},ce=Object.fromEntries(Object.entries(ee).filter(([,e])=>e.length>1)),be=[{value:"employment_basic_information",label:"Basic Information"},{value:"contract_details",label:"Contract Details"}];import{jsx as r,jsxs as h}from"react/jsx-runtime";var fe=i(()=>{let[e,l]=Y("employment_basic_information"),[a,s]=Y(1),[u,m]=Y(1),[p,t]=Y("ARE"),{client:c}=ae(),{data:S}=je({...oe(c,"schema-comparison"),select:i(n=>n.data?.data?.filter(w=>w.eor_onboarding).filter(w=>Object.keys(ce).includes(w.code)).map(w=>({label:w.name,value:w.code}))||[],"select")}),b=e==="contract_details",{data:f,isLoading:d}=W({countryCode:p,form:e,fieldValues:{},jsonSchemaVersion:a,options:{queryOptions:{enabled:!0}}}),{data:N,isLoading:T}=W({countryCode:p,form:e,fieldValues:{},jsonSchemaVersion:u,options:{queryOptions:{enabled:!0}}}),C=d||T,P=ee[p],V=P!==void 0,D=Je(()=>e==="employment_basic_information"?pe:P||[{value:"latest",label:"Latest"}],[e,P]);return ke(()=>{let n=D.map(w=>w.value);n.includes(a)||s(D[0].value),n.includes(u)||m(D[0].value)},[e,p,D,a,u]),h("div",{className:"space-y-6",children:[h(L,{children:[r(H,{children:r(U,{children:"Configuration"})}),h(O,{className:"space-y-4",children:[h("div",{children:[r(A,{className:"mb-2 block",children:"Form Type"}),r(z,{value:e,onValueChange:n=>l(n),children:r($,{className:"grid w-full grid-cols-2",children:be.map(n=>r(X,{value:n.value,children:n.label},n.value))})})]}),b&&!V&&r("div",{className:"rounded-md bg-yellow-50 p-4 border border-yellow-200",children:h("div",{className:"flex",children:[r("div",{className:"flex-shrink-0",children:r("svg",{className:"h-5 w-5 text-yellow-400",viewBox:"0 0 20 20",fill:"currentColor",children:r("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),h("div",{className:"ml-3",children:[r("h3",{className:"text-sm font-medium text-yellow-800",children:"Version mappings not found"}),r("div",{className:"mt-2 text-sm text-yellow-700",children:h("p",{children:["Country"," ",r("span",{className:"font-semibold",children:p})," is not configured in COUNTRY_CONTRACT_VERSIONS. Using default (latest only)."]})})]})]})}),b&&h("div",{children:[r(A,{htmlFor:"country-select",className:"mb-2 block",children:"Country"}),h(_,{value:p,onValueChange:t,children:[r(k,{id:"country-select",children:r(I,{placeholder:"Select a country"})}),r(J,{children:S?.map(n=>r(j,{value:n.value,children:n.label},n.value))})]})]}),h("div",{className:"grid grid-cols-2 gap-4",children:[h("div",{children:[r(A,{htmlFor:"top-version",className:"mb-2 block",children:"Left Version"}),h(_,{value:String(a),onValueChange:n=>s(n==="latest"?"latest":Number(n)),children:[r(k,{id:"top-version",children:r(I,{placeholder:"Select version"})}),r(J,{children:D.map(n=>r(j,{value:String(n.value),children:n.label},String(n.value)))})]})]}),h("div",{children:[r(A,{htmlFor:"bottom-version",className:"mb-2 block",children:"Right Version"}),h(_,{value:String(u),onValueChange:n=>m(n==="latest"?"latest":Number(n)),children:[r(k,{id:"bottom-version",children:r(I,{placeholder:"Select version"})}),r(J,{children:D.map(n=>r(j,{value:String(n.value),children:n.label},String(n.value)))})]})]})]})]})]}),r(me,{topVersion:a,bottomVersion:u,topFields:f?.fields||[],bottomFields:N?.fields||[],topFieldsets:f?.meta?.["x-jsf-fieldsets"],bottomFieldsets:N?.meta?.["x-jsf-fieldsets"],isLoading:C})]})},"JsonSchemaComparison");export{ge as a,ye as b,Se as c,Ne as d,xe as e,Ce as f,De as g,we as h,Re as i,Pe as j,z as k,$ as l,X as m,Ve as n,ne as o,fe as p};
2
- //# sourceMappingURL=chunk-MQTRTRV6.js.map
@@ -1,2 +0,0 @@
1
- import{a as l}from"./chunk-KVUKJU5U.js";import{a as i}from"./chunk-KFFTPU6V.js";import{a as u}from"./chunk-HHFDREGB.js";import{a as d}from"./chunk-SVVZOMLQ.js";import{a as S}from"./chunk-MZXFOY5T.js";import{a as e}from"./chunk-CW7CHRMN.js";import{a as s}from"./chunk-GJV6HJ3D.js";import{a as p}from"./chunk-DB4JHJ3Z.js";import{a as c}from"./chunk-3D7HWCNX.js";import{a as m}from"./chunk-2PMYCCWO.js";import{a as f}from"./chunk-FOUXLCEA.js";import{a as n}from"./chunk-Q3ALCPJN.js";import{a}from"./chunk-UAMKMIHP.js";import{a as t}from"./chunk-P37U34EQ.js";import{useId as I,useRef as F,useMemo as y}from"react";import{jsx as D}from"react/jsx-runtime";var J=t(({render:g,employmentId:C,externalId:b,countryCode:v,skipSteps:B,initialValues:O,options:w})=>{let P=I(),o=F(void 0),R=y(()=>({setValue:o}),[]),r=a({options:{...w,onContractReviewed:t(()=>{o.current&&o.current("review_completed",!0)},"onContractReviewed")},employmentId:C,externalId:b,countryCode:v,skipSteps:B,initialValues:O});return D(n.Provider,{value:{contractorOnboardingBag:r,formId:P,formRef:R},children:g({contractorOnboardingBag:r,components:{BasicInformationStep:m,SelectCountryStep:i,BackButton:e,SubmitButton:p,PricingPlanStep:c,EligibilityQuestionnaireStep:S,ContractDetailsStep:f,ContractPreviewStep:u,OnboardingInvite:s,ContractReviewButton:d,SaveDraftButton:l}})})},"ContractorOnboardingFlow");export{J as a};
2
- //# sourceMappingURL=chunk-NJNJACVL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/ContractorOnboarding/ContractorOnboarding.tsx"],"sourcesContent":["import { UseFormSetValue } from 'react-hook-form';\nimport { useId, useRef, useMemo } from 'react';\nimport { OnboardingBack } from '@/src/flows/ContractorOnboarding/components/OnboardingBack';\nimport { SelectCountryStep } from '@/src/flows/ContractorOnboarding/components/SelectCountryStep';\nimport { ContractorOnboardingContext } from '@/src/flows/ContractorOnboarding/context';\nimport { useContractorOnboarding } from '@/src/flows/ContractorOnboarding/hooks';\nimport { ContractorOnboardingFlowProps } from '@/src/flows/ContractorOnboarding/types';\nimport { BasicInformationStep } from '@/src/flows/ContractorOnboarding/components/BasicInformationStep';\nimport { OnboardingSubmit } from '@/src/flows/ContractorOnboarding/components/OnboardingSubmit';\nimport { PricingPlanStep } from '@/src/flows/ContractorOnboarding/components/PricingPlan';\nimport { ContractDetailsStep } from '@/src/flows/ContractorOnboarding/components/ContractDetailsStep';\nimport { ContractPreviewStep } from '@/src/flows/ContractorOnboarding/components/ContractPreviewStep';\nimport { OnboardingInvite } from '@/src/flows/ContractorOnboarding/components/OnboardingInvite';\nimport { ContractReviewButton } from '@/src/flows/ContractorOnboarding/components/ContractReviewButton';\nimport { EligibilityQuestionnaireStep } from '@/src/flows/ContractorOnboarding/components/EligibilityQuestionnaireStep';\nimport { SaveDraftButton } from '@/src/flows/ContractorOnboarding/components/SaveDraftButton';\n\nexport const ContractorOnboardingFlow = ({\n render,\n employmentId,\n externalId,\n countryCode,\n skipSteps,\n initialValues,\n options,\n}: ContractorOnboardingFlowProps) => {\n const formId = useId();\n // Store form's setValue method in ref to allow sibling components\n // to update form state directly (e.g., ContractReviewButton setting review_completed)\n const setValueRef = useRef<\n UseFormSetValue<Record<string, unknown>> | undefined\n >(undefined);\n const formRef = useMemo(() => ({ setValue: setValueRef }), []);\n\n const contractorOnboardingBag = useContractorOnboarding({\n options: {\n ...options,\n onContractReviewed: () => {\n // Sync with internal form when contract is marked as reviewed\n if (setValueRef.current) {\n setValueRef.current('review_completed', true);\n }\n },\n },\n employmentId,\n externalId,\n countryCode,\n skipSteps,\n initialValues,\n });\n\n return (\n <ContractorOnboardingContext.Provider\n value={{ contractorOnboardingBag, formId, formRef }}\n >\n {render({\n contractorOnboardingBag,\n components: {\n BasicInformationStep: BasicInformationStep,\n SelectCountryStep: SelectCountryStep,\n BackButton: OnboardingBack,\n SubmitButton: OnboardingSubmit,\n PricingPlanStep: PricingPlanStep,\n EligibilityQuestionnaireStep: EligibilityQuestionnaireStep,\n ContractDetailsStep: ContractDetailsStep,\n ContractPreviewStep: ContractPreviewStep,\n OnboardingInvite: OnboardingInvite,\n ContractReviewButton: ContractReviewButton,\n SaveDraftButton: SaveDraftButton,\n },\n })}\n </ContractorOnboardingContext.Provider>\n );\n};\n"],"mappings":"2iBACA,OAAS,SAAAA,EAAO,UAAAC,EAAQ,WAAAC,MAAe,QAmDnC,cAAAC,MAAA,oBAnCG,IAAMC,EAA2BC,EAAA,CAAC,CACvC,OAAAC,EACA,aAAAC,EACA,WAAAC,EACA,YAAAC,EACA,UAAAC,EACA,cAAAC,EACA,QAAAC,CACF,IAAqC,CACnC,IAAMC,EAASC,EAAM,EAGfC,EAAcC,EAElB,MAAS,EACLC,EAAUC,EAAQ,KAAO,CAAE,SAAUH,CAAY,GAAI,CAAC,CAAC,EAEvDI,EAA0BC,EAAwB,CACtD,QAAS,CACP,GAAGR,EACH,mBAAoBP,EAAA,IAAM,CAEpBU,EAAY,SACdA,EAAY,QAAQ,mBAAoB,EAAI,CAEhD,EALoB,qBAMtB,EACA,aAAAR,EACA,WAAAC,EACA,YAAAC,EACA,UAAAC,EACA,cAAAC,CACF,CAAC,EAED,OACER,EAACkB,EAA4B,SAA5B,CACC,MAAO,CAAE,wBAAAF,EAAyB,OAAAN,EAAQ,QAAAI,CAAQ,EAEjD,SAAAX,EAAO,CACN,wBAAAa,EACA,WAAY,CACV,qBAAsBG,EACtB,kBAAmBC,EACnB,WAAYC,EACZ,aAAcC,EACd,gBAAiBC,EACjB,6BAA8BC,EAC9B,oBAAqBC,EACrB,oBAAqBC,EACrB,iBAAkBC,EAClB,qBAAsBC,EACtB,gBAAiBC,CACnB,CACF,CAAC,EACH,CAEJ,EAxDwC","names":["useId","useRef","useMemo","jsx","ContractorOnboardingFlow","__name","render","employmentId","externalId","countryCode","skipSteps","initialValues","options","formId","useId","setValueRef","useRef","formRef","useMemo","contractorOnboardingBag","useContractorOnboarding","ContractorOnboardingContext","BasicInformationStep","SelectCountryStep","OnboardingBack","OnboardingSubmit","PricingPlanStep","EligibilityQuestionnaireStep","ContractDetailsStep","ContractPreviewStep","OnboardingInvite","ContractReviewButton","SaveDraftButton"]}
@@ -1,2 +0,0 @@
1
- import{a as te}from"./chunk-AP56UUME.js";import{a as ee}from"./chunk-IJCTN52C.js";import{e as R}from"./chunk-COAJUZSE.js";import{a as I,b as ne,c as P,d as _,f as h,m as oe}from"./chunk-PB6UQ4A4.js";import{a as X}from"./chunk-WVJDCDGZ.js";import{a as Z}from"./chunk-HGIMRQIZ.js";import{a as b}from"./chunk-LKVQ32ZK.js";import{$,E as j,K as J,S as K,V as N,X as k,_ as G,aa as B,ba as W,ea as H,f as w,ga as Y,h as Q,ha as z,r as A,t as L,u as U,v}from"./chunk-KWIWHDBS.js";import{b as q,g as O,t as V}from"./chunk-G2LZFGZA.js";import{e as a}from"./chunk-H2O4CVKF.js";import{a as n}from"./chunk-P37U34EQ.js";import{useMemo as ce}from"react";import{useMutation as g,useQuery as m}from"@tanstack/react-query";import{useMutation as be,useQuery as re}from"@tanstack/react-query";var Ve=n(()=>{let{client:e}=a();return be({mutationFn:n(t=>k({client:e,body:t,headers:{Authorization:""}}),"mutationFn")})},"useUploadFile"),ie=n(e=>{let{client:t}=a();return re({queryKey:["download-file",e],queryFn:n(async()=>{let o=await j({client:t,path:{id:e}});if(o.error)throw o.error;return o.data},"queryFn"),select:n(({data:o})=>o?.file,"select"),enabled:!!e})},"useDownloadFile"),se=n((e,t,o)=>{let{client:r}=a();return re({queryKey:["employment-files",e],queryFn:n(async()=>{let i=await N({client:r,path:{employment_id:e},query:t});if(i.error)throw i.error;return i.data},"queryFn"),...o})},"useEmploymentFiles");import{useQuery as Fe}from"@tanstack/react-query";import{useQuery as ge}from"@tanstack/react-query";var E=n(()=>{let{client:e}=a();return ge({queryKey:["identity"],queryFn:n(()=>$({client:e,headers:{Authorization:""}}),"queryFn"),select:n(t=>t.data?.data,"select")})},"useIdentity");function M(e){return e!=null&&"company"in e}n(M,"hasCompany");var ae=n((e={enabled:!0})=>{let{data:t}=E(),o=M(t)?t?.company?.id??"":"",{client:r}=a();return Fe({queryKey:["pricing-plans",o],queryFn:n(()=>w({client:r,path:{company_id:o}}),"queryFn"),select:n(i=>i.data?.data?.pricing_plans,"select"),enabled:!!e?.enabled&&!!o})},"useCompanyPricingPlans");var Se=n(({employmentId:e,options:t})=>{let{client:o}=a();return m({queryKey:["contractor-currencies",e],queryFn:n(async()=>v({client:o,path:{employment_id:e},query:{restrict_to_guaranteed_pay_out_currencies:!1}}),"queryFn"),enabled:t?.queryOptions?.enabled,select:n(({data:r})=>r?.data,"select")})},"useContractorCurrencies"),_t=n(({fieldValues:e,options:t})=>m({queryKey:["contract-document-signature",e.review_completed,t?.jsfModify],queryFn:n(async()=>b(ee,e,{jsfModify:t?.jsfModify}),"queryFn"),enabled:t?.queryOptions?.enabled}),"useGetContractDocumentSignatureSchema"),ht=n(()=>{let{client:e}=a();return g({mutationFn:n(async({employmentId:t,contractDocumentId:o,payload:r})=>G({client:e,body:r,path:{employment_id:t,contract_document_id:o}}),"mutationFn")})},"useSignContractDocument"),_e=n(({employmentId:e,contractDocumentId:t,options:o})=>{let{client:r}=a();return m({queryKey:["contract-document",e,t],queryFn:n(async()=>L({client:r,path:{employment_id:e,id:t}}),"queryFn"),enabled:o?.queryOptions?.enabled,select:n(({data:i})=>({...i?.data,contract_document:{...i?.data?.contract_document,content:V(i?.data?.contract_document?.content)}}),"select")})},"useGetShowContractDocument"),Et=n(({employmentId:e,contractDocumentId:t,options:o})=>{let{data:r}=_e({employmentId:e,contractDocumentId:t,options:{queryOptions:{enabled:o?.queryOptions?.enabled}}});return{hasCompanySignedContract:r?.contract_document?.signatories?.some(s=>s.type==="company"&&s.status==="signed")}},"useHasCompanySignedContract"),he=n(({employmentId:e,options:t})=>{let{client:o}=a();return m({queryKey:["contractor-subscriptions",e],queryFn:n(async()=>A({client:o,path:{employment_id:e}}),"queryFn"),enabled:t?.queryOptions?.enabled,select:n(({data:r})=>r?.data,"select")})},"useGetContractorSubscriptions"),qt=n(()=>{let{client:e}=a();return g({mutationFn:n(async({employmentId:t,payload:o})=>W({client:e,body:o,path:{employment_id:t}}),"mutationFn")})},"usePostManageContractorSubscriptions"),Ot=n(()=>{let{client:e}=a();return g({mutationFn:n(async({employmentId:t,payload:o})=>K({client:e,body:o,path:{employment_id:t}}),"mutationFn")})},"useCreateContractorContractDocument"),Ee=n(({countryCode:e,employmentId:t,fieldValues:o,options:r})=>{let{client:i}=a();return m({queryKey:["contractor-onboarding-details-schema",e,t],retry:!1,queryFn:n(async()=>Q({client:i,path:{country_code:e},query:{json_schema_version:1,employment_id:t}}),"queryFn"),enabled:r?.queryOptions?.enabled,select:n(({data:s})=>{let c=s?.data?.schema||{};return b(c,o,r)},"select")})},"useContractorOnboardingDetailsSchema"),qe={[I]:"Contractor Management",[ne]:"Contractor Management Plus",[P]:"Contractor of Record"},Oe=n(e=>{let{data:t,isLoading:o}=ae({enabled:e?.enabled}),r=t?.find(s=>s.product.name==="EOR Monthly");return{eorSubscription:r?{product:{identifier:_,short_name:"EOR"},currency:r.price.currency,price:{amount:O(r.price.amount)},features:["Contract between Remote and employee","Remote manages onboarding, payroll, and compliance","Manages taxes, benefits, and time-off tracking","Handles contracts, transfers, and terminations"],description:"Enables hiring in countries without a local entity",label:"Employer of Record",value:_}:null,isLoading:o}},"useEorSubscription"),Ie=n((e,t,o)=>(t&&R(_,o)&&e.push({label:t.label,value:t.value,description:t.description,meta:{features:t.features,price:{amount:t.price.amount,currencyCode:t.currency?.code??""}},disabled:!1}),e),"addEorToFieldOptions"),It=n((e,t,o)=>{let{data:r,isLoading:i,refetch:s}=he({employmentId:e,options:{queryOptions:o?.queryOptions}}),c=ce(()=>r?.filter(u=>R(u.product.identifier??"",o?.excludeProducts))??[],[r,o?.excludeProducts]),F=r?r?.length<3:!1,d=r?.find(u=>u.product.identifier===P)?.eligibility_questionnaire?.is_blocking,C=(F||d)&&t?.eor_onboarding&&!o?.excludeProducts?.includes("eor"),{eorSubscription:T,isLoading:le}=Oe({enabled:C}),ue=c.length>0||C&&T!==null,x=b(te.data.schema,{},{...o,jsfModify:{...o?.jsfModify,required:ue?o?.jsfModify?.required:u=>u.filter(f=>f!=="subscription")}}),D=x.fields.find(u=>u.name==="subscription");if(D){let u=c.map(S=>{let l=S.product,de=S.price.amount,me=S.currency.code,pe=qe[l.identifier]??"",ye=l.identifier??"",Ce=l.description??"";l.description||console.error(`[Data Integrity] Missing description for product: ${l.identifier}`,{product:l});let fe={features:l.features??oe[l.identifier]??[],price:{amount:O(de),currencyCode:me}};return{label:pe,value:ye,description:Ce,meta:fe,disabled:d&&l.identifier!==I}});u.sort((S,l)=>S.label.localeCompare(l.label));let f=[];C&&(Ie(f,T,o?.excludeProducts),f.length>0&&(f[0].meta={...f[0].meta,groupSeparator:{show:!0}})),D.options=[...u,...f]}return{isLoading:i||le,form:x,contractorSubscriptions:r,filteredContractorSubscriptions:c,refetch:s,isEligibilityQuestionnaireBlocked:d}},"useContractorSubscriptionSchemaField"),Pt=n((e,t,o)=>{let{mutateAsyncOrThrow:r}=q(t),{mutateAsyncOrThrow:i}=q(e);return{mutateAsync:n(async({employmentId:s})=>{let{nationality_status:c,ir35:p,ir35_sds_file:F}=o,y={contract_document:{ir_35:p}},d={contract_document:{nationality:c}};return p?(await i({employmentId:s,payload:y}),F?r({employment_id:s,file:F,sub_type:h}):Promise.resolve()):c?i({employmentId:s,payload:d}):Promise.resolve()},"mutateAsync")}},"useUpdateUKandSaudiFields"),Rt=n((e,t)=>{let{data:o,isLoading:r}=se(e,{sub_type:h},{...t,select:n(({data:c})=>c?.files?.filter(p=>p.sub_type===h),"select")}),i=o?.[0]?.id,s=ie(i);return{...s,isLoading:r||s.isLoading}},"useGetIR35File"),Mt=n((e,t)=>{let{client:o}=a();return m({queryKey:["contract-documents",e],queryFn:n(async()=>U({client:o,path:{employment_id:e}}),"queryFn"),enabled:t?.enabled,select:n(({data:r})=>r?.data?.contract_documents,"select")})},"useGetContractDocuments"),Tt=n(({options:e,fieldValues:t})=>{let{client:o}=a();return m({queryKey:["eligibility-questionnaire"],queryFn:n(async()=>{let r=await B({client:o,query:{type:"contractor_of_record",json_schema_version:1}});if(r.error)throw new Error("Failed to fetch eligibility questionnaire");return r.data.data},"queryFn"),select:n(r=>{let i=r?.schema||{};return b(i,t,{jsfModify:e?.jsfModify})},"select"),enabled:e?.queryOptions?.enabled})},"useGetEligibilityQuestionnaire"),xt=n(()=>{let{client:e}=a();return g({mutationFn:n(async({employmentId:t,payload:o})=>J({client:e,body:{employment_slug:t,responses:o,type:"contractor_of_record"},query:{json_schema_version:1}}),"mutationFn")})},"usePostCreateEligibilityQuestionnaire"),Dt=n(()=>{let{client:e}=a();return g({mutationFn:n(async({employmentId:t})=>z({client:e,path:{employment_id:t}}),"mutationFn")})},"usePostManageContractorCorSubscription"),Vt=n(()=>{let{client:e}=a();return g({mutationFn:n(async({employmentId:t})=>Y({client:e,path:{employment_id:t}}),"mutationFn")})},"useDeleteContractorCorSubscription"),wt=n(e=>{let{client:t}=a(),{data:o,isLoading:r}=m({...Z(t,"contractor-onboarding-countries"),select:n(s=>s.data?.data?.map(c=>({label:c.name,value:c.code,eor_onboarding:c.eor_onboarding,contractor_products_available:c.contractor_products_available}))||[],"select"),enabled:e?.queryOptions?.enabled}),i=b(X.data.schema,{},e);if(o){let s=i.fields.find(c=>c.name==="country");s&&(s.options=o)}return{isLoading:r,selectCountryForm:i,countries:o}},"useCountriesSchemaField"),Qt=n(({countryCode:e,employmentId:t,fieldValues:o,options:r})=>{let i=Ee({countryCode:e,employmentId:t,fieldValues:o,options:r}),{data:s,isLoading:c}=Se({employmentId:t,options:{queryOptions:{enabled:r?.queryOptions?.enabled}}}),p=ce(()=>!i.data||!s?i.data:{...i.data,fields:i.data.fields.map(y=>y.name!=="payment_terms"?y:{...y,fields:y.fields?.map(d=>d.name!=="compensation_currency_code"?d:{...d,options:s.map(C=>({label:C.code,value:C.code,meta:{source:C.source}}))})})},[i.data,s]);return{...i,data:p,isLoading:i.isLoading||c}},"useContractorOnboardingDetailsSchemaWithCurrencies"),At=n(({options:e}={})=>{let{data:t}=E(),o=M(t)?t?.company?.id??"":"",{client:r}=a();return m({queryKey:["company-open-tasks",o],queryFn:n(()=>H({client:r,path:{company_id:o}}),"queryFn"),select:n(({data:i})=>i?.data?.actions??[],"select"),enabled:(e?.queryOptions?.enabled??!0)&&!!o})},"useCompanyOpenTasks");export{Ve as a,E as b,M as c,_t as d,ht as e,_e as f,Et as g,he as h,qt as i,Ot as j,qe as k,It as l,Pt as m,Rt as n,Mt as o,Tt as p,xt as q,Dt as r,Vt as s,wt as t,Qt as u,At as v};
2
- //# sourceMappingURL=chunk-RATFUMTL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/ContractorOnboarding/api.ts","../src/common/api/files.ts","../src/common/api/companies.ts","../src/common/api/identity.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport {\n CompanyAction,\n CreateContractDocument,\n getV1CompaniesCompanyIdActions,\n getV1ContractorsEmploymentsEmploymentIdContractDocumentsId,\n getV1CountriesCountryCodeContractorContractDetails,\n getV1ContractorsEmploymentsEmploymentIdContractorSubscriptions,\n ManageContractorPlusSubscriptionOperationsParams,\n postV1ContractorsEmploymentsEmploymentIdContractDocuments,\n postV1ContractorsEmploymentsEmploymentIdContractorPlusSubscription,\n postV1ContractorsEmploymentsEmploymentIdContractDocumentsContractDocumentIdSign,\n SignContractDocument,\n getV1EmploymentsEmploymentIdContractDocuments,\n EligibilityQuestionnaireJsonSchemaResponse,\n getV1ContractorsSchemasEligibilityQuestionnaire,\n SubmitEligibilityQuestionnaireRequest,\n postV1ContractorsEligibilityQuestionnaire,\n postV1ContractorsEmploymentsEmploymentIdContractorCorSubscription,\n deleteV1ContractorsEmploymentsEmploymentIdContractorCorSubscription,\n getV1ContractorsEmploymentsEmploymentIdContractorCurrencies,\n Country,\n} from '@/src/client';\nimport { useClient } from '@/src/context';\nimport { signatureSchema } from '@/src/flows/ContractorOnboarding/json-schemas/signature';\nimport { selectContractorSubscriptionStepSchema } from '@/src/flows/ContractorOnboarding/json-schemas/selectContractorSubscriptionStep';\nimport {\n JSONSchemaFormResultWithFieldsets,\n FlowOptions,\n JSFModify,\n} from '@/src/flows/types';\nimport { clearBase64Data } from '@/src/lib/utils';\nimport { Client } from '@/src/client/client';\nimport { createHeadlessForm } from '@/src/common/createHeadlessForm';\nimport { useMutation, useQuery, UseQueryResult } from '@tanstack/react-query';\nimport { FieldValues } from 'react-hook-form';\nimport {\n contractorPlusProductIdentifier,\n contractorStandardProductIdentifier,\n corProductIdentifier,\n eorProductIdentifier,\n FEATURES_BY_IDENTIFIER,\n IR35_FILE_SUBTYPE,\n ProductType,\n} from '@/src/flows/ContractorOnboarding/constants';\nimport { $TSFixMe, JSFField } from '@/src/types/remoteFlows';\nimport { mutationToPromise } from '@/src/lib/mutations';\nimport {\n useDownloadFile,\n useEmploymentFiles,\n useUploadFile,\n} from '@/src/common/api/files';\nimport { convertFromCents } from '@/src/components/form/utils';\nimport { countriesOptions } from '@/src/common/api/countries';\nimport { selectCountryStepSchema } from '@/src/flows/Onboarding/json-schemas/selectCountryStep';\nimport { shouldIncludeProduct } from '@/src/flows/ContractorOnboarding/utils';\nimport { useCompanyPricingPlans, hasCompany } from '@/src/common/api/companies';\nimport { useIdentity } from '@/src/common/api/identity';\n\nconst useContractorCurrencies = ({\n employmentId,\n options,\n}: {\n employmentId: string;\n options?: { queryOptions?: { enabled?: boolean } };\n}) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['contractor-currencies', employmentId],\n queryFn: async () => {\n return getV1ContractorsEmploymentsEmploymentIdContractorCurrencies({\n client: client as Client,\n path: { employment_id: employmentId },\n query: {\n restrict_to_guaranteed_pay_out_currencies: false,\n },\n });\n },\n enabled: options?.queryOptions?.enabled,\n select: ({ data }) => {\n return data?.data;\n },\n });\n};\n\n/**\n * Get the contract document signature schema\n * @param fieldValues - The field values\n * @param options - The options\n * @returns The contract document signature schema\n */\nexport const useGetContractDocumentSignatureSchema = ({\n fieldValues,\n options,\n}: {\n fieldValues: FieldValues;\n options?: { queryOptions?: { enabled?: boolean }; jsfModify?: JSFModify };\n}) => {\n return useQuery({\n queryKey: [\n 'contract-document-signature',\n fieldValues.review_completed,\n options?.jsfModify,\n ],\n queryFn: async () => {\n return createHeadlessForm(signatureSchema, fieldValues, {\n jsfModify: options?.jsfModify,\n });\n },\n enabled: options?.queryOptions?.enabled,\n });\n};\n\n/**\n * Signs the contract document\n * @param employmentId - The employment ID\n * @param contractDocumentId - The contract document ID\n * @param payload - The payload\n * @returns The signed contract document\n */\nexport const useSignContractDocument = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: async ({\n employmentId,\n contractDocumentId,\n payload,\n }: {\n employmentId: string;\n contractDocumentId: string;\n payload: SignContractDocument;\n }) => {\n return postV1ContractorsEmploymentsEmploymentIdContractDocumentsContractDocumentIdSign(\n {\n client: client as Client,\n body: payload,\n path: {\n employment_id: employmentId,\n contract_document_id: contractDocumentId,\n },\n },\n );\n },\n });\n};\n\n/**\n * Get the contract document for a given employment and contract document ID\n * @param employmentId - The employment ID\n * @param contractDocumentId - The contract document ID\n * @returns The contract document\n */\nexport const useGetShowContractDocument = ({\n employmentId,\n contractDocumentId,\n options,\n}: {\n employmentId: string;\n contractDocumentId: string;\n options?: { queryOptions?: { enabled?: boolean }; jsfModify?: JSFModify };\n}) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['contract-document', employmentId, contractDocumentId],\n queryFn: async () => {\n return getV1ContractorsEmploymentsEmploymentIdContractDocumentsId({\n client: client as Client,\n path: { employment_id: employmentId, id: contractDocumentId },\n });\n },\n enabled: options?.queryOptions?.enabled,\n select: ({ data }) => {\n return {\n ...data?.data,\n contract_document: {\n ...data?.data?.contract_document,\n content: clearBase64Data(\n data?.data?.contract_document?.content as $TSFixMe,\n ),\n },\n };\n },\n });\n};\n\nexport const useHasCompanySignedContract = ({\n employmentId,\n contractDocumentId,\n options,\n}: {\n employmentId: string;\n contractDocumentId: string;\n options?: { queryOptions?: { enabled?: boolean } };\n}) => {\n const { data: documentPreviewPdf } = useGetShowContractDocument({\n employmentId,\n contractDocumentId,\n options: {\n queryOptions: {\n enabled: options?.queryOptions?.enabled,\n },\n },\n });\n\n const hasCompanySignedContract =\n documentPreviewPdf?.contract_document?.signatories?.some(\n (signatory) =>\n signatory.type === 'company' && signatory.status === 'signed',\n );\n\n return {\n hasCompanySignedContract,\n };\n};\n/**\n * Get the contractor subscriptions for the given employment id\n * @param employmentId - The employment ID\n * @returns The contractor subscriptions available\n */\nexport const useGetContractorSubscriptions = ({\n employmentId,\n options,\n}: {\n employmentId: string;\n options?: { queryOptions?: { enabled?: boolean } };\n}) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['contractor-subscriptions', employmentId],\n queryFn: async () => {\n return getV1ContractorsEmploymentsEmploymentIdContractorSubscriptions({\n client: client as Client,\n path: { employment_id: employmentId },\n });\n },\n enabled: options?.queryOptions?.enabled,\n select: ({ data }) => {\n return data?.data;\n },\n });\n};\n\n/**\n * Upgrade or downgrade contractor subscription\n */\nexport const usePostManageContractorSubscriptions = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: async ({\n employmentId,\n payload,\n }: {\n employmentId: string;\n payload: ManageContractorPlusSubscriptionOperationsParams;\n }) => {\n return postV1ContractorsEmploymentsEmploymentIdContractorPlusSubscription(\n {\n client: client as Client,\n body: payload,\n path: {\n employment_id: employmentId,\n },\n },\n );\n },\n });\n};\n\n/**\n * Saves the contractor details data\n * @param employmentId - The employment ID\n * @param payload - The payload\n * @returns The contractor contract document\n */\nexport const useCreateContractorContractDocument = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: async ({\n employmentId,\n payload,\n }: {\n employmentId: string;\n payload: CreateContractDocument;\n }) => {\n return postV1ContractorsEmploymentsEmploymentIdContractDocuments({\n client: client as Client,\n body: payload,\n path: {\n employment_id: employmentId,\n },\n });\n },\n });\n};\n\n/**\n * Get the contractor onboarding details schema for a given country\n * @param countryCode - The country code\n * @param fieldValues - The field values\n * @param options - The options\n * @returns The contractor onboarding details schema\n */\nconst useContractorOnboardingDetailsSchema = ({\n countryCode,\n employmentId,\n fieldValues,\n options,\n}: {\n countryCode: string;\n fieldValues: FieldValues;\n employmentId: string;\n options?: FlowOptions & { queryOptions?: { enabled?: boolean } };\n query?: Record<string, unknown>;\n}): UseQueryResult<JSONSchemaFormResultWithFieldsets> => {\n const { client } = useClient();\n return useQuery({\n queryKey: [\n 'contractor-onboarding-details-schema',\n countryCode,\n employmentId,\n ],\n retry: false,\n queryFn: async () => {\n return getV1CountriesCountryCodeContractorContractDetails({\n client: client as Client,\n path: { country_code: countryCode },\n query: {\n json_schema_version: 1,\n employment_id: employmentId,\n },\n });\n },\n enabled: options?.queryOptions?.enabled,\n select: ({ data }) => {\n const jsfSchema = data?.data?.schema || {};\n return createHeadlessForm(jsfSchema, fieldValues, options);\n },\n });\n};\n\nexport const CONTRACT_PRODUCT_TITLES = {\n [contractorStandardProductIdentifier]: 'Contractor Management',\n [contractorPlusProductIdentifier]: 'Contractor Management Plus',\n [corProductIdentifier]: 'Contractor of Record',\n};\n\nconst useEorSubscription = (options?: { enabled?: boolean }) => {\n const { data: pricingPlans, isLoading: isLoadingPricingPlans } =\n useCompanyPricingPlans({\n enabled: options?.enabled,\n });\n\n const eorPricingPlan = pricingPlans?.find(\n (plan) => plan.product.name === 'EOR Monthly',\n );\n\n const eorSubscription = eorPricingPlan\n ? {\n product: {\n identifier: eorProductIdentifier,\n short_name: 'EOR',\n },\n currency: eorPricingPlan.price.currency,\n price: {\n amount: convertFromCents(eorPricingPlan.price.amount),\n },\n features: [\n 'Contract between Remote and employee',\n 'Remote manages onboarding, payroll, and compliance',\n 'Manages taxes, benefits, and time-off tracking',\n 'Handles contracts, transfers, and terminations',\n ],\n description: 'Enables hiring in countries without a local entity',\n label: 'Employer of Record',\n value: eorProductIdentifier,\n }\n : null;\n\n return { eorSubscription, isLoading: isLoadingPricingPlans };\n};\n\ntype SelectedCountry =\n | (Pick<Country, 'eor_onboarding' | 'contractor_products_available'> & {\n label: string;\n })\n | undefined;\n\nconst addEorToFieldOptions = (\n fieldOptions: $TSFixMe[],\n eorSubscription: ReturnType<typeof useEorSubscription>['eorSubscription'],\n excludeProducts?: ProductType[],\n) => {\n if (\n eorSubscription &&\n shouldIncludeProduct(eorProductIdentifier, excludeProducts)\n ) {\n fieldOptions.push({\n label: eorSubscription.label,\n value: eorSubscription.value,\n description: eorSubscription.description,\n meta: {\n features: eorSubscription.features,\n price: {\n amount: eorSubscription.price.amount,\n currencyCode: eorSubscription.currency?.code ?? '',\n },\n },\n disabled: false,\n });\n }\n return fieldOptions;\n};\n\nexport const useContractorSubscriptionSchemaField = (\n employmentId: string,\n selectedCountry: SelectedCountry,\n options?: FlowOptions & {\n queryOptions?: { enabled?: boolean };\n excludeProducts?: ProductType[];\n },\n) => {\n const {\n data: contractorSubscriptions,\n isLoading,\n refetch,\n } = useGetContractorSubscriptions({\n employmentId: employmentId,\n options: {\n queryOptions: options?.queryOptions,\n },\n });\n\n const filteredContractorSubscriptions = useMemo(\n () =>\n contractorSubscriptions?.filter((subscription) =>\n shouldIncludeProduct(\n subscription.product.identifier ?? '',\n options?.excludeProducts,\n ),\n ) ?? [],\n [contractorSubscriptions, options?.excludeProducts],\n );\n\n // maximum number of subscriptions\n const MAXIMUM_CONTRACTOR_SUBSCRIPTIONS_COUNT = 3;\n\n const isMissingSubscriptions = contractorSubscriptions\n ? contractorSubscriptions?.length < MAXIMUM_CONTRACTOR_SUBSCRIPTIONS_COUNT\n : false;\n\n const corSubscription = contractorSubscriptions?.find(\n (subscription) => subscription.product.identifier === corProductIdentifier,\n );\n\n const isEligibilityQuestionnaireBlocked =\n corSubscription?.eligibility_questionnaire?.is_blocking;\n\n const showEorSubscription =\n (isMissingSubscriptions || isEligibilityQuestionnaireBlocked) &&\n selectedCountry?.eor_onboarding &&\n !options?.excludeProducts?.includes('eor');\n\n const { eorSubscription, isLoading: isLoadingEorSubscription } =\n useEorSubscription({\n enabled: showEorSubscription,\n });\n\n const hasAvailableOptions =\n filteredContractorSubscriptions.length > 0 ||\n (showEorSubscription && eorSubscription !== null);\n\n const form = createHeadlessForm(\n selectContractorSubscriptionStepSchema.data.schema,\n {},\n {\n ...options,\n jsfModify: {\n ...options?.jsfModify,\n // If no filtered subscriptions are available, make the subscription field optional\n required: hasAvailableOptions\n ? options?.jsfModify?.required\n : (existingRequired: string[]) =>\n existingRequired.filter(\n (fieldName: string) => fieldName !== 'subscription',\n ),\n },\n },\n );\n\n const field: JSFField | undefined = form.fields.find(\n (field) => field.name === 'subscription',\n ) as JSFField | undefined;\n\n if (field) {\n // Start with contractor management options\n const contractorOptions = filteredContractorSubscriptions.map((opts) => {\n const product = opts.product;\n const price = opts.price.amount;\n const currencyCode = opts.currency.code;\n const title =\n CONTRACT_PRODUCT_TITLES[\n product.identifier as keyof typeof CONTRACT_PRODUCT_TITLES\n ] ?? '';\n const label = title;\n const value = product.identifier ?? '';\n const description = product.description ?? '';\n\n if (!product.description) {\n console.error(\n `[Data Integrity] Missing description for product: ${product.identifier}`,\n { product },\n );\n }\n\n const features =\n product.features ??\n FEATURES_BY_IDENTIFIER[\n product.identifier as keyof typeof FEATURES_BY_IDENTIFIER\n ] ??\n [];\n const meta = {\n features,\n price: {\n amount: convertFromCents(price),\n currencyCode: currencyCode,\n },\n };\n return {\n label,\n value,\n description,\n meta,\n disabled:\n isEligibilityQuestionnaireBlocked &&\n product.identifier !== contractorStandardProductIdentifier,\n };\n });\n\n // Sort contractor options\n contractorOptions.sort((a, b) => a.label.localeCompare(b.label));\n\n // Build otherSubscriptions (EOR) with separator metadata\n const otherOptions: $TSFixMe[] = [];\n if (showEorSubscription) {\n addEorToFieldOptions(\n otherOptions as unknown as $TSFixMe[],\n eorSubscription,\n options?.excludeProducts,\n );\n\n // Add separator metadata to first \"other\" option\n // only the first option to avoid problems when iterating over the options\n if (otherOptions.length > 0) {\n otherOptions[0].meta = {\n ...otherOptions[0].meta,\n groupSeparator: {\n show: true,\n },\n };\n }\n }\n\n // Combine all options into the single field\n field.options = [...contractorOptions, ...otherOptions];\n }\n\n return {\n isLoading: isLoading || isLoadingEorSubscription,\n form,\n contractorSubscriptions,\n filteredContractorSubscriptions,\n refetch,\n isEligibilityQuestionnaireBlocked,\n };\n};\n\nexport const useUpdateUKandSaudiFields = (\n createContractorContractDocumentMutation: ReturnType<\n typeof useCreateContractorContractDocument\n >,\n uploadFileMutation: ReturnType<typeof useUploadFile>,\n parsedValues: FieldValues,\n) => {\n const { mutateAsyncOrThrow: uploadFileMutationAsync } =\n mutationToPromise(uploadFileMutation);\n const { mutateAsyncOrThrow: createContractorContractDocumentMutationAsync } =\n mutationToPromise(createContractorContractDocumentMutation);\n\n return {\n mutateAsync: async ({ employmentId }: { employmentId: string }) => {\n const {\n nationality_status: nationalityStatus,\n ir35: ir35Status,\n ir35_sds_file: ir35SdsFile,\n } = parsedValues;\n const ir35ContractDetailsPayload = {\n contract_document: {\n ir_35: ir35Status,\n },\n };\n const nationalityContractDetailsPayload = {\n contract_document: {\n nationality: nationalityStatus,\n },\n };\n if (ir35Status) {\n await createContractorContractDocumentMutationAsync({\n employmentId: employmentId,\n payload: ir35ContractDetailsPayload,\n });\n\n if (ir35SdsFile) {\n return uploadFileMutationAsync({\n employment_id: employmentId,\n file: ir35SdsFile,\n sub_type: IR35_FILE_SUBTYPE,\n });\n }\n return Promise.resolve();\n }\n // nationality status is sent for the countries SAU, KWT, OMN, QAT, BHR\n if (nationalityStatus) {\n return createContractorContractDocumentMutationAsync({\n employmentId: employmentId,\n payload: nationalityContractDetailsPayload,\n });\n }\n\n return Promise.resolve();\n },\n };\n};\n\nexport const useGetIR35File = (\n employmentId: string,\n options?: { enabled?: boolean },\n) => {\n const { data: ir35Files, isLoading: isLoadingFiles } = useEmploymentFiles(\n employmentId,\n {\n sub_type: IR35_FILE_SUBTYPE,\n },\n {\n ...options,\n select: ({ data }) =>\n data?.files?.filter((file) => file.sub_type === IR35_FILE_SUBTYPE),\n },\n );\n const id = ir35Files?.[0]?.id;\n\n const downloadQuery = useDownloadFile(id as string);\n\n return {\n ...downloadQuery,\n isLoading: isLoadingFiles || downloadQuery.isLoading,\n };\n};\n\n/**\n * Get the contract documents for a given employment\n * @param employmentId - The employment ID\n * @param options - The options\n * @returns The contract documents\n */\nexport const useGetContractDocuments = (\n employmentId: string,\n options?: { enabled?: boolean },\n) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['contract-documents', employmentId],\n queryFn: async () => {\n return getV1EmploymentsEmploymentIdContractDocuments({\n client: client as Client,\n path: { employment_id: employmentId },\n });\n },\n enabled: options?.enabled,\n select: ({ data }) => {\n return data?.data?.contract_documents;\n },\n });\n};\n\nexport const useGetEligibilityQuestionnaire = ({\n options,\n fieldValues,\n}: {\n options?: FlowOptions & { queryOptions?: { enabled?: boolean } };\n fieldValues: FieldValues;\n}) => {\n const { client } = useClient();\n return useQuery<\n EligibilityQuestionnaireJsonSchemaResponse['data'],\n Error,\n JSONSchemaFormResultWithFieldsets\n >({\n queryKey: ['eligibility-questionnaire'],\n queryFn: async (): Promise<\n EligibilityQuestionnaireJsonSchemaResponse['data']\n > => {\n const response = await getV1ContractorsSchemasEligibilityQuestionnaire({\n client: client as Client,\n query: {\n type: 'contractor_of_record',\n json_schema_version: 1,\n },\n });\n\n // Extract the data from the response wrapper\n if (response.error) {\n throw new Error('Failed to fetch eligibility questionnaire');\n }\n\n return response.data\n .data as EligibilityQuestionnaireJsonSchemaResponse['data'];\n },\n select: (data: EligibilityQuestionnaireJsonSchemaResponse['data']) => {\n const schema = data?.schema || {};\n return createHeadlessForm(schema, fieldValues, {\n jsfModify: options?.jsfModify,\n });\n },\n enabled: options?.queryOptions?.enabled,\n });\n};\n\nexport const usePostCreateEligibilityQuestionnaire = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: async ({\n employmentId,\n payload,\n }: {\n employmentId: string;\n payload: SubmitEligibilityQuestionnaireRequest['responses'];\n }) => {\n return postV1ContractorsEligibilityQuestionnaire({\n client: client as Client,\n body: {\n employment_slug: employmentId,\n responses: payload,\n type: 'contractor_of_record',\n },\n query: {\n json_schema_version: 1, // TODO: json_schema_version should be dynamic but fixed for now\n },\n });\n },\n });\n};\n\nexport const usePostManageContractorCorSubscription = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: async ({ employmentId }: { employmentId: string }) => {\n return postV1ContractorsEmploymentsEmploymentIdContractorCorSubscription({\n client: client as Client,\n path: {\n employment_id: employmentId,\n },\n });\n },\n });\n};\n\nexport const useDeleteContractorCorSubscription = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: async ({ employmentId }: { employmentId: string }) => {\n return deleteV1ContractorsEmploymentsEmploymentIdContractorCorSubscription(\n {\n client: client as Client,\n path: { employment_id: employmentId },\n },\n );\n },\n });\n};\n\nexport const useCountriesSchemaField = (\n options?: Omit<FlowOptions, 'jsonSchemaVersion'> & {\n queryOptions?: { enabled?: boolean };\n },\n) => {\n const { client } = useClient();\n const { data: countries, isLoading } = useQuery({\n ...countriesOptions(client as Client, 'contractor-onboarding-countries'),\n select: (response) => {\n return (\n response.data?.data?.map((country) => {\n return {\n label: country.name,\n value: country.code,\n eor_onboarding: country.eor_onboarding,\n contractor_products_available:\n country.contractor_products_available,\n };\n }) || []\n );\n },\n enabled: options?.queryOptions?.enabled,\n });\n\n const selectCountryForm = createHeadlessForm(\n selectCountryStepSchema.data.schema,\n {},\n options,\n );\n\n if (countries) {\n const countryField = selectCountryForm.fields.find(\n (field) => field.name === 'country',\n );\n if (countryField) {\n countryField.options = countries;\n }\n }\n\n return {\n isLoading,\n selectCountryForm,\n countries,\n };\n};\n\n/**\n * Get contractor onboarding details schema with currency options overridden\n * from the getIndexContractorCurrency endpoint\n */\nexport const useContractorOnboardingDetailsSchemaWithCurrencies = ({\n countryCode,\n employmentId,\n fieldValues,\n options,\n}: {\n countryCode: string;\n fieldValues: FieldValues;\n employmentId: string;\n options?: FlowOptions & { queryOptions?: { enabled?: boolean } };\n}) => {\n const schemaQuery = useContractorOnboardingDetailsSchema({\n countryCode,\n employmentId,\n fieldValues,\n options,\n });\n\n const { data: currencies, isLoading: isLoadingCurrencies } =\n useContractorCurrencies({\n employmentId,\n options: {\n queryOptions: { enabled: options?.queryOptions?.enabled },\n },\n });\n\n const dataWithCurrencies = useMemo(() => {\n if (!schemaQuery.data || !currencies) {\n return schemaQuery.data;\n }\n\n const form = {\n ...schemaQuery.data,\n fields: schemaQuery.data.fields.map((field) => {\n if (field.name !== 'payment_terms') {\n return field;\n }\n\n return {\n ...field,\n fields: (field.fields as $TSFixMe[])?.map((nestedField: $TSFixMe) => {\n if (nestedField.name !== 'compensation_currency_code') {\n return nestedField;\n }\n\n // Return a new object with overridden options\n return {\n ...nestedField,\n options: currencies.map((currency) => ({\n label: currency.code,\n value: currency.code,\n meta: { source: currency.source },\n })),\n };\n }),\n };\n }),\n };\n\n return form;\n }, [schemaQuery.data, currencies]);\n\n return {\n ...schemaQuery,\n data: dataWithCurrencies as $TSFixMe,\n isLoading: schemaQuery.isLoading || isLoadingCurrencies,\n };\n};\n\nexport const useCompanyOpenTasks = ({\n options,\n}: {\n options?: { queryOptions?: { enabled?: boolean } };\n} = {}) => {\n const { data: identity } = useIdentity();\n const companyId = hasCompany(identity) ? (identity?.company?.id ?? '') : '';\n const { client } = useClient();\n\n return useQuery({\n queryKey: ['company-open-tasks', companyId],\n queryFn: () =>\n getV1CompaniesCompanyIdActions({\n client: client as Client,\n path: { company_id: companyId },\n }),\n select: ({ data }) => data?.data?.actions ?? ([] as CompanyAction[]),\n enabled: (options?.queryOptions?.enabled ?? true) && !!companyId,\n });\n};\n","import { useMutation, useQuery, UseQueryOptions } from '@tanstack/react-query';\nimport { Client } from '@/src/client/client';\nimport {\n getV1EmploymentsEmploymentIdFiles,\n getV1FilesId,\n postV1Documents,\n} from '@/src/client/sdk.gen';\nimport {\n GetV1EmploymentsEmploymentIdFilesData,\n GetV1EmploymentsEmploymentIdFilesErrors,\n File as ApiFile,\n ListFilesResponse,\n PostV1DocumentsData,\n} from '@/src/client/types.gen';\nimport { useClient } from '@/src/context';\n\n/**\n * Hook to upload a file associated with a specified employment.\n * @returns A mutation result for uploading employee files.\n */\nexport const useUploadFile = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (params: PostV1DocumentsData['body']) => {\n return postV1Documents({\n client: client as Client,\n body: params,\n headers: {\n Authorization: ``,\n },\n });\n },\n });\n};\n\n/**\n * Hook to download a file by its ID.\n * @param id - The ID of the file to download.\n * @returns A query result containing the file data.\n */\nexport const useDownloadFile = (id: string) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['download-file', id],\n queryFn: async () => {\n const result = await getV1FilesId({\n client: client as Client,\n path: { id: id },\n });\n\n if (result.error) {\n throw result.error;\n }\n\n return result.data;\n },\n select: ({ data }) => data?.file,\n enabled: !!id,\n });\n};\n\n/**\n * Hook to retrieve files associated with a specific employment.\n * @param employmentId - The ID of the employment to retrieve files for.\n * @param queryParams - The query parameters to filter the files.\n * @param queryOptions - Optional TanStack Query options to customize the query behavior.\n * @returns A query result containing the employment files.\n */\nexport const useEmploymentFiles = (\n employmentId: string,\n queryParams: GetV1EmploymentsEmploymentIdFilesData['query'],\n queryOptions?: Omit<\n UseQueryOptions<\n ListFilesResponse,\n GetV1EmploymentsEmploymentIdFilesErrors,\n ApiFile[] | undefined,\n unknown[]\n >,\n 'queryKey' | 'queryFn'\n >,\n) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['employment-files', employmentId],\n queryFn: async () => {\n const result = await getV1EmploymentsEmploymentIdFiles({\n client: client as Client,\n path: { employment_id: employmentId },\n query: queryParams,\n });\n\n if (result.error) {\n throw result.error;\n }\n\n return result.data;\n },\n ...queryOptions,\n });\n};\n","import { useQuery } from '@tanstack/react-query';\nimport { useClient } from '@/src/context';\nimport {\n getV1CompaniesCompanyIdPricingPlans,\n IdentityCurrentResponse,\n} from '@/src/client';\nimport { Client } from '@/src/client/client';\nimport { useIdentity } from '@/src/common/api/identity';\n\nexport function hasCompany(\n identity: IdentityCurrentResponse['data'] | undefined,\n): identity is Extract<\n IdentityCurrentResponse['data'],\n { company: { id: string } }\n> {\n return identity != null && 'company' in identity;\n}\n\nexport const useCompanyPricingPlans = (\n queryOptions: { enabled?: boolean } = { enabled: true },\n) => {\n const { data: identity } = useIdentity();\n const companyId = hasCompany(identity) ? (identity?.company?.id ?? '') : '';\n const { client } = useClient();\n return useQuery({\n queryKey: ['pricing-plans', companyId],\n queryFn: () =>\n getV1CompaniesCompanyIdPricingPlans({\n client: client as Client,\n path: { company_id: companyId },\n }),\n select: (data) => data.data?.data?.pricing_plans,\n enabled: Boolean(queryOptions?.enabled) && !!companyId,\n });\n};\n","import { useQuery } from '@tanstack/react-query';\nimport { getV1IdentityCurrent } from '@/src/client';\nimport { useClient } from '@/src/context';\nimport { Client } from '@/src/client/client';\n\nexport const useIdentity = () => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['identity'],\n queryFn: () =>\n getV1IdentityCurrent({\n client: client as Client,\n headers: { Authorization: `` },\n }),\n select: (data) => data.data?.data,\n });\n};\n"],"mappings":"+lBAAA,OAAS,WAAAA,OAAe,QAkCxB,OAAS,eAA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AAGD,EACH,KAAMG,EACN,UAAWH,EAAY,WAAaE,CACtC,CACF,EAnEkE,sDAqErDI,GAAsBhI,EAAA,CAAC,CAClC,QAAAE,CACF,EAEI,CAAC,IAAM,CACT,GAAM,CAAE,KAAM+H,CAAS,EAAIC,EAAY,EACjCC,EAAYC,EAAWH,CAAQ,EAAKA,GAAU,SAAS,IAAM,GAAM,GACnE,CAAE,OAAA9H,CAAO,EAAIC,EAAU,EAE7B,OAAOC,EAAS,CACd,SAAU,CAAC,qBAAsB8H,CAAS,EAC1C,QAASnI,EAAA,IACPqI,EAA+B,CAC7B,OAAQlI,EACR,KAAM,CAAE,WAAYgI,CAAU,CAChC,CAAC,EAJM,WAKT,OAAQnI,EAAA,CAAC,CAAE,KAAAO,CAAK,IAAMA,GAAM,MAAM,SAAY,CAAC,EAAvC,UACR,SAAUL,GAAS,cAAc,SAAW,KAAS,CAAC,CAACiI,CACzD,CAAC,CACH,EAnBmC","names":["useMemo","useMutation","useQuery","useMutation","useQuery","useUploadFile","__name","client","useClient","useMutation","params","postV1Documents","useDownloadFile","id","useQuery","result","getV1FilesId","data","useEmploymentFiles","employmentId","queryParams","queryOptions","getV1EmploymentsEmploymentIdFiles","useQuery","useQuery","useIdentity","__name","client","useClient","useQuery","getV1IdentityCurrent","data","hasCompany","identity","__name","useCompanyPricingPlans","queryOptions","useIdentity","companyId","client","useClient","useQuery","getV1CompaniesCompanyIdPricingPlans","data","useContractorCurrencies","__name","employmentId","options","client","useClient","useQuery","getV1ContractorsEmploymentsEmploymentIdContractorCurrencies","data","useGetContractDocumentSignatureSchema","fieldValues","createHeadlessForm","signatureSchema","useSignContractDocument","useMutation","contractDocumentId","payload","postV1ContractorsEmploymentsEmploymentIdContractDocumentsContractDocumentIdSign","useGetShowContractDocument","getV1ContractorsEmploymentsEmploymentIdContractDocumentsId","clearBase64Data","useHasCompanySignedContract","documentPreviewPdf","signatory","useGetContractorSubscriptions","getV1ContractorsEmploymentsEmploymentIdContractorSubscriptions","usePostManageContractorSubscriptions","postV1ContractorsEmploymentsEmploymentIdContractorPlusSubscription","useCreateContractorContractDocument","postV1ContractorsEmploymentsEmploymentIdContractDocuments","useContractorOnboardingDetailsSchema","countryCode","getV1CountriesCountryCodeContractorContractDetails","jsfSchema","CONTRACT_PRODUCT_TITLES","contractorStandardProductIdentifier","contractorPlusProductIdentifier","corProductIdentifier","useEorSubscription","pricingPlans","isLoadingPricingPlans","useCompanyPricingPlans","eorPricingPlan","plan","eorProductIdentifier","convertFromCents","addEorToFieldOptions","fieldOptions","eorSubscription","excludeProducts","shouldIncludeProduct","useContractorSubscriptionSchemaField","selectedCountry","contractorSubscriptions","isLoading","refetch","filteredContractorSubscriptions","useMemo","subscription","isMissingSubscriptions","isEligibilityQuestionnaireBlocked","showEorSubscription","isLoadingEorSubscription","hasAvailableOptions","form","selectContractorSubscriptionStepSchema","existingRequired","fieldName","field","contractorOptions","opts","product","price","currencyCode","label","value","description","meta","FEATURES_BY_IDENTIFIER","a","b","otherOptions","useUpdateUKandSaudiFields","createContractorContractDocumentMutation","uploadFileMutation","parsedValues","uploadFileMutationAsync","mutationToPromise","createContractorContractDocumentMutationAsync","nationalityStatus","ir35Status","ir35SdsFile","ir35ContractDetailsPayload","nationalityContractDetailsPayload","IR35_FILE_SUBTYPE","useGetIR35File","ir35Files","isLoadingFiles","useEmploymentFiles","file","id","downloadQuery","useDownloadFile","useGetContractDocuments","getV1EmploymentsEmploymentIdContractDocuments","useGetEligibilityQuestionnaire","response","getV1ContractorsSchemasEligibilityQuestionnaire","schema","usePostCreateEligibilityQuestionnaire","postV1ContractorsEligibilityQuestionnaire","usePostManageContractorCorSubscription","postV1ContractorsEmploymentsEmploymentIdContractorCorSubscription","useDeleteContractorCorSubscription","deleteV1ContractorsEmploymentsEmploymentIdContractorCorSubscription","useCountriesSchemaField","countries","countriesOptions","country","selectCountryForm","selectCountryStepSchema","countryField","useContractorOnboardingDetailsSchemaWithCurrencies","schemaQuery","currencies","isLoadingCurrencies","dataWithCurrencies","nestedField","currency","useCompanyOpenTasks","identity","useIdentity","companyId","hasCompany","getV1CompaniesCompanyIdActions"]}
@@ -1,2 +0,0 @@
1
- import{a as o}from"./chunk-TC7EQZJK.js";import{a as m}from"./chunk-NX7MM6XR.js";import{a as e}from"./chunk-ZXGAFQXW.js";import{a as i}from"./chunk-LMYJ6V44.js";var p={employee_communication:o,termination_details:e,paid_time_off:m,additional_information:i};export{p as a};
2
- //# sourceMappingURL=chunk-SC7YWKOW.js.map
@@ -1 +0,0 @@
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\nexport type StepKeys =\n | 'select_country'\n | 'basic_information'\n | 'engagement_agreement_details'\n | 'contract_details'\n | 'benefits'\n | 'employment_agreement_preview'\n | 'review';\n\ntype StepConfig = {\n includeSelectCountry?: boolean;\n includeEngagementAgreementDetails?: boolean;\n useDynamicSteps?: boolean;\n useEAPreview?: boolean;\n};\n\nexport function buildSteps(config: StepConfig = {}) {\n const stepDefinitions: Array<{\n name: StepKeys;\n label: string;\n visible: boolean;\n }> = [\n {\n name: 'select_country',\n label: 'Select Country',\n visible: Boolean(config?.includeSelectCountry),\n },\n {\n name: 'basic_information',\n label: 'Basic Information',\n visible: true,\n },\n {\n name: 'engagement_agreement_details',\n label: 'Engagement Agreement Details',\n visible: Boolean(config?.includeEngagementAgreementDetails),\n },\n {\n name: 'contract_details',\n label: 'Contract Details',\n visible: true,\n },\n {\n name: 'benefits',\n label: 'Benefits',\n visible: true,\n },\n {\n name: 'employment_agreement_preview',\n label: 'Preview Employment Agreement',\n visible: Boolean(config?.useEAPreview),\n },\n {\n name: 'review',\n label: 'Review',\n visible: true,\n },\n ];\n\n // When useDynamicSteps is false (default/legacy behavior):\n // - Filter out hidden steps first\n // - Assign sequential indices (0, 1, 2, 3...)\n // - This maintains backwards compatibility with existing implementations\n //\n // When useDynamicSteps is true (new behavior):\n // - Keep all steps including hidden ones\n // - Preserve original indices even for hidden steps\n // - Consumers must filter by `visible` property\n const stepsArray = config.useDynamicSteps\n ? stepDefinitions.map((step, index) => ({\n name: step.name,\n index,\n label: step.label,\n visible: step.visible,\n }))\n : stepDefinitions\n .filter((step) => step.visible)\n .map((step, index) => ({\n name: step.name,\n index,\n label: step.label,\n visible: step.visible,\n }));\n\n const steps = stepsArray.reduce(\n (acc, step) => {\n acc[step.name] = {\n index: step.index,\n name: step.name,\n visible: step.visible,\n };\n return acc;\n },\n {} as Record<string, Step<StepKeys>>,\n );\n\n return { steps, stepsArray };\n}\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 'initiated',\n 'invited',\n 'created_awaiting_reserve',\n 'created_reserve_paid',\n];\n\nexport const disabledInviteButtonEmploymentStatus: Employment['status'][] = [\n 'initiated',\n 'created_awaiting_reserve',\n 'invited',\n];\n\nexport const DEFAULT_VERSION = 1;\n\n/**\n * Gets the default (recommended) contract details schema version for a country\n */\nconst getDefaultContractDetailsSchemaVersion = (): number => {\n return DEFAULT_VERSION;\n};\n\n/**\n * Resolves the effective contract details schema version for a 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();\n\n return requestedVersion;\n};\n\n/**\n * Gets the basic information schema version from options\n * @param options - The flow options containing version configurations\n * @returns The jsonSchemaVersion for basic information or default\n */\nexport const getBasicInformationSchemaVersion = (\n options: OnboardingFlowProps['options'],\n): number | 'latest' => {\n return (\n options?.jsonSchemaVersion?.employment_basic_information || DEFAULT_VERSION\n );\n};\n\n/**\n * Gets the benefit offers schema version from options\n * @param options - The flow options containing version configurations\n * @returns The jsonSchemaVersion for benefit offers or undefined if not set\n */\nexport const getBenefitOffersSchemaVersion = (\n options: OnboardingFlowProps['options'],\n): number | 'latest' => {\n return (\n options?.jsonSchemaVersion?.benefit_offers_form_schema || DEFAULT_VERSION\n );\n};\n"],"mappings":"wCAmBO,SAASA,EAAWC,EAAqB,CAAC,EAAG,CAClD,IAAMC,EAID,CACH,CACE,KAAM,iBACN,MAAO,iBACP,QAAS,EAAQD,GAAQ,oBAC3B,EACA,CACE,KAAM,oBACN,MAAO,oBACP,QAAS,EACX,EACA,CACE,KAAM,+BACN,MAAO,+BACP,QAAS,EAAQA,GAAQ,iCAC3B,EACA,CACE,KAAM,mBACN,MAAO,mBACP,QAAS,EACX,EACA,CACE,KAAM,WACN,MAAO,WACP,QAAS,EACX,EACA,CACE,KAAM,+BACN,MAAO,+BACP,QAAS,EAAQA,GAAQ,YAC3B,EACA,CACE,KAAM,SACN,MAAO,SACP,QAAS,EACX,CACF,EAWME,EAAaF,EAAO,gBACtBC,EAAgB,IAAI,CAACE,EAAMC,KAAW,CACpC,KAAMD,EAAK,KACX,MAAAC,EACA,MAAOD,EAAK,MACZ,QAASA,EAAK,OAChB,EAAE,EACFF,EACG,OAAQE,GAASA,EAAK,OAAO,EAC7B,IAAI,CAACA,EAAMC,KAAW,CACrB,KAAMD,EAAK,KACX,MAAAC,EACA,MAAOD,EAAK,MACZ,QAASA,EAAK,OAChB,EAAE,EAcR,MAAO,CAAE,MAZKD,EAAW,OACvB,CAACG,EAAKF,KACJE,EAAIF,EAAK,IAAI,EAAI,CACf,MAAOA,EAAK,MACZ,KAAMA,EAAK,KACX,QAASA,EAAK,OAChB,EACOE,GAET,CAAC,CACH,EAEgB,WAAAH,CAAW,CAC7B,CAjFgBI,EAAAP,EAAA,cAyFT,IAAMQ,EAA4D,CACvE,YACA,UACA,2BACA,sBACF,EAEaC,EAA+D,CAC1E,YACA,2BACA,SACF,EAEaC,EAAkB,EAKzBC,EAAyCJ,EAAA,IACtCG,EADsC,0CAWlCE,EAAkCL,EAAA,CAC7CM,EACAC,IACG,CACH,IAAMC,EAA6BF,GAAS,2BACtCG,EAAyBF,EAC3BC,IAA6BD,CAAW,GAAG,iBAC3C,OAMJ,OAJyBE,GAErBL,EAAuC,CAG7C,EAd+C,mCAqBlCM,EAAmCV,EAC9CM,GAGEA,GAAS,mBAAmB,8BAAgCH,EAJhB,oCAanCQ,EAAgCX,EAC3CM,GAGEA,GAAS,mBAAmB,4BAA8BH,EAJjB","names":["buildSteps","config","stepDefinitions","stepsArray","step","index","acc","__name","reviewStepAllowedEmploymentStatus","disabledInviteButtonEmploymentStatus","DEFAULT_VERSION","getDefaultContractDetailsSchemaVersion","getContractDetailsSchemaVersion","options","countryCode","jsonSchemaVersionByCountry","countrySpecificVersion","getBasicInformationSchemaVersion","getBenefitOffersSchemaVersion"]}
@@ -1,2 +0,0 @@
1
- import{a as Zt,b as oe,c as ae,d as se,e as ce,f as le,g as ue,i as de,j as pe,k as me,l as fe,m as ye,n as _e,o as ge,p as be,q as Se,r as Ce,s as we,t as ve,u as he,v as Pe}from"./chunk-RATFUMTL.js";import{a as Ee,b as Fe,c as Ve}from"./chunk-YQQHCS4S.js";import{a as te,b as ee,f as ne,g as ie,h as re}from"./chunk-COAJUZSE.js";import{a as $,b as at,c as m,d as Xt,g as Yt}from"./chunk-PB6UQ4A4.js";import{a as $t}from"./chunk-PMRAJKJ5.js";import{f as Gt,h as Ht,i as Wt}from"./chunk-ZMQTQ4UQ.js";import{Q as Kt}from"./chunk-KWIWHDBS.js";import{a as Qt,b as w,d as Jt,h as _,i as k,u as M,v}from"./chunk-G2LZFGZA.js";import{a as zt}from"./chunk-JDIKYCN6.js";import{e as Ut}from"./chunk-H2O4CVKF.js";import{a as d}from"./chunk-P37U34EQ.js";import{useEffect as R,useMemo as a,useRef as Oe,useState as A}from"react";import De from"lodash.omit";import{useQuery as Fn}from"@tanstack/react-query";var Vn=d(()=>{let{client:T}=Ut(),{data:q}=oe(),u=ae(q)?q?.company?.id??"":"";return Fn({queryKey:["legal-entities",u],queryFn:d(()=>Kt({client:T,path:{company_id:u},query:{page_size:100}}),"queryFn"),select:d(z=>z.data?.data?.legal_entities,"select"),enabled:!!u})},"useLegalEntities"),Me=d(()=>{let{data:T}=Vn();return T?.find(q=>q.is_default)},"useDefaultLegalEntity");var Mn={select_country:null,basic_information:"employment_basic_information",contract_details:null,eligibility_questionnaire:null,pricing_plan:null,contract_preview:null,review:null},On={employment_basic_information:"basic_information"},oi=d(({countryCode:T,externalId:q,employmentId:u,skipSteps:z,options:f,initialValues:p})=>{let Ie=f?.excludeProducts||[],_t=Oe(f?.onContractReviewed);R(()=>{_t.current=f?.onContractReviewed},[f?.onContractReviewed]);let[l,gt]=A(T||null),[r,ke]=A(u),[g,bt]=A(void 0),X=Oe({select_country:{},basic_information:{},contract_details:{},contract_preview:{},pricing_plan:{},eligibility_questionnaire:{}}),[Y,Re]=A(void 0),[St,Z]=A(!1),[Ct,Ae]=A(!0),[st,wt]=A(null),{steps:qe,stepsArray:Te}=a(()=>te({includeSelectCountry:!z?.includes("select_country"),includeEligibilityQuestionnaire:St,includeContractPreview:Ct}),[St,Ct,z]),{fieldValues:c,stepState:e,setFieldValues:vt,previousStep:Le,nextStep:je,goToStep:L,setStepValues:ht}=zt(qe);R(()=>{st&&(L(st),wt(null))},[st,L]);let{data:o,isLoading:xe,refetch:Pt}=$t({employmentId:r,queryParams:{exclude_files:!0}}),Be=Me(),{data:Et}=Pe({options:{queryOptions:{enabled:e.currentStep.name==="review"}}}),{status:O}=o||{},h=O&&ne.includes(O),Ne=O&&!ie.includes(O),Qe=a(()=>O&&["invited","initiated"].includes(O)?"invited":"not_invited",[O]),Ft=Ht(),Vt=Wt(l,f),ct=pe(),Mt=Zt(),{mutateAsync:Ot}=ye(ct,Mt,c),Dt=Se(),It=Ce(),{mutateAsyncOrThrow:Je}=w(Vt),kt=ce(),Rt=de(),At=we(),{mutateAsyncOrThrow:Ue}=w(Ft),{mutateAsyncOrThrow:Ke}=w(ct),{mutateAsyncOrThrow:Ge}=w(kt),{mutateAsyncOrThrow:qt}=w(Rt),{mutateAsyncOrThrow:He}=w(Dt),{mutateAsyncOrThrow:Tt}=w(It),{mutateAsyncOrThrow:We}=w(At);u&&o?.country?.code&&!l&&gt(o.country.code);let{selectCountryForm:j,isLoading:$e,countries:Lt}=ve({jsfModify:f?.jsfModify?.select_country}),lt=a(()=>Lt?.find(t=>t.value===l),[Lt,l]),ze=a(()=>lt?.label,[lt]),Xe=e.currentStep.name==="pricing_plan"||!!u&&h,{form:P,isLoading:Ye,contractorSubscriptions:tt,filteredContractorSubscriptions:x,refetch:ut,isEligibilityQuestionnaireBlocked:B}=fe(r,lt,{jsonSchemaVersion:f?.jsonSchemaVersion,queryOptions:{enabled:Xe},excludeProducts:Ie,jsfModify:f?.jsfModify?.pricing_plan}),D=a(()=>!!tt?.find(t=>t.product.identifier===m)?.eligibility_questionnaire?.submitted_at,[tt]);R(()=>{if(D){Z(!1);return}else Z(Y===m)},[D,Y]),R(()=>{let t=o?.contractor_type==="cor";Ae(!t)},[o?.contractor_type]);let et=a(()=>tt?.find(t=>t.product.identifier===m)?.eligibility_questionnaire?.responses,[tt]),Ze=Mn[e.currentStep.name]||"contractor_basic_information",tn=On[Ze],en=o?.[tn]||{},nn=d(({form:t,options:i={},query:s={}})=>{let V=Object.keys(c).length>0?{...p,...e.values?.[e.currentStep.name],...c}:{...p,...en};return Gt({countryCode:l,form:t,fieldValues:V,query:s,options:{...i,queryOptions:{enabled:i.queryOptions?.enabled??!0}}})},"useJSONSchema"),rn=!!(l&&(e.currentStep.name==="basic_information"||u)),on=!!(l==="GBR"&&u&&e.currentStep.name==="basic_information"),{data:N,isLoading:an}=_e(u,{enabled:on}),{data:nt,isLoading:sn}=ge(r,{enabled:!!r});R(()=>{nt&&nt.length>0&&!g&&bt(nt[0].id)},[nt,g]);let{data:b,isLoading:cn}=nn({form:"contractor_basic_information",options:{jsfModify:Fe(l,ze,f),queryOptions:{enabled:rn}}}),ln=a(()=>ee(o?.basic_information?.provisional_start_date,c?.service_duration?.provisional_start_date),[o?.basic_information?.provisional_start_date,c?.service_duration?.provisional_start_date]),y=a(()=>{let t={standard:$,plus:at,cor:m};if(c.subscription)return c.subscription;let i=e.values?.pricing_plan?.subscription;if(i&&!B)return i;if(D&&!B)return m;if(B&&D)return $;if(x&&x.length>0)return t[o?.contractor_type]||$},[c,e.values,D,o?.contractor_type,B,x]);R(()=>{y&&y!==Y&&Re(y)},[y,Y]);let un=a(()=>({...et,...p,...e.values?.eligibility_questionnaire,...c}),[et,p,e.values?.eligibility_questionnaire,c]),dn=a(()=>y===m&&e.currentStep.name==="eligibility_questionnaire"||!!u&&h&&y===m,[y,e.currentStep.name,u,h]),{data:E,isLoading:pn}=be({options:{queryOptions:{enabled:dn},jsfModify:f?.jsfModify?.eligibility_questionnaire},fieldValues:un}),mn=!!(l&&e.currentStep.name==="contract_details"||h),{data:S,isLoading:fn}=he({countryCode:l,fieldValues:c,employmentId:r,options:{queryOptions:{enabled:mn},jsfModify:Ee(f?.jsfModify?.contract_details,ln,y,c,y===m)}}),yn=a(()=>e.currentStep.name==="contract_preview"||!!u&&h,[e.currentStep.name,u,h]),{data:F}=se({fieldValues:c,options:{queryOptions:{enabled:yn},jsfModify:Ve(f,c)}}),{data:dt,isLoading:_n,refetch:gn}=le({employmentId:r,contractDocumentId:g,options:{queryOptions:{enabled:!!g}}}),{hasCompanySignedContract:bn}=ue({employmentId:r,contractDocumentId:g,options:{queryOptions:{enabled:!!g}}}),n=a(()=>({select_country:j?.fields||[],basic_information:b?.fields||[],pricing_plan:P?.fields||[],eligibility_questionnaire:E?.fields||[],contract_details:S?.fields||[],contract_preview:F?.fields||[],review:[]}),[j?.fields,b?.fields,P?.fields,S?.fields,F?.fields,E?.fields]),Sn={select_country:null,basic_information:b?.meta["x-jsf-fieldsets"],pricing_plan:null,contract_details:S?.meta["x-jsf-fieldsets"],eligibility_questionnaire:null,contract_preview:null,review:null},Cn={select_country:j?.meta?.["x-jsf-presentation"],basic_information:b?.meta?.["x-jsf-presentation"],pricing_plan:P?.meta?.["x-jsf-presentation"],eligibility_questionnaire:E?.meta?.["x-jsf-presentation"],contract_details:S?.meta?.["x-jsf-presentation"],contract_preview:F?.meta?.["x-jsf-presentation"],review:null},{country:wn,basic_information:it={},contract_details:jt={}}=o||{},xt=wn?.code,Q=a(()=>k(n.select_country,{country:l||xt||""}),[n.select_country,l,xt]),pt=a(()=>N?.content?Jt(N.content,N.name):null,[N?.content,N?.name]),J=a(()=>{let t={...p,...it,ir35:o?.contract_details?.ir_35,nationality_status:o?.contract_details?.nationality,...pt&&{ir35_sds_file:[pt]}};return k(n.basic_information,t)},[p,it,o?.contract_details?.ir_35,o?.contract_details?.nationality,pt,n.basic_information]),U=a(()=>{let i={...{service_duration:{provisional_start_date:it.provisional_start_date}},...p,...jt};return k(n.contract_details,i)},[n.contract_details,jt,p,it]),K=a(()=>{let t=dt?.contract_document?.signatories?.find(s=>s.type==="company"),i={...p,signature:t?.signature};return k(n.contract_preview,i)},[n.contract_preview,p,dt]),G=a(()=>{let i={...{subscription:y},...p};return k(n.pricing_plan,i)},[n.pricing_plan,p,y]),H=a(()=>{let t={...p,...et};return k(n.eligibility_questionnaire,t)},[n.eligibility_questionnaire,p,et]),vn=a(()=>({select_country:Q,basic_information:J,contract_details:U,contract_preview:K,pricing_plan:G,eligibility_questionnaire:H}),[Q,J,U,K,G,H]),mt=!!(u&&h&&e.currentStep.name!=="review"),ft=$e||cn||xe||fn||Ye||_n||an||sn||pn,Bt=a(()=>{let i=o?.contractor_type==="cor"||n.contract_preview.length>0;return!!(mt&&!ft&&g&&n.basic_information.length>0&&n.contract_details.length>0&&i)},[mt,ft,g,n.basic_information.length,n.contract_details.length,n.contract_preview.length,o?.contractor_type]);R(()=>{Bt&&(X.current={select_country:M(Q,n.select_country,{skipMoneyConversion:!0}),basic_information:M(J,n.basic_information,{skipMoneyConversion:!0}),contract_details:M(U,n.contract_details,{skipMoneyConversion:!0}),contract_preview:M(K,n.contract_preview,{skipMoneyConversion:!0}),pricing_plan:M(G,n.pricing_plan,{skipMoneyConversion:!0}),eligibility_questionnaire:M(H,n.eligibility_questionnaire,{skipMoneyConversion:!0})},ht({select_country:Q,basic_information:J,contract_details:U,contract_preview:K,pricing_plan:G,eligibility_questionnaire:H,review:{}}),L("review"))},[Bt,L,Q,J,U,ht,n.select_country,n.basic_information,n.contract_details,n.pricing_plan,G,n.contract_preview,K,n.eligibility_questionnaire,H]);let hn=d(t=>{L(t)},"goTo"),Nt=d(async t=>j&&e.currentStep.name==="select_country"?t:b&&e.currentStep.name==="basic_information"?await _(t,b?.fields,{isPartialValidation:!1}):S&&e.currentStep.name==="contract_details"?await _(t,S?.fields,{isPartialValidation:!1}):F&&e.currentStep.name==="contract_preview"?await _(t,F?.fields,{isPartialValidation:!1}):P&&e.currentStep.name==="pricing_plan"?await _(t,P?.fields,{isPartialValidation:!1}):E&&e.currentStep.name==="eligibility_questionnaire"?await _(t,E?.fields,{isPartialValidation:!1}):{},"parseFormValues"),Pn=d(t=>{if(!Qt(t))return null;let i=t.normalizedErrors.services_and_deliverables,s=Array.isArray(i)?i[0]:i;return s?.source===Yt?{error:s.error,source:s.source,skippable:s.skippable}:null},"extractAiValidationError");async function En(t){let i=e.currentStep.name,s=await Nt(t);switch(i in X.current&&(X.current[i]=M(s,n[i])),e.currentStep.name){case"select_country":return gt(s.country),Promise.resolve({data:{countryCode:s.country}});case"basic_information":{let I=!r&&l,V=r&&l&&o?.country&&o?.country.code!==l;if(I||V){let yt={basic_information:De(s,"nationality_status","ir35","ir35_sds_file"),type:"contractor",country_code:l,external_id:q},ot=await Ue(yt),C=ot?.data?.employment?.id;if(!C)throw v("Employment ID not found");return await Ot({employmentId:C}),ke(C),ot}else if(r){let rt=De(s,"nationality_status","ir35","ir35_sds_file");return await Ot({employmentId:r}),Je({employmentId:r,basic_information:rt})}return}case"contract_details":{let{services_and_deliverables_ai_warning:I,services_and_deliverables_error_skippable:V,...rt}=s,yt=c.services_and_deliverables_error_skippable===!0,ot={contract_document:rt,skip_ai_checks:yt};try{let C=await Ke({employmentId:r,payload:ot}),W=C?.data?.contract_document?.id;if(!W)throw v("Contract document ID not found");return bt(W),C}catch(C){let W=Pn(C);throw W&&vt({...t,services_and_deliverables_ai_warning:re(y===m),services_and_deliverables_error_skippable:W.skippable}),C}}case"contract_preview":{if(bn)return Promise.resolve({data:{contract_document:{id:g}}});let I=await Ge({employmentId:r,contractDocumentId:g,payload:{signature:s.signature}});return await gn(),I}case"pricing_plan":{if(t.subscription===Xt)return Promise.resolve({data:{subscription:t.subscription}});if(x.length===0)throw v("No available subscriptions.");if(!t.subscription&&x.length>0)throw v("Please select a subscription plan.");if(B&&[m,at].includes(t.subscription))throw v(`This individual is not eligible for ${me[t.subscription]}.`);if(D&&t.subscription!==m)try{await We({employmentId:r}),await ut()}catch(V){if(V?.response?.status!==404)throw V;await ut()}if(t.subscription==$)return qt({employmentId:r,payload:{operation:"downgrade"}});if(t.subscription==at)return qt({employmentId:r,payload:{operation:"upgrade"}});if(t.subscription==m)return D&&o?.contractor_type!=="cor"?Tt({employmentId:r}):Promise.resolve({data:{subscription:t.subscription}});throw v("invalid selection")}case"eligibility_questionnaire":try{if((await He({employmentId:r,payload:s}))?.data?.is_blocking)throw Z(!1),wt("pricing_plan"),v("This individual is not eligible for Contractor of Record.");return await Tt({employmentId:r})}finally{await ut()}default:throw v("Invalid step state")}}return d(En,"onSubmit"),{isLoading:ft||mt,fieldValues:c,stepState:e,checkFieldUpdates:vt,markContractAsReviewed:d(()=>{_t.current?.()},"markContractAsReviewed"),back:Le,next:d(()=>{r&&Pt(),je()},"handleNextStep"),goTo:hn,onSubmit:En,fields:n[e.currentStep.name],meta:{fields:X.current,fieldsets:Sn[e.currentStep.name],presentation:Cn[e.currentStep.name]},parseFormValues:Nt,canSkipAiValidation:c.services_and_deliverables_error_skippable===!0,handleValidation:d(async t=>{if(e.currentStep.name==="select_country")return j.handleValidation(t);if(b&&e.currentStep.name==="basic_information"){let i=await _(t,b?.fields,{isPartialValidation:!1});return b?.handleValidation(i)}if(S&&e.currentStep.name==="contract_details"){let i=await _(t,S?.fields,{isPartialValidation:!1});return S?.handleValidation(i)}if(F&&e.currentStep.name==="contract_preview"){let i=await _(t,F?.fields,{isPartialValidation:!0});return F?.handleValidation(i)}if(P&&e.currentStep.name==="pricing_plan"){let i=await _(t,P?.fields,{isPartialValidation:!1});return P?.handleValidation(i)}if(E&&e.currentStep.name==="eligibility_questionnaire"){let i=await _(t,E?.fields,{isPartialValidation:!1});return E?.handleValidation(i)}return null},"handleValidation"),initialValues:vn,employmentId:r,refetchEmployment:Pt,isSubmitting:Ft.isPending||Vt.isPending||ct.isPending||kt.isPending||Rt.isPending||Mt.isPending||Dt.isPending||It.isPending||At.isPending,documentPreviewPdf:dt,canInvite:Ne,isEmploymentReadOnly:h,invitedStatus:Qe,employment:o,defaultLegalEntity:Be,needsCompanyVerification:Et?.some(t=>t.type==="verify_company")??!1,needsRemotePaymentsSetup:Et?.some(t=>t.type==="setup_remote_payments")??!1,steps:Te}},"useContractorOnboarding");export{oi as a};
2
- //# sourceMappingURL=chunk-UAMKMIHP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/ContractorOnboarding/hooks.tsx","../src/common/api/legal-entities.ts"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\nimport { FieldValues } from 'react-hook-form';\nimport omit from 'lodash.omit';\nimport { $TSFixMe, JSFFields } from '@/src/types/remoteFlows';\nimport {\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 useCreateContractorContractDocument,\n useGetContractDocumentSignatureSchema,\n usePostManageContractorSubscriptions,\n useContractorSubscriptionSchemaField,\n useGetShowContractDocument,\n useSignContractDocument,\n useUpdateUKandSaudiFields,\n useGetIR35File,\n useGetContractDocuments,\n useGetEligibilityQuestionnaire,\n usePostCreateEligibilityQuestionnaire,\n usePostManageContractorCorSubscription,\n useDeleteContractorCorSubscription,\n useCountriesSchemaField,\n useContractorOnboardingDetailsSchemaWithCurrencies,\n CONTRACT_PRODUCT_TITLES,\n useHasCompanySignedContract,\n useCompanyOpenTasks,\n} from '@/src/flows/ContractorOnboarding/api';\nimport {\n ContractorOnboardingFlowProps,\n ContractorOnboardingHookOptions,\n} from '@/src/flows/ContractorOnboarding/types';\nimport {\n buildSteps,\n calculateProvisionalStartDateDescription,\n reviewStepAllowedEmploymentStatus,\n disabledInviteButtonEmploymentStatus,\n StepKeys,\n} from '@/src/flows/ContractorOnboarding/utils';\nimport {\n useCreateEmployment,\n useJSONSchemaForm,\n useUpdateEmployment,\n} from '@/src/flows/Onboarding/api';\nimport { FlowOptions, JSFModify, JSONSchemaFormType } from '@/src/flows/types';\nimport { useStepState } from '@/src/flows/useStepState';\nimport { mutationToPromise, isMutationError } from '@/src/lib/mutations';\nimport { createStructuredError, prettifyFormValues } from '@/src/lib/utils';\nimport { JSFFieldset, Meta } from '@/src/types/remoteFlows';\nimport {\n contractorStandardProductIdentifier,\n contractorPlusProductIdentifier,\n corProductIdentifier,\n eorProductIdentifier,\n REMOTE_AI_ERROR_SOURCE,\n} from '@/src/flows/ContractorOnboarding/constants';\nimport {\n buildBasicInformationJsfModify,\n buildContractDetailsJsfModify,\n buildContractPreviewJsfModify,\n} from '@/src/flows/ContractorOnboarding/jsfModify';\nimport { transformAiErrorResponse } from '@/src/flows/ContractorOnboarding/utils';\nimport { AiValidationError } from '@/src/flows/ContractorOnboarding/types';\nimport { useUploadFile } from '@/src/common/api/files';\nimport { dataURLtoFile } from '@/src/lib/files';\nimport { useEmploymentQuery } from '@/src/common/api/employment';\nimport { useDefaultLegalEntity } from '@/src/common/api/legal-entities';\n\ntype useContractorOnboardingProps = Omit<\n ContractorOnboardingFlowProps,\n 'render' | 'options'\n> & {\n options: ContractorOnboardingHookOptions;\n};\n\nconst stepToFormSchemaMap: Record<StepKeys, JSONSchemaFormType | null> = {\n select_country: null,\n basic_information: 'employment_basic_information',\n contract_details: null,\n eligibility_questionnaire: 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 excludeProducts = options?.excludeProducts || [];\n\n const onContractReviewedRef = useRef(options?.onContractReviewed);\n\n useEffect(() => {\n onContractReviewedRef.current = options?.onContractReviewed;\n }, [options?.onContractReviewed]);\n\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 eligibility_questionnaire: Meta;\n }>({\n select_country: {},\n basic_information: {},\n contract_details: {},\n contract_preview: {},\n pricing_plan: {},\n eligibility_questionnaire: {},\n });\n\n const [selectedProduct, setSelectedProduct] = useState<string | undefined>(\n undefined,\n );\n\n const [includeEligibilityQuestionnaire, setIncludeEligibilityQuestionnaire] =\n useState<boolean>(false);\n\n const [includeContractPreview, setIncludeContractPreview] =\n useState<boolean>(true);\n\n const [pendingNavigationStep, setPendingNavigationStep] =\n useState<StepKeys | null>(null);\n\n const { steps, stepsArray } = useMemo(\n () =>\n buildSteps({\n includeSelectCountry: !skipSteps?.includes('select_country'),\n includeEligibilityQuestionnaire: includeEligibilityQuestionnaire,\n includeContractPreview: includeContractPreview,\n }),\n [includeEligibilityQuestionnaire, includeContractPreview, skipSteps],\n );\n\n const {\n fieldValues,\n stepState,\n setFieldValues,\n previousStep,\n nextStep,\n goToStep,\n setStepValues,\n } = useStepState(steps);\n\n useEffect(() => {\n if (pendingNavigationStep) {\n // Now steps have been updated\n goToStep(pendingNavigationStep);\n setPendingNavigationStep(null);\n }\n }, [pendingNavigationStep, goToStep]);\n\n const {\n data: employment,\n isLoading: isLoadingEmployment,\n refetch: refetchEmployment,\n } = useEmploymentQuery({\n employmentId: internalEmploymentId as string,\n queryParams: { exclude_files: true },\n });\n\n const defaultLegalEntity = useDefaultLegalEntity();\n\n const { data: openTasks } = useCompanyOpenTasks({\n options: {\n queryOptions: {\n enabled: stepState.currentStep.name === 'review',\n },\n },\n });\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 invitedStatuses = ['invited', 'initiated'];\n const isInvited =\n employmentStatus && invitedStatuses.includes(employmentStatus);\n\n return isInvited ? 'invited' : 'not_invited';\n }, [employmentStatus]);\n\n const createEmploymentMutation = useCreateEmployment();\n const updateEmploymentMutation = useUpdateEmployment(\n internalCountryCode as string,\n options,\n );\n const createContractorContractDocumentMutation =\n useCreateContractorContractDocument();\n const uploadFileMutation = useUploadFile();\n const { mutateAsync: updateUKandSaudiFieldsMutation } =\n useUpdateUKandSaudiFields(\n createContractorContractDocumentMutation,\n uploadFileMutation,\n fieldValues,\n );\n const createEligibilityQuestionnaireMutation =\n usePostCreateEligibilityQuestionnaire();\n const manageContractorCorSubscriptionMutation =\n usePostManageContractorCorSubscription();\n\n const { mutateAsyncOrThrow: updateEmploymentMutationAsync } =\n mutationToPromise(updateEmploymentMutation);\n const signContractDocumentMutation = useSignContractDocument();\n const manageContractorSubscriptionMutation =\n usePostManageContractorSubscriptions();\n const deleteContractorCorSubscriptionMutation =\n useDeleteContractorCorSubscription();\n\n const { mutateAsyncOrThrow: createEmploymentMutationAsync } =\n mutationToPromise(createEmploymentMutation);\n\n const { mutateAsyncOrThrow: createContractorContractDocumentMutationAsync } =\n mutationToPromise(createContractorContractDocumentMutation);\n\n const { mutateAsyncOrThrow: signContractDocumentMutationAsync } =\n mutationToPromise(signContractDocumentMutation);\n\n const { mutateAsyncOrThrow: manageContractorSubscriptionMutationAsync } =\n mutationToPromise(manageContractorSubscriptionMutation);\n\n const { mutateAsyncOrThrow: createEligibilityQuestionnaireMutationAsync } =\n mutationToPromise(createEligibilityQuestionnaireMutation);\n\n const { mutateAsyncOrThrow: manageContractorCorSubscriptionMutationAsync } =\n mutationToPromise(manageContractorCorSubscriptionMutation);\n\n const { mutateAsyncOrThrow: deleteContractorCorSubscriptionMutationAsync } =\n mutationToPromise(deleteContractorCorSubscriptionMutation);\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 {\n selectCountryForm,\n isLoading: isLoadingCountries,\n countries,\n } = useCountriesSchemaField({\n jsfModify: options?.jsfModify?.select_country,\n });\n\n const selectedCountry = useMemo(() => {\n return countries?.find((country) => country.value === internalCountryCode);\n }, [countries, internalCountryCode]);\n\n const countryName = useMemo(() => {\n return selectedCountry?.label;\n }, [selectedCountry]);\n\n const isPricingPlanEnabled =\n stepState.currentStep.name === 'pricing_plan' ||\n (Boolean(employmentId) && isEmploymentReadOnly);\n\n const {\n form: selectContractorSubscriptionForm,\n isLoading: isLoadingContractorSubscriptions,\n contractorSubscriptions,\n filteredContractorSubscriptions,\n refetch: refetchContractorSubscriptions,\n isEligibilityQuestionnaireBlocked,\n } = useContractorSubscriptionSchemaField(\n internalEmploymentId as string,\n selectedCountry,\n {\n jsonSchemaVersion: options?.jsonSchemaVersion,\n queryOptions: {\n enabled: isPricingPlanEnabled,\n },\n excludeProducts: excludeProducts,\n jsfModify: options?.jsfModify?.pricing_plan,\n },\n );\n\n const hasEligibilityQuestionnaireSubmitted = useMemo(() => {\n return Boolean(\n contractorSubscriptions?.find(\n (subscription) =>\n subscription.product.identifier === corProductIdentifier,\n )?.eligibility_questionnaire?.submitted_at,\n );\n }, [contractorSubscriptions]);\n\n useEffect(() => {\n if (hasEligibilityQuestionnaireSubmitted) {\n setIncludeEligibilityQuestionnaire(false);\n return;\n } else if (selectedProduct === corProductIdentifier) {\n setIncludeEligibilityQuestionnaire(true);\n } else {\n setIncludeEligibilityQuestionnaire(false);\n }\n }, [hasEligibilityQuestionnaireSubmitted, selectedProduct]);\n\n useEffect(() => {\n const isCor = employment?.contractor_type === 'cor';\n setIncludeContractPreview(!isCor);\n }, [employment?.contractor_type]);\n\n const eligibilityAnswers = useMemo(() => {\n return contractorSubscriptions?.find(\n (subscription) =>\n subscription.product.identifier === corProductIdentifier,\n )?.eligibility_questionnaire?.responses;\n }, [contractorSubscriptions]);\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 isIR35FileEnabled = Boolean(\n internalCountryCode === 'GBR' &&\n employmentId &&\n stepState.currentStep.name === 'basic_information',\n );\n\n const { data: ir35File, isLoading: isLoadingIR35File } = useGetIR35File(\n employmentId as string,\n {\n enabled: isIR35FileEnabled,\n },\n );\n\n const { data: contractDocuments, isLoading: isLoadingContractDocuments } =\n useGetContractDocuments(internalEmploymentId as string, {\n enabled: Boolean(internalEmploymentId),\n });\n\n useEffect(() => {\n if (\n contractDocuments &&\n contractDocuments.length > 0 &&\n !internalContractDocumentId\n ) {\n setInternalContractDocumentId(contractDocuments[0].id);\n }\n }, [contractDocuments, internalContractDocumentId]);\n\n const {\n data: basicInformationForm,\n isLoading: isLoadingBasicInformationForm,\n } = useJSONSchema({\n form: 'contractor_basic_information',\n options: {\n jsfModify: buildBasicInformationJsfModify(\n internalCountryCode as string,\n countryName,\n options,\n ),\n queryOptions: {\n enabled: isBasicInformationDetailsEnabled,\n },\n },\n });\n\n const descriptionProvisionalStartDate = useMemo(() => {\n return calculateProvisionalStartDateDescription(\n employment?.basic_information?.provisional_start_date as string,\n fieldValues?.service_duration?.provisional_start_date as string,\n );\n }, [\n employment?.basic_information?.provisional_start_date,\n fieldValues?.service_duration?.provisional_start_date,\n ]);\n\n /**\n * When the user selects COR, the data isn't saved yet in the BE\n * We need to use the internalState to know what has happened\n */\n const selectedPricingPlan = useMemo(() => {\n const subscriptions = {\n standard: contractorStandardProductIdentifier,\n plus: contractorPlusProductIdentifier,\n cor: corProductIdentifier,\n };\n\n // HIGHEST PRIORITY: Current form value (user is actively selecting)\n if (fieldValues.subscription) {\n return fieldValues.subscription;\n }\n\n // SECOND: Previously submitted value in this session\n const subscription = stepState.values?.pricing_plan?.subscription;\n if (subscription && !isEligibilityQuestionnaireBlocked) {\n return subscription;\n }\n\n // THIRD: Backend state (eligibility submitted or employment contractor_type)\n if (\n hasEligibilityQuestionnaireSubmitted &&\n !isEligibilityQuestionnaireBlocked\n ) {\n return corProductIdentifier;\n }\n\n // Fourth: If the eligibility questionnaire is blocked and has been submitted, return the standard product\n if (\n isEligibilityQuestionnaireBlocked &&\n hasEligibilityQuestionnaireSubmitted\n ) {\n return contractorStandardProductIdentifier;\n }\n\n // Fifth: If there are no available subscriptions, return undefined\n const hasAvailableSubscriptions =\n filteredContractorSubscriptions &&\n filteredContractorSubscriptions.length > 0;\n\n if (!hasAvailableSubscriptions) {\n return undefined;\n }\n\n // FALLBACK: Employment contractor_type or default\n return (\n subscriptions[\n employment?.contractor_type as keyof typeof subscriptions\n ] || contractorStandardProductIdentifier\n );\n }, [\n fieldValues,\n stepState.values,\n hasEligibilityQuestionnaireSubmitted,\n employment?.contractor_type,\n isEligibilityQuestionnaireBlocked,\n filteredContractorSubscriptions,\n ]);\n\n useEffect(() => {\n if (selectedPricingPlan && selectedPricingPlan !== selectedProduct) {\n setSelectedProduct(selectedPricingPlan);\n }\n }, [selectedPricingPlan, selectedProduct]);\n\n const eligibilityFields = useMemo(() => {\n return {\n ...eligibilityAnswers,\n ...onboardingInitialValues,\n ...stepState.values?.eligibility_questionnaire,\n ...fieldValues,\n };\n }, [\n eligibilityAnswers,\n onboardingInitialValues,\n stepState.values?.eligibility_questionnaire,\n fieldValues,\n ]);\n\n const isEligibilityQuestionnaireEnabled = useMemo(() => {\n return (\n (selectedPricingPlan === corProductIdentifier &&\n stepState.currentStep.name === 'eligibility_questionnaire') ||\n (Boolean(employmentId) &&\n isEmploymentReadOnly &&\n selectedPricingPlan === corProductIdentifier)\n );\n }, [\n selectedPricingPlan,\n stepState.currentStep.name,\n employmentId,\n isEmploymentReadOnly,\n ]);\n\n const {\n data: eligibilityQuestionnaireForm,\n isLoading: isLoadingEligibilityQuestionnaire,\n } = useGetEligibilityQuestionnaire({\n options: {\n queryOptions: {\n enabled: isEligibilityQuestionnaireEnabled,\n },\n jsfModify: options?.jsfModify?.eligibility_questionnaire,\n },\n fieldValues: eligibilityFields,\n });\n\n const isContractorOnboardingDetailsEnabled = Boolean(\n (internalCountryCode &&\n stepState.currentStep.name === 'contract_details') ||\n isEmploymentReadOnly,\n );\n\n const {\n data: contractorOnboardingDetailsForm,\n isLoading: isLoadingContractorOnboardingDetailsForm,\n } = useContractorOnboardingDetailsSchemaWithCurrencies({\n countryCode: internalCountryCode as string,\n fieldValues: fieldValues,\n employmentId: internalEmploymentId as string,\n options: {\n queryOptions: {\n enabled: isContractorOnboardingDetailsEnabled,\n },\n jsfModify: buildContractDetailsJsfModify(\n options?.jsfModify?.contract_details,\n descriptionProvisionalStartDate,\n selectedPricingPlan,\n fieldValues,\n selectedPricingPlan === corProductIdentifier,\n ),\n },\n });\n\n const isSignatureSchemaEnabled = useMemo(() => {\n return (\n stepState.currentStep.name === 'contract_preview' ||\n (Boolean(employmentId) && isEmploymentReadOnly)\n );\n }, [stepState.currentStep.name, employmentId, isEmploymentReadOnly]);\n\n const { data: signatureSchemaForm } = useGetContractDocumentSignatureSchema({\n fieldValues: fieldValues,\n options: {\n queryOptions: {\n enabled: isSignatureSchemaEnabled,\n },\n jsfModify: buildContractPreviewJsfModify(options, fieldValues),\n },\n });\n\n const {\n data: documentPreviewPdf,\n isLoading: isLoadingDocumentPreviewForm,\n refetch: refetchDocumentPreviewForm,\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 { hasCompanySignedContract } = useHasCompanySignedContract({\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<StepKeys, JSFFields> = useMemo(\n () => ({\n select_country: selectCountryForm?.fields || [],\n basic_information: basicInformationForm?.fields || [],\n pricing_plan: selectContractorSubscriptionForm?.fields || [],\n eligibility_questionnaire: eligibilityQuestionnaireForm?.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 eligibilityQuestionnaireForm?.fields,\n ],\n );\n\n const stepFieldsWithFlatFieldsets: Record<\n StepKeys,\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 eligibility_questionnaire: null,\n contract_preview: null,\n review: null,\n };\n\n const stepPresentation: Record<\n StepKeys,\n Record<string, unknown> | null | undefined\n > = {\n select_country: selectCountryForm?.meta?.['x-jsf-presentation'],\n basic_information: basicInformationForm?.meta?.['x-jsf-presentation'],\n pricing_plan:\n selectContractorSubscriptionForm?.meta?.['x-jsf-presentation'],\n eligibility_questionnaire:\n eligibilityQuestionnaireForm?.meta?.['x-jsf-presentation'],\n contract_details:\n contractorOnboardingDetailsForm?.meta?.['x-jsf-presentation'],\n contract_preview: signatureSchemaForm?.meta?.['x-jsf-presentation'],\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 // memoize file conversion to avoid re-converting the file on every render\n // noticed performance issues when not doing memoizing individually\n const convertedIr35File = useMemo(() => {\n if (!ir35File?.content) return null;\n return dataURLtoFile(ir35File.content as unknown as string, ir35File.name);\n }, [ir35File?.content, ir35File?.name]);\n\n const basicInformationInitialValues = useMemo(() => {\n const initialValues = {\n ...onboardingInitialValues,\n ...employmentBasicInformation,\n ir35: employment?.contract_details?.ir_35,\n nationality_status: employment?.contract_details?.nationality,\n ...(convertedIr35File && {\n ir35_sds_file: [convertedIr35File],\n }),\n };\n\n return getInitialValues(stepFields.basic_information, initialValues);\n }, [\n onboardingInitialValues,\n employmentBasicInformation,\n employment?.contract_details?.ir_35,\n employment?.contract_details?.nationality,\n convertedIr35File,\n stepFields.basic_information,\n ]);\n\n const contractDetailsInitialValues = useMemo(() => {\n const hardcodedValues = {\n service_duration: {\n provisional_start_date:\n employmentBasicInformation.provisional_start_date,\n },\n };\n const initialValues = {\n ...hardcodedValues,\n ...onboardingInitialValues,\n ...employmentContractDetails,\n };\n\n return getInitialValues(stepFields.contract_details, initialValues);\n }, [\n stepFields.contract_details,\n employmentContractDetails,\n onboardingInitialValues,\n employmentBasicInformation,\n ]);\n\n const contractPreviewInitialValues = useMemo(() => {\n const signature = documentPreviewPdf?.contract_document?.signatories?.find(\n (signatory) => signatory.type === 'company',\n );\n const initialValues = {\n ...onboardingInitialValues,\n signature: signature?.signature,\n };\n\n return getInitialValues(stepFields.contract_preview, initialValues);\n }, [\n stepFields.contract_preview,\n onboardingInitialValues,\n documentPreviewPdf,\n ]);\n\n const pricingPlanInitialValues = useMemo(() => {\n const preselectedPricingPlan = {\n subscription: selectedPricingPlan,\n };\n const initialValues = {\n ...preselectedPricingPlan,\n ...onboardingInitialValues,\n };\n\n return getInitialValues(stepFields.pricing_plan, initialValues);\n }, [stepFields.pricing_plan, onboardingInitialValues, selectedPricingPlan]);\n\n const eligibilityQuestionnaireInitialValues = useMemo(() => {\n const initialValues = {\n ...onboardingInitialValues,\n ...eligibilityAnswers,\n };\n return getInitialValues(\n stepFields.eligibility_questionnaire,\n initialValues,\n );\n }, [\n stepFields.eligibility_questionnaire,\n onboardingInitialValues,\n eligibilityAnswers,\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 eligibility_questionnaire: eligibilityQuestionnaireInitialValues,\n };\n }, [\n selectCountryInitialValues,\n basicInformationInitialValues,\n contractDetailsInitialValues,\n contractPreviewInitialValues,\n pricingPlanInitialValues,\n eligibilityQuestionnaireInitialValues,\n ]);\n\n const shouldHandleReadOnlyEmployment = Boolean(\n employmentId &&\n isEmploymentReadOnly &&\n stepState.currentStep.name !== 'review',\n );\n\n const initialLoading =\n isLoadingCountries ||\n isLoadingBasicInformationForm ||\n isLoadingEmployment ||\n isLoadingContractorOnboardingDetailsForm ||\n isLoadingContractorSubscriptions ||\n isLoadingDocumentPreviewForm ||\n isLoadingIR35File ||\n isLoadingContractDocuments ||\n isLoadingEligibilityQuestionnaire;\n\n const isNavigatingToReview = useMemo(() => {\n const isCor = employment?.contractor_type === 'cor';\n const hasContractPreviewFields =\n isCor || stepFields.contract_preview.length > 0;\n\n return Boolean(\n shouldHandleReadOnlyEmployment &&\n !initialLoading &&\n Boolean(internalContractDocumentId) &&\n stepFields.basic_information.length > 0 &&\n stepFields.contract_details.length > 0 &&\n hasContractPreviewFields,\n );\n }, [\n shouldHandleReadOnlyEmployment,\n initialLoading,\n internalContractDocumentId,\n stepFields.basic_information.length,\n stepFields.contract_details.length,\n stepFields.contract_preview.length,\n employment?.contractor_type,\n ]);\n\n useEffect(() => {\n if (isNavigatingToReview) {\n fieldsMetaRef.current = {\n select_country: prettifyFormValues(\n selectCountryInitialValues,\n stepFields.select_country,\n { skipMoneyConversion: true },\n ),\n basic_information: prettifyFormValues(\n basicInformationInitialValues,\n stepFields.basic_information,\n { skipMoneyConversion: true },\n ),\n contract_details: prettifyFormValues(\n contractDetailsInitialValues,\n stepFields.contract_details,\n { skipMoneyConversion: true },\n ),\n contract_preview: prettifyFormValues(\n contractPreviewInitialValues,\n stepFields.contract_preview,\n { skipMoneyConversion: true },\n ),\n pricing_plan: prettifyFormValues(\n pricingPlanInitialValues,\n stepFields.pricing_plan,\n { skipMoneyConversion: true },\n ),\n eligibility_questionnaire: prettifyFormValues(\n eligibilityQuestionnaireInitialValues,\n stepFields.eligibility_questionnaire,\n { skipMoneyConversion: true },\n ),\n };\n\n setStepValues({\n select_country: selectCountryInitialValues,\n basic_information: basicInformationInitialValues,\n contract_details: contractDetailsInitialValues,\n contract_preview: contractPreviewInitialValues,\n pricing_plan: pricingPlanInitialValues,\n eligibility_questionnaire: eligibilityQuestionnaireInitialValues,\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 stepFields.pricing_plan,\n pricingPlanInitialValues,\n stepFields.contract_preview,\n contractPreviewInitialValues,\n stepFields.eligibility_questionnaire,\n eligibilityQuestionnaireInitialValues,\n ]);\n\n const goTo = (step: StepKeys) => {\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 (\n selectContractorSubscriptionForm &&\n stepState.currentStep.name === 'pricing_plan'\n ) {\n return await parseJSFToValidate(\n values,\n selectContractorSubscriptionForm?.fields,\n {\n isPartialValidation: false,\n },\n );\n }\n\n if (\n eligibilityQuestionnaireForm &&\n stepState.currentStep.name === 'eligibility_questionnaire'\n ) {\n return await parseJSFToValidate(\n values,\n eligibilityQuestionnaireForm?.fields,\n {\n isPartialValidation: false,\n },\n );\n }\n\n return {};\n };\n\n /**\n * Extracts AI validation error from the error response\n * @param error - The error object from the API call\n * @returns The AI validation error if found, null otherwise\n */\n const extractAiValidationError = (\n error: unknown,\n ): AiValidationError | null => {\n if (!isMutationError(error)) {\n return null;\n }\n\n const rawError = error.normalizedErrors.services_and_deliverables;\n\n // The backend's normalize_errors wraps non-list values in an array,\n // so the AI validation error object arrives as a single-element array.\n const servicesAndDeliverablesError = (\n Array.isArray(rawError) ? rawError[0] : rawError\n ) as\n | {\n error: string[];\n source: string;\n skippable: boolean;\n }\n | undefined;\n\n if (servicesAndDeliverablesError?.source === REMOTE_AI_ERROR_SOURCE) {\n return {\n error: servicesAndDeliverablesError.error,\n source: servicesAndDeliverablesError.source,\n skippable: servicesAndDeliverablesError.skippable,\n };\n }\n return null;\n };\n\n async function onSubmit(values: FieldValues) {\n const currentStepName = stepState.currentStep.name;\n const parsedValues = await parseFormValues(values);\n\n if (currentStepName in fieldsMetaRef.current) {\n fieldsMetaRef.current[\n currentStepName as keyof typeof fieldsMetaRef.current\n ] = prettifyFormValues(parsedValues, stepFields[currentStepName]);\n }\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 basicInformationParsedValues = omit(\n parsedValues,\n 'nationality_status',\n 'ir35',\n 'ir35_sds_file',\n );\n const basicInformationPayload: EmploymentCreateParams = {\n basic_information: basicInformationParsedValues,\n type: 'contractor',\n country_code: internalCountryCode,\n external_id: externalId,\n };\n const response = await createEmploymentMutationAsync(\n basicInformationPayload,\n );\n const employmentId = response?.data?.employment?.id;\n if (!employmentId) {\n throw createStructuredError('Employment ID not found');\n }\n\n await updateUKandSaudiFieldsMutation({\n employmentId: employmentId as string,\n });\n\n // Only update state (triggers queries with fully consistent backend state) if not caused a bug\n // if one of the updateUKandSaudiFieldsMutation fails with a 422 for example\n setInternalEmploymentId(employmentId);\n\n return response;\n } else if (internalEmploymentId) {\n const basicInformationParsedValues = omit(\n parsedValues,\n 'nationality_status',\n 'ir35',\n 'ir35_sds_file',\n );\n\n await updateUKandSaudiFieldsMutation({\n employmentId: internalEmploymentId,\n });\n return updateEmploymentMutationAsync({\n employmentId: internalEmploymentId,\n basic_information: basicInformationParsedValues,\n });\n }\n\n return;\n }\n case 'contract_details': {\n const {\n services_and_deliverables_ai_warning:\n _servicesAndDeliverablesAiWarning,\n services_and_deliverables_error_skippable:\n _servicesAndDeliverablesErrorSkippable,\n ...contractDetailsData\n } = parsedValues;\n\n const shouldSkipAiChecks =\n fieldValues.services_and_deliverables_error_skippable === true;\n const payload: CreateContractDocument = {\n contract_document: contractDetailsData,\n skip_ai_checks: shouldSkipAiChecks,\n };\n\n try {\n const response = await createContractorContractDocumentMutationAsync({\n employmentId: internalEmploymentId as string,\n payload,\n });\n const contractDocumentId = response?.data?.contract_document?.id;\n if (!contractDocumentId) {\n throw createStructuredError('Contract document ID not found');\n }\n setInternalContractDocumentId(contractDocumentId);\n\n return response;\n } catch (error) {\n const aiError = extractAiValidationError(error);\n if (aiError) {\n const isContractorOfRecord =\n selectedPricingPlan === corProductIdentifier;\n setFieldValues({\n ...values,\n services_and_deliverables_ai_warning:\n transformAiErrorResponse(isContractorOfRecord),\n services_and_deliverables_error_skippable: aiError.skippable,\n });\n }\n\n throw error;\n }\n }\n\n case 'contract_preview': {\n if (hasCompanySignedContract) {\n return Promise.resolve({\n data: {\n contract_document: {\n id: internalContractDocumentId,\n },\n },\n });\n }\n const response = await signContractDocumentMutationAsync({\n employmentId: internalEmploymentId as string,\n contractDocumentId: internalContractDocumentId as string,\n payload: {\n signature: parsedValues.signature,\n },\n });\n await refetchDocumentPreviewForm();\n return response;\n }\n case 'pricing_plan': {\n if (values.subscription === eorProductIdentifier) {\n // EOR selection - no API call needed at this step\n return Promise.resolve({\n data: {\n subscription: values.subscription,\n },\n });\n }\n // If there are no available contractor subscriptions, throw an error\n if (filteredContractorSubscriptions.length === 0) {\n throw createStructuredError('No available subscriptions.');\n }\n\n if (\n !values.subscription &&\n filteredContractorSubscriptions.length > 0\n ) {\n throw createStructuredError('Please select a subscription plan.');\n }\n\n const blockedProductsEligibility = [\n corProductIdentifier,\n contractorPlusProductIdentifier,\n ];\n\n if (\n isEligibilityQuestionnaireBlocked &&\n blockedProductsEligibility.includes(values.subscription)\n ) {\n throw createStructuredError(\n `This individual is not eligible for ${\n CONTRACT_PRODUCT_TITLES[\n values.subscription as keyof typeof CONTRACT_PRODUCT_TITLES\n ]\n }.`,\n );\n }\n\n if (\n hasEligibilityQuestionnaireSubmitted &&\n values.subscription !== corProductIdentifier\n ) {\n try {\n await deleteContractorCorSubscriptionMutationAsync({\n employmentId: internalEmploymentId as string,\n });\n await refetchContractorSubscriptions();\n } catch (error) {\n if ((error as $TSFixMe)?.response?.status !== 404) {\n throw error;\n }\n // Still refetch to update the UI state\n await refetchContractorSubscriptions();\n }\n }\n\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 } else if (values.subscription == corProductIdentifier) {\n if (\n hasEligibilityQuestionnaireSubmitted &&\n employment?.contractor_type !== 'cor'\n ) {\n return manageContractorCorSubscriptionMutationAsync({\n employmentId: internalEmploymentId as string,\n });\n } else {\n return Promise.resolve({\n data: { subscription: values.subscription },\n });\n }\n }\n\n throw createStructuredError('invalid selection');\n }\n\n case 'eligibility_questionnaire': {\n try {\n const response = await createEligibilityQuestionnaireMutationAsync({\n employmentId: internalEmploymentId as string,\n payload: parsedValues,\n });\n\n const isEligibilityQuestionnaireBlocked = response?.data?.is_blocking;\n\n if (isEligibilityQuestionnaireBlocked) {\n setIncludeEligibilityQuestionnaire(false);\n setPendingNavigationStep('pricing_plan');\n throw createStructuredError(\n 'This individual is not eligible for Contractor of Record.',\n );\n }\n\n return await manageContractorCorSubscriptionMutationAsync({\n employmentId: internalEmploymentId as string,\n });\n } finally {\n // Always refetch to keep state in sync, even on error\n await refetchContractorSubscriptions();\n }\n }\n\n default: {\n throw createStructuredError('Invalid step state');\n }\n }\n }\n\n const markContractAsReviewed = () => {\n // Notify parent to sync form state\n onContractReviewedRef.current?.();\n };\n\n const handleNextStep = () => {\n if (internalEmploymentId) {\n refetchEmployment();\n }\n nextStep();\n };\n\n const isLoading = initialLoading || shouldHandleReadOnlyEmployment;\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 mark the contract as reviewed\n * @param values - New form values to check\n * @returns {boolean}\n */\n markContractAsReviewed,\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: handleNextStep,\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 presentation: stepPresentation[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 * Indicates whether AI validation errors can be skipped (user can continue at their own risk).\n * True when there's a skippable AI validation error on services_and_deliverables field.\n * @returns {boolean}\n */\n canSkipAiValidation:\n fieldValues.services_and_deliverables_error_skippable === true,\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: true },\n );\n return signatureSchemaForm?.handleValidation(parsedValues);\n }\n\n if (\n selectContractorSubscriptionForm &&\n stepState.currentStep.name === 'pricing_plan'\n ) {\n const parsedValues = await parseJSFToValidate(\n values,\n selectContractorSubscriptionForm?.fields,\n { isPartialValidation: false },\n );\n return selectContractorSubscriptionForm?.handleValidation(parsedValues);\n }\n\n if (\n eligibilityQuestionnaireForm &&\n stepState.currentStep.name === 'eligibility_questionnaire'\n ) {\n const parsedValues = await parseJSFToValidate(\n values,\n eligibilityQuestionnaireForm?.fields,\n { isPartialValidation: false },\n );\n return eligibilityQuestionnaireForm?.handleValidation(parsedValues);\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 updateEmploymentMutation.isPending ||\n createContractorContractDocumentMutation.isPending ||\n signContractDocumentMutation.isPending ||\n manageContractorSubscriptionMutation.isPending ||\n uploadFileMutation.isPending ||\n createEligibilityQuestionnaireMutation.isPending ||\n manageContractorCorSubscriptionMutation.isPending ||\n deleteContractorCorSubscriptionMutation.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 */\n employment,\n\n /**\n * Default legal entity\n * @returns {CompanyLegalEntity}\n */\n defaultLegalEntity,\n\n /**\n * Whether the company needs to complete KYB verification before contractors can be paid.\n * Use this to show a company verification nudge banner on the review step.\n */\n needsCompanyVerification:\n openTasks?.some((a) => a.type === 'verify_company') ?? false,\n\n /**\n * Whether the company needs to set up Remote Payments.\n * Use this to show a Remote Payments setup nudge banner on the review step.\n */\n needsRemotePaymentsSetup:\n openTasks?.some((a) => a.type === 'setup_remote_payments') ?? false,\n\n /**\n * Steps array\n * @returns {Array<{name: string, index: number, visible: boolean, label: string}>}\n */\n steps: stepsArray,\n };\n};\n","import { useQuery } from '@tanstack/react-query';\nimport {\n getV1CompaniesCompanyIdLegalEntities,\n CompanyLegalEntity,\n} from '@/src/client';\nimport { Client } from '@/src/client/client';\nimport { useClient } from '@/src/context';\nimport { useIdentity } from '@/src/common/api/identity';\nimport { hasCompany } from '@/src/common/api/companies';\n\n/**\n * Hook to get the legal entities for a company\n * @param companyId - The company ID\n * @returns The legal entities\n */\nexport const useLegalEntities = () => {\n const { client } = useClient();\n const { data: identity } = useIdentity();\n const companyId = hasCompany(identity) ? (identity?.company?.id ?? '') : '';\n\n return useQuery({\n queryKey: ['legal-entities', companyId],\n queryFn: () =>\n getV1CompaniesCompanyIdLegalEntities({\n client: client as Client,\n path: {\n company_id: companyId,\n },\n query: {\n page_size: 100,\n },\n }),\n select: (data) => data.data?.data?.legal_entities,\n enabled: !!companyId,\n });\n};\n\nexport const useDefaultLegalEntity = () => {\n const { data: legalEntities } = useLegalEntities();\n return legalEntities?.find(\n (legalEntity: CompanyLegalEntity) => legalEntity.is_default,\n );\n};\n"],"mappings":"suBAAA,OAAS,aAAAA,EAAW,WAAAC,EAAS,UAAAC,GAAQ,YAAAC,MAAgB,QAErD,OAAOC,OAAU,cCFjB,OAAS,YAAAC,OAAgB,wBAelB,IAAMC,GAAmBC,EAAA,IAAM,CACpC,GAAM,CAAE,OAAAC,CAAO,EAAIC,GAAU,EACvB,CAAE,KAAMC,CAAS,EAAIC,GAAY,EACjCC,EAAYC,GAAWH,CAAQ,EAAKA,GAAU,SAAS,IAAM,GAAM,GAEzE,OAAOI,GAAS,CACd,SAAU,CAAC,iBAAkBF,CAAS,EACtC,QAASL,EAAA,IACPQ,GAAqC,CACnC,OAAQP,EACR,KAAM,CACJ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emo","useRef","useState","omit","useQuery","useLegalEntities","__name","client","useClient","identity","useIdentity","companyId","hasCompany","useQuery","getV1CompaniesCompanyIdLegalEntities","data","useDefaultLegalEntity","legalEntities","legalEntity","stepToFormSchemaMap","jsonSchemaToEmployment","useContractorOnboarding","__name","countryCode","externalId","employmentId","skipSteps","options","onboardingInitialValues","excludeProducts","onContractReviewedRef","useRef","useEffect","internalCountryCode","setInternalCountryCode","useState","internalEmploymentId","setInternalEmploymentId","internalContractDocumentId","setInternalContractDocumentId","fieldsMetaRef","selectedProduct","setSelectedProduct","includeEligibilityQuestionnaire","setIncludeEligibilityQuestionnaire","includeContractPreview","setIncludeContractPreview","pendingNavigationStep","setPendingNavigationStep","steps","stepsArray","useMemo","buildSteps","fieldValues","stepState","setFieldValues","previousStep","nextStep","goToStep","setStepValues","useStepState","employment","isLoadingEmployment","refetchEmployment","useEmploymentQuery","defaultLegalEntity","useDefaultLegalEntity","openTasks","useCompanyOpenTasks","employmentStatus","isEmploymentReadOnly","reviewStepAllowedEmploymentStatus","canInvite","disabledInviteButtonEmploymentStatus","invitedStatus","createEmploymentMutation","useCreateEmployment","updateEmploymentMutation","useUpdateEmployment","createContractorContractDocumentMutation","useCreateContractorContractDocument","uploadFileMutation","useUploadFile","updateUKandSaudiFieldsMutation","useUpdateUKandSaudiFields","createEligibilityQuestionnaireMutation","usePostCreateEligibilityQuestionnaire","manageContractorCorSubscriptionMutation","usePostManageContractorCorSubscription","updateEmploymentMutationAsync","mutationToPromise","signContractDocumentMutation","useSignContractDocument","manageContractorSubscriptionMutation","usePostManageContractorSubscriptions","deleteContractorCorSubscriptionMutation","useDeleteContractorCorSubscription","createEmploymentMutationAsync","createContractorContractDocumentMutationAsync","signContractDocumentMutationAsync","manageContractorSubscriptionMutationAsync","createEligibilityQuestionnaireMutationAsync","manageContractorCorSubscriptionMutationAsync","deleteContractorCorSubscriptionMutationAsync","selectCountryForm","isLoadingCountries","countries","useCountriesSchemaField","selectedCountry","country","countryName","isPricingPlanEnabled","selectContractorSubscriptionForm","isLoadingContractorSubscriptions","contractorSubscriptions","filteredContractorSubscriptions","refetchContractorSubscriptions","isEligibilityQuestionnaireBlocked","useContractorSubscriptionSchemaField","hasEligibilityQuestionnaireSubmitted","subscription","corProductIdentifier","isCor","eligibilityAnswers","formType","employmentKey","serverEmploymentData","useJSONSchema","form","jsonSchemaOptions","query","mergedFormValues","useJSONSchemaForm","isBasicInformationDetailsEnabled","isIR35FileEnabled","ir35File","isLoadingIR35File","useGetIR35File","contractDocuments","isLoadingContractDocuments","useGetContractDocuments","basicInformationForm","isLoadingBasicInformationForm","buildBasicInformationJsfModify","descriptionProvisionalStartDate","calculateProvisionalStartDateDescription","selectedPricingPlan","subscriptions","contractorStandardProductIdentifier","contractorPlusProductIdentifier","eligibilityFields","isEligibilityQuestionnaireEnabled","eligibilityQuestionnaireForm","isLoadingEligibilityQuestionnaire","useGetEligibilityQuestionnaire","isContractorOnboardingDetailsEnabled","contractorOnboardingDetailsForm","isLoadingContractorOnboardingDetailsForm","useContractorOnboardingDetailsSchemaWithCurrencies","buildContractDetailsJsfModify","isSignatureSchemaEnabled","signatureSchemaForm","useGetContractDocumentSignatureSchema","buildContractPreviewJsfModify","documentPreviewPdf","isLoadingDocumentPreviewForm","refetchDocumentPreviewForm","useGetShowContractDocument","hasCompanySignedContract","useHasCompanySignedContract","stepFields","stepFieldsWithFlatFieldsets","stepPresentation","employmentBasicInformation","employmentContractDetails","employmentCountryCode","selectCountryInitialValues","getInitialValues","convertedIr35File","dataURLtoFile","basicInformationInitialValues","initialValues","contractDetailsInitialValues","contractPreviewInitialValues","signature","signatory","pricingPlanInitialValues","eligibilityQuestionnaireInitialValues","shouldHandleReadOnlyEmployment","initialLoading","isNavigatingToReview","hasContractPreviewFields","prettifyFormValues","goTo","step","parseFormValues","values","parseJSFToValidate","extractAiValidationError","error","isMutationError","rawError","servicesAndDeliverablesError","REMOTE_AI_ERROR_SOURCE","onSubmit","currentStepName","parsedValues","isEmploymentNotLoaded","hasChangedCountry","basicInformationPayload","omit","response","createStructuredError","basicInformationParsedValues","_servicesAndDeliverablesAiWarning","_servicesAndDeliverablesErrorSkippable","contractDetailsData","shouldSkipAiChecks","payload","contractDocumentId","aiError","transformAiErrorResponse","eorProductIdentifier","CONTRACT_PRODUCT_TITLES","a"]}
@@ -1,2 +0,0 @@
1
- import{b as P}from"./chunk-PGWKJ6FK.js";import{q,r as w,s as D,t as O}from"./chunk-ZMQTQ4UQ.js";import{b as u}from"./chunk-G2LZFGZA.js";import{a as s}from"./chunk-P37U34EQ.js";import{useState as R}from"react";var E=s(({employmentId:n})=>{let[r,a]=R({}),[o,_]=R(),{data:d,isLoading:l,refetch:y}=q(n,{queryOptions:{enabled:!!n}}),m=o?r[o]:void 0,{data:h,isLoading:v}=D(n,m,{queryOptions:{enabled:!!m}}),g=w(),b=O(),{mutateAsyncOrThrow:A}=u(g),{mutateAsyncOrThrow:x}=u(b),C=s(async(e,c)=>{let i=d?.find(t=>t.slug===e);if(i?.status==="blocked"){let t=i.depends_on_requirement?.name;throw new Error(`Cannot create document for blocked requirement. ${t?`${t} must be completed first.`:"A dependent requirement must be completed first."}`)}let k=r[e];if(_(e),k)return null;let f=await A({employmentId:n,body:{pre_onboarding_document_requirement_slug:e,constraints_ack_at:c||i?.document_constraints_ack_at||null}}),p=f?.data.pre_onboarding_document.id;return p&&a(t=>({...t,[e]:p})),f},"onCreateDocument"),I=s(async e=>{if(!o)throw new Error("No active requirement selected");let c=r[o];if(!c)throw new Error("No document to sign");if(!e)throw new Error("Signature is required");let i=await x({employmentId:n,documentId:c,signature:e});return await y(),i},"onSignDocument");return{requirements:d,isLoadingRequirements:l,documentPreview:h,isLoadingDocumentPreview:v,activeRequirementSlug:o,isCreatingDocument:g.isPending,isSigning:b.isPending,onCreateDocument:C,onSignDocument:I}},"usePreOnboardingRequirements"),B=s(({render:n})=>{let{onboardingBag:r}=P(),a=E({employmentId:r.employmentId});return n(a)},"PreOnboardingRequirements");export{E as a,B as b};
2
- //# sourceMappingURL=chunk-VWO7PDZ4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Onboarding/components/PreOnboardingRequirements.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useOnboardingContext } from '@/src/flows/Onboarding/context';\nimport {\n useGetPreOnboardingRequirements,\n useCreatePreOnboardingDocument,\n useGetPreOnboardingDocument,\n useSignPreOnboardingDocument,\n} from '@/src/flows/Onboarding/api';\nimport { mutationToPromise } from '@/src/lib/mutations';\n\nexport const usePreOnboardingRequirements = ({\n employmentId,\n}: {\n employmentId: string;\n}) => {\n const [documentIds, setDocumentIds] = useState<Record<string, string>>({});\n const [activeRequirementSlug, setActiveRequirementSlug] = useState<\n string | undefined\n >();\n\n const {\n data: requirements,\n isLoading: isLoadingRequirements,\n refetch: refetchRequirements,\n } = useGetPreOnboardingRequirements(employmentId, {\n queryOptions: { enabled: !!employmentId },\n });\n\n const activeDocumentId = activeRequirementSlug\n ? documentIds[activeRequirementSlug]\n : undefined;\n\n const { data: documentPreview, isLoading: isLoadingDocumentPreview } =\n useGetPreOnboardingDocument(employmentId, activeDocumentId, {\n queryOptions: { enabled: !!activeDocumentId },\n });\n\n const createDocumentMutation = useCreatePreOnboardingDocument();\n const signDocumentMutation = useSignPreOnboardingDocument();\n\n const { mutateAsyncOrThrow: createDocumentMutationAsync } = mutationToPromise(\n createDocumentMutation,\n );\n const { mutateAsyncOrThrow: signDocumentMutationAsync } =\n mutationToPromise(signDocumentMutation);\n\n const onCreateDocument = async (\n requirementSlug: string,\n constraintsAckAt?: string,\n ) => {\n const requirement = requirements?.find(\n (req) => req.slug === requirementSlug,\n );\n\n if (requirement?.status === 'blocked') {\n const dependsOnName = requirement.depends_on_requirement?.name;\n throw new Error(\n `Cannot create document for blocked requirement. ${dependsOnName ? `${dependsOnName} must be completed first.` : 'A dependent requirement must be completed first.'}`,\n );\n }\n\n const existingDocumentId = documentIds[requirementSlug];\n setActiveRequirementSlug(requirementSlug);\n\n if (existingDocumentId) {\n return null;\n }\n\n const result = await createDocumentMutationAsync({\n employmentId,\n body: {\n pre_onboarding_document_requirement_slug: requirementSlug,\n constraints_ack_at:\n constraintsAckAt || requirement?.document_constraints_ack_at || null,\n },\n });\n const newDocumentId = result?.data.pre_onboarding_document.id;\n if (newDocumentId) {\n setDocumentIds((prev) => ({ ...prev, [requirementSlug]: newDocumentId }));\n }\n return result;\n };\n\n const onSignDocument = async (signature: string) => {\n if (!activeRequirementSlug) {\n throw new Error('No active requirement selected');\n }\n\n const documentId = documentIds[activeRequirementSlug];\n if (!documentId) {\n throw new Error('No document to sign');\n }\n\n if (!signature) {\n throw new Error('Signature is required');\n }\n\n const responnse = await signDocumentMutationAsync({\n employmentId,\n documentId,\n signature,\n });\n await refetchRequirements();\n return responnse;\n };\n\n return {\n requirements,\n isLoadingRequirements,\n documentPreview,\n isLoadingDocumentPreview,\n activeRequirementSlug,\n isCreatingDocument: createDocumentMutation.isPending,\n isSigning: signDocumentMutation.isPending,\n onCreateDocument,\n onSignDocument,\n };\n};\n\nexport type PreOnboardingRequirementsBag = ReturnType<\n typeof usePreOnboardingRequirements\n>;\n\nexport const PreOnboardingRequirements = ({\n render,\n}: {\n render: (bag: PreOnboardingRequirementsBag) => React.ReactNode;\n}) => {\n const { onboardingBag } = useOnboardingContext();\n\n const bag = usePreOnboardingRequirements({\n employmentId: onboardingBag.employmentId as string,\n });\n\n return render(bag);\n};\n"],"mappings":"gLAAA,OAAS,YAAAA,MAAgB,QAUlB,IAAMC,EAA+BC,EAAA,CAAC,CAC3C,aAAAC,CACF,IAEM,CACJ,GAAM,CAACC,EAAaC,CAAc,EAAIC,EAAiC,CAAC,CAAC,EACnE,CAACC,EAAuBC,CAAwB,EAAIF,EAExD,EAEI,CACJ,KAAMG,EACN,UAAWC,EACX,QAASC,CACX,EAAIC,EAAgCT,EAAc,CAChD,aAAc,CAAE,QAAS,CAAC,CAACA,CAAa,CAC1C,CAAC,EAEKU,EAAmBN,EACrBH,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aAAMxB,EAAoB,EACnB0B,CACT,EArBuB,kBAuBvB,MAAO,CACL,aAAA5B,EACA,sBAAAC,EACA,gBAAAI,EACA,yBAAAC,EACA,sBAAAR,EACA,mBAAoBU,EAAuB,UAC3C,UAAWE,EAAqB,UAChC,iBAAAK,EACA,eAAAU,CACF,CACF,EA3G4C,gCAiH/BI,EAA4BpC,EAAA,CAAC,CACxC,OAAAqC,CACF,IAEM,CACJ,GAAM,CAAE,cAAAC,CAAc,EAAIC,EAAqB,EAEzCC,EAAMzC,EAA6B,CACvC,aAAcuC,EAAc,YAC9B,CAAC,EAED,OAAOD,EAAOG,CAAG,CACnB,EAZyC","names":["useState","usePreOnboardingRequirements","__name","employmentId","documentIds","setDocumentIds","useState","activeRequirementSlug","setActiveRequirementSlug","requirements","isLoadingRequirements","refetchRequirements","useGetPreOnboardingRequirements","activeDocumentId","documentPreview","isLoadingDocumentPreview","useGetPreOnboardingDocument","createDocumentMutation","useCreatePreOnboardingDocument","signDocumentMutation","useSignPreOnboardingDocument","createDocumentMutationAsync","mutationToPromise","signDocumentMutationAsync","onCreateDocument","requirementSlug","constraintsAckAt","requirement","req","dependsOnName","existingDocumentId","result","newDocumentId","prev","onSignDocument","signature","documentId","responnse","PreOnboardingRequirements","render","onboardingBag","useOnboardingContext","bag"]}