@remoteoss/remote-flows 0.2.2 → 0.4.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{chunk-EQBNHLR4.js → chunk-2KK5HDYP.js} +2 -2
- package/dist/chunk-2PXGLWCY.js +2 -0
- package/dist/chunk-2PXGLWCY.js.map +1 -0
- package/dist/{chunk-NBD4VOG3.js → chunk-344TN4EG.js} +2 -2
- package/dist/{chunk-AD7ZWPEI.js → chunk-3FVI5JIC.js} +2 -2
- package/dist/chunk-4HAR3Z2C.js +2 -0
- package/dist/chunk-4HAR3Z2C.js.map +1 -0
- package/dist/{chunk-FI76EKUS.js → chunk-56BNVYTD.js} +2 -2
- package/dist/chunk-5ETXP2QF.js +2 -0
- package/dist/chunk-5ETXP2QF.js.map +1 -0
- package/dist/{chunk-YVC4OEFJ.js → chunk-6A3F6JG6.js} +2 -2
- package/dist/chunk-6CT35VQR.js +2 -0
- package/dist/chunk-6CT35VQR.js.map +1 -0
- package/dist/{chunk-OCNLZSS7.js → chunk-7CYG2RHP.js} +2 -2
- package/dist/chunk-BKBIALOU.js +2 -0
- package/dist/chunk-BKBIALOU.js.map +1 -0
- package/dist/chunk-BKROCZRD.js +2 -0
- package/dist/chunk-BKROCZRD.js.map +1 -0
- package/dist/chunk-BL2HRBUQ.js +2 -0
- package/dist/chunk-BL2HRBUQ.js.map +1 -0
- package/dist/{chunk-RCX4JUI3.js → chunk-D3XENMEM.js} +2 -2
- package/dist/{chunk-IJWDAD54.js → chunk-DGPRFQYK.js} +2 -2
- package/dist/chunk-DPKJX4NS.js +2 -0
- package/dist/chunk-DPKJX4NS.js.map +1 -0
- package/dist/{chunk-NZFES56Y.js → chunk-EAAIAMTY.js} +2 -2
- package/dist/{chunk-37DREOGC.js → chunk-FMT2OTOL.js} +2 -2
- package/dist/chunk-FNMWKUNJ.js +2 -0
- package/dist/chunk-FNMWKUNJ.js.map +1 -0
- package/dist/chunk-GFBF55NR.js +2 -0
- package/dist/chunk-GFBF55NR.js.map +1 -0
- package/dist/{chunk-XEQTLVMV.js → chunk-GMGKIQLI.js} +2 -2
- package/dist/chunk-GPICG72A.js +2 -0
- package/dist/chunk-GPICG72A.js.map +1 -0
- package/dist/chunk-GULCZWSK.js +1 -0
- package/dist/chunk-GYSK6CY5.js +2 -0
- package/dist/chunk-GYSK6CY5.js.map +1 -0
- package/dist/{chunk-SEUQNAF6.js → chunk-HSW5HMHH.js} +2 -2
- package/dist/{chunk-N5AQSLAU.js → chunk-IDSJI7KQ.js} +2 -2
- package/dist/{chunk-4F7PYKUZ.js → chunk-J55S4SEH.js} +2 -2
- package/dist/chunk-J6LUE5K7.js +2 -0
- package/dist/chunk-J6LUE5K7.js.map +1 -0
- package/dist/chunk-JIBRNWD2.js +2 -0
- package/dist/chunk-JIBRNWD2.js.map +1 -0
- package/dist/chunk-JWIYUQ5X.js +2 -0
- package/dist/chunk-JWIYUQ5X.js.map +1 -0
- package/dist/{chunk-J2RINDSC.js → chunk-KH6QS5OU.js} +2 -2
- package/dist/{chunk-CKGTR44U.js → chunk-KSGPQCSG.js} +2 -2
- package/dist/chunk-M22FKNEY.js +1 -0
- package/dist/chunk-M22FKNEY.js.map +1 -0
- package/dist/chunk-M5VZBMLC.js +2 -0
- package/dist/chunk-M5VZBMLC.js.map +1 -0
- package/dist/chunk-M7WCW7WD.js +2 -0
- package/dist/chunk-M7WCW7WD.js.map +1 -0
- package/dist/{chunk-FCRDQVTB.js → chunk-MESREYTZ.js} +2 -2
- package/dist/chunk-MHKNAQLP.js +2 -0
- package/dist/chunk-MHKNAQLP.js.map +1 -0
- package/dist/{chunk-JLUDKN4H.js → chunk-NFEY2YL6.js} +2 -2
- package/dist/{chunk-XULIEA44.js → chunk-QEMICBEY.js} +2 -2
- package/dist/chunk-RIAYBN32.js +2 -0
- package/dist/chunk-RIAYBN32.js.map +1 -0
- package/dist/chunk-RLS4PMWA.js +2 -0
- package/dist/chunk-RLS4PMWA.js.map +1 -0
- package/dist/chunk-RRFSGYAC.js +2 -0
- package/dist/chunk-RRFSGYAC.js.map +1 -0
- package/dist/chunk-S4FKLPBB.js +2 -0
- package/dist/chunk-S4FKLPBB.js.map +1 -0
- package/dist/chunk-SSIHUUZY.js +2 -0
- package/dist/chunk-SSIHUUZY.js.map +1 -0
- package/dist/{chunk-DOA6BAUQ.js → chunk-WQHKB5T7.js} +2 -2
- package/dist/chunk-WS3C3WIJ.js +2 -0
- package/dist/chunk-WS3C3WIJ.js.map +1 -0
- package/dist/{chunk-CTG3DYJR.js → chunk-WWANHPT7.js} +2 -2
- package/dist/{chunk-CTG3DYJR.js.map → chunk-WWANHPT7.js.map} +1 -1
- package/dist/chunk-XJMVWJZ4.js +2 -0
- package/dist/chunk-XJMVWJZ4.js.map +1 -0
- package/dist/{chunk-5DQBY2TR.js → chunk-XLFHHYVS.js} +2 -2
- package/dist/chunk-XQ6WWP6K.js +2 -0
- package/dist/chunk-XQ6WWP6K.js.map +1 -0
- package/dist/chunk-XSHHMBMT.js +2 -0
- package/dist/chunk-XSHHMBMT.js.map +1 -0
- package/dist/chunk-XVOJ4RMC.js +2 -0
- package/dist/chunk-XVOJ4RMC.js.map +1 -0
- package/dist/chunk-YDUUQU4R.js +2 -0
- package/dist/chunk-YDUUQU4R.js.map +1 -0
- package/dist/chunk-YH5F6MGK.js +2 -0
- package/dist/chunk-YH5F6MGK.js.map +1 -0
- package/dist/{chunk-KPSFJ6BN.js → chunk-YOC3VDC7.js} +2 -2
- package/dist/flows/ContractAmendment/ContractAmendmentBack.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +6 -4
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentSubmit.js +1 -1
- package/dist/flows/ContractAmendment/context.d.ts +3 -1
- package/dist/flows/ContractAmendment/hooks.d.ts +3 -1
- package/dist/flows/ContractAmendment/hooks.js +1 -1
- package/dist/flows/ContractAmendment/index.d.ts +5 -3
- package/dist/flows/ContractAmendment/index.js +1 -1
- package/dist/flows/ContractAmendment/types.d.ts +6 -5
- package/dist/flows/ContractAmendment/utils.d.ts +1 -1
- package/dist/flows/ContractAmendment/utils.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorDisclaimer.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +1 -1
- 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.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorSubmitButton.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorBenefitsBreakdown.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorContributionsBreakdown.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorGrossSalary.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/Results/CostCalculatorResultsChart.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorTotalCost.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/Onboarding/BasicInformationStep.d.ts +15 -0
- package/dist/flows/Onboarding/BasicInformationStep.js +2 -0
- package/dist/flows/Onboarding/BasicInformationStep.js.map +1 -0
- package/dist/flows/Onboarding/BenefitsStep.d.ts +34 -0
- package/dist/flows/Onboarding/BenefitsStep.js +2 -0
- package/dist/flows/Onboarding/BenefitsStep.js.map +1 -0
- package/dist/flows/Onboarding/ContractDetailsStep.d.ts +12 -0
- package/dist/flows/Onboarding/ContractDetailsStep.js +2 -0
- package/dist/flows/Onboarding/ContractDetailsStep.js.map +1 -0
- package/dist/flows/Onboarding/OnboardingBack.d.ts +5 -0
- package/dist/flows/Onboarding/OnboardingBack.js +2 -0
- package/dist/flows/Onboarding/OnboardingBack.js.map +1 -0
- package/dist/flows/Onboarding/OnboardingFlow.d.ts +52 -0
- package/dist/flows/Onboarding/OnboardingFlow.js +2 -0
- package/dist/flows/Onboarding/OnboardingFlow.js.map +1 -0
- package/dist/flows/Onboarding/OnboardingForm.d.ts +19 -0
- package/dist/flows/Onboarding/OnboardingForm.js +2 -0
- package/dist/flows/Onboarding/OnboardingForm.js.map +1 -0
- package/dist/flows/Onboarding/OnboardingInvite.d.ts +11 -0
- package/dist/flows/Onboarding/OnboardingInvite.js +2 -0
- package/dist/flows/Onboarding/OnboardingInvite.js.map +1 -0
- package/dist/flows/Onboarding/OnboardingSubmit.d.ts +5 -0
- package/dist/flows/Onboarding/OnboardingSubmit.js +2 -0
- package/dist/flows/Onboarding/OnboardingSubmit.js.map +1 -0
- package/dist/flows/Onboarding/context.d.ts +81 -0
- package/dist/flows/Onboarding/context.js +2 -0
- package/dist/flows/Onboarding/context.js.map +1 -0
- package/dist/flows/Onboarding/hooks.d.ts +136 -0
- package/dist/flows/Onboarding/hooks.js +2 -0
- package/dist/flows/Onboarding/hooks.js.map +1 -0
- package/dist/flows/Onboarding/index.d.ts +20 -0
- package/dist/flows/Onboarding/index.js +2 -0
- package/dist/flows/Onboarding/index.js.map +1 -0
- package/dist/flows/Onboarding/types.d.ts +31 -0
- package/dist/flows/Onboarding/types.js +1 -0
- package/dist/flows/Onboarding/types.js.map +1 -0
- package/dist/flows/Onboarding/utils.d.ts +8 -0
- package/dist/flows/Onboarding/utils.js +2 -0
- package/dist/flows/Onboarding/utils.js.map +1 -0
- package/dist/flows/Termination/AdditionalDetailsForm.d.ts +13 -0
- package/dist/flows/Termination/AdditionalDetailsForm.js +2 -0
- package/dist/flows/Termination/AdditionalDetailsForm.js.map +1 -0
- package/dist/flows/Termination/EmployeeComunicationForm.d.ts +10 -0
- package/dist/flows/Termination/EmployeeComunicationForm.js +2 -0
- package/dist/flows/Termination/EmployeeComunicationForm.js.map +1 -0
- package/dist/flows/Termination/PaidTimeOffForm.d.ts +10 -0
- package/dist/flows/Termination/PaidTimeOffForm.js +2 -0
- package/dist/flows/Termination/PaidTimeOffForm.js.map +1 -0
- package/dist/flows/Termination/TerminationBack.js +1 -1
- package/dist/flows/Termination/TerminationDetailsForm.d.ts +10 -0
- package/dist/flows/Termination/TerminationDetailsForm.js +2 -0
- package/dist/flows/Termination/TerminationDetailsForm.js.map +1 -0
- package/dist/flows/Termination/TerminationFlow.d.ts +19 -10
- package/dist/flows/Termination/TerminationFlow.js +1 -1
- package/dist/flows/Termination/TerminationForm.d.ts +5 -6
- package/dist/flows/Termination/TerminationForm.js +1 -1
- package/dist/flows/Termination/TerminationSubmit.js +1 -1
- package/dist/flows/Termination/TimeOff.d.ts +1 -1
- package/dist/flows/Termination/TimeOff.js +1 -1
- package/dist/flows/Termination/context.d.ts +3 -1
- package/dist/flows/Termination/hooks.d.ts +12 -1
- package/dist/flows/Termination/hooks.js +1 -1
- package/dist/flows/Termination/index.d.ts +8 -5
- package/dist/flows/Termination/index.js +1 -1
- package/dist/flows/Termination/json-schemas/additionalInformation.js +1 -1
- package/dist/flows/Termination/json-schemas/jsonSchema.js +1 -1
- package/dist/flows/Termination/json-schemas/schema.js +1 -1
- package/dist/flows/Termination/types.d.ts +1 -1
- package/dist/flows/types.d.ts +16 -1
- package/dist/flows/utils.d.ts +3 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +23 -121
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/remoteFlows-CswYencu.d.ts +116 -0
- package/dist/types.gen-HC04kr7n.d.ts +947 -0
- package/package.json +3 -2
- package/dist/chunk-2EKC7DK3.js +0 -2
- package/dist/chunk-2EKC7DK3.js.map +0 -1
- package/dist/chunk-55VACCVZ.js +0 -2
- package/dist/chunk-55VACCVZ.js.map +0 -1
- package/dist/chunk-6LTJBLSD.js +0 -2
- package/dist/chunk-6LTJBLSD.js.map +0 -1
- package/dist/chunk-AYFHWLQZ.js +0 -2
- package/dist/chunk-AYFHWLQZ.js.map +0 -1
- package/dist/chunk-F5QJZKDL.js +0 -2
- package/dist/chunk-F5QJZKDL.js.map +0 -1
- package/dist/chunk-FZ7FWFJX.js +0 -1
- package/dist/chunk-GW7GG5ZW.js +0 -2
- package/dist/chunk-GW7GG5ZW.js.map +0 -1
- package/dist/chunk-IJPE22L7.js +0 -2
- package/dist/chunk-IJPE22L7.js.map +0 -1
- package/dist/chunk-IPJORKYJ.js +0 -2
- package/dist/chunk-IPJORKYJ.js.map +0 -1
- package/dist/chunk-IPZEZMLD.js +0 -2
- package/dist/chunk-IPZEZMLD.js.map +0 -1
- package/dist/chunk-SJ56GVNV.js +0 -2
- package/dist/chunk-SJ56GVNV.js.map +0 -1
- package/dist/chunk-TOSGDMB4.js +0 -2
- package/dist/chunk-TOSGDMB4.js.map +0 -1
- package/dist/chunk-VHL76MEG.js +0 -2
- package/dist/chunk-VHL76MEG.js.map +0 -1
- package/dist/chunk-YAHWFLDH.js +0 -2
- package/dist/chunk-YAHWFLDH.js.map +0 -1
- package/dist/chunk-YBACB5A6.js +0 -2
- package/dist/chunk-YBACB5A6.js.map +0 -1
- package/dist/types.gen-BgLeTAqP.d.ts +0 -10618
- /package/dist/{chunk-EQBNHLR4.js.map → chunk-2KK5HDYP.js.map} +0 -0
- /package/dist/{chunk-NBD4VOG3.js.map → chunk-344TN4EG.js.map} +0 -0
- /package/dist/{chunk-AD7ZWPEI.js.map → chunk-3FVI5JIC.js.map} +0 -0
- /package/dist/{chunk-FI76EKUS.js.map → chunk-56BNVYTD.js.map} +0 -0
- /package/dist/{chunk-YVC4OEFJ.js.map → chunk-6A3F6JG6.js.map} +0 -0
- /package/dist/{chunk-OCNLZSS7.js.map → chunk-7CYG2RHP.js.map} +0 -0
- /package/dist/{chunk-RCX4JUI3.js.map → chunk-D3XENMEM.js.map} +0 -0
- /package/dist/{chunk-IJWDAD54.js.map → chunk-DGPRFQYK.js.map} +0 -0
- /package/dist/{chunk-NZFES56Y.js.map → chunk-EAAIAMTY.js.map} +0 -0
- /package/dist/{chunk-37DREOGC.js.map → chunk-FMT2OTOL.js.map} +0 -0
- /package/dist/{chunk-XEQTLVMV.js.map → chunk-GMGKIQLI.js.map} +0 -0
- /package/dist/{chunk-FZ7FWFJX.js.map → chunk-GULCZWSK.js.map} +0 -0
- /package/dist/{chunk-SEUQNAF6.js.map → chunk-HSW5HMHH.js.map} +0 -0
- /package/dist/{chunk-N5AQSLAU.js.map → chunk-IDSJI7KQ.js.map} +0 -0
- /package/dist/{chunk-4F7PYKUZ.js.map → chunk-J55S4SEH.js.map} +0 -0
- /package/dist/{chunk-J2RINDSC.js.map → chunk-KH6QS5OU.js.map} +0 -0
- /package/dist/{chunk-CKGTR44U.js.map → chunk-KSGPQCSG.js.map} +0 -0
- /package/dist/{chunk-FCRDQVTB.js.map → chunk-MESREYTZ.js.map} +0 -0
- /package/dist/{chunk-JLUDKN4H.js.map → chunk-NFEY2YL6.js.map} +0 -0
- /package/dist/{chunk-XULIEA44.js.map → chunk-QEMICBEY.js.map} +0 -0
- /package/dist/{chunk-DOA6BAUQ.js.map → chunk-WQHKB5T7.js.map} +0 -0
- /package/dist/{chunk-5DQBY2TR.js.map → chunk-XLFHHYVS.js.map} +0 -0
- /package/dist/{chunk-KPSFJ6BN.js.map → chunk-YOC3VDC7.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/ContractAmendment/ContractAmendmentForm.tsx"],"sourcesContent":["import {\n ContractAmendmentAutomatableResponse,\n PostAutomatableContractAmendmentError,\n} from '@/src/client';\nimport { JSONSchemaFormFields } from '@/src/components/form/JSONSchemaForm';\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { useJsonSchemasValidationFormResolver } from '@/src/components/form/yupValidationResolver';\nimport { Form } from '@/src/components/ui/form';\nimport React, { useEffect } from 'react';\nimport { FieldValues, useForm } from 'react-hook-form';\nimport { useContractAmendmentContext } from './context';\n\ntype ContractAmendmentFormProps = {\n /**\n * Callback function to be called when the contract amendment form is submitted.\n * This function is called before the contract amendment is submitted.\n * It can be used to perform any additional validation or processing before\n * the contract amendment is submitted.\n * @param values\n * @returns\n */\n onSubmit?: (values: FieldValues) => Promise<void>;\n /**\n * Callback function to be called when the contract amendment fails.\n * @param error\n * @returns\n */\n onError?: (\n error:\n | PostAutomatableContractAmendmentError\n | { message: 'no_changes_detected_contract_details' },\n ) => void;\n /**\n * Callback function to be called when the contract amendment is successfully submitted.\n * This function is called after the contract amendment is submitted.\n * @param data\n * @returns\n */\n onSuccess?: (data: ContractAmendmentAutomatableResponse) => void;\n};\n\nconst commonFields = [\n 'effective_date',\n 'reason_for_change',\n 'reason_for_change_description',\n 'additional_comments',\n 'additional_comments_toggle',\n] as const;\n\ntype CommonFields = (typeof commonFields)[number];\n\nexport function ContractAmendmentForm({\n onSubmit,\n onError,\n onSuccess,\n}: ContractAmendmentFormProps) {\n const {\n formId,\n contractAmendment: {\n checkFieldUpdates,\n fields,\n onSubmit: submitContractAmendment,\n stepState,\n initialValues,\n handleValidation,\n },\n } = useContractAmendmentContext();\n\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n handleValidation,\n );\n\n const form = useForm({\n resolver,\n defaultValues:\n // stepState.values is used as defaultValues for the form when the form is\n // rendered when clicking on the back button after the user has submitted the form\n // and the confirmation form is displayed.\n // This is because the form is unmounted when the user submits the form.\n stepState.values?.form || initialValues,\n shouldUnregister: true,\n mode: 'onBlur',\n });\n\n useEffect(() => {\n const subscription = form?.watch((values) => {\n const isFormDirty =\n Object.keys(form.formState.dirtyFields).length > 0 ||\n form.formState.isDirty;\n if (isFormDirty) {\n checkFieldUpdates(values);\n }\n });\n return () => subscription?.unsubscribe();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleSubmit = async (values: FieldValues) => {\n let hasContractDetailsChanges = false;\n for (const [key, value] of Object.entries(values)) {\n if (\n !commonFields.includes(key as CommonFields) &&\n // @ts-expect-error error\n initialValues[key] !== value\n ) {\n hasContractDetailsChanges = true;\n break;\n }\n }\n\n if (!hasContractDetailsChanges) {\n return onError?.({\n message: 'no_changes_detected_contract_details',\n });\n }\n\n const parsedValues = parseJSFToValidate(values, fields, {\n isPartialValidation: false,\n });\n\n await onSubmit?.(parsedValues);\n\n const contractAmendmentResult = await submitContractAmendment(values);\n\n if (contractAmendmentResult.error) {\n onError?.(contractAmendmentResult.error);\n } else {\n onSuccess?.(\n contractAmendmentResult.data as ContractAmendmentAutomatableResponse,\n );\n }\n };\n\n return (\n <Form {...form}>\n <form\n id={formId}\n data-testid=\"contract-amendment-form\"\n onSubmit={form.handleSubmit(handleSubmit)}\n className=\"space-y-4 RemoteFlows__ContractAmendmentForm\"\n >\n <JSONSchemaFormFields fields={fields} />\n </form>\n </Form>\n );\n}\n"],"mappings":"gPAQA,OAAOA,GAAS,aAAAC,MAAiB,QACjC,OAAsB,WAAAC,MAAe,kBAgCrC,IAAMC,EAAe,CACnB,iBACA,oBACA,gCACA,sBACA,4BACF,EAIO,SAASC,EAAsB,CACpC,SAAAC,EACA,QAAAC,EACA,UAAAC,CACF,EAA+B,CAC7B,GAAM,CACJ,OAAAC,EACA,kBAAmB,CACjB,kBAAAC,EACA,OAAAC,EACA,SAAUC,EACV,UAAAC,EACA,cAAAC,EACA,iBAAAC,CACF,CACF,EAAIC,EAA4B,EAE1BC,EAAWC,EAEfH,CACF,EAEMI,EAAOC,EAAQ,CACnB,SAAAH,EACA,cAKEJ,EAAU,QAAQ,MAAQC,EAC5B,iBAAkB,GAClB,KAAM,QACR,CAAC,EAEDO,EAAU,IAAM,CACd,IAAMC,EAAeH,GAAM,MAAOI,GAAW,EAEzC,OAAO,KAAKJ,EAAK,UAAU,WAAW,EAAE,OAAS,GACjDA,EAAK,UAAU,UAEfT,EAAkBa,CAAM,CAE5B,CAAC,EACD,MAAO,IAAMD,GAAc,YAAY,CAEzC,EAAG,CAAC,CAAC,EAEL,IAAME,EAAeC,EAAA,MAAOF,GAAwB,CAClD,IAAIG,EAA4B,GAChC,OAAW,CAACC,EAAKC,CAAK,IAAK,OAAO,QAAQL,CAAM,EAC9C,GACE,CAACnB,EAAa,SAASuB,CAAmB,GAE1Cb,EAAca,CAAG,IAAMC,EACvB,CACAF,EAA4B,GAC5B,KACF,CAGF,GAAI,CAACA,EACH,OAAOnB,IAAU,CACf,QAAS,sCACX,CAAC,EAGH,IAAMsB,EAAeC,EAAmBP,EAAQZ,EAAQ,CACtD,oBAAqB,EACvB,CAAC,EAED,MAAML,IAAWuB,CAAY,EAE7B,IAAME,EAA0B,MAAMnB,EAAwBW,CAAM,EAEhEQ,EAAwB,MAC1BxB,IAAUwB,EAAwB,KAAK,EAEvCvB,IACEuB,EAAwB,IAC1B,CAEJ,EAlCqB,gBAoCrB,OACEC,EAAA,cAACC,EAAA,CAAM,GAAGd,GACRa,EAAA,cAAC,QACC,GAAIvB,EACJ,cAAY,0BACZ,SAAUU,EAAK,aAAaK,CAAY,EACxC,UAAU,gDAEVQ,EAAA,cAACE,EAAA,CAAqB,OAAQvB,EAAQ,CACxC,CACF,CAEJ,CA/FgBc,EAAApB,EAAA","names":["React","useEffect","useForm","commonFields","ContractAmendmentForm","onSubmit","onError","onSuccess","formId","checkFieldUpdates","fields","submitContractAmendment","stepState","initialValues","handleValidation","useContractAmendmentContext","resolver","useJsonSchemasValidationFormResolver","form","useForm","useEffect","subscription","values","handleSubmit","__name","hasContractDetailsChanges","key","value","parsedValues","parseJSFToValidate","contractAmendmentResult","React","Form","JSONSchemaFormFields"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p}from"./chunk-DPKJX4NS.js";import{a as i}from"./chunk-MHKNAQLP.js";import{b as t}from"./chunk-BL2HRBUQ.js";import{a as e}from"./chunk-6CT35VQR.js";import{a as d}from"./chunk-RIAYBN32.js";import{a as m}from"./chunk-BKBIALOU.js";import{a}from"./chunk-M7WCW7WD.js";import{a as r}from"./chunk-WS3C3WIJ.js";import{a as n}from"./chunk-AYDF3IFZ.js";import O,{useId as S}from"react";var R=n(({employmentId:f,countryCode:s,type:b="employee",render:g,options:c})=>{let B=S(),o=t({employmentId:f,countryCode:s,type:b,options:c});return O.createElement(r.Provider,{value:{formId:B,onboardingBag:o}},g({onboardingBag:o,components:{BasicInformationStep:e,ContractDetailsStep:m,BenefitsStep:d,SubmitButton:i,BackButton:a,OnboardingInvite:p}}))},"OnboardingFlow");export{R as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JIBRNWD2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Onboarding/OnboardingFlow.tsx"],"sourcesContent":["import React, { useId } from 'react';\nimport { useOnboarding } from '@/src/flows/Onboarding/hooks';\nimport { BasicInformationStep } from '@/src/flows/Onboarding/BasicInformationStep';\nimport { OnboardingContext } from '@/src/flows/Onboarding/context';\nimport { OnboardingSubmit } from '@/src/flows/Onboarding/OnboardingSubmit';\nimport { OnboardingBack } from '@/src/flows/Onboarding/OnboardingBack';\nimport { OnboardingFlowParams } from '@/src/flows/Onboarding/types';\nimport { OnboardingInvite } from '@/src/flows/Onboarding/OnboardingInvite';\nimport { ContractDetailsStep } from '@/src/flows/Onboarding/ContractDetailsStep';\nimport { BenefitsStep } from '@/src/flows/Onboarding/BenefitsStep';\n\nexport type OnboardingRenderProps = {\n /**\n * The onboarding bag returned by the useOnboarding hook.\n * This bag contains all the methods and properties needed to handle the onboarding flow.\n * @see {@link useOnboarding}\n */\n onboardingBag: ReturnType<typeof useOnboarding>;\n /**\n * The components used in the onboarding flow.\n * This includes different steps, submit button, back button.\n * @see {@link BasicInformationStep}\n * @see {@link ContractDetailsStep}\n * @see {@link OnboardingSubmit}\n * @see {@link OnboardingBack}\n * @see {@link OnboardingInvite}\n * @see {@link BenefitsStep}\n */\n components: {\n SubmitButton: typeof OnboardingSubmit;\n BackButton: typeof OnboardingBack;\n BasicInformationStep: typeof BasicInformationStep;\n OnboardingInvite: typeof OnboardingInvite;\n ContractDetailsStep: typeof ContractDetailsStep;\n BenefitsStep: typeof BenefitsStep;\n };\n};\n\ntype OnboardingFlowProps = OnboardingFlowParams & {\n render: ({\n onboardingBag,\n components,\n }: OnboardingRenderProps) => React.ReactNode;\n};\n\nexport const OnboardingFlow = ({\n employmentId,\n countryCode,\n type = 'employee',\n render,\n options,\n}: OnboardingFlowProps) => {\n const formId = useId();\n const onboardingBag = useOnboarding({\n employmentId,\n countryCode,\n type,\n options,\n });\n\n return (\n <OnboardingContext.Provider\n value={{\n formId: formId,\n onboardingBag,\n }}\n >\n {render({\n onboardingBag,\n components: {\n BasicInformationStep: BasicInformationStep,\n ContractDetailsStep: ContractDetailsStep,\n BenefitsStep: BenefitsStep,\n SubmitButton: OnboardingSubmit,\n BackButton: OnboardingBack,\n OnboardingInvite: OnboardingInvite,\n },\n })}\n </OnboardingContext.Provider>\n );\n};\n"],"mappings":"mWAAA,OAAOA,GAAS,SAAAC,MAAa,QA6CtB,IAAMC,EAAiBC,EAAA,CAAC,CAC7B,aAAAC,EACA,YAAAC,EACA,KAAAC,EAAO,WACP,OAAAC,EACA,QAAAC,CACF,IAA2B,CACzB,IAAMC,EAASC,EAAM,EACfC,EAAgBC,EAAc,CAClC,aAAAR,EACA,YAAAC,EACA,KAAAC,EACA,QAAAE,CACF,CAAC,EAED,OACEK,EAAA,cAACC,EAAkB,SAAlB,CACC,MAAO,CACL,OAAQL,EACR,cAAAE,CACF,GAECJ,EAAO,CACN,cAAAI,EACA,WAAY,CACV,qBAAsBI,EACtB,oBAAqBC,EACrB,aAAcC,EACd,aAAcC,EACd,WAAYC,EACZ,iBAAkBC,CACpB,CACF,CAAC,CACH,CAEJ,EAnC8B","names":["React","useId","OnboardingFlow","__name","employmentId","countryCode","type","render","options","formId","useId","onboardingBag","useOnboarding","React","OnboardingContext","BasicInformationStep","ContractDetailsStep","BenefitsStep","OnboardingSubmit","OnboardingBack","OnboardingInvite"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as t}from"./chunk-YH5F6MGK.js";import{b as a}from"./chunk-DZYFSFZ7.js";import{a as i}from"./chunk-AYDF3IFZ.js";import p from"react";function b({requesterName:n,onSubmit:m,onSuccess:s,onError:d}){let{terminationBag:e}=a(),l=i(async r=>{await m?.(e?.parseFormValues(r));let o=await e?.onSubmit(r);o?.error?d?.(o.error):o?.data&&s?.(o.data)},"handleSubmit"),u=e?.fields.map(r=>r.name==="acknowledge_termination_procedure"?{...r,label:r.label.replace("{{requesterName}}",n)}:r);return p.createElement(t,{fields:u,onSubmit:l})}i(b,"AdditionalDetailsForm");export{b as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JWIYUQ5X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Termination/AdditionalDetailsForm.tsx"],"sourcesContent":["import React from 'react';\nimport { useTerminationContext } from './context';\nimport { TerminationFormValues } from '@/src/flows/Termination/types';\nimport { OffboardingResponse } from '@/src/client';\nimport { TerminationForm } from '@/src/flows/Termination/TerminationForm';\n\ntype AdditionalDetailsFormProps = {\n /*\n * The name of the person who initiates the termination, used to personalize the label of the\n * acknowledge_termination_procedure field.\n */\n requesterName: string;\n /*\n * The function is called when the form is submitted. It receives the form values as an argument.\n */\n onSubmit?: (payload: TerminationFormValues) => void | Promise<void>;\n /*\n * The function is called when the form submission has failed.\n */\n onError?: (error: Error) => void;\n /*\n * The function is called when the form submission is successful. It receives the response data as\n * an argument.\n */\n onSuccess?: (data: OffboardingResponse) => void;\n};\n\nexport function AdditionalDetailsForm({\n requesterName,\n onSubmit,\n onSuccess,\n onError,\n}: AdditionalDetailsFormProps) {\n const { terminationBag } = useTerminationContext();\n\n const handleSubmit = async (values: TerminationFormValues) => {\n await onSubmit?.(\n terminationBag?.parseFormValues(values) as TerminationFormValues,\n );\n const terminationResult = await terminationBag?.onSubmit(values);\n\n if (terminationResult?.error) {\n onError?.(terminationResult.error);\n } else {\n if (terminationResult?.data) {\n onSuccess?.(terminationResult.data as OffboardingResponse);\n }\n }\n };\n\n const updatedFields = terminationBag?.fields.map((field) => {\n if (field.name === 'acknowledge_termination_procedure') {\n return {\n ...field,\n label: (field.label as string).replace(\n '{{requesterName}}',\n requesterName,\n ),\n };\n }\n return field;\n });\n\n return <TerminationForm fields={updatedFields} onSubmit={handleSubmit} />;\n}\n"],"mappings":"wHAAA,OAAOA,MAAW,QA2BX,SAASC,EAAsB,CACpC,cAAAC,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,CACF,EAA+B,CAC7B,GAAM,CAAE,eAAAC,CAAe,EAAIC,EAAsB,EAE3CC,EAAeC,EAAA,MAAOC,GAAkC,CAC5D,MAAMP,IACJG,GAAgB,gBAAgBI,CAAM,CACxC,EACA,IAAMC,EAAoB,MAAML,GAAgB,SAASI,CAAM,EAE3DC,GAAmB,MACrBN,IAAUM,EAAkB,KAAK,EAE7BA,GAAmB,MACrBP,IAAYO,EAAkB,IAA2B,CAG/D,EAbqB,gBAefC,EAAgBN,GAAgB,OAAO,IAAKO,GAC5CA,EAAM,OAAS,oCACV,CACL,GAAGA,EACH,MAAQA,EAAM,MAAiB,QAC7B,oBACAX,CACF,CACF,EAEKW,CACR,EAED,OAAOC,EAAA,cAACC,EAAA,CAAgB,OAAQH,EAAe,SAAUJ,EAAc,CACzE,CArCgBC,EAAAR,EAAA","names":["React","AdditionalDetailsForm","requesterName","onSubmit","onSuccess","onError","terminationBag","useTerminationContext","handleSubmit","__name","values","terminationResult","updatedFields","field","React","TerminationForm"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b as m,c as p,d as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a,b as m,c as p,d as l}from"./chunk-3FVI5JIC.js";import{a as e}from"./chunk-MESREYTZ.js";import{b as n}from"./chunk-56BNVYTD.js";import{b as i}from"./chunk-5ETXP2QF.js";import{a as t}from"./chunk-AYDF3IFZ.js";import{Info as v}from"lucide-react";import o from"react";function w({benefitsTotal:d,benefitsBreakdown:f,currency:r}){return o.createElement("div",null,o.createElement("div",{className:"flex justify-between items-center mb-2"},o.createElement("h3",{className:"font-medium text-primary-foreground-800"},"Benefits"),o.createElement("span",{className:"font-semibold text-lg"},i(d,r))),o.createElement(e,{className:"mb-3"}),o.createElement("div",{className:"space-y-3 pl-2"},f.map((s,u)=>o.createElement("div",{key:u,className:"flex justify-between items-start text-sm"},o.createElement("div",{className:"flex items-start gap-2"},o.createElement("span",null,s.name),o.createElement(a,null,o.createElement(m,null,o.createElement(p,{asChild:!0},o.createElement(n,{variant:"ghost",size:"icon",className:"h-4 w-4 p-0"},o.createElement(v,{className:"h-3 w-3 text-gray-400"}),o.createElement("span",{className:"sr-only"},"Info"))),o.createElement(l,null,o.createElement("p",{className:"max-w-xs"},s.description))))),o.createElement("span",null,i(s.amount,r))))))}t(w,"CostCalculatorBenefitsBreakdown");export{w as a};
|
|
2
|
+
//# sourceMappingURL=chunk-KH6QS5OU.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as n}from"./chunk-DZYFSFZ7.js";import{b as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as n}from"./chunk-DZYFSFZ7.js";import{b as r}from"./chunk-56BNVYTD.js";import{a as o}from"./chunk-AYDF3IFZ.js";import e from"react";function B(t){let{formId:i}=n();return e.createElement(r,{...t,form:i},t.children)}o(B,"TerminationSubmit");export{B as a};
|
|
2
|
+
//# sourceMappingURL=chunk-KSGPQCSG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-M22FKNEY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as l}from"./chunk-OLJ2S6A6.js";import{d as s,e}from"./chunk-344TN4EG.js";import{b as a}from"./chunk-A4RX3KRZ.js";import{a as r}from"./chunk-AYDF3IFZ.js";import g,{useId as y}from"react";import{useForm as p}from"react-hook-form";var v=r(({estimationOptions:n=s,defaultValues:o={countryRegionSlug:"",currencySlug:"",salary:""},options:i,render:u})=>{let c=y(),t=e({defaultRegion:o.countryRegionSlug,estimationOptions:n,options:i}),m=a(t.handleValidation),C=p({resolver:m,defaultValues:{country:o?.countryRegionSlug,currency:o?.currencySlug,region:"",salary:o?.salary},shouldUnregister:!0,mode:"onBlur"});return g.createElement(l.Provider,{value:{form:C,formId:c,costCalculatorBag:t}},u(t))},"CostCalculatorFlow");export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-M5VZBMLC.js.map
|
|
@@ -0,0 +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, { useId } from 'react';\nimport { useForm } from 'react-hook-form';\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 formId = useId();\n const costCalculatorBag = useCostCalculator({\n defaultRegion: defaultValues.countryRegionSlug,\n estimationOptions,\n options,\n });\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"],"mappings":"kKAUA,OAAOA,GAAS,SAAAC,MAAa,QAC7B,OAAS,WAAAC,MAAe,kBAgCjB,IAAMC,EAAqBC,EAAA,CAAC,CACjC,kBAAAC,EAAoBC,EACpB,cAAAC,EAAgB,CACd,kBAAmB,GACnB,aAAc,GACd,OAAQ,EACV,EACA,QAAAC,EACA,OAAAC,CACF,IAA+B,CAC7B,IAAMC,EAASC,EAAM,EACfC,EAAoBC,EAAkB,CAC1C,cAAeN,EAAc,kBAC7B,kBAAAF,EACA,QAAAG,CACF,CAAC,EACKM,EAAWC,EAEfH,EAAkB,gBACpB,EAEMI,EAAOC,EAAQ,CACnB,SAAAH,EACA,cAAe,CACb,QAASP,GAAe,kBACxB,SAAUA,GAAe,aACzB,OAAQ,GACR,OAAQA,GAAe,MACzB,EACA,iBAAkB,GAClB,KAAM,QACR,CAAC,EAED,OACEW,EAAA,cAACC,EAAsB,SAAtB,CACC,MAAO,CACL,KAAAH,EACA,OAAQN,EACR,kBAAAE,CACF,GAECH,EAAOG,CAAiB,CAC3B,CAEJ,EA5CkC","names":["React","useId","useForm","CostCalculatorFlow","__name","estimationOptions","defaultEstimationOptions","defaultValues","options","render","formId","useId","costCalculatorBag","useCostCalculator","resolver","useJsonSchemasValidationFormResolver","form","useForm","React","CostCalculatorContext"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as n}from"./chunk-WS3C3WIJ.js";import{b as o}from"./chunk-56BNVYTD.js";import{a as t}from"./chunk-AYDF3IFZ.js";import u from"react";function s({children:r,...i}){let{onboardingBag:{back:e}}=n();return u.createElement(o,{...i,onClick:()=>{e()}},r)}t(s,"OnboardingBack");export{s as a};
|
|
2
|
+
//# sourceMappingURL=chunk-M7WCW7WD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Onboarding/OnboardingBack.tsx"],"sourcesContent":["import { Button } from '@/src/components/ui/button';\nimport React, { ButtonHTMLAttributes, PropsWithChildren } from 'react';\nimport { useOnboardingContext } from '@/src/flows/Onboarding/context';\n\nexport function OnboardingBack({\n children,\n ...props\n}: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>) {\n const {\n onboardingBag: { back },\n } = useOnboardingContext();\n\n return (\n <Button\n {...props}\n onClick={() => {\n back();\n }}\n >\n {children}\n </Button>\n );\n}\n"],"mappings":"wHACA,OAAOA,MAAwD,QAGxD,SAASC,EAAe,CAC7B,SAAAC,EACA,GAAGC,CACL,EAA+D,CAC7D,GAAM,CACJ,cAAe,CAAE,KAAAC,CAAK,CACxB,EAAIC,EAAqB,EAEzB,OACEC,EAAA,cAACC,EAAA,CACE,GAAGJ,EACJ,QAAS,IAAM,CACbC,EAAK,CACP,GAECF,CACH,CAEJ,CAlBgBM,EAAAP,EAAA","names":["React","OnboardingBack","children","props","back","useOnboardingContext","React","Button","__name"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-5ETXP2QF.js";import{a as t}from"./chunk-AYDF3IFZ.js";import*as r from"react";import*as a from"@radix-ui/react-separator";function m({className:i,orientation:e="horizontal",decorative:n=!0,...p}){return r.createElement(a.Root,{"data-slot":"separator-root",decorative:n,orientation:e,className:o("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",i),...p})}t(m,"Separator");export{m as a};
|
|
2
|
+
//# sourceMappingURL=chunk-MESREYTZ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as r}from"./chunk-WS3C3WIJ.js";import{b as o}from"./chunk-56BNVYTD.js";import{a as t}from"./chunk-AYDF3IFZ.js";import e from"react";function d({children:n,...i}){let{formId:u}=r();return e.createElement(o,{...i,form:u},n)}t(d,"OnboardingSubmit");export{d as a};
|
|
2
|
+
//# sourceMappingURL=chunk-MHKNAQLP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Onboarding/OnboardingSubmit.tsx"],"sourcesContent":["import React, { ButtonHTMLAttributes, PropsWithChildren } from 'react';\nimport { Button } from '@/src/components/ui/button';\nimport { useOnboardingContext } from '@/src/flows/Onboarding/context';\n\nexport function OnboardingSubmit({\n children,\n ...props\n}: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>) {\n const { formId } = useOnboardingContext();\n\n return (\n <Button {...props} form={formId}>\n {children}\n </Button>\n );\n}\n"],"mappings":"wHAAA,OAAOA,MAAwD,QAIxD,SAASC,EAAiB,CAC/B,SAAAC,EACA,GAAGC,CACL,EAA+D,CAC7D,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAqB,EAExC,OACEC,EAAA,cAACC,EAAA,CAAQ,GAAGJ,EAAO,KAAMC,GACtBF,CACH,CAEJ,CAXgBM,EAAAP,EAAA","names":["React","OnboardingSubmit","children","props","formId","useOnboardingContext","React","Button","__name"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{l as o,r as i}from"./chunk-FNMWKUNJ.js";import{d as n}from"./chunk-WRDKLT4N.js";import{a as e}from"./chunk-AYDF3IFZ.js";import{useQuery as s}from"@tanstack/react-query";var p=e(({employmentId:t})=>{let{client:r}=n();return s({queryKey:["employment",t],retry:!1,queryFn:e(()=>o({client:r,headers:{Authorization:""},path:{employment_id:t}}),"queryFn"),select:e(({data:m})=>m,"select")})},"useEmploymentQuery"),c=e(({employmentId:t,status:r})=>{let{client:m}=n();return s({queryKey:["timeoff",t,r],retry:!1,queryFn:e(()=>i({client:m,headers:{Authorization:""},query:{employment_id:t,status:r}}),"queryFn"),select:e(({data:u})=>u,"select")})},"useTimeOffQuery");export{p as a,c as b};
|
|
2
|
+
//# sourceMappingURL=chunk-NFEY2YL6.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as i}from"./chunk-OLJ2S6A6.js";import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as i}from"./chunk-OLJ2S6A6.js";import{a as e}from"./chunk-BKROCZRD.js";import{a as l}from"./chunk-IDSJI7KQ.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-QEMICBEY.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as s}from"./chunk-RLS4PMWA.js";import{b as t}from"./chunk-WS3C3WIJ.js";import{d as e}from"./chunk-XVOJ4RMC.js";import{a as o}from"./chunk-AYDF3IFZ.js";import a from"react";function l({components:i}){let{onboardingBag:n}=t(),r=n.fields??[],m=e(r,{});return a.createElement(s,{defaultValues:m,components:i,onSubmit:o(async()=>{n?.next()},"handleSubmit")})}o(l,"BenefitsStep");export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RIAYBN32.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Onboarding/BenefitsStep.tsx"],"sourcesContent":["import React from 'react';\nimport { Components } from '@/src/types/remoteFlows';\nimport { OnboardingForm } from '@/src/flows/Onboarding/OnboardingForm';\nimport { useOnboardingContext } from '@/src/flows/Onboarding/context';\nimport { SuccessResponse } from '@/src/client';\nimport { getInitialValues } from '@/src/components/form/utils';\n\ntype BenefitsPayload = Record<string, unknown>;\n\ntype BenefitsStepProps = {\n components: Components;\n /**\n * Callback function to be called when the benefits form is submitted.\n * It can be used to perform any additional validation or processing before\n * the onboarding moves to the last step.\n * @param values\n * @returns\n */\n onSubmit?: (values: BenefitsPayload) => Promise<void>;\n /**\n * Callback function to be called when the submitting benefits form fails.\n * @param error\n * @returns\n */\n onError?: (error: unknown) => void;\n /**\n * Callback function to be called when benefits form is successfully submitted.\n * This function is called after the submitting benefits form is submitted.\n * @param data\n * @returns\n */\n onSuccess?: (data: SuccessResponse) => void;\n};\n\nexport function BenefitsStep({ components }: BenefitsStepProps) {\n const { onboardingBag } = useOnboardingContext();\n const fields = onboardingBag.fields ?? [];\n const initialValues = getInitialValues(fields, {});\n\n const handleSubmit = async () => {\n onboardingBag?.next();\n };\n\n return (\n <OnboardingForm\n defaultValues={initialValues}\n components={components}\n onSubmit={handleSubmit}\n />\n );\n}\n"],"mappings":"gKAAA,OAAOA,MAAW,QAkCX,SAASC,EAAa,CAAE,WAAAC,CAAW,EAAsB,CAC9D,GAAM,CAAE,cAAAC,CAAc,EAAIC,EAAqB,EACzCC,EAASF,EAAc,QAAU,CAAC,EAClCG,EAAgBC,EAAiBF,EAAQ,CAAC,CAAC,EAMjD,OACEG,EAAA,cAACC,EAAA,CACC,cAAeH,EACf,WAAYJ,EACZ,SARiBQ,EAAA,SAAY,CAC/BP,GAAe,KAAK,CACtB,EAFqB,gBASnB,CAEJ,CAhBgBO,EAAAT,EAAA","names":["React","BenefitsStep","components","onboardingBag","useOnboardingContext","fields","initialValues","getInitialValues","React","OnboardingForm","__name"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as d}from"./chunk-WS3C3WIJ.js";import{a}from"./chunk-BKROCZRD.js";import{b as s}from"./chunk-A4RX3KRZ.js";import{a as t}from"./chunk-IDSJI7KQ.js";import{a as m}from"./chunk-AYDF3IFZ.js";import e,{useEffect as l}from"react";import{useForm as y}from"react-hook-form";function B({defaultValues:f,onSubmit:p,components:c}){let{formId:u,onboardingBag:o}=d(),F=s(o.handleValidation),r=y({resolver:F,defaultValues:f,shouldUnregister:!1,mode:"onBlur"});return l(()=>{o.employmentId&&o?.checkFieldUpdates(r.getValues())},[]),l(()=>{let b=r?.watch(n=>{Object.keys(n).some(i=>n[i]!==o?.initialValues?.[i])&&o?.checkFieldUpdates(n)});return()=>b?.unsubscribe()},[]),e.createElement(t,{...r},e.createElement("form",{id:u,onSubmit:r.handleSubmit(p),className:"space-y-4 RemoteFlows__OnboardingForm"},e.createElement(a,{components:c,fields:o.fields})))}m(B,"OnboardingForm");export{B as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RLS4PMWA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Onboarding/OnboardingForm.tsx"],"sourcesContent":["import { JSONSchemaFormFields } from '@/src/components/form/JSONSchemaForm';\nimport { Form } from '@/src/components/ui/form';\nimport React, { useEffect } from 'react';\nimport { useOnboardingContext } from './context';\nimport { useForm } from 'react-hook-form';\nimport { useJsonSchemasValidationFormResolver } from '@/src/components/form/yupValidationResolver';\nimport { Fields } from '@remoteoss/json-schema-form';\nimport { BasicInformationFormPayload } from '@/src/flows/Onboarding/types';\nimport { Components } from '@/src/types/remoteFlows';\n\ntype OnboardingFormProps = {\n onSubmit: (payload: BasicInformationFormPayload) => void;\n components?: Components;\n fields?: Fields;\n defaultValues: Record<string, unknown>;\n};\n\nexport function OnboardingForm({\n defaultValues,\n onSubmit,\n components,\n}: OnboardingFormProps) {\n const { formId, onboardingBag } = useOnboardingContext();\n\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n onboardingBag.handleValidation,\n );\n\n const form = useForm({\n resolver,\n defaultValues,\n shouldUnregister: false,\n mode: 'onBlur',\n });\n\n useEffect(() => {\n // When the employmentId is set,\n // we need to run the checkFieldUpdates to update fieldValues in useStepState\n if (onboardingBag.employmentId) {\n onboardingBag?.checkFieldUpdates(form.getValues());\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n const subscription = form?.watch((values) => {\n const isAnyFieldDirty = Object.keys(values).some(\n (key) =>\n values[key as keyof unknown] !==\n onboardingBag?.initialValues?.[key as keyof unknown],\n );\n if (isAnyFieldDirty) {\n onboardingBag?.checkFieldUpdates(values);\n }\n });\n return () => subscription?.unsubscribe();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <Form {...form}>\n <form\n id={formId}\n onSubmit={form.handleSubmit(onSubmit)}\n className=\"space-y-4 RemoteFlows__OnboardingForm\"\n >\n <JSONSchemaFormFields\n components={components}\n fields={onboardingBag.fields}\n />\n </form>\n </Form>\n );\n}\n"],"mappings":"mMAEA,OAAOA,GAAS,aAAAC,MAAiB,QAEjC,OAAS,WAAAC,MAAe,kBAajB,SAASC,EAAe,CAC7B,cAAAC,EACA,SAAAC,EACA,WAAAC,CACF,EAAwB,CACtB,GAAM,CAAE,OAAAC,EAAQ,cAAAC,CAAc,EAAIC,EAAqB,EAEjDC,EAAWC,EAEfH,EAAc,gBAChB,EAEMI,EAAOC,EAAQ,CACnB,SAAAH,EACA,cAAAN,EACA,iBAAkB,GAClB,KAAM,QACR,CAAC,EAED,OAAAU,EAAU,IAAM,CAGVN,EAAc,cAChBA,GAAe,kBAAkBI,EAAK,UAAU,CAAC,CAGrD,EAAG,CAAC,CAAC,EAELE,EAAU,IAAM,CACd,IAAMC,EAAeH,GAAM,MAAOI,GAAW,CACnB,OAAO,KAAKA,CAAM,EAAE,KACzCC,GACCD,EAAOC,CAAoB,IAC3BT,GAAe,gBAAgBS,CAAoB,CACvD,GAEET,GAAe,kBAAkBQ,CAAM,CAE3C,CAAC,EACD,MAAO,IAAMD,GAAc,YAAY,CAEzC,EAAG,CAAC,CAAC,EAGHG,EAAA,cAACC,EAAA,CAAM,GAAGP,GACRM,EAAA,cAAC,QACC,GAAIX,EACJ,SAAUK,EAAK,aAAaP,CAAQ,EACpC,UAAU,yCAEVa,EAAA,cAACE,EAAA,CACC,WAAYd,EACZ,OAAQE,EAAc,OACxB,CACF,CACF,CAEJ,CAzDgBa,EAAAlB,EAAA","names":["React","useEffect","useForm","OnboardingForm","defaultValues","onSubmit","components","formId","onboardingBag","useOnboardingContext","resolver","useJsonSchemasValidationFormResolver","form","useForm","useEffect","subscription","values","key","React","Form","JSONSchemaFormFields","__name"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as m}from"./chunk-YH5F6MGK.js";import{b as r}from"./chunk-DZYFSFZ7.js";import{a as o}from"./chunk-AYDF3IFZ.js";import a from"react";function p({onSubmit:n}){let{terminationBag:i}=r();return a.createElement(m,{onSubmit:o(async t=>{await n?.(i?.parseFormValues(t)),i?.next()},"handleSubmit")})}o(p,"TerminationDetailsForm");export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RRFSGYAC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Termination/TerminationDetailsForm.tsx"],"sourcesContent":["import React from 'react';\nimport { useTerminationContext } from './context';\nimport { TerminationFormValues } from '@/src/flows/Termination/types';\nimport { TerminationForm } from '@/src/flows/Termination/TerminationForm';\n\ntype TerminationDetailsFormProps = {\n /*\n * The function is called when the form is submitted. It receives the form values as an argument.\n */\n onSubmit?: (payload: TerminationFormValues) => void | Promise<void>;\n};\n\nexport function TerminationDetailsForm({\n onSubmit,\n}: TerminationDetailsFormProps) {\n const { terminationBag } = useTerminationContext();\n const handleSubmit = async (values: TerminationFormValues) => {\n await onSubmit?.(\n terminationBag?.parseFormValues(values) as TerminationFormValues,\n );\n terminationBag?.next();\n };\n\n return <TerminationForm onSubmit={handleSubmit} />;\n}\n"],"mappings":"wHAAA,OAAOA,MAAW,QAYX,SAASC,EAAuB,CACrC,SAAAC,CACF,EAAgC,CAC9B,GAAM,CAAE,eAAAC,CAAe,EAAIC,EAAsB,EAQjD,OAAOC,EAAA,cAACC,EAAA,CAAgB,SAPHC,EAAA,MAAOC,GAAkC,CAC5D,MAAMN,IACJC,GAAgB,gBAAgBK,CAAM,CACxC,EACAL,GAAgB,KAAK,CACvB,EALqB,gBAO2B,CAClD,CAZgBI,EAAAN,EAAA","names":["React","TerminationDetailsForm","onSubmit","terminationBag","useTerminationContext","React","TerminationForm","__name","values"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as g,b as _,c as h,d as v,e as T}from"./chunk-GMGKIQLI.js";import{a as P}from"./chunk-WQHKB5T7.js";import{a as w}from"./chunk-KH6QS5OU.js";import{a as x}from"./chunk-J55S4SEH.js";import{a as N}from"./chunk-6A3F6JG6.js";import{a as y}from"./chunk-GFBF55NR.js";import{a as l}from"./chunk-5ETXP2QF.js";import{a as n}from"./chunk-AYDF3IFZ.js";import{Euro as j}from"lucide-react";import t,{lazy as z,useState as E}from"react";import*as c from"react";import*as r from"@radix-ui/react-tabs";function k({className:a,...o}){return c.createElement(r.Root,{"data-slot":"tabs",className:l("flex flex-col gap-2",a),...o})}n(k,"Tabs");function B({className:a,...o}){return c.createElement(r.List,{"data-slot":"tabs-list",className:l("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-1",a),...o})}n(B,"TabsList");function d({className:a,...o}){return c.createElement(r.Trigger,{"data-slot":"tabs-trigger",className:l("data-[state=active]:bg-background data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring inline-flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...o})}n(d,"TabsTrigger");var H=z(()=>import("./flows/CostCalculator/Results/CostCalculatorResultsChart.js"));function X({employmentData:a,options:o}){let[e,S]=E("monthly"),i=a.employments?.[0];if(!i)return null;let s=i.employer_currency_costs,m=s.currency.symbol,b=e==="monthly"?s.monthly_gross_salary:s.annual_gross_salary,f=e==="monthly"?s.monthly_benefits_total:s.annual_benefits_total,C=e==="monthly"?s.monthly_contributions_total:s.annual_contributions_total,D=e==="monthly"?s.monthly_total:s.annual_total,u=e==="monthly"?s.monthly_benefits_breakdown:s.annual_benefits_breakdown,L=e==="monthly"?s.monthly_contributions_breakdown:s.annual_contributions_breakdown,p=[{name:"Gross Salary",value:b,color:o?.chartColors?.grossSalary??"#3b82f6"},{name:"Contributions",value:C,color:o?.chartColors?.contributions??"#f59e0b"}];return u&&p.push({name:"Benefits",value:f??0,color:o?.chartColors?.benefits??"#10b981"}),t.createElement(t.Fragment,null,t.createElement("div",{className:"flex flex-col md:flex-row gap-4 md:items-center justify-between mb-6 RemoteFlows__CostCalculatorResults"},t.createElement("div",{className:"RemoteFlows__CostCalculatorResults__Header"},t.createElement("h2",{className:"text-xl font-semibold flex items-center gap-2"},t.createElement("span",{className:"flex items-center gap-1"},t.createElement(j,{className:"h-5 w-5 text-gray-600"}),o?.title??"Cost Calculator"),t.createElement(y,{className:"ml-2"},i.country.name)),t.createElement("p",{className:"text-primary-foreground font-medium mt-1"},o?.description??`Total cost of employment in ${i.country.name}`)),t.createElement(k,{value:e,onValueChange:F=>S(F),className:"w-full md:w-auto RemoteFlows__CostCalculatorResults__Tabs"},t.createElement(B,{className:"grid w-full md:w-[200px] grid-cols-2"},t.createElement(d,{value:"monthly"},"Monthly"),t.createElement(d,{value:"annual"},"Annual")))),t.createElement("div",{className:l("grid grid-cols-1 gap-6",o?.showChart?"md:grid-cols-3":"","RemoteFlows__CostCalculatorResults_CostBreakdown")},t.createElement(g,{className:"md:col-span-2 rounded-lg"},t.createElement(_,{className:"pb-2"},t.createElement(h,null,"Cost Breakdown"),t.createElement(v,null,"Detailed breakdown of all employer costs")),t.createElement(T,null,t.createElement("div",{className:"space-y-6"},t.createElement(N,{grossSalary:b,currency:m}),u?t.createElement(w,{benefitsBreakdown:u,benefitsTotal:f,currency:m}):null,t.createElement(x,{contributionsBreakdown:L,contributionsTotal:C,currency:m}),t.createElement(P,{totalCost:D,currency:m})))),o?.showChart&&t.createElement(H,{chartData:p,currency:m})))}n(X,"CostCalculatorResults");export{X as a};
|
|
2
|
+
//# sourceMappingURL=chunk-S4FKLPBB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/CostCalculator/Results/CostCalculatorResults.tsx","../src/components/ui/tabs.tsx"],"sourcesContent":["import { Euro } from 'lucide-react';\nimport React, { lazy, useState } from 'react';\n\nimport { CostCalculatorEstimateResponse } from '@/src/client';\nimport { Badge } from '@/src/components/ui/badge';\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@/src/components/ui/card';\nimport { Tabs, TabsList, TabsTrigger } from '@/src/components/ui/tabs';\nimport { cn } from '@/src/lib/utils';\nimport { CostCalculatorBenefitsBreakdown } from './CostCalculatorBenefitsBreakdown';\nimport { CostCalculatorContributionsBreakdown } from './CostCalculatorContributionsBreakdown';\nimport { CostCalculatorGrossSalary } from './CostCalculatorGrossSalary';\nimport { CostCalculatorTotalCost } from './CostCalculatorTotalCost';\n\nconst CostCalculatorResultsChart = lazy(\n () => import('./CostCalculatorResultsChart'),\n);\n\ninterface CostCalculatorResultProps {\n employmentData: CostCalculatorEstimateResponse['data'];\n options?: Partial<{\n title: string;\n description: string;\n showChart: boolean;\n chartColors: {\n grossSalary: string;\n contributions: string;\n benefits: string;\n };\n }>;\n}\n\nexport function CostCalculatorResults({\n employmentData,\n options,\n}: CostCalculatorResultProps) {\n const [view, setView] = useState<'monthly' | 'annual'>('monthly');\n const employment = employmentData.employments?.[0];\n\n if (!employment) {\n return null;\n }\n\n const costs =\n view === 'monthly'\n ? employment.employer_currency_costs\n : employment.employer_currency_costs;\n\n const currency = costs.currency.symbol;\n const grossSalary =\n view === 'monthly' ? costs.monthly_gross_salary : costs.annual_gross_salary;\n const benefitsTotal =\n view === 'monthly'\n ? costs.monthly_benefits_total\n : costs.annual_benefits_total;\n const contributionsTotal =\n view === 'monthly'\n ? costs.monthly_contributions_total\n : costs.annual_contributions_total;\n const totalCost =\n view === 'monthly' ? costs.monthly_total : costs.annual_total;\n\n const benefitsBreakdown =\n view === 'monthly'\n ? costs.monthly_benefits_breakdown\n : costs.annual_benefits_breakdown;\n const contributionsBreakdown =\n view === 'monthly'\n ? costs.monthly_contributions_breakdown\n : costs.annual_contributions_breakdown;\n\n const chartData = [\n {\n name: 'Gross Salary',\n value: grossSalary,\n color: options?.chartColors?.grossSalary ?? '#3b82f6',\n },\n {\n name: 'Contributions',\n value: contributionsTotal,\n color: options?.chartColors?.contributions ?? '#f59e0b',\n },\n ];\n\n if (benefitsBreakdown) {\n chartData.push({\n name: 'Benefits',\n value: benefitsTotal ?? 0,\n color: options?.chartColors?.benefits ?? '#10b981',\n });\n }\n\n return (\n <>\n <div className=\"flex flex-col md:flex-row gap-4 md:items-center justify-between mb-6 RemoteFlows__CostCalculatorResults\">\n <div className=\"RemoteFlows__CostCalculatorResults__Header\">\n <h2 className=\"text-xl font-semibold flex items-center gap-2\">\n <span className=\"flex items-center gap-1\">\n <Euro className=\"h-5 w-5 text-gray-600\" />\n {options?.title ?? 'Cost Calculator'}\n </span>\n <Badge className=\"ml-2\">{employment.country.name}</Badge>\n </h2>\n <p className=\"text-primary-foreground font-medium mt-1\">\n {options?.description ??\n `Total cost of employment in ${employment.country.name}`}\n </p>\n </div>\n\n <Tabs\n value={view}\n onValueChange={(v) => setView(v as 'monthly' | 'annual')}\n className=\"w-full md:w-auto RemoteFlows__CostCalculatorResults__Tabs\"\n >\n <TabsList className=\"grid w-full md:w-[200px] grid-cols-2\">\n <TabsTrigger value=\"monthly\">Monthly</TabsTrigger>\n <TabsTrigger value=\"annual\">Annual</TabsTrigger>\n </TabsList>\n </Tabs>\n </div>\n\n <div\n className={cn(\n 'grid grid-cols-1 gap-6',\n options?.showChart ? 'md:grid-cols-3' : '',\n 'RemoteFlows__CostCalculatorResults_CostBreakdown',\n )}\n >\n <Card className=\"md:col-span-2 rounded-lg\">\n <CardHeader className=\"pb-2\">\n <CardTitle>Cost Breakdown</CardTitle>\n <CardDescription>\n Detailed breakdown of all employer costs\n </CardDescription>\n </CardHeader>\n <CardContent>\n <div className=\"space-y-6\">\n {/* Salary Section */}\n <CostCalculatorGrossSalary\n grossSalary={grossSalary}\n currency={currency}\n />\n {/* Benefits Section */}\n {benefitsBreakdown ? (\n <CostCalculatorBenefitsBreakdown\n benefitsBreakdown={benefitsBreakdown}\n benefitsTotal={benefitsTotal}\n currency={currency}\n />\n ) : null}\n {/* Contributions Section */}\n <CostCalculatorContributionsBreakdown\n contributionsBreakdown={contributionsBreakdown}\n contributionsTotal={contributionsTotal}\n currency={currency}\n />\n {/* Total */}\n <CostCalculatorTotalCost\n totalCost={totalCost}\n currency={currency}\n />\n </div>\n </CardContent>\n </Card>\n\n {options?.showChart && (\n <CostCalculatorResultsChart\n chartData={chartData}\n currency={currency}\n />\n )}\n </div>\n </>\n );\n}\n","import * as React from 'react';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\n\nimport { cn } from '@/src/lib/utils';\n\nfunction Tabs({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Root>) {\n return (\n <TabsPrimitive.Root\n data-slot=\"tabs\"\n className={cn('flex flex-col gap-2', className)}\n {...props}\n />\n );\n}\n\nfunction TabsList({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.List>) {\n return (\n <TabsPrimitive.List\n data-slot=\"tabs-list\"\n className={cn(\n 'bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-1',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction TabsTrigger({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {\n return (\n <TabsPrimitive.Trigger\n data-slot=\"tabs-trigger\"\n className={cn(\n \"data-[state=active]:bg-background data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring inline-flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction TabsContent({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Content>) {\n return (\n <TabsPrimitive.Content\n data-slot=\"tabs-content\"\n className={cn('flex-1 outline-none', className)}\n {...props}\n />\n );\n}\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent };\n"],"mappings":"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","names":["Euro","React","lazy","useState","React","TabsPrimitive","Tabs","className","props","cn","__name","TabsList","TabsTrigger","CostCalculatorResultsChart","lazy","CostCalculatorResults","employmentData","options","view","setView","useState","employment","costs","currency","grossSalary","benefitsTotal","contributionsTotal","totalCost","benefitsBreakdown","contributionsBreakdown","chartData","React","Euro","Badge","Tabs","v","TabsList","TabsTrigger","cn","Card","CardHeader","CardTitle","CardDescription","CardContent","CostCalculatorGrossSalary","CostCalculatorBenefitsBreakdown","CostCalculatorContributionsBreakdown","CostCalculatorTotalCost","__name"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as v}from"./chunk-NFEY2YL6.js";import{a as S}from"./chunk-JRQSZHUU.js";import{a as l,b as V}from"./chunk-D3XENMEM.js";import{c as F,h as b,o as w}from"./chunk-FNMWKUNJ.js";import{a as M}from"./chunk-S56EWAS4.js";import{d}from"./chunk-WRDKLT4N.js";import{a as j,c as A}from"./chunk-XVOJ4RMC.js";import{a as e}from"./chunk-AYDF3IFZ.js";import{createHeadlessForm as R,modify as B}from"@remoteoss/json-schema-form";import{useMutation as T,useQuery as J}from"@tanstack/react-query";var K=e(({countryCode:a,employment:t,fieldValues:i,options:n})=>{let{client:u}=d(),s=n?.jsonSchemaVersion?.contract_amendments?{json_schema_version:n.jsonSchemaVersion.contract_amendments}:{};return J({queryKey:["contract-amendment-schema"],retry:!1,queryFn:e(async()=>{let r=await F({client:u,headers:{Authorization:""},query:{employment_id:t?.data?.employment?.id,country_code:a,...s}});if(r.error||!r.data)throw new Error("Failed to fetch contract amendment schema");return r},"queryFn"),enabled:!!t,select:e(({data:r})=>{let c=r?.data||{};if(n&&n.jsfModify){let{schema:p}=B(c,n.jsfModify);c=p}let o={...i,annual_gross_salary:i?.annual_gross_salary?j(i?.annual_gross_salary):void 0},f=Object.keys(o).length>0;return R(c,{initialValues:f?o:V(t)})},"select")})},"useContractAmendmentSchemaQuery"),O=e(()=>{let{client:a}=d();return T({mutationFn:e(t=>b({client:a,headers:{Authorization:""},body:t}),"mutationFn")})},"useCreateContractAmendmentMutation"),U=e(()=>{let{client:a}=d();return T({mutationFn:e(t=>w({client:a,headers:{Authorization:""},body:t}),"mutationFn")})},"useAutomatableContractAmendmentMutation"),ae=e(({employmentId:a,countryCode:t,options:i})=>{let{fieldValues:n,setFieldValues:u,stepState:s,nextStep:r,previousStep:c}=M(l),{data:o,isLoading:f,isError:_,error:p}=v({employmentId:a}),{data:m,isLoading:k,isError:L,error:Q}=K({employment:o,countryCode:t,fieldValues:{...s.values?.[s.currentStep.name],...n},options:i}),q=V(o,m?.fields),g=O(),E=U();async function z(y){let C=A(y,m?.fields||[],{isPartialValidation:!1}),P={employment_id:o?.data.employment?.id,amendment_contract_id:o?.data.employment?.active_contract_id,contract_amendment:{...C}};switch(s.currentStep.name){case l.form.name:{let{mutateAsync:h}=S(E),I=await h(P);return r(),I}case l.confirmation_form.name:{let{mutateAsync:h}=S(g);return h(P)}default:throw new Error("Invalid step state")}}e(z,"onSubmit");function x(y){if(m){let C=A(y,m?.fields);return m?.handleValidation(C)}return null}e(x,"handleValidation");function H(){c()}return e(H,"back"),{stepState:s,fields:m?.fields||[],isLoading:f||k,isError:_||L,error:p||Q,isSubmitting:E.isPending||g.isPending,initialValues:q,values:n,handleValidation:x,checkFieldUpdates:u,onSubmit:z,back:H}},"useContractAmendment");export{ae as a};
|
|
2
|
+
//# sourceMappingURL=chunk-SSIHUUZY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/ContractAmendment/hooks.ts"],"sourcesContent":["import {\n CreateContractAmendmentParams,\n EmploymentShowResponse,\n getShowContractAmendmentSchema,\n postAutomatableContractAmendment,\n postCreateContractAmendment,\n} from '@/src/client';\n\nimport {\n convertToCents,\n parseJSFToValidate,\n} from '@/src/components/form/utils';\nimport { mutationToPromise } from '@/src/lib/mutations';\n\nimport { Client } from '@hey-api/client-fetch';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { ContractAmendmentParams } from './types';\n\nimport { useEmploymentQuery } from '@/src/common/hooks';\nimport { useClient } from '@/src/context';\nimport { FieldValues } from 'react-hook-form';\nimport { useStepState } from '../useStepState';\nimport { buildInitialValues, STEPS } from './utils';\n\ntype ContractAmendmentSchemaParams = {\n countryCode: string;\n employment: EmploymentShowResponse | undefined;\n fieldValues: FieldValues | undefined;\n options?: ContractAmendmentParams['options'];\n};\n\nconst useContractAmendmentSchemaQuery = ({\n countryCode,\n employment,\n fieldValues,\n options,\n}: ContractAmendmentSchemaParams) => {\n const { client } = useClient();\n const jsonSchemaQueryParam = options?.jsonSchemaVersion?.contract_amendments\n ? {\n json_schema_version: options.jsonSchemaVersion.contract_amendments,\n }\n : {};\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 ...jsonSchemaQueryParam,\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\n const copyFieldValues = {\n ...fieldValues,\n annual_gross_salary: fieldValues?.annual_gross_salary\n ? convertToCents(fieldValues?.annual_gross_salary)\n : undefined,\n };\n\n const hasFieldValues = Object.keys(copyFieldValues).length > 0;\n\n const result = createHeadlessForm(jsfSchema, {\n initialValues: hasFieldValues\n ? copyFieldValues\n : buildInitialValues(employment),\n });\n return result;\n },\n });\n};\n\nconst useCreateContractAmendmentMutation = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateContractAmendmentParams) => {\n return postCreateContractAmendment({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nconst useAutomatableContractAmendmentMutation = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateContractAmendmentParams) => {\n return postAutomatableContractAmendment({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nexport const useContractAmendment = ({\n employmentId,\n countryCode,\n options,\n}: ContractAmendmentParams) => {\n const { fieldValues, setFieldValues, stepState, nextStep, previousStep } =\n useStepState<keyof typeof STEPS>(STEPS);\n\n const {\n data: employment,\n isLoading: isLoadingEmployment,\n isError: isErrorEmployment,\n error: errorEmployment,\n } = useEmploymentQuery({\n employmentId,\n });\n\n const {\n data: contractAmendmentHeadlessForm,\n isLoading: isLoadingContractAmendments,\n isError: isErrorContractAmendmentSchema,\n error: errorContractAmendmentSchema,\n } = useContractAmendmentSchemaQuery({\n employment,\n countryCode,\n // In case the user is navigating back to the form step, we need to\n // pass the previous field values, so that the schema can be\n // generated with the correct values.\n fieldValues: {\n ...stepState.values?.[stepState.currentStep.name as keyof typeof STEPS], // Restore values for the current step\n ...fieldValues,\n },\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\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":"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","names":["createHeadlessForm","modify","useMutation","useQuery","useContractAmendmentSchemaQuery","__name","countryCode","employment","fieldValues","options","client","useClient","jsonSchemaQueryParam","useQuery","response","getShowContractAmendmentSchema","data","jsfSchema","schema","modify","copyFieldValues","convertToCents","hasFieldValues","createHeadlessForm","buildInitialValues","useCreateContractAmendmentMutation","useMutation","payload","postCreateContractAmendment","useAutomatableContractAmendmentMutation","postAutomatableContractAmendment","useContractAmendment","employmentId","setFieldValues","stepState","nextStep","previousStep","useStepState","STEPS","isLoadingEmployment","isErrorEmployment","errorEmployment","useEmploymentQuery","contractAmendmentHeadlessForm","isLoadingContractAmendments","isErrorContractAmendmentSchema","errorContractAmendmentSchema","initialValues","createContractAmendmentMutation","automatableContractAmendmentMutation","onSubmit","values","parsedValues","parseJSFToValidate","mutateAsync","mutationToPromise","automatableContractAmendment","handleValidation","back"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as r}from"./chunk-5ETXP2QF.js";import{a as o}from"./chunk-AYDF3IFZ.js";import t from"react";function n({totalCost:s,currency:a}){return t.createElement("div",{className:"pt-2 mt-4 border-t-2 border-gray-200"},t.createElement("div",{className:"flex justify-between items-center"},t.createElement("h3",{className:"font-bold text-primary-foreground-800"},"Total Cost"),t.createElement("span",{className:"font-bold text-xl"},r(s,a))))}o(n,"CostCalculatorTotalCost");export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-WQHKB5T7.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as o}from"./chunk-AYDF3IFZ.js";import{createContext as r,useContext as t}from"react";var e=r({formId:void 0,onboardingBag:null}),i=o(()=>{let n=t(e);if(!n.formId||!n.onboardingBag)throw new Error("useOnboardingContext must be used within a OnboardingContextProvider");return{formId:n.formId,onboardingBag:n.onboardingBag}},"useOnboardingContext");export{e as a,i as b};
|
|
2
|
+
//# sourceMappingURL=chunk-WS3C3WIJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Onboarding/context.ts"],"sourcesContent":["import type { useOnboarding } from '@/src/flows/Onboarding/hooks';\nimport { createContext, useContext } from 'react';\n\nexport const OnboardingContext = createContext<{\n formId: string | undefined;\n onboardingBag: ReturnType<typeof useOnboarding> | null;\n}>({\n formId: undefined,\n onboardingBag: null,\n});\n\nexport const useOnboardingContext = () => {\n const context = useContext(OnboardingContext);\n if (!context.formId || !context.onboardingBag) {\n throw new Error(\n 'useOnboardingContext must be used within a OnboardingContextProvider',\n );\n }\n\n return {\n formId: context.formId,\n onboardingBag: context.onboardingBag,\n } as const;\n};\n"],"mappings":"wCACA,OAAS,iBAAAA,EAAe,cAAAC,MAAkB,QAEnC,IAAMC,EAAoBC,EAG9B,CACD,OAAQ,OACR,cAAe,IACjB,CAAC,EAEYC,EAAuBC,EAAA,IAAM,CACxC,IAAMC,EAAUC,EAAWL,CAAiB,EAC5C,GAAI,CAACI,EAAQ,QAAU,CAACA,EAAQ,cAC9B,MAAM,IAAI,MACR,sEACF,EAGF,MAAO,CACL,OAAQA,EAAQ,OAChB,cAAeA,EAAQ,aACzB,CACF,EAZoC","names":["createContext","useContext","OnboardingContext","createContext","useOnboardingContext","__name","context","useContext"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={data:{version:7,schema:{additionalProperties:!1,allOf:[{if:{properties:{personal_email:{pattern:"^[a-zA-Z0-9 .]+$"}}},then:{properties:{personal_email:{"x-jsf-presentation":{statement:{title:"Please make sure to add the employee personal email so we can get in contact with the employee after the termination process takes effect.",inputType:"statement",severity:"warning"}}}}}},{if:{properties:{customer_informed_employee:{const:"yes"}},required:["customer_informed_employee"]},then:{properties:{customer_informed_employee_date:{type:"string"},customer_informed_employee_description:{type:"string"}},required:["customer_informed_employee_date","customer_informed_employee_description"]},else:{properties:{customer_informed_employee_date:!1,customer_informed_employee_description:!1}}},{if:{properties:{will_challenge_termination:{const:"yes"}},required:["will_challenge_termination"]},then:{properties:{will_challenge_termination_description:{type:"string"}},required:["will_challenge_termination_description"]},else:{properties:{will_challenge_termination_description:!1}}},{if:{properties:{agrees_to_pto_amount:{const:"no"}},required:["agrees_to_pto_amount"]},then:{properties:{agrees_to_pto_amount_notes:{type:"string"}},required:["agrees_to_pto_amount_notes"]},else:{properties:{agrees_to_pto_amount_notes:!1,timesheet_file:!1}}}],properties:{confidential:{description:"Confidential requests are visible only to you. Non-confidential requests are visible to all admins in your company.",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Is this request confidential?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio",statement:{title:"Please do not inform the employee of their termination until we review your request for legal risks. When we approve your request, you can inform the employee and we'll take it from there.",inputType:"statement",severity:"warning"}}},customer_informed_employee:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Have you informed the employee of the termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},customer_informed_employee_date:{description:"",format:"date",maxLength:255,title:"When the employee was told about the termination",type:["string","null"],"x-jsf-presentation":{inputType:"date"}},customer_informed_employee_description:{description:"",maxLength:1e3,title:"How did you share this information?",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},personal_email:{description:"",maxLength:255,title:"Employee's personal email",format:"email",type:"string","x-jsf-presentation":{inputType:"email"}},termination_reason:{title:"Termination reason",description:"Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.",type:"string",oneOf:[{const:"gross_misconduct",title:"Gross misconduct"},{const:"performance",title:"Performance"},{const:"workforce_reduction",title:"Workforce Reduction"},{const:"values",title:"Values"},{const:"compliance_issue",title:"Compliance issue"},{const:"incapacity_to_perform_inherent_duties",title:"Incapacity To perform inherent duties"},{const:"mutual_agreement",title:"Mutual agreement"},{const:"cancellation_before_start_date",title:"Decision to cancel hiring before the employee starts"},{const:"job_abandonment",title:"Job abandonment"},{const:"dissatisfaction_with_remote_service",title:"Dissatisfaction with EOR service"},{const:"end_of_fixed_term_contract_compliance_issue",title:"End of fixed-term contract"},{const:"other",title:"Other"}],"x-jsf-presentation":{inputType:"select"}},reason_description:{description:"",maxLength:1e3,title:"Termination reason details",type:"string","x-jsf-presentation":{inputType:"textarea"}},additional_comments:{description:"",maxLength:1e3,title:"Additional details regarding this termination process.",type:"string","x-jsf-presentation":{inputType:"textarea"}},termination_reason_files:{description:"Please upload any supporting documents regarding the termination reason.",title:"Termination reason files",type:"string","x-jsf-presentation":{inputType:"file",accept:".pdf",multiple:!0}},risk_assessment_reasons:{description:"",title:"This employee is...",type:"array",items:{anyOf:[{const:"sick_leave",title:"Currently on or recently returned from sick leave"},{const:"family_leave",title:"Currently on or recently returned from maternity, paternity, or other family leave"},{const:"pregnant_or_breastfeeding",title:"Pregnant or breastfeeding"},{const:"requested_medical_or_family_leave",title:"Requested medical or family leave"},{const:"disabled_or_health_condition",title:"Disabled or has a health condition"},{const:"member_of_union_or_works_council",title:"A member of a union or works council"},{const:"caring_responsibilities",title:"Caring responsibilities"},{const:"reported_concerns_with_workplace",title:"Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions"},{const:"none_of_these",title:"To the best of my knowledge, I am not aware of any of these"}]},"x-jsf-presentation":{inputType:"checkbox",direction:"column"}},will_challenge_termination:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Do you consider it is likely that the employee will challenge their termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},will_challenge_termination_description:{description:"",maxLength:1e3,title:"Please explain how the employee will challenge their termination",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},proposed_termination_date:{description:"",format:"date",maxLength:255,title:"Proposed termination date",type:"string","x-jsf-presentation":{inputType:"date"}},agrees_to_pto_amount:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Are these paid time off records correct?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},agrees_to_pto_amount_notes:{description:"Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.",maxLength:1e3,title:"Provide time off details",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},timesheet_file:{description:"Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.",title:"Timesheet document",type:["string","null"],"x-jsf-presentation":{inputType:"file",accept:".pdf"}},acknowledge_termination_procedure:{description:"",title:"I, {{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
var e={data:{version:7,schema:{additionalProperties:!1,allOf:[{if:{properties:{personal_email:{pattern:"^[a-zA-Z0-9 .]+$"}}},then:{properties:{personal_email:{"x-jsf-presentation":{statement:{title:"Please make sure to add the employee personal email so we can get in contact with the employee after the termination process takes effect.",inputType:"statement",severity:"warning"}}}}}},{if:{properties:{customer_informed_employee:{const:"yes"}},required:["customer_informed_employee"]},then:{properties:{customer_informed_employee_date:{type:"string"},customer_informed_employee_description:{type:"string"}},required:["customer_informed_employee_date","customer_informed_employee_description"]},else:{properties:{customer_informed_employee_date:!1,customer_informed_employee_description:!1}}},{if:{properties:{will_challenge_termination:{const:"yes"}},required:["will_challenge_termination"]},then:{properties:{will_challenge_termination_description:{type:"string"}},required:["will_challenge_termination_description"]},else:{properties:{will_challenge_termination_description:!1}}},{if:{properties:{agrees_to_pto_amount:{const:"no"}},required:["agrees_to_pto_amount"]},then:{properties:{agrees_to_pto_amount_notes:{type:"string"}},required:["agrees_to_pto_amount_notes"]},else:{properties:{agrees_to_pto_amount_notes:!1,timesheet_file:!1}}}],properties:{confidential:{description:"Confidential requests are visible only to you. Non-confidential requests are visible to all admins in your company.",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Is this request confidential?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio",statement:{title:"Please do not inform the employee of their termination until we review your request for legal risks. When we approve your request, you can inform the employee and we'll take it from there.",inputType:"statement",severity:"warning"}}},customer_informed_employee:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Have you informed the employee of the termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},customer_informed_employee_date:{description:"",format:"date",maxLength:255,title:"When the employee was told about the termination",type:["string","null"],"x-jsf-presentation":{inputType:"date"}},customer_informed_employee_description:{description:"",maxLength:1e3,title:"How did you share this information?",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},personal_email:{description:"",maxLength:255,title:"Employee's personal email",format:"email",type:"string","x-jsf-presentation":{inputType:"email"}},termination_reason:{title:"Termination reason",description:"Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.",type:"string",oneOf:[{const:"gross_misconduct",title:"Gross misconduct"},{const:"performance",title:"Performance"},{const:"workforce_reduction",title:"Workforce Reduction"},{const:"values",title:"Values"},{const:"compliance_issue",title:"Compliance issue"},{const:"incapacity_to_perform_inherent_duties",title:"Incapacity To perform inherent duties"},{const:"mutual_agreement",title:"Mutual agreement"},{const:"cancellation_before_start_date",title:"Decision to cancel hiring before the employee starts"},{const:"job_abandonment",title:"Job abandonment"},{const:"dissatisfaction_with_remote_service",title:"Dissatisfaction with EOR service"},{const:"end_of_fixed_term_contract_compliance_issue",title:"End of fixed-term contract"},{const:"other",title:"Other"}],"x-jsf-presentation":{inputType:"select"}},reason_description:{description:"",maxLength:1e3,title:"Termination reason details",type:"string","x-jsf-presentation":{inputType:"textarea"}},additional_comments:{description:"",maxLength:1e3,title:"Additional details regarding this termination process.",type:"string","x-jsf-presentation":{inputType:"textarea"}},termination_reason_files:{description:"Please upload any supporting documents regarding the termination reason.",title:"Termination reason files",type:"string","x-jsf-presentation":{inputType:"file",accept:".pdf",multiple:!0}},risk_assessment_reasons:{description:"",title:"This employee is...",type:"array",items:{anyOf:[{const:"sick_leave",title:"Currently on or recently returned from sick leave"},{const:"family_leave",title:"Currently on or recently returned from maternity, paternity, or other family leave"},{const:"pregnant_or_breastfeeding",title:"Pregnant or breastfeeding"},{const:"requested_medical_or_family_leave",title:"Requested medical or family leave"},{const:"disabled_or_health_condition",title:"Disabled or has a health condition"},{const:"member_of_union_or_works_council",title:"A member of a union or works council"},{const:"caring_responsibilities",title:"Caring responsibilities"},{const:"reported_concerns_with_workplace",title:"Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions"},{const:"none_of_these",title:"To the best of my knowledge, I am not aware of any of these"}]},"x-jsf-presentation":{inputType:"checkbox",direction:"column"}},will_challenge_termination:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Do you consider it is likely that the employee will challenge their termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},will_challenge_termination_description:{description:"",maxLength:1e3,title:"Please explain how the employee will challenge their termination",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},proposed_termination_date:{description:"",format:"date",maxLength:255,title:"Proposed termination date",type:"string","x-jsf-presentation":{inputType:"date"}},agrees_to_pto_amount:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Are these paid time off records correct?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},agrees_to_pto_amount_notes:{description:"Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.",maxLength:1e3,title:"Provide time off details",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},timesheet_file:{description:"Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.",title:"Timesheet document",type:["string","null"],"x-jsf-presentation":{inputType:"file",accept:".pdf"}},acknowledge_termination_procedure:{description:"",title:"I, {{requesterName}} have read and agree to the procedures as defined in the termination form.",type:"boolean","x-jsf-presentation":{direction:"column",inputType:"checkbox"}}},required:["confidential","customer_informed_employee","personal_email","termination_reason","reason_description","risk_assessment_reasons","will_challenge_termination","proposed_termination_date","agrees_to_pto_amount","acknowledge_termination_procedure"],type:"object","x-jsf-order":["is_confidential","customer_informed_employee","customer_informed_employee_date","customer_informed_employee_description","personal_email","termination_reason","reason_description","additional_comments","termination_reason_files","risk_assessment_reasons","will_challenge_termination","will_challenge_termination_description","proposed_termination_date","agrees_to_pto_amount","agrees_to_pto_amount_notes","timesheet_file","acknowledge_termination_procedure"]}}};export{e as a};
|
|
2
|
+
//# sourceMappingURL=chunk-WWANHPT7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flows/Termination/json-schemas/jsonSchema.ts"],"sourcesContent":["export const jsonSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n personal_email: {\n pattern: '^[a-zA-Z0-9 .]+$',\n },\n },\n },\n then: {\n properties: {\n personal_email: {\n 'x-jsf-presentation': {\n statement: {\n title:\n 'Please make sure to add the employee personal email so we can get in contact with the employee after the termination process takes effect.',\n inputType: 'statement',\n severity: 'warning',\n },\n },\n },\n },\n },\n },\n {\n if: {\n properties: {\n customer_informed_employee: {\n const: 'yes',\n },\n },\n required: ['customer_informed_employee'],\n },\n then: {\n properties: {\n customer_informed_employee_date: {\n type: 'string',\n },\n customer_informed_employee_description: {\n type: 'string',\n },\n },\n required: [\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n ],\n },\n else: {\n properties: {\n customer_informed_employee_date: false,\n customer_informed_employee_description: false,\n },\n },\n },\n {\n if: {\n properties: {\n will_challenge_termination: {\n const: 'yes',\n },\n },\n required: ['will_challenge_termination'],\n },\n then: {\n properties: {\n will_challenge_termination_description: {\n type: 'string',\n },\n },\n required: ['will_challenge_termination_description'],\n },\n else: {\n properties: {\n will_challenge_termination_description: false,\n },\n },\n },\n {\n if: {\n properties: {\n agrees_to_pto_amount: {\n const: 'no',\n },\n },\n required: ['agrees_to_pto_amount'],\n },\n then: {\n properties: {\n agrees_to_pto_amount_notes: {\n type: 'string',\n },\n },\n required: ['agrees_to_pto_amount_notes'],\n },\n else: {\n properties: {\n agrees_to_pto_amount_notes: false,\n timesheet_file: false,\n },\n },\n },\n ],\n properties: {\n confidential: {\n description:\n 'Confidential requests are visible only to you. Non-confidential requests are visible to all admins in your company.',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Is this request confidential?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n statement: {\n title:\n \"Please do not inform the employee of their termination until we review your request for legal risks. When we approve your request, you can inform the employee and we'll take it from there.\",\n inputType: 'statement',\n severity: 'warning',\n },\n },\n },\n customer_informed_employee: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Have you informed the employee of the termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n customer_informed_employee_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'When the employee was told about the termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n customer_informed_employee_description: {\n description: '',\n maxLength: 1000,\n title: 'How did you share this information?',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n personal_email: {\n description: '',\n maxLength: 255,\n title: \"Employee's personal email\",\n format: 'email',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'email',\n },\n },\n termination_reason: {\n title: 'Termination reason',\n description:\n 'Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.',\n type: 'string',\n oneOf: [\n {\n const: 'gross_misconduct',\n title: 'Gross misconduct',\n },\n {\n const: 'performance',\n title: 'Performance',\n },\n {\n const: 'workforce_reduction',\n title: 'Workforce Reduction',\n },\n {\n const: 'values',\n title: 'Values',\n },\n {\n const: 'compliance_issue',\n title: 'Compliance issue',\n },\n {\n const: 'incapacity_to_perform_inherent_duties',\n title: 'Incapacity To perform inherent duties',\n },\n {\n const: 'mutual_agreement',\n title: 'Mutual agreement',\n },\n {\n const: 'cancellation_before_start_date',\n title: 'Decision to cancel hiring before the employee starts',\n },\n {\n const: 'job_abandonment',\n title: 'Job abandonment',\n },\n {\n const: 'dissatisfaction_with_remote_service',\n title: 'Dissatisfaction with EOR service',\n },\n {\n const: 'end_of_fixed_term_contract_compliance_issue',\n title: 'End of fixed-term contract',\n },\n {\n const: 'other',\n title: 'Other',\n },\n ],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n reason_description: {\n description: '',\n maxLength: 1000,\n title: 'Termination reason details',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n additional_comments: {\n description: '',\n maxLength: 1000,\n title: 'Additional details regarding this termination process.',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n termination_reason_files: {\n description:\n 'Please upload any supporting documents regarding the termination reason.',\n title: 'Termination reason files',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n multiple: true,\n },\n },\n risk_assessment_reasons: {\n description: '',\n title: 'This employee is...',\n type: 'array',\n items: {\n anyOf: [\n {\n const: 'sick_leave',\n title: 'Currently on or recently returned from sick leave',\n },\n {\n const: 'family_leave',\n title:\n 'Currently on or recently returned from maternity, paternity, or other family leave',\n },\n {\n const: 'pregnant_or_breastfeeding',\n title: 'Pregnant or breastfeeding',\n },\n {\n const: 'requested_medical_or_family_leave',\n title: 'Requested medical or family leave',\n },\n {\n const: 'disabled_or_health_condition',\n title: 'Disabled or has a health condition',\n },\n {\n const: 'member_of_union_or_works_council',\n title: 'A member of a union or works council',\n },\n {\n const: 'caring_responsibilities',\n title: 'Caring responsibilities',\n },\n {\n const: 'reported_concerns_with_workplace',\n title:\n 'Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions',\n },\n {\n const: 'none_of_these',\n title:\n 'To the best of my knowledge, I am not aware of any of these',\n },\n ],\n },\n 'x-jsf-presentation': {\n inputType: 'checkbox',\n direction: 'column',\n },\n },\n will_challenge_termination: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title:\n 'Do you consider it is likely that the employee will challenge their termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n will_challenge_termination_description: {\n description: '',\n maxLength: 1000,\n title:\n 'Please explain how the employee will challenge their termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n proposed_termination_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'Proposed termination date',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n agrees_to_pto_amount: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Are these paid time off records correct?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n agrees_to_pto_amount_notes: {\n description:\n 'Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.',\n maxLength: 1000,\n title: 'Provide time off details',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n timesheet_file: {\n description:\n 'Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.',\n title: 'Timesheet document',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n },\n },\n acknowledge_termination_procedure: {\n description: '',\n title:\n 'I, {{username}} have read and agree to the procedures as defined in the termination form.',\n type: 'boolean',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'checkbox',\n },\n },\n },\n required: [\n 'confidential',\n 'customer_informed_employee',\n 'personal_email',\n 'termination_reason',\n 'reason_description',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'proposed_termination_date',\n 'agrees_to_pto_amount',\n 'acknowledge_termination_procedure',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'is_confidential',\n 'customer_informed_employee',\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n 'personal_email',\n 'termination_reason',\n 'reason_description',\n 'additional_comments',\n 'termination_reason_files',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'will_challenge_termination_description',\n 'proposed_termination_date',\n 'agrees_to_pto_amount',\n 'agrees_to_pto_amount_notes',\n 'timesheet_file',\n 'acknowledge_termination_procedure',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAAa,CACxB,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CACL,CACE,GAAI,CACF,WAAY,CACV,eAAgB,CACd,QAAS,kBACX,CACF,CACF,EACA,KAAM,CACJ,WAAY,CACV,eAAgB,CACd,qBAAsB,CACpB,UAAW,CACT,MACE,6IACF,UAAW,YACX,SAAU,SACZ,CACF,CACF,CACF,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,gCAAiC,CAC/B,KAAM,QACR,EACA,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CACR,kCACA,wCACF,CACF,EACA,KAAM,CACJ,WAAY,CACV,gCAAiC,GACjC,uCAAwC,EAC1C,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CAAC,wCAAwC,CACrD,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,EAC1C,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,qBAAsB,CACpB,MAAO,IACT,CACF,EACA,SAAU,CAAC,sBAAsB,CACnC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,CAC1B,KAAM,QACR,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,GAC5B,eAAgB,EAClB,CACF,CACF,CACF,EACA,WAAY,CACV,aAAc,CACZ,YACE,sHACF,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,gCACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,QACX,UAAW,CACT,MACE,+LACF,UAAW,YACX,SAAU,SACZ,CACF,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,qDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,gCAAiC,CAC/B,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,mDACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,MACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MAAO,sCACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,eAAgB,CACd,YAAa,GACb,UAAW,IACX,MAAO,4BACP,OAAQ,QACR,KAAM,SACN,qBAAsB,CACpB,UAAW,OACb,CACF,EACA,mBAAoB,CAClB,MAAO,qBACP,YACE,oGACF,KAAM,SACN,MAAO,CACL,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,cACP,MAAO,aACT,EACA,CACE,MAAO,sBACP,MAAO,qBACT,EACA,CACE,MAAO,SACP,MAAO,QACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,wCACP,MAAO,uCACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,iCACP,MAAO,sDACT,EACA,CACE,MAAO,kBACP,MAAO,iBACT,EACA,CACE,MAAO,sCACP,MAAO,kCACT,EACA,CACE,MAAO,8CACP,MAAO,4BACT,EACA,CACE,MAAO,QACP,MAAO,OACT,CACF,EACA,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,mBAAoB,CAClB,YAAa,GACb,UAAW,IACX,MAAO,6BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,oBAAqB,CACnB,YAAa,GACb,UAAW,IACX,MAAO,yDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,yBAA0B,CACxB,YACE,2EACF,MAAO,2BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,OACX,OAAQ,OACR,SAAU,EACZ,CACF,EACA,wBAAyB,CACvB,YAAa,GACb,MAAO,sBACP,KAAM,QACN,MAAO,CACL,MAAO,CACL,CACE,MAAO,aACP,MAAO,mDACT,EACA,CACE,MAAO,eACP,MACE,oFACJ,EACA,CACE,MAAO,4BACP,MAAO,2BACT,EACA,CACE,MAAO,oCACP,MAAO,mCACT,EACA,CACE,MAAO,+BACP,MAAO,oCACT,EACA,CACE,MAAO,mCACP,MAAO,sCACT,EACA,CACE,MAAO,0BACP,MAAO,yBACT,EACA,CACE,MAAO,mCACP,MACE,2LACJ,EACA,CACE,MAAO,gBACP,MACE,6DACJ,CACF,CACF,EACA,qBAAsB,CACpB,UAAW,WACX,UAAW,QACb,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MACE,mFACF,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MACE,mEACF,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,0BAA2B,CACzB,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,4BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,MACb,CACF,EACA,qBAAsB,CACpB,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,2CACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,2BAA4B,CAC1B,YACE,sIACF,UAAW,IACX,MAAO,2BACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,eAAgB,CACd,YACE,4HACF,MAAO,qBACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,OACX,OAAQ,MACV,CACF,EACA,kCAAmC,CACjC,YAAa,GACb,MACE,4FACF,KAAM,UACN,qBAAsB,CACpB,UAAW,SACX,UAAW,UACb,CACF,CACF,EACA,SAAU,CACR,eACA,6BACA,iBACA,qBACA,qBACA,0BACA,6BACA,4BACA,uBACA,mCACF,EACA,KAAM,SACN,cAAe,CACb,kBACA,6BACA,kCACA,yCACA,iBACA,qBACA,qBACA,sBACA,2BACA,0BACA,6BACA,yCACA,4BACA,uBACA,6BACA,iBACA,mCACF,CACF,CACF,CACF","names":["jsonSchema"]}
|
|
1
|
+
{"version":3,"sources":["../src/flows/Termination/json-schemas/jsonSchema.ts"],"sourcesContent":["export const jsonSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n personal_email: {\n pattern: '^[a-zA-Z0-9 .]+$',\n },\n },\n },\n then: {\n properties: {\n personal_email: {\n 'x-jsf-presentation': {\n statement: {\n title:\n 'Please make sure to add the employee personal email so we can get in contact with the employee after the termination process takes effect.',\n inputType: 'statement',\n severity: 'warning',\n },\n },\n },\n },\n },\n },\n {\n if: {\n properties: {\n customer_informed_employee: {\n const: 'yes',\n },\n },\n required: ['customer_informed_employee'],\n },\n then: {\n properties: {\n customer_informed_employee_date: {\n type: 'string',\n },\n customer_informed_employee_description: {\n type: 'string',\n },\n },\n required: [\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n ],\n },\n else: {\n properties: {\n customer_informed_employee_date: false,\n customer_informed_employee_description: false,\n },\n },\n },\n {\n if: {\n properties: {\n will_challenge_termination: {\n const: 'yes',\n },\n },\n required: ['will_challenge_termination'],\n },\n then: {\n properties: {\n will_challenge_termination_description: {\n type: 'string',\n },\n },\n required: ['will_challenge_termination_description'],\n },\n else: {\n properties: {\n will_challenge_termination_description: false,\n },\n },\n },\n {\n if: {\n properties: {\n agrees_to_pto_amount: {\n const: 'no',\n },\n },\n required: ['agrees_to_pto_amount'],\n },\n then: {\n properties: {\n agrees_to_pto_amount_notes: {\n type: 'string',\n },\n },\n required: ['agrees_to_pto_amount_notes'],\n },\n else: {\n properties: {\n agrees_to_pto_amount_notes: false,\n timesheet_file: false,\n },\n },\n },\n ],\n properties: {\n confidential: {\n description:\n 'Confidential requests are visible only to you. Non-confidential requests are visible to all admins in your company.',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Is this request confidential?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n statement: {\n title:\n \"Please do not inform the employee of their termination until we review your request for legal risks. When we approve your request, you can inform the employee and we'll take it from there.\",\n inputType: 'statement',\n severity: 'warning',\n },\n },\n },\n customer_informed_employee: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Have you informed the employee of the termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n customer_informed_employee_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'When the employee was told about the termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n customer_informed_employee_description: {\n description: '',\n maxLength: 1000,\n title: 'How did you share this information?',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n personal_email: {\n description: '',\n maxLength: 255,\n title: \"Employee's personal email\",\n format: 'email',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'email',\n },\n },\n termination_reason: {\n title: 'Termination reason',\n description:\n 'Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.',\n type: 'string',\n oneOf: [\n {\n const: 'gross_misconduct',\n title: 'Gross misconduct',\n },\n {\n const: 'performance',\n title: 'Performance',\n },\n {\n const: 'workforce_reduction',\n title: 'Workforce Reduction',\n },\n {\n const: 'values',\n title: 'Values',\n },\n {\n const: 'compliance_issue',\n title: 'Compliance issue',\n },\n {\n const: 'incapacity_to_perform_inherent_duties',\n title: 'Incapacity To perform inherent duties',\n },\n {\n const: 'mutual_agreement',\n title: 'Mutual agreement',\n },\n {\n const: 'cancellation_before_start_date',\n title: 'Decision to cancel hiring before the employee starts',\n },\n {\n const: 'job_abandonment',\n title: 'Job abandonment',\n },\n {\n const: 'dissatisfaction_with_remote_service',\n title: 'Dissatisfaction with EOR service',\n },\n {\n const: 'end_of_fixed_term_contract_compliance_issue',\n title: 'End of fixed-term contract',\n },\n {\n const: 'other',\n title: 'Other',\n },\n ],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n reason_description: {\n description: '',\n maxLength: 1000,\n title: 'Termination reason details',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n additional_comments: {\n description: '',\n maxLength: 1000,\n title: 'Additional details regarding this termination process.',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n termination_reason_files: {\n description:\n 'Please upload any supporting documents regarding the termination reason.',\n title: 'Termination reason files',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n multiple: true,\n },\n },\n risk_assessment_reasons: {\n description: '',\n title: 'This employee is...',\n type: 'array',\n items: {\n anyOf: [\n {\n const: 'sick_leave',\n title: 'Currently on or recently returned from sick leave',\n },\n {\n const: 'family_leave',\n title:\n 'Currently on or recently returned from maternity, paternity, or other family leave',\n },\n {\n const: 'pregnant_or_breastfeeding',\n title: 'Pregnant or breastfeeding',\n },\n {\n const: 'requested_medical_or_family_leave',\n title: 'Requested medical or family leave',\n },\n {\n const: 'disabled_or_health_condition',\n title: 'Disabled or has a health condition',\n },\n {\n const: 'member_of_union_or_works_council',\n title: 'A member of a union or works council',\n },\n {\n const: 'caring_responsibilities',\n title: 'Caring responsibilities',\n },\n {\n const: 'reported_concerns_with_workplace',\n title:\n 'Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions',\n },\n {\n const: 'none_of_these',\n title:\n 'To the best of my knowledge, I am not aware of any of these',\n },\n ],\n },\n 'x-jsf-presentation': {\n inputType: 'checkbox',\n direction: 'column',\n },\n },\n will_challenge_termination: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title:\n 'Do you consider it is likely that the employee will challenge their termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n will_challenge_termination_description: {\n description: '',\n maxLength: 1000,\n title:\n 'Please explain how the employee will challenge their termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n proposed_termination_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'Proposed termination date',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n agrees_to_pto_amount: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Are these paid time off records correct?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n agrees_to_pto_amount_notes: {\n description:\n 'Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.',\n maxLength: 1000,\n title: 'Provide time off details',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n timesheet_file: {\n description:\n 'Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.',\n title: 'Timesheet document',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n },\n },\n acknowledge_termination_procedure: {\n description: '',\n title:\n 'I, {{requesterName}} have read and agree to the procedures as defined in the termination form.',\n type: 'boolean',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'checkbox',\n },\n },\n },\n required: [\n 'confidential',\n 'customer_informed_employee',\n 'personal_email',\n 'termination_reason',\n 'reason_description',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'proposed_termination_date',\n 'agrees_to_pto_amount',\n 'acknowledge_termination_procedure',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'is_confidential',\n 'customer_informed_employee',\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n 'personal_email',\n 'termination_reason',\n 'reason_description',\n 'additional_comments',\n 'termination_reason_files',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'will_challenge_termination_description',\n 'proposed_termination_date',\n 'agrees_to_pto_amount',\n 'agrees_to_pto_amount_notes',\n 'timesheet_file',\n 'acknowledge_termination_procedure',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAAa,CACxB,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CACL,CACE,GAAI,CACF,WAAY,CACV,eAAgB,CACd,QAAS,kBACX,CACF,CACF,EACA,KAAM,CACJ,WAAY,CACV,eAAgB,CACd,qBAAsB,CACpB,UAAW,CACT,MACE,6IACF,UAAW,YACX,SAAU,SACZ,CACF,CACF,CACF,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,gCAAiC,CAC/B,KAAM,QACR,EACA,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CACR,kCACA,wCACF,CACF,EACA,KAAM,CACJ,WAAY,CACV,gCAAiC,GACjC,uCAAwC,EAC1C,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CAAC,wCAAwC,CACrD,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,EAC1C,CACF,CACF,EACA,CACE,GAAI,CACF,WAAY,CACV,qBAAsB,CACpB,MAAO,IACT,CACF,EACA,SAAU,CAAC,sBAAsB,CACnC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,CAC1B,KAAM,QACR,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,GAC5B,eAAgB,EAClB,CACF,CACF,CACF,EACA,WAAY,CACV,aAAc,CACZ,YACE,sHACF,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,gCACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,QACX,UAAW,CACT,MACE,+LACF,UAAW,YACX,SAAU,SACZ,CACF,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,qDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,gCAAiC,CAC/B,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,mDACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,MACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MAAO,sCACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,eAAgB,CACd,YAAa,GACb,UAAW,IACX,MAAO,4BACP,OAAQ,QACR,KAAM,SACN,qBAAsB,CACpB,UAAW,OACb,CACF,EACA,mBAAoB,CAClB,MAAO,qBACP,YACE,oGACF,KAAM,SACN,MAAO,CACL,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,cACP,MAAO,aACT,EACA,CACE,MAAO,sBACP,MAAO,qBACT,EACA,CACE,MAAO,SACP,MAAO,QACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,wCACP,MAAO,uCACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,iCACP,MAAO,sDACT,EACA,CACE,MAAO,kBACP,MAAO,iBACT,EACA,CACE,MAAO,sCACP,MAAO,kCACT,EACA,CACE,MAAO,8CACP,MAAO,4BACT,EACA,CACE,MAAO,QACP,MAAO,OACT,CACF,EACA,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,mBAAoB,CAClB,YAAa,GACb,UAAW,IACX,MAAO,6BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,oBAAqB,CACnB,YAAa,GACb,UAAW,IACX,MAAO,yDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,yBAA0B,CACxB,YACE,2EACF,MAAO,2BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,OACX,OAAQ,OACR,SAAU,EACZ,CACF,EACA,wBAAyB,CACvB,YAAa,GACb,MAAO,sBACP,KAAM,QACN,MAAO,CACL,MAAO,CACL,CACE,MAAO,aACP,MAAO,mDACT,EACA,CACE,MAAO,eACP,MACE,oFACJ,EACA,CACE,MAAO,4BACP,MAAO,2BACT,EACA,CACE,MAAO,oCACP,MAAO,mCACT,EACA,CACE,MAAO,+BACP,MAAO,oCACT,EACA,CACE,MAAO,mCACP,MAAO,sCACT,EACA,CACE,MAAO,0BACP,MAAO,yBACT,EACA,CACE,MAAO,mCACP,MACE,2LACJ,EACA,CACE,MAAO,gBACP,MACE,6DACJ,CACF,CACF,EACA,qBAAsB,CACpB,UAAW,WACX,UAAW,QACb,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MACE,mFACF,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MACE,mEACF,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,0BAA2B,CACzB,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,4BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,MACb,CACF,EACA,qBAAsB,CACpB,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,2CACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,2BAA4B,CAC1B,YACE,sIACF,UAAW,IACX,MAAO,2BACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,eAAgB,CACd,YACE,4HACF,MAAO,qBACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,OACX,OAAQ,MACV,CACF,EACA,kCAAmC,CACjC,YAAa,GACb,MACE,iGACF,KAAM,UACN,qBAAsB,CACpB,UAAW,SACX,UAAW,UACb,CACF,CACF,EACA,SAAU,CACR,eACA,6BACA,iBACA,qBACA,qBACA,0BACA,6BACA,4BACA,uBACA,mCACF,EACA,KAAM,SACN,cAAe,CACb,kBACA,6BACA,kCACA,yCACA,iBACA,qBACA,qBACA,sBACA,2BACA,0BACA,6BACA,yCACA,4BACA,uBACA,6BACA,iBACA,mCACF,CACF,CACF,CACF","names":["jsonSchema"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as S}from"./chunk-HSW5HMHH.js";import{a as F}from"./chunk-XFD3ULUF.js";import{a as h}from"./chunk-WWANHPT7.js";import{a as T}from"./chunk-FZ2HS6G7.js";import{b as V}from"./chunk-36UPHOJS.js";import{a as _}from"./chunk-JRQSZHUU.js";import{b as c}from"./chunk-FNMWKUNJ.js";import{a as y}from"./chunk-S56EWAS4.js";import{d as p}from"./chunk-WRDKLT4N.js";import{c as s}from"./chunk-XVOJ4RMC.js";import{a as e}from"./chunk-AYDF3IFZ.js";import{createHeadlessForm as P,modify as x}from"@remoteoss/json-schema-form";import{useMutation as A,useQuery as K}from"@tanstack/react-query";import L from"lodash/omitBy";import q from"lodash/isNull";import z from"lodash/omit";function R(o){return{confidential:"",customer_informed_employee:"",customer_informed_employee_date:"",customer_informed_employee_description:"",personal_email:"",termination_reason:void 0,reason_description:"",termination_reason_files:[],will_challenge_termination:"",will_challenge_termination_description:null,agrees_to_pto_amount:"",agrees_to_pto_amount_notes:null,acknowledge_termination_procedure:!1,additional_comments:"",proposed_termination_date:"",risk_assessment_reasons:[],timesheet_file:void 0,...o}}e(R,"buildInitialValues");var B=e(()=>{let{client:o}=p();return A({mutationFn:e(a=>c({client:o,headers:{Authorization:""},body:a}),"mutationFn")})},"useCreateTermination"),I=e(({formValues:o,jsfModify:a,step:m})=>K({queryKey:["rmt-flows-termination-schema",m],queryFn:e(()=>S[m]??F,"queryFn"),select:e(({data:u})=>{let{schema:i}=x(u.schema,a||{});return P(i||{},{initialValues:o||{}})},"select")}),"useTerminationSchema"),ue=e(({employmentId:o,options:a})=>{let{fieldValues:m,setFieldValues:u,stepState:i,previousStep:d,nextStep:g}=y(T),k={...i.values?.[i.currentStep.name],...m},{data:r,isLoading:w}=I({formValues:k,jsfModify:a?.jsfModify,step:i.currentStep.name}),l=P(h.data.schema),f=B(),{mutateAsync:b}=_(f);async function C(n){if(!o)throw new Error("Employment id is missing");if(r){let t=s(n,l.fields,{isPartialValidation:!0}),{customer_informed_employee:j}=t,D=j==="yes"?{employee_awareness:{date:t.customer_informed_employee_date,note:t.customer_informed_employee_description}}:void 0,H=V(t,["agrees_to_pto_amount","confidential","customer_informed_employee","will_challenge_termination"]),J=z(H,"customer_informed_employee_date","customer_informed_employee_description"),O=L({...J,...D},q);return b({employment_id:o,termination_details:O,type:"termination"})}}e(C,"onSubmit");function M(){d()}e(M,"back");function v(){g()}e(v,"next");let E=R({...i.values?.employee_communication,...i.values?.termination_details,...i.values?.paid_time_off,...i.values?.additional_information});return{employmentId:o,stepState:i,fields:r?.fields||[],isLoading:w,isSubmitting:f.isPending,initialValues:E,handleValidation:e(n=>{if(r){let t=s(n,r?.fields);return r?.handleValidation(t)}return null},"handleValidation"),checkFieldUpdates:e(n=>{if(l){let t=s(n,l?.fields,{isPartialValidation:!0});u(t)}},"checkFieldUpdates"),parseFormValues:e(n=>s(n,l.fields,{isPartialValidation:!0}),"parseFormValues"),onSubmit:C,back:M,next:v}},"useTermination");export{ue as a};
|
|
2
|
+
//# sourceMappingURL=chunk-XJMVWJZ4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Termination/hooks.ts"],"sourcesContent":["import {\n CreateOffboardingParams,\n postCreateOffboarding,\n TerminationDetailsParams,\n} from '@/src/client';\nimport { mutationToPromise } from '@/src/lib/mutations';\nimport { Client } from '@hey-api/client-fetch';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport omitBy from 'lodash/omitBy';\nimport isNull from 'lodash/isNull';\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { JSFModify } from '@/src/flows/CostCalculator/types';\nimport { TerminationFormValues } from '@/src/flows/Termination/types';\nimport { useClient } from '@/src/context';\nimport omit from 'lodash/omit';\nimport { parseFormRadioValues } from '@/src/flows/utils';\nimport { useStepState } from '@/src/flows/useStepState';\nimport { STEPS } from '@/src/flows/Termination/utils';\nimport { defaultSchema } from '@/src/flows/Termination/json-schemas/defaultSchema';\nimport { schema } from '@/src/flows/Termination/json-schemas/schema';\nimport { jsonSchema } from '@/src/flows/Termination/json-schemas/jsonSchema';\n\nfunction buildInitialValues(\n stepsInitialValues: Partial<TerminationFormValues>,\n): TerminationFormValues {\n const initialValues: TerminationFormValues = {\n confidential: '',\n customer_informed_employee: '',\n customer_informed_employee_date: '',\n customer_informed_employee_description: '',\n personal_email: '',\n termination_reason: undefined,\n reason_description: '',\n termination_reason_files: [],\n will_challenge_termination: '',\n will_challenge_termination_description: null,\n agrees_to_pto_amount: '',\n agrees_to_pto_amount_notes: null,\n acknowledge_termination_procedure: false,\n additional_comments: '',\n proposed_termination_date: '',\n risk_assessment_reasons: [],\n timesheet_file: undefined,\n ...stepsInitialValues,\n };\n\n return initialValues;\n}\n\nconst useCreateTermination = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateOffboardingParams) => {\n return postCreateOffboarding({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nconst useTerminationSchema = ({\n formValues,\n jsfModify,\n step,\n}: {\n formValues?: TerminationFormValues;\n jsfModify?: JSFModify;\n step?: string;\n}) => {\n return useQuery({\n queryKey: ['rmt-flows-termination-schema', step],\n queryFn: () => {\n return schema[step as keyof typeof schema] ?? defaultSchema;\n },\n select: ({ data }) => {\n const { schema } = modify(data.schema, jsfModify || {});\n const form = createHeadlessForm(schema || {}, {\n initialValues: formValues || {},\n });\n return form;\n },\n });\n};\n\ntype TerminationHookProps = {\n employmentId: string;\n options?: {\n jsfModify?: JSFModify;\n };\n};\n\nexport const useTermination = ({\n employmentId,\n options,\n}: TerminationHookProps) => {\n const { fieldValues, setFieldValues, stepState, previousStep, nextStep } =\n useStepState<keyof typeof STEPS, TerminationFormValues>(STEPS);\n\n const formValues = {\n ...stepState.values?.[stepState.currentStep.name as keyof typeof STEPS], // Restore values for the current step\n ...fieldValues,\n };\n\n const { data: terminationHeadlessForm, isLoading: isLoadingTermination } =\n useTerminationSchema({\n formValues: formValues,\n jsfModify: options?.jsfModify,\n step: stepState.currentStep.name,\n });\n\n const entireTerminationSchema = createHeadlessForm(jsonSchema.data.schema);\n\n const createTermination = useCreateTermination();\n const { mutateAsync } = mutationToPromise(createTermination);\n\n async function onSubmit(values: TerminationFormValues) {\n if (!employmentId) {\n throw new Error('Employment id is missing');\n }\n\n if (terminationHeadlessForm) {\n // this is a hack because I need to validate all form values with the entire schema\n const parsedValues = parseJSFToValidate(\n values,\n entireTerminationSchema.fields,\n { isPartialValidation: true },\n );\n\n const { customer_informed_employee: customerInformedEmployee } =\n parsedValues;\n\n const employeeAwareness =\n customerInformedEmployee === 'yes'\n ? {\n employee_awareness: {\n date: parsedValues.customer_informed_employee_date,\n note: parsedValues.customer_informed_employee_description,\n },\n }\n : undefined;\n\n const radioFieldKeys = [\n 'agrees_to_pto_amount',\n 'confidential',\n 'customer_informed_employee',\n 'will_challenge_termination',\n ];\n\n const parsedRadioValues = parseFormRadioValues(\n parsedValues,\n radioFieldKeys,\n );\n\n const normalizedValues = omit(\n parsedRadioValues,\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n );\n\n const terminationDetails: TerminationDetailsParams = omitBy(\n {\n ...normalizedValues,\n ...employeeAwareness,\n },\n isNull,\n ) as unknown as TerminationDetailsParams;\n\n const terminationPayload: CreateOffboardingParams = {\n employment_id: employmentId,\n termination_details: terminationDetails,\n type: 'termination',\n };\n\n return mutateAsync(terminationPayload);\n }\n\n return;\n }\n\n function back() {\n previousStep();\n }\n\n function next() {\n nextStep();\n }\n\n const initialValues = buildInitialValues({\n ...stepState.values?.employee_communication,\n ...stepState.values?.termination_details,\n ...stepState.values?.paid_time_off,\n ...stepState.values?.additional_information,\n });\n\n return {\n /**\n * Employment id passed useful to be used between components\n */\n employmentId,\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState,\n /**\n * Array of form fields from the contract amendment schema\n */\n fields: terminationHeadlessForm?.fields || [],\n /**\n * Loading state indicating if the termination schema is being fetched\n */\n isLoading: isLoadingTermination,\n /**\n * Loading state indicating if a contract amendment mutation is in progress\n */\n isSubmitting: createTermination.isPending,\n /**\n * Initial form values\n */\n initialValues: initialValues,\n /**\n * Function to validate form values against the contract amendment schema\n * @param values - Form values to validate\n * @returns Validation result or null if no schema is available\n */\n handleValidation: (values: TerminationFormValues) => {\n if (terminationHeadlessForm) {\n const parsedValues = parseJSFToValidate(\n values,\n terminationHeadlessForm?.fields,\n );\n return terminationHeadlessForm?.handleValidation(parsedValues);\n }\n return null;\n },\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: (values: Partial<TerminationFormValues>) => {\n if (entireTerminationSchema) {\n const parsedValues = parseJSFToValidate(\n values,\n entireTerminationSchema?.fields,\n { isPartialValidation: true },\n );\n setFieldValues(parsedValues as TerminationFormValues);\n }\n },\n /**\n * Function to parse form values before submission\n * @param values - Form values to parse\n * @returns Parsed form values\n */\n parseFormValues: (values: TerminationFormValues) => {\n return parseJSFToValidate(values, entireTerminationSchema.fields, {\n isPartialValidation: true,\n });\n },\n /**\n * Function to handle form submission\n * @param values - Form values to submit\n * @returns Promise resolving to the mutation result\n */\n onSubmit,\n\n /**\n * Function to handle going back to the previous step\n * @returns {void}\n */\n back,\n\n /**\n * Function to handle going to the next step\n * @returns {void}\n */\n next,\n };\n};\n"],"mappings":"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","names":["createHeadlessForm","modify","useMutation","useQuery","omitBy","isNull","omit","buildInitialValues","stepsInitialValues","__name","useCreateTermination","client","useClient","useMutation","payload","postCreateOffboarding","useTerminationSchema","formValues","jsfModify","step","useQuery","schema","defaultSchema","data","modify","createHeadlessForm","useTermination","employmentId","options","fieldValues","setFieldValues","stepState","previousStep","nextStep","useStepState","STEPS","terminationHeadlessForm","isLoadingTermination","entireTerminationSchema","jsonSchema","createTermination","mutateAsync","mutationToPromise","onSubmit","values","parsedValues","parseJSFToValidate","customerInformedEmployee","employeeAwareness","parsedRadioValues","parseFormRadioValues","normalizedValues","omit","terminationDetails","omitBy","isNull","back","next","initialValues"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as o}from"./chunk-56BNVYTD.js";import{b as n}from"./chunk-6HGUGIYJ.js";import{a as t}from"./chunk-AYDF3IFZ.js";import i from"react";function B({children:r,...e}){let{formId:m}=n();return i.createElement(o,{...e,form:m},r)}t(B,"ContractAmendmentSubmit");export{B as a};
|
|
2
|
+
//# sourceMappingURL=chunk-XLFHHYVS.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e}from"./chunk-XJMVWJZ4.js";import{a}from"./chunk-YDUUQU4R.js";import{a as f}from"./chunk-GPICG72A.js";import{a as r}from"./chunk-YOC3VDC7.js";import{a as p}from"./chunk-RRFSGYAC.js";import{a as m}from"./chunk-KSGPQCSG.js";import{a as n}from"./chunk-2KK5HDYP.js";import{a as T}from"./chunk-JWIYUQ5X.js";import{a as t}from"./chunk-DZYFSFZ7.js";import{a as i}from"./chunk-AYDF3IFZ.js";import c,{useId as u}from"react";var k=i(({employmentId:d,render:s,options:l})=>{let y=u(),o=e({employmentId:d,options:l});return c.createElement(t.Provider,{value:{formId:y,terminationBag:o}},s({terminationBag:o,components:{SubmitButton:m,TimeOff:n,Back:r,EmployeeComunicationStep:a,TerminationDetailsStep:p,PaidTimeOffStep:f,AdditionalDetailsStep:T}}))},"TerminationFlow");export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-XQ6WWP6K.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Termination/TerminationFlow.tsx"],"sourcesContent":["import { TerminationContext } from '@/src/flows/Termination/context';\nimport React, { useId } from 'react';\nimport { useTermination } from '@/src/flows/Termination/hooks';\nimport { JSFModify } from '@/src/flows/CostCalculator/types';\nimport { TerminationSubmit } from '@/src/flows/Termination/TerminationSubmit';\nimport { TimeOff } from '@/src/flows/Termination/TimeOff';\nimport { TerminationBack } from '@/src/flows/Termination/TerminationBack';\nimport { EmployeeCommunicationForm } from '@/src/flows/Termination/EmployeeComunicationForm';\nimport { TerminationDetailsForm } from '@/src/flows/Termination/TerminationDetailsForm';\nimport { PaidTimeOffForm } from '@/src/flows/Termination/PaidTimeOffForm';\nimport { AdditionalDetailsForm } from '@/src/flows/Termination/AdditionalDetailsForm';\n\nexport type TerminationRenderProps = {\n /**\n * The termination bag returned by the useTermination hook.\n * This bag contains all the methods and properties needed to handle the termination flow.\n * @see {@link useTermination}\n */\n terminationBag: ReturnType<typeof useTermination>;\n /**\n * The components used in the termination flow.\n * This includes different steps, submit button, back button and timeoff.\n * @see {@link TerminationSubmit}\n * @see {@link TimeOff}\n * @see {@link TerminationBack}\n * @see {@link EmployeeCommunicationForm}\n * @see {@link TerminationDetailsForm}\n * @see {@link PaidTimeOffForm}\n * @see {@link AdditionalDetailsForm}\n */\n components: {\n SubmitButton: typeof TerminationSubmit;\n TimeOff: typeof TimeOff;\n Back: typeof TerminationBack;\n EmployeeComunicationStep: typeof EmployeeCommunicationForm;\n TerminationDetailsStep: typeof TerminationDetailsForm;\n PaidTimeOffStep: typeof PaidTimeOffForm;\n AdditionalDetailsStep: typeof AdditionalDetailsForm;\n };\n};\n\ntype TerminationFlowProps = {\n employmentId: string;\n render: ({\n terminationBag,\n components,\n }: TerminationRenderProps) => React.ReactNode;\n options?: {\n jsfModify?: JSFModify;\n };\n};\n\nexport const TerminationFlow = ({\n employmentId,\n render,\n options,\n}: TerminationFlowProps) => {\n const formId = useId();\n const terminationBag = useTermination({ employmentId, options });\n\n return (\n <TerminationContext.Provider\n value={{\n formId: formId,\n terminationBag,\n }}\n >\n {render({\n terminationBag,\n components: {\n SubmitButton: TerminationSubmit,\n TimeOff: TimeOff,\n Back: TerminationBack,\n EmployeeComunicationStep: EmployeeCommunicationForm,\n TerminationDetailsStep: TerminationDetailsForm,\n PaidTimeOffStep: PaidTimeOffForm,\n AdditionalDetailsStep: AdditionalDetailsForm,\n },\n })}\n </TerminationContext.Provider>\n );\n};\n"],"mappings":"2YACA,OAAOA,GAAS,SAAAC,MAAa,QAmDtB,IAAMC,EAAkBC,EAAA,CAAC,CAC9B,aAAAC,EACA,OAAAC,EACA,QAAAC,CACF,IAA4B,CAC1B,IAAMC,EAASC,EAAM,EACfC,EAAiBC,EAAe,CAAE,aAAAN,EAAc,QAAAE,CAAQ,CAAC,EAE/D,OACEK,EAAA,cAACC,EAAmB,SAAnB,CACC,MAAO,CACL,OAAQL,EACR,eAAAE,CACF,GAECJ,EAAO,CACN,eAAAI,EACA,WAAY,CACV,aAAcI,EACd,QAASC,EACT,KAAMC,EACN,yBAA0BC,EAC1B,uBAAwBC,EACxB,gBAAiBC,EACjB,sBAAuBC,CACzB,CACF,CAAC,CACH,CAEJ,EA7B+B","names":["React","useId","TerminationFlow","__name","employmentId","render","options","formId","useId","terminationBag","useTermination","React","TerminationContext","TerminationSubmit","TimeOff","TerminationBack","EmployeeCommunicationForm","TerminationDetailsForm","PaidTimeOffForm","AdditionalDetailsForm"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={data:{version:7,schema:{additionalProperties:!1,allOf:[],properties:{acknowledge_termination_procedure:{description:"",title:"I, {{requesterName}} have read and agree to the procedures as defined in the termination form.",type:"boolean","x-jsf-presentation":{direction:"column",inputType:"checkbox"}}},required:["acknowledge_termination_procedure"],type:"object","x-jsf-order":["acknowledge_termination_procedure"]}}};export{e as a};
|
|
2
|
+
//# sourceMappingURL=chunk-XSHHMBMT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Termination/json-schemas/additionalInformation.ts"],"sourcesContent":["export const additionalInformationSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [],\n properties: {\n acknowledge_termination_procedure: {\n description: '',\n title:\n 'I, {{requesterName}} have read and agree to the procedures as defined in the termination form.',\n type: 'boolean',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'checkbox',\n },\n },\n },\n required: ['acknowledge_termination_procedure'],\n type: 'object',\n 'x-jsf-order': ['acknowledge_termination_procedure'],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAA8B,CACzC,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CAAC,EACR,WAAY,CACV,kCAAmC,CACjC,YAAa,GACb,MACE,iGACF,KAAM,UACN,qBAAsB,CACpB,UAAW,SACX,UAAW,UACb,CACF,CACF,EACA,SAAU,CAAC,mCAAmC,EAC9C,KAAM,SACN,cAAe,CAAC,mCAAmC,CACrD,CACF,CACF","names":["additionalInformationSchema"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as i}from"./chunk-AYDF3IFZ.js";import E from"lodash/get";var F={TEXT:"text",TEXTAREA:"textarea",NUMBER:"number",SELECT:"select",COUNTRIES:"countries",TEL:"tel",EMAIL:"email",MONEY:"money",DATE:"date",DATE_RANGE:"date-range",CURRENCIES:"currencies",TIME:"time"},I={CHECKBOX:"checkbox",ACK_CHECK:"ack-check"},l={FILE:"file",RADIO:"radio",RADIO_CARD:"radio-card",GROUP_ARRAY:"group-array",EXTRA:"extra",STATEMENT:"statement",HIDDEN:"hidden",FIELDSET:"fieldset",FIELDSET_FLAT:"fieldset-flat",WORK_SCHEDULE:"work-schedule",WORK_WEEK_SCHEDULE:"work-week-schedule",BENEFITS:"benefits",SIGNATURE:"signature",SELECT_MULTIPLE:"select-multiple",...F,...I};function b(e){return Math.round((e+Number.EPSILON)*100)/100}i(b,"round");function d(e){return parseFloat(e.replace(/,/g,""))}i(d,"convertToValidCost");function D(e){if(e==null||e===""||Number.isNaN(e)||Array.isArray(e)||typeof e=="boolean")return null;let n;return typeof e=="string"?n=d(e):n=e,b(n*100)}i(D,"convertToCents");function O(e){if(e==null||Number.isNaN(e))return null;let n;return typeof e=="string"?n=d(e||"0"):n=e,b(n/100)}i(O,"convertFromCents");var y=i(e=>Object.entries(e||{}).reduce((n,[a,t])=>(Array.isArray(t)?n[a]=t.map(r=>typeof r=="object"&&r!==null?y(r):typeof r=="string"?r.trim():r):typeof t=="object"&&t!==null?n[a]=y(t):n[a]=typeof t=="string"?t.trim():t,n),{}),"trimStringValues");function p(e){let n={};return Object.entries(e).forEach(([a,t])=>{Array.isArray(t)?n[a]=t.map(r=>typeof r=="object"&&r!==null?p(r):r===""?null:r):typeof t=="object"&&t!==null?n[a]=p(t):n[a]=t===""?null:t}),n}i(p,"convertEmptyStringsToNull");function T(e,n){let a={};return n.forEach(t=>{let r=t.name;if(!(!Object.prototype.hasOwnProperty.call(e,r)&&!(t.type===l.FIELDSET&&t.valueGroupingDisabled))){if(t.type===l.FIELDSET&&t.valueGroupingDisabled){Object.assign(a,T(e,t.fields));return}t.readOnly&&t.defaultValue?a[r]=t.defaultValue:a[r]=e[r]}}),a}i(T,"prefillReadOnlyFields");function V(e,n){return e.reduce((a,t)=>(t.type===l.FIELDSET&&t.valueGroupingDisabled?Object.assign(a,V(t.fields,n)):Object.prototype.hasOwnProperty.call(n,t.name)&&(a[t.name]=n[t.name]),a),{})}i(V,"extractFieldsetFieldsValues");var f={[l.COUNTRIES]:{transformValueFromAPI:i(e=>n=>{if(!e.multiple)return n??"";let a;return typeof n=="string"?a=n.split(","):a=n||[],a.map(r=>e.countries?.find?.(s=>"name"in s&&s.name===r)||{name:r})},"transformValueFromAPI"),transformValueToAPI:i(e=>n=>!e.multiple||typeof n=="string"?n:n.map(a=>typeof a=="string"?a:a.name),"transformValueToAPI"),transformValue:i(e=>{let n=i(a=>a?.name||a?.value||a?.label,"getCountryValue");return Array.isArray(e)?e.map(n):n(e)||""},"transformValue")},[l.NUMBER]:{transformValueToAPI:i(()=>e=>{let n=Number(e);return Number.isNaN(n)?e:n},"transformValueToAPI")},[l.MONEY]:{transformValueFromAPI:i(()=>e=>O(e)??"","transformValueFromAPI"),transformValueToAPI:i(()=>D,"transformValueToAPI")},[l.RADIO]:{transformValueToAPI:i(e=>n=>e.transformToBool?n==="yes":n,"transformValueToAPI")},[l.CHECKBOX]:{transformValueToAPI:i(e=>n=>n===void 0?!1:e.const&&n===!0?e.const:n,"transformValueToAPI")},[l.SELECT]:{transformValue:i(e=>Array.isArray(e)?e.map(n=>n.value):e?.value??"","transformValue")}};function m(e={},n){return n.filter(r=>e[r.name]||r.type===l.FIELDSET&&r.valueGroupingDisabled).reduce((r,s)=>{switch(s.type){case l.FIELDSET:{let o=s;if(o.valueGroupingDisabled){let u=V(o.fields,e);Object.assign(r,m(u,o.fields))}else r[s.name]=m(e[s.name],o.fields);break}case l.TEXTAREA:case l.TEXT:{r[s.name]=e[s.name].replace(/\0/g,"");break}case l.GROUP_ARRAY:{let o=s?.fields?.().map(c=>({...c,name:c.nameKey||""})),u=e[s.name]?.map(c=>m(c,o));r[s.name]=u;break}case l.EXTRA:{let o=s;if(o.includeValueToApi!==!1){let u=e[o.name],c=o?.transformValueToAPI||f[o.type]?.transformValueToAPI;if(c){r[o.name]=c(s)(u);break}r[o.name]=u;break}r[o.name]=void 0;break}default:{let o=e[s.name],u=s?.transformValueToAPI||f[s.type]?.transformValueToAPI;if(u){r[s.name]=u(s)(o);break}r[s.name]=o;break}}return s.forcedValue!==void 0&&(r[s.name]=s.forcedValue),r},{...e})}i(m,"parseFormValuesToAPI");function S(e,n){return e.visibilityCondition?e.visibilityCondition(n):typeof e.isVisible<"u"?!!e.isVisible:!0}i(S,"isFieldVisible");function A(e,n){return e.calculateDynamicProperties?{...e,...e.calculateDynamicProperties(n)||{}}:e}i(A,"applyFieldDynamicProperties");function g(e,n,a,t){let r={};return n.map(s=>A(s,e)).forEach(s=>{let o=s.name;t&&(o=o?`${t}.${s.name}`:t);let u=E(e,o);if(!(!S(s,e)&&!(a&&u))&&!s.meta?.ignoreValue)if(s.type==="fieldset"&&s.valueGroupingDisabled)Object.assign(r,g(e,s.fields,a,o));else if(Array.isArray(s.fields))r[s.name]=g(e,s.fields,a,o);else{if(u===void 0)return;r[s.name]=u}}),r}i(g,"excludeValuesInvisible");function P(e,n,a){let t=a?.keepInvisibleValues?e:g(e,n),r=m(t,n),s=y(r),o=p(s);return T(o,n)}i(P,"parseSubmitValues");function C(e,n,a={isPartialValidation:!1}){return P(e,n,{keepInvisibleValues:a?.isPartialValidation})}i(C,"parseJSFToValidate");function N(e){switch(e){case l.FILE:return;default:return""}}i(N,"getDefaultValueForType");function k(e,n){let a=E(e,n.name),t=n?.transformValueFromAPI||f[n.type]?.transformValueFromAPI;if(t)return t(n)(a);let r=typeof n.value=="function"?n.value(a,e):null,s=typeof n.value!="function"?n.value:null,o=n.checkboxValue===!0?a||!1:null,u=i(c=>c===""?void 0:c,"excludeString");return u(r)??u(a)??u(s)??u(n.default)??o??N(n.type)}i(k,"getInitialDefaultValue");function R(e,n,a){let t={},r=e.name;a&&(r=r?`${a}.${r}`:a);let s=e.fields;if(Array.isArray(s)){let o={};s.forEach(u=>{Object.assign(o,R(u,n,r))}),e.type===l.FIELDSET&&e.valueGroupingDisabled?Object.assign(t,o):t[e.name]=o}else t[e.name]=k(n,{...e,name:r});return t}i(R,"getInitialSubFieldValues");function x(e,n){let a={},t=n;return e.map(r=>A(r,t)).forEach(r=>{switch(r.type){case l.FIELDSET:{if(r.valueGroupingDisabled)Object.assign(a,x(r.fields,t));else{let s=R(r,t);Object.assign(a,s)}break}}}),a}i(x,"getInitialValues");export{D as a,O as b,C as c,x as d};
|
|
2
|
+
//# sourceMappingURL=chunk-XVOJ4RMC.js.map
|