@remoteoss/remote-flows 0.26.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ZendeskTriggerButton-FSCvhzTG.d.ts → ZendeskTriggerButton-DIV8pCPo.d.ts} +2 -1
- package/dist/{chunk-KH5SAWNH.js → chunk-2FKEF3OG.js} +2 -2
- package/dist/{chunk-AU6AILO2.js → chunk-53KVZ4BP.js} +2 -2
- package/dist/{chunk-46JFDBPC.js → chunk-5MYWJJBQ.js} +2 -2
- package/dist/{chunk-22JG4IMF.js → chunk-5NPET4ZO.js} +2 -2
- package/dist/{chunk-I3PGODII.js → chunk-6KIQIVKA.js} +2 -2
- package/dist/{chunk-T5LZSTW3.js → chunk-6LJRRFK2.js} +2 -2
- package/dist/chunk-7AC3W7WD.js +2 -0
- package/dist/chunk-7AC3W7WD.js.map +1 -0
- package/dist/chunk-7VOQAVM4.js +2 -0
- package/dist/chunk-7VOQAVM4.js.map +1 -0
- package/dist/chunk-ANQ4HVVK.js +2 -0
- package/dist/chunk-ANQ4HVVK.js.map +1 -0
- package/dist/{chunk-P4ZSYIA4.js → chunk-AODV6HT2.js} +2 -2
- package/dist/{chunk-S2KE2JLJ.js → chunk-AUZWLETL.js} +2 -2
- package/dist/{chunk-BGXVK7HL.js → chunk-AWDGLK2T.js} +2 -2
- package/dist/{chunk-VUP76ZMQ.js → chunk-BOTWQMOJ.js} +2 -2
- package/dist/{chunk-PHBQMNG3.js → chunk-CVIWZYO3.js} +2 -2
- package/dist/chunk-DB7ITLRX.js +2 -0
- package/dist/chunk-DB7ITLRX.js.map +1 -0
- package/dist/{chunk-2M7EBC4K.js → chunk-DZ7FZ4L2.js} +2 -2
- package/dist/{chunk-W5BJQRNM.js → chunk-E6OBNWMU.js} +2 -2
- package/dist/chunk-EHAZWZ3O.js +2 -0
- package/dist/chunk-EHAZWZ3O.js.map +1 -0
- package/dist/{chunk-4JVXDB5G.js → chunk-FFMKAMWP.js} +2 -2
- package/dist/{chunk-I52UTPHD.js → chunk-GWLOE7WJ.js} +2 -2
- package/dist/{chunk-LHSNAVGR.js → chunk-HMNHKZGD.js} +2 -2
- package/dist/{chunk-M6G27EJN.js → chunk-IQKZWU7I.js} +2 -2
- package/dist/chunk-IWA5B4U6.js +2 -0
- package/dist/chunk-IWA5B4U6.js.map +1 -0
- package/dist/{chunk-RNJWBKLA.js → chunk-JO4722R7.js} +2 -2
- package/dist/chunk-LMYJ6V44.js +2 -0
- package/dist/chunk-LMYJ6V44.js.map +1 -0
- package/dist/{chunk-74DRB7Z5.js → chunk-MGVP76ZI.js} +2 -2
- package/dist/{chunk-VVF4IZES.js → chunk-MRPXDND2.js} +2 -2
- package/dist/chunk-NP4G3N5P.js +2 -0
- package/dist/{chunk-4IXRU67S.js → chunk-OU4Y73FX.js} +2 -2
- package/dist/{chunk-BLZW25OE.js → chunk-PYKEYPGA.js} +2 -2
- package/dist/{chunk-7KNNJBO6.js → chunk-QDYWPG2R.js} +2 -2
- package/dist/{chunk-OCNL6L4L.js → chunk-QPTO4XXU.js} +2 -2
- package/dist/{chunk-EJ4COVQQ.js → chunk-QTYDDIVO.js} +2 -2
- package/dist/chunk-R3DJNVHR.js +2 -0
- package/dist/chunk-R3DJNVHR.js.map +1 -0
- package/dist/chunk-R645TMO5.js +2 -0
- package/dist/{chunk-2TADRH4W.js.map → chunk-R645TMO5.js.map} +1 -1
- package/dist/{chunk-JHPCP2ZX.js → chunk-RAHCZTQ3.js} +2 -2
- package/dist/{chunk-CT2ROVBF.js → chunk-TM7Q7RHH.js} +2 -2
- package/dist/chunk-UFBTCHEI.js +2 -0
- package/dist/{chunk-IUZ7DEXC.js.map → chunk-UFBTCHEI.js.map} +1 -1
- package/dist/{chunk-RDGF4PBB.js → chunk-UQOWSJ2B.js} +2 -2
- package/dist/chunk-VDRNNOVA.js +2 -0
- package/dist/chunk-VDRNNOVA.js.map +1 -0
- package/dist/chunk-VM2DQCZO.js +2 -0
- package/dist/chunk-VM2DQCZO.js.map +1 -0
- package/dist/chunk-W55MUSAS.js +2 -0
- package/dist/{chunk-NVYMAOQ7.js.map → chunk-W55MUSAS.js.map} +1 -1
- package/dist/{chunk-NWEXPORY.js → chunk-WCIJHQMP.js} +2 -2
- package/dist/chunk-WLBRCGTG.js +2 -0
- package/dist/{chunk-QKLIYOMA.js.map → chunk-WLBRCGTG.js.map} +1 -1
- package/dist/chunk-XPKVRYIU.js +2 -0
- package/dist/chunk-XPKVRYIU.js.map +1 -0
- package/dist/{chunk-3VYNEJMC.js → chunk-Z42H2QEW.js} +2 -2
- package/dist/{chunk-HCZWP44I.js → chunk-ZWZJ4XOY.js} +2 -2
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
- package/dist/flows/ContractAmendment/index.js +1 -1
- package/dist/flows/ContractorOnboarding/ContractorOnboarding.js +1 -1
- package/dist/flows/ContractorOnboarding/components/BasicInformationStep.js +1 -1
- package/dist/flows/ContractorOnboarding/components/ContractDetailsStep.js +1 -1
- package/dist/flows/ContractorOnboarding/components/ContractPreviewStep.js +1 -1
- package/dist/flows/ContractorOnboarding/components/ContractorOnboardingForm.js +1 -1
- package/dist/flows/ContractorOnboarding/components/PricingPlan.js +1 -1
- package/dist/flows/ContractorOnboarding/components/SelectCountryStep.js +1 -1
- package/dist/flows/ContractorOnboarding/index.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -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.js +1 -1
- package/dist/flows/CostCalculator/components/SalaryField.js +1 -1
- package/dist/flows/CostCalculator/hooks.js +1 -1
- package/dist/flows/CostCalculator/index.js +1 -1
- package/dist/flows/CostCalculator/utils.js +1 -1
- package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
- package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
- package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
- package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
- package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
- package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
- package/dist/flows/Onboarding/index.js +1 -1
- package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
- package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
- package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
- package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
- package/dist/flows/Termination/TerminationFlow.js +1 -1
- package/dist/flows/Termination/TerminationForm.js +1 -1
- package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInfomationContainer.d.ts +10 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInfomationContainer.js +2 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInfomationContainer.js.map +1 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInformation.d.ts +11 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInformation.js +2 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInformation.js.map +1 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInformationFees.d.ts +18 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInformationFees.js +2 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/AcknowledgeInformationFees.js.map +1 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/constants.d.ts +12 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/constants.js +2 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/constants.js.map +1 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/types.d.ts +11 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/types.js +1 -0
- package/dist/flows/Termination/components/AcknowledgeInformation/types.js.map +1 -0
- package/dist/flows/Termination/components/TerminationDialogInfoContent/TerminationDialogInfoContent.js +1 -1
- package/dist/flows/Termination/hooks.js +1 -1
- package/dist/flows/Termination/index.d.ts +4 -0
- package/dist/flows/Termination/index.js +1 -1
- package/dist/flows/Termination/json-schemas/additionalInformation.d.ts +17 -0
- package/dist/flows/Termination/json-schemas/additionalInformation.js +1 -1
- package/dist/flows/Termination/json-schemas/jsonSchema.d.ts +19 -0
- package/dist/flows/Termination/json-schemas/jsonSchema.js +1 -1
- package/dist/flows/Termination/json-schemas/paidTimeOff.d.ts +1 -0
- package/dist/flows/Termination/json-schemas/paidTimeOff.js +1 -1
- package/dist/flows/Termination/json-schemas/schema.js +1 -1
- package/dist/flows/Termination/json-schemas/terminationDetails.d.ts +1 -0
- package/dist/flows/Termination/json-schemas/terminationDetails.js +1 -1
- package/dist/flows/api.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +52 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2TADRH4W.js +0 -2
- package/dist/chunk-32GSS4UM.js +0 -2
- package/dist/chunk-32GSS4UM.js.map +0 -1
- package/dist/chunk-4T6PRR6R.js +0 -2
- package/dist/chunk-4T6PRR6R.js.map +0 -1
- package/dist/chunk-GC23RRCI.js +0 -2
- package/dist/chunk-GC23RRCI.js.map +0 -1
- package/dist/chunk-HHWIJGDR.js +0 -2
- package/dist/chunk-HHWIJGDR.js.map +0 -1
- package/dist/chunk-IUZ7DEXC.js +0 -2
- package/dist/chunk-MP2T74PU.js +0 -2
- package/dist/chunk-MP2T74PU.js.map +0 -1
- package/dist/chunk-NVYMAOQ7.js +0 -2
- package/dist/chunk-Q3A4A2HL.js +0 -2
- package/dist/chunk-QEWB24WT.js +0 -2
- package/dist/chunk-QEWB24WT.js.map +0 -1
- package/dist/chunk-QKLIYOMA.js +0 -2
- package/dist/chunk-XSHHMBMT.js +0 -2
- package/dist/chunk-XSHHMBMT.js.map +0 -1
- /package/dist/{chunk-KH5SAWNH.js.map → chunk-2FKEF3OG.js.map} +0 -0
- /package/dist/{chunk-AU6AILO2.js.map → chunk-53KVZ4BP.js.map} +0 -0
- /package/dist/{chunk-46JFDBPC.js.map → chunk-5MYWJJBQ.js.map} +0 -0
- /package/dist/{chunk-22JG4IMF.js.map → chunk-5NPET4ZO.js.map} +0 -0
- /package/dist/{chunk-I3PGODII.js.map → chunk-6KIQIVKA.js.map} +0 -0
- /package/dist/{chunk-T5LZSTW3.js.map → chunk-6LJRRFK2.js.map} +0 -0
- /package/dist/{chunk-P4ZSYIA4.js.map → chunk-AODV6HT2.js.map} +0 -0
- /package/dist/{chunk-S2KE2JLJ.js.map → chunk-AUZWLETL.js.map} +0 -0
- /package/dist/{chunk-BGXVK7HL.js.map → chunk-AWDGLK2T.js.map} +0 -0
- /package/dist/{chunk-VUP76ZMQ.js.map → chunk-BOTWQMOJ.js.map} +0 -0
- /package/dist/{chunk-PHBQMNG3.js.map → chunk-CVIWZYO3.js.map} +0 -0
- /package/dist/{chunk-2M7EBC4K.js.map → chunk-DZ7FZ4L2.js.map} +0 -0
- /package/dist/{chunk-W5BJQRNM.js.map → chunk-E6OBNWMU.js.map} +0 -0
- /package/dist/{chunk-4JVXDB5G.js.map → chunk-FFMKAMWP.js.map} +0 -0
- /package/dist/{chunk-I52UTPHD.js.map → chunk-GWLOE7WJ.js.map} +0 -0
- /package/dist/{chunk-LHSNAVGR.js.map → chunk-HMNHKZGD.js.map} +0 -0
- /package/dist/{chunk-M6G27EJN.js.map → chunk-IQKZWU7I.js.map} +0 -0
- /package/dist/{chunk-RNJWBKLA.js.map → chunk-JO4722R7.js.map} +0 -0
- /package/dist/{chunk-74DRB7Z5.js.map → chunk-MGVP76ZI.js.map} +0 -0
- /package/dist/{chunk-VVF4IZES.js.map → chunk-MRPXDND2.js.map} +0 -0
- /package/dist/{chunk-Q3A4A2HL.js.map → chunk-NP4G3N5P.js.map} +0 -0
- /package/dist/{chunk-4IXRU67S.js.map → chunk-OU4Y73FX.js.map} +0 -0
- /package/dist/{chunk-BLZW25OE.js.map → chunk-PYKEYPGA.js.map} +0 -0
- /package/dist/{chunk-7KNNJBO6.js.map → chunk-QDYWPG2R.js.map} +0 -0
- /package/dist/{chunk-OCNL6L4L.js.map → chunk-QPTO4XXU.js.map} +0 -0
- /package/dist/{chunk-EJ4COVQQ.js.map → chunk-QTYDDIVO.js.map} +0 -0
- /package/dist/{chunk-JHPCP2ZX.js.map → chunk-RAHCZTQ3.js.map} +0 -0
- /package/dist/{chunk-CT2ROVBF.js.map → chunk-TM7Q7RHH.js.map} +0 -0
- /package/dist/{chunk-RDGF4PBB.js.map → chunk-UQOWSJ2B.js.map} +0 -0
- /package/dist/{chunk-NWEXPORY.js.map → chunk-WCIJHQMP.js.map} +0 -0
- /package/dist/{chunk-3VYNEJMC.js.map → chunk-Z42H2QEW.js.map} +0 -0
- /package/dist/{chunk-HCZWP44I.js.map → chunk-ZWZJ4XOY.js.map} +0 -0
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/RemoteFlowsProvider.tsx","../src/lib/applyTheme.ts","../src/theme.tsx","../src/environments.ts","../src/useAuth.ts"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport { ThemeProvider } from '@/src/theme';\nimport { FormFieldsContext, RemoteFlowContext } from './context';\nimport { Components, RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { useAuth } from './useAuth';\n\nconst queryClient = new QueryClient();\n\ntype RemoteFlowContextWrapperProps = {\n auth: RemoteFlowsSDKProps['auth'];\n children: React.ReactNode;\n environment?: RemoteFlowsSDKProps['environment'];\n proxy?: RemoteFlowsSDKProps['proxy'];\n authId?: RemoteFlowsSDKProps['authId'];\n};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n authId,\n proxy,\n environment,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\n authId,\n options: {\n proxy,\n environment,\n },\n });\n return (\n <RemoteFlowContext.Provider value={{ client: remoteApiClient.current }}>\n {children}\n </RemoteFlowContext.Provider>\n );\n}\n\nexport function FormFieldsProvider({\n children,\n components,\n}: PropsWithChildren<{\n components?: Components;\n}>) {\n return (\n <FormFieldsContext.Provider\n value={components ? { components } : { components: {} }}\n >\n {children}\n </FormFieldsContext.Provider>\n );\n}\n\nexport function RemoteFlows({\n auth,\n authId,\n children,\n components,\n theme,\n proxy,\n environment,\n}: PropsWithChildren<RemoteFlowsSDKProps>) {\n return (\n <QueryClientProvider client={queryClient}>\n <FormFieldsProvider components={components}>\n <RemoteFlowContextWrapper\n auth={auth}\n authId={authId}\n proxy={proxy}\n environment={environment}\n >\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </RemoteFlowContextWrapper>\n </FormFieldsProvider>\n </QueryClientProvider>\n );\n}\n","import {\n CssThemeBorder,\n CssThemeColors,\n CssThemeFont,\n CssThemeSpacing,\n ThemeColors,\n ThemeFont,\n ThemeProviderProps,\n} from '@/src/types/theme';\n\nfunction setCssProperties(variables: Record<string, string>) {\n const root = document.documentElement;\n Object.keys(variables).forEach((v) => {\n const propertyVal = variables[v];\n if (propertyVal) {\n root.style.setProperty(v, propertyVal);\n }\n });\n}\n\nfunction mapThemeColors(colors: ThemeColors): CssThemeColors {\n const result: CssThemeColors = {};\n Object.keys(colors).forEach((key) => {\n result[`--${key}` as keyof CssThemeColors] =\n colors[key as keyof ThemeColors];\n });\n return result;\n}\n\nfunction mapThemeSpacing(spacing: string): CssThemeSpacing {\n return {\n '--spacing': spacing,\n };\n}\n\nfunction mapThemeBorderRadius(borderRadius: string): CssThemeBorder {\n return {\n '--radius': borderRadius,\n };\n}\n\nfunction mapThemeFont(font: ThemeFont): CssThemeFont {\n return {\n '--fontSizeBase': font.fontSizeBase,\n };\n}\n\nexport function applyTheme(theme: ThemeProviderProps['theme']) {\n if (theme?.colors) {\n setCssProperties(mapThemeColors(theme.colors));\n }\n\n if (theme?.spacing) {\n setCssProperties(mapThemeSpacing(theme.spacing));\n }\n\n if (theme?.borderRadius) {\n setCssProperties(mapThemeBorderRadius(theme.borderRadius));\n }\n\n if (theme?.font) {\n setCssProperties(mapThemeFont(theme.font));\n }\n}\n","import { applyTheme } from '@/src/lib/applyTheme';\nimport { createContext, useEffect, useMemo } from 'react';\nimport { ThemeProviderProps } from './types/theme';\n\nconst ThemeContext = createContext<Omit<ThemeProviderProps, 'children'>>({\n theme: {},\n});\n\nexport function ThemeProvider(props: ThemeProviderProps) {\n useEffect(() => {\n if (props.theme && Object.keys(props.theme).length > 0) {\n applyTheme(props.theme);\n }\n }, [props.theme]);\n\n const value = useMemo(() => {\n return { theme: props.theme };\n }, [props.theme]);\n\n return (\n <ThemeContext.Provider value={value}>\n {props.children}\n </ThemeContext.Provider>\n );\n}\n","export const ENVIRONMENTS = {\n local: 'http://localhost:4000/api/eor',\n partners: 'https://gateway.partners.remote-sandbox.com',\n production: 'https://gateway.remote.com',\n sandbox: 'https://gateway.remote-sandbox.com',\n staging: 'https://gateway.niceremote.com',\n};\n","import { client } from '@/src/client/client.gen';\nimport { ENVIRONMENTS } from '@/src/environments';\nimport { createClient } from '@hey-api/client-fetch';\nimport { useQuery } from '@tanstack/react-query';\nimport { useRef } from 'react';\nimport { RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { debug } from './lib/utils';\n\ntype AuthResponse = {\n accessToken: string;\n expiresIn: number;\n};\n\ntype Options = Partial<{\n environment: keyof typeof ENVIRONMENTS;\n proxy: RemoteFlowsSDKProps['proxy'];\n}>;\n\nfunction isValidUrl(url: string) {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const useAuth = ({\n auth,\n options,\n authId = 'default',\n}: {\n auth: () => Promise<AuthResponse>;\n options?: Options;\n authId?: 'default' | 'client';\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth', authId],\n queryFn: auth,\n enabled: false,\n });\n\n const baseUrl = options?.environment\n ? ENVIRONMENTS[options?.environment]\n : process.env.REMOTE_GATEWAY_URL;\n\n const clientConfig = client.getConfig();\n const npmPackageVersion = process.env.VERSION || 'unknown';\n\n if (options?.environment && options?.environment !== 'production') {\n debug(npmPackageVersion);\n }\n\n const isValidProxy = !!options?.proxy && isValidUrl(options.proxy.url);\n\n if (options?.proxy && !isValidProxy) {\n console.error('Invalid proxy URL provided. Using default base URL.');\n }\n\n return useRef(\n createClient({\n ...clientConfig,\n headers: {\n ...clientConfig.headers,\n ...(isValidProxy ? options?.proxy?.headers : {}),\n 'X-Client-Name': 'remote-flows-sdk',\n 'X-Client-Version': npmPackageVersion,\n },\n baseUrl: isValidProxy ? options.proxy?.url : baseUrl,\n auth: async () => {\n function hasTokenExpired(expiresAt: number | undefined) {\n return !expiresAt || Date.now() + 60000 > expiresAt;\n }\n if (!session.current || hasTokenExpired(session.current.expiresAt)) {\n const { data } = await refetch();\n if (data) {\n session.current = {\n accessToken: data.accessToken,\n expiresAt: Date.now() + data.expiresIn * 1000,\n };\n }\n }\n return session.current?.accessToken;\n },\n }),\n );\n};\n"],"mappings":"mwHAAA,OAAS,eAAAA,EAAa,uBAAAC,MAA2B,wBCUjD,SAASC,EAAiBC,EAAmC,CAC3D,IAAMC,EAAO,SAAS,gBACtB,OAAO,KAAKD,CAAS,EAAE,QAASE,GAAM,CACpC,IAAMC,EAAcH,EAAUE,CAAC,EAC3BC,GACFF,EAAK,MAAM,YAAYC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,EAAG,CAClE,GAAM,CAAE,KAAAc,CAAK,EAAI,MAAMZ,EAAQ,EAC3BY,IACFd,EAAQ,QAAU,CAChB,YAAac,EAAK,YAClB,UAAW,KAAK,IAAI,EAAIA,EAAK,UAAY,GAC3C,EAEJ,CACA,OAAOd,EAAQ,SAAS,WAC1B,EAdM,OAeR,CAAC,CACH,CACF,EA9DuB,WJQnB,cAAAe,MAAA,oBA1BJ,IAAMC,GAAc,IAAIC,EAUxB,SAASC,GAAyB,CAChC,SAAAC,EACA,KAAAC,EACA,OAAAC,EACA,MAAAC,EACA,YAAAC,CACF,EAAkC,CAChC,IAAMC,EAAkBC,EAAQ,CAC9B,KAAAL,EACA,OAAAC,EACA,QAAS,CACP,MAAAC,EACA,YAAAC,CACF,CACF,CAAC,EACD,OACER,EAACW,EAAkB,SAAlB,CAA2B,MAAO,CAAE,OAAQF,EAAgB,OAAQ,EAClE,SAAAL,EACH,CAEJ,CApBSQ,EAAAT,GAAA,4BAsBF,SAASU,GAAmB,CACjC,SAAAT,EACA,WAAAU,CACF,EAEI,CACF,OACEd,EAACe,EAAkB,SAAlB,CACC,MAAOD,EAAa,CAAE,WAAAA,CAAW,EAAI,CAAE,WAAY,CAAC,CAAE,EAErD,SAAAV,EACH,CAEJ,CAbgBQ,EAAAC,GAAA,sBAeT,SAASG,GAAY,CAC1B,KAAAX,EACA,OAAAC,EACA,SAAAF,EACA,WAAAU,EACA,MAAAG,EACA,MAAAV,EACA,YAAAC,CACF,EAA2C,CACzC,OACER,EAACkB,EAAA,CAAoB,OAAQjB,GAC3B,SAAAD,EAACa,GAAA,CAAmB,WAAYC,EAC9B,SAAAd,EAACG,GAAA,CACC,KAAME,EACN,OAAQC,EACR,MAAOC,EACP,YAAaC,EAEb,SAAAR,EAACmB,EAAA,CAAc,MAAOF,EAAQ,SAAAb,EAAS,EACzC,EACF,EACF,CAEJ,CAvBgBQ,EAAAI,GAAA","names":["QueryClient","QueryClientProvider","setCssProperties","variables","root","v","propertyVal","__name","mapThemeColors","colors","result","key","mapThemeSpacing","spacing","mapThemeBorderRadius","borderRadius","mapThemeFont","font","applyTheme","theme","createContext","useEffect","useMemo","jsx","ThemeContext","createContext","ThemeProvider","props","useEffect","applyTheme","value","useMemo","__name","ENVIRONMENTS","createClient","useQuery","useRef","isValidUrl","url","__name","useAuth","auth","options","authId","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","debug","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","authId","proxy","environment","remoteApiClient","useAuth","RemoteFlowContext","__name","FormFieldsProvider","components","FormFieldsContext","RemoteFlows","theme","QueryClientProvider","ThemeProvider"]}
|
|
1
|
+
{"version":3,"sources":["../src/RemoteFlowsProvider.tsx","../src/lib/applyTheme.ts","../src/theme.tsx","../src/environments.ts","../src/useAuth.ts"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport { ThemeProvider } from '@/src/theme';\nimport { FormFieldsContext, RemoteFlowContext } from './context';\nimport { Components, RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { useAuth } from './useAuth';\n\nconst queryClient = new QueryClient();\n\ntype RemoteFlowContextWrapperProps = {\n auth: RemoteFlowsSDKProps['auth'];\n children: React.ReactNode;\n environment?: RemoteFlowsSDKProps['environment'];\n proxy?: RemoteFlowsSDKProps['proxy'];\n authId?: RemoteFlowsSDKProps['authId'];\n};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n authId,\n proxy,\n environment,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\n authId,\n options: {\n proxy,\n environment,\n },\n });\n return (\n <RemoteFlowContext.Provider value={{ client: remoteApiClient.current }}>\n {children}\n </RemoteFlowContext.Provider>\n );\n}\n\nexport function FormFieldsProvider({\n children,\n components,\n}: PropsWithChildren<{\n components?: Components;\n}>) {\n return (\n <FormFieldsContext.Provider\n value={components ? { components } : { components: {} }}\n >\n {children}\n </FormFieldsContext.Provider>\n );\n}\n\nexport function RemoteFlows({\n auth,\n authId,\n children,\n components,\n theme,\n proxy,\n environment,\n}: PropsWithChildren<RemoteFlowsSDKProps>) {\n return (\n <QueryClientProvider client={queryClient}>\n <FormFieldsProvider components={components}>\n <RemoteFlowContextWrapper\n auth={auth}\n authId={authId}\n proxy={proxy}\n environment={environment}\n >\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </RemoteFlowContextWrapper>\n </FormFieldsProvider>\n </QueryClientProvider>\n );\n}\n","import {\n CssThemeBorder,\n CssThemeColors,\n CssThemeFont,\n CssThemeSpacing,\n ThemeColors,\n ThemeFont,\n ThemeProviderProps,\n} from '@/src/types/theme';\n\nfunction setCssProperties(variables: Record<string, string>) {\n const root = document.documentElement;\n Object.keys(variables).forEach((v) => {\n const propertyVal = variables[v];\n if (propertyVal) {\n root.style.setProperty(v, propertyVal);\n }\n });\n}\n\nfunction mapThemeColors(colors: ThemeColors): CssThemeColors {\n const result: CssThemeColors = {};\n Object.keys(colors).forEach((key) => {\n result[`--${key}` as keyof CssThemeColors] =\n colors[key as keyof ThemeColors];\n });\n return result;\n}\n\nfunction mapThemeSpacing(spacing: string): CssThemeSpacing {\n return {\n '--spacing': spacing,\n };\n}\n\nfunction mapThemeBorderRadius(borderRadius: string): CssThemeBorder {\n return {\n '--radius': borderRadius,\n };\n}\n\nfunction mapThemeFont(font: ThemeFont): CssThemeFont {\n return {\n '--fontSizeBase': font.fontSizeBase,\n };\n}\n\nexport function applyTheme(theme: ThemeProviderProps['theme']) {\n if (theme?.colors) {\n setCssProperties(mapThemeColors(theme.colors));\n }\n\n if (theme?.spacing) {\n setCssProperties(mapThemeSpacing(theme.spacing));\n }\n\n if (theme?.borderRadius) {\n setCssProperties(mapThemeBorderRadius(theme.borderRadius));\n }\n\n if (theme?.font) {\n setCssProperties(mapThemeFont(theme.font));\n }\n}\n","import { applyTheme } from '@/src/lib/applyTheme';\nimport { createContext, useEffect, useMemo } from 'react';\nimport { ThemeProviderProps } from './types/theme';\n\nconst ThemeContext = createContext<Omit<ThemeProviderProps, 'children'>>({\n theme: {},\n});\n\nexport function ThemeProvider(props: ThemeProviderProps) {\n useEffect(() => {\n if (props.theme && Object.keys(props.theme).length > 0) {\n applyTheme(props.theme);\n }\n }, [props.theme]);\n\n const value = useMemo(() => {\n return { theme: props.theme };\n }, [props.theme]);\n\n return (\n <ThemeContext.Provider value={value}>\n {props.children}\n </ThemeContext.Provider>\n );\n}\n","export const ENVIRONMENTS = {\n local: 'http://localhost:4000/api/eor',\n partners: 'https://gateway.partners.remote-sandbox.com',\n production: 'https://gateway.remote.com',\n sandbox: 'https://gateway.remote-sandbox.com',\n staging: 'https://gateway.niceremote.com',\n};\n","import { client } from '@/src/client/client.gen';\nimport { ENVIRONMENTS } from '@/src/environments';\nimport { createClient } from '@hey-api/client-fetch';\nimport { useQuery } from '@tanstack/react-query';\nimport { useRef } from 'react';\nimport { RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { debug } from './lib/utils';\n\ntype AuthResponse = {\n accessToken: string;\n expiresIn: number;\n};\n\ntype Options = Partial<{\n environment: keyof typeof ENVIRONMENTS;\n proxy: RemoteFlowsSDKProps['proxy'];\n}>;\n\nfunction isValidUrl(url: string) {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const useAuth = ({\n auth,\n options,\n authId = 'default',\n}: {\n auth: () => Promise<AuthResponse>;\n options?: Options;\n authId?: 'default' | 'client';\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth', authId],\n queryFn: auth,\n enabled: false,\n });\n\n const baseUrl = options?.environment\n ? ENVIRONMENTS[options?.environment]\n : process.env.REMOTE_GATEWAY_URL;\n\n const clientConfig = client.getConfig();\n const npmPackageVersion = process.env.VERSION || 'unknown';\n\n if (options?.environment && options?.environment !== 'production') {\n debug(npmPackageVersion);\n }\n\n const isValidProxy = !!options?.proxy && isValidUrl(options.proxy.url);\n\n if (options?.proxy && !isValidProxy) {\n console.error('Invalid proxy URL provided. Using default base URL.');\n }\n\n return useRef(\n createClient({\n ...clientConfig,\n headers: {\n ...clientConfig.headers,\n ...(isValidProxy ? options?.proxy?.headers : {}),\n 'X-Client-Name': 'remote-flows-sdk',\n 'X-Client-Version': npmPackageVersion,\n },\n baseUrl: isValidProxy ? options.proxy?.url : baseUrl,\n auth: async () => {\n function hasTokenExpired(expiresAt: number | undefined) {\n return !expiresAt || Date.now() + 60000 > expiresAt;\n }\n if (!session.current || hasTokenExpired(session.current.expiresAt)) {\n const { data } = await refetch();\n if (data) {\n session.current = {\n accessToken: data.accessToken,\n expiresAt: Date.now() + data.expiresIn * 1000,\n };\n }\n }\n return session.current?.accessToken;\n },\n }),\n );\n};\n"],"mappings":"82HAAA,OAAS,eAAAA,EAAa,uBAAAC,MAA2B,wBCUjD,SAASC,EAAiBC,EAAmC,CAC3D,IAAMC,EAAO,SAAS,gBACtB,OAAO,KAAKD,CAAS,EAAE,QAASE,GAAM,CACpC,IAAMC,EAAcH,EAAUE,CAAC,EAC3BC,GACFF,EAAK,MAAM,YAAYC,EAAGC,CAAW,CAEzC,CAAC,CACH,CARSC,EAAAL,EAAA,oBAUT,SAASM,EAAeC,EAAqC,CAC3D,IAAMC,EAAyB,CAAC,EAChC,cAAO,KAAKD,CAAM,EAAE,QAASE,GAAQ,CACnCD,EAAO,KAAKC,CAAG,EAA0B,EACvCF,EAAOE,CAAwB,CACnC,CAAC,EACMD,CACT,CAPSH,EAAAC,EAAA,kBAST,SAASI,EAAgBC,EAAkC,CACzD,MAAO,CACL,YAAaA,CACf,CACF,CAJSN,EAAAK,EAAA,mBAMT,SAASE,EAAqBC,EAAsC,CAClE,MAAO,CACL,WAAYA,CACd,CACF,CAJSR,EAAAO,EAAA,wBAMT,SAASE,EAAaC,EAA+B,CACnD,MAAO,CACL,iBAAkBA,E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,CACF,CAAC,EACD,OACER,EAACW,EAAkB,SAAlB,CAA2B,MAAO,CAAE,OAAQF,EAAgB,OAAQ,EAClE,SAAAL,EACH,CAEJ,CApBSQ,EAAAT,GAAA,4BAsBF,SAASU,GAAmB,CACjC,SAAAT,EACA,WAAAU,CACF,EAEI,CACF,OACEd,EAACe,EAAkB,SAAlB,CACC,MAAOD,EAAa,CAAE,WAAAA,CAAW,EAAI,CAAE,WAAY,CAAC,CAAE,EAErD,SAAAV,EACH,CAEJ,CAbgBQ,EAAAC,GAAA,sBAeT,SAASG,GAAY,CAC1B,KAAAX,EACA,OAAAC,EACA,SAAAF,EACA,WAAAU,EACA,MAAAG,EACA,MAAAV,EACA,YAAAC,CACF,EAA2C,CACzC,OACER,EAACkB,EAAA,CAAoB,OAAQjB,GAC3B,SAAAD,EAACa,GAAA,CAAmB,WAAYC,EAC9B,SAAAd,EAACG,GAAA,CACC,KAAME,EACN,OAAQC,EACR,MAAOC,EACP,YAAaC,EAEb,SAAAR,EAACmB,EAAA,CAAc,MAAOF,EAAQ,SAAAb,EAAS,EACzC,EACF,EACF,CAEJ,CAvBgBQ,EAAAI,GAAA","names":["QueryClient","QueryClientProvider","setCssProperties","variables","root","v","propertyVal","__name","mapThemeColors","colors","result","key","mapThemeSpacing","spacing","mapThemeBorderRadius","borderRadius","mapThemeFont","font","applyTheme","theme","createContext","useEffect","useMemo","jsx","ThemeContext","createContext","ThemeProvider","props","useEffect","applyTheme","value","useMemo","__name","ENVIRONMENTS","createClient","useQuery","useRef","isValidUrl","url","__name","useAuth","auth","options","authId","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","debug","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","authId","proxy","environment","remoteApiClient","useAuth","RemoteFlowContext","__name","FormFieldsProvider","components","FormFieldsContext","RemoteFlows","theme","QueryClientProvider","ThemeProvider"]}
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Z as ZendeskTriggerButton, c as cn } from './ZendeskTriggerButton-
|
|
1
|
+
export { Z as ZendeskTriggerButton, c as cn } from './ZendeskTriggerButton-DIV8pCPo.js';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
package/dist/internals.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Q,b as R,c as S}from"./chunk-JBUNDNKJ.js";import{a as M,b as N,c as O,d as P}from"./chunk-7R347KBY.js";import{a as G,b as H,c as I,d as J,e as K,f as L}from"./chunk-AFRA4BIW.js";import{a as F}from"./chunk-3A47R5RQ.js";import{a as j,b as m,c as n,d as o,f as p,g as q,h as r,i as s,j as v,k as w,l as x,m as y,n as z,o as A,p as B,q as C,r as D,s as E}from"./chunk-D6X2WCEG.js";import{a as t,b as u}from"./chunk-HPHWQU34.js";import{
|
|
1
|
+
import{a as Q,b as R,c as S}from"./chunk-JBUNDNKJ.js";import{a as M,b as N,c as O,d as P}from"./chunk-7R347KBY.js";import{a as G,b as H,c as I,d as J,e as K,f as L}from"./chunk-AFRA4BIW.js";import{a as F}from"./chunk-3A47R5RQ.js";import{a as j,b as m,c as n,d as o,f as p,g as q,h as r,i as s,j as v,k as w,l as x,m as y,n as z,o as A,p as B,q as C,r as D,s as E}from"./chunk-D6X2WCEG.js";import{a as t,b as u}from"./chunk-HPHWQU34.js";import{b as i}from"./chunk-ANQ4HVVK.js";import{a as c}from"./chunk-PD24XKD6.js";import{a as d,b as e,d as f,e as g,f as h}from"./chunk-TWIUL2P3.js";import"./chunk-ZX5OIIJX.js";import"./chunk-3O3Q24JL.js";import{a as k,b as l}from"./chunk-WVDTHFGS.js";import"./chunk-3ZWDIEEM.js";import{a as b}from"./chunk-MQ6F5LE4.js";import{a}from"./chunk-43WMZDDH.js";import"./chunk-P37U34EQ.js";export{C as Alert,E as AlertDescription,D as AlertTitle,u as Badge,l as Button,G as Card,K as CardContent,J as CardDescription,L as CardFooter,H as CardHeader,I as CardTitle,j as Checkbox,Q as Collapsible,S as CollapsibleContent,R as CollapsibleTrigger,v as Dialog,x as DialogContent,B as DialogDescription,z as DialogFooter,y as DialogHeader,A as DialogTitle,w as DialogTrigger,d as Drawer,f as DrawerContent,g as DrawerHeader,h as DrawerTitle,e as DrawerTrigger,c as Input,b as Label,m as RadioGroup,n as RadioGroupItem,F as ScrollArea,o as Select,r as SelectContent,s as SelectItem,q as SelectTrigger,p as SelectValue,M as Tabs,P as TabsContent,N as TabsList,O as TabsTrigger,i as ZendeskTriggerButton,t as badgeVariants,k as buttonVariants,a as cn};
|
|
2
2
|
//# sourceMappingURL=internals.js.map
|
package/package.json
CHANGED
package/dist/chunk-2TADRH4W.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./chunk-ZSCKSEAA.js";import{a as m}from"./chunk-ZE3YT3Q6.js";import{a as e}from"./chunk-32GSS4UM.js";import{a}from"./chunk-MP2T74PU.js";import{b as n}from"./chunk-WVDTHFGS.js";import{b as s}from"./chunk-43WMZDDH.js";import{a as o}from"./chunk-P37U34EQ.js";import{Info as f}from"lucide-react";import{Fragment as y,jsx as r,jsxs as t}from"react/jsx-runtime";function N({grossSalary:l,currency:p,hasExtraStatutoryPayment:c=!1}){return t("div",{children:[t("div",{className:"flex justify-between items-center mb-2",children:[t("div",{className:"flex items-center gap-2",children:[r("h3",{className:"font-medium text-primary-foreground",children:"Gross Salary"}),c&&r(m,{content:t(y,{children:[r("span",{children:"This country respects extra payments on top of the gross salary."})," ",r(a,{zendeskId:e.extraPayments,children:"Learn more"})]}),children:t(n,{variant:"ghost",size:"icon",className:"h-4 w-4 p-0 mt-2",children:[r(f,{className:"h-3 w-3 text-gray-400"}),r("span",{className:"sr-only",children:"Info"})]})})]}),r("span",{className:"font-semibold text-lg",children:s(l,p)})]}),r(i,{})]})}o(N,"CostCalculatorGrossSalary");export{N as a};
|
|
2
|
-
//# sourceMappingURL=chunk-2TADRH4W.js.map
|
package/dist/chunk-32GSS4UM.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e={disclaimerCostCalculator:4668194326797,employeeOnboardingTimeline:4411262104589,extraPayments:4466822781709,internationalPricing:4410698586893,remoteFxRate:33271144977421,terminationEmployeeCommunication:4411585179661,terminationNoticePeriods:5831900985613};export{e as a};
|
|
2
|
-
//# sourceMappingURL=chunk-32GSS4UM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/shared/zendesk-drawer/utils.ts"],"sourcesContent":["export const zendeskArticles = {\n disclaimerCostCalculator: 4668194326797,\n employeeOnboardingTimeline: 4411262104589,\n extraPayments: 4466822781709,\n internationalPricing: 4410698586893,\n remoteFxRate: 33271144977421,\n terminationEmployeeCommunication: 4411585179661,\n terminationNoticePeriods: 5831900985613,\n};\n"],"mappings":"AAAO,IAAMA,EAAkB,CAC7B,yBAA0B,cAC1B,2BAA4B,cAC5B,cAAe,cACf,qBAAsB,cACtB,aAAc,eACd,iCAAkC,cAClC,yBAA0B,aAC5B","names":["zendeskArticles"]}
|
package/dist/chunk-4T6PRR6R.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e={data:{version:7,schema:{additionalProperties:!1,allOf:[{if:{properties:{agrees_to_pto_amount:{const:"no"}},required:["agrees_to_pto_amount"]},then:{properties:{agrees_to_pto_amount_notes:{type:"string"}},required:["agrees_to_pto_amount_notes"]},else:{properties:{agrees_to_pto_amount_notes:!1,timesheet_file:!1}}}],properties:{timeoff_statement:{type:"null",title:"Timeoff statement","x-jsf-presentation":{inputType:"hidden",statement:{title:"Make sure these paid time off records are correct",description:"You must pay the employee for any unused accrued paid time off, so please check these records carefully.",inputType:"statement",severity:"warning"},meta:{ignoreValue:!0}}},paid_time_off_info:{type:"null",title:"Paid time off info","x-jsf-presentation":{inputType:"hidden"},meta:{ignoreValue:!0}},agrees_to_pto_amount:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Are these paid time off records correct?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},agrees_to_pto_amount_notes:{description:"Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.",maxLength:1e3,title:"Provide time off details",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},timesheet_file:{description:"Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.",title:"Timesheet document",type:["string","null"],"x-jsf-presentation":{inputType:"file",accept:".pdf"}}},required:["agrees_to_pto_amount"],type:"object","x-jsf-order":["timeoff_statement","paid_time_off_info","agrees_to_pto_amount","agrees_to_pto_amount_notes","timesheet_file"]}}};export{e as a};
|
|
2
|
-
//# sourceMappingURL=chunk-4T6PRR6R.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flows/Termination/json-schemas/paidTimeOff.ts"],"sourcesContent":["export const paidTimeOffSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n agrees_to_pto_amount: {\n const: 'no',\n },\n },\n required: ['agrees_to_pto_amount'],\n },\n then: {\n properties: {\n agrees_to_pto_amount_notes: {\n type: 'string',\n },\n },\n required: ['agrees_to_pto_amount_notes'],\n },\n else: {\n properties: {\n agrees_to_pto_amount_notes: false,\n timesheet_file: false,\n },\n },\n },\n ],\n properties: {\n timeoff_statement: {\n type: 'null',\n title: 'Timeoff statement',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n statement: {\n title: 'Make sure these paid time off records are correct',\n description:\n 'You must pay the employee for any unused accrued paid time off, so please check these records carefully.',\n inputType: 'statement',\n severity: 'warning',\n },\n meta: {\n ignoreValue: true,\n },\n },\n },\n paid_time_off_info: {\n type: 'null',\n title: 'Paid time off info',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n },\n meta: {\n ignoreValue: true,\n },\n },\n agrees_to_pto_amount: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Are these paid time off records correct?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n agrees_to_pto_amount_notes: {\n description:\n 'Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.',\n maxLength: 1000,\n title: 'Provide time off details',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n timesheet_file: {\n description:\n 'Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.',\n title: 'Timesheet document',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n },\n },\n },\n required: ['agrees_to_pto_amount'],\n type: 'object',\n 'x-jsf-order': [\n 'timeoff_statement',\n 'paid_time_off_info',\n 'agrees_to_pto_amount',\n 'agrees_to_pto_amount_notes',\n 'timesheet_file',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAAoB,CAC/B,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CACL,CACE,GAAI,CACF,WAAY,CACV,qBAAsB,CACpB,MAAO,IACT,CACF,EACA,SAAU,CAAC,sBAAsB,CACnC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,CAC1B,KAAM,QACR,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,GAC5B,eAAgB,EAClB,CACF,CACF,CACF,EACA,WAAY,CACV,kBAAmB,CACjB,KAAM,OACN,MAAO,oBACP,qBAAsB,CACpB,UAAW,SACX,UAAW,CACT,MAAO,oDACP,YACE,2GACF,UAAW,YACX,SAAU,SACZ,EACA,KAAM,CACJ,YAAa,EACf,CACF,CACF,EACA,mBAAoB,CAClB,KAAM,OACN,MAAO,qBACP,qBAAsB,CACpB,UAAW,QACb,EACA,KAAM,CACJ,YAAa,EACf,CACF,EACA,qBAAsB,CACpB,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,2CACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,2BAA4B,CAC1B,YACE,sIACF,UAAW,IACX,MAAO,2BACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,eAAgB,CACd,YACE,4HACF,MAAO,qBACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,OACX,OAAQ,MACV,CACF,CACF,EACA,SAAU,CAAC,sBAAsB,EACjC,KAAM,SACN,cAAe,CACb,oBACA,qBACA,uBACA,6BACA,gBACF,CACF,CACF,CACF","names":["paidTimeOffSchema"]}
|
package/dist/chunk-GC23RRCI.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e={data:{version:7,schema:{additionalProperties:!1,allOf:[{if:{properties:{will_challenge_termination:{const:"yes"}},required:["will_challenge_termination"]},then:{properties:{will_challenge_termination_description:{type:"string"}},required:["will_challenge_termination_description"]},else:{properties:{will_challenge_termination_description:!1}}}],properties:{termination_reason:{title:"Termination reason",description:"Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.",type:"string",oneOf:[{const:"gross_misconduct",title:"Gross misconduct"},{const:"performance",title:"Performance"},{const:"workforce_reduction",title:"Workforce Reduction"},{const:"values",title:"Values"},{const:"compliance_issue",title:"Compliance issue"},{const:"incapacity_to_perform_inherent_duties",title:"Incapacity To perform inherent duties"},{const:"mutual_agreement",title:"Mutual agreement"},{const:"cancellation_before_start_date",title:"Decision to cancel hiring before the employee starts"},{const:"job_abandonment",title:"Job abandonment"},{const:"dissatisfaction_with_remote_service",title:"Dissatisfaction with EOR service"},{const:"end_of_fixed_term_contract_compliance_issue",title:"End of fixed-term contract"},{const:"other",title:"Other"}],"x-jsf-presentation":{inputType:"select"}},reason_description:{description:"",maxLength:1e3,title:"Termination reason details",type:"string","x-jsf-presentation":{inputType:"textarea"}},additional_comments:{description:"",maxLength:1e3,title:"Additional details regarding this termination process.",type:"string","x-jsf-presentation":{inputType:"textarea"}},termination_reason_files:{description:"Please upload any supporting documents regarding the termination reason.",title:"Termination reason files",type:"string","x-jsf-presentation":{inputType:"file",accept:".pdf",multiple:!0}},risk_assesment_info:{description:"",title:"Risk assessment info",type:"null","x-jsf-presentation":{inputType:"hidden"}},risk_assessment_reasons:{description:"",title:"This employee is...",type:"array",items:{anyOf:[{const:"sick_leave",title:"Currently on or recently returned from sick leave"},{const:"family_leave",title:"Currently on or recently returned from maternity, paternity, or other family leave"},{const:"pregnant_or_breastfeeding",title:"Pregnant or breastfeeding"},{const:"requested_medical_or_family_leave",title:"Requested medical or family leave"},{const:"disabled_or_health_condition",title:"Disabled or has a health condition"},{const:"member_of_union_or_works_council",title:"A member of a union or works council"},{const:"caring_responsibilities",title:"Caring responsibilities"},{const:"reported_concerns_with_workplace",title:"Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions"},{const:"none_of_these",title:"To the best of my knowledge, I am not aware of any of these"}]},"x-jsf-presentation":{inputType:"checkbox",direction:"column"}},will_challenge_termination:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Do you consider it is likely that the employee will challenge their termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},will_challenge_termination_description:{description:"",maxLength:1e3,title:"Please explain how the employee will challenge their termination",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},proposed_termination_date_info:{description:"",title:"Proposed termination date info",type:"null","x-jsf-presentation":{inputType:"hidden"}},proposed_termination_date:{description:"",format:"date",maxLength:255,title:"Proposed termination date",type:"string","x-jsf-presentation":{inputType:"date"}}},required:["termination_reason","reason_description","risk_assessment_reasons","will_challenge_termination","proposed_termination_date"],type:"object","x-jsf-order":["termination_reason","reason_description","additional_comments","termination_reason_files","risk_assesment_info","risk_assessment_reasons","will_challenge_termination","will_challenge_termination_description","proposed_termination_date_info","proposed_termination_date"]}}};export{e as a};
|
|
2
|
-
//# sourceMappingURL=chunk-GC23RRCI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flows/Termination/json-schemas/terminationDetails.ts"],"sourcesContent":["export const terminationDetailsSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n will_challenge_termination: {\n const: 'yes',\n },\n },\n required: ['will_challenge_termination'],\n },\n then: {\n properties: {\n will_challenge_termination_description: {\n type: 'string',\n },\n },\n required: ['will_challenge_termination_description'],\n },\n else: {\n properties: {\n will_challenge_termination_description: false,\n },\n },\n },\n ],\n properties: {\n termination_reason: {\n title: 'Termination reason',\n description:\n 'Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.',\n type: 'string',\n oneOf: [\n {\n const: 'gross_misconduct',\n title: 'Gross misconduct',\n },\n {\n const: 'performance',\n title: 'Performance',\n },\n {\n const: 'workforce_reduction',\n title: 'Workforce Reduction',\n },\n {\n const: 'values',\n title: 'Values',\n },\n {\n const: 'compliance_issue',\n title: 'Compliance issue',\n },\n {\n const: 'incapacity_to_perform_inherent_duties',\n title: 'Incapacity To perform inherent duties',\n },\n {\n const: 'mutual_agreement',\n title: 'Mutual agreement',\n },\n {\n const: 'cancellation_before_start_date',\n title: 'Decision to cancel hiring before the employee starts',\n },\n {\n const: 'job_abandonment',\n title: 'Job abandonment',\n },\n {\n const: 'dissatisfaction_with_remote_service',\n title: 'Dissatisfaction with EOR service',\n },\n {\n const: 'end_of_fixed_term_contract_compliance_issue',\n title: 'End of fixed-term contract',\n },\n {\n const: 'other',\n title: 'Other',\n },\n ],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n reason_description: {\n description: '',\n maxLength: 1000,\n title: 'Termination reason details',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n additional_comments: {\n description: '',\n maxLength: 1000,\n title: 'Additional details regarding this termination process.',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n termination_reason_files: {\n description:\n 'Please upload any supporting documents regarding the termination reason.',\n title: 'Termination reason files',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n multiple: true,\n },\n },\n risk_assesment_info: {\n description: '',\n title: 'Risk assessment info',\n type: 'null',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n },\n },\n risk_assessment_reasons: {\n description: '',\n title: 'This employee is...',\n type: 'array',\n items: {\n anyOf: [\n {\n const: 'sick_leave',\n title: 'Currently on or recently returned from sick leave',\n },\n {\n const: 'family_leave',\n title:\n 'Currently on or recently returned from maternity, paternity, or other family leave',\n },\n {\n const: 'pregnant_or_breastfeeding',\n title: 'Pregnant or breastfeeding',\n },\n {\n const: 'requested_medical_or_family_leave',\n title: 'Requested medical or family leave',\n },\n {\n const: 'disabled_or_health_condition',\n title: 'Disabled or has a health condition',\n },\n {\n const: 'member_of_union_or_works_council',\n title: 'A member of a union or works council',\n },\n {\n const: 'caring_responsibilities',\n title: 'Caring responsibilities',\n },\n {\n const: 'reported_concerns_with_workplace',\n title:\n 'Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions',\n },\n {\n const: 'none_of_these',\n title:\n 'To the best of my knowledge, I am not aware of any of these',\n },\n ],\n },\n 'x-jsf-presentation': {\n inputType: 'checkbox',\n direction: 'column',\n },\n },\n will_challenge_termination: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title:\n 'Do you consider it is likely that the employee will challenge their termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n will_challenge_termination_description: {\n description: '',\n maxLength: 1000,\n title:\n 'Please explain how the employee will challenge their termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n proposed_termination_date_info: {\n description: '',\n title: 'Proposed termination date info',\n type: 'null',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n },\n },\n proposed_termination_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'Proposed termination date',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n },\n required: [\n 'termination_reason',\n 'reason_description',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'proposed_termination_date',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'termination_reason',\n 'reason_description',\n 'additional_comments',\n 'termination_reason_files',\n 'risk_assesment_info',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'will_challenge_termination_description',\n 'proposed_termination_date_info',\n 'proposed_termination_date',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAA2B,CACtC,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CACL,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CAAC,wCAAwC,CACrD,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,EAC1C,CACF,CACF,CACF,EACA,WAAY,CACV,mBAAoB,CAClB,MAAO,qBACP,YACE,oGACF,KAAM,SACN,MAAO,CACL,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,cACP,MAAO,aACT,EACA,CACE,MAAO,sBACP,MAAO,qBACT,EACA,CACE,MAAO,SACP,MAAO,QACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,wCACP,MAAO,uCACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,iCACP,MAAO,sDACT,EACA,CACE,MAAO,kBACP,MAAO,iBACT,EACA,CACE,MAAO,sCACP,MAAO,kCACT,EACA,CACE,MAAO,8CACP,MAAO,4BACT,EACA,CACE,MAAO,QACP,MAAO,OACT,CACF,EACA,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,mBAAoB,CAClB,YAAa,GACb,UAAW,IACX,MAAO,6BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,oBAAqB,CACnB,YAAa,GACb,UAAW,IACX,MAAO,yDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,yBAA0B,CACxB,YACE,2EACF,MAAO,2BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,OACX,OAAQ,OACR,SAAU,EACZ,CACF,EACA,oBAAqB,CACnB,YAAa,GACb,MAAO,uBACP,KAAM,OACN,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,wBAAyB,CACvB,YAAa,GACb,MAAO,sBACP,KAAM,QACN,MAAO,CACL,MAAO,CACL,CACE,MAAO,aACP,MAAO,mDACT,EACA,CACE,MAAO,eACP,MACE,oFACJ,EACA,CACE,MAAO,4BACP,MAAO,2BACT,EACA,CACE,MAAO,oCACP,MAAO,mCACT,EACA,CACE,MAAO,+BACP,MAAO,oCACT,EACA,CACE,MAAO,mCACP,MAAO,sCACT,EACA,CACE,MAAO,0BACP,MAAO,yBACT,EACA,CACE,MAAO,mCACP,MACE,2LACJ,EACA,CACE,MAAO,gBACP,MACE,6DACJ,CACF,CACF,EACA,qBAAsB,CACpB,UAAW,WACX,UAAW,QACb,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MACE,mFACF,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MACE,mEACF,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,+BAAgC,CAC9B,YAAa,GACb,MAAO,iCACP,KAAM,OACN,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,0BAA2B,CACzB,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,4BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,MACb,CACF,CACF,EACA,SAAU,CACR,qBACA,qBACA,0BACA,6BACA,2BACF,EACA,KAAM,SACN,cAAe,CACb,qBACA,qBACA,sBACA,2BACA,sBACA,0BACA,6BACA,yCACA,iCACA,2BACF,CACF,CACF,CACF","names":["terminationDetailsSchema"]}
|
package/dist/chunk-HHWIJGDR.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as w}from"./chunk-SLMJEZJ7.js";import{a as C}from"./chunk-6IL4TB7S.js";import{a as j}from"./chunk-VUP76ZMQ.js";import{a as P}from"./chunk-S4XU4SE7.js";import{a as g}from"./chunk-32GSS4UM.js";import{a as M}from"./chunk-KDUM4EZJ.js";import{a as V}from"./chunk-2YTBWEC7.js";import{a as S}from"./chunk-MP2T74PU.js";import{a as x,b as k}from"./chunk-2M7EBC4K.js";import{a as h}from"./chunk-PJBAQZ6G.js";import{a as F}from"./chunk-Z5WMKCRJ.js";import{c as m}from"./chunk-PAQW5BFW.js";import{a as r}from"./chunk-43WMZDDH.js";import{a as i}from"./chunk-P37U34EQ.js";import{createHeadlessForm as Z}from"@remoteoss/json-schema-form";import Q from"lodash.omitby";import U from"lodash.isnull";import{format as W}from"date-fns";import{useMemo as b}from"react";import G from"lodash.omit";import{jsx as N,jsxs as K}from"react/jsx-runtime";function c(t,e,f){return{"x-jsf-presentation":{inputType:"hidden",Component:i(()=>K("div",{className:r("RemoteFlows__InformationStatement",f?.className),children:[N("h3",{className:r("RemoteFlows__InformationStatement__Title"),children:t}),N("p",{className:r("RemoteFlows__InformationStatement__Description"),children:e})]}),"Component")}}}i(c,"createInformationField");import{Fragment as Y,jsx as d,jsxs as ee}from"react/jsx-runtime";function X(t){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,...t}}i(X,"buildInitialValues");var ke=i(({employmentId:t,options:e,initialValues:f})=>{let{fieldValues:y,setFieldValues:v,stepState:n,previousStep:$,nextStep:R}=h(P),{data:p}=M({employmentId:t}),_=X({...n.values?.employee_communication,...n.values?.termination_details,...n.values?.paid_time_off,...n.values?.additional_information,...f}),u=b(()=>({...n.values?.[n.currentStep.name],..._,...y}),[n.values,n.currentStep.name,y,_]),D=b(()=>({fields:{risk_assesment_info:c("Offboarding risk assessment","Employees may be protected from termination if they fall into certain categories. To help avoid claims from employees, let us know if the employee is part of one or more of these categories. Select all that apply.",{className:e?.jsfModify?.fields?.risk_assesment_info?.["x-jsf-presentation"]?.className}),proposed_termination_date_info:c("Proposed termination date",ee(Y,{children:["In most cases, we must provide notice to the employee before termination. The required notice period depends on local labor laws, the employment agreement, and other factors. We'll use those factors to determine the required notice period.",d(S,{zendeskId:g.terminationNoticePeriods,className:r("text-sm",e?.jsfModify?.fields?.proposed_termination_date_info?.["x-jsf-presentation"]?.zendeskTriggerButtonClassName),children:"Learn about notice periods"})]}),{className:e?.jsfModify?.fields?.proposed_termination_date_info?.["x-jsf-presentation"]?.className}),proposed_termination_date:{...e?.jsfModify?.fields?.proposed_termination_date,"x-jsf-presentation":{...e?.jsfModify?.fields?.proposed_termination_date?.["x-jsf-presentation"],minDate:W(new Date,"yyyy-MM-dd")}},paid_time_off_info:{...e?.jsfModify?.fields?.paid_time_off_info,"x-jsf-presentation":{...e?.jsfModify?.fields?.paid_time_off_info?.["x-jsf-presentation"],Component:i(()=>{let a=e?.jsfModify?.fields?.paid_time_off_info?.["x-jsf-presentation"]?.Component;return d(C,{employeeName:p?.basic_information?.name,proposedTerminationDate:u.proposed_termination_date,employmentId:t,employment:p,render:o=>a?d(a,{...o}):d(w,{...o})})},"Component")}}}}),[e?.jsfModify?.fields?.risk_assesment_info,e?.jsfModify?.fields?.proposed_termination_date_info,e?.jsfModify?.fields?.proposed_termination_date,e?.jsfModify?.fields?.paid_time_off_info,u.proposed_termination_date,t,p]),{data:s,isLoading:E}=k({formValues:u,jsfModify:{...e?.jsfModify,fields:{...e?.jsfModify?.fields,...D?.fields}},step:n.currentStep.name}),l=Z(j.data.schema),T=x(),{mutateAsync:O}=V(T);async function I(a){if(!t)throw new Error("Employment id is missing");if(s){let o=m(a,l.fields,{isPartialValidation:!0}),{customer_informed_employee:B}=o,H=B==="yes"?{employee_awareness:{date:o.customer_informed_employee_date,note:o.customer_informed_employee_description}}:void 0,L=F(o,["agrees_to_pto_amount","confidential","customer_informed_employee","will_challenge_termination"]),A=G(L,"customer_informed_employee_date","customer_informed_employee_description"),q=Q({...A,...H},U);return O({employment_id:t,termination_details:q,type:"termination"})}}i(I,"onSubmit");function J(){$()}i(J,"back");function z(){R()}return i(z,"next"),{employmentId:t,stepState:n,fields:s?.fields||[],isLoading:E,isSubmitting:T.isPending,initialValues:_,handleValidation:i(a=>{if(s){let o=m(a,s?.fields);return s?.handleValidation(o)}return null},"handleValidation"),checkFieldUpdates:i(a=>{if(l){let o=m(a,l?.fields,{isPartialValidation:!0});v(o)}},"checkFieldUpdates"),parseFormValues:i(a=>m(a,l.fields,{isPartialValidation:!0}),"parseFormValues"),onSubmit:I,back:J,next:z}},"useTermination");export{ke as a};
|
|
2
|
-
//# sourceMappingURL=chunk-HHWIJGDR.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flows/Termination/hooks.tsx","../src/components/form/jsf-utils/createFields.tsx"],"sourcesContent":["import { $TSFixMe, createHeadlessForm } from '@remoteoss/json-schema-form';\nimport omitBy from 'lodash.omitby';\nimport isNull from 'lodash.isnull';\nimport { format } from 'date-fns';\nimport { useMemo } from 'react';\nimport {\n CreateOffboardingParams,\n TerminationDetailsParams,\n} from '@/src/client';\nimport { mutationToPromise } from '@/src/lib/mutations';\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport {\n TerminationFlowProps,\n TerminationFormValues,\n} from '@/src/flows/Termination/types';\nimport omit from 'lodash.omit';\nimport { parseFormRadioValues } from '@/src/flows/utils';\nimport { useStepState } from '@/src/flows/useStepState';\nimport { STEPS } from '@/src/flows/Termination/utils';\nimport { jsonSchema } from '@/src/flows/Termination/json-schemas/jsonSchema';\nimport { useCreateTermination, useTerminationSchema } from '@/src/flows/api';\nimport { createInformationField } from '@/src/components/form/jsf-utils/createFields';\nimport { cn, ZendeskTriggerButton } from '@/src/internals';\nimport { zendeskArticles } from '@/src/components/shared/zendesk-drawer/utils';\nimport { PaidTimeOff } from '@/src/flows/Termination/components/PaidTimeOff/PaidTimeOff';\nimport { PaidTimeOffContainer } from '@/src/flows/Termination/components/PaidTimeOff/PaidTimeOffContainer';\nimport { useEmploymentQuery } from '@/src/common/api';\n\nfunction buildInitialValues(\n stepsInitialValues: Partial<TerminationFormValues>,\n): TerminationFormValues {\n const initialValues: TerminationFormValues = {\n confidential: '',\n customer_informed_employee: '',\n customer_informed_employee_date: '',\n customer_informed_employee_description: '',\n personal_email: '',\n termination_reason: undefined,\n reason_description: '',\n termination_reason_files: [],\n will_challenge_termination: '',\n will_challenge_termination_description: null,\n agrees_to_pto_amount: '',\n agrees_to_pto_amount_notes: null,\n acknowledge_termination_procedure: false,\n additional_comments: '',\n proposed_termination_date: '',\n risk_assessment_reasons: [],\n timesheet_file: undefined,\n ...stepsInitialValues,\n };\n\n return initialValues;\n}\n\ntype TerminationHookProps = Omit<TerminationFlowProps, 'render'>;\n\nexport const useTermination = ({\n employmentId,\n options,\n initialValues: terminationInitialValues,\n}: TerminationHookProps) => {\n const { fieldValues, setFieldValues, stepState, previousStep, nextStep } =\n useStepState<keyof typeof STEPS, TerminationFormValues>(STEPS);\n\n const { data: employment } = useEmploymentQuery({ employmentId });\n\n const initialValues = buildInitialValues({\n ...stepState.values?.employee_communication,\n ...stepState.values?.termination_details,\n ...stepState.values?.paid_time_off,\n ...stepState.values?.additional_information,\n ...terminationInitialValues,\n });\n\n const formValues = useMemo(\n () => ({\n ...stepState.values?.[stepState.currentStep.name as keyof typeof STEPS], // Restore values for the current step\n ...initialValues,\n ...fieldValues,\n }),\n [stepState.values, stepState.currentStep.name, fieldValues, initialValues],\n );\n\n const customFields = useMemo(() => {\n return {\n fields: {\n risk_assesment_info: createInformationField(\n 'Offboarding risk assessment',\n 'Employees may be protected from termination if they fall into certain categories. To help avoid claims from employees, let us know if the employee is part of one or more of these categories. Select all that apply.',\n {\n className: (\n options?.jsfModify?.fields?.risk_assesment_info as $TSFixMe\n )?.['x-jsf-presentation']?.className,\n },\n ),\n proposed_termination_date_info: createInformationField(\n 'Proposed termination date',\n <>\n In most cases, we must provide notice to the employee before\n termination. The required notice period depends on local labor laws,\n the employment agreement, and other factors. We'll use those factors\n to determine the required notice period.\n <ZendeskTriggerButton\n zendeskId={zendeskArticles.terminationNoticePeriods}\n className={cn(\n 'text-sm',\n (\n options?.jsfModify?.fields\n ?.proposed_termination_date_info as $TSFixMe\n )?.['x-jsf-presentation']?.zendeskTriggerButtonClassName,\n )}\n >\n Learn about notice periods\n </ZendeskTriggerButton>\n </>,\n {\n className: (\n options?.jsfModify?.fields\n ?.proposed_termination_date_info as $TSFixMe\n )?.['x-jsf-presentation']?.className,\n },\n ),\n proposed_termination_date: {\n ...(options?.jsfModify?.fields\n ?.proposed_termination_date as $TSFixMe),\n 'x-jsf-presentation': {\n ...(\n options?.jsfModify?.fields?.proposed_termination_date as $TSFixMe\n )?.['x-jsf-presentation'],\n minDate: format(new Date(), 'yyyy-MM-dd'),\n },\n },\n paid_time_off_info: {\n ...(options?.jsfModify?.fields?.paid_time_off_info as $TSFixMe),\n 'x-jsf-presentation': {\n ...(options?.jsfModify?.fields?.paid_time_off_info as $TSFixMe)?.[\n 'x-jsf-presentation'\n ],\n Component: () => {\n const CustomComponent = (\n options?.jsfModify?.fields?.paid_time_off_info as $TSFixMe\n )?.['x-jsf-presentation']?.Component;\n\n return (\n <PaidTimeOffContainer\n employeeName={employment?.basic_information?.name as string}\n proposedTerminationDate={formValues.proposed_termination_date}\n employmentId={employmentId}\n employment={employment}\n render={(props) => {\n if (CustomComponent) {\n return <CustomComponent {...props} />;\n }\n return <PaidTimeOff {...props} />;\n }}\n />\n );\n },\n },\n },\n },\n };\n }, [\n options?.jsfModify?.fields?.risk_assesment_info,\n options?.jsfModify?.fields?.proposed_termination_date_info,\n options?.jsfModify?.fields?.proposed_termination_date,\n options?.jsfModify?.fields?.paid_time_off_info,\n formValues.proposed_termination_date,\n employmentId,\n employment,\n ]);\n\n const { data: terminationHeadlessForm, isLoading: isLoadingTermination } =\n useTerminationSchema({\n formValues: formValues,\n jsfModify: {\n ...options?.jsfModify,\n fields: {\n ...options?.jsfModify?.fields,\n ...customFields?.fields,\n },\n },\n step: stepState.currentStep.name,\n });\n\n const entireTerminationSchema = createHeadlessForm(jsonSchema.data.schema);\n\n const createTermination = useCreateTermination();\n const { mutateAsync } = mutationToPromise(createTermination);\n\n async function onSubmit(values: TerminationFormValues) {\n if (!employmentId) {\n throw new Error('Employment id is missing');\n }\n\n if (terminationHeadlessForm) {\n // this is a hack because I need to validate all form values with the entire schema\n const parsedValues = parseJSFToValidate(\n values,\n entireTerminationSchema.fields,\n { isPartialValidation: true },\n );\n\n const { customer_informed_employee: customerInformedEmployee } =\n parsedValues;\n\n const employeeAwareness =\n customerInformedEmployee === 'yes'\n ? {\n employee_awareness: {\n date: parsedValues.customer_informed_employee_date,\n note: parsedValues.customer_informed_employee_description,\n },\n }\n : undefined;\n\n const radioFieldKeys = [\n 'agrees_to_pto_amount',\n 'confidential',\n 'customer_informed_employee',\n 'will_challenge_termination',\n ];\n\n const parsedRadioValues = parseFormRadioValues(\n parsedValues,\n radioFieldKeys,\n );\n\n const normalizedValues = omit(\n parsedRadioValues,\n 'customer_informed_employee_date',\n 'customer_informed_employee_description',\n );\n\n const terminationDetails: TerminationDetailsParams = omitBy(\n {\n ...normalizedValues,\n ...employeeAwareness,\n },\n isNull,\n ) as unknown as TerminationDetailsParams;\n\n const terminationPayload: CreateOffboardingParams = {\n employment_id: employmentId,\n termination_details: terminationDetails,\n type: 'termination',\n };\n\n return mutateAsync(terminationPayload);\n }\n\n return;\n }\n\n function back() {\n previousStep();\n }\n\n function next() {\n nextStep();\n }\n\n return {\n /**\n * Employment id passed useful to be used between components\n */\n employmentId,\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState,\n /**\n * Array of form fields from the contract amendment schema\n */\n fields: terminationHeadlessForm?.fields || [],\n /**\n * Loading state indicating if the termination schema is being fetched\n */\n isLoading: isLoadingTermination,\n /**\n * Loading state indicating if a contract amendment mutation is in progress\n */\n isSubmitting: createTermination.isPending,\n /**\n * Initial form values\n */\n initialValues: initialValues,\n /**\n * Function to validate form values against the contract amendment schema\n * @param values - Form values to validate\n * @returns Validation result or null if no schema is available\n */\n handleValidation: (values: TerminationFormValues) => {\n if (terminationHeadlessForm) {\n const parsedValues = parseJSFToValidate(\n values,\n terminationHeadlessForm?.fields,\n );\n return terminationHeadlessForm?.handleValidation(parsedValues);\n }\n return null;\n },\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: (values: Partial<TerminationFormValues>) => {\n if (entireTerminationSchema) {\n const parsedValues = parseJSFToValidate(\n values,\n entireTerminationSchema?.fields,\n { isPartialValidation: true },\n );\n setFieldValues(parsedValues as TerminationFormValues);\n }\n },\n /**\n * Function to parse form values before submission\n * @param values - Form values to parse\n * @returns Parsed form values\n */\n parseFormValues: (values: TerminationFormValues) => {\n return parseJSFToValidate(values, entireTerminationSchema.fields, {\n isPartialValidation: true,\n });\n },\n /**\n * Function to handle form submission\n * @param values - Form values to submit\n * @returns Promise resolving to the mutation result\n */\n onSubmit,\n\n /**\n * Function to handle going back to the previous step\n * @returns {void}\n */\n back,\n\n /**\n * Function to handle going to the next step\n * @returns {void}\n */\n next,\n };\n};\n","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"],"mappings":"ujBAAA,OAAmB,sBAAAA,MAA0B,8BAC7C,OAAOC,MAAY,gBACnB,OAAOC,MAAY,gBACnB,OAAS,UAAAC,MAAc,WACvB,OAAS,WAAAC,MAAe,QAWxB,OAAOC,MAAU,cCcT,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,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AwB,OAAQ,CAChE,oBAAqB,EACvB,CAAC,EAHc,mBAUjB,SAAAO,EAMA,KAAAa,EAMA,KAAAC,CACF,CACF,EAjS8B","names":["createHeadlessForm","omitBy","isNull","format","useMemo","omit","jsx","jsxs","createInformationField","title","description","options","__name","cn","Fragment","jsx","jsxs","buildInitialValues","stepsInitialValues","__name","useTermination","employmentId","options","terminationInitialValues","fieldValues","setFieldValues","stepState","previousStep","nextStep","useStepState","STEPS","employment","useEmploymentQuery","initialValues","formValues","useMemo","customFields","createInformationField","ZendeskTriggerButton","zendeskArticles","cn","format","CustomComponent","PaidTimeOffContainer","props","PaidTimeOff","terminationHeadlessForm","isLoadingTermination","useTerminationSchema","entireTerminationSchema","createHeadlessForm","jsonSchema","createTermination","useCreateTermination","mutateAsync","mutationToPromise","onSubmit","values","parsedValues","parseJSFToValidate","customerInformedEmployee","employeeAwareness","parsedRadioValues","parseFormRadioValues","normalizedValues","omit","terminationDetails","omitBy","isNull","back","next"]}
|
package/dist/chunk-IUZ7DEXC.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as y}from"./chunk-32GSS4UM.js";import{a as l}from"./chunk-HFI2MD3H.js";import{a as m}from"./chunk-MP2T74PU.js";import{c}from"./chunk-CNDSIADP.js";import{a as t}from"./chunk-P37U34EQ.js";import{useEffect as N}from"react";import{Fragment as b,jsx as v,jsxs as C}from"react/jsx-runtime";var R=t(({currencies:{from:d,to:F},shouldSwapOrder:s,salary_conversion_properties:a,conversionType:_="no_spread",defaultValue:r,...e})=>{let{setValue:n,getValues:i}=c(),f={label:a?.label||"Salary conversion",description:a?.description||C(b,{children:["The conversion is based on the Remote FX rate."," ",v(m,{className:"text-sm",zendeskId:y.remoteFxRate,children:"Learn more \u2197"})]})},g=s?"salary_conversion":e.name,u=s?e.name:"salary_conversion";return N(()=>{if(s){let o=i(e.name);o?(n("salary_conversion",o),n("salary_converted","salary_conversion")):r&&(n("salary_conversion",r),n("salary_converted","salary_conversion"))}else{let o=i("salary_conversion");o?(n(e.name,o),n("salary_converted",e.name)):r&&(n(e.name,r),n("salary_converted",e.name))}},[s,r,n,i,e.name]),v(l,{...e,sourceCurrency:d,targetCurrency:F,mainFieldName:g,conversionFieldName:u,conversionProperties:f,classNamePrefix:"RemoteFlows-Salary",conversionType:_})},"SalaryField");export{R as a};
|
|
2
|
-
//# sourceMappingURL=chunk-IUZ7DEXC.js.map
|
package/dist/chunk-MP2T74PU.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as b,b as h,d as C,e as Z,f as v,g as y}from"./chunk-TWIUL2P3.js";import{g}from"./chunk-3O3Q24JL.js";import{b as w,d as f}from"./chunk-3ZWDIEEM.js";import{a as k,f as D}from"./chunk-43WMZDDH.js";import{a as e}from"./chunk-P37U34EQ.js";import{useQuery as F}from"@tanstack/react-query";var x=e((r,a)=>{let{client:s}=f();return F({queryKey:["zendesk-article",r],queryFn:e(async()=>{let t=await g({client:s,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,...a})},"useZendeskArticle");import{jsx as n,jsxs as l}from"react/jsx-runtime";var N=e(r=>`https://support.remote.com/hc/en-us/articles/${r}`,"buildZendeskURL"),T=e(({Trigger:r,zendeskId:a,open:s,onClose:t})=>{let{components:o}=w(),i=N(a),d=e(()=>{t?.()},"handleClose"),{data:c,isLoading:m,error:p}=x(a,{enabled:s}),u=o?.zendeskDrawer;return u?n(u,{open:s,onClose:d,data:c,isLoading:m,error:p,zendeskURL:i,Trigger:r}):l(b,{open:s,onOpenChange:R=>!R&&d(),direction:"right",children:[n(h,{asChild:!0,children:r}),n(C,{className:"h-full w-[540px] mt-0 ml-auto RemoteFlows_ZendeskDrawer",children:l("div",{className:"h-full flex flex-col",children:[l(Z,{children:[n(v,{children:c?.title}),l(y,{children:["For more details see our"," ",n("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:"help article"})," "]})]}),m&&n("div",{children:"Loading..."}),p&&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:c?.body||""}})]})})]})},"ZendeskDrawer");import{useState as L}from"react";import{jsx as _}from"react/jsx-runtime";function $({zendeskId:r,className:a,onClick:s,children:t}){let[o,i]=L(!1);return _(T,{zendeskId:r,open:o,onClose:()=>i(!1),Trigger:_("button",{onClick:e(()=>{i(!0),s?.(r)},"handleClick"),className:k("RemoteFlows__ZendeskTriggerButton text-blue-500 hover:underline inline-block mt-1 text-xs bg-transparent border-none cursor-pointer p-0",a),children:t})})}e($,"ZendeskTriggerButton");export{$ as a};
|
|
2
|
-
//# sourceMappingURL=chunk-MP2T74PU.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/shared/zendesk-drawer/api.ts","../src/components/shared/zendesk-drawer/ZendeskDrawer.tsx","../src/components/shared/zendesk-drawer/ZendeskTriggerButton.tsx"],"sourcesContent":["import { getShowHelpCenterArticle } from '@/src/client';\nimport { useClient } from '@/src/context';\nimport { sanitizeHtmlWithImageErrorHandling } from '@/src/lib/utils';\nimport { Client } from '@hey-api/client-fetch';\nimport { useQuery } from '@tanstack/react-query';\n\nexport const useZendeskArticle = (\n zendeskId: number | null,\n queryOptions?: { enabled?: boolean },\n) => {\n const { client } = useClient();\n return useQuery({\n queryKey: ['zendesk-article', zendeskId],\n queryFn: async () => {\n const response = await getShowHelpCenterArticle({\n client: client as Client,\n path: {\n id: Number(zendeskId),\n },\n });\n\n if (response.error) {\n throw new Error(response.error.message || 'Failed to fetch article');\n }\n\n return response;\n },\n select: (data) => {\n const article = data.data?.data.help_center_article;\n if (article) {\n return {\n ...article,\n body: sanitizeHtmlWithImageErrorHandling(article.body || ''),\n };\n }\n return article;\n },\n retry: false,\n ...queryOptions,\n });\n};\n","import { useZendeskArticle } from '@/src/components/shared/zendesk-drawer/api';\nimport {\n Drawer,\n DrawerTrigger,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n} from '@/src/components/ui/drawer';\nimport { useFormFields } from '@/src/context';\n\nexport type ZendeskDrawerProps = {\n Trigger: React.ReactElement;\n zendeskId: number;\n open: boolean;\n onClose: () => void;\n};\n\nconst buildZendeskURL = (zendeskId: number) => {\n return `https://support.remote.com/hc/en-us/articles/${zendeskId}`;\n};\n\nexport const ZendeskDrawer = ({\n Trigger,\n zendeskId,\n open,\n onClose,\n}: ZendeskDrawerProps) => {\n const { components } = useFormFields();\n const zendeskURL = buildZendeskURL(zendeskId);\n\n const handleClose = () => {\n onClose?.();\n };\n\n const { data, isLoading, error } = useZendeskArticle(zendeskId, {\n enabled: open,\n });\n\n const CustomZendeskDrawer = components?.zendeskDrawer;\n\n if (CustomZendeskDrawer) {\n return (\n <CustomZendeskDrawer\n open={open}\n onClose={handleClose}\n data={data}\n isLoading={isLoading}\n error={error}\n zendeskURL={zendeskURL}\n Trigger={Trigger}\n />\n );\n }\n\n return (\n <Drawer\n open={open}\n onOpenChange={(open) => !open && handleClose()}\n direction='right'\n >\n <DrawerTrigger asChild>{Trigger}</DrawerTrigger>\n <DrawerContent className='h-full w-[540px] mt-0 ml-auto RemoteFlows_ZendeskDrawer'>\n <div className='h-full flex flex-col'>\n <DrawerHeader>\n <DrawerTitle>{data?.title}</DrawerTitle>\n <DrawerDescription>\n For more details see our{' '}\n <a href={zendeskURL} target='_blank' rel='noopener noreferrer'>\n help article\n </a>{' '}\n </DrawerDescription>\n </DrawerHeader>\n {isLoading && <div>Loading...</div>}\n {error && (\n <div className='text-sm p-4 text-red-500'>\n Error loading article\n </div>\n )}\n <div\n className='flex-1 overflow-y-auto p-4 RemoteFlows_ZendeskDrawer__Content'\n dangerouslySetInnerHTML={{\n __html: data?.body || '',\n }}\n ></div>\n </div>\n </DrawerContent>\n </Drawer>\n );\n};\n","import { cn } from '@/src/lib/utils';\nimport { ZendeskDrawer } from './ZendeskDrawer';\nimport { useState } from 'react';\n\ninterface ZendeskTriggerButtonProps {\n zendeskId: number;\n className?: string;\n onClick?: (zendeskId: number) => void;\n children?: React.ReactNode;\n}\n\nexport function ZendeskTriggerButton({\n zendeskId,\n className,\n onClick,\n children,\n}: ZendeskTriggerButtonProps) {\n const [isOpen, setIsOpen] = useState(false);\n\n const handleClick = () => {\n setIsOpen(true);\n onClick?.(zendeskId);\n };\n\n return (\n <ZendeskDrawer\n zendeskId={zendeskId}\n open={isOpen}\n onClose={() => setIsOpen(false)}\n Trigger={\n <button\n onClick={handleClick}\n className={cn(\n 'RemoteFlows__ZendeskTriggerButton text-blue-500 hover:underline inline-block mt-1 text-xs bg-transparent border-none cursor-pointer p-0',\n className,\n )}\n >\n {children}\n </button>\n }\n />\n );\n}\n"],"mappings":"oPAIA,OAAS,YAAAA,MAAgB,wBAElB,IAAMC,EAAoBC,EAAA,CAC/BC,EACAC,IACG,CACH,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAU,EAC7B,OAAOC,EAAS,CACd,SAAU,CAAC,kBAAmBJ,CAAS,EACvC,QAASD,EAAA,SAAY,CACnB,IAAMM,EAAW,MAAMC,EAAyB,CAC9C,OAAQJ,EACR,KAAM,CACJ,GAAI,OAAOF,CAAS,CACtB,CACF,CAAC,EAED,GAAIK,EAAS,MACX,MAAM,IAAI,MAAMA,EAAS,MAAM,SAAW,yBAAyB,EAGrE,OAAOA,CACT,EAbS,WAcT,OAAQN,EAACQ,GAAS,CAChB,IAAMC,EAAUD,EAAK,MAAM,KAAK,oBAChC,OAAIC,GACK,CACL,GAAGA,EACH,KAAMC,EAAmCD,EAAQ,MAAQ,EAAE,CAC7D,CAGJ,EATQ,UAUR,MAAO,GACP,GAAGP,CACL,CAAC,CACH,EAlCiC,qBCqC3B,cAAAS,EAuBM,QAAAC,MAvBN,oBAzBN,IAAMC,EAAkBC,EAACC,GAChB,gDAAgDA,CAAS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AS,EAAIC,EAAS,EAAK,EAO1C,OACER,EAACS,EAAA,CACC,UAAWP,EACX,KAAMI,EACN,QAAS,IAAMC,EAAU,EAAK,EAC9B,QACEP,EAAC,UACC,QAZYU,EAAA,IAAM,CACxBH,EAAU,EAAI,EACdH,IAAUF,CAAS,CACrB,EAHoB,eAaZ,UAAWS,EACT,0IACAR,CACF,EAEC,SAAAE,EACH,EAEJ,CAEJ,CA/BgBK,EAAAT,EAAA","names":["useQuery","useZendeskArticle","__name","zendeskId","queryOptions","client","useClient","useQuery","response","getShowHelpCenterArticle","data","article","sanitizeHtmlWithImageErrorHandling","jsx","jsxs","buildZendeskURL","__name","zendeskId","ZendeskDrawer","Trigger","open","onClose","components","useFormFields","zendeskURL","handleClose","data","isLoading","error","useZendeskArticle","CustomZendeskDrawer","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","useState","jsx","ZendeskTriggerButton","zendeskId","className","onClick","children","isOpen","setIsOpen","useState","ZendeskDrawer","__name","cn"]}
|
package/dist/chunk-NVYMAOQ7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as R,b as x,c as N,d as A}from"./chunk-DTHBG6BD.js";import{a as T}from"./chunk-ZE3YT3Q6.js";import{a as f}from"./chunk-32GSS4UM.js";import{a as C}from"./chunk-AFRA4BIW.js";import{a as w}from"./chunk-MP2T74PU.js";import{b as B}from"./chunk-WVDTHFGS.js";import{a as i,b as n,e as F}from"./chunk-43WMZDDH.js";import{a as d}from"./chunk-P37U34EQ.js";import{MoreHorizontal as G}from"lucide-react";import{useState as P}from"react";import{Fragment as U,jsx as g,jsxs as E}from"react/jsx-runtime";function L({actions:e=[],className:r,label:l,"data-testid":a}){let[_,m]=P(!1);return E("div",{className:i("relative",r),children:[g(B,{"data-testid":a,variant:"ghost","aria-label":l,className:"h-8 w-8 p-0",onClick:()=>m(!_),children:g(G,{className:"h-4 w-4"})}),_&&E(U,{children:[g("div",{className:"fixed inset-0 z-40",onClick:()=>m(!1)}),g("div",{className:"absolute right-0 top-1/2 mt-1 bg-white border border-gray-200 rounded-md shadow-lg z-50 min-w-[120px]",children:e.map((c,u)=>g("button",{"data-testid":`${a}-${c.label.toLowerCase().replace(" ","-")}`,className:i("w-full text-left px-2 py-1.5 text-sm hover:bg-gray-100",c.disabled&&"opacity-50 cursor-not-allowed"),onClick:()=>{c.onClick(),m(!1)},disabled:c.disabled,children:c.label},u))})]})]})}d(L,"ActionsDropdown");import{ChevronDown as S,Info as $}from"lucide-react";import j from"react-flagpack";import{useState as O}from"react";import{Fragment as b,jsx as o,jsxs as t}from"react/jsx-runtime";var Z={GB:"GB-UKM"},K=d(({title:e,country:r,region:l,annualGrossSalary:a,onDelete:_,onExportPdf:m,onEdit:c})=>{let u=[{label:"Edit",onClick:c},{label:"Export",onClick:m},{label:"Delete",onClick:_}];return t("div",{className:"RemoteFlows__EstimationResults__Header flex justify-between",children:[t("div",{className:"flex flex-row items-center gap-6",children:[o("div",{className:"RemoteFlows__EstimationResultsHeader__FlagContainer flex h-16 w-16 items-center justify-center rounded-lg bg-[#F4F4F5]",children:o(j,{code:Z[r.alpha_2_code]||r.alpha_2_code})}),t("div",{className:"space-y-1",children:[o("h2",{"data-testid":"estimation-results-header-title",className:"RemoteFlows__EstimationResultsHeader__Title text-lg font-medium leading-none text-[#181818]",children:e}),t("p",{className:"RemoteFlows__EstimationResultsHeader__Country text-xs text-[#71717A]",children:[r.name," ",l?` (${l.name})`:""]}),t("p",{"data-testid":"estimation-results-header-annual-gross-salary",className:"RemoteFlows__EstimationResultsHeader__AnnualGrossSalary text-xs text-[#71717A]",children:[o("span",{className:"text-[#181818]",children:"Employee annual gross salary:"})," ",a]})]})]}),o(L,{label:"Actions",className:"RemoteFlows__EstimationResults__ActionsDropdown",actions:u})]})},"EstimationResultsHeader"),V=d(()=>({steps:[{id:"add-employment-details",title:"Add employment details",description:"You add employee employments details."},{id:"invite-employee",title:"Invite employee",description:"Hire receives an email invitation from Remote to start the self-enrollment process."},{id:"verify-information",title:"Verify information",description:"Remote prepares the Employment Agreement and verifies all the information."},{id:"sign-contract",title:"Sign contract",description:"All parties sign the Employment Agreement and are ready to start. \u{1F389}"}],helpText:"For customers who accept Remote's Terms of Service (ToS), the employee onboarding timeline starts once the employee has been invited to the platform and completed self enrollment.",zendeskArticleId:f.employeeOnboardingTimeline}),"getOnboardingTimelineData");function Y({minimumOnboardingDays:e,data:r,className:l}){return o(R,{type:"single",collapsible:!0,className:i("RemoteFlows__EstimationResults__OnboardingTimeline w-full",l),children:t(x,{value:"timeline",className:"RemoteFlows__OnboardingTimeline__AccordionItem border-border",children:[o(N,{className:"RemoteFlows__OnboardingTimeline__AccordionTrigger hover:no-underline px-0 py-4",children:t("div",{className:"flex items-center justify-between w-full",children:[o("span",{className:"RemoteFlows__OnboardingTimeline__Title text-base font-medium text-[#0F172A]",children:"Onboarding timeline"}),e!=null&&t("span",{className:"RemoteFlows__OnboardingTimeline__Description text-base text-muted-foreground mr-4",children:[e," days"]})]})}),t(A,{className:"px-0 pb-4",children:[o("ul",{className:"RemoteFlows__OnboardingTimeline__List list-disc list-inside space-y-2",children:r.steps.map(a=>t("li",{children:[o("strong",{className:"font-medium text-[#09090B]",children:a.title})," ","- ",a.description]},a.id))}),t("p",{className:"RemoteFlows__OnboardingTimeline__HelpText text-xs text-muted-foreground mt-4",children:[r.helpText,r.zendeskArticleId&&o(w,{zendeskId:r.zendeskArticleId,children:"Learn more"})]})]})]})})}d(Y,"OnboardingTimeline");function q({className:e,countryBenefitsUrl:r,countryGuideUrl:l,country:a}){return o(R,{type:"single",collapsible:!0,className:i("RemoteFlows__EstimationResults__HiringSection w-full",e),children:t(x,{value:"timeline",className:"RemoteFlows__HiringSection__AccordionItem border-border",children:[o(N,{className:"RemoteFlows__HiringSection__AccordionTrigger hover:no-underline px-0 py-4",children:o("div",{className:"flex items-center justify-between w-full",children:t("span",{className:"text-base font-medium text-[#0F172A]",children:["Hiring in ",a.name]})})}),o(A,{children:t("div",{className:"flex flex-col gap-1",children:[l&&o("a",{href:l,target:"_blank",className:"RemoteFlows__Link",children:"Explore our complete guide \u2197"}),r&&o("a",{href:r,target:"_blank",className:"RemoteFlows__Link",children:"Explore our available benefits \u2197"})]})})]})})}d(q,"HiringSection");function J({isMultipleCurrency:e,className:r}){return t("div",{className:i("RemoteFlows__EstimationResults__Headers grid grid-cols-3 items-center",r),children:[o("span",{"aria-hidden":!0}),e?t(b,{children:[o("span",{className:"RemoteFlows__EstimationResults__Headers__Label",children:"Employee currency"}),o("span",{className:"RemoteFlows__EstimationResults__Headers__Label",children:"Employer currency"})]}):t(b,{children:[o("span",{}),o("span",{className:"RemoteFlows__EstimationResults__Headers__Label",children:"Amount"})]})]})}d(J,"EstimationHeaders");function I({label:e,amounts:r,className:l,children:a}){let[_,m]=O(!0);return t("div",{className:i("RemoteFlows__EstimationResults__Row",l),children:[t("div",{className:"RemoteFlows__EstimationRow__Grid grid grid-cols-3 items-center",children:[t("div",{className:"RemoteFlows__EstimationRow__LabelContainer flex items-center gap-2",children:[o("span",{className:i("RemoteFlows__EstimationRow__Title min-w-[140px] font-medium text-[#09090B]"),children:e}),o("button",{onClick:()=>m(!_),className:"RemoteFlows__EstimationRow__CollapseButton p-1 hover:bg-gray-100 rounded",children:o(S,{className:`h-4 w-4 text-muted-foreground transition-transform ${_?"rotate-180":""}`})})]}),Array.isArray(r)?r.map((c,u)=>o("span",{className:i("RemoteFlows__EstimationRow__RegionalAmount text-right font-medium text-[#09090B]"),children:c},u)):t(b,{children:[o("span",{}),o("span",{className:i("RemoteFlows__EstimationRow__EmployerAmount text-right font-medium text-[#09090B]"),children:r})]})]}),_&&a&&o("div",{className:"RemoteFlows__EstimationRow__CollapsibleContent mt-4",children:a})]})}d(I,"EstimationRow");function Q({item:e,isMultipleCurrency:r,level:l=0}){let[a,_]=O(!1),m=e.children&&e.children.length>0,c=l>0,u=e.isCollapsible||m;return t("li",{className:i("RemoteFlows__BreakdownList__Item pb-3",c&&"pb-1"),children:[t("div",{className:i(r?"RemoteFlows__BreakdownList__Grid grid grid-cols-3 items-center justify-between":"RemoteFlows__BreakdownList__Grid grid grid-cols-2 items-center justify-between"),children:[t("div",{className:i("RemoteFlows__BreakdownList__LabelContainer flex items-center gap-2",c&&"pl-3"),children:[!c&&o("span",{className:"RemoteFlows__BreakdownList__Bullet w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0","aria-hidden":"true"}),u?t("button",{onClick:()=>_(!a),className:"RemoteFlows__BreakdownList__CollapseButton flex items-center gap-2 hover:bg-gray-100 rounded p-1",children:[o("span",{className:i(c?"RemoteFlows__BreakdownList__Text--Nested text-xs text-[#71717A]":"RemoteFlows__BreakdownList__Text--NotNested text-sm text-[#09090B]"),children:e.label}),o(S,{className:`RemoteFlows__BreakdownList__ChevronDown h-3 w-3 text-muted-foreground transition-transform ${a?"rotate-180":""}`})]}):o("span",{className:i(c?"RemoteFlows__BreakdownList__Text--Nested text-xs text-[#71717A]":"RemoteFlows__BreakdownList__Text--NotNested text-sm text-[#09090B] p-1"),children:e.label}),e.tooltip&&o(T,{content:t(b,{children:[o("span",{dangerouslySetInnerHTML:{__html:F(e.tooltip)}})," ",e.zendeskId&&o(w,{zendeskId:Number(e.zendeskId),children:"Learn more"})]}),children:o("button",{className:"RemoteFlows__BreakdownList__InfoButton p-1 hover:bg-gray-100 rounded",children:o($,{className:i("RemoteFlows__BreakdownList__InfoButton__Icon text-muted-foreground",c?"h-3 w-3":"h-4 w-4")})})})]}),r?t(b,{children:[o("span",{"data-testid":e.dataSelector&&e.dataSelector+"-employee-amount",className:i("RemoteFlows__BreakdownList__RegionalAmountText text-sm text-right",c?"RemoteFlows__BreakdownList__RegionalAmountText--Nested text-[#71717A]":"RemoteFlows__BreakdownList__RegionalAmountText--NotNested text-[#09090B]"),children:e.regionalAmount||"\u2014"}),o("span",{"data-testid":e.dataSelector&&e.dataSelector+"-employer-amount",className:i("RemoteFlows__BreakdownList__EmployerAmountText text-sm text-right",c?"RemoteFlows__BreakdownList__EmployerAmountText--Nested text-[#71717A]":"RemoteFlows__BreakdownList__EmployerAmountText--NotNested text-[#09090B]"),children:e.employerAmount||"\u2014"})]}):o("span",{"data-testid":e.dataSelector,className:i("RemoteFlows__BreakdownList__RegionalAmountText text-sm text-right",c?"RemoteFlows__BreakdownList__RegionalAmountText--Nested text-[#71717A]":"RemoteFlows__BreakdownList__RegionalAmountText--NotNested text-[#09090B]"),children:e.regionalAmount||"\u2014"})]}),m&&a&&o("div",{className:"mt-1",children:o(k,{items:e.children,isMultipleCurrency:r,level:l+1})})]})}d(Q,"BreakdownListItem");function k({items:e,isMultipleCurrency:r,className:l,level:a}){return o("ul",{className:i("RemoteFlows__BreakdownList list-none",l),children:e.map((_,m)=>o(Q,{item:_,isMultipleCurrency:r,level:a},m))})}d(k,"BreakdownList");var pe=d(({estimation:e,title:r,components:l,onDelete:a,onExportPdf:_,onEdit:m})=>{let c=l?.HiringSection||q,u=l?.OnboardingTimeline||Y,z=l?.Header||K,h=l?.Footer,H=V(),p=e.employer_currency_costs.currency.code!==e.regional_currency_costs.currency.code,v=e.employer_currency_costs.monthly_management_fee,D=e.region.code!==e.country.code,M=n(e.regional_currency_costs.annual_gross_salary,e.regional_currency_costs.currency.symbol);return t(C,{className:"RemoteFlows__EstimationResults__Card p-10",children:[o("div",{className:"RemoteFlows__Separator",children:o(z,{title:r,annualGrossSalary:M,region:D?e.region:void 0,country:e.country,onDelete:a,onExportPdf:_,onEdit:m})}),t("div",{className:"RemoteFlows__Separator",children:[o(J,{isMultipleCurrency:p,className:"mb-3"}),o(I,{label:"Monthly total cost",amounts:p?[n(e.regional_currency_costs.monthly_total,e.regional_currency_costs.currency.symbol),n(e.employer_currency_costs.monthly_total,e.employer_currency_costs.currency.symbol)]:n(e.regional_currency_costs.monthly_total,e.regional_currency_costs.currency.symbol),children:o(k,{items:[{label:"Gross monthly salary",regionalAmount:n(e.regional_currency_costs.monthly_gross_salary,e.regional_currency_costs.currency.symbol),employerAmount:n(e.employer_currency_costs.monthly_gross_salary,e.employer_currency_costs.currency.symbol),zendeskId:f.extraPayments.toString(),tooltip:"This country respects extra payments on top of the gross salary."},{label:"Mandatory employer costs",regionalAmount:n(e.regional_currency_costs.monthly_contributions_total,e.regional_currency_costs.currency.symbol),employerAmount:n(e.employer_currency_costs.monthly_contributions_total,e.employer_currency_costs.currency.symbol),children:e.employer_currency_costs.monthly_contributions_breakdown?.map((s,y)=>({label:s.name,regionalAmount:n(e.regional_currency_costs.monthly_contributions_breakdown?.[y]?.amount,e.regional_currency_costs.currency.symbol),employerAmount:n(s.amount,e.employer_currency_costs.currency.symbol),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},{label:"Benefits",regionalAmount:n(e.regional_currency_costs.monthly_benefits_total,e.regional_currency_costs.currency.symbol),employerAmount:n(e.employer_currency_costs.monthly_benefits_total,e.employer_currency_costs.currency.symbol),children:e.employer_currency_costs.monthly_benefits_breakdown?.map((s,y)=>({label:s.name,regionalAmount:n(e.regional_currency_costs.monthly_benefits_breakdown?.[y]?.amount,e.regional_currency_costs.currency.symbol),employerAmount:n(s.amount,e.employer_currency_costs.currency.symbol),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},...v?[{label:"Monthly fee",regionalAmount:n(e.regional_currency_costs.monthly_management_fee,e.regional_currency_costs.currency.symbol),employerAmount:n(e.employer_currency_costs.monthly_management_fee,e.employer_currency_costs.currency.symbol),tooltip:"Discounts may be available based on your commitment and team size. Speak to your account or customer success manager to learn more."}]:[]],isMultipleCurrency:p})})]}),o("div",{className:"RemoteFlows__Separator",children:o(I,{label:"Annual total cost",amounts:p?[n(e.regional_currency_costs.annual_total,e.regional_currency_costs.currency.symbol),n(e.employer_currency_costs.annual_total,e.employer_currency_costs.currency.symbol)]:n(e.regional_currency_costs.annual_total,e.regional_currency_costs.currency.symbol),children:o(k,{items:[{label:"Gross annual salary",dataSelector:"annual-gross-salary",regionalAmount:n(e.regional_currency_costs.annual_gross_salary,e.regional_currency_costs.currency.symbol),employerAmount:n(e.employer_currency_costs.annual_gross_salary,e.employer_currency_costs.currency.symbol)},{label:"Mandatory employer costs",regionalAmount:n(e.regional_currency_costs.annual_contributions_total,e.regional_currency_costs.currency.symbol),employerAmount:n(e.employer_currency_costs.annual_contributions_total,e.employer_currency_costs.currency.symbol),children:e.employer_currency_costs.annual_contributions_breakdown?.map((s,y)=>({label:s.name,regionalAmount:n(e.regional_currency_costs.annual_contributions_breakdown?.[y]?.amount,e.regional_currency_costs.currency.symbol),employerAmount:n(s.amount,e.employer_currency_costs.currency.symbol),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},{label:"Benefits",regionalAmount:n(e.regional_currency_costs.annual_benefits_total,e.regional_currency_costs.currency.symbol),employerAmount:n(e.employer_currency_costs.annual_benefits_total,e.employer_currency_costs.currency.symbol),children:e.employer_currency_costs.annual_benefits_breakdown?.map((s,y)=>({label:s.name,regionalAmount:n(e.regional_currency_costs.annual_benefits_breakdown?.[y]?.amount,e.regional_currency_costs.currency.symbol),employerAmount:n(s.amount,e.employer_currency_costs.currency.symbol),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},{label:"Extra statutory payments",regionalAmount:n(e.regional_currency_costs.extra_statutory_payments_total,e.regional_currency_costs.currency.symbol),employerAmount:n(e.employer_currency_costs.extra_statutory_payments_total,e.employer_currency_costs.currency.symbol),children:e.employer_currency_costs.extra_statutory_payments_breakdown?.map((s,y)=>({label:s.name,regionalAmount:n(e.regional_currency_costs.extra_statutory_payments_breakdown?.[y]?.amount,e.regional_currency_costs.currency.symbol),employerAmount:n(s.amount,e.employer_currency_costs.currency.symbol),zendeskId:s.zendesk_article_id||void 0,tooltip:s.description||void 0}))||[]},...v?[{label:"Annual fee",regionalAmount:n(e.regional_currency_costs.annual_management_fee,e.regional_currency_costs.currency.symbol),employerAmount:n(e.employer_currency_costs.annual_management_fee,e.employer_currency_costs.currency.symbol),tooltip:"Discounts may be available based on your commitment and team size. Speak to your account or customer success manager to learn more."}]:[]],isMultipleCurrency:p})})}),o("div",{className:"RemoteFlows__Separator",children:o(u,{minimumOnboardingDays:e.minimum_onboarding_time,data:H})}),o(c,{countryBenefitsUrl:e.country_benefits_details_url,countryGuideUrl:e.country_guide_url,country:e.country}),h&&o(h,{})]})},"EstimationResults");export{pe as a};
|
|
2
|
-
//# sourceMappingURL=chunk-NVYMAOQ7.js.map
|
package/dist/chunk-Q3A4A2HL.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./chunk-GC23RRCI.js";import{a as i}from"./chunk-XSHHMBMT.js";import{a as o}from"./chunk-N6G4VZXF.js";import{a as m}from"./chunk-4T6PRR6R.js";var p={employee_communication:o,termination_details:e,paid_time_off:m,additional_information:i};export{p as a};
|
|
2
|
-
//# sourceMappingURL=chunk-Q3A4A2HL.js.map
|
package/dist/chunk-QEWB24WT.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as B}from"./chunk-BV3PGYSH.js";import{a as ye,b as Ge,c as Je,d as qe,e as Ke,f as Ye,g as je,h as Ze,i as Xe,j as Ce,k as et,l as xe,m as be,o as Se,q as tt,r as ot,s as rt}from"./chunk-D6X2WCEG.js";import{b as Qe}from"./chunk-HPHWQU34.js";import{a as _e}from"./chunk-MP2T74PU.js";import{a as ve,b as $}from"./chunk-WVDTHFGS.js";import{b as S}from"./chunk-3ZWDIEEM.js";import{a as ne,b as ae,c as b,d as Ae,e as Oe,f as Ue,g as ze,h as k,i as w,j as N,k as R,l as P,m as D}from"./chunk-CNDSIADP.js";import{g as Ve}from"./chunk-PAQW5BFW.js";import{a as h,e as oe}from"./chunk-43WMZDDH.js";import{a as r}from"./chunk-P37U34EQ.js";import{Fragment as wo,useEffect as Ro,useRef as Ht}from"react";import{Fragment as Ot,jsx as A,jsxs as se}from"react/jsx-runtime";function le({name:e,defaultValue:t,description:n,label:o,onChange:s,multiple:d,options:c,component:F,...f}){let{components:l}=S(),{control:a}=b(),u=r((m,i,g)=>{let p=g.value?[...g.value]:[];i?p.includes(m)||g.onChange([...p,m]):g.onChange(p.filter(y=>y!==m))},"handleCheckboxChange");return A(k,{control:a,name:e,defaultValue:t,render:({field:m,fieldState:i})=>{let g=F||l?.checkbox;if(g){let p={name:e,description:n,label:o,defaultValue:t,multiple:d,options:c,...f};return A(g,{field:{...m,onChange:r(y=>{if(d){let{checked:x,value:v}=y.target;u(v,x,m),s?.(x);return}m.onChange(y),s?.(y)},"onChange")},fieldState:i,fieldData:p})}return se(w,{"data-field":e,className:h(`RemoteFlows__CheckBoxField__Item__${e}`),children:[A(R,{children:se(Ot,{children:[c&&d?A(N,{children:o}):null,c&&d?c.map(p=>se("div",{className:"flex space-x-2",children:[A(ye,{id:p.value,onCheckedChange:y=>{u(p.value,y===!0,m),s?.(y,p.value)},checked:m.value?.includes(p.value),className:"RemoteFlows__CheckBox__Input"}),A(N,{htmlFor:p.value,className:"mb-0 RemoteFlows__CheckBox__Label",children:p.label})]},p.value)):se("div",{className:"flex space-x-2",children:[A(ye,{id:e,onCheckedChange:p=>{m.onChange(p),s?.(p)},checked:m.value,className:"RemoteFlows__CheckBox__Input"}),A(N,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label",children:o})]})]})}),n&&A(P,{children:n}),i.error&&A(D,{})]})}})}r(le,"CheckBoxField");import{CalendarIcon as Gt}from"lucide-react";import{PopoverClose as Jt}from"@radix-ui/react-popover";import{ChevronLeft as Ut,ChevronRight as Vt}from"lucide-react";import{DayPicker as zt}from"react-day-picker";import{jsx as ke}from"react/jsx-runtime";function nt({className:e,classNames:t,showOutsideDays:n=!0,...o}){return ke(zt,{showOutsideDays:n,className:h("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:h(ve({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:h("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",o.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:h(ve({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:r(({className:s,...d})=>ke(Ut,{className:h("size-4",s),...d}),"IconLeft"),IconRight:r(({className:s,...d})=>ke(Vt,{className:h("size-4",s),...d}),"IconRight")},...o})}r(nt,"Calendar");import*as U from"@radix-ui/react-popover";import{jsx as ie}from"react/jsx-runtime";function me({...e}){return ie(U.Root,{"data-slot":"popover",...e})}r(me,"Popover");function de({...e}){return ie(U.Trigger,{"data-slot":"popover-trigger",...e})}r(de,"PopoverTrigger");function ce({className:e,align:t="center",sideOffset:n=4,...o}){return ie(U.Portal,{children:ie(U.Content,{"data-slot":"popover-content",align:t,sideOffset:n,className:h("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),...o})})}r(ce,"PopoverContent");import{format as at,parse as qt}from"date-fns";import{Fragment as Kt,jsx as M,jsxs as Ne}from"react/jsx-runtime";function st({description:e,label:t,name:n,minDate:o,onChange:s,component:d,...c}){let{components:F}=S(),{control:f}=b(),l;return c.meta?.mot&&typeof c.meta.mot=="number"?l=Ve(c.meta.mot):o&&(l=qt(o,"yyyy-MM-dd",new Date)),M(k,{control:f,name:n,render:({field:a,fieldState:u})=>{let m=d||F?.date;if(m){let i={description:e,label:t,name:n,onChange:s,...l&&{minDate:l.toISOString()},...c};return M(m,{field:{...a,onChange:r(g=>{a.onChange(g),s?.(g)},"onChange")},fieldState:u,fieldData:i})}return Ne(w,{"data-field":n,className:`flex flex-col RemoteFlows__DatePickerField__Item__${n}`,children:[M(N,{className:"RemoteFlows__DatePickerField__Label",children:t}),Ne(me,{children:[M(de,{asChild:!0,children:M(R,{children:M("div",{children:Ne($,{type:"button",variant:"outline",className:h("w-full pl-3 text-left font-normal",!a.value&&"text-muted-foreground"),"data-testid":`date-picker-button-${n}`,children:[a.value&&M(Kt,{children:at(a.value,"yyyy-MM-dd")}),M(Gt,{className:"ml-auto h-4 w-4 opacity-50"})]})})})}),M(ce,{className:"w-auto p-0 RemoteFlows__DatepickerField__PopoverContent",align:"start",children:M(nt,{mode:"single",className:"RemoteFlows__DatepickerField__Calendar",selected:a.value?new Date(a.value):void 0,onSelect:i=>{a.onChange(i?at(i,"yyyy-MM-dd"):null),s?.(i)},defaultMonth:l,components:{DayContent:r(i=>M(Jt,{children:i.date.getDate()}),"DayContent")},...l&&{disabled:r(i=>i<l,"disabled")}})})]}),e?M(P,{children:e}):null,u.error&&M(D,{className:"RemoteFlows__DatePickerField__Error"})]})}})}r(st,"DatePickerField");import{useState as Yt,useRef as jt}from"react";import{Upload as Zt,X as Xt}from"lucide-react";import{jsx as V,jsxs as we}from"react/jsx-runtime";function lt({onChange:e,className:t,multiple:n}){let[o,s]=Yt([]),d=jt(null),c=r(l=>{l.preventDefault(),d.current?.click()},"handleClick"),F=r(l=>{if(l.target.files&&l.target.files.length>0){let a=Array.from(l.target.files);s(a),e(l)}},"handleChange"),f=r(l=>{s(a=>a.filter(u=>u!==l))},"onRemoveFile");return we("div",{className:h("flex flex-col items-start gap-4",t),children:[V("input",{type:"file",ref:d,onChange:F,className:"hidden","aria-label":"File upload",multiple:n}),we($,{type:"button",onClick:c,className:"gap-2",children:[V(Zt,{className:"h-4 w-4"}),"Choose File"]}),o.length===0&&V("div",{className:"text-sm",children:n?V("span",{className:"font-medium",children:"No files selected. You can select multiple files"}):V("span",{className:"font-medium",children:"No file selected."})}),o.length>0&&o.map((l,a)=>we("div",{className:"text-sm flex items-center gap-2",children:["Selected file: ",V("span",{className:"font-medium",children:l.name})," (",Math.round(l.size/1024)," KB)",V($,{variant:"ghost",onClick:()=>f(l),children:V(Xt,{})})]},a))]})}r(lt,"FileUploader");import{jsx as z,jsxs as eo}from"react/jsx-runtime";var Qt=r(e=>new Promise((t,n)=>{let o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result),o.onerror=s=>n(s)}),"toBase64"),it=r(async e=>{let t=e.target.files?Array.from(e.target.files):[];return await Promise.all(t.map(async o=>{let s=await Qt(o);return{name:o.name,content:s.split(",")[1]}}))},"convertFilesToBase64");function mt({name:e,description:t,label:n,multiple:o,onChange:s,component:d,...c}){let{components:F}=S(),{control:f}=b();return z(k,{control:f,name:e,render:({field:l,fieldState:a})=>{let u=d||F?.file;if(u){let m={name:e,description:t,label:n,multiple:o,...c};return z(u,{field:{...l,value:null,onChange:r(async i=>{let g=await it(i);l.onChange(g),s?.(g)},"onChange")},fieldState:a,fieldData:m})}return eo(w,{"data-field":e,className:`RemoteFlows__FileUpload__Item__${e}`,children:[z(N,{className:"RemoteFlows__FileUpload__Label",children:n}),z(R,{children:z(lt,{onChange:async m=>{let i=await it(m);l.onChange(i),s?.(i)},multiple:o,className:h("RemoteFlows__FileUpload__Input")})}),t&&z("div",{className:"flex items-center justify-between",children:z(P,{className:"RemoteFlows__FileUpload__Description",children:t})}),a.error&&z(D,{className:"RemoteFlows__FileUpload__Error"})]})}})}r(mt,"FileUploadField");import{jsx as Re}from"react/jsx-runtime";function ue(e){let{components:t}=S(),{control:n}=b(),o=e.component||t?.number;return o?Re(k,{control:n,name:e.name,render:({field:s,fieldState:d})=>Re(o,{field:{...s,onChange:r(c=>{s.onChange(c),e.onChange?.(c)},"onChange")},fieldState:d,fieldData:e})}):Re(B,{...e,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$"})}r(ue,"NumberField");import{Fragment as to}from"react";import{jsx as W,jsxs as Pe}from"react/jsx-runtime";function dt({name:e,defaultValue:t,description:n,label:o,options:s,onChange:d,component:c,...F}){let{components:f}=S(),{control:l}=b();return W(k,{control:l,name:e,defaultValue:t,render:({field:a,fieldState:u})=>{let m=c||f?.radio;if(m){let i={name:e,defaultValue:t,description:n,label:o,options:s,...F};return W(m,{field:{...a,onChange:r(g=>{a.onChange(g),d?.(g)},"onChange")},fieldState:u,fieldData:i})}return Pe(w,{className:h("space-y-3",`RemoteFlows__RadioGroupField__Item__${e}`),"data-field":e,children:[W(N,{children:o}),W(R,{children:W(Ge,{"aria-label":o||e,onValueChange:i=>{a.onChange(i),d?.(i)},value:a.value,className:"flex flex-col space-y-3",children:s?.map(i=>W(to,{children:Pe(w,{"data-field":e,className:"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item",children:[W(R,{children:W(Je,{value:i.value,className:"RemoteFlows__RadioField__Input",disabled:i.disabled})}),Pe("div",{children:[W(N,{className:"font-normal mb-0 RemoteFlows__RadioField__Label",children:i.label}),i.description&&W(P,{className:"mt-2",children:i.description})]})]})},i.value))})}),n&&W(P,{children:n}),u.error&&W(D,{})]})}})}r(dt,"RadioGroupField");import{jsx as E,jsxs as ct}from"react/jsx-runtime";function ut({label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,component:c,...F}){let{control:f}=b(),{components:l}=S();return E(k,{defaultValue:o,control:f,name:t,render:({field:a,fieldState:u})=>{let m=c||l?.select;if(m){let i={label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,...F};return E(m,{field:{...a,onChange:r(g=>{let p=F.jsonType==="number"?Number(g):g;a.onChange(p),d?.(p)},"onChange")},fieldState:u,fieldData:i})}return ct(w,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[E(N,{className:"RemoteFlows__SelectField__Label",children:e}),E(R,{children:E("div",{className:"relative",children:ct(qe,{value:a.value||"",onValueChange:i=>{let g=F.jsonType==="number"?Number(i):i;a.onChange(g),d?.(g)},children:[E(je,{className:"RemoteFlows__SelectField__Trigger","aria-invalid":!!u.error,"aria-label":e,children:E("span",{className:"absolute",children:E(Ye,{placeholder:e})})}),E(Ze,{className:"RemoteFlows__SelectField__Content",children:E(Ke,{className:"RemoteFlows__SelectField__Group",children:n.map(i=>E(Xe,{value:i.value,className:"RemoteFlows__SelectField__SelectItem",disabled:i.disabled,children:i.label},i.value))})})]})})}),s&&E(P,{children:s}),u.error&&E(D,{})]})}})}r(ut,"SelectField");import{useState as lo}from"react";import{Fragment as oo,useState as ro}from"react";import{Check as no,ChevronDownIcon as ao,X as so}from"lucide-react";import{Command as Y}from"cmdk";import{SearchIcon as tn}from"lucide-react";import{jsx as j,jsxs as an}from"react/jsx-runtime";function pt({className:e,...t}){return j(Y,{"data-slot":"command",className:h("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}r(pt,"Command");function ft({className:e,...t}){return j(Y.List,{"data-slot":"command-list",className:h("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}r(ft,"CommandList");function Ft({...e}){return j(Y.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}r(Ft,"CommandEmpty");function gt({className:e,...t}){return j(Y.Group,{"data-slot":"command-group",className:h("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})}r(gt,"CommandGroup");function ht({className:e,...t}){return j(Y.Separator,{"data-slot":"command-separator",className:h("bg-border -mx-1 h-px",e),...t})}r(ht,"CommandSeparator");function _t({className:e,...t}){return j(Y.Item,{"data-slot":"command-item",className:h("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})}r(_t,"CommandItem");import{jsx as L,jsxs as Z}from"react/jsx-runtime";function pe({options:e,selected:t,onChange:n,placeholder:o,...s}){let[d,c]=ro(!1),F=r(a=>{n(t.filter(u=>u.value!==a.value))},"handleUnselect"),f=e.some(a=>a.category),l=e.reduce((a,u)=>{let m=u.category||"Uncategorized";return a[m]||(a[m]=[]),a[m].push(u),a},{});return Z(me,{open:d,onOpenChange:c,...s,children:[L(de,{children:Z($,{variant:"outline",role:"combobox","aria-expanded":d,className:"w-full justify-between font-normal",type:"button",children:[L("div",{className:"flex gap-1 flex-wrap overflow-x-auto max-h-[2.5rem] items-center",children:t.length>0?t.map(a=>Z(Qe,{variant:"secondary",className:"mr-1 mb-1",children:[a.label,L("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:L(so,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},a.label)):L("span",{className:"text-foreground",children:o})}),L(ao,{className:"size-4"})]})}),L(ce,{align:"start",className:"w-full p-0",children:L(pt,{children:Z(ft,{children:[L(Ft,{children:"No item found."}),Object.entries(l).map(([a,u],m)=>Z(oo,{children:[m>0&&L(ht,{}),L(gt,{heading:f?a:void 0,children:u.map(i=>{let g=t.some(p=>p.value===i.value);return Z(_t,{onSelect:()=>{n(g?t.filter(p=>p.value!==i.value):[...t,i])},children:[L(no,{className:h("mr-2 h-4 w-4",g?"opacity-100":"opacity-0")}),i.label]},i.label)})})]},a))]})})})]})}r(pe,"MultiSelect");import{jsx as G,jsxs as io}from"react/jsx-runtime";function yt({label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,$meta:c,component:F,...f}){let{control:l}=b(),{components:a}=S(),[u,m]=lo([]);return G(k,{defaultValue:o,control:l,name:t,render:({field:i,fieldState:g})=>{let p=F||a?.countries;if(p){let v={label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,$meta:c,...f};return G(p,{field:{...i,onChange:r(T=>{i.onChange(T),d?.(T)},"onChange")},fieldState:g,fieldData:v})}let y=[...Object.entries(c?.regions||{}).map(([v,T])=>({value:T,label:v,category:"Regions"})),...Object.entries(c?.subregions||{}).map(([v,T])=>({value:T,label:v,category:"Subregions"})),...n.map(v=>({...v,value:v.value,label:v.label,category:"Countries"}))],x=r(v=>{let T=v.map(({value:K})=>K);i.onChange(T),d?.(T),m(v)},"handleChange");return io(w,{"data-field":t,className:`RemoteFlows__CountryField__Item__${t}`,children:[G(N,{className:"RemoteFlows__CountryField__Label",children:e}),G(R,{children:G(pe,{options:y,selected:u,onChange:x,...f})}),s&&G(P,{children:s}),g.error&&G(D,{})]})}})}r(yt,"CountryField");import*as vt from"react";import{jsx as mo}from"react/jsx-runtime";var De=vt.forwardRef(({className:e,...t},n)=>mo("textarea",{className:h("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:n,...t}));De.displayName="Textarea";import{jsx as J,jsxs as Te}from"react/jsx-runtime";function Ct({name:e,description:t,label:n,onChange:o,maxLength:s,component:d,...c}){let{components:F}=S(),{control:f}=b();return J(k,{control:f,name:e,render:({field:l,fieldState:a})=>{let u=d||F?.textarea;if(u){let i={name:e,description:t,label:n,maxLength:s,...c};return J(u,{field:{...l,onChange:r(g=>{l.onChange(g),o?.(g)},"onChange")},fieldState:a,fieldData:i})}let m=l.value?.length??0;return Te(w,{"data-field":e,className:`RemoteFlows__TextArea__Item__${e}`,children:[J(N,{className:"RemoteFlows__TextArea__Label",children:n}),J(R,{children:J(De,{...l,value:l.value??"",onChange:i=>{l.onChange(i),o?.(i)},className:h(a.error&&"border-red-500 focus-visible:ring-red-500","RemoteFlows__TextArea__Input"),placeholder:n})}),(t||s)&&Te("div",{className:"flex items-center justify-between",children:[t&&J(P,{className:"RemoteFlows__TextArea__Description",children:t}),s&&Te("span",{className:"text-sm ml-auto RemoteFlows__TextArea__MaxLength",children:[m,"/",s]})]}),a.error&&J(D,{className:"RemoteFlows__TextArea__Error"})]})}})}r(Ct,"TextAreaField");import{jsx as Ie}from"react/jsx-runtime";function xt(e){let{components:t}=S(),{control:n}=b(),o=e.component||t?.email;return o?Ie(k,{control:n,name:e.name,render:({field:s,fieldState:d})=>Ie(o,{field:{...s,onChange:r(c=>{s.onChange(c),e.onChange?.(c)},"onChange")},fieldState:d,fieldData:e})}):Ie(B,{...e,type:"email"})}r(xt,"EmailField");import{jsx as bt}from"react/jsx-runtime";function St(e){let{control:t}=b();return bt(k,{control:t,name:e.name,render:({field:n})=>bt("input",{...n,type:"hidden"})})}r(St,"HiddenField");import ho,{useEffect as _o,useState as $t}from"react";var kt=r((e,t,n)=>{if(e&&"reportValidity"in e){let o=ne(n,t);e.setCustomValidity(o&&o.message||""),e.reportValidity()}},"r"),$e=r((e,t)=>{for(let n in t.fields){let o=t.fields[n];o&&o.ref&&"reportValidity"in o.ref?kt(o.ref,n,e):o&&o.refs&&o.refs.forEach(s=>kt(s,n,e))}},"o"),wt=r((e,t)=>{t.shouldUseNativeValidation&&$e(e,t);let n={};for(let o in e){let s=ne(t.fields,o),d=Object.assign(e[o]||{},{ref:s&&s.ref});if(co(t.names||Object.keys(e),o)){let c=Object.assign({},ne(n,o));ae(c,"root",d),ae(n,o,c)}else ae(n,o,d)}return n},"s"),co=r((e,t)=>{let n=Nt(t);return e.some(o=>Nt(o).match(`^${n}\\.\\d+`))},"i");function Nt(e){return e.replace(/\]|\[/g,"")}r(Nt,"n");function Rt(e,t,n){return t===void 0&&(t={}),n===void 0&&(n={}),function(o,s,d){try{return Promise.resolve(function(c,F){try{var f=(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[n.mode==="sync"?"validateSync":"validate"](o,Object.assign({abortEarly:!1},t,{context:s}))).then(function(l){return d.shouldUseNativeValidation&&$e({},d),{values:n.raw?Object.assign({},o):l,errors:{}}}))}catch(l){return F(l)}return f&&f.then?f.then(void 0,F):f}(0,function(c){if(!c.inner)throw c;return{values:{},errors:wt((F=c,f=!d.shouldUseNativeValidation&&d.criteriaMode==="all",(F.inner||[]).reduce(function(l,a){if(l[a.path]||(l[a.path]={message:a.message,type:a.type}),f){var u=l[a.path].types,m=u&&u[a.type];l[a.path]=Ae(a.path,f,l,a.type,m?[].concat(m,a.message):a.message)}return l},{})),d)};var F,f}))}catch(c){return Promise.reject(c)}}}r(Rt,"o");import*as I from"yup";import Pt from"lodash.groupby";import X from"lodash.capitalize";var Dt=60,fe=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function uo(e){if(e<60)return`${e}m`;let t=Math.floor(e/Dt),n=e%Dt;return n>0?`${t}h${n}m`:`${t}h`}r(uo,"convertBreakDurationToHours");function Tt(e){let t=e.reduce((n,o)=>o.hours+n,0);return Number(t.toFixed(2))}r(Tt,"calculateTotalWorkHours");function po(e,t){let n=t.map(({day:d})=>d.toLowerCase()),o=n.indexOf(e),s=null;for(;o<n.length&&!s;){let d=n[o],c=n[o+1],F=fe.indexOf(d)+1;fe[F]===c||(s=d),o+=1}return s}r(po,"findLastConsecutiveDay");function fo(e){return e.start_time&&e.end_time&&(typeof e.hours=="number"?e.hours:Number.parseInt(e.hours))>0}r(fo,"shouldSummarizeSchedule");function Fo(e){return Number.parseInt(e.break_duration_minutes)>0}r(Fo,"shouldSummarizeBreaks");function It(e){let t=e.filter(fo),n=Pt(t,F=>`${F.start_time}|${F.end_time}`),o=e.filter(Fo),s=Pt(o,"break_duration_minutes"),d=Object.keys(n).map(F=>{let f=n[F],l=f[0].day,[a,u]=F.split("|"),m=`from <span>${a.replace(":","h")}</span> to <span>${u.replace(":","h")}</span>`,i=po(l,f),p=(i?f.findIndex(y=>y.day===i):-1)===f.length-1;return f.length===1?`${X(l)}, ${m}`:!p||!i?f.reduce((y,x,v)=>{let T=X(x.day);return v===f.length-1?`${y}and ${T}, ${m}`:`${y}<span>${T}</span>, `},""):`<span>${X(l)}</span> to <span>${X(i)}</span>, ${m}`}),c=Object.keys(s).reverse().map((F,f)=>{let l=f===0,a=s[F],u=uo(parseInt(F,10));if(Object.keys(s).length===1)return`With ${u} daily breaks`;if(a.length===1){let m=`${u} break on ${X(a[0].day)}.`;return l?`With ${m}`:m}return a.reduce((m,i,g)=>{let p=X(i.day);return g===0?`${m} ${p}`:g===a.length-1?`${m}, and ${p}.`:`${m}, ${p}`},l?`With ${u} break on`:`${u} break on`)});return{workHoursSummary:d,breakSummary:c}}r(It,"buildWorkScheduleSummary");function Me(e){let{checked:t,start_time:n,end_time:o,break_duration_minutes:s}=e;if(!t)return 0;let[d,c]=n.split(":").map(Number),[F,f]=o.split(":").map(Number),l=d*60+c,m=(F*60+f-l-Number.parseInt(s||"0"))/60;return m===Math.floor(m)?m:Number(m.toFixed(2))}r(Me,"calculateHours");var go={monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat",sunday:"Sun"};function Fe(e){return go[e]}r(Fe,"getShortWeekday");import{jsx as _,jsxs as H}from"react/jsx-runtime";var yo=I.object({day:I.string().required(),checked:I.boolean().required(),start_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:r(e=>e.required("Required"),"then"),otherwise:r(e=>e.optional().nullable(),"otherwise")}),end_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:r(e=>e.required("Required"),"then"),otherwise:r(e=>e.optional().nullable(),"otherwise")}),hours:I.number().default(0),break_duration_minutes:I.string().default("0")}),vo=I.object({schedule:I.array(yo)});function Co({defaultSchedule:e,onSubmit:t}){let[n,o]=$t(!1),s=fe.map(p=>{let y=e.find(x=>x.day.toLowerCase()===Fe(p).toLowerCase()||x.day.toLowerCase()===p.toLowerCase());return y?{...y,day:Fe(p),checked:!0}:{...e[0],checked:!1,day:Fe(p)}}),d=Ue({defaultValues:{schedule:s},resolver:Rt(vo)}),{handleSubmit:c,watch:F,reset:f,control:l,formState:a}=d,{fields:u}=Oe({name:"schedule",control:l}),m=F("schedule");function i(p){let y=p.schedule.filter(({checked:x})=>x).map(x=>({...x,hours:Me(x)}));t(y),o(!1)}r(i,"handleSubmitWorkingHours");function g(){f(),o(!1)}return r(g,"handleCancel"),_("div",{className:"flex items-center justify-between",children:H(Ce,{open:n,onOpenChange:o,children:[_(et,{asChild:!0,children:_($,{variant:"link",className:"flex items-center p-0 RemoteFlows__WorkScheduleSelectionForm__Trigger",children:"Edit Schedule"})}),H(xe,{className:"max-w-5xl max-h-[90vh] overflow-y-auto px-8 py-4 RemoteFlows__WorkScheduleSelectionForm__Content",children:[_(be,{children:_(Se,{className:"RemoteFlows__WorkScheduleSelectionForm__Title",children:"Edit employee working hours"})}),_(ze,{...d,children:H("form",{className:"space-y-4 RemoteFlows__WorkScheduleSelectionForm__Form",children:[H("div",{className:"rounded-lg",children:[_("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."}),H("div",{className:"grid grid-cols-12 gap-4 text-sm font-medium text-gray-500 uppercase tracking-wide RemoteFlows__WorkScheduleSelectionForm__Header",children:[_("div",{className:"col-span-2"}),_("div",{className:"col-span-3 text-center",children:"START"}),_("div",{className:"col-span-1 text-center"}),_("div",{className:"col-span-3 text-center",children:"END"}),_("div",{className:"col-span-2 text-center",children:"HOURS"})]}),_("div",{className:"RemoteFlows__WorkScheduleSelectionForm__Rows",children:u.map((p,y)=>{let x=m[y],v=Me(x);return H(ho.Fragment,{children:[H("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Hours",children:[_("div",{className:"col-span-2 flex items-center gap-3",children:_(le,{label:p.day,name:`schedule.${y}.checked`})}),_("div",{className:"col-span-3",children:_(B,{name:`schedule.${y}.start_time`,includeErrorMessage:!1})}),_("div",{className:"col-span-1 text-center text-gray-500",children:"to"}),_("div",{className:"col-span-3",children:_(B,{name:`schedule.${y}.end_time`,includeErrorMessage:!1})}),_("div",{className:"col-span-2 text-center text-gray-600",children:isNaN(v)?"-":`${v} hours`})]}),H("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Break",children:[_("div",{className:"col-span-2 text-gray-500",children:"Break"}),_("div",{className:"col-span-2",children:_(B,{name:`schedule.${y}.break_duration_minutes`,includeErrorMessage:!1})}),_("div",{className:"col-span-2 text-gray-500",children:"minutes"}),_("div",{className:"col-span-4"})]})]},p.id)})})]}),Object.keys(a.errors).length>0&&_("p",{className:"text-destructive text-sm mb-0",children:"Invalid time format (HH:mm)"}),H("div",{className:"flex gap-4 pt-4",children:[_($,{type:"button",className:"reset-button",variant:"outline",onClick:g,children:"Cancel"}),_($,{type:"button",className:"submit-button",onClick:c(i),children:"Save Schedule"})]})]})})]})]})})}r(Co,"WorkScheduleSelectionForm");function Mt(e){let{components:t}=S(),{setValue:n,control:o,watch:s}=b(),d=s(e.name),[c,F]=$t(d),{workHoursSummary:f,breakSummary:l}=It(c),a=Tt(c);_o(()=>{n(e.name,c)},[c,e.name,n]);function u(i){F(i)}r(u,"onSubmit");let m=e.component||t?.["work-schedule"];return m?_(k,{control:o,name:e.name,render:({field:i,fieldState:g})=>_(m,{field:{...i,onChange:r(p=>{i.onChange(p),e.onChange?.(p)},"onChange")},fieldState:g,fieldData:{...e,defaultFormattedValue:{workHoursSummary:f,breakSummary:l,totalWorkHours:a}}})}):H("div",{className:"flex flex-col gap-3 RemoteFlows__WorkScheduleField",children:[_("p",{className:"text-sm RemoteFlows__WorkScheduleField__Title",children:"Work hours"}),H("div",{className:"flex flex-col gap-1 RemoteFlows__WorkScheduleField__Summary",children:[_("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__WorkHours",dangerouslySetInnerHTML:{__html:f.join(", ")}}),_("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Break",children:l.join()}),H("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Total",children:["Total of ",_("span",{children:a})," hours per week"]}),_(Co,{defaultSchedule:c,onSubmit:u})]})]})}r(Mt,"WorkScheduleField");import{useState as xo}from"react";import{jsx as q,jsxs as bo}from"react/jsx-runtime";function Et({label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,component:c,...F}){let{control:f}=b(),{components:l}=S(),[a,u]=xo();return q(k,{defaultValue:o,control:f,name:t,render:({field:m,fieldState:i})=>{let g=c||l?.["multi-select"];if(g){let y={label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,...F};return q(g,{field:{...m,onChange:r(x=>{m.onChange(x),d?.(x)},"onChange")},fieldState:i,fieldData:y})}let p=a||n.filter(y=>m.value.includes(y.value));return bo(w,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[q(N,{className:"RemoteFlows__SelectField__Label",children:e}),q(R,{children:q(pe,{options:n,selected:p,onChange:y=>{let x=y.map(({value:v})=>v);m.onChange(x),d?.(x),u(y)},...F})}),s&&q(P,{children:s}),i.error&&q(D,{})]})}})}r(Et,"MultiSelectField");import{jsx as So}from"react/jsx-runtime";var Wt=r(e=>So(ue,{maxLength:15,...e}),"MoneyField");var Ee={checkbox:le,text:B,email:xt,money:Wt,select:ut,"multi-select":Et,radio:dt,number:ue,file:mt,date:st,textarea:Ct,countries:yt,hidden:St,"work-schedule":Mt};import{AlertCircle as ko}from"lucide-react";import{jsx as ge,jsxs as No}from"react/jsx-runtime";function Lt({title:e,description:t,severity:n}){let{components:o}=S();if(o?.statement){let s=o?.statement;return ge(s,{data:{title:e,description:oe(t),severity:n}})}return No(tt,{variant:"warning",children:[ge(ko,{className:"h-4 w-4"}),e&&ge(ot,{children:e}),t&&ge(rt,{dangerouslySetInnerHTML:{__html:oe(t)}})]})}r(Lt,"Statement");import{Fragment as Do,jsx as O,jsxs as Q}from"react/jsx-runtime";var Po=r(({isExpanded:e,onToggle:t,className:n,...o})=>O($,{type:"button",className:h("RemoteFlows__Button RemoteFlows__FieldSetField__ToggleButton",n),variant:"default",onClick:t,...o,children:e?"Remove":"Define"}),"DefaultToggleButton");function us({label:e,name:t,fields:n,description:o,components:s,statement:d,isFlatFieldset:c,extra:F,variant:f="outset",features:l,meta:a}){let{helpCenter:u}=a||{},{watch:m,setValue:i,trigger:g,formState:p}=b(),{components:y}=S(),x=l?.toggle?.stateField,v=x?m(x):l?.toggle?.defaultExpanded??!0,T=n.map(({name:C})=>`${t}.${C}`),K=m(T),We=Ht(K),ee=Ht(null),Bt=r(()=>{x&&i(x,!v)},"toggleExpanded");Ro(()=>{let C=K,re=We.current,he=p.isSubmitted||p.submitCount>0,Be=!1;for(let te=0;te<C.length;te++)if(C[te]!==void 0&&re[te]!==C[te]){Be=!0;break}return Be&&he&&(ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{g()},50)),We.current=[...C],()=>{ee.current&&clearTimeout(ee.current)}},[K,g,p.isSubmitted,p.submitCount]);let At=y?.fieldsetToggle||Po,Le=`${t}-content`,He=`${t}-header`;return Q("fieldset",{className:h("border-1 border-input p-4 rounded-xl","RemoteFlows__FieldSetField",`RemoteFlows__FieldSetField__${t}`),children:[O("legend",{className:h("text-sm font-semibold px-2",f==="inset"&&"hidden"),children:e}),u?.callToAction&&u?.id&&f==="outset"&&O(_e,{className:"RemoteFlows__FieldSetField__HelpCenterLink mb-3",zendeskId:u.id,children:u.callToAction}),f==="inset"&&Q(Do,{children:[Q("div",{className:"RemoteFlows__FieldSetField__Header",id:He,"data-state":v?"expanded":"collapsed","aria-expanded":v,children:[O("h3",{className:h("RemoteFlows__FieldSetField__Title"),children:e}),l?.toggle?.enabled&&O(At,{isExpanded:v,onToggle:Bt,"aria-expanded":v,"aria-controls":Le,"aria-label":`${v?"Hide":"Show"} ${e}`,className:h("RemoteFlows__FieldSetField__Toggle",l.toggle?.className),children:v?l.toggle.labels?.collapse??"Remove":l.toggle.labels?.expand??"Define"})]}),u?.callToAction&&u?.id&&O(_e,{className:"RemoteFlows__FieldSetField__HelpCenterLink mb-3",zendeskId:u.id,children:u.callToAction})]}),v&&Q("div",{id:Le,"aria-labelledby":He,role:"region",children:[o?O("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:oe(o)}}):null,Q("div",{className:"grid gap-4",children:[n.map(C=>{C.calculateDynamicProperties&&(C={...C,...C.calculateDynamicProperties(K,C)||{}});let re=Ee[C.type];if(C.isVisible===!1||C.deprecated)return null;if(C.Component){let{Component:he}=C;return O(he,{...C},C.name)}return C.type==="select"&&C.multiple&&(re=Ee["multi-select"]),Q(wo,{children:[O(re,{...C,name:`${c?C.name:`${t}.${C.name}`}`,component:s?.[C.type]}),C.extra?C.extra:null]},`${c?C.name:`${t}.${C.name}`}`)}),F||null,d?O(Lt,{...d}):null]})]})]})}r(us,"FieldSetField");export{Ee as a,Lt as b,us as c};
|
|
2
|
-
//# sourceMappingURL=chunk-QEWB24WT.js.map
|