@remoteoss/remote-flows 0.1.0 → 0.1.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.
- package/dist/chunk-2DWTIFOU.js +2 -0
- package/dist/chunk-2DWTIFOU.js.map +1 -0
- package/dist/chunk-36UPHOJS.js +2 -0
- package/dist/chunk-36UPHOJS.js.map +1 -0
- package/dist/chunk-37DREOGC.js +2 -0
- package/dist/chunk-37DREOGC.js.map +1 -0
- package/dist/chunk-5DQBY2TR.js +2 -0
- package/dist/chunk-5DQBY2TR.js.map +1 -0
- package/dist/{chunk-VV7RML2Q.js → chunk-5O2L2L25.js} +2 -2
- package/dist/chunk-5PXYSIYN.js +2 -0
- package/dist/chunk-5PXYSIYN.js.map +1 -0
- package/dist/chunk-5YDR5BIG.js +2 -0
- package/dist/chunk-5YDR5BIG.js.map +1 -0
- package/dist/chunk-6DMCAUPE.js +2 -0
- package/dist/chunk-6DMCAUPE.js.map +1 -0
- package/dist/chunk-6HGUGIYJ.js +2 -0
- package/dist/chunk-6HGUGIYJ.js.map +1 -0
- package/dist/chunk-A7ZJQCNU.js +1 -0
- package/dist/chunk-CKGTR44U.js +2 -0
- package/dist/chunk-CKGTR44U.js.map +1 -0
- package/dist/chunk-DZYFSFZ7.js +2 -0
- package/dist/chunk-DZYFSFZ7.js.map +1 -0
- package/dist/chunk-FZ7FWFJX.js +1 -0
- package/dist/chunk-FZ7FWFJX.js.map +1 -0
- package/dist/chunk-G2GI6FEO.js +2 -0
- package/dist/{chunk-5UXOVZY5.js.map → chunk-G2GI6FEO.js.map} +1 -1
- package/dist/chunk-HELGRHUB.js +2 -0
- package/dist/chunk-HELGRHUB.js.map +1 -0
- package/dist/chunk-JRQSZHUU.js +2 -0
- package/dist/chunk-JRQSZHUU.js.map +1 -0
- package/dist/chunk-JWMY3OVH.js +2 -0
- package/dist/chunk-JWMY3OVH.js.map +1 -0
- package/dist/chunk-LUCFM5TE.js +2 -0
- package/dist/chunk-LUCFM5TE.js.map +1 -0
- package/dist/chunk-OCNLZSS7.js +2 -0
- package/dist/chunk-OCNLZSS7.js.map +1 -0
- package/dist/chunk-QWZVBZED.js +2 -0
- package/dist/{chunk-Q6GIPVSE.js.map → chunk-QWZVBZED.js.map} +1 -1
- package/dist/chunk-RL2KU7BM.js +2 -0
- package/dist/chunk-RL2KU7BM.js.map +1 -0
- package/dist/chunk-ROPNMSSM.js +2 -0
- package/dist/{chunk-YNLDKIE4.js.map → chunk-ROPNMSSM.js.map} +1 -1
- package/dist/chunk-TIXDBKBM.js +2 -0
- package/dist/chunk-TIXDBKBM.js.map +1 -0
- package/dist/chunk-TPKAREI4.js +2 -0
- package/dist/chunk-TPKAREI4.js.map +1 -0
- package/dist/{chunk-KQCZ2KSO.js → chunk-WTGUGPHV.js} +2 -2
- package/dist/{chunk-KQCZ2KSO.js.map → chunk-WTGUGPHV.js.map} +1 -1
- package/dist/chunk-XFE56PM4.js +2 -0
- package/dist/chunk-XFE56PM4.js.map +1 -0
- package/dist/chunk-Y5UG6SJJ.js +2 -0
- package/dist/chunk-Y5UG6SJJ.js.map +1 -0
- package/dist/chunk-ZCG5JUUR.js +2 -0
- package/dist/chunk-ZCG5JUUR.js.map +1 -0
- package/dist/flows/ContractAmendment/ContractAmendmentBack.d.ts +5 -0
- package/dist/flows/ContractAmendment/ContractAmendmentBack.js +2 -0
- package/dist/flows/ContractAmendment/ContractAmendmentBack.js.map +1 -0
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +30 -0
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js +2 -0
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js.map +1 -0
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +24 -7
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +26 -3
- package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentSubmit.d.ts +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentSubmit.js +1 -1
- package/dist/flows/ContractAmendment/context.d.ts +26 -24
- package/dist/flows/ContractAmendment/context.js +1 -1
- package/dist/flows/ContractAmendment/hooks.d.ts +94 -6
- package/dist/flows/ContractAmendment/hooks.js +1 -1
- package/dist/flows/ContractAmendment/index.d.ts +8 -5
- package/dist/flows/ContractAmendment/index.js +1 -1
- package/dist/flows/ContractAmendment/utils.d.ts +11 -0
- package/dist/flows/ContractAmendment/utils.js +2 -0
- package/dist/flows/ContractAmendment/utils.js.map +1 -0
- package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +2 -2
- package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorResetButton.d.ts +1 -1
- package/dist/flows/CostCalculator/CostCalculatorResetButton.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorResults.d.ts +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorResults.js +1 -1
- package/dist/flows/CostCalculator/context.d.ts +1 -1
- package/dist/flows/CostCalculator/hooks.d.ts +1 -1
- package/dist/flows/CostCalculator/hooks.js +1 -1
- package/dist/flows/CostCalculator/index.d.ts +1 -1
- package/dist/flows/CostCalculator/index.js +1 -1
- package/dist/flows/CostCalculator/types.d.ts +1 -1
- package/dist/flows/CostCalculator/utils.d.ts +1 -1
- package/dist/flows/CostCalculator/utils.js +1 -1
- package/dist/flows/Termination/TerminationFlow.d.ts +20 -0
- package/dist/flows/Termination/TerminationFlow.js +2 -0
- package/dist/flows/Termination/TerminationFlow.js.map +1 -0
- package/dist/flows/Termination/TerminationForm.d.ts +13 -0
- package/dist/flows/Termination/TerminationForm.js +2 -0
- package/dist/flows/Termination/TerminationForm.js.map +1 -0
- package/dist/flows/Termination/TerminationSubmit.d.ts +5 -0
- package/dist/flows/Termination/TerminationSubmit.js +2 -0
- package/dist/flows/Termination/TerminationSubmit.js.map +1 -0
- package/dist/flows/Termination/context.d.ts +43 -0
- package/dist/flows/Termination/context.js +2 -0
- package/dist/flows/Termination/context.js.map +1 -0
- package/dist/flows/Termination/hooks.d.ts +40 -0
- package/dist/flows/Termination/hooks.js +2 -0
- package/dist/flows/Termination/hooks.js.map +1 -0
- package/dist/flows/Termination/index.d.ts +10 -0
- package/dist/flows/Termination/index.js +2 -0
- package/dist/flows/Termination/index.js.map +1 -0
- package/dist/flows/Termination/jsonSchema.d.ts +297 -0
- package/dist/flows/Termination/jsonSchema.js +2 -0
- package/dist/flows/Termination/jsonSchema.js.map +1 -0
- package/dist/flows/Termination/types.d.ts +23 -0
- package/dist/flows/Termination/types.js +1 -0
- package/dist/flows/Termination/types.js.map +1 -0
- package/dist/flows/useStepState.d.ts +49 -0
- package/dist/flows/useStepState.js +2 -0
- package/dist/flows/useStepState.js.map +1 -0
- package/dist/flows/utils.d.ts +20 -1
- package/dist/flows/utils.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +40 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mutations-v9H353tz.d.ts +10 -0
- package/dist/{types.gen-DCJSPsGk.d.ts → types.gen-BhkGMC9-.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-4QHHDFB2.js +0 -2
- package/dist/chunk-4QHHDFB2.js.map +0 -1
- package/dist/chunk-5UXOVZY5.js +0 -2
- package/dist/chunk-7V6IPASW.js +0 -2
- package/dist/chunk-7V6IPASW.js.map +0 -1
- package/dist/chunk-ANPGCYMT.js +0 -2
- package/dist/chunk-ANPGCYMT.js.map +0 -1
- package/dist/chunk-GCF5EF2A.js +0 -2
- package/dist/chunk-GCF5EF2A.js.map +0 -1
- package/dist/chunk-GKEURJR4.js +0 -2
- package/dist/chunk-GKEURJR4.js.map +0 -1
- package/dist/chunk-KY7BGW6H.js +0 -2
- package/dist/chunk-KY7BGW6H.js.map +0 -1
- package/dist/chunk-MKJHD77O.js +0 -1
- package/dist/chunk-Q6GIPVSE.js +0 -2
- package/dist/chunk-UTCIIPYZ.js +0 -2
- package/dist/chunk-UTCIIPYZ.js.map +0 -1
- package/dist/chunk-VTAHQOKR.js +0 -2
- package/dist/chunk-VTAHQOKR.js.map +0 -1
- package/dist/chunk-YGP3O2VJ.js +0 -2
- package/dist/chunk-YGP3O2VJ.js.map +0 -1
- package/dist/chunk-YNLDKIE4.js +0 -2
- package/dist/hooks-BQWrl9Bj.d.ts +0 -50
- /package/dist/{chunk-VV7RML2Q.js.map → chunk-5O2L2L25.js.map} +0 -0
- /package/dist/{chunk-MKJHD77O.js.map → chunk-A7ZJQCNU.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as t}from"./chunk-DZYFSFZ7.js";import{a as i}from"./chunk-XFE56PM4.js";import{a as n}from"./chunk-AYDF3IFZ.js";import m,{useId as p}from"react";function d({render:o,terminationBag:e}){let r=p();return m.createElement(t.Provider,{value:{formId:r,terminationBag:e}},o({terminationBag:e}))}n(d,"TerminationFlowProvider");var y=n(({employmentId:o,render:e,options:r})=>{let a=i({employmentId:o,options:r});return m.createElement(d,{terminationBag:a,render:e})},"TerminationFlow");export{y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HELGRHUB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Termination/TerminationFlow.tsx"],"sourcesContent":["import { TerminationContext } from '@/src/flows/Termination/context';\nimport React, { PropsWithChildren, useId } from 'react';\nimport { useTermination } from '@/src/flows/Termination/hooks';\nimport { JSFModify } from '@/src/flows/CostCalculator/types';\n\nfunction TerminationFlowProvider({\n render,\n terminationBag,\n}: PropsWithChildren<{\n render: ({\n terminationBag,\n }: {\n terminationBag: ReturnType<typeof useTermination>;\n }) => React.ReactNode;\n terminationBag: ReturnType<typeof useTermination>;\n}>) {\n const formId = useId();\n\n return (\n <TerminationContext.Provider\n value={{\n formId: formId,\n terminationBag,\n }}\n >\n {render({ terminationBag })}\n </TerminationContext.Provider>\n );\n}\n\ntype TerminationFlowProps = {\n employmentId: string;\n render: ({\n terminationBag,\n }: {\n terminationBag: ReturnType<typeof useTermination>;\n }) => React.ReactNode;\n options?: {\n jsfModify?: JSFModify;\n };\n};\n\nexport const TerminationFlow = ({\n employmentId,\n render,\n options,\n}: TerminationFlowProps) => {\n const terminationBag = useTermination({ employmentId, options });\n\n return (\n <TerminationFlowProvider terminationBag={terminationBag} render={render} />\n );\n};\n"],"mappings":"wHACA,OAAOA,GAA4B,SAAAC,MAAa,QAIhD,SAASC,EAAwB,CAC/B,OAAAC,EACA,eAAAC,CACF,EAOI,CACF,IAAMC,EAASC,EAAM,EAErB,OACEC,EAAA,cAACC,EAAmB,SAAnB,CACC,MAAO,CACL,OAAQH,EACR,eAAAD,CACF,GAECD,EAAO,CAAE,eAAAC,CAAe,CAAC,CAC5B,CAEJ,CAvBSK,EAAAP,EAAA,2BAqCF,IAAMQ,EAAkBD,EAAA,CAAC,CAC9B,aAAAE,EACA,OAAAR,EACA,QAAAS,CACF,IAA4B,CAC1B,IAAMR,EAAiBS,EAAe,CAAE,aAAAF,EAAc,QAAAC,CAAQ,CAAC,EAE/D,OACEL,EAAA,cAACL,EAAA,CAAwB,eAAgBE,EAAgB,OAAQD,EAAQ,CAE7E,EAV+B","names":["React","useId","TerminationFlowProvider","render","terminationBag","formId","useId","React","TerminationContext","__name","TerminationFlow","employmentId","options","useTermination"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e}from"./chunk-AYDF3IFZ.js";function s(a){return{mutateAsync:e(n=>new Promise((t,o)=>{a.mutate(n,{onSuccess:e(r=>{r.data?t({data:r.data,error:null}):t({data:null,error:new Error("Something went wrong. Please try again later.")})},"onSuccess"),onError:e(r=>{o({data:null,error:r})},"onError")})}),"mutateAsync")}}e(s,"mutationToPromise");export{s as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JRQSZHUU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/mutations.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { UseMutationResult } from '@tanstack/react-query';\n\ntype MutationData<T> =\n T extends UseMutationResult<infer R, any, any, any> ? R : never;\ntype MutationVariables<T> =\n T extends UseMutationResult<any, any, infer V, any> ? V : never;\ntype MutationError<T> =\n T extends UseMutationResult<any, infer E, any, any> ? E : never;\n\nexport interface SuccessResponse<D> {\n data: D;\n error: null;\n}\n\nexport interface ErrorResponse<E> {\n data: null;\n error: E;\n}\n\ntype PromiseResult<D, E> = SuccessResponse<D> | ErrorResponse<E>;\n\n/**\n * Converts a mutation to a promise-based API. We avoid using the\n * `mutateAsync` method from react-query for 2 reasons:\n * 1. We lose the isPending state of the mutation\n * 2. We want to return the data and error in a consistent way\n * (either data or error is null)\n * @param mutation\n * @returns\n */\nexport function mutationToPromise<\n T extends UseMutationResult<any, any, any, any>,\n>(mutation: T) {\n type Data = MutationData<T>;\n type Variables = MutationVariables<T>;\n type Error = MutationError<T>;\n\n return {\n mutateAsync: (values: Variables): Promise<PromiseResult<Data, Error>> => {\n return new Promise((resolve, reject) => {\n mutation.mutate(values, {\n onSuccess: (response) => {\n if (response.data) {\n resolve({\n data: response.data as Data,\n error: null,\n });\n } else {\n resolve({\n data: null,\n error: new Error(\n 'Something went wrong. Please try again later.',\n ) as unknown as Error,\n });\n }\n },\n onError: (error) => {\n reject({\n data: null,\n error: error as Error,\n });\n },\n });\n });\n },\n };\n}\n"],"mappings":"wCA+BO,SAASA,EAEdC,EAAa,CAKb,MAAO,CACL,YAAaC,EAACC,GACL,IAAI,QAAQ,CAACC,EAASC,IAAW,CACtCJ,EAAS,OAAOE,EAAQ,CACtB,UAAWD,EAACI,GAAa,CACnBA,EAAS,KACXF,EAAQ,CACN,KAAME,EAAS,KACf,MAAO,IACT,CAAC,EAEDF,EAAQ,CACN,KAAM,KACN,MAAO,IAAI,MACT,+CACF,CACF,CAAC,CAEL,EAdW,aAeX,QAASF,EAACK,GAAU,CAClBF,EAAO,CACL,KAAM,KACN,MAAOE,CACT,CAAC,CACH,EALS,UAMX,CAAC,CACH,CAAC,EAzBU,cA2Bf,CACF,CApCgBL,EAAAF,EAAA","names":["mutationToPromise","mutation","__name","values","resolve","reject","response","error"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as A}from"./chunk-JRQSZHUU.js";import{a as l,b as S}from"./chunk-TPKAREI4.js";import{c as g,f as b,h as w,j as _}from"./chunk-G2GI6FEO.js";import{c as h}from"./chunk-6DMCAUPE.js";import{a as M}from"./chunk-5PXYSIYN.js";import{d as c}from"./chunk-WRDKLT4N.js";import{a as t}from"./chunk-AYDF3IFZ.js";import{createHeadlessForm as H,modify as K}from"@remoteoss/json-schema-form";import{useMutation as k,useQuery as q}from"@tanstack/react-query";var R=t(({employmentId:n})=>{let{client:e}=c();return q({queryKey:["employment"],retry:!1,queryFn:t(()=>w({client:e,headers:{Authorization:""},path:{employment_id:n}}),"queryFn"),select:t(({data:s})=>s,"select")})},"useEmploymentQuery"),B=t(({countryCode:n,employment:e,fieldValues:s,options:r})=>{let{client:u}=c();return q({queryKey:["contract-amendment-schema"],retry:!1,queryFn:t(async()=>{let a=await g({client:u,headers:{Authorization:""},query:{employment_id:e?.data?.employment?.id,country_code:n}});if(a.error||!a.data)throw new Error("Failed to fetch contract amendment schema");return a},"queryFn"),enabled:!!e,select:t(({data:a})=>{let i=a?.data||{};if(r&&r.jsfModify){let{schema:p}=K(i,r.jsfModify);i=p}let d={...s},o=Object.keys(d).length>0;return H(i,{initialValues:o?d:S(e)})},"select")})},"useContractAmendmentSchemaQuery"),J=t(()=>{let{client:n}=c();return k({mutationFn:t(e=>b({client:n,headers:{Authorization:""},body:e}),"mutationFn")})},"useCreateContractAmendmentMutation"),O=t(()=>{let{client:n}=c();return k({mutationFn:t(e=>_({client:n,headers:{Authorization:""},body:e}),"mutationFn")})},"useAutomatableContractAmendmentMutation"),nt=t(({employmentId:n,countryCode:e,options:s})=>{let{fieldValues:r,setFieldValues:u,stepState:a,nextStep:i,previousStep:d}=M(l),{data:o,isLoading:E,isError:p,error:L}=R({employmentId:n}),{data:m,isLoading:j,isError:v,error:z}=B({employment:o,countryCode:e,fieldValues:r,options:s}),T=S(o,m?.fields),V=J(),F=O();async function I(y){let f=h(y,m?.fields||[],{isPartialValidation:!1}),P={employment_id:o?.data.employment?.id,amendment_contract_id:o?.data.employment?.active_contract_id,contract_amendment:{...f}};switch(a.currentStep.name){case l.form.name:{let{mutateAsync:C}=A(F),x=await C(P);return i(),x}case l.confirmation_form.name:{let{mutateAsync:C}=A(V);return C(P)}default:throw new Error("Invalid step state")}}t(I,"onSubmit");function Q(y){if(m){let f=h(y,m?.fields);return m?.handleValidation(f)}return null}t(Q,"handleValidation");function U(){d()}return t(U,"back"),{stepState:a,fields:m?.fields||[],isLoading:E||j,isError:p||v,error:L||z,isSubmitting:F.isPending||V.isPending,initialValues:T,values:r,handleValidation:Q,checkFieldUpdates:u,onSubmit:I,back:U}},"useContractAmendment");export{nt as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JWMY3OVH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/ContractAmendment/hooks.ts"],"sourcesContent":["import {\n CreateContractAmendmentParams,\n EmploymentShowResponse,\n getShowContractAmendmentSchema,\n getShowEmployment,\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 { useClient } from '@/src/context';\nimport { FieldValues } from 'react-hook-form';\nimport { useStepState } from '../useStepState';\nimport { buildInitialValues, STEPS } from './utils';\n\ntype UseEmployment = Pick<ContractAmendmentParams, 'employmentId'>;\n\nconst useEmploymentQuery = ({ employmentId }: UseEmployment) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['employment'],\n retry: false,\n queryFn: () => {\n return getShowEmployment({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n path: { employment_id: employmentId },\n });\n },\n select: ({ data }) => data,\n });\n};\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 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 const {\n data: contractAmendmentHeadlessForm,\n isLoading: isLoadingContractAmendments,\n isError: isErrorContractAmendmentSchema,\n error: errorContractAmendmentSchema,\n } = useContractAmendmentSchemaQuery({\n employment,\n countryCode,\n 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":"oTAaA,OAAS,sBAAAA,EAAoB,UAAAC,MAAc,8BAC3C,OAAS,eAAAC,EAAa,YAAAC,MAAgB,wBAUtC,IAAMC,EAAqBC,EAAA,CAAC,CAAE,aAAAC,CAAa,IAAqB,CAC9D,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAU,EAC7B,OAAOC,EAAS,CACd,SAAU,CAAC,YAAY,EACvB,MAAO,GACP,QAASJ,EAAA,IACAK,EAAkB,CACvB,OAAQH,EACR,QAAS,CACP,cAAe,EACjB,EACA,KAAM,CAAE,cAAeD,CAAa,CACtC,CAAC,EAPM,WAST,OAAQD,EAAA,CAAC,CAAE,K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E,MAAM,IAAI,MAAM,oBAAoB,CACxC,CACF,CAzCevB,EAAA4C,EAAA,YA2Cf,SAASO,EAAiBN,EAAqB,CAC7C,GAAIR,EAA+B,CACjC,IAAMS,EAAeC,EACnBF,EACAR,GAA+B,MACjC,EACA,OAAOA,GAA+B,iBAAiBS,CAAY,CACrE,CACA,OAAO,IACT,CATS9C,EAAAmD,EAAA,oBAWT,SAASC,GAAO,CACdrB,EAAa,CACf,CAFS,OAAA/B,EAAAoD,EAAA,QAIF,CAIL,UAAAvB,EAIA,OAAQQ,GAA+B,QAAU,CAAC,EAIlD,UAAWH,GAAuBI,EAIlC,QAASH,GAAqBI,EAI9B,MAAOH,GAAmBI,EAI1B,aACEG,EAAqC,WACrCD,EAAgC,UAIlC,cAAAD,EAIA,OAAQ/B,EAMR,iBAAAyC,EAKA,kBAAmBvB,EAMnB,SAAAgB,EAKA,KAAAQ,CACF,CACF,EAzJoC","names":["createHeadlessForm","modify","useMutation","useQuery","useEmploymentQuery","__name","employmentId","client","useClient","useQuery","getShowEmployment","data","useContractAmendmentSchemaQuery","countryCode","employment","fieldValues","options","response","getShowContractAmendmentSchema","jsfSchema","schema","modify","copyFieldValues","hasFieldValues","createHeadlessForm","buildInitialValues","useCreateContractAmendmentMutation","useMutation","payload","postCreateContractAmendment","useAutomatableContractAmendmentMutation","postAutomatableContractAmendment","useContractAmendment","setFieldValues","stepState","nextStep","previousStep","useStepState","STEPS","isLoadingEmployment","isErrorEmployment","errorEmployment","contractAmendmentHeadlessForm","isLoadingContractAmendments","isErrorContractAmendmentSchema","errorContractAmendmentSchema","initialValues","createContractAmendmentMutation","automatableContractAmendmentMutation","onSubmit","values","parsedValues","parseJSFToValidate","mutateAsync","mutationToPromise","automatableContractAmendment","handleValidation","back"]}
|
|
@@ -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 b,e as R,f as w,g as N}from"./chunk-TIXDBKBM.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 C 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:f,...y}){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 C.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:f,...y};return C.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 C.createElement(S,{className:s(`RemoteFlows__CheckBoxField__Item__${e}`)},C.createElement(R,null,C.createElement(C.Fragment,null,f&&d?f.map(p=>C.createElement("div",{key:p.value,className:"flex space-x-2"},C.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"}),C.createElement(b,{htmlFor:p.value,className:"mb-0 RemoteFlows__CheckBox__Label"},p.label))):C.createElement("div",{className:"flex space-x-2"},C.createElement(O,{id:e,onCheckedChange:p=>{n.onChange(p),i?.(p)},checked:n.value,className:"RemoteFlows__CheckBox__Input"}),C.createElement(b,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label"},a)))),r&&C.createElement(w,null,r),x.error&&C.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:f}=g(),{control:y}=Je();return v.createElement(_,{control:y,name:r,render:({field:l,fieldState:c})=>{if(f?.date){let m=f?.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,{className:`flex flex-col RemoteFlows__DatePickerField__Item__${r}`},v.createElement(b,{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),f=o(()=>{d.current?.click()},"handleClick"),y=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:y,className:"hidden","aria-label":"File upload",multiple:r}),T.createElement(U,{onClick:f,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:f}=g(),{control:y}=qe();return I.createElement(_,{control:y,name:e,render:({field:l,fieldState:c})=>{if(f?.file){let m=f?.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,{className:`RemoteFlows__FileUpload__Item__${e}`},I.createElement(b,{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:f}=g(),{control:y}=Xe();return L.createElement(_,{control:y,name:e,render:({field:l,fieldState:c})=>{if(f?.text){let m=f?.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,{className:`RemoteFlows__TextField__Item__${e}`},L.createElement(b,{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(f=>{a.onChange(f),e.onChange?.(f)},"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,...f}){let{components:y}=g(),{control:l}=Ze();return h.createElement(_,{control:l,name:e,defaultValue:t,render:({field:c,fieldState:m})=>{if(y?.radio){let n=y?.radio,x={name:e,defaultValue:t,description:r,label:a,options:i,...f};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}`)},h.createElement(b,null,a),h.createElement(R,null,h.createElement(ve,{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,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(b,{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 u from"@radix-ui/react-select";import{CheckIcon as et,ChevronDownIcon as he,ChevronUpIcon as tt}from"lucide-react";function ye({...e}){return F.createElement(u.Root,{"data-slot":"select",...e})}o(ye,"Select");function be({...e}){return F.createElement(u.Group,{"data-slot":"select-group",...e})}o(be,"SelectGroup");function Ce({...e}){return F.createElement(u.Value,{"data-slot":"select-value",...e})}o(Ce,"SelectValue");function Pe({className:e,children:t,...r}){return F.createElement(u.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(u.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(u.Portal,null,F.createElement(u.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(u.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(u.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(u.ItemText,null,t),F.createElement("span",{className:"flex size-3.5 items-center justify-center"},F.createElement(u.ItemIndicator,null,F.createElement(et,{className:"size-4"}))))}o(Re,"SelectItem");function ot({className:e,...t}){return F.createElement(u.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(u.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,...f}){let{control:y}=at(),{components:l}=g();return P.createElement(_,{defaultValue:a,control:y,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,...f};return P.createElement(n,{field:{...c,onChange:o(p=>{c.onChange(p),d?.(p)},"onChange")},fieldState:m,fieldData:x})}return P.createElement(S,{className:`RemoteFlows__SelectField__Item__${t}`},P.createElement(b,{className:"RemoteFlows__SelectField__Label"},e),P.createElement(R,{"aria-label":e},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},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:f}=g(),{control:y}=it();return k.createElement(_,{control:y,name:e,render:({field:l,fieldState:c})=>{if(f?.textarea){let n=f?.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,{className:`RemoteFlows__TextArea__Item__${e}`},k.createElement(b,{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(f=>{a.onChange(f),e.onChange?.(f)},"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-LUCFM5TE.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 className={cn(`RemoteFlows__CheckBoxField__Item__${name}`)}>\n <FormControl>\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 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 className={`RemoteFlows__FileUpload__Item__${name}`}>\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 className={`RemoteFlows__TextField__Item__${name}`}>\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 >\n <FormLabel>{label}</FormLabel>\n <FormControl>\n <RadioGroup\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 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 className={`RemoteFlows__SelectField__Item__${name}`}>\n <FormLabel className=\"RemoteFlows__SelectField__Label\">\n {label}\n </FormLabel>\n <FormControl aria-label={label}>\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 >\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 className={`RemoteFlows__TextArea__Item__${name}`}>\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,G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,EAAM,KACZ,YAAaA,EAAM,YACnB,MAAOA,EAAM,MACb,UAAWA,EAAM,UACnB,EAIJ,IAAMM,EAAiBC,EAAUP,EAAM,SAA2B,EAClE,OAAOM,EACLF,EAAA,cAACI,GAAA,CAAS,IAAKR,EAAM,MACnBI,EAAA,cAACE,EAAA,CAAgB,GAAGN,EAAO,EAC1BA,EAAM,UACLI,EAAA,cAACK,GAAA,CAAW,GAAIT,EAAM,UAA8B,EAClD,IACN,EAEAI,EAAA,cAAC,KAAE,UAAU,SAAQ,cACPJ,EAAM,UAAoB,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","option","Checkbox","FormLabel","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 r}from"./chunk-OLJ2S6A6.js";import{b as n}from"./chunk-FI76EKUS.js";import{a as e}from"./chunk-SJ56GVNV.js";import{a as o}from"./chunk-AYDF3IFZ.js";import i from"react";function _({children:s,...t}){let{form:m,formId:l,costCalculatorBag:u}=r();return i.createElement(n,{...t,type:"reset",className:e("RemoteFlows__CostCalculatorForm__ResetButton",t.className),form:l,onClick:a=>{u?.resetForm(),m.reset(),t.onClick?.(a)}},s)}o(_,"CostCalculatorResetButton");export{_ as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OCNLZSS7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/CostCalculator/CostCalculatorResetButton.tsx"],"sourcesContent":["import { Button } from '@/src/components/ui/button';\nimport React, { ButtonHTMLAttributes, PropsWithChildren } from 'react';\nimport { useCostCalculatorContext } from './context';\nimport { cn } from '@/src/lib/utils';\n\nexport function CostCalculatorResetButton({\n children,\n ...props\n}: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>) {\n const { form, formId, costCalculatorBag } = useCostCalculatorContext();\n return (\n <Button\n {...props}\n type=\"reset\"\n className={cn(\n 'RemoteFlows__CostCalculatorForm__ResetButton',\n props.className,\n )}\n form={formId}\n onClick={(evt) => {\n costCalculatorBag?.resetForm();\n form.reset();\n props.onClick?.(evt);\n }}\n >\n {children}\n </Button>\n );\n}\n"],"mappings":"gKACA,OAAOA,MAAwD,QAIxD,SAASC,EAA0B,CACxC,SAAAC,EACA,GAAGC,CACL,EAA+D,CAC7D,GAAM,CAAE,KAAAC,EAAM,OAAAC,EAAQ,kBAAAC,CAAkB,EAAIC,EAAyB,EACrE,OACEC,EAAA,cAACC,EAAA,CACE,GAAGN,EACJ,KAAK,QACL,UAAWO,EACT,+CACAP,EAAM,SACR,EACA,KAAME,EACN,QAAUM,GAAQ,CAChBL,GAAmB,UAAU,EAC7BF,EAAK,MAAM,EACXD,EAAM,UAAUQ,CAAG,CACrB,GAECT,CACH,CAEJ,CAvBgBU,EAAAX,EAAA","names":["React","CostCalculatorResetButton","children","props","form","formId","costCalculatorBag","useCostCalculatorContext","React","Button","cn","evt","__name"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as n}from"./chunk-OLJ2S6A6.js";import{d as u,e as i}from"./chunk-WTGUGPHV.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-QWZVBZED.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
|
|
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 e={data:{version:7,schema:{additionalProperties:!1,allOf:[{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"}},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\u2019s 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-RL2KU7BM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Termination/jsonSchema.ts"],"sourcesContent":["export const jsonSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n customer_informed_employee: {\n const: 'yes', // Ensure this matches the value in the form data\n },\n },\n required: ['customer_informed_employee'], // Ensure this field is required\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 ], // Make the field required when condition is met\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 },\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 { const: 'values', title: 'Values' },\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 { const: 'other', title: 'Other' },\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,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,OACb,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,iCACP,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,CAAE,MAAO,SAAU,MAAO,QAAS,EACnC,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,CAAE,MAAO,QAAS,MAAO,OAAQ,CACnC,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{b as i}from"./chunk-OLJ2S6A6.js";import{a as e}from"./chunk-LUCFM5TE.js";import{a as l}from"./chunk-TIXDBKBM.js";import{a as r}from"./chunk-AYDF3IFZ.js";import t from"react";function S({onSubmit:u,onError:C,onSuccess:c}){let{form:a,formId:n,costCalculatorBag:s}=i(),d=r(async m=>{let o=await s?.onSubmit(m);await u?.(m),o?.error?C?.(o.error):o?.data&&c?.(o?.data)},"handleSubmit");return t.createElement(l,{...a},t.createElement("form",{id:n,onSubmit:a.handleSubmit(d),className:"space-y-4 RemoteFlows__CostCalculatorForm"},t.createElement(e,{fields:s?.fields??[]})))}r(S,"CostCalculatorForm");export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ROPNMSSM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flows/CostCalculator/CostCalculatorForm.tsx"],"sourcesContent":["import { CostCalculatorEstimateResponse } from '@/src/client';\nimport { JSONSchemaFormFields } from '@/src/components/form/JSONSchemaForm';\nimport { Form } from '@/src/components/ui/form';\nimport { useCostCalculatorContext } from '@/src/flows/CostCalculator/context';\nimport { EstimationError } from '@/src/flows/CostCalculator/hooks';\nimport { CostCalculatorEstimationFormValues } from '@/src/flows/CostCalculator/types';\nimport React from 'react';\n\ntype CostCalculatorFormProps = Partial<{\n /**\n * Callback function that handles form submission. When form is submit, the form values are sent to the consumer app before behind submitted to Remote.\n * @param data - The payload sent to the /cost-calculator/estimation endpoint.\n */\n onSubmit: (data: CostCalculatorEstimationFormValues) => Promise<void> | void;\n /**\n * Callback function to handle the success when the estimation succeeds. The CostCalculatorEstimateResponse is sent back to you.\n * @param data - The response data from the /cost-calculator/estimation endpoint.\n */\n onSuccess: (data: CostCalculatorEstimateResponse) => Promise<void> | void;\n /**\n * Callback function to handle the error when the estimation fails.\n * @param error - The error object.\n */\n onError: (error: EstimationError) => void;\n}>;\n\nexport function CostCalculatorForm({\n onSubmit,\n onError,\n onSuccess,\n}: CostCalculatorFormProps) {\n const { form, formId, costCalculatorBag } = useCostCalculatorContext();\n\n const handleSubmit = async (values: CostCalculatorEstimationFormValues) => {\n const costCalculatorResults = await costCalculatorBag?.onSubmit(values);\n\n await onSubmit?.(values);\n\n if (costCalculatorResults?.error) {\n onError?.(costCalculatorResults.error);\n } else {\n if (costCalculatorResults?.data) {\n onSuccess?.(costCalculatorResults?.data);\n }\n }\n };\n\n return (\n <Form {...form}>\n <form\n id={formId}\n onSubmit={form.handleSubmit(handleSubmit)}\n className=\"space-y-4 RemoteFlows__CostCalculatorForm\"\n >\n <JSONSchemaFormFields fields={costCalculatorBag?.fields ?? []} />\n </form>\n </Form>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/flows/CostCalculator/CostCalculatorForm.tsx"],"sourcesContent":["import { CostCalculatorEstimateResponse } from '@/src/client';\nimport { JSONSchemaFormFields } from '@/src/components/form/JSONSchemaForm';\nimport { Form } from '@/src/components/ui/form';\nimport { useCostCalculatorContext } from '@/src/flows/CostCalculator/context';\nimport { EstimationError } from '@/src/flows/CostCalculator/hooks';\nimport { CostCalculatorEstimationFormValues } from '@/src/flows/CostCalculator/types';\nimport React from 'react';\n\ntype CostCalculatorFormProps = Partial<{\n /**\n * Callback function that handles form submission. When form is submit, the form values are sent to the consumer app before behind submitted to Remote.\n * @param data - The payload sent to the /cost-calculator/estimation endpoint.\n */\n onSubmit: (data: CostCalculatorEstimationFormValues) => Promise<void> | void;\n /**\n * Callback function to handle the success when the estimation succeeds. The CostCalculatorEstimateResponse is sent back to you.\n * @param data - The response data from the /cost-calculator/estimation endpoint.\n */\n onSuccess: (data: CostCalculatorEstimateResponse) => Promise<void> | void;\n /**\n * Callback function to handle the error when the estimation fails.\n * @param error - The error object.\n */\n onError: (error: EstimationError) => void;\n}>;\n\nexport function CostCalculatorForm({\n onSubmit,\n onError,\n onSuccess,\n}: CostCalculatorFormProps) {\n const { form, formId, costCalculatorBag } = useCostCalculatorContext();\n\n const handleSubmit = async (values: CostCalculatorEstimationFormValues) => {\n const costCalculatorResults = await costCalculatorBag?.onSubmit(values);\n\n await onSubmit?.(values);\n\n if (costCalculatorResults?.error) {\n onError?.(costCalculatorResults.error);\n } else {\n if (costCalculatorResults?.data) {\n onSuccess?.(costCalculatorResults?.data);\n }\n }\n };\n\n return (\n <Form {...form}>\n <form\n id={formId}\n onSubmit={form.handleSubmit(handleSubmit)}\n className=\"space-y-4 RemoteFlows__CostCalculatorForm\"\n >\n <JSONSchemaFormFields fields={costCalculatorBag?.fields ?? []} />\n </form>\n </Form>\n );\n}\n"],"mappings":"gKAMA,OAAOA,MAAW,QAoBX,SAASC,EAAmB,CACjC,SAAAC,EACA,QAAAC,EACA,UAAAC,CACF,EAA4B,CAC1B,GAAM,CAAE,KAAAC,EAAM,OAAAC,EAAQ,kBAAAC,CAAkB,EAAIC,EAAyB,EAE/DC,EAAeC,EAAA,MAAOC,GAA+C,CACzE,IAAMC,EAAwB,MAAML,GAAmB,SAASI,CAAM,EAEtE,MAAMT,IAAWS,CAAM,EAEnBC,GAAuB,MACzBT,IAAUS,EAAsB,KAAK,EAEjCA,GAAuB,MACzBR,IAAYQ,GAAuB,IAAI,CAG7C,EAZqB,gBAcrB,OACEC,EAAA,cAACC,EAAA,CAAM,GAAGT,GACRQ,EAAA,cAAC,QACC,GAAIP,EACJ,SAAUD,EAAK,aAAaI,CAAY,EACxC,UAAU,6CAEVI,EAAA,cAACE,EAAA,CAAqB,OAAQR,GAAmB,QAAU,CAAC,EAAG,CACjE,CACF,CAEJ,CAhCgBG,EAAAT,EAAA","names":["React","CostCalculatorForm","onSubmit","onError","onSuccess","form","formId","costCalculatorBag","useCostCalculatorContext","handleSubmit","__name","values","costCalculatorResults","React","Form","JSONSchemaFormFields"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as n}from"./chunk-SJ56GVNV.js";import{a}from"./chunk-AYDF3IFZ.js";import{Slot as p}from"@radix-ui/react-slot";import*as t from"react";import{Controller as x,FormProvider as C,useFormContext as P,useFormState as R}from"react-hook-form";import*as d from"react";import*as c from"@radix-ui/react-label";function u({className:e,...o}){return d.createElement(c.Root,{"data-slot":"label",className:n("flex items-center gap-2 text-sm leading-none select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",e),...o})}a(u,"Label");var $=C,F=t.createContext({}),w=a(({...e})=>t.createElement(F.Provider,{value:{name:e.name}},t.createElement(x,{...e})),"FormField"),l=a(()=>{let e=t.useContext(F),o=t.useContext(f),{getFieldState:r}=P(),i=R({name:e.name}),m=r(e.name,i);if(!e)throw new Error("useFormField should be used within <FormField>");let{id:s}=o;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...m}},"useFormField"),f=t.createContext({});function D({className:e,...o}){let r=t.useId();return t.createElement(f.Provider,{value:{id:r}},t.createElement("div",{"data-slot":"form-item",className:n("grid gap-2",e),...o}))}a(D,"FormItem");function M({className:e,...o}){let{error:r,formItemId:i}=l();return t.createElement(u,{"data-slot":"form-label","data-error":!!r,className:n("text-base-color mb-1 data-[error=true]:text-destructive",e),htmlFor:i,...o})}a(M,"FormLabel");var b=t.forwardRef(({...e},o)=>{let{error:r,formItemId:i,formDescriptionId:m,formMessageId:s}=l();return t.createElement(p,{"data-slot":"form-control",ref:o,id:i,"aria-describedby":r?`${m} ${s}`:`${m}`,"aria-invalid":!!r,...e})});b.displayName="FormControl";function E({className:e,...o}){let{formDescriptionId:r}=l();return t.createElement("p",{"data-slot":"form-description",id:r,className:n("text-base-color text-xs",e),...o})}a(E,"FormDescription");function W({className:e,...o}){let{error:r,formMessageId:i}=l(),m=r?String(r?.message??""):o.children;return m?t.createElement("p",{"data-slot":"form-message",id:i,className:n("text-destructive text-sm",e),...o},m):null}a(W,"FormMessage");export{$ as a,w as b,D as c,M as d,b as e,E as f,W as g};
|
|
2
|
+
//# sourceMappingURL=chunk-TIXDBKBM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/form.tsx","../src/components/ui/label.tsx"],"sourcesContent":["import * as LabelPrimitive from '@radix-ui/react-label';\nimport { Slot } from '@radix-ui/react-slot';\nimport * as React from 'react';\nimport {\n Controller,\n ControllerProps,\n FieldPath,\n FieldValues,\n FormProvider,\n useFormContext,\n useFormState,\n} from 'react-hook-form';\n\nimport { Label } from '@/src/components/ui/label';\nimport { cn } from '@/src/lib/utils';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>(\n {} as FormFieldContextValue,\n);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>(\n {} as FormItemContextValue,\n);\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div\n data-slot=\"form-item\"\n className={cn('grid gap-2', className)}\n {...props}\n />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n data-slot=\"form-label\"\n data-error={!!error}\n className={cn(\n 'text-base-color mb-1 data-[error=true]:text-destructive',\n className,\n )}\n htmlFor={formItemId}\n {...props}\n />\n );\n}\n\nconst FormControl = React.forwardRef<\n React.ComponentRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } =\n useFormField();\n\n return (\n <Slot\n data-slot=\"form-control\"\n ref={ref}\n id={formItemId}\n aria-describedby={\n !error\n ? `${formDescriptionId}`\n : `${formDescriptionId} ${formMessageId}`\n }\n aria-invalid={!!error}\n {...props}\n />\n );\n});\n\nFormControl.displayName = 'FormControl';\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n data-slot=\"form-description\"\n id={formDescriptionId}\n className={cn('text-base-color text-xs', className)}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message ?? '') : props.children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n data-slot=\"form-message\"\n id={formMessageId}\n className={cn('text-destructive text-sm', className)}\n {...props}\n >\n {body}\n </p>\n );\n}\n\nexport {\n Form,\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n useFormField,\n};\n","'use client';\n\nimport * as React from 'react';\nimport * as LabelPrimitive from '@radix-ui/react-label';\n\nimport { cn } from '@/src/lib/utils';\n\nfunction Label({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n 'flex items-center gap-2 text-sm leading-none select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Label };\n"],"mappings":"2EACA,OAAS,QAAAA,MAAY,uBACrB,UAAYC,MAAW,QACvB,OACE,cAAAC,EAIA,gBAAAC,EACA,kBAAAC,EACA,gBAAAC,MACK,kBCTP,UAAYC,MAAW,QACvB,UAAYC,MAAoB,wBAIhC,SAASC,EAAM,CACb,UAAAC,EACA,GAAGC,CACL,EAAqD,CACnD,OACE,gBAAgB,OAAf,CACC,YAAU,QACV,UAAWC,EACT,gJACAF,CACF,EACC,GAAGC,EACN,CAEJ,CAdSE,EAAAJ,EAAA,SDST,IAAMK,EAAOC,EASPC,EAAyB,gBAC7B,CAAC,CACH,EAEMC,EAAYC,EAAA,CAGhB,CACA,GAAGC,CACL,IAEI,gBAACH,EAAiB,SAAjB,CAA0B,MAAO,CAAE,KAAMG,EAAM,IAAK,GACnD,gBAACC,EAAA,CAAY,GAAGD,EAAO,CACzB,EATc,aAaZE,EAAeH,EAAA,IAAM,CACzB,IAAMI,EAAqB,aAAWN,CAAgB,EAChDO,EAAoB,aAAWC,CAAe,EAC9C,CAAE,cAAAC,CAAc,EAAIC,EAAe,EACnCC,EAAYC,EAAa,CAAE,KAAMN,EAAa,IAAK,CAAC,EACpDO,EAAaJ,EAAcH,EAAa,KAAMK,CAAS,EAE7D,GAAI,CAACL,EACH,MAAM,IAAI,MAAM,gDAAgD,EAGlE,GAAM,CAAE,GAAAQ,CAAG,EAAIP,EAEf,MAAO,CACL,GAAAO,EACA,KAAMR,EAAa,KACnB,WAAY,GAAGQ,CAAE,aACjB,kBAAmB,GAAGA,CAAE,yBACxB,cAAe,GAAGA,CAAE,qBACpB,GAAGD,CACL,CACF,EArBqB,gBA2BfL,EAAwB,gBAC5B,CAAC,CACH,EAEA,SAASO,EAAS,CAAE,UAAAC,EAAW,GAAGb,CAAM,EAAgC,CACtE,IA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M,SAE1D,OAAK0B,EAKH,gBAAC,KACC,YAAU,eACV,GAAIJ,EACJ,UAAWR,EAAG,2BAA4BD,CAAS,EAClD,GAAGb,GAEH0B,CACH,EAXO,IAaX,CAlBS3B,EAAA0B,EAAA","names":["Slot","React","Controller","FormProvider","useFormContext","useFormState","React","LabelPrimitive","Label","className","props","cn","__name","Form","FormProvider","FormFieldContext","FormField","__name","props","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","useFormContext","formState","useFormState","fieldState","id","FormItem","className","cn","FormLabel","error","formItemId","Label","FormControl","ref","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","body"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as e}from"./chunk-6DMCAUPE.js";import{a as r}from"./chunk-AYDF3IFZ.js";var m={form:{index:0,name:"form"},confirmation_form:{index:1,name:"confirmation_form"}};function _(t,o){if(!t)return{};if(!o)return{...t.data.employment?.contract_details,effective_date:"",reason_for_change:"",job_title:t.data.employment?.job_title,additional_comments:"",annual_gross_salary:e(t.data.employment?.contract_details?.annual_gross_salary)};let s=o.map(n=>n.name),i=Object.keys(t?.data?.employment?.contract_details||{});return{...s.reduce((n,a)=>{if(i.includes(a)){let c=t?.data?.employment?.contract_details;n[a]=c[a]}return n},{}),effective_date:"",reason_for_change:"",job_title:t.data.employment?.job_title,additional_comments:"",annual_gross_salary:e(t.data.employment?.contract_details?.annual_gross_salary),additional_comments_toggle:!1}}r(_,"buildInitialValues");export{m as a,_ as b};
|
|
2
|
+
//# sourceMappingURL=chunk-TPKAREI4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/ContractAmendment/utils.ts"],"sourcesContent":["import { EmploymentShowResponse } from '@/src/client';\nimport { convertFromCents } from '@/src/components/form/utils';\nimport { Fields } from '@remoteoss/json-schema-form';\nimport { Step } from '../useStepState';\n\ntype StepKeys = 'form' | 'confirmation_form';\n\nexport const STEPS: Record<StepKeys, Step> = {\n form: { index: 0, name: 'form' },\n confirmation_form: { index: 1, name: 'confirmation_form' },\n} as const;\n\nexport function buildInitialValues(\n employment: EmploymentShowResponse | undefined,\n fields?: Fields | undefined,\n) {\n if (!employment) {\n return {};\n }\n\n if (!fields) {\n return {\n ...employment.data.employment?.contract_details,\n effective_date: '',\n reason_for_change: '',\n job_title: employment.data.employment?.job_title,\n additional_comments: '',\n annual_gross_salary: convertFromCents(\n employment.data.employment?.contract_details\n ?.annual_gross_salary as string,\n ),\n };\n }\n\n const allFields = fields.map((field) => field.name);\n const employmentFields = Object.keys(\n employment?.data?.employment?.contract_details || {},\n );\n const initialValues = allFields.reduce<Record<string, unknown>>(\n (initialValuesAcc, field) => {\n // @ts-expect-error error\n if (employmentFields.includes(field)) {\n const contractDetails = employment?.data?.employment\n ?.contract_details as Record<string, unknown>;\n // @ts-expect-error error\n initialValuesAcc[field] = contractDetails[field];\n }\n return initialValuesAcc;\n },\n {} as Record<string, unknown>,\n );\n\n return {\n ...initialValues,\n effective_date: '',\n reason_for_change: '',\n job_title: employment.data.employment?.job_title,\n additional_comments: '',\n annual_gross_salary: convertFromCents(\n employment.data.employment?.contract_details\n ?.annual_gross_salary as string,\n ),\n additional_comments_toggle: false,\n };\n}\n"],"mappings":"gFAOO,IAAMA,EAAgC,CAC3C,KAAM,CAAE,MAAO,EAAG,KAAM,MAAO,EAC/B,kBAAmB,CAAE,MAAO,EAAG,KAAM,mBAAoB,CAC3D,EAEO,SAASC,EACdC,EACAC,EACA,CACA,GAAI,CAACD,EACH,MAAO,CAAC,EAGV,GAAI,CAACC,EACH,MAAO,CACL,GAAGD,EAAW,KAAK,YAAY,iBAC/B,eAAgB,GAChB,kBAAmB,GACnB,UAAWA,EAAW,KAAK,YAAY,UACvC,oBAAqB,GACrB,oBAAqBE,EACnBF,EAAW,KAAK,YAAY,kBACxB,mBACN,CACF,EAGF,IAAMG,EAAYF,EAAO,IAAKG,GAAUA,EAAM,IAAI,EAC5CC,EAAmB,OAAO,KAC9BL,GAAY,MAAM,YAAY,kBAAoB,CAAC,CACrD,EAeA,MAAO,CACL,GAfoBG,EAAU,OAC9B,CAACG,EAAkBF,IAAU,CAE3B,GAAIC,EAAiB,SAASD,CAAK,EAAG,CACpC,IAAMG,EAAkBP,GAAY,MAAM,YACtC,iBAEJM,EAAiBF,CAAK,EAAIG,EAAgBH,CAAK,CACjD,CACA,OAAOE,CACT,EACA,CAAC,CACH,EAIE,eAAgB,GAChB,kBAAmB,GACnB,UAAWN,EAAW,KAAK,YAAY,UACvC,oBAAqB,GACrB,oBAAqBE,EACnBF,EAAW,KAAK,YAAY,kBACxB,mBACN,EACA,2BAA4B,EAC9B,CACF,CApDgBQ,EAAAT,EAAA","names":["STEPS","buildInitialValues","employment","fields","convertFromCents","allFields","field","employmentFields","initialValuesAcc","contractDetails","__name"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as x}from"./chunk-UPRUP24B.js";import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as x}from"./chunk-UPRUP24B.js";import{d as j,e as M,g as w,i as B,k as O}from"./chunk-G2GI6FEO.js";import{a as y,c as A}from"./chunk-6DMCAUPE.js";import{a as V}from"./chunk-A4RX3KRZ.js";import{d as f}from"./chunk-WRDKLT4N.js";import{a as r}from"./chunk-AYDF3IFZ.js";import{object as se}from"yup";import{createHeadlessForm as k,modify as I}from"@remoteoss/json-schema-form";import{useMutation as K,useQuery as p}from"@tanstack/react-query";import{useState as q}from"react";import{string as L,ValidationError as J}from"yup";var oe=r(({includePremiumBenefits:e})=>{let{client:o}=f();return p({queryKey:["cost-calculator-countries",e],queryFn:r(()=>w({client:o,headers:{Authorization:""},query:{include_premium_benefits:e}}),"queryFn"),select:r(n=>n.data?.data.map(a=>({value:a.region_slug,label:a.name,childRegions:a.child_regions,hasAdditionalFields:a.has_additional_fields,regionSlug:a.region_slug})),"select")})},"useCostCalculatorCountries"),ie=r(()=>{let{client:e}=f();return p({queryKey:["company-currencies"],queryFn:r(()=>O({client:e,headers:{Authorization:""}}),"queryFn"),select:r(o=>o.data?.data?.company_currencies.map(n=>({value:n.slug,label:n.code})),"select")})},"useCompanyCurrencies"),ne=r(()=>{let{client:e}=f();return K({mutationFn:r(o=>j({client:e,headers:{Authorization:""},body:o}),"mutationFn")})},"useCostCalculatorEstimation"),Fe=r(()=>{let{client:e}=f();return K({mutationFn:r(o=>M({client:e,headers:{Authorization:""},body:o}),"mutationFn")})},"useCostCalculatorEstimationPdf"),ae=r((e,{includePremiumBenefits:o,options:n})=>{let{client:a}=f();return p({queryKey:["cost-calculator-region-fields",e,o],queryFn:r(()=>B({client:a,headers:{Authorization:""},path:{slug:e},query:{include_premium_benefits:o}}),"queryFn"),enabled:!!e,select:r(({data:s})=>{let u=s?.data?.schema||{};if(n&&n.jsfModify){let{schema:c}=I(u,n.jsfModify);u=c}return k(u)},"select")})},"useRegionFields"),E={title:"Estimation",includeBenefits:!1,includeCostBreakdowns:!1,includePremiumBenefits:!1},Pe=r(({defaultRegion:e,estimationOptions:o,options:n}={estimationOptions:E})=>{let{schema:a}=I(x.data.schema,n?.jsfModify||{}),s=k(a),[u,c]=q(e),[h,b]=q(),{data:g,isLoading:G}=oe({includePremiumBenefits:o.includePremiumBenefits}),{data:_,isLoading:U}=ie(),$=u||h?.value,{data:S,isLoading:H}=ae($,{includePremiumBenefits:o.includePremiumBenefits,options:n}),F=ne();async function N(i){try{await C.validate(i,{abortEarly:!1})}catch(t){return{data:null,error:t}}return new Promise((t,d)=>{F.mutate(T(i,o),{onSuccess:r(l=>{l.data?t({data:l.data,error:null}):t({data:null,error:new Error("Something went wrong. Please try again later.")})},"onSuccess"),onError:r(l=>{d({data:null,error:l})},"onError")})})}r(N,"onSubmit");function Q(i){let t=g?.find(({value:d})=>d===i);t&&t.childRegions.length===0&&t.hasAdditionalFields?c(t.regionSlug):c(void 0),b(t)}r(Q,"onCountryChange");function D(i){c(i)}r(D,"onRegionChange");let m=s.fields.find(i=>i.name==="region");if(m){let i=h?.childRegions.map(t=>({value:t.slug,label:t.name}))??[];m.options=i,m.isVisible=i.length>0,m.required=i.length>0,m.onChange=D,m.schema=i.length>0?L().transform(t=>typeof t=="string"?t:"").required("Region is required"):L()}if(_){let i=s.fields.find(t=>t.name==="currency");i&&(i.options=_)}if(g){let i=s.fields.find(t=>t.name==="country");i&&(i.options=g,i.onChange=Q)}let W=r(()=>{b(void 0),c(e)},"resetForm"),P=[...s.fields,...S?.fields||[]],C=z(s.fields);async function X(i){let t=null,d=A(i,P);try{await C.validate(d,{abortEarly:!1}),t={formErrors:{},yupError:new J([],i)}}catch(R){let v=V(R);t={formErrors:Object.entries(v).reduce((ee,[te,re])=>({...ee,[te]:re.message}),{}),yupError:R}}let l=S?.handleValidation(d),Y=[...t?.yupError.inner||[],...l?.yupError?.inner||[]],Z={...t?.yupError?.value||{},...l?.yupError?.value||{}};return{formErrors:{...t?.formErrors||{},...l?.formErrors||{}},yupError:new J(Y,Z)}}return r(X,"handleValidation"),{stepState:{current:0,total:1,isLastStep:!0},fields:P,validationSchema:C,handleValidation:X,isSubmitting:F.isPending,isLoading:G&&U&&H,onSubmit:N,resetForm:W}},"useCostCalculator");function z(e){let o=e.reduce((n,a)=>(n[a.name]=a.schema,n),{});return se(o)}r(z,"buildValidationSchema");function le(e){let o="benefit-";return Object.keys(e).reduce((n,a)=>{let u={benefit_group_slug:a.replace(o,""),benefit_tier_slug:e[a]};return[...n,u]},[])}r(le,"formatBenefits");function T(e,o=E){return{employer_currency_slug:e.currency,include_benefits:o.includeBenefits,include_cost_breakdowns:o.includeCostBreakdowns,include_premium_benefits:o.includePremiumBenefits,employments:[{region_slug:e.region||e.country,annual_gross_salary:y(e.salary),annual_gross_salary_in_employer_currency:y(e.salary),employment_term:e.contract_duration_type??"fixed",title:o.title,regional_to_employer_exchange_rate:"1",age:e.age??void 0,...e.benefits&&{benefits:le(e.benefits)}}]}}r(T,"buildPayload");export{z as a,T as b,Fe as c,E as d,Pe as e};
|
|
2
|
+
//# sourceMappingURL=chunk-WTGUGPHV.js.map
|