@remoteoss/remote-flows 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -8
- package/dist/{chunk-7TX2YY4K.js → chunk-2W2XD7ZY.js} +2 -2
- package/dist/chunk-2W2XD7ZY.js.map +1 -0
- package/dist/chunk-3ZWDIEEM.js +2 -0
- package/dist/chunk-3ZWDIEEM.js.map +1 -0
- package/dist/{chunk-WMICWLC3.js → chunk-5AG4K2EA.js} +2 -2
- package/dist/{chunk-DXTLNOCG.js → chunk-5CVD5WZZ.js} +2 -2
- package/dist/chunk-5CVD5WZZ.js.map +1 -0
- package/dist/{chunk-DYXTJBSK.js → chunk-5KHLOGTR.js} +2 -2
- package/dist/{chunk-7RFJWDXS.js → chunk-5KZXFQLZ.js} +2 -2
- package/dist/{chunk-LWGVLLBH.js → chunk-5OZPBBXS.js} +2 -2
- package/dist/chunk-5P7INAU2.js +2 -0
- package/dist/chunk-5P7INAU2.js.map +1 -0
- package/dist/{chunk-K2L2NSOM.js → chunk-5ZR7EFPY.js} +2 -2
- package/dist/{chunk-KVAGMBSU.js → chunk-6FWFRVQE.js} +2 -2
- package/dist/{chunk-LLM6MDNY.js → chunk-6VRUYYUV.js} +2 -2
- package/dist/{chunk-ZF4BLPXL.js → chunk-76DHIEN7.js} +2 -2
- package/dist/{chunk-D7WCSZGW.js → chunk-7CJX7I3M.js} +2 -2
- package/dist/{chunk-7OL54VKA.js → chunk-7YQAVDVX.js} +2 -2
- package/dist/chunk-7YQAVDVX.js.map +1 -0
- package/dist/chunk-A477TZFC.js +2 -0
- package/dist/chunk-A477TZFC.js.map +1 -0
- package/dist/chunk-AA7QB3QQ.js +2 -0
- package/dist/{chunk-2CDCTUVY.js.map → chunk-AA7QB3QQ.js.map} +1 -1
- package/dist/{chunk-QAOGIYQL.js → chunk-AM2IRFHQ.js} +2 -2
- package/dist/{chunk-HYOJP6J5.js → chunk-ANGJCT4I.js} +2 -2
- package/dist/{chunk-SOYN4LOZ.js → chunk-B6IVJUEH.js} +2 -2
- package/dist/{chunk-RYXRWMF4.js → chunk-BV3PGYSH.js} +2 -2
- package/dist/{chunk-KFJJXMAH.js → chunk-COBQ4WSJ.js} +2 -2
- package/dist/{chunk-TW7Z6G37.js → chunk-CW3MAP5L.js} +2 -2
- package/dist/chunk-DFJNVGK4.js +2 -0
- package/dist/chunk-DFJNVGK4.js.map +1 -0
- package/dist/{chunk-4CIYPTKM.js → chunk-DPWL4KNA.js} +2 -2
- package/dist/{chunk-OHAAAVNB.js → chunk-DPY77ASH.js} +2 -2
- package/dist/{chunk-PFKNQGOD.js → chunk-DXFA52BU.js} +2 -2
- package/dist/{chunk-YBB6BOW7.js → chunk-DXIO72S4.js} +2 -2
- package/dist/{chunk-EL5QIDYZ.js → chunk-DZ2R72O5.js} +2 -2
- package/dist/{chunk-67V3DFV4.js → chunk-E4CABUTS.js} +2 -2
- package/dist/{chunk-5NARH23N.js → chunk-EKKRQI6B.js} +2 -2
- package/dist/{chunk-PEHALKVU.js → chunk-EM5UYWUQ.js} +2 -2
- package/dist/{chunk-6GUXV7XA.js → chunk-ENW4DCDU.js} +2 -2
- package/dist/{chunk-JTOLQCOG.js → chunk-FRTJ4KWA.js} +2 -2
- package/dist/{chunk-YP7Q47E2.js → chunk-GCJCNDJ3.js} +2 -2
- package/dist/chunk-GKD2WI2W.js +2 -0
- package/dist/chunk-GKD2WI2W.js.map +1 -0
- package/dist/chunk-GOGPCCBS.js +2 -0
- package/dist/chunk-GOGPCCBS.js.map +1 -0
- package/dist/{chunk-7JUP5JEY.js → chunk-HBHVB56P.js} +2 -2
- package/dist/{chunk-FDBUFHR3.js → chunk-HO2TIG7R.js} +2 -2
- package/dist/{chunk-XLAKJHGV.js → chunk-HZDCZFR5.js} +2 -2
- package/dist/chunk-HZDCZFR5.js.map +1 -0
- package/dist/{chunk-HMUIT2NU.js → chunk-ID3ZF7QT.js} +2 -2
- package/dist/{chunk-U24UNO6X.js → chunk-IHNYOUXP.js} +2 -2
- package/dist/chunk-IHNYOUXP.js.map +1 -0
- package/dist/chunk-IUEXOXFA.js +2 -0
- package/dist/chunk-IUEXOXFA.js.map +1 -0
- package/dist/{chunk-RCWBOOZF.js → chunk-K2BWF2HC.js} +2 -2
- package/dist/{chunk-5ORIDYIK.js → chunk-L3D2AK3X.js} +2 -2
- package/dist/{chunk-ZF6MZYBK.js → chunk-LQAHRGU4.js} +2 -2
- package/dist/{chunk-6GQZCUUR.js → chunk-LV5R6H3D.js} +2 -2
- package/dist/{chunk-PEOWIEYM.js → chunk-M2CI2UDK.js} +2 -2
- package/dist/{chunk-UOOM7V2D.js → chunk-MZB24YJP.js} +2 -2
- package/dist/{chunk-GTWY3JK3.js → chunk-OIN3HGOQ.js} +2 -2
- package/dist/{chunk-Z47JQN3R.js → chunk-OW5QGJD4.js} +2 -2
- package/dist/{chunk-HBRO74FQ.js → chunk-P5WUODPR.js} +2 -2
- package/dist/{chunk-JK5K2S7N.js → chunk-P7JZC65P.js} +2 -2
- package/dist/chunk-Q2N5SOKO.js +2 -0
- package/dist/chunk-Q2N5SOKO.js.map +1 -0
- package/dist/{chunk-JBUNDNKJ.js → chunk-QWJFYQK3.js} +1 -1
- package/dist/{chunk-BKWNJMNJ.js → chunk-SHP4ULHS.js} +2 -2
- package/dist/chunk-SHP4ULHS.js.map +1 -0
- package/dist/{chunk-ZZWX3C6V.js → chunk-SO3YQ4WT.js} +2 -2
- package/dist/{chunk-WNGPZXEX.js → chunk-SPQO42TA.js} +2 -2
- package/dist/{chunk-RGGU6BNB.js → chunk-SRRY72CZ.js} +2 -2
- package/dist/chunk-THMWKOHC.js +2 -0
- package/dist/chunk-THMWKOHC.js.map +1 -0
- package/dist/{chunk-664GOQG3.js → chunk-TWVFLXVF.js} +2 -2
- package/dist/chunk-U4JVXNOG.js +2 -0
- package/dist/chunk-U4JVXNOG.js.map +1 -0
- package/dist/{chunk-DTZ23AE6.js → chunk-UJKTTTGB.js} +2 -2
- package/dist/{chunk-2N5A6EGD.js → chunk-UPXJJBXZ.js} +2 -2
- package/dist/{chunk-YP2JBYAK.js → chunk-WBRWVTZK.js} +2 -2
- package/dist/chunk-WJ6YJFD4.js +2 -0
- package/dist/chunk-WJ6YJFD4.js.map +1 -0
- package/dist/{chunk-OIIALEVF.js → chunk-WMPKW7HC.js} +2 -2
- package/dist/chunk-WW5UCMQZ.js +2 -0
- package/dist/chunk-WW5UCMQZ.js.map +1 -0
- package/dist/chunk-WXUIXZ7P.js +2 -0
- package/dist/chunk-WXUIXZ7P.js.map +1 -0
- package/dist/{chunk-HTJZUAVS.js → chunk-X6CD3FMG.js} +2 -2
- package/dist/chunk-XNOLBKZC.js +2 -0
- package/dist/chunk-XNOLBKZC.js.map +1 -0
- package/dist/{chunk-HX34JCPL.js → chunk-XPL5XOQ4.js} +2 -2
- package/dist/{chunk-CHDWFMD3.js → chunk-XPOLXRYT.js} +2 -2
- package/dist/{chunk-QRD43QJA.js → chunk-YDJVQRND.js} +2 -2
- package/dist/{chunk-EVSDVI2G.js → chunk-ZQ6MG635.js} +2 -2
- package/dist/flows/ContractAmendment/ContractAmendmentBack.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +4 -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/ContractAmendmentSubmit.js +1 -1
- package/dist/flows/ContractAmendment/context.d.ts +4 -3
- package/dist/flows/ContractAmendment/hooks.d.ts +4 -3
- package/dist/flows/ContractAmendment/hooks.js +1 -1
- package/dist/flows/ContractAmendment/index.d.ts +4 -3
- package/dist/flows/ContractAmendment/index.js +1 -1
- package/dist/flows/ContractAmendment/types.d.ts +1 -0
- package/dist/flows/ContractAmendment/utils.d.ts +1 -1
- package/dist/flows/ContractAmendment/utils.js +1 -1
- package/dist/flows/ContractorOnboarding/ContractorOnboarding.d.ts +6 -5
- package/dist/flows/ContractorOnboarding/ContractorOnboarding.js +1 -1
- package/dist/flows/ContractorOnboarding/api.d.ts +3 -2
- package/dist/flows/ContractorOnboarding/api.js +1 -1
- package/dist/flows/ContractorOnboarding/components/BasicInformationStep.d.ts +5 -4
- package/dist/flows/ContractorOnboarding/components/BasicInformationStep.js +1 -1
- package/dist/flows/ContractorOnboarding/components/ContractDetailsStep.d.ts +6 -5
- package/dist/flows/ContractorOnboarding/components/ContractDetailsStep.js +1 -1
- package/dist/flows/ContractorOnboarding/components/ContractPreviewStep.d.ts +6 -5
- package/dist/flows/ContractorOnboarding/components/ContractPreviewStep.js +1 -1
- package/dist/flows/ContractorOnboarding/components/ContractorOnboardingForm.d.ts +6 -5
- package/dist/flows/ContractorOnboarding/components/ContractorOnboardingForm.js +1 -1
- package/dist/flows/ContractorOnboarding/components/OnboardingBack.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/OnboardingSubmit.js +1 -1
- package/dist/flows/ContractorOnboarding/components/PricingPlan.d.ts +6 -5
- package/dist/flows/ContractorOnboarding/components/PricingPlan.js +1 -1
- package/dist/flows/ContractorOnboarding/components/SelectCountryStep.d.ts +5 -4
- package/dist/flows/ContractorOnboarding/components/SelectCountryStep.js +1 -1
- package/dist/flows/ContractorOnboarding/context.d.ts +6 -5
- package/dist/flows/ContractorOnboarding/hooks.d.ts +6 -5
- package/dist/flows/ContractorOnboarding/hooks.js +1 -1
- package/dist/flows/ContractorOnboarding/index.d.ts +6 -5
- package/dist/flows/ContractorOnboarding/index.js +1 -1
- package/dist/flows/ContractorOnboarding/types.d.ts +6 -5
- package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +4 -3
- package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +4 -3
- package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorResetButton.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorSubmitButton.js +1 -1
- package/dist/flows/CostCalculator/EstimationResults/EstimationResults.d.ts +2 -1
- package/dist/flows/CostCalculator/EstimationResults/EstimationResults.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorBenefitsBreakdown.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorContributionsBreakdown.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorExtraStatutoryPaymentsBreakdown.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorGrossSalary.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorResults.d.ts +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorResults.js +1 -1
- package/dist/flows/CostCalculator/SummaryResults/SummaryResults.d.ts +2 -1
- package/dist/flows/CostCalculator/api.d.ts +2 -1
- 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 +4 -3
- package/dist/flows/CostCalculator/hooks.d.ts +4 -3
- package/dist/flows/CostCalculator/hooks.js +1 -1
- package/dist/flows/CostCalculator/index.d.ts +4 -3
- package/dist/flows/CostCalculator/index.js +1 -1
- package/dist/flows/CostCalculator/types.d.ts +2 -1
- package/dist/flows/CostCalculator/utils.d.ts +4 -3
- package/dist/flows/CostCalculator/utils.js +1 -1
- package/dist/flows/Onboarding/OnboardingFlow.d.ts +5 -4
- package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
- package/dist/flows/Onboarding/api.d.ts +5 -4
- 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 +5 -4
- package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
- package/dist/flows/Onboarding/components/BenefitsStep.d.ts +5 -4
- package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
- package/dist/flows/Onboarding/components/ContractDetailsStep.d.ts +5 -4
- package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
- package/dist/flows/Onboarding/components/OnboardingBack.js +1 -1
- package/dist/flows/Onboarding/components/OnboardingForm.d.ts +5 -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/OnboardingSubmit.js +1 -1
- package/dist/flows/Onboarding/components/ReviewStep.d.ts +5 -4
- package/dist/flows/Onboarding/components/SaveDraftButton.d.ts +3 -3
- package/dist/flows/Onboarding/components/SaveDraftButton.js +1 -1
- package/dist/flows/Onboarding/components/SelectCountryStep.d.ts +5 -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 +5 -4
- package/dist/flows/Onboarding/hooks.js +1 -1
- package/dist/flows/Onboarding/index.d.ts +5 -4
- package/dist/flows/Onboarding/index.js +1 -1
- package/dist/flows/Onboarding/types.d.ts +5 -4
- package/dist/flows/Onboarding/utils.d.ts +5 -4
- package/dist/flows/Onboarding/utils.js +1 -1
- package/dist/flows/Termination/AdditionalDetailsForm.d.ts +5 -5
- package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
- package/dist/flows/Termination/EmployeeComunicationForm.d.ts +5 -5
- package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
- package/dist/flows/Termination/PaidTimeOffForm.d.ts +5 -5
- package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
- package/dist/flows/Termination/TerminationBack.js +1 -1
- package/dist/flows/Termination/TerminationDetailsForm.d.ts +5 -5
- package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
- package/dist/flows/Termination/TerminationFlow.d.ts +5 -5
- package/dist/flows/Termination/TerminationFlow.js +1 -1
- package/dist/flows/Termination/TerminationForm.d.ts +5 -5
- package/dist/flows/Termination/TerminationForm.js +1 -1
- package/dist/flows/Termination/TerminationSubmit.js +1 -1
- package/dist/flows/Termination/api.d.ts +106 -0
- package/dist/flows/Termination/api.js +2 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInformationFees.js +1 -1
- package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOff.d.ts +10 -5
- package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOff.js +1 -1
- package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOffContainer.d.ts +10 -5
- package/dist/flows/Termination/components/PaidTimeOff/PaidTimeOffContainer.js +1 -1
- package/dist/flows/Termination/components/PaidTimeOff/types.d.ts +10 -5
- package/dist/flows/Termination/components/TerminationDialogInfoContent/TerminationDialogInfoContent.js +1 -1
- package/dist/flows/Termination/context.d.ts +25 -5
- package/dist/flows/Termination/hooks.d.ts +5 -5
- package/dist/flows/Termination/hooks.js +1 -1
- package/dist/flows/Termination/index.d.ts +8 -7
- package/dist/flows/Termination/index.js +1 -1
- package/dist/flows/Termination/json-schemas/schema.d.ts +14 -3
- package/dist/flows/Termination/types.d.ts +5 -5
- package/dist/flows/Termination/utils.d.ts +13 -6
- package/dist/flows/Termination/utils.js +1 -1
- package/dist/flows/types.d.ts +3 -1
- package/dist/index.d.ts +12 -17
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internals.d.ts +10 -1
- package/dist/internals.js +1 -1
- package/dist/{mutations-BdkQ8BEQ.d.ts → mutations-Cdk0PM78.d.ts} +1 -1
- package/dist/{remoteFlows-nNmmcD-T.d.ts → remoteFlows-DUivEPPh.d.ts} +41 -7
- package/dist/{types-BOXcQDia.d.ts → types-BZBdCzER.d.ts} +4 -4
- package/dist/{types-5wwUT05a.d.ts → types-C-X7siUr.d.ts} +46 -5
- package/dist/{types-CNHUaKN_.d.ts → types-OcTc56P-.d.ts} +3 -74
- package/dist/{types-omiJJgNz.d.ts → types-pohqJTkr.d.ts} +4 -4
- package/dist/{types.gen-BS9UfhS-.d.ts → types.gen-D0ZCnKWv.d.ts} +18 -1
- package/package.json +2 -1
- package/dist/chunk-2CDCTUVY.js +0 -2
- package/dist/chunk-56LJAMZC.js +0 -2
- package/dist/chunk-56LJAMZC.js.map +0 -1
- package/dist/chunk-7OL54VKA.js.map +0 -1
- package/dist/chunk-7TX2YY4K.js.map +0 -1
- package/dist/chunk-A6GJNXUZ.js +0 -2
- package/dist/chunk-A6GJNXUZ.js.map +0 -1
- package/dist/chunk-BB3WWKGA.js +0 -2
- package/dist/chunk-BB3WWKGA.js.map +0 -1
- package/dist/chunk-BKWNJMNJ.js.map +0 -1
- package/dist/chunk-CFIJKJXD.js +0 -2
- package/dist/chunk-CFIJKJXD.js.map +0 -1
- package/dist/chunk-D64MAPTD.js +0 -2
- package/dist/chunk-D64MAPTD.js.map +0 -1
- package/dist/chunk-D6X2WCEG.js +0 -2
- package/dist/chunk-D6X2WCEG.js.map +0 -1
- package/dist/chunk-DXTLNOCG.js.map +0 -1
- package/dist/chunk-EHS4ERDW.js +0 -2
- package/dist/chunk-EHS4ERDW.js.map +0 -1
- package/dist/chunk-HJYHCWGX.js +0 -2
- package/dist/chunk-HJYHCWGX.js.map +0 -1
- package/dist/chunk-LJYCBMDS.js +0 -2
- package/dist/chunk-LJYCBMDS.js.map +0 -1
- package/dist/chunk-PAQW5BFW.js +0 -2
- package/dist/chunk-PAQW5BFW.js.map +0 -1
- package/dist/chunk-QGWCUGLN.js +0 -2
- package/dist/chunk-QGWCUGLN.js.map +0 -1
- package/dist/chunk-S4XU4SE7.js +0 -2
- package/dist/chunk-S4XU4SE7.js.map +0 -1
- package/dist/chunk-U24UNO6X.js.map +0 -1
- package/dist/chunk-XFJPUKYR.js +0 -2
- package/dist/chunk-XFJPUKYR.js.map +0 -1
- package/dist/chunk-XLAKJHGV.js.map +0 -1
- package/dist/chunk-ZX5OIIJX.js +0 -1
- package/dist/chunk-ZX5OIIJX.js.map +0 -1
- package/dist/flows/api.d.ts +0 -34
- package/dist/flows/api.js +0 -2
- /package/dist/{chunk-WMICWLC3.js.map → chunk-5AG4K2EA.js.map} +0 -0
- /package/dist/{chunk-DYXTJBSK.js.map → chunk-5KHLOGTR.js.map} +0 -0
- /package/dist/{chunk-7RFJWDXS.js.map → chunk-5KZXFQLZ.js.map} +0 -0
- /package/dist/{chunk-LWGVLLBH.js.map → chunk-5OZPBBXS.js.map} +0 -0
- /package/dist/{chunk-K2L2NSOM.js.map → chunk-5ZR7EFPY.js.map} +0 -0
- /package/dist/{chunk-KVAGMBSU.js.map → chunk-6FWFRVQE.js.map} +0 -0
- /package/dist/{chunk-LLM6MDNY.js.map → chunk-6VRUYYUV.js.map} +0 -0
- /package/dist/{chunk-ZF4BLPXL.js.map → chunk-76DHIEN7.js.map} +0 -0
- /package/dist/{chunk-D7WCSZGW.js.map → chunk-7CJX7I3M.js.map} +0 -0
- /package/dist/{chunk-QAOGIYQL.js.map → chunk-AM2IRFHQ.js.map} +0 -0
- /package/dist/{chunk-HYOJP6J5.js.map → chunk-ANGJCT4I.js.map} +0 -0
- /package/dist/{chunk-SOYN4LOZ.js.map → chunk-B6IVJUEH.js.map} +0 -0
- /package/dist/{chunk-RYXRWMF4.js.map → chunk-BV3PGYSH.js.map} +0 -0
- /package/dist/{chunk-KFJJXMAH.js.map → chunk-COBQ4WSJ.js.map} +0 -0
- /package/dist/{chunk-TW7Z6G37.js.map → chunk-CW3MAP5L.js.map} +0 -0
- /package/dist/{chunk-4CIYPTKM.js.map → chunk-DPWL4KNA.js.map} +0 -0
- /package/dist/{chunk-OHAAAVNB.js.map → chunk-DPY77ASH.js.map} +0 -0
- /package/dist/{chunk-PFKNQGOD.js.map → chunk-DXFA52BU.js.map} +0 -0
- /package/dist/{chunk-YBB6BOW7.js.map → chunk-DXIO72S4.js.map} +0 -0
- /package/dist/{chunk-EL5QIDYZ.js.map → chunk-DZ2R72O5.js.map} +0 -0
- /package/dist/{chunk-67V3DFV4.js.map → chunk-E4CABUTS.js.map} +0 -0
- /package/dist/{chunk-5NARH23N.js.map → chunk-EKKRQI6B.js.map} +0 -0
- /package/dist/{chunk-PEHALKVU.js.map → chunk-EM5UYWUQ.js.map} +0 -0
- /package/dist/{chunk-6GUXV7XA.js.map → chunk-ENW4DCDU.js.map} +0 -0
- /package/dist/{chunk-JTOLQCOG.js.map → chunk-FRTJ4KWA.js.map} +0 -0
- /package/dist/{chunk-YP7Q47E2.js.map → chunk-GCJCNDJ3.js.map} +0 -0
- /package/dist/{chunk-7JUP5JEY.js.map → chunk-HBHVB56P.js.map} +0 -0
- /package/dist/{chunk-FDBUFHR3.js.map → chunk-HO2TIG7R.js.map} +0 -0
- /package/dist/{chunk-HMUIT2NU.js.map → chunk-ID3ZF7QT.js.map} +0 -0
- /package/dist/{chunk-RCWBOOZF.js.map → chunk-K2BWF2HC.js.map} +0 -0
- /package/dist/{chunk-5ORIDYIK.js.map → chunk-L3D2AK3X.js.map} +0 -0
- /package/dist/{chunk-ZF6MZYBK.js.map → chunk-LQAHRGU4.js.map} +0 -0
- /package/dist/{chunk-6GQZCUUR.js.map → chunk-LV5R6H3D.js.map} +0 -0
- /package/dist/{chunk-PEOWIEYM.js.map → chunk-M2CI2UDK.js.map} +0 -0
- /package/dist/{chunk-UOOM7V2D.js.map → chunk-MZB24YJP.js.map} +0 -0
- /package/dist/{chunk-GTWY3JK3.js.map → chunk-OIN3HGOQ.js.map} +0 -0
- /package/dist/{chunk-Z47JQN3R.js.map → chunk-OW5QGJD4.js.map} +0 -0
- /package/dist/{chunk-HBRO74FQ.js.map → chunk-P5WUODPR.js.map} +0 -0
- /package/dist/{chunk-JK5K2S7N.js.map → chunk-P7JZC65P.js.map} +0 -0
- /package/dist/{chunk-JBUNDNKJ.js.map → chunk-QWJFYQK3.js.map} +0 -0
- /package/dist/{chunk-ZZWX3C6V.js.map → chunk-SO3YQ4WT.js.map} +0 -0
- /package/dist/{chunk-WNGPZXEX.js.map → chunk-SPQO42TA.js.map} +0 -0
- /package/dist/{chunk-RGGU6BNB.js.map → chunk-SRRY72CZ.js.map} +0 -0
- /package/dist/{chunk-664GOQG3.js.map → chunk-TWVFLXVF.js.map} +0 -0
- /package/dist/{chunk-DTZ23AE6.js.map → chunk-UJKTTTGB.js.map} +0 -0
- /package/dist/{chunk-2N5A6EGD.js.map → chunk-UPXJJBXZ.js.map} +0 -0
- /package/dist/{chunk-YP2JBYAK.js.map → chunk-WBRWVTZK.js.map} +0 -0
- /package/dist/{chunk-OIIALEVF.js.map → chunk-WMPKW7HC.js.map} +0 -0
- /package/dist/{chunk-HTJZUAVS.js.map → chunk-X6CD3FMG.js.map} +0 -0
- /package/dist/{chunk-HX34JCPL.js.map → chunk-XPL5XOQ4.js.map} +0 -0
- /package/dist/{chunk-CHDWFMD3.js.map → chunk-XPOLXRYT.js.map} +0 -0
- /package/dist/{chunk-QRD43QJA.js.map → chunk-YDJVQRND.js.map} +0 -0
- /package/dist/{chunk-EVSDVI2G.js.map → chunk-ZQ6MG635.js.map} +0 -0
- /package/dist/flows/{api.js.map → Termination/api.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as y}from"./chunk-PGWKJ6FK.js";import{b as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as y}from"./chunk-PGWKJ6FK.js";import{b as c}from"./chunk-5P7INAU2.js";import{a as F}from"./chunk-WJ6YJFD4.js";import{b as u}from"./chunk-2YTBWEC7.js";import{f,g as p}from"./chunk-CNDSIADP.js";import{a as m}from"./chunk-P37U34EQ.js";import{useEffect as S}from"react";import{jsx as b}from"react/jsx-runtime";import{createElement as V}from"react";function U({defaultValues:d,onSubmit:g,components:E}){let{formId:k,onboardingBag:o}=y(),w=c(o.handleValidation),r=f({resolver:w,defaultValues:d,shouldUnregister:!1,mode:"onBlur"});S(()=>{o.employmentId&&o?.checkFieldUpdates(r.getValues())},[]),S(()=>{let t=r?.watch(e=>{Object.keys(e).some(i=>e[i]!==d[i])&&o?.checkFieldUpdates(e)});return()=>t?.unsubscribe()},[]);let h=m(async(t,e)=>{let s=e?.nativeEvent;if(s?.isDraftSubmission){let{onSuccess:i,onError:l}=s.draftCallbacks;try{if(!await r.trigger())return;let n=await o.onSubmit(t);if(n?.data)i?.();else if(n?.error){let B=o.stepState.currentStep.name,P=o.meta?.fields?.[B],O=u(n?.fieldErrors||[],P);l?.({error:n.error,rawError:n.rawError,fieldErrors:O})}}catch(a){l?.({error:a,rawError:a,fieldErrors:[]})}}else g(t)},"handleSubmit");return V(p,{...r,key:`form-${o.stepState.currentStep.name}`},b("form",{id:k,onSubmit:r.handleSubmit(h),className:"space-y-4 RemoteFlows__OnboardingForm",children:b(F,{components:E,fields:o.fields,fieldsets:o.meta.fieldsets,fieldValues:o.fieldValues})}))}m(U,"OnboardingForm");export{U as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HZDCZFR5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Onboarding/components/OnboardingForm.tsx"],"sourcesContent":["import { JSONSchemaFormFields } from '@/src/components/form/JSONSchemaForm';\nimport { Form } from '@/src/components/ui/form';\nimport { useEffect } from 'react';\nimport { useOnboardingContext } from '@/src/flows/Onboarding/context';\nimport { useForm } from 'react-hook-form';\nimport { useJsonSchemasValidationFormResolver } from '@/src/components/form/validationResolver';\nimport { Fields } from '@remoteoss/json-schema-form';\nimport {\n BasicInformationFormPayload,\n BenefitsFormPayload,\n ContractDetailsFormPayload,\n} from '@/src/flows/Onboarding/types';\nimport { $TSFixMe, Components } from '@/src/types/remoteFlows';\nimport { normalizeFieldErrors } from '@/src/lib/mutations';\n\ntype OnboardingFormProps = {\n onSubmit: (\n payload:\n | BasicInformationFormPayload\n | BenefitsFormPayload\n | ContractDetailsFormPayload,\n ) => void;\n components?: Components;\n fields?: Fields;\n defaultValues: Record<string, unknown>;\n};\n\nexport function OnboardingForm({\n defaultValues,\n onSubmit,\n components,\n}: OnboardingFormProps) {\n const { formId, onboardingBag } = useOnboardingContext();\n\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n onboardingBag.handleValidation,\n );\n\n const form = useForm({\n resolver,\n defaultValues,\n shouldUnregister: false,\n mode: 'onBlur',\n });\n\n useEffect(() => {\n // When the employmentId is set,\n // we need to run the checkFieldUpdates to update fieldValues in useStepState\n if (onboardingBag.employmentId) {\n onboardingBag?.checkFieldUpdates(form.getValues());\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n const subscription = form?.watch((values) => {\n const isAnyFieldDirty = Object.keys(values).some(\n (key) =>\n values[key as keyof unknown] !== defaultValues[key as keyof unknown],\n );\n if (isAnyFieldDirty) {\n onboardingBag?.checkFieldUpdates(values);\n }\n });\n return () => subscription?.unsubscribe();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleSubmit = async (\n values: Record<string, unknown>,\n event?: React.BaseSyntheticEvent,\n ) => {\n const nativeEvent = event?.nativeEvent as $TSFixMe;\n\n if (nativeEvent?.isDraftSubmission) {\n // Handle draft submission\n const { onSuccess, onError } = nativeEvent.draftCallbacks;\n\n try {\n // Trigger validation\n const isValid = await form.trigger();\n if (!isValid) {\n return; // Don't submit if validation fails\n }\n\n // Submit the form\n const response = await onboardingBag.onSubmit(values);\n\n if (response?.data) {\n onSuccess?.();\n } else if (response?.error) {\n const currentStepName = onboardingBag.stepState.currentStep.name;\n\n // Get the appropriate fields based on current step\n const currentStepFields =\n onboardingBag.meta?.fields?.[\n currentStepName as keyof typeof onboardingBag.meta.fields\n ];\n\n const normalizedFieldErrors = normalizeFieldErrors(\n response?.fieldErrors || [],\n currentStepFields,\n );\n onError?.({\n error: response.error,\n rawError: response.rawError,\n fieldErrors: normalizedFieldErrors,\n });\n }\n } catch (error) {\n onError?.({\n error: error as Error,\n rawError: error as Record<string, unknown>,\n fieldErrors: [],\n });\n }\n } else {\n // Handle normal form submission\n onSubmit(values);\n }\n };\n\n return (\n <Form {...form} key={`form-${onboardingBag.stepState.currentStep.name}`}>\n <form\n id={formId}\n onSubmit={form.handleSubmit(handleSubmit)}\n className='space-y-4 RemoteFlows__OnboardingForm'\n >\n <JSONSchemaFormFields\n components={components}\n fields={onboardingBag.fields}\n fieldsets={onboardingBag.meta.fieldsets}\n fieldValues={onboardingBag.fieldValues}\n />\n </form>\n </Form>\n );\n}\n"],"mappings":"kPAEA,OAAS,aAAAA,MAAiB,QAgIlB,cAAAC,MAAA,oBANJ,wBAAAC,MAAA,QAjGG,SAASC,EAAe,CAC7B,cAAAC,EACA,SAAAC,EACA,WAAAC,CACF,EAAwB,CACtB,GAAM,CAAE,OAAAC,EAAQ,cAAAC,CAAc,EAAIC,EAAqB,EAEjDC,EAAWC,EAEfH,EAAc,gBAChB,EAEMI,EAAOC,EAAQ,CACnB,SAAAH,EACA,cAAAN,EACA,iBAAkB,GAClB,KAAM,QACR,CAAC,EAEDU,EAAU,IAAM,CAGVN,EAAc,cAChBA,GAAe,kBAAkBI,EAAK,UAAU,CAAC,CAGrD,EAAG,CAAC,CAAC,EAELE,EAAU,IAAM,CACd,IAAMC,EAAeH,GAAM,MAAOI,GAAW,CACnB,OAAO,KAAKA,CAAM,EAAE,KACzCC,GACCD,EAAOC,CAAoB,IAAMb,EAAca,CAAoB,CACvE,GAEET,GAAe,kBAAkBQ,CAAM,CAE3C,CAAC,EACD,MAAO,IAAMD,GAAc,YAAY,CAEzC,EAAG,CAAC,CAAC,EAEL,IAAMG,EAAeC,EAAA,MACnBH,EACAI,IACG,CACH,IAAMC,EAAcD,GAAO,YAE3B,GAAIC,GAAa,kBAAmB,CAElC,GAAM,CAAE,UAAAC,EAAW,QAAAC,CAAQ,EAAIF,EAAY,eAE3C,GAAI,CAGF,GAAI,CADY,MAAMT,EAAK,QAAQ,EAEjC,OAIF,IAAMY,EAAW,MAAMhB,EAAc,SAASQ,CAAM,EAEpD,GAAIQ,GAAU,KACZF,IAAY,UACHE,GAAU,MAAO,CAC1B,IAAMC,EAAkBjB,EAAc,UAAU,YAAY,KAGtDkB,EACJlB,EAAc,MAAM,SAClBiB,CACF,EAEIE,EAAwBC,EAC5BJ,GAAU,aAAe,CAAC,EAC1BE,CACF,EACAH,IAAU,CACR,MAAOC,EAAS,MAChB,SAAUA,EAAS,SACnB,YAAaG,CACf,CAAC,CACH,CACF,OAASE,EAAO,CACdN,IAAU,CACR,MAAOM,EACP,SAAUA,EACV,YAAa,CAAC,CAChB,CAAC,CACH,CACF,MAEExB,EAASW,CAAM,CAEnB,EApDqB,gBAsDrB,OACEd,EAAC4B,EAAA,CAAM,GAAGlB,EAAM,IAAK,QAAQJ,EAAc,UAAU,YAAY,IAAI,IACnEP,EAAC,QACC,GAAIM,EACJ,SAAUK,EAAK,aAAaM,CAAY,EACxC,UAAU,wCAEV,SAAAjB,EAAC8B,EAAA,CACC,WAAYzB,EACZ,OAAQE,EAAc,OACtB,UAAWA,EAAc,KAAK,UAC9B,YAAaA,EAAc,YAC7B,EACF,CACF,CAEJ,CAhHgBW,EAAAhB,EAAA","names":["useEffect","jsx","createElement","OnboardingForm","defaultValues","onSubmit","components","formId","onboardingBag","useOnboardingContext","resolver","useJsonSchemasValidationFormResolver","form","useForm","useEffect","subscription","values","key","handleSubmit","__name","event","nativeEvent","onSuccess","onError","response","currentStepName","currentStepFields","normalizedFieldErrors","normalizeFieldErrors","error","Form","JSONSchemaFormFields"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as D}from"./chunk-SGE4DLC3.js";import{a as S,b as E,d as L,e as _,f as F}from"./chunk-TWIUL2P3.js";import{b as k}from"./chunk-WVDTHFGS.js";import{b as w}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as D}from"./chunk-SGE4DLC3.js";import{a as S,b as E,d as L,e as _,f as F}from"./chunk-TWIUL2P3.js";import{b as k}from"./chunk-WVDTHFGS.js";import{b as w}from"./chunk-3ZWDIEEM.js";import{a as l}from"./chunk-43WMZDDH.js";import{a as p}from"./chunk-P37U34EQ.js";import{jsx as y,jsxs as B}from"react/jsx-runtime";var A=p(({open:e,onOpenChange:a,title:t,trigger:n,children:m,className:d="",direction:i="right"})=>{let{components:f}=w(),r=f?.drawer;return r?y(r,{open:e,onOpenChange:a,title:t,trigger:n,children:m}):B(S,{open:e,onOpenChange:a,direction:i,children:[y(E,{asChild:!0,children:n}),y(L,{className:l(d,"RemoteFlows__Drawer h-full w-[540px] mt-0 ml-auto px-4"),children:B("div",{className:"h-full flex flex-col",children:[y(_,{children:y(F,{children:t})}),y("div",{className:"flex-1 overflow-y-auto",children:m})]})})]})},"Drawer");import*as T from"react";import{jsx as b}from"react/jsx-runtime";var g=T.forwardRef(({className:e,...a},t)=>b("div",{className:"relative w-full overflow-auto",children:b("table",{ref:t,className:l("w-full caption-bottom text-sm",e),...a})}));g.displayName="Table";var x=T.forwardRef(({className:e,...a},t)=>b("thead",{ref:t,className:l("[&_tr]:border-b",e),...a}));x.displayName="TableHeader";var h=T.forwardRef(({className:e,...a},t)=>b("tbody",{ref:t,className:l("[&_tr:last-child]:border-0",e),...a}));h.displayName="TableBody";var K=T.forwardRef(({className:e,...a},t)=>b("tfoot",{ref:t,className:l("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...a}));K.displayName="TableFooter";var R=T.forwardRef(({className:e,...a},t)=>b("tr",{ref:t,className:l("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...a}));R.displayName="TableRow";var v=T.forwardRef(({className:e,...a},t)=>b("th",{ref:t,className:l("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...a}));v.displayName="TableHead";var C=T.forwardRef(({className:e,...a},t)=>b("td",{ref:t,className:l("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...a}));C.displayName="TableCell";var Y=T.forwardRef(({className:e,...a},t)=>b("caption",{ref:t,className:l("mt-4 text-sm text-muted-foreground",e),...a}));Y.displayName="TableCaption";import q from"react";import{jsx as c,jsxs as I}from"react/jsx-runtime";var H=q.forwardRef(({data:e=[],columns:a,className:t=""},n)=>{let{components:m}=w(),d=m?.table;return d?c(d,{data:e,columns:a,className:t}):I(g,{ref:n,className:l("RemoteFlows__Table",t),children:[c(x,{children:c(R,{children:a.map(i=>c(v,{className:l("RemoteFlows__TableHead",i.className),children:i.label},String(i.id)))})}),c(h,{children:e?.map((i,f)=>c(R,{children:a.map(r=>c(C,{className:l("RemoteFlows__TableCell",r.className,r.cellClassName),children:r.render?r.render(i[r.id],i,f):i[r.id]},String(r.id)))},z(i,f)))})]})});H.displayName="Table";function z(e,a){return String(e.id??a)}p(z,"getRowKey");import{Fragment as M,jsx as o,jsxs as s}from"react/jsx-runtime";var J="RemoteFlows__SummaryRow flex justify-between items-center py-2 text-xs",V="RemoteFlows__SummaryRowBorder border-b border-b-1 border-b-[#E4E4E7]",u=p(({children:e,withBorder:a=!1,className:t=""})=>o("div",{className:l(J,a&&V,t),children:e}),"SummaryRow"),W=p(({usedDays:e,bookedDays:a,approvedDaysBeforeTermination:t,approvedDaysAfterTermination:n,remainingDays:m,proposedTerminationDate:d,isUnlimitedPto:i,currentEntitlementDays:f})=>{let r=new Date(d).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return s("div",{children:[s(u,{withBorder:!0,children:[o("label",{children:"Number of days entitled to per year"}),o("p",{"data-testid":"entitled-days",className:"font-bold",children:i?"Unlimited":f})]}),s(u,{children:[o("label",{children:"Total days booked"}),o("p",{"data-testid":"booked-days",className:"font-bold",children:a})]}),s(u,{children:[o("label",{children:"Number of days already used"}),o("p",{"data-testid":"used-days",className:"font-bold",children:e})]}),s(u,{children:[s("label",{children:["Approved for use before ",r]}),o("p",{"data-testid":"approved-days-before-termination",className:"font-bold",children:t})]}),s(u,{withBorder:!0,children:[s("label",{children:["Approved for use after ",r]}),o("p",{"data-testid":"approved-days-after-termination",className:"font-bold",children:n})]}),s(u,{children:[o("label",{children:"Total days remaining unused"}),o("p",{"data-testid":"remaining-days",className:"font-bold",children:m})]}),o(u,{className:"mb-2 py-0",children:s("p",{className:"text-xs text-[#222E39]",children:["Unused days expire on ",r]})})]})},"SummaryTimeOff"),X=[{id:"formattedDate",label:"Dates",className:"w-[250px]",cellClassName:"font-medium"},{id:"duration",label:"Duration",render:p(e=>D({number:e,singular:"day",plural:"days",followCopyGuidelines:!1,showNumber:!0}),"render")},{id:"status",label:"Status"}],Z=p(({employeeName:e,timeoffQuery:a,entitledDays:t,countryName:n,currentEntitlementDays:m,formattedProposedTerminationDate:d,onOpenChange:i,open:f})=>{let{data:r,isLoading:N}=a;return o(A,{open:f,onOpenChange:i,title:`${e} paid time off breakdown`,trigger:o(k,{variant:"link",className:"text-xs text-[#3B82F6] font-bold p-0",children:"See detailed time off breakdown \u2197"}),className:"h-full w-[540px] mt-0 ml-auto px-4 RemoteFlows_DrawerTimeOff",children:!N&&o(M,{children:Array.isArray(r?.timeoffs)&&r?.timeoffs?.length>0?s(M,{children:[o("p",{className:"text-[#09090B] font-medium mb-4",children:"This list is for your information only."}),s("p",{className:"text-xs text-[#09090B] mb-1 flex items-center justify-between gap-2",children:[s("span",{children:["Annual entitlement for ",n]}),o("span",{className:"font-bold",children:t})]}),s("p",{className:"text-xs text-[#09090B] mb-6 flex items-center justify-between gap-2",children:[s("span",{children:["Entitlement up to ",d]}),o("span",{className:"font-bold",children:m})]}),o("div",{className:"mb-2",children:o(H,{data:r?.timeoffs,columns:X})}),s("p",{className:"text-xs",children:["Total of"," ",D({number:r?.bookedDays,singular:"day",plural:"days",followCopyGuidelines:!1,showNumber:!0})," ","booked"]})]}):s(M,{children:[o("p",{className:"font-medium mb-1 text-[#09090B]",children:"No recorded time off"}),s("p",{className:"text-sm text-[#09090B]",children:["According to our records, ",e," has not taken any time off this year."]})]})})})},"DrawerTimeOff"),Ne=p(({employeeName:e,proposedTerminationDate:a,summaryData:t,formattedProposedTerminationDate:n,timeoffQuery:m,employment:d,onOpenChange:i,open:f})=>{let{entitledDays:r,bookedDays:N,usedDays:O,approvedDaysBeforeTermination:U,approvedDaysAfterTermination:$,remainingDays:Q,currentEntitlementDays:P,isUnlimitedPto:G}=t.data;return s("div",{className:"RemoteFlows__PaidTimeOff__Container py-3",children:[o("h3",{className:"RemoteFlows__PaidTimeOff__Title mb-2",children:"Paid time off"}),s("p",{className:"RemoteFlows__PaidTimeOff__Description text-sm mb-2",children:["The proposed termination date for ",e," is"," ",n,". You will need to pay them for any unused accrued days. Below is a breakdown of their time off entitlement and usage for the current annual leave period:"]}),s("div",{className:"mb-2",children:[!t?.isLoading&&!t?.isError&&t?.data&&o(W,{usedDays:O,bookedDays:N,currentEntitlementDays:P,approvedDaysBeforeTermination:U,approvedDaysAfterTermination:$,remainingDays:Q,proposedTerminationDate:a,isUnlimitedPto:G}),o(Z,{employeeName:e,timeoffQuery:m,entitledDays:r,currentEntitlementDays:P,countryName:d?.country?.name??"Unknown",onOpenChange:i,formattedProposedTerminationDate:n,open:f})]})]})},"PaidTimeOff");export{Ne as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ID3ZF7QT.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as u}from"./chunk-5P7INAU2.js";import{a as F}from"./chunk-WJ6YJFD4.js";import{f as l,g as p}from"./chunk-CNDSIADP.js";import{c as f}from"./chunk-WXUIXZ7P.js";import{b as _}from"./chunk-TVZAFTPT.js";import{a as r}from"./chunk-P37U34EQ.js";import{useEffect as R}from"react";import{jsx as a}from"react/jsx-runtime";var w=["effective_date","reason_for_change","reason_for_change_description","additional_comments","additional_comments_toggle"];function x({onSubmit:b,onError:m,onSuccess:A}){let{formId:C,contractAmendment:{checkFieldUpdates:h,fields:s,onSubmit:S,stepState:g,initialValues:i,handleValidation:y}}=_(),V=u(y),e=l({resolver:V,defaultValues:g.values?.form||i,shouldUnregister:!0,mode:"onBlur"});R(()=>{let t=e?.watch(o=>{(Object.keys(e.formState.dirtyFields).length>0||e.formState.isDirty)&&h(o)});return()=>t?.unsubscribe()},[]);let v=r(async t=>{let o=!1;for(let[c,P]of Object.entries(t))if(!w.includes(c)&&i[c]!==P){o=!0;break}if(!o)return m?.({message:"no_changes_detected_contract_details"});let d=f(t,s,{isPartialValidation:!1});await b?.(d);let n=await S(t);n.error?m?.(n.error):await A?.(n.data)},"handleSubmit");return a(p,{...e,children:a("form",{id:C,"data-testid":"contract-amendment-form",onSubmit:e.handleSubmit(v),className:"space-y-4 RemoteFlows__ContractAmendmentForm",children:a(F,{fields:s})})})}r(x,"ContractAmendmentForm");export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IHNYOUXP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/ContractAmendment/ContractAmendmentForm.tsx"],"sourcesContent":["import {\n ContractAmendmentAutomatableResponse,\n PostAutomatableContractAmendmentError,\n} from '@/src/client';\nimport { JSONSchemaFormFields } from '@/src/components/form/JSONSchemaForm';\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { useJsonSchemasValidationFormResolver } from '@/src/components/form/validationResolver';\nimport { Form } from '@/src/components/ui/form';\nimport { useEffect } from 'react';\nimport { FieldValues, useForm } from 'react-hook-form';\nimport { useContractAmendmentContext } from './context';\n\ntype ContractAmendmentFormProps = {\n /**\n * Callback function to be called when the contract amendment form is submitted.\n * This function is called before the contract amendment is submitted.\n * It can be used to perform any additional validation or processing before\n * the contract amendment is submitted.\n * @param values\n * @returns\n */\n onSubmit?: (values: FieldValues) => void | Promise<void>;\n /**\n * Callback function to be called when the contract amendment fails.\n * @param error\n * @returns\n */\n onError?: (\n error:\n | PostAutomatableContractAmendmentError\n | { message: 'no_changes_detected_contract_details' },\n ) => void;\n /**\n * Callback function to be called when the contract amendment is successfully submitted.\n * This function is called after the contract amendment is submitted.\n * @param data\n * @returns\n */\n onSuccess?: (\n data: ContractAmendmentAutomatableResponse,\n ) => void | Promise<void>;\n};\n\nconst commonFields = [\n 'effective_date',\n 'reason_for_change',\n 'reason_for_change_description',\n 'additional_comments',\n 'additional_comments_toggle',\n] as const;\n\ntype CommonFields = (typeof commonFields)[number];\n\nexport function ContractAmendmentForm({\n onSubmit,\n onError,\n onSuccess,\n}: ContractAmendmentFormProps) {\n const {\n formId,\n contractAmendment: {\n checkFieldUpdates,\n fields,\n onSubmit: submitContractAmendment,\n stepState,\n initialValues,\n handleValidation,\n },\n } = useContractAmendmentContext();\n\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n handleValidation,\n );\n\n const form = useForm({\n resolver,\n defaultValues:\n // stepState.values is used as defaultValues for the form when the form is\n // rendered when clicking on the back button after the user has submitted the form\n // and the confirmation form is displayed.\n // This is because the form is unmounted when the user submits the form.\n stepState.values?.form || initialValues,\n shouldUnregister: true,\n mode: 'onBlur',\n });\n\n useEffect(() => {\n const subscription = form?.watch((values) => {\n const isFormDirty =\n Object.keys(form.formState.dirtyFields).length > 0 ||\n form.formState.isDirty;\n if (isFormDirty) {\n checkFieldUpdates(values);\n }\n });\n return () => subscription?.unsubscribe();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleSubmit = async (values: FieldValues) => {\n let hasContractDetailsChanges = false;\n for (const [key, value] of Object.entries(values)) {\n if (\n !commonFields.includes(key as CommonFields) &&\n // @ts-expect-error error\n initialValues[key] !== value\n ) {\n hasContractDetailsChanges = true;\n break;\n }\n }\n\n if (!hasContractDetailsChanges) {\n return onError?.({\n message: 'no_changes_detected_contract_details',\n });\n }\n\n const parsedValues = parseJSFToValidate(values, fields, {\n isPartialValidation: false,\n });\n\n await onSubmit?.(parsedValues);\n\n const contractAmendmentResult = await submitContractAmendment(values);\n\n if (contractAmendmentResult.error) {\n onError?.(contractAmendmentResult.error);\n } else {\n await onSuccess?.(\n contractAmendmentResult.data as ContractAmendmentAutomatableResponse,\n );\n }\n };\n\n return (\n <Form {...form}>\n <form\n id={formId}\n data-testid='contract-amendment-form'\n onSubmit={form.handleSubmit(handleSubmit)}\n className='space-y-4 RemoteFlows__ContractAmendmentForm'\n >\n <JSONSchemaFormFields fields={fields} />\n </form>\n </Form>\n );\n}\n"],"mappings":"uPAQA,OAAS,aAAAA,MAAiB,QAwIlB,cAAAC,MAAA,oBArGR,IAAMC,EAAe,CACnB,iBACA,oBACA,gCACA,sBACA,4BACF,EAIO,SAASC,EAAsB,CACpC,SAAAC,EACA,QAAAC,EACA,UAAAC,CACF,EAA+B,CAC7B,GAAM,CACJ,OAAAC,EACA,kBAAmB,CACjB,kBAAAC,EACA,OAAAC,EACA,SAAUC,EACV,UAAAC,EACA,cAAAC,EACA,iBAAAC,CACF,CACF,EAAIC,EAA4B,EAE1BC,EAAWC,EAEfH,CACF,EAEMI,EAAOC,EAAQ,CACnB,SAAAH,EACA,cAKEJ,EAAU,QAAQ,MAAQC,EAC5B,iBAAkB,GAClB,KAAM,QACR,CAAC,EAEDO,EAAU,IAAM,CACd,IAAMC,EAAeH,GAAM,MAAOI,GAAW,EAEzC,OAAO,KAAKJ,EAAK,UAAU,WAAW,EAAE,OAAS,GACjDA,EAAK,UAAU,UAEfT,EAAkBa,CAAM,CAE5B,CAAC,EACD,MAAO,IAAMD,GAAc,YAAY,CAEzC,EAAG,CAAC,CAAC,EAEL,IAAME,EAAeC,EAAA,MAAOF,GAAwB,CAClD,IAAIG,EAA4B,GAChC,OAAW,CAACC,EAAKC,CAAK,IAAK,OAAO,QAAQL,CAAM,EAC9C,GACE,CAACnB,EAAa,SAASuB,CAAmB,GAE1Cb,EAAca,CAAG,IAAMC,EACvB,CACAF,EAA4B,GAC5B,KACF,CAGF,GAAI,CAACA,EACH,OAAOnB,IAAU,CACf,QAAS,sCACX,CAAC,EAGH,IAAMsB,EAAeC,EAAmBP,EAAQZ,EAAQ,CACtD,oBAAqB,EACvB,CAAC,EAED,MAAML,IAAWuB,CAAY,EAE7B,IAAME,EAA0B,MAAMnB,EAAwBW,CAAM,EAEhEQ,EAAwB,MAC1BxB,IAAUwB,EAAwB,KAAK,EAEvC,MAAMvB,IACJuB,EAAwB,IAC1B,CAEJ,EAlCqB,gBAoCrB,OACE5B,EAAC6B,EAAA,CAAM,GAAGb,EACR,SAAAhB,EAAC,QACC,GAAIM,EACJ,cAAY,0BACZ,SAAUU,EAAK,aAAaK,CAAY,EACxC,UAAU,+CAEV,SAAArB,EAAC8B,EAAA,CAAqB,OAAQtB,EAAQ,EACxC,EACF,CAEJ,CA/FgBc,EAAApB,EAAA","names":["useEffect","jsx","commonFields","ContractAmendmentForm","onSubmit","onError","onSuccess","formId","checkFieldUpdates","fields","submitContractAmendment","stepState","initialValues","handleValidation","useContractAmendmentContext","resolver","useJsonSchemasValidationFormResolver","form","useForm","useEffect","subscription","values","handleSubmit","__name","hasContractDetailsChanges","key","value","parsedValues","parseJSFToValidate","contractAmendmentResult","Form","JSONSchemaFormFields"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as m,b as s}from"./chunk-U4JVXNOG.js";import{c as t,d as i}from"./chunk-A477TZFC.js";import{a as o}from"./chunk-P37U34EQ.js";import{useState as T}from"react";var k=o(({proposedTerminationDate:e,employeeName:f,employmentId:a,employment:r,render:y})=>{let[n,d]=T(!1),u=i({employmentId:a}),l=new Date(e).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),c=t({employmentId:a,options:{enabled:n}}),p=m({employmentId:a,date:e}),D=s({employmentId:a,proposedTerminationDate:e,employment:r});return y({leavePoliciesSummaryQuery:u,timeoffQuery:c||{data:{bookedDays:0,timeoffs:[]}},bookedTimeBeforeAndAfterTerminationQuery:p,formattedProposedTerminationDate:l,employeeName:f,proposedTerminationDate:e,summaryData:D??{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:n,onOpenChange:o(()=>{d(P=>!P)},"onOpenChange")})},"PaidTimeOffContainer");export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IUEXOXFA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Termination/components/PaidTimeOff/PaidTimeOffContainer.tsx"],"sourcesContent":["import {\n usePaidTimeoffBreakdownQuery,\n useTimeOffLeavePoliciesSummaryQuery,\n} from '@/src/common/api';\nimport {\n useBookedTimeoffBeforeAndAfterTerminationQuery,\n useSummaryTimeOffDataQuery,\n} from '@/src/flows/Termination/api';\nimport { PaidTimeOffContainerProps } from '@/src/flows/Termination/components/PaidTimeOff/types';\nimport { useState } from 'react';\n\n/**\n * PaidTimeOffContainer component\n *\n * This is a container component that manages paid time off (PTO) data retrieval and state\n * for the termination flow. It aggregates multiple time off-related queries and formats\n * the termination date for display.\n *\n */\nexport const PaidTimeOffContainer = ({\n proposedTerminationDate,\n employeeName,\n employmentId,\n employment,\n render,\n}: PaidTimeOffContainerProps) => {\n const [open, setOpen] = useState(false);\n\n const leavePoliciesSummaryQuery = useTimeOffLeavePoliciesSummaryQuery({\n employmentId: employmentId,\n });\n\n const formattedProposedTerminationDate = new Date(\n proposedTerminationDate,\n ).toLocaleDateString('en-US', {\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n });\n\n const timeoffQuery = usePaidTimeoffBreakdownQuery({\n employmentId: employmentId,\n options: {\n enabled: open,\n },\n });\n\n const bookedTimeBeforeAndAfterTerminationQuery =\n useBookedTimeoffBeforeAndAfterTerminationQuery({\n employmentId: employmentId,\n date: proposedTerminationDate,\n });\n\n // computed summary data\n const summaryData = useSummaryTimeOffDataQuery({\n employmentId: employmentId,\n proposedTerminationDate,\n employment: employment,\n });\n\n const onOpenChange = () => {\n setOpen((open) => !open);\n };\n\n return render({\n leavePoliciesSummaryQuery,\n timeoffQuery: timeoffQuery || {\n data: {\n bookedDays: 0,\n timeoffs: [],\n },\n },\n bookedTimeBeforeAndAfterTerminationQuery,\n formattedProposedTerminationDate,\n employeeName,\n proposedTerminationDate,\n summaryData: summaryData ?? {\n data: {\n entitledDays: '0 days',\n bookedDays: '0 days',\n usedDays: '0 days',\n approvedDaysBeforeTermination: '0 days',\n approvedDaysAfterTermination: '0 days',\n remainingDays: '0 days',\n isUnlimitedPto: false,\n },\n isLoading: false,\n isError: false,\n error: null,\n },\n employment: employment,\n open,\n onOpenChange,\n });\n};\n"],"mappings":"sIASA,OAAS,YAAAA,MAAgB,QAUlB,IAAMC,EAAuBC,EAAA,CAAC,CACnC,wBAAAC,EACA,aAAAC,EACA,aAAAC,EACA,WAAAC,EACA,OAAAC,CACF,IAAiC,CAC/B,GAAM,CAACC,EAAMC,CAAO,EAAIC,EAAS,EAAK,EAEhCC,EAA4BC,EAAoC,CACpE,aAAcP,CAChB,CAAC,EAEKQ,EAAmC,IAAI,KAC3CV,CACF,EAAE,mBAAmB,QAAS,CAC5B,MAAO,OACP,IAAK,UACL,KAAM,SACR,CAAC,EAEKW,EAAeC,EAA6B,CAChD,aAAcV,EACd,QAAS,CACP,QAASG,CACX,CACF,CAAC,EAEKQ,EACJC,EAA+C,CAC7C,aAAcZ,EACd,KAAMF,CACR,CAAC,EAGGe,EAAcC,EAA2B,CAC7C,aAAcd,EACd,wBAAAF,EACA,WAAYG,CACd,CAAC,EAMD,OAAOC,EAAO,CACZ,0BAAAI,EACA,aAAcG,GAAgB,CAC5B,KAAM,CACJ,WAAY,EACZ,SAAU,CAAC,CACb,CACF,EACA,yCAAAE,EACA,iCAAAH,EACA,aAAAT,EACA,wBAAAD,EACA,YAAae,GAAe,CAC1B,KAAM,CACJ,aAAc,SACd,WAAY,SACZ,SAAU,SACV,8BAA+B,SAC/B,6BAA8B,SAC9B,cAAe,SACf,eAAgB,EAClB,EACA,UAAW,GACX,QAAS,GACT,MAAO,IACT,EACA,WAAYZ,EACZ,KAAAE,EACA,aAhCmBN,EAAA,IAAM,CACzBO,EAASD,GAAS,CAACA,CAAI,CACzB,EAFqB,eAiCrB,CAAC,CACH,EA3EoC","names":["useState","PaidTimeOffContainer","__name","proposedTerminationDate","employeeName","employmentId","employment","render","open","setOpen","useState","leavePoliciesSummaryQuery","useTimeOffLeavePoliciesSummaryQuery","formattedProposedTerminationDate","timeoffQuery","usePaidTimeoffBreakdownQuery","bookedTimeBeforeAndAfterTerminationQuery","useBookedTimeoffBeforeAndAfterTerminationQuery","summaryData","useSummaryTimeOffDataQuery"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as v}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as v}from"./chunk-A477TZFC.js";import{a as l,b as _}from"./chunk-FRTJ4KWA.js";import{a as A}from"./chunk-2YTBWEC7.js";import{E as w,c as E,r as b}from"./chunk-AA7QB3QQ.js";import{a as M}from"./chunk-PJBAQZ6G.js";import{d}from"./chunk-3ZWDIEEM.js";import{a as j,c as S}from"./chunk-WXUIXZ7P.js";import{a as t}from"./chunk-P37U34EQ.js";import{createHeadlessForm as I,modify as B}from"@remoteoss/json-schema-form";import{useMutation as Q,useQuery as J}from"@tanstack/react-query";var K=t(({countryCode:a,employment:r,fieldValues:n,options:e})=>{let{client:u}=d(),m=e?.jsonSchemaVersion?.contract_amendments?{json_schema_version:e.jsonSchemaVersion.contract_amendments}:{};return J({queryKey:["contract-amendment-schema"],retry:!1,queryFn:t(async()=>{let o=await E({client:u,headers:{Authorization:""},query:{employment_id:r?.id,country_code:a,...m}});if(o.error||!o.data)throw new Error("Failed to fetch contract amendment schema");return o},"queryFn"),enabled:!!r,select:t(({data:o})=>{let c=o?.data||{};if(e&&e.jsfModify){let{schema:y}=B(c,e.jsfModify);c=y}let s={...n,annual_gross_salary:n?.annual_gross_salary?j(n?.annual_gross_salary):void 0},f=Object.keys(s).length>0;return I(c,{initialValues:f?s:_(r)})},"select")})},"useContractAmendmentSchemaQuery"),U=t(a=>{let{client:r}=d(),n=a?.jsonSchemaVersion?.contract_amendments?{json_schema_version:a.jsonSchemaVersion.contract_amendments}:{};return Q({mutationFn:t(e=>b({client:r,headers:{Authorization:""},body:e,query:{...n}}),"mutationFn")})},"useCreateContractAmendmentMutation"),D=t(a=>{let{client:r}=d(),n=a?.jsonSchemaVersion?.contract_amendments?{json_schema_version:a.jsonSchemaVersion.contract_amendments}:{};return Q({mutationFn:t(e=>w({client:r,headers:{Authorization:""},body:e,query:{...n}}),"mutationFn")})},"useAutomatableContractAmendmentMutation"),ae=t(({employmentId:a,countryCode:r,options:n})=>{let{fieldValues:e,setFieldValues:u,stepState:m,nextStep:o,previousStep:c}=M(l),{data:s,isLoading:f,isError:V,error:y}=v({employmentId:a}),{data:i,isLoading:q,isError:L,error:T}=K({employment:s,countryCode:r,fieldValues:{...m.values?.[m.currentStep.name],...e},options:n}),k=_(s,i?.fields),F=U(n),g=D(n);async function O(h){let p=S(h,i?.fields||[],{isPartialValidation:!1}),P={employment_id:s?.id,amendment_contract_id:s?.active_contract_id,contract_amendment:{...p}};switch(m.currentStep.name){case l.form.name:{let{mutateAsync:C}=A(g),H=await C(P);return o(),H}case l.confirmation_form.name:{let{mutateAsync:C}=A(F);return C(P)}default:throw new Error("Invalid step state")}}t(O,"onSubmit");function z(h){if(i){let p=S(h,i?.fields);return i?.handleValidation(p)}return null}t(z,"handleValidation");function x(){c()}return t(x,"back"),{stepState:m,fields:i?.fields||[],isLoading:f||q,isError:V||L,error:y||T,isSubmitting:g.isPending||F.isPending,initialValues:k,values:e,handleValidation:z,checkFieldUpdates:u,onSubmit:O,back:x}},"useContractAmendment");export{ae as a};
|
|
2
|
+
//# sourceMappingURL=chunk-K2BWF2HC.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as g}from"./chunk-PGWKJ6FK.js";import{d as f,e as w}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as g}from"./chunk-PGWKJ6FK.js";import{d as f,e as w}from"./chunk-5KZXFQLZ.js";import{a as m}from"./chunk-2YTBWEC7.js";import{b as E}from"./chunk-WVDTHFGS.js";import{b as y}from"./chunk-3ZWDIEEM.js";import{a}from"./chunk-P37U34EQ.js";import{jsx as R}from"react/jsx-runtime";function A({onSubmit:S,onSuccess:d,onError:o,render:u,...r}){let{components:I}=y(),{onboardingBag:t,setCreditScore:c}=g(),n=f(),i=w(),{mutateAsync:b}=m(n),{mutateAsync:_}=m(i),l=a(async()=>{try{if(await S?.(),t.creditRiskStatus==="deposit_required"&&t.employmentId&&t.employment?.status&&!t.isEmploymentReadOnly){let e=await _({employment_slug:t.employmentId});if(e.data){await d?.({data:e.data,employmentStatus:"created_awaiting_reserve"}),c?.(s=>({...s,showReserveInvoice:!0})),t.refetchEmployment();return}e.error&&o?.({error:e.error,rawError:e.rawError,fieldErrors:[]})}else if(t.employmentId){let e=await b({employment_id:t.employmentId});if(e.data){await d?.({data:e.data,employmentStatus:"invited"}),c?.(s=>({...s,showInviteSuccessful:!0})),t.refetchEmployment();return}e.error&&o?.({error:e.error,rawError:e.rawError,fieldErrors:[]})}}catch(e){o?.({error:e,rawError:e,fieldErrors:[]})}},"handleSubmit"),p=t.creditRiskStatus==="deposit_required"&&t.employment?.status&&!t.isEmploymentReadOnly,v=I?.button;return v?R(v,{...r,disabled:n.isPending||i.isPending||r.disabled,onClick:e=>{l(),r.onClick?.(e)},children:u({employmentStatus:p?"created_awaiting_reserve":"invited"})}):R(E,{...r,disabled:n.isPending||i.isPending||r.disabled,onClick:()=>{l()},children:u({employmentStatus:p?"created_awaiting_reserve":"invited"})})}a(A,"OnboardingInvite");export{A as a};
|
|
2
|
+
//# sourceMappingURL=chunk-L3D2AK3X.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a}from"./chunk-HZDCZFR5.js";import{b as i}from"./chunk-PGWKJ6FK.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as d}from"react/jsx-runtime";function y({onSubmit:s,onSuccess:c,onError:t}){let{onboardingBag:o}=i(),u=e(async n=>{try{await s?.({countryCode:n.country});let r=await o.onSubmit(n);if(r?.data){await c?.(r?.data),o?.next();return}r?.error&&t?.({error:r.error,rawError:r.rawError,fieldErrors:[]})}catch(r){t?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit"),l=o.stepState.values?.select_country||o.initialValues.select_country;return d(a,{defaultValues:l,onSubmit:u})}e(y,"SelectCountryStep");export{y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-LQAHRGU4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as t}from"./chunk-5CVD5WZZ.js";import{b as n}from"./chunk-MRYRNB7Y.js";import{a as o}from"./chunk-P37U34EQ.js";import{jsx as e}from"react/jsx-runtime";function u({onSubmit:a}){let{terminationBag:i}=n();return e(t,{onSubmit:o(async r=>{await a?.(i?.parseFormValues(r)),i?.next()},"handleSubmit")})}o(u,"TerminationDetailsForm");export{u as a};
|
|
2
|
+
//# sourceMappingURL=chunk-LV5R6H3D.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-HZDCZFR5.js";import{b as t}from"./chunk-PGWKJ6FK.js";import{b as e}from"./chunk-2YTBWEC7.js";import{a as i}from"./chunk-P37U34EQ.js";import{jsx as c}from"react/jsx-runtime";function S({onSubmit:m,onSuccess:d,onError:a}){let{onboardingBag:o}=t(),l=i(async n=>{try{await m?.(o.parseFormValues(n));let r=await o.onSubmit(n);if(r?.data){await d?.(r?.data),o?.next();return}if(r?.error){let p=e(r?.fieldErrors||[],o.meta?.fields?.basic_information);a?.({error:r?.error,rawError:r?.rawError,fieldErrors:p})}}catch(r){a?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit"),f=o.stepState.values?.basic_information||o.initialValues.basic_information;return c(s,{defaultValues:f,onSubmit:l})}i(S,"BasicInformationStep");export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-M2CI2UDK.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h,b as y,d as Z,e as v,f as x,g as R}from"./chunk-TWIUL2P3.js";import{g as b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as h,b as y,d as Z,e as v,f as x,g as R}from"./chunk-TWIUL2P3.js";import{g as b}from"./chunk-AA7QB3QQ.js";import{b as k,d as C}from"./chunk-3ZWDIEEM.js";import{a as p,f as D}from"./chunk-43WMZDDH.js";import{a as e}from"./chunk-P37U34EQ.js";var z={disclaimerCostCalculator:4668194326797,employeeOnboardingTimeline:4411262104589,extraPayments:4466822781709,internationalPricing:4410698586893,remoteFxRate:33271144977421,terminationEmployeeCommunication:4411585179661,terminationNoticePeriods:5831900985613,involuntaryOffboardingServiceCharge:4406932229133,reconciliationInvoice:17604014808589},c=e(r=>`https://support.remote.com/hc/en-us/articles/${r}`,"buildZendeskURL");import{useQuery as L}from"@tanstack/react-query";var T=e((r,i)=>{let{client:a}=C();return L({queryKey:["zendesk-article",r],queryFn:e(async()=>{let t=await b({client:a,path:{id:Number(r)}});if(t.error)throw new Error(t.error.message||"Failed to fetch article");return t},"queryFn"),select:e(t=>{let o=t.data?.data.help_center_article;return o&&{...o,body:D(o.body||"")}},"select"),retry:!1,...i})},"useZendeskArticle");import{jsx as n,jsxs as m}from"react/jsx-runtime";var _=e(({Trigger:r,zendeskId:i,open:a,onClose:t})=>{let{components:o}=k(),d=c(i),l=e(()=>{t?.()},"handleClose"),{data:s,isLoading:f,error:g}=T(i,{enabled:a}),w=o?.zendeskDrawer;return w?n(w,{open:a,onClose:l,data:s,isLoading:f,error:g,zendeskURL:d,Trigger:r}):m(h,{open:a,onOpenChange:F=>!F&&l(),direction:"right",children:[n(y,{asChild:!0,children:r}),n(Z,{className:"h-full w-[540px] mt-0 ml-auto RemoteFlows_ZendeskDrawer",children:m("div",{className:"h-full flex flex-col",children:[m(v,{children:[n(x,{children:s?.title}),m(R,{children:["For more details see our"," ",n("a",{href:d,target:"_blank",rel:"noopener noreferrer",children:"help article"})," "]})]}),f&&n("div",{children:"Loading..."}),g&&n("div",{className:"text-sm p-4 text-red-500",children:"Error loading article"}),n("div",{className:"flex-1 overflow-y-auto p-4 RemoteFlows_ZendeskDrawer__Content",dangerouslySetInnerHTML:{__html:s?.body||""}})]})})]})},"ZendeskDrawer");import{useState as P}from"react";import{jsx as u}from"react/jsx-runtime";var N="RemoteFlows__ZendeskTriggerButton text-blue-500 hover:underline inline-block text-xs bg-transparent border-none cursor-pointer p-0";function j({zendeskId:r,className:i,onClick:a,children:t,external:o=!1}){let[d,l]=P(!1),s=e(()=>{o||l(!0),a?.(r)},"handleClick");return o?u("a",{href:c(r),target:"_blank",rel:"noopener noreferrer",onClick:s,className:p(N,i),children:t}):u(_,{zendeskId:r,open:d,onClose:()=>l(!1),Trigger:u("button",{onClick:s,className:p(N,i),children:t})})}e(j,"ZendeskTriggerButton");export{z as a,j as b};
|
|
2
|
+
//# sourceMappingURL=chunk-MZB24YJP.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as e}from"./chunk-PGWKJ6FK.js";import{b as i}from"./chunk-WVDTHFGS.js";import{b as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as e}from"./chunk-PGWKJ6FK.js";import{b as i}from"./chunk-WVDTHFGS.js";import{b as m}from"./chunk-3ZWDIEEM.js";import{a as u}from"./chunk-P37U34EQ.js";import{jsx as s}from"react/jsx-runtime";function p({children:t,...o}){let{formId:n}=e(),{components:f}=m(),r=f?.button;return r?s(r,{...o,form:n,children:t}):s(i,{...o,form:n,children:t})}u(p,"OnboardingSubmit");export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OIN3HGOQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as e}from"./chunk-WVDTHFGS.js";import{b as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as e}from"./chunk-WVDTHFGS.js";import{b as u}from"./chunk-3ZWDIEEM.js";import{b as i}from"./chunk-TVZAFTPT.js";import{a as m}from"./chunk-P37U34EQ.js";import{jsx as s}from"react/jsx-runtime";function d({children:t,...o}){let{formId:n}=i(),{components:f}=u(),r=f?.button;return r?s(r,{...o,form:n,children:t}):s(e,{...o,form:n,children:t})}m(d,"ContractAmendmentSubmit");export{d as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OW5QGJD4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as e}from"./chunk-MRYRNB7Y.js";import{b as i}from"./chunk-WVDTHFGS.js";import{b as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as e}from"./chunk-MRYRNB7Y.js";import{b as i}from"./chunk-WVDTHFGS.js";import{b as u}from"./chunk-3ZWDIEEM.js";import{a as m}from"./chunk-P37U34EQ.js";import{jsx as s}from"react/jsx-runtime";function T({children:t,...o}){let{formId:n}=e(),{components:f}=u(),r=f?.button;return r?s(r,{...o,form:n,children:t}):s(i,{...o,form:n,children:t})}m(T,"TerminationSubmit");export{T as a};
|
|
2
|
+
//# sourceMappingURL=chunk-P5WUODPR.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-2W2XD7ZY.js";import{b as e}from"./chunk-TOA3JILU.js";import{b as t}from"./chunk-2YTBWEC7.js";import{a as i}from"./chunk-P37U34EQ.js";import{jsx as p}from"react/jsx-runtime";function S({onSubmit:m,onSuccess:d,onError:a}){let{contractorOnboardingBag:o}=e(),l=i(async n=>{try{await m?.(o.parseFormValues(n));let r=await o.onSubmit(n);if(r?.data){await d?.(r?.data),o?.next();return}if(r?.error){let f=t(r?.fieldErrors||[],o.meta?.fields?.basic_information);a?.({error:r?.error,rawError:r?.rawError,fieldErrors:f})}}catch(r){a?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit"),c=o.stepState.values?.basic_information||o.initialValues.basic_information;return p(s,{defaultValues:c,onSubmit:l})}i(S,"BasicInformationStep");export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-P7JZC65P.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e as p}from"./chunk-DFJNVGK4.js";import{a as m}from"./chunk-43WMZDDH.js";import{a as i}from"./chunk-P37U34EQ.js";import{endOfMonth as _,isAfter as d,isBefore as g,parseISO as y,startOfDay as h,setDate as S,isFuture as w,differenceInHours as M,endOfDay as F,differenceInDays as x}from"date-fns";var c={MONTHLY:"monthly",SEMI_MONTHLY:"bi_monthly",BI_WEEKLY:"bi_weekly"};import{jsx as u,jsxs as T}from"react/jsx-runtime";function b(n,e,t){return{"x-jsf-presentation":{inputType:"hidden",Component:i(()=>T("div",{className:m("RemoteFlows__InformationStatement",t?.className),children:[u("h3",{className:m("RemoteFlows__InformationStatement__Title"),children:n}),u("p",{className:m("RemoteFlows__InformationStatement__Description"),children:e})]}),"Component")}}}i(b,"createInformationField");function a({title:n,description:e,severity:t}){return{statement:{title:n,description:e,severity:t}}}i(a,"createStatementProperty");var E={employee_communication:{index:0,name:"employee_communication"},termination_details:{index:1,name:"termination_details"},paid_time_off:{index:2,name:"paid_time_off"},additional_information:{index:3,name:"additional_information"}},Y=i(n=>{let e=new Date,t=S(e,15),o=h(e),l=h(t),f=n?.cycle_frequency,r=n?.cycles?.filter(s=>s.input_cutoff_date&&y(s.input_cutoff_date).getMonth()===e.getMonth())?.map(s=>y(s.input_cutoff_date));if(!r?.length)return e;switch(f){case c.MONTHLY:return d(o,r[0])?_(e):e;case c.SEMI_MONTHLY:return d(o,r[1])?_(e):d(o,r[0])&&g(o,l)?t:e;default:return e}},"calculateMinTerminationDate"),k=i(({minTerminationDate:n,isEmployeeInProbationPeriod:e,selectedDate:t})=>{let o=w(n),l=t&&M(F(t),new Date)<48;return t&&x(t,new Date)>=30||!t&&!o?null:o&&!e?a({description:`The next available termination dates are ${p(n)} and later. We've already processed the employee's payments until then.`,severity:"info"}):o&&e?a({description:"This payroll period's cut-off has passed. While you can offboard the employee after the cut-off, their payment may have already processed. If that's the case, we'll try to recover the payment. But if that isn't possible, we'll send you an invoice for the amount.",severity:"info"}):l?a({description:"Requests made with less than 48 hours' notice are subject to changes due to the country-specific offboarding laws and case details. If changes are needed, your specialist will guide you accordingly.",severity:"info"}):a({description:"Termination dates depend on payroll cutoffs, local laws, and case details. We'll aim for your proposed date but it's possible it will need to change. After you submit your request, a specialist will reach out and guide you through the process.",severity:"info"})},"calculateProposedTerminationDateStatement");function V(n,e){return{confidential:"",customer_informed_employee:"",customer_informed_employee_date:"",customer_informed_employee_description:"",personal_email:"",termination_reason:void 0,reason_description:"",termination_reason_files:[],will_challenge_termination:"",will_challenge_termination_description:null,agrees_to_pto_amount:"",agrees_to_pto_amount_notes:null,acknowledge_termination_procedure:!1,additional_comments:"",proposed_termination_date:"",risk_assessment_reasons:[],timesheet_file:void 0,...n,...e?{termination_reason:"cancellation_before_start_date"}:{}}}i(V,"buildInitialValues");export{b as a,E as b,Y as c,k as d,V as e};
|
|
2
|
+
//# sourceMappingURL=chunk-Q2N5SOKO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/Termination/utils.ts","../src/common/payroll.ts","../src/components/form/jsf-utils/createFields.tsx"],"sourcesContent":["import {\n endOfMonth,\n isAfter,\n isBefore,\n parseISO,\n startOfDay,\n setDate,\n isFuture,\n differenceInHours,\n endOfDay,\n differenceInDays,\n} from 'date-fns';\nimport { PayrollCalendarEor } from '@/src/client';\nimport { Step } from '@/src/flows/useStepState';\nimport { PAYROLL_CYCLES } from '@/src/common/payroll';\nimport { createStatementProperty } from '@/src/components/form/jsf-utils/createFields';\nimport { formatMonthDayInLocalTime } from '@/src/lib/time';\nimport { TerminationFormValues } from '@/src/flows/Termination/types';\n\nexport type StepTerminationKeys =\n | 'employee_communication'\n | 'termination_details'\n | 'paid_time_off'\n | 'additional_information';\n\nexport const STEPS: Record<StepTerminationKeys, Step<StepTerminationKeys>> = {\n employee_communication: { index: 0, name: 'employee_communication' },\n termination_details: { index: 1, name: 'termination_details' },\n paid_time_off: { index: 2, name: 'paid_time_off' },\n additional_information: { index: 3, name: 'additional_information' },\n} as const;\n\nexport const calculateMinTerminationDate = (\n payrollCalendars: PayrollCalendarEor | undefined,\n) => {\n const today = new Date();\n const midMonthDate = setDate(today, 15);\n\n // Normalize today and mid month date to midnight to ensure consistent date comparisons regardless of time\n const normalizedToday = startOfDay(today);\n const normalizedMidMonthDate = startOfDay(midMonthDate);\n\n const payFrequency = payrollCalendars?.cycle_frequency;\n\n const currentMonthCutoffDates = payrollCalendars?.cycles\n ?.filter(\n (cycle) =>\n cycle.input_cutoff_date &&\n parseISO(cycle.input_cutoff_date).getMonth() === today.getMonth(),\n )\n // Since cutoffDate is a date-only string with no time component, the converted Date will be set to midnight\n ?.map((cycle) => parseISO(cycle.input_cutoff_date!));\n\n if (!currentMonthCutoffDates?.length) return today;\n\n switch (payFrequency) {\n /**\n * For monthly payroll, if today is\n * - after cutoff return end of month\n * - any other case return today\n */\n case PAYROLL_CYCLES.MONTHLY:\n return isAfter(normalizedToday, currentMonthCutoffDates[0])\n ? endOfMonth(today)\n : today;\n\n /**\n * For bi-monthly payroll, if today is\n * - after second cutoff return end of month\n * - between first cutoff and mid-month return mid-month date\n * - any other case return today\n */\n case PAYROLL_CYCLES.SEMI_MONTHLY:\n if (isAfter(normalizedToday, currentMonthCutoffDates[1]))\n return endOfMonth(today);\n if (\n isAfter(normalizedToday, currentMonthCutoffDates[0]) &&\n isBefore(normalizedToday, normalizedMidMonthDate)\n )\n return midMonthDate;\n return today;\n\n default:\n return today;\n }\n};\n\nexport const calculateProposedTerminationDateStatement = ({\n minTerminationDate,\n isEmployeeInProbationPeriod,\n selectedDate,\n}: {\n minTerminationDate: Date;\n isEmployeeInProbationPeriod: boolean;\n selectedDate?: Date;\n}) => {\n const hasPassedCutoffDate = isFuture(minTerminationDate);\n const isShortNotice =\n selectedDate && differenceInHours(endOfDay(selectedDate), new Date()) < 48;\n const isMoreThan30Days =\n selectedDate && differenceInDays(selectedDate, new Date()) >= 30;\n\n if (isMoreThan30Days || (!selectedDate && !hasPassedCutoffDate)) {\n return null;\n }\n\n if (hasPassedCutoffDate && !isEmployeeInProbationPeriod) {\n return createStatementProperty({\n description: `The next available termination dates are ${formatMonthDayInLocalTime(minTerminationDate)} and later. We've already processed the employee's payments until then.`,\n severity: 'info',\n });\n }\n\n if (hasPassedCutoffDate && isEmployeeInProbationPeriod) {\n return createStatementProperty({\n description: `This payroll period's cut-off has passed. While you can offboard the employee after the cut-off, their payment may have already processed. If that's the case, we'll try to recover the payment. But if that isn't possible, we'll send you an invoice for the amount.`,\n severity: 'info',\n });\n }\n\n if (isShortNotice) {\n return createStatementProperty({\n description: `Requests made with less than 48 hours' notice are subject to changes due to the country-specific offboarding laws and case details. If changes are needed, your specialist will guide you accordingly.`,\n severity: 'info',\n });\n }\n\n return createStatementProperty({\n description: `Termination dates depend on payroll cutoffs, local laws, and case details. We'll aim for your proposed date but it's possible it will need to change. After you submit your request, a specialist will reach out and guide you through the process.`,\n severity: 'info',\n });\n};\n\nexport function buildInitialValues(\n stepsInitialValues: Partial<TerminationFormValues>,\n hasFutureStartDate: boolean,\n): TerminationFormValues {\n const initialValues: TerminationFormValues = {\n confidential: '',\n customer_informed_employee: '',\n customer_informed_employee_date: '',\n customer_informed_employee_description: '',\n personal_email: '',\n termination_reason: undefined,\n reason_description: '',\n termination_reason_files: [],\n will_challenge_termination: '',\n will_challenge_termination_description: null,\n agrees_to_pto_amount: '',\n agrees_to_pto_amount_notes: null,\n acknowledge_termination_procedure: false,\n additional_comments: '',\n proposed_termination_date: '',\n risk_assessment_reasons: [],\n timesheet_file: undefined,\n ...stepsInitialValues,\n ...(hasFutureStartDate\n ? { termination_reason: 'cancellation_before_start_date' }\n : {}),\n };\n\n return initialValues;\n}\n","export const PAYROLL_CYCLES = {\n MONTHLY: 'monthly',\n SEMI_MONTHLY: 'bi_monthly', // this inconsistency is intentional, due to legacy misnomer in the backend\n BI_WEEKLY: 'bi_weekly',\n} as const;\n","import { cn } from '@/src/lib/utils';\nimport { $TSFixMe } from '@/src/types/remoteFlows';\n\ntype JSFPresentationConfig = {\n inputType?: string;\n Component?: React.ComponentType<$TSFixMe>;\n hidden?: boolean;\n [key: string]: unknown;\n};\n\ntype JSFFieldConfig = {\n 'x-jsf-presentation'?: JSFPresentationConfig;\n [key: string]: unknown;\n};\n\n/**\n * Creates an information field with standard styling\n */\nexport function createInformationField(\n title: React.ReactNode,\n description: React.ReactNode,\n options?: {\n className?: string;\n },\n): JSFFieldConfig {\n return {\n 'x-jsf-presentation': {\n inputType: 'hidden',\n Component: () => (\n <div\n className={cn(\n 'RemoteFlows__InformationStatement',\n options?.className,\n )}\n >\n <h3 className={cn('RemoteFlows__InformationStatement__Title')}>\n {title}\n </h3>\n <p className={cn('RemoteFlows__InformationStatement__Description')}>\n {description}\n </p>\n </div>\n ),\n },\n };\n}\n\nexport function createStatementProperty({\n title,\n description,\n severity,\n}: {\n title?: React.ReactNode;\n description?: React.ReactNode;\n severity?: 'warning' | 'error' | 'success' | 'info';\n}) {\n return {\n statement: {\n title,\n description,\n severity,\n },\n };\n}\n"],"mappings":"wHAAA,OACE,cAAAA,EACA,WAAAC,EACA,YAAAC,EACA,YAAAC,EACA,cAAAC,EACA,WAAAC,EACA,YAAAC,EACA,qBAAAC,EACA,YAAAC,EACA,oBAAAC,MACK,WCXA,IAAMC,EAAiB,CAC5B,QAAS,UACT,aAAc,aACd,UAAW,WACb,ECyBQ,OAME,OAAAC,EANF,QAAAC,MAAA,oBAXD,SAASC,EACdC,EACAC,EACAC,EAGgB,CAChB,MAAO,CACL,qBAAsB,CACpB,UAAW,SACX,UAAWC,EAAA,IACTL,EAAC,OACC,UAAWM,EACT,oCACAF,GAAS,SACX,EAEA,UAAAL,EAAC,MAAG,UAAWO,EAAG,0CAA0C,EACzD,SAAAJ,EACH,EACAH,EAAC,KAAE,UAAWO,EAAG,gDAAgD,EAC9D,SAAAH,EACH,GACF,EAbS,YAeb,CACF,CACF,CA3BgBE,EAAAJ,EAAA,0BA6BT,SAASM,EAAwB,CACtC,MAAAL,EACA,YAAAC,EACA,SAAAK,CACF,EAIG,CACD,MAAO,CACL,UAAW,CACT,MAAAN,EACA,YAAAC,EACA,SAAAK,CACF,CACF,CACF,CAhBgBH,EAAAE,EAAA,2BFtBT,IAAME,EAAgE,CAC3E,uBAAwB,CAAE,MAAO,EAAG,KAAM,wBAAyB,EACnE,oBAAqB,CAAE,MAAO,EAAG,KAAM,qBAAsB,EAC7D,cAAe,CAAE,MAAO,EAAG,KAAM,eAAgB,EACjD,uBAAwB,CAAE,MAAO,EAAG,KAAM,wBAAyB,CACrE,EAEaC,EAA8BC,EACzCC,GACG,CACH,IAAMC,EAAQ,IAAI,KACZC,EAAeC,EAAQF,EAAO,EAAE,EAGhCG,EAAkBC,EAAWJ,CAAK,EAClCK,EAAyBD,EAAWH,CAAY,EAEhDK,EAAeP,GAAkB,gBAEjCQ,EAA0BR,GAAkB,QAC9C,OACCS,GACCA,EAAM,mBACNC,EAASD,EAAM,iBAAiB,EAAE,SAAS,IAAMR,EAAM,SAAS,CACpE,GAEE,IAAKQ,GAAUC,EAASD,EAAM,iBAAkB,CAAC,EAErD,GAAI,CAACD,GAAyB,OAAQ,OAAOP,EAE7C,OAAQM,EAAc,CAMpB,KAAKI,EAAe,QAClB,OAAOC,EAAQR,EAAiBI,EAAwB,CAAC,CAAC,EACtDK,EAAWZ,CAAK,EAChBA,EAQN,KAAKU,EAAe,aAClB,OAAIC,EAAQR,EAAiBI,EAAwB,CAAC,CAAC,EAC9CK,EAAWZ,CAAK,EAEvBW,EAAQR,EAAiBI,EAAwB,CAAC,CAAC,GACnDM,EAASV,EAAiBE,CAAsB,EAEzCJ,EACFD,EAET,QACE,OAAOA,CACX,CACF,EArD2C,+BAuD9Bc,EAA4ChB,EAAA,CAAC,CACxD,mBAAAiB,EACA,4BAAAC,EACA,aAAAC,CACF,IAIM,CACJ,IAAMC,EAAsBC,EAASJ,CAAkB,EACjDK,EACJH,GAAgBI,EAAkBC,EAASL,CAAY,EAAG,IAAI,IAAM,EAAI,GAI1E,OAFEA,GAAgBM,EAAiBN,EAAc,IAAI,IAAM,GAAK,IAEvC,CAACA,GAAgB,CAACC,EAClC,KAGLA,GAAuB,CAACF,EACnBQ,EAAwB,CAC7B,YAAa,4CAA4CC,EAA0BV,CAAkB,CAAC,0EACtG,SAAU,MACZ,CAAC,EAGCG,GAAuBF,EAClBQ,EAAwB,CAC7B,YAAa,yQACb,SAAU,MACZ,CAAC,EAGCJ,EACKI,EAAwB,CAC7B,YAAa,yMACb,SAAU,MACZ,CAAC,EAGIA,EAAwB,CAC7B,YAAa,sPACb,SAAU,MACZ,CAAC,CACH,EA5CyD,6CA8ClD,SAASE,EACdC,EACAC,EACuB,CAyBvB,MAxB6C,CAC3C,aAAc,GACd,2BAA4B,GAC5B,gCAAiC,GACjC,uCAAwC,GACxC,eAAgB,GAChB,mBAAoB,OACpB,mBAAoB,GACpB,yBAA0B,CAAC,EAC3B,2BAA4B,GAC5B,uCAAwC,KACxC,qBAAsB,GACtB,2BAA4B,KAC5B,kCAAmC,GACnC,oBAAqB,GACrB,0BAA2B,GAC3B,wBAAyB,CAAC,EAC1B,eAAgB,OAChB,GAAGD,EACH,GAAIC,EACA,CAAE,mBAAoB,gCAAiC,EACvD,CAAC,CACP,CAGF,CA7BgB9B,EAAA4B,EAAA","names":["endOfMonth","isAfter","isBefore","parseISO","startOfDay","setDate","isFuture","differenceInHours","endOfDay","differenceInDays","PAYROLL_CYCLES","jsx","jsxs","createInformationField","title","description","options","__name","cn","createStatementProperty","severity","STEPS","calculateMinTerminationDate","__name","payrollCalendars","today","midMonthDate","setDate","normalizedToday","startOfDay","normalizedMidMonthDate","payFrequency","currentMonthCutoffDates","cycle","parseISO","PAYROLL_CYCLES","isAfter","endOfMonth","isBefore","calculateProposedTerminationDateStatement","minTerminationDate","isEmployeeInProbationPeriod","selectedDate","hasPassedCutoffDate","isFuture","isShortNotice","differenceInHours","endOfDay","differenceInDays","createStatementProperty","formatMonthDayInLocalTime","buildInitialValues","stepsInitialValues","hasFutureStartDate"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import*as e from"@radix-ui/react-collapsible";var r=e.Root,o=e.CollapsibleTrigger,t=e.CollapsibleContent;export{r as a,o as b,t as c};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-QWJFYQK3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as d,d as S}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as d,d as S}from"./chunk-7YQAVDVX.js";import{a as u}from"./chunk-HN5HLFTB.js";import{a as f}from"./chunk-KSHK3ZPX.js";import{b as C}from"./chunk-5P7INAU2.js";import{f as y}from"./chunk-CNDSIADP.js";import{a as o}from"./chunk-P37U34EQ.js";import{useEffect as T,useId as U,useState as I}from"react";import{jsx as k}from"react/jsx-runtime";var i=o((n,e,r)=>r&&r[e]?r[e]:n[e]?n[e]/100:0,"getDefaultManagementFee"),A=o((n,e,r,s)=>!e&&!r?.management_fee&&n?i(u,n,s):e&&!r?.management_fee?"":r?.management_fee,"getManagementFee"),W=o(({estimationOptions:n=d,defaultValues:e={countryRegionSlug:"",regionSlug:"",currencySlug:"",salary:"",benefits:{},management:{management_fee:""}},options:r,render:s,version:_="standard"})=>{let p=U(),[R,m]=I("USD"),F=o(g=>{m(g);let a=i(u,g,n.managementFees);a&&c.setValue("management.management_fee",a)},"onCurrencyChange"),t=S({defaultRegion:e.countryRegionSlug,defaultCurrency:e.currencySlug,defaultSalary:e.salary,estimationOptions:n,version:_,options:{...r,onCurrencyChange:F}}),K=C(t.handleValidation),b=A(R,e.currencySlug,e.management,n.managementFees),{countryRegionSlug:v,currencySlug:h,salary:D,benefits:P,hiringBudget:B,age:E,contractDurationType:M,regionSlug:w,...x}=e,c=y({resolver:K,defaultValues:{country:v,currency:h,region:w,salary:D,salary_conversion:"",salary_converted:"",hiring_budget:B||"employee_annual_salary",age:E,contract_duration_type:M,management:{management_fee:b},benefits:P,estimation_title:n.title,...x},shouldUnregister:!1,mode:"onBlur"});return T(()=>{if(e.currencySlug&&t.currencies&&n.includeManagementFee&&!e.management?.management_fee){let a=t.currencies.find(l=>l.value===e.currencySlug)?.label;if(a){m(a);let l=i(u,a,n.managementFees);c.setValue("management.management_fee",l)}}},[e.currencySlug,t.currencies,n.includeManagementFee,n.managementFees,e.management?.management_fee,c]),k(f.Provider,{value:{form:c,formId:p,costCalculatorBag:t},children:s(t)})},"CostCalculatorFlow");export{W as a};
|
|
2
|
+
//# sourceMappingURL=chunk-SHP4ULHS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flows/CostCalculator/CostCalculatorFlow.tsx"],"sourcesContent":["import React, { useEffect, useId, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { useJsonSchemasValidationFormResolver } from '@/src/components/form/validationResolver';\nimport { CostCalculatorContext } from '@/src/flows/CostCalculator/context';\nimport {\n CostCalculatorVersion,\n defaultEstimationOptions,\n useCostCalculator,\n} from '@/src/flows/CostCalculator/hooks';\nimport {\n CostCalculatorEstimationOptions,\n CurrencyKey,\n UseCostCalculatorOptions,\n} from '@/src/flows/CostCalculator/types';\nimport { BASE_RATES } from '@/src/flows/CostCalculator/constants';\n\nexport type CostCalculatorFlowProps = {\n /**\n * Estimation params allows you to customize the parameters sent to the /cost-calculator/estimation endpoint.\n */\n estimationOptions?: CostCalculatorEstimationOptions;\n /**\n * Default values for the form fields.\n */\n defaultValues?: Partial<\n {\n /**\n * Default value for the country field.\n */\n countryRegionSlug: string;\n /**\n * Default value for the currency field.\n */\n currencySlug: string;\n /**\n * Default value for the salary field.\n */\n salary: string;\n /**\n * Default value for the benefits field.\n */\n benefits: Record<string, string>;\n /**\n * Default value for the hiring budget field\n */\n hiringBudget: string;\n /**\n * Default value for the age field.\n */\n age: number;\n /**\n * Default value for the contract duration type field.\n */\n contractDurationType: 'fixed' | 'indefinite';\n /**\n * Default value for the management fee field.\n */\n management: {\n management_fee: string;\n };\n /**\n * Default value for the region field.\n */\n regionSlug: string;\n } & Record<string, unknown>\n >;\n options?: UseCostCalculatorOptions;\n render: (\n costCalculatorBag: ReturnType<typeof useCostCalculator>,\n ) => React.ReactNode;\n /**\n * Whether to include annual_gross_salary in the estimation payload\n */\n version?: CostCalculatorVersion;\n};\n\nconst getDefaultManagementFee = (\n baseRates: Record<CurrencyKey, number>,\n currency: CurrencyKey,\n managementFees?: Partial<Record<CurrencyKey, number>>,\n) => {\n if (managementFees && managementFees[currency]) {\n return managementFees[currency];\n }\n if (baseRates[currency]) {\n return baseRates[currency] / 100;\n }\n return 0;\n};\n\nconst getManagementFee = (\n currency: CurrencyKey,\n currencySlug?: string,\n management?: { management_fee: string },\n managementFees?: Partial<Record<CurrencyKey, number>>,\n) => {\n if (!currencySlug && !management?.management_fee && currency) {\n return getDefaultManagementFee(BASE_RATES, currency, managementFees);\n }\n if (currencySlug && !management?.management_fee) {\n return '';\n }\n\n return management?.management_fee;\n};\n\nexport const CostCalculatorFlow = ({\n estimationOptions = defaultEstimationOptions,\n defaultValues = {\n countryRegionSlug: '',\n regionSlug: '',\n currencySlug: '',\n salary: '',\n benefits: {},\n management: {\n management_fee: '',\n },\n },\n options,\n render,\n version = 'standard',\n}: CostCalculatorFlowProps) => {\n const formId = useId();\n const [currency, setCurrency] = useState<CurrencyKey>('USD');\n const onCurrencyChange = (currency: string) => {\n setCurrency(currency as CurrencyKey);\n const managementFee = getDefaultManagementFee(\n BASE_RATES,\n currency as CurrencyKey,\n estimationOptions.managementFees,\n );\n if (managementFee) {\n form.setValue('management.management_fee', managementFee);\n }\n };\n const costCalculatorBag = useCostCalculator({\n defaultRegion: defaultValues.countryRegionSlug,\n defaultCurrency: defaultValues.currencySlug,\n defaultSalary: defaultValues.salary,\n estimationOptions,\n version,\n options: {\n ...options,\n onCurrencyChange: onCurrencyChange,\n },\n });\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n costCalculatorBag.handleValidation,\n );\n\n const defaultManagementFee = getManagementFee(\n currency,\n defaultValues.currencySlug,\n defaultValues.management,\n estimationOptions.managementFees,\n );\n\n const {\n countryRegionSlug,\n currencySlug,\n salary,\n benefits,\n hiringBudget,\n age,\n contractDurationType,\n regionSlug,\n ...formDefaultValues\n } = defaultValues;\n\n const form = useForm({\n resolver,\n defaultValues: {\n country: countryRegionSlug,\n currency: currencySlug,\n region: regionSlug,\n salary: salary,\n salary_conversion: '',\n salary_converted: '',\n hiring_budget: hiringBudget || 'employee_annual_salary',\n age: age,\n contract_duration_type: contractDurationType,\n management: {\n management_fee: defaultManagementFee,\n },\n benefits: benefits,\n estimation_title: estimationOptions.title,\n ...formDefaultValues,\n },\n shouldUnregister: false,\n mode: 'onBlur',\n });\n\n useEffect(() => {\n if (\n defaultValues.currencySlug &&\n costCalculatorBag.currencies &&\n estimationOptions.includeManagementFee &&\n !defaultValues.management?.management_fee\n ) {\n const currencyData = costCalculatorBag.currencies.find(\n (currency) => currency.value === defaultValues.currencySlug,\n );\n const currencyCode = currencyData?.label;\n if (currencyCode) {\n setCurrency(currencyCode as CurrencyKey);\n const defaultManagementFee = getDefaultManagementFee(\n BASE_RATES,\n currencyCode as CurrencyKey,\n estimationOptions.managementFees,\n );\n form.setValue('management.management_fee', defaultManagementFee);\n }\n }\n }, [\n defaultValues.currencySlug,\n costCalculatorBag.currencies,\n estimationOptions.includeManagementFee,\n estimationOptions.managementFees,\n defaultValues.management?.management_fee,\n form,\n ]);\n\n return (\n <CostCalculatorContext.Provider\n value={{\n form,\n formId: formId,\n costCalculatorBag,\n }}\n >\n {render(costCalculatorBag)}\n </CostCalculatorContext.Provider>\n );\n};\n"],"mappings":"uPAAA,OAAgB,aAAAA,EAAW,SAAAC,EAAO,YAAAC,MAAgB,QAgO9C,cAAAC,MAAA,oBApJJ,IAAMC,EAA0BC,EAAA,CAC9BC,EACAC,EACAC,IAEIA,GAAkBA,EAAeD,CAAQ,EACpCC,EAAeD,CAAQ,EAE5BD,EAAUC,CAAQ,EACbD,EAAUC,CAAQ,EAAI,IAExB,EAXuB,2BAc1BE,EAAmBJ,EAAA,CACvBE,EACAG,EACAC,EACAH,IAEI,CAACE,GAAgB,CAACC,GAAY,gBAAkBJ,EAC3CH,EAAwBQ,EAAYL,EAAUC,CAAc,EAEjEE,GAAgB,CAACC,GAAY,eACxB,GAGFA,GAAY,eAbI,oBAgBZE,EAAqBR,EAAA,CAAC,CACjC,kBAAAS,EAAoBC,EACpB,cAAAC,EAAgB,CACd,kBAAmB,GACnB,WAAY,GACZ,aAAc,GACd,OAAQ,GACR,SAAU,CAAC,EACX,WAAY,CACV,eAAgB,EAClB,CACF,EACA,QAAAC,EACA,OAAAC,EACA,QAAAC,EAAU,UACZ,IAA+B,CAC7B,IAAMC,EAASC,EAAM,EACf,CAACd,EAAUe,CAAW,EAAIC,EAAsB,KAAK,EACrDC,EAAmBnB,EAACE,GAAqB,CAC7Ce,EAAYf,CAAuB,EACnC,IAAMkB,EAAgBrB,EACpBQ,EACAL,EACAO,EAAkB,cACpB,EACIW,GACFC,EAAK,SAAS,4BAA6BD,CAAa,CAE5D,EAVyB,oBAWnBE,EAAoBC,EAAkB,CAC1C,cAAeZ,EAAc,kBAC7B,gBAAiBA,EAAc,aAC/B,cAAeA,EAAc,OAC7B,kBAAAF,EACA,QAAAK,EACA,QAAS,CACP,GAAGF,EACH,iBAAkBO,CACpB,CACF,CAAC,EACKK,EAAWC,EAEfH,EAAkB,gBACpB,EAEMI,EAAuBtB,EAC3BF,EACAS,EAAc,aACdA,EAAc,WACdF,EAAkB,cACpB,EAEM,CACJ,kBAAAkB,EACA,aAAAtB,EACA,OAAAuB,EACA,SAAAC,EACA,aAAAC,EACA,IAAAC,EACA,qBAAAC,EACA,WAAAC,EACA,GAAGC,CACL,EAAIvB,EAEEU,EAAOc,EAAQ,CACnB,SAAAX,EACA,cAAe,CACb,QAASG,EACT,SAAUtB,EACV,OAAQ4B,EACR,OAAQL,EACR,kBAAmB,GACnB,iBAAkB,GAClB,cAAeE,GAAgB,yBAC/B,IAAKC,EACL,uBAAwBC,EACxB,WAAY,CACV,eAAgBN,CAClB,EACA,SAAUG,EACV,iBAAkBpB,EAAkB,MACpC,GAAGyB,CACL,EACA,iBAAkB,GAClB,KAAM,QACR,CAAC,EAED,OAAAE,EAAU,IAAM,CACd,GACEzB,EAAc,cACdW,EAAkB,YAClBb,EAAkB,sBAClB,CAACE,EAAc,YAAY,eAC3B,CAIA,IAAM0B,EAHef,EAAkB,WAAW,KAC/CpB,GAAaA,EAAS,QAAUS,EAAc,YACjD,GACmC,MACnC,GAAI0B,EAAc,CAChBpB,EAAYoB,CAA2B,EACvC,IAAMX,EAAuB3B,EAC3BQ,EACA8B,EACA5B,EAAkB,cACpB,EACAY,EAAK,SAAS,4BAA6BK,CAAoB,CACjE,CACF,CACF,EAAG,CACDf,EAAc,aACdW,EAAkB,WAClBb,EAAkB,qBAClBA,EAAkB,eAClBE,EAAc,YAAY,eAC1BU,CACF,CAAC,EAGCvB,EAACwC,EAAsB,SAAtB,CACC,MAAO,CACL,KAAAjB,EACA,OAAQN,EACR,kBAAAO,CACF,EAEC,SAAAT,EAAOS,CAAiB,EAC3B,CAEJ,EAhIkC","names":["useEffect","useId","useState","jsx","getDefaultManagementFee","__name","baseRates","currency","managementFees","getManagementFee","currencySlug","management","BASE_RATES","CostCalculatorFlow","estimationOptions","defaultEstimationOptions","defaultValues","options","render","version","formId","useId","setCurrency","useState","onCurrencyChange","managementFee","form","costCalculatorBag","useCostCalculator","resolver","useJsonSchemasValidationFormResolver","defaultManagementFee","countryRegionSlug","salary","benefits","hiringBudget","age","contractDurationType","regionSlug","formDefaultValues","useForm","useEffect","currencyCode","CostCalculatorContext"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as p}from"./chunk-TOA3JILU.js";import{d as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as p}from"./chunk-TOA3JILU.js";import{d as u}from"./chunk-5KZXFQLZ.js";import{a as l}from"./chunk-2YTBWEC7.js";import{b as c}from"./chunk-WVDTHFGS.js";import{b as d}from"./chunk-3ZWDIEEM.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as y}from"react/jsx-runtime";function k({onSubmit:f,onSuccess:E,onError:i,render:s,...o}){let{components:v}=d(),{contractorOnboardingBag:r}=p(),n=u(),{mutateAsync:b}=l(n),m=e(async()=>{try{if(await f?.(),r.employmentId){let t=await b({employment_id:r.employmentId});if(t.data){await E?.({data:t.data,employmentStatus:"invited"}),r.refetchEmployment();return}t.error&&i?.({error:t.error,rawError:t.rawError,fieldErrors:[]})}}catch(t){i?.({error:t,rawError:t,fieldErrors:[]})}},"handleSubmit"),a=v?.button;return a?y(a,{...o,disabled:n.isPending||o.disabled,onClick:t=>{m(),o.onClick?.(t)},children:s({employmentStatus:"invited"})}):y(c,{...o,disabled:n.isPending||o.disabled,onClick:()=>{m()},children:s({employmentStatus:"invited"})})}e(k,"OnboardingInvite");export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-SO3YQ4WT.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l}from"./chunk-ZSCKSEAA.js";import{a as m}from"./chunk-ZE3YT3Q6.js";import{b as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l}from"./chunk-ZSCKSEAA.js";import{a as m}from"./chunk-ZE3YT3Q6.js";import{b as o}from"./chunk-MZB24YJP.js";import{b as i}from"./chunk-WVDTHFGS.js";import{b as r}from"./chunk-43WMZDDH.js";import{a as n}from"./chunk-P37U34EQ.js";import{Info as p}from"lucide-react";import{Fragment as f,jsx as t,jsxs as e}from"react/jsx-runtime";function B({extraStatutoryPaymentsTotal:d,extraStatutoryPaymentsBreakdown:u,currency:s}){return e("div",{children:[e("div",{className:"flex justify-between items-center mb-2",children:[t("h3",{className:"font-medium text-primary-foreground-800",children:"Extra Statutory Payments"}),t("span",{className:"font-semibold text-lg",children:r(d,s)})]}),t(l,{className:"mb-3"}),t("div",{className:"space-y-3 pl-2",children:u.map((a,c)=>e("div",{className:"flex justify-between items-start text-sm",children:[e("div",{className:"flex items-start gap-2",children:[t("span",{children:a.name}),a.description&&t(m,{content:e(f,{children:[t("span",{children:a.description})," ",a.zendesk_article_url&&t(o,{zendeskId:Number(a.zendesk_article_id),children:"Learn more"})]}),children:e(i,{variant:"ghost",size:"icon",className:"h-4 w-4 p-0",children:[t(p,{className:"h-3 w-3 text-gray-400"}),t("span",{className:"sr-only",children:"Info"})]})})]}),t("span",{children:r(a.amount,s)})]},c))})]})}n(B,"CostCalculatorExtraStatutoryPaymentsBreakdown");export{B as a};
|
|
2
|
+
//# sourceMappingURL=chunk-SPQO42TA.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-2W2XD7ZY.js";import{b as i}from"./chunk-TOA3JILU.js";import{b as n}from"./chunk-2YTBWEC7.js";import{a as t}from"./chunk-P37U34EQ.js";import{jsx as u}from"react/jsx-runtime";function F({onSubmit:d,onSuccess:l,onError:a}){let{contractorOnboardingBag:o}=i(),c=t(async e=>{try{await d?.(o.parseFormValues(e));let r=await o.onSubmit(e);if(r?.data){await l?.(r?.data),o?.next();return}if(r?.error){let p=n(r?.fieldErrors||[],o.meta?.fields?.contract_details);a?.({error:r?.error,rawError:r?.rawError,fieldErrors:p})}}catch(r){a?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit"),m=o.stepState.values?.contract_details||o.initialValues.contract_details;return u(s,{defaultValues:m,onSubmit:c})}t(F,"ContractDetailsStep");export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-SRRY72CZ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as H}from"./chunk-BV3PGYSH.js";import{a as he,b as Ve,c as Ue,d as Ge,e as Je,f as qe,g as je,h as Ke,i as Ye,j as Ze,k as ve,l as Qe,m as Ce,n as xe,p as be,r as et,s as tt,t as ot}from"./chunk-GOGPCCBS.js";import{b as Xe}from"./chunk-HPHWQU34.js";import{b as _e}from"./chunk-MZB24YJP.js";import{a as ye,b as O}from"./chunk-WVDTHFGS.js";import{b as S}from"./chunk-3ZWDIEEM.js";import{a as re,b as ne,c as b,d as Be,e as He,f as Oe,g as ze,h as k,i as w,j as N,k as P,l as R,m as D}from"./chunk-CNDSIADP.js";import{g as Ae}from"./chunk-WXUIXZ7P.js";import{a as v,e as oe}from"./chunk-43WMZDDH.js";import{a as n}from"./chunk-P37U34EQ.js";import{Fragment as xo,useEffect as bo,useRef as Wt}from"react";import{Fragment as Ht,jsx as A,jsxs as ae}from"react/jsx-runtime";function se({name:e,defaultValue:t,description:o,label:r,onChange:s,multiple:d,options:c,component:F,...g}){let{components:p}=S(),{control:a}=b(),u=n((i,m,f)=>{let l=f.value?[...f.value]:[];m?l.includes(i)||f.onChange([...l,i]):f.onChange(l.filter(_=>_!==i))},"handleCheckboxChange");return A(k,{control:a,name:e,defaultValue:t,render:({field:i,fieldState:m})=>{let f=F||p?.checkbox;if(f){let l={name:e,description:o,label:r,defaultValue:t,multiple:d,options:c,...g};return A(f,{field:{...i,onChange:n(_=>{if(d){let{checked:C,value:x}=_.target;u(x,C,i),s?.(C);return}i.onChange(_),s?.(_)},"onChange")},fieldState:m,fieldData:l})}return ae(w,{"data-field":e,className:v(`RemoteFlows__CheckBoxField__Item__${e}`),children:[A(P,{children:ae(Ht,{children:[c&&d?A(N,{children:r}):null,c&&d?c.map(l=>ae("div",{className:"flex space-x-2",children:[A(he,{id:l.value,onCheckedChange:_=>{u(l.value,_===!0,i),s?.(_,l.value)},checked:i.value?.includes(l.value),className:"RemoteFlows__CheckBox__Input"}),A(N,{htmlFor:l.value,className:"mb-0 RemoteFlows__CheckBox__Label",children:l.label})]},l.value)):ae("div",{className:"flex space-x-2",children:[A(he,{id:e,onCheckedChange:l=>{i.onChange(l),s?.(l)},checked:i.value,className:"RemoteFlows__CheckBox__Input"}),A(N,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label",children:r})]})]})}),o&&A(R,{children:o}),m.error&&A(D,{})]})}})}n(se,"CheckBoxField");import{CalendarIcon as Vt}from"lucide-react";import{PopoverClose as Ut}from"@radix-ui/react-popover";import{ChevronLeft as Ot,ChevronRight as At}from"lucide-react";import{DayPicker as zt}from"react-day-picker";import{jsx as Se}from"react/jsx-runtime";function rt({className:e,classNames:t,showOutsideDays:o=!0,...r}){return Se(zt,{showOutsideDays:o,className:v("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:v(ye({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:v("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",r.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:v(ye({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:n(({className:s,...d})=>Se(Ot,{className:v("size-4",s),...d}),"IconLeft"),IconRight:n(({className:s,...d})=>Se(At,{className:v("size-4",s),...d}),"IconRight")},...r})}n(rt,"Calendar");import*as z from"@radix-ui/react-popover";import{jsx as ie}from"react/jsx-runtime";function le({...e}){return ie(z.Root,{"data-slot":"popover",...e})}n(le,"Popover");function me({...e}){return ie(z.Trigger,{"data-slot":"popover-trigger",...e})}n(me,"PopoverTrigger");function de({className:e,align:t="center",sideOffset:o=4,...r}){return ie(z.Portal,{children:ie(z.Content,{"data-slot":"popover-content",align:t,sideOffset:o,className:v("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...r})})}n(de,"PopoverContent");import{format as nt}from"date-fns";import{Fragment as Gt,jsx as I,jsxs as ke}from"react/jsx-runtime";function at({description:e,label:t,name:o,minDate:r,maxDate:s,onChange:d,component:c,...F}){let{components:g}=S(),{control:p}=b(),a;F.meta?.mot&&typeof F.meta.mot=="number"?a=Ae(F.meta.mot):r&&(a=new Date(`${r}T00:00:00`));let u;return s&&(u=new Date(`${s}T23:59:59`)),I(k,{control:p,name:o,render:({field:i,fieldState:m})=>{let f=c||g?.date;if(f){let l={description:e,label:t,name:o,onChange:d,...a&&{minDate:a.toISOString()},...u&&{maxDate:u.toISOString()},...F};return I(f,{field:{...i,onChange:n(_=>{i.onChange(_),d?.(_)},"onChange")},fieldState:m,fieldData:l})}return ke(w,{"data-field":o,className:`flex flex-col RemoteFlows__DatePickerField__Item__${o}`,children:[I(N,{className:"RemoteFlows__DatePickerField__Label",children:t}),ke(le,{children:[I(me,{asChild:!0,children:I(P,{children:I("div",{children:ke(O,{type:"button",variant:"outline",className:v("w-full pl-3 text-left font-normal",!i.value&&"text-muted-foreground"),"data-testid":`date-picker-button-${o}`,children:[i.value&&I(Gt,{children:nt(i.value,"yyyy-MM-dd")}),I(Vt,{className:"ml-auto h-4 w-4 opacity-50"})]})})})}),I(de,{className:"w-auto p-0 RemoteFlows__DatepickerField__PopoverContent",align:"start",children:I(rt,{mode:"single",className:"RemoteFlows__DatepickerField__Calendar",selected:i.value?new Date(i.value):void 0,onSelect:l=>{i.onChange(l?nt(l,"yyyy-MM-dd"):null),d?.(l)},defaultMonth:a,components:{DayContent:n(l=>I(Ut,{children:l.date.getDate()}),"DayContent")},disabled:l=>!!(a&&l<a||u&&l>u)})})]}),e?I(R,{children:e}):null,m.error&&I(D,{className:"RemoteFlows__DatePickerField__Error"})]})}})}n(at,"DatePickerField");import{jsx as V,jsxs as Kt}from"react/jsx-runtime";var Jt=n(e=>new Promise((t,o)=>{let r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=s=>o(s)}),"toBase64"),qt=n(async e=>await Promise.all(e.map(async o=>{let r=await Jt(o);return{...o,name:o.name,size:o.size,type:o.type,content:r.split(",")[1]}})),"convertFilesToBase64"),jt=n((e,t)=>{if(!t)return null;for(let o of e)if(o.size>t){let r=Math.round(t/1048576),s=Math.round(o.size/(1024*1024));return`File "${o.name}" exceeds maximum size of ${r}MB (file is ${s}MB)`}return null},"validateFileSize");function st({name:e,description:t,label:o,multiple:r,onChange:s,component:d,accept:c,maxSize:F,...g}){let{components:p}=S(),{control:a,setError:u,clearErrors:i}=b(),m=n(async(f,l)=>{let _=jt(f,F);if(_){u(e,{message:_});return}i(e);let C=await qt(f);l.onChange(C),s?.(C)},"handleOnChange");return V(k,{control:a,name:e,render:({field:f,fieldState:l})=>{let _=d||p?.file;if(_){let C={name:e,description:t,label:o,multiple:r,accept:c,maxFileSize:F,...g};return V(_,{field:{...f,value:f.value,onChange:n(async x=>m(x,f),"onChange")},fieldState:l,fieldData:C})}return Kt(w,{"data-field":e,className:`RemoteFlows__FileUpload__Item__${e}`,children:[V(N,{className:"RemoteFlows__FileUpload__Label",children:o}),V(P,{children:V(Ve,{onChange:C=>m(C,f),multiple:r,className:v("RemoteFlows__FileUpload__Input"),accept:c,files:f.value})}),t&&V("div",{className:"flex items-center justify-between",children:V(R,{className:"RemoteFlows__FileUpload__Description",children:t})}),l.error&&V(D,{className:"RemoteFlows__FileUpload__Error"})]})}})}n(st,"FileUploadField");import{jsx as Ne}from"react/jsx-runtime";function ce(e){let{components:t}=S(),{control:o}=b(),r=e.component||t?.number;return r?Ne(k,{control:o,name:e.name,render:({field:s,fieldState:d})=>Ne(r,{field:{...s,onChange:n(c=>{s.onChange(c),e.onChange?.(c)},"onChange")},fieldState:d,fieldData:e})}):Ne(H,{...e,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$"})}n(ce,"NumberField");import{Fragment as Yt}from"react";import{jsx as W,jsxs as we}from"react/jsx-runtime";function it({name:e,defaultValue:t,description:o,label:r,options:s,onChange:d,component:c,...F}){let{components:g}=S(),{control:p}=b();return W(k,{control:p,name:e,defaultValue:t,render:({field:a,fieldState:u})=>{let i=c||g?.radio;if(i){let m={name:e,defaultValue:t,description:o,label:r,options:s,...F};return W(i,{field:{...a,onChange:n(f=>{a.onChange(f),d?.(f)},"onChange")},fieldState:u,fieldData:m})}return we(w,{className:v("space-y-3",`RemoteFlows__RadioGroupField__Item__${e}`),"data-field":e,children:[W(N,{children:r}),W(P,{children:W(Ue,{"aria-label":r||e,onValueChange:m=>{a.onChange(m),d?.(m)},value:a.value,className:"flex flex-col space-y-3",children:s?.map(m=>W(Yt,{children:we(w,{"data-field":e,className:"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item",children:[W(P,{children:W(Ge,{value:m.value,className:"RemoteFlows__RadioField__Input",disabled:m.disabled})}),we("div",{children:[W(N,{className:"font-normal mb-0 RemoteFlows__RadioField__Label",children:m.label}),m.description&&W(R,{className:"mt-2",children:m.description})]})]})},m.value))})}),o&&W(R,{children:o}),u.error&&W(D,{})]})}})}n(it,"RadioGroupField");import{jsx as M,jsxs as lt}from"react/jsx-runtime";function mt({label:e,name:t,options:o,defaultValue:r,description:s,onChange:d,component:c,...F}){let{control:g}=b(),{components:p}=S();return M(k,{defaultValue:r,control:g,name:t,render:({field:a,fieldState:u})=>{let i=c||p?.select;if(i){let m={label:e,name:t,options:o,defaultValue:r,description:s,onChange:d,...F};return M(i,{field:{...a,onChange:n(f=>{let l=F.jsonType==="number"?Number(f):f;a.onChange(l),d?.(l)},"onChange")},fieldState:u,fieldData:m})}return lt(w,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[M(N,{className:"RemoteFlows__SelectField__Label",children:e}),M(P,{children:M("div",{className:"relative",children:lt(Je,{value:a.value||"",onValueChange:m=>{let f=F.jsonType==="number"?Number(m):m;a.onChange(f),d?.(f)},children:[M(Ke,{className:"RemoteFlows__SelectField__Trigger","aria-invalid":!!u.error,"aria-label":e,children:M("span",{className:"absolute",children:M(je,{placeholder:e})})}),M(Ye,{className:"RemoteFlows__SelectField__Content",children:M(qe,{className:"RemoteFlows__SelectField__Group",children:o.map(m=>M(Ze,{value:m.value,className:"RemoteFlows__SelectField__SelectItem",disabled:m.disabled,children:m.label},m.value))})})]})})}),s&&M(R,{children:s}),u.error&&M(D,{})]})}})}n(mt,"SelectField");import{useState as oo}from"react";import{Fragment as Zt,useState as Xt}from"react";import{Check as Qt,ChevronDownIcon as eo,X as to}from"lucide-react";import{Command as K}from"cmdk";import{SearchIcon as Ur}from"lucide-react";import{jsx as Y,jsxs as jr}from"react/jsx-runtime";function dt({className:e,...t}){return Y(K,{"data-slot":"command",className:v("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}n(dt,"Command");function ct({className:e,...t}){return Y(K.List,{"data-slot":"command-list",className:v("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}n(ct,"CommandList");function ut({...e}){return Y(K.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}n(ut,"CommandEmpty");function pt({className:e,...t}){return Y(K.Group,{"data-slot":"command-group",className:v("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}n(pt,"CommandGroup");function Ft({className:e,...t}){return Y(K.Separator,{"data-slot":"command-separator",className:v("bg-border -mx-1 h-px",e),...t})}n(Ft,"CommandSeparator");function ft({className:e,...t}){return Y(K.Item,{"data-slot":"command-item",className:v("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}n(ft,"CommandItem");import{jsx as E,jsxs as Z}from"react/jsx-runtime";function ue({options:e,selected:t,onChange:o,placeholder:r,...s}){let[d,c]=Xt(!1),F=n(a=>{o(t.filter(u=>u.value!==a.value))},"handleUnselect"),g=e.some(a=>a.category),p=e.reduce((a,u)=>{let i=u.category||"Uncategorized";return a[i]||(a[i]=[]),a[i].push(u),a},{});return Z(le,{open:d,onOpenChange:c,...s,children:[E(me,{children:Z(O,{variant:"outline",role:"combobox","aria-expanded":d,className:"w-full justify-between font-normal",type:"button",children:[E("div",{className:"flex gap-1 flex-wrap overflow-x-auto max-h-[2.5rem] items-center",children:t.length>0?t.map(a=>Z(Xe,{variant:"secondary",className:"mr-1 mb-1",children:[a.label,E("div",{role:"button",tabIndex:0,"aria-label":`remove ${a.label}`,className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",onKeyDown:u=>{u.key==="Enter"&&F(a)},onMouseDown:u=>{u.preventDefault(),u.stopPropagation()},onClick:()=>F(a),children:E(to,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},a.label)):E("span",{className:"text-foreground",children:r})}),E(eo,{className:"size-4"})]})}),E(de,{align:"start",className:"w-full p-0",children:E(dt,{children:Z(ct,{children:[E(ut,{children:"No item found."}),Object.entries(p).map(([a,u],i)=>Z(Zt,{children:[i>0&&E(Ft,{}),E(pt,{heading:g?a:void 0,children:u.map(m=>{let f=t.some(l=>l.value===m.value);return Z(ft,{onSelect:()=>{o(f?t.filter(l=>l.value!==m.value):[...t,m])},children:[E(Qt,{className:v("mr-2 h-4 w-4",f?"opacity-100":"opacity-0")}),m.label]},m.label)})})]},a))]})})})]})}n(ue,"MultiSelect");import{jsx as U,jsxs as ro}from"react/jsx-runtime";function gt({label:e,name:t,options:o,defaultValue:r,description:s,onChange:d,$meta:c,component:F,...g}){let{control:p}=b(),{components:a}=S(),[u,i]=oo([]);return U(k,{defaultValue:r,control:p,name:t,render:({field:m,fieldState:f})=>{let l=F||a?.countries;if(l){let x={label:e,name:t,options:o,defaultValue:r,description:s,onChange:d,$meta:c,...g};return U(l,{field:{...m,onChange:n(T=>{m.onChange(T),d?.(T)},"onChange")},fieldState:f,fieldData:x})}let _=[...Object.entries(c?.regions||{}).map(([x,T])=>({value:T,label:x,category:"Regions"})),...Object.entries(c?.subregions||{}).map(([x,T])=>({value:T,label:x,category:"Subregions"})),...o.map(x=>({...x,value:x.value,label:x.label,category:"Countries"}))],C=n(x=>{let T=x.map(({value:j})=>j);m.onChange(T),d?.(T),i(x)},"handleChange");return ro(w,{"data-field":t,className:`RemoteFlows__CountryField__Item__${t}`,children:[U(N,{className:"RemoteFlows__CountryField__Label",children:e}),U(P,{children:U(ue,{options:_,selected:u,onChange:C,...g})}),s&&U(R,{children:s}),f.error&&U(D,{})]})}})}n(gt,"CountryField");import*as _t from"react";import{jsx as no}from"react/jsx-runtime";var Pe=_t.forwardRef(({className:e,...t},o)=>no("textarea",{className:v("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:o,...t}));Pe.displayName="Textarea";import{jsx as G,jsxs as Re}from"react/jsx-runtime";function ht({name:e,description:t,label:o,onChange:r,maxLength:s,component:d,...c}){let{components:F}=S(),{control:g}=b();return G(k,{control:g,name:e,render:({field:p,fieldState:a})=>{let u=d||F?.textarea;if(u){let m={name:e,description:t,label:o,maxLength:s,...c};return G(u,{field:{...p,onChange:n(f=>{p.onChange(f),r?.(f)},"onChange")},fieldState:a,fieldData:m})}let i=p.value?.length??0;return Re(w,{"data-field":e,className:`RemoteFlows__TextArea__Item__${e}`,children:[G(N,{className:"RemoteFlows__TextArea__Label",children:o}),G(P,{children:G(Pe,{...p,value:p.value??"",onChange:m=>{p.onChange(m),r?.(m)},className:v(a.error&&"border-red-500 focus-visible:ring-red-500","RemoteFlows__TextArea__Input"),placeholder:o})}),(t||s)&&Re("div",{className:"flex items-center justify-between",children:[t&&G(R,{className:"RemoteFlows__TextArea__Description",children:t}),s&&Re("span",{className:"text-sm ml-auto RemoteFlows__TextArea__MaxLength",children:[i,"/",s]})]}),a.error&&G(D,{className:"RemoteFlows__TextArea__Error"})]})}})}n(ht,"TextAreaField");import{jsx as De}from"react/jsx-runtime";function yt(e){let{components:t}=S(),{control:o}=b(),r=e.component||t?.email;return r?De(k,{control:o,name:e.name,render:({field:s,fieldState:d})=>De(r,{field:{...s,onChange:n(c=>{s.onChange(c),e.onChange?.(c)},"onChange")},fieldState:d,fieldData:e})}):De(H,{...e,type:"email"})}n(yt,"EmailField");import{jsx as vt}from"react/jsx-runtime";function Ct(e){let{control:t}=b();return vt(k,{control:t,name:e.name,render:({field:o})=>vt("input",{...o,type:"hidden"})})}n(Ct,"HiddenField");import uo,{useEffect as po,useState as Dt}from"react";var xt=n((e,t,o)=>{if(e&&"reportValidity"in e){let r=re(o,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},"r"),Te=n((e,t)=>{for(let o in t.fields){let r=t.fields[o];r&&r.ref&&"reportValidity"in r.ref?xt(r.ref,o,e):r&&r.refs&&r.refs.forEach(s=>xt(s,o,e))}},"o"),St=n((e,t)=>{t.shouldUseNativeValidation&&Te(e,t);let o={};for(let r in e){let s=re(t.fields,r),d=Object.assign(e[r]||{},{ref:s&&s.ref});if(ao(t.names||Object.keys(e),r)){let c=Object.assign({},re(o,r));ne(c,"root",d),ne(o,r,c)}else ne(o,r,d)}return o},"s"),ao=n((e,t)=>{let o=bt(t);return e.some(r=>bt(r).match(`^${o}\\.\\d+`))},"i");function bt(e){return e.replace(/\]|\[/g,"")}n(bt,"n");function kt(e,t,o){return t===void 0&&(t={}),o===void 0&&(o={}),function(r,s,d){try{return Promise.resolve(function(c,F){try{var g=(t.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e[o.mode==="sync"?"validateSync":"validate"](r,Object.assign({abortEarly:!1},t,{context:s}))).then(function(p){return d.shouldUseNativeValidation&&Te({},d),{values:o.raw?Object.assign({},r):p,errors:{}}}))}catch(p){return F(p)}return g&&g.then?g.then(void 0,F):g}(0,function(c){if(!c.inner)throw c;return{values:{},errors:St((F=c,g=!d.shouldUseNativeValidation&&d.criteriaMode==="all",(F.inner||[]).reduce(function(p,a){if(p[a.path]||(p[a.path]={message:a.message,type:a.type}),g){var u=p[a.path].types,i=u&&u[a.type];p[a.path]=Be(a.path,g,p,a.type,i?[].concat(i,a.message):a.message)}return p},{})),d)};var F,g}))}catch(c){return Promise.reject(c)}}}n(kt,"o");import*as $ from"yup";import Nt from"lodash.groupby";import X from"lodash.capitalize";var wt=60,pe=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function so(e){if(e<60)return`${e}m`;let t=Math.floor(e/wt),o=e%wt;return o>0?`${t}h${o}m`:`${t}h`}n(so,"convertBreakDurationToHours");function Pt(e){let t=e.reduce((o,r)=>r.hours+o,0);return Number(t.toFixed(2))}n(Pt,"calculateTotalWorkHours");function io(e,t){let o=t.map(({day:d})=>d.toLowerCase()),r=o.indexOf(e),s=null;for(;r<o.length&&!s;){let d=o[r],c=o[r+1],F=pe.indexOf(d)+1;pe[F]===c||(s=d),r+=1}return s}n(io,"findLastConsecutiveDay");function lo(e){return e.start_time&&e.end_time&&(typeof e.hours=="number"?e.hours:Number.parseInt(e.hours))>0}n(lo,"shouldSummarizeSchedule");function mo(e){return Number.parseInt(e.break_duration_minutes)>0}n(mo,"shouldSummarizeBreaks");function Rt(e){let t=e.filter(lo),o=Nt(t,F=>`${F.start_time}|${F.end_time}`),r=e.filter(mo),s=Nt(r,"break_duration_minutes"),d=Object.keys(o).map(F=>{let g=o[F],p=g[0].day,[a,u]=F.split("|"),i=`from <span>${a.replace(":","h")}</span> to <span>${u.replace(":","h")}</span>`,m=io(p,g),l=(m?g.findIndex(_=>_.day===m):-1)===g.length-1;return g.length===1?`${X(p)}, ${i}`:!l||!m?g.reduce((_,C,x)=>{let T=X(C.day);return x===g.length-1?`${_}and ${T}, ${i}`:`${_}<span>${T}</span>, `},""):`<span>${X(p)}</span> to <span>${X(m)}</span>, ${i}`}),c=Object.keys(s).reverse().map((F,g)=>{let p=g===0,a=s[F],u=so(parseInt(F,10));if(Object.keys(s).length===1)return`With ${u} daily breaks`;if(a.length===1){let i=`${u} break on ${X(a[0].day)}.`;return p?`With ${i}`:i}return a.reduce((i,m,f)=>{let l=X(m.day);return f===0?`${i} ${l}`:f===a.length-1?`${i}, and ${l}.`:`${i}, ${l}`},p?`With ${u} break on`:`${u} break on`)});return{workHoursSummary:d,breakSummary:c}}n(Rt,"buildWorkScheduleSummary");function $e(e){let{checked:t,start_time:o,end_time:r,break_duration_minutes:s}=e;if(!t)return 0;let[d,c]=o.split(":").map(Number),[F,g]=r.split(":").map(Number),p=d*60+c,i=(F*60+g-p-Number.parseInt(s||"0"))/60;return i===Math.floor(i)?i:Number(i.toFixed(2))}n($e,"calculateHours");var co={monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat",sunday:"Sun"};function Fe(e){return co[e]}n(Fe,"getShortWeekday");import{jsx as y,jsxs as L}from"react/jsx-runtime";var Fo=$.object({day:$.string().required(),checked:$.boolean().required(),start_time:$.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:n(e=>e.required("Required"),"then"),otherwise:n(e=>e.optional().nullable(),"otherwise")}),end_time:$.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:n(e=>e.required("Required"),"then"),otherwise:n(e=>e.optional().nullable(),"otherwise")}),hours:$.number().default(0),break_duration_minutes:$.string().default("0")}),fo=$.object({schedule:$.array(Fo)});function go({defaultSchedule:e,onSubmit:t}){let[o,r]=Dt(!1),s=pe.map(l=>{let _=e.find(C=>C.day.toLowerCase()===Fe(l).toLowerCase()||C.day.toLowerCase()===l.toLowerCase());return _?{..._,day:Fe(l),checked:!0}:{...e[0],checked:!1,day:Fe(l)}}),d=Oe({defaultValues:{schedule:s},resolver:kt(fo)}),{handleSubmit:c,watch:F,reset:g,control:p,formState:a}=d,{fields:u}=He({name:"schedule",control:p}),i=F("schedule");function m(l){let _=l.schedule.filter(({checked:C})=>C).map(C=>({...C,hours:$e(C)}));t(_),r(!1)}n(m,"handleSubmitWorkingHours");function f(){g(),r(!1)}return n(f,"handleCancel"),y("div",{className:"flex items-center justify-between",children:L(ve,{open:o,onOpenChange:r,children:[y(Qe,{asChild:!0,children:y(O,{variant:"link",className:"flex items-center p-0 RemoteFlows__WorkScheduleSelectionForm__Trigger",children:"Edit Schedule"})}),L(Ce,{className:"max-w-5xl max-h-[90vh] overflow-y-auto px-8 py-4 RemoteFlows__WorkScheduleSelectionForm__Content",children:[y(xe,{children:y(be,{className:"RemoteFlows__WorkScheduleSelectionForm__Title",children:"Edit employee working hours"})}),y(ze,{...d,children:L("form",{className:"space-y-4 RemoteFlows__WorkScheduleSelectionForm__Form",children:[L("div",{className:"rounded-lg",children:[y("p",{className:"text-gray-600 text-sm mb-4 RemoteFlows__WorkScheduleSelectionForm__Description",children:"The times displayed are in the employee's time zone in the 24-hour format."}),L("div",{className:"grid grid-cols-12 gap-4 text-sm font-medium text-gray-500 uppercase tracking-wide RemoteFlows__WorkScheduleSelectionForm__Header",children:[y("div",{className:"col-span-2"}),y("div",{className:"col-span-3 text-center",children:"START"}),y("div",{className:"col-span-1 text-center"}),y("div",{className:"col-span-3 text-center",children:"END"}),y("div",{className:"col-span-2 text-center",children:"HOURS"})]}),y("div",{className:"RemoteFlows__WorkScheduleSelectionForm__Rows",children:u.map((l,_)=>{let C=i[_],x=$e(C);return L(uo.Fragment,{children:[L("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Hours",children:[y("div",{className:"col-span-2 flex items-center gap-3",children:y(se,{label:l.day,name:`schedule.${_}.checked`})}),y("div",{className:"col-span-3",children:y(H,{name:`schedule.${_}.start_time`,includeErrorMessage:!1})}),y("div",{className:"col-span-1 text-center text-gray-500",children:"to"}),y("div",{className:"col-span-3",children:y(H,{name:`schedule.${_}.end_time`,includeErrorMessage:!1})}),y("div",{className:"col-span-2 text-center text-gray-600",children:isNaN(x)?"-":`${x} hours`})]}),L("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Break",children:[y("div",{className:"col-span-2 text-gray-500",children:"Break"}),y("div",{className:"col-span-2",children:y(H,{name:`schedule.${_}.break_duration_minutes`,includeErrorMessage:!1})}),y("div",{className:"col-span-2 text-gray-500",children:"minutes"}),y("div",{className:"col-span-4"})]})]},l.id)})})]}),Object.keys(a.errors).length>0&&y("p",{className:"text-destructive text-sm mb-0",children:"Invalid time format (HH:mm)"}),L("div",{className:"flex gap-4 pt-4",children:[y(O,{type:"button",className:"reset-button",variant:"outline",onClick:f,children:"Cancel"}),y(O,{type:"button",className:"submit-button",onClick:c(m),children:"Save Schedule"})]})]})})]})]})})}n(go,"WorkScheduleSelectionForm");function Tt(e){let{components:t}=S(),{setValue:o,control:r,watch:s}=b(),d=s(e.name),[c,F]=Dt(d),{workHoursSummary:g,breakSummary:p}=Rt(c),a=Pt(c);po(()=>{o(e.name,c)},[c,e.name,o]);function u(m){F(m)}n(u,"onSubmit");let i=e.component||t?.["work-schedule"];return i?y(k,{control:r,name:e.name,render:({field:m,fieldState:f})=>y(i,{field:{...m,onChange:n(l=>{m.onChange(l),e.onChange?.(l)},"onChange")},fieldState:f,fieldData:{...e,defaultFormattedValue:{workHoursSummary:g,breakSummary:p,totalWorkHours:a}}})}):L("div",{className:"flex flex-col gap-3 RemoteFlows__WorkScheduleField",children:[y("p",{className:"text-sm RemoteFlows__WorkScheduleField__Title",children:"Work hours"}),L("div",{className:"flex flex-col gap-1 RemoteFlows__WorkScheduleField__Summary",children:[y("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__WorkHours",dangerouslySetInnerHTML:{__html:g.join(", ")}}),y("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Break",children:p.join()}),L("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Total",children:["Total of ",y("span",{children:a})," hours per week"]}),y(go,{defaultSchedule:c,onSubmit:u})]})]})}n(Tt,"WorkScheduleField");import{useState as _o}from"react";import{jsx as J,jsxs as ho}from"react/jsx-runtime";function $t({label:e,name:t,options:o,defaultValue:r,description:s,onChange:d,component:c,...F}){let{control:g}=b(),{components:p}=S(),[a,u]=_o();return J(k,{defaultValue:r,control:g,name:t,render:({field:i,fieldState:m})=>{let f=c||p?.["multi-select"];if(f){let _={label:e,name:t,options:o,defaultValue:r,description:s,onChange:d,...F};return J(f,{field:{...i,onChange:n(C=>{i.onChange(C),d?.(C)},"onChange")},fieldState:m,fieldData:_})}let l=a||o.filter(_=>i.value.includes(_.value));return ho(w,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[J(N,{className:"RemoteFlows__SelectField__Label",children:e}),J(P,{children:J(ue,{options:o,selected:l,onChange:_=>{let C=_.map(({value:x})=>x);i.onChange(C),d?.(C),u(_)},...F})}),s&&J(R,{children:s}),m.error&&J(D,{})]})}})}n($t,"MultiSelectField");import{jsx as yo}from"react/jsx-runtime";var It=n(e=>yo(ce,{maxLength:15,...e}),"MoneyField");var Ie={checkbox:se,text:H,email:yt,money:It,select:mt,"multi-select":$t,radio:it,number:ce,file:st,date:at,textarea:ht,countries:gt,hidden:Ct,"work-schedule":Tt};import{AlertCircle as vo}from"lucide-react";import{jsx as fe,jsxs as Co}from"react/jsx-runtime";function Mt({title:e,description:t,severity:o}){let{components:r}=S();if(r?.statement){let s=r?.statement;return fe(s,{data:{title:e,description:oe(t),severity:o}})}return Co(et,{variant:"warning",children:[fe(vo,{className:"h-4 w-4"}),e&&fe(tt,{children:e}),t&&fe(ot,{dangerouslySetInnerHTML:{__html:oe(t)}})]})}n(Mt,"Statement");import{Fragment as ko,jsx as B,jsxs as q}from"react/jsx-runtime";var So=n(({isExpanded:e,onToggle:t,className:o,...r})=>B(O,{type:"button",className:v("RemoteFlows__Button RemoteFlows__FieldSetField__ToggleButton",o),variant:"default",onClick:t,...r,children:e?"Remove":"Define"}),"DefaultToggleButton");function Et({label:e,name:t,fields:o,description:r,components:s,statement:d,isFlatFieldset:c,extra:F,variant:g="outset",features:p,meta:a}){let{helpCenter:u}=a||{},{watch:i,setValue:m,trigger:f,formState:l}=b(),{components:_}=S(),C=p?.toggle?.stateField,x=C?i(C):p?.toggle?.defaultExpanded??!0,T=o.map(({name:h})=>`${t}.${h}`),j=i(T),Me=Wt(j),Q=Wt(null),Lt=n(()=>{C&&m(C,!x)},"toggleExpanded");bo(()=>{let h=j,ee=Me.current,ge=l.isSubmitted||l.submitCount>0,Le=!1;for(let te=0;te<h.length;te++)if(h[te]!==void 0&&ee[te]!==h[te]){Le=!0;break}return Le&&ge&&(Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{f()},50)),Me.current=[...h],()=>{Q.current&&clearTimeout(Q.current)}},[j,f,l.isSubmitted,l.submitCount]);let Bt=_?.fieldsetToggle||So,We=`${t}-content`,Ee=`${t}-header`;return q("fieldset",{className:v("border-1 border-input p-4 rounded-xl","RemoteFlows__FieldSetField",`RemoteFlows__FieldSetField__${t}`),children:[B("legend",{className:v("text-sm font-semibold px-2",g==="inset"&&"hidden"),children:e}),u?.callToAction&&u?.id&&g==="outset"&&B(_e,{className:"RemoteFlows__FieldSetField__HelpCenterLink mb-3",zendeskId:u.id,children:u.callToAction}),g==="inset"&&q(ko,{children:[q("div",{className:"RemoteFlows__FieldSetField__Header",id:Ee,"data-state":x?"expanded":"collapsed","aria-expanded":x,children:[B("h3",{className:v("RemoteFlows__FieldSetField__Title"),children:e}),p?.toggle?.enabled&&B(Bt,{isExpanded:x,onToggle:Lt,"aria-expanded":x,"aria-controls":We,"aria-label":`${x?"Hide":"Show"} ${e}`,className:v("RemoteFlows__FieldSetField__Toggle",p.toggle?.className),children:x?p.toggle.labels?.collapse??"Remove":p.toggle.labels?.expand??"Define"})]}),u?.callToAction&&u?.id&&B(_e,{className:"RemoteFlows__FieldSetField__HelpCenterLink mb-3",zendeskId:u.id,children:u.callToAction})]}),x&&q("div",{id:We,"aria-labelledby":Ee,role:"region",children:[r?B("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:oe(r)}}):null,q("div",{className:"grid gap-4",children:[o.map(h=>{if(h.calculateDynamicProperties&&(h={...h,...h.calculateDynamicProperties(j,h)||{}}),h.isVisible===!1||h.deprecated)return null;if(h.inputType==="fieldset")return B(Et,{...h,name:`${c?h.name:`${t}.${h.name}`}`,components:s},`${c?h.name:`${t}.${h.name}`}`);if(h.inputType==="fieldset-flat")return B(Et,{...h,name:`${c?h.name:`${t}.${h.name}`}`,components:s,isFlatFieldset:!0},`${c?h.name:`${t}.${h.name}`}`);let ee=Ie[h.inputType];if(h.Component){let{Component:ge}=h;return B(ge,{...h},h.name)}return ee?(h.inputType==="select"&&h.multiple&&(ee=Ie["multi-select"]),q(xo,{children:[B(ee,{...h,name:`${c?h.name:`${t}.${h.name}`}`,component:s?.[h.inputType]}),h.extra?h.extra:null]},`${c?h.name:`${t}.${h.name}`}`)):q("p",{className:"error",children:["Field type ",h.inputType," not supported"]})}),F||null,d?B(Mt,{...d}):null]})]})]})}n(Et,"FieldSetField");export{Ie as a,Mt as b,Et as c};
|
|
2
|
+
//# sourceMappingURL=chunk-THMWKOHC.js.map
|