@remoteoss/remote-flows 0.18.0 → 0.19.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 (242) hide show
  1. package/dist/{chunk-A522V6XF.js → chunk-27PK3DVV.js} +2 -2
  2. package/dist/{chunk-3O2RD3RK.js → chunk-2EN2X5NU.js} +2 -2
  3. package/dist/chunk-2ERB4H3T.js +2 -0
  4. package/dist/chunk-2ERB4H3T.js.map +1 -0
  5. package/dist/chunk-32GSS4UM.js +2 -0
  6. package/dist/{chunk-NBCZF2FO.js.map → chunk-32GSS4UM.js.map} +1 -1
  7. package/dist/{chunk-N5I33LIN.js → chunk-5ISPIMTZ.js} +2 -2
  8. package/dist/{chunk-U4NWXPI5.js → chunk-5NDSOA6K.js} +2 -2
  9. package/dist/{chunk-U4NWXPI5.js.map → chunk-5NDSOA6K.js.map} +1 -1
  10. package/dist/{chunk-ALYKEN3E.js → chunk-5NPHBFW7.js} +2 -2
  11. package/dist/{chunk-CYKK3LPJ.js → chunk-6F66NTNI.js} +2 -2
  12. package/dist/{chunk-MRMVBBVZ.js → chunk-6NIRGHFF.js} +2 -2
  13. package/dist/chunk-6NXC6SLB.js +1 -0
  14. package/dist/{chunk-A6EYY3FO.js → chunk-73A7SYGH.js} +2 -2
  15. package/dist/{chunk-MLB2I27G.js → chunk-7CHZ25AS.js} +2 -2
  16. package/dist/{chunk-4R3ITKOA.js → chunk-7DKOWSJ3.js} +2 -2
  17. package/dist/{chunk-OZ63OC3N.js → chunk-7EI4E76I.js} +2 -2
  18. package/dist/{chunk-RZTT3MEP.js → chunk-7SR3FCW6.js} +2 -2
  19. package/dist/chunk-AHUK7NSK.js +2 -0
  20. package/dist/chunk-AHUK7NSK.js.map +1 -0
  21. package/dist/{chunk-BFOGH4SF.js → chunk-AS6DCKEJ.js} +2 -2
  22. package/dist/{chunk-6NKUEDYP.js → chunk-BE54D4XM.js} +2 -2
  23. package/dist/{chunk-7P5B6XHM.js → chunk-BM3AKYMT.js} +2 -2
  24. package/dist/{chunk-H4KE45NG.js → chunk-BZIVYUMH.js} +2 -2
  25. package/dist/{chunk-EGQJ7UBR.js → chunk-E3QWREZF.js} +1 -1
  26. package/dist/chunk-E5PSJ75C.js +2 -0
  27. package/dist/chunk-E5PSJ75C.js.map +1 -0
  28. package/dist/{chunk-ZSDJZMQW.js → chunk-F2E56YE2.js} +2 -2
  29. package/dist/{chunk-ZSDJZMQW.js.map → chunk-F2E56YE2.js.map} +1 -1
  30. package/dist/{chunk-XGEKV3FC.js → chunk-FQPU3JBJ.js} +2 -2
  31. package/dist/chunk-GC23RRCI.js +2 -0
  32. package/dist/chunk-GC23RRCI.js.map +1 -0
  33. package/dist/chunk-GPBU6CQP.js +2 -0
  34. package/dist/chunk-GPBU6CQP.js.map +1 -0
  35. package/dist/{chunk-BF2D5O5H.js → chunk-H6NMRBGZ.js} +2 -2
  36. package/dist/{chunk-A4KEKMEQ.js → chunk-H77RIB6S.js} +2 -2
  37. package/dist/chunk-INC2YFDP.js +2 -0
  38. package/dist/chunk-INC2YFDP.js.map +1 -0
  39. package/dist/{chunk-PHN4XMPV.js → chunk-J7JO4GF4.js} +2 -2
  40. package/dist/chunk-JBUNDNKJ.js +2 -0
  41. package/dist/chunk-JBUNDNKJ.js.map +1 -0
  42. package/dist/{chunk-6ZPISRAG.js → chunk-JIRA6B5O.js} +2 -2
  43. package/dist/{chunk-56DXHJNR.js → chunk-KVNG6CWQ.js} +2 -2
  44. package/dist/{chunk-7JQPHRUK.js → chunk-LUUUPLTW.js} +2 -2
  45. package/dist/{chunk-4B36XRKA.js → chunk-LYF7ISYE.js} +2 -2
  46. package/dist/chunk-MAHR7HCO.js +2 -0
  47. package/dist/chunk-MAHR7HCO.js.map +1 -0
  48. package/dist/chunk-N6G4VZXF.js +2 -0
  49. package/dist/chunk-N6G4VZXF.js.map +1 -0
  50. package/dist/{chunk-2VS6B3PC.js → chunk-NNM5M4E3.js} +2 -2
  51. package/dist/{chunk-7C2Z2EE5.js → chunk-OD37LQSP.js} +2 -2
  52. package/dist/{chunk-TLC5WQY2.js → chunk-OMECCA6L.js} +2 -2
  53. package/dist/{chunk-73H6SO2E.js → chunk-P5CLILU4.js} +2 -2
  54. package/dist/{chunk-CEUBVUKV.js → chunk-P6JDGCDA.js} +2 -2
  55. package/dist/{chunk-QKKEFL4Z.js → chunk-PBXZVY22.js} +2 -2
  56. package/dist/{chunk-ITSQE6EW.js → chunk-PHGCCQZ2.js} +2 -2
  57. package/dist/{chunk-ZOKSYPOP.js → chunk-PUSPB4CX.js} +2 -2
  58. package/dist/{chunk-I2A4EFDY.js → chunk-RM3HE733.js} +2 -2
  59. package/dist/{chunk-GGBEM452.js → chunk-TDQVKDQW.js} +2 -2
  60. package/dist/{chunk-DCRLPAJL.js → chunk-TPHCKHYD.js} +2 -2
  61. package/dist/{chunk-63HVO7J5.js → chunk-U4HGV7LP.js} +2 -2
  62. package/dist/chunk-UH3E6HSQ.js +2 -0
  63. package/dist/{chunk-QQ7KPOLK.js → chunk-W2PPGQL6.js} +2 -2
  64. package/dist/{chunk-QXPWESEW.js → chunk-XVTAPI3Z.js} +2 -2
  65. package/dist/{chunk-5BQOPJTQ.js → chunk-Y373YLLS.js} +2 -2
  66. package/dist/{chunk-JB55FFG6.js → chunk-Y4C57RXK.js} +2 -2
  67. package/dist/{chunk-V2YORDAL.js → chunk-YDNOMXS7.js} +2 -2
  68. package/dist/{chunk-53NFLDRX.js → chunk-Z6M74RQ7.js} +2 -2
  69. package/dist/chunk-ZX5OIIJX.js +1 -0
  70. package/dist/chunk-ZX5OIIJX.js.map +1 -0
  71. package/dist/flows/ContractAmendment/ContractAmendmentBack.js +1 -1
  72. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +1 -1
  73. package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +1 -1
  74. package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
  75. package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +1 -1
  76. package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
  77. package/dist/flows/ContractAmendment/ContractAmendmentSubmit.js +1 -1
  78. package/dist/flows/ContractAmendment/context.d.ts +2 -2
  79. package/dist/flows/ContractAmendment/hooks.d.ts +1 -1
  80. package/dist/flows/ContractAmendment/hooks.js +1 -1
  81. package/dist/flows/ContractAmendment/index.d.ts +1 -1
  82. package/dist/flows/ContractAmendment/index.js +1 -1
  83. package/dist/flows/ContractAmendment/utils.d.ts +1 -1
  84. package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +20 -2
  85. package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
  86. package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +1 -1
  87. package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
  88. package/dist/flows/CostCalculator/CostCalculatorResetButton.js +1 -1
  89. package/dist/flows/CostCalculator/CostCalculatorSubmitButton.js +1 -1
  90. package/dist/flows/CostCalculator/EstimationResults/EstimationResults.d.ts +1 -1
  91. package/dist/flows/CostCalculator/EstimationResults/EstimationResults.js +1 -1
  92. package/dist/flows/CostCalculator/Results/CostCalculatorBenefitsBreakdown.js +1 -1
  93. package/dist/flows/CostCalculator/Results/CostCalculatorContributionsBreakdown.js +1 -1
  94. package/dist/flows/CostCalculator/Results/CostCalculatorExtraStatutoryPaymentsBreakdown.js +1 -1
  95. package/dist/flows/CostCalculator/Results/CostCalculatorGrossSalary.js +1 -1
  96. package/dist/flows/CostCalculator/Results/CostCalculatorResults.d.ts +1 -1
  97. package/dist/flows/CostCalculator/Results/CostCalculatorResults.js +1 -1
  98. package/dist/flows/CostCalculator/SummaryResults/SummaryResults.d.ts +1 -1
  99. package/dist/flows/CostCalculator/api.d.ts +1 -1
  100. package/dist/flows/CostCalculator/api.js +1 -1
  101. package/dist/flows/CostCalculator/components/SalaryField.d.ts +2 -2
  102. package/dist/flows/CostCalculator/components/SalaryField.js +1 -1
  103. package/dist/flows/CostCalculator/context.d.ts +2 -2
  104. package/dist/flows/CostCalculator/hooks.d.ts +1 -1
  105. package/dist/flows/CostCalculator/hooks.js +1 -1
  106. package/dist/flows/CostCalculator/index.d.ts +2 -2
  107. package/dist/flows/CostCalculator/index.js +1 -1
  108. package/dist/flows/CostCalculator/types.d.ts +1 -1
  109. package/dist/flows/CostCalculator/utils.d.ts +2 -2
  110. package/dist/flows/CostCalculator/utils.js +1 -1
  111. package/dist/flows/Onboarding/OnboardingFlow.d.ts +2 -2
  112. package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
  113. package/dist/flows/Onboarding/api.d.ts +2 -2
  114. package/dist/flows/Onboarding/api.js +1 -1
  115. package/dist/flows/Onboarding/components/AnnualGrossSalary.d.ts +2 -2
  116. package/dist/flows/Onboarding/components/AnnualGrossSalary.js +1 -1
  117. package/dist/flows/Onboarding/components/BasicInformationStep.d.ts +1 -1
  118. package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
  119. package/dist/flows/Onboarding/components/BenefitsStep.d.ts +2 -2
  120. package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
  121. package/dist/flows/Onboarding/components/ContractDetailsStep.d.ts +1 -1
  122. package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
  123. package/dist/flows/Onboarding/components/OnboardingBack.js +1 -1
  124. package/dist/flows/Onboarding/components/OnboardingForm.d.ts +2 -2
  125. package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
  126. package/dist/flows/Onboarding/components/OnboardingInvite.d.ts +1 -1
  127. package/dist/flows/Onboarding/components/OnboardingInvite.js +1 -1
  128. package/dist/flows/Onboarding/components/OnboardingSubmit.js +1 -1
  129. package/dist/flows/Onboarding/components/ReviewStep.d.ts +1 -1
  130. package/dist/flows/Onboarding/components/SelectCountryStep.d.ts +1 -1
  131. package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
  132. package/dist/flows/Onboarding/context.d.ts +2 -2
  133. package/dist/flows/Onboarding/hooks.d.ts +2 -2
  134. package/dist/flows/Onboarding/hooks.js +1 -1
  135. package/dist/flows/Onboarding/index.d.ts +2 -2
  136. package/dist/flows/Onboarding/index.js +1 -1
  137. package/dist/flows/Onboarding/types.d.ts +1 -1
  138. package/dist/flows/Onboarding/utils.d.ts +1 -1
  139. package/dist/flows/Termination/AdditionalDetailsForm.d.ts +1 -1
  140. package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
  141. package/dist/flows/Termination/EmployeeComunicationForm.d.ts +1 -1
  142. package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
  143. package/dist/flows/Termination/PaidTimeOffForm.d.ts +1 -1
  144. package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
  145. package/dist/flows/Termination/TerminationBack.js +1 -1
  146. package/dist/flows/Termination/TerminationDetailsForm.d.ts +1 -1
  147. package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
  148. package/dist/flows/Termination/TerminationDialogInfoContent/TerminationDialogInfoContent.d.ts +5 -0
  149. package/dist/flows/Termination/TerminationDialogInfoContent/TerminationDialogInfoContent.js +2 -0
  150. package/dist/flows/Termination/TerminationDialogInfoContent/TerminationDialogInfoContent.js.map +1 -0
  151. package/dist/flows/Termination/TerminationFlow.d.ts +2 -2
  152. package/dist/flows/Termination/TerminationFlow.js +1 -1
  153. package/dist/flows/Termination/TerminationForm.d.ts +1 -1
  154. package/dist/flows/Termination/TerminationForm.js +1 -1
  155. package/dist/flows/Termination/TerminationSubmit.js +1 -1
  156. package/dist/flows/Termination/TimeOff.d.ts +1 -1
  157. package/dist/flows/Termination/TimeOff.js +1 -1
  158. package/dist/flows/Termination/context.d.ts +2 -2
  159. package/dist/flows/Termination/hooks.d.ts +4 -3
  160. package/dist/flows/Termination/hooks.js +1 -1
  161. package/dist/flows/Termination/index.d.ts +2 -1
  162. package/dist/flows/Termination/index.js +1 -1
  163. package/dist/flows/Termination/json-schemas/employeeComunication.d.ts +1 -0
  164. package/dist/flows/Termination/json-schemas/employeeComunication.js +1 -1
  165. package/dist/flows/Termination/json-schemas/jsonSchema.d.ts +17 -1
  166. package/dist/flows/Termination/json-schemas/jsonSchema.js +1 -1
  167. package/dist/flows/Termination/json-schemas/schema.js +1 -1
  168. package/dist/flows/Termination/json-schemas/terminationDetails.d.ts +16 -0
  169. package/dist/flows/Termination/json-schemas/terminationDetails.js +1 -1
  170. package/dist/flows/Termination/types.d.ts +1 -1
  171. package/dist/flows/api.d.ts +23 -0
  172. package/dist/flows/api.js +2 -0
  173. package/dist/flows/api.js.map +1 -0
  174. package/dist/index.css +1 -1
  175. package/dist/index.css.map +1 -1
  176. package/dist/index.d.ts +7 -4
  177. package/dist/index.js +1 -1
  178. package/dist/index.js.map +1 -1
  179. package/dist/internals.js +1 -1
  180. package/dist/internals.js.map +1 -1
  181. package/dist/{remoteFlows-BLMhusyP.d.ts → remoteFlows-DZCgZVnE.d.ts} +1 -1
  182. package/dist/{types.gen-CaXCWhlP.d.ts → types.gen-BbxQoQYr.d.ts} +9 -1
  183. package/package.json +1 -1
  184. package/dist/chunk-HSW5HMHH.js +0 -2
  185. package/dist/chunk-JODJFARP.js +0 -2
  186. package/dist/chunk-JODJFARP.js.map +0 -1
  187. package/dist/chunk-M22FKNEY.js +0 -1
  188. package/dist/chunk-NBCZF2FO.js +0 -2
  189. package/dist/chunk-NGJXBBXW.js +0 -2
  190. package/dist/chunk-NGJXBBXW.js.map +0 -1
  191. package/dist/chunk-NTEIOU72.js +0 -2
  192. package/dist/chunk-NTEIOU72.js.map +0 -1
  193. package/dist/chunk-OT2DXWYZ.js +0 -2
  194. package/dist/chunk-OT2DXWYZ.js.map +0 -1
  195. package/dist/chunk-VX2UC3HG.js +0 -2
  196. package/dist/chunk-VX2UC3HG.js.map +0 -1
  197. package/dist/chunk-WWANHPT7.js +0 -2
  198. package/dist/chunk-WWANHPT7.js.map +0 -1
  199. /package/dist/{chunk-A522V6XF.js.map → chunk-27PK3DVV.js.map} +0 -0
  200. /package/dist/{chunk-3O2RD3RK.js.map → chunk-2EN2X5NU.js.map} +0 -0
  201. /package/dist/{chunk-N5I33LIN.js.map → chunk-5ISPIMTZ.js.map} +0 -0
  202. /package/dist/{chunk-ALYKEN3E.js.map → chunk-5NPHBFW7.js.map} +0 -0
  203. /package/dist/{chunk-CYKK3LPJ.js.map → chunk-6F66NTNI.js.map} +0 -0
  204. /package/dist/{chunk-MRMVBBVZ.js.map → chunk-6NIRGHFF.js.map} +0 -0
  205. /package/dist/{chunk-M22FKNEY.js.map → chunk-6NXC6SLB.js.map} +0 -0
  206. /package/dist/{chunk-A6EYY3FO.js.map → chunk-73A7SYGH.js.map} +0 -0
  207. /package/dist/{chunk-MLB2I27G.js.map → chunk-7CHZ25AS.js.map} +0 -0
  208. /package/dist/{chunk-4R3ITKOA.js.map → chunk-7DKOWSJ3.js.map} +0 -0
  209. /package/dist/{chunk-OZ63OC3N.js.map → chunk-7EI4E76I.js.map} +0 -0
  210. /package/dist/{chunk-RZTT3MEP.js.map → chunk-7SR3FCW6.js.map} +0 -0
  211. /package/dist/{chunk-BFOGH4SF.js.map → chunk-AS6DCKEJ.js.map} +0 -0
  212. /package/dist/{chunk-6NKUEDYP.js.map → chunk-BE54D4XM.js.map} +0 -0
  213. /package/dist/{chunk-7P5B6XHM.js.map → chunk-BM3AKYMT.js.map} +0 -0
  214. /package/dist/{chunk-H4KE45NG.js.map → chunk-BZIVYUMH.js.map} +0 -0
  215. /package/dist/{chunk-EGQJ7UBR.js.map → chunk-E3QWREZF.js.map} +0 -0
  216. /package/dist/{chunk-XGEKV3FC.js.map → chunk-FQPU3JBJ.js.map} +0 -0
  217. /package/dist/{chunk-BF2D5O5H.js.map → chunk-H6NMRBGZ.js.map} +0 -0
  218. /package/dist/{chunk-A4KEKMEQ.js.map → chunk-H77RIB6S.js.map} +0 -0
  219. /package/dist/{chunk-PHN4XMPV.js.map → chunk-J7JO4GF4.js.map} +0 -0
  220. /package/dist/{chunk-6ZPISRAG.js.map → chunk-JIRA6B5O.js.map} +0 -0
  221. /package/dist/{chunk-56DXHJNR.js.map → chunk-KVNG6CWQ.js.map} +0 -0
  222. /package/dist/{chunk-7JQPHRUK.js.map → chunk-LUUUPLTW.js.map} +0 -0
  223. /package/dist/{chunk-4B36XRKA.js.map → chunk-LYF7ISYE.js.map} +0 -0
  224. /package/dist/{chunk-2VS6B3PC.js.map → chunk-NNM5M4E3.js.map} +0 -0
  225. /package/dist/{chunk-7C2Z2EE5.js.map → chunk-OD37LQSP.js.map} +0 -0
  226. /package/dist/{chunk-TLC5WQY2.js.map → chunk-OMECCA6L.js.map} +0 -0
  227. /package/dist/{chunk-73H6SO2E.js.map → chunk-P5CLILU4.js.map} +0 -0
  228. /package/dist/{chunk-CEUBVUKV.js.map → chunk-P6JDGCDA.js.map} +0 -0
  229. /package/dist/{chunk-QKKEFL4Z.js.map → chunk-PBXZVY22.js.map} +0 -0
  230. /package/dist/{chunk-ITSQE6EW.js.map → chunk-PHGCCQZ2.js.map} +0 -0
  231. /package/dist/{chunk-ZOKSYPOP.js.map → chunk-PUSPB4CX.js.map} +0 -0
  232. /package/dist/{chunk-I2A4EFDY.js.map → chunk-RM3HE733.js.map} +0 -0
  233. /package/dist/{chunk-GGBEM452.js.map → chunk-TDQVKDQW.js.map} +0 -0
  234. /package/dist/{chunk-DCRLPAJL.js.map → chunk-TPHCKHYD.js.map} +0 -0
  235. /package/dist/{chunk-63HVO7J5.js.map → chunk-U4HGV7LP.js.map} +0 -0
  236. /package/dist/{chunk-HSW5HMHH.js.map → chunk-UH3E6HSQ.js.map} +0 -0
  237. /package/dist/{chunk-QQ7KPOLK.js.map → chunk-W2PPGQL6.js.map} +0 -0
  238. /package/dist/{chunk-QXPWESEW.js.map → chunk-XVTAPI3Z.js.map} +0 -0
  239. /package/dist/{chunk-5BQOPJTQ.js.map → chunk-Y373YLLS.js.map} +0 -0
  240. /package/dist/{chunk-JB55FFG6.js.map → chunk-Y4C57RXK.js.map} +0 -0
  241. /package/dist/{chunk-V2YORDAL.js.map → chunk-YDNOMXS7.js.map} +0 -0
  242. /package/dist/{chunk-53NFLDRX.js.map → chunk-Z6M74RQ7.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-M22FKNEY.js";import{a as lr}from"./chunk-QKKEFL4Z.js";import"./chunk-53NFLDRX.js";import"./chunk-DCRLPAJL.js";import"./chunk-QQ7KPOLK.js";import"./chunk-OT2DXWYZ.js";import"./chunk-XFD3ULUF.js";import"./chunk-WWANHPT7.js";import"./chunk-HSW5HMHH.js";import"./chunk-VX2UC3HG.js";import"./chunk-XSHHMBMT.js";import"./chunk-JODJFARP.js";import"./chunk-W5DG5WWJ.js";import"./chunk-S4XU4SE7.js";import"./chunk-GULCZWSK.js";import"./chunk-A6EYY3FO.js";import"./chunk-CYKK3LPJ.js";import"./chunk-RZTT3MEP.js";import"./chunk-MRMVBBVZ.js";import"./chunk-XGEKV3FC.js";import"./chunk-MRYRNB7Y.js";import"./chunk-Z3BMF4BO.js";import{a as N}from"./chunk-MLB2I27G.js";import"./chunk-E5YN6OT3.js";import{a as D}from"./chunk-R2UI3WAJ.js";import{a as j}from"./chunk-6ZPISRAG.js";import"./chunk-4RULC3AZ.js";import"./chunk-H4KE45NG.js";import"./chunk-6NKUEDYP.js";import"./chunk-I2A4EFDY.js";import"./chunk-4R3ITKOA.js";import"./chunk-ZE3YT3Q6.js";import"./chunk-NVMZDPMF.js";import"./chunk-XJVYASHX.js";import{a as dr}from"./chunk-5BQOPJTQ.js";import"./chunk-4B36XRKA.js";import"./chunk-BF2D5O5H.js";import"./chunk-63HVO7J5.js";import"./chunk-73H6SO2E.js";import"./chunk-7JQPHRUK.js";import"./chunk-Z7WBY27D.js";import"./chunk-5KHLOGTR.js";import"./chunk-TLC5WQY2.js";import"./chunk-CEUBVUKV.js";import"./chunk-56DXHJNR.js";import"./chunk-ZOKSYPOP.js";import"./chunk-VAIBLWOY.js";import"./chunk-7C2Z2EE5.js";import"./chunk-F66G33YT.js";import"./chunk-PGWKJ6FK.js";import{a as _}from"./chunk-NGJXBBXW.js";import{b as F,d as T}from"./chunk-NTEIOU72.js";import"./chunk-ALYKEN3E.js";import{a as z}from"./chunk-NBCZF2FO.js";import"./chunk-VFRHMNLJ.js";import"./chunk-PHN4XMPV.js";import"./chunk-BFOGH4SF.js";import"./chunk-WVJDCDGZ.js";import{a as B}from"./chunk-3O2RD3RK.js";import{a as S}from"./chunk-OZ63OC3N.js";import{a as E}from"./chunk-A4KEKMEQ.js";import{d as R}from"./chunk-V2YORDAL.js";import"./chunk-HN5HLFTB.js";import"./chunk-KSHK3ZPX.js";import"./chunk-A7ZJQCNU.js";import{a as A}from"./chunk-HQI6W7PR.js";import{a as I}from"./chunk-DYB3RWP7.js";import"./chunk-CRXPRR3R.js";import"./chunk-UHS3QRA3.js";import"./chunk-N5I33LIN.js";import"./chunk-LBUNJ5J3.js";import"./chunk-ANXYPRBG.js";import"./chunk-Z5WMKCRJ.js";import{a as sr}from"./chunk-JB55FFG6.js";import{a as er}from"./chunk-A522V6XF.js";import"./chunk-CFIJKJXD.js";import"./chunk-2VS6B3PC.js";import"./chunk-U4NWXPI5.js";import"./chunk-ZTDKPUB5.js";import{a as or}from"./chunk-ITSQE6EW.js";import{a as cr}from"./chunk-QXPWESEW.js";import{a as ir,b as nr}from"./chunk-GGBEM452.js";import"./chunk-QW4JPW6J.js";import"./chunk-3AEKPMIN.js";import"./chunk-ZSDJZMQW.js";import"./chunk-GP237GUO.js";import"./chunk-TXSJL3HC.js";import{a as v}from"./chunk-EGQJ7UBR.js";import"./chunk-PJBAQZ6G.js";import"./chunk-7P5B6XHM.js";import{a as u,c as h}from"./chunk-3ZWDIEEM.js";import"./chunk-7VUILYZ3.js";import{a as tr}from"./chunk-DBDVBJDV.js";import"./chunk-3BREUYLG.js";import{b as C}from"./chunk-PAQW5BFW.js";import"./chunk-BI6U55BD.js";import"./chunk-TVZAFTPT.js";import{c as P,d as m}from"./chunk-3LOVCTCN.js";import{a as t}from"./chunk-P37U34EQ.js";import{QueryClient as $,QueryClientProvider as G}from"@tanstack/react-query";function d(r){let a=document.documentElement;Object.keys(r).forEach(e=>{let o=r[e];o&&a.style.setProperty(e,o)})}t(d,"setCssProperties");function O(r){let a={};return Object.keys(r).forEach(e=>{a[`--${e}`]=r[e]}),a}t(O,"mapThemeColors");function K(r){return{"--spacing":r}}t(K,"mapThemeSpacing");function V(r){return{"--radius":r}}t(V,"mapThemeBorderRadius");function U(r){return{"--fontSizeBase":r.fontSizeBase}}t(U,"mapThemeFont");function w(r){r?.colors&&d(O(r.colors)),r?.spacing&&d(K(r.spacing)),r?.borderRadius&&d(V(r.borderRadius)),r?.font&&d(U(r.font))}t(w,"applyTheme");import{createContext as W,useEffect as M,useMemo as L}from"react";import{jsx as Q}from"react/jsx-runtime";var q=W({theme:{}});function f(r){M(()=>{r.theme&&Object.keys(r.theme).length>0&&w(r.theme)},[r.theme]);let a=L(()=>({theme:r.theme}),[r.theme]);return Q(q.Provider,{value:a,children:r.children})}t(f,"ThemeProvider");var x={local:"http://localhost:4000/api/eor",partners:"https://gateway.partners.remote-sandbox.com",production:"https://gateway.remote.com",sandbox:"https://gateway.remote-sandbox.com",staging:"https://gateway.niceremote.com"};import{createClient as X}from"@hey-api/client-fetch";import{useQuery as Y}from"@tanstack/react-query";import{useRef as b}from"react";function Z(r){try{return new URL(r),!0}catch{return!1}}t(Z,"isValidUrl");var y=t(({auth:r,options:a,authId:e="default"})=>{let o=b(null),{refetch:c}=Y({queryKey:["auth",e],queryFn:r,enabled:!1}),s=a?.environment?x[a?.environment]:"https://gateway.remote.com",l=v.getConfig(),g="0.18.0";a?.environment&&a?.environment!=="production"&&m(g);let p=!!a?.proxy&&Z(a.proxy.url);return a?.proxy&&!p&&console.error("Invalid proxy URL provided. Using default base URL."),b(X({...l,headers:{...l.headers,...p?a?.proxy?.headers:{},"X-Client-Name":"remote-flows-sdk","X-Client-Version":g},baseUrl:p?a.proxy?.url:s,auth:t(async()=>{function k(i){return!i||Date.now()+6e4>i}if(t(k,"hasTokenExpired"),!o.current||k(o.current.expiresAt)){let{data:i}=await c();i&&(o.current={accessToken:i.accessToken,expiresAt:Date.now()+i.expiresIn*1e3})}return o.current?.accessToken},"auth")}))},"useAuth");import{jsx as n}from"react/jsx-runtime";var H=new $;function J({children:r,auth:a,authId:e,proxy:o,environment:c}){let s=y({auth:a,authId:e,options:{proxy:o,environment:c}});return n(h.Provider,{value:{client:s.current},children:r})}t(J,"RemoteFlowContextWrapper");function rr({children:r,components:a}){return n(u.Provider,{value:a?{components:a}:{components:{}},children:r})}t(rr,"FormFieldsProvider");function ar({auth:r,authId:a,children:e,components:o,theme:c,proxy:s,environment:l}){return n(G,{client:H,children:n(rr,{components:o,children:n(J,{auth:r,authId:a,proxy:s,environment:l,children:n(f,{theme:c,children:e})})})})}t(ar,"RemoteFlows");export{tr as ContractAmendmentConfirmationForm,sr as ContractAmendmentFlow,er as ContractAmendmentForm,or as ContractAmendmentSubmit,A as CostCalculatorDisclaimer,_ as CostCalculatorFlow,B as CostCalculatorForm,S as CostCalculatorResetButton,N as CostCalculatorResults,E as CostCalculatorSubmitButton,j as EstimationResults,dr as OnboardingFlow,ar as RemoteFlows,D as SummaryResults,lr as TerminationFlow,F as buildCostCalculatorEstimationPayload,C as convertFromCents,I as disclaimerData,P as transformYupErrorsIntoObject,cr as useContractAmendment,T as useCostCalculator,R as useCostCalculatorEstimationPdf,ir as useEmploymentQuery,nr as useTimeOffQuery,z as zendeskArticles};
1
+ import"./chunk-6NXC6SLB.js";import{a as dr}from"./chunk-2ERB4H3T.js";import{a as lr}from"./chunk-PBXZVY22.js";import"./chunk-FQPU3JBJ.js";import"./chunk-Z6M74RQ7.js";import"./chunk-TPHCKHYD.js";import"./chunk-W2PPGQL6.js";import"./chunk-AHUK7NSK.js";import"./chunk-E5PSJ75C.js";import"./chunk-S4XU4SE7.js";import"./chunk-GULCZWSK.js";import"./chunk-73A7SYGH.js";import"./chunk-6F66NTNI.js";import"./chunk-7SR3FCW6.js";import"./chunk-6NIRGHFF.js";import"./chunk-MRYRNB7Y.js";import"./chunk-Z3BMF4BO.js";import{a as N}from"./chunk-7CHZ25AS.js";import"./chunk-NVMZDPMF.js";import"./chunk-E5YN6OT3.js";import{a as D}from"./chunk-R2UI3WAJ.js";import{a as j}from"./chunk-JIRA6B5O.js";import"./chunk-4RULC3AZ.js";import"./chunk-BZIVYUMH.js";import"./chunk-BE54D4XM.js";import"./chunk-RM3HE733.js";import"./chunk-7DKOWSJ3.js";import"./chunk-XJVYASHX.js";import"./chunk-ZE3YT3Q6.js";import{a as pr}from"./chunk-Y373YLLS.js";import"./chunk-5KHLOGTR.js";import"./chunk-LYF7ISYE.js";import"./chunk-P6JDGCDA.js";import"./chunk-H6NMRBGZ.js";import"./chunk-U4HGV7LP.js";import"./chunk-P5CLILU4.js";import"./chunk-LUUUPLTW.js";import"./chunk-Z7WBY27D.js";import"./chunk-OMECCA6L.js";import"./chunk-KVNG6CWQ.js";import"./chunk-PGWKJ6FK.js";import"./chunk-PUSPB4CX.js";import"./chunk-VAIBLWOY.js";import"./chunk-OD37LQSP.js";import"./chunk-F66G33YT.js";import{a as A}from"./chunk-HQI6W7PR.js";import{a as I}from"./chunk-DYB3RWP7.js";import{a as _}from"./chunk-MAHR7HCO.js";import{b as F,d as T}from"./chunk-GPBU6CQP.js";import"./chunk-5NPHBFW7.js";import{a as z}from"./chunk-32GSS4UM.js";import"./chunk-VFRHMNLJ.js";import"./chunk-J7JO4GF4.js";import"./chunk-AS6DCKEJ.js";import"./chunk-WVJDCDGZ.js";import{a as B}from"./chunk-2EN2X5NU.js";import{a as S}from"./chunk-7EI4E76I.js";import{a as E}from"./chunk-H77RIB6S.js";import{d as R}from"./chunk-YDNOMXS7.js";import"./chunk-HN5HLFTB.js";import"./chunk-KSHK3ZPX.js";import"./chunk-A7ZJQCNU.js";import{a as sr}from"./chunk-Y4C57RXK.js";import{a as er}from"./chunk-27PK3DVV.js";import"./chunk-CFIJKJXD.js";import"./chunk-NNM5M4E3.js";import"./chunk-5NDSOA6K.js";import"./chunk-ZTDKPUB5.js";import{a as or}from"./chunk-PHGCCQZ2.js";import{a as cr}from"./chunk-XVTAPI3Z.js";import{a as ir,b as nr}from"./chunk-TDQVKDQW.js";import"./chunk-QW4JPW6J.js";import"./chunk-3AEKPMIN.js";import"./chunk-JBUNDNKJ.js";import"./chunk-CRXPRR3R.js";import"./chunk-UHS3QRA3.js";import"./chunk-LBUNJ5J3.js";import"./chunk-5ISPIMTZ.js";import"./chunk-ANXYPRBG.js";import"./chunk-F2E56YE2.js";import"./chunk-GP237GUO.js";import"./chunk-TXSJL3HC.js";import"./chunk-ZX5OIIJX.js";import"./chunk-INC2YFDP.js";import"./chunk-UH3E6HSQ.js";import"./chunk-W5DG5WWJ.js";import"./chunk-GC23RRCI.js";import"./chunk-XSHHMBMT.js";import"./chunk-XFD3ULUF.js";import"./chunk-N6G4VZXF.js";import{a as v}from"./chunk-E3QWREZF.js";import"./chunk-PJBAQZ6G.js";import"./chunk-Z5WMKCRJ.js";import"./chunk-BM3AKYMT.js";import"./chunk-7VUILYZ3.js";import{a as u,c as h}from"./chunk-3ZWDIEEM.js";import{a as tr}from"./chunk-DBDVBJDV.js";import"./chunk-3BREUYLG.js";import{b as C}from"./chunk-PAQW5BFW.js";import"./chunk-BI6U55BD.js";import"./chunk-TVZAFTPT.js";import{c as P,d as m}from"./chunk-3LOVCTCN.js";import{a as t}from"./chunk-P37U34EQ.js";import{QueryClient as $,QueryClientProvider as G}from"@tanstack/react-query";function d(r){let a=document.documentElement;Object.keys(r).forEach(e=>{let o=r[e];o&&a.style.setProperty(e,o)})}t(d,"setCssProperties");function O(r){let a={};return Object.keys(r).forEach(e=>{a[`--${e}`]=r[e]}),a}t(O,"mapThemeColors");function K(r){return{"--spacing":r}}t(K,"mapThemeSpacing");function V(r){return{"--radius":r}}t(V,"mapThemeBorderRadius");function U(r){return{"--fontSizeBase":r.fontSizeBase}}t(U,"mapThemeFont");function w(r){r?.colors&&d(O(r.colors)),r?.spacing&&d(K(r.spacing)),r?.borderRadius&&d(V(r.borderRadius)),r?.font&&d(U(r.font))}t(w,"applyTheme");import{createContext as W,useEffect as M,useMemo as L}from"react";import{jsx as Q}from"react/jsx-runtime";var q=W({theme:{}});function f(r){M(()=>{r.theme&&Object.keys(r.theme).length>0&&w(r.theme)},[r.theme]);let a=L(()=>({theme:r.theme}),[r.theme]);return Q(q.Provider,{value:a,children:r.children})}t(f,"ThemeProvider");var x={local:"http://localhost:4000/api/eor",partners:"https://gateway.partners.remote-sandbox.com",production:"https://gateway.remote.com",sandbox:"https://gateway.remote-sandbox.com",staging:"https://gateway.niceremote.com"};import{createClient as X}from"@hey-api/client-fetch";import{useQuery as Y}from"@tanstack/react-query";import{useRef as b}from"react";function Z(r){try{return new URL(r),!0}catch{return!1}}t(Z,"isValidUrl");var y=t(({auth:r,options:a,authId:e="default"})=>{let o=b(null),{refetch:c}=Y({queryKey:["auth",e],queryFn:r,enabled:!1}),s=a?.environment?x[a?.environment]:"https://gateway.remote.com",l=v.getConfig(),g="0.19.0";a?.environment&&a?.environment!=="production"&&m(g);let p=!!a?.proxy&&Z(a.proxy.url);return a?.proxy&&!p&&console.error("Invalid proxy URL provided. Using default base URL."),b(X({...l,headers:{...l.headers,...p?a?.proxy?.headers:{},"X-Client-Name":"remote-flows-sdk","X-Client-Version":g},baseUrl:p?a.proxy?.url:s,auth:t(async()=>{function k(i){return!i||Date.now()+6e4>i}if(t(k,"hasTokenExpired"),!o.current||k(o.current.expiresAt)){let{data:i}=await c();i&&(o.current={accessToken:i.accessToken,expiresAt:Date.now()+i.expiresIn*1e3})}return o.current?.accessToken},"auth")}))},"useAuth");import{jsx as n}from"react/jsx-runtime";var H=new $;function J({children:r,auth:a,authId:e,proxy:o,environment:c}){let s=y({auth:a,authId:e,options:{proxy:o,environment:c}});return n(h.Provider,{value:{client:s.current},children:r})}t(J,"RemoteFlowContextWrapper");function rr({children:r,components:a}){return n(u.Provider,{value:a?{components:a}:{components:{}},children:r})}t(rr,"FormFieldsProvider");function ar({auth:r,authId:a,children:e,components:o,theme:c,proxy:s,environment:l}){return n(G,{client:H,children:n(rr,{components:o,children:n(J,{auth:r,authId:a,proxy:s,environment:l,children:n(f,{theme:c,children:e})})})})}t(ar,"RemoteFlows");export{tr as ContractAmendmentConfirmationForm,sr as ContractAmendmentFlow,er as ContractAmendmentForm,or as ContractAmendmentSubmit,A as CostCalculatorDisclaimer,_ as CostCalculatorFlow,B as CostCalculatorForm,S as CostCalculatorResetButton,N as CostCalculatorResults,E as CostCalculatorSubmitButton,j as EstimationResults,pr as OnboardingFlow,ar as RemoteFlows,D as SummaryResults,dr as TerminationDialogInfoContent,lr as TerminationFlow,F as buildCostCalculatorEstimationPayload,C as convertFromCents,I as disclaimerData,P as transformYupErrorsIntoObject,cr as useContractAmendment,T as useCostCalculator,R as useCostCalculatorEstimationPdf,ir as useEmploymentQuery,nr as useTimeOffQuery,z as zendeskArticles};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/RemoteFlowsProvider.tsx","../src/lib/applyTheme.ts","../src/theme.tsx","../src/environments.ts","../src/useAuth.ts"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport { ThemeProvider } from '@/src/theme';\nimport { FormFieldsContext, RemoteFlowContext } from './context';\nimport { Components, RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { useAuth } from './useAuth';\n\nconst queryClient = new QueryClient();\n\ntype RemoteFlowContextWrapperProps = {\n auth: RemoteFlowsSDKProps['auth'];\n children: React.ReactNode;\n environment?: RemoteFlowsSDKProps['environment'];\n proxy?: RemoteFlowsSDKProps['proxy'];\n authId?: RemoteFlowsSDKProps['authId'];\n};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n authId,\n proxy,\n environment,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\n authId,\n options: {\n proxy,\n environment,\n },\n });\n return (\n <RemoteFlowContext.Provider value={{ client: remoteApiClient.current }}>\n {children}\n </RemoteFlowContext.Provider>\n );\n}\n\nexport function FormFieldsProvider({\n children,\n components,\n}: PropsWithChildren<{\n components?: Components;\n}>) {\n return (\n <FormFieldsContext.Provider\n value={components ? { components } : { components: {} }}\n >\n {children}\n </FormFieldsContext.Provider>\n );\n}\n\nexport function RemoteFlows({\n auth,\n authId,\n children,\n components,\n theme,\n proxy,\n environment,\n}: PropsWithChildren<RemoteFlowsSDKProps>) {\n return (\n <QueryClientProvider client={queryClient}>\n <FormFieldsProvider components={components}>\n <RemoteFlowContextWrapper\n auth={auth}\n authId={authId}\n proxy={proxy}\n environment={environment}\n >\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </RemoteFlowContextWrapper>\n </FormFieldsProvider>\n </QueryClientProvider>\n );\n}\n","import {\n CssThemeBorder,\n CssThemeColors,\n CssThemeFont,\n CssThemeSpacing,\n ThemeColors,\n ThemeFont,\n ThemeProviderProps,\n} from '@/src/types/theme';\n\nfunction setCssProperties(variables: Record<string, string>) {\n const root = document.documentElement;\n Object.keys(variables).forEach((v) => {\n const propertyVal = variables[v];\n if (propertyVal) {\n root.style.setProperty(v, propertyVal);\n }\n });\n}\n\nfunction mapThemeColors(colors: ThemeColors): CssThemeColors {\n const result: CssThemeColors = {};\n Object.keys(colors).forEach((key) => {\n result[`--${key}` as keyof CssThemeColors] =\n colors[key as keyof ThemeColors];\n });\n return result;\n}\n\nfunction mapThemeSpacing(spacing: string): CssThemeSpacing {\n return {\n '--spacing': spacing,\n };\n}\n\nfunction mapThemeBorderRadius(borderRadius: string): CssThemeBorder {\n return {\n '--radius': borderRadius,\n };\n}\n\nfunction mapThemeFont(font: ThemeFont): CssThemeFont {\n return {\n '--fontSizeBase': font.fontSizeBase,\n };\n}\n\nexport function applyTheme(theme: ThemeProviderProps['theme']) {\n if (theme?.colors) {\n setCssProperties(mapThemeColors(theme.colors));\n }\n\n if (theme?.spacing) {\n setCssProperties(mapThemeSpacing(theme.spacing));\n }\n\n if (theme?.borderRadius) {\n setCssProperties(mapThemeBorderRadius(theme.borderRadius));\n }\n\n if (theme?.font) {\n setCssProperties(mapThemeFont(theme.font));\n }\n}\n","import { applyTheme } from '@/src/lib/applyTheme';\nimport { createContext, useEffect, useMemo } from 'react';\nimport { ThemeProviderProps } from './types/theme';\n\nconst ThemeContext = createContext<Omit<ThemeProviderProps, 'children'>>({\n theme: {},\n});\n\nexport function ThemeProvider(props: ThemeProviderProps) {\n useEffect(() => {\n if (props.theme && Object.keys(props.theme).length > 0) {\n applyTheme(props.theme);\n }\n }, [props.theme]);\n\n const value = useMemo(() => {\n return { theme: props.theme };\n }, [props.theme]);\n\n return (\n <ThemeContext.Provider value={value}>\n {props.children}\n </ThemeContext.Provider>\n );\n}\n","export const ENVIRONMENTS = {\n local: 'http://localhost:4000/api/eor',\n partners: 'https://gateway.partners.remote-sandbox.com',\n production: 'https://gateway.remote.com',\n sandbox: 'https://gateway.remote-sandbox.com',\n staging: 'https://gateway.niceremote.com',\n};\n","import { client } from '@/src/client/client.gen';\nimport { ENVIRONMENTS } from '@/src/environments';\nimport { createClient } from '@hey-api/client-fetch';\nimport { useQuery } from '@tanstack/react-query';\nimport { useRef } from 'react';\nimport { RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { debug } from './lib/utils';\n\ntype AuthResponse = {\n accessToken: string;\n expiresIn: number;\n};\n\ntype Options = Partial<{\n environment: keyof typeof ENVIRONMENTS;\n proxy: RemoteFlowsSDKProps['proxy'];\n}>;\n\nfunction isValidUrl(url: string) {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const useAuth = ({\n auth,\n options,\n authId = 'default',\n}: {\n auth: () => Promise<AuthResponse>;\n options?: Options;\n authId?: 'default' | 'client';\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth', authId],\n queryFn: auth,\n enabled: false,\n });\n\n const baseUrl = options?.environment\n ? ENVIRONMENTS[options?.environment]\n : process.env.REMOTE_GATEWAY_URL;\n\n const clientConfig = client.getConfig();\n const npmPackageVersion = process.env.VERSION || 'unknown';\n\n if (options?.environment && options?.environment !== 'production') {\n debug(npmPackageVersion);\n }\n\n const isValidProxy = !!options?.proxy && isValidUrl(options.proxy.url);\n\n if (options?.proxy && !isValidProxy) {\n console.error('Invalid proxy URL provided. Using default base URL.');\n }\n\n return useRef(\n createClient({\n ...clientConfig,\n headers: {\n ...clientConfig.headers,\n ...(isValidProxy ? options?.proxy?.headers : {}),\n 'X-Client-Name': 'remote-flows-sdk',\n 'X-Client-Version': npmPackageVersion,\n },\n baseUrl: isValidProxy ? options.proxy?.url : baseUrl,\n auth: async () => {\n function hasTokenExpired(expiresAt: number | undefined) {\n return !expiresAt || Date.now() + 60000 > expiresAt;\n }\n if (!session.current || hasTokenExpired(session.current.expiresAt)) {\n const { data } = await refetch();\n if (data) {\n session.current = {\n accessToken: data.accessToken,\n expiresAt: Date.now() + data.expiresIn * 1000,\n };\n }\n }\n return session.current?.accessToken;\n },\n }),\n );\n};\n"],"mappings":"qiGAAA,OAAS,eAAAA,EAAa,uBAAAC,MAA2B,wBCUjD,SAASC,EAAiBC,EAAmC,CAC3D,IAAMC,EAAO,SAAS,gBACtB,OAAO,KAAKD,CAAS,EAAE,QAASE,GAAM,CACpC,IAAMC,EAAcH,EAAUE,CAAC,EAC3BC,GACFF,EAAK,MAAM,YAAYC,EAAGC,CAAW,CAEzC,CAAC,CACH,CARSC,EAAAL,EAAA,oBAUT,SAASM,EAAeC,EAAqC,CAC3D,IAAMC,EAAyB,CAAC,EAChC,cAAO,KAAKD,CAAM,EAAE,QAASE,GAAQ,CACnCD,EAAO,KAAKC,CAAG,EAA0B,EACvCF,EAAOE,CAAwB,CACnC,CAAC,EACMD,CACT,CAPSH,EAAAC,EAAA,kBAST,SAASI,EAAgBC,EA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c,IAAIC,EAUxB,SAASC,EAAyB,CAChC,SAAAC,EACA,KAAAC,EACA,OAAAC,EACA,MAAAC,EACA,YAAAC,CACF,EAAkC,CAChC,IAAMC,EAAkBC,EAAQ,CAC9B,KAAAL,EACA,OAAAC,EACA,QAAS,CACP,MAAAC,EACA,YAAAC,CACF,CACF,CAAC,EACD,OACER,EAACW,EAAkB,SAAlB,CAA2B,MAAO,CAAE,OAAQF,EAAgB,OAAQ,EAClE,SAAAL,EACH,CAEJ,CApBSQ,EAAAT,EAAA,4BAsBF,SAASU,GAAmB,CACjC,SAAAT,EACA,WAAAU,CACF,EAEI,CACF,OACEd,EAACe,EAAkB,SAAlB,CACC,MAAOD,EAAa,CAAE,WAAAA,CAAW,EAAI,CAAE,WAAY,CAAC,CAAE,EAErD,SAAAV,EACH,CAEJ,CAbgBQ,EAAAC,GAAA,sBAeT,SAASG,GAAY,CAC1B,KAAAX,EACA,OAAAC,EACA,SAAAF,EACA,WAAAU,EACA,MAAAG,EACA,MAAAV,EACA,YAAAC,CACF,EAA2C,CACzC,OACER,EAACkB,EAAA,CAAoB,OAAQjB,EAC3B,SAAAD,EAACa,GAAA,CAAmB,WAAYC,EAC9B,SAAAd,EAACG,EAAA,CACC,KAAME,EACN,OAAQC,EACR,MAAOC,EACP,YAAaC,EAEb,SAAAR,EAACmB,EAAA,CAAc,MAAOF,EAAQ,SAAAb,EAAS,EACzC,EACF,EACF,CAEJ,CAvBgBQ,EAAAI,GAAA","names":["QueryClient","QueryClientProvider","setCssProperties","variables","root","v","propertyVal","__name","mapThemeColors","colors","result","key","mapThemeSpacing","spacing","mapThemeBorderRadius","borderRadius","mapThemeFont","font","applyTheme","theme","createContext","useEffect","useMemo","jsx","ThemeContext","createContext","ThemeProvider","props","useEffect","applyTheme","value","useMemo","__name","ENVIRONMENTS","createClient","useQuery","useRef","isValidUrl","url","__name","useAuth","auth","options","authId","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","debug","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","authId","proxy","environment","remoteApiClient","useAuth","RemoteFlowContext","__name","FormFieldsProvider","components","FormFieldsContext","RemoteFlows","theme","QueryClientProvider","ThemeProvider"]}
1
+ {"version":3,"sources":["../src/RemoteFlowsProvider.tsx","../src/lib/applyTheme.ts","../src/theme.tsx","../src/environments.ts","../src/useAuth.ts"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport { ThemeProvider } from '@/src/theme';\nimport { FormFieldsContext, RemoteFlowContext } from './context';\nimport { Components, RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { useAuth } from './useAuth';\n\nconst queryClient = new QueryClient();\n\ntype RemoteFlowContextWrapperProps = {\n auth: RemoteFlowsSDKProps['auth'];\n children: React.ReactNode;\n environment?: RemoteFlowsSDKProps['environment'];\n proxy?: RemoteFlowsSDKProps['proxy'];\n authId?: RemoteFlowsSDKProps['authId'];\n};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n authId,\n proxy,\n environment,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\n authId,\n options: {\n proxy,\n environment,\n },\n });\n return (\n <RemoteFlowContext.Provider value={{ client: remoteApiClient.current }}>\n {children}\n </RemoteFlowContext.Provider>\n );\n}\n\nexport function FormFieldsProvider({\n children,\n components,\n}: PropsWithChildren<{\n components?: Components;\n}>) {\n return (\n <FormFieldsContext.Provider\n value={components ? { components } : { components: {} }}\n >\n {children}\n </FormFieldsContext.Provider>\n );\n}\n\nexport function RemoteFlows({\n auth,\n authId,\n children,\n components,\n theme,\n proxy,\n environment,\n}: PropsWithChildren<RemoteFlowsSDKProps>) {\n return (\n <QueryClientProvider client={queryClient}>\n <FormFieldsProvider components={components}>\n <RemoteFlowContextWrapper\n auth={auth}\n authId={authId}\n proxy={proxy}\n environment={environment}\n >\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </RemoteFlowContextWrapper>\n </FormFieldsProvider>\n </QueryClientProvider>\n );\n}\n","import {\n CssThemeBorder,\n CssThemeColors,\n CssThemeFont,\n CssThemeSpacing,\n ThemeColors,\n ThemeFont,\n ThemeProviderProps,\n} from '@/src/types/theme';\n\nfunction setCssProperties(variables: Record<string, string>) {\n const root = document.documentElement;\n Object.keys(variables).forEach((v) => {\n const propertyVal = variables[v];\n if (propertyVal) {\n root.style.setProperty(v, propertyVal);\n }\n });\n}\n\nfunction mapThemeColors(colors: ThemeColors): CssThemeColors {\n const result: CssThemeColors = {};\n Object.keys(colors).forEach((key) => {\n result[`--${key}` as keyof CssThemeColors] =\n colors[key as keyof ThemeColors];\n });\n return result;\n}\n\nfunction mapThemeSpacing(spacing: string): CssThemeSpacing {\n return {\n '--spacing': spacing,\n };\n}\n\nfunction mapThemeBorderRadius(borderRadius: string): CssThemeBorder {\n return {\n '--radius': borderRadius,\n };\n}\n\nfunction mapThemeFont(font: ThemeFont): CssThemeFont {\n return {\n '--fontSizeBase': font.fontSizeBase,\n };\n}\n\nexport function applyTheme(theme: ThemeProviderProps['theme']) {\n if (theme?.colors) {\n setCssProperties(mapThemeColors(theme.colors));\n }\n\n if (theme?.spacing) {\n setCssProperties(mapThemeSpacing(theme.spacing));\n }\n\n if (theme?.borderRadius) {\n setCssProperties(mapThemeBorderRadius(theme.borderRadius));\n }\n\n if (theme?.font) {\n setCssProperties(mapThemeFont(theme.font));\n }\n}\n","import { applyTheme } from '@/src/lib/applyTheme';\nimport { createContext, useEffect, useMemo } from 'react';\nimport { ThemeProviderProps } from './types/theme';\n\nconst ThemeContext = createContext<Omit<ThemeProviderProps, 'children'>>({\n theme: {},\n});\n\nexport function ThemeProvider(props: ThemeProviderProps) {\n useEffect(() => {\n if (props.theme && Object.keys(props.theme).length > 0) {\n applyTheme(props.theme);\n }\n }, [props.theme]);\n\n const value = useMemo(() => {\n return { theme: props.theme };\n }, [props.theme]);\n\n return (\n <ThemeContext.Provider value={value}>\n {props.children}\n </ThemeContext.Provider>\n );\n}\n","export const ENVIRONMENTS = {\n local: 'http://localhost:4000/api/eor',\n partners: 'https://gateway.partners.remote-sandbox.com',\n production: 'https://gateway.remote.com',\n sandbox: 'https://gateway.remote-sandbox.com',\n staging: 'https://gateway.niceremote.com',\n};\n","import { client } from '@/src/client/client.gen';\nimport { ENVIRONMENTS } from '@/src/environments';\nimport { createClient } from '@hey-api/client-fetch';\nimport { useQuery } from '@tanstack/react-query';\nimport { useRef } from 'react';\nimport { RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { debug } from './lib/utils';\n\ntype AuthResponse = {\n accessToken: string;\n expiresIn: number;\n};\n\ntype Options = Partial<{\n environment: keyof typeof ENVIRONMENTS;\n proxy: RemoteFlowsSDKProps['proxy'];\n}>;\n\nfunction isValidUrl(url: string) {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const useAuth = ({\n auth,\n options,\n authId = 'default',\n}: {\n auth: () => Promise<AuthResponse>;\n options?: Options;\n authId?: 'default' | 'client';\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth', authId],\n queryFn: auth,\n enabled: false,\n });\n\n const baseUrl = options?.environment\n ? ENVIRONMENTS[options?.environment]\n : process.env.REMOTE_GATEWAY_URL;\n\n const clientConfig = client.getConfig();\n const npmPackageVersion = process.env.VERSION || 'unknown';\n\n if (options?.environment && options?.environment !== 'production') {\n debug(npmPackageVersion);\n }\n\n const isValidProxy = !!options?.proxy && isValidUrl(options.proxy.url);\n\n if (options?.proxy && !isValidProxy) {\n console.error('Invalid proxy URL provided. Using default base URL.');\n }\n\n return useRef(\n createClient({\n ...clientConfig,\n headers: {\n ...clientConfig.headers,\n ...(isValidProxy ? options?.proxy?.headers : {}),\n 'X-Client-Name': 'remote-flows-sdk',\n 'X-Client-Version': npmPackageVersion,\n },\n baseUrl: isValidProxy ? options.proxy?.url : baseUrl,\n auth: async () => {\n function hasTokenExpired(expiresAt: number | undefined) {\n return !expiresAt || Date.now() + 60000 > expiresAt;\n }\n if (!session.current || hasTokenExpired(session.current.expiresAt)) {\n const { data } = await refetch();\n if (data) {\n session.current = {\n accessToken: data.accessToken,\n expiresAt: Date.now() + data.expiresIn * 1000,\n };\n }\n }\n return session.current?.accessToken;\n },\n }),\n );\n};\n"],"mappings":"kqGAAA,OAAS,eAAAA,EAAa,uBAAAC,MAA2B,wBCUjD,SAASC,EAAiBC,EAAmC,CAC3D,IAAMC,EAAO,SAAS,gBACtB,OAAO,KAAKD,CAAS,EAAE,QAASE,GAAM,CACpC,IAAMC,EAAcH,EAAUE,CAAC,EAC3BC,GACFF,EAAK,MAAM,YAAYC,EAAGC,CAAW,CAEzC,CAAC,CACH,CARSC,EAAAL,EAAA,oBAUT,SAASM,EAAeC,EAAqC,CAC3D,IAAMC,EAAyB,CAAC,EAChC,cAAO,KAAKD,CAAM,EAAE,QAASE,GAAQ,CACnCD,EAAO,KAAKC,CAAG,EAA0B,EACvCF,EAAOE,CAAwB,CACnC,CAAC,EACMD,CACT,CAPSH,EAAAC,EAAA,kBAST,SAASI,EAAgBC,EAAkC,CACzD,MAAO,CACL,YAAaA,CACf,CACF,CAJSN,EAAAK,EAAA,mBAMT,SAASE,EAAqBC,EAAsC,CAClE,MAAO,CACL,WAAYA,CACd,CACF,CAJSR,EAAAO,EAAA,wBAMT,SAASE,EAAaC,EAA+B,CACnD,MAAO,CACL,iBAAkBA,EAAK,YACzB,CACF,CAJSV,EAAAS,EAAA,gBAMF,SAASE,EAAWC,EAAoC,CACzDA,GAAO,QACTjB,EAAiBM,EAAeW,EAAM,MAAM,CAAC,EAG3CA,GAAO,SACTjB,EAAiBU,EAAgBO,EAAM,OAAO,CAAC,EAG7CA,GAAO,cACTjB,EAAiBY,EAAqBK,EAAM,YAAY,CAAC,EAGvDA,GAAO,MACTjB,EAAiBc,EAAaG,EAAM,IAAI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,CAAE,EAErD,SAAAV,EACH,CAEJ,CAbgBQ,EAAAC,GAAA,sBAeT,SAASG,GAAY,CAC1B,KAAAX,EACA,OAAAC,EACA,SAAAF,EACA,WAAAU,EACA,MAAAG,EACA,MAAAV,EACA,YAAAC,CACF,EAA2C,CACzC,OACER,EAACkB,EAAA,CAAoB,OAAQjB,EAC3B,SAAAD,EAACa,GAAA,CAAmB,WAAYC,EAC9B,SAAAd,EAACG,EAAA,CACC,KAAME,EACN,OAAQC,EACR,MAAOC,EACP,YAAaC,EAEb,SAAAR,EAACmB,EAAA,CAAc,MAAOF,EAAQ,SAAAb,EAAS,EACzC,EACF,EACF,CAEJ,CAvBgBQ,EAAAI,GAAA","names":["QueryClient","QueryClientProvider","setCssProperties","variables","root","v","propertyVal","__name","mapThemeColors","colors","result","key","mapThemeSpacing","spacing","mapThemeBorderRadius","borderRadius","mapThemeFont","font","applyTheme","theme","createContext","useEffect","useMemo","jsx","ThemeContext","createContext","ThemeProvider","props","useEffect","applyTheme","value","useMemo","__name","ENVIRONMENTS","createClient","useQuery","useRef","isValidUrl","url","__name","useAuth","auth","options","authId","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","debug","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","authId","proxy","environment","remoteApiClient","useAuth","RemoteFlowContext","__name","FormFieldsProvider","components","FormFieldsContext","RemoteFlows","theme","QueryClientProvider","ThemeProvider"]}
package/dist/internals.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as y,b as z,c as E,d as J}from"./chunk-CRXPRR3R.js";import{a as G,b as L,c as h,d as k,e as j,f as q}from"./chunk-UHS3QRA3.js";import{a as O}from"./chunk-N5I33LIN.js";import{a as F}from"./chunk-LBUNJ5J3.js";import{a as l,b as i,d as a,e as p,f as n}from"./chunk-ANXYPRBG.js";import{a as C,b as g,c as b,d as x,f,g as D,h as T,i as c,j as S,k as w,l as v,m as A,n as P,o as H,p as I,q as R,r as V,s as B}from"./chunk-ZSDJZMQW.js";import{a as d,b as u}from"./chunk-GP237GUO.js";import{a as t}from"./chunk-TXSJL3HC.js";import"./chunk-EGQJ7UBR.js";import"./chunk-3ZWDIEEM.js";import{a as s,b as m}from"./chunk-7VUILYZ3.js";import{a as o}from"./chunk-BI6U55BD.js";import{a as r}from"./chunk-3LOVCTCN.js";import"./chunk-P37U34EQ.js";import*as e from"@radix-ui/react-collapsible";var K=e.Root,M=e.CollapsibleTrigger,N=e.CollapsibleContent;export{R as Alert,B as AlertDescription,V as AlertTitle,u as Badge,m as Button,G as Card,j as CardContent,k as CardDescription,q as CardFooter,L as CardHeader,h as CardTitle,C as Checkbox,K as Collapsible,N as CollapsibleContent,M as CollapsibleTrigger,S as Dialog,v as DialogContent,I as DialogDescription,P as DialogFooter,A as DialogHeader,H as DialogTitle,w as DialogTrigger,l as Drawer,a as DrawerContent,p as DrawerHeader,n as DrawerTitle,i as DrawerTrigger,t as Input,o as Label,g as RadioGroup,b as RadioGroupItem,F as ScrollArea,x as Select,T as SelectContent,c as SelectItem,D as SelectTrigger,f as SelectValue,y as Tabs,J as TabsContent,z as TabsList,E as TabsTrigger,O as ZendeskTriggerButton,d as badgeVariants,s as buttonVariants,r as cn};
1
+ import{a as Q,b as R,c as S}from"./chunk-JBUNDNKJ.js";import{a as M,b as N,c as O,d as P}from"./chunk-CRXPRR3R.js";import{a as G,b as H,c as I,d as J,e as K,f as L}from"./chunk-UHS3QRA3.js";import{a as F}from"./chunk-LBUNJ5J3.js";import{a as i}from"./chunk-5ISPIMTZ.js";import{a as d,b as e,d as f,e as g,f as h}from"./chunk-ANXYPRBG.js";import{a as j,b as m,c as n,d as o,f as p,g as q,h as r,i as s,j as v,k as w,l as x,m as y,n as z,o as A,p as B,q as C,r as D,s as E}from"./chunk-F2E56YE2.js";import{a as t,b as u}from"./chunk-GP237GUO.js";import{a as c}from"./chunk-TXSJL3HC.js";import"./chunk-ZX5OIIJX.js";import"./chunk-E3QWREZF.js";import{a as k,b as l}from"./chunk-7VUILYZ3.js";import"./chunk-3ZWDIEEM.js";import{a as b}from"./chunk-BI6U55BD.js";import{a}from"./chunk-3LOVCTCN.js";import"./chunk-P37U34EQ.js";export{C as Alert,E as AlertDescription,D as AlertTitle,u as Badge,l as Button,G as Card,K as CardContent,J as CardDescription,L as CardFooter,H as CardHeader,I as CardTitle,j as Checkbox,Q as Collapsible,S as CollapsibleContent,R as CollapsibleTrigger,v as Dialog,x as DialogContent,B as DialogDescription,z as DialogFooter,y as DialogHeader,A as DialogTitle,w as DialogTrigger,d as Drawer,f as DrawerContent,g as DrawerHeader,h as DrawerTitle,e as DrawerTrigger,c as Input,b as Label,m as RadioGroup,n as RadioGroupItem,F as ScrollArea,o as Select,r as SelectContent,s as SelectItem,q as SelectTrigger,p as SelectValue,M as Tabs,P as TabsContent,N as TabsList,O as TabsTrigger,i as ZendeskTriggerButton,t as badgeVariants,k as buttonVariants,a as cn};
2
2
  //# sourceMappingURL=internals.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ui/collapsible.tsx"],"sourcesContent":["import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\n\nconst Collapsible = CollapsiblePrimitive.Root;\n\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\n\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n"],"mappings":"guBAAA,UAAYA,MAA0B,8BAEtC,IAAMC,EAAmC,OAEnCC,EAA0C,qBAE1CC,EAA0C","names":["CollapsiblePrimitive","Collapsible","CollapsibleTrigger","CollapsibleContent"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,7 +1,7 @@
1
1
  import { ControllerRenderProps, FieldValues, ControllerFieldState } from 'react-hook-form';
2
2
  import { PropsWithChildren, ReactNode } from 'react';
3
3
  import { AnySchema } from 'yup';
4
- import { I as HelpCenterArticle } from './types.gen-CaXCWhlP.js';
4
+ import { J as HelpCenterArticle } from './types.gen-BbxQoQYr.js';
5
5
  import { S as SupportedTypes } from './types-Zg1n_9wh.js';
6
6
 
7
7
  type ThemeProviderProps = PropsWithChildren<{
@@ -272,6 +272,14 @@ type Country = {
272
272
  subregion?: string | null;
273
273
  supported_json_schemas?: Array<string>;
274
274
  };
275
+ type CreateOffboardingParams = {
276
+ employment_id: string;
277
+ termination_details: TerminationDetailsParams;
278
+ /**
279
+ * The type of the offboarding request. For now, only `termination` is allowed.
280
+ */
281
+ type: 'termination';
282
+ };
275
283
  /**
276
284
  * The status of the user
277
285
  */
@@ -1392,4 +1400,4 @@ type PostInviteEmploymentInvitationErrors = {
1392
1400
  };
1393
1401
  type PostInviteEmploymentInvitationError = PostInviteEmploymentInvitationErrors[keyof PostInviteEmploymentInvitationErrors];
1394
1402
 
1395
- export type { MinimalCountry as A, EmploymentTermType as B, ContractAmendmentAutomatableResponse as C, CostCalculatorEmployment as D, EmploymentShowResponse as E, PostCreateOffboardingError as F, TimeoffStatus as G, Currency as H, HelpCenterArticle as I, ListTimeoffResponse as L, MinimalRegion as M, OffboardingResponse as O, PostAutomatableContractAmendmentError as P, SuccessResponse as S, TerminationDetailsParams as T, UnifiedEmploymentUpsertBenefitOffersRequest as U, ValidationError as V, ContractAmendmentResponse as a, PostCreateContractAmendmentError as b, CostCalculatorEstimateResponse as c, CostCalculatorEstimatePdfResponse as d, PostCreateEstimationPdfError as e, CostCalculatorEstimateParams as f, PostCreateEstimationError as g, Employment as h, Company as i, PostInviteEmploymentInvitationError as j, PostCreateRiskReserveError as k, EmploymentCreationResponse as l, PostCreateEmployment2Error as m, EmploymentCreateParams as n, EmploymentResponse as o, PatchUpdateEmployment2Error as p, EmploymentFullParams as q, PutUpdateBenefitOfferError as r, MagicLinkResponse as s, UnprocessableEntityResponse as t, MagicLinkParams as u, ConvertCurrencyResponse as v, PostConvertRawCurrencyConverterError as w, ConvertCurrencyParams as x, PostCreateContractEligibilityError as y, CreateContractEligibilityParams as z };
1403
+ export type { PostCreateContractEligibilityError as A, CreateContractEligibilityParams as B, CreateOffboardingParams as C, MinimalCountry as D, EmploymentShowResponse as E, EmploymentTermType as F, CostCalculatorEmployment as G, TimeoffStatus as H, Currency as I, HelpCenterArticle as J, ListTimeoffResponse as L, MinimalRegion as M, OffboardingResponse as O, PostCreateOffboardingError as P, SuccessResponse as S, TerminationDetailsParams as T, UnifiedEmploymentUpsertBenefitOffersRequest as U, ValidationError as V, ContractAmendmentAutomatableResponse as a, PostAutomatableContractAmendmentError as b, ContractAmendmentResponse as c, PostCreateContractAmendmentError as d, CostCalculatorEstimateResponse as e, CostCalculatorEstimatePdfResponse as f, PostCreateEstimationPdfError as g, CostCalculatorEstimateParams as h, PostCreateEstimationError as i, Employment as j, Company as k, PostInviteEmploymentInvitationError as l, PostCreateRiskReserveError as m, EmploymentCreationResponse as n, PostCreateEmployment2Error as o, EmploymentCreateParams as p, EmploymentResponse as q, PatchUpdateEmployment2Error as r, EmploymentFullParams as s, PutUpdateBenefitOfferError as t, MagicLinkResponse as u, UnprocessableEntityResponse as v, MagicLinkParams as w, ConvertCurrencyResponse as x, PostConvertRawCurrencyConverterError as y, ConvertCurrencyParams as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/remote-flows",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "scripts": {
5
5
  "build": "NODE_ENV=production tsup",
6
6
  "ci": "npm run build && npm run check-format && npm run check-exports && npm run lint && npm run type-check && npm run test",
@@ -1,2 +0,0 @@
1
- import{a as e}from"./chunk-VX2UC3HG.js";import{a as i}from"./chunk-XSHHMBMT.js";import{a as o}from"./chunk-JODJFARP.js";import{a as m}from"./chunk-W5DG5WWJ.js";var p={employee_communication:o,termination_details:e,paid_time_off:m,additional_information:i};export{p as a};
2
- //# sourceMappingURL=chunk-HSW5HMHH.js.map
@@ -1,2 +0,0 @@
1
- var e={data:{version:7,schema:{additionalProperties:!1,allOf:[{if:{properties:{personal_email:{pattern:"^[a-zA-Z0-9 .]+$"}}},then:{properties:{personal_email:{"x-jsf-presentation":{statement:{title:"Please make sure to add the employee personal email so we can get in contact with the employee after the termination process takes effect.",inputType:"statement",severity:"warning"}}}}}},{if:{properties:{customer_informed_employee:{const:"yes"}},required:["customer_informed_employee"]},then:{properties:{customer_informed_employee_date:{type:"string"},customer_informed_employee_description:{type:"string"}},required:["customer_informed_employee_date","customer_informed_employee_description"]},else:{properties:{customer_informed_employee_date:!1,customer_informed_employee_description:!1}}}],properties:{confidential:{description:"Confidential requests are visible only to you. Non-confidential requests are visible to all admins in your company.",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Is this request confidential?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio",statement:{title:"Please do not inform the employee of their termination until we review your request for legal risks. When we approve your request, you can inform the employee and we'll take it from there.",inputType:"statement",severity:"warning"}}},customer_informed_employee:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Have you informed the employee of the termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},customer_informed_employee_date:{description:"",format:"date",maxLength:255,title:"When the employee was told about the termination",type:["string","null"],"x-jsf-presentation":{inputType:"date"}},customer_informed_employee_description:{description:"",maxLength:1e3,title:"How did you share this information?",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},personal_email:{description:"",maxLength:255,title:"Employee's personal email",format:"email",type:"string","x-jsf-presentation":{inputType:"email"}}},required:["confidential","customer_informed_employee","personal_email"],type:"object","x-jsf-order":["is_confidential","customer_informed_employee","customer_informed_employee_date","customer_informed_employee_description","personal_email"]}}};export{e as a};
2
- //# sourceMappingURL=chunk-JODJFARP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Termination/json-schemas/employeeComunication.ts"],"sourcesContent":["export const employeeComunicationSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n personal_email: {\n pattern: '^[a-zA-Z0-9 .]+$',\n },\n },\n },\n then: {\n properties: {\n personal_email: {\n 'x-jsf-presentation': {\n statement: {\n title:\n 'Please make sure to add the employee personal email so we can get in contact with the employee after the termination process takes effect.',\n inputType: 'statement',\n severity: 'warning',\n },\n },\n },\n },\n },\n },\n {\n if: {\n properties: {\n customer_informed_employee: {\n const: 'yes',\n },\n },\n required: ['customer_informed_employee'],\n },\n then: {\n properties: {\n customer_informed_employee_date: {\n type: 'string',\n },\n customer_informed_employee_description: {\n type: 'string',\n },\n },\n required: [\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n ],\n },\n else: {\n properties: {\n customer_informed_employee_date: false,\n customer_informed_employee_description: false,\n },\n },\n },\n ],\n properties: {\n confidential: {\n description:\n 'Confidential requests are visible only to you. Non-confidential requests are visible to all admins in your company.',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Is this request confidential?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n statement: {\n title:\n \"Please do not inform the employee of their termination until we review your request for legal risks. When we approve your request, you can inform the employee and we'll take it from there.\",\n inputType: 'statement',\n severity: 'warning',\n },\n },\n },\n customer_informed_employee: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Have you informed the employee of the termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n customer_informed_employee_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'When the employee was told about the termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n customer_informed_employee_description: {\n description: '',\n maxLength: 1000,\n title: 'How did you share this information?',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n personal_email: {\n description: '',\n maxLength: 255,\n title: \"Employee's personal email\",\n format: 'email',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'email',\n },\n },\n },\n required: [\n 'confidential',\n 'customer_informed_employee',\n 'personal_email',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'is_confidential',\n 'customer_informed_employee',\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n 'personal_email',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAA6B,CACxC,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CACL,CACE,GAAI,CACF,WAAY,CACV,eAAgB,CACd,QAAS,kBACX,CACF,CACF,EACA,KAAM,CACJ,WAAY,CACV,eAAgB,CACd,qBAAsB,CACpB,UAAW,CACT,MACE,6IACF,UAAW,YACX,SAAU,SACZ,CACF,CACF,CACF,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,gCAAiC,CAC/B,KAAM,QACR,EACA,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CACR,kCACA,wCACF,CACF,EACA,KAAM,CACJ,WAAY,CACV,gCAAiC,GACjC,uCAAwC,EAC1C,CACF,CACF,CACF,EACA,WAAY,CACV,aAAc,CACZ,YACE,sHACF,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,gCACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,QACX,UAAW,CACT,MACE,+LACF,UAAW,YACX,SAAU,SACZ,CACF,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,qDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,gCAAiC,CAC/B,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,mDACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,MACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MAAO,sCACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,eAAgB,CACd,YAAa,GACb,UAAW,IACX,MAAO,4BACP,OAAQ,QACR,KAAM,SACN,qBAAsB,CACpB,UAAW,OACb,CACF,CACF,EACA,SAAU,CACR,eACA,6BACA,gBACF,EACA,KAAM,SACN,cAAe,CACb,kBACA,6BACA,kCACA,yCACA,gBACF,CACF,CACF,CACF","names":["employeeComunicationSchema"]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-M22FKNEY.js.map
@@ -1,2 +0,0 @@
1
- var e={disclaimerCostCalculator:4668194326797,employeeOnboardingTimeline:4411262104589,extraPayments:4466822781709,internationalPricing:4410698586893,remoteFxRate:33271144977421};export{e as a};
2
- //# sourceMappingURL=chunk-NBCZF2FO.js.map
@@ -1,2 +0,0 @@
1
- import{c as f,d}from"./chunk-NTEIOU72.js";import{a as u}from"./chunk-HN5HLFTB.js";import{a as m}from"./chunk-KSHK3ZPX.js";import{b as C}from"./chunk-CFIJKJXD.js";import{f as y}from"./chunk-3BREUYLG.js";import{a as c}from"./chunk-P37U34EQ.js";import{useEffect as h,useId as b,useState as B}from"react";import{jsx as E}from"react/jsx-runtime";var i=c((r,e,o)=>o&&o[e]?o[e]:r[e]?r[e]/100:0,"getDefaultManagementFee"),T=c(({estimationOptions:r=f,defaultValues:e={countryRegionSlug:"",currencySlug:"",salary:"",benefits:{}},options:o,render:S,version:p="standard"})=>{let F=b(),[R,g]=B("USD"),_=c(s=>{g(s);let t=i(u,s,r.managementFees);t&&a.setValue("management.management_fee",t)},"onCurrencyChange"),n=d({defaultRegion:e.countryRegionSlug,defaultCurrency:e.currencySlug,defaultSalary:e.salary,estimationOptions:r,version:p,options:{...o,onCurrencyChange:_}}),v=C(n.handleValidation),K=e.currencySlug?"":i(u,R,r.managementFees),a=y({resolver:v,defaultValues:{country:e?.countryRegionSlug,currency:e?.currencySlug,region:"",salary:e?.salary,salary_conversion:"",salary_converted:"",hiring_budget:e?.hiringBudget||"employee_annual_salary",management:{management_fee:K},benefits:e?.benefits,estimation_title:r.title},shouldUnregister:!1,mode:"onBlur"});return h(()=>{if(e.currencySlug&&n.currencies&&r.includeManagementFee){let t=n.currencies.find(l=>l.value===e.currencySlug)?.label;if(t){g(t);let l=i(u,t,r.managementFees);a.setValue("management.management_fee",l)}}},[e.currencySlug,n.currencies,r.includeManagementFee,r.managementFees,a]),E(m.Provider,{value:{form:a,formId:F,costCalculatorBag:n},children:S(n)})},"CostCalculatorFlow");export{T as a};
2
- //# sourceMappingURL=chunk-NGJXBBXW.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/CostCalculator/CostCalculatorFlow.tsx"],"sourcesContent":["import React, { useEffect, useId, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { useJsonSchemasValidationFormResolver } from '@/src/components/form/yupValidationResolver';\nimport { CostCalculatorContext } from '@/src/flows/CostCalculator/context';\nimport {\n CostCalculatorVersion,\n defaultEstimationOptions,\n useCostCalculator,\n} from '@/src/flows/CostCalculator/hooks';\nimport {\n CostCalculatorEstimationOptions,\n CurrencyKey,\n UseCostCalculatorOptions,\n} from '@/src/flows/CostCalculator/types';\nimport { BASE_RATES } from '@/src/flows/CostCalculator/constants';\n\nexport type CostCalculatorFlowProps = {\n /**\n * Estimation params allows you to customize the parameters sent to the /cost-calculator/estimation endpoint.\n */\n estimationOptions?: CostCalculatorEstimationOptions;\n /**\n * Default values for the form fields.\n */\n defaultValues?: Partial<{\n /**\n * Default value for the country field.\n */\n countryRegionSlug: string;\n /**\n * Default value for the currency field.\n */\n currencySlug: string;\n /**\n * Default value for the salary field.\n */\n salary: string;\n /**\n * Default value for the benefits field.\n */\n benefits: Record<string, string>;\n /**\n * Default value for the hiring budget field\n */\n hiringBudget: string;\n }>;\n options?: UseCostCalculatorOptions;\n render: (\n costCalculatorBag: ReturnType<typeof useCostCalculator>,\n ) => React.ReactNode;\n /**\n * Whether to include annual_gross_salary in the estimation payload\n */\n version?: CostCalculatorVersion;\n};\n\nconst getDefaultManagementFee = (\n baseRates: Record<CurrencyKey, number>,\n currency: CurrencyKey,\n managementFees?: Partial<Record<CurrencyKey, number>>,\n) => {\n if (managementFees && managementFees[currency]) {\n return managementFees[currency];\n }\n if (baseRates[currency]) {\n return baseRates[currency] / 100;\n }\n return 0;\n};\n\nexport const CostCalculatorFlow = ({\n estimationOptions = defaultEstimationOptions,\n defaultValues = {\n countryRegionSlug: '',\n currencySlug: '',\n salary: '',\n benefits: {},\n },\n options,\n render,\n version = 'standard',\n}: CostCalculatorFlowProps) => {\n const formId = useId();\n const [currency, setCurrency] = useState<CurrencyKey>('USD');\n const onCurrencyChange = (currency: string) => {\n setCurrency(currency as CurrencyKey);\n const managementFee = getDefaultManagementFee(\n BASE_RATES,\n currency as CurrencyKey,\n estimationOptions.managementFees,\n );\n if (managementFee) {\n form.setValue('management.management_fee', managementFee);\n }\n };\n const costCalculatorBag = useCostCalculator({\n defaultRegion: defaultValues.countryRegionSlug,\n defaultCurrency: defaultValues.currencySlug,\n defaultSalary: defaultValues.salary,\n estimationOptions,\n version,\n options: {\n ...options,\n onCurrencyChange: onCurrencyChange,\n },\n });\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n costCalculatorBag.handleValidation,\n );\n\n const defaultManagementFee = defaultValues.currencySlug\n ? ''\n : getDefaultManagementFee(\n BASE_RATES,\n currency,\n estimationOptions.managementFees,\n );\n\n const form = useForm({\n resolver,\n defaultValues: {\n country: defaultValues?.countryRegionSlug,\n currency: defaultValues?.currencySlug,\n region: '',\n salary: defaultValues?.salary,\n salary_conversion: '',\n salary_converted: '',\n hiring_budget: defaultValues?.hiringBudget || 'employee_annual_salary',\n management: {\n management_fee: defaultManagementFee,\n },\n benefits: defaultValues?.benefits,\n estimation_title: estimationOptions.title,\n },\n shouldUnregister: false,\n mode: 'onBlur',\n });\n\n useEffect(() => {\n if (\n defaultValues.currencySlug &&\n costCalculatorBag.currencies &&\n estimationOptions.includeManagementFee\n ) {\n const currencyData = costCalculatorBag.currencies.find(\n (currency) => currency.value === defaultValues.currencySlug,\n );\n const currencyCode = currencyData?.label;\n if (currencyCode) {\n setCurrency(currencyCode as CurrencyKey);\n const defaultManagementFee = getDefaultManagementFee(\n BASE_RATES,\n currencyCode as CurrencyKey,\n estimationOptions.managementFees,\n );\n form.setValue('management.management_fee', defaultManagementFee);\n }\n }\n }, [\n defaultValues.currencySlug,\n costCalculatorBag.currencies,\n estimationOptions.includeManagementFee,\n estimationOptions.managementFees,\n form,\n ]);\n\n return (\n <CostCalculatorContext.Provider\n value={{\n form,\n formId: formId,\n costCalculatorBag,\n }}\n >\n {render(costCalculatorBag)}\n </CostCalculatorContext.Provider>\n );\n};\n"],"mappings":"kPAAA,OAAgB,aAAAA,EAAW,SAAAC,EAAO,YAAAC,MAAgB,QAwK9C,cAAAC,MAAA,oBAhHJ,IAAMC,EAA0BC,EAAA,CAC9BC,EACAC,EACAC,IAEIA,GAAkBA,EAAeD,CAAQ,EACpCC,EAAeD,CAAQ,EAE5BD,EAAUC,CAAQ,EACbD,EAAUC,CAAQ,EAAI,IAExB,EAXuB,2BAcnBE,EAAqBJ,EAAA,CAAC,CACjC,kBAAAK,EAAoBC,EACpB,cAAAC,EAAgB,CACd,kBAAmB,GACnB,aAAc,GACd,OAAQ,GACR,SAAU,CAAC,CACb,EACA,QAAAC,EACA,OAAAC,EACA,QAAAC,EAAU,UACZ,IAA+B,CAC7B,IAAMC,EAASC,EAAM,EACf,CAACV,EAAUW,CAAW,EAAIC,EAAsB,KAAK,EACr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CAEJ,EA5GkC","names":["useEffect","useId","useState","jsx","getDefaultManagementFee","__name","baseRates","currency","managementFees","CostCalculatorFlow","estimationOptions","defaultEstimationOptions","defaultValues","options","render","version","formId","useId","setCurrency","useState","onCurrencyChange","managementFee","BASE_RATES","form","costCalculatorBag","useCostCalculator","resolver","useJsonSchemasValidationFormResolver","defaultManagementFee","useForm","useEffect","currencyCode","CostCalculatorContext"]}
@@ -1,2 +0,0 @@
1
- import{a as W}from"./chunk-ALYKEN3E.js";import{a as K}from"./chunk-VFRHMNLJ.js";import{a as G,b as I,c as z,e as Q}from"./chunk-V2YORDAL.js";import{a as C}from"./chunk-HN5HLFTB.js";import{a as N}from"./chunk-CFIJKJXD.js";import{c as X}from"./chunk-U4NWXPI5.js";import{c as M}from"./chunk-PAQW5BFW.js";import{a as i}from"./chunk-P37U34EQ.js";import{number as Re,object as ae}from"yup";import{createHeadlessForm as he,modify as Fe}from"@remoteoss/json-schema-form";import{useCallback as Ve,useEffect as Y,useMemo as Me,useState as j}from"react";import{string as Z,ValidationError as ee}from"yup";import{jsx as te}from"react/jsx-runtime";var k={title:"Estimation",includeBenefits:!1,includeCostBreakdowns:!1,includePremiumBenefits:!1,enableCurrencyConversion:!1,includeEstimationTitle:!1,includeManagementFee:!1},je=i(t=>{let{schema:a}=Fe(K.data.schema,t?.jsfModify||{});return he(a)},"useStaticSchema");function Pe(t,a){if(typeof t=="object"&&t!==null&&"title"in t){let l=t.title;if(l)return l}return a==="my_hiring_budget"?"Hiring budget":"Employee's annual salary"}i(Pe,"getSalaryTitle");var Ne=i(({defaultRegion:t,defaultCurrency:a,defaultSalary:l,estimationOptions:s,options:r,version:o}={estimationOptions:k})=>{let[u,S]=j(t),[P,R]=j(),[d,q]=j(),[H,ie]=j(),{data:_,isLoading:oe}=G({includePremiumBenefits:s.includePremiumBenefits}),{data:f,isLoading:se}=I(),le=u||P?.value,{data:w,isLoading:ce}=Q(le,{includePremiumBenefits:s.includePremiumBenefits,options:r}),U=z(),E=P?.currency,p=r?.jsfModify?.fields?.salary,F=p&&typeof p=="object"&&"presentation"in p?p.presentation:void 0,L=Ve(()=>{let e=E&&d?E!==d:!1;return E!==d?{from:d,to:E,shouldSwapOrder:e}:{from:E,to:d,shouldSwapOrder:e}},[E,d]),J=s.showManagementFee,$=s.includeEstimationTitle,ue=Me(()=>{let{from:e,to:n,shouldSwapOrder:m}=L(),c=Pe(p,H);return{fields:{salary:{...p,title:c,presentation:{salary_conversion_properties:{label:F?.salary_conversion_properties?.label,description:F?.salary_conversion_properties?.description},currencies:{from:e,to:n},Component:i(y=>te(W,{...y,shouldSwapOrder:m,conversionType:o==="marketing"?"no_spread":"spread",defaultValue:l}),"Component")}},hiring_budget:{presentation:{hidden:o=="marketing"}},management:{...r?.jsfModify?.fields?.management,properties:{...r?.jsfModify?.fields?.management?.properties,management_fee:{...r?.jsfModify?.fields?.management?.properties?.management_fee,"x-jsf-presentation":{inputType:"money",additionalProps:{currency:d||"USD"}}}},presentation:{...typeof r?.jsfModify?.fields?.management=="object"?(r?.jsfModify?.fields?.management)["x-jsf-presentation"]:{},hidden:!J,Component:i(y=>te(X,{...y,variant:"inset",features:{toggle:{enabled:!0,stateField:"management._expanded",labels:{expand:"Define",collapse:"Remove"}}}}),"Component")}},estimation_title:{...r?.jsfModify?.fields?.estimation_title,"x-jsf-presentation":{hidden:!$}}}}},[d,p,H,F?.salary_conversion_properties?.description,F?.salary_conversion_properties?.label,l,L,r?.jsfModify?.fields?.management,J,o,$,r?.jsfModify?.fields?.estimation_title]),g=je({jsfModify:{fields:{...r?.jsfModify?.fields,...ue?.fields}}});Y(()=>{if(t&&_){let e=_.find(({value:n})=>n===t);e&&R(e)}},[t,_]),Y(()=>{if(a&&f){let e=f.find(({value:n})=>n===a);e&&q(e.label)}},[a,f]);async function me(e){try{await x.validate(e,{abortEarly:!1})}catch(n){return{data:null,error:n}}return new Promise((n,m)=>{U.mutate(re(e,s,o),{onSuccess:i(c=>{c.data?n({data:c.data,error:null}):m({data:null,error:c.error})},"onSuccess"),onError:i(c=>{m({data:null,error:c})},"onError")})})}i(me,"onSubmit");function de(e){let n=_?.find(({value:m})=>m===e);n&&n.childRegions.length===0&&n.hasAdditionalFields?S(n.regionSlug):S(void 0),R(n)}i(de,"onCountryChange");function fe(e){S(e)}i(fe,"onRegionChange");function ge(e){ie(e.target.value)}i(ge,"onHiringBudgetChange");function ye(e){let n=f?.find(m=>m.value===e)?.label;q(n),r?.onCurrencyChange?.(n||"")}i(ye,"onChangeCurrency");let b=g.fields.find(e=>e.name==="region");if(b){let e=P?.childRegions.map(n=>({value:n.slug,label:n.name}))??[];b.options=e,b.isVisible=e.length>0,b.required=e.length>0,b.onChange=fe,b.schema=e.length>0?Z().transform(n=>typeof n=="string"?n:"").required("Region is required"):Z()}if(f){let e=g.fields.find(n=>n.name==="currency");e&&(e.options=f,e.onChange=ye)}let v=g.fields.find(e=>e.name==="hiring_budget");if(v&&(v.onChange=ge),_){let e=g.fields.find(n=>n.name==="country");e&&(e.options=_,e.onChange=de)}let pe=i(()=>{R(void 0),S(t)},"resetForm"),D=[...g.fields.filter(e=>e.name!=="management"),...w?.fields||[],...g.fields.filter(e=>e.name==="management")],x=ne(g.fields,d||"USD",s.includeEstimationTitle);async function Ce(e){let n=null;r?.onValidation?.(e);let m=M(e,D);try{await x.validate(m,{abortEarly:!1}),n={formErrors:{},yupError:new ee([],e)}}catch(h){let T=N(h);n={formErrors:Object.entries(T).reduce((O,[A,V])=>({...O,[A]:V.message}),{}),yupError:h}}let c=w?.handleValidation(m),y=[...n?.yupError.inner||[],...c?.yupError?.inner||[]],B={...n?.yupError?.value||{},...c?.yupError?.value||{}};return{formErrors:{...n?.formErrors||{},...c?.formErrors||{}},yupError:new ee(y,B)}}return i(Ce,"handleValidation"),{stepState:{current:0,total:1,isLastStep:!0},fields:D,validationSchema:x,parseFormValues:i(e=>{let{country:n,region:m,currency:c,salary_converted:y,hiring_budget:B,salary_conversion:h,management:T,estimation_title:O,...A}=e,V=e.salary;y==="salary_conversion"&&(V=h);let _e=M({country:n,region:m,salary:V,salary_converted:y,salary_conversion:h,hiring_budget:B,currency:c,management:T,estimation_title:O},g.fields),Ee=M(A,w?.fields||[]),be={currency_code:f?.find(Se=>Se.value===c)?.label};return{..._e,...Ee,...be}},"parseFormValues"),handleValidation:Ce,isSubmitting:U.isPending,isLoading:oe&&se&&ce,onSubmit:me,resetForm:pe,currencies:f}},"useCostCalculator");function ne(t,a,l){let s=t.reduce((r,o)=>(o.name==="salary"||o.name==="salary_conversion"?r[o.name]=o.schema.when("salary_converted",{is:i(u=>u===o.name,"is"),then:i(u=>u.required("Required field"),"then"),otherwise:i(u=>u.optional(),"otherwise")}):o.name==="management"?r[o.name]=ae({management_fee:Re().transform(u=>isNaN(u)?void 0:u).min(0,"Management fee must be greater than or equal to 0").max(a?C[a]:C.USD,()=>`Management fee cannot exceed ${(a?C[a]:C.USD)/100} ${a}`)}):o.name==="estimation_title"&&l?r[o.name]=o.schema.required("Required field"):r[o.name]=o.schema,r),{});return ae(s)}i(ne,"buildValidationSchema");function we(t){let a="benefit-";return Object.keys(t).reduce((l,s)=>{let r=t[s];if(r==="none")return l;let u={benefit_group_slug:s.replace(a,""),benefit_tier_slug:r};return[...l,u]},[])}i(we,"formatBenefits");function xe(t,a,l){let s=Number(t.management?.management_fee),r=t.currency_code;return{...{region_slug:t.region||t.country,employment_term:t.contract_duration_type??"fixed",title:t.estimation_title||a.title,age:t.age??void 0,...t.benefits&&{benefits:we(t.benefits)},...a.includeManagementFee&&s&&{discount:{quoted_amount:a.showManagementFee?s:C[r]||C.USD,text:""}}},...Be(t,l)}}i(xe,"mapValueToEmployment");function Be(t,a){let l=a==="marketing"||t.salary_converted==="salary_conversion",s=a==="standard"&&t.salary_converted==="salary",r=t.hiring_budget==="my_hiring_budget";if(l){let o=t.salary_converted==="salary_conversion";return r?{annual_total_cost_in_employer_currency:t.salary}:{[o?"annual_gross_salary_in_employer_currency":"annual_gross_salary"]:t.salary}}return s?r?{annual_total_cost:t.salary}:{annual_gross_salary:t.salary}:{}}i(Be,"getSalaryFields");function re(t,a=k,l="standard"){let s=Array.isArray(t)?t:[t];if(s.length===0)throw new Error("At least one employment value is required");return s.length>1&&new Set(s.map(o=>o.currency)).size>1&&console.warn("Multiple currencies detected in array. Using currency from first employment."),{employer_currency_slug:s[0].currency,include_benefits:a.includeBenefits,include_cost_breakdowns:a.includeCostBreakdowns,include_premium_benefits:a.includePremiumBenefits,include_management_fee:a.includeManagementFee,employments:s.map(r=>xe(r,a,l))}}i(re,"buildPayload");export{ne as a,re as b,k as c,Ne as d};
2
- //# sourceMappingURL=chunk-NTEIOU72.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/CostCalculator/utils.ts","../src/flows/CostCalculator/hooks.tsx"],"sourcesContent":["import type {\n CostCalculatorEmploymentParam,\n CostCalculatorEstimateParams,\n} from '@/src/client';\n\nimport { $TSFixMe } from '@/src/types/remoteFlows';\nimport { AnyObjectSchema, number, object } from 'yup';\nimport { CostCalculatorVersion, defaultEstimationOptions } from './hooks';\nimport type {\n CostCalculatorEstimationOptions,\n CostCalculatorEstimationSubmitValues,\n CurrencyKey,\n} from './types';\nimport { BASE_RATES } from '@/src/flows/CostCalculator/constants';\n\n/**\n * Build the validation schema for the form.\n * @returns\n */\nexport function buildValidationSchema(\n fields: $TSFixMe[],\n employerBillingCurrency: string,\n includeEstimationTitle?: boolean,\n) {\n const fieldsSchema = fields.reduce<Record<string, AnyObjectSchema>>(\n (fieldsSchemaAcc, field) => {\n // Special handling for salary fields\n if (field.name === 'salary' || field.name === 'salary_conversion') {\n fieldsSchemaAcc[field.name] = (field.schema as AnyObjectSchema).when(\n 'salary_converted',\n {\n is: (val: string | null) => val === field.name,\n then: (schema) => schema.required('Required field'),\n otherwise: (schema) => schema.optional(),\n },\n );\n } else if (field.name === 'management') {\n fieldsSchemaAcc[field.name] = object({\n management_fee: number()\n .transform((value) => {\n return isNaN(value) ? undefined : value;\n })\n .min(0, 'Management fee must be greater than or equal to 0')\n .max(\n employerBillingCurrency\n ? BASE_RATES[employerBillingCurrency as CurrencyKey]\n : BASE_RATES.USD,\n () => {\n const maxValue = employerBillingCurrency\n ? BASE_RATES[employerBillingCurrency as CurrencyKey]\n : BASE_RATES.USD;\n const displayValue = maxValue / 100;\n return `Management fee cannot exceed ${displayValue} ${employerBillingCurrency}`;\n },\n ),\n });\n } else if (field.name === 'estimation_title' && includeEstimationTitle) {\n // Make estimation_title required when includeEstimationTitle is true\n fieldsSchemaAcc[field.name] = (\n field.schema as AnyObjectSchema\n ).required('Required field');\n } else {\n fieldsSchemaAcc[field.name] = field.schema as AnyObjectSchema;\n }\n return fieldsSchemaAcc;\n },\n {},\n );\n return object(fieldsSchema) as AnyObjectSchema;\n}\n\n/**\n * Format the benefits to the expected format by the API.\n * @param benefits\n * @returns\n */\nfunction formatBenefits(benefits: Record<string, string>) {\n const needle = 'benefit-';\n return Object.keys(benefits).reduce<\n Array<{ benefit_group_slug: string; benefit_tier_slug: string }>\n >((acc, key) => {\n const benefitTierSlug = benefits[key];\n if (benefitTierSlug === 'none') {\n return acc;\n }\n const benefitGroupSlug = key.replace(needle, '');\n const benefitEntry = {\n benefit_group_slug: benefitGroupSlug,\n benefit_tier_slug: benefitTierSlug,\n };\n return [...acc, benefitEntry];\n }, []);\n}\n\nfunction mapValueToEmployment(\n value: CostCalculatorEstimationSubmitValues,\n estimationOptions: CostCalculatorEstimationOptions,\n version: CostCalculatorVersion,\n): CostCalculatorEmploymentParam {\n const managementFee = Number(value.management?.management_fee);\n const currencyCode = value.currency_code;\n\n const base: CostCalculatorEmploymentParam = {\n region_slug: value.region || value.country,\n employment_term: value.contract_duration_type ?? 'fixed',\n title: value.estimation_title || estimationOptions.title,\n age: value.age ?? undefined,\n ...(value.benefits && { benefits: formatBenefits(value.benefits) }),\n ...(estimationOptions.includeManagementFee &&\n managementFee && {\n discount: {\n quoted_amount: estimationOptions.showManagementFee\n ? managementFee\n : BASE_RATES[currencyCode as keyof typeof BASE_RATES] ||\n BASE_RATES.USD,\n text: '',\n },\n }),\n };\n\n return {\n ...base,\n ...getSalaryFields(value, version),\n };\n}\n\nfunction getSalaryFields(\n value: CostCalculatorEstimationSubmitValues,\n version: CostCalculatorVersion,\n): Partial<CostCalculatorEmploymentParam> {\n const isMarketing =\n version === 'marketing' || value.salary_converted === 'salary_conversion';\n const isStandard =\n version === 'standard' && value.salary_converted === 'salary';\n const useHiringBudget = value.hiring_budget === 'my_hiring_budget';\n\n if (isMarketing) {\n const useEmployerCurrency = value.salary_converted === 'salary_conversion';\n return useHiringBudget\n ? {\n annual_total_cost_in_employer_currency: value.salary,\n }\n : {\n [useEmployerCurrency\n ? 'annual_gross_salary_in_employer_currency'\n : 'annual_gross_salary']: value.salary,\n };\n }\n\n if (isStandard) {\n return useHiringBudget\n ? {\n annual_total_cost: value.salary,\n }\n : {\n annual_gross_salary: value.salary,\n };\n }\n\n return {};\n}\n\n/**\n * Build the payload for the cost calculator estimation.\n * @param values\n * @param estimationOptions\n * @returns\n */\nexport function buildPayload(\n values:\n | CostCalculatorEstimationSubmitValues\n | CostCalculatorEstimationSubmitValues[],\n estimationOptions: CostCalculatorEstimationOptions = defaultEstimationOptions,\n version: CostCalculatorVersion = 'standard',\n): CostCalculatorEstimateParams {\n const employments = Array.isArray(values) ? values : [values];\n\n if (employments.length === 0) {\n throw new Error('At least one employment value is required');\n }\n\n if (employments.length > 1) {\n const currencies = new Set(employments.map((v) => v.currency));\n if (currencies.size > 1) {\n console.warn(\n 'Multiple currencies detected in array. Using currency from first employment.',\n );\n }\n }\n\n return {\n employer_currency_slug: employments[0].currency,\n include_benefits: estimationOptions.includeBenefits,\n include_cost_breakdowns: estimationOptions.includeCostBreakdowns,\n include_premium_benefits: estimationOptions.includePremiumBenefits,\n include_management_fee: estimationOptions.includeManagementFee,\n employments: employments.map((value) =>\n mapValueToEmployment(value, estimationOptions, version),\n ),\n };\n}\n","import {\n CostCalculatorEstimateResponse,\n MinimalRegion,\n PostCreateEstimationError,\n} from '@/src/client';\nimport { jsonSchema } from '@/src/flows/CostCalculator/jsonSchema';\nimport type {\n CostCalculatorEstimationFormValues,\n CostCalculatorEstimationOptions,\n CostCalculatorEstimationSubmitValues,\n EstimationError,\n UseCostCalculatorOptions,\n} from '@/src/flows/CostCalculator/types';\nimport type { JSFModify, Result } from '@/src/flows/types';\n\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { iterateErrors } from '@/src/components/form/yupValidationResolver';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { string, ValidationError } from 'yup';\nimport { buildPayload, buildValidationSchema } from './utils';\nimport {\n useCompanyCurrencies,\n useCostCalculatorCountries,\n useCostCalculatorEstimation,\n useRegionFields,\n} from '@/src/flows/CostCalculator/api';\nimport { $TSFixMe, JSFField } from '@/src/types/remoteFlows';\nimport { SalaryField } from '@/src/flows/CostCalculator/components/SalaryField';\nimport {\n FieldSetField,\n FieldSetProps,\n} from '@/src/components/form/fields/FieldSetField';\n\nexport type CostCalculatorVersion = 'standard' | 'marketing';\n\ntype CostCalculatorCountry = {\n value: string;\n label: string;\n childRegions: MinimalRegion[];\n hasAdditionalFields: boolean | undefined;\n regionSlug: string;\n currency: string;\n};\n\ntype JSFValidationError = {\n formErrors: Record<\n string,\n {\n type: string;\n message: string;\n }\n >;\n yupError: ValidationError;\n};\n\nexport const defaultEstimationOptions: CostCalculatorEstimationOptions = {\n title: 'Estimation',\n includeBenefits: false,\n includeCostBreakdowns: false,\n includePremiumBenefits: false,\n enableCurrencyConversion: false,\n includeEstimationTitle: false,\n includeManagementFee: false,\n};\n\ntype UseCostCalculatorParams = {\n /**\n * The default region slug to preselect a country and a region.\n */\n defaultRegion?: string;\n /**\n * The default currency slug to preselect a currency.\n */\n defaultCurrency?: string;\n\n /**\n * The default salary to preselect a salary.\n */\n defaultSalary?: string;\n /**\n * The estimation options.\n */\n estimationOptions: CostCalculatorEstimationOptions;\n options?: UseCostCalculatorOptions;\n version?: CostCalculatorVersion;\n};\n\nconst useStaticSchema = (options?: { jsfModify?: JSFModify }) => {\n const { schema: jsonSchemaModified } = modify(\n jsonSchema.data.schema,\n options?.jsfModify || {},\n );\n\n return createHeadlessForm(jsonSchemaModified);\n};\n\ntype HiringBudget = 'my_hiring_budget' | 'employee_annual_salary';\n\nfunction getSalaryTitle(\n salaryField: unknown,\n hiringBudget?: HiringBudget,\n): string {\n if (\n typeof salaryField === 'object' &&\n salaryField !== null &&\n 'title' in salaryField\n ) {\n const title = (salaryField as { title?: string }).title;\n if (title) return title;\n }\n return hiringBudget === 'my_hiring_budget'\n ? 'Hiring budget'\n : \"Employee's annual salary\";\n}\n\n/**\n * Hook to use the cost calculator.\n */\nexport const useCostCalculator = (\n {\n defaultRegion,\n defaultCurrency,\n defaultSalary,\n estimationOptions,\n options,\n version,\n }: UseCostCalculatorParams = {\n estimationOptions: defaultEstimationOptions,\n },\n) => {\n const [selectedRegion, setSelectedRegion] = useState<string | undefined>(\n defaultRegion,\n );\n const [selectedCountry, setSelectedCountry] =\n useState<CostCalculatorCountry>();\n const [employerBillingCurrency, setEmployerBillingCurrency] = useState<\n string | undefined\n >();\n const [hiringBudget, setHiringBudget] = useState<HiringBudget>();\n const { data: countries, isLoading: isLoadingCountries } =\n useCostCalculatorCountries({\n includePremiumBenefits: estimationOptions.includePremiumBenefits,\n });\n const { data: currencies, isLoading: isLoadingCurrencies } =\n useCompanyCurrencies();\n\n const jsonSchemaRegionSlug = selectedRegion || selectedCountry?.value;\n\n const { data: jsonSchemaRegionFields, isLoading: isLoadingRegionFields } =\n useRegionFields(jsonSchemaRegionSlug, {\n includePremiumBenefits: estimationOptions.includePremiumBenefits,\n options,\n });\n const costCalculatorEstimationMutation = useCostCalculatorEstimation();\n const employeeBillingCurrency = selectedCountry?.currency;\n\n const salaryField = options?.jsfModify?.fields?.salary;\n const salaryFieldPresentation =\n salaryField &&\n typeof salaryField === 'object' &&\n 'presentation' in salaryField\n ? (\n salaryField as {\n presentation?: {\n salary_conversion_properties?: {\n label?: string;\n description?: string;\n };\n };\n }\n ).presentation\n : undefined;\n\n const getCurrencies = useCallback(() => {\n const shouldSwapOrder =\n employeeBillingCurrency && employerBillingCurrency\n ? employeeBillingCurrency !== employerBillingCurrency\n : false;\n\n if (employeeBillingCurrency !== employerBillingCurrency) {\n return {\n from: employerBillingCurrency,\n to: employeeBillingCurrency,\n shouldSwapOrder,\n };\n }\n\n return {\n from: employeeBillingCurrency,\n to: employerBillingCurrency,\n shouldSwapOrder,\n };\n }, [employeeBillingCurrency, employerBillingCurrency]);\n\n const showManagementField = estimationOptions.showManagementFee;\n const showEstimationTitleField = estimationOptions.includeEstimationTitle;\n const customFields = useMemo(() => {\n const { from, to, shouldSwapOrder } = getCurrencies();\n const salaryTitle = getSalaryTitle(salaryField, hiringBudget);\n\n return {\n fields: {\n salary: {\n ...salaryField,\n title: salaryTitle,\n presentation: {\n salary_conversion_properties: {\n label:\n salaryFieldPresentation?.salary_conversion_properties?.label,\n description:\n salaryFieldPresentation?.salary_conversion_properties\n ?.description,\n },\n currencies: { from, to },\n Component: (\n props: JSFField & { currencies: { from: string; to: string } },\n ) => {\n return (\n <SalaryField\n {...props}\n shouldSwapOrder={shouldSwapOrder}\n conversionType={\n version === 'marketing' ? 'no_spread' : 'spread'\n }\n defaultValue={defaultSalary}\n />\n );\n },\n },\n },\n hiring_budget: {\n presentation: {\n hidden: version == 'marketing',\n },\n },\n management: {\n ...options?.jsfModify?.fields?.management,\n properties: {\n ...(options?.jsfModify?.fields?.management as $TSFixMe)?.properties,\n management_fee: {\n ...(options?.jsfModify?.fields?.management as $TSFixMe)\n ?.properties?.management_fee,\n 'x-jsf-presentation': {\n inputType: 'money',\n additionalProps: {\n currency: employerBillingCurrency || 'USD',\n },\n },\n },\n },\n presentation: {\n ...(typeof options?.jsfModify?.fields?.management === 'object'\n ? (\n options?.jsfModify?.fields?.management as Record<\n string,\n $TSFixMe\n >\n )['x-jsf-presentation']\n : {}),\n hidden: !showManagementField,\n Component: (props: FieldSetProps) => {\n return (\n <FieldSetField\n {...props}\n variant='inset'\n features={{\n toggle: {\n enabled: true,\n stateField: 'management._expanded',\n labels: {\n expand: 'Define',\n collapse: 'Remove',\n },\n },\n }}\n />\n );\n },\n },\n },\n estimation_title: {\n ...options?.jsfModify?.fields?.estimation_title,\n 'x-jsf-presentation': {\n hidden: !showEstimationTitleField,\n },\n },\n },\n };\n }, [\n employerBillingCurrency,\n salaryField,\n hiringBudget,\n salaryFieldPresentation?.salary_conversion_properties?.description,\n salaryFieldPresentation?.salary_conversion_properties?.label,\n defaultSalary,\n getCurrencies,\n options?.jsfModify?.fields?.management,\n showManagementField,\n version,\n showEstimationTitleField,\n options?.jsfModify?.fields?.estimation_title,\n ]);\n\n const fieldsJSONSchema = useStaticSchema({\n jsfModify: {\n fields: {\n ...options?.jsfModify?.fields,\n ...customFields?.fields,\n },\n },\n });\n\n useEffect(() => {\n // Initialize selectedCountry from defaultRegion\n if (defaultRegion && countries) {\n const defaultCountry = countries.find(\n ({ value }) => value === defaultRegion,\n );\n if (defaultCountry) {\n setSelectedCountry(defaultCountry);\n }\n }\n }, [defaultRegion, countries]);\n\n useEffect(() => {\n // Initialize selectedCurrency from defaultCurrency\n if (defaultCurrency && currencies) {\n const defaultCurrencyObj = currencies.find(\n ({ value }) => value === defaultCurrency,\n );\n if (defaultCurrencyObj) {\n setEmployerBillingCurrency(defaultCurrencyObj.label);\n }\n }\n }, [defaultCurrency, currencies]);\n\n /**\n * Submit the estimation form with the given values.\n * @param values\n */\n async function onSubmit(\n values: CostCalculatorEstimationSubmitValues,\n ): Promise<Result<CostCalculatorEstimateResponse, EstimationError>> {\n try {\n await validationSchema.validate(values, { abortEarly: false });\n } catch (err) {\n return {\n data: null,\n error: err as ValidationError,\n };\n }\n\n return new Promise((resolve, reject) => {\n costCalculatorEstimationMutation.mutate(\n buildPayload(values, estimationOptions, version),\n {\n onSuccess: (response) => {\n if (response.data) {\n resolve({\n data: response.data,\n error: null,\n });\n } else {\n reject({\n data: null,\n error: response.error as PostCreateEstimationError,\n });\n }\n },\n onError: (error) => {\n reject({\n data: null,\n error: error as PostCreateEstimationError,\n });\n },\n },\n );\n });\n }\n\n /**\n * If the selected country has no child regions and has additional fields,\n * set the current region to the country's region slug and fetch the region fields.\n * @param country\n */\n function onCountryChange(country: string) {\n const currentCountry = countries?.find(({ value }) => value === country);\n\n if (\n currentCountry &&\n currentCountry.childRegions.length === 0 &&\n currentCountry.hasAdditionalFields\n ) {\n setSelectedRegion(currentCountry.regionSlug);\n } else {\n setSelectedRegion(undefined);\n }\n setSelectedCountry(currentCountry);\n }\n\n /**\n * Update the selected region and fetch the region fields.\n * @param region\n */\n function onRegionChange(region: string) {\n setSelectedRegion(region);\n }\n\n function onHiringBudgetChange(event: React.ChangeEvent<HTMLInputElement>) {\n setHiringBudget(event.target.value as HiringBudget);\n }\n\n function onChangeCurrency(currency: string) {\n const selectedCurrency = currencies?.find(\n (c) => c.value === currency,\n )?.label;\n setEmployerBillingCurrency(selectedCurrency);\n options?.onCurrencyChange?.(selectedCurrency || '');\n }\n\n const regionField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'region',\n );\n\n if (regionField) {\n const regions =\n selectedCountry?.childRegions.map((region) => ({\n value: region.slug,\n label: region.name,\n })) ?? [];\n regionField.options = regions;\n regionField.isVisible = regions.length > 0;\n regionField.required = regions.length > 0;\n regionField.onChange = onRegionChange;\n regionField.schema =\n regions.length > 0\n ? string()\n .transform((value) => (typeof value === 'string' ? value : ''))\n .required('Region is required')\n : string();\n }\n\n if (currencies) {\n const currencyField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'currency',\n );\n if (currencyField) {\n currencyField.options = currencies;\n currencyField.onChange = onChangeCurrency;\n }\n }\n\n const hiringBudgetField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'hiring_budget',\n );\n if (hiringBudgetField) {\n hiringBudgetField.onChange = onHiringBudgetChange;\n }\n\n if (countries) {\n const countryField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'country',\n );\n if (countryField) {\n countryField.options = countries;\n countryField.onChange = onCountryChange;\n }\n }\n\n const resetForm = () => {\n setSelectedCountry(undefined);\n setSelectedRegion(defaultRegion);\n };\n\n const allFields = [\n ...fieldsJSONSchema.fields.filter((field) => field.name !== 'management'),\n ...(jsonSchemaRegionFields?.fields || []),\n ...fieldsJSONSchema.fields.filter((field) => field.name === 'management'),\n ];\n\n const validationSchema = buildValidationSchema(\n fieldsJSONSchema.fields,\n employerBillingCurrency || 'USD',\n estimationOptions.includeEstimationTitle,\n );\n\n async function handleValidation(values: CostCalculatorEstimationFormValues) {\n let errors: JSFValidationError | null = null;\n\n options?.onValidation?.(values);\n const parsedValues = parseJSFToValidate(values, allFields);\n\n // 1. validate static fields first using Yup validate function\n try {\n await validationSchema.validate(parsedValues, {\n abortEarly: false,\n });\n errors = {\n formErrors: {},\n yupError: new ValidationError([], values),\n };\n } catch (error) {\n const iterateResult = iterateErrors(error as ValidationError);\n\n errors = {\n // convert the errors to a format that can be used in the form\n formErrors: Object.entries(iterateResult).reduce(\n (acc, [key, value]) => ({ ...acc, [key]: value.message }),\n {},\n ),\n yupError: error as ValidationError,\n };\n }\n\n // 2. validate json schema fields using the handleValidation (from json-schema-form)\n const handleValidationResult =\n jsonSchemaRegionFields?.handleValidation(parsedValues);\n\n // 3. combine the errors from both validations\n const combinedInnerErrors = [\n ...(errors?.yupError.inner || []),\n ...(handleValidationResult?.yupError?.inner || []),\n ];\n const combinedValues = {\n ...(errors?.yupError?.value || {}),\n ...(handleValidationResult?.yupError?.value || {}),\n };\n\n return {\n formErrors: {\n ...(errors?.formErrors || {}),\n ...(handleValidationResult?.formErrors || {}),\n },\n yupError: new ValidationError(combinedInnerErrors, combinedValues),\n };\n }\n\n return {\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState: {\n current: 0,\n total: 1,\n isLastStep: true,\n },\n /**\n * Array of form fields from the cost calculator schema + dynamic region fields like benefits, age, etc.\n */\n fields: allFields,\n /**\n * Validation schema for the cost calculator form\n */\n validationSchema,\n /**\n * Function to parse form values before submission\n * @param values - Form values to parse\n * @returns Parsed form values\n */\n parseFormValues: (\n values: CostCalculatorEstimationFormValues,\n ): CostCalculatorEstimationSubmitValues => {\n const {\n country,\n region,\n currency,\n salary_converted,\n hiring_budget,\n salary_conversion,\n management,\n estimation_title,\n ...rest\n } = values;\n\n // If the salary has been converted, we take the one the user has inputted\n let salary = values.salary;\n if (salary_converted === 'salary_conversion') {\n salary = salary_conversion;\n }\n\n const jsonSchemaStaticFieldValues = {\n country,\n region,\n salary,\n salary_converted,\n salary_conversion,\n hiring_budget,\n currency,\n management,\n estimation_title,\n };\n\n const parsedStaticFields = parseJSFToValidate(\n jsonSchemaStaticFieldValues,\n fieldsJSONSchema.fields,\n );\n\n const parsedRegionFields = parseJSFToValidate(\n rest,\n jsonSchemaRegionFields?.fields || [],\n );\n\n const additionalFields = {\n currency_code: currencies?.find((c) => c.value === currency)?.label,\n };\n\n return {\n ...parsedStaticFields,\n ...parsedRegionFields,\n ...additionalFields,\n } as CostCalculatorEstimationSubmitValues;\n },\n /**\n * Function to handle validation of the cost calculator form\n * @param values - Form values to validate\n * @returns Validation result\n */\n handleValidation,\n /**\n * Whether the cost calculator form is currently being submitted\n */\n isSubmitting: costCalculatorEstimationMutation.isPending,\n /**\n * Whether the cost calculator form is currently loading\n */\n isLoading:\n isLoadingCountries && isLoadingCurrencies && isLoadingRegionFields,\n /**\n * Function to submit the cost calculator form\n */\n onSubmit,\n /**\n * Function to reset the cost calculator form\n */\n resetForm,\n\n /**\n * Currencies data useful to get the currency if you have a currencySlug\n */\n currencies,\n };\n};\n"],"mappings":"qVAMA,OAA0B,UAAAA,GAAQ,UAAAC,OAAc,MCWhD,OAAS,sBAAAC,GAAoB,UAAAC,OAAc,8BAC3C,OAAS,eAAAC,GAAa,aAAAC,EAAW,WAAAC,GAAS,YAAAC,MAAgB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CACV,CAlCSL,EAAAmB,GAAA,mBA0CF,SAASK,GACdC,EAGAV,EAAqDW,EACrDV,EAAiC,WACH,CAC9B,IAAMW,EAAc,MAAM,QAAQF,CAAM,EAAIA,EAAS,CAACA,CAAM,EAE5D,GAAIE,EAAY,SAAW,EACzB,MAAM,IAAI,MAAM,2CAA2C,EAG7D,OAAIA,EAAY,OAAS,GACJ,IAAI,IAAIA,EAAY,IAAKC,GAAMA,EAAE,QAAQ,CAAC,EAC9C,KAAO,GACpB,QAAQ,KACN,8EACF,EAIG,CACL,uBAAwBD,EAAY,CAAC,EAAE,SACvC,iBAAkBZ,EAAkB,gBACpC,wBAAyBA,EAAkB,sBAC3C,yBAA0BA,EAAkB,uBAC5C,uBAAwBA,EAAkB,qBAC1C,YAAaY,EAAY,IAAKtB,GAC5BS,GAAqBT,EAAOU,EAAmBC,CAAO,CACxD,CACF,CACF,CAhCgBhB,EAAAwB,GAAA","names":["number","object","createHeadlessForm","modify","useCallback","useEffect","useMemo","useState","string","ValidationError","jsx","defaultEstimationOptions","useStaticSchema","__name","options","jsonSchemaModified","modify","jsonSchema","createHeadlessForm","getSalaryTitle","salaryField","hiringBudget","title","useCostCalculator","defaultRegion","defaultCurrency","defaultSalary","estimationOptions","version","selectedRegion","setSelectedRegion","useState","selectedCountry","setSelectedCountry","employerBillingCurrency","setEmployerBillingCurrency","setHiringBudget","countries","isLoadingCountries","useCostCalculatorCountries","currencies","isLoadingCurrencies","useCompanyCurrencies","jsonSchemaRegionSlug","jsonSchemaRegionFields","isLoadingRegionFields","useRegionFields","costCalculatorEstimationMutation","useCostCalculatorEstimation","employeeBillingCurrency","salaryFieldPresentation","getCurrencies","useCallback","shouldSwapOrder","showManagementField","showEstimationTitleField","customFields","useMemo","from","to","salaryTitle","props","SalaryField","FieldSetField","fieldsJSONSchema","useEffect","defaultCountry","value","defaultCurrencyObj","onSubmit","values","validationSchema","err","resolve","reject","buildPayload","response","error","onCountryChange","country","currentCountry","onRegionChange","region","onHiringBudgetChange","event","onChangeCurrency","currency","selectedCurrency","c","regionField","field","regions","string","currencyField","hiringBudgetField","countryField","resetForm","allFields","buildValidationSchema","handleValidation","errors","parsedValues","parseJSFToValidate","ValidationError","iterateResult","iterateErrors","acc","key","handleValidationResult","combinedInnerErrors","combinedValues","salary_converted","hiring_budget","salary_conversion","management","estimation_title","rest","salary","parsedStaticFields","parsedRegionFields","additionalFields","buildValidationSchema","fields","employerBillingCurrency","includeEstimationTitle","fieldsSchema","fieldsSchemaAcc","field","__name","val","schema","object","number","value","BASE_RATES","formatBenefits","benefits","needle","acc","key","benefitTierSlug","benefitEntry","mapValueToEmployment","estimationOptions","version","managementFee","currencyCode","getSalaryFields","isMarketing","isStandard","useHiringBudget","useEmployerCurrency","buildPayload","values","defaultEstimationOptions","employments","v"]}
@@ -1,2 +0,0 @@
1
- import{a as S}from"./chunk-XFD3ULUF.js";import{a as g}from"./chunk-WWANHPT7.js";import{a as P}from"./chunk-HSW5HMHH.js";import{a as F}from"./chunk-S4XU4SE7.js";import{a as y}from"./chunk-Z5WMKCRJ.js";import{a as V}from"./chunk-QW4JPW6J.js";import{b as p}from"./chunk-EGQJ7UBR.js";import{a as T}from"./chunk-PJBAQZ6G.js";import{d as _}from"./chunk-3ZWDIEEM.js";import{c as s}from"./chunk-PAQW5BFW.js";import{a as e}from"./chunk-P37U34EQ.js";import{createHeadlessForm as h,modify as x}from"@remoteoss/json-schema-form";import{useMutation as K,useQuery as L}from"@tanstack/react-query";import q from"lodash.omitby";import A from"lodash.isnull";import R from"lodash.omit";function z(o){return{confidential:"",customer_informed_employee:"",customer_informed_employee_date:"",customer_informed_employee_description:"",personal_email:"",termination_reason:void 0,reason_description:"",termination_reason_files:[],will_challenge_termination:"",will_challenge_termination_description:null,agrees_to_pto_amount:"",agrees_to_pto_amount_notes:null,acknowledge_termination_procedure:!1,additional_comments:"",proposed_termination_date:"",risk_assessment_reasons:[],timesheet_file:void 0,...o}}e(z,"buildInitialValues");var B=e(()=>{let{client:o}=_();return K({mutationFn:e(n=>p({client:o,body:n}),"mutationFn")})},"useCreateTermination"),I=e(({formValues:o,jsfModify:n,step:m})=>L({queryKey:["rmt-flows-termination-schema",m],queryFn:e(()=>P[m]??S,"queryFn"),select:e(({data:u})=>{let i=u?.schema||{};if(n){let{schema:d}=x(i,n);i=d}return h(i||{},{initialValues:o||{}})},"select")}),"useTerminationSchema"),ue=e(({employmentId:o,options:n})=>{let{fieldValues:m,setFieldValues:u,stepState:i,previousStep:f,nextStep:d}=T(F),k={...i.values?.[i.currentStep.name],...m},{data:r,isLoading:w}=I({formValues:k,jsfModify:n?.jsfModify,step:i.currentStep.name}),l=h(g.data.schema),c=B(),{mutateAsync:b}=V(c);async function C(a){if(!o)throw new Error("Employment id is missing");if(r){let t=s(a,l.fields,{isPartialValidation:!0}),{customer_informed_employee:j}=t,D=j==="yes"?{employee_awareness:{date:t.customer_informed_employee_date,note:t.customer_informed_employee_description}}:void 0,H=y(t,["agrees_to_pto_amount","confidential","customer_informed_employee","will_challenge_termination"]),J=R(H,"customer_informed_employee_date","customer_informed_employee_description"),O=q({...J,...D},A);return b({employment_id:o,termination_details:O,type:"termination"})}}e(C,"onSubmit");function M(){f()}e(M,"back");function v(){d()}e(v,"next");let E=z({...i.values?.employee_communication,...i.values?.termination_details,...i.values?.paid_time_off,...i.values?.additional_information});return{employmentId:o,stepState:i,fields:r?.fields||[],isLoading:w,isSubmitting:c.isPending,initialValues:E,handleValidation:e(a=>{if(r){let t=s(a,r?.fields);return r?.handleValidation(t)}return null},"handleValidation"),checkFieldUpdates:e(a=>{if(l){let t=s(a,l?.fields,{isPartialValidation:!0});u(t)}},"checkFieldUpdates"),parseFormValues:e(a=>s(a,l.fields,{isPartialValidation:!0}),"parseFormValues"),onSubmit:C,back:M,next:v}},"useTermination");export{ue as a};
2
- //# sourceMappingURL=chunk-OT2DXWYZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Termination/hooks.ts"],"sourcesContent":["import {\n CreateOffboardingParams,\n postCreateOffboarding,\n TerminationDetailsParams,\n} from '@/src/client';\nimport { mutationToPromise } from '@/src/lib/mutations';\nimport { Client } from '@hey-api/client-fetch';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport omitBy from 'lodash.omitby';\nimport isNull from 'lodash.isnull';\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { TerminationFormValues } from '@/src/flows/Termination/types';\nimport { useClient } from '@/src/context';\nimport omit from 'lodash.omit';\nimport { parseFormRadioValues } from '@/src/flows/utils';\nimport { useStepState } from '@/src/flows/useStepState';\nimport { STEPS } from '@/src/flows/Termination/utils';\nimport { defaultSchema } from '@/src/flows/Termination/json-schemas/defaultSchema';\nimport { schema } from '@/src/flows/Termination/json-schemas/schema';\nimport { jsonSchema } from '@/src/flows/Termination/json-schemas/jsonSchema';\nimport { JSFModify } from '@/src/flows/types';\n\nfunction buildInitialValues(\n stepsInitialValues: Partial<TerminationFormValues>,\n): TerminationFormValues {\n const initialValues: TerminationFormValues = {\n confidential: '',\n customer_informed_employee: '',\n customer_informed_employee_date: '',\n customer_informed_employee_description: '',\n personal_email: '',\n termination_reason: undefined,\n reason_description: '',\n termination_reason_files: [],\n will_challenge_termination: '',\n will_challenge_termination_description: null,\n agrees_to_pto_amount: '',\n agrees_to_pto_amount_notes: null,\n acknowledge_termination_procedure: false,\n additional_comments: '',\n proposed_termination_date: '',\n risk_assessment_reasons: [],\n timesheet_file: undefined,\n ...stepsInitialValues,\n };\n\n return initialValues;\n}\n\nconst useCreateTermination = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateOffboardingParams) => {\n return postCreateOffboarding({\n client: client as Client,\n body: payload,\n });\n },\n });\n};\n\nconst useTerminationSchema = ({\n formValues,\n jsfModify,\n step,\n}: {\n formValues?: TerminationFormValues;\n jsfModify?: JSFModify;\n step?: string;\n}) => {\n return useQuery({\n queryKey: ['rmt-flows-termination-schema', step],\n queryFn: () => {\n return schema[step as keyof typeof schema] ?? defaultSchema;\n },\n select: ({ data }) => {\n let jsfSchema = data?.schema || {};\n if (jsfModify) {\n const { schema } = modify(jsfSchema, jsfModify);\n jsfSchema = schema;\n }\n const form = createHeadlessForm(jsfSchema || {}, {\n initialValues: formValues || {},\n });\n return form;\n },\n });\n};\n\ntype TerminationHookProps = {\n employmentId: string;\n options?: {\n jsfModify?: JSFModify;\n };\n};\n\nexport const useTermination = ({\n employmentId,\n options,\n}: TerminationHookProps) => {\n const { fieldValues, setFieldValues, stepState, previousStep, nextStep } =\n useStepState<keyof typeof STEPS, TerminationFormValues>(STEPS);\n\n const formValues = {\n ...stepState.values?.[stepState.currentStep.name as keyof typeof STEPS], // Restore values for the current step\n ...fieldValues,\n };\n\n const { data: terminationHeadlessForm, isLoading: isLoadingTermination } =\n useTerminationSchema({\n formValues: formValues,\n jsfModify: options?.jsfModify,\n step: stepState.currentStep.name,\n });\n\n const entireTerminationSchema = createHeadlessForm(jsonSchema.data.schema);\n\n const createTermination = useCreateTermination();\n const { mutateAsync } = mutationToPromise(createTermination);\n\n async function onSubmit(values: TerminationFormValues) {\n if (!employmentId) {\n throw new Error('Employment id is missing');\n }\n\n if (terminationHeadlessForm) {\n // this is a hack because I need to validate all form values with the entire schema\n const parsedValues = parseJSFToValidate(\n values,\n entireTerminationSchema.fields,\n { isPartialValidation: true },\n );\n\n const { customer_informed_employee: customerInformedEmployee } =\n parsedValues;\n\n const employeeAwareness =\n customerInformedEmployee === 'yes'\n ? {\n employee_awareness: {\n date: parsedValues.customer_informed_employee_date,\n note: parsedValues.customer_informed_employee_description,\n },\n }\n : undefined;\n\n const radioFieldKeys = [\n 'agrees_to_pto_amount',\n 'confidential',\n 'customer_informed_employee',\n 'will_challenge_termination',\n ];\n\n const parsedRadioValues = parseFormRadioValues(\n parsedValues,\n radioFieldKeys,\n );\n\n const normalizedValues = omit(\n parsedRadioValues,\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n );\n\n const terminationDetails: TerminationDetailsParams = omitBy(\n {\n ...normalizedValues,\n ...employeeAwareness,\n },\n isNull,\n ) as unknown as TerminationDetailsParams;\n\n const terminationPayload: CreateOffboardingParams = {\n employment_id: employmentId,\n termination_details: terminationDetails,\n type: 'termination',\n };\n\n return mutateAsync(terminationPayload);\n }\n\n return;\n }\n\n function back() {\n previousStep();\n }\n\n function next() {\n nextStep();\n }\n\n const initialValues = buildInitialValues({\n ...stepState.values?.employee_communication,\n ...stepState.values?.termination_details,\n ...stepState.values?.paid_time_off,\n ...stepState.values?.additional_information,\n });\n\n return {\n /**\n * Employment id passed useful to be used between components\n */\n employmentId,\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState,\n /**\n * Array of form fields from the contract amendment schema\n */\n fields: terminationHeadlessForm?.fields || [],\n /**\n * Loading state indicating if the termination schema is being fetched\n */\n isLoading: isLoadingTermination,\n /**\n * Loading state indicating if a contract amendment mutation is in progress\n */\n isSubmitting: createTermination.isPending,\n /**\n * Initial form values\n */\n initialValues: initialValues,\n /**\n * Function to validate form values against the contract amendment schema\n * @param values - Form values to validate\n * @returns Validation result or null if no schema is available\n */\n handleValidation: (values: TerminationFormValues) => {\n if (terminationHeadlessForm) {\n const parsedValues = parseJSFToValidate(\n values,\n terminationHeadlessForm?.fields,\n );\n return terminationHeadlessForm?.handleValidation(parsedValues);\n }\n return null;\n },\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: (values: Partial<TerminationFormValues>) => {\n if (entireTerminationSchema) {\n const parsedValues = parseJSFToValidate(\n values,\n entireTerminationSchema?.fields,\n { isPartialValidation: true },\n );\n setFieldValues(parsedValues as TerminationFormValues);\n }\n },\n /**\n * Function to parse form values before submission\n * @param values - Form values to parse\n * @returns Parsed form values\n */\n parseFormValues: (values: TerminationFormValues) => {\n return parseJSFToValidate(values, entireTerminationSchema.fields, {\n isPartialValidation: true,\n });\n },\n /**\n * Function to handle form submission\n * @param values - Form values to submit\n * @returns Promise resolving to the mutation result\n */\n onSubmit,\n\n /**\n * Function to handle going back to the previous step\n * @returns {void}\n */\n back,\n\n /**\n * Function to handle going to the next step\n * @returns {void}\n */\n next,\n };\n};\n"],"mappings":"wbAOA,OAAS,sBAAAA,EAAoB,UAAAC,MAAc,8BAC3C,OAAS,eAAAC,EAAa,YAAAC,MAAgB,wBACtC,OAAOC,MAAY,gBACnB,OAAOC,MAAY,gBAInB,OAAOC,MAAU,cASjB,SAASC,EACPC,EACuB,CAsBvB,MArB6C,CAC3C,aAAc,GACd,2BAA4B,GAC5B,gCAAiC,GACjC,uCAAwC,GACxC,eAAgB,GAChB,mBAAoB,OACpB,mBAAoB,GACpB,yBAA0B,CAAC,EAC3B,2BAA4B,GAC5B,uCAAwC,KACxC,qBAAsB,GACtB,2BAA4B,KAC5B,kCAAmC,GACnC,oBAAqB,GACrB,0BAA2B,GAC3B,wBAAyB,CAAC,EAC1B,eAAgB,OAChB,GAAGA,CACL,CAGF,CAzBSC,EAAAF,EAAA,sBA2BT,IAAMG,EAAuBD,EAAA,IAAM,CACjC,GAAM,CAAE,OAAAE,CAAO,EAAIC,EAAU,EAC7B,OAAOC,EAAY,CACjB,WAAYJ,EAACK,GACJC,EAAsB,CAC3B,OAAQJ,EACR,KAAMG,CACR,CAAC,EAJS,aAMd,CAAC,CACH,EAV6B,wBAYvBE,EAAuBP,EAAA,CAAC,CAC5B,WAAAQ,EACA,UAAAC,EACA,KAAAC,CACF,IAKSC,EAAS,CACd,SAAU,CAAC,+BAAgCD,CAAI,EAC/C,QAASV,EAAA,IACAY,EAAOF,CAA2B,GAAKG,EADvC,WAGT,OAAQb,EAAA,CAAC,CAAE,KAAAc,CAAK,IAAM,CACpB,IAAIC,EAAYD,GAAM,QAAU,CAAC,EACjC,GAAIL,EAAW,CACb,GAAM,CAAE,OAAAG,CAAO,EAAII,EAAOD,EAAWN,CAAS,EAC9CM,EAAYH,CACd,CAIA,OAHaK,EAAmBF,GAAa,CAAC,EAAG,CAC/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xB,EAAS,CACX,CAFSzB,EAAAiD,EAAA,QAIT,IAAMC,EAAgBpD,EAAmB,CACvC,GAAGyB,EAAU,QAAQ,uBACrB,GAAGA,EAAU,QAAQ,oBACrB,GAAGA,EAAU,QAAQ,cACrB,GAAGA,EAAU,QAAQ,sBACvB,CAAC,EAED,MAAO,CAIL,aAAAJ,EAIA,UAAAI,EAIA,OAAQK,GAAyB,QAAU,CAAC,EAI5C,UAAWC,EAIX,aAAcG,EAAkB,UAIhC,cAAekB,EAMf,iBAAkBlD,EAACoC,GAAkC,CACnD,GAAIR,EAAyB,CAC3B,IAAMS,EAAeC,EACnBF,EACAR,GAAyB,MAC3B,EACA,OAAOA,GAAyB,iBAAiBS,CAAY,CAC/D,CACA,OAAO,IACT,EATkB,oBAclB,kBAAmBrC,EAACoC,GAA2C,CAC7D,GAAIN,EAAyB,CAC3B,IAAMO,EAAeC,EACnBF,EACAN,GAAyB,OACzB,CAAE,oBAAqB,EAAK,CAC9B,EACAR,EAAee,CAAqC,CACtD,CACF,EATmB,qBAenB,gBAAiBrC,EAACoC,GACTE,EAAmBF,EAAQN,EAAwB,OAAQ,CAChE,oBAAqB,EACvB,CAAC,EAHc,mBAUjB,SAAAK,EAMA,KAAAa,EAMA,KAAAC,CACF,CACF,EA1L8B","names":["createHeadlessForm","modify","useMutation","useQuery","omitBy","isNull","omit","buildInitialValues","stepsInitialValues","__name","useCreateTermination","client","useClient","useMutation","payload","postCreateOffboarding","useTerminationSchema","formValues","jsfModify","step","useQuery","schema","defaultSchema","data","jsfSchema","modify","createHeadlessForm","useTermination","employmentId","options","fieldValues","setFieldValues","stepState","previousStep","nextStep","useStepState","STEPS","terminationHeadlessForm","isLoadingTermination","entireTerminationSchema","jsonSchema","createTermination","mutateAsync","mutationToPromise","onSubmit","values","parsedValues","parseJSFToValidate","customerInformedEmployee","employeeAwareness","parsedRadioValues","parseFormRadioValues","normalizedValues","omit","terminationDetails","omitBy","isNull","back","next","initialValues"]}
@@ -1,2 +0,0 @@
1
- var e={data:{version:7,schema:{additionalProperties:!1,allOf:[{if:{properties:{will_challenge_termination:{const:"yes"}},required:["will_challenge_termination"]},then:{properties:{will_challenge_termination_description:{type:"string"}},required:["will_challenge_termination_description"]},else:{properties:{will_challenge_termination_description:!1}}}],properties:{termination_reason:{title:"Termination reason",description:"Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.",type:"string",oneOf:[{const:"gross_misconduct",title:"Gross misconduct"},{const:"performance",title:"Performance"},{const:"workforce_reduction",title:"Workforce Reduction"},{const:"values",title:"Values"},{const:"compliance_issue",title:"Compliance issue"},{const:"incapacity_to_perform_inherent_duties",title:"Incapacity To perform inherent duties"},{const:"mutual_agreement",title:"Mutual agreement"},{const:"cancellation_before_start_date",title:"Decision to cancel hiring before the employee starts"},{const:"job_abandonment",title:"Job abandonment"},{const:"dissatisfaction_with_remote_service",title:"Dissatisfaction with EOR service"},{const:"end_of_fixed_term_contract_compliance_issue",title:"End of fixed-term contract"},{const:"other",title:"Other"}],"x-jsf-presentation":{inputType:"select"}},reason_description:{description:"",maxLength:1e3,title:"Termination reason details",type:"string","x-jsf-presentation":{inputType:"textarea"}},additional_comments:{description:"",maxLength:1e3,title:"Additional details regarding this termination process.",type:"string","x-jsf-presentation":{inputType:"textarea"}},termination_reason_files:{description:"Please upload any supporting documents regarding the termination reason.",title:"Termination reason files",type:"string","x-jsf-presentation":{inputType:"file",accept:".pdf",multiple:!0}},risk_assessment_reasons:{description:"",title:"This employee is...",type:"array",items:{anyOf:[{const:"sick_leave",title:"Currently on or recently returned from sick leave"},{const:"family_leave",title:"Currently on or recently returned from maternity, paternity, or other family leave"},{const:"pregnant_or_breastfeeding",title:"Pregnant or breastfeeding"},{const:"requested_medical_or_family_leave",title:"Requested medical or family leave"},{const:"disabled_or_health_condition",title:"Disabled or has a health condition"},{const:"member_of_union_or_works_council",title:"A member of a union or works council"},{const:"caring_responsibilities",title:"Caring responsibilities"},{const:"reported_concerns_with_workplace",title:"Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions"},{const:"none_of_these",title:"To the best of my knowledge, I am not aware of any of these"}]},"x-jsf-presentation":{inputType:"checkbox",direction:"column"}},will_challenge_termination:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Do you consider it is likely that the employee will challenge their termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},will_challenge_termination_description:{description:"",maxLength:1e3,title:"Please explain how the employee will challenge their termination",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},proposed_termination_date:{description:"",format:"date",maxLength:255,title:"Proposed termination date",type:"string","x-jsf-presentation":{inputType:"date"}}},required:["termination_reason","reason_description","risk_assessment_reasons","will_challenge_termination","proposed_termination_date"],type:"object","x-jsf-order":["termination_reason","reason_description","additional_comments","termination_reason_files","risk_assessment_reasons","will_challenge_termination","will_challenge_termination_description","proposed_termination_date"]}}};export{e as a};
2
- //# sourceMappingURL=chunk-VX2UC3HG.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Termination/json-schemas/terminationDetails.ts"],"sourcesContent":["export const terminationDetailsSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n will_challenge_termination: {\n const: 'yes',\n },\n },\n required: ['will_challenge_termination'],\n },\n then: {\n properties: {\n will_challenge_termination_description: {\n type: 'string',\n },\n },\n required: ['will_challenge_termination_description'],\n },\n else: {\n properties: {\n will_challenge_termination_description: false,\n },\n },\n },\n ],\n properties: {\n termination_reason: {\n title: 'Termination reason',\n description:\n 'Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.',\n type: 'string',\n oneOf: [\n {\n const: 'gross_misconduct',\n title: 'Gross misconduct',\n },\n {\n const: 'performance',\n title: 'Performance',\n },\n {\n const: 'workforce_reduction',\n title: 'Workforce Reduction',\n },\n {\n const: 'values',\n title: 'Values',\n },\n {\n const: 'compliance_issue',\n title: 'Compliance issue',\n },\n {\n const: 'incapacity_to_perform_inherent_duties',\n title: 'Incapacity To perform inherent duties',\n },\n {\n const: 'mutual_agreement',\n title: 'Mutual agreement',\n },\n {\n const: 'cancellation_before_start_date',\n title: 'Decision to cancel hiring before the employee starts',\n },\n {\n const: 'job_abandonment',\n title: 'Job abandonment',\n },\n {\n const: 'dissatisfaction_with_remote_service',\n title: 'Dissatisfaction with EOR service',\n },\n {\n const: 'end_of_fixed_term_contract_compliance_issue',\n title: 'End of fixed-term contract',\n },\n {\n const: 'other',\n title: 'Other',\n },\n ],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n reason_description: {\n description: '',\n maxLength: 1000,\n title: 'Termination reason details',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n additional_comments: {\n description: '',\n maxLength: 1000,\n title: 'Additional details regarding this termination process.',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n termination_reason_files: {\n description:\n 'Please upload any supporting documents regarding the termination reason.',\n title: 'Termination reason files',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n multiple: true,\n },\n },\n risk_assessment_reasons: {\n description: '',\n title: 'This employee is...',\n type: 'array',\n items: {\n anyOf: [\n {\n const: 'sick_leave',\n title: 'Currently on or recently returned from sick leave',\n },\n {\n const: 'family_leave',\n title:\n 'Currently on or recently returned from maternity, paternity, or other family leave',\n },\n {\n const: 'pregnant_or_breastfeeding',\n title: 'Pregnant or breastfeeding',\n },\n {\n const: 'requested_medical_or_family_leave',\n title: 'Requested medical or family leave',\n },\n {\n const: 'disabled_or_health_condition',\n title: 'Disabled or has a health condition',\n },\n {\n const: 'member_of_union_or_works_council',\n title: 'A member of a union or works council',\n },\n {\n const: 'caring_responsibilities',\n title: 'Caring responsibilities',\n },\n {\n const: 'reported_concerns_with_workplace',\n title:\n 'Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions',\n },\n {\n const: 'none_of_these',\n title:\n 'To the best of my knowledge, I am not aware of any of these',\n },\n ],\n },\n 'x-jsf-presentation': {\n inputType: 'checkbox',\n direction: 'column',\n },\n },\n will_challenge_termination: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title:\n 'Do you consider it is likely that the employee will challenge their termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n will_challenge_termination_description: {\n description: '',\n maxLength: 1000,\n title:\n 'Please explain how the employee will challenge their termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n proposed_termination_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'Proposed termination date',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n },\n required: [\n 'termination_reason',\n 'reason_description',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'proposed_termination_date',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'termination_reason',\n 'reason_description',\n 'additional_comments',\n 'termination_reason_files',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'will_challenge_termination_description',\n 'proposed_termination_date',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAA2B,CACtC,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CACL,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CAAC,wCAAwC,CACrD,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,EAC1C,CACF,CACF,CACF,EACA,WAAY,CACV,mBAAoB,CAClB,MAAO,qBACP,YACE,oGACF,KAAM,SACN,MAAO,CACL,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,cACP,MAAO,aACT,EACA,CACE,MAAO,sBACP,MAAO,qBACT,EACA,CACE,MAAO,SACP,MAAO,QACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,wCACP,MAAO,uCACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,iCACP,MAAO,sDACT,EACA,CACE,MAAO,kBACP,MAAO,iBACT,EACA,CACE,MAAO,sCACP,MAAO,kCACT,EACA,CACE,MAAO,8CACP,MAAO,4BACT,EACA,CACE,MAAO,QACP,MAAO,OACT,CACF,EACA,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,mBAAoB,CAClB,YAAa,GACb,UAAW,IACX,MAAO,6BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,oBAAqB,CACnB,YAAa,GACb,UAAW,IACX,MAAO,yDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,yBAA0B,CACxB,YACE,2EACF,MAAO,2BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,OACX,OAAQ,OACR,SAAU,EACZ,CACF,EACA,wBAAyB,CACvB,YAAa,GACb,MAAO,sBACP,KAAM,QACN,MAAO,CACL,MAAO,CACL,CACE,MAAO,aACP,MAAO,mDACT,EACA,CACE,MAAO,eACP,MACE,oFACJ,EACA,CACE,MAAO,4BACP,MAAO,2BACT,EACA,CACE,MAAO,oCACP,MAAO,mCACT,EACA,CACE,MAAO,+BACP,MAAO,oCACT,EACA,CACE,MAAO,mCACP,MAAO,sCACT,EACA,CACE,MAAO,0BACP,MAAO,yBACT,EACA,CACE,MAAO,mCACP,MACE,2LACJ,EACA,CACE,MAAO,gBACP,MACE,6DACJ,CACF,CACF,EACA,qBAAsB,CACpB,UAAW,WACX,UAAW,QACb,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MACE,mFACF,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MACE,mEACF,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,0BAA2B,CACzB,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,4BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,MACb,CACF,CACF,EACA,SAAU,CACR,qBACA,qBACA,0BACA,6BACA,2BACF,EACA,KAAM,SACN,cAAe,CACb,qBACA,qBACA,sBACA,2BACA,0BACA,6BACA,yCACA,2BACF,CACF,CACF,CACF","names":["terminationDetailsSchema"]}
@@ -1,2 +0,0 @@
1
- var e={data:{version:7,schema:{additionalProperties:!1,allOf:[{if:{properties:{personal_email:{pattern:"^[a-zA-Z0-9 .]+$"}}},then:{properties:{personal_email:{"x-jsf-presentation":{statement:{title:"Please make sure to add the employee personal email so we can get in contact with the employee after the termination process takes effect.",inputType:"statement",severity:"warning"}}}}}},{if:{properties:{customer_informed_employee:{const:"yes"}},required:["customer_informed_employee"]},then:{properties:{customer_informed_employee_date:{type:"string"},customer_informed_employee_description:{type:"string"}},required:["customer_informed_employee_date","customer_informed_employee_description"]},else:{properties:{customer_informed_employee_date:!1,customer_informed_employee_description:!1}}},{if:{properties:{will_challenge_termination:{const:"yes"}},required:["will_challenge_termination"]},then:{properties:{will_challenge_termination_description:{type:"string"}},required:["will_challenge_termination_description"]},else:{properties:{will_challenge_termination_description:!1}}},{if:{properties:{agrees_to_pto_amount:{const:"no"}},required:["agrees_to_pto_amount"]},then:{properties:{agrees_to_pto_amount_notes:{type:"string"}},required:["agrees_to_pto_amount_notes"]},else:{properties:{agrees_to_pto_amount_notes:!1,timesheet_file:!1}}}],properties:{confidential:{description:"Confidential requests are visible only to you. Non-confidential requests are visible to all admins in your company.",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Is this request confidential?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio",statement:{title:"Please do not inform the employee of their termination until we review your request for legal risks. When we approve your request, you can inform the employee and we'll take it from there.",inputType:"statement",severity:"warning"}}},customer_informed_employee:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Have you informed the employee of the termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},customer_informed_employee_date:{description:"",format:"date",maxLength:255,title:"When the employee was told about the termination",type:["string","null"],"x-jsf-presentation":{inputType:"date"}},customer_informed_employee_description:{description:"",maxLength:1e3,title:"How did you share this information?",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},personal_email:{description:"",maxLength:255,title:"Employee's personal email",format:"email",type:"string","x-jsf-presentation":{inputType:"email"}},termination_reason:{title:"Termination reason",description:"Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.",type:"string",oneOf:[{const:"gross_misconduct",title:"Gross misconduct"},{const:"performance",title:"Performance"},{const:"workforce_reduction",title:"Workforce Reduction"},{const:"values",title:"Values"},{const:"compliance_issue",title:"Compliance issue"},{const:"incapacity_to_perform_inherent_duties",title:"Incapacity To perform inherent duties"},{const:"mutual_agreement",title:"Mutual agreement"},{const:"cancellation_before_start_date",title:"Decision to cancel hiring before the employee starts"},{const:"job_abandonment",title:"Job abandonment"},{const:"dissatisfaction_with_remote_service",title:"Dissatisfaction with EOR service"},{const:"end_of_fixed_term_contract_compliance_issue",title:"End of fixed-term contract"},{const:"other",title:"Other"}],"x-jsf-presentation":{inputType:"select"}},reason_description:{description:"",maxLength:1e3,title:"Termination reason details",type:"string","x-jsf-presentation":{inputType:"textarea"}},additional_comments:{description:"",maxLength:1e3,title:"Additional details regarding this termination process.",type:"string","x-jsf-presentation":{inputType:"textarea"}},termination_reason_files:{description:"Please upload any supporting documents regarding the termination reason.",title:"Termination reason files",type:"string","x-jsf-presentation":{inputType:"file",accept:".pdf",multiple:!0}},risk_assessment_reasons:{description:"",title:"This employee is...",type:"array",items:{anyOf:[{const:"sick_leave",title:"Currently on or recently returned from sick leave"},{const:"family_leave",title:"Currently on or recently returned from maternity, paternity, or other family leave"},{const:"pregnant_or_breastfeeding",title:"Pregnant or breastfeeding"},{const:"requested_medical_or_family_leave",title:"Requested medical or family leave"},{const:"disabled_or_health_condition",title:"Disabled or has a health condition"},{const:"member_of_union_or_works_council",title:"A member of a union or works council"},{const:"caring_responsibilities",title:"Caring responsibilities"},{const:"reported_concerns_with_workplace",title:"Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions"},{const:"none_of_these",title:"To the best of my knowledge, I am not aware of any of these"}]},"x-jsf-presentation":{inputType:"checkbox",direction:"column"}},will_challenge_termination:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Do you consider it is likely that the employee will challenge their termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},will_challenge_termination_description:{description:"",maxLength:1e3,title:"Please explain how the employee will challenge their termination",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},proposed_termination_date:{description:"",format:"date",maxLength:255,title:"Proposed termination date",type:"string","x-jsf-presentation":{inputType:"date"}},agrees_to_pto_amount:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Are these paid time off records correct?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},agrees_to_pto_amount_notes:{description:"Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.",maxLength:1e3,title:"Provide time off details",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},timesheet_file:{description:"Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.",title:"Timesheet document",type:["string","null"],"x-jsf-presentation":{inputType:"file",accept:".pdf"}},acknowledge_termination_procedure:{description:"",title:"I, {{requesterName}} have read and agree to the procedures as defined in the termination form.",type:"boolean","x-jsf-presentation":{direction:"column",inputType:"checkbox"}}},required:["confidential","customer_informed_employee","personal_email","termination_reason","reason_description","risk_assessment_reasons","will_challenge_termination","proposed_termination_date","agrees_to_pto_amount","acknowledge_termination_procedure"],type:"object","x-jsf-order":["is_confidential","customer_informed_employee","customer_informed_employee_date","customer_informed_employee_description","personal_email","termination_reason","reason_description","additional_comments","termination_reason_files","risk_assessment_reasons","will_challenge_termination","will_challenge_termination_description","proposed_termination_date","agrees_to_pto_amount","agrees_to_pto_amount_notes","timesheet_file","acknowledge_termination_procedure"]}}};export{e as a};
2
- //# sourceMappingURL=chunk-WWANHPT7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Termination/json-schemas/jsonSchema.ts"],"sourcesContent":["export const jsonSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n personal_email: {\n pattern: '^[a-zA-Z0-9 .]+$',\n },\n },\n },\n then: {\n properties: {\n personal_email: {\n 'x-jsf-presentation': {\n statement: {\n title:\n 'Please make sure to add the employee personal email so we can get in contact with the employee after the termination process takes effect.',\n inputType: 'statement',\n severity: 'warning',\n },\n },\n },\n },\n },\n },\n {\n if: {\n properties: {\n customer_informed_employee: {\n const: 'yes',\n },\n },\n required: ['customer_informed_employee'],\n },\n then: {\n properties: {\n customer_informed_employee_date: {\n type: 'string',\n },\n customer_informed_employee_description: {\n type: 'string',\n },\n },\n required: [\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n ],\n },\n else: {\n properties: {\n customer_informed_employee_date: false,\n customer_informed_employee_description: false,\n },\n },\n },\n {\n if: {\n properties: {\n will_challenge_termination: {\n const: 'yes',\n },\n },\n required: ['will_challenge_termination'],\n },\n then: {\n properties: {\n will_challenge_termination_description: {\n type: 'string',\n },\n },\n required: ['will_challenge_termination_description'],\n },\n else: {\n properties: {\n will_challenge_termination_description: false,\n },\n },\n },\n {\n if: {\n properties: {\n agrees_to_pto_amount: {\n const: 'no',\n },\n },\n required: ['agrees_to_pto_amount'],\n },\n then: {\n properties: {\n agrees_to_pto_amount_notes: {\n type: 'string',\n },\n },\n required: ['agrees_to_pto_amount_notes'],\n },\n else: {\n properties: {\n agrees_to_pto_amount_notes: false,\n timesheet_file: false,\n },\n },\n },\n ],\n properties: {\n confidential: {\n description:\n 'Confidential requests are visible only to you. Non-confidential requests are visible to all admins in your company.',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Is this request confidential?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n statement: {\n title:\n \"Please do not inform the employee of their termination until we review your request for legal risks. When we approve your request, you can inform the employee and we'll take it from there.\",\n inputType: 'statement',\n severity: 'warning',\n },\n },\n },\n customer_informed_employee: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Have you informed the employee of the termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n customer_informed_employee_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'When the employee was told about the termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n customer_informed_employee_description: {\n description: '',\n maxLength: 1000,\n title: 'How did you share this information?',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n personal_email: {\n description: '',\n maxLength: 255,\n title: \"Employee's personal email\",\n format: 'email',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'email',\n },\n },\n termination_reason: {\n title: 'Termination reason',\n description:\n 'Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.',\n type: 'string',\n oneOf: [\n {\n const: 'gross_misconduct',\n title: 'Gross misconduct',\n },\n {\n const: 'performance',\n title: 'Performance',\n },\n {\n const: 'workforce_reduction',\n title: 'Workforce Reduction',\n },\n {\n const: 'values',\n title: 'Values',\n },\n {\n const: 'compliance_issue',\n title: 'Compliance issue',\n },\n {\n const: 'incapacity_to_perform_inherent_duties',\n title: 'Incapacity To perform inherent duties',\n },\n {\n const: 'mutual_agreement',\n title: 'Mutual agreement',\n },\n {\n const: 'cancellation_before_start_date',\n title: 'Decision to cancel hiring before the employee starts',\n },\n {\n const: 'job_abandonment',\n title: 'Job abandonment',\n },\n {\n const: 'dissatisfaction_with_remote_service',\n title: 'Dissatisfaction with EOR service',\n },\n {\n const: 'end_of_fixed_term_contract_compliance_issue',\n title: 'End of fixed-term contract',\n },\n {\n const: 'other',\n title: 'Other',\n },\n ],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n reason_description: {\n description: '',\n maxLength: 1000,\n title: 'Termination reason details',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n additional_comments: {\n description: '',\n maxLength: 1000,\n title: 'Additional details regarding this termination process.',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n termination_reason_files: {\n description:\n 'Please upload any supporting documents regarding the termination reason.',\n title: 'Termination reason files',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n multiple: true,\n },\n },\n risk_assessment_reasons: {\n description: '',\n title: 'This employee is...',\n type: 'array',\n items: {\n anyOf: [\n {\n const: 'sick_leave',\n title: 'Currently on or recently returned from sick leave',\n },\n {\n const: 'family_leave',\n title:\n 'Currently on or recently returned from maternity, paternity, or other family leave',\n },\n {\n const: 'pregnant_or_breastfeeding',\n title: 'Pregnant or breastfeeding',\n },\n {\n const: 'requested_medical_or_family_leave',\n title: 'Requested medical or family leave',\n },\n {\n const: 'disabled_or_health_condition',\n title: 'Disabled or has a health condition',\n },\n {\n const: 'member_of_union_or_works_council',\n title: 'A member of a union or works council',\n },\n {\n const: 'caring_responsibilities',\n title: 'Caring responsibilities',\n },\n {\n const: 'reported_concerns_with_workplace',\n title:\n 'Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions',\n },\n {\n const: 'none_of_these',\n title:\n 'To the best of my knowledge, I am not aware of any of these',\n },\n ],\n },\n 'x-jsf-presentation': {\n inputType: 'checkbox',\n direction: 'column',\n },\n },\n will_challenge_termination: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title:\n 'Do you consider it is likely that the employee will challenge their termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n will_challenge_termination_description: {\n description: '',\n maxLength: 1000,\n title:\n 'Please explain how the employee will challenge their termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n proposed_termination_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'Proposed termination date',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n agrees_to_pto_amount: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Are these paid time off records correct?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n agrees_to_pto_amount_notes: {\n description:\n 'Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.',\n maxLength: 1000,\n title: 'Provide time off details',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n timesheet_file: {\n description:\n 'Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.',\n title: 'Timesheet document',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n },\n },\n acknowledge_termination_procedure: {\n description: '',\n title:\n 'I, {{requesterName}} have read and agree to the procedures as defined in the termination form.',\n type: 'boolean',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'checkbox',\n },\n },\n },\n required: [\n 'confidential',\n 'customer_informed_employee',\n 'personal_email',\n 'termination_reason',\n 'reason_description',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'proposed_termination_date',\n 'agrees_to_pto_amount',\n 'acknowledge_termination_procedure',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'is_confidential',\n 'customer_informed_employee',\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n 'personal_email',\n 'termination_reason',\n 'reason_description',\n 'additional_comments',\n 'termination_reason_files',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'will_challenge_termination_description',\n 'proposed_termination_date',\n 'agrees_to_pto_amount',\n 'agrees_to_pto_amount_notes',\n 'timesheet_file',\n 'acknowledge_termination_procedure',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAAa,CACxB,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CACL,CACE,GAAI,CACF,WAAY,CACV,eAAgB,CACd,QAAS,kBACX,CACF,CACF,EACA,KAAM,CACJ,WAAY,CACV,eAAgB,CACd,qBAAsB,CACpB,UAAW,CACT,MACE,6IACF,UAAW,YACX,SAAU,SACZ,CACF,CACF,CACF,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,gCAAiC,CAC/B,KAAM,QACR,EACA,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CACR,kCACA,wCACF,CACF,EACA,KAAM,CACJ,WAAY,CACV,gCAAiC,GACjC,uCAAwC,EAC1C,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CAAC,wCAAwC,CACrD,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,EAC1C,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,qBAAsB,CACpB,MAAO,IACT,CACF,EACA,SAAU,CAAC,sBAAsB,CACnC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,CAC1B,KAAM,QACR,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,GAC5B,eAAgB,EAClB,CACF,CACF,CACF,EACA,WAAY,CACV,aAAc,CACZ,YACE,sHACF,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,gCACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,QACX,UAAW,CACT,MACE,+LACF,UAAW,YACX,SAAU,SACZ,CACF,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,qDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,gCAAiC,CAC/B,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,mDACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,MACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MAAO,sCACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,eAAgB,CACd,YAAa,GACb,UAAW,IACX,MAAO,4BACP,OAAQ,QACR,KAAM,SACN,qBAAsB,CACpB,UAAW,OACb,CACF,EACA,mBAAoB,CAClB,MAAO,qBACP,YACE,oGACF,KAAM,SACN,MAAO,CACL,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,cACP,MAAO,aACT,EACA,CACE,MAAO,sBACP,MAAO,qBACT,EACA,CACE,MAAO,SACP,MAAO,QACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,wCACP,MAAO,uCACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,iCACP,MAAO,sDACT,EACA,CACE,MAAO,kBACP,MAAO,iBACT,EACA,CACE,MAAO,sCACP,MAAO,kCACT,EACA,CACE,MAAO,8CACP,MAAO,4BACT,EACA,CACE,MAAO,QACP,MAAO,OACT,CACF,EACA,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,mBAAoB,CAClB,YAAa,GACb,UAAW,IACX,MAAO,6BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,oBAAqB,CACnB,YAAa,GACb,UAAW,IACX,MAAO,yDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,yBAA0B,CACxB,YACE,2EACF,MAAO,2BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,OACX,OAAQ,OACR,SAAU,EACZ,CACF,EACA,wBAAyB,CACvB,YAAa,GACb,MAAO,sBACP,KAAM,QACN,MAAO,CACL,MAAO,CACL,CACE,MAAO,aACP,MAAO,mDACT,EACA,CACE,MAAO,eACP,MACE,oFACJ,EACA,CACE,MAAO,4BACP,MAAO,2BACT,EACA,CACE,MAAO,oCACP,MAAO,mCACT,EACA,CACE,MAAO,+BACP,MAAO,oCACT,EACA,CACE,MAAO,mCACP,MAAO,sCACT,EACA,CACE,MAAO,0BACP,MAAO,yBACT,EACA,CACE,MAAO,mCACP,MACE,2LACJ,EACA,CACE,MAAO,gBACP,MACE,6DACJ,CACF,CACF,EACA,qBAAsB,CACpB,UAAW,WACX,UAAW,QACb,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MACE,mFACF,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MACE,mEACF,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,0BAA2B,CACzB,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,4BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,MACb,CACF,EACA,qBAAsB,CACpB,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,2CACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,2BAA4B,CAC1B,YACE,sIACF,UAAW,IACX,MAAO,2BACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,eAAgB,CACd,YACE,4HACF,MAAO,qBACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,OACX,OAAQ,MACV,CACF,EACA,kCAAmC,CACjC,YAAa,GACb,MACE,iGACF,KAAM,UACN,qBAAsB,CACpB,UAAW,SACX,UAAW,UACb,CACF,CACF,EACA,SAAU,CACR,eACA,6BACA,iBACA,qBACA,qBACA,0BACA,6BACA,4BACA,uBACA,mCACF,EACA,KAAM,SACN,cAAe,CACb,kBACA,6BACA,kCACA,yCACA,iBACA,qBACA,qBACA,sBACA,2BACA,0BACA,6BACA,yCACA,4BACA,uBACA,6BACA,iBACA,mCACF,CACF,CACF,CACF","names":["jsonSchema"]}