@remoteoss/remote-flows 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-SABMDOWE.js";import{a as f}from"./chunk-KPSFJ6BN.js";import{a as e}from"./chunk-HP7ZP256.js";import{a as n}from"./chunk-CKGTR44U.js";import{a as m}from"./chunk-EQBNHLR4.js";import{a as r}from"./chunk-DZYFSFZ7.js";import{a as t}from"./chunk-AYDF3IFZ.js";import d,{useId as c}from"react";var R=t(({employmentId:p,render:a,options:T})=>{let s=c(),o=i({employmentId:p,options:T});return d.createElement(r.Provider,{value:{formId:s,terminationBag:o}},a({terminationBag:o,components:{Form:e,SubmitButton:n,TimeOff:m,Back:f}}))},"TerminationFlow");export{R as a};
2
- //# sourceMappingURL=chunk-LNF27NTC.js.map
1
+ import{a as i}from"./chunk-TOSGDMB4.js";import{a as f}from"./chunk-KPSFJ6BN.js";import{a as e}from"./chunk-VHL76MEG.js";import{a as n}from"./chunk-CKGTR44U.js";import{a as m}from"./chunk-EQBNHLR4.js";import{a as r}from"./chunk-DZYFSFZ7.js";import{a as t}from"./chunk-AYDF3IFZ.js";import d,{useId as c}from"react";var R=t(({employmentId:p,render:a,options:T})=>{let s=c(),o=i({employmentId:p,options:T});return d.createElement(r.Provider,{value:{formId:s,terminationBag:o}},a({terminationBag:o,components:{Form:e,SubmitButton:n,TimeOff:m,Back:f}}))},"TerminationFlow");export{R as a};
2
+ //# sourceMappingURL=chunk-IPJORKYJ.js.map
@@ -0,0 +1,2 @@
1
+ import{a as S}from"./chunk-XFD3ULUF.js";import{a as h}from"./chunk-CTG3DYJR.js";import{a as F}from"./chunk-SEUQNAF6.js";import{a as T}from"./chunk-FZ2HS6G7.js";import{b as V}from"./chunk-36UPHOJS.js";import{a as _}from"./chunk-JRQSZHUU.js";import{b as c}from"./chunk-55VACCVZ.js";import{c as m}from"./chunk-YBACB5A6.js";import{a as y}from"./chunk-S56EWAS4.js";import{d as p}from"./chunk-WRDKLT4N.js";import{a as o}from"./chunk-AYDF3IFZ.js";import{createHeadlessForm as g,modify as O}from"@remoteoss/json-schema-form";import{useMutation as x,useQuery as A}from"@tanstack/react-query";import K from"lodash/omitBy";import L from"lodash/isNull";import q from"lodash/omit";function z(i){return{confidential:"",customer_informed_employee:"",customer_informed_employee_date:"",customer_informed_employee_description:"",personal_email:"",termination_reason:void 0,reason_description:"",termination_reason_files:[],will_challenge_termination:"",will_challenge_termination_description:null,agrees_to_pto_amount:"",agrees_to_pto_amount_notes:null,acknowledge_termination_procedure:!1,additional_comments:"",proposed_termination_date:"",risk_assessment_reasons:[],timesheet_file:void 0,...i}}o(z,"buildInitialValues");var R=o(()=>{let{client:i}=p();return x({mutationFn:o(n=>c({client:i,headers:{Authorization:""},body:n}),"mutationFn")})},"useCreateTermination"),B=o(({formValues:i,jsfModify:n,step:s})=>A({queryKey:["rmt-flows-termination-schema",s],queryFn:o(()=>F[s]??S,"queryFn"),select:o(({data:l})=>{let{schema:e}=O(l.schema,n||{});return g(e||{},{initialValues:i||{}})},"select")}),"useTerminationSchema"),le=o(({employmentId:i,options:n})=>{let{fieldValues:s,setFieldValues:l,stepState:e,previousStep:d,nextStep:P}=y(T),k={...e.values?.[e.currentStep.name],...s},{data:a,isLoading:w}=B({formValues:k,jsfModify:n?.jsfModify,step:e.currentStep.name}),u=g(h.data.schema),f=R(),{mutateAsync:b}=_(f);async function C(r){if(!i)throw new Error("Employment id is missing");if(e.currentStep.index<e.totalSteps-1){P();return}if(a){let t=m(r,u.fields,{isPartialValidation:!0}),{customer_informed_employee:E}=t,j=E==="yes"?{employee_awareness:{date:t.customer_informed_employee_date,note:t.customer_informed_employee_description}}:void 0,D=V(t,["agrees_to_pto_amount","confidential","customer_informed_employee","will_challenge_termination"]),H=q(D,"customer_informed_employee_date","customer_informed_employee_description"),J=K({...H,...j},L);return b({employment_id:i,termination_details:J,type:"termination"})}}o(C,"onSubmit");function M(){d()}o(M,"back");let v=z({...e.values?.employee_communication,...e.values?.termination_details,...e.values?.paid_time_off,...e.values?.additional_information});return{employmentId:i,stepState:e,fields:a?.fields||[],isLoading:w,isSubmitting:f.isPending,initialValues:v,handleValidation:o(r=>{if(a){let t=m(r,a?.fields);return a?.handleValidation(t)}return null},"handleValidation"),checkFieldUpdates:o(r=>{if(u){let t=m(r,u?.fields,{isPartialValidation:!0});l(t)}},"checkFieldUpdates"),onSubmit:C,back:M}},"useTermination");export{le as a};
2
+ //# sourceMappingURL=chunk-TOSGDMB4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Termination/hooks.ts"],"sourcesContent":["import {\n CreateOffboardingParams,\n postCreateOffboarding,\n TerminationDetailsParams,\n} from '@/src/client';\nimport { mutationToPromise } from '@/src/lib/mutations';\nimport { Client } from '@hey-api/client-fetch';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport omitBy from 'lodash/omitBy';\nimport isNull from 'lodash/isNull';\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { JSFModify } from '@/src/flows/CostCalculator/types';\nimport { TerminationFormValues } from '@/src/flows/Termination/types';\nimport { useClient } from '@/src/context';\nimport omit from 'lodash/omit';\nimport { parseFormRadioValues } from '@/src/flows/utils';\nimport { useStepState } from '@/src/flows/useStepState';\nimport { STEPS } from '@/src/flows/Termination/utils';\nimport { defaultSchema } from '@/src/flows/Termination/json-schemas/defaultSchema';\nimport { schema } from '@/src/flows/Termination/json-schemas/schema';\nimport { jsonSchema } from '@/src/flows/Termination/json-schemas/jsonSchema';\n\nfunction buildInitialValues(\n stepsInitialValues: Partial<TerminationFormValues>,\n): TerminationFormValues {\n const initialValues: TerminationFormValues = {\n confidential: '',\n customer_informed_employee: '',\n customer_informed_employee_date: '',\n customer_informed_employee_description: '',\n personal_email: '',\n termination_reason: undefined,\n reason_description: '',\n termination_reason_files: [],\n will_challenge_termination: '',\n will_challenge_termination_description: null,\n agrees_to_pto_amount: '',\n agrees_to_pto_amount_notes: null,\n acknowledge_termination_procedure: false,\n additional_comments: '',\n proposed_termination_date: '',\n risk_assessment_reasons: [],\n timesheet_file: undefined,\n ...stepsInitialValues,\n };\n\n return initialValues;\n}\n\nconst useCreateTermination = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateOffboardingParams) => {\n return postCreateOffboarding({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nconst useTerminationSchema = ({\n formValues,\n jsfModify,\n step,\n}: {\n formValues?: TerminationFormValues;\n jsfModify?: JSFModify;\n step?: string;\n}) => {\n return useQuery({\n queryKey: ['rmt-flows-termination-schema', step],\n queryFn: () => {\n return schema[step as keyof typeof schema] ?? defaultSchema;\n },\n select: ({ data }) => {\n const { schema } = modify(data.schema, jsfModify || {});\n const form = createHeadlessForm(schema || {}, {\n initialValues: formValues || {},\n });\n return form;\n },\n });\n};\n\ntype TerminationHookProps = {\n employmentId: string;\n options?: {\n jsfModify?: JSFModify;\n };\n};\n\nexport const useTermination = ({\n employmentId,\n options,\n}: TerminationHookProps) => {\n const { fieldValues, setFieldValues, stepState, previousStep, nextStep } =\n useStepState<keyof typeof STEPS, TerminationFormValues>(STEPS);\n\n const formValues = {\n ...stepState.values?.[stepState.currentStep.name as keyof typeof STEPS], // Restore values for the current step\n ...fieldValues,\n };\n\n const { data: terminationHeadlessForm, isLoading: isLoadingTermination } =\n useTerminationSchema({\n formValues: formValues,\n jsfModify: options?.jsfModify,\n step: stepState.currentStep.name,\n });\n\n const entireTerminationSchema = createHeadlessForm(jsonSchema.data.schema);\n\n const createTermination = useCreateTermination();\n const { mutateAsync } = mutationToPromise(createTermination);\n\n async function onSubmit(values: TerminationFormValues) {\n if (!employmentId) {\n throw new Error('Employment id is missing');\n }\n\n if (stepState.currentStep.index < stepState.totalSteps - 1) {\n nextStep();\n return;\n }\n\n if (terminationHeadlessForm) {\n // this is a hack because I need to validate all form values with the entire schema\n const parsedValues = parseJSFToValidate(\n values,\n entireTerminationSchema.fields,\n { isPartialValidation: true },\n );\n\n const { customer_informed_employee: customerInformedEmployee } =\n parsedValues;\n\n const employeeAwareness =\n customerInformedEmployee === 'yes'\n ? {\n employee_awareness: {\n date: parsedValues.customer_informed_employee_date,\n note: parsedValues.customer_informed_employee_description,\n },\n }\n : undefined;\n\n const radioFieldKeys = [\n 'agrees_to_pto_amount',\n 'confidential',\n 'customer_informed_employee',\n 'will_challenge_termination',\n ];\n\n const parsedRadioValues = parseFormRadioValues(\n parsedValues,\n radioFieldKeys,\n );\n\n const normalizedValues = omit(\n parsedRadioValues,\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n );\n\n const terminationDetails: TerminationDetailsParams = omitBy(\n {\n ...normalizedValues,\n ...employeeAwareness,\n },\n isNull,\n ) as unknown as TerminationDetailsParams;\n\n const terminationPayload: CreateOffboardingParams = {\n employment_id: employmentId,\n termination_details: terminationDetails,\n type: 'termination',\n };\n\n return mutateAsync(terminationPayload);\n }\n\n return;\n }\n\n function back() {\n previousStep();\n }\n\n const initialValues = buildInitialValues({\n ...stepState.values?.employee_communication,\n ...stepState.values?.termination_details,\n ...stepState.values?.paid_time_off,\n ...stepState.values?.additional_information,\n });\n\n return {\n /**\n * Employment id passed useful to be used between components\n */\n employmentId,\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState,\n /**\n * Array of form fields from the contract amendment schema\n */\n fields: terminationHeadlessForm?.fields || [],\n /**\n * Loading state indicating if the termination schema is being fetched\n */\n isLoading: isLoadingTermination,\n /**\n * Loading state indicating if a contract amendment mutation is in progress\n */\n isSubmitting: createTermination.isPending,\n /**\n * Initial form values\n */\n initialValues: initialValues,\n /**\n * Function to validate form values against the contract amendment schema\n * @param values - Form values to validate\n * @returns Validation result or null if no schema is available\n */\n handleValidation: (values: TerminationFormValues) => {\n if (terminationHeadlessForm) {\n const parsedValues = parseJSFToValidate(\n values,\n terminationHeadlessForm?.fields,\n );\n return terminationHeadlessForm?.handleValidation(parsedValues);\n }\n return null;\n },\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: (values: Partial<TerminationFormValues>) => {\n if (entireTerminationSchema) {\n const parsedValues = parseJSFToValidate(\n values,\n entireTerminationSchema?.fields,\n { isPartialValidation: true },\n );\n setFieldValues(parsedValues as TerminationFormValues);\n }\n },\n /**\n * Function to handle form submission\n * @param values - Form values to submit\n * @returns Promise resolving to the mutation result\n */\n onSubmit,\n\n /**\n * Function to handle going back to the previous step\n * @returns {void}\n */\n back,\n };\n};\n"],"mappings":"wbAOA,OAAS,sBAAAA,EAAoB,UAAAC,MAAc,8BAC3C,OAAS,eAAAC,EAAa,YAAAC,MAAgB,wBACtC,OAAOC,MAAY,gBACnB,OAAOC,MAAY,gBAKnB,OAAOC,MAAU,cAQjB,SAASC,EACPC,EACuB,CAsBvB,MArB6C,CAC3C,aAAc,GACd,2BAA4B,GAC5B,gCAAiC,GACjC,uCAAwC,GACxC,eAAgB,GAChB,mBAAoB,OACpB,mBAAoB,GACpB,yBAA0B,CAAC,EAC3B,2BAA4B,GAC5B,uCAAwC,KACxC,qBAAsB,GACtB,2BAA4B,KAC5B,kCAAmC,GACnC,oBAAqB,GACrB,0BAA2B,GAC3B,wBAAyB,CAAC,EAC1B,eAAgB,OAChB,GAAGA,CACL,CAGF,CAzBSC,EAAAF,EAAA,sBA2BT,IAAMG,EAAuBD,EAAA,IAAM,CACjC,GAAM,CAAE,OAAAE,CAAO,EAAIC,EAAU,EAC7B,OAAOC,EAAY,CACjB,WAAYJ,EAACK,GACJC,EAAsB,CAC3B,OAAQJ,EACR,QAAS,CACP,cAAe,EACjB,EACA,KAAMG,CACR,CAAC,EAPS,aASd,CAAC,CACH,EAb6B,wBAevBE,EAAuBP,EAAA,CAAC,CAC5B,WAAAQ,EACA,UAAAC,EACA,KAAAC,CACF,IAKSC,EAAS,CACd,SAAU,CAAC,+BAAgCD,CAA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BACF,CAKA,EAEMM,EAAmBC,EACvBH,EACA,kCACA,wCACF,EAEMI,EAA+CC,EACnD,CACE,GAAGH,EACH,GAAGH,CACL,EACAO,CACF,EAQA,OAAOd,EAN6C,CAClD,cAAed,EACf,oBAAqB0B,EACrB,KAAM,aACR,CAEqC,CACvC,CAGF,CAnEe5C,EAAAkC,EAAA,YAqEf,SAASa,GAAO,CACdxB,EAAa,CACf,CAFSvB,EAAA+C,EAAA,QAIT,IAAMC,EAAgBlD,EAAmB,CACvC,GAAGwB,EAAU,QAAQ,uBACrB,GAAGA,EAAU,QAAQ,oBACrB,GAAGA,EAAU,QAAQ,cACrB,GAAGA,EAAU,QAAQ,sBACvB,CAAC,EAED,MAAO,CAIL,aAAAJ,EAIA,UAAAI,EAIA,OAAQK,GAAyB,QAAU,CAAC,EAI5C,UAAWC,EAIX,aAAcG,EAAkB,UAIhC,cAAeiB,EAMf,iBAAkBhD,EAACmC,GAAkC,CACnD,GAAIR,EAAyB,CAC3B,IAAMS,EAAeC,EACnBF,EACAR,GAAyB,MAC3B,EACA,OAAOA,GAAyB,iBAAiBS,CAAY,CAC/D,CACA,OAAO,IACT,EATkB,oBAclB,kBAAmBpC,EAACmC,GAA2C,CAC7D,GAAIN,EAAyB,CAC3B,IAAMO,EAAeC,EACnBF,EACAN,GAAyB,OACzB,CAAE,oBAAqB,EAAK,CAC9B,EACAR,EAAee,CAAqC,CACtD,CACF,EATmB,qBAenB,SAAAF,EAMA,KAAAa,CACF,CACF,EA3K8B","names":["createHeadlessForm","modify","useMutation","useQuery","omitBy","isNull","omit","buildInitialValues","stepsInitialValues","__name","useCreateTermination","client","useClient","useMutation","payload","postCreateOffboarding","useTerminationSchema","formValues","jsfModify","step","useQuery","schema","defaultSchema","data","modify","createHeadlessForm","useTermination","employmentId","options","fieldValues","setFieldValues","stepState","previousStep","nextStep","useStepState","STEPS","terminationHeadlessForm","isLoadingTermination","entireTerminationSchema","jsonSchema","createTermination","mutateAsync","mutationToPromise","onSubmit","values","parsedValues","parseJSFToValidate","customerInformedEmployee","employeeAwareness","parsedRadioValues","parseFormRadioValues","normalizedValues","omit","terminationDetails","omitBy","isNull","back","initialValues"]}
@@ -0,0 +1,2 @@
1
+ import{b as d}from"./chunk-DZYFSFZ7.js";import{a as f}from"./chunk-AYFHWLQZ.js";import{b as m}from"./chunk-A4RX3KRZ.js";import{a as l}from"./chunk-N5AQSLAU.js";import{a as n}from"./chunk-AYDF3IFZ.js";import s,{useEffect as T}from"react";import{useForm as V}from"react-hook-form";function _({username:u,onSubmit:p,onError:c,onSuccess:F}){let{formId:b,terminationBag:o}=d(),S=m(o.handleValidation),i=V({resolver:S,defaultValues:o?.initialValues,shouldUnregister:!1,mode:"onBlur"});T(()=>{let r=i?.watch(t=>{Object.keys(t).some(a=>t[a]!==o?.initialValues?.[a])&&o?.checkFieldUpdates(t)});return()=>r?.unsubscribe()},[]);let g=n(async r=>{o?.stepState.currentStep.index===o?.stepState.totalSteps-1&&await p?.(r);let e=await o?.onSubmit(r);e?.error?c?.(e.error):e?.data&&F?.(e.data)},"handleSubmit"),y=(o?.fields?o.fields:[]).map(r=>r.name==="acknowledge_termination_procedure"?{...r,label:r.label.replace("{{username}}",u)}:r);return s.createElement(l,{...i},s.createElement("form",{id:b,onSubmit:i.handleSubmit(g),className:"space-y-4 RemoteFlows__TerminationForm"},s.createElement(f,{fields:y})))}n(_,"TerminationForm");export{_ as a};
2
+ //# sourceMappingURL=chunk-VHL76MEG.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 const isAnyFieldDirty = Object.keys(values).some(\n (key) =>\n values[key as keyof TerminationFormValues] !==\n terminationBag?.initialValues?.[key as keyof TerminationFormValues],\n );\n if (isAnyFieldDirty) {\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,OAA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it","onError","onSuccess","formId","terminationBag","useTerminationContext","resolver","useJsonSchemasValidationFormResolver","form","useForm","useEffect","subscription","values","key","handleSubmit","__name","terminationResult","updatedFields","field","React","Form","JSONSchemaFormFields"]}
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-LNF27NTC.js";import"../../chunk-SABMDOWE.js";import"../../chunk-XFD3ULUF.js";import"../../chunk-CTG3DYJR.js";import"../../chunk-SEUQNAF6.js";import"../../chunk-VX2UC3HG.js";import"../../chunk-IPZEZMLD.js";import"../../chunk-JODJFARP.js";import"../../chunk-W5DG5WWJ.js";import"../../chunk-FZ2HS6G7.js";import"../../chunk-KPSFJ6BN.js";import"../../chunk-HP7ZP256.js";import"../../chunk-CKGTR44U.js";import"../../chunk-EQBNHLR4.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-36UPHOJS.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-JLUDKN4H.js";import"../../chunk-55VACCVZ.js";import"../../chunk-YBACB5A6.js";import"../../chunk-S56EWAS4.js";import"../../chunk-AYFHWLQZ.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-FI76EKUS.js";import"../../chunk-N5AQSLAU.js";import"../../chunk-SJ56GVNV.js";import"../../chunk-AYDF3IFZ.js";export{a as TerminationFlow};
1
+ import{a}from"../../chunk-IPJORKYJ.js";import"../../chunk-TOSGDMB4.js";import"../../chunk-XFD3ULUF.js";import"../../chunk-CTG3DYJR.js";import"../../chunk-SEUQNAF6.js";import"../../chunk-VX2UC3HG.js";import"../../chunk-IPZEZMLD.js";import"../../chunk-JODJFARP.js";import"../../chunk-W5DG5WWJ.js";import"../../chunk-FZ2HS6G7.js";import"../../chunk-KPSFJ6BN.js";import"../../chunk-VHL76MEG.js";import"../../chunk-CKGTR44U.js";import"../../chunk-EQBNHLR4.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-36UPHOJS.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-JLUDKN4H.js";import"../../chunk-55VACCVZ.js";import"../../chunk-YBACB5A6.js";import"../../chunk-S56EWAS4.js";import"../../chunk-AYFHWLQZ.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-FI76EKUS.js";import"../../chunk-N5AQSLAU.js";import"../../chunk-SJ56GVNV.js";import"../../chunk-AYDF3IFZ.js";export{a as TerminationFlow};
2
2
  //# sourceMappingURL=TerminationFlow.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-HP7ZP256.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-AYFHWLQZ.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-FI76EKUS.js";import"../../chunk-N5AQSLAU.js";import"../../chunk-SJ56GVNV.js";import"../../chunk-AYDF3IFZ.js";export{a as TerminationForm};
1
+ import{a}from"../../chunk-VHL76MEG.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-AYFHWLQZ.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-FI76EKUS.js";import"../../chunk-N5AQSLAU.js";import"../../chunk-SJ56GVNV.js";import"../../chunk-AYDF3IFZ.js";export{a as TerminationForm};
2
2
  //# sourceMappingURL=TerminationForm.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-SABMDOWE.js";import"../../chunk-XFD3ULUF.js";import"../../chunk-CTG3DYJR.js";import"../../chunk-SEUQNAF6.js";import"../../chunk-VX2UC3HG.js";import"../../chunk-IPZEZMLD.js";import"../../chunk-JODJFARP.js";import"../../chunk-W5DG5WWJ.js";import"../../chunk-FZ2HS6G7.js";import"../../chunk-36UPHOJS.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-55VACCVZ.js";import"../../chunk-YBACB5A6.js";import"../../chunk-S56EWAS4.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-AYDF3IFZ.js";export{a as useTermination};
1
+ import{a}from"../../chunk-TOSGDMB4.js";import"../../chunk-XFD3ULUF.js";import"../../chunk-CTG3DYJR.js";import"../../chunk-SEUQNAF6.js";import"../../chunk-VX2UC3HG.js";import"../../chunk-IPZEZMLD.js";import"../../chunk-JODJFARP.js";import"../../chunk-W5DG5WWJ.js";import"../../chunk-FZ2HS6G7.js";import"../../chunk-36UPHOJS.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-55VACCVZ.js";import"../../chunk-YBACB5A6.js";import"../../chunk-S56EWAS4.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-AYDF3IFZ.js";export{a as useTermination};
2
2
  //# sourceMappingURL=hooks.js.map
@@ -1,2 +1,2 @@
1
- import"../../chunk-FZ7FWFJX.js";import{a as c}from"../../chunk-LNF27NTC.js";import"../../chunk-SABMDOWE.js";import"../../chunk-XFD3ULUF.js";import"../../chunk-CTG3DYJR.js";import"../../chunk-SEUQNAF6.js";import"../../chunk-VX2UC3HG.js";import"../../chunk-IPZEZMLD.js";import"../../chunk-JODJFARP.js";import"../../chunk-W5DG5WWJ.js";import"../../chunk-FZ2HS6G7.js";import"../../chunk-KPSFJ6BN.js";import{a}from"../../chunk-HP7ZP256.js";import{a as b}from"../../chunk-CKGTR44U.js";import"../../chunk-EQBNHLR4.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-36UPHOJS.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-JLUDKN4H.js";import"../../chunk-55VACCVZ.js";import"../../chunk-YBACB5A6.js";import"../../chunk-S56EWAS4.js";import"../../chunk-AYFHWLQZ.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-FI76EKUS.js";import"../../chunk-N5AQSLAU.js";import"../../chunk-SJ56GVNV.js";import"../../chunk-AYDF3IFZ.js";export{c as TerminationFlow,a as TerminationForm,b as TerminationSubmit};
1
+ import"../../chunk-FZ7FWFJX.js";import{a as c}from"../../chunk-IPJORKYJ.js";import"../../chunk-TOSGDMB4.js";import"../../chunk-XFD3ULUF.js";import"../../chunk-CTG3DYJR.js";import"../../chunk-SEUQNAF6.js";import"../../chunk-VX2UC3HG.js";import"../../chunk-IPZEZMLD.js";import"../../chunk-JODJFARP.js";import"../../chunk-W5DG5WWJ.js";import"../../chunk-FZ2HS6G7.js";import"../../chunk-KPSFJ6BN.js";import{a}from"../../chunk-VHL76MEG.js";import{a as b}from"../../chunk-CKGTR44U.js";import"../../chunk-EQBNHLR4.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-36UPHOJS.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-JLUDKN4H.js";import"../../chunk-55VACCVZ.js";import"../../chunk-YBACB5A6.js";import"../../chunk-S56EWAS4.js";import"../../chunk-AYFHWLQZ.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-FI76EKUS.js";import"../../chunk-N5AQSLAU.js";import"../../chunk-SJ56GVNV.js";import"../../chunk-AYDF3IFZ.js";export{c as TerminationFlow,a as TerminationForm,b as TerminationSubmit};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-FZ7FWFJX.js";import{a as ir}from"./chunk-LNF27NTC.js";import"./chunk-SABMDOWE.js";import"./chunk-XFD3ULUF.js";import"./chunk-CTG3DYJR.js";import"./chunk-SEUQNAF6.js";import"./chunk-VX2UC3HG.js";import"./chunk-IPZEZMLD.js";import"./chunk-JODJFARP.js";import"./chunk-W5DG5WWJ.js";import"./chunk-FZ2HS6G7.js";import"./chunk-KPSFJ6BN.js";import{a as ar}from"./chunk-HP7ZP256.js";import{a as or}from"./chunk-CKGTR44U.js";import"./chunk-EQBNHLR4.js";import"./chunk-DZYFSFZ7.js";import"./chunk-FGBEOUQK.js";import{a as E}from"./chunk-YAHWFLDH.js";import"./chunk-XEQTLVMV.js";import"./chunk-DOA6BAUQ.js";import"./chunk-J2RINDSC.js";import"./chunk-4F7PYKUZ.js";import"./chunk-AD7ZWPEI.js";import"./chunk-YVC4OEFJ.js";import"./chunk-FCRDQVTB.js";import{a as P}from"./chunk-XULIEA44.js";import{a as R}from"./chunk-OCNLZSS7.js";import{a as F}from"./chunk-NZFES56Y.js";import"./chunk-A7ZJQCNU.js";import{a as B}from"./chunk-IJWDAD54.js";import{a as S}from"./chunk-DYB3RWP7.js";import{a as T}from"./chunk-F5QJZKDL.js";import"./chunk-OLJ2S6A6.js";import{b as y,c as k,e as C}from"./chunk-NBD4VOG3.js";import"./chunk-UPRUP24B.js";import"./chunk-36UPHOJS.js";import{a as tr}from"./chunk-2EKC7DK3.js";import{a as H}from"./chunk-5DQBY2TR.js";import{a as er}from"./chunk-GW7GG5ZW.js";import"./chunk-JRQSZHUU.js";import{a as J,b as rr}from"./chunk-JLUDKN4H.js";import"./chunk-RCX4JUI3.js";import{a as p}from"./chunk-55VACCVZ.js";import"./chunk-YBACB5A6.js";import"./chunk-S56EWAS4.js";import"./chunk-37DREOGC.js";import{a as Z}from"./chunk-IJPE22L7.js";import{a as $}from"./chunk-6LTJBLSD.js";import"./chunk-AYFHWLQZ.js";import"./chunk-A4RX3KRZ.js";import{a as g,c as v}from"./chunk-WRDKLT4N.js";import"./chunk-FI76EKUS.js";import"./chunk-N5AQSLAU.js";import"./chunk-6HGUGIYJ.js";import{c as z}from"./chunk-SJ56GVNV.js";import{a as t}from"./chunk-AYDF3IFZ.js";import{QueryClient as L,QueryClientProvider as q}from"@tanstack/react-query";import n from"react";function l(r){let e=document.documentElement;Object.keys(r).forEach(a=>{let o=r[a];o&&e.style.setProperty(a,o)})}t(l,"setCssProperties");function j(r){let e={};return Object.keys(r).forEach(a=>{e[`--${a}`]=r[a]}),e}t(j,"mapThemeColors");function M(r){return{"--spacing":r}}t(M,"mapThemeSpacing");function I(r){return{"--radius":r}}t(I,"mapThemeBorderRadius");function N(r){return{"--fontSizeBase":r.fontSizeBase}}t(N,"mapThemeFont");function u(r){r?.colors&&l(j(r.colors)),r?.spacing&&l(M(r.spacing)),r?.borderRadius&&l(I(r.borderRadius)),r?.font&&l(N(r.font))}t(u,"applyTheme");import U,{createContext as A,useEffect as D,useMemo as O}from"react";var _=A({theme:{}});function h(r){D(()=>{r.theme&&Object.keys(r.theme).length>0&&u(r.theme)},[r.theme]);let e=O(()=>({theme:r.theme}),[r.theme]);return U.createElement(_.Provider,{value:e},r.children)}t(h,"ThemeProvider");var f={staging:"https://gateway.niceremote.com",partners:"https://gateway.partners.remote-sandbox.com",production:"https://gateway.remote.com"};import{createClient as K}from"@hey-api/client-fetch";import{useQuery as V}from"@tanstack/react-query";import{useRef as w}from"react";function W(r){try{return new URL(r),!0}catch{return!1}}t(W,"isValidUrl");var m=t(({auth:r,options:e})=>{let a=w(null),{refetch:o}=V({queryKey:["auth"],queryFn:r,enabled:!1}),s=e.isTestingMode?f.partners:"https://gateway.remote.com",c=p.getConfig(),b="0.2.0",d=!!e.proxy&&W(e.proxy.url);return e.proxy&&!d&&console.error("Invalid proxy URL provided. Using default base URL."),w(K({...c,headers:{...c.headers,...d?e.proxy?.headers:{},"X-Client-Name":"remote-flows-sdk","X-Client-Version":b},baseUrl:d?e.proxy?.url:s,auth:t(async()=>{function x(i){return!i||Date.now()+6e4>i}if(t(x,"hasTokenExpired"),!a.current||x(a.current.expiresAt)){let{data:i}=await o();i&&(a.current={accessToken:i.accessToken,expiresAt:Date.now()+i.expiresIn*1e3})}return a.current?.accessToken},"auth")}))},"useAuth");var Q=new L;function X({children:r,auth:e,isTestingMode:a,proxy:o}){let s=m({auth:e,options:{isTestingMode:!!a,proxy:o}});return n.createElement(v.Provider,{value:{client:s.current}},r)}t(X,"RemoteFlowContextWrapper");function Y({children:r,components:e}){return n.createElement(g.Provider,{value:e?{components:e}:{components:{}}},r)}t(Y,"FormFieldsProvider");function G({auth:r,children:e,components:a,isTestingMode:o=!1,theme:s,proxy:c}){return n.createElement(q,{client:Q},n.createElement(Y,{components:a},n.createElement(X,{isTestingMode:o,auth:r,proxy:c},n.createElement(h,{theme:s},e))))}t(G,"RemoteFlows");export{Z as ContractAmendmentConfirmationForm,tr as ContractAmendmentFlow,$ as ContractAmendmentForm,H as ContractAmendmentSubmit,B as CostCalculatorDisclaimer,T as CostCalculatorFlow,P as CostCalculatorForm,R as CostCalculatorResetButton,E as CostCalculatorResults,F as CostCalculatorSubmitButton,G as RemoteFlows,ir as TerminationFlow,ar as TerminationForm,or as TerminationSubmit,y as buildCostCalculatorEstimationPayload,S as disclaimerData,z as transformYupErrorsIntoObject,er as useContractAmendment,C as useCostCalculator,k as useCostCalculatorEstimationPdf,J as useEmploymentQuery,rr as useTimeOffQuery};
1
+ import"./chunk-FZ7FWFJX.js";import{a as ir}from"./chunk-IPJORKYJ.js";import"./chunk-TOSGDMB4.js";import"./chunk-XFD3ULUF.js";import"./chunk-CTG3DYJR.js";import"./chunk-SEUQNAF6.js";import"./chunk-VX2UC3HG.js";import"./chunk-IPZEZMLD.js";import"./chunk-JODJFARP.js";import"./chunk-W5DG5WWJ.js";import"./chunk-FZ2HS6G7.js";import"./chunk-KPSFJ6BN.js";import{a as ar}from"./chunk-VHL76MEG.js";import{a as or}from"./chunk-CKGTR44U.js";import"./chunk-EQBNHLR4.js";import"./chunk-DZYFSFZ7.js";import"./chunk-FGBEOUQK.js";import{a as E}from"./chunk-YAHWFLDH.js";import"./chunk-XEQTLVMV.js";import"./chunk-DOA6BAUQ.js";import"./chunk-J2RINDSC.js";import"./chunk-4F7PYKUZ.js";import"./chunk-AD7ZWPEI.js";import"./chunk-YVC4OEFJ.js";import"./chunk-FCRDQVTB.js";import{a as P}from"./chunk-XULIEA44.js";import{a as R}from"./chunk-OCNLZSS7.js";import{a as F}from"./chunk-NZFES56Y.js";import"./chunk-A7ZJQCNU.js";import{a as B}from"./chunk-IJWDAD54.js";import{a as S}from"./chunk-DYB3RWP7.js";import{a as T}from"./chunk-F5QJZKDL.js";import"./chunk-OLJ2S6A6.js";import{b as y,c as k,e as C}from"./chunk-NBD4VOG3.js";import"./chunk-UPRUP24B.js";import"./chunk-36UPHOJS.js";import{a as tr}from"./chunk-2EKC7DK3.js";import{a as H}from"./chunk-5DQBY2TR.js";import{a as er}from"./chunk-GW7GG5ZW.js";import"./chunk-JRQSZHUU.js";import{a as J,b as rr}from"./chunk-JLUDKN4H.js";import"./chunk-RCX4JUI3.js";import{a as p}from"./chunk-55VACCVZ.js";import"./chunk-YBACB5A6.js";import"./chunk-S56EWAS4.js";import"./chunk-37DREOGC.js";import{a as Z}from"./chunk-IJPE22L7.js";import{a as $}from"./chunk-6LTJBLSD.js";import"./chunk-AYFHWLQZ.js";import"./chunk-A4RX3KRZ.js";import{a as g,c as v}from"./chunk-WRDKLT4N.js";import"./chunk-FI76EKUS.js";import"./chunk-N5AQSLAU.js";import"./chunk-6HGUGIYJ.js";import{c as z}from"./chunk-SJ56GVNV.js";import{a as t}from"./chunk-AYDF3IFZ.js";import{QueryClient as L,QueryClientProvider as q}from"@tanstack/react-query";import n from"react";function l(r){let e=document.documentElement;Object.keys(r).forEach(a=>{let o=r[a];o&&e.style.setProperty(a,o)})}t(l,"setCssProperties");function j(r){let e={};return Object.keys(r).forEach(a=>{e[`--${a}`]=r[a]}),e}t(j,"mapThemeColors");function M(r){return{"--spacing":r}}t(M,"mapThemeSpacing");function I(r){return{"--radius":r}}t(I,"mapThemeBorderRadius");function N(r){return{"--fontSizeBase":r.fontSizeBase}}t(N,"mapThemeFont");function u(r){r?.colors&&l(j(r.colors)),r?.spacing&&l(M(r.spacing)),r?.borderRadius&&l(I(r.borderRadius)),r?.font&&l(N(r.font))}t(u,"applyTheme");import U,{createContext as A,useEffect as D,useMemo as O}from"react";var _=A({theme:{}});function h(r){D(()=>{r.theme&&Object.keys(r.theme).length>0&&u(r.theme)},[r.theme]);let e=O(()=>({theme:r.theme}),[r.theme]);return U.createElement(_.Provider,{value:e},r.children)}t(h,"ThemeProvider");var f={staging:"https://gateway.niceremote.com",partners:"https://gateway.partners.remote-sandbox.com",production:"https://gateway.remote.com"};import{createClient as K}from"@hey-api/client-fetch";import{useQuery as V}from"@tanstack/react-query";import{useRef as w}from"react";function W(r){try{return new URL(r),!0}catch{return!1}}t(W,"isValidUrl");var m=t(({auth:r,options:e})=>{let a=w(null),{refetch:o}=V({queryKey:["auth"],queryFn:r,enabled:!1}),s=e.isTestingMode?f.partners:"https://gateway.remote.com",c=p.getConfig(),b="0.2.2",d=!!e.proxy&&W(e.proxy.url);return e.proxy&&!d&&console.error("Invalid proxy URL provided. Using default base URL."),w(K({...c,headers:{...c.headers,...d?e.proxy?.headers:{},"X-Client-Name":"remote-flows-sdk","X-Client-Version":b},baseUrl:d?e.proxy?.url:s,auth:t(async()=>{function x(i){return!i||Date.now()+6e4>i}if(t(x,"hasTokenExpired"),!a.current||x(a.current.expiresAt)){let{data:i}=await o();i&&(a.current={accessToken:i.accessToken,expiresAt:Date.now()+i.expiresIn*1e3})}return a.current?.accessToken},"auth")}))},"useAuth");var Q=new L;function X({children:r,auth:e,isTestingMode:a,proxy:o}){let s=m({auth:e,options:{isTestingMode:!!a,proxy:o}});return n.createElement(v.Provider,{value:{client:s.current}},r)}t(X,"RemoteFlowContextWrapper");function Y({children:r,components:e}){return n.createElement(g.Provider,{value:e?{components:e}:{components:{}}},r)}t(Y,"FormFieldsProvider");function G({auth:r,children:e,components:a,isTestingMode:o=!1,theme:s,proxy:c}){return n.createElement(q,{client:Q},n.createElement(Y,{components:a},n.createElement(X,{isTestingMode:o,auth:r,proxy:c},n.createElement(h,{theme:s},e))))}t(G,"RemoteFlows");export{Z as ContractAmendmentConfirmationForm,tr as ContractAmendmentFlow,$ as ContractAmendmentForm,H as ContractAmendmentSubmit,B as CostCalculatorDisclaimer,T as CostCalculatorFlow,P as CostCalculatorForm,R as CostCalculatorResetButton,E as CostCalculatorResults,F as CostCalculatorSubmitButton,G as RemoteFlows,ir as TerminationFlow,ar as TerminationForm,or as TerminationSubmit,y as buildCostCalculatorEstimationPayload,S as disclaimerData,z as transformYupErrorsIntoObject,er as useContractAmendment,C as useCostCalculator,k as useCostCalculatorEstimationPdf,J as useEmploymentQuery,rr as useTimeOffQuery};
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/remote-flows",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "scripts": {
5
5
  "build": "NODE_ENV=production tsup",
6
6
  "ci": "npm run build && npm run check-format && npm run check-exports && npm run lint && npm run test",
@@ -1,2 +0,0 @@
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
@@ -1 +0,0 @@
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>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Form","TerminationForm","username","onSubmit","onError","onSuccess","formId","terminationBag","useTerminationContext","resolver","useJsonSchemasValidationFormResolver","form","useForm","useEffect","subscription","values","handleSubmit","__name","terminationResult","updatedFields","field","React","Form","JSONSchemaFormFields"]}
@@ -1,2 +0,0 @@
1
- import{a as T}from"./chunk-XFD3ULUF.js";import{a as F}from"./chunk-CTG3DYJR.js";import{a as S}from"./chunk-SEUQNAF6.js";import{a as V}from"./chunk-FZ2HS6G7.js";import{b as y}from"./chunk-36UPHOJS.js";import{a as p}from"./chunk-JRQSZHUU.js";import{b as f}from"./chunk-55VACCVZ.js";import{c as m}from"./chunk-YBACB5A6.js";import{a as _}from"./chunk-S56EWAS4.js";import{d as c}from"./chunk-WRDKLT4N.js";import{a as o}from"./chunk-AYDF3IFZ.js";import{createHeadlessForm as h,modify as J}from"@remoteoss/json-schema-form";import{useMutation as O,useQuery as x}from"@tanstack/react-query";import z from"lodash/omit";function A(i){return{confidential:"",customer_informed_employee:"",customer_informed_employee_date:"",customer_informed_employee_description:"",personal_email:"",termination_reason:void 0,reason_description:"",termination_reason_files:[],will_challenge_termination:"",will_challenge_termination_description:null,agrees_to_pto_amount:"",agrees_to_pto_amount_notes:null,acknowledge_termination_procedure:!1,additional_comments:"",proposed_termination_date:"",risk_assessment_reasons:[],timesheet_file:void 0,...i}}o(A,"buildInitialValues");var K=o(()=>{let{client:i}=c();return O({mutationFn:o(a=>f({client:i,headers:{Authorization:""},body:a}),"mutationFn")})},"useCreateTermination"),L=o(({formValues:i,jsfModify:a,step:s})=>x({queryKey:["rmt-flows-termination-schema",s],queryFn:o(()=>S[s]??T,"queryFn"),select:o(({data:l})=>{let{schema:e}=J(l.schema,a||{});return h(e||{},{initialValues:i||{}})},"select")}),"useTerminationSchema"),ae=o(({employmentId:i,options:a})=>{let{fieldValues:s,setFieldValues:l,stepState:e,previousStep:u,nextStep:g}=_(V),P=e.values?e.values[e.currentStep.name]:s,{data:n,isLoading:b}=L({formValues:P,jsfModify:a?.jsfModify,step:e.currentStep.name}),k=h(F.data.schema),d=K(),{mutateAsync:w}=p(d);async function C(r){if(!i)throw new Error("Employment id is missing");if(e.currentStep.index<e.totalSteps-1){g();return}if(n){let t=m(r,k.fields),{customer_informed_employee:E}=t,j=E==="yes"?{employee_awareness:{date:t.customer_informed_employee_date,note:t.customer_informed_employee_description}}:void 0,D=y(t,["agrees_to_pto_amount","confidential","customer_informed_employee","will_challenge_termination"]),H={...z(D,"customer_informed_employee_date","customer_informed_employee_description"),...j};return w({employment_id:i,termination_details:H,type:"termination"})}}o(C,"onSubmit");function M(){u()}o(M,"back");let v=A({...e.values?.employee_communication,...e.values?.termination_details,...e.values?.paid_time_off,...e.values?.additional_information});return{employmentId:i,stepState:e,fields:n?.fields||[],isLoading:b,isSubmitting:d.isPending,initialValues:v,handleValidation:o(r=>{if(n){let t=m(r,n?.fields);return n?.handleValidation(t)}return null},"handleValidation"),checkFieldUpdates:o(r=>{if(n){let t=m(r,n?.fields,{isPartialValidation:!0});l(t)}},"checkFieldUpdates"),onSubmit:C,back:M}},"useTermination");export{ae as a};
2
- //# sourceMappingURL=chunk-SABMDOWE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Termination/hooks.ts"],"sourcesContent":["import {\n CreateOffboardingParams,\n postCreateOffboarding,\n TerminationDetailsParams,\n} from '@/src/client';\nimport { mutationToPromise } from '@/src/lib/mutations';\nimport { Client } from '@hey-api/client-fetch';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { JSFModify } from '@/src/flows/CostCalculator/types';\nimport { TerminationFormValues } from '@/src/flows/Termination/types';\nimport { useClient } from '@/src/context';\nimport omit from 'lodash/omit';\nimport { parseFormRadioValues } from '@/src/flows/utils';\nimport { useStepState } from '@/src/flows/useStepState';\nimport { STEPS } from '@/src/flows/Termination/utils';\nimport { defaultSchema } from '@/src/flows/Termination/json-schemas/defaultSchema';\nimport { schema } from '@/src/flows/Termination/json-schemas/schema';\nimport { jsonSchema } from '@/src/flows/Termination/json-schemas/jsonSchema';\n\nfunction buildInitialValues(\n stepsInitialValues: Partial<TerminationFormValues>,\n): TerminationFormValues {\n const initialValues: TerminationFormValues = {\n confidential: '',\n customer_informed_employee: '',\n customer_informed_employee_date: '',\n customer_informed_employee_description: '',\n personal_email: '',\n termination_reason: undefined,\n reason_description: '',\n termination_reason_files: [],\n will_challenge_termination: '',\n will_challenge_termination_description: null,\n agrees_to_pto_amount: '',\n agrees_to_pto_amount_notes: null,\n acknowledge_termination_procedure: false,\n additional_comments: '',\n proposed_termination_date: '',\n risk_assessment_reasons: [],\n timesheet_file: undefined,\n ...stepsInitialValues,\n };\n\n return initialValues;\n}\n\nconst useCreateTermination = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateOffboardingParams) => {\n return postCreateOffboarding({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nconst useTerminationSchema = ({\n formValues,\n jsfModify,\n step,\n}: {\n formValues?: TerminationFormValues;\n jsfModify?: JSFModify;\n step?: string;\n}) => {\n return useQuery({\n queryKey: ['rmt-flows-termination-schema', step],\n queryFn: () => {\n return schema[step as keyof typeof schema] ?? defaultSchema;\n },\n select: ({ data }) => {\n const { schema } = modify(data.schema, jsfModify || {});\n const form = createHeadlessForm(schema || {}, {\n initialValues: formValues || {},\n });\n return form;\n },\n });\n};\n\ntype TerminationHookProps = {\n employmentId: string;\n options?: {\n jsfModify?: JSFModify;\n };\n};\n\nexport const useTermination = ({\n employmentId,\n options,\n}: TerminationHookProps) => {\n const { fieldValues, setFieldValues, stepState, previousStep, nextStep } =\n useStepState<keyof typeof STEPS, TerminationFormValues>(STEPS);\n\n const formValues = stepState.values\n ? stepState.values[stepState.currentStep.name as keyof typeof STEPS]\n : fieldValues;\n\n const { data: terminationHeadlessForm, isLoading: isLoadingTermination } =\n useTerminationSchema({\n formValues: formValues,\n jsfModify: options?.jsfModify,\n step: stepState.currentStep.name,\n });\n\n const entireTerminationSchema = createHeadlessForm(jsonSchema.data.schema);\n\n const createTermination = useCreateTermination();\n const { mutateAsync } = mutationToPromise(createTermination);\n\n async function onSubmit(values: TerminationFormValues) {\n if (!employmentId) {\n throw new Error('Employment id is missing');\n }\n\n if (stepState.currentStep.index < stepState.totalSteps - 1) {\n nextStep();\n return;\n }\n\n if (terminationHeadlessForm) {\n // this is a hack because I need to validate all form values with the entire schema\n const parsedValues = parseJSFToValidate(\n values,\n entireTerminationSchema.fields,\n );\n\n const { customer_informed_employee: customerInformedEmployee } =\n parsedValues;\n\n const employeeAwareness =\n customerInformedEmployee === 'yes'\n ? {\n employee_awareness: {\n date: parsedValues.customer_informed_employee_date,\n note: parsedValues.customer_informed_employee_description,\n },\n }\n : undefined;\n\n const radioFieldKeys = [\n 'agrees_to_pto_amount',\n 'confidential',\n 'customer_informed_employee',\n 'will_challenge_termination',\n ];\n\n const parsedRadioValues = parseFormRadioValues(\n parsedValues,\n radioFieldKeys,\n );\n\n const normalizedValues = omit(\n parsedRadioValues,\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n );\n\n const terminationDetails: TerminationDetailsParams = {\n ...normalizedValues,\n ...employeeAwareness,\n } as TerminationDetailsParams;\n\n const terminationPayload: CreateOffboardingParams = {\n employment_id: employmentId,\n termination_details: terminationDetails,\n type: 'termination',\n };\n\n return mutateAsync(terminationPayload);\n }\n\n return;\n }\n\n function back() {\n previousStep();\n }\n\n const initialValues = buildInitialValues({\n ...stepState.values?.employee_communication,\n ...stepState.values?.termination_details,\n ...stepState.values?.paid_time_off,\n ...stepState.values?.additional_information,\n });\n\n return {\n /**\n * Employment id passed useful to be used between components\n */\n employmentId,\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState,\n /**\n * Array of form fields from the contract amendment schema\n */\n fields: terminationHeadlessForm?.fields || [],\n /**\n * Loading state indicating if the termination schema is being fetched\n */\n isLoading: isLoadingTermination,\n /**\n * Loading state indicating if a contract amendment mutation is in progress\n */\n isSubmitting: createTermination.isPending,\n /**\n * Initial form values\n */\n initialValues: initialValues,\n /**\n * Function to validate form values against the contract amendment schema\n * @param values - Form values to validate\n * @returns Validation result or null if no schema is available\n */\n handleValidation: (values: TerminationFormValues) => {\n if (terminationHeadlessForm) {\n const parsedValues = parseJSFToValidate(\n values,\n terminationHeadlessForm?.fields,\n );\n return terminationHeadlessForm?.handleValidation(parsedValues);\n }\n return null;\n },\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: (values: Partial<TerminationFormValues>) => {\n if (terminationHeadlessForm) {\n const parsedValues = parseJSFToValidate(\n values,\n terminationHeadlessForm?.fields,\n { isPartialValidation: true },\n );\n setFieldValues(parsedValues as TerminationFormValues);\n }\n },\n /**\n * Function to handle form submission\n * @param values - Form values to submit\n * @returns Promise resolving to the mutation result\n */\n onSubmit,\n\n /**\n * Function to handle going back to the previous step\n * @returns {void}\n */\n back,\n };\n};\n"],"mappings":"wbAOA,OAAS,sBAAAA,EAAoB,UAAAC,MAAc,8BAC3C,OAAS,eAAAC,EAAa,YAAAC,MAAgB,wBAKtC,OAAOC,MAAU,cAQjB,SAASC,EACPC,EACuB,CAsBvB,MArB6C,CAC3C,aAAc,GACd,2BAA4B,GAC5B,gCAAiC,GACjC,uCAAwC,GACxC,eAAgB,GAChB,mBAAoB,OACpB,mBAAoB,GACpB,yBAA0B,CAAC,EAC3B,2BAA4B,GAC5B,uCAAwC,KACxC,qBAAsB,GACtB,2BAA4B,KAC5B,kCAAmC,GACnC,oBAAqB,GACrB,0BAA2B,GAC3B,wBAAyB,CAAC,EAC1B,eAAgB,OAChB,GAAGA,CACL,CAGF,CAzBSC,EAAAF,EAAA,sBA2BT,IAAMG,EAAuBD,EAAA,IAAM,CACjC,GAAM,CAAE,OAAAE,CAAO,EAAIC,EAAU,EAC7B,OAAOC,EAAY,CACjB,WAAYJ,EAACK,GACJC,EAAsB,CA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2BAA4BS,CAAyB,EAC3DF,EAEIG,EACJD,IAA6B,MACzB,CACE,mBAAoB,CAClB,KAAMF,EAAa,gCACnB,KAAMA,EAAa,sCACrB,CACF,EACA,OASAI,EAAoBC,EACxBL,EARqB,CACrB,uBACA,eACA,6BACA,4BACF,CAKA,EAQMM,EAA+C,CACnD,GAPuBC,EACvBH,EACA,kCACA,wCACF,EAIE,GAAGD,CACL,EAQA,OAAOP,EAN6C,CAClD,cAAed,EACf,oBAAqBwB,EACrB,KAAM,aACR,CAEqC,CACvC,CAGF,CA/De1C,EAAAkC,EAAA,YAiEf,SAASU,GAAO,CACdrB,EAAa,CACf,CAFSvB,EAAA4C,EAAA,QAIT,IAAMC,EAAgB/C,EAAmB,CACvC,GAAGwB,EAAU,QAAQ,uBACrB,GAAGA,EAAU,QAAQ,oBACrB,GAAGA,EAAU,QAAQ,cACrB,GAAGA,EAAU,QAAQ,sBACvB,CAAC,EAED,MAAO,CAIL,aAAAJ,EAIA,UAAAI,EAIA,OAAQK,GAAyB,QAAU,CAAC,EAI5C,UAAWC,EAIX,aAAcG,EAAkB,UAIhC,cAAec,EAMf,iBAAkB7C,EAACmC,GAAkC,CACnD,GAAIR,EAAyB,CAC3B,IAAMS,EAAeC,EACnBF,EACAR,GAAyB,MAC3B,EACA,OAAOA,GAAyB,iBAAiBS,CAAY,CAC/D,CACA,OAAO,IACT,EATkB,oBAclB,kBAAmBpC,EAACmC,GAA2C,CAC7D,GAAIR,EAAyB,CAC3B,IAAMS,EAAeC,EACnBF,EACAR,GAAyB,OACzB,CAAE,oBAAqB,EAAK,CAC9B,EACAN,EAAee,CAAqC,CACtD,CACF,EATmB,qBAenB,SAAAF,EAMA,KAAAU,CACF,CACF,EAtK8B","names":["createHeadlessForm","modify","useMutation","useQuery","omit","buildInitialValues","stepsInitialValues","__name","useCreateTermination","client","useClient","useMutation","payload","postCreateOffboarding","useTerminationSchema","formValues","jsfModify","step","useQuery","schema","defaultSchema","data","modify","createHeadlessForm","useTermination","employmentId","options","fieldValues","setFieldValues","stepState","previousStep","nextStep","useStepState","STEPS","terminationHeadlessForm","isLoadingTermination","entireTerminationSchema","jsonSchema","createTermination","mutateAsync","mutationToPromise","onSubmit","values","parsedValues","parseJSFToValidate","customerInformedEmployee","employeeAwareness","parsedRadioValues","parseFormRadioValues","terminationDetails","omit","back","initialValues"]}