@remoteoss/remote-flows 1.16.0 → 1.18.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/dist/CountryFieldDefault-KSVYDH5T.js +2 -0
- package/dist/DatePickerFieldDefault-TZEI446Y.js +2 -0
- package/dist/PDFPreviewDefault-HSSMYKV5.js +2 -0
- package/dist/RadioGroupFieldDefault-U44JTO4O.js +2 -0
- package/dist/chunk-2IA5ZHU4.js +6 -0
- package/dist/chunk-2IA5ZHU4.js.map +1 -0
- package/dist/{chunk-WEAO46EO.js → chunk-36MJ5ORQ.js} +2 -2
- package/dist/{chunk-YHROBX2M.js → chunk-3GYINB3B.js} +2 -2
- package/dist/{chunk-MLVB5MYU.js → chunk-545OW3ET.js} +2 -2
- package/dist/{chunk-JGJTFYHN.js → chunk-5BBQUGAN.js} +2 -2
- package/dist/{chunk-UMVMNUPH.js → chunk-5D4AKL3N.js} +2 -2
- package/dist/{chunk-EDLQ3JNY.js → chunk-5L2ELV4L.js} +2 -2
- package/dist/{chunk-R7BHA5RA.js → chunk-6P53J6DA.js} +2 -2
- package/dist/{chunk-A232PIG7.js → chunk-AK4FXJFO.js} +2 -2
- package/dist/{chunk-NAH5PAUK.js → chunk-BCO3C476.js} +2 -2
- package/dist/{chunk-VBQVXR4U.js → chunk-C6ND527K.js} +2 -2
- package/dist/{chunk-XHAJ544L.js → chunk-CPXEQRNG.js} +2 -2
- package/dist/{chunk-B7EJ2OAA.js → chunk-CUANSH3E.js} +2 -2
- package/dist/chunk-DAXHNASW.js +2 -0
- package/dist/chunk-DAXHNASW.js.map +1 -0
- package/dist/{chunk-AJIDQALB.js → chunk-DM5RRWPM.js} +2 -2
- package/dist/{chunk-PHPCCABU.js → chunk-EKJK34DS.js} +2 -2
- package/dist/{chunk-EWL6BSEP.js → chunk-EQVUP5ZR.js} +2 -2
- package/dist/{chunk-H3BUOBWO.js → chunk-FBWPGUBC.js} +2 -2
- package/dist/chunk-FHYOWPXB.js +2 -0
- package/dist/chunk-FHYOWPXB.js.map +1 -0
- package/dist/{chunk-UB6PYKNX.js → chunk-FJ6WBG3H.js} +2 -2
- package/dist/{chunk-BG66XH5L.js → chunk-FQHFTFUZ.js} +2 -2
- package/dist/chunk-GCBEPX4V.js +2 -0
- package/dist/chunk-GCBEPX4V.js.map +1 -0
- package/dist/{chunk-XNAFFHZH.js → chunk-GCVM3FO4.js} +2 -2
- package/dist/{chunk-7PWZAW7M.js → chunk-GDJP7TMP.js} +2 -2
- package/dist/{chunk-W4ECFBIA.js → chunk-I2NE5CCG.js} +2 -2
- package/dist/chunk-IHGCXP2X.js +2 -0
- package/dist/chunk-IHGCXP2X.js.map +1 -0
- package/dist/chunk-IZGJP7OI.js +2 -0
- package/dist/chunk-IZGJP7OI.js.map +1 -0
- package/dist/{chunk-ERSP6CZ3.js → chunk-J6HS3UVY.js} +2 -2
- package/dist/{chunk-IZGSVS3I.js → chunk-JPA3IMPE.js} +2 -2
- package/dist/chunk-K5S6JRYY.js +2 -0
- package/dist/chunk-K5S6JRYY.js.map +1 -0
- package/dist/{chunk-WEOIHTBU.js → chunk-L4P7572F.js} +2 -2
- package/dist/{chunk-AW7JELYX.js → chunk-M53HKCJ5.js} +2 -2
- package/dist/{chunk-DFAY4TWC.js → chunk-MCWXQT7A.js} +2 -2
- package/dist/{chunk-4UO7KLRK.js → chunk-N3Q636ZK.js} +2 -2
- package/dist/{chunk-62O3CKKH.js → chunk-NAGIFFJS.js} +2 -2
- package/dist/{chunk-FSK2DR6Z.js → chunk-NNW7S5AY.js} +2 -2
- package/dist/{chunk-YPUP5LNV.js → chunk-OHCA7HXR.js} +2 -2
- package/dist/{chunk-4N4MQECC.js → chunk-OXAEJWEQ.js} +2 -2
- package/dist/{chunk-TPGN6QTL.js → chunk-OZKZKV5C.js} +2 -2
- package/dist/{chunk-JI4CYPLW.js → chunk-PGVAOMQU.js} +2 -2
- package/dist/{chunk-LVXV3GHT.js → chunk-QGGPXNVY.js} +2 -2
- package/dist/{chunk-MHAY555P.js → chunk-QI6E2NJU.js} +2 -2
- package/dist/{chunk-3B6XXK5H.js → chunk-QNWTCGRD.js} +2 -2
- package/dist/{chunk-HOR3KPOZ.js → chunk-SAKDBD4P.js} +2 -2
- package/dist/chunk-SD3LBJUH.js +2 -0
- package/dist/{chunk-246D2A55.js.map → chunk-SD3LBJUH.js.map} +1 -1
- package/dist/{chunk-G7EVUAYE.js → chunk-SJ5IZCJP.js} +2 -2
- package/dist/{chunk-SLLDKJ7K.js → chunk-SNRZPCZ7.js} +2 -2
- package/dist/{chunk-HYYILYKU.js → chunk-T3GSGHZJ.js} +2 -2
- package/dist/chunk-TMWN4PEK.js +2 -0
- package/dist/chunk-TMWN4PEK.js.map +1 -0
- package/dist/{chunk-TVIUQXLE.js → chunk-UPJDLAKU.js} +2 -2
- package/dist/{chunk-OEXY56S2.js → chunk-URJI6IZB.js} +2 -2
- package/dist/chunk-URJI6IZB.js.map +1 -0
- package/dist/{chunk-BVFQ6LFD.js → chunk-V6LOIP27.js} +2 -2
- package/dist/{chunk-7WGZGAQY.js → chunk-V74BLD3D.js} +2 -2
- package/dist/{chunk-WO54IG4S.js → chunk-VKE3F6V7.js} +2 -2
- package/dist/{chunk-YWZHBXEI.js → chunk-WH6BDFVD.js} +2 -2
- package/dist/{chunk-37RMY44V.js → chunk-WOH5UQMK.js} +2 -2
- package/dist/chunk-WUFJP4GG.js +2 -0
- package/dist/chunk-WUFJP4GG.js.map +1 -0
- package/dist/{chunk-BGRX3DBF.js → chunk-X6ZOK7H5.js} +2 -2
- package/dist/{chunk-CARPUKT7.js → chunk-XFDNQDDA.js} +2 -2
- package/dist/{chunk-A7CLJBJI.js → chunk-XFGSO4WQ.js} +2 -2
- package/dist/chunk-XOK42FJS.js +2 -0
- package/dist/chunk-XOK42FJS.js.map +1 -0
- package/dist/{chunk-IF42CZJH.js → chunk-YRC6EEM3.js} +2 -2
- package/dist/{chunk-4EMAROPQ.js → chunk-ZTKZWB7I.js} +2 -2
- package/dist/chunk-ZVUQDK2E.js +2 -0
- package/dist/default-components.d.ts +2 -2
- package/dist/default-components.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +3 -3
- 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/context.d.ts +3 -3
- package/dist/flows/ContractAmendment/hooks.d.ts +3 -3
- package/dist/flows/ContractAmendment/hooks.js +1 -1
- package/dist/flows/ContractAmendment/index.d.ts +3 -3
- package/dist/flows/ContractAmendment/index.js +1 -1
- package/dist/flows/ContractAmendment/types.d.ts +2 -2
- package/dist/flows/ContractAmendment/utils.d.ts +2 -2
- package/dist/flows/ContractorOnboarding/ContractorOnboarding.d.ts +5 -6
- package/dist/flows/ContractorOnboarding/ContractorOnboarding.js +1 -1
- package/dist/flows/ContractorOnboarding/api.d.ts +9 -19
- package/dist/flows/ContractorOnboarding/api.js +1 -1
- package/dist/flows/ContractorOnboarding/components/BasicInformationStep.d.ts +4 -4
- package/dist/flows/ContractorOnboarding/components/BasicInformationStep.js +1 -1
- package/dist/flows/ContractorOnboarding/components/ContractDetailsStep.d.ts +5 -6
- package/dist/flows/ContractorOnboarding/components/ContractDetailsStep.js +1 -1
- package/dist/flows/ContractorOnboarding/components/ContractPreviewHeader.d.ts +2 -2
- package/dist/flows/ContractorOnboarding/components/ContractPreviewStatement.d.ts +2 -2
- package/dist/flows/ContractorOnboarding/components/ContractPreviewStep.d.ts +5 -6
- package/dist/flows/ContractorOnboarding/components/ContractPreviewStep.js +1 -1
- package/dist/flows/ContractorOnboarding/components/ContractorOnboardingForm.d.ts +5 -6
- package/dist/flows/ContractorOnboarding/components/ContractorOnboardingForm.js +1 -1
- package/dist/flows/ContractorOnboarding/components/EligibilityQuestionnaireStep.d.ts +5 -6
- package/dist/flows/ContractorOnboarding/components/EligibilityQuestionnaireStep.js +1 -1
- package/dist/flows/ContractorOnboarding/components/OnboardingInvite.d.ts +3 -3
- package/dist/flows/ContractorOnboarding/components/OnboardingInvite.js +1 -1
- package/dist/flows/ContractorOnboarding/components/PricingPlan.d.ts +5 -6
- package/dist/flows/ContractorOnboarding/components/PricingPlan.js +1 -1
- package/dist/flows/ContractorOnboarding/components/SelectCountryStep.d.ts +4 -4
- package/dist/flows/ContractorOnboarding/components/SelectCountryStep.js +1 -1
- package/dist/flows/ContractorOnboarding/context.d.ts +6 -11
- package/dist/flows/ContractorOnboarding/hooks.d.ts +5 -6
- package/dist/flows/ContractorOnboarding/hooks.js +1 -1
- package/dist/flows/ContractorOnboarding/index.d.ts +5 -6
- package/dist/flows/ContractorOnboarding/index.js +1 -1
- package/dist/flows/ContractorOnboarding/jsfModify.d.ts +5 -6
- package/dist/flows/ContractorOnboarding/jsfModify.js +1 -1
- package/dist/flows/ContractorOnboarding/types.d.ts +8 -9
- package/dist/flows/ContractorOnboarding/utils.d.ts +5 -5
- package/dist/flows/ContractorOnboarding/utils.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +3 -3
- package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +3 -3
- package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
- package/dist/flows/CostCalculator/EstimationResults/EstimationResults.d.ts +2 -2
- package/dist/flows/CostCalculator/EstimationResults/EstimationResults.js +1 -1
- package/dist/flows/CostCalculator/SummaryResults/SummaryResults.d.ts +2 -2
- package/dist/flows/CostCalculator/api.d.ts +2 -2
- package/dist/flows/CostCalculator/api.js +1 -1
- package/dist/flows/CostCalculator/components/SalaryField.d.ts +2 -2
- package/dist/flows/CostCalculator/components/SalaryField.js +1 -1
- package/dist/flows/CostCalculator/context.d.ts +3 -3
- package/dist/flows/CostCalculator/hooks.d.ts +3 -3
- package/dist/flows/CostCalculator/hooks.js +1 -1
- package/dist/flows/CostCalculator/index.d.ts +3 -3
- package/dist/flows/CostCalculator/index.js +1 -1
- package/dist/flows/CostCalculator/types.d.ts +2 -2
- package/dist/flows/CostCalculator/utils.d.ts +3 -3
- package/dist/flows/CostCalculator/utils.js +1 -1
- package/dist/flows/CreateCompany/CreateCompany.d.ts +4 -4
- package/dist/flows/CreateCompany/CreateCompany.js +1 -1
- package/dist/flows/CreateCompany/api.d.ts +2 -2
- package/dist/flows/CreateCompany/api.js +1 -1
- package/dist/flows/CreateCompany/components/AddressDetailsStep.d.ts +4 -4
- package/dist/flows/CreateCompany/components/AddressDetailsStep.js +1 -1
- package/dist/flows/CreateCompany/components/CompanyBasicInformationStep.d.ts +4 -4
- package/dist/flows/CreateCompany/components/CompanyBasicInformationStep.js +1 -1
- package/dist/flows/CreateCompany/components/CreateCompanyForm.d.ts +2 -2
- package/dist/flows/CreateCompany/components/CreateCompanyForm.js +1 -1
- package/dist/flows/CreateCompany/context.d.ts +4 -4
- package/dist/flows/CreateCompany/hooks.d.ts +4 -4
- package/dist/flows/CreateCompany/hooks.js +1 -1
- package/dist/flows/CreateCompany/index.d.ts +4 -4
- package/dist/flows/CreateCompany/index.js +1 -1
- package/dist/flows/CreateCompany/types.d.ts +4 -4
- package/dist/flows/Onboarding/OnboardingFlow.d.ts +4 -4
- package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
- package/dist/flows/Onboarding/api.d.ts +13 -5
- package/dist/flows/Onboarding/api.js +1 -1
- package/dist/flows/Onboarding/components/AnnualGrossSalary.d.ts +2 -2
- package/dist/flows/Onboarding/components/AnnualGrossSalary.js +1 -1
- package/dist/flows/Onboarding/components/BasicInformationStep.d.ts +4 -4
- package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
- package/dist/flows/Onboarding/components/BenefitsStep.d.ts +4 -4
- package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
- package/dist/flows/Onboarding/components/ContractDetailsStep.d.ts +4 -4
- package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
- package/dist/flows/Onboarding/components/OnboardingForm.d.ts +4 -4
- package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
- package/dist/flows/Onboarding/components/OnboardingInvite.d.ts +3 -3
- package/dist/flows/Onboarding/components/OnboardingInvite.js +1 -1
- package/dist/flows/Onboarding/components/ReviewStep.d.ts +4 -4
- package/dist/flows/Onboarding/components/ReviewStep.js +1 -1
- package/dist/flows/Onboarding/components/SaveDraftButton.d.ts +3 -3
- package/dist/flows/Onboarding/components/SelectCountryStep.d.ts +4 -4
- package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
- package/dist/flows/Onboarding/context.d.ts +5 -4
- package/dist/flows/Onboarding/hooks.d.ts +4 -4
- package/dist/flows/Onboarding/hooks.js +1 -1
- package/dist/flows/Onboarding/index.d.ts +4 -4
- package/dist/flows/Onboarding/index.js +1 -1
- package/dist/flows/Onboarding/types.d.ts +4 -4
- package/dist/flows/Onboarding/utils.d.ts +4 -4
- package/dist/flows/Termination/AdditionalDetailsForm.d.ts +4 -4
- package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
- package/dist/flows/Termination/EmployeeComunicationForm.d.ts +4 -4
- package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
- package/dist/flows/Termination/PaidTimeOffForm.d.ts +4 -4
- package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
- package/dist/flows/Termination/TerminationDetailsForm.d.ts +4 -4
- package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
- package/dist/flows/Termination/TerminationFlow.d.ts +4 -4
- package/dist/flows/Termination/TerminationFlow.js +1 -1
- package/dist/flows/Termination/TerminationForm.d.ts +4 -4
- package/dist/flows/Termination/TerminationForm.js +1 -1
- package/dist/flows/Termination/api.d.ts +5 -5
- package/dist/flows/Termination/api.js +1 -1
- package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInformationFees.js +1 -1
- package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOff.d.ts +6 -6
- package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOffContainer.d.ts +6 -6
- package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOffContainer.js +1 -1
- package/dist/flows/Termination/components/PaidTimeOff/types.d.ts +6 -6
- package/dist/flows/Termination/components/TerminationDialogInfoContent/TerminationDialogInfoContent.js +1 -1
- package/dist/flows/Termination/context.d.ts +4 -4
- package/dist/flows/Termination/hooks.d.ts +4 -4
- package/dist/flows/Termination/hooks.js +1 -1
- package/dist/flows/Termination/index.d.ts +6 -6
- package/dist/flows/Termination/index.js +1 -1
- package/dist/flows/Termination/json-schemas/jsonSchema.js +1 -1
- package/dist/flows/Termination/json-schemas/schema.d.ts +4 -4
- package/dist/flows/Termination/json-schemas/schema.js +1 -1
- package/dist/flows/Termination/types.d.ts +4 -4
- package/dist/flows/Termination/utils.d.ts +4 -4
- package/dist/flows/types.d.ts +2 -2
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +11 -12
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/internals.d.ts +3 -3
- package/dist/internals.js +1 -1
- package/dist/{mutations-DfpgjZty.d.ts → mutations-C70g1hf2.d.ts} +1 -1
- package/dist/{remoteFlows-PN8ksydr.d.ts → remoteFlows-S2ZmIMR3.d.ts} +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/dist/{types-BxoBKn3U.d.ts → types-Bt3Nvzma.d.ts} +1 -1
- package/dist/{types-D9-E_Ywz.d.ts → types-DAJZFuKz.d.ts} +12 -15
- package/dist/{types-BOd-0F3b.d.ts → types-DP9U0M1b.d.ts} +3 -3
- package/dist/{types-BK2JZJKy.d.ts → types-DXC7D8qf.d.ts} +8 -3
- package/dist/{types-kzU5HUpO.d.ts → types-Dq-2OENN.d.ts} +2 -2
- package/dist/{types.gen-COTll5I0.d.ts → types.gen-BSxAhJ_V.d.ts} +5 -1
- package/dist/{utils-CfntV90o.d.ts → utils-BaHnOWNw.d.ts} +1 -1
- package/package.json +1 -6
- package/dist/CountryFieldDefault-JZDE75HS.js +0 -2
- package/dist/DatePickerFieldDefault-LJV4QSEP.js +0 -2
- package/dist/PDFPreviewDefault-RJNE7QSF.js +0 -2
- package/dist/RadioGroupFieldDefault-CXY33ONT.js +0 -2
- package/dist/chunk-246D2A55.js +0 -2
- package/dist/chunk-2NDVHQRP.js +0 -2
- package/dist/chunk-2NDVHQRP.js.map +0 -1
- package/dist/chunk-42R2H2DW.js +0 -2
- package/dist/chunk-7ENB7H4E.js +0 -6
- package/dist/chunk-7ENB7H4E.js.map +0 -1
- package/dist/chunk-E2LBPO5Z.js +0 -2
- package/dist/chunk-E2LBPO5Z.js.map +0 -1
- package/dist/chunk-E6256SK7.js +0 -2
- package/dist/chunk-E6256SK7.js.map +0 -1
- package/dist/chunk-FJVQQ4XB.js +0 -2
- package/dist/chunk-FJVQQ4XB.js.map +0 -1
- package/dist/chunk-FRCFJ64I.js +0 -2
- package/dist/chunk-FRCFJ64I.js.map +0 -1
- package/dist/chunk-HQAHUE5P.js +0 -2
- package/dist/chunk-HQAHUE5P.js.map +0 -1
- package/dist/chunk-OENTT2KT.js +0 -2
- package/dist/chunk-OENTT2KT.js.map +0 -1
- package/dist/chunk-OEXY56S2.js.map +0 -1
- package/dist/chunk-QECFSTI4.js +0 -2
- package/dist/chunk-QECFSTI4.js.map +0 -1
- package/dist/chunk-SLD227LM.js +0 -2
- package/dist/chunk-SLD227LM.js.map +0 -1
- package/dist/chunk-Z3EAYQ5D.js +0 -2
- package/dist/chunk-Z3EAYQ5D.js.map +0 -1
- package/dist/chunk-Z7WBY27D.js +0 -2
- package/dist/chunk-Z7WBY27D.js.map +0 -1
- package/dist/flows/ContractorOnboarding/components/ChooseAlternativePlanStep.d.ts +0 -29
- package/dist/flows/ContractorOnboarding/components/ChooseAlternativePlanStep.js +0 -2
- package/dist/flows/ContractorOnboarding/components/ChooseAlternativePlanStep.js.map +0 -1
- package/dist/flows/ContractorOnboarding/json-schemas/chooseAlternativePlanStep.d.ts +0 -23
- package/dist/flows/ContractorOnboarding/json-schemas/chooseAlternativePlanStep.js +0 -2
- package/dist/flows/ContractorOnboarding/json-schemas/chooseAlternativePlanStep.js.map +0 -1
- /package/dist/{CountryFieldDefault-JZDE75HS.js.map → CountryFieldDefault-KSVYDH5T.js.map} +0 -0
- /package/dist/{DatePickerFieldDefault-LJV4QSEP.js.map → DatePickerFieldDefault-TZEI446Y.js.map} +0 -0
- /package/dist/{PDFPreviewDefault-RJNE7QSF.js.map → PDFPreviewDefault-HSSMYKV5.js.map} +0 -0
- /package/dist/{RadioGroupFieldDefault-CXY33ONT.js.map → RadioGroupFieldDefault-U44JTO4O.js.map} +0 -0
- /package/dist/{chunk-WEAO46EO.js.map → chunk-36MJ5ORQ.js.map} +0 -0
- /package/dist/{chunk-YHROBX2M.js.map → chunk-3GYINB3B.js.map} +0 -0
- /package/dist/{chunk-MLVB5MYU.js.map → chunk-545OW3ET.js.map} +0 -0
- /package/dist/{chunk-JGJTFYHN.js.map → chunk-5BBQUGAN.js.map} +0 -0
- /package/dist/{chunk-UMVMNUPH.js.map → chunk-5D4AKL3N.js.map} +0 -0
- /package/dist/{chunk-EDLQ3JNY.js.map → chunk-5L2ELV4L.js.map} +0 -0
- /package/dist/{chunk-R7BHA5RA.js.map → chunk-6P53J6DA.js.map} +0 -0
- /package/dist/{chunk-A232PIG7.js.map → chunk-AK4FXJFO.js.map} +0 -0
- /package/dist/{chunk-NAH5PAUK.js.map → chunk-BCO3C476.js.map} +0 -0
- /package/dist/{chunk-VBQVXR4U.js.map → chunk-C6ND527K.js.map} +0 -0
- /package/dist/{chunk-XHAJ544L.js.map → chunk-CPXEQRNG.js.map} +0 -0
- /package/dist/{chunk-B7EJ2OAA.js.map → chunk-CUANSH3E.js.map} +0 -0
- /package/dist/{chunk-AJIDQALB.js.map → chunk-DM5RRWPM.js.map} +0 -0
- /package/dist/{chunk-PHPCCABU.js.map → chunk-EKJK34DS.js.map} +0 -0
- /package/dist/{chunk-EWL6BSEP.js.map → chunk-EQVUP5ZR.js.map} +0 -0
- /package/dist/{chunk-H3BUOBWO.js.map → chunk-FBWPGUBC.js.map} +0 -0
- /package/dist/{chunk-UB6PYKNX.js.map → chunk-FJ6WBG3H.js.map} +0 -0
- /package/dist/{chunk-BG66XH5L.js.map → chunk-FQHFTFUZ.js.map} +0 -0
- /package/dist/{chunk-XNAFFHZH.js.map → chunk-GCVM3FO4.js.map} +0 -0
- /package/dist/{chunk-7PWZAW7M.js.map → chunk-GDJP7TMP.js.map} +0 -0
- /package/dist/{chunk-W4ECFBIA.js.map → chunk-I2NE5CCG.js.map} +0 -0
- /package/dist/{chunk-ERSP6CZ3.js.map → chunk-J6HS3UVY.js.map} +0 -0
- /package/dist/{chunk-IZGSVS3I.js.map → chunk-JPA3IMPE.js.map} +0 -0
- /package/dist/{chunk-WEOIHTBU.js.map → chunk-L4P7572F.js.map} +0 -0
- /package/dist/{chunk-AW7JELYX.js.map → chunk-M53HKCJ5.js.map} +0 -0
- /package/dist/{chunk-DFAY4TWC.js.map → chunk-MCWXQT7A.js.map} +0 -0
- /package/dist/{chunk-4UO7KLRK.js.map → chunk-N3Q636ZK.js.map} +0 -0
- /package/dist/{chunk-62O3CKKH.js.map → chunk-NAGIFFJS.js.map} +0 -0
- /package/dist/{chunk-FSK2DR6Z.js.map → chunk-NNW7S5AY.js.map} +0 -0
- /package/dist/{chunk-YPUP5LNV.js.map → chunk-OHCA7HXR.js.map} +0 -0
- /package/dist/{chunk-4N4MQECC.js.map → chunk-OXAEJWEQ.js.map} +0 -0
- /package/dist/{chunk-TPGN6QTL.js.map → chunk-OZKZKV5C.js.map} +0 -0
- /package/dist/{chunk-JI4CYPLW.js.map → chunk-PGVAOMQU.js.map} +0 -0
- /package/dist/{chunk-LVXV3GHT.js.map → chunk-QGGPXNVY.js.map} +0 -0
- /package/dist/{chunk-MHAY555P.js.map → chunk-QI6E2NJU.js.map} +0 -0
- /package/dist/{chunk-3B6XXK5H.js.map → chunk-QNWTCGRD.js.map} +0 -0
- /package/dist/{chunk-HOR3KPOZ.js.map → chunk-SAKDBD4P.js.map} +0 -0
- /package/dist/{chunk-G7EVUAYE.js.map → chunk-SJ5IZCJP.js.map} +0 -0
- /package/dist/{chunk-SLLDKJ7K.js.map → chunk-SNRZPCZ7.js.map} +0 -0
- /package/dist/{chunk-HYYILYKU.js.map → chunk-T3GSGHZJ.js.map} +0 -0
- /package/dist/{chunk-TVIUQXLE.js.map → chunk-UPJDLAKU.js.map} +0 -0
- /package/dist/{chunk-BVFQ6LFD.js.map → chunk-V6LOIP27.js.map} +0 -0
- /package/dist/{chunk-7WGZGAQY.js.map → chunk-V74BLD3D.js.map} +0 -0
- /package/dist/{chunk-WO54IG4S.js.map → chunk-VKE3F6V7.js.map} +0 -0
- /package/dist/{chunk-YWZHBXEI.js.map → chunk-WH6BDFVD.js.map} +0 -0
- /package/dist/{chunk-37RMY44V.js.map → chunk-WOH5UQMK.js.map} +0 -0
- /package/dist/{chunk-BGRX3DBF.js.map → chunk-X6ZOK7H5.js.map} +0 -0
- /package/dist/{chunk-CARPUKT7.js.map → chunk-XFDNQDDA.js.map} +0 -0
- /package/dist/{chunk-A7CLJBJI.js.map → chunk-XFGSO4WQ.js.map} +0 -0
- /package/dist/{chunk-IF42CZJH.js.map → chunk-YRC6EEM3.js.map} +0 -0
- /package/dist/{chunk-4EMAROPQ.js.map → chunk-ZTKZWB7I.js.map} +0 -0
- /package/dist/{chunk-42R2H2DW.js.map → chunk-ZVUQDK2E.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{f as jt,h as Qt,i as Jt}from"./chunk-WUFJP4GG.js";import{a as Ut,b as Ht,c as zt,d as Xt,e as Yt,f as Zt,h as te,i as ee,j as ie,k as ne,l as oe,m as re,n as ae,o as se,p as ce,q as le,r as ue,s as de,t as me}from"./chunk-DAXHNASW.js";import{a as pe,b as fe,c as ye}from"./chunk-VKE3F6V7.js";import{a as Kt,b as Gt,f as $t,g as Wt}from"./chunk-IZGJP7OI.js";import{a as G,b as it,c as b,d as Nt}from"./chunk-LHEF2FN7.js";import{a as kt}from"./chunk-PGVAOMQU.js";import{a as Bt,e as p,f as M}from"./chunk-T7O3YYOG.js";import{L as Rt}from"./chunk-2IA5ZHU4.js";import{h as P,i as V}from"./chunk-VIGKOVHP.js";import{a as g}from"./chunk-X6ZAR7ZL.js";import{a as xt}from"./chunk-TSPDJUGG.js";import{d as At}from"./chunk-KQPDXXG3.js";import{a as d}from"./chunk-P37U34EQ.js";import{useEffect as q,useMemo as o,useRef as pi,useState as O}from"react";import ge from"lodash.omit";import{useQuery as di}from"@tanstack/react-query";var mi=d(()=>{let{client:L}=At(),{data:I}=Ht(),a=zt(I)?I?.company?.id??"":"";return di({queryKey:["legal-entities",a],queryFn:d(()=>Rt({client:L,path:{company_id:a}}),"queryFn"),select:d($=>$.data?.data?.legal_entities,"select"),enabled:!!a})},"useLegalEntities"),_e=d(()=>{let{data:L}=mi();return L?.find(I=>I.is_default)},"useDefaultLegalEntity");var fi={select_country:null,basic_information:"employment_basic_information",contract_details:null,eligibility_questionnaire:null,pricing_plan:null,contract_preview:null,review:null},yi={employment_basic_information:"basic_information"},Ji=d(({countryCode:L,externalId:I,employmentId:a,skipSteps:$,options:_,initialValues:u})=>{let be=_?.excludeProducts||[],[c,mt]=O(L||null),[s,Se]=O(a),[h,pt]=O(void 0),W=pi({select_country:{},basic_information:{},contract_details:{},contract_preview:{},pricing_plan:{},eligibility_questionnaire:{}}),[H,Ce]=O(void 0),[ft,z]=O(!1),[yt,we]=O(!0),[nt,_t]=O(null),{steps:Pe,stepsArray:he}=o(()=>Kt({includeSelectCountry:!$?.includes("select_country"),includeEligibilityQuestionnaire:ft,includeContractPreview:yt}),[ft,yt,$]),{fieldValues:l,stepState:e,setFieldValues:Fe,previousStep:Ee,nextStep:ve,goToStep:R,setStepValues:gt}=xt(Pe);q(()=>{nt&&(R(nt),_t(null))},[nt,R]);let{data:r,isLoading:Ve,refetch:bt}=kt({employmentId:s,queryParams:{exclude_files:!0}}),Me=_e(),{status:D}=r||{},S=D&&$t.includes(D),Oe=D&&!Wt.includes(D),Ie=o(()=>D==="invited"?"invited":"not_invited",[D]),St=Qt(),Ct=Jt(c,_),ot=ee(),wt=Ut(),{mutateAsync:Pt}=oe(ot,wt,l),ht=ce(),Ft=le(),{mutateAsyncOrThrow:De}=g(Ct),Et=Yt(),vt=te(),Vt=ue(),{mutateAsyncOrThrow:Te}=g(St),{mutateAsyncOrThrow:qe}=g(ot),{mutateAsyncOrThrow:Le}=g(Et),{mutateAsyncOrThrow:Mt}=g(vt),{mutateAsyncOrThrow:Re}=g(ht),{mutateAsyncOrThrow:Ae}=g(Ft),{mutateAsyncOrThrow:Be}=g(Vt);a&&r?.country?.code&&!c&&mt(r.country.code);let{selectCountryForm:X,isLoading:je,countries:Ot}=de({jsfModify:_?.jsfModify?.select_country}),rt=o(()=>Ot?.find(t=>t.value===c),[Ot,c]),Qe=o(()=>rt?.label,[rt]),Je=e.currentStep.name==="pricing_plan"||!!a&&S,{form:F,isLoading:ke,contractorSubscriptions:Y,refetch:at,isEligibilityQuestionnaireBlocked:A}=ne(s,rt,{jsonSchemaVersion:_?.jsonSchemaVersion,queryOptions:{enabled:Je},excludeProducts:be,jsfModify:_?.jsfModify?.pricing_plan}),T=o(()=>!!Y?.find(t=>t.product.short_name==="COR")?.eligibility_questionnaire?.submitted_at,[Y]);q(()=>{if(T){z(!1);return}else z(H===b)},[T,H]),q(()=>{let t=r?.contractor_type==="cor";we(!t)},[r?.contractor_type]);let Z=o(()=>Y?.find(t=>t.product.short_name==="COR")?.eligibility_questionnaire?.responses,[Y]),xe=fi[e.currentStep.name]||"contractor_basic_information",Ne=yi[xe],Ue=r?.[Ne]||{},Ke=d(({form:t,options:n={},query:m={}})=>{let y=Object.keys(l).length>0?{...u,...e.values?.[e.currentStep.name],...l}:{...u,...Ue};return jt({countryCode:c,form:t,fieldValues:y,query:m,options:{...n,queryOptions:{enabled:n.queryOptions?.enabled??!0}}})},"useJSONSchema"),Ge=!!(c&&(e.currentStep.name==="basic_information"||a)),$e=!!(c==="GBR"&&a&&e.currentStep.name==="basic_information"),{data:B,isLoading:We}=re(a,{enabled:$e}),{data:tt,isLoading:He}=ae(a,{enabled:!!a});q(()=>{tt&&tt.length>0&&!h&&pt(tt[0].id)},[tt,h]);let{data:C,isLoading:ze}=Ke({form:"contractor_basic_information",options:{jsfModify:fe(c,Qe,_),queryOptions:{enabled:Ge}}}),Xe=o(()=>Gt(r?.basic_information?.provisional_start_date,l?.service_duration?.provisional_start_date),[r?.basic_information?.provisional_start_date,l?.service_duration?.provisional_start_date]),f=o(()=>{let t={standard:G,plus:it,cor:b};if(l.subscription)return l.subscription;let n=e.values?.pricing_plan?.subscription;return n&&!A?n:T&&!A?b:A&&T?G:t[r?.contractor_type]||G},[l,e.values,T,r?.contractor_type,A]);q(()=>{f&&f!==H&&Ce(f)},[f,H]);let Ye=o(()=>({...Z,...u,...e.values?.eligibility_questionnaire,...l}),[Z,u,e.values?.eligibility_questionnaire,l]),Ze=o(()=>f===b&&e.currentStep.name==="eligibility_questionnaire"||!!a&&S&&f===b,[f,e.currentStep.name,a,S]),{data:E,isLoading:ti}=se({options:{queryOptions:{enabled:Ze},jsfModify:_?.jsfModify?.eligibility_questionnaire},fieldValues:Ye}),ei=!!(c&&e.currentStep.name==="contract_details"||S),{data:w,isLoading:ii}=me({countryCode:c,fieldValues:l,employmentId:s,options:{queryOptions:{enabled:ei},jsfModify:pe(_?.jsfModify?.contract_details,Xe,f,l)}}),ni=o(()=>e.currentStep.name==="contract_preview"||!!a&&S,[e.currentStep.name,a,S]),{data:v}=Xt({fieldValues:l,options:{queryOptions:{enabled:ni},jsfModify:ye(_,l)}}),{data:st,isLoading:oi}=Zt({employmentId:s,contractDocumentId:h,options:{queryOptions:{enabled:!!h}}}),i=o(()=>({select_country:X?.fields||[],basic_information:C?.fields||[],pricing_plan:F?.fields||[],eligibility_questionnaire:E?.fields||[],contract_details:w?.fields||[],contract_preview:v?.fields||[],review:[]}),[X?.fields,C?.fields,F?.fields,w?.fields,v?.fields,E?.fields]),ri={select_country:null,basic_information:C?.meta["x-jsf-fieldsets"],pricing_plan:null,contract_details:w?.meta["x-jsf-fieldsets"],eligibility_questionnaire:null,contract_preview:null,review:null},{country:ai,basic_information:et={},contract_details:It={}}=r||{},Dt=ai?.code,j=o(()=>M(i.select_country,{country:c||Dt||""}),[i.select_country,c,Dt]),ct=o(()=>B?.content?Bt(B.content,B.name):null,[B?.content,B?.name]),Q=o(()=>{let t={...u,...et,ir35:r?.contract_details?.ir_35,nationality_status:r?.contract_details?.nationality,...ct&&{ir35_sds_file:[ct]}};return M(i.basic_information,t)},[u,et,r?.contract_details?.ir_35,r?.contract_details?.nationality,ct,i.basic_information]),J=o(()=>{let n={...{service_duration:{provisional_start_date:et.provisional_start_date}},...u,...It};return M(i.contract_details,n)},[i.contract_details,It,u,et]),k=o(()=>{let t=st?.contract_document?.signatories?.find(m=>m.type==="company"),n={...u,signature:t?.signature};return M(i.contract_preview,n)},[i.contract_preview,u,st]),x=o(()=>{let n={...{subscription:f},...u};return M(i.pricing_plan,n)},[i.pricing_plan,u,f]),N=o(()=>{let t={...u,...Z};return M(i.eligibility_questionnaire,t)},[i.eligibility_questionnaire,u,Z]),si=o(()=>({select_country:j,basic_information:Q,contract_details:J,contract_preview:k,pricing_plan:x,eligibility_questionnaire:N}),[j,Q,J,k,x,N]),lt=!!(a&&S&&e.currentStep.name!=="review"),ut=je||ze||Ve||ii||ke||oi||We||He||ti,Tt=o(()=>{let n=r?.contractor_type==="cor"||i.contract_preview.length>0;return!!(lt&&!ut&&h&&i.basic_information.length>0&&i.contract_details.length>0&&n)},[lt,ut,h,i.basic_information.length,i.contract_details.length,i.contract_preview.length,r?.contractor_type]);q(()=>{Tt&&(W.current={select_country:P(j,i.select_country),basic_information:P(Q,i.basic_information),contract_details:P(J,i.contract_details),contract_preview:P(k,i.contract_preview),pricing_plan:P(x,i.pricing_plan),eligibility_questionnaire:P(N,i.eligibility_questionnaire)},gt({select_country:j,basic_information:Q,contract_details:J,contract_preview:k,pricing_plan:x,eligibility_questionnaire:N,review:{}}),R("review"))},[Tt,R,j,Q,J,gt,i.select_country,i.basic_information,i.contract_details,i.pricing_plan,x,i.contract_preview,k,i.eligibility_questionnaire,N]);let ci=d(t=>{R(t)},"goTo"),qt=d(async t=>X&&e.currentStep.name==="select_country"?t:C&&e.currentStep.name==="basic_information"?await p(t,C?.fields,{isPartialValidation:!1}):w&&e.currentStep.name==="contract_details"?await p(t,w?.fields,{isPartialValidation:!1}):v&&e.currentStep.name==="contract_preview"?await p(t,v?.fields,{isPartialValidation:!1}):F&&e.currentStep.name==="pricing_plan"?await p(t,F?.fields,{isPartialValidation:!1}):E&&e.currentStep.name==="eligibility_questionnaire"?await p(t,E?.fields,{isPartialValidation:!1}):{},"parseFormValues");async function li(t){let n=e.currentStep.name;n in W.current&&(W.current[n]=P(t,i[n]));let m=await qt(t);switch(e.currentStep.name){case"select_country":return mt(m.country),Promise.resolve({data:{countryCode:m.country}});case"basic_information":{let U=!s&&c,y=s&&c&&r?.country&&r?.country.code!==c;if(U||y){let ui={basic_information:ge(m,"nationality_status","ir35","ir35_sds_file"),type:"contractor",country_code:c,external_id:I},Lt=await Te(ui),dt=Lt?.data?.employment?.id;if(!dt)throw V("Employment ID not found");return await Pt({employmentId:dt}),Se(dt),Lt}else if(s){let K=ge(m,"nationality_status","ir35","ir35_sds_file");return await Pt({employmentId:s}),De({employmentId:s,basic_information:K})}return}case"contract_details":{let y=await qe({employmentId:s,payload:{contract_document:m}}),K=y?.data?.contract_document?.id;if(!K)throw V("Contract document ID not found");return pt(K),await bt(),y}case"contract_preview":return Le({employmentId:s,contractDocumentId:h,payload:{signature:m.signature}});case"pricing_plan":{if(A&&[b,it].includes(t.subscription))throw V(`This individual is not eligible for ${ie[t.subscription]}.`);if(t.subscription===Nt)return Promise.resolve({data:{subscription:t.subscription}});if(T&&t.subscription!==b)try{await Be({employmentId:s}),await at()}catch(y){if(y?.response?.status!==404)throw y;await at()}if(t.subscription==G)return Mt({employmentId:s,payload:{operation:"downgrade"}});if(t.subscription==it)return Mt({employmentId:s,payload:{operation:"upgrade"}});if(t.subscription==b)return Promise.resolve({data:{subscription:t.subscription}});throw V("invalid selection")}case"eligibility_questionnaire":try{if((await Re({employmentId:s,payload:m}))?.data?.is_blocking)throw z(!1),_t("pricing_plan"),V("This individual is not eligible for Contractor of Record.");return await Ae({employmentId:s})}finally{await at()}default:throw V("Invalid step state")}}return d(li,"onSubmit"),{isLoading:ut||lt,fieldValues:l,stepState:e,checkFieldUpdates:Fe,back:Ee,next:ve,goTo:ci,onSubmit:li,fields:i[e.currentStep.name],meta:{fields:W.current,fieldsets:ri[e.currentStep.name]},parseFormValues:qt,handleValidation:d(async t=>{if(e.currentStep.name==="select_country")return X.handleValidation(t);if(C&&e.currentStep.name==="basic_information"){let n=await p(t,C?.fields,{isPartialValidation:!1});return C?.handleValidation(n)}if(w&&e.currentStep.name==="contract_details"){let n=await p(t,w?.fields,{isPartialValidation:!1});return w?.handleValidation(n)}if(v&&e.currentStep.name==="contract_preview"){let n=await p(t,v?.fields,{isPartialValidation:!0});return v?.handleValidation(n)}if(F&&e.currentStep.name==="pricing_plan"){let n=await p(t,F?.fields,{isPartialValidation:!1});return F?.handleValidation(n)}if(E&&e.currentStep.name==="eligibility_questionnaire"){let n=await p(t,E?.fields,{isPartialValidation:!1});return E?.handleValidation(n)}return null},"handleValidation"),initialValues:si,employmentId:s,refetchEmployment:bt,isSubmitting:St.isPending||Ct.isPending||ot.isPending||Et.isPending||vt.isPending||wt.isPending||ht.isPending||Ft.isPending||Vt.isPending,documentPreviewPdf:st,canInvite:Oe,isEmploymentReadOnly:S,invitedStatus:Ie,employment:r,defaultLegalEntity:Me,steps:he}},"useContractorOnboarding");export{Ji as a};
|
|
2
|
+
//# sourceMappingURL=chunk-K5S6JRYY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/ContractorOnboarding/hooks.tsx","../src/common/api/legal-entities.ts"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\nimport { FieldValues } from 'react-hook-form';\nimport omit from 'lodash.omit';\nimport { $TSFixMe, JSFFields } from '@/src/types/remoteFlows';\nimport {\n CreateContractDocument,\n Employment,\n EmploymentCreateParams,\n} from '@/src/client/types.gen';\nimport {\n getInitialValues,\n parseJSFToValidate,\n} from '@/src/components/form/utils';\nimport { ValidationResult } from '@remoteoss/remote-json-schema-form-kit';\nimport {\n useCreateContractorContractDocument,\n useGetContractDocumentSignatureSchema,\n usePostManageContractorSubscriptions,\n useContractorSubscriptionSchemaField,\n useGetShowContractDocument,\n useSignContractDocument,\n useUpdateUKandSaudiFields,\n useGetIR35File,\n useGetContractDocuments,\n useGetEligibilityQuestionnaire,\n usePostCreateEligibilityQuestionnaire,\n usePostManageContractorCorSubscription,\n useDeleteContractorCorSubscription,\n useCountriesSchemaField,\n useContractorOnboardingDetailsSchemaWithCurrencies,\n CONTRACT_PRODUCT_TITLES,\n} from '@/src/flows/ContractorOnboarding/api';\nimport { ContractorOnboardingFlowProps } from '@/src/flows/ContractorOnboarding/types';\nimport {\n buildSteps,\n calculateProvisionalStartDateDescription,\n reviewStepAllowedEmploymentStatus,\n disabledInviteButtonEmploymentStatus,\n StepKeys,\n} from '@/src/flows/ContractorOnboarding/utils';\nimport {\n useCreateEmployment,\n useJSONSchemaForm,\n useUpdateEmployment,\n} from '@/src/flows/Onboarding/api';\nimport { FlowOptions, JSFModify, JSONSchemaFormType } from '@/src/flows/types';\nimport { useStepState } from '@/src/flows/useStepState';\nimport { mutationToPromise } from '@/src/lib/mutations';\nimport { createStructuredError, prettifyFormValues } from '@/src/lib/utils';\nimport { JSFFieldset, Meta } from '@/src/types/remoteFlows';\nimport {\n contractorStandardProductIdentifier,\n contractorPlusProductIdentifier,\n corProductIdentifier,\n eorProductIdentifier,\n} from '@/src/flows/ContractorOnboarding/constants';\nimport {\n buildBasicInformationJsfModify,\n buildContractDetailsJsfModify,\n buildContractPreviewJsfModify,\n} from '@/src/flows/ContractorOnboarding/jsfModify';\nimport { useUploadFile } from '@/src/common/api/files';\nimport { dataURLtoFile } from '@/src/lib/files';\nimport { useEmploymentQuery } from '@/src/common/api/employment';\nimport { useDefaultLegalEntity } from '@/src/common/api/legal-entities';\n\ntype useContractorOnboardingProps = Omit<\n ContractorOnboardingFlowProps,\n 'render'\n>;\n\nconst stepToFormSchemaMap: Record<StepKeys, JSONSchemaFormType | null> = {\n select_country: null,\n basic_information: 'employment_basic_information',\n contract_details: null,\n eligibility_questionnaire: null,\n pricing_plan: null,\n contract_preview: null,\n review: null,\n};\n\nconst jsonSchemaToEmployment: Partial<\n Record<JSONSchemaFormType, keyof Employment>\n> = {\n employment_basic_information: 'basic_information',\n};\n\nexport const useContractorOnboarding = ({\n countryCode,\n externalId,\n employmentId,\n skipSteps,\n options,\n initialValues: onboardingInitialValues,\n}: useContractorOnboardingProps) => {\n const excludeProducts = options?.excludeProducts || [];\n const [internalCountryCode, setInternalCountryCode] = useState<string | null>(\n countryCode || null,\n );\n const [internalEmploymentId, setInternalEmploymentId] = useState<\n string | undefined\n >(employmentId);\n const [internalContractDocumentId, setInternalContractDocumentId] = useState<\n string | undefined\n >(undefined);\n const fieldsMetaRef = useRef<{\n select_country: Meta;\n basic_information: Meta;\n contract_details: Meta;\n contract_preview: Meta;\n pricing_plan: Meta;\n eligibility_questionnaire: Meta;\n }>({\n select_country: {},\n basic_information: {},\n contract_details: {},\n contract_preview: {},\n pricing_plan: {},\n eligibility_questionnaire: {},\n });\n\n const [selectedProduct, setSelectedProduct] = useState<string | undefined>(\n undefined,\n );\n\n const [includeEligibilityQuestionnaire, setIncludeEligibilityQuestionnaire] =\n useState<boolean>(false);\n\n const [includeContractPreview, setIncludeContractPreview] =\n useState<boolean>(true);\n\n const [pendingNavigationStep, setPendingNavigationStep] =\n useState<StepKeys | null>(null);\n\n const { steps, stepsArray } = useMemo(\n () =>\n buildSteps({\n includeSelectCountry: !skipSteps?.includes('select_country'),\n includeEligibilityQuestionnaire: includeEligibilityQuestionnaire,\n includeContractPreview: includeContractPreview,\n }),\n [includeEligibilityQuestionnaire, includeContractPreview, skipSteps],\n );\n\n const {\n fieldValues,\n stepState,\n setFieldValues,\n previousStep,\n nextStep,\n goToStep,\n setStepValues,\n } = useStepState(steps);\n\n useEffect(() => {\n if (pendingNavigationStep) {\n // Now steps have been updated\n goToStep(pendingNavigationStep);\n setPendingNavigationStep(null);\n }\n }, [pendingNavigationStep, goToStep]);\n\n const {\n data: employment,\n isLoading: isLoadingEmployment,\n refetch: refetchEmployment,\n } = useEmploymentQuery({\n employmentId: internalEmploymentId as string,\n queryParams: { exclude_files: true },\n });\n\n const defaultLegalEntity = useDefaultLegalEntity();\n\n const { status: employmentStatus } = employment || {};\n\n const isEmploymentReadOnly =\n employmentStatus &&\n reviewStepAllowedEmploymentStatus.includes(employmentStatus);\n\n const canInvite =\n employmentStatus &&\n !disabledInviteButtonEmploymentStatus.includes(employmentStatus);\n\n const invitedStatus: 'invited' | 'not_invited' = useMemo(() => {\n const isInvited = employmentStatus === 'invited';\n\n return isInvited ? 'invited' : 'not_invited';\n }, [employmentStatus]);\n\n const createEmploymentMutation = useCreateEmployment();\n const updateEmploymentMutation = useUpdateEmployment(\n internalCountryCode as string,\n options,\n );\n const createContractorContractDocumentMutation =\n useCreateContractorContractDocument();\n const uploadFileMutation = useUploadFile();\n const { mutateAsync: updateUKandSaudiFieldsMutation } =\n useUpdateUKandSaudiFields(\n createContractorContractDocumentMutation,\n uploadFileMutation,\n fieldValues,\n );\n const createEligibilityQuestionnaireMutation =\n usePostCreateEligibilityQuestionnaire();\n const manageContractorCorSubscriptionMutation =\n usePostManageContractorCorSubscription();\n\n const { mutateAsyncOrThrow: updateEmploymentMutationAsync } =\n mutationToPromise(updateEmploymentMutation);\n const signContractDocumentMutation = useSignContractDocument();\n const manageContractorSubscriptionMutation =\n usePostManageContractorSubscriptions();\n const deleteContractorCorSubscriptionMutation =\n useDeleteContractorCorSubscription();\n\n const { mutateAsyncOrThrow: createEmploymentMutationAsync } =\n mutationToPromise(createEmploymentMutation);\n\n const { mutateAsyncOrThrow: createContractorContractDocumentMutationAsync } =\n mutationToPromise(createContractorContractDocumentMutation);\n\n const { mutateAsyncOrThrow: signContractDocumentMutationAsync } =\n mutationToPromise(signContractDocumentMutation);\n\n const { mutateAsyncOrThrow: manageContractorSubscriptionMutationAsync } =\n mutationToPromise(manageContractorSubscriptionMutation);\n\n const { mutateAsyncOrThrow: createEligibilityQuestionnaireMutationAsync } =\n mutationToPromise(createEligibilityQuestionnaireMutation);\n\n const { mutateAsyncOrThrow: manageContractorCorSubscriptionMutationAsync } =\n mutationToPromise(manageContractorCorSubscriptionMutation);\n\n const { mutateAsyncOrThrow: deleteContractorCorSubscriptionMutationAsync } =\n mutationToPromise(deleteContractorCorSubscriptionMutation);\n\n // if the employment is loaded, country code has not been set yet\n // we set the internal country code with the employment country code\n if (employmentId && employment?.country?.code && !internalCountryCode) {\n setInternalCountryCode(employment.country.code);\n }\n\n const {\n selectCountryForm,\n isLoading: isLoadingCountries,\n countries,\n } = useCountriesSchemaField({\n jsfModify: options?.jsfModify?.select_country,\n });\n\n const selectedCountry = useMemo(() => {\n return countries?.find((country) => country.value === internalCountryCode);\n }, [countries, internalCountryCode]);\n\n const countryName = useMemo(() => {\n return selectedCountry?.label;\n }, [selectedCountry]);\n\n const isPricingPlanEnabled =\n stepState.currentStep.name === 'pricing_plan' ||\n (Boolean(employmentId) && isEmploymentReadOnly);\n\n const {\n form: selectContractorSubscriptionForm,\n isLoading: isLoadingContractorSubscriptions,\n contractorSubscriptions,\n refetch: refetchContractorSubscriptions,\n isEligibilityQuestionnaireBlocked,\n } = useContractorSubscriptionSchemaField(\n internalEmploymentId as string,\n selectedCountry,\n {\n jsonSchemaVersion: options?.jsonSchemaVersion,\n queryOptions: {\n enabled: isPricingPlanEnabled,\n },\n excludeProducts: excludeProducts,\n jsfModify: options?.jsfModify?.pricing_plan,\n },\n );\n\n const hasEligibilityQuestionnaireSubmitted = useMemo(() => {\n return Boolean(\n contractorSubscriptions?.find(\n (subscription) => subscription.product.short_name === 'COR',\n )?.eligibility_questionnaire?.submitted_at,\n );\n }, [contractorSubscriptions]);\n\n useEffect(() => {\n if (hasEligibilityQuestionnaireSubmitted) {\n setIncludeEligibilityQuestionnaire(false);\n return;\n } else if (selectedProduct === corProductIdentifier) {\n setIncludeEligibilityQuestionnaire(true);\n } else {\n setIncludeEligibilityQuestionnaire(false);\n }\n }, [hasEligibilityQuestionnaireSubmitted, selectedProduct]);\n\n useEffect(() => {\n const isCor = employment?.contractor_type === 'cor';\n setIncludeContractPreview(!isCor);\n }, [employment?.contractor_type]);\n\n const eligibilityAnswers = useMemo(() => {\n return contractorSubscriptions?.find(\n (subscription) => subscription.product.short_name === 'COR',\n )?.eligibility_questionnaire?.responses;\n }, [contractorSubscriptions]);\n\n const formType =\n stepToFormSchemaMap[stepState.currentStep.name] ||\n 'contractor_basic_information';\n const employmentKey = jsonSchemaToEmployment[formType] as keyof Employment;\n const serverEmploymentData = (employment?.[employmentKey] || {}) as Record<\n string,\n unknown\n >;\n\n const useJSONSchema = ({\n form,\n options: jsonSchemaOptions = {},\n query = {},\n }: {\n form: JSONSchemaFormType;\n options?: {\n jsfModify?: JSFModify;\n queryOptions?: { enabled?: boolean };\n jsonSchemaVersion?: FlowOptions['jsonSchemaVersion'];\n };\n query?: Record<string, string>;\n }) => {\n const hasUserEnteredAnyValues = Object.keys(fieldValues).length > 0;\n // when you write on the fields, the values are stored in the fieldValues state\n // when values are stored in the stepState is when the user has navigated to the step\n // and then we have the values from the server and the onboardingInitialValues that the user can inject,\n const mergedFormValues = hasUserEnteredAnyValues\n ? {\n ...onboardingInitialValues,\n ...stepState.values?.[stepState.currentStep.name], // Restore values for the current step\n ...fieldValues,\n }\n : {\n ...onboardingInitialValues,\n ...serverEmploymentData,\n };\n\n return useJSONSchemaForm({\n countryCode: internalCountryCode as string,\n form: form,\n fieldValues: mergedFormValues,\n query,\n options: {\n ...jsonSchemaOptions,\n queryOptions: {\n enabled: jsonSchemaOptions.queryOptions?.enabled ?? true,\n },\n },\n });\n };\n\n const isBasicInformationDetailsEnabled = Boolean(\n internalCountryCode &&\n (stepState.currentStep.name === 'basic_information' ||\n Boolean(employmentId)),\n );\n\n const isIR35FileEnabled = Boolean(\n internalCountryCode === 'GBR' &&\n employmentId &&\n stepState.currentStep.name === 'basic_information',\n );\n\n const { data: ir35File, isLoading: isLoadingIR35File } = useGetIR35File(\n employmentId as string,\n {\n enabled: isIR35FileEnabled,\n },\n );\n\n const { data: contractDocuments, isLoading: isLoadingContractDocuments } =\n useGetContractDocuments(employmentId as string, {\n enabled: Boolean(employmentId),\n });\n\n useEffect(() => {\n if (\n contractDocuments &&\n contractDocuments.length > 0 &&\n !internalContractDocumentId\n ) {\n setInternalContractDocumentId(contractDocuments[0].id);\n }\n }, [contractDocuments, internalContractDocumentId]);\n\n const {\n data: basicInformationForm,\n isLoading: isLoadingBasicInformationForm,\n } = useJSONSchema({\n form: 'contractor_basic_information',\n options: {\n jsfModify: buildBasicInformationJsfModify(\n internalCountryCode as string,\n countryName,\n options,\n ),\n queryOptions: {\n enabled: isBasicInformationDetailsEnabled,\n },\n },\n });\n\n const descriptionProvisionalStartDate = useMemo(() => {\n return calculateProvisionalStartDateDescription(\n employment?.basic_information?.provisional_start_date as string,\n fieldValues?.service_duration?.provisional_start_date as string,\n );\n }, [\n employment?.basic_information?.provisional_start_date,\n fieldValues?.service_duration?.provisional_start_date,\n ]);\n\n /**\n * When the user selects COR, the data isn't saved yet in the BE\n * We need to use the internalState to know what has happened\n */\n const selectedPricingPlan = useMemo(() => {\n const subscriptions = {\n standard: contractorStandardProductIdentifier,\n plus: contractorPlusProductIdentifier,\n cor: corProductIdentifier,\n };\n\n // HIGHEST PRIORITY: Current form value (user is actively selecting)\n if (fieldValues.subscription) {\n return fieldValues.subscription;\n }\n\n // SECOND: Previously submitted value in this session\n const subscription = stepState.values?.pricing_plan?.subscription;\n if (subscription && !isEligibilityQuestionnaireBlocked) {\n return subscription;\n }\n\n // THIRD: Backend state (eligibility submitted or employment contractor_type)\n if (\n hasEligibilityQuestionnaireSubmitted &&\n !isEligibilityQuestionnaireBlocked\n ) {\n return corProductIdentifier;\n }\n\n // Fourth: If the eligibility questionnaire is blocked and has been submitted, return the standard product\n if (\n isEligibilityQuestionnaireBlocked &&\n hasEligibilityQuestionnaireSubmitted\n ) {\n return contractorStandardProductIdentifier;\n }\n\n // FALLBACK: Employment contractor_type or default\n return (\n subscriptions[\n employment?.contractor_type as keyof typeof subscriptions\n ] || contractorStandardProductIdentifier\n );\n }, [\n fieldValues,\n stepState.values,\n hasEligibilityQuestionnaireSubmitted,\n employment?.contractor_type,\n isEligibilityQuestionnaireBlocked,\n ]);\n\n useEffect(() => {\n if (selectedPricingPlan && selectedPricingPlan !== selectedProduct) {\n setSelectedProduct(selectedPricingPlan);\n }\n }, [selectedPricingPlan, selectedProduct]);\n\n const eligibilityFields = useMemo(() => {\n return {\n ...eligibilityAnswers,\n ...onboardingInitialValues,\n ...stepState.values?.eligibility_questionnaire,\n ...fieldValues,\n };\n }, [\n eligibilityAnswers,\n onboardingInitialValues,\n stepState.values?.eligibility_questionnaire,\n fieldValues,\n ]);\n\n const isEligibilityQuestionnaireEnabled = useMemo(() => {\n return (\n (selectedPricingPlan === corProductIdentifier &&\n stepState.currentStep.name === 'eligibility_questionnaire') ||\n (Boolean(employmentId) &&\n isEmploymentReadOnly &&\n selectedPricingPlan === corProductIdentifier)\n );\n }, [\n selectedPricingPlan,\n stepState.currentStep.name,\n employmentId,\n isEmploymentReadOnly,\n ]);\n\n const {\n data: eligibilityQuestionnaireForm,\n isLoading: isLoadingEligibilityQuestionnaire,\n } = useGetEligibilityQuestionnaire({\n options: {\n queryOptions: {\n enabled: isEligibilityQuestionnaireEnabled,\n },\n jsfModify: options?.jsfModify?.eligibility_questionnaire,\n },\n fieldValues: eligibilityFields,\n });\n\n const isContractorOnboardingDetailsEnabled = Boolean(\n (internalCountryCode &&\n stepState.currentStep.name === 'contract_details') ||\n isEmploymentReadOnly,\n );\n\n const {\n data: contractorOnboardingDetailsForm,\n isLoading: isLoadingContractorOnboardingDetailsForm,\n } = useContractorOnboardingDetailsSchemaWithCurrencies({\n countryCode: internalCountryCode as string,\n fieldValues: fieldValues,\n employmentId: internalEmploymentId as string,\n options: {\n queryOptions: {\n enabled: isContractorOnboardingDetailsEnabled,\n },\n jsfModify: buildContractDetailsJsfModify(\n options?.jsfModify?.contract_details,\n descriptionProvisionalStartDate,\n selectedPricingPlan,\n fieldValues,\n ),\n },\n });\n\n const isSignatureSchemaEnabled = useMemo(() => {\n return (\n stepState.currentStep.name === 'contract_preview' ||\n (Boolean(employmentId) && isEmploymentReadOnly)\n );\n }, [stepState.currentStep.name, employmentId, isEmploymentReadOnly]);\n\n const { data: signatureSchemaForm } = useGetContractDocumentSignatureSchema({\n fieldValues: fieldValues,\n options: {\n queryOptions: {\n enabled: isSignatureSchemaEnabled,\n },\n jsfModify: buildContractPreviewJsfModify(options, fieldValues),\n },\n });\n\n const { data: documentPreviewPdf, isLoading: isLoadingDocumentPreviewForm } =\n useGetShowContractDocument({\n employmentId: internalEmploymentId as string,\n contractDocumentId: internalContractDocumentId as string,\n options: {\n queryOptions: {\n enabled: Boolean(internalContractDocumentId),\n },\n },\n });\n\n const stepFields: Record<StepKeys, JSFFields> = useMemo(\n () => ({\n select_country: selectCountryForm?.fields || [],\n basic_information: basicInformationForm?.fields || [],\n pricing_plan: selectContractorSubscriptionForm?.fields || [],\n eligibility_questionnaire: eligibilityQuestionnaireForm?.fields || [],\n contract_details: contractorOnboardingDetailsForm?.fields || [],\n contract_preview: signatureSchemaForm?.fields || [],\n review: [],\n }),\n [\n selectCountryForm?.fields,\n basicInformationForm?.fields,\n selectContractorSubscriptionForm?.fields,\n contractorOnboardingDetailsForm?.fields,\n signatureSchemaForm?.fields,\n eligibilityQuestionnaireForm?.fields,\n ],\n );\n\n const stepFieldsWithFlatFieldsets: Record<\n StepKeys,\n JSFFieldset | null | undefined\n > = {\n select_country: null,\n basic_information: basicInformationForm?.meta['x-jsf-fieldsets'],\n pricing_plan: null,\n contract_details: contractorOnboardingDetailsForm?.meta['x-jsf-fieldsets'],\n eligibility_questionnaire: null,\n contract_preview: null,\n review: null,\n };\n\n const {\n country,\n basic_information: employmentBasicInformation = {},\n contract_details: employmentContractDetails = {},\n } = employment || {};\n\n const employmentCountryCode = country?.code;\n\n const selectCountryInitialValues = useMemo(\n () =>\n getInitialValues(stepFields.select_country, {\n country: internalCountryCode || employmentCountryCode || '',\n }),\n [stepFields.select_country, internalCountryCode, employmentCountryCode],\n );\n\n // memoize file conversion to avoid re-converting the file on every render\n // noticed performance issues when not doing memoizing individually\n const convertedIr35File = useMemo(() => {\n if (!ir35File?.content) return null;\n return dataURLtoFile(ir35File.content as unknown as string, ir35File.name);\n }, [ir35File?.content, ir35File?.name]);\n\n const basicInformationInitialValues = useMemo(() => {\n const initialValues = {\n ...onboardingInitialValues,\n ...employmentBasicInformation,\n ir35: employment?.contract_details?.ir_35,\n nationality_status: employment?.contract_details?.nationality,\n ...(convertedIr35File && {\n ir35_sds_file: [convertedIr35File],\n }),\n };\n\n return getInitialValues(stepFields.basic_information, initialValues);\n }, [\n onboardingInitialValues,\n employmentBasicInformation,\n employment?.contract_details?.ir_35,\n employment?.contract_details?.nationality,\n convertedIr35File,\n stepFields.basic_information,\n ]);\n\n const contractDetailsInitialValues = useMemo(() => {\n const hardcodedValues = {\n service_duration: {\n provisional_start_date:\n employmentBasicInformation.provisional_start_date,\n },\n };\n const initialValues = {\n ...hardcodedValues,\n ...onboardingInitialValues,\n ...employmentContractDetails,\n };\n\n return getInitialValues(stepFields.contract_details, initialValues);\n }, [\n stepFields.contract_details,\n employmentContractDetails,\n onboardingInitialValues,\n employmentBasicInformation,\n ]);\n\n const contractPreviewInitialValues = useMemo(() => {\n const signature = documentPreviewPdf?.contract_document?.signatories?.find(\n (signatory) => signatory.type === 'company',\n );\n const initialValues = {\n ...onboardingInitialValues,\n signature: signature?.signature,\n };\n\n return getInitialValues(stepFields.contract_preview, initialValues);\n }, [\n stepFields.contract_preview,\n onboardingInitialValues,\n documentPreviewPdf,\n ]);\n\n const pricingPlanInitialValues = useMemo(() => {\n const preselectedPricingPlan = {\n subscription: selectedPricingPlan,\n };\n const initialValues = {\n ...preselectedPricingPlan,\n ...onboardingInitialValues,\n };\n\n return getInitialValues(stepFields.pricing_plan, initialValues);\n }, [stepFields.pricing_plan, onboardingInitialValues, selectedPricingPlan]);\n\n const eligibilityQuestionnaireInitialValues = useMemo(() => {\n const initialValues = {\n ...onboardingInitialValues,\n ...eligibilityAnswers,\n };\n return getInitialValues(\n stepFields.eligibility_questionnaire,\n initialValues,\n );\n }, [\n stepFields.eligibility_questionnaire,\n onboardingInitialValues,\n eligibilityAnswers,\n ]);\n\n const initialValues = useMemo(() => {\n return {\n select_country: selectCountryInitialValues,\n basic_information: basicInformationInitialValues,\n contract_details: contractDetailsInitialValues,\n contract_preview: contractPreviewInitialValues,\n pricing_plan: pricingPlanInitialValues,\n eligibility_questionnaire: eligibilityQuestionnaireInitialValues,\n };\n }, [\n selectCountryInitialValues,\n basicInformationInitialValues,\n contractDetailsInitialValues,\n contractPreviewInitialValues,\n pricingPlanInitialValues,\n eligibilityQuestionnaireInitialValues,\n ]);\n\n const shouldHandleReadOnlyEmployment = Boolean(\n employmentId &&\n isEmploymentReadOnly &&\n stepState.currentStep.name !== 'review',\n );\n\n const initialLoading =\n isLoadingCountries ||\n isLoadingBasicInformationForm ||\n isLoadingEmployment ||\n isLoadingContractorOnboardingDetailsForm ||\n isLoadingContractorSubscriptions ||\n isLoadingDocumentPreviewForm ||\n isLoadingIR35File ||\n isLoadingContractDocuments ||\n isLoadingEligibilityQuestionnaire;\n\n const isNavigatingToReview = useMemo(() => {\n const isCor = employment?.contractor_type === 'cor';\n const hasContractPreviewFields =\n isCor || stepFields.contract_preview.length > 0;\n\n return Boolean(\n shouldHandleReadOnlyEmployment &&\n !initialLoading &&\n Boolean(internalContractDocumentId) &&\n stepFields.basic_information.length > 0 &&\n stepFields.contract_details.length > 0 &&\n hasContractPreviewFields,\n );\n }, [\n shouldHandleReadOnlyEmployment,\n initialLoading,\n internalContractDocumentId,\n stepFields.basic_information.length,\n stepFields.contract_details.length,\n stepFields.contract_preview.length,\n employment?.contractor_type,\n ]);\n\n useEffect(() => {\n if (isNavigatingToReview) {\n fieldsMetaRef.current = {\n select_country: prettifyFormValues(\n selectCountryInitialValues,\n stepFields.select_country,\n ),\n basic_information: prettifyFormValues(\n basicInformationInitialValues,\n stepFields.basic_information,\n ),\n contract_details: prettifyFormValues(\n contractDetailsInitialValues,\n stepFields.contract_details,\n ),\n contract_preview: prettifyFormValues(\n contractPreviewInitialValues,\n stepFields.contract_preview,\n ),\n pricing_plan: prettifyFormValues(\n pricingPlanInitialValues,\n stepFields.pricing_plan,\n ),\n eligibility_questionnaire: prettifyFormValues(\n eligibilityQuestionnaireInitialValues,\n stepFields.eligibility_questionnaire,\n ),\n };\n\n setStepValues({\n select_country: selectCountryInitialValues,\n basic_information: basicInformationInitialValues,\n contract_details: contractDetailsInitialValues,\n contract_preview: contractPreviewInitialValues,\n pricing_plan: pricingPlanInitialValues,\n eligibility_questionnaire: eligibilityQuestionnaireInitialValues,\n review: {},\n });\n goToStep('review');\n }\n }, [\n isNavigatingToReview,\n goToStep,\n selectCountryInitialValues,\n basicInformationInitialValues,\n contractDetailsInitialValues,\n setStepValues,\n stepFields.select_country,\n stepFields.basic_information,\n stepFields.contract_details,\n stepFields.pricing_plan,\n pricingPlanInitialValues,\n stepFields.contract_preview,\n contractPreviewInitialValues,\n stepFields.eligibility_questionnaire,\n eligibilityQuestionnaireInitialValues,\n ]);\n\n const goTo = (step: StepKeys) => {\n goToStep(step);\n };\n\n const parseFormValues = async (values: FieldValues) => {\n if (selectCountryForm && stepState.currentStep.name === 'select_country') {\n return values;\n }\n\n if (\n basicInformationForm &&\n stepState.currentStep.name === 'basic_information'\n ) {\n return await parseJSFToValidate(values, basicInformationForm?.fields, {\n isPartialValidation: false,\n });\n }\n\n if (\n contractorOnboardingDetailsForm &&\n stepState.currentStep.name === 'contract_details'\n ) {\n return await parseJSFToValidate(\n values,\n contractorOnboardingDetailsForm?.fields,\n {\n isPartialValidation: false,\n },\n );\n }\n\n if (\n signatureSchemaForm &&\n stepState.currentStep.name === 'contract_preview'\n ) {\n return await parseJSFToValidate(values, signatureSchemaForm?.fields, {\n isPartialValidation: false,\n });\n }\n\n if (\n selectContractorSubscriptionForm &&\n stepState.currentStep.name === 'pricing_plan'\n ) {\n return await parseJSFToValidate(\n values,\n selectContractorSubscriptionForm?.fields,\n {\n isPartialValidation: false,\n },\n );\n }\n\n if (\n eligibilityQuestionnaireForm &&\n stepState.currentStep.name === 'eligibility_questionnaire'\n ) {\n return await parseJSFToValidate(\n values,\n eligibilityQuestionnaireForm?.fields,\n {\n isPartialValidation: false,\n },\n );\n }\n\n return {};\n };\n\n async function onSubmit(values: FieldValues) {\n const currentStepName = stepState.currentStep.name;\n if (currentStepName in fieldsMetaRef.current) {\n fieldsMetaRef.current[\n currentStepName as keyof typeof fieldsMetaRef.current\n ] = prettifyFormValues(values, stepFields[currentStepName]);\n }\n const parsedValues = await parseFormValues(values);\n switch (stepState.currentStep.name) {\n case 'select_country': {\n setInternalCountryCode(parsedValues.country);\n return Promise.resolve({ data: { countryCode: parsedValues.country } });\n }\n case 'basic_information': {\n const isEmploymentNotLoaded =\n !internalEmploymentId && internalCountryCode;\n const hasChangedCountry =\n internalEmploymentId &&\n internalCountryCode &&\n employment?.country &&\n employment?.country.code !== internalCountryCode;\n\n if (isEmploymentNotLoaded || hasChangedCountry) {\n const basicInformationParsedValues = omit(\n parsedValues,\n 'nationality_status',\n 'ir35',\n 'ir35_sds_file',\n );\n const basicInformationPayload: EmploymentCreateParams = {\n basic_information: basicInformationParsedValues,\n type: 'contractor',\n country_code: internalCountryCode,\n external_id: externalId,\n };\n const response = await createEmploymentMutationAsync(\n basicInformationPayload,\n );\n const employmentId = response?.data?.employment?.id;\n if (!employmentId) {\n throw createStructuredError('Employment ID not found');\n }\n\n await updateUKandSaudiFieldsMutation({\n employmentId: employmentId as string,\n });\n\n // Only update state (triggers queries with fully consistent backend state) if not caused a bug\n // if one of the updateUKandSaudiFieldsMutation fails with a 422 for example\n setInternalEmploymentId(employmentId);\n\n return response;\n } else if (internalEmploymentId) {\n const basicInformationParsedValues = omit(\n parsedValues,\n 'nationality_status',\n 'ir35',\n 'ir35_sds_file',\n );\n\n await updateUKandSaudiFieldsMutation({\n employmentId: internalEmploymentId,\n });\n return updateEmploymentMutationAsync({\n employmentId: internalEmploymentId,\n basic_information: basicInformationParsedValues,\n });\n }\n\n return;\n }\n case 'contract_details': {\n const payload: CreateContractDocument = {\n contract_document: parsedValues,\n };\n const response = await createContractorContractDocumentMutationAsync({\n employmentId: internalEmploymentId as string,\n payload,\n });\n const contractDocumentId = response?.data?.contract_document?.id;\n if (!contractDocumentId) {\n throw createStructuredError('Contract document ID not found');\n }\n setInternalContractDocumentId(contractDocumentId);\n\n await refetchEmployment();\n\n return response;\n }\n\n case 'contract_preview': {\n return signContractDocumentMutationAsync({\n employmentId: internalEmploymentId as string,\n contractDocumentId: internalContractDocumentId as string,\n payload: {\n signature: parsedValues.signature,\n },\n });\n }\n case 'pricing_plan': {\n const blockedProductsEligibility = [\n corProductIdentifier,\n contractorPlusProductIdentifier,\n ];\n\n if (\n isEligibilityQuestionnaireBlocked &&\n blockedProductsEligibility.includes(values.subscription)\n ) {\n throw createStructuredError(\n `This individual is not eligible for ${\n CONTRACT_PRODUCT_TITLES[\n values.subscription as keyof typeof CONTRACT_PRODUCT_TITLES\n ]\n }.`,\n );\n }\n // Handle EOR selection (from merged options)\n if (values.subscription === eorProductIdentifier) {\n // EOR selection - no API call needed at this step\n return Promise.resolve({\n data: {\n subscription: values.subscription,\n },\n });\n }\n\n if (\n hasEligibilityQuestionnaireSubmitted &&\n values.subscription !== corProductIdentifier\n ) {\n try {\n await deleteContractorCorSubscriptionMutationAsync({\n employmentId: internalEmploymentId as string,\n });\n await refetchContractorSubscriptions();\n } catch (error) {\n if ((error as $TSFixMe)?.response?.status !== 404) {\n throw error;\n }\n // Still refetch to update the UI state\n await refetchContractorSubscriptions();\n }\n }\n\n if (values.subscription == contractorStandardProductIdentifier) {\n return manageContractorSubscriptionMutationAsync({\n employmentId: internalEmploymentId as string,\n payload: {\n operation: 'downgrade',\n },\n });\n } else if (values.subscription == contractorPlusProductIdentifier) {\n return manageContractorSubscriptionMutationAsync({\n employmentId: internalEmploymentId as string,\n payload: {\n operation: 'upgrade',\n },\n });\n } else if (values.subscription == corProductIdentifier) {\n return Promise.resolve({\n data: { subscription: values.subscription },\n });\n }\n\n throw createStructuredError('invalid selection');\n }\n\n case 'eligibility_questionnaire': {\n try {\n const response = await createEligibilityQuestionnaireMutationAsync({\n employmentId: internalEmploymentId as string,\n payload: parsedValues,\n });\n\n const isEligibilityQuestionnaireBlocked = response?.data?.is_blocking;\n\n if (isEligibilityQuestionnaireBlocked) {\n setIncludeEligibilityQuestionnaire(false);\n setPendingNavigationStep('pricing_plan');\n throw createStructuredError(\n 'This individual is not eligible for Contractor of Record.',\n );\n }\n\n return await manageContractorCorSubscriptionMutationAsync({\n employmentId: internalEmploymentId as string,\n });\n } finally {\n // Always refetch to keep state in sync, even on error\n await refetchContractorSubscriptions();\n }\n }\n\n default: {\n throw createStructuredError('Invalid step state');\n }\n }\n }\n\n const isLoading = initialLoading || shouldHandleReadOnlyEmployment;\n\n return {\n /**\n * Loading state indicating if the flow is loading data\n */\n isLoading,\n\n /**\n * Current state of the form fields for the current step.\n */\n fieldValues,\n\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState,\n\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: setFieldValues,\n\n /**\n * Function to handle going back to the previous step\n * @returns {void}\n */\n back: previousStep,\n\n /**\n * Function to handle going to the next step\n * @returns {void}\n */\n next: nextStep,\n\n /**\n * Function to handle going to a specific step\n * @param step The step to go to.\n * @returns {void}\n */\n goTo: goTo,\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 * Array of form fields from the onboarding schema\n */\n fields: stepFields[stepState.currentStep.name],\n\n /**\n * Fields metadata for each step\n */\n meta: {\n fields: fieldsMetaRef.current,\n fieldsets: stepFieldsWithFlatFieldsets[stepState.currentStep.name],\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,\n\n /**\n * Function to validate form values against the onboarding schema\n * @param values - Form values to validate\n * @returns Validation result or null if no schema is available\n */\n handleValidation: async (\n values: FieldValues,\n ): Promise<ValidationResult | null> => {\n if (stepState.currentStep.name === 'select_country') {\n return selectCountryForm.handleValidation(values);\n }\n\n if (\n basicInformationForm &&\n stepState.currentStep.name === 'basic_information'\n ) {\n const parsedValues = await parseJSFToValidate(\n values,\n basicInformationForm?.fields,\n { isPartialValidation: false },\n );\n return basicInformationForm?.handleValidation(parsedValues);\n }\n\n if (\n contractorOnboardingDetailsForm &&\n stepState.currentStep.name === 'contract_details'\n ) {\n const parsedValues = await parseJSFToValidate(\n values,\n contractorOnboardingDetailsForm?.fields,\n { isPartialValidation: false },\n );\n return contractorOnboardingDetailsForm?.handleValidation(parsedValues);\n }\n\n if (\n signatureSchemaForm &&\n stepState.currentStep.name === 'contract_preview'\n ) {\n const parsedValues = await parseJSFToValidate(\n values,\n signatureSchemaForm?.fields,\n { isPartialValidation: true },\n );\n return signatureSchemaForm?.handleValidation(parsedValues);\n }\n\n if (\n selectContractorSubscriptionForm &&\n stepState.currentStep.name === 'pricing_plan'\n ) {\n const parsedValues = await parseJSFToValidate(\n values,\n selectContractorSubscriptionForm?.fields,\n { isPartialValidation: false },\n );\n return selectContractorSubscriptionForm?.handleValidation(parsedValues);\n }\n\n if (\n eligibilityQuestionnaireForm &&\n stepState.currentStep.name === 'eligibility_questionnaire'\n ) {\n const parsedValues = await parseJSFToValidate(\n values,\n eligibilityQuestionnaireForm?.fields,\n { isPartialValidation: false },\n );\n return eligibilityQuestionnaireForm?.handleValidation(parsedValues);\n }\n\n return null;\n },\n\n /**\n * Initial form values\n */\n initialValues,\n\n /**\n * Employment id\n */\n employmentId: internalEmploymentId,\n\n /**\n * Function to refetch the employment data\n * @returns {void}\n */\n refetchEmployment: refetchEmployment,\n\n /**\n * Loading state indicating if the onboarding mutation is in progress\n */\n isSubmitting:\n createEmploymentMutation.isPending ||\n updateEmploymentMutation.isPending ||\n createContractorContractDocumentMutation.isPending ||\n signContractDocumentMutation.isPending ||\n manageContractorSubscriptionMutation.isPending ||\n uploadFileMutation.isPending ||\n createEligibilityQuestionnaireMutation.isPending ||\n manageContractorCorSubscriptionMutation.isPending ||\n deleteContractorCorSubscriptionMutation.isPending,\n\n /**\n * Document preview PDF data\n */\n documentPreviewPdf,\n\n /**\n * let's the user know if the company can invite employees\n * @returns {boolean}\n */\n canInvite,\n\n /**\n * let's the user know that the employment cannot be edited, happens when employment.status is invited\n * @returns {boolean}\n */\n isEmploymentReadOnly,\n /**\n * let's the user know if the employment is invited or not\n * @returns {'invited' | 'not_invited'}\n */\n invitedStatus,\n\n /**\n * Employment data\n * @returns {Employment}\n */\n employment,\n\n /**\n * Default legal entity\n * @returns {CompanyLegalEntity}\n */\n defaultLegalEntity,\n /**\n * Steps array\n * @returns {Array<{name: string, index: number, label: string}>}\n */\n steps: stepsArray,\n };\n};\n","import { useQuery } from '@tanstack/react-query';\nimport { getIndexCompanyLegalEntities } from '@/src/client';\nimport { Client } from '@/src/client/client';\nimport { useClient } from '@/src/context';\nimport { useIdentity } from '@/src/common/api/identity';\nimport { hasCompany } from '@/src/common/api/companies';\n\n/**\n * Hook to get the legal entities for a company\n * @param companyId - The company ID\n * @returns The legal entities\n */\nexport const useLegalEntities = () => {\n const { client } = useClient();\n const { data: identity } = useIdentity();\n const companyId = hasCompany(identity) ? (identity?.company?.id ?? '') : '';\n\n return useQuery({\n queryKey: ['legal-entities', companyId],\n queryFn: () =>\n getIndexCompanyLegalEntities({\n client: client as Client,\n path: {\n company_id: companyId,\n },\n }),\n select: (data) => data.data?.data?.legal_entities,\n enabled: !!companyId,\n });\n};\n\nexport const useDefaultLegalEntity = () => {\n const { data: legalEntities } = useLegalEntities();\n return legalEntities?.find((legalEntity) => legalEntity.is_default);\n};\n"],"mappings":"qwBAAA,OAAS,aAAAA,EAAW,WAAAC,EAAS,UAAAC,GAAQ,YAAAC,MAAgB,QAErD,OAAOC,OAAU,cCFjB,OAAS,YAAAC,OAAgB,wBAYlB,IAAMC,GAAmBC,EAAA,IAAM,CACpC,GAAM,CAAE,OAAAC,CAAO,EAAIC,GAAU,EACvB,CAAE,KAAMC,CAAS,EAAIC,GAAY,EACjCC,EAAYC,GAAWH,CAAQ,EAAKA,GAAU,SAAS,IAAM,GAAM,GAEzE,OAAOI,GAAS,CACd,SAAU,CAAC,iBAAkBF,CAAS,EACtC,QAASL,EAAA,IACPQ,GAA6B,CAC3B,OAAQP,EACR,KAAM,CACJ,WAAYI,CACd,CACF,CAAC,EANM,WAOT,OAAQL,EAACS,GAASA,EAAK,MAAM,MAAM,eAA3B,UACR,QAAS,CAAC,CAACJ,CACb,CAAC,CACH,EAjBgC,oBAmBnBK,GAAwBV,EAAA,IAAM,CACzC,GAAM,CAAE,KAAMW,CAAc,EAAIZ,GAAiB,EACjD,OAAOY,GAAe,KAAMC,GAAgBA,EAAY,UAAU,CACpE,EAHqC,yBDwCrC,IAAMC,GAAmE,CACvE,eAAgB,KAChB,kBAAmB,+BACnB,iBAAkB,KAClB,0BAA2B,KAC3B,aAAc,KACd,iBAAkB,KAClB,OAAQ,IAC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OAAS,mBAC/B,CACA,IAAM4I,EAAe,MAAMH,EACzBD,EACApC,GAAiC,OACjC,CAAE,oBAAqB,EAAM,CAC/B,EACA,OAAOA,GAAiC,iBAAiBwC,CAAY,CACvE,CAEA,GACEnC,GACAzG,EAAU,YAAY,OAAS,mBAC/B,CACA,IAAM4I,EAAe,MAAMH,EACzBD,EACA/B,GAAqB,OACrB,CAAE,oBAAqB,EAAK,CAC9B,EACA,OAAOA,GAAqB,iBAAiBmC,CAAY,CAC3D,CAEA,GACEnF,GACAzD,EAAU,YAAY,OAAS,eAC/B,CACA,IAAM4I,EAAe,MAAMH,EACzBD,EACA/E,GAAkC,OAClC,CAAE,oBAAqB,EAAM,CAC/B,EACA,OAAOA,GAAkC,iBAAiBmF,CAAY,CACxE,CAEA,GACE5C,GACAhG,EAAU,YAAY,OAAS,4BAC/B,CACA,IAAM4I,EAAe,MAAMH,EACzBD,EACAxC,GAA8B,OAC9B,CAAE,oBAAqB,EAAM,CAC/B,EACA,OAAOA,GAA8B,iBAAiB4C,CAAY,CACpE,CAEA,OAAO,IACT,EApEkB,oBAyElB,cAAAnB,GAKA,aAAc5I,EAMd,kBAAmB6B,GAKnB,aACEU,GAAyB,WACzBE,GAAyB,WACzBE,GAAyC,WACzCY,GAA6B,WAC7BE,GAAqC,WACrCZ,GAAmB,WACnBI,GAAuC,WACvCE,GAAwC,WACxCQ,GAAwC,UAK1C,mBAAAoE,GAMA,UAAA3F,GAMA,qBAAAF,EAKA,cAAAI,GAMA,WAAAX,EAMA,mBAAAI,GAKA,MAAOhB,EACT,CACF,EA/sCuC","names":["useEffect","useMemo","useRef","useState","omit","useQuery","useLegalEntities","__name","client","useClient","identity","useIdentity","companyId","hasCompany","useQuery","getIndexCompanyLegalEntities","data","useDefaultLegalEntity","legalEntities","legalEntity","stepToFormSchemaMap","jsonSchemaToEmployment","useContractorOnboarding","__name","countryCode","externalId","employmentId","skipSteps","options","onboardingInitialValues","excludeProducts","internalCountryCode","setInternalCountryCode","useState","internalEmploymentId","setInternalEmploymentId","internalContractDocumentId","setInternalContractDocumentId","fieldsMetaRef","useRef","selectedProduct","setSelectedProduct","includeEligibilityQuestionnaire","setIncludeEligibilityQuestionnaire","includeContractPreview","setIncludeContractPreview","pendingNavigationStep","setPendingNavigationStep","steps","stepsArray","useMemo","buildSteps","fieldValues","stepState","setFieldValues","previousStep","nextStep","goToStep","setStepValues","useStepState","useEffect","employment","isLoadingEmployment","refetchEmployment","useEmploymentQuery","defaultLegalEntity","useDefaultLegalEntity","employmentStatus","isEmploymentReadOnly","reviewStepAllowedEmploymentStatus","canInvite","disabledInviteButtonEmploymentStatus","invitedStatus","createEmploymentMutation","useCreateEmployment","updateEmploymentMutation","useUpdateEmployment","createContractorContractDocumentMutation","useCreateContractorContractDocument","uploadFileMutation","useUploadFile","updateUKandSaudiFieldsMutation","useUpdateUKandSaudiFields","createEligibilityQuestionnaireMutation","usePostCreateEligibilityQuestionnaire","manageContractorCorSubscriptionMutation","usePostManageContractorCorSubscription","updateEmploymentMutationAsync","mutationToPromise","signContractDocumentMutation","useSignContractDocument","manageContractorSubscriptionMutation","usePostManageContractorSubscriptions","deleteContractorCorSubscriptionMutation","useDeleteContractorCorSubscription","createEmploymentMutationAsync","createContractorContractDocumentMutationAsync","signContractDocumentMutationAsync","manageContractorSubscriptionMutationAsync","createEligibilityQuestionnaireMutationAsync","manageContractorCorSubscriptionMutationAsync","deleteContractorCorSubscriptionMutationAsync","selectCountryForm","isLoadingCountries","countries","useCountriesSchemaField","selectedCountry","country","countryName","isPricingPlanEnabled","selectContractorSubscriptionForm","isLoadingContractorSubscriptions","contractorSubscriptions","refetchContractorSubscriptions","isEligibilityQuestionnaireBlocked","useContractorSubscriptionSchemaField","hasEligibilityQuestionnaireSubmitted","subscription","corProductIdentifier","isCor","eligibilityAnswers","formType","employmentKey","serverEmploymentData","useJSONSchema","form","jsonSchemaOptions","query","mergedFormValues","useJSONSchemaForm","isBasicInformationDetailsEnabled","isIR35FileEnabled","ir35File","isLoadingIR35File","useGetIR35File","contractDocuments","isLoadingContractDocuments","useGetContractDocuments","basicInformationForm","isLoadingBasicInformationForm","buildBasicInformationJsfModify","descriptionProvisionalStartDate","calculateProvisionalStartDateDescription","selectedPricingPlan","subscriptions","contractorStandardProductIdentifier","contractorPlusProductIdentifier","eligibilityFields","isEligibilityQuestionnaireEnabled","eligibilityQuestionnaireForm","isLoadingEligibilityQuestionnaire","useGetEligibilityQuestionnaire","isContractorOnboardingDetailsEnabled","contractorOnboardingDetailsForm","isLoadingContractorOnboardingDetailsForm","useContractorOnboardingDetailsSchemaWithCurrencies","buildContractDetailsJsfModify","isSignatureSchemaEnabled","signatureSchemaForm","useGetContractDocumentSignatureSchema","buildContractPreviewJsfModify","documentPreviewPdf","isLoadingDocumentPreviewForm","useGetShowContractDocument","stepFields","stepFieldsWithFlatFieldsets","employmentBasicInformation","employmentContractDetails","employmentCountryCode","selectCountryInitialValues","getInitialValues","convertedIr35File","dataURLtoFile","basicInformationInitialValues","initialValues","contractDetailsInitialValues","contractPreviewInitialValues","signature","signatory","pricingPlanInitialValues","eligibilityQuestionnaireInitialValues","shouldHandleReadOnlyEmployment","initialLoading","isNavigatingToReview","hasContractPreviewFields","prettifyFormValues","goTo","step","parseFormValues","values","parseJSFToValidate","onSubmit","currentStepName","parsedValues","isEmploymentNotLoaded","hasChangedCountry","basicInformationPayload","omit","response","createStructuredError","basicInformationParsedValues","contractDocumentId","CONTRACT_PRODUCT_TITLES","eorProductIdentifier","error"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as Y}from"./chunk-XFDNQDDA.js";import{a as Q}from"./chunk-AJCKNHZB.js";import{a as J}from"./chunk-NNW7S5AY.js";import{a as U}from"./chunk-6DHV4GT6.js";import{a as W}from"./chunk-TRBEYNRN.js";import{a as H}from"./chunk-YRC6EEM3.js";import{a as q,b as B,c as L,d as z}from"./chunk-L5DII4MV.js";import{f as Z,g as K}from"./chunk-EQVUP5ZR.js";import{a as R}from"./chunk-ZXGAFQXW.js";import{a as S}from"./chunk-RAH453TV.js";import{a as N}from"./chunk-PGVAOMQU.js";import{a as E}from"./chunk-EUSCQL4H.js";import{e as _}from"./chunk-T7O3YYOG.js";import{a as u,b as v}from"./chunk-AK4FXJFO.js";import{q as $}from"./chunk-2IA5ZHU4.js";import{a as D}from"./chunk-VIGKOVHP.js";import{a as w}from"./chunk-X6ZAR7ZL.js";import{a as A}from"./chunk-TSPDJUGG.js";import{a as I}from"./chunk-Z5WMKCRJ.js";import{d as O}from"./chunk-KQPDXXG3.js";import{a as o}from"./chunk-P37U34EQ.js";import xe from"lodash.omitby";import je from"lodash.isnull";import{format as x,isFuture as Ve,parseISO as j,subDays as Pe}from"date-fns";import{useMemo as V}from"react";import be from"lodash.omit";import{useQuery as Fe}from"@tanstack/react-query";var G=o(({query:t,options:e})=>{let{client:y}=O();return Fe({queryKey:["payroll-calendars"],queryFn:o(()=>$({client:y,query:{year:t?.year,country_code:t?.countryCode}}),"queryFn"),enabled:e?.enabled,select:o(c=>c.data?.data?.payroll_calendars?.[0],"select")})},"usePayrollCalendars");import{isFuture as Me,isToday as ge,parseISO as Se}from"date-fns";var X=o(t=>{if(!t)return!1;let e=Se(t);return Me(e)||ge(e)},"isInProbationPeriod");import{Fragment as ke,jsx as m,jsxs as Ce}from"react/jsx-runtime";var lo=o(({employmentId:t,options:e,initialValues:y})=>{let{fieldValues:c,setFieldValues:ee,stepState:l,previousStep:oe,nextStep:ie}=A(q),{data:n,isLoading:te}=N({employmentId:t,queryParams:{exclude_files:!0}}),{data:ne}=G({query:{year:new Date().getFullYear().toString(),countryCode:n?.country?.code},options:{enabled:!!n?.country?.code}}),T=X(n?.probation_period_end_date),F=B(ne),P=V(()=>T?x(new Date,"yyyy-MM-dd"):x(F,"yyyy-MM-dd"),[T,F]),M=!!(n?.provisional_start_date&&Ve(j(n.provisional_start_date))),ae={personal_email:n?.basic_information?.email},g=z({...ae,...y,...l.values?.employee_communication,...l.values?.termination_details,...l.values?.paid_time_off,...l.values?.additional_information},M),d=V(()=>({...g,...c}),[c,g]),b=L({minTerminationDate:F,isEmployeeInProbationPeriod:T,selectedDate:j(d.proposed_termination_date)}),re=V(()=>{let s=R.data.schema.properties.termination_reason.oneOf,a=M?s.filter(i=>i.const==="cancellation_before_start_date"):s.filter(i=>i.const!=="cancellation_before_start_date");return{fields:{risk_assesment_info:S("Offboarding risk assessment","Employees may be protected from termination if they fall into certain categories. To help avoid claims from employees, let us know if the employee is part of one or more of these categories. Select all that apply.",{className:e?.jsfModify?.fields?.risk_assesment_info?.["x-jsf-presentation"]?.className}),termination_reason:{...e?.jsfModify?.fields?.termination_reason,oneOf:a},proposed_termination_date_info:S("Proposed termination date",Ce(ke,{children:["In most cases, Remote must provide notice to the employee before termination. The required notice period depends on local labor laws, the employment agreement, and other factors. We'll use those factors to determine the required notice period.",m(v,{external:!0,zendeskId:u.terminationNoticePeriods,className:D("text-sm",e?.jsfModify?.fields?.proposed_termination_date_info?.["x-jsf-presentation"]?.zendeskTriggerButtonClassName),children:"Learn about notice periods"})]}),{className:e?.jsfModify?.fields?.proposed_termination_date_info?.["x-jsf-presentation"]?.className}),proposed_termination_date:{...e?.jsfModify?.fields?.proposed_termination_date,"x-jsf-presentation":{...e?.jsfModify?.fields?.proposed_termination_date?.["x-jsf-presentation"],minDate:P,...d.termination_reason==="cancellation_before_start_date"&&n?.provisional_start_date?{maxDate:x(Pe(j(n.provisional_start_date),1),"yyyy-MM-dd")}:{},...b},...d.termination_reason==="cancellation_before_start_date"?{"x-jsf-errorMessage":{maximum:"The proposed termination date must be before the employee's start date."}}:{}},paid_time_off_info:{...e?.jsfModify?.fields?.paid_time_off_info,"x-jsf-presentation":{...e?.jsfModify?.fields?.paid_time_off_info?.["x-jsf-presentation"],Component:o(()=>{let i=e?.jsfModify?.fields?.paid_time_off_info?.["x-jsf-presentation"]?.Component;return m(J,{employeeName:n?.basic_information?.name,proposedTerminationDate:d.proposed_termination_date,employmentId:t,employment:n,render:r=>i?m(i,{...r}):m(Q,{...r})})},"Component")}},acknowledge_termination_procedure_info:{...e?.jsfModify?.fields?.acknowledge_termination_procedure_info,"x-jsf-presentation":{...e?.jsfModify?.fields?.acknowledge_termination_procedure_info?.["x-jsf-presentation"],Component:o(()=>{let i=e?.jsfModify?.fields?.acknowledge_termination_procedure_info?.["x-jsf-presentation"]?.Component;return m(U,{render:r=>i?m(i,{...r}):m(W,{...r})})},"Component")}},acknowledge_termination_procedure_fees_info:{...e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info,"x-jsf-presentation":{...e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info?.["x-jsf-presentation"],Component:o(()=>{let i={involuntaryOffboardingServiceChargeZendeskId:u.involuntaryOffboardingServiceCharge,reconciliationInvoiceZendeskId:u.reconciliationInvoice},r=e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info?.["x-jsf-presentation"]?.Component;return r?m(r,{...i}):m(Y,{...i})},"Component")}}}}},[n,t,d.proposed_termination_date,d.termination_reason,M,P,e?.jsfModify?.fields?.acknowledge_termination_procedure_fees_info,e?.jsfModify?.fields?.acknowledge_termination_procedure_info,e?.jsfModify?.fields?.paid_time_off_info,e?.jsfModify?.fields?.proposed_termination_date,e?.jsfModify?.fields?.proposed_termination_date_info,e?.jsfModify?.fields?.risk_assesment_info,e?.jsfModify?.fields?.termination_reason,b]),{data:f,isLoading:se}=K({formValues:d,jsfModify:{...e?.jsfModify,fields:{...e?.jsfModify?.fields,...re?.fields}},step:l.currentStep.name}),me=E(H.data.schema),k=Z(),{mutateAsync:de}=w(k);async function fe(s){if(!t)throw new Error("Employment id is missing");if(f){let a=await C(s,!0),{customer_informed_employee:i}=a,r=i==="yes"?{employee_awareness:{date:a.customer_informed_employee_date,note:a.customer_informed_employee_description}}:void 0,ue=await I(a,["agrees_to_pto_amount","confidential","customer_informed_employee","will_challenge_termination"]),_e=be(ue,"customer_informed_employee_date","customer_informed_employee_description"),ye=xe({..._e,...r},je),p=a.timesheet_file??[],h=Array.isArray(p)&&p.length>0?{content:p[0].content,name:p[0].name}:void 0,Te={employment_id:t,termination_details:{...ye,timesheet_file:h||void 0},type:"termination"};return de(Te)}}o(fe,"onSubmit");function le(){oe()}o(le,"back");function ce(){ie()}o(ce,"next");let pe=Object.keys(c).length>0,C=o(async(s,a=!1)=>a?await _(s,me.fields,{isPartialValidation:!0}):f?await _(s,f?.fields,{isPartialValidation:!0}):{},"parseFormValues");return{employmentId:t,employment:n,fieldValues:d,isDirty:pe,stepState:l,fields:f?.fields||[],isLoading:se||te,isSubmitting:k.isPending,initialValues:g,handleValidation:o(async s=>{if(f){let a=await _(s,f?.fields);return f?.handleValidation(a)}return null},"handleValidation"),checkFieldUpdates:ee,parseFormValues:C,onSubmit:fe,back:le,next:ce}},"useTermination");export{lo as a};
|
|
2
|
+
//# sourceMappingURL=chunk-L4P7572F.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as p}from"./chunk-QPN6X6UA.js";import{a}from"./chunk-BCO3C476.js";import{a as m}from"./chunk-NAGIFFJS.js";import{a as e}from"./chunk-76ZDXC2T.js";import{a as r}from"./chunk-WOH5UQMK.js";import{a as t}from"./chunk-P37U34EQ.js";import{useId as y}from"react";import{jsx as d}from"react/jsx-runtime";var P=t(({render:n,countryCode:C,options:i,initialValues:s})=>{let o=r({options:i,countryCode:C,initialValues:s}),f=y();return d(e.Provider,{value:{createCompanyBag:o,formId:f},children:n({createCompanyBag:o,components:{CompanyBasicInformationStep:m,AddressDetailsStep:a,SubmitButton:p}})})},"CreateCompanyFlow");export{P as a};
|
|
2
|
+
//# sourceMappingURL=chunk-M53HKCJ5.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as t}from"./chunk-AK4FXJFO.js";import{a as r}from"./chunk-P37U34EQ.js";import{jsx as n}from"react/jsx-runtime";function p({helpCenter:e}){return e?n(t,{zendeskId:e.id,children:e.callToAction}):null}r(p,"HelpCenter");export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-MCWXQT7A.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-V6LOIP27.js";import{b as e}from"./chunk-MRYRNB7Y.js";import{a as r}from"./chunk-P37U34EQ.js";import{jsx as u}from"react/jsx-runtime";function F({onSubmit:t,onSuccess:s,onError:m}){let{terminationBag:o}=e(),d=r(async a=>{let l=await o?.parseFormValues(a,!0);await t?.(l);let i=await o?.onSubmit(a);i?.error?m?.(i.rawError):i?.data&&await s?.(i.data)},"handleSubmit");return u(n,{defaultValues:o.fieldValues,fields:o?.fields,onSubmit:d})}r(F,"AdditionalDetailsForm");export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-N3Q636ZK.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-EKJK34DS.js";import{b as m}from"./chunk-76ZDXC2T.js";import{k as i}from"./chunk-VIGKOVHP.js";import{a}from"./chunk-P37U34EQ.js";import{jsx as d}from"react/jsx-runtime";function l({onSubmit:c,onSuccess:p,onError:t}){let{createCompanyBag:o}=m(),u=a(async r=>{try{await c?.({countryCode:r.country_code,companyOwnerEmail:r.company_owner_email,companyOwnerName:r.company_owner_name,desiredCurrency:r.desired_currency,name:r.name,phoneNumber:r.phone_number,taxNumber:r.tax_number});let n=await o.onSubmit(r);if(n?.data){await p?.(n?.data),o?.next();return}if(n?.error){let e=i(n,o.meta?.fields?.company_basic_information);t?.(e)}}catch(n){let e=i(n,o.meta?.fields?.company_basic_information);t?.(e)}},"handleSubmit"),f=o.stepState.values?.company_basic_information||o.initialValues.company_basic_information;return d(s,{defaultValues:f,onSubmit:u})}a(l,"CompanyBasicInformationStep");export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-NAGIFFJS.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as i,c as m,d as s,e as f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as i,c as m,d as s,e as f}from"./chunk-EQVUP5ZR.js";import{a as n}from"./chunk-TXSUZLOI.js";import{a}from"./chunk-P37U34EQ.js";import{useState as O}from"react";var B=a(({proposedTerminationDate:e,employeeName:y,employmentId:o,employment:r,render:d})=>{let[t,u]=O(!1),l=m({employmentId:o}),p=n(e).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),c=i({employmentId:o,options:{enabled:t}}),D=s({employmentId:o,date:e}),P=f({employmentId:o,proposedTerminationDate:e,employment:r});return d({leavePoliciesSummaryQuery:l,timeoffQuery:c||{data:{bookedDays:0,timeoffs:[]}},bookedTimeBeforeAndAfterTerminationQuery:D,formattedProposedTerminationDate:p,employeeName:y,proposedTerminationDate:e,summaryData:P??{data:{entitledDays:"0 days",bookedDays:"0 days",usedDays:"0 days",approvedDaysBeforeTermination:"0 days",approvedDaysAfterTermination:"0 days",remainingDays:"0 days",isUnlimitedPto:!1},isLoading:!1,isError:!1,error:null},employment:r,open:t,onOpenChange:a(()=>{u(T=>!T)},"onOpenChange")})},"PaidTimeOffContainer");export{B as a};
|
|
2
|
+
//# sourceMappingURL=chunk-NNW7S5AY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-V6LOIP27.js";import{b as a}from"./chunk-MRYRNB7Y.js";import{a as i}from"./chunk-P37U34EQ.js";import{jsx as s}from"react/jsx-runtime";function p({onSubmit:t}){let{terminationBag:o}=a(),n=i(async r=>{let m=await o?.parseFormValues(r);await t?.(m),o?.next()},"handleSubmit");return s(e,{defaultValues:o.fieldValues,onSubmit:n})}i(p,"TerminationDetailsForm");export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OHCA7HXR.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Z}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as Z}from"./chunk-CPXEQRNG.js";import{a as I}from"./chunk-VFRHMNLJ.js";import{a as Q,b as W,c as X,f as Y}from"./chunk-SD3LBJUH.js";import{a as C}from"./chunk-HN5HLFTB.js";import{a as G}from"./chunk-LNV36S6D.js";import{b as ee}from"./chunk-SAKDBD4P.js";import{a as z}from"./chunk-EUSCQL4H.js";import{e as M}from"./chunk-T7O3YYOG.js";import{a as K}from"./chunk-X6ZAR7ZL.js";import{a as o}from"./chunk-P37U34EQ.js";import{number as Be,object as se}from"yup";import{useCallback as je,useEffect as te,useMemo as we,useRef as Re,useState as j}from"react";import{string as ne,ValidationError as re}from"yup";import{jsx as ie}from"react/jsx-runtime";var O={title:"Estimation",includeBenefits:!1,includeCostBreakdowns:!1,includePremiumBenefits:!1,enableCurrencyConversion:!1,includeEstimationTitle:!1,includeManagementFee:!1},Pe=o(t=>z(I.data.schema,void 0,t),"useStaticSchema");function xe(t,i){if(typeof t=="object"&&t!==null&&"title"in t){let l=t.title;if(l)return l}return i==="my_hiring_budget"?"Hiring budget":"Employee's annual salary"}o(xe,"getSalaryTitle");var ze=o(({defaultRegion:t,defaultCurrency:i,defaultSalary:l,estimationOptions:s,options:n,version:a}={estimationOptions:O})=>{let u=Re({fields:{}}),[k,h]=j(t),[w,R]=j(),[m,q]=j(),[H,le]=j(),{data:_,isLoading:ue}=Q({includePremiumBenefits:s.includePremiumBenefits}),{data:d,isLoading:ce}=W(),me=k||w?.value,{data:P,isLoading:de}=Y(me,{includePremiumBenefits:s.includePremiumBenefits,options:n}),U=X(),{mutateAsync:fe}=K(U),b=w?.currency,p=n?.jsfModify?.fields?.salary,F=p&&typeof p=="object"&&"presentation"in p?p.presentation:void 0,L=je(()=>{let e=b&&m?b!==m:!1;return b!==m?{from:m,to:b,shouldSwapOrder:e}:{from:b,to:m,shouldSwapOrder:e}},[b,m]),J=s.showManagementFee,$=s.includeEstimationTitle,ge=we(()=>{let{from:e,to:r,shouldSwapOrder:c}=L(),g=xe(p,H);return{fields:{salary:{...p,title:g,presentation:{salary_conversion_properties:{label:F?.salary_conversion_properties?.label,description:F?.salary_conversion_properties?.description},currencies:{from:e,to:r},Component:o(y=>ie(Z,{...y,shouldSwapOrder:c,conversionType:a==="marketing"?"no_spread":"spread",defaultValue:l}),"Component")}},hiring_budget:{...n?.jsfModify?.fields?.hiring_budget,presentation:{hidden:a=="marketing"}},management:{...n?.jsfModify?.fields?.management,properties:{...n?.jsfModify?.fields?.management?.properties,management_fee:{...n?.jsfModify?.fields?.management?.properties?.management_fee,"x-jsf-presentation":{inputType:"money",additionalProps:{currency:m||"USD"}}}},presentation:{...typeof n?.jsfModify?.fields?.management=="object"?(n?.jsfModify?.fields?.management)["x-jsf-presentation"]:{},hidden:!J,Component:o(y=>ie(ee,{...y,variant:"inset",features:{toggle:{enabled:!0,stateField:"management._expanded",labels:{expand:"Define",collapse:"Remove"}}}}),"Component")}},estimation_title:{...n?.jsfModify?.fields?.estimation_title,"x-jsf-presentation":{hidden:!$}}}}},[L,p,H,F?.salary_conversion_properties?.label,F?.salary_conversion_properties?.description,n?.jsfModify?.fields?.hiring_budget,n?.jsfModify?.fields?.management,n?.jsfModify?.fields?.estimation_title,a,m,J,$,l]),f=Pe({jsfModify:{fields:{...n?.jsfModify?.fields,...ge?.fields}}});te(()=>{if(t&&_){let e=_.find(({value:r})=>r===t);e&&R(e)}},[t,_]),te(()=>{if(i&&d){let e=d.find(({value:r})=>r===i);e&&q(e.label)}},[i,d]);async function ye(e){return fe(oe(e,s,a))}o(ye,"onSubmit");function pe(e){let r=_?.find(({value:c})=>c===e);r&&r.childRegions.length===0&&r.hasAdditionalFields?h(r.regionSlug):h(void 0),R(r)}o(pe,"onCountryChange");function Ce(e){h(e)}o(Ce,"onRegionChange");function _e(e){le(e.target.value)}o(_e,"onHiringBudgetChange");function be(e){let r=d?.find(c=>c.value===e)?.label;q(r),n?.onCurrencyChange?.(r||"")}o(be,"onChangeCurrency");let E=f.fields.find(e=>e.name==="region");if(E){let e=w?.childRegions.map(r=>({value:r.slug,label:r.name}))??[];E.options=e,E.isVisible=e.length>0,E.required=e.length>0,E.onChange=Ce,E.schema=e.length>0?ne().transform(r=>typeof r=="string"?r:"").required("Region is required"):ne()}if(d){let e=f.fields.find(r=>r.name==="currency");e&&(e.options=d,e.onChange=be)}let v=f.fields.find(e=>e.name==="hiring_budget");if(v&&(v.onChange=_e),_){let e=f.fields.find(r=>r.name==="country");e&&(e.options=_,e.onChange=pe)}let Ee=o(()=>{R(void 0),h(t)},"resetForm"),D=[...f.fields.filter(e=>e.name!=="management"),...P?.fields||[],...f.fields.filter(e=>e.name==="management")],N=ae(f.fields,m||"USD",s.includeEstimationTitle);async function Se(e){let r=null;n?.onValidation?.(e);let c=await M(e,D);try{await N.validate(c,{abortEarly:!1}),r={formErrors:{},yupError:new re([],e)}}catch(S){let B=G(S);r={formErrors:Object.entries(B).reduce((T,[A,V])=>({...T,[A]:V.message}),{}),yupError:S}}let g=P?.handleValidation(c),y=[...r?.yupError.inner||[],...g?.yupError?.inner||[]],x={...r?.yupError?.value||{},...g?.yupError?.value||{}};return{formErrors:{...r?.formErrors||{},...g?.formErrors||{}},yupError:new re(y,x)}}return o(Se,"handleValidation"),{stepState:{current:0,total:1,isLastStep:!0},fields:D,validationSchema:N,parseFormValues:o(async e=>{let{country:r,region:c,currency:g,salary_converted:y,hiring_budget:x,salary_conversion:S,management:B,estimation_title:T,...A}=e,V=e.salary;y==="salary_conversion"&&(V=S);let he=await M({country:r,region:c,salary:V,salary_converted:y,salary_conversion:S,hiring_budget:x,currency:g,management:B,estimation_title:T},f.fields),Fe=await M(A,P?.fields||[]),Ve={currency_code:d?.find(Me=>Me.value===g)?.label};return{...he,...Fe,...Ve}},"parseFormValues"),handleValidation:Se,isSubmitting:U.isPending,isLoading:ue&&ce&&de,onSubmit:ye,resetForm:Ee,currencies:d,meta:{fields:u.current?.fields}}},"useCostCalculator");function ae(t,i,l){let s=t.reduce((n,a)=>(a.name==="salary"||a.name==="salary_conversion"?n[a.name]=a.schema.when("salary_converted",{is:o(u=>u===a.name,"is"),then:o(u=>u.required("Required field"),"then"),otherwise:o(u=>u.optional(),"otherwise")}):a.name==="management"?n[a.name]=se({management_fee:Be().transform(u=>isNaN(u)?void 0:u).min(0,"Management fee must be greater than or equal to 0").max(i?C[i]:C.USD,()=>`Management fee cannot exceed ${(i?C[i]:C.USD)/100} ${i}`)}):a.name==="estimation_title"&&l?n[a.name]=a.schema.required("Required field"):n[a.name]=a.schema,n),{});return se(s)}o(ae,"buildValidationSchema");function Te(t){let i="benefit-";return Object.keys(t).reduce((l,s)=>{let n=t[s];if(n==="none")return l;let u={benefit_group_slug:s.replace(i,""),benefit_tier_slug:n};return[...l,u]},[])}o(Te,"formatBenefits");function Ae(t,i,l){let s=Number(t.management?.management_fee),n=t.currency_code;return{...{region_slug:t.region||t.country,employment_term:t.contract_duration_type??"fixed",title:t.estimation_title||i.title,age:t.age??void 0,...t.benefits&&{benefits:Te(t.benefits)},...i.includeManagementFee&&s&&{discount:{quoted_amount:i.showManagementFee?s:C[n]||C.USD,text:""}}},...Oe(t,l)}}o(Ae,"mapValueToEmployment");function Oe(t,i){let l=i==="marketing"||t.salary_converted==="salary_conversion",s=i==="standard"&&t.salary_converted==="salary",n=t.hiring_budget==="my_hiring_budget";if(l){let a=t.salary_converted==="salary_conversion";return n?{annual_total_cost_in_employer_currency:t.salary}:{[a?"annual_gross_salary_in_employer_currency":"annual_gross_salary"]:t.salary}}return s?n?{annual_total_cost:t.salary}:{annual_gross_salary:t.salary}:{}}o(Oe,"getSalaryFields");function oe(t,i=O,l="standard"){let s=Array.isArray(t)?t:[t];if(s.length===0)throw new Error("At least one employment value is required");return s.length>1&&new Set(s.map(a=>a.currency)).size>1&&console.warn("Multiple currencies detected in array. Using currency from first employment."),{employer_currency_slug:s[0].currency,include_benefits:i.includeBenefits,include_cost_breakdowns:i.includeCostBreakdowns,include_premium_benefits:i.includePremiumBenefits,include_management_fee:i.includeManagementFee,employments:s.map(n=>Ae(n,i,l))}}o(oe,"buildPayload");export{ae as a,oe as b,O as c,ze as d};
|
|
2
|
+
//# sourceMappingURL=chunk-OXAEJWEQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l}from"./chunk-36MJ5ORQ.js";import{b as s}from"./chunk-PGWKJ6FK.js";import{b as n}from"./chunk-X6ZAR7ZL.js";import{a as t}from"./chunk-P37U34EQ.js";import{jsx as E}from"react/jsx-runtime";function S({onSubmit:d,onError:a,onSuccess:m}){let{onboardingBag:r}=s(),c=t(async i=>{try{let e=await r.parseFormValues(i);await d?.(e);let o=await r.onSubmit(i);if(o?.data){await m?.(o.data),r?.next();return}if(o?.error){let p=n(o?.fieldErrors||[],r.meta?.fields?.contract_details);a?.({error:o.error,rawError:o.rawError,fieldErrors:p})}}catch(e){a?.({error:e,rawError:e,fieldErrors:[]})}},"handleSubmit");return E(l,{defaultValues:r.stepState.values?.contract_details||r.initialValues.contract_details,onSubmit:c})}t(S,"ContractDetailsStep");export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OZKZKV5C.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{G as m,d as r}from"./chunk-2IA5ZHU4.js";import{d as o}from"./chunk-KQPDXXG3.js";import{a as e}from"./chunk-P37U34EQ.js";import{useMutation as u,useQuery as l}from"@tanstack/react-query";var h=e(({employmentId:t,queryParams:n})=>{let{client:i}=o();return l({queryKey:["employment",t],retry:!1,queryFn:e(()=>m({client:i,headers:{Authorization:""},path:{employment_id:t},query:n}),"queryFn"),enabled:!!t,select:e(({data:s})=>s?.data?.employment,"select")})},"useEmploymentQuery"),f=e(()=>{let{client:t}=o();return u({mutationFn:e(({employmentId:n})=>r({client:t,headers:{Authorization:""},path:{employment_id:n}}),"mutationFn")})},"useDiscardEmploymentMutation");export{h as a,f as b};
|
|
2
|
+
//# sourceMappingURL=chunk-PGVAOMQU.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-36MJ5ORQ.js";import{b as a}from"./chunk-PGWKJ6FK.js";import{f as t}from"./chunk-T7O3YYOG.js";import{b as s}from"./chunk-X6ZAR7ZL.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as E}from"react/jsx-runtime";function P({components:d,onSubmit:l,onError:i,onSuccess:f}){let{onboardingBag:o}=a(),p=o.fields??[],c=t(p,o.initialValues.benefits);return E(m,{defaultValues:c,components:d,onSubmit:e(async n=>{try{await l?.(n);let r=await o.onSubmit(n);if(r?.data){await f?.(r.data),o?.next();return}if(r?.error){let u=s(r?.fieldErrors||[],o.meta?.fields?.benefits);i?.({error:r.error,rawError:r.rawError,fieldErrors:u})}}catch(r){i?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit")})}e(P,"BenefitsStep");export{P as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QGGPXNVY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-6P53J6DA.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as i}from"react/jsx-runtime";var l=e(({currency:n,desiredCurrency:o,annual_gross_salary_conversion_properties:r,...a})=>i(s,{...a,sourceCurrency:n,targetCurrency:o,conversionFieldName:"annual_gross_salary_conversion",conversionProperties:{...r,description:r?.description||"Estimated amount. This is an estimation. We calculate conversions based on spot rates that are subject to fluctuation over time."},classNamePrefix:"RemoteFlows-AnnualGrossSalary",conversionType:"no_spread"}),"AnnualGrossSalary");export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QI6E2NJU.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as R,b as x,c as N,d as A}from"./chunk-KRSUSMJK.js";import{a as w,b as f}from"./chunk-A232PIG7.js";import{a as C}from"./chunk-TFSRZOMP.js";import{b as B}from"./chunk-RJY6AEJB.js";import{a as i,b as t,e as F}from"./chunk-VIGKOVHP.js";import{a as m}from"./chunk-P37U34EQ.js";import{MoreHorizontal as P}from"lucide-react";import{useState as U}from"react";import{Fragment as $,jsx as g,jsxs as T}from"react/jsx-runtime";function E({actions:e=[],className:n,label:a,"data-testid":l}){let[_,d]=U(!1);return T("div",{className:i("relative",n),children:[g(B,{"data-testid":l,variant:"ghost","aria-label":a,className:"h-8 w-8 p-0",onClick:()=>d(!_),children:g(P,{className:"h-4 w-4"})}),_&&T($,{children:[g("div",{className:"fixed inset-0 z-40",onClick:()=>d(!1)}),g("div",{className:"absolute right-0 top-1/2 mt-1 bg-white border border-gray-200 rounded-md shadow-lg z-50 min-w-[120px]",children:e.map((c,u)=>g("button",{"data-testid":`${l}-${c.label.toLowerCase().replace(" ","-")}`,className:i("w-full text-left px-2 py-1.5 text-sm hover:bg-gray-100",c.disabled&&"opacity-50 cursor-not-allowed"),onClick:()=>{c.onClick(),d(!1)},disabled:c.disabled,children:c.label},u))})]})]})}m(E,"ActionsDropdown");import{ChevronDown as O,Info as Z}from"lucide-react";import K from"react-flagpack";import{useState as z}from"react";import{jsx as j,jsxs as L}from"react/jsx-runtime";var I=m(({children:e,content:n})=>L("div",{className:"relative inline-block group",children:[e,L("div",{className:"absolute bottom-full right-0 mb-2 px-3 py-2 bg-gray-900 text-white text-xs rounded-md opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50 w-64 whitespace-normal break-words",children:[n,j("div",{className:"absolute top-full right-3 border-4 border-transparent border-t-gray-900"})]})]}),"BasicTooltip");import{Fragment as b,jsx as o,jsxs as r}from"react/jsx-runtime";var V={GB:"GB-UKM"},Y=m(({title:e,country:n,region:a,annualGrossSalary:l,onDelete:_,onExportPdf:d,onEdit:c})=>{let u=[{label:"Edit",onClick:c},{label:"Export",onClick:d},{label:"Delete",onClick:_}];return r("div",{className:"RemoteFlows__EstimationResults__Header flex justify-between",children:[r("div",{className:"flex flex-row items-center gap-6",children:[o("div",{className:"RemoteFlows__EstimationResultsHeader__FlagContainer flex h-16 w-16 items-center justify-center rounded-lg bg-[#F4F4F5]",children:o(K,{code:V[n.alpha_2_code]||n.alpha_2_code})}),r("div",{className:"space-y-1",children:[o("h2",{"data-testid":"estimation-results-header-title",className:"RemoteFlows__EstimationResultsHeader__Title text-lg font-medium leading-none text-[#181818]",children:e}),r("p",{className:"RemoteFlows__EstimationResultsHeader__Country text-xs text-[#71717A]",children:[n.name," ",a?` (${a.name})`:""]}),r("p",{"data-testid":"estimation-results-header-annual-gross-salary",className:"RemoteFlows__EstimationResultsHeader__AnnualGrossSalary text-xs text-[#71717A]",children:[o("span",{className:"text-[#181818]",children:"Employee annual gross salary:"})," ",l]})]})]}),o(E,{label:"Actions",className:"RemoteFlows__EstimationResults__ActionsDropdown",actions:u})]})},"EstimationResultsHeader"),q=m(()=>({steps:[{id:"add-employment-details",title:"Add employment details",description:"You add employee employments details."},{id:"invite-employee",title:"Invite employee",description:"Hire receives an email invitation from Remote to start the self-enrollment process."},{id:"verify-information",title:"Verify information",description:"Remote prepares the Employment Agreement and verifies all the information."},{id:"sign-contract",title:"Sign contract",description:"All parties sign the Employment Agreement and are ready to start. \u{1F389}"}],helpText:"For customers who accept Remote's Terms of Service (ToS), the employee onboarding timeline starts once the employee has been invited to the platform and completed self enrollment.",zendeskArticleId:w.employeeOnboardingTimeline}),"getOnboardingTimelineData");function J({minimumOnboardingDays:e,data:n,className:a}){return o(R,{type:"single",collapsible:!0,className:i("RemoteFlows__EstimationResults__OnboardingTimeline w-full",a),children:r(x,{value:"timeline",className:"RemoteFlows__OnboardingTimeline__AccordionItem border-border",children:[o(N,{className:"RemoteFlows__OnboardingTimeline__AccordionTrigger hover:no-underline px-0 py-4",children:r("div",{className:"flex items-center justify-between w-full",children:[o("span",{className:"RemoteFlows__OnboardingTimeline__Title text-base font-medium text-[#0F172A]",children:"Onboarding timeline"}),e!=null&&r("span",{className:"RemoteFlows__OnboardingTimeline__Description text-base text-muted-foreground mr-4",children:[e," days"]})]})}),r(A,{className:"px-0 pb-4",children:[o("ul",{className:"RemoteFlows__OnboardingTimeline__List list-disc list-inside space-y-2",children:n.steps.map(l=>r("li",{children:[o("strong",{className:"font-medium text-[#09090B]",children:l.title})," ","- ",l.description]},l.id))}),r("p",{className:"RemoteFlows__OnboardingTimeline__HelpText text-xs text-muted-foreground mt-4",children:[n.helpText,n.zendeskArticleId&&o(f,{zendeskId:n.zendeskArticleId,children:"Learn more"})]})]})]})})}m(J,"OnboardingTimeline");function Q({className:e,countryBenefitsUrl:n,countryGuideUrl:a,country:l}){return o(R,{type:"single",collapsible:!0,className:i("RemoteFlows__EstimationResults__HiringSection w-full",e),children:r(x,{value:"timeline",className:"RemoteFlows__HiringSection__AccordionItem border-border",children:[o(N,{className:"RemoteFlows__HiringSection__AccordionTrigger hover:no-underline px-0 py-4",children:o("div",{className:"flex items-center justify-between w-full",children:r("span",{className:"text-base font-medium text-[#0F172A]",children:["Hiring in ",l.name]})})}),o(A,{children:r("div",{className:"flex flex-col gap-1",children:[a&&o("a",{href:a,target:"_blank",className:"RemoteFlows__Link",children:"Explore our complete guide \u2197"}),n&&o("a",{href:n,target:"_blank",className:"RemoteFlows__Link",children:"Explore our available benefits \u2197"})]})})]})})}m(Q,"HiringSection");function W({isMultipleCurrency:e,className:n}){return r("div",{className:i("RemoteFlows__EstimationResults__Headers grid grid-cols-3 items-center",n),children:[o("span",{"aria-hidden":!0}),e?r(b,{children:[o("span",{className:"RemoteFlows__EstimationResults__Headers__Label",children:"Employee currency"}),o("span",{className:"RemoteFlows__EstimationResults__Headers__Label",children:"Employer currency"})]}):r(b,{children:[o("span",{}),o("span",{className:"RemoteFlows__EstimationResults__Headers__Label",children:"Amount"})]})]})}m(W,"EstimationHeaders");function S({label:e,amounts:n,className:a,children:l}){let[_,d]=z(!0);return r("div",{className:i("RemoteFlows__EstimationResults__Row",a),children:[r("div",{className:"RemoteFlows__EstimationRow__Grid grid grid-cols-3 items-center",children:[r("div",{className:"RemoteFlows__EstimationRow__LabelContainer flex items-center gap-2",children:[o("span",{className:i("RemoteFlows__EstimationRow__Title min-w-[140px] font-medium text-[#09090B]"),children:e}),o("button",{onClick:()=>d(!_),className:"RemoteFlows__EstimationRow__CollapseButton p-1 hover:bg-gray-100 rounded",children:o(O,{className:`h-4 w-4 text-muted-foreground transition-transform ${_?"rotate-180":""}`})})]}),Array.isArray(n)?n.map((c,u)=>o("span",{className:i("RemoteFlows__EstimationRow__RegionalAmount text-right font-medium text-[#09090B]"),children:c},u)):r(b,{children:[o("span",{}),o("span",{className:i("RemoteFlows__EstimationRow__EmployerAmount text-right font-medium text-[#09090B]"),children:n})]})]}),_&&l&&o("div",{className:"RemoteFlows__EstimationRow__CollapsibleContent mt-4",children:l})]})}m(S,"EstimationRow");function X({item:e,isMultipleCurrency:n,level:a=0}){let[l,_]=z(!1),d=e.children&&e.children.length>0,c=a>0,u=e.isCollapsible||d;return r("li",{className:i("RemoteFlows__BreakdownList__Item pb-3",c&&"pb-1"),children:[r("div",{className:i(n?"RemoteFlows__BreakdownList__Grid grid grid-cols-3 items-center justify-between":"RemoteFlows__BreakdownList__Grid grid grid-cols-2 items-center justify-between"),children:[r("div",{className:i("RemoteFlows__BreakdownList__LabelContainer flex items-center gap-2",c&&"pl-3"),children:[!c&&o("span",{className:"RemoteFlows__BreakdownList__Bullet w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0","aria-hidden":"true"}),u?r("button",{onClick:()=>_(!l),className:"RemoteFlows__BreakdownList__CollapseButton flex items-center gap-2 hover:bg-gray-100 rounded p-1",children:[o("span",{className:i(c?"RemoteFlows__BreakdownList__Text--Nested text-xs text-[#71717A]":"RemoteFlows__BreakdownList__Text--NotNested text-sm text-[#09090B]"),children:e.label}),o(O,{className:`RemoteFlows__BreakdownList__ChevronDown h-3 w-3 text-muted-foreground transition-transform ${l?"rotate-180":""}`})]}):o("span",{className:i(c?"RemoteFlows__BreakdownList__Text--Nested text-xs text-[#71717A]":"RemoteFlows__BreakdownList__Text--NotNested text-sm text-[#09090B] p-1"),children:e.label}),e.tooltip&&o(I,{content:r(b,{children:[o("span",{dangerouslySetInnerHTML:{__html:F(e.tooltip)}})," ",e.zendeskId&&o(f,{zendeskId:Number(e.zendeskId),children:"Learn more"})]}),children:o("button",{className:"RemoteFlows__BreakdownList__InfoButton p-1 hover:bg-gray-100 rounded",children:o(Z,{className:i("RemoteFlows__BreakdownList__InfoButton__Icon text-muted-foreground",c?"h-3 w-3":"h-4 w-4")})})})]}),n?r(b,{children:[o("span",{"data-testid":e.dataSelector&&e.dataSelector+"-employee-amount",className:i("RemoteFlows__BreakdownList__RegionalAmountText text-sm text-right",c?"RemoteFlows__BreakdownList__RegionalAmountText--Nested text-[#71717A]":"RemoteFlows__BreakdownList__RegionalAmountText--NotNested text-[#09090B]"),children:e.regionalAmount||"\u2014"}),o("span",{"data-testid":e.dataSelector&&e.dataSelector+"-employer-amount",className:i("RemoteFlows__BreakdownList__EmployerAmountText text-sm text-right",c?"RemoteFlows__BreakdownList__EmployerAmountText--Nested text-[#71717A]":"RemoteFlows__BreakdownList__EmployerAmountText--NotNested text-[#09090B]"),children:e.employerAmount||"\u2014"})]}):o("span",{"data-testid":e.dataSelector,className:i("RemoteFlows__BreakdownList__RegionalAmountText text-sm text-right",c?"RemoteFlows__BreakdownList__RegionalAmountText--Nested text-[#71717A]":"RemoteFlows__BreakdownList__RegionalAmountText--NotNested text-[#09090B]"),children:e.regionalAmount||"\u2014"})]}),d&&l&&o("div",{className:"mt-1",children:o(h,{items:e.children,isMultipleCurrency:n,level:a+1})})]})}m(X,"BreakdownListItem");function h({items:e,isMultipleCurrency:n,className:a,level:l}){return o("ul",{className:i("RemoteFlows__BreakdownList list-none",a),children:e.map((_,d)=>o(X,{item:_,isMultipleCurrency:n,level:l},d))})}m(h,"BreakdownList");var Re=m(({estimation:e,title:n,components:a,onDelete:l,onExportPdf:_,onEdit:d})=>{let c=a?.HiringSection||Q,u=a?.OnboardingTimeline||J,H=a?.Header||Y,v=a?.Footer,D=q(),p=e.employer_currency_costs.currency.code!==e.regional_currency_costs.currency.code,k=e.employer_currency_costs.monthly_management_fee,M=e.region.code!==e.country.code,G=t(e.regional_currency_costs.annual_gross_salary,e.regional_currency_costs.currency.code);return r(C,{className:"RemoteFlows__EstimationResults__Card p-10",children:[o("div",{className:"RemoteFlows__Separator",children:o(H,{title:n,annualGrossSalary:G,region:M?e.region:void 0,country:e.country,onDelete:l,onExportPdf:_,onEdit:d})}),r("div",{className:"RemoteFlows__Separator",children:[o(W,{isMultipleCurrency:p,className:"mb-3"}),o(S,{label:"Monthly total cost",amounts:p?[t(e.regional_currency_costs.monthly_total,e.regional_currency_costs.currency.code),t(e.employer_currency_costs.monthly_total,e.employer_currency_costs.currency.code)]:t(e.regional_currency_costs.monthly_total,e.regional_currency_costs.currency.code),children:o(h,{items:[{label:"Gross monthly salary",regionalAmount:t(e.regional_currency_costs.monthly_gross_salary,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.monthly_gross_salary,e.employer_currency_costs.currency.code),zendeskId:w.extraPayments.toString(),tooltip:"This country respects extra payments on top of the gross salary."},{label:"Mandatory employer costs",regionalAmount:t(e.regional_currency_costs.monthly_contributions_total,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.monthly_contributions_total,e.employer_currency_costs.currency.code),children:e.employer_currency_costs.monthly_contributions_breakdown?.map((s,y)=>({label:s.name,regionalAmount:t(e.regional_currency_costs.monthly_contributions_breakdown?.[y]?.amount,e.regional_currency_costs.currency.code),employerAmount:t(s.amount,e.employer_currency_costs.currency.code),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},{label:"Benefits",regionalAmount:t(e.regional_currency_costs.monthly_benefits_total,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.monthly_benefits_total,e.employer_currency_costs.currency.code),children:e.employer_currency_costs.monthly_benefits_breakdown?.map((s,y)=>({label:s.name,regionalAmount:t(e.regional_currency_costs.monthly_benefits_breakdown?.[y]?.amount,e.regional_currency_costs.currency.code),employerAmount:t(s.amount,e.employer_currency_costs.currency.code),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},...k?[{label:"Monthly fee",regionalAmount:t(e.regional_currency_costs.monthly_management_fee,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.monthly_management_fee,e.employer_currency_costs.currency.code),tooltip:"Discounts may be available based on your commitment and team size. Speak to your account or customer success manager to learn more."}]:[]],isMultipleCurrency:p})})]}),o("div",{className:"RemoteFlows__Separator",children:o(S,{label:"Annual total cost",amounts:p?[t(e.regional_currency_costs.annual_total,e.regional_currency_costs.currency.code),t(e.employer_currency_costs.annual_total,e.employer_currency_costs.currency.code)]:t(e.regional_currency_costs.annual_total,e.regional_currency_costs.currency.code),children:o(h,{items:[{label:"Gross annual salary",dataSelector:"annual-gross-salary",regionalAmount:t(e.regional_currency_costs.annual_gross_salary,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.annual_gross_salary,e.employer_currency_costs.currency.code)},{label:"Mandatory employer costs",regionalAmount:t(e.regional_currency_costs.annual_contributions_total,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.annual_contributions_total,e.employer_currency_costs.currency.code),children:e.employer_currency_costs.annual_contributions_breakdown?.map((s,y)=>({label:s.name,regionalAmount:t(e.regional_currency_costs.annual_contributions_breakdown?.[y]?.amount,e.regional_currency_costs.currency.code),employerAmount:t(s.amount,e.employer_currency_costs.currency.code),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},{label:"Benefits",regionalAmount:t(e.regional_currency_costs.annual_benefits_total,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.annual_benefits_total,e.employer_currency_costs.currency.code),children:e.employer_currency_costs.annual_benefits_breakdown?.map((s,y)=>({label:s.name,regionalAmount:t(e.regional_currency_costs.annual_benefits_breakdown?.[y]?.amount,e.regional_currency_costs.currency.code),employerAmount:t(s.amount,e.employer_currency_costs.currency.code),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},{label:"Extra statutory payments",regionalAmount:t(e.regional_currency_costs.extra_statutory_payments_total,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.extra_statutory_payments_total,e.employer_currency_costs.currency.code),children:e.employer_currency_costs.extra_statutory_payments_breakdown?.map((s,y)=>({label:s.name,regionalAmount:t(e.regional_currency_costs.extra_statutory_payments_breakdown?.[y]?.amount,e.regional_currency_costs.currency.code),employerAmount:t(s.amount,e.employer_currency_costs.currency.code),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},...k?[{label:"Annual fee",regionalAmount:t(e.regional_currency_costs.annual_management_fee,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.annual_management_fee,e.employer_currency_costs.currency.code),tooltip:"Discounts may be available based on your commitment and team size. Speak to your account or customer success manager to learn more."}]:[]],isMultipleCurrency:p})})}),o("div",{className:"RemoteFlows__Separator",children:o(u,{minimumOnboardingDays:e.minimum_onboarding_time,data:D})}),o(c,{countryBenefitsUrl:e.country_benefits_details_url,countryGuideUrl:e.country_guide_url,country:e.country}),v&&o(v,{})]})},"EstimationResults");export{Re as a};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as R,b as x,c as N,d as A}from"./chunk-KRSUSMJK.js";import{a as w,b as f}from"./chunk-AK4FXJFO.js";import{a as C}from"./chunk-TFSRZOMP.js";import{b as B}from"./chunk-RJY6AEJB.js";import{a as i,b as t,e as F}from"./chunk-VIGKOVHP.js";import{a as m}from"./chunk-P37U34EQ.js";import{MoreHorizontal as P}from"lucide-react";import{useState as U}from"react";import{Fragment as $,jsx as g,jsxs as T}from"react/jsx-runtime";function E({actions:e=[],className:n,label:a,"data-testid":l}){let[_,d]=U(!1);return T("div",{className:i("relative",n),children:[g(B,{"data-testid":l,variant:"ghost","aria-label":a,className:"h-8 w-8 p-0",onClick:()=>d(!_),children:g(P,{className:"h-4 w-4"})}),_&&T($,{children:[g("div",{className:"fixed inset-0 z-40",onClick:()=>d(!1)}),g("div",{className:"absolute right-0 top-1/2 mt-1 bg-white border border-gray-200 rounded-md shadow-lg z-50 min-w-[120px]",children:e.map((c,u)=>g("button",{"data-testid":`${l}-${c.label.toLowerCase().replace(" ","-")}`,className:i("w-full text-left px-2 py-1.5 text-sm hover:bg-gray-100",c.disabled&&"opacity-50 cursor-not-allowed"),onClick:()=>{c.onClick(),d(!1)},disabled:c.disabled,children:c.label},u))})]})]})}m(E,"ActionsDropdown");import{ChevronDown as O,Info as Z}from"lucide-react";import K from"react-flagpack";import{useState as z}from"react";import{jsx as j,jsxs as L}from"react/jsx-runtime";var I=m(({children:e,content:n})=>L("div",{className:"relative inline-block group",children:[e,L("div",{className:"absolute bottom-full right-0 mb-2 px-3 py-2 bg-gray-900 text-white text-xs rounded-md opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50 w-64 whitespace-normal break-words",children:[n,j("div",{className:"absolute top-full right-3 border-4 border-transparent border-t-gray-900"})]})]}),"BasicTooltip");import{Fragment as b,jsx as o,jsxs as r}from"react/jsx-runtime";var V={GB:"GB-UKM"},Y=m(({title:e,country:n,region:a,annualGrossSalary:l,onDelete:_,onExportPdf:d,onEdit:c})=>{let u=[{label:"Edit",onClick:c},{label:"Export",onClick:d},{label:"Delete",onClick:_}];return r("div",{className:"RemoteFlows__EstimationResults__Header flex justify-between",children:[r("div",{className:"flex flex-row items-center gap-6",children:[o("div",{className:"RemoteFlows__EstimationResultsHeader__FlagContainer flex h-16 w-16 items-center justify-center rounded-lg bg-[#F4F4F5]",children:o(K,{code:V[n.alpha_2_code]||n.alpha_2_code})}),r("div",{className:"space-y-1",children:[o("h2",{"data-testid":"estimation-results-header-title",className:"RemoteFlows__EstimationResultsHeader__Title text-lg font-medium leading-none text-[#181818]",children:e}),r("p",{className:"RemoteFlows__EstimationResultsHeader__Country text-xs text-[#71717A]",children:[n.name," ",a?` (${a.name})`:""]}),r("p",{"data-testid":"estimation-results-header-annual-gross-salary",className:"RemoteFlows__EstimationResultsHeader__AnnualGrossSalary text-xs text-[#71717A]",children:[o("span",{className:"text-[#181818]",children:"Employee annual gross salary:"})," ",l]})]})]}),o(E,{label:"Actions",className:"RemoteFlows__EstimationResults__ActionsDropdown",actions:u})]})},"EstimationResultsHeader"),q=m(()=>({steps:[{id:"add-employment-details",title:"Add employment details",description:"You add employee employments details."},{id:"invite-employee",title:"Invite employee",description:"Hire receives an email invitation from Remote to start the self-enrollment process."},{id:"verify-information",title:"Verify information",description:"Remote prepares the Employment Agreement and verifies all the information."},{id:"sign-contract",title:"Sign contract",description:"All parties sign the Employment Agreement and are ready to start. \u{1F389}"}],helpText:"For customers who accept Remote's Terms of Service (ToS), the employee onboarding timeline starts once the employee has been invited to the platform and completed self enrollment.",zendeskArticleId:w.employeeOnboardingTimeline}),"getOnboardingTimelineData");function J({minimumOnboardingDays:e,data:n,className:a}){return o(R,{type:"single",collapsible:!0,className:i("RemoteFlows__EstimationResults__OnboardingTimeline w-full",a),children:r(x,{value:"timeline",className:"RemoteFlows__OnboardingTimeline__AccordionItem border-border",children:[o(N,{className:"RemoteFlows__OnboardingTimeline__AccordionTrigger hover:no-underline px-0 py-4",children:r("div",{className:"flex items-center justify-between w-full",children:[o("span",{className:"RemoteFlows__OnboardingTimeline__Title text-base font-medium text-[#0F172A]",children:"Onboarding timeline"}),e!=null&&r("span",{className:"RemoteFlows__OnboardingTimeline__Description text-base text-muted-foreground mr-4",children:[e," days"]})]})}),r(A,{className:"px-0 pb-4",children:[o("ul",{className:"RemoteFlows__OnboardingTimeline__List list-disc list-inside space-y-2",children:n.steps.map(l=>r("li",{children:[o("strong",{className:"font-medium text-[#09090B]",children:l.title})," ","- ",l.description]},l.id))}),r("p",{className:"RemoteFlows__OnboardingTimeline__HelpText text-xs text-muted-foreground mt-4",children:[n.helpText,n.zendeskArticleId&&o(f,{zendeskId:n.zendeskArticleId,children:"Learn more"})]})]})]})})}m(J,"OnboardingTimeline");function Q({className:e,countryBenefitsUrl:n,countryGuideUrl:a,country:l}){return o(R,{type:"single",collapsible:!0,className:i("RemoteFlows__EstimationResults__HiringSection w-full",e),children:r(x,{value:"timeline",className:"RemoteFlows__HiringSection__AccordionItem border-border",children:[o(N,{className:"RemoteFlows__HiringSection__AccordionTrigger hover:no-underline px-0 py-4",children:o("div",{className:"flex items-center justify-between w-full",children:r("span",{className:"text-base font-medium text-[#0F172A]",children:["Hiring in ",l.name]})})}),o(A,{children:r("div",{className:"flex flex-col gap-1",children:[a&&o("a",{href:a,target:"_blank",className:"RemoteFlows__Link",children:"Explore our complete guide \u2197"}),n&&o("a",{href:n,target:"_blank",className:"RemoteFlows__Link",children:"Explore our available benefits \u2197"})]})})]})})}m(Q,"HiringSection");function W({isMultipleCurrency:e,className:n}){return r("div",{className:i("RemoteFlows__EstimationResults__Headers grid grid-cols-3 items-center",n),children:[o("span",{"aria-hidden":!0}),e?r(b,{children:[o("span",{className:"RemoteFlows__EstimationResults__Headers__Label",children:"Employee currency"}),o("span",{className:"RemoteFlows__EstimationResults__Headers__Label",children:"Employer currency"})]}):r(b,{children:[o("span",{}),o("span",{className:"RemoteFlows__EstimationResults__Headers__Label",children:"Amount"})]})]})}m(W,"EstimationHeaders");function S({label:e,amounts:n,className:a,children:l}){let[_,d]=z(!0);return r("div",{className:i("RemoteFlows__EstimationResults__Row",a),children:[r("div",{className:"RemoteFlows__EstimationRow__Grid grid grid-cols-3 items-center",children:[r("div",{className:"RemoteFlows__EstimationRow__LabelContainer flex items-center gap-2",children:[o("span",{className:i("RemoteFlows__EstimationRow__Title min-w-[140px] font-medium text-[#09090B]"),children:e}),o("button",{onClick:()=>d(!_),className:"RemoteFlows__EstimationRow__CollapseButton p-1 hover:bg-gray-100 rounded",children:o(O,{className:`h-4 w-4 text-muted-foreground transition-transform ${_?"rotate-180":""}`})})]}),Array.isArray(n)?n.map((c,u)=>o("span",{className:i("RemoteFlows__EstimationRow__RegionalAmount text-right font-medium text-[#09090B]"),children:c},u)):r(b,{children:[o("span",{}),o("span",{className:i("RemoteFlows__EstimationRow__EmployerAmount text-right font-medium text-[#09090B]"),children:n})]})]}),_&&l&&o("div",{className:"RemoteFlows__EstimationRow__CollapsibleContent mt-4",children:l})]})}m(S,"EstimationRow");function X({item:e,isMultipleCurrency:n,level:a=0}){let[l,_]=z(!1),d=e.children&&e.children.length>0,c=a>0,u=e.isCollapsible||d;return r("li",{className:i("RemoteFlows__BreakdownList__Item pb-3",c&&"pb-1"),children:[r("div",{className:i(n?"RemoteFlows__BreakdownList__Grid grid grid-cols-3 items-center justify-between":"RemoteFlows__BreakdownList__Grid grid grid-cols-2 items-center justify-between"),children:[r("div",{className:i("RemoteFlows__BreakdownList__LabelContainer flex items-center gap-2",c&&"pl-3"),children:[!c&&o("span",{className:"RemoteFlows__BreakdownList__Bullet w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0","aria-hidden":"true"}),u?r("button",{onClick:()=>_(!l),className:"RemoteFlows__BreakdownList__CollapseButton flex items-center gap-2 hover:bg-gray-100 rounded p-1",children:[o("span",{className:i(c?"RemoteFlows__BreakdownList__Text--Nested text-xs text-[#71717A]":"RemoteFlows__BreakdownList__Text--NotNested text-sm text-[#09090B]"),children:e.label}),o(O,{className:`RemoteFlows__BreakdownList__ChevronDown h-3 w-3 text-muted-foreground transition-transform ${l?"rotate-180":""}`})]}):o("span",{className:i(c?"RemoteFlows__BreakdownList__Text--Nested text-xs text-[#71717A]":"RemoteFlows__BreakdownList__Text--NotNested text-sm text-[#09090B] p-1"),children:e.label}),e.tooltip&&o(I,{content:r(b,{children:[o("span",{dangerouslySetInnerHTML:{__html:F(e.tooltip)}})," ",e.zendeskId&&o(f,{zendeskId:Number(e.zendeskId),children:"Learn more"})]}),children:o("button",{className:"RemoteFlows__BreakdownList__InfoButton p-1 hover:bg-gray-100 rounded",children:o(Z,{className:i("RemoteFlows__BreakdownList__InfoButton__Icon text-muted-foreground",c?"h-3 w-3":"h-4 w-4")})})})]}),n?r(b,{children:[o("span",{"data-testid":e.dataSelector&&e.dataSelector+"-employee-amount",className:i("RemoteFlows__BreakdownList__RegionalAmountText text-sm text-right",c?"RemoteFlows__BreakdownList__RegionalAmountText--Nested text-[#71717A]":"RemoteFlows__BreakdownList__RegionalAmountText--NotNested text-[#09090B]"),children:e.regionalAmount||"\u2014"}),o("span",{"data-testid":e.dataSelector&&e.dataSelector+"-employer-amount",className:i("RemoteFlows__BreakdownList__EmployerAmountText text-sm text-right",c?"RemoteFlows__BreakdownList__EmployerAmountText--Nested text-[#71717A]":"RemoteFlows__BreakdownList__EmployerAmountText--NotNested text-[#09090B]"),children:e.employerAmount||"\u2014"})]}):o("span",{"data-testid":e.dataSelector,className:i("RemoteFlows__BreakdownList__RegionalAmountText text-sm text-right",c?"RemoteFlows__BreakdownList__RegionalAmountText--Nested text-[#71717A]":"RemoteFlows__BreakdownList__RegionalAmountText--NotNested text-[#09090B]"),children:e.regionalAmount||"\u2014"})]}),d&&l&&o("div",{className:"mt-1",children:o(h,{items:e.children,isMultipleCurrency:n,level:a+1})})]})}m(X,"BreakdownListItem");function h({items:e,isMultipleCurrency:n,className:a,level:l}){return o("ul",{className:i("RemoteFlows__BreakdownList list-none",a),children:e.map((_,d)=>o(X,{item:_,isMultipleCurrency:n,level:l},d))})}m(h,"BreakdownList");var Re=m(({estimation:e,title:n,components:a,onDelete:l,onExportPdf:_,onEdit:d})=>{let c=a?.HiringSection||Q,u=a?.OnboardingTimeline||J,H=a?.Header||Y,v=a?.Footer,D=q(),p=e.employer_currency_costs.currency.code!==e.regional_currency_costs.currency.code,k=e.employer_currency_costs.monthly_management_fee,M=e.region.code!==e.country.code,G=t(e.regional_currency_costs.annual_gross_salary,e.regional_currency_costs.currency.code);return r(C,{className:"RemoteFlows__EstimationResults__Card p-10",children:[o("div",{className:"RemoteFlows__Separator",children:o(H,{title:n,annualGrossSalary:G,region:M?e.region:void 0,country:e.country,onDelete:l,onExportPdf:_,onEdit:d})}),r("div",{className:"RemoteFlows__Separator",children:[o(W,{isMultipleCurrency:p,className:"mb-3"}),o(S,{label:"Monthly total cost",amounts:p?[t(e.regional_currency_costs.monthly_total,e.regional_currency_costs.currency.code),t(e.employer_currency_costs.monthly_total,e.employer_currency_costs.currency.code)]:t(e.regional_currency_costs.monthly_total,e.regional_currency_costs.currency.code),children:o(h,{items:[{label:"Gross monthly salary",regionalAmount:t(e.regional_currency_costs.monthly_gross_salary,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.monthly_gross_salary,e.employer_currency_costs.currency.code),zendeskId:w.extraPayments.toString(),tooltip:"This country respects extra payments on top of the gross salary."},{label:"Mandatory employer costs",regionalAmount:t(e.regional_currency_costs.monthly_contributions_total,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.monthly_contributions_total,e.employer_currency_costs.currency.code),children:e.employer_currency_costs.monthly_contributions_breakdown?.map((s,y)=>({label:s.name,regionalAmount:t(e.regional_currency_costs.monthly_contributions_breakdown?.[y]?.amount,e.regional_currency_costs.currency.code),employerAmount:t(s.amount,e.employer_currency_costs.currency.code),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},{label:"Benefits",regionalAmount:t(e.regional_currency_costs.monthly_benefits_total,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.monthly_benefits_total,e.employer_currency_costs.currency.code),children:e.employer_currency_costs.monthly_benefits_breakdown?.map((s,y)=>({label:s.name,regionalAmount:t(e.regional_currency_costs.monthly_benefits_breakdown?.[y]?.amount,e.regional_currency_costs.currency.code),employerAmount:t(s.amount,e.employer_currency_costs.currency.code),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},...k?[{label:"Monthly fee",regionalAmount:t(e.regional_currency_costs.monthly_management_fee,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.monthly_management_fee,e.employer_currency_costs.currency.code),tooltip:"Discounts may be available based on your commitment and team size. Speak to your account or customer success manager to learn more."}]:[]],isMultipleCurrency:p})})]}),o("div",{className:"RemoteFlows__Separator",children:o(S,{label:"Annual total cost",amounts:p?[t(e.regional_currency_costs.annual_total,e.regional_currency_costs.currency.code),t(e.employer_currency_costs.annual_total,e.employer_currency_costs.currency.code)]:t(e.regional_currency_costs.annual_total,e.regional_currency_costs.currency.code),children:o(h,{items:[{label:"Gross annual salary",dataSelector:"annual-gross-salary",regionalAmount:t(e.regional_currency_costs.annual_gross_salary,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.annual_gross_salary,e.employer_currency_costs.currency.code)},{label:"Mandatory employer costs",regionalAmount:t(e.regional_currency_costs.annual_contributions_total,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.annual_contributions_total,e.employer_currency_costs.currency.code),children:e.employer_currency_costs.annual_contributions_breakdown?.map((s,y)=>({label:s.name,regionalAmount:t(e.regional_currency_costs.annual_contributions_breakdown?.[y]?.amount,e.regional_currency_costs.currency.code),employerAmount:t(s.amount,e.employer_currency_costs.currency.code),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},{label:"Benefits",regionalAmount:t(e.regional_currency_costs.annual_benefits_total,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.annual_benefits_total,e.employer_currency_costs.currency.code),children:e.employer_currency_costs.annual_benefits_breakdown?.map((s,y)=>({label:s.name,regionalAmount:t(e.regional_currency_costs.annual_benefits_breakdown?.[y]?.amount,e.regional_currency_costs.currency.code),employerAmount:t(s.amount,e.employer_currency_costs.currency.code),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},{label:"Extra statutory payments",regionalAmount:t(e.regional_currency_costs.extra_statutory_payments_total,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.extra_statutory_payments_total,e.employer_currency_costs.currency.code),children:e.employer_currency_costs.extra_statutory_payments_breakdown?.map((s,y)=>({label:s.name,regionalAmount:t(e.regional_currency_costs.extra_statutory_payments_breakdown?.[y]?.amount,e.regional_currency_costs.currency.code),employerAmount:t(s.amount,e.employer_currency_costs.currency.code),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},...k?[{label:"Annual fee",regionalAmount:t(e.regional_currency_costs.annual_management_fee,e.regional_currency_costs.currency.code),employerAmount:t(e.employer_currency_costs.annual_management_fee,e.employer_currency_costs.currency.code),tooltip:"Discounts may be available based on your commitment and team size. Speak to your account or customer success manager to learn more."}]:[]],isMultipleCurrency:p})})}),o("div",{className:"RemoteFlows__Separator",children:o(u,{minimumOnboardingDays:e.minimum_onboarding_time,data:D})}),o(c,{countryBenefitsUrl:e.country_benefits_details_url,countryGuideUrl:e.country_guide_url,country:e.country}),v&&o(v,{})]})},"EstimationResults");export{Re as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QNWTCGRD.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as v}from"./chunk-SNECOPBD.js";import{i as U}from"./chunk-T7O3YYOG.js";import{b as L,c as O,f as G}from"./chunk-EHD2YB5F.js";import{a as I}from"./chunk-SS2FAFUZ.js";import{a as z}from"./chunk-TOQPDTGG.js";import{b as J}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as v}from"./chunk-SNECOPBD.js";import{i as U}from"./chunk-T7O3YYOG.js";import{b as L,c as O,f as G}from"./chunk-EHD2YB5F.js";import{a as I}from"./chunk-SS2FAFUZ.js";import{a as z}from"./chunk-TOQPDTGG.js";import{b as J}from"./chunk-AK4FXJFO.js";import{c as d,h as g}from"./chunk-H2JFQGQJ.js";import{a as R,e as H}from"./chunk-VIGKOVHP.js";import{b as C}from"./chunk-KQPDXXG3.js";import{a as n}from"./chunk-P37U34EQ.js";import{Fragment as fe,useEffect as Pe,useRef as ge}from"react";import{jsx as Z}from"react/jsx-runtime";function q({description:e,label:t,name:i,minDate:l,maxDate:s,onChange:p,component:r,...c}){let{components:h}=C(),{control:u}=d(),F;c.meta?.mot&&typeof c.meta.mot=="number"?F=U(c.meta.mot):typeof l=="string"&&(F=new Date(`${l}T00:00:00`));let a;return s&&(a=new Date(`${s}T23:59:59`)),Z(g,{control:u,name:i,render:({field:f,fieldState:S})=>{let m=r||h?.date;if(!m)throw new Error(`Date picker component not found for field ${i}`);let y={description:e,label:t,name:i,onChange:p,...F&&{minDate:F.toISOString()},...a&&{maxDate:a.toISOString()},...c};return Z(m,{field:{...f,onChange:n(x=>{f.onChange(x),p?.(x)},"onChange")},fieldState:S,fieldData:y})}})}n(q,"DatePickerField");import{jsx as K}from"react/jsx-runtime";var xe=n((e,t)=>{if(!t)return null;for(let i of e)if(i.size>t){let l=Math.round(t/1048576),s=Math.round(i.size/(1024*1024));return`File "${i.name}" exceeds maximum size of ${l}MB (file is ${s}MB)`}return null},"validateFileSize");function Q({name:e,description:t,label:i,multiple:l,onChange:s,component:p,accept:r,maxSize:c,...h}){let{components:u}=C(),{control:F,setError:a,clearErrors:f}=d(),S=n(async(m,y)=>{let x=xe(m,c);if(x){a(e,{message:x});return}f(e),y.onChange(m),s?.(m)},"handleOnChange");return K(g,{control:F,name:e,render:({field:m,fieldState:y})=>{let x=p||u.file;if(!x)throw new Error(`File upload component not found for field ${e}`);let P={name:e,description:t,label:i,multiple:l,accept:r,maxFileSize:c,...h};return K(x,{field:{...m,value:m.value,onChange:n(async T=>S(T,m),"onChange")},fieldState:y,fieldData:P})}})}n(Q,"FileUploadField");import{jsx as X}from"react/jsx-runtime";function N(e){let{components:t}=C(),{control:i}=d(),l=e.component||t.number;if(!l)throw new Error(`Number component not found for field ${e.name}`);return X(g,{control:i,name:e.name,render:({field:s,fieldState:p})=>X(l,{field:{...s,onChange:n(r=>{s.onChange(r),e.onChange?.(r)},"onChange")},fieldState:p,fieldData:e})})}n(N,"NumberField");import{jsx as Y}from"react/jsx-runtime";function j({name:e,defaultValue:t,description:i,label:l,options:s,onChange:p,component:r,...c}){let{components:h}=C(),{control:u}=d();return Y(g,{control:u,name:e,defaultValue:t,render:({field:F,fieldState:a})=>{let f=r||h?.radio;if(!f)throw new Error(`Radio group component not found for field ${e}`);let S={name:e,defaultValue:t,description:i,label:l,options:s,...c};return Y(f,{field:{...F,onChange:n(m=>{F.onChange(m),p?.(m)},"onChange")},fieldState:a,fieldData:S})}})}n(j,"RadioGroupField");import{jsx as ee}from"react/jsx-runtime";function oe({label:e,name:t,options:i,defaultValue:l,description:s,onChange:p,component:r,...c}){let{control:h}=d(),{components:u}=C();return ee(g,{defaultValue:l,control:h,name:t,render:({field:F,fieldState:a})=>{let f=r||u?.select;if(!f)throw new Error(`Select component not found for field ${t}`);let S={label:e,name:t,options:i,defaultValue:l,description:s,onChange:p,...c};return ee(f,{field:{...F,onChange:n(m=>{let y=c.jsonType==="number"?Number(m):m;F.onChange(y),p?.(y)},"onChange")},fieldState:a,fieldData:S})}})}n(oe,"SelectField");import{jsx as te}from"react/jsx-runtime";function ne({label:e,name:t,options:i,defaultValue:l,description:s,onChange:p,$meta:r,component:c,...h}){let{control:u}=d(),{components:F}=C();return te(g,{defaultValue:l,control:u,name:t,render:({field:a,fieldState:f})=>{let S=c||F.countries;if(!S)throw new Error(`Country component not found for field ${t}`);let m={label:e,name:t,options:i,defaultValue:l,description:s,onChange:p,$meta:r,...h};return te(S,{field:{...a,onChange:n(y=>{a.onChange(y),p?.(y)},"onChange")},fieldState:f,fieldData:m})}})}n(ne,"CountryField");import{jsx as re}from"react/jsx-runtime";function ie({name:e,description:t,label:i,onChange:l,maxLength:s,component:p,...r}){let{components:c}=C(),{control:h}=d();return re(g,{control:h,name:e,render:({field:u,fieldState:F})=>{let a=p||c.textarea;if(!a)throw new Error(`Text area component not found for field ${e}`);let f={name:e,description:t,label:i,maxLength:s,...r};return re(a,{field:{...u,onChange:n(S=>{u.onChange(S),l?.(S)},"onChange")},fieldState:F,fieldData:f})}})}n(ie,"TextAreaField");import{jsx as le}from"react/jsx-runtime";function me(e){let{components:t}=C(),{control:i}=d(),l=e.component||t.email;if(!l)throw new Error(`Email component not found for field ${e.name}`);return le(g,{control:i,name:e.name,render:({field:s,fieldState:p})=>le(l,{field:{...s,onChange:n(r=>{s.onChange(r),e.onChange?.(r)},"onChange")},fieldState:p,fieldData:e})})}n(me,"EmailField");import{jsx as se}from"react/jsx-runtime";function ae(e){let{control:t}=d();return se(g,{control:t,name:e.name,render:({field:i})=>se("input",{...i,type:"hidden"})})}n(ae,"HiddenField");import{useEffect as be,useState as Te}from"react";import{jsx as pe}from"react/jsx-runtime";function de(e){let{components:t}=C(),{setValue:i,control:l,watch:s}=d(),p=s(e.name),[r,c]=Te(p),{workHoursSummary:h,breakSummary:u}=O(r),F=L(r);be(()=>{i(e.name,r)},[r,e.name,i]);function a(m){c(m)}n(a,"onSubmit");let f=e.component||t["work-schedule"];if(!f)throw new Error(`Work schedule component not found for field ${e.name}`);let S={...e,onSubmit:a,currentSchedule:r,defaultFormattedValue:{workHoursSummary:h,breakSummary:u,totalWorkHours:F}};return pe(g,{control:l,name:e.name,render:({field:m,fieldState:y})=>pe(f,{field:{...m,onChange:n(x=>{m.onChange(x),e.onChange?.(x)},"onChange")},fieldState:y,fieldData:S})})}n(de,"WorkScheduleField");import{jsx as ce}from"react/jsx-runtime";function ue({label:e,name:t,options:i,defaultValue:l,description:s,onChange:p,component:r,...c}){let{control:h}=d(),{components:u}=C();return ce(g,{defaultValue:l,control:h,name:t,render:({field:F,fieldState:a})=>{let f=r||u?.["multi-select"];if(!f)throw new Error(`Multi select component not found for field ${t}`);let S={label:e,name:t,options:i,defaultValue:l,description:s,onChange:p,...c};return ce(f,{field:{...F,onChange:n(m=>{F.onChange(m),p?.(m)},"onChange")},fieldState:a,fieldData:S})}})}n(ue,"MultiSelectField");import{jsx as $e}from"react/jsx-runtime";var Fe=n(e=>$e(N,{maxLength:15,...e}),"MoneyField");var A={checkbox:G,text:z,email:me,money:Fe,select:oe,"multi-select":ue,radio:j,number:N,file:Q,date:q,textarea:ie,countries:ne,hidden:ae,"work-schedule":de};import{Fragment as we,jsx as b,jsxs as $}from"react/jsx-runtime";function Ce({label:e,name:t,fields:i,description:l,components:s,statement:p,isFlatFieldset:r,extra:c,variant:h="outset",features:u,meta:F}){let{helpCenter:a}=F||{},{watch:f,setValue:S,trigger:m,formState:y}=d(),{components:x}=C(),P=u?.toggle?.stateField,T=P?f(P):u?.toggle?.defaultExpanded??!0,Se=i.map(({name:o})=>`${t}.${o}`),_=f(Se),B=ge(_),w=ge(null),he=n(()=>{P&&S(P,!T)},"toggleExpanded");Pe(()=>{let o=_,D=B.current,M=y.isSubmitted||y.submitCount>0,E=!1;for(let k=0;k<o.length;k++)if(o[k]!==void 0&&D[k]!==o[k]){E=!0;break}return E&&M&&(w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{m()},50)),B.current=[...o],()=>{w.current&&clearTimeout(w.current)}},[_,m,y.isSubmitted,y.submitCount]);let ye=x?.fieldsetToggle||I,V=`${t}-content`,W=`${t}-header`;return $("fieldset",{className:R("border-1 border-input p-4 rounded-xl","RemoteFlows__FieldSetField",`RemoteFlows__FieldSetField__${t}`),children:[b("legend",{className:R("text-sm font-semibold px-2",h==="inset"&&"hidden"),children:e}),a?.callToAction&&a?.id&&h==="outset"&&b(J,{className:"RemoteFlows__FieldSetField__HelpCenterLink mb-3",zendeskId:a.id,children:a.callToAction}),h==="inset"&&$(we,{children:[$("div",{className:"RemoteFlows__FieldSetField__Header",id:W,"data-state":T?"expanded":"collapsed","aria-expanded":T,children:[b("h3",{className:R("RemoteFlows__FieldSetField__Title"),children:e}),u?.toggle?.enabled&&b(ye,{isExpanded:T,onToggle:he,"aria-expanded":T,"aria-controls":V,"aria-label":`${T?"Hide":"Show"} ${e}`,className:R("RemoteFlows__FieldSetField__Toggle",u.toggle?.className),children:T?u.toggle.labels?.collapse??"Remove":u.toggle.labels?.expand??"Define"})]}),a?.callToAction&&a?.id&&b(J,{className:"RemoteFlows__FieldSetField__HelpCenterLink mb-3",zendeskId:a.id,children:a.callToAction})]}),T&&$("div",{id:V,"aria-labelledby":W,role:"region",children:[l?b("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:H(l)}}):null,$("div",{className:"grid gap-4",children:[i.map(o=>{if(o.calculateDynamicProperties&&(o={...o,...o.calculateDynamicProperties(_,o)||{}}),o.isVisible===!1||o.deprecated)return null;if(o.inputType==="fieldset")return b(Ce,{...o,name:`${r?o.name:`${t}.${o.name}`}`,components:s},`${r?o.name:`${t}.${o.name}`}`);if(o.inputType==="fieldset-flat")return b(Ce,{...o,name:`${r?o.name:`${t}.${o.name}`}`,components:s,isFlatFieldset:!0},`${r?o.name:`${t}.${o.name}`}`);let D=A[o.inputType];if(o.Component){let{Component:M}=o;return $(fe,{children:[b(M,{setValue:E=>S(r?o.name:`${t}.${o.name}`,E),...o}),o.statement?b(v,{...o.statement}):null,o.extra?o.extra:null]},`${r?o.name:`${t}.${o.name}`}`)}return D?(o.inputType==="select"&&o.multiple&&(D=A["multi-select"]),$(fe,{children:[b(D,{...o,name:`${r?o.name:`${t}.${o.name}`}`,component:s?.[o.inputType]}),o.statement?b(v,{...o.statement}):null,o.extra?o.extra:null]},`${r?o.name:`${t}.${o.name}`}`)):$("p",{className:"error",children:["Field type ",o.inputType," not supported"]})}),c||null,p?b(v,{...p}):null]})]})]})}n(Ce,"FieldSetField");export{A as a,Ce as b};
|
|
2
|
+
//# sourceMappingURL=chunk-SAKDBD4P.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p}from"./chunk-EUSCQL4H.js";import{C as c,I as m,M as C,R as d,m as l,v as u}from"./chunk-2IA5ZHU4.js";import{d as o}from"./chunk-KQPDXXG3.js";import{a as t}from"./chunk-P37U34EQ.js";import{useMutation as a,useQuery as r}from"@tanstack/react-query";var h=t(({includePremiumBenefits:e})=>{let{client:i}=o();return r({queryKey:["cost-calculator-countries",e],queryFn:t(()=>c({client:i,query:{include_premium_benefits:e}}),"queryFn"),select:t(s=>s.data?.data.filter(n=>n.availability==="active").map(n=>({value:n.region_slug,label:n.name,childRegions:n.child_regions,hasAdditionalFields:n.has_additional_fields,regionSlug:n.region_slug,currency:n.currency.code})),"select")})},"useCostCalculatorCountries"),q=t(()=>{let{client:e}=o();return r({queryKey:["company-currencies"],queryFn:t(()=>d({client:e}),"queryFn"),select:t(i=>i.data?.data?.company_currencies.map(s=>({value:s.slug,label:s.code})),"select")})},"useCompanyCurrencies"),x=t(()=>{let{client:e}=o();return a({mutationFn:t(i=>l({client:e,body:i}),"mutationFn")})},"useCostCalculatorEstimation"),P=t(()=>{let{client:e}=o();return a({mutationFn:t(i=>u({client:e,body:i}),"mutationFn")})},"useCostCalculatorEstimationPdf"),v=t(()=>{let{client:e}=o();return a({mutationFn:t(i=>C({client:e,body:i}),"mutationFn")})},"useCostCalculatorEstimationCsv"),S=t((e,{includePremiumBenefits:i,options:s})=>{let{client:n}=o();return r({queryKey:["cost-calculator-region-fields",e,i],queryFn:t(()=>m({client:n,path:{slug:e},query:{include_premium_benefits:i}}),"queryFn"),enabled:!!e,select:t(({data:f})=>{let y=f?.data?.schema||{};return p(y,void 0,s)},"select")})},"useRegionFields");export{h as a,q as b,x as c,P as d,v as e,S as f};
|
|
2
|
+
//# sourceMappingURL=chunk-SD3LBJUH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flows/CostCalculator/api.ts"],"sourcesContent":["import { createHeadlessForm } from '@/src/common/createHeadlessForm';\nimport {\n CostCalculatorEstimateParams,\n getIndexCompanyCurrency,\n getIndexCountry,\n getShowRegionField,\n postCreateEstimation,\n postCreateEstimationCsv,\n postCreateEstimationPdf,\n} from '@/src/client';\nimport { Client } from '@/src/client/client';\nimport { useClient } from '@/src/context';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { CostCalculatorEstimationOptions } from '@/src/flows/CostCalculator/types';\nimport { JSFModify } from '@/src/flows/types';\n\n/**\n * Hook to fetch the countries for the cost calculator.\n * @returns\n */\nexport const useCostCalculatorCountries = ({\n includePremiumBenefits,\n}: {\n includePremiumBenefits: CostCalculatorEstimationOptions['includePremiumBenefits'];\n}) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['cost-calculator-countries', includePremiumBenefits],\n queryFn: () => {\n return getIndexCountry({\n client: client as Client,\n query: {\n include_premium_benefits: includePremiumBenefits,\n },\n });\n },\n select: (data) =>\n data.data?.data\n .filter((country) => country.availability === 'active')\n .map((country) => ({\n value: country.region_slug,\n label: country.name,\n childRegions: country.child_regions,\n hasAdditionalFields: country.has_additional_fields,\n regionSlug: country.region_slug,\n currency: country.currency.code,\n })),\n });\n};\n\n/**\n * Hook to fetch the company currencies.\n * @returns\n */\nexport const useCompanyCurrencies = () => {\n const { client } = useClient();\n\n return useQuery({\n queryKey: ['company-currencies'],\n queryFn: () => {\n return getIndexCompanyCurrency({\n client: client as Client,\n });\n },\n select: (data) =>\n data.data?.data?.company_currencies.map((currency) => ({\n value: currency.slug,\n label: currency.code,\n })),\n });\n};\n\n/**\n * Hook to create an estimation.\n * @returns\n */\nexport const useCostCalculatorEstimation = () => {\n const { client } = useClient();\n\n return useMutation({\n mutationFn: (payload: CostCalculatorEstimateParams) => {\n return postCreateEstimation({\n client: client as Client,\n body: payload,\n });\n },\n });\n};\n\n/**\n * Custom hook to create a PDF estimation.\n *\n * @returns\n */\nexport const useCostCalculatorEstimationPdf = () => {\n const { client } = useClient();\n\n return useMutation({\n mutationFn: (payload: CostCalculatorEstimateParams) => {\n return postCreateEstimationPdf({\n client: client as Client,\n body: payload,\n });\n },\n });\n};\n\n/**\n * Custom hook to create a CSV estimation.\n *\n * @returns\n */\nexport const useCostCalculatorEstimationCsv = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CostCalculatorEstimateParams) => {\n return postCreateEstimationCsv({\n client: client as Client,\n body: payload,\n });\n },\n });\n};\n\n/**\n * Hook to fetch the region fields.\n * @param region\n * @returns\n */\nexport const useRegionFields = (\n region: string | undefined,\n {\n includePremiumBenefits,\n options,\n }: {\n includePremiumBenefits: CostCalculatorEstimationOptions['includePremiumBenefits'];\n options?: {\n jsfModify?: JSFModify;\n };\n },\n) => {\n const { client } = useClient();\n\n return useQuery({\n queryKey: ['cost-calculator-region-fields', region, includePremiumBenefits],\n queryFn: () => {\n return getShowRegionField({\n client: client as Client,\n path: { slug: region as string },\n query: {\n include_premium_benefits: includePremiumBenefits,\n },\n });\n },\n enabled: !!region,\n select: ({ data }) => {\n const jsfSchema = data?.data?.schema || {};\n return createHeadlessForm(jsfSchema, undefined, options);\n },\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/flows/CostCalculator/api.ts"],"sourcesContent":["import { createHeadlessForm } from '@/src/common/createHeadlessForm';\nimport {\n CostCalculatorEstimateParams,\n getIndexCompanyCurrency,\n getIndexCountry,\n getShowRegionField,\n postCreateEstimation,\n postCreateEstimationCsv,\n postCreateEstimationPdf,\n} from '@/src/client';\nimport { Client } from '@/src/client/client';\nimport { useClient } from '@/src/context';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { CostCalculatorEstimationOptions } from '@/src/flows/CostCalculator/types';\nimport { JSFModify } from '@/src/flows/types';\n\n/**\n * Hook to fetch the countries for the cost calculator.\n * @returns\n */\nexport const useCostCalculatorCountries = ({\n includePremiumBenefits,\n}: {\n includePremiumBenefits: CostCalculatorEstimationOptions['includePremiumBenefits'];\n}) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['cost-calculator-countries', includePremiumBenefits],\n queryFn: () => {\n return getIndexCountry({\n client: client as Client,\n query: {\n include_premium_benefits: includePremiumBenefits,\n },\n });\n },\n select: (data) =>\n data.data?.data\n .filter((country) => country.availability === 'active')\n .map((country) => ({\n value: country.region_slug,\n label: country.name,\n childRegions: country.child_regions,\n hasAdditionalFields: country.has_additional_fields,\n regionSlug: country.region_slug,\n currency: country.currency.code,\n })),\n });\n};\n\n/**\n * Hook to fetch the company currencies.\n * @returns\n */\nexport const useCompanyCurrencies = () => {\n const { client } = useClient();\n\n return useQuery({\n queryKey: ['company-currencies'],\n queryFn: () => {\n return getIndexCompanyCurrency({\n client: client as Client,\n });\n },\n select: (data) =>\n data.data?.data?.company_currencies.map((currency) => ({\n value: currency.slug,\n label: currency.code,\n })),\n });\n};\n\n/**\n * Hook to create an estimation.\n * @returns\n */\nexport const useCostCalculatorEstimation = () => {\n const { client } = useClient();\n\n return useMutation({\n mutationFn: (payload: CostCalculatorEstimateParams) => {\n return postCreateEstimation({\n client: client as Client,\n body: payload,\n });\n },\n });\n};\n\n/**\n * Custom hook to create a PDF estimation.\n *\n * @returns\n */\nexport const useCostCalculatorEstimationPdf = () => {\n const { client } = useClient();\n\n return useMutation({\n mutationFn: (payload: CostCalculatorEstimateParams) => {\n return postCreateEstimationPdf({\n client: client as Client,\n body: payload,\n });\n },\n });\n};\n\n/**\n * Custom hook to create a CSV estimation.\n *\n * @returns\n */\nexport const useCostCalculatorEstimationCsv = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CostCalculatorEstimateParams) => {\n return postCreateEstimationCsv({\n client: client as Client,\n body: payload,\n });\n },\n });\n};\n\n/**\n * Hook to fetch the region fields.\n * @param region\n * @returns\n */\nexport const useRegionFields = (\n region: string | undefined,\n {\n includePremiumBenefits,\n options,\n }: {\n includePremiumBenefits: CostCalculatorEstimationOptions['includePremiumBenefits'];\n options?: {\n jsfModify?: JSFModify;\n };\n },\n) => {\n const { client } = useClient();\n\n return useQuery({\n queryKey: ['cost-calculator-region-fields', region, includePremiumBenefits],\n queryFn: () => {\n return getShowRegionField({\n client: client as Client,\n path: { slug: region as string },\n query: {\n include_premium_benefits: includePremiumBenefits,\n },\n });\n },\n enabled: !!region,\n select: ({ data }) => {\n const jsfSchema = data?.data?.schema || {};\n return createHeadlessForm(jsfSchema, undefined, options);\n },\n });\n};\n"],"mappings":"mMAYA,OAAS,eAAAA,EAAa,YAAAC,MAAgB,wBAQ/B,IAAMC,EAA6BC,EAAA,CAAC,CACzC,uBAAAC,CACF,IAEM,CACJ,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAU,EAC7B,OAAOC,EAAS,CACd,SAAU,CAAC,4BAA6BH,CAAsB,EAC9D,QAASD,EAAA,IACAK,EAAgB,CACrB,OAAQH,EACR,MAAO,CACL,yBAA0BD,CAC5B,CACF,CAAC,EANM,WAQT,OAAQD,EAACM,GACPA,EAAK,MAAM,KACR,OAAQC,GAAYA,EAAQ,eAAiB,QAAQ,EACrD,IAAKA,IAAa,CACjB,MAAOA,EAAQ,YACf,MAAOA,EAAQ,KACf,aAAcA,EAAQ,cACtB,oBAAqBA,EAAQ,sBAC7B,WAAYA,EAAQ,YACpB,SAAUA,EAAQ,SAAS,IAC7B,EAAE,EAVE,SAWV,CAAC,CACH,EA5B0C,8BAkC7BC,EAAuBR,EAAA,IAAM,CACxC,GAAM,CAAE,OAAAE,CAAO,EAAIC,EAAU,EAE7B,OAAOC,EAAS,CACd,SAAU,CAAC,oBAAoB,EAC/B,QAASJ,EAAA,IACAS,EAAwB,CAC7B,OAAQP,CACV,CAAC,EAHM,WAKT,OAAQF,EAACM,GACPA,EAAK,MAAM,MAAM,mBAAmB,IAAKI,IAAc,CACrD,MAAOA,EAAS,KAChB,MAAOA,EAAS,IAClB,EAAE,EAJI,SAKV,CAAC,CACH,EAhBoC,wBAsBvBC,EAA8BX,EAAA,IAAM,CAC/C,GAAM,CAAE,OAAAE,CAAO,EAAIC,EAAU,EAE7B,OAAOS,EAAY,CACjB,WAAYZ,EAACa,GACJC,EAAqB,CAC1B,OAAQZ,EACR,KAAMW,CACR,CAAC,EAJS,aAMd,CAAC,CACH,EAX2C,+BAkB9BE,EAAiCf,EAAA,IAAM,CAClD,GAAM,CAAE,OAAAE,CAAO,EAAIC,EAAU,EAE7B,OAAOS,EAAY,CACjB,WAAYZ,EAACa,GACJG,EAAwB,CAC7B,OAAQd,EACR,KAAMW,CACR,CAAC,EAJS,aAMd,CAAC,CACH,EAX8C,kCAkBjCI,EAAiCjB,EAAA,IAAM,CAClD,GAAM,CAAE,OAAAE,CAAO,EAAIC,EAAU,EAC7B,OAAOS,EAAY,CACjB,WAAYZ,EAACa,GACJK,EAAwB,CAC7B,OAAQhB,EACR,KAAMW,CACR,CAAC,EAJS,aAMd,CAAC,CACH,EAV8C,kCAiBjCM,EAAkBnB,EAAA,CAC7BoB,EACA,CACE,uBAAAnB,EACA,QAAAoB,CACF,IAMG,CACH,GAAM,CAAE,OAAAnB,CAAO,EAAIC,EAAU,EAE7B,OAAOC,EAAS,CACd,SAAU,CAAC,gCAAiCgB,EAAQnB,CAAsB,EAC1E,QAASD,EAAA,IACAsB,EAAmB,CACxB,OAAQpB,EACR,KAAM,CAAE,KAAMkB,CAAiB,EAC/B,MAAO,CACL,yBAA0BnB,CAC5B,CACF,CAAC,EAPM,WAST,QAAS,CAAC,CAACmB,EACX,OAAQpB,EAAA,CAAC,CAAE,KAAAM,CAAK,IAAM,CACpB,IAAMiB,EAAYjB,GAAM,MAAM,QAAU,CAAC,EACzC,OAAOkB,EAAmBD,EAAW,OAAWF,CAAO,CACzD,EAHQ,SAIV,CAAC,CACH,EA/B+B","names":["useMutation","useQuery","useCostCalculatorCountries","__name","includePremiumBenefits","client","useClient","useQuery","getIndexCountry","data","country","useCompanyCurrencies","getIndexCompanyCurrency","currency","useCostCalculatorEstimation","useMutation","payload","postCreateEstimation","useCostCalculatorEstimationPdf","postCreateEstimationPdf","useCostCalculatorEstimationCsv","postCreateEstimationCsv","useRegionFields","region","options","getShowRegionField","jsfSchema","createHeadlessForm"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-URJI6IZB.js";import{b as a}from"./chunk-Q3ALCPJN.js";import{k as n}from"./chunk-VIGKOVHP.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as b}from"react/jsx-runtime";function g({onSubmit:l,onSuccess:u,onError:d}){let{contractorOnboardingBag:i}=a(),m=e(async t=>{try{let o=await i.parseFormValues(t);await l?.(o);let r=await i.onSubmit(t);if(r?.data){await u?.(r?.data),r?._skipNextStep||i?.next();return}}catch(o){let r=n(o,i.meta?.fields?.eligibility_questionnaire);d?.(r)}},"handleSubmit"),p=i.stepState.values?.eligibility_questionnaire||i.initialValues.eligibility_questionnaire;return b(s,{defaultValues:p,onSubmit:m})}e(g,"EligibilityQuestionnaireStep");export{g as a};
|
|
2
|
+
//# sourceMappingURL=chunk-SJ5IZCJP.js.map
|