@remoteoss/remote-flows 0.1.1 → 0.2.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 (195) hide show
  1. package/README.md +2 -0
  2. package/dist/chunk-2EKC7DK3.js +2 -0
  3. package/dist/chunk-2EKC7DK3.js.map +1 -0
  4. package/dist/chunk-36UPHOJS.js +2 -0
  5. package/dist/chunk-36UPHOJS.js.map +1 -0
  6. package/dist/chunk-37DREOGC.js +2 -0
  7. package/dist/chunk-37DREOGC.js.map +1 -0
  8. package/dist/chunk-55VACCVZ.js +2 -0
  9. package/dist/{chunk-5UXOVZY5.js.map → chunk-55VACCVZ.js.map} +1 -1
  10. package/dist/chunk-5DQBY2TR.js +2 -0
  11. package/dist/chunk-5DQBY2TR.js.map +1 -0
  12. package/dist/chunk-6HGUGIYJ.js +2 -0
  13. package/dist/chunk-6HGUGIYJ.js.map +1 -0
  14. package/dist/chunk-6LTJBLSD.js +2 -0
  15. package/dist/chunk-6LTJBLSD.js.map +1 -0
  16. package/dist/chunk-A7ZJQCNU.js +1 -0
  17. package/dist/chunk-AYFHWLQZ.js +2 -0
  18. package/dist/chunk-AYFHWLQZ.js.map +1 -0
  19. package/dist/chunk-CKGTR44U.js +2 -0
  20. package/dist/chunk-CKGTR44U.js.map +1 -0
  21. package/dist/chunk-CTG3DYJR.js +2 -0
  22. package/dist/chunk-CTG3DYJR.js.map +1 -0
  23. package/dist/chunk-DZYFSFZ7.js +2 -0
  24. package/dist/chunk-DZYFSFZ7.js.map +1 -0
  25. package/dist/chunk-EQBNHLR4.js +2 -0
  26. package/dist/chunk-EQBNHLR4.js.map +1 -0
  27. package/dist/chunk-F5QJZKDL.js +2 -0
  28. package/dist/{chunk-Q6GIPVSE.js.map → chunk-F5QJZKDL.js.map} +1 -1
  29. package/dist/chunk-FZ2HS6G7.js +2 -0
  30. package/dist/chunk-FZ2HS6G7.js.map +1 -0
  31. package/dist/chunk-FZ7FWFJX.js +1 -0
  32. package/dist/chunk-FZ7FWFJX.js.map +1 -0
  33. package/dist/chunk-GW7GG5ZW.js +2 -0
  34. package/dist/chunk-GW7GG5ZW.js.map +1 -0
  35. package/dist/chunk-HP7ZP256.js +2 -0
  36. package/dist/chunk-HP7ZP256.js.map +1 -0
  37. package/dist/chunk-IJPE22L7.js +2 -0
  38. package/dist/chunk-IJPE22L7.js.map +1 -0
  39. package/dist/chunk-IPZEZMLD.js +2 -0
  40. package/dist/chunk-IPZEZMLD.js.map +1 -0
  41. package/dist/chunk-JLUDKN4H.js +2 -0
  42. package/dist/chunk-JLUDKN4H.js.map +1 -0
  43. package/dist/chunk-JODJFARP.js +2 -0
  44. package/dist/chunk-JODJFARP.js.map +1 -0
  45. package/dist/chunk-JRQSZHUU.js +2 -0
  46. package/dist/chunk-JRQSZHUU.js.map +1 -0
  47. package/dist/chunk-KPSFJ6BN.js +2 -0
  48. package/dist/chunk-KPSFJ6BN.js.map +1 -0
  49. package/dist/chunk-LNF27NTC.js +2 -0
  50. package/dist/chunk-LNF27NTC.js.map +1 -0
  51. package/dist/chunk-N5AQSLAU.js +2 -0
  52. package/dist/chunk-N5AQSLAU.js.map +1 -0
  53. package/dist/{chunk-KQCZ2KSO.js → chunk-NBD4VOG3.js} +2 -2
  54. package/dist/{chunk-KQCZ2KSO.js.map → chunk-NBD4VOG3.js.map} +1 -1
  55. package/dist/chunk-RCX4JUI3.js +2 -0
  56. package/dist/chunk-RCX4JUI3.js.map +1 -0
  57. package/dist/chunk-S56EWAS4.js +2 -0
  58. package/dist/chunk-S56EWAS4.js.map +1 -0
  59. package/dist/chunk-SABMDOWE.js +2 -0
  60. package/dist/chunk-SABMDOWE.js.map +1 -0
  61. package/dist/chunk-SEUQNAF6.js +2 -0
  62. package/dist/chunk-SEUQNAF6.js.map +1 -0
  63. package/dist/chunk-VX2UC3HG.js +2 -0
  64. package/dist/chunk-VX2UC3HG.js.map +1 -0
  65. package/dist/chunk-W5DG5WWJ.js +2 -0
  66. package/dist/chunk-W5DG5WWJ.js.map +1 -0
  67. package/dist/chunk-XFD3ULUF.js +2 -0
  68. package/dist/chunk-XFD3ULUF.js.map +1 -0
  69. package/dist/chunk-XULIEA44.js +2 -0
  70. package/dist/{chunk-YNLDKIE4.js.map → chunk-XULIEA44.js.map} +1 -1
  71. package/dist/{chunk-VV7RML2Q.js → chunk-YAHWFLDH.js} +2 -2
  72. package/dist/chunk-YBACB5A6.js +2 -0
  73. package/dist/chunk-YBACB5A6.js.map +1 -0
  74. package/dist/flows/ContractAmendment/ContractAmendmentBack.d.ts +5 -0
  75. package/dist/flows/ContractAmendment/ContractAmendmentBack.js +2 -0
  76. package/dist/flows/ContractAmendment/ContractAmendmentBack.js.map +1 -0
  77. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +30 -0
  78. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js +2 -0
  79. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js.map +1 -0
  80. package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +24 -7
  81. package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
  82. package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +26 -3
  83. package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
  84. package/dist/flows/ContractAmendment/ContractAmendmentSubmit.d.ts +1 -1
  85. package/dist/flows/ContractAmendment/ContractAmendmentSubmit.js +1 -1
  86. package/dist/flows/ContractAmendment/context.d.ts +26 -24
  87. package/dist/flows/ContractAmendment/context.js +1 -1
  88. package/dist/flows/ContractAmendment/hooks.d.ts +94 -6
  89. package/dist/flows/ContractAmendment/hooks.js +1 -1
  90. package/dist/flows/ContractAmendment/index.d.ts +8 -5
  91. package/dist/flows/ContractAmendment/index.js +1 -1
  92. package/dist/flows/ContractAmendment/utils.d.ts +11 -0
  93. package/dist/flows/ContractAmendment/utils.js +2 -0
  94. package/dist/flows/ContractAmendment/utils.js.map +1 -0
  95. package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +2 -2
  96. package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
  97. package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +1 -1
  98. package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
  99. package/dist/flows/CostCalculator/Results/CostCalculatorResults.d.ts +1 -1
  100. package/dist/flows/CostCalculator/Results/CostCalculatorResults.js +1 -1
  101. package/dist/flows/CostCalculator/context.d.ts +1 -1
  102. package/dist/flows/CostCalculator/hooks.d.ts +1 -1
  103. package/dist/flows/CostCalculator/hooks.js +1 -1
  104. package/dist/flows/CostCalculator/index.d.ts +1 -1
  105. package/dist/flows/CostCalculator/index.js +1 -1
  106. package/dist/flows/CostCalculator/types.d.ts +1 -1
  107. package/dist/flows/CostCalculator/utils.d.ts +1 -1
  108. package/dist/flows/CostCalculator/utils.js +1 -1
  109. package/dist/flows/Termination/TerminationBack.d.ts +5 -0
  110. package/dist/flows/Termination/TerminationBack.js +2 -0
  111. package/dist/flows/Termination/TerminationBack.js.map +1 -0
  112. package/dist/flows/Termination/TerminationFlow.d.ts +46 -0
  113. package/dist/flows/Termination/TerminationFlow.js +2 -0
  114. package/dist/flows/Termination/TerminationFlow.js.map +1 -0
  115. package/dist/flows/Termination/TerminationForm.d.ts +13 -0
  116. package/dist/flows/Termination/TerminationForm.js +2 -0
  117. package/dist/flows/Termination/TerminationForm.js.map +1 -0
  118. package/dist/flows/Termination/TerminationSubmit.d.ts +5 -0
  119. package/dist/flows/Termination/TerminationSubmit.js +2 -0
  120. package/dist/flows/Termination/TerminationSubmit.js.map +1 -0
  121. package/dist/flows/Termination/TimeOff.d.ts +11 -0
  122. package/dist/flows/Termination/TimeOff.js +2 -0
  123. package/dist/flows/Termination/TimeOff.js.map +1 -0
  124. package/dist/flows/Termination/context.d.ts +52 -0
  125. package/dist/flows/Termination/context.js +2 -0
  126. package/dist/flows/Termination/context.js.map +1 -0
  127. package/dist/flows/Termination/hooks.d.ts +86 -0
  128. package/dist/flows/Termination/hooks.js +2 -0
  129. package/dist/flows/Termination/hooks.js.map +1 -0
  130. package/dist/flows/Termination/index.d.ts +14 -0
  131. package/dist/flows/Termination/index.js +2 -0
  132. package/dist/flows/Termination/index.js.map +1 -0
  133. package/dist/flows/Termination/json-schemas/additionalInformation.d.ts +25 -0
  134. package/dist/flows/Termination/json-schemas/additionalInformation.js +2 -0
  135. package/dist/flows/Termination/json-schemas/additionalInformation.js.map +1 -0
  136. package/dist/flows/Termination/json-schemas/defaultSchema.d.ts +15 -0
  137. package/dist/flows/Termination/json-schemas/defaultSchema.js +2 -0
  138. package/dist/flows/Termination/json-schemas/defaultSchema.js.map +1 -0
  139. package/dist/flows/Termination/json-schemas/employeeComunication.d.ts +133 -0
  140. package/dist/flows/Termination/json-schemas/employeeComunication.js +2 -0
  141. package/dist/flows/Termination/json-schemas/employeeComunication.js.map +1 -0
  142. package/dist/flows/Termination/json-schemas/jsonSchema.d.ts +339 -0
  143. package/dist/flows/Termination/json-schemas/jsonSchema.js +2 -0
  144. package/dist/flows/Termination/json-schemas/jsonSchema.js.map +1 -0
  145. package/dist/flows/Termination/json-schemas/paidTimeOff.d.ts +71 -0
  146. package/dist/flows/Termination/json-schemas/paidTimeOff.js +2 -0
  147. package/dist/flows/Termination/json-schemas/paidTimeOff.js.map +1 -0
  148. package/dist/flows/Termination/json-schemas/schema.d.ts +8 -0
  149. package/dist/flows/Termination/json-schemas/schema.js +2 -0
  150. package/dist/flows/Termination/json-schemas/schema.js.map +1 -0
  151. package/dist/flows/Termination/json-schemas/terminationDetails.d.ts +126 -0
  152. package/dist/flows/Termination/json-schemas/terminationDetails.js +2 -0
  153. package/dist/flows/Termination/json-schemas/terminationDetails.js.map +1 -0
  154. package/dist/flows/Termination/types.d.ts +23 -0
  155. package/dist/flows/Termination/types.js +1 -0
  156. package/dist/flows/Termination/types.js.map +1 -0
  157. package/dist/flows/Termination/utils.d.ts +8 -0
  158. package/dist/flows/Termination/utils.js +2 -0
  159. package/dist/flows/Termination/utils.js.map +1 -0
  160. package/dist/flows/useStepState.d.ts +49 -0
  161. package/dist/flows/useStepState.js +2 -0
  162. package/dist/flows/useStepState.js.map +1 -0
  163. package/dist/flows/utils.d.ts +20 -1
  164. package/dist/flows/utils.js +1 -1
  165. package/dist/index.css +1 -1
  166. package/dist/index.css.map +1 -1
  167. package/dist/index.d.ts +69 -8
  168. package/dist/index.js +1 -1
  169. package/dist/index.js.map +1 -1
  170. package/dist/mutations-v9H353tz.d.ts +10 -0
  171. package/dist/{types.gen-DCJSPsGk.d.ts → types.gen-BgLeTAqP.d.ts} +1 -1
  172. package/package.json +2 -1
  173. package/dist/chunk-4QHHDFB2.js +0 -2
  174. package/dist/chunk-4QHHDFB2.js.map +0 -1
  175. package/dist/chunk-5UXOVZY5.js +0 -2
  176. package/dist/chunk-ANPGCYMT.js +0 -2
  177. package/dist/chunk-ANPGCYMT.js.map +0 -1
  178. package/dist/chunk-GCF5EF2A.js +0 -2
  179. package/dist/chunk-GCF5EF2A.js.map +0 -1
  180. package/dist/chunk-GKEURJR4.js +0 -2
  181. package/dist/chunk-GKEURJR4.js.map +0 -1
  182. package/dist/chunk-KY7BGW6H.js +0 -2
  183. package/dist/chunk-KY7BGW6H.js.map +0 -1
  184. package/dist/chunk-MKJHD77O.js +0 -1
  185. package/dist/chunk-Q6GIPVSE.js +0 -2
  186. package/dist/chunk-UTCIIPYZ.js +0 -2
  187. package/dist/chunk-UTCIIPYZ.js.map +0 -1
  188. package/dist/chunk-VTAHQOKR.js +0 -2
  189. package/dist/chunk-VTAHQOKR.js.map +0 -1
  190. package/dist/chunk-YGP3O2VJ.js +0 -2
  191. package/dist/chunk-YGP3O2VJ.js.map +0 -1
  192. package/dist/chunk-YNLDKIE4.js +0 -2
  193. package/dist/hooks-BQWrl9Bj.d.ts +0 -50
  194. /package/dist/{chunk-MKJHD77O.js.map → chunk-A7ZJQCNU.js.map} +0 -0
  195. /package/dist/{chunk-VV7RML2Q.js.map → chunk-YAHWFLDH.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ import{b as o}from"./chunk-FI76EKUS.js";import{b as n}from"./chunk-6HGUGIYJ.js";import{a as t}from"./chunk-AYDF3IFZ.js";import i from"react";function B({children:r,...e}){let{formId:m}=n();return i.createElement(o,{...e,form:m},r)}t(B,"ContractAmendmentSubmit");export{B as a};
2
+ //# sourceMappingURL=chunk-5DQBY2TR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/ContractAmendment/ContractAmendmentSubmit.tsx"],"sourcesContent":["import { Button } from '@/src/components/ui/button';\nimport React, { ButtonHTMLAttributes, PropsWithChildren } from 'react';\nimport { useContractAmendmentContext } from './context';\n\nexport function ContractAmendmentSubmit({\n children,\n ...props\n}: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>) {\n const { formId } = useContractAmendmentContext();\n\n return (\n <Button {...props} form={formId}>\n {children}\n </Button>\n );\n}\n"],"mappings":"wHACA,OAAOA,MAAwD,QAGxD,SAASC,EAAwB,CACtC,SAAAC,EACA,GAAGC,CACL,EAA+D,CAC7D,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAA4B,EAE/C,OACEC,EAAA,cAACC,EAAA,CAAQ,GAAGJ,EAAO,KAAMC,GACtBF,CACH,CAEJ,CAXgBM,EAAAP,EAAA","names":["React","ContractAmendmentSubmit","children","props","formId","useContractAmendmentContext","React","Button","__name"]}
@@ -0,0 +1,2 @@
1
+ import{a as n}from"./chunk-AYDF3IFZ.js";import{createContext as e,useContext as o}from"react";var r=e({formId:void 0,contractAmendmentBag:null}),c=n(()=>{let t=o(r);if(!t.contractAmendmentBag)throw new Error("useContractAmendmentContext must be used within a ContractAmendmentProvider");return{formId:t.formId,contractAmendment:t.contractAmendmentBag}},"useContractAmendmentContext");export{r as a,c as b};
2
+ //# sourceMappingURL=chunk-6HGUGIYJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/ContractAmendment/context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport { useContractAmendment } from './hooks';\n\nexport const ContractAmendmentContext = createContext<{\n formId: string | undefined;\n contractAmendmentBag: ReturnType<typeof useContractAmendment> | null;\n}>({ formId: undefined, contractAmendmentBag: null });\n\nexport const useContractAmendmentContext = () => {\n const context = useContext(ContractAmendmentContext);\n if (!context.contractAmendmentBag) {\n throw new Error(\n 'useContractAmendmentContext must be used within a ContractAmendmentProvider',\n );\n }\n\n return {\n formId: context.formId,\n contractAmendment: context.contractAmendmentBag,\n } as const;\n};\n"],"mappings":"wCAAA,OAAS,iBAAAA,EAAe,cAAAC,MAAkB,QAGnC,IAAMC,EAA2BC,EAGrC,CAAE,OAAQ,OAAW,qBAAsB,IAAK,CAAC,EAEvCC,EAA8BC,EAAA,IAAM,CAC/C,IAAMC,EAAUC,EAAWL,CAAwB,EACnD,GAAI,CAACI,EAAQ,qBACX,MAAM,IAAI,MACR,6EACF,EAGF,MAAO,CACL,OAAQA,EAAQ,OAChB,kBAAmBA,EAAQ,oBAC7B,CACF,EAZ2C","names":["createContext","useContext","ContractAmendmentContext","createContext","useContractAmendmentContext","__name","context","useContext"]}
@@ -0,0 +1,2 @@
1
+ import{a as l}from"./chunk-AYFHWLQZ.js";import{b as c}from"./chunk-A4RX3KRZ.js";import{a as d}from"./chunk-N5AQSLAU.js";import{b as u}from"./chunk-6HGUGIYJ.js";import{a as r}from"./chunk-AYDF3IFZ.js";import m,{useEffect as v}from"react";import{useForm as V}from"react-hook-form";var P=["effective_date","reason_for_change","reason_for_change_description","additional_comments","additional_comments_toggle"];function x({onSubmit:f,onError:s,onSuccess:F}){let{formId:p,contractAmendment:{checkFieldUpdates:_,fields:b,onSubmit:A,stepState:C,initialValues:a,handleValidation:h}}=u(),S=c(h),e=V({resolver:S,defaultValues:C.values?.form||a,shouldUnregister:!0,mode:"onBlur"});v(()=>{let t=e?.watch(o=>{(Object.keys(e.formState.dirtyFields).length>0||e.formState.isDirty)&&_(o)});return()=>t?.unsubscribe()},[]);let g=r(async t=>{let o=!1;for(let[i,y]of Object.entries(t))if(!P.includes(i)&&a[i]!==y){o=!0;break}if(!o)return s?.({message:"no_changes_detected_contract_details"});await f?.(t);let n=await A(t);n.error?s?.(n.error):F?.(n.data)},"handleSubmit");return m.createElement(d,{...e},m.createElement("form",{id:p,"data-testid":"contract-amendment-form",onSubmit:e.handleSubmit(g),className:"space-y-4 RemoteFlows__ContractAmendmentForm"},m.createElement(l,{fields:b})))}r(x,"ContractAmendmentForm");export{x as a};
2
+ //# sourceMappingURL=chunk-6LTJBLSD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/ContractAmendment/ContractAmendmentForm.tsx"],"sourcesContent":["import {\n ContractAmendmentAutomatableResponse,\n PostAutomatableContractAmendmentError,\n} from '@/src/client';\nimport { JSONSchemaFormFields } from '@/src/components/form/JSONSchemaForm';\nimport { useJsonSchemasValidationFormResolver } from '@/src/components/form/yupValidationResolver';\nimport { Form } from '@/src/components/ui/form';\nimport React, { useEffect } from 'react';\nimport { FieldValues, useForm } from 'react-hook-form';\nimport { useContractAmendmentContext } from './context';\n\ntype ContractAmendmentFormProps = {\n /**\n * Callback function to be called when the contract amendment form is submitted.\n * This function is called before the contract amendment is submitted.\n * It can be used to perform any additional validation or processing before\n * the contract amendment is submitted.\n * @param values\n * @returns\n */\n onSubmit?: (values: FieldValues) => Promise<void>;\n /**\n * Callback function to be called when the contract amendment fails.\n * @param error\n * @returns\n */\n onError?: (\n error:\n | PostAutomatableContractAmendmentError\n | { message: 'no_changes_detected_contract_details' },\n ) => void;\n /**\n * Callback function to be called when the contract amendment is successfully submitted.\n * This function is called after the contract amendment is submitted.\n * @param data\n * @returns\n */\n onSuccess?: (data: ContractAmendmentAutomatableResponse) => void;\n};\n\nconst commonFields = [\n 'effective_date',\n 'reason_for_change',\n 'reason_for_change_description',\n 'additional_comments',\n 'additional_comments_toggle',\n] as const;\n\ntype CommonFields = (typeof commonFields)[number];\n\nexport function ContractAmendmentForm({\n onSubmit,\n onError,\n onSuccess,\n}: ContractAmendmentFormProps) {\n const {\n formId,\n contractAmendment: {\n checkFieldUpdates,\n fields,\n onSubmit: submitContractAmendment,\n stepState,\n initialValues,\n handleValidation,\n },\n } = useContractAmendmentContext();\n\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n handleValidation,\n );\n\n const form = useForm({\n resolver,\n defaultValues:\n // stepState.values is used as defaultValues for the form when the form is\n // rendered when clicking on the back button after the user has submitted the form\n // and the confirmation form is displayed.\n // This is because the form is unmounted when the user submits the form.\n stepState.values?.form || initialValues,\n shouldUnregister: true,\n mode: 'onBlur',\n });\n\n useEffect(() => {\n const subscription = form?.watch((values) => {\n const isFormDirty =\n Object.keys(form.formState.dirtyFields).length > 0 ||\n form.formState.isDirty;\n if (isFormDirty) {\n checkFieldUpdates(values);\n }\n });\n return () => subscription?.unsubscribe();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleSubmit = async (values: FieldValues) => {\n let hasContractDetailsChanges = false;\n for (const [key, value] of Object.entries(values)) {\n if (\n !commonFields.includes(key as CommonFields) &&\n // @ts-expect-error error\n initialValues[key] !== value\n ) {\n hasContractDetailsChanges = true;\n break;\n }\n }\n\n if (!hasContractDetailsChanges) {\n return onError?.({\n message: 'no_changes_detected_contract_details',\n });\n }\n\n await onSubmit?.(values);\n\n const contractAmendmentResult = await submitContractAmendment(values);\n\n if (contractAmendmentResult.error) {\n onError?.(contractAmendmentResult.error);\n } else {\n onSuccess?.(\n contractAmendmentResult.data as ContractAmendmentAutomatableResponse,\n );\n }\n };\n\n return (\n <Form {...form}>\n <form\n id={formId}\n data-testid=\"contract-amendment-form\"\n onSubmit={form.handleSubmit(handleSubmit)}\n className=\"space-y-4 RemoteFlows__ContractAmendmentForm\"\n >\n <JSONSchemaFormFields fields={fields} />\n </form>\n </Form>\n );\n}\n"],"mappings":"wMAOA,OAAOA,GAAS,aAAAC,MAAiB,QACjC,OAAsB,WAAAC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A,CAAqB,OAAQrB,EAAQ,CACxC,CACF,CAEJ,CA3FgBc,EAAApB,EAAA","names":["React","useEffect","useForm","commonFields","ContractAmendmentForm","onSubmit","onError","onSuccess","formId","checkFieldUpdates","fields","submitContractAmendment","stepState","initialValues","handleValidation","useContractAmendmentContext","resolver","useJsonSchemasValidationFormResolver","form","useForm","useEffect","subscription","values","handleSubmit","__name","hasContractDetailsChanges","key","value","contractAmendmentResult","React","Form","JSONSchemaFormFields"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-A7ZJQCNU.js.map
@@ -0,0 +1,2 @@
1
+ import{b as g}from"./chunk-WRDKLT4N.js";import{a as Y,b as U}from"./chunk-FI76EKUS.js";import{b as _,c as S,d as y,e as R,f as w,g as N}from"./chunk-N5AQSLAU.js";import{a as s}from"./chunk-SJ56GVNV.js";import{a as o}from"./chunk-AYDF3IFZ.js";import*as B from"react";import*as J from"@radix-ui/react-checkbox";import{Check as Be}from"lucide-react";var O=B.forwardRef(({className:e,...t},r)=>B.createElement(J.Root,{ref:r,className:s("peer h-4 w-4 shrink-0 rounded-sm border border-input ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-checkbox data-[state=checked]:text-primary",e),...t},B.createElement(J.Indicator,{className:s("flex items-center justify-center text-current")},B.createElement(Be,{className:"h-4 w-4"}))));O.displayName=J.Root.displayName;import*as b from"react";import{useFormContext as Ge}from"react-hook-form";function ae({name:e,defaultValue:t,description:r,label:a,onChange:i,multiple:d,options:u,...C}){let{components:l}=g(),{control:c}=Ge(),m=o((n,x,p)=>{let A=p.value?[...p.value]:[];x?A.includes(n)||p.onChange([...A,n]):p.onChange(A.filter(z=>z!==n))},"handleCheckboxChange");return b.createElement(_,{control:c,name:e,defaultValue:t,render:({field:n,fieldState:x})=>{if(l?.checkbox){let p=l?.checkbox,A={name:e,description:r,label:a,defaultValue:t,multiple:d,options:u,...C};return b.createElement(p,{field:{...n,onChange:o(z=>{if(d){let{checked:re,value:Me}=z.target;m(Me,re,n),i?.(re);return}n.onChange(z),i?.(z)},"onChange")},fieldState:x,fieldData:A})}return b.createElement(S,{"data-field":e,className:s(`RemoteFlows__CheckBoxField__Item__${e}`)},b.createElement(R,null,b.createElement(b.Fragment,null,u&&d?b.createElement(y,null,a):null,u&&d?u.map(p=>b.createElement("div",{key:p.value,className:"flex space-x-2"},b.createElement(O,{id:p.value,onCheckedChange:A=>{m(p.value,A===!0,n),i?.(A,p.value)},checked:n.value?.includes(p.value),className:"RemoteFlows__CheckBox__Input"}),b.createElement(y,{htmlFor:p.value,className:"mb-0 RemoteFlows__CheckBox__Label"},p.label))):b.createElement("div",{className:"flex space-x-2"},b.createElement(O,{id:e,onCheckedChange:p=>{n.onChange(p),i?.(p)},checked:n.value,className:"RemoteFlows__CheckBox__Input"}),b.createElement(y,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label"},a)))),r&&b.createElement(w,null,r),x.error&&b.createElement(N,null))}})}o(ae,"CheckBoxField");import{CalendarIcon as Ue}from"lucide-react";import*as v from"react";import{useFormContext as Je}from"react-hook-form";import*as W from"react";import{ChevronLeft as Ve,ChevronRight as Ee}from"lucide-react";import{DayPicker as ze}from"react-day-picker";function ie({className:e,classNames:t,showOutsideDays:r=!0,...a}){return W.createElement(ze,{showOutsideDays:r,className:s("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:s(Y({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:s("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",a.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:s(Y({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:o(({className:i,...d})=>W.createElement(Ve,{className:s("size-4",i),...d}),"IconLeft"),IconRight:o(({className:i,...d})=>W.createElement(Ee,{className:s("size-4",i),...d}),"IconRight")},...a})}o(ie,"Calendar");import*as H from"react";import*as D from"@radix-ui/react-popover";function ne({...e}){return H.createElement(D.Root,{"data-slot":"popover",...e})}o(ne,"Popover");function se({...e}){return H.createElement(D.Trigger,{"data-slot":"popover-trigger",...e})}o(se,"PopoverTrigger");function le({className:e,align:t="center",sideOffset:r=4,...a}){return H.createElement(D.Portal,null,H.createElement(D.Content,{"data-slot":"popover-content",align:t,sideOffset:r,className:s("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...a}))}o(le,"PopoverContent");import{PopoverClose as He}from"@radix-ui/react-popover";import{format as me}from"date-fns";function ce({description:e,label:t,name:r,minDate:a,onChange:i,...d}){let{components:u}=g(),{control:C}=Je();return v.createElement(_,{control:C,name:r,render:({field:l,fieldState:c})=>{if(u?.date){let m=u?.date,n={description:e,label:t,name:r,minDate:a,onChange:i,...d};return v.createElement(m,{field:{...l,onChange:o(x=>{l.onChange(x),i?.(x)},"onChange")},fieldState:c,fieldData:n})}return v.createElement(S,{"data-field":r,className:`flex flex-col RemoteFlows__DatePickerField__Item__${r}`},v.createElement(y,{className:"RemoteFlows__DatePickerField__Label"},t),v.createElement(ne,null,v.createElement(se,{asChild:!0},v.createElement(R,null,v.createElement("div",null,v.createElement(U,{type:"button",variant:"outline",className:s("w-full pl-3 text-left font-normal",!l.value&&"text-muted-foreground"),"data-testid":"date-picker-button"},l.value&&v.createElement(v.Fragment,null,me(l.value,"yyyy-MM-dd")),v.createElement(Ue,{className:"ml-auto h-4 w-4 opacity-50"}))))),v.createElement(le,{className:"w-auto p-0 RemoteFlows__DatepickerField__PopoverContent",align:"start"},v.createElement(ie,{mode:"single",className:"RemoteFlows__DatepickerField__Calendar",selected:l.value?new Date(l.value):void 0,onSelect:m=>{l.onChange(m?me(m,"yyyy-MM-dd"):null),i?.(m)},defaultMonth:a?new Date(a):void 0,components:{DayContent:o(m=>v.createElement(He,null,m.date.getDate()),"DayContent")},...a&&{disabled:o(m=>m<new Date(a),"disabled")}}))),e?v.createElement(w,null,e):null,c.error&&v.createElement(N,{className:"RemoteFlows__DatePickerField__Error"}))}})}o(ce,"DatePickerField");import*as G from"react";function de({label:e,name:t,fields:r,description:a}){return G.createElement("fieldset",{className:s("border-1 border-input p-4 rounded-xl",`RemoteFlows__FieldSetField__${t}`)},G.createElement("legend",{className:"text-sm font-semibold px-2"},e),a?G.createElement("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:a}}):null,G.createElement("div",{className:"grid gap-4"},r.map(i=>{let d=q[i.type];return G.createElement(d,{...i,key:i.name,name:`${t}.${i.name}`})})))}o(de,"FieldSetField");import*as I from"react";import{useFormContext as qe}from"react-hook-form";import T,{useState as $e,useRef as je}from"react";import{Upload as Oe,X as We}from"lucide-react";function pe({onChange:e,className:t,multiple:r}){let[a,i]=$e([]),d=je(null),u=o(()=>{d.current?.click()},"handleClick"),C=o(c=>{if(c.target.files&&c.target.files.length>0){let m=Array.from(c.target.files);i(m),e(c)}},"handleChange"),l=o(c=>{i(m=>m.filter(n=>n!==c))},"onRemoveFile");return T.createElement("div",{className:s("flex flex-col items-start gap-4",t)},T.createElement("input",{type:"file",ref:d,onChange:C,className:"hidden","aria-label":"File upload",multiple:r}),T.createElement(U,{onClick:u,className:"gap-2"},T.createElement(Oe,{className:"h-4 w-4"}),"Choose File"),a.length===0&&T.createElement("div",{className:"text-sm"},r?T.createElement("span",{className:"font-medium"},"No files selected. You can select multiple files"):T.createElement("span",{className:"font-medium"},"No file selected.")),a.length>0&&a.map((c,m)=>T.createElement("div",{key:m,className:"text-sm flex items-center gap-2"},"Selected file: ",T.createElement("span",{className:"font-medium"},c.name)," (",Math.round(c.size/1024)," KB)",T.createElement(U,{variant:"ghost",onClick:()=>l(c)},T.createElement(We,null)))))}o(pe,"FileUploader");var Ke=o(e=>new Promise((t,r)=>{let a=new FileReader;a.readAsDataURL(e),a.onload=()=>t(a.result),a.onerror=i=>r(i)}),"toBase64"),ue=o(async e=>{let t=e.target.files?Array.from(e.target.files):[];return await Promise.all(t.map(async a=>{let i=await Ke(a);return{name:a.name,content:i.split(",")[1]}}))},"convertFilesToBase64");function fe({name:e,description:t,label:r,multiple:a,onChange:i,...d}){let{components:u}=g(),{control:C}=qe();return I.createElement(_,{control:C,name:e,render:({field:l,fieldState:c})=>{if(u?.file){let m=u?.file,n={name:e,description:t,label:r,multiple:a,...d};return I.createElement(m,{field:{...l,value:null,onChange:o(async x=>{let p=await ue(x);a?(l.onChange(p),i?.(p)):(l.onChange([p[0]]),i?.([p[0]]))},"onChange")},fieldState:c,fieldData:n})}return I.createElement(S,{"data-field":e,className:`RemoteFlows__FileUpload__Item__${e}`},I.createElement(y,{className:"RemoteFlows__FileUpload__Label"},r),I.createElement(R,null,I.createElement(pe,{onChange:async m=>{let n=await ue(m);a?(l.onChange(n),i?.(n)):(l.onChange([n[0]]),i?.([n[0]]))},multiple:a,className:s("RemoteFlows__FileUpload__Input")})),t&&I.createElement("div",{className:"flex items-center justify-between"},I.createElement(w,{className:"RemoteFlows__FileUpload__Description"},t)),c.error&&I.createElement(N,{className:"RemoteFlows__FileUpload__Error"}))}})}o(fe,"FileUploadField");import Q from"react";import{useFormContext as Ye}from"react-hook-form";import*as L from"react";import{useFormContext as Xe}from"react-hook-form";import*as Fe from"react";function ge({className:e,type:t,...r}){return Fe.createElement("input",{type:t,"data-slot":"input",className:s("shadow-xs border-input file:text-foreground placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-xl border bg-transparent px-4 py-7 text-sm transition-[color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-focused","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}o(ge,"Input");function V({name:e,description:t,label:r,type:a,onChange:i,...d}){let{components:u}=g(),{control:C}=Xe();return L.createElement(_,{control:C,name:e,render:({field:l,fieldState:c})=>{if(u?.text){let m=u?.text,n={name:e,description:t,label:r,type:a,onChange:i,...d};return L.createElement(m,{field:{...l,onChange:o(x=>{l.onChange(x),i?.(x)},"onChange")},fieldState:c,fieldData:n})}return L.createElement(S,{"data-field":e,className:`RemoteFlows__TextField__Item__${e}`},L.createElement(y,{className:"RemoteFlows__TextField__Label"},r),L.createElement(R,null,L.createElement(ge,{...l,value:l.value??"",onChange:m=>{l.onChange(m),i?.(m)},className:"RemoteFlows__TextField__Input",placeholder:r})),t&&L.createElement(w,{className:"RemoteFlows__TextField__Description"},t),c.error&&L.createElement(N,{className:"RemoteFlows__TextField__Error"}))}})}o(V,"TextField");function Z(e){let{components:t}=g(),{control:r}=Ye();return t?.number?Q.createElement(_,{control:r,name:e.name,render:({field:a,fieldState:i})=>{let d=t.number;return Q.createElement(d,{field:{...a,onChange:o(u=>{a.onChange(u),e.onChange?.(u)},"onChange")},fieldState:i,fieldData:e})}}):Q.createElement(V,{...e,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$"})}o(Z,"NumberField");import*as E from"@radix-ui/react-radio-group";import{CircleIcon as Qe}from"lucide-react";import*as $ from"react";function ve({className:e,...t}){return $.createElement(E.Root,{"data-slot":"radio-group",className:s("grid gap-3",e),...t})}o(ve,"RadioGroup");function xe({className:e,...t}){return $.createElement(E.Item,{"data-slot":"radio-group-item",className:s("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t},$.createElement(E.Indicator,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center"},$.createElement(Qe,{className:"fill-radio absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})))}o(xe,"RadioGroupItem");import*as h from"react";import{useFormContext as Ze}from"react-hook-form";function _e({name:e,defaultValue:t,description:r,label:a,options:i,onChange:d,...u}){let{components:C}=g(),{control:l}=Ze();return h.createElement(_,{control:l,name:e,defaultValue:t,render:({field:c,fieldState:m})=>{if(C?.radio){let n=C?.radio,x={name:e,defaultValue:t,description:r,label:a,options:i,...u};return h.createElement(n,{field:{...c,onChange:o(p=>{c.onChange(p),d?.(p)},"onChange")},fieldState:m,fieldData:x})}return h.createElement(S,{className:s("space-y-3",`RemoteFlows__RadioGroupField__Item__${e}`),"data-field":e},h.createElement(y,null,a),h.createElement(R,null,h.createElement(ve,{"aria-label":a,onValueChange:n=>{c.onChange(n),d?.(n)},value:c.value,className:"flex flex-col space-y-3"},i?.map(n=>h.createElement(h.Fragment,null,h.createElement(S,{key:n.value,"data-field":e,className:"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item"},h.createElement(R,null,h.createElement(xe,{value:n.value,className:"RemoteFlows__RadioField__Input"})),h.createElement("div",null,h.createElement(y,{className:"font-normal mb-0 RemoteFlows__RadioField__Label"},n.label),n.description&&h.createElement(w,{className:"mt-2"},n.description))))))),r&&h.createElement(w,null,r),m.error&&h.createElement(N,null))}})}o(_e,"RadioGroupField");import*as P from"react";import*as F from"react";import*as f from"@radix-ui/react-select";import{CheckIcon as et,ChevronDownIcon as he,ChevronUpIcon as tt}from"lucide-react";function ye({...e}){return F.createElement(f.Root,{"data-slot":"select",...e})}o(ye,"Select");function be({...e}){return F.createElement(f.Group,{"data-slot":"select-group",...e})}o(be,"SelectGroup");function Ce({...e}){return F.createElement(f.Value,{"data-slot":"select-value",...e})}o(Ce,"SelectValue");function Pe({className:e,children:t,...r}){return F.createElement(f.Trigger,{"data-slot":"select-trigger",className:s("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-full items-center justify-between rounded-xl border bg-transparent px-4 py-7 text-sm whitespace-nowrap transition-[color] outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","focus-visible:border-focused",e),...r},t,F.createElement(f.Icon,{asChild:!0,className:"absolute right-4"},F.createElement(he,{className:"size-4"})))}o(Pe,"SelectTrigger");function Se({className:e,children:t,position:r="popper",...a}){return F.createElement(f.Portal,null,F.createElement(f.Content,{"data-slot":"select-content",className:s("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...a},F.createElement(ot,null),F.createElement(f.Viewport,{className:s(r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1")},t),F.createElement(rt,null)))}o(Se,"SelectContent");function Re({className:e,children:t,...r}){return F.createElement(f.Item,{"data-slot":"select-item",className:s("focus:bg-accent focus:text-accent-foreground min-h-11 justify-between [&_svg:not([class*='text-'])]:text-muted-foreground flex w-full cursor-default items-center gap-2 py-2 px-4 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r},F.createElement(f.ItemText,null,t),F.createElement("span",{className:"flex size-3.5 items-center justify-center"},F.createElement(f.ItemIndicator,null,F.createElement(et,{className:"size-4"}))))}o(Re,"SelectItem");function ot({className:e,...t}){return F.createElement(f.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:s("flex cursor-default items-center justify-center py-1",e),...t},F.createElement(tt,{className:"size-4"}))}o(ot,"SelectScrollUpButton");function rt({className:e,...t}){return F.createElement(f.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:s("flex cursor-default items-center justify-center py-1",e),...t},F.createElement(he,{className:"size-4"}))}o(rt,"SelectScrollDownButton");import{useFormContext as at}from"react-hook-form";function we({label:e,name:t,options:r,defaultValue:a,description:i,onChange:d,...u}){let{control:C}=at(),{components:l}=g();return P.createElement(_,{defaultValue:a,control:C,name:t,render:({field:c,fieldState:m})=>{if(l?.select){let n=l?.select,x={label:e,name:t,options:r,defaultValue:a,description:i,onChange:d,...u};return P.createElement(n,{field:{...c,onChange:o(p=>{c.onChange(p),d?.(p)},"onChange")},fieldState:m,fieldData:x})}return P.createElement(S,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`},P.createElement(y,{className:"RemoteFlows__SelectField__Label"},e),P.createElement(R,null,P.createElement("div",{className:"relative"},P.createElement(ye,{value:c.value||"",onValueChange:n=>{c.onChange(n),d?.(n)}},P.createElement(Pe,{className:"RemoteFlows__SelectField__Trigger","aria-invalid":!!m.error,"aria-label":e},P.createElement("span",{className:"absolute"},P.createElement(Ce,{placeholder:e}))),P.createElement(Se,{className:"RemoteFlows__SelectField__Content"},P.createElement(be,{className:"RemoteFlows__SelectField__Group"},r.map(n=>P.createElement(Re,{key:n.value,value:n.value,className:"RemoteFlows__SelectField__SelectItem"},n.label))))))),i&&P.createElement(w,null,i),m.error&&P.createElement(N,null))}})}o(we,"SelectField");import*as k from"react";import{useFormContext as it}from"react-hook-form";import*as K from"react";var ee=K.forwardRef(({className:e,...t},r)=>K.createElement("textarea",{className:s("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...t}));ee.displayName="Textarea";function Ne({name:e,description:t,label:r,onChange:a,maxLength:i,...d}){let{components:u}=g(),{control:C}=it();return k.createElement(_,{control:C,name:e,render:({field:l,fieldState:c})=>{if(u?.textarea){let n=u?.textarea,x={name:e,description:t,label:r,maxLength:i,...d};return k.createElement(n,{field:{...l,onChange:o(p=>{l.onChange(p),a?.(p)},"onChange")},fieldState:c,fieldData:x})}let m=l.value?.length??0;return k.createElement(S,{"data-field":e,className:`RemoteFlows__TextArea__Item__${e}`},k.createElement(y,{className:"RemoteFlows__TextArea__Label"},r),k.createElement(R,null,k.createElement(ee,{...l,value:l.value??"",onChange:n=>{l.onChange(n),a?.(n)},className:s(c.error&&"border-red-500 focus-visible:ring-red-500","RemoteFlows__TextArea__Input"),placeholder:r})),(t||i)&&k.createElement("div",{className:"flex items-center justify-between"},t&&k.createElement(w,{className:"RemoteFlows__TextArea__Description"},t),i&&k.createElement("span",{className:"text-sm ml-auto RemoteFlows__TextArea__MaxLength"},m,"/",i)),c.error&&k.createElement(N,{className:"RemoteFlows__TextArea__Error"}))}})}o(Ne,"TextAreaField");import te from"react";import{useFormContext as nt}from"react-hook-form";function Te(e){let{components:t}=g(),{control:r}=nt();return t?.email?te.createElement(_,{control:r,name:e.name,render:({field:a,fieldState:i})=>{let d=t.email;return te.createElement(d,{field:{...a,onChange:o(u=>{a.onChange(u),e.onChange?.(u)},"onChange")},fieldState:i,fieldData:e})}}):te.createElement(V,{...e,type:"email"})}o(Te,"EmailField");var q={checkbox:ae,text:V,email:Te,money:Z,select:we,radio:_e,number:Z,file:fe,fieldset:de,date:ce,textarea:Ne};import M,{Fragment as pt}from"react";import{cva as st}from"class-variance-authority";import*as X from"react";var lt=st("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-card bg-warning border-warning-border [&>svg]:text-current"}},defaultVariants:{variant:"default"}});function ke({className:e,variant:t,...r}){return X.createElement("div",{"data-slot":"alert",role:"alert",className:s(lt({variant:t}),e),...r})}o(ke,"Alert");function Ie({className:e,...t}){return X.createElement("div",{"data-slot":"alert-title",className:s("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}o(Ie,"AlertTitle");function De({className:e,...t}){return X.createElement("div",{"data-slot":"alert-description",className:s("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}o(De,"AlertDescription");import{AlertCircle as mt}from"lucide-react";import j from"react";function Le({title:e,description:t,severity:r}){let{components:a}=g();if(a?.statement){let i=a?.statement;return j.createElement(i,{data:{title:e,description:t,severity:r}})}return j.createElement(ke,{variant:"warning"},j.createElement(mt,{className:"h-4 w-4"}),j.createElement(Ie,null,e),j.createElement(De,null,t))}o(Le,"Statement");import oe,{useEffect as ct}from"react";import{useFormContext as dt}from"react-hook-form";function Ae({name:e,value:t,description:r,statement:a}){let{setValue:i}=dt();return ct(()=>{i(e,t)},[]),oe.createElement("div",null,oe.createElement("p",{className:`text-sm RemoteFlows__ForcedValue__Title__${e}`,dangerouslySetInnerHTML:{__html:a.title}}),oe.createElement("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:a.description||r}}))}o(Ae,"ForcedValueField");function ut(e){return e.const!==void 0&&e.const===e.default&&e.inputType!=="checkbox"&&e.inputType!=="hidden"}o(ut,"checkFieldHasForcedValue");var Jr=o(({fields:e})=>!e||e.length===0?null:M.createElement(M.Fragment,null,e.map(t=>{if(t.isVisible===!1||t.deprecated)return null;if(ut(t))return M.createElement(Ae,{key:t.name,name:t.name,description:t.description,value:t.const,statement:t.statement});let r=q[t.inputType];return r?M.createElement(pt,{key:t.name},M.createElement(r,{...t}),t.statement?M.createElement(Le,{...t.statement}):null):M.createElement("p",{className:"error"},"Field type ",t.inputType," not supported")})),"JSONSchemaFormFields");export{Jr as a};
2
+ //# sourceMappingURL=chunk-AYFHWLQZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/ui/checkbox.tsx","../src/components/form/fields/CheckBoxField.tsx","../src/components/form/fields/DatePickerField.tsx","../src/components/ui/calendar.tsx","../src/components/ui/popover.tsx","../src/components/form/fields/FieldSetField.tsx","../src/components/form/fields/FileUploadField.tsx","../src/components/ui/file-uploader.tsx","../src/components/form/fields/NumberField.tsx","../src/components/form/fields/TextField.tsx","../src/components/ui/input.tsx","../src/components/ui/radio-group.tsx","../src/components/form/fields/RadioGroupField.tsx","../src/components/form/fields/SelectField.tsx","../src/components/ui/select.tsx","../src/components/form/fields/TextAreaField.tsx","../src/components/ui/textarea.tsx","../src/components/form/fields/EmailField.tsx","../src/components/form/fields/fieldsMapping.tsx","../src/components/form/JSONSchemaForm.tsx","../src/components/ui/alert.tsx","../src/components/form/Statement.tsx","../src/components/form/fields/ForcedValueField.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { Check } from 'lucide-react';\n\nimport { cn } from '@/src/lib/utils';\n\nconst Checkbox = React.forwardRef<\n React.ComponentRef<typeof CheckboxPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n className={cn(\n 'peer h-4 w-4 shrink-0 rounded-sm border border-input ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-checkbox data-[state=checked]:text-primary',\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n className={cn('flex items-center justify-center text-current')}\n >\n <Check className=\"h-4 w-4\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n));\nCheckbox.displayName = CheckboxPrimitive.Root.displayName;\n\nexport { Checkbox };\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Checkbox } from '@/src/components/ui/checkbox';\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@/src/components/ui/form';\nimport { useFormFields } from '@/src/context';\nimport { cn } from '@/src/lib/utils';\nimport { JSFField } from '@/src/types/remoteFlows';\nimport { CheckedState } from '@radix-ui/react-checkbox';\nimport * as React from 'react';\nimport {\n ControllerRenderProps,\n FieldValues,\n useFormContext,\n} from 'react-hook-form';\n\nexport type CheckBoxFieldProps = JSFField & {\n onChange?: (checked: any, optionId?: string) => void;\n};\n\nexport function CheckBoxField({\n name,\n defaultValue,\n description,\n label,\n onChange,\n multiple,\n options,\n ...rest\n}: CheckBoxFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n\n const handleCheckboxChange = (\n optionId: string,\n checked: boolean,\n field: ControllerRenderProps<FieldValues, string>,\n ) => {\n const currentValues = field.value ? [...field.value] : [];\n\n if (checked) {\n // Add the value if it's not already in the array\n if (!currentValues.includes(optionId)) {\n field.onChange([...currentValues, optionId]);\n }\n } else {\n // Remove the value from the array\n field.onChange(currentValues.filter((value) => value !== optionId));\n }\n };\n\n return (\n <FormField\n control={control}\n name={name}\n defaultValue={defaultValue}\n render={({ field, fieldState }) => {\n if (components?.checkbox) {\n const CustomCheckboxField = components?.checkbox;\n const customCheckboxFieldProps = {\n name,\n description,\n label,\n defaultValue,\n multiple,\n options,\n ...rest,\n };\n return (\n <CustomCheckboxField\n field={{\n ...field,\n onChange: (evt: any) => {\n if (multiple) {\n const { checked, value } = evt.target;\n handleCheckboxChange(value, checked, field);\n onChange?.(checked);\n return;\n }\n field.onChange(evt);\n onChange?.(evt);\n },\n }}\n fieldState={fieldState}\n fieldData={customCheckboxFieldProps}\n />\n );\n }\n return (\n <FormItem\n data-field={name}\n className={cn(`RemoteFlows__CheckBoxField__Item__${name}`)}\n >\n <FormControl>\n <>\n {options && multiple ? <FormLabel>{label}</FormLabel> : null}\n\n {options && multiple ? (\n options.map((option) => (\n <div key={option.value} className=\"flex space-x-2\">\n <Checkbox\n id={option.value}\n onCheckedChange={(checked: CheckedState) => {\n handleCheckboxChange(\n option.value,\n checked === true,\n field,\n );\n onChange?.(checked, option.value);\n }}\n checked={field.value?.includes(option.value)}\n className=\"RemoteFlows__CheckBox__Input\"\n />\n <FormLabel\n htmlFor={option.value}\n className=\"mb-0 RemoteFlows__CheckBox__Label\"\n >\n {option.label}\n </FormLabel>\n </div>\n ))\n ) : (\n <div className=\"flex space-x-2\">\n <Checkbox\n id={name}\n onCheckedChange={(event: CheckedState) => {\n field.onChange(event);\n onChange?.(event);\n }}\n checked={field.value}\n className=\"RemoteFlows__CheckBox__Input\"\n />\n <FormLabel\n htmlFor={name}\n className=\"mb-0 RemoteFlows__CheckBox__Label\"\n >\n {label}\n </FormLabel>\n </div>\n )}\n </>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {fieldState.error && <FormMessage />}\n </FormItem>\n );\n }}\n />\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { CalendarIcon } from 'lucide-react';\nimport * as React from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { Button } from '@/src/components/ui/button';\nimport { Calendar } from '@/src/components/ui/calendar';\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@/src/components/ui/form';\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from '@/src/components/ui/popover';\nimport { useFormFields } from '@/src/context';\nimport { cn } from '@/src/lib/utils';\nimport { JSFField } from '@/src/types/remoteFlows';\nimport { PopoverClose } from '@radix-ui/react-popover';\nimport { format } from 'date-fns';\n\nexport type DatePickerFieldProps = JSFField & {\n onChange?: (value: any) => void;\n};\n\nexport function DatePickerField({\n description,\n label,\n name,\n minDate,\n onChange,\n ...rest\n}: DatePickerFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n return (\n <FormField\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n if (components?.date) {\n const CustomDatePickerField = components?.date;\n const customDatePickerFieldProps = {\n description,\n label,\n name,\n minDate,\n onChange,\n ...rest,\n };\n return (\n <CustomDatePickerField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={customDatePickerFieldProps}\n />\n );\n }\n return (\n <FormItem\n data-field={name}\n className={`flex flex-col RemoteFlows__DatePickerField__Item__${name}`}\n >\n <FormLabel className=\"RemoteFlows__DatePickerField__Label\">\n {label}\n </FormLabel>\n <Popover>\n <PopoverTrigger asChild>\n <FormControl>\n <div>\n <Button\n type=\"button\"\n variant={'outline'}\n className={cn(\n 'w-full pl-3 text-left font-normal',\n !field.value && 'text-muted-foreground',\n )}\n data-testid=\"date-picker-button\"\n >\n {field.value && <>{format(field.value, 'yyyy-MM-dd')}</>}\n <CalendarIcon className=\"ml-auto h-4 w-4 opacity-50\" />\n </Button>\n </div>\n </FormControl>\n </PopoverTrigger>\n <PopoverContent\n className={`w-auto p-0 RemoteFlows__DatepickerField__PopoverContent`}\n align=\"start\"\n >\n <Calendar\n mode=\"single\"\n className=\"RemoteFlows__DatepickerField__Calendar\"\n selected={field.value ? new Date(field.value) : undefined}\n onSelect={(date) => {\n field.onChange(date ? format(date, 'yyyy-MM-dd') : null);\n onChange?.(date);\n }}\n defaultMonth={minDate ? new Date(minDate) : undefined}\n components={{\n DayContent: (props) => {\n return (\n <PopoverClose>{props.date.getDate()}</PopoverClose>\n );\n },\n }}\n {...(minDate && {\n disabled: (date: Date) => date < new Date(minDate),\n })}\n />\n </PopoverContent>\n </Popover>\n {description ? (\n <FormDescription>{description}</FormDescription>\n ) : null}\n {fieldState.error && (\n <FormMessage className=\"RemoteFlows__DatePickerField__Error\" />\n )}\n </FormItem>\n );\n }}\n />\n );\n}\n","import * as React from 'react';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { DayPicker } from 'react-day-picker';\n\nimport { cn } from '@/src/lib/utils';\nimport { buttonVariants } from '@/src/components/ui/button';\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n ...props\n}: React.ComponentProps<typeof DayPicker>) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn('p-3', className)}\n classNames={{\n months: 'flex flex-col sm:flex-row gap-2',\n month: 'flex flex-col gap-4',\n caption: 'flex justify-center pt-1 relative items-center w-full',\n caption_label: 'text-sm font-medium',\n nav: 'flex items-center gap-1',\n nav_button: cn(\n buttonVariants({ variant: 'outline' }),\n 'size-7 bg-transparent p-0 opacity-50 hover:opacity-100',\n ),\n nav_button_previous: 'absolute left-1',\n nav_button_next: 'absolute right-1',\n table: 'w-full border-collapse space-x-1',\n head_row: 'flex',\n head_cell:\n 'text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]',\n row: 'flex w-full mt-2',\n cell: cn(\n 'relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md',\n props.mode === 'range'\n ? '[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md'\n : '[&:has([aria-selected])]:rounded-md',\n ),\n day: cn(\n buttonVariants({ variant: 'ghost' }),\n 'size-8 p-0 font-normal aria-selected:opacity-100',\n ),\n day_range_start:\n 'day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground',\n day_range_end:\n 'day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground',\n day_selected:\n 'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground',\n day_today: 'bg-accent text-accent-foreground',\n day_outside:\n 'day-outside text-muted-foreground aria-selected:text-muted-foreground',\n day_disabled: 'text-muted-foreground opacity-50',\n day_range_middle:\n 'aria-selected:bg-accent aria-selected:text-accent-foreground',\n day_hidden: 'invisible',\n ...classNames,\n }}\n components={{\n IconLeft: ({ className, ...props }) => (\n <ChevronLeft className={cn('size-4', className)} {...props} />\n ),\n IconRight: ({ className, ...props }) => (\n <ChevronRight className={cn('size-4', className)} {...props} />\n ),\n }}\n {...props}\n />\n );\n}\n\nexport { Calendar };\n","import * as React from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { cn } from '@/src/lib/utils';\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\nfunction PopoverTrigger({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n}\n\nfunction PopoverAnchor({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />;\n}\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };\n","import { fieldsMap } from '@/src/components/form/fields/fieldsMapping';\nimport { cn } from '@/src/lib/utils';\nimport * as React from 'react';\nimport { SupportedTypes } from './types';\n\ntype FieldBase = {\n label: string;\n name: string;\n description: string;\n};\n\ntype FieldWithOptions = FieldBase & {\n type: 'select' | 'radio';\n options: Array<{ value: string; label: string }>;\n};\n\ntype FieldWithoutOptions = FieldBase & {\n type: Exclude<SupportedTypes, 'select' | 'radio'>;\n options?: never;\n};\n\ntype Field = FieldWithOptions | FieldWithoutOptions;\n\ntype FieldSetProps = {\n label: string;\n name: string;\n description: string;\n fields: Field[];\n};\n\nexport function FieldSetField({\n label,\n name,\n fields,\n description,\n}: FieldSetProps) {\n return (\n <fieldset\n className={cn(\n 'border-1 border-input p-4 rounded-xl',\n `RemoteFlows__FieldSetField__${name}`,\n )}\n >\n <legend className=\"text-sm font-semibold px-2\">{label}</legend>\n {description ? (\n <div\n className=\"mb-5 RemoteFlows__FieldSetField__Description\"\n dangerouslySetInnerHTML={{ __html: description }}\n />\n ) : null}\n <div className=\"grid gap-4\">\n {fields.map((field) => {\n const FieldComponent = fieldsMap[field.type];\n return (\n <FieldComponent\n {...field}\n key={field.name}\n name={`${name}.${field.name}`}\n />\n );\n })}\n </div>\n </fieldset>\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\n\nimport { useFormFields } from '@/src/context';\nimport { cn } from '@/src/lib/utils';\nimport { JSFField } from '@/src/types/remoteFlows';\nimport { useFormContext } from 'react-hook-form';\nimport { FileUploader } from '../../ui/file-uploader';\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '../../ui/form';\n\nconst toBase64 = (file: File): Promise<string> => {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n });\n};\n\nconst convertFilesToBase64 = async (\n event: React.ChangeEvent<HTMLInputElement>,\n) => {\n const files = event.target.files ? Array.from(event.target.files) : [];\n\n const base64Files = await Promise.all(\n files.map(async (file) => {\n const base64 = await toBase64(file);\n return {\n name: file.name,\n content: base64.split(',')[1],\n };\n }),\n );\n return base64Files;\n};\n\nexport type FileUploadFieldProps = JSFField & {\n onChange?: (value: any) => void;\n multiple?: boolean;\n};\n\nexport function FileUploadField({\n name,\n description,\n label,\n multiple,\n onChange,\n ...rest\n}: FileUploadFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n\n return (\n <FormField\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n if (components?.file) {\n const CustomFileUploadField = components?.file;\n const customFileUploadFieldProps = {\n name,\n description,\n label,\n multiple,\n ...rest,\n };\n return (\n <CustomFileUploadField\n field={{\n ...field,\n value: null,\n onChange: async (value: any) => {\n const files = await convertFilesToBase64(value);\n if (multiple) {\n field.onChange(files);\n onChange?.(files);\n } else {\n field.onChange([files[0]]);\n onChange?.([files[0]]);\n }\n },\n }}\n fieldState={fieldState}\n fieldData={customFileUploadFieldProps}\n />\n );\n }\n return (\n <FormItem\n data-field={name}\n className={`RemoteFlows__FileUpload__Item__${name}`}\n >\n <FormLabel className=\"RemoteFlows__FileUpload__Label\">\n {label}\n </FormLabel>\n <FormControl>\n <FileUploader\n onChange={async (\n event: React.ChangeEvent<HTMLInputElement>,\n ) => {\n const files = await convertFilesToBase64(event);\n if (multiple) {\n field.onChange(files);\n onChange?.(files);\n } else {\n field.onChange([files[0]]);\n onChange?.([files[0]]);\n }\n }}\n multiple={multiple}\n className={cn('RemoteFlows__FileUpload__Input')}\n />\n </FormControl>\n {description && (\n <div className=\"flex items-center justify-between\">\n <FormDescription className=\"RemoteFlows__FileUpload__Description\">\n {description}\n </FormDescription>\n </div>\n )}\n {fieldState.error && (\n <FormMessage className=\"RemoteFlows__FileUpload__Error\" />\n )}\n </FormItem>\n );\n }}\n />\n );\n}\n","import React, { useState, useRef } from 'react';\nimport { Button } from '@/src/components/ui/button';\nimport { Upload, X } from 'lucide-react';\nimport { cn } from '@/src/lib/utils';\n\ntype FileUploaderProps = {\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n className?: string;\n multiple?: boolean;\n};\n\nexport function FileUploader({\n onChange,\n className,\n multiple,\n}: FileUploaderProps) {\n const [files, setFiles] = useState<File[]>([]);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const handleClick = () => {\n inputRef.current?.click();\n };\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (e.target.files && e.target.files.length > 0) {\n const newFiles = Array.from(e.target.files);\n\n setFiles(newFiles);\n onChange(e);\n }\n };\n\n const onRemoveFile = (file: File) => {\n setFiles((prevFiles) => prevFiles.filter((f) => f !== file));\n };\n\n return (\n <div className={cn('flex flex-col items-start gap-4', className)}>\n <input\n type=\"file\"\n ref={inputRef}\n onChange={handleChange}\n className=\"hidden\"\n aria-label=\"File upload\"\n multiple={multiple}\n />\n <Button onClick={handleClick} className=\"gap-2\">\n <Upload className=\"h-4 w-4\" />\n Choose File\n </Button>\n {files.length === 0 && (\n <div className=\"text-sm\">\n {!multiple ? (\n <span className=\"font-medium\">No file selected.</span>\n ) : (\n <span className=\"font-medium\">\n No files selected. You can select multiple files\n </span>\n )}\n </div>\n )}\n {files.length > 0 &&\n files.map((file, index) => (\n <div key={index} className=\"text-sm flex items-center gap-2\">\n Selected file: <span className=\"font-medium\">{file.name}</span> (\n {Math.round(file.size / 1024)} KB)\n <Button variant=\"ghost\" onClick={() => onRemoveFile(file)}>\n <X />\n </Button>\n </div>\n ))}\n </div>\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useFormFields } from '@/src/context';\nimport React from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { FormField } from '../../ui/form';\nimport { TextField, TextFieldProps } from './TextField';\n\nexport function NumberField(props: TextFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n\n if (components?.number) {\n return (\n <FormField\n control={control}\n name={props.name}\n render={({ field, fieldState }) => {\n const CustomNumberField =\n components.number as React.ComponentType<any>;\n return (\n <CustomNumberField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n props.onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={props}\n />\n );\n }}\n />\n );\n }\n\n return (\n <TextField {...props} type=\"text\" inputMode=\"decimal\" pattern=\"^[0-9.]*$\" />\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\n\nimport { useFormFields } from '@/src/context';\nimport { JSFField } from '@/src/types/remoteFlows';\nimport { useFormContext } from 'react-hook-form';\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '../../ui/form';\nimport { Input } from '../../ui/input';\n\nexport type TextFieldProps = React.ComponentProps<'input'> &\n JSFField & {\n onChange?: (value: any) => void;\n };\n\nexport function TextField({\n name,\n description,\n label,\n type,\n onChange,\n ...rest\n}: TextFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n\n return (\n <FormField\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n if (components?.text) {\n const CustomTextField = components?.text;\n const customTextFieldProps = {\n name,\n description,\n label,\n type,\n onChange,\n ...rest,\n };\n return (\n <CustomTextField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={customTextFieldProps}\n />\n );\n }\n\n return (\n <FormItem\n data-field={name}\n className={`RemoteFlows__TextField__Item__${name}`}\n >\n <FormLabel className=\"RemoteFlows__TextField__Label\">\n {label}\n </FormLabel>\n <FormControl>\n <Input\n {...field}\n value={field.value ?? ''}\n onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n field.onChange(event);\n onChange?.(event);\n }}\n className=\"RemoteFlows__TextField__Input\"\n placeholder={label}\n />\n </FormControl>\n {description && (\n <FormDescription className=\"RemoteFlows__TextField__Description\">\n {description}\n </FormDescription>\n )}\n {fieldState.error && (\n <FormMessage className=\"RemoteFlows__TextField__Error\" />\n )}\n </FormItem>\n );\n }}\n />\n );\n}\n","import * as React from 'react';\n\nimport { cn } from '@/src/lib/utils';\n\nfunction Input({ className, type, ...props }: React.ComponentProps<'input'>) {\n return (\n <input\n type={type}\n data-slot=\"input\"\n className={cn(\n 'shadow-xs border-input file:text-foreground placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-xl border bg-transparent px-4 py-7 text-sm transition-[color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n 'focus-visible:border-focused',\n 'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Input };\n","import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport { CircleIcon } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '@/src/lib/utils';\n\nfunction RadioGroup({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {\n return (\n <RadioGroupPrimitive.Root\n data-slot=\"radio-group\"\n className={cn('grid gap-3', className)}\n {...props}\n />\n );\n}\n\nfunction RadioGroupItem({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {\n return (\n <RadioGroupPrimitive.Item\n data-slot=\"radio-group-item\"\n className={cn(\n 'border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator\n data-slot=\"radio-group-indicator\"\n className=\"relative flex items-center justify-center\"\n >\n <CircleIcon className=\"fill-radio absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n );\n}\n\nexport { RadioGroup, RadioGroupItem };\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@/src/components/ui/form';\nimport { RadioGroup, RadioGroupItem } from '@/src/components/ui/radio-group';\nimport { useFormFields } from '@/src/context';\nimport { cn } from '@/src/lib/utils';\nimport { JSFField } from '@/src/types/remoteFlows';\nimport * as React from 'react';\nimport { useFormContext } from 'react-hook-form';\n\ntype RadioGroupFieldProps = JSFField & {\n onChange?: (value: any) => void;\n};\n\nexport function RadioGroupField({\n name,\n defaultValue,\n description,\n label,\n options,\n onChange,\n ...rest\n}: RadioGroupFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n return (\n <FormField\n control={control}\n name={name}\n defaultValue={defaultValue}\n render={({ field, fieldState }) => {\n if (components?.radio) {\n const CustomRadioGroupField = components?.radio;\n const customRadioGroupFieldProps = {\n name,\n defaultValue,\n description,\n label,\n options,\n ...rest,\n };\n return (\n <CustomRadioGroupField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={customRadioGroupFieldProps}\n />\n );\n }\n\n return (\n <FormItem\n className={cn(\n 'space-y-3',\n `RemoteFlows__RadioGroupField__Item__${name}`,\n )}\n data-field={name}\n >\n <FormLabel>{label}</FormLabel>\n <FormControl>\n <RadioGroup\n aria-label={label}\n onValueChange={(value: string) => {\n field.onChange(value);\n onChange?.(value);\n }}\n value={field.value}\n className=\"flex flex-col space-y-3\"\n >\n {options?.map((option) => (\n <>\n <FormItem\n key={option.value}\n data-field={name}\n className=\"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item\"\n >\n <FormControl>\n <RadioGroupItem\n value={option.value}\n className=\"RemoteFlows__RadioField__Input\"\n />\n </FormControl>\n <div>\n <FormLabel className=\"font-normal mb-0 RemoteFlows__RadioField__Label\">\n {option.label}\n </FormLabel>\n {option.description && (\n <FormDescription className=\"mt-2\">\n {option.description}\n </FormDescription>\n )}\n </div>\n </FormItem>\n </>\n ))}\n </RadioGroup>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {fieldState.error && <FormMessage />}\n </FormItem>\n );\n }}\n />\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\n\nimport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@/src/components/ui/select';\nimport { useFormFields } from '@/src/context';\nimport { JSFField } from '@/src/types/remoteFlows';\nimport { useFormContext } from 'react-hook-form';\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '../../ui/form';\n\ntype SelectFieldProps = JSFField & {\n placeholder?: string;\n options: Array<{ value: string; label: string }>;\n className?: string;\n onChange?: (value: any) => void;\n};\n\nexport function SelectField({\n label,\n name,\n options,\n defaultValue,\n description,\n onChange,\n ...rest\n}: SelectFieldProps) {\n const { control } = useFormContext();\n const { components } = useFormFields();\n\n return (\n <FormField\n defaultValue={defaultValue}\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n if (components?.select) {\n const CustomSelectField = components?.select;\n const customSelectFieldProps = {\n label,\n name,\n options,\n defaultValue,\n description,\n onChange,\n ...rest,\n };\n return (\n <CustomSelectField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={customSelectFieldProps}\n />\n );\n }\n\n return (\n <FormItem\n data-field={name}\n className={`RemoteFlows__SelectField__Item__${name}`}\n >\n <FormLabel className=\"RemoteFlows__SelectField__Label\">\n {label}\n </FormLabel>\n <FormControl>\n <div className=\"relative\">\n <Select\n value={field.value || ''}\n onValueChange={(value: string) => {\n field.onChange(value);\n onChange?.(value);\n }}\n >\n <SelectTrigger\n className=\"RemoteFlows__SelectField__Trigger\"\n aria-invalid={Boolean(fieldState.error)}\n aria-label={label}\n >\n <span className=\"absolute\">\n <SelectValue placeholder={label} />\n </span>\n </SelectTrigger>\n <SelectContent className=\"RemoteFlows__SelectField__Content\">\n <SelectGroup className=\"RemoteFlows__SelectField__Group\">\n {options.map((option) => (\n <SelectItem\n key={option.value}\n value={option.value}\n className=\"RemoteFlows__SelectField__SelectItem\"\n >\n {option.label}\n </SelectItem>\n ))}\n </SelectGroup>\n </SelectContent>\n </Select>\n </div>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {fieldState.error && <FormMessage />}\n </FormItem>\n );\n }}\n />\n );\n}\n","import * as React from 'react';\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';\n\nimport { cn } from '@/src/lib/utils';\n\nfunction Select({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />;\n}\n\nfunction SelectGroup({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nfunction SelectValue({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />;\n}\n\nfunction SelectTrigger({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger>) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n className={cn(\n \"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-full items-center justify-between rounded-xl border bg-transparent px-4 py-7 text-sm whitespace-nowrap transition-[color] outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n 'focus-visible:border-focused',\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild className=\"absolute right-4\">\n <ChevronDownIcon className=\"size-4\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n}\n\nfunction SelectContent({\n className,\n children,\n position = 'popper',\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border',\n position === 'popper' &&\n 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n position === 'popper' &&\n 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1',\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return (\n <SelectPrimitive.Label\n data-slot=\"select-label\"\n className={cn('px-2 py-1.5 text-sm font-medium', className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground min-h-11 justify-between [&_svg:not([class*='text-'])]:text-muted-foreground flex w-full cursor-default items-center gap-2 py-2 px-4 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n <span className=\"flex size-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn('bg-border pointer-events-none -mx-1 my-1 h-px', className)}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className,\n )}\n {...props}\n >\n <ChevronUpIcon className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className,\n )}\n {...props}\n >\n <ChevronDownIcon className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\n\nimport { useFormFields } from '@/src/context';\nimport { cn } from '@/src/lib/utils';\nimport { JSFField } from '@/src/types/remoteFlows';\nimport { useFormContext } from 'react-hook-form';\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '../../ui/form';\nimport { Textarea } from '../../ui/textarea';\n\nexport type TextAreaFieldProps = JSFField & {\n onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n maxLength?: number;\n};\n\nexport function TextAreaField({\n name,\n description,\n label,\n onChange,\n maxLength,\n ...rest\n}: TextAreaFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n return (\n <FormField\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n if (components?.textarea) {\n const CustomTextAreaField = components?.textarea;\n const customTextAreaFieldProps = {\n name,\n description,\n label,\n maxLength,\n ...rest,\n };\n return (\n <CustomTextAreaField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={customTextAreaFieldProps}\n />\n );\n }\n\n const valueLength = field.value?.length ?? 0;\n return (\n <FormItem\n data-field={name}\n className={`RemoteFlows__TextArea__Item__${name}`}\n >\n <FormLabel className=\"RemoteFlows__TextArea__Label\">\n {label}\n </FormLabel>\n <FormControl>\n <Textarea\n {...field}\n value={field.value ?? ''}\n onChange={(event: React.ChangeEvent<HTMLTextAreaElement>) => {\n field.onChange(event);\n onChange?.(event);\n }}\n className={cn(\n fieldState.error &&\n 'border-red-500 focus-visible:ring-red-500',\n 'RemoteFlows__TextArea__Input',\n )}\n placeholder={label}\n />\n </FormControl>\n {(description || maxLength) && (\n <div className=\"flex items-center justify-between\">\n {description && (\n <FormDescription className=\"RemoteFlows__TextArea__Description\">\n {description}\n </FormDescription>\n )}\n {maxLength && (\n <span className=\"text-sm ml-auto RemoteFlows__TextArea__MaxLength\">\n {valueLength}/{maxLength}\n </span>\n )}\n </div>\n )}\n {fieldState.error && (\n <FormMessage className=\"RemoteFlows__TextArea__Error\" />\n )}\n </FormItem>\n );\n }}\n />\n );\n}\n","import * as React from 'react';\n\nimport { cn } from '@/src/lib/utils';\n\nconst Textarea = React.forwardRef<\n HTMLTextAreaElement,\n React.ComponentProps<'textarea'>\n>(({ className, ...props }, ref) => {\n return (\n <textarea\n className={cn(\n 'flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n});\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useFormFields } from '@/src/context';\nimport React from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { FormField } from '../../ui/form';\nimport { TextField, TextFieldProps } from './TextField';\n\nexport function EmailField(props: TextFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n\n if (components?.email) {\n return (\n <FormField\n control={control}\n name={props.name}\n render={({ field, fieldState }) => {\n const CustomEmailField = components.email as React.ComponentType<any>;\n return (\n <CustomEmailField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n props.onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={props}\n />\n );\n }}\n />\n );\n }\n\n return <TextField {...props} type=\"email\" />;\n}\n","import { CheckBoxField } from '@/src/components/form/fields/CheckBoxField';\nimport { DatePickerField } from '@/src/components/form/fields/DatePickerField';\nimport { FieldSetField } from '@/src/components/form/fields/FieldSetField';\nimport { FileUploadField } from '@/src/components/form/fields/FileUploadField';\nimport { NumberField } from '@/src/components/form/fields/NumberField';\nimport { RadioGroupField } from '@/src/components/form/fields/RadioGroupField';\nimport { SelectField } from '@/src/components/form/fields/SelectField';\nimport { TextAreaField } from '@/src/components/form/fields/TextAreaField';\nimport { TextField } from '@/src/components/form/fields/TextField';\nimport { EmailField } from '@/src/components/form/fields/EmailField';\nimport { SupportedTypes } from '@/src/components/form/fields/types';\nimport React from 'react';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const fieldsMap: Record<SupportedTypes, React.ComponentType<any>> = {\n checkbox: CheckBoxField,\n text: TextField,\n email: EmailField,\n money: NumberField,\n select: SelectField,\n radio: RadioGroupField,\n number: NumberField,\n file: FileUploadField,\n fieldset: FieldSetField,\n date: DatePickerField,\n textarea: TextAreaField,\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { fieldsMap } from '@/src/components/form/fields/fieldsMapping';\nimport { SupportedTypes } from '@/src/components/form/fields/types';\nimport { Fields } from '@remoteoss/json-schema-form';\nimport React, { Fragment } from 'react';\nimport { Statement, StatementProps } from './Statement';\nimport { ForcedValueField } from './fields/ForcedValueField';\n\ntype JSONSchemaFormFieldsProps = {\n fields: Fields;\n};\n\nfunction checkFieldHasForcedValue(field: any) {\n // A field to be considered \"forced value\" must:\n return (\n field.const !== undefined && // Only accepts a specific value\n field.const === field.default && // It can be prefilled, meaning it's not critical\n field.inputType !== 'checkbox' && // Because checkbox must always be visible\n field.inputType !== 'hidden' // Because hidden inputs shouldn't be visible\n );\n}\n\nexport const JSONSchemaFormFields = ({ fields }: JSONSchemaFormFieldsProps) => {\n if (!fields || fields.length === 0) return null;\n\n return (\n <>\n {fields.map((field) => {\n if (field.isVisible === false || field.deprecated) {\n return null; // Skip hidden or deprecated fields\n }\n\n if (checkFieldHasForcedValue(field)) {\n return (\n <ForcedValueField\n key={field.name as string}\n name={field.name as string}\n description={field.description as string}\n value={field.const as string}\n statement={field.statement as any}\n />\n );\n }\n\n const FieldComponent = fieldsMap[field.inputType as SupportedTypes];\n return FieldComponent ? (\n <Fragment key={field.name as string}>\n <FieldComponent {...field} />\n {field.statement ? (\n <Statement {...(field.statement as StatementProps)} />\n ) : null}\n </Fragment>\n ) : (\n <p className=\"error\">\n Field type {field.inputType as string} not supported\n </p>\n );\n })}\n </>\n );\n};\n","import { cva, type VariantProps } from 'class-variance-authority';\nimport * as React from 'react';\n\nimport { cn } from '@/src/lib/utils';\n\nconst alertVariants = cva(\n 'relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current',\n {\n variants: {\n variant: {\n default: 'bg-card text-card-foreground',\n destructive:\n 'text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90',\n warning:\n 'bg-card bg-warning border-warning-border [&>svg]:text-current',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\nfunction Alert({\n className,\n variant,\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {\n return (\n <div\n data-slot=\"alert\"\n role=\"alert\"\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n );\n}\n\nfunction AlertTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-title\"\n className={cn(\n 'col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction AlertDescription({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-description\"\n className={cn(\n 'text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Alert, AlertDescription, AlertTitle };\n","import { Alert, AlertDescription, AlertTitle } from '@/src/components/ui/alert';\nimport { useFormFields } from '@/src/context';\nimport { AlertCircle } from 'lucide-react';\nimport React from 'react';\n\nexport type StatementProps = {\n title: string;\n description: string;\n severity: 'warning' | 'error' | 'success' | 'info' | 'neutral' | 'time';\n};\n\nexport function Statement({ title, description, severity }: StatementProps) {\n const { components } = useFormFields();\n\n if (components?.statement) {\n const CustomStatement = components?.statement;\n return (\n <CustomStatement\n data={{\n title,\n description,\n severity,\n }}\n />\n );\n }\n\n return (\n <Alert variant=\"warning\">\n <AlertCircle className=\"h-4 w-4\" />\n <AlertTitle>{title}</AlertTitle>\n <AlertDescription>{description}</AlertDescription>\n </Alert>\n );\n}\n","import React, { useEffect } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\ntype ForcedValueFieldProps = {\n name: string;\n value: string;\n description: string;\n statement: {\n title: string;\n description: string;\n };\n};\n\nexport function ForcedValueField({\n name,\n value,\n description,\n statement,\n}: ForcedValueFieldProps) {\n const { setValue } = useFormContext();\n\n useEffect(() => {\n setValue(name, value);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <div>\n <p\n className={`text-sm RemoteFlows__ForcedValue__Title__${name}`}\n dangerouslySetInnerHTML={{ __html: statement.title }}\n />\n <p\n className={`text-xs RemoteFlows__ForcedValue__Description__${name}`}\n dangerouslySetInnerHTML={{\n __html: statement.description || description,\n }}\n />\n </div>\n );\n}\n"],"mappings":"kPAEA,UAAYA,MAAW,QACvB,UAAYC,MAAuB,2BACnC,OAAS,SAAAC,OAAa,eAItB,IAAMC,EAAiB,aAGrB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC1B,gBAAmB,OAAlB,CACC,IAAKA,EACL,UAAWC,EACT,qSACAH,CACF,EACC,GAAGC,GAEJ,gBAAmB,YAAlB,CACC,UAAWE,EAAG,+CAA+C,GAE7D,gBAACC,GAAA,CAAM,UAAU,UAAU,CAC7B,CACF,CACD,EACDL,EAAS,YAAgC,OAAK,YCb9C,UAAYM,MAAW,QACvB,OAGE,kBAAAC,OACK,kBAMA,SAASC,GAAc,CAC5B,KAAAC,EACA,aAAAC,EACA,YAAAC,EACA,MAAAC,EACA,SAAAC,EACA,SAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAAuB,CACrB,GAAM,CAAE,WAAAC,CAAW,EAAIC,EAAc,EAC/B,CAAE,QAAAC,CAAQ,EAAIC,GAAe,EAE7BC,EAAuBC,EAAA,CAC3BC,EACAC,EACAC,IACG,CACH,IAAMC,EAAgBD,EAAM,MAAQ,CAAC,GAAGA,EAAM,KAAK,EAAI,CAAC,EAEpDD,EAEGE,EAAc,SAASH,CAAQ,GAClCE,EAAM,SAAS,CAAC,GAAGC,EAAeH,CAAQ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AAoB,gBACxC,CAEJ,CAAC,CACH,EApCgC","names":["React","CheckboxPrimitive","Check","Checkbox","className","props","ref","cn","Check","React","useFormContext","CheckBoxField","name","defaultValue","description","label","onChange","multiple","options","rest","components","useFormFields","control","useFormContext","handleCheckboxChange","__name","optionId","checked","field","currentValues","value","FormField","fieldState","CustomCheckboxField","customCheckboxFieldProps","evt","FormItem","cn","FormControl","FormLabel","option","Checkbox","event","FormDescription","FormMessage","CalendarIcon","React","useFormContext","React","ChevronLeft","ChevronRight","DayPicker","Calendar","className","classNames","showOutsideDays","props","DayPicker","cn","buttonVariants","__name","ChevronLeft","ChevronRight","React","PopoverPrimitive","Popover","props","__name","PopoverTrigger","PopoverContent","className","align","sideOffset","cn","PopoverClose","format","DatePickerField","description","label","name","minDate","onChange","rest","components","useFormFields","control","useFormContext","FormField","field","fieldState","CustomDatePickerField","customDatePickerFieldProps","__name","value","FormItem","FormLabel","Popover","PopoverTrigger","FormControl","Button","cn","format","CalendarIcon","PopoverContent","Calendar","date","props","PopoverClose","FormDescription","FormMessage","React","FieldSetField","label","name","fields","description","cn","field","FieldComponent","fieldsMap","__name","React","useFormContext","React","useState","useRef","Upload","X","FileUploader","onChange","className","multiple","files","setFiles","useState","inputRef","useRef","handleClick","__name","handleChange","e","newFiles","onRemoveFile","file","prevFiles","f","React","cn","Button","Upload","index","X","toBase64","__name","file","resolve","reject","reader","error","convertFilesToBase64","event","files","base64","FileUploadField","name","description","label","multiple","onChange","rest","components","useFormFields","control","useFormContext","FormField","field","fieldState","CustomFileUploadField","customFileUploadFieldProps","value","FormItem","FormLabel","FormControl","FileUploader","cn","FormDescription","FormMessage","React","useFormContext","React","useFormContext","React","Input","className","type","props","cn","__name","TextField","name","description","label","type","onChange","rest","components","useFormFields","control","useFormContext","FormField","field","fieldState","CustomTextField","customTextFieldProps","__name","value","FormItem","FormLabel","FormControl","Input","event","FormDescription","FormMessage","NumberField","props","components","useFormFields","control","useFormContext","React","FormField","field","fieldState","CustomNumberField","__name","value","TextField","RadioGroupPrimitive","CircleIcon","React","RadioGroup","className","props","cn","__name","RadioGroupItem","CircleIcon","React","useFormContext","RadioGroupField","name","defaultValue","description","label","options","onChange","rest","components","useFormFields","control","useFormContext","FormField","field","fieldState","CustomRadioGroupField","customRadioGroupFieldProps","__name","value","FormItem","cn","FormLabel","FormControl","RadioGroup","option","RadioGroupItem","FormDescription","FormMessage","React","React","SelectPrimitive","CheckIcon","ChevronDownIcon","ChevronUpIcon","Select","props","__name","SelectGroup","SelectValue","SelectTrigger","className","children","cn","ChevronDownIcon","SelectContent","position","SelectScrollUpButton","SelectScrollDownButton","SelectItem","className","children","props","cn","CheckIcon","__name","SelectScrollUpButton","className","props","cn","ChevronUpIcon","__name","SelectScrollDownButton","ChevronDownIcon","useFormContext","SelectField","label","name","options","defaultValue","description","onChange","rest","control","useFormContext","components","useFormFields","FormField","field","fieldState","CustomSelectField","customSelectFieldProps","__name","value","FormItem","FormLabel","FormControl","Select","SelectTrigger","SelectValue","SelectContent","SelectGroup","option","SelectItem","FormDescription","FormMessage","React","useFormContext","React","Textarea","className","props","ref","cn","TextAreaField","name","description","label","onChange","maxLength","rest","components","useFormFields","control","useFormContext","FormField","field","fieldState","CustomTextAreaField","customTextAreaFieldProps","__name","value","valueLength","FormItem","FormLabel","FormControl","Textarea","event","cn","FormDescription","FormMessage","React","useFormContext","EmailField","props","components","useFormFields","control","useFormContext","React","FormField","field","fieldState","CustomEmailField","__name","value","TextField","fieldsMap","CheckBoxField","TextField","EmailField","NumberField","SelectField","RadioGroupField","FileUploadField","FieldSetField","DatePickerField","TextAreaField","React","Fragment","cva","React","alertVariants","cva","Alert","className","variant","props","cn","__name","AlertTitle","AlertDescription","AlertCircle","React","Statement","title","description","severity","components","useFormFields","CustomStatement","React","Alert","AlertCircle","AlertTitle","AlertDescription","__name","React","useEffect","useFormContext","ForcedValueField","name","value","description","statement","setValue","useFormContext","useEffect","React","__name","checkFieldHasForcedValue","field","__name","JSONSchemaFormFields","fields","React","ForcedValueField","FieldComponent","fieldsMap","Fragment","Statement"]}
@@ -0,0 +1,2 @@
1
+ import{b as n}from"./chunk-DZYFSFZ7.js";import{b as r}from"./chunk-FI76EKUS.js";import{a as o}from"./chunk-AYDF3IFZ.js";import e from"react";function B(t){let{formId:i}=n();return e.createElement(r,{...t,form:i},t.children)}o(B,"TerminationSubmit");export{B as a};
2
+ //# sourceMappingURL=chunk-CKGTR44U.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Termination/TerminationSubmit.tsx"],"sourcesContent":["import { Button } from '@/src/components/ui/button';\nimport React, { ButtonHTMLAttributes, PropsWithChildren } from 'react';\nimport { useTerminationContext } from './context';\n\nexport function TerminationSubmit(\n props: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>,\n) {\n const { formId } = useTerminationContext();\n\n return (\n <Button {...props} form={formId}>\n {props.children}\n </Button>\n );\n}\n"],"mappings":"wHACA,OAAOA,MAAwD,QAGxD,SAASC,EACdC,EACA,CACA,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAsB,EAEzC,OACEC,EAAA,cAACC,EAAA,CAAQ,GAAGJ,EAAO,KAAMC,GACtBD,EAAM,QACT,CAEJ,CAVgBK,EAAAN,EAAA","names":["React","TerminationSubmit","props","formId","useTerminationContext","React","Button","__name"]}
@@ -0,0 +1,2 @@
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, {{username}} 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-CTG3DYJR.js.map
@@ -0,0 +1 @@
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, {{username}} 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,4FACF,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"]}
@@ -0,0 +1,2 @@
1
+ import{a as n}from"./chunk-AYDF3IFZ.js";import{createContext as e,useContext as o}from"react";var r=e({formId:void 0,terminationBag:null}),m=n(()=>{let t=o(r);if(!t.formId||!t.terminationBag)throw new Error("useTerminationContext must be used within a TerminationContextProvider");return{formId:t.formId,terminationBag:t.terminationBag}},"useTerminationContext");export{r as a,m as b};
2
+ //# sourceMappingURL=chunk-DZYFSFZ7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Termination/context.ts"],"sourcesContent":["import type { useTermination } from '@/src/flows/Termination/hooks';\nimport { createContext, useContext } from 'react';\n\nexport const TerminationContext = createContext<{\n formId: string | undefined;\n terminationBag: ReturnType<typeof useTermination> | null;\n}>({\n formId: undefined,\n terminationBag: null,\n});\n\nexport const useTerminationContext = () => {\n const context = useContext(TerminationContext);\n if (!context.formId || !context.terminationBag) {\n throw new Error(\n 'useTerminationContext must be used within a TerminationContextProvider',\n );\n }\n\n return {\n formId: context.formId,\n terminationBag: context.terminationBag,\n } as const;\n};\n"],"mappings":"wCACA,OAAS,iBAAAA,EAAe,cAAAC,MAAkB,QAEnC,IAAMC,EAAqBC,EAG/B,CACD,OAAQ,OACR,eAAgB,IAClB,CAAC,EAEYC,EAAwBC,EAAA,IAAM,CACzC,IAAMC,EAAUC,EAAWL,CAAkB,EAC7C,GAAI,CAACI,EAAQ,QAAU,CAACA,EAAQ,eAC9B,MAAM,IAAI,MACR,wEACF,EAGF,MAAO,CACL,OAAQA,EAAQ,OAChB,eAAgBA,EAAQ,cAC1B,CACF,EAZqC","names":["createContext","useContext","TerminationContext","createContext","useTerminationContext","__name","context","useContext"]}
@@ -0,0 +1,2 @@
1
+ import{b as n}from"./chunk-DZYFSFZ7.js";import{a as t,b as m}from"./chunk-JLUDKN4H.js";import{a as o}from"./chunk-AYDF3IFZ.js";var a=o(({render:p})=>{let{terminationBag:e}=n(),{data:s}=t({employmentId:e.employmentId}),{data:f}=m({employmentId:e.employmentId,status:"taken"});return p({employment:s,timeoff:f})},"TimeOff");export{a};
2
+ //# sourceMappingURL=chunk-EQBNHLR4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Termination/TimeOff.tsx"],"sourcesContent":["import { EmploymentShowResponse, ListTimeoffResponse } from '@/src/client';\nimport { useEmploymentQuery, useTimeOffQuery } from '@/src/common/hooks';\nimport { useTerminationContext } from '@/src/flows/Termination/context';\nimport React from 'react';\n\nexport const TimeOff = ({\n render,\n}: {\n render: (props: {\n employment: EmploymentShowResponse | undefined;\n timeoff: ListTimeoffResponse | undefined;\n }) => React.ReactNode;\n}) => {\n const { terminationBag } = useTerminationContext();\n const { data: employment } = useEmploymentQuery({\n employmentId: terminationBag.employmentId,\n });\n\n const { data: timeoff } = useTimeOffQuery({\n employmentId: terminationBag.employmentId,\n status: 'taken',\n });\n\n return render({ employment, timeoff });\n};\n"],"mappings":"+HAKO,IAAMA,EAAUC,EAAA,CAAC,CACtB,OAAAC,CACF,IAKM,CACJ,GAAM,CAAE,eAAAC,CAAe,EAAIC,EAAsB,EAC3C,CAAE,KAAMC,CAAW,EAAIC,EAAmB,CAC9C,aAAcH,EAAe,YAC/B,CAAC,EAEK,CAAE,KAAMI,CAAQ,EAAIC,EAAgB,CACxC,aAAcL,EAAe,aAC7B,OAAQ,OACV,CAAC,EAED,OAAOD,EAAO,CAAE,WAAAG,EAAY,QAAAE,CAAQ,CAAC,CACvC,EAnBuB","names":["TimeOff","__name","render","terminationBag","useTerminationContext","employment","useEmploymentQuery","timeoff","useTimeOffQuery"]}
@@ -0,0 +1,2 @@
1
+ import{a as n}from"./chunk-OLJ2S6A6.js";import{d as u,e as i}from"./chunk-NBD4VOG3.js";import{b as s}from"./chunk-A4RX3KRZ.js";import{a as l}from"./chunk-AYDF3IFZ.js";import c,{useId as g}from"react";import{useForm as y}from"react-hook-form";function d({costCalculatorBag:r,defaultValues:o,render:t}){let e=g(),a=s(r.handleValidation),C=y({resolver:a,defaultValues:{country:o?.countryRegionSlug,currency:o?.currencySlug,region:"",salary:o?.salary},shouldUnregister:!0,mode:"onBlur"});return c.createElement(n.Provider,{value:{form:C,formId:e,costCalculatorBag:r}},t(r))}l(d,"CostCalculatorFlowProvider");var F=l(({estimationOptions:r=u,defaultValues:o={countryRegionSlug:"",currencySlug:"",salary:""},options:t,render:e})=>{let a=i({defaultRegion:o.countryRegionSlug,estimationOptions:r,options:t});return c.createElement(d,{costCalculatorBag:a,defaultValues:o,render:e})},"CostCalculatorFlow");export{F as a};
2
+ //# sourceMappingURL=chunk-F5QJZKDL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/flows/CostCalculator/CostCalculatorFlow.tsx"],"sourcesContent":["import { useJsonSchemasValidationFormResolver } from '@/src/components/form/yupValidationResolver';\nimport { CostCalculatorContext } from '@/src/flows/CostCalculator/context';\nimport {\n defaultEstimationOptions,\n useCostCalculator,\n} from '@/src/flows/CostCalculator/hooks';\nimport {\n CostCalculatorEstimationOptions,\n JSFModify,\n} from '@/src/flows/CostCalculator/types';\nimport React, { PropsWithChildren, useId } from 'react';\nimport { useForm } from 'react-hook-form';\n\nfunction CostCalculatorFlowProvider({\n costCalculatorBag,\n defaultValues,\n render,\n}: PropsWithChildren<{\n costCalculatorBag: ReturnType<typeof useCostCalculator>;\n defaultValues: Partial<{\n countryRegionSlug: string;\n currencySlug: string;\n salary: string;\n }>;\n render: (\n costCalculatorBag: ReturnType<typeof useCostCalculator>,\n ) => React.ReactNode;\n}>) {\n const formId = useId();\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n costCalculatorBag.handleValidation,\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 },\n shouldUnregister: true,\n mode: 'onBlur',\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\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 options?: {\n jsfModify?: JSFModify;\n };\n render: (\n costCalculatorBag: ReturnType<typeof useCostCalculator>,\n ) => React.ReactNode;\n};\n\nexport const CostCalculatorFlow = ({\n estimationOptions = defaultEstimationOptions,\n defaultValues = {\n countryRegionSlug: '',\n currencySlug: '',\n salary: '',\n },\n options,\n render,\n}: CostCalculatorFlowProps) => {\n const costCalculatorBag = useCostCalculator({\n defaultRegion: defaultValues.countryRegionSlug,\n estimationOptions,\n options,\n });\n\n if (costCalculatorBag.isLoading) {\n return render(costCalculatorBag);\n }\n\n return (\n <CostCalculatorFlowProvider\n costCalculatorBag={costCalculatorBag}\n defaultValues={defaultValues}\n render={render}\n />\n );\n};\n"],"mappings":"uKAUA,OAAOA,GAA4B,SAAAC,MAAa,QAChD,OAAS,WAAAC,MAAe,kBAExB,SAASC,EAA2B,CAClC,kBAAAC,EACA,cAAAC,EACA,OAAAC,CACF,EAUI,CACF,IAAMC,EAASC,EAAM,EACfC,EAAWC,EAEfN,EAAkB,gBACpB,EAEMO,EAAOC,EAAQ,CACnB,SAAAH,EACA,cAAe,CACb,QAASJ,GAAe,kBACxB,SAAUA,GAAe,aACzB,OAAQ,GACR,OAAQA,GAAe,MACzB,EACA,iBAAkB,GAClB,KAAM,QACR,CAAC,EAED,OACEQ,EAAA,cAACC,EAAsB,SAAtB,CACC,MAAO,CACL,KAAAH,EACA,OAAQJ,EACR,kBAAAH,CACF,GAECE,EAAOF,CAAiB,CAC3B,CAEJ,CA5CSW,EAAAZ,EAAA,8BA4EF,IAAMa,EAAqBD,EAAA,CAAC,CACjC,kBAAAE,EAAoBC,EACpB,cAAAb,EAAgB,CACd,kBAAmB,GACnB,aAAc,GACd,OAAQ,EACV,EACA,QAAAc,EACA,OAAAb,CACF,IAA+B,CAC7B,IAAMF,EAAoBgB,EAAkB,CAC1C,cAAef,EAAc,kBAC7B,kBAAAY,EACA,QAAAE,CACF,CAAC,EAED,OAAIf,EAAkB,UACbE,EAAOF,CAAiB,EAI/BS,EAAA,cAACV,EAAA,CACC,kBAAmBC,EACnB,cAAeC,EACf,OAAQC,EACV,CAEJ,EA3BkC","names":["React","useId","useForm","CostCalculatorFlowProvider","costCalculatorBag","defaultValues","render","formId","useId","resolver","useJsonSchemasValidationFormResolver","form","useForm","React","CostCalculatorContext","__name","CostCalculatorFlow","estimationOptions","defaultEstimationOptions","options","useCostCalculator"]}
1
+ {"version":3,"sources":["../src/flows/CostCalculator/CostCalculatorFlow.tsx"],"sourcesContent":["import { useJsonSchemasValidationFormResolver } from '@/src/components/form/yupValidationResolver';\nimport { CostCalculatorContext } from '@/src/flows/CostCalculator/context';\nimport {\n defaultEstimationOptions,\n useCostCalculator,\n} from '@/src/flows/CostCalculator/hooks';\nimport {\n CostCalculatorEstimationOptions,\n JSFModify,\n} from '@/src/flows/CostCalculator/types';\nimport React, { PropsWithChildren, useId } from 'react';\nimport { useForm } from 'react-hook-form';\n\nfunction CostCalculatorFlowProvider({\n costCalculatorBag,\n defaultValues,\n render,\n}: PropsWithChildren<{\n costCalculatorBag: ReturnType<typeof useCostCalculator>;\n defaultValues: Partial<{\n countryRegionSlug: string;\n currencySlug: string;\n salary: string;\n }>;\n render: (\n costCalculatorBag: ReturnType<typeof useCostCalculator>,\n ) => React.ReactNode;\n}>) {\n const formId = useId();\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n costCalculatorBag.handleValidation,\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 },\n shouldUnregister: true,\n mode: 'onBlur',\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\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 options?: {\n jsfModify?: JSFModify;\n };\n render: (\n costCalculatorBag: ReturnType<typeof useCostCalculator>,\n ) => React.ReactNode;\n};\n\nexport const CostCalculatorFlow = ({\n estimationOptions = defaultEstimationOptions,\n defaultValues = {\n countryRegionSlug: '',\n currencySlug: '',\n salary: '',\n },\n options,\n render,\n}: CostCalculatorFlowProps) => {\n const costCalculatorBag = useCostCalculator({\n defaultRegion: defaultValues.countryRegionSlug,\n estimationOptions,\n options,\n });\n\n return (\n <CostCalculatorFlowProvider\n costCalculatorBag={costCalculatorBag}\n defaultValues={defaultValues}\n render={render}\n />\n );\n};\n"],"mappings":"uKAUA,OAAOA,GAA4B,SAAAC,MAAa,QAChD,OAAS,WAAAC,MAAe,kBAExB,SAASC,EAA2B,CAClC,kBAAAC,EACA,cAAAC,EACA,OAAAC,CACF,EAUI,CACF,IAAMC,EAASC,EAAM,EACfC,EAAWC,EAEfN,EAAkB,gBACpB,EAEMO,EAAOC,EAAQ,CACnB,SAAAH,EACA,cAAe,CACb,QAASJ,GAAe,kBACxB,SAAUA,GAAe,aACzB,OAAQ,GACR,OAAQA,GAAe,MACzB,EACA,iBAAkB,GAClB,KAAM,QACR,CAAC,EAED,OACEQ,EAAA,cAACC,EAAsB,SAAtB,CACC,MAAO,CACL,KAAAH,EACA,OAAQJ,EACR,kBAAAH,CACF,GAECE,EAAOF,CAAiB,CAC3B,CAEJ,CA5CSW,EAAAZ,EAAA,8BA4EF,IAAMa,EAAqBD,EAAA,CAAC,CACjC,kBAAAE,EAAoBC,EACpB,cAAAb,EAAgB,CACd,kBAAmB,GACnB,aAAc,GACd,OAAQ,EACV,EACA,QAAAc,EACA,OAAAb,CACF,IAA+B,CAC7B,IAAMF,EAAoBgB,EAAkB,CAC1C,cAAef,EAAc,kBAC7B,kBAAAY,EACA,QAAAE,CACF,CAAC,EAED,OACEN,EAAA,cAACV,EAAA,CACC,kBAAmBC,EACnB,cAAeC,EACf,OAAQC,EACV,CAEJ,EAvBkC","names":["React","useId","useForm","CostCalculatorFlowProvider","costCalculatorBag","defaultValues","render","formId","useId","resolver","useJsonSchemasValidationFormResolver","form","useForm","React","CostCalculatorContext","__name","CostCalculatorFlow","estimationOptions","defaultEstimationOptions","options","useCostCalculator"]}
@@ -0,0 +1,2 @@
1
+ var i={employee_communication:{index:0,name:"employee_communication"},termination_details:{index:1,name:"termination_details"},paid_time_off:{index:2,name:"paid_time_off"},additional_information:{index:3,name:"additional_information"}};export{i as a};
2
+ //# sourceMappingURL=chunk-FZ2HS6G7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Termination/utils.ts"],"sourcesContent":["import { Step } from '@/src/flows/useStepState';\n\nexport type StepTerminationKeys =\n | 'employee_communication'\n | 'termination_details'\n | 'paid_time_off'\n | 'additional_information';\n\nexport const STEPS: Record<StepTerminationKeys, Step> = {\n employee_communication: { index: 0, name: 'employee_communication' },\n termination_details: { index: 1, name: 'termination_details' },\n paid_time_off: { index: 2, name: 'paid_time_off' },\n additional_information: { index: 3, name: 'additional_information' },\n} as const;\n"],"mappings":"AAQO,IAAMA,EAA2C,CACtD,uBAAwB,CAAE,MAAO,EAAG,KAAM,wBAAyB,EACnE,oBAAqB,CAAE,MAAO,EAAG,KAAM,qBAAsB,EAC7D,cAAe,CAAE,MAAO,EAAG,KAAM,eAAgB,EACjD,uBAAwB,CAAE,MAAO,EAAG,KAAM,wBAAyB,CACrE","names":["STEPS"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-FZ7FWFJX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ import{a as A}from"./chunk-JRQSZHUU.js";import{a as _}from"./chunk-JLUDKN4H.js";import{a as d,b as S}from"./chunk-RCX4JUI3.js";import{c as b,f as P,j as w}from"./chunk-55VACCVZ.js";import{c as h}from"./chunk-YBACB5A6.js";import{a as k}from"./chunk-S56EWAS4.js";import{d as c}from"./chunk-WRDKLT4N.js";import{a as t}from"./chunk-AYDF3IFZ.js";import{createHeadlessForm as H,modify as I}from"@remoteoss/json-schema-form";import{useMutation as v,useQuery as R}from"@tanstack/react-query";var J=t(({countryCode:a,employment:n,fieldValues:l,options:o})=>{let{client:u}=c();return R({queryKey:["contract-amendment-schema"],retry:!1,queryFn:t(async()=>{let e=await b({client:u,headers:{Authorization:""},query:{employment_id:n?.data?.employment?.id,country_code:a}});if(e.error||!e.data)throw new Error("Failed to fetch contract amendment schema");return e},"queryFn"),enabled:!!n,select:t(({data:e})=>{let s=e?.data||{};if(o&&o.jsfModify){let{schema:f}=I(s,o.jsfModify);s=f}let i={...l},r=Object.keys(i).length>0;return H(s,{initialValues:r?i:S(n)})},"select")})},"useContractAmendmentSchemaQuery"),K=t(()=>{let{client:a}=c();return v({mutationFn:t(n=>P({client:a,headers:{Authorization:""},body:n}),"mutationFn")})},"useCreateContractAmendmentMutation"),N=t(()=>{let{client:a}=c();return v({mutationFn:t(n=>w({client:a,headers:{Authorization:""},body:n}),"mutationFn")})},"useAutomatableContractAmendmentMutation"),at=t(({employmentId:a,countryCode:n,options:l})=>{let{fieldValues:o,setFieldValues:u,stepState:e,nextStep:s,previousStep:i}=k(d),{data:r,isLoading:V,isError:f,error:M}=_({employmentId:a}),j=Object.keys(o).length===0&&Object.keys(e.values?.form||{}).length>0,{data:m,isLoading:L,isError:T,error:q}=J({employment:r,countryCode:n,fieldValues:j?e.values?.form:o,options:l}),z=S(r,m?.fields),g=K(),F=N();async function O(p){let y=h(p,m?.fields||[],{isPartialValidation:!1}),E={employment_id:r?.data.employment?.id,amendment_contract_id:r?.data.employment?.active_contract_id,contract_amendment:{...y}};switch(e.currentStep.name){case d.form.name:{let{mutateAsync:C}=A(F),B=await C(E);return s(),B}case d.confirmation_form.name:{let{mutateAsync:C}=A(g);return C(E)}default:throw new Error("Invalid step state")}}t(O,"onSubmit");function Q(p){if(m){let y=h(p,m?.fields);return m?.handleValidation(y)}return null}t(Q,"handleValidation");function x(){i()}return t(x,"back"),{stepState:e,fields:m?.fields||[],isLoading:V||L,isError:f||T,error:M||q,isSubmitting:F.isPending||g.isPending,initialValues:z,values:o,handleValidation:Q,checkFieldUpdates:u,onSubmit:O,back:x}},"useContractAmendment");export{at as a};
2
+ //# sourceMappingURL=chunk-GW7GG5ZW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/ContractAmendment/hooks.ts"],"sourcesContent":["import {\n CreateContractAmendmentParams,\n EmploymentShowResponse,\n getShowContractAmendmentSchema,\n postAutomatableContractAmendment,\n postCreateContractAmendment,\n} from '@/src/client';\n\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { mutationToPromise } from '@/src/lib/mutations';\n\nimport { Client } from '@hey-api/client-fetch';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { ContractAmendmentParams } from './types';\n\nimport { useEmploymentQuery } from '@/src/common/hooks';\nimport { useClient } from '@/src/context';\nimport { FieldValues } from 'react-hook-form';\nimport { useStepState } from '../useStepState';\nimport { buildInitialValues, STEPS } from './utils';\n\ntype ContractAmendmentSchemaParams = {\n countryCode: string;\n employment: EmploymentShowResponse | undefined;\n fieldValues: FieldValues | undefined;\n options?: ContractAmendmentParams['options'];\n};\n\nconst useContractAmendmentSchemaQuery = ({\n countryCode,\n employment,\n fieldValues,\n options,\n}: ContractAmendmentSchemaParams) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['contract-amendment-schema'],\n retry: false,\n queryFn: async () => {\n const response = await getShowContractAmendmentSchema({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n query: {\n employment_id: employment?.data?.employment?.id as string,\n country_code: countryCode,\n },\n });\n\n // If response status is 404 or other error, throw an error to trigger isError\n if (response.error || !response.data) {\n throw new Error('Failed to fetch contract amendment schema');\n }\n\n return response;\n },\n enabled: Boolean(employment),\n select: ({ data }) => {\n let jsfSchema = data?.data || {};\n\n if (options && options.jsfModify) {\n const { schema } = modify(jsfSchema, options.jsfModify);\n jsfSchema = schema;\n }\n const copyFieldValues = { ...fieldValues };\n const hasFieldValues = Object.keys(copyFieldValues).length > 0;\n\n const result = createHeadlessForm(jsfSchema, {\n initialValues: hasFieldValues\n ? copyFieldValues\n : buildInitialValues(employment),\n });\n return result;\n },\n });\n};\n\nconst useCreateContractAmendmentMutation = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateContractAmendmentParams) => {\n return postCreateContractAmendment({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nconst useAutomatableContractAmendmentMutation = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateContractAmendmentParams) => {\n return postAutomatableContractAmendment({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nexport const useContractAmendment = ({\n employmentId,\n countryCode,\n options,\n}: ContractAmendmentParams) => {\n const { fieldValues, setFieldValues, stepState, nextStep, previousStep } =\n useStepState<keyof typeof STEPS>(STEPS);\n\n const {\n data: employment,\n isLoading: isLoadingEmployment,\n isError: isErrorEmployment,\n error: errorEmployment,\n } = useEmploymentQuery({\n employmentId,\n });\n\n const isNavigatingBackToForm =\n Object.keys(fieldValues).length === 0 &&\n Object.keys(stepState.values?.form || {}).length > 0;\n const {\n data: contractAmendmentHeadlessForm,\n isLoading: isLoadingContractAmendments,\n isError: isErrorContractAmendmentSchema,\n error: errorContractAmendmentSchema,\n } = useContractAmendmentSchemaQuery({\n employment,\n countryCode,\n // In case the user is navigating back to the form step, we need to\n // pass the previous field values, so that the schema can be\n // generated with the correct values.\n fieldValues: isNavigatingBackToForm ? stepState.values?.form : fieldValues,\n options,\n });\n\n const initialValues = buildInitialValues(\n employment,\n contractAmendmentHeadlessForm?.fields,\n );\n\n const createContractAmendmentMutation = useCreateContractAmendmentMutation();\n const automatableContractAmendmentMutation =\n useAutomatableContractAmendmentMutation();\n\n async function onSubmit(values: FieldValues) {\n const parsedValues = parseJSFToValidate(\n values,\n contractAmendmentHeadlessForm?.fields || [],\n {\n isPartialValidation: false,\n },\n );\n\n const payload = {\n employment_id: employment?.data.employment?.id as string,\n amendment_contract_id: employment?.data.employment\n ?.active_contract_id as string,\n contract_amendment: {\n ...parsedValues,\n },\n };\n\n switch (stepState.currentStep.name) {\n case STEPS.form.name: {\n const { mutateAsync } = mutationToPromise(\n automatableContractAmendmentMutation,\n );\n\n const automatableContractAmendment = await mutateAsync(payload);\n\n nextStep();\n\n return automatableContractAmendment;\n }\n case STEPS.confirmation_form.name: {\n const { mutateAsync } = mutationToPromise(\n createContractAmendmentMutation,\n );\n\n return mutateAsync(payload);\n }\n\n default:\n throw new Error('Invalid step state');\n }\n }\n\n function handleValidation(values: FieldValues) {\n if (contractAmendmentHeadlessForm) {\n const parsedValues = parseJSFToValidate(\n values,\n contractAmendmentHeadlessForm?.fields,\n );\n return contractAmendmentHeadlessForm?.handleValidation(parsedValues);\n }\n return null;\n }\n\n function back() {\n previousStep();\n }\n\n return {\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState,\n /**\n * Array of form fields from the contract amendment schema\n */\n fields: contractAmendmentHeadlessForm?.fields || [],\n /**\n * Loading state indicating if either employment or contract amendment data is being fetched\n */\n isLoading: isLoadingEmployment || isLoadingContractAmendments,\n /**\n * Error state indicating if there was an error fetching either employment or contract amendment data\n */\n isError: isErrorEmployment || isErrorContractAmendmentSchema,\n /**\n * Error object containing details about any errors that occurred during data fetching\n */\n error: errorEmployment || errorContractAmendmentSchema,\n /**\n * Loading state indicating if a contract amendment mutation is in progress\n */\n isSubmitting:\n automatableContractAmendmentMutation.isPending ||\n createContractAmendmentMutation.isPending,\n /**\n * Initial form values built from employment data and contract amendment fields\n */\n initialValues,\n /**\n * Current form field values\n */\n values: fieldValues,\n /**\n * Function to validate form values against the contract amendment schema\n * @param values - Form values to validate\n * @returns Validation result or null if no schema is available\n */\n handleValidation,\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: setFieldValues,\n /**\n * Function to handle form submission\n * @param values - Form values to submit\n * @returns Promise resolving to the mutation result\n */\n onSubmit,\n /**\n * Function to handle going back to the previous step\n * @returns {void}\n */\n back,\n };\n};\n"],"mappings":"qVAYA,OAAS,sBAAAA,EAAoB,UAAAC,MAAc,8BAC3C,OAAS,eAAAC,EAAa,YAAAC,MAAgB,wBAgBtC,IAAMC,EAAkCC,EAAA,CAAC,CACvC,YAAAC,EACA,WAAAC,EACA,YAAAC,EACA,QAAAC,CACF,IAAqC,CACnC,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAU,EAC7B,OAAOC,EAAS,CACd,SAAU,CAAC,2BAA2B,EACtC,MAAO,GACP,QAASP,EAAA,SAAY,CACnB,IAAMQ,EAAW,MAAMC,EAA+B,CACpD,OAAQJ,EACR,QAAS,CACP,cAAe,EACjB,EACA,MAAO,CACL,cAAeH,GAAY,MAAM,YAAY,GAC7C,aAAcD,CAChB,CACF,CAAC,EAGD,GAAIO,EAAS,OAAS,CAACA,EAAS,KAC9B,MAAM,IAAI,MAAM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IA,OAAQU,GAA+B,QAAU,CAAC,EAIlD,UAAWL,GAAuBM,EAIlC,QAASL,GAAqBM,EAI9B,MAAOL,GAAmBM,EAI1B,aACEG,EAAqC,WACrCD,EAAgC,UAIlC,cAAAD,EAIA,OAAQtC,EAMR,iBAAAgD,EAKA,kBAAmBzB,EAMnB,SAAAkB,EAKA,KAAAQ,CACF,CACF,EAhKoC","names":["createHeadlessForm","modify","useMutation","useQuery","useContractAmendmentSchemaQuery","__name","countryCode","employment","fieldValues","options","client","useClient","useQuery","response","getShowContractAmendmentSchema","data","jsfSchema","schema","modify","copyFieldValues","hasFieldValues","createHeadlessForm","buildInitialValues","useCreateContractAmendmentMutation","useMutation","payload","postCreateContractAmendment","useAutomatableContractAmendmentMutation","postAutomatableContractAmendment","useContractAmendment","employmentId","setFieldValues","stepState","nextStep","previousStep","useStepState","STEPS","isLoadingEmployment","isErrorEmployment","errorEmployment","useEmploymentQuery","isNavigatingBackToForm","contractAmendmentHeadlessForm","isLoadingContractAmendments","isErrorContractAmendmentSchema","errorContractAmendmentSchema","initialValues","createContractAmendmentMutation","automatableContractAmendmentMutation","onSubmit","values","parsedValues","parseJSFToValidate","mutateAsync","mutationToPromise","automatableContractAmendment","handleValidation","back"]}
@@ -0,0 +1,2 @@
1
+ import{b as d}from"./chunk-DZYFSFZ7.js";import{a as l}from"./chunk-AYFHWLQZ.js";import{b as a}from"./chunk-A4RX3KRZ.js";import{a as m}from"./chunk-N5AQSLAU.js";import{a as i}from"./chunk-AYDF3IFZ.js";import n,{useEffect as h}from"react";import{useForm as T}from"react-hook-form";function R({username:f,onSubmit:u,onError:p,onSuccess:c}){let{formId:F,terminationBag:e}=d(),b=a(e.handleValidation),o=T({resolver:b,defaultValues:e?.initialValues,shouldUnregister:!1,mode:"onBlur"});h(()=>{let r=o?.watch(s=>{Object.keys(o.formState.dirtyFields).length>0&&e?.checkFieldUpdates(s)});return()=>r?.unsubscribe()},[]);let S=i(async r=>{e?.stepState.currentStep.index===e?.stepState.totalSteps-1&&await u?.(r);let t=await e?.onSubmit(r);t?.error?p?.(t.error):t?.data&&c?.(t.data)},"handleSubmit"),g=(e?.fields?e.fields:[]).map(r=>r.name==="acknowledge_termination_procedure"?{...r,label:r.label.replace("{{username}}",f)}:r);return n.createElement(m,{...o},n.createElement("form",{id:F,onSubmit:o.handleSubmit(S),className:"space-y-4 RemoteFlows__TerminationForm"},n.createElement(l,{fields:g})))}i(R,"TerminationForm");export{R as a};
2
+ //# sourceMappingURL=chunk-HP7ZP256.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Termination/TerminationForm.tsx"],"sourcesContent":["import { JSONSchemaFormFields } from '@/src/components/form/JSONSchemaForm';\nimport { Form } from '@/src/components/ui/form';\nimport React, { useEffect } from 'react';\nimport { useTerminationContext } from './context';\nimport { TerminationFormValues } from '@/src/flows/Termination/types';\nimport { OffboardingResponse, PostCreateOffboardingError } from '@/src/client';\nimport { useForm } from 'react-hook-form';\nimport { useJsonSchemasValidationFormResolver } from '@/src/components/form/yupValidationResolver';\n\ntype TerminationFormProps = {\n username: string;\n onSubmit?: (payload: TerminationFormValues) => Promise<void>;\n onError?: (error: PostCreateOffboardingError) => void;\n onSuccess?: (data: OffboardingResponse) => void;\n};\n\nexport function TerminationForm({\n username,\n onSubmit,\n onError,\n onSuccess,\n}: TerminationFormProps) {\n const { formId, terminationBag } = useTerminationContext();\n\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n terminationBag.handleValidation,\n );\n\n const form = useForm({\n resolver,\n defaultValues: terminationBag?.initialValues,\n shouldUnregister: false,\n mode: 'onBlur',\n });\n\n useEffect(() => {\n const subscription = form?.watch((values) => {\n if (Object.keys(form.formState.dirtyFields).length > 0) {\n // TODO: for some reason isDirty doesn't work the first time we touch the form\n terminationBag?.checkFieldUpdates(values);\n }\n });\n return () => subscription?.unsubscribe();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleSubmit = async (values: TerminationFormValues) => {\n const lastStep =\n terminationBag?.stepState.currentStep.index ===\n terminationBag?.stepState.totalSteps - 1;\n\n if (lastStep) {\n await onSubmit?.(values);\n }\n\n const terminationResult = await terminationBag?.onSubmit(values);\n\n if (terminationResult?.error) {\n onError?.(terminationResult.error);\n } else {\n if (terminationResult?.data) {\n onSuccess?.(terminationResult.data as OffboardingResponse);\n }\n }\n };\n\n const fields = terminationBag?.fields ? terminationBag.fields : [];\n\n const updatedFields = fields.map((field) => {\n if (field.name === 'acknowledge_termination_procedure') {\n return {\n ...field,\n label: (field.label as string).replace('{{username}}', username),\n };\n }\n return field;\n });\n\n return (\n <Form {...form}>\n <form\n id={formId}\n onSubmit={form.handleSubmit(handleSubmit)}\n className=\"space-y-4 RemoteFlows__TerminationForm\"\n >\n <JSONSchemaFormFields fields={updatedFields} />\n </form>\n </Form>\n );\n}\n"],"mappings":"wMAEA,OAAOA,GAAS,aAAAC,MAAiB,QAIjC,OAAS,WAAAC,MAAe,kBAUjB,SAASC,EAAgB,CAC9B,SAAAC,EACA,SAAAC,EACA,QAAAC,EACA,UAAAC,CACF,EAAyB,CACvB,GAAM,CAAE,OAAAC,EAAQ,eAAAC,CAAe,EAAIC,EAAsB,EAEnDC,EAAWC,EAEfH,EAAe,gBACjB,EAEMI,EAAOC,EAAQ,CACnB,SAAAH,EACA,cAAeF,GAAgB,cAC/B,iBAAkB,GAClB,KAAM,QACR,CAAC,EAEDM,EAAU,IAAM,CACd,IAAMC,EAAeH,GAAM,MAAOI,GAAW,CACvC,OAAO,KAAKJ,EAAK,UAAU,WAAW,EAAE,OAAS,GAEnDJ,GAAgB,kBAAkBQ,CAAM,CAE5C,CAAC,EACD,MAAO,IAAMD,GAAc,YAAY,CAEzC,EAAG,CAAC,CAAC,EAEL,IAAME,EAAeC,EAAA,MAAOF,GAAkC,CAE1DR,GAAgB,UAAU,YAAY,QACtCA,GAAgB,UAAU,WAAa,GAGvC,MAAMJ,IAAWY,CAAM,EAGzB,IAAMG,EAAoB,MAAMX,GAAgB,SAASQ,CAAM,EAE3DG,GAAmB,MACrBd,IAAUc,EAAkB,KAAK,EAE7BA,GAAmB,MACrBb,IAAYa,EAAkB,IAA2B,CAG/D,EAlBqB,gBAsBfC,GAFSZ,GAAgB,OAASA,EAAe,OAAS,CAAC,GAEpC,IAAKa,GAC5BA,EAAM,OAAS,oCACV,CACL,GAAGA,EACH,MAAQA,EAAM,MAAiB,QAAQ,eAAgBlB,CAAQ,CACjE,EAEKkB,CACR,EAED,OACEC,EAAA,cAACC,EAAA,CAAM,GAAGX,GACRU,EAAA,cAAC,QACC,GAAIf,EACJ,SAAUK,EAAK,aAAaK,CAAY,EACxC,UAAU,0CAEVK,EAAA,cAACE,EAAA,CAAqB,OAAQJ,EAAe,CAC/C,CACF,CAEJ,CA1EgBF,EAAAhB,EAAA","names":["React","useEffect","useForm","TerminationForm","username","onSubmit","onError","onSuccess","formId","terminationBag","useTerminationContext","resolver","useJsonSchemasValidationFormResolver","form","useForm","useEffect","subscription","values","handleSubmit","__name","terminationResult","updatedFields","field","React","Form","JSONSchemaFormFields"]}
@@ -0,0 +1,2 @@
1
+ import{a as e}from"./chunk-N5AQSLAU.js";import{b as m}from"./chunk-6HGUGIYJ.js";import{a as o}from"./chunk-AYDF3IFZ.js";import a from"react";import{useForm as A}from"react-hook-form";function v({onSubmit:i,onError:s,onSuccess:d}){let{contractAmendment:{values:c,isSubmitting:u,onSubmit:C},formId:f}=m(),n=A({defaultValues:c}),l=o(async r=>{await i?.(r);let t=await C(r);t.error?s?.(t.error):d?.(t.data)},"handleSubmit");return u?null:a.createElement(e,{...n},a.createElement("form",{id:f,onSubmit:n.handleSubmit(l),className:"RemoteFlows__ContractAmendmentConfirmationForm"}))}o(v,"ContractAmendmentConfirmationForm");export{v as a};
2
+ //# sourceMappingURL=chunk-IJPE22L7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/ContractAmendment/ContractAmendmentConfirmationForm.tsx"],"sourcesContent":["import {\n ContractAmendmentResponse,\n PostCreateContractAmendmentError,\n} from '@/src/client';\nimport { Form } from '@/src/components/ui/form';\nimport React from 'react';\nimport { FieldValues, useForm } from 'react-hook-form';\nimport { useContractAmendmentContext } from './context';\n\ntype ContractAmendmentConfirmationFormProps = {\n /**\n * Callback function to be called when the contract amendment form is submitted.\n * This function is called before the contract amendment is submitted.\n * It can be used to perform any additional validation or processing before\n * the contract amendment is submitted.\n * @param values\n * @returns\n */\n onSubmit?: (values: FieldValues) => Promise<void>;\n /**\n * Callback function to be called when the contract amendment fails.\n * @param error\n * @returns\n */\n onError?: (error: PostCreateContractAmendmentError) => void;\n /**\n * Callback function to be called when the contract amendment is successfully submitted.\n * @param data\n * @returns\n */\n onSuccess?: (data: ContractAmendmentResponse) => void;\n};\n\nexport function ContractAmendmentConfirmationForm({\n onSubmit,\n onError,\n onSuccess,\n}: ContractAmendmentConfirmationFormProps) {\n const {\n contractAmendment: {\n values,\n isSubmitting,\n onSubmit: submitContractAmendment,\n },\n formId,\n } = useContractAmendmentContext();\n const form = useForm({\n defaultValues: values,\n });\n\n const handleSubmit = async (values: FieldValues) => {\n await onSubmit?.(values);\n\n const contractAmendmentResult = await submitContractAmendment(values);\n\n if (contractAmendmentResult.error) {\n onError?.(\n contractAmendmentResult.error as PostCreateContractAmendmentError,\n );\n } else {\n onSuccess?.(contractAmendmentResult.data as ContractAmendmentResponse);\n }\n };\n\n // Ensure that step\n if (isSubmitting) {\n return null;\n }\n\n return (\n <Form {...form}>\n <form\n id={formId}\n onSubmit={form.handleSubmit(handleSubmit)}\n className=\"RemoteFlows__ContractAmendmentConfirmationForm\"\n ></form>\n </Form>\n );\n}\n"],"mappings":"wHAKA,OAAOA,MAAW,QAClB,OAAsB,WAAAC,MAAe,kBA2B9B,SAASC,EAAkC,CAChD,SAAAC,EACA,QAAAC,EACA,UAAAC,CACF,EAA2C,CACzC,GAAM,CACJ,kBAAmB,CACjB,OAAAC,EACA,aAAAC,EACA,SAAUC,CACZ,EACA,OAAAC,CACF,EAAIC,EAA4B,EAC1BC,EAAOC,EAAQ,CACnB,cAAeN,CACjB,CAAC,EAEKO,EAAeC,EAAA,MAAOR,GAAwB,CAClD,MAAMH,IAAWG,CAAM,EAEvB,IAAMS,EAA0B,MAAMP,EAAwBF,CAAM,EAEhES,EAAwB,MAC1BX,IACEW,EAAwB,KAC1B,EAEAV,IAAYU,EAAwB,IAAiC,CAEzE,EAZqB,gBAerB,OAAIR,EACK,KAIPS,EAAA,cAACC,EAAA,CAAM,GAAGN,GACRK,EAAA,cAAC,QACC,GAAIP,EACJ,SAAUE,EAAK,aAAaE,CAAY,EACxC,UAAU,iDACX,CACH,CAEJ,CA7CgBC,EAAAZ,EAAA","names":["React","useForm","ContractAmendmentConfirmationForm","onSubmit","onError","onSuccess","values","isSubmitting","submitContractAmendment","formId","useContractAmendmentContext","form","useForm","handleSubmit","__name","contractAmendmentResult","React","Form"]}
@@ -0,0 +1,2 @@
1
+ var e={data:{version:7,schema:{additionalProperties:!1,allOf:[],properties:{acknowledge_termination_procedure:{description:"",title:"I, {{username}} have read and agree to the procedures as defined in the termination form.",type:"boolean","x-jsf-presentation":{direction:"column",inputType:"checkbox"}}},required:["acknowledge_termination_procedure"],type:"object","x-jsf-order":["acknowledge_termination_procedure"]}}};export{e as a};
2
+ //# sourceMappingURL=chunk-IPZEZMLD.js.map