@remoteoss/remote-flows 0.15.0 → 0.16.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.
Files changed (84) hide show
  1. package/dist/chunk-34JNRT23.js +2 -0
  2. package/dist/chunk-34JNRT23.js.map +1 -0
  3. package/dist/chunk-HVTGLVLT.js +2 -0
  4. package/dist/chunk-HVTGLVLT.js.map +1 -0
  5. package/dist/chunk-IEYBG2G5.js +2 -0
  6. package/dist/{chunk-SIUODCGO.js.map → chunk-IEYBG2G5.js.map} +1 -1
  7. package/dist/chunk-IHPLMALI.js +2 -0
  8. package/dist/chunk-IHPLMALI.js.map +1 -0
  9. package/dist/chunk-QURYMQUD.js +2 -0
  10. package/dist/chunk-QURYMQUD.js.map +1 -0
  11. package/dist/{chunk-A3OEOVEH.js → chunk-R2UI3WAJ.js} +2 -2
  12. package/dist/chunk-R2UI3WAJ.js.map +1 -0
  13. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +1 -1
  14. package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +1 -1
  15. package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +1 -1
  16. package/dist/flows/ContractAmendment/context.d.ts +2 -2
  17. package/dist/flows/ContractAmendment/hooks.d.ts +1 -1
  18. package/dist/flows/ContractAmendment/index.d.ts +1 -1
  19. package/dist/flows/ContractAmendment/utils.d.ts +1 -1
  20. package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +1 -1
  21. package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
  22. package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +3 -3
  23. package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
  24. package/dist/flows/CostCalculator/EstimationResults/EstimationResults.d.ts +6 -2
  25. package/dist/flows/CostCalculator/EstimationResults/EstimationResults.js +1 -1
  26. package/dist/flows/CostCalculator/Results/CostCalculatorResults.d.ts +1 -1
  27. package/dist/flows/CostCalculator/SummaryResults/SummaryResults.d.ts +6 -2
  28. package/dist/flows/CostCalculator/SummaryResults/SummaryResults.js +1 -1
  29. package/dist/flows/CostCalculator/api.d.ts +1 -1
  30. package/dist/flows/CostCalculator/components/SalaryField.d.ts +2 -2
  31. package/dist/flows/CostCalculator/context.d.ts +2 -2
  32. package/dist/flows/CostCalculator/hooks.d.ts +1 -1
  33. package/dist/flows/CostCalculator/hooks.js +1 -1
  34. package/dist/flows/CostCalculator/index.d.ts +2 -2
  35. package/dist/flows/CostCalculator/index.js +1 -1
  36. package/dist/flows/CostCalculator/jsonSchema.d.ts +21 -0
  37. package/dist/flows/CostCalculator/jsonSchema.js +1 -1
  38. package/dist/flows/CostCalculator/types.d.ts +19 -2
  39. package/dist/flows/CostCalculator/utils.d.ts +3 -3
  40. package/dist/flows/CostCalculator/utils.js +1 -1
  41. package/dist/flows/Onboarding/OnboardingFlow.d.ts +2 -2
  42. package/dist/flows/Onboarding/api.d.ts +2 -2
  43. package/dist/flows/Onboarding/components/AnnualGrossSalary.d.ts +2 -2
  44. package/dist/flows/Onboarding/components/BasicInformationStep.d.ts +1 -1
  45. package/dist/flows/Onboarding/components/BenefitsStep.d.ts +2 -2
  46. package/dist/flows/Onboarding/components/ContractDetailsStep.d.ts +1 -1
  47. package/dist/flows/Onboarding/components/OnboardingForm.d.ts +2 -2
  48. package/dist/flows/Onboarding/components/OnboardingInvite.d.ts +1 -1
  49. package/dist/flows/Onboarding/components/ReviewStep.d.ts +1 -1
  50. package/dist/flows/Onboarding/components/SelectCountryStep.d.ts +1 -1
  51. package/dist/flows/Onboarding/context.d.ts +4 -4
  52. package/dist/flows/Onboarding/hooks.d.ts +4 -4
  53. package/dist/flows/Onboarding/index.d.ts +2 -2
  54. package/dist/flows/Onboarding/types.d.ts +1 -1
  55. package/dist/flows/Onboarding/utils.d.ts +1 -1
  56. package/dist/flows/Termination/AdditionalDetailsForm.d.ts +1 -1
  57. package/dist/flows/Termination/EmployeeComunicationForm.d.ts +1 -1
  58. package/dist/flows/Termination/PaidTimeOffForm.d.ts +1 -1
  59. package/dist/flows/Termination/TerminationDetailsForm.d.ts +1 -1
  60. package/dist/flows/Termination/TerminationFlow.d.ts +1 -1
  61. package/dist/flows/Termination/TerminationForm.d.ts +1 -1
  62. package/dist/flows/Termination/TimeOff.d.ts +1 -1
  63. package/dist/flows/Termination/context.d.ts +2 -2
  64. package/dist/flows/Termination/hooks.d.ts +1 -1
  65. package/dist/flows/Termination/index.d.ts +1 -1
  66. package/dist/flows/Termination/types.d.ts +1 -1
  67. package/dist/index.css +1 -1
  68. package/dist/index.css.map +1 -1
  69. package/dist/index.d.ts +5 -5
  70. package/dist/index.js +1 -1
  71. package/dist/index.js.map +1 -1
  72. package/dist/{remoteFlows-Clat4nYN.d.ts → remoteFlows-CBNrcwGZ.d.ts} +2 -1
  73. package/dist/{types.gen-C9Y1S1pc.d.ts → types.gen-CaXCWhlP.d.ts} +1 -1
  74. package/package.json +1 -1
  75. package/dist/chunk-6YKL7EOK.js +0 -2
  76. package/dist/chunk-6YKL7EOK.js.map +0 -1
  77. package/dist/chunk-A3OEOVEH.js.map +0 -1
  78. package/dist/chunk-HSIQ2OHT.js +0 -2
  79. package/dist/chunk-HSIQ2OHT.js.map +0 -1
  80. package/dist/chunk-NVQBJCNL.js +0 -2
  81. package/dist/chunk-NVQBJCNL.js.map +0 -1
  82. package/dist/chunk-OC7VOBB4.js +0 -2
  83. package/dist/chunk-OC7VOBB4.js.map +0 -1
  84. package/dist/chunk-SIUODCGO.js +0 -2
@@ -0,0 +1,2 @@
1
+ import{a as Q}from"./chunk-JUGNVM2R.js";import{a as N}from"./chunk-IHPLMALI.js";import{a as K,b as G,c as I,e as z}from"./chunk-V2YORDAL.js";import{a as h}from"./chunk-HN5HLFTB.js";import{a as D}from"./chunk-CFIJKJXD.js";import{c as M}from"./chunk-MXFDOIUA.js";import{a as i}from"./chunk-P37U34EQ.js";import{number as Me,object as te}from"yup";import{createHeadlessForm as Ee,modify as _e}from"@remoteoss/json-schema-form";import{useCallback as be,useEffect as W,useMemo as Se,useState as j}from"react";import{string as X,ValidationError as Y}from"yup";import{jsx as Ve}from"react/jsx-runtime";var q={title:"Estimation",includeBenefits:!1,includeCostBreakdowns:!1,includePremiumBenefits:!1,enableCurrencyConversion:!1,includeEstimationTitle:!1,includeManagementFee:!1},he=i(t=>{let{schema:r}=_e(N.data.schema,t?.jsfModify||{});return Ee(r)},"useStaticSchema");function Fe(t,r){if(typeof t=="object"&&t!==null&&"title"in t){let l=t.title;if(l)return l}return r==="my_hiring_budget"?"Hiring budget":"Employee's annual salary"}i(Fe,"getSalaryTitle");var Ue=i(({defaultRegion:t,defaultCurrency:r,defaultSalary:l,estimationOptions:o,options:a,version:s}={estimationOptions:q})=>{let[u,b]=j(t),[P,R]=j(),[d,A]=j(),[H,ne]=j(),{data:p,isLoading:re}=K({includePremiumBenefits:o.includePremiumBenefits}),{data:g,isLoading:ae}=G(),ie=u||P?.value,{data:w,isLoading:oe}=z(ie,{includePremiumBenefits:o.includePremiumBenefits,options:a}),L=I(),C=P?.currency,y=a?.jsfModify?.fields?.salary,F=y&&typeof y=="object"&&"presentation"in y?y.presentation:void 0,U=be(()=>{let e=C&&d?C!==d:!1;return C!==d?{from:d,to:C,shouldSwapOrder:e}:{from:C,to:d,shouldSwapOrder:e}},[C,d]),J=o.includeManagementFee,se=o.includeEstimationTitle,le=Se(()=>{let{from:e,to:n,shouldSwapOrder:c}=U(),m=Fe(y,H);return{fields:{salary:{...y,title:m,presentation:{salary_conversion_properties:{label:F?.salary_conversion_properties?.label,description:F?.salary_conversion_properties?.description},currencies:{from:e,to:n},Component:i(_=>Ve(Q,{..._,shouldSwapOrder:c,conversionType:s==="marketing"?"no_spread":"spread",defaultValue:l}),"Component")}},hiring_budget:{presentation:{hidden:s=="marketing"}},management:{...a?.jsfModify?.fields?.management,properties:{...a?.jsfModify?.fields?.management?.properties,management_fee:{...a?.jsfModify?.fields?.management?.properties?.management_fee,"x-jsf-presentation":{inputType:"money",additionalProps:{currency:d||"USD"}}}},presentation:{...typeof a?.jsfModify?.fields?.management=="object"?(a?.jsfModify?.fields?.management)["x-jsf-presentation"]:{},hidden:!J}},estimation_title:{...a?.jsfModify?.fields?.estimation_title,"x-jsf-presentation":{hidden:!se}}}}},[d,y,H,F?.salary_conversion_properties?.description,F?.salary_conversion_properties?.label,l,U,a?.jsfModify?.fields?.management,J,s]),f=he({jsfModify:{fields:{...a?.jsfModify?.fields,...le?.fields}}});W(()=>{if(t&&p){let e=p.find(({value:n})=>n===t);e&&R(e)}},[t,p]),W(()=>{if(r&&g){let e=g.find(({value:n})=>n===r);e&&A(e.label)}},[r,g]);async function ue(e){try{await B.validate(e,{abortEarly:!1})}catch(n){return{data:null,error:n}}return new Promise((n,c)=>{L.mutate(ee(e,o,s),{onSuccess:i(m=>{m.data?n({data:m.data,error:null}):c({data:null,error:m.error})},"onSuccess"),onError:i(m=>{c({data:null,error:m})},"onError")})})}i(ue,"onSubmit");function ce(e){let n=p?.find(({value:c})=>c===e);n&&n.childRegions.length===0&&n.hasAdditionalFields?b(n.regionSlug):b(void 0),R(n)}i(ce,"onCountryChange");function me(e){b(e)}i(me,"onRegionChange");function de(e){ne(e.target.value)}i(de,"onHiringBudgetChange");function fe(e){let n=g?.find(c=>c.value===e)?.label;A(n),a?.onCurrencyChange?.(n||"")}i(fe,"onChangeCurrency");let E=f.fields.find(e=>e.name==="region");if(E){let e=P?.childRegions.map(n=>({value:n.slug,label:n.name}))??[];E.options=e,E.isVisible=e.length>0,E.required=e.length>0,E.onChange=me,E.schema=e.length>0?X().transform(n=>typeof n=="string"?n:"").required("Region is required"):X()}if(g){let e=f.fields.find(n=>n.name==="currency");e&&(e.options=g,e.onChange=fe)}let $=f.fields.find(e=>e.name==="hiring_budget");if($&&($.onChange=de),p){let e=f.fields.find(n=>n.name==="country");e&&(e.options=p,e.onChange=ce)}let ge=i(()=>{R(void 0),b(t)},"resetForm"),v=[...f.fields.filter(e=>e.name!=="management"),...w?.fields||[],...f.fields.filter(e=>e.name==="management")],B=Z(f.fields,d||"USD",o.includeEstimationTitle);async function ye(e){let n=null;a?.onValidation?.(e);let c=M(e,v);try{await B.validate(c,{abortEarly:!1}),n={formErrors:{},yupError:new Y([],e)}}catch(S){let T=D(S);n={formErrors:Object.entries(T).reduce((O,[k,V])=>({...O,[k]:V.message}),{}),yupError:S}}let m=w?.handleValidation(c),_=[...n?.yupError.inner||[],...m?.yupError?.inner||[]],x={...n?.yupError?.value||{},...m?.yupError?.value||{}};return{formErrors:{...n?.formErrors||{},...m?.formErrors||{}},yupError:new Y(_,x)}}return i(ye,"handleValidation"),{stepState:{current:0,total:1,isLastStep:!0},fields:v,validationSchema:B,parseFormValues:i(e=>{let{country:n,region:c,currency:m,salary_converted:_,hiring_budget:x,salary_conversion:S,management:T,estimation_title:O,...k}=e,V=e.salary;_==="salary_conversion"&&(V=S);let pe=M({country:n,region:c,salary:V,salary_converted:_,salary_conversion:S,hiring_budget:x,currency:m,management:T,estimation_title:O},f.fields),Ce=M(k,w?.fields||[]);return{...pe,...Ce}},"parseFormValues"),handleValidation:ye,isSubmitting:L.isPending,isLoading:re&&ae&&oe,onSubmit:ue,resetForm:ge,currencies:g}},"useCostCalculator");function Z(t,r,l){let o=t.reduce((a,s)=>(s.name==="salary"||s.name==="salary_conversion"?a[s.name]=s.schema.when("salary_converted",{is:i(u=>u===s.name,"is"),then:i(u=>u.required("Required field"),"then"),otherwise:i(u=>u.optional(),"otherwise")}):s.name==="management"?a[s.name]=te({management_fee:Me().transform(u=>isNaN(u)?void 0:u).min(0,"Management fee must be greater than or equal to 0").max(r?h[r]:h.USD,()=>`Management fee cannot exceed ${(r?h[r]:h.USD)/100} ${r}`)}):s.name==="estimation_title"&&l?a[s.name]=s.schema.required("Required field"):a[s.name]=s.schema,a),{});return te(o)}i(Z,"buildValidationSchema");function je(t){let r="benefit-";return Object.keys(t).reduce((l,o)=>{let a=t[o];if(a==="none")return l;let u={benefit_group_slug:o.replace(r,""),benefit_tier_slug:a};return[...l,u]},[])}i(je,"formatBenefits");function Pe(t,r,l){return{...{region_slug:t.region||t.country,employment_term:t.contract_duration_type??"fixed",title:t.estimation_title||r.title,age:t.age??void 0,...t.benefits&&{benefits:je(t.benefits)}},...Re(t,l)}}i(Pe,"mapValueToEmployment");function Re(t,r){let l=r==="marketing"||t.salary_converted==="salary_conversion",o=r==="standard"&&t.salary_converted==="salary",a=t.hiring_budget==="my_hiring_budget";return l?a?{annual_total_cost_in_employer_currency:t.salary}:{annual_gross_salary_in_employer_currency:t.salary}:o?a?{annual_total_cost:t.salary}:{annual_gross_salary:t.salary}:{}}i(Re,"getSalaryFields");function ee(t,r=q,l="standard"){let o=Array.isArray(t)?t:[t];if(o.length===0)throw new Error("At least one employment value is required");o.length>1&&new Set(o.map(u=>u.currency)).size>1&&console.warn("Multiple currencies detected in array. Using currency from first employment.");let a=Number(o[0].management?.management_fee);return{employer_currency_slug:o[0].currency,include_benefits:r.includeBenefits,include_cost_breakdowns:r.includeCostBreakdowns,include_premium_benefits:r.includePremiumBenefits,include_management_fee:r.includeManagementFee,...r.includeManagementFee&&a&&{global_discount:{quoted_amount:a,text:""}},employments:o.map(s=>Pe(s,r,l))}}i(ee,"buildPayload");export{Z as a,ee as b,q as c,Ue as d};
2
+ //# sourceMappingURL=chunk-34JNRT23.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/CostCalculator/utils.ts","../src/flows/CostCalculator/hooks.tsx"],"sourcesContent":["import type {\n CostCalculatorEmploymentParam,\n CostCalculatorEstimateParams,\n} from '@/src/client';\n\nimport { $TSFixMe } from '@/src/types/remoteFlows';\nimport { AnyObjectSchema, number, object } from 'yup';\nimport { CostCalculatorVersion, defaultEstimationOptions } from './hooks';\nimport type {\n CostCalculatorEstimationOptions,\n CostCalculatorEstimationSubmitValues,\n CurrencyKey,\n} from './types';\nimport { BASE_RATES } from '@/src/flows/CostCalculator/constants';\n\n/**\n * Build the validation schema for the form.\n * @returns\n */\nexport function buildValidationSchema(\n fields: $TSFixMe[],\n employerBillingCurrency: string,\n includeEstimationTitle?: boolean,\n) {\n const fieldsSchema = fields.reduce<Record<string, AnyObjectSchema>>(\n (fieldsSchemaAcc, field) => {\n // Special handling for salary fields\n if (field.name === 'salary' || field.name === 'salary_conversion') {\n fieldsSchemaAcc[field.name] = (field.schema as AnyObjectSchema).when(\n 'salary_converted',\n {\n is: (val: string | null) => val === field.name,\n then: (schema) => schema.required('Required field'),\n otherwise: (schema) => schema.optional(),\n },\n );\n } else if (field.name === 'management') {\n fieldsSchemaAcc[field.name] = object({\n management_fee: number()\n .transform((value) => {\n return isNaN(value) ? undefined : value;\n })\n .min(0, 'Management fee must be greater than or equal to 0')\n .max(\n employerBillingCurrency\n ? BASE_RATES[employerBillingCurrency as CurrencyKey]\n : BASE_RATES.USD,\n () => {\n const maxValue = employerBillingCurrency\n ? BASE_RATES[employerBillingCurrency as CurrencyKey]\n : BASE_RATES.USD;\n const displayValue = maxValue / 100;\n return `Management fee cannot exceed ${displayValue} ${employerBillingCurrency}`;\n },\n ),\n });\n } else if (field.name === 'estimation_title' && includeEstimationTitle) {\n // Make estimation_title required when includeEstimationTitle is true\n fieldsSchemaAcc[field.name] = (\n field.schema as AnyObjectSchema\n ).required('Required field');\n } else {\n fieldsSchemaAcc[field.name] = field.schema as AnyObjectSchema;\n }\n return fieldsSchemaAcc;\n },\n {},\n );\n return object(fieldsSchema) as AnyObjectSchema;\n}\n\n/**\n * Format the benefits to the expected format by the API.\n * @param benefits\n * @returns\n */\nfunction formatBenefits(benefits: Record<string, string>) {\n const needle = 'benefit-';\n return Object.keys(benefits).reduce<\n Array<{ benefit_group_slug: string; benefit_tier_slug: string }>\n >((acc, key) => {\n const benefitTierSlug = benefits[key];\n if (benefitTierSlug === 'none') {\n return acc;\n }\n const benefitGroupSlug = key.replace(needle, '');\n const benefitEntry = {\n benefit_group_slug: benefitGroupSlug,\n benefit_tier_slug: benefitTierSlug,\n };\n return [...acc, benefitEntry];\n }, []);\n}\n\nfunction mapValueToEmployment(\n value: CostCalculatorEstimationSubmitValues,\n estimationOptions: CostCalculatorEstimationOptions,\n version: CostCalculatorVersion,\n): CostCalculatorEmploymentParam {\n const base: CostCalculatorEmploymentParam = {\n region_slug: value.region || value.country,\n employment_term: value.contract_duration_type ?? 'fixed',\n title: value.estimation_title || estimationOptions.title,\n age: value.age ?? undefined,\n ...(value.benefits && { benefits: formatBenefits(value.benefits) }),\n };\n\n return {\n ...base,\n ...getSalaryFields(value, version),\n };\n}\n\nfunction getSalaryFields(\n value: CostCalculatorEstimationSubmitValues,\n version: CostCalculatorVersion,\n): Partial<CostCalculatorEmploymentParam> {\n const isMarketing =\n version === 'marketing' || value.salary_converted === 'salary_conversion';\n const isStandard =\n version === 'standard' && value.salary_converted === 'salary';\n const useHiringBudget = value.hiring_budget === 'my_hiring_budget';\n\n if (isMarketing) {\n return useHiringBudget\n ? {\n annual_total_cost_in_employer_currency: value.salary,\n }\n : {\n annual_gross_salary_in_employer_currency: value.salary,\n };\n }\n\n if (isStandard) {\n return useHiringBudget\n ? {\n annual_total_cost: value.salary,\n }\n : {\n annual_gross_salary: value.salary,\n };\n }\n\n return {};\n}\n\n/**\n * Build the payload for the cost calculator estimation.\n * @param values\n * @param estimationOptions\n * @returns\n */\nexport function buildPayload(\n values:\n | CostCalculatorEstimationSubmitValues\n | CostCalculatorEstimationSubmitValues[],\n estimationOptions: CostCalculatorEstimationOptions = defaultEstimationOptions,\n version: CostCalculatorVersion = 'standard',\n): CostCalculatorEstimateParams {\n const employments = Array.isArray(values) ? values : [values];\n\n if (employments.length === 0) {\n throw new Error('At least one employment value is required');\n }\n\n if (employments.length > 1) {\n const currencies = new Set(employments.map((v) => v.currency));\n if (currencies.size > 1) {\n console.warn(\n 'Multiple currencies detected in array. Using currency from first employment.',\n );\n }\n }\n const managementFee = Number(employments[0].management?.management_fee);\n\n return {\n employer_currency_slug: employments[0].currency,\n include_benefits: estimationOptions.includeBenefits,\n include_cost_breakdowns: estimationOptions.includeCostBreakdowns,\n include_premium_benefits: estimationOptions.includePremiumBenefits,\n include_management_fee: estimationOptions.includeManagementFee,\n ...(estimationOptions.includeManagementFee &&\n managementFee && {\n global_discount: {\n quoted_amount: managementFee,\n text: '',\n },\n }),\n employments: employments.map((value) =>\n mapValueToEmployment(value, estimationOptions, version),\n ),\n };\n}\n","import {\n CostCalculatorEstimateResponse,\n MinimalRegion,\n PostCreateEstimationError,\n} from '@/src/client';\nimport { jsonSchema } from '@/src/flows/CostCalculator/jsonSchema';\nimport type {\n CostCalculatorEstimationFormValues,\n CostCalculatorEstimationOptions,\n CostCalculatorEstimationSubmitValues,\n EstimationError,\n UseCostCalculatorOptions,\n} from '@/src/flows/CostCalculator/types';\nimport type { JSFModify, Result } from '@/src/flows/types';\n\nimport { parseJSFToValidate } from '@/src/components/form/utils';\nimport { iterateErrors } from '@/src/components/form/yupValidationResolver';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { string, ValidationError } from 'yup';\nimport { buildPayload, buildValidationSchema } from './utils';\nimport {\n useCompanyCurrencies,\n useCostCalculatorCountries,\n useCostCalculatorEstimation,\n useRegionFields,\n} from '@/src/flows/CostCalculator/api';\nimport { $TSFixMe, JSFField } from '@/src/types/remoteFlows';\nimport { SalaryField } from '@/src/flows/CostCalculator/components/SalaryField';\n\nexport type CostCalculatorVersion = 'standard' | 'marketing';\n\ntype CostCalculatorCountry = {\n value: string;\n label: string;\n childRegions: MinimalRegion[];\n hasAdditionalFields: boolean | undefined;\n regionSlug: string;\n currency: string;\n};\n\ntype JSFValidationError = {\n formErrors: Record<\n string,\n {\n type: string;\n message: string;\n }\n >;\n yupError: ValidationError;\n};\n\nexport const defaultEstimationOptions: CostCalculatorEstimationOptions = {\n title: 'Estimation',\n includeBenefits: false,\n includeCostBreakdowns: false,\n includePremiumBenefits: false,\n enableCurrencyConversion: false,\n includeEstimationTitle: false,\n includeManagementFee: false,\n};\n\ntype UseCostCalculatorParams = {\n /**\n * The default region slug to preselect a country and a region.\n */\n defaultRegion?: string;\n /**\n * The default currency slug to preselect a currency.\n */\n defaultCurrency?: string;\n\n /**\n * The default salary to preselect a salary.\n */\n defaultSalary?: string;\n /**\n * The estimation options.\n */\n estimationOptions: CostCalculatorEstimationOptions;\n options?: UseCostCalculatorOptions;\n version?: CostCalculatorVersion;\n};\n\nconst useStaticSchema = (options?: { jsfModify?: JSFModify }) => {\n const { schema: jsonSchemaModified } = modify(\n jsonSchema.data.schema,\n options?.jsfModify || {},\n );\n\n return createHeadlessForm(jsonSchemaModified);\n};\n\ntype HiringBudget = 'my_hiring_budget' | 'employee_annual_salary';\n\nfunction getSalaryTitle(\n salaryField: unknown,\n hiringBudget?: HiringBudget,\n): string {\n if (\n typeof salaryField === 'object' &&\n salaryField !== null &&\n 'title' in salaryField\n ) {\n const title = (salaryField as { title?: string }).title;\n if (title) return title;\n }\n return hiringBudget === 'my_hiring_budget'\n ? 'Hiring budget'\n : \"Employee's annual salary\";\n}\n\n/**\n * Hook to use the cost calculator.\n */\nexport const useCostCalculator = (\n {\n defaultRegion,\n defaultCurrency,\n defaultSalary,\n estimationOptions,\n options,\n version,\n }: UseCostCalculatorParams = {\n estimationOptions: defaultEstimationOptions,\n },\n) => {\n const [selectedRegion, setSelectedRegion] = useState<string | undefined>(\n defaultRegion,\n );\n const [selectedCountry, setSelectedCountry] =\n useState<CostCalculatorCountry>();\n const [employerBillingCurrency, setEmployerBillingCurrency] = useState<\n string | undefined\n >();\n const [hiringBudget, setHiringBudget] = useState<HiringBudget>();\n const { data: countries, isLoading: isLoadingCountries } =\n useCostCalculatorCountries({\n includePremiumBenefits: estimationOptions.includePremiumBenefits,\n });\n const { data: currencies, isLoading: isLoadingCurrencies } =\n useCompanyCurrencies();\n\n const jsonSchemaRegionSlug = selectedRegion || selectedCountry?.value;\n\n const { data: jsonSchemaRegionFields, isLoading: isLoadingRegionFields } =\n useRegionFields(jsonSchemaRegionSlug, {\n includePremiumBenefits: estimationOptions.includePremiumBenefits,\n options,\n });\n const costCalculatorEstimationMutation = useCostCalculatorEstimation();\n const employeeBillingCurrency = selectedCountry?.currency;\n\n const salaryField = options?.jsfModify?.fields?.salary;\n const salaryFieldPresentation =\n salaryField &&\n typeof salaryField === 'object' &&\n 'presentation' in salaryField\n ? (\n salaryField as {\n presentation?: {\n salary_conversion_properties?: {\n label?: string;\n description?: string;\n };\n };\n }\n ).presentation\n : undefined;\n\n const getCurrencies = useCallback(() => {\n const shouldSwapOrder =\n employeeBillingCurrency && employerBillingCurrency\n ? employeeBillingCurrency !== employerBillingCurrency\n : false;\n\n if (employeeBillingCurrency !== employerBillingCurrency) {\n return {\n from: employerBillingCurrency,\n to: employeeBillingCurrency,\n shouldSwapOrder,\n };\n }\n\n return {\n from: employeeBillingCurrency,\n to: employerBillingCurrency,\n shouldSwapOrder,\n };\n }, [employeeBillingCurrency, employerBillingCurrency]);\n\n const showManagementField = estimationOptions.includeManagementFee;\n const showEstimationTitleField = estimationOptions.includeEstimationTitle;\n const customFields = useMemo(() => {\n const { from, to, shouldSwapOrder } = getCurrencies();\n const salaryTitle = getSalaryTitle(salaryField, hiringBudget);\n\n return {\n fields: {\n salary: {\n ...salaryField,\n title: salaryTitle,\n presentation: {\n salary_conversion_properties: {\n label:\n salaryFieldPresentation?.salary_conversion_properties?.label,\n description:\n salaryFieldPresentation?.salary_conversion_properties\n ?.description,\n },\n currencies: { from, to },\n Component: (\n props: JSFField & { currencies: { from: string; to: string } },\n ) => {\n return (\n <SalaryField\n {...props}\n shouldSwapOrder={shouldSwapOrder}\n conversionType={\n version === 'marketing' ? 'no_spread' : 'spread'\n }\n defaultValue={defaultSalary}\n />\n );\n },\n },\n },\n hiring_budget: {\n presentation: {\n hidden: version == 'marketing',\n },\n },\n management: {\n ...options?.jsfModify?.fields?.management,\n properties: {\n ...(options?.jsfModify?.fields?.management as $TSFixMe)?.properties,\n management_fee: {\n ...(options?.jsfModify?.fields?.management as $TSFixMe)\n ?.properties?.management_fee,\n 'x-jsf-presentation': {\n inputType: 'money',\n additionalProps: {\n currency: employerBillingCurrency || 'USD',\n },\n },\n },\n },\n presentation: {\n ...(typeof options?.jsfModify?.fields?.management === 'object'\n ? (\n options?.jsfModify?.fields?.management as Record<\n string,\n $TSFixMe\n >\n )['x-jsf-presentation']\n : {}),\n hidden: !showManagementField,\n },\n },\n estimation_title: {\n ...options?.jsfModify?.fields?.estimation_title,\n 'x-jsf-presentation': {\n hidden: !showEstimationTitleField,\n },\n },\n },\n };\n }, [\n employerBillingCurrency,\n salaryField,\n hiringBudget,\n salaryFieldPresentation?.salary_conversion_properties?.description,\n salaryFieldPresentation?.salary_conversion_properties?.label,\n defaultSalary,\n getCurrencies,\n options?.jsfModify?.fields?.management,\n showManagementField,\n version,\n ]);\n\n const fieldsJSONSchema = useStaticSchema({\n jsfModify: {\n fields: {\n ...options?.jsfModify?.fields,\n ...customFields?.fields,\n },\n },\n });\n\n useEffect(() => {\n // Initialize selectedCountry from defaultRegion\n if (defaultRegion && countries) {\n const defaultCountry = countries.find(\n ({ value }) => value === defaultRegion,\n );\n if (defaultCountry) {\n setSelectedCountry(defaultCountry);\n }\n }\n }, [defaultRegion, countries]);\n\n useEffect(() => {\n // Initialize selectedCurrency from defaultCurrency\n if (defaultCurrency && currencies) {\n const defaultCurrencyObj = currencies.find(\n ({ value }) => value === defaultCurrency,\n );\n if (defaultCurrencyObj) {\n setEmployerBillingCurrency(defaultCurrencyObj.label);\n }\n }\n }, [defaultCurrency, currencies]);\n\n /**\n * Submit the estimation form with the given values.\n * @param values\n */\n async function onSubmit(\n values: CostCalculatorEstimationSubmitValues,\n ): Promise<Result<CostCalculatorEstimateResponse, EstimationError>> {\n try {\n await validationSchema.validate(values, { abortEarly: false });\n } catch (err) {\n return {\n data: null,\n error: err as ValidationError,\n };\n }\n\n return new Promise((resolve, reject) => {\n costCalculatorEstimationMutation.mutate(\n buildPayload(values, estimationOptions, version),\n {\n onSuccess: (response) => {\n if (response.data) {\n resolve({\n data: response.data,\n error: null,\n });\n } else {\n reject({\n data: null,\n error: response.error as PostCreateEstimationError,\n });\n }\n },\n onError: (error) => {\n reject({\n data: null,\n error: error as PostCreateEstimationError,\n });\n },\n },\n );\n });\n }\n\n /**\n * If the selected country has no child regions and has additional fields,\n * set the current region to the country's region slug and fetch the region fields.\n * @param country\n */\n function onCountryChange(country: string) {\n const currentCountry = countries?.find(({ value }) => value === country);\n\n if (\n currentCountry &&\n currentCountry.childRegions.length === 0 &&\n currentCountry.hasAdditionalFields\n ) {\n setSelectedRegion(currentCountry.regionSlug);\n } else {\n setSelectedRegion(undefined);\n }\n setSelectedCountry(currentCountry);\n }\n\n /**\n * Update the selected region and fetch the region fields.\n * @param region\n */\n function onRegionChange(region: string) {\n setSelectedRegion(region);\n }\n\n function onHiringBudgetChange(event: React.ChangeEvent<HTMLInputElement>) {\n setHiringBudget(event.target.value as HiringBudget);\n }\n\n function onChangeCurrency(currency: string) {\n const selectedCurrency = currencies?.find(\n (c) => c.value === currency,\n )?.label;\n setEmployerBillingCurrency(selectedCurrency);\n options?.onCurrencyChange?.(selectedCurrency || '');\n }\n\n const regionField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'region',\n );\n\n if (regionField) {\n const regions =\n selectedCountry?.childRegions.map((region) => ({\n value: region.slug,\n label: region.name,\n })) ?? [];\n regionField.options = regions;\n regionField.isVisible = regions.length > 0;\n regionField.required = regions.length > 0;\n regionField.onChange = onRegionChange;\n regionField.schema =\n regions.length > 0\n ? string()\n .transform((value) => (typeof value === 'string' ? value : ''))\n .required('Region is required')\n : string();\n }\n\n if (currencies) {\n const currencyField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'currency',\n );\n if (currencyField) {\n currencyField.options = currencies;\n currencyField.onChange = onChangeCurrency;\n }\n }\n\n const hiringBudgetField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'hiring_budget',\n );\n if (hiringBudgetField) {\n hiringBudgetField.onChange = onHiringBudgetChange;\n }\n\n if (countries) {\n const countryField = fieldsJSONSchema.fields.find(\n (field) => field.name === 'country',\n );\n if (countryField) {\n countryField.options = countries;\n countryField.onChange = onCountryChange;\n }\n }\n\n const resetForm = () => {\n setSelectedCountry(undefined);\n setSelectedRegion(defaultRegion);\n };\n\n const allFields = [\n ...fieldsJSONSchema.fields.filter((field) => field.name !== 'management'),\n ...(jsonSchemaRegionFields?.fields || []),\n ...fieldsJSONSchema.fields.filter((field) => field.name === 'management'),\n ];\n\n const validationSchema = buildValidationSchema(\n fieldsJSONSchema.fields,\n employerBillingCurrency || 'USD',\n estimationOptions.includeEstimationTitle,\n );\n\n async function handleValidation(values: CostCalculatorEstimationFormValues) {\n let errors: JSFValidationError | null = null;\n\n options?.onValidation?.(values);\n const parsedValues = parseJSFToValidate(values, allFields);\n\n // 1. validate static fields first using Yup validate function\n try {\n await validationSchema.validate(parsedValues, {\n abortEarly: false,\n });\n errors = {\n formErrors: {},\n yupError: new ValidationError([], values),\n };\n } catch (error) {\n const iterateResult = iterateErrors(error as ValidationError);\n\n errors = {\n // convert the errors to a format that can be used in the form\n formErrors: Object.entries(iterateResult).reduce(\n (acc, [key, value]) => ({ ...acc, [key]: value.message }),\n {},\n ),\n yupError: error as ValidationError,\n };\n }\n\n // 2. validate json schema fields using the handleValidation (from json-schema-form)\n const handleValidationResult =\n jsonSchemaRegionFields?.handleValidation(parsedValues);\n\n // 3. combine the errors from both validations\n const combinedInnerErrors = [\n ...(errors?.yupError.inner || []),\n ...(handleValidationResult?.yupError?.inner || []),\n ];\n const combinedValues = {\n ...(errors?.yupError?.value || {}),\n ...(handleValidationResult?.yupError?.value || {}),\n };\n\n return {\n formErrors: {\n ...(errors?.formErrors || {}),\n ...(handleValidationResult?.formErrors || {}),\n },\n yupError: new ValidationError(combinedInnerErrors, combinedValues),\n };\n }\n\n return {\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState: {\n current: 0,\n total: 1,\n isLastStep: true,\n },\n /**\n * Array of form fields from the cost calculator schema + dynamic region fields like benefits, age, etc.\n */\n fields: allFields,\n /**\n * Validation schema for the cost calculator form\n */\n validationSchema,\n /**\n * Function to parse form values before submission\n * @param values - Form values to parse\n * @returns Parsed form values\n */\n parseFormValues: (\n values: CostCalculatorEstimationFormValues,\n ): CostCalculatorEstimationSubmitValues => {\n const {\n country,\n region,\n currency,\n salary_converted,\n hiring_budget,\n salary_conversion,\n management,\n estimation_title,\n ...rest\n } = values;\n\n // If the salary has been converted, we take the one the user has inputted\n let salary = values.salary;\n if (salary_converted === 'salary_conversion') {\n salary = salary_conversion;\n }\n\n const jsonSchemaStaticFieldValues = {\n country,\n region,\n salary,\n salary_converted,\n salary_conversion,\n hiring_budget,\n currency,\n management,\n estimation_title,\n };\n\n const parsedStaticFields = parseJSFToValidate(\n jsonSchemaStaticFieldValues,\n fieldsJSONSchema.fields,\n );\n\n const parsedRegionFields = parseJSFToValidate(\n rest,\n jsonSchemaRegionFields?.fields || [],\n );\n\n return {\n ...parsedStaticFields,\n ...parsedRegionFields,\n } as CostCalculatorEstimationSubmitValues;\n },\n /**\n * Function to handle validation of the cost calculator form\n * @param values - Form values to validate\n * @returns Validation result\n */\n handleValidation,\n /**\n * Whether the cost calculator form is currently being submitted\n */\n isSubmitting: costCalculatorEstimationMutation.isPending,\n /**\n * Whether the cost calculator form is currently loading\n */\n isLoading:\n isLoadingCountries && isLoadingCurrencies && isLoadingRegionFields,\n /**\n * Function to submit the cost calculator form\n */\n onSubmit,\n /**\n * Function to reset the cost calculator form\n */\n resetForm,\n\n /**\n * Currencies data useful to get the currency if you have a currencySlug\n */\n currencies,\n };\n};\n"],"mappings":"6SAMA,OAA0B,UAAAA,GAAQ,UAAAC,OAAc,MCWhD,OAAS,sBAAAC,GAAoB,UAAAC,OAAc,8BAC3C,OAAS,eAAAC,GAAa,aAAAC,EAAW,WAAAC,GAAS,YAAAC,MAAgB,QAC1D,OAAS,UAAAC,EAAQ,mBAAAC,MAAuB,MAoMxB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EAAOU,EAAmBC,CAAO,CACxD,CACF,CACF,CAxCgBhB,EAAAqB,GAAA","names":["number","object","createHeadlessForm","modify","useCallback","useEffect","useMemo","useState","string","ValidationError","jsx","defaultEstimationOptions","useStaticSchema","__name","options","jsonSchemaModified","modify","jsonSchema","createHeadlessForm","getSalaryTitle","salaryField","hiringBudget","title","useCostCalculator","defaultRegion","defaultCurrency","defaultSalary","estimationOptions","version","selectedRegion","setSelectedRegion","useState","selectedCountry","setSelectedCountry","employerBillingCurrency","setEmployerBillingCurrency","setHiringBudget","countries","isLoadingCountries","useCostCalculatorCountries","currencies","isLoadingCurrencies","useCompanyCurrencies","jsonSchemaRegionSlug","jsonSchemaRegionFields","isLoadingRegionFields","useRegionFields","costCalculatorEstimationMutation","useCostCalculatorEstimation","employeeBillingCurrency","salaryFieldPresentation","getCurrencies","useCallback","shouldSwapOrder","showManagementField","showEstimationTitleField","customFields","useMemo","from","to","salaryTitle","props","SalaryField","fieldsJSONSchema","useEffect","defaultCountry","value","defaultCurrencyObj","onSubmit","values","validationSchema","err","resolve","reject","buildPayload","response","error","onCountryChange","country","currentCountry","onRegionChange","region","onHiringBudgetChange","event","onChangeCurrency","currency","selectedCurrency","regionField","field","regions","string","currencyField","hiringBudgetField","countryField","resetForm","allFields","buildValidationSchema","handleValidation","errors","parsedValues","parseJSFToValidate","ValidationError","iterateResult","iterateErrors","acc","key","handleValidationResult","combinedInnerErrors","combinedValues","salary_converted","hiring_budget","salary_conversion","management","estimation_title","rest","salary","parsedStaticFields","parsedRegionFields","buildValidationSchema","fields","employerBillingCurrency","includeEstimationTitle","fieldsSchema","fieldsSchemaAcc","field","__name","val","schema","object","number","value","BASE_RATES","formatBenefits","benefits","needle","acc","key","benefitTierSlug","benefitEntry","mapValueToEmployment","estimationOptions","version","getSalaryFields","isMarketing","isStandard","useHiringBudget","buildPayload","values","defaultEstimationOptions","employments","v","managementFee"]}
@@ -0,0 +1,2 @@
1
+ import{a as R,b as x,c as N,d as A}from"./chunk-4RULC3AZ.js";import{a as T}from"./chunk-ZE3YT3Q6.js";import{a as f}from"./chunk-NBCZF2FO.js";import{a as C}from"./chunk-UHS3QRA3.js";import{a as w}from"./chunk-N5I33LIN.js";import{b as F}from"./chunk-7VUILYZ3.js";import{a as i,b as n}from"./chunk-3LOVCTCN.js";import{a as u}from"./chunk-P37U34EQ.js";import{MoreHorizontal as M}from"lucide-react";import{useState as P}from"react";import{Fragment as G,jsx as g,jsxs as E}from"react/jsx-runtime";function B({actions:e=[],className:r,label:l,"data-testid":a}){let[m,_]=P(!1);return E("div",{className:i("relative",r),children:[g(F,{"data-testid":a,variant:"ghost","aria-label":l,className:"h-8 w-8 p-0",onClick:()=>_(!m),children:g(M,{className:"h-4 w-4"})}),m&&E(G,{children:[g("div",{className:"fixed inset-0 z-40",onClick:()=>_(!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,d)=>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(),_(!1)},disabled:c.disabled,children:c.label},d))})]})]})}u(B,"ActionsDropdown");import{ChevronDown as L,Info as U}from"lucide-react";import $ from"react-flagpack";import{useState as S}from"react";import{Fragment as b,jsx as o,jsxs as t}from"react/jsx-runtime";var j={GB:"GB-UKM"},Z=u(({title:e,country:r,region:l,annualGrossSalary:a,onDelete:m,onExportPdf:_,onEdit:c})=>{let d=[{label:"Edit",onClick:c},{label:"Export",onClick:_},{label:"Delete",onClick:m}];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($,{code:j[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(B,{label:"Actions",className:"RemoteFlows__EstimationResults__ActionsDropdown",actions:d})]})},"EstimationResultsHeader"),K=u(()=>({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 our Terms of Service (ToS), the employee onboarding timeline starts once the employee has been invited to the platform and completed self enrolment.",zendeskArticleId:f.employeeOnboardingTimeline}),"getOnboardingTimelineData");function V({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"})]})]})]})})}u(V,"OnboardingTimeline");function Y({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"})]})})]})})}u(Y,"HiringSection");function q({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"})]})]})}u(q,"EstimationHeaders");function I({label:e,amounts:r,className:l,children:a}){let[m,_]=S(!0);return t("div",{className:i("RemoteFlows__EstimationResults__Row",l),children:[t("div",{className:"grid grid-cols-3 items-center",children:[t("div",{className:"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(L,{className:`h-4 w-4 text-muted-foreground transition-transform ${m?"rotate-180":""}`})})]}),Array.isArray(r)?r.map((c,d)=>o("span",{className:i("RemoteFlows__EstimationRow__RegionalAmount text-right font-medium text-[#09090B]"),children:c},d)):t(b,{children:[o("span",{}),o("span",{className:i("RemoteFlows__EstimationRow__EmployerAmount text-right font-medium text-[#09090B]"),children:r})]})]}),m&&a&&o("div",{className:"RemoteFlows__EstimationRow__CollapsibleContent mt-4",children:a})]})}u(I,"EstimationRow");function J({item:e,isMultipleCurrency:r,level:l=0}){let[a,m]=S(!1),_=e.children&&e.children.length>0,c=l>0,d=e.isCollapsible||_;return t("li",{className:i("RemoteFlows__BreakdownList__Item pb-3",c&&"pb-1"),children:[t("div",{className:i(r?"grid grid-cols-3 items-center justify-between":"grid grid-cols-2 items-center justify-between"),children:[t("div",{className:i("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"}),d?t("button",{onClick:()=>m(!a),className:"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(L,{className:`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",{children: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(U,{className:i("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"})]}),_&&a&&o("div",{className:"mt-1",children:o(h,{items:e.children,isMultipleCurrency:r,level:l+1})})]})}u(J,"BreakdownListItem");function h({items:e,isMultipleCurrency:r,className:l,level:a}){return o("ul",{className:i("RemoteFlows__BreakdownList list-none",l),children:e.map((m,_)=>o(J,{item:m,isMultipleCurrency:r,level:a},_))})}u(h,"BreakdownList");var ye=u(({estimation:e,title:r,components:l,onDelete:a,onExportPdf:m,onEdit:_})=>{let c=l?.HiringSection||Y,d=l?.OnboardingTimeline||V,O=l?.Header||Z,k=l?.Footer,z=K(),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,H=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(O,{title:r,annualGrossSalary:H,region:D?e.region:void 0,country:e.country,onDelete:a,onExportPdf:m,onEdit:_})}),t("div",{className:"RemoteFlows__Separator",children:[o(q,{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(h,{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:"Core 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:"Management 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(h,{items:[{label:"Annual gross 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:"Core 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:"Management 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(d,{minimumOnboardingDays:e.minimum_onboarding_time,data:z})}),o(c,{countryBenefitsUrl:e.country_benefits_details_url,countryGuideUrl:e.country_guide_url,country:e.country}),k&&o(k,{})]})},"EstimationResults");export{ye as a};
2
+ //# sourceMappingURL=chunk-HVTGLVLT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/shared/actions-dropdown/ActionsDropdown.tsx","../src/flows/CostCalculator/EstimationResults/EstimationResults.tsx"],"sourcesContent":["import { Button } from '@/src/components/ui/button';\nimport { cn } from '@/src/lib/utils';\nimport { MoreHorizontal } from 'lucide-react';\nimport { useState, type ReactNode } from 'react';\n\nexport interface DropdownAction {\n label: string;\n icon?: ReactNode;\n onClick: () => void;\n separator?: boolean;\n disabled?: boolean;\n}\n\ninterface ActionsDropdownProps {\n actions?: DropdownAction[];\n label?: string;\n className?: string;\n 'data-testid'?: string;\n}\n\nexport function ActionsDropdown({\n actions = [],\n className,\n label,\n 'data-testid': dataSelector,\n}: ActionsDropdownProps) {\n const [isOpen, setIsOpen] = useState(false);\n\n return (\n <div className={cn('relative', className)}>\n <Button\n data-testid={dataSelector}\n variant='ghost'\n aria-label={label}\n className='h-8 w-8 p-0'\n onClick={() => setIsOpen(!isOpen)}\n >\n <MoreHorizontal className='h-4 w-4' />\n </Button>\n\n {isOpen && (\n <>\n <div\n className='fixed inset-0 z-40'\n onClick={() => setIsOpen(false)}\n />\n <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]'>\n {actions.map((action, index) => (\n <button\n key={index}\n data-testid={`${dataSelector}-${action.label.toLowerCase().replace(' ', '-')}`}\n className={cn(\n 'w-full text-left px-2 py-1.5 text-sm hover:bg-gray-100',\n action.disabled && 'opacity-50 cursor-not-allowed',\n )}\n onClick={() => {\n action.onClick();\n setIsOpen(false);\n }}\n disabled={action.disabled}\n >\n {action.label}\n </button>\n ))}\n </div>\n </>\n )}\n </div>\n );\n}\n","import { MinimalCountry, MinimalRegion } from '@/src/client';\nimport { ActionsDropdown } from '@/src/components/shared/actions-dropdown/ActionsDropdown';\nimport { Card } from '@/src/components/ui/card';\nimport { ChevronDown, Info } from 'lucide-react';\nimport Flag from 'react-flagpack';\nimport { useState } from 'react';\nimport {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n} from '@/src/components/ui/accordion';\nimport { cn, formatCurrency } from '@/src/lib/utils';\nimport { ZendeskTriggerButton } from '@/src/components/shared/zendesk-drawer/ZendeskTriggerButton';\nimport { zendeskArticles } from '@/src/components/shared/zendesk-drawer/utils';\nimport { BasicTooltip } from '@/src/components/ui/basic-tooltip';\nimport { CostCalculatorEstimation } from '@/src/flows/CostCalculator/types';\n\nconst FLAG_CODE_MAPPING: Record<string, string> = {\n GB: 'GB-UKM',\n};\n\nconst EstimationResultsHeader = ({\n title,\n country,\n region,\n annualGrossSalary,\n onDelete,\n onExportPdf,\n onEdit,\n}: {\n title: string;\n country: MinimalCountry;\n region?: MinimalRegion;\n annualGrossSalary: string;\n onDelete: () => void;\n onExportPdf: () => void;\n onEdit: () => void;\n}) => {\n const actions = [\n {\n label: 'Edit',\n onClick: onEdit,\n },\n {\n label: 'Export',\n onClick: onExportPdf,\n },\n {\n label: 'Delete',\n onClick: onDelete,\n },\n ];\n return (\n <div className='RemoteFlows__EstimationResults__Header flex justify-between'>\n <div className='flex flex-row items-center gap-6'>\n <div className='RemoteFlows__EstimationResultsHeader__FlagContainer flex h-16 w-16 items-center justify-center rounded-lg bg-[#F4F4F5]'>\n <Flag\n code={\n FLAG_CODE_MAPPING[country.alpha_2_code] || country.alpha_2_code\n }\n />\n </div>\n <div className='space-y-1'>\n <h2\n data-testid='estimation-results-header-title'\n className='RemoteFlows__EstimationResultsHeader__Title text-lg font-medium leading-none text-[#181818]'\n >\n {title}\n </h2>\n <p className='RemoteFlows__EstimationResultsHeader__Country text-xs text-[#71717A]'>\n {country.name} {region ? ` (${region.name})` : ''}\n </p>\n <p\n data-testid='estimation-results-header-annual-gross-salary'\n className='RemoteFlows__EstimationResultsHeader__AnnualGrossSalary text-xs text-[#71717A]'\n >\n <span className='text-[#181818]'>\n Employee annual gross salary:\n </span>{' '}\n {annualGrossSalary}\n </p>\n </div>\n </div>\n <ActionsDropdown\n label='Actions'\n className='RemoteFlows__EstimationResults__ActionsDropdown'\n actions={actions}\n />\n </div>\n );\n};\n\ninterface OnboardingTimelineStep {\n title: string;\n description: string;\n id: string;\n}\n\ninterface OnboardingTimelineData {\n steps: OnboardingTimelineStep[];\n helpText: string;\n zendeskArticleId?: number;\n}\n\nconst getOnboardingTimelineData = (): OnboardingTimelineData => {\n return {\n steps: [\n {\n id: 'add-employment-details',\n title: 'Add employment details',\n description: 'You add employee employments details.',\n },\n {\n id: 'invite-employee',\n title: 'Invite employee',\n description:\n 'Hire receives an email invitation from Remote to start the self-enrollment process.',\n },\n {\n id: 'verify-information',\n title: 'Verify information',\n description:\n 'Remote prepares the Employment Agreement and verifies all the information.',\n },\n {\n id: 'sign-contract',\n title: 'Sign contract',\n description:\n 'All parties sign the Employment Agreement and are ready to start. 🎉',\n },\n ],\n helpText:\n 'For customers who accept our Terms of Service (ToS), the employee onboarding timeline starts once the employee has been invited to the platform and completed self enrolment.',\n zendeskArticleId: zendeskArticles.employeeOnboardingTimeline,\n };\n};\n\nfunction OnboardingTimeline({\n minimumOnboardingDays,\n data,\n className,\n}: {\n minimumOnboardingDays: number | null;\n data: OnboardingTimelineData;\n className?: string;\n}) {\n return (\n <Accordion\n type='single'\n collapsible\n className={cn(\n 'RemoteFlows__EstimationResults__OnboardingTimeline w-full',\n className,\n )}\n >\n <AccordionItem\n value='timeline'\n className='RemoteFlows__OnboardingTimeline__AccordionItem border-border'\n >\n <AccordionTrigger className='RemoteFlows__OnboardingTimeline__AccordionTrigger hover:no-underline px-0 py-4'>\n <div className='flex items-center justify-between w-full'>\n <span className='RemoteFlows__OnboardingTimeline__Title text-base font-medium text-[#0F172A]'>\n Onboarding timeline\n </span>\n {minimumOnboardingDays != null && (\n <span className='RemoteFlows__OnboardingTimeline__Description text-base text-muted-foreground mr-4'>\n {minimumOnboardingDays} days\n </span>\n )}\n </div>\n </AccordionTrigger>\n <AccordionContent className='px-0 pb-4'>\n <ul className='RemoteFlows__OnboardingTimeline__List list-disc list-inside space-y-2'>\n {data.steps.map((step) => (\n <li key={step.id}>\n <strong className='font-medium text-[#09090B]'>\n {step.title}\n </strong>{' '}\n - {step.description}\n </li>\n ))}\n </ul>\n <p className='RemoteFlows__OnboardingTimeline__HelpText text-xs text-muted-foreground mt-4'>\n {data.helpText}\n {data.zendeskArticleId && (\n <ZendeskTriggerButton zendeskId={data.zendeskArticleId}>\n Learn more\n </ZendeskTriggerButton>\n )}\n </p>\n </AccordionContent>\n </AccordionItem>\n </Accordion>\n );\n}\n\nfunction HiringSection({\n className,\n countryBenefitsUrl,\n countryGuideUrl,\n country,\n}: {\n className?: string;\n countryBenefitsUrl: string;\n countryGuideUrl: string;\n country: MinimalCountry;\n}) {\n return (\n <Accordion\n type='single'\n collapsible\n className={cn(\n 'RemoteFlows__EstimationResults__HiringSection w-full',\n className,\n )}\n >\n <AccordionItem\n value='timeline'\n className='RemoteFlows__HiringSection__AccordionItem border-border'\n >\n <AccordionTrigger className='RemoteFlows__HiringSection__AccordionTrigger hover:no-underline px-0 py-4'>\n <div className='flex items-center justify-between w-full'>\n <span className='text-base font-medium text-[#0F172A]'>\n Hiring in {country.name}\n </span>\n </div>\n </AccordionTrigger>\n <AccordionContent>\n <div className='flex flex-col gap-1'>\n {countryGuideUrl && (\n <a\n href={countryGuideUrl}\n target='_blank'\n className='RemoteFlows__Link'\n >\n Explore our complete guide ↗\n </a>\n )}\n {countryBenefitsUrl && (\n <a\n href={countryBenefitsUrl}\n target='_blank'\n className='RemoteFlows__Link'\n >\n Explore our available benefits ↗\n </a>\n )}\n </div>\n </AccordionContent>\n </AccordionItem>\n </Accordion>\n );\n}\n\nfunction EstimationHeaders({\n isMultipleCurrency,\n className,\n}: {\n isMultipleCurrency: boolean;\n className?: string;\n}) {\n return (\n <div\n className={cn(\n 'RemoteFlows__EstimationResults__Headers grid grid-cols-3 items-center',\n className,\n )}\n >\n <span aria-hidden />\n {isMultipleCurrency ? (\n <>\n <span className='RemoteFlows__EstimationResults__Headers__Label'>\n Employee currency\n </span>\n <span className='RemoteFlows__EstimationResults__Headers__Label'>\n Employer currency\n </span>\n </>\n ) : (\n <>\n <span></span>\n <span className='RemoteFlows__EstimationResults__Headers__Label'>\n Amount\n </span>\n </>\n )}\n </div>\n );\n}\n\nfunction EstimationRow({\n label,\n amounts,\n className,\n children,\n}: {\n label: string | React.ReactNode;\n amounts: string | string[];\n className?: string;\n children?: React.ReactNode;\n}) {\n const [isOpen, setIsOpen] = useState(true);\n\n return (\n <div className={cn('RemoteFlows__EstimationResults__Row', className)}>\n <div className='grid grid-cols-3 items-center'>\n <div className='flex items-center gap-2'>\n <span\n className={cn(\n 'RemoteFlows__EstimationRow__Title min-w-[140px] font-medium text-[#09090B]',\n )}\n >\n {label}\n </span>\n <button\n onClick={() => setIsOpen(!isOpen)}\n className='RemoteFlows__EstimationRow__CollapseButton p-1 hover:bg-gray-100 rounded'\n >\n <ChevronDown\n className={`h-4 w-4 text-muted-foreground transition-transform ${\n isOpen ? 'rotate-180' : ''\n }`}\n />\n </button>\n </div>\n\n {Array.isArray(amounts) ? (\n amounts.map((amount, index) => (\n <span\n key={index}\n className={cn(\n 'RemoteFlows__EstimationRow__RegionalAmount text-right font-medium text-[#09090B]',\n )}\n >\n {amount}\n </span>\n ))\n ) : (\n <>\n <span></span>\n <span\n className={cn(\n 'RemoteFlows__EstimationRow__EmployerAmount text-right font-medium text-[#09090B]',\n )}\n >\n {amounts}\n </span>\n </>\n )}\n </div>\n\n {/* Collapsible content */}\n {isOpen && children && (\n <div className='RemoteFlows__EstimationRow__CollapsibleContent mt-4'>\n {children}\n </div>\n )}\n </div>\n );\n}\n\ninterface BreakdownItem {\n label: string;\n tooltip?: string;\n dataSelector?: string;\n regionalAmount?: string;\n employerAmount?: string;\n description?: string;\n zendeskId?: string;\n isCollapsible?: boolean;\n children?: BreakdownItem[];\n}\n\nfunction BreakdownListItem({\n item,\n isMultipleCurrency,\n level = 0,\n}: {\n item: BreakdownItem;\n isMultipleCurrency: boolean;\n level?: number;\n}) {\n const [isOpen, setIsOpen] = useState(false);\n const hasChildren = item.children && item.children.length > 0;\n const isNested = level > 0;\n const isCollapsible = item.isCollapsible || hasChildren;\n\n return (\n <li\n className={cn(\n 'RemoteFlows__BreakdownList__Item pb-3',\n isNested && 'pb-1',\n )}\n >\n <div\n className={cn(\n isMultipleCurrency\n ? 'grid grid-cols-3 items-center justify-between'\n : 'grid grid-cols-2 items-center justify-between',\n )}\n >\n <div className={cn('flex items-center gap-2', isNested && 'pl-3')}>\n {!isNested && (\n <span\n className='RemoteFlows__BreakdownList__Bullet w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0'\n aria-hidden='true'\n />\n )}\n\n {isCollapsible ? (\n <button\n onClick={() => setIsOpen(!isOpen)}\n className='flex items-center gap-2 hover:bg-gray-100 rounded p-1'\n >\n <span\n className={cn(\n isNested\n ? 'RemoteFlows__BreakdownList__Text--Nested text-xs text-[#71717A]'\n : 'RemoteFlows__BreakdownList__Text--NotNested text-sm text-[#09090B]',\n )}\n >\n {item.label}\n </span>\n <ChevronDown\n className={`h-3 w-3 text-muted-foreground transition-transform ${\n isOpen ? 'rotate-180' : ''\n }`}\n />\n </button>\n ) : (\n <span\n className={cn(\n isNested\n ? 'RemoteFlows__BreakdownList__Text--Nested text-xs text-[#71717A]'\n : 'RemoteFlows__BreakdownList__Text--NotNested text-sm text-[#09090B] p-1',\n )}\n >\n {item.label}\n </span>\n )}\n\n {item.tooltip && (\n <BasicTooltip\n content={\n <>\n <span>{item.tooltip}</span>{' '}\n {item.zendeskId && (\n <ZendeskTriggerButton zendeskId={Number(item.zendeskId)}>\n Learn more\n </ZendeskTriggerButton>\n )}\n </>\n }\n >\n <button className='RemoteFlows__BreakdownList__InfoButton p-1 hover:bg-gray-100 rounded'>\n <Info\n className={cn(\n 'text-muted-foreground',\n isNested ? 'h-3 w-3' : 'h-4 w-4',\n )}\n />\n </button>\n </BasicTooltip>\n )}\n </div>\n\n {isMultipleCurrency ? (\n <>\n <span\n data-testid={\n item.dataSelector && item.dataSelector + '-employee-amount'\n }\n className={cn(\n 'RemoteFlows__BreakdownList__RegionalAmountText text-sm text-right',\n isNested\n ? 'RemoteFlows__BreakdownList__RegionalAmountText--Nested text-[#71717A]'\n : 'RemoteFlows__BreakdownList__RegionalAmountText--NotNested text-[#09090B]',\n )}\n >\n {item.regionalAmount || '—'}\n </span>\n <span\n data-testid={\n item.dataSelector && item.dataSelector + '-employer-amount'\n }\n className={cn(\n 'RemoteFlows__BreakdownList__EmployerAmountText text-sm text-right',\n isNested\n ? 'RemoteFlows__BreakdownList__EmployerAmountText--Nested text-[#71717A]'\n : 'RemoteFlows__BreakdownList__EmployerAmountText--NotNested text-[#09090B]',\n )}\n >\n {item.employerAmount || '—'}\n </span>\n </>\n ) : (\n <span\n data-testid={item.dataSelector}\n className={cn(\n 'RemoteFlows__BreakdownList__RegionalAmountText text-sm text-right',\n isNested\n ? 'RemoteFlows__BreakdownList__RegionalAmountText--Nested text-[#71717A]'\n : 'RemoteFlows__BreakdownList__RegionalAmountText--NotNested text-[#09090B]',\n )}\n >\n {item.regionalAmount || '—'}\n </span>\n )}\n </div>\n\n {hasChildren && isOpen && (\n <div className='mt-1'>\n <BreakdownList\n items={item.children!}\n isMultipleCurrency={isMultipleCurrency}\n level={level + 1}\n />\n </div>\n )}\n </li>\n );\n}\n\ninterface BreakdownListProps {\n items: BreakdownItem[];\n isMultipleCurrency: boolean;\n className?: string;\n level?: number;\n}\n\nfunction BreakdownList({\n items,\n isMultipleCurrency,\n className,\n level,\n}: BreakdownListProps) {\n return (\n <ul className={cn('RemoteFlows__BreakdownList list-none', className)}>\n {items.map((item, index) => (\n <BreakdownListItem\n key={index}\n item={item}\n isMultipleCurrency={isMultipleCurrency}\n level={level}\n />\n ))}\n </ul>\n );\n}\n\ntype EstimationResultsComponents = {\n HiringSection?: React.ComponentType<{\n country: MinimalCountry;\n countryBenefitsUrl: string;\n countryGuideUrl: string;\n }>;\n OnboardingTimeline?: React.ComponentType<{\n minimumOnboardingDays: number | null;\n data: OnboardingTimelineData;\n }>;\n Header?: React.ComponentType<{\n title: string;\n region?: MinimalRegion;\n country: MinimalCountry;\n onDelete: () => void;\n onExportPdf: () => void;\n }>;\n Footer?: React.ComponentType;\n};\n\ntype EstimationResultsProps = {\n estimation: CostCalculatorEstimation;\n title: string;\n components?: EstimationResultsComponents;\n onDelete: () => void;\n onExportPdf: () => void;\n onEdit: () => void;\n};\n\nexport const EstimationResults = ({\n estimation,\n title,\n components,\n onDelete,\n onExportPdf,\n onEdit,\n}: EstimationResultsProps) => {\n const CustomHiringSection = components?.HiringSection || HiringSection;\n const CustomOnboardingTimeline =\n components?.OnboardingTimeline || OnboardingTimeline;\n const CustomHeader = components?.Header || EstimationResultsHeader;\n const CustomFooter = components?.Footer;\n\n const onboardingTimelineData = getOnboardingTimelineData();\n\n const isMultipleCurrency =\n estimation.employer_currency_costs.currency.code !==\n estimation.regional_currency_costs.currency.code;\n\n const hasManagementFee =\n estimation.employer_currency_costs.monthly_management_fee;\n\n const hasRegion = estimation.region.code !== estimation.country.code;\n\n const formattedSalary = formatCurrency(\n estimation.regional_currency_costs.annual_gross_salary,\n estimation.regional_currency_costs.currency.symbol,\n );\n\n return (\n <Card className='RemoteFlows__EstimationResults__Card p-10'>\n <div className='RemoteFlows__Separator'>\n <CustomHeader\n title={title}\n annualGrossSalary={formattedSalary}\n region={hasRegion ? estimation.region : undefined}\n country={estimation.country}\n onDelete={onDelete}\n onExportPdf={onExportPdf}\n onEdit={onEdit}\n />\n </div>\n <div className='RemoteFlows__Separator'>\n <EstimationHeaders\n isMultipleCurrency={isMultipleCurrency}\n className='mb-3'\n />\n <EstimationRow\n label='Monthly total cost'\n amounts={\n isMultipleCurrency\n ? [\n formatCurrency(\n estimation.regional_currency_costs.monthly_total,\n estimation.regional_currency_costs.currency.symbol,\n ),\n formatCurrency(\n estimation.employer_currency_costs.monthly_total,\n estimation.employer_currency_costs.currency.symbol,\n ),\n ]\n : formatCurrency(\n estimation.regional_currency_costs.monthly_total,\n estimation.regional_currency_costs.currency.symbol,\n )\n }\n >\n <BreakdownList\n items={[\n {\n label: 'Gross monthly salary',\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs.monthly_gross_salary,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n estimation.employer_currency_costs.monthly_gross_salary,\n estimation.employer_currency_costs.currency.symbol,\n ),\n zendeskId: zendeskArticles.extraPayments.toString(),\n tooltip:\n 'This country respects extra payments on top of the gross salary.',\n },\n {\n label: 'Mandatory employer costs',\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs\n .monthly_contributions_total,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n estimation.employer_currency_costs\n .monthly_contributions_total,\n estimation.employer_currency_costs.currency.symbol,\n ),\n children:\n estimation.employer_currency_costs.monthly_contributions_breakdown?.map(\n (item, index) => {\n return {\n label: item.name,\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs\n .monthly_contributions_breakdown?.[index]?.amount,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n item.amount,\n estimation.employer_currency_costs.currency.symbol,\n ),\n zendeskId: item.zendesk_article_id || undefined,\n tooltip: item.description || undefined,\n };\n },\n ) || [],\n },\n {\n label: 'Core benefits',\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs.monthly_benefits_total,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n estimation.employer_currency_costs.monthly_benefits_total,\n estimation.employer_currency_costs.currency.symbol,\n ),\n children:\n estimation.employer_currency_costs.monthly_benefits_breakdown?.map(\n (item, index) => ({\n label: item.name,\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs\n .monthly_benefits_breakdown?.[index]?.amount,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n item.amount,\n estimation.employer_currency_costs.currency.symbol,\n ),\n zendeskId: item.zendesk_article_id || undefined,\n tooltip: item.description || undefined,\n }),\n ) || [],\n },\n ...(hasManagementFee\n ? [\n {\n label: 'Management fee',\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs\n .monthly_management_fee,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n estimation.employer_currency_costs\n .monthly_management_fee,\n estimation.employer_currency_costs.currency.symbol,\n ),\n tooltip:\n 'Discounts may be available based on your commitment and team size. Speak to your account or customer success manager to learn more.',\n },\n ]\n : []),\n ]}\n isMultipleCurrency={isMultipleCurrency}\n />\n </EstimationRow>\n </div>\n <div className='RemoteFlows__Separator'>\n <EstimationRow\n label='Annual total cost'\n amounts={\n isMultipleCurrency\n ? [\n formatCurrency(\n estimation.regional_currency_costs.annual_total,\n estimation.regional_currency_costs.currency.symbol,\n ),\n formatCurrency(\n estimation.employer_currency_costs.annual_total,\n estimation.employer_currency_costs.currency.symbol,\n ),\n ]\n : formatCurrency(\n estimation.regional_currency_costs.annual_total,\n estimation.regional_currency_costs.currency.symbol,\n )\n }\n >\n <BreakdownList\n items={[\n {\n label: 'Annual gross salary',\n dataSelector: 'annual-gross-salary',\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs.annual_gross_salary,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n estimation.employer_currency_costs.annual_gross_salary,\n estimation.employer_currency_costs.currency.symbol,\n ),\n },\n {\n label: 'Mandatory employer costs',\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs.annual_contributions_total,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n estimation.employer_currency_costs.annual_contributions_total,\n estimation.employer_currency_costs.currency.symbol,\n ),\n children:\n estimation.employer_currency_costs.annual_contributions_breakdown?.map(\n (item, index) => ({\n label: item.name,\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs\n .annual_contributions_breakdown?.[index]?.amount,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n item.amount,\n estimation.employer_currency_costs.currency.symbol,\n ),\n zendeskId: item.zendesk_article_id || undefined,\n tooltip: item.description || undefined,\n }),\n ) || [],\n },\n {\n label: 'Core benefits',\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs.annual_benefits_total,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n estimation.employer_currency_costs.annual_benefits_total,\n estimation.employer_currency_costs.currency.symbol,\n ),\n children:\n estimation.employer_currency_costs.annual_benefits_breakdown?.map(\n (item, index) => ({\n label: item.name,\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs\n .annual_benefits_breakdown?.[index]?.amount,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n item.amount,\n estimation.employer_currency_costs.currency.symbol,\n ),\n zendeskId: item.zendesk_article_id || undefined,\n tooltip: item.description || undefined,\n }),\n ) || [],\n },\n {\n label: 'Extra statutory payments',\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs\n .extra_statutory_payments_total,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n estimation.employer_currency_costs\n .extra_statutory_payments_total,\n estimation.employer_currency_costs.currency.symbol,\n ),\n children:\n estimation.employer_currency_costs.extra_statutory_payments_breakdown?.map(\n (item, index) => ({\n label: item.name,\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs\n .extra_statutory_payments_breakdown?.[index]?.amount,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n item.amount,\n estimation.employer_currency_costs.currency.symbol,\n ),\n zendeskId: item.zendesk_article_id || undefined,\n tooltip: item.description || undefined,\n }),\n ) || [],\n },\n ...(hasManagementFee\n ? [\n {\n label: 'Management fee',\n regionalAmount: formatCurrency(\n estimation.regional_currency_costs\n .annual_management_fee,\n estimation.regional_currency_costs.currency.symbol,\n ),\n employerAmount: formatCurrency(\n estimation.employer_currency_costs\n .annual_management_fee,\n estimation.employer_currency_costs.currency.symbol,\n ),\n tooltip:\n 'Discounts may be available based on your commitment and team size. Speak to your account or customer success manager to learn more.',\n },\n ]\n : []),\n ]}\n isMultipleCurrency={isMultipleCurrency}\n />\n </EstimationRow>\n </div>\n <div className='RemoteFlows__Separator'>\n <CustomOnboardingTimeline\n minimumOnboardingDays={estimation.minimum_onboarding_time}\n data={onboardingTimelineData}\n />\n </div>\n\n <CustomHiringSection\n countryBenefitsUrl={estimation.country_benefits_details_url as string}\n countryGuideUrl={estimation.country_guide_url as string}\n country={estimation.country}\n />\n\n {CustomFooter && <CustomFooter />}\n </Card>\n );\n};\n"],"mappings":"4VAEA,OAAS,kBAAAA,MAAsB,eAC/B,OAAS,YAAAC,MAAgC,QAkCjC,OAIA,YAAAC,EAJA,OAAAC,EAIA,QAAAC,MAJA,oBAjBD,SAASC,EAAgB,CAC9B,QAAAC,EAAU,CAAC,EACX,UAAAC,EACA,MAAAC,EACA,cAAeC,CACjB,EAAyB,CACvB,GAAM,CAACC,EAAQC,CAAS,EAAIC,EAAS,EAAK,EAE1C,OACER,EAAC,OAAI,UAAWS,EAAG,WAAYN,CAAS,EACtC,UAAAJ,EAACW,EAA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,EAAA,CACC,mBAAoBF,EAAW,6BAC/B,gBAAiBA,EAAW,kBAC5B,QAASA,EAAW,QACtB,EAECK,GAAgB3D,EAAC2D,EAAA,EAAa,GACjC,CAEJ,EAzUiC","names":["MoreHorizontal","useState","Fragment","jsx","jsxs","ActionsDropdown","actions","className","label","dataSelector","isOpen","setIsOpen","useState","cn","Button","MoreHorizontal","action","index","__name","ChevronDown","Info","Flag","useState","Fragment","jsx","jsxs","FLAG_CODE_MAPPING","EstimationResultsHeader","__name","title","country","region","annualGrossSalary","onDelete","onExportPdf","onEdit","actions","Flag","ActionsDropdown","getOnboardingTimelineData","zendeskArticles","OnboardingTimeline","minimumOnboardingDays","data","className","Accordion","cn","AccordionItem","AccordionTrigger","AccordionContent","step","ZendeskTriggerButton","HiringSection","countryBenefitsUrl","countryGuideUrl","EstimationHeaders","isMultipleCurrency","EstimationRow","label","amounts","children","isOpen","setIsOpen","useState","ChevronDown","amount","index","BreakdownListItem","item","level","hasChildren","isNested","isCollapsible","BasicTooltip","Info","BreakdownList","items","EstimationResults","estimation","components","CustomHiringSection","CustomOnboardingTimeline","CustomHeader","CustomFooter","onboardingTimelineData","hasManagementFee","hasRegion","formattedSalary","formatCurrency","Card"]}
@@ -0,0 +1,2 @@
1
+ import{c as f,d}from"./chunk-34JNRT23.js";import{a as u}from"./chunk-HN5HLFTB.js";import{a as m}from"./chunk-KSHK3ZPX.js";import{b as C}from"./chunk-CFIJKJXD.js";import{f as g}from"./chunk-3BREUYLG.js";import{a as c}from"./chunk-P37U34EQ.js";import{useEffect as b,useId as h,useState as E}from"react";import{jsx as P}from"react/jsx-runtime";var y=c((r,e,o)=>o&&o[e]?o[e]:r[e]?r[e]/100:0,"getDefaultManagementFee"),T=c(({estimationOptions:r=f,defaultValues:e={countryRegionSlug:"",currencySlug:"",salary:"",benefits:{}},options:o,render:S,version:p="standard"})=>{let F=h(),[R,i]=E("USD"),_=c(s=>{i(s);let t=y(u,s,r.managementFees);t&&a.setValue("management.management_fee",t)},"onCurrencyChange"),n=d({defaultRegion:e.countryRegionSlug,defaultCurrency:e.currencySlug,defaultSalary:e.salary,estimationOptions:r,version:p,options:{...o,onCurrencyChange:_}}),v=C(n.handleValidation),K=e.currencySlug?"":y(u,R,r.managementFees),a=g({resolver:v,defaultValues:{country:e?.countryRegionSlug,currency:e?.currencySlug,region:"",salary:e?.salary,salary_conversion:"",salary_converted:"",hiring_budget:"employee_annual_salary",management:{management_fee:K},benefits:e?.benefits,estimation_title:r.title},shouldUnregister:!1,mode:"onBlur"});return b(()=>{if(e.currencySlug&&n.currencies&&r.includeManagementFee){let t=n.currencies.find(l=>l.value===e.currencySlug)?.label;if(t){i(t);let l=y(u,t,r.managementFees);a.setValue("management.management_fee",l)}}},[e.currencySlug,n.currencies,r.includeManagementFee,r.managementFees,a]),P(m.Provider,{value:{form:a,formId:F,costCalculatorBag:n},children:S(n)})},"CostCalculatorFlow");export{T as a};
2
+ //# sourceMappingURL=chunk-IEYBG2G5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/flows/CostCalculator/CostCalculatorFlow.tsx"],"sourcesContent":["import React, { useEffect, useId, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { useJsonSchemasValidationFormResolver } from '@/src/components/form/yupValidationResolver';\nimport { CostCalculatorContext } from '@/src/flows/CostCalculator/context';\nimport {\n CostCalculatorVersion,\n defaultEstimationOptions,\n useCostCalculator,\n} from '@/src/flows/CostCalculator/hooks';\nimport {\n CostCalculatorEstimationOptions,\n CurrencyKey,\n UseCostCalculatorOptions,\n} from '@/src/flows/CostCalculator/types';\nimport { BASE_RATES } from '@/src/flows/CostCalculator/constants';\n\nexport type CostCalculatorFlowProps = {\n /**\n * Estimation params allows you to customize the parameters sent to the /cost-calculator/estimation endpoint.\n */\n estimationOptions?: CostCalculatorEstimationOptions;\n /**\n * Default values for the form fields.\n */\n defaultValues?: Partial<{\n /**\n * Default value for the country field.\n */\n countryRegionSlug: string;\n /**\n * Default value for the currency field.\n */\n currencySlug: string;\n /**\n * Default value for the salary field.\n */\n salary: string;\n /**\n * Default value for the benefits field.\n */\n benefits: Record<string, string>;\n }>;\n options?: UseCostCalculatorOptions;\n render: (\n costCalculatorBag: ReturnType<typeof useCostCalculator>,\n ) => React.ReactNode;\n /**\n * Whether to include annual_gross_salary in the estimation payload\n */\n version?: CostCalculatorVersion;\n};\n\nconst getDefaultManagementFee = (\n baseRates: Record<CurrencyKey, number>,\n currency: CurrencyKey,\n managementFees?: Partial<Record<CurrencyKey, number>>,\n) => {\n if (managementFees && managementFees[currency]) {\n return managementFees[currency];\n }\n if (baseRates[currency]) {\n return baseRates[currency] / 100;\n }\n return 0;\n};\n\nexport const CostCalculatorFlow = ({\n estimationOptions = defaultEstimationOptions,\n defaultValues = {\n countryRegionSlug: '',\n currencySlug: '',\n salary: '',\n benefits: {},\n },\n options,\n render,\n version = 'standard',\n}: CostCalculatorFlowProps) => {\n const formId = useId();\n const [currency, setCurrency] = useState<CurrencyKey>('USD');\n const onCurrencyChange = (currency: string) => {\n setCurrency(currency as CurrencyKey);\n const managementFee = getDefaultManagementFee(\n BASE_RATES,\n currency as CurrencyKey,\n estimationOptions.managementFees,\n );\n if (managementFee) {\n form.setValue('management.management_fee', managementFee);\n }\n };\n const costCalculatorBag = useCostCalculator({\n defaultRegion: defaultValues.countryRegionSlug,\n defaultCurrency: defaultValues.currencySlug,\n defaultSalary: defaultValues.salary,\n estimationOptions,\n version,\n options: {\n ...options,\n onCurrencyChange: onCurrencyChange,\n },\n });\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n costCalculatorBag.handleValidation,\n );\n\n const defaultManagementFee = defaultValues.currencySlug\n ? ''\n : getDefaultManagementFee(\n BASE_RATES,\n currency,\n estimationOptions.managementFees,\n );\n\n const form = useForm({\n resolver,\n defaultValues: {\n country: defaultValues?.countryRegionSlug,\n currency: defaultValues?.currencySlug,\n region: '',\n salary: defaultValues?.salary,\n salary_conversion: '',\n salary_converted: '',\n management: {\n management_fee: defaultManagementFee,\n },\n benefits: defaultValues?.benefits,\n },\n shouldUnregister: false,\n mode: 'onBlur',\n });\n\n useEffect(() => {\n if (\n defaultValues.currencySlug &&\n costCalculatorBag.currencies &&\n estimationOptions.includeManagementFee\n ) {\n const currencyData = costCalculatorBag.currencies.find(\n (currency) => currency.value === defaultValues.currencySlug,\n );\n const currencyCode = currencyData?.label;\n if (currencyCode) {\n setCurrency(currencyCode as CurrencyKey);\n const defaultManagementFee = getDefaultManagementFee(\n BASE_RATES,\n currencyCode as CurrencyKey,\n estimationOptions.managementFees,\n );\n form.setValue('management.management_fee', defaultManagementFee);\n }\n }\n }, [\n defaultValues.currencySlug,\n costCalculatorBag.currencies,\n estimationOptions.includeManagementFee,\n estimationOptions.managementFees,\n form,\n ]);\n\n return (\n <CostCalculatorContext.Provider\n value={{\n form,\n formId: formId,\n costCalculatorBag,\n }}\n >\n {render(costCalculatorBag)}\n </CostCalculatorContext.Provider>\n );\n};\n"],"mappings":"kPAAA,OAAgB,aAAAA,EAAW,SAAAC,EAAO,YAAAC,MAAgB,QAkK9C,cAAAC,MAAA,oBA9GJ,IAAMC,EAA0BC,EAAA,CAC9BC,EACAC,EACAC,IAEIA,GAAkBA,EAAeD,CAAQ,EACpCC,EAAeD,CAAQ,EAE5BD,EAAUC,CAAQ,EACbD,EAAUC,CAAQ,EAAI,IAExB,EAXuB,2BAcnBE,EAAqBJ,EAAA,CAAC,CACjC,kBAAAK,EAAoBC,EACpB,cAAAC,EAAgB,CACd,kBAAmB,GACnB,aAAc,GACd,OAAQ,GACR,SAAU,CAAC,CACb,EACA,QAAAC,EACA,OAAAC,EACA,QAAAC,EAAU,UACZ,IAA+B,CAC7B,IAAMC,EAASC,EAAM,EACf,CAACV,EAAUW,CAAW,EAAIC,EAAsB,KAAK,EACrDC,EAAmBf,EAACE,GAAqB,CAC7CW,EAAYX,CAAuB,EACnC,IAAMc,EAAgBjB,EACpBkB,EACAf,EACAG,EAAkB,cACpB,EACIW,GACFE,EAAK,SAAS,4BAA6BF,CAAa,CAE5D,EAVyB,oBAWnBG,EAAoBC,EAAkB,CAC1C,cAAeb,EAAc,kBAC7B,gBAAiBA,EAAc,aAC/B,cAAeA,EAAc,OAC7B,kBAAAF,EACA,QAAAK,EACA,QAAS,CACP,GAAGF,EACH,iBAAkBO,CACpB,CACF,CAAC,EACKM,EAAWC,EAEfH,EAAkB,gBACpB,EAEMI,EAAuBhB,EAAc,aACvC,GACAR,EACEkB,EACAf,EACAG,EAAkB,cACpB,EAEEa,EAAOM,EAAQ,CACnB,SAAAH,EACA,cAAe,CACb,QAASd,GAAe,kBACxB,SAAUA,GAAe,aACzB,OAAQ,GACR,OAAQA,GAAe,OACvB,kBAAmB,GACnB,iBAAkB,GAClB,WAAY,CACV,eAAgBgB,CAClB,EACA,SAAUhB,GAAe,QAC3B,EACA,iBAAkB,GAClB,KAAM,QACR,CAAC,EAED,OAAAkB,EAAU,IAAM,CACd,GACElB,EAAc,cACdY,EAAkB,YAClBd,EAAkB,qBAClB,CAIA,IAAMqB,EAHeP,EAAkB,WAAW,KAC/CjB,GAAaA,EAAS,QAAUK,EAAc,YACjD,GACmC,MACnC,GAAImB,EAAc,CAChBb,EAAYa,CAA2B,EACvC,IAAMH,EAAuBxB,EAC3BkB,EACAS,EACArB,EAAkB,cACpB,EACAa,EAAK,SAAS,4BAA6BK,CAAoB,CACjE,CACF,CACF,EAAG,CACDhB,EAAc,aACdY,EAAkB,WAClBd,EAAkB,qBAClBA,EAAkB,eAClBa,CACF,CAAC,EAGCpB,EAAC6B,EAAsB,SAAtB,CACC,MAAO,CACL,KAAAT,EACA,OAAQP,EACR,kBAAAQ,CACF,EAEC,SAAAV,EAAOU,CAAiB,EAC3B,CAEJ,EA1GkC","names":["useEffect","useId","useState","jsx","getDefaultManagementFee","__name","baseRates","currency","managementFees","CostCalculatorFlow","estimationOptions","defaultEstimationOptions","defaultValues","options","render","version","formId","useId","setCurrency","useState","onCurrencyChange","managementFee","BASE_RATES","form","costCalculatorBag","useCostCalculator","resolver","useJsonSchemasValidationFormResolver","defaultManagementFee","useForm","useEffect","currencyCode","CostCalculatorContext"]}
1
+ {"version":3,"sources":["../src/flows/CostCalculator/CostCalculatorFlow.tsx"],"sourcesContent":["import React, { useEffect, useId, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { useJsonSchemasValidationFormResolver } from '@/src/components/form/yupValidationResolver';\nimport { CostCalculatorContext } from '@/src/flows/CostCalculator/context';\nimport {\n CostCalculatorVersion,\n defaultEstimationOptions,\n useCostCalculator,\n} from '@/src/flows/CostCalculator/hooks';\nimport {\n CostCalculatorEstimationOptions,\n CurrencyKey,\n UseCostCalculatorOptions,\n} from '@/src/flows/CostCalculator/types';\nimport { BASE_RATES } from '@/src/flows/CostCalculator/constants';\n\nexport type CostCalculatorFlowProps = {\n /**\n * Estimation params allows you to customize the parameters sent to the /cost-calculator/estimation endpoint.\n */\n estimationOptions?: CostCalculatorEstimationOptions;\n /**\n * Default values for the form fields.\n */\n defaultValues?: Partial<{\n /**\n * Default value for the country field.\n */\n countryRegionSlug: string;\n /**\n * Default value for the currency field.\n */\n currencySlug: string;\n /**\n * Default value for the salary field.\n */\n salary: string;\n /**\n * Default value for the benefits field.\n */\n benefits: Record<string, string>;\n }>;\n options?: UseCostCalculatorOptions;\n render: (\n costCalculatorBag: ReturnType<typeof useCostCalculator>,\n ) => React.ReactNode;\n /**\n * Whether to include annual_gross_salary in the estimation payload\n */\n version?: CostCalculatorVersion;\n};\n\nconst getDefaultManagementFee = (\n baseRates: Record<CurrencyKey, number>,\n currency: CurrencyKey,\n managementFees?: Partial<Record<CurrencyKey, number>>,\n) => {\n if (managementFees && managementFees[currency]) {\n return managementFees[currency];\n }\n if (baseRates[currency]) {\n return baseRates[currency] / 100;\n }\n return 0;\n};\n\nexport const CostCalculatorFlow = ({\n estimationOptions = defaultEstimationOptions,\n defaultValues = {\n countryRegionSlug: '',\n currencySlug: '',\n salary: '',\n benefits: {},\n },\n options,\n render,\n version = 'standard',\n}: CostCalculatorFlowProps) => {\n const formId = useId();\n const [currency, setCurrency] = useState<CurrencyKey>('USD');\n const onCurrencyChange = (currency: string) => {\n setCurrency(currency as CurrencyKey);\n const managementFee = getDefaultManagementFee(\n BASE_RATES,\n currency as CurrencyKey,\n estimationOptions.managementFees,\n );\n if (managementFee) {\n form.setValue('management.management_fee', managementFee);\n }\n };\n const costCalculatorBag = useCostCalculator({\n defaultRegion: defaultValues.countryRegionSlug,\n defaultCurrency: defaultValues.currencySlug,\n defaultSalary: defaultValues.salary,\n estimationOptions,\n version,\n options: {\n ...options,\n onCurrencyChange: onCurrencyChange,\n },\n });\n const resolver = useJsonSchemasValidationFormResolver(\n // @ts-expect-error no matching type\n costCalculatorBag.handleValidation,\n );\n\n const defaultManagementFee = defaultValues.currencySlug\n ? ''\n : getDefaultManagementFee(\n BASE_RATES,\n currency,\n estimationOptions.managementFees,\n );\n\n const form = useForm({\n resolver,\n defaultValues: {\n country: defaultValues?.countryRegionSlug,\n currency: defaultValues?.currencySlug,\n region: '',\n salary: defaultValues?.salary,\n salary_conversion: '',\n salary_converted: '',\n hiring_budget: 'employee_annual_salary',\n management: {\n management_fee: defaultManagementFee,\n },\n benefits: defaultValues?.benefits,\n estimation_title: estimationOptions.title,\n },\n shouldUnregister: false,\n mode: 'onBlur',\n });\n\n useEffect(() => {\n if (\n defaultValues.currencySlug &&\n costCalculatorBag.currencies &&\n estimationOptions.includeManagementFee\n ) {\n const currencyData = costCalculatorBag.currencies.find(\n (currency) => currency.value === defaultValues.currencySlug,\n );\n const currencyCode = currencyData?.label;\n if (currencyCode) {\n setCurrency(currencyCode as CurrencyKey);\n const defaultManagementFee = getDefaultManagementFee(\n BASE_RATES,\n currencyCode as CurrencyKey,\n estimationOptions.managementFees,\n );\n form.setValue('management.management_fee', defaultManagementFee);\n }\n }\n }, [\n defaultValues.currencySlug,\n costCalculatorBag.currencies,\n estimationOptions.includeManagementFee,\n estimationOptions.managementFees,\n form,\n ]);\n\n return (\n <CostCalculatorContext.Provider\n value={{\n form,\n formId: formId,\n costCalculatorBag,\n }}\n >\n {render(costCalculatorBag)}\n </CostCalculatorContext.Provider>\n );\n};\n"],"mappings":"kPAAA,OAAgB,aAAAA,EAAW,SAAAC,EAAO,YAAAC,MAAgB,QAoK9C,cAAAC,MAAA,oBAhHJ,IAAMC,EAA0BC,EAAA,CAC9BC,EACAC,EACAC,IAEIA,GAAkBA,EAAeD,CAAQ,EACpCC,EAAeD,CAAQ,EAE5BD,EAAUC,CAAQ,EACbD,EAAUC,CAAQ,EAAI,IAExB,EAXuB,2BAcnBE,EAAqBJ,EAAA,CAAC,CACjC,kBAAAK,EAAoBC,EACpB,cAAAC,EAAgB,CACd,kBAAmB,GACnB,aAAc,GACd,OAAQ,GACR,SAAU,CAAC,CACb,EACA,QAAAC,EACA,OAAAC,EACA,QAAAC,EAAU,UACZ,IAA+B,CAC7B,IAAMC,EAASC,EAAM,EACf,CAACV,EAAUW,CAAW,EAAIC,EAAsB,KAAK,EACrDC,EAAmBf,EAACE,GAAqB,CAC7CW,EAAYX,CAAuB,EACnC,IAAMc,EAAgBjB,EACpBkB,EACAf,EACAG,EAAkB,cACpB,EACIW,GACFE,EAAK,SAAS,4BAA6BF,CAAa,CAE5D,EAVyB,oBAWnBG,EAAoBC,EAAkB,CAC1C,cAAeb,EAAc,kBAC7B,gBAAiBA,EAAc,aAC/B,cAAeA,EAAc,OAC7B,kBAAAF,EACA,QAAAK,EACA,QAAS,CACP,GAAGF,EACH,iBAAkBO,CACpB,CACF,CAAC,EACKM,EAAWC,EAEfH,EAAkB,gBACpB,EAEMI,EAAuBhB,EAAc,aACvC,GACAR,EACEkB,EACAf,EACAG,EAAkB,cACpB,EAEEa,EAAOM,EAAQ,CACnB,SAAAH,EACA,cAAe,CACb,QAASd,GAAe,kBACxB,SAAUA,GAAe,aACzB,OAAQ,GACR,OAAQA,GAAe,OACvB,kBAAmB,GACnB,iBAAkB,GAClB,cAAe,yBACf,WAAY,CACV,eAAgBgB,CAClB,EACA,SAAUhB,GAAe,SACzB,iBAAkBF,EAAkB,KACtC,EACA,iBAAkB,GAClB,KAAM,QACR,CAAC,EAED,OAAAoB,EAAU,IAAM,CACd,GACElB,EAAc,cACdY,EAAkB,YAClBd,EAAkB,qBAClB,CAIA,IAAMqB,EAHeP,EAAkB,WAAW,KAC/CjB,GAAaA,EAAS,QAAUK,EAAc,YACjD,GACmC,MACnC,GAAImB,EAAc,CAChBb,EAAYa,CAA2B,EACvC,IAAMH,EAAuBxB,EAC3BkB,EACAS,EACArB,EAAkB,cACpB,EACAa,EAAK,SAAS,4BAA6BK,CAAoB,CACjE,CACF,CACF,EAAG,CACDhB,EAAc,aACdY,EAAkB,WAClBd,EAAkB,qBAClBA,EAAkB,eAClBa,CACF,CAAC,EAGCpB,EAAC6B,EAAsB,SAAtB,CACC,MAAO,CACL,KAAAT,EACA,OAAQP,EACR,kBAAAQ,CACF,EAEC,SAAAV,EAAOU,CAAiB,EAC3B,CAEJ,EA5GkC","names":["useEffect","useId","useState","jsx","getDefaultManagementFee","__name","baseRates","currency","managementFees","CostCalculatorFlow","estimationOptions","defaultEstimationOptions","defaultValues","options","render","version","formId","useId","setCurrency","useState","onCurrencyChange","managementFee","BASE_RATES","form","costCalculatorBag","useCostCalculator","resolver","useJsonSchemasValidationFormResolver","defaultManagementFee","useForm","useEffect","currencyCode","CostCalculatorContext"]}
@@ -0,0 +1,2 @@
1
+ var e={data:{version:7,schema:{additionalProperties:!1,properties:{country:{title:"Country",description:"",type:"string",oneOf:[],"x-jsf-presentation":{inputType:"select"}},region:{title:"Region",description:"",type:"string",oneOf:[],"x-jsf-presentation":{inputType:"select"}},currency:{title:"Currency",description:"",type:"string",oneOf:[],"x-jsf-presentation":{inputType:"select"}},hiring_budget:{title:"How would you like to estimate the cost of hiring?",enum:["employee_annual_salary","my_hiring_budget"],type:"string",oneOf:[{title:"With the employee's annual salary",const:"employee_annual_salary"},{title:"With my hiring budget for this role",const:"my_hiring_budget"}],"x-jsf-presentation":{inputType:"radio"}},salary:{description:"",title:"Salary",type:"integer","x-jsf-presentation":{inputType:"money"}},estimation_title:{title:"Estimation title",description:'Employee title. e.g; "Software Engineer".',type:"string","x-jsf-presentation":{inputType:"text",hidden:!0}},salary_conversion:{description:"",title:"Salary",type:"integer","x-jsf-presentation":{inputType:"money",hidden:!0}},salary_converted:{description:"Whether the salary is expressed in regional or employer currency",title:"Salary in employer currency",type:"string","x-jsf-presentation":{inputType:"hidden",hidden:!0}},management:{title:"Management fee",type:"object",properties:{management_fee:{title:"Desired monthly management fee",type:"integer","x-jsf-presentation":{inputType:"money"}}},"x-jsf-presentation":{inputType:"fieldset",hidden:!0}}},required:["country","currency","salary","salary_conversion","salary_converted"],type:"object","x-jsf-order":["country","region","currency","salary","estimation_title","management"]}}};export{e as a};
2
+ //# sourceMappingURL=chunk-IHPLMALI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/CostCalculator/jsonSchema.ts"],"sourcesContent":["export const jsonSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n properties: {\n country: {\n title: 'Country',\n description: '',\n type: 'string',\n oneOf: [],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n region: {\n title: 'Region',\n description: '',\n type: 'string',\n oneOf: [],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n currency: {\n title: 'Currency',\n description: '',\n type: 'string',\n oneOf: [],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n hiring_budget: {\n title: 'How would you like to estimate the cost of hiring?',\n enum: ['employee_annual_salary', 'my_hiring_budget'],\n type: 'string',\n oneOf: [\n {\n title: \"With the employee's annual salary\",\n const: 'employee_annual_salary',\n },\n {\n title: 'With my hiring budget for this role',\n const: 'my_hiring_budget',\n },\n ],\n 'x-jsf-presentation': {\n inputType: 'radio',\n },\n },\n salary: {\n description: '',\n title: 'Salary',\n type: 'integer',\n 'x-jsf-presentation': {\n inputType: 'money',\n },\n },\n estimation_title: {\n title: 'Estimation title',\n description: 'Employee title. e.g; \"Software Engineer\".',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'text',\n hidden: true,\n },\n },\n salary_conversion: {\n description: '',\n title: 'Salary',\n type: 'integer',\n 'x-jsf-presentation': {\n inputType: 'money',\n hidden: true,\n },\n },\n salary_converted: {\n description:\n 'Whether the salary is expressed in regional or employer currency',\n title: 'Salary in employer currency',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n hidden: true,\n },\n },\n management: {\n title: 'Management fee',\n type: 'object',\n properties: {\n management_fee: {\n title: 'Desired monthly management fee',\n type: 'integer',\n 'x-jsf-presentation': {\n inputType: 'money',\n },\n },\n },\n 'x-jsf-presentation': {\n inputType: 'fieldset',\n hidden: true,\n },\n },\n },\n required: [\n 'country',\n 'currency',\n 'salary',\n 'salary_conversion',\n 'salary_converted',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'country',\n 'region',\n 'currency',\n 'salary',\n 'estimation_title',\n 'management',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAAa,CACxB,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,WAAY,CACV,QAAS,CACP,MAAO,UACP,YAAa,GACb,KAAM,SACN,MAAO,CAAC,EACR,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,OAAQ,CACN,MAAO,SACP,YAAa,GACb,KAAM,SACN,MAAO,CAAC,EACR,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,SAAU,CACR,MAAO,WACP,YAAa,GACb,KAAM,SACN,MAAO,CAAC,EACR,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,cAAe,CACb,MAAO,qDACP,KAAM,CAAC,yBAA0B,kBAAkB,EACnD,KAAM,SACN,MAAO,CACL,CACE,MAAO,oCACP,MAAO,wBACT,EACA,CACE,MAAO,sCACP,MAAO,kBACT,CACF,EACA,qBAAsB,CACpB,UAAW,OACb,CACF,EACA,OAAQ,CACN,YAAa,GACb,MAAO,SACP,KAAM,UACN,qBAAsB,CACpB,UAAW,OACb,CACF,EACA,iBAAkB,CAChB,MAAO,mBACP,YAAa,4CACb,KAAM,SACN,qBAAsB,CACpB,UAAW,OACX,OAAQ,EACV,CACF,EACA,kBAAmB,CACjB,YAAa,GACb,MAAO,SACP,KAAM,UACN,qBAAsB,CACpB,UAAW,QACX,OAAQ,EACV,CACF,EACA,iBAAkB,CAChB,YACE,mEACF,MAAO,8BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,OAAQ,EACV,CACF,EACA,WAAY,CACV,MAAO,iBACP,KAAM,SACN,WAAY,CACV,eAAgB,CACd,MAAO,iCACP,KAAM,UACN,qBAAsB,CACpB,UAAW,OACb,CACF,CACF,EACA,qBAAsB,CACpB,UAAW,WACX,OAAQ,EACV,CACF,CACF,EACA,SAAU,CACR,UACA,WACA,SACA,oBACA,kBACF,EACA,KAAM,SACN,cAAe,CACb,UACA,SACA,WACA,SACA,mBACA,YACF,CACF,CACF,CACF","names":["jsonSchema"]}
@@ -0,0 +1,2 @@
1
+ import{b as n}from"./chunk-KSHK3ZPX.js";import{a as f}from"./chunk-LK4XMOCE.js";import{g as C}from"./chunk-3BREUYLG.js";import{a as i}from"./chunk-P37U34EQ.js";import{useEffect as b}from"react";import{jsx as l}from"react/jsx-runtime";function w({onSubmit:d,onError:m,onSuccess:p,shouldResetForm:u,resetFields:s}){let{form:o,formId:E,costCalculatorBag:r}=n(),{formState:{isSubmitSuccessful:e}}=o;b(()=>{if(e&&u){r?.resetForm(),o.reset();return}if(e&&s){let t={...o.getValues()};s.forEach(a=>{t[a]=""}),r?.resetForm(),o.reset(t)}},[e,o,u,r,s]);let S=i(async c=>{try{let t=r?.parseFormValues(c),a=await r?.onSubmit(t);if(await d?.(t),a?.error)m?.(a.error);else if(a?.data){let F={data:{...a.data.data,employments:a.data.data.employments?.map(V=>({...V,title:t.estimation_title}))}};await p?.(F)}}catch(t){m?.(t)}},"handleSubmit");return l(C,{...o,children:l("form",{id:E,onSubmit:o.handleSubmit(S),className:"space-y-4 RemoteFlows__CostCalculatorForm",children:l(f,{fields:r?.fields??[]})})})}i(w,"CostCalculatorForm");export{w as a};
2
+ //# sourceMappingURL=chunk-QURYMQUD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/CostCalculator/CostCalculatorForm.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { JSONSchemaFormFields } from '@/src/components/form/JSONSchemaForm';\nimport { Form } from '@/src/components/ui/form';\nimport { useCostCalculatorContext } from '@/src/flows/CostCalculator/context';\nimport {\n CostCalculatorEstimationResponse,\n CostCalculatorEstimationFormValues,\n CostCalculatorEstimationSubmitValues,\n EstimationError,\n} from '@/src/flows/CostCalculator/types';\n\ntype CostCalculatorFormProps = Partial<{\n /**\n * Callback function that handles form submission. When form is submit, the form values are sent to the consumer app before behind submitted to Remote.\n * @param data - The payload sent to the /cost-calculator/estimation endpoint.\n */\n onSubmit: (\n data: CostCalculatorEstimationSubmitValues,\n ) => Promise<void> | void;\n /**\n * Callback function to handle the success when the estimation succeeds. The CostCalculatorEstimateResponse is sent back to you.\n * @param data - The response data from the /cost-calculator/estimation endpoint.\n */\n onSuccess: (data: CostCalculatorEstimationResponse) => Promise<void> | void;\n /**\n * Callback function to handle the error when the estimation fails.\n * @param error - The error object.\n */\n onError: (error: EstimationError) => void;\n /**\n * Whether to reset the form when the form is successfully submitted.\n */\n shouldResetForm?: boolean;\n\n /**\n * Fields to reset when the form is successfully submitted.\n */\n resetFields?: ('country' | 'currency' | 'salary')[];\n}>;\n\nexport function CostCalculatorForm({\n onSubmit,\n onError,\n onSuccess,\n shouldResetForm,\n resetFields,\n}: CostCalculatorFormProps) {\n const { form, formId, costCalculatorBag } = useCostCalculatorContext();\n\n const {\n formState: { isSubmitSuccessful },\n } = form;\n\n useEffect(() => {\n // resets the entire form if the form is successfully submitted and the shouldResetForm prop is true\n if (isSubmitSuccessful && shouldResetForm) {\n costCalculatorBag?.resetForm();\n form.reset();\n return;\n }\n\n // resets the specified fields if the form is successfully submitted and the resetFields prop is provided\n if (isSubmitSuccessful && resetFields) {\n // Reset only the specified fields\n const currentValues = form.getValues();\n const resetValues = { ...currentValues };\n resetFields.forEach((field) => {\n resetValues[field] = '';\n });\n\n costCalculatorBag?.resetForm();\n form.reset(resetValues);\n }\n }, [\n isSubmitSuccessful,\n form,\n shouldResetForm,\n costCalculatorBag,\n resetFields,\n ]);\n\n const handleSubmit = async (values: CostCalculatorEstimationFormValues) => {\n try {\n const parsedValues = costCalculatorBag?.parseFormValues(\n values,\n ) as CostCalculatorEstimationSubmitValues;\n\n const costCalculatorResults =\n await costCalculatorBag?.onSubmit(parsedValues);\n\n // if this rejects, catch will handle it\n await onSubmit?.(parsedValues);\n\n if (costCalculatorResults?.error) {\n onError?.(costCalculatorResults.error);\n } else if (costCalculatorResults?.data) {\n const responseWithTitle = {\n data: {\n ...costCalculatorResults.data.data,\n employments: costCalculatorResults.data.data.employments?.map(\n (employment) => ({\n ...employment,\n title: parsedValues.estimation_title,\n }),\n ),\n },\n };\n await onSuccess?.(responseWithTitle);\n }\n } catch (err) {\n onError?.(err as EstimationError);\n }\n };\n\n return (\n <Form {...form}>\n <form\n id={formId}\n onSubmit={form.handleSubmit(handleSubmit)}\n className='space-y-4 RemoteFlows__CostCalculatorForm'\n >\n <JSONSchemaFormFields fields={costCalculatorBag?.fields ?? []} />\n </form>\n </Form>\n );\n}\n"],"mappings":"gKAAA,OAAS,aAAAA,MAAiB,QAyHlB,cAAAC,MAAA,oBAjFD,SAASC,EAAmB,CACjC,SAAAC,EACA,QAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,YAAAC,CACF,EAA4B,CAC1B,GAAM,CAAE,KAAAC,EAAM,OAAAC,EAAQ,kBAAAC,CAAkB,EAAIC,EAAyB,EAE/D,CACJ,UAAW,CAAE,mBAAAC,CAAmB,CAClC,EAAIJ,EAEJK,EAAU,IAAM,CAEd,GAAID,GAAsBN,EAAiB,CACzCI,GAAmB,UAAU,EAC7BF,EAAK,MAAM,EACX,MACF,CAGA,GAAII,GAAsBL,EAAa,CAGrC,IAAMO,EAAc,CAAE,GADAN,EAAK,UAAU,CACE,EACvCD,EAAY,QAASQ,GAAU,CAC7BD,EAAYC,CAAK,EAAI,EACvB,CAAC,EAEDL,GAAmB,UAAU,EAC7BF,EAAK,MAAMM,CAAW,CACxB,CACF,EAAG,CACDF,EACAJ,EACAF,EACAI,EACAH,CACF,CAAC,EAED,IAAMS,EAAeC,EAAA,MAAOC,GAA+C,CACzE,GAAI,CACF,IAAMC,EAAeT,GAAmB,gBACtCQ,CACF,EAEME,EACJ,MAAMV,GAAmB,SAASS,CAAY,EAKhD,GAFA,MAAMhB,IAAWgB,CAAY,EAEzBC,GAAuB,MACzBhB,IAAUgB,EAAsB,KAAK,UAC5BA,GAAuB,KAAM,CACtC,IAAMC,EAAoB,CACxB,KAAM,CACJ,GAAGD,EAAsB,KAAK,KAC9B,YAAaA,EAAsB,KAAK,KAAK,aAAa,IACvDE,IAAgB,CACf,GAAGA,EACH,MAAOH,EAAa,gBACtB,EACF,CACF,CACF,EACA,MAAMd,IAAYgB,CAAiB,CACrC,CACF,OAASE,EAAK,CACZnB,IAAUmB,CAAsB,CAClC,CACF,EA/BqB,gBAiCrB,OACEtB,EAACuB,EAAA,CAAM,GAAGhB,EACR,SAAAP,EAAC,QACC,GAAIQ,EACJ,SAAUD,EAAK,aAAaQ,CAAY,EACxC,UAAU,4CAEV,SAAAf,EAACwB,EAAA,CAAqB,OAAQf,GAAmB,QAAU,CAAC,EAAG,EACjE,EACF,CAEJ,CArFgBO,EAAAf,EAAA","names":["useEffect","jsx","CostCalculatorForm","onSubmit","onError","onSuccess","shouldResetForm","resetFields","form","formId","costCalculatorBag","useCostCalculatorContext","isSubmitSuccessful","useEffect","resetValues","field","handleSubmit","__name","values","parsedValues","costCalculatorResults","responseWithTitle","employment","err","Form","JSONSchemaFormFields"]}
@@ -1,2 +1,2 @@
1
- import{a as d,b as p,c as g,d as x}from"./chunk-4RULC3AZ.js";import{a as N}from"./chunk-UHS3QRA3.js";import{a as i,b as y}from"./chunk-3LOVCTCN.js";import{a as c}from"./chunk-P37U34EQ.js";import{ChevronDown as b,Globe as _}from"lucide-react";import{useState as A}from"react";import{Fragment as C,jsx as e,jsxs as r}from"react/jsx-runtime";var w=c(s=>{if(s.length<2)return{currency:null,costsPerCountry:[],employeesCost:null};let t=s[0]?.employer_currency_costs.currency,m=s.reduce((o,a)=>{let l=a.country.name;return o[l]={country:a.country,monthlyTotal:(o[l]?.monthlyTotal||0)+a.employer_currency_costs.monthly_total,annualTotal:(o[l]?.annualTotal||0)+a.employer_currency_costs.annual_total},o},{}),n=Object.values(m).map(({country:o,monthlyTotal:a,annualTotal:l})=>({country:o,monthlyCost:y(a,t.symbol),annualCost:y(l,t.symbol)})),u={monthlyTotal:y(s.reduce((o,a)=>o+a.employer_currency_costs.monthly_total,0),t.symbol),annualTotal:y(s.reduce((o,a)=>o+a.employer_currency_costs.annual_total,0),t.symbol)};return{currency:t,costsPerCountry:n,employeesCost:u}},"useSummaryResults"),T=c(({currency:s,title:t})=>e("div",{className:"flex items-center justify-between w-full",children:r("div",{className:"flex flex-row items-center gap-6",children:[e("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-[#F4F4F5]",children:e(_,{className:"h-6 w-6 text-[#000000]"})}),r("div",{className:"space-y-1",children:[e("h2",{className:"text-lg font-medium leading-none text-[#181818]",children:t}),r("p",{className:"text-xs text-[#71717A]",children:["Employer billing currency: ",s.code]})]})]})}),"SummaryHeader"),h=c(({label:s,columns:t,rows:m,defaultValue:n="accordion",className:u})=>{let o=t.length===1?"grid-cols-2":"grid-cols-3";return e(d,{type:"single",collapsible:!0,defaultValue:n,className:i("w-full",u),children:r(p,{value:n,className:"border-none",children:[e(g,{className:"hover:no-underline px-0 py-3 [&>svg]:hidden group",children:r("div",{className:i("grid items-center w-full",o),children:[r("div",{className:"flex items-center gap-2",children:[s,e(b,{className:"h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),t.length===1?e("span",{className:"text-xs text-[#27272A] text-right",children:t[0]}):t.map((a,l)=>e("span",{className:"text-xs text-[#27272A] text-right",children:a},l))]})}),e(x,{className:"px-0 pb-4",children:e("div",{className:"space-y-3",children:m.map((a,l)=>r("div",{className:i("grid items-center",o),children:[e("div",{className:"flex items-center gap-2",children:a.label}),t.length===1?e("span",{className:"text-sm text-[#09090B] text-right",children:a.values[0]}):a.values.map((v,f)=>e("span",{className:"text-sm text-[#09090B] text-right",children:v},f))]},l))})})]})})},"MultiColumnAccordion"),R=c(({employeesCost:s})=>e(h,{label:e("span",{className:"text-sm font-medium text-[#0F172A]",children:"Cost for all employees"}),columns:["Total cost"],rows:[{label:r(C,{children:[e("span",{className:"w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0"}),e("span",{className:"text-sm text-[#09090B]",children:"Monthly cost"})]}),values:[s.monthlyTotal]},{label:r(C,{children:[e("span",{className:"w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0"}),e("span",{className:"text-sm text-[#09090B]",children:"Annual cost"})]}),values:[s.annualTotal]}],defaultValue:"cost-breakdown"}),"CostForAllEmployees"),S=c(({costsPerCountry:s})=>e(h,{label:e("span",{className:"text-sm font-medium text-[#0F172A]",children:"Cost per country"}),columns:["Monthly cost","Annual cost"],rows:s.map(t=>({label:r(C,{children:[e("span",{className:"w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0"}),e("span",{className:"text-sm text-[#09090B]",children:t.country.name})]}),values:[t.monthlyCost,t.annualCost]})),defaultValue:"country-breakdown"}),"CostsPerCountry"),E=c(({estimations:s})=>{let{currency:t,costsPerCountry:m,employeesCost:n}=w(s),[u,o]=A("summary");return!t||m.length===0||Object.keys(n).length===0?null:e(N,{className:"RemoteFlows__SummaryResults__Card p-10",children:e(d,{type:"single",collapsible:!0,defaultValue:u,onValueChange:o,className:"RemoteFlows__SummaryResults__Accordion w-full",children:r(p,{value:"summary",className:"border-border",children:[e("div",{className:i({RemoteFlows__Separator:u==="summary"}),children:e(g,{iconClassName:"size-6",className:"hover:no-underline px-0 py-4",children:e(T,{currency:t,title:"Summary Overview"})})}),r(x,{className:"px-0 pb-4 mt-6",children:[e("div",{className:"RemoteFlows__Separator",children:e(R,{employeesCost:n})}),e("div",{className:"mt-6",children:e(S,{costsPerCountry:m})})]})]})})})},"SummaryResults");export{E as a};
2
- //# sourceMappingURL=chunk-A3OEOVEH.js.map
1
+ import{a as d,b as p,c as g,d as x}from"./chunk-4RULC3AZ.js";import{a as N}from"./chunk-UHS3QRA3.js";import{a as i,b as y}from"./chunk-3LOVCTCN.js";import{a as c}from"./chunk-P37U34EQ.js";import{ChevronDown as b,Globe as _}from"lucide-react";import{useState as A}from"react";import{Fragment as C,jsx as e,jsxs as r}from"react/jsx-runtime";var w=c(s=>{if(s.length<2)return{currency:null,costsPerCountry:[],employeesCost:null};let t=s[0]?.employer_currency_costs.currency,m=s.reduce((o,a)=>{let l=a.country.name;return o[l]={country:a.country,monthlyTotal:(o[l]?.monthlyTotal||0)+a.employer_currency_costs.monthly_total,annualTotal:(o[l]?.annualTotal||0)+a.employer_currency_costs.annual_total},o},{}),n=Object.values(m).map(({country:o,monthlyTotal:a,annualTotal:l})=>({country:o,monthlyCost:y(a,t.symbol),annualCost:y(l,t.symbol)})),u={monthlyTotal:y(s.reduce((o,a)=>o+a.employer_currency_costs.monthly_total,0),t.symbol),annualTotal:y(s.reduce((o,a)=>o+a.employer_currency_costs.annual_total,0),t.symbol)};return{currency:t,costsPerCountry:n,employeesCost:u}},"useSummaryResults"),T=c(({currency:s,title:t})=>e("div",{className:"flex items-center justify-between w-full",children:r("div",{className:"flex flex-row items-center gap-6",children:[e("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-[#F4F4F5]",children:e(_,{className:"h-6 w-6 text-[#000000]"})}),r("div",{className:"space-y-1",children:[e("h2",{className:"text-lg font-medium leading-none text-[#181818]",children:t}),r("p",{className:"text-xs text-[#71717A]",children:["Employer billing currency: ",s.code]})]})]})}),"SummaryHeader"),f=c(({label:s,columns:t,rows:m,defaultValue:n="accordion",className:u})=>{let o=t.length===1?"grid-cols-2":"grid-cols-3";return e(d,{type:"single",collapsible:!0,defaultValue:n,className:i("w-full",u),children:r(p,{value:n,className:"border-none",children:[e(g,{className:"hover:no-underline px-0 py-3 [&>svg]:hidden group",children:r("div",{className:i("grid items-center w-full",o),children:[r("div",{className:"flex items-center gap-2",children:[s,e(b,{className:"h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),t.length===1?e("span",{className:"text-xs text-[#27272A] text-right",children:t[0]}):t.map((a,l)=>e("span",{className:"text-xs text-[#27272A] text-right",children:a},l))]})}),e(x,{className:"px-0 pb-4",children:e("div",{className:"space-y-3",children:m.map((a,l)=>r("div",{className:i("grid items-center",o),children:[e("div",{className:"flex items-center gap-2",children:a.label}),t.length===1?e("span",{className:"text-sm text-[#09090B] text-right",children:a.values[0]}):a.values.map((h,v)=>e("span",{className:"text-sm text-[#09090B] text-right",children:h},v))]},l))})})]})})},"MultiColumnAccordion"),R=c(({employeesCost:s})=>e(f,{label:e("span",{className:"text-sm font-medium text-[#0F172A]",children:"Cost for all employees"}),columns:["Total cost"],rows:[{label:r(C,{children:[e("span",{className:"w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0"}),e("span",{className:"text-sm text-[#09090B]",children:"Monthly cost"})]}),values:[s.monthlyTotal]},{label:r(C,{children:[e("span",{className:"w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0"}),e("span",{className:"text-sm text-[#09090B]",children:"Annual cost"})]}),values:[s.annualTotal]}],defaultValue:"cost-breakdown"}),"CostForAllEmployees"),S=c(({costsPerCountry:s})=>e(f,{label:e("span",{className:"text-sm font-medium text-[#0F172A]",children:"Cost per country"}),columns:["Monthly cost","Annual cost"],rows:s.map(t=>({label:r(C,{children:[e("span",{className:"w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0"}),e("span",{className:"text-sm text-[#09090B]",children:t.country.name})]}),values:[t.monthlyCost,t.annualCost]})),defaultValue:"country-breakdown"}),"CostsPerCountry"),E=c(({estimations:s})=>{let{currency:t,costsPerCountry:m,employeesCost:n}=w(s),[u,o]=A("summary");return!t||m.length===0||Object.keys(n).length===0?null:e(N,{className:"RemoteFlows__SummaryResults__Card p-10",children:e(d,{type:"single",collapsible:!0,defaultValue:u,onValueChange:o,className:"RemoteFlows__SummaryResults__Accordion w-full",children:r(p,{value:"summary",className:"border-border",children:[e("div",{className:i({RemoteFlows__Separator:u==="summary"}),children:e(g,{iconClassName:"size-6",className:"hover:no-underline px-0 py-4",children:e(T,{currency:t,title:"Summary Overview"})})}),r(x,{className:"px-0 pb-4 mt-6",children:[e("div",{className:"RemoteFlows__Separator",children:e(R,{employeesCost:n})}),e("div",{className:"mt-6",children:e(S,{costsPerCountry:m})})]})]})})})},"SummaryResults");export{E as a};
2
+ //# sourceMappingURL=chunk-R2UI3WAJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/CostCalculator/SummaryResults/SummaryResults.tsx"],"sourcesContent":["import { Currency } from '@/src/client';\nimport {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n} from '@/src/components/ui/accordion';\nimport { Card } from '@/src/components/ui/card';\nimport { CostCalculatorEstimation } from '@/src/flows/CostCalculator/types';\nimport { cn, formatCurrency } from '@/src/lib/utils';\nimport { ChevronDown, Globe } from 'lucide-react';\nimport { useState } from 'react';\n\nconst useSummaryResults = (estimations: CostCalculatorEstimation[]) => {\n if (estimations.length < 2) {\n return {\n currency: null,\n costsPerCountry: [],\n employeesCost: null,\n };\n }\n const currency = estimations[0]?.employer_currency_costs.currency;\n const costsPerCountry = estimations.reduce(\n (acc, estimation) => {\n const countryName = estimation.country.name;\n\n acc[countryName] = {\n country: estimation.country,\n monthlyTotal:\n (acc[countryName]?.monthlyTotal || 0) +\n estimation.employer_currency_costs.monthly_total,\n annualTotal:\n (acc[countryName]?.annualTotal || 0) +\n estimation.employer_currency_costs.annual_total,\n };\n\n return acc;\n },\n {} as Record<\n string,\n {\n country: (typeof estimations)[0]['country'];\n monthlyTotal: number;\n annualTotal: number;\n }\n >,\n );\n\n const groupedCostsPerCountry = Object.values(costsPerCountry).map(\n ({ country, monthlyTotal, annualTotal }) => ({\n country,\n monthlyCost: formatCurrency(monthlyTotal, currency.symbol),\n annualCost: formatCurrency(annualTotal, currency.symbol),\n }),\n );\n\n const employeesCost = {\n monthlyTotal: formatCurrency(\n estimations.reduce((acc, estimation) => {\n return acc + estimation.employer_currency_costs.monthly_total;\n }, 0),\n currency.symbol,\n ),\n annualTotal: formatCurrency(\n estimations.reduce((acc, estimation) => {\n return acc + estimation.employer_currency_costs.annual_total;\n }, 0),\n currency.symbol,\n ),\n };\n return { currency, costsPerCountry: groupedCostsPerCountry, employeesCost };\n};\n\nconst SummaryHeader = ({\n currency,\n title,\n}: {\n currency: Currency;\n title: string;\n}) => {\n return (\n <div className='flex items-center justify-between w-full'>\n <div className='flex flex-row items-center gap-6'>\n <div className='flex h-12 w-12 items-center justify-center rounded-lg bg-[#F4F4F5]'>\n <Globe className='h-6 w-6 text-[#000000]' />\n </div>\n <div className='space-y-1'>\n <h2 className='text-lg font-medium leading-none text-[#181818]'>\n {title}\n </h2>\n <p className='text-xs text-[#71717A]'>\n Employer billing currency: {currency.code}\n </p>\n </div>\n </div>\n </div>\n );\n};\n\nconst MultiColumnAccordion = ({\n label,\n columns,\n rows,\n defaultValue = 'accordion',\n className,\n}: {\n label: React.ReactNode;\n columns: string[];\n rows: Array<{\n label: React.ReactNode;\n values: string[];\n }>;\n defaultValue?: string;\n className?: string;\n}) => {\n const gridCols = columns.length === 1 ? 'grid-cols-2' : 'grid-cols-3';\n\n return (\n <Accordion\n type='single'\n collapsible\n defaultValue={defaultValue}\n className={cn('w-full', className)}\n >\n <AccordionItem value={defaultValue} className='border-none'>\n <AccordionTrigger className='hover:no-underline px-0 py-3 [&>svg]:hidden group'>\n <div className={cn('grid items-center w-full', gridCols)}>\n <div className='flex items-center gap-2'>\n {label}\n <ChevronDown className='h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180' />\n </div>\n {columns.length === 1 ? (\n <span className='text-xs text-[#27272A] text-right'>\n {columns[0]}\n </span>\n ) : (\n columns.map((column, index) => (\n <span key={index} className='text-xs text-[#27272A] text-right'>\n {column}\n </span>\n ))\n )}\n </div>\n </AccordionTrigger>\n\n <AccordionContent className='px-0 pb-4'>\n <div className='space-y-3'>\n {rows.map((row, index) => (\n <div key={index} className={cn('grid items-center', gridCols)}>\n <div className='flex items-center gap-2'>{row.label}</div>\n {columns.length === 1 ? (\n <span className='text-sm text-[#09090B] text-right'>\n {row.values[0]}\n </span>\n ) : (\n row.values.map((value, valueIndex) => (\n <span\n key={valueIndex}\n className='text-sm text-[#09090B] text-right'\n >\n {value}\n </span>\n ))\n )}\n </div>\n ))}\n </div>\n </AccordionContent>\n </AccordionItem>\n </Accordion>\n );\n};\n\nconst CostForAllEmployees = ({\n employeesCost,\n}: {\n employeesCost: { monthlyTotal: string; annualTotal: string };\n}) => {\n return (\n <MultiColumnAccordion\n label={\n <span className='text-sm font-medium text-[#0F172A]'>\n Cost for all employees\n </span>\n }\n columns={['Total cost']}\n rows={[\n {\n label: (\n <>\n <span className='w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0' />\n <span className='text-sm text-[#09090B]'>Monthly cost</span>\n </>\n ),\n values: [employeesCost.monthlyTotal],\n },\n {\n label: (\n <>\n <span className='w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0' />\n <span className='text-sm text-[#09090B]'>Annual cost</span>\n </>\n ),\n values: [employeesCost.annualTotal],\n },\n ]}\n defaultValue='cost-breakdown'\n />\n );\n};\n\nconst CostsPerCountry = ({\n costsPerCountry,\n}: {\n costsPerCountry: Array<{\n country: { name: string };\n monthlyCost: string;\n annualCost: string;\n }>;\n}) => {\n return (\n <MultiColumnAccordion\n label={\n <span className='text-sm font-medium text-[#0F172A]'>\n Cost per country\n </span>\n }\n columns={['Monthly cost', 'Annual cost']}\n rows={costsPerCountry.map((cost) => ({\n label: (\n <>\n <span className='w-1 h-1 bg-[#09090B] rounded-full flex-shrink-0' />\n <span className='text-sm text-[#09090B]'>{cost.country.name}</span>\n </>\n ),\n values: [cost.monthlyCost, cost.annualCost],\n }))}\n defaultValue='country-breakdown'\n />\n );\n};\n\ntype SummaryResultsProps = {\n /**\n * Array of employments to compare costs for.\n * 2 estimations required for the component to render\n */\n estimations: CostCalculatorEstimation[];\n};\n\n/**\n * Displays a summary comparison of costs across multiple estimations.\n * The component will return null if you pass less than 2 estimations.\n */\nexport const SummaryResults = ({ estimations }: SummaryResultsProps) => {\n const { currency, costsPerCountry, employeesCost } =\n useSummaryResults(estimations);\n\n const [accordionValue, setAccordionValue] = useState('summary');\n\n if (\n !currency ||\n costsPerCountry.length === 0 ||\n Object.keys(employeesCost).length === 0\n ) {\n return null;\n }\n\n return (\n <Card className='RemoteFlows__SummaryResults__Card p-10'>\n <Accordion\n type='single'\n collapsible\n defaultValue={accordionValue}\n onValueChange={setAccordionValue}\n className='RemoteFlows__SummaryResults__Accordion w-full'\n >\n <AccordionItem value='summary' className='border-border'>\n <div\n className={cn({\n RemoteFlows__Separator: accordionValue === 'summary',\n })}\n >\n <AccordionTrigger\n iconClassName='size-6'\n className='hover:no-underline px-0 py-4'\n >\n <SummaryHeader currency={currency} title='Summary Overview' />\n </AccordionTrigger>\n </div>\n <AccordionContent className='px-0 pb-4 mt-6'>\n <div className='RemoteFlows__Separator'>\n <CostForAllEmployees employeesCost={employeesCost} />\n </div>\n <div className='mt-6'>\n <CostsPerCountry costsPerCountry={costsPerCountry} />\n </div>\n </AccordionContent>\n </AccordionItem>\n </Accordion>\n </Card>\n );\n};\n"],"mappings":"4LAUA,OAAS,eAAAA,EAAa,SAAAC,MAAa,eACnC,OAAS,YAAAC,MAAgB,QAyEf,OAyGE,YAAAC,EAzGF,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yCACd,SAAA5C,EAAC0B,EAAA,CACC,KAAK,SACL,YAAW,GACX,aAAce,EACd,cAAeC,EACf,UAAU,gDAEV,SAAAzC,EAAC2B,EAAA,CAAc,MAAM,UAAU,UAAU,gBACvC,UAAA5B,EAAC,OACC,UAAW2B,EAAG,CACZ,uBAAwBc,IAAmB,SAC7C,CAAC,EAED,SAAAzC,EAAC6B,EAAA,CACC,cAAc,SACd,UAAU,+BAEV,SAAA7B,EAACgB,EAAA,CAAc,SAAUX,EAAU,MAAM,mBAAmB,EAC9D,EACF,EACAJ,EAACgC,EAAA,CAAiB,UAAU,iBAC1B,UAAAjC,EAAC,OAAI,UAAU,yBACb,SAAAA,EAACqC,EAAA,CAAoB,cAAetB,EAAe,EACrD,EACAf,EAAC,OAAI,UAAU,OACb,SAAAA,EAACsC,EAAA,CAAgB,gBAAiBhC,EAAiB,EACrD,GACF,GACF,EACF,EACF,CAEJ,EAhD8B","names":["ChevronDown","Globe","useState","Fragment","jsx","jsxs","useSummaryResults","__name","estimations","currency","costsPerCountry","acc","estimation","countryName","groupedCostsPerCountry","country","monthlyTotal","annualTotal","formatCurrency","employeesCost","SummaryHeader","title","Globe","MultiColumnAccordion","label","columns","rows","defaultValue","className","gridCols","Accordion","cn","AccordionItem","AccordionTrigger","ChevronDown","column","index","AccordionContent","row","value","valueIndex","CostForAllEmployees","CostsPerCountry","cost","SummaryResults","accordionValue","setAccordionValue","useState","Card"]}
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { b as PostCreateContractAmendmentError, a as ContractAmendmentResponse } from '../../types.gen-C9Y1S1pc.js';
2
+ import { b as PostCreateContractAmendmentError, a as ContractAmendmentResponse } from '../../types.gen-CaXCWhlP.js';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
 
5
5
  type ContractAmendmentConfirmationFormProps = {
@@ -5,7 +5,7 @@ import { ContractAmendmentForm } from './ContractAmendmentForm.js';
5
5
  import { ContractAmendmentSubmit } from './ContractAmendmentSubmit.js';
6
6
  import { useContractAmendment } from './hooks.js';
7
7
  import { ContractAmendmentParams } from './types.js';
8
- import '../../types.gen-C9Y1S1pc.js';
8
+ import '../../types.gen-CaXCWhlP.js';
9
9
  import 'react-hook-form';
10
10
  import 'react';
11
11
  import '../../mutations-B6HWH-rZ.js';
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { P as PostAutomatableContractAmendmentError, C as ContractAmendmentAutomatableResponse } from '../../types.gen-C9Y1S1pc.js';
2
+ import { P as PostAutomatableContractAmendmentError, C as ContractAmendmentAutomatableResponse } from '../../types.gen-CaXCWhlP.js';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
 
5
5
  type ContractAmendmentFormProps = {
@@ -1,8 +1,8 @@
1
1
  import { S as SuccessResponse, E as ErrorResponse } from '../../mutations-B6HWH-rZ.js';
2
- import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-C9Y1S1pc.js';
2
+ import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-CaXCWhlP.js';
3
3
  import * as React from 'react';
4
4
  import * as _remoteoss_json_schema_form from '@remoteoss/json-schema-form';
5
- import '../../remoteFlows-Clat4nYN.js';
5
+ import '../../remoteFlows-CBNrcwGZ.js';
6
6
  import * as react_hook_form from 'react-hook-form';
7
7
  import { useContractAmendment } from './hooks.js';
8
8
  import { Step } from '../useStepState.js';
@@ -1,5 +1,5 @@
1
1
  import { S as SuccessResponse, E as ErrorResponse } from '../../mutations-B6HWH-rZ.js';
2
- import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-C9Y1S1pc.js';
2
+ import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-CaXCWhlP.js';
3
3
  import * as React from 'react';
4
4
  import * as _remoteoss_json_schema_form from '@remoteoss/json-schema-form';
5
5
  import { Step } from '../useStepState.js';
@@ -4,7 +4,7 @@ export { ContractAmendmentForm } from './ContractAmendmentForm.js';
4
4
  export { ContractAmendmentSubmit } from './ContractAmendmentSubmit.js';
5
5
  export { useContractAmendment } from './hooks.js';
6
6
  import 'react/jsx-runtime';
7
- import '../../types.gen-C9Y1S1pc.js';
7
+ import '../../types.gen-CaXCWhlP.js';
8
8
  import 'react-hook-form';
9
9
  import './ContractAmendmentBack.js';
10
10
  import 'react';
@@ -1,4 +1,4 @@
1
- import { E as EmploymentShowResponse } from '../../types.gen-C9Y1S1pc.js';
1
+ import { E as EmploymentShowResponse } from '../../types.gen-CaXCWhlP.js';
2
2
  import { Fields } from '@remoteoss/json-schema-form';
3
3
  import { Step } from '../useStepState.js';
4
4
  import 'react';
@@ -3,7 +3,7 @@ import React__default from 'react';
3
3
  import { useCostCalculator, CostCalculatorVersion } from './hooks.js';
4
4
  import { CostCalculatorEstimationOptions, UseCostCalculatorOptions } from './types.js';
5
5
  import 'yup';
6
- import '../../types.gen-C9Y1S1pc.js';
6
+ import '../../types.gen-CaXCWhlP.js';
7
7
  import '../types.js';
8
8
  import '@remoteoss/json-schema-form';
9
9
  import './constants.js';
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-SIUODCGO.js";import"../../chunk-OC7VOBB4.js";import"../../chunk-JUGNVM2R.js";import"../../chunk-NBCZF2FO.js";import"../../chunk-6YKL7EOK.js";import"../../chunk-JQDP6SAT.js";import"../../chunk-DTGFQMCE.js";import"../../chunk-WVJDCDGZ.js";import"../../chunk-V2YORDAL.js";import"../../chunk-HN5HLFTB.js";import"../../chunk-KSHK3ZPX.js";import"../../chunk-N5I33LIN.js";import"../../chunk-ANXYPRBG.js";import"../../chunk-Z5WMKCRJ.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-ZTDKPUB5.js";import"../../chunk-TXSJL3HC.js";import"../../chunk-EGQJ7UBR.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-3BREUYLG.js";import"../../chunk-MXFDOIUA.js";import"../../chunk-BI6U55BD.js";import"../../chunk-3LOVCTCN.js";import"../../chunk-P37U34EQ.js";export{a as CostCalculatorFlow};
1
+ import{a}from"../../chunk-IEYBG2G5.js";import"../../chunk-34JNRT23.js";import"../../chunk-JUGNVM2R.js";import"../../chunk-NBCZF2FO.js";import"../../chunk-IHPLMALI.js";import"../../chunk-JQDP6SAT.js";import"../../chunk-DTGFQMCE.js";import"../../chunk-WVJDCDGZ.js";import"../../chunk-V2YORDAL.js";import"../../chunk-HN5HLFTB.js";import"../../chunk-KSHK3ZPX.js";import"../../chunk-N5I33LIN.js";import"../../chunk-ANXYPRBG.js";import"../../chunk-Z5WMKCRJ.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-ZTDKPUB5.js";import"../../chunk-TXSJL3HC.js";import"../../chunk-EGQJ7UBR.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-3BREUYLG.js";import"../../chunk-MXFDOIUA.js";import"../../chunk-BI6U55BD.js";import"../../chunk-3LOVCTCN.js";import"../../chunk-P37U34EQ.js";export{a as CostCalculatorFlow};
2
2
  //# sourceMappingURL=CostCalculatorFlow.js.map
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { c as CostCalculatorEstimateResponse } from '../../types.gen-C9Y1S1pc.js';
3
- import { CostCalculatorEstimationSubmitValues, EstimationError } from './types.js';
2
+ import { CostCalculatorEstimationSubmitValues, CostCalculatorEstimationResponse, EstimationError } from './types.js';
3
+ import '../../types.gen-CaXCWhlP.js';
4
4
  import './constants.js';
5
5
  import '../types.js';
6
6
  import '@remoteoss/json-schema-form';
@@ -15,7 +15,7 @@ type CostCalculatorFormProps = Partial<{
15
15
  * Callback function to handle the success when the estimation succeeds. The CostCalculatorEstimateResponse is sent back to you.
16
16
  * @param data - The response data from the /cost-calculator/estimation endpoint.
17
17
  */
18
- onSuccess: (data: CostCalculatorEstimateResponse) => Promise<void> | void;
18
+ onSuccess: (data: CostCalculatorEstimationResponse) => Promise<void> | void;
19
19
  /**
20
20
  * Callback function to handle the error when the estimation fails.
21
21
  * @param error - The error object.
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-NVQBJCNL.js";import"../../chunk-KSHK3ZPX.js";import"../../chunk-LK4XMOCE.js";import"../../chunk-ZTDKPUB5.js";import"../../chunk-KHNAQRGE.js";import"../../chunk-GP237GUO.js";import"../../chunk-TXSJL3HC.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-7VUILYZ3.js";import"../../chunk-3BREUYLG.js";import"../../chunk-MXFDOIUA.js";import"../../chunk-BI6U55BD.js";import"../../chunk-3LOVCTCN.js";import"../../chunk-P37U34EQ.js";export{a as CostCalculatorForm};
1
+ import{a}from"../../chunk-QURYMQUD.js";import"../../chunk-KSHK3ZPX.js";import"../../chunk-LK4XMOCE.js";import"../../chunk-ZTDKPUB5.js";import"../../chunk-KHNAQRGE.js";import"../../chunk-GP237GUO.js";import"../../chunk-TXSJL3HC.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-7VUILYZ3.js";import"../../chunk-3BREUYLG.js";import"../../chunk-MXFDOIUA.js";import"../../chunk-BI6U55BD.js";import"../../chunk-3LOVCTCN.js";import"../../chunk-P37U34EQ.js";export{a as CostCalculatorForm};
2
2
  //# sourceMappingURL=CostCalculatorForm.js.map
@@ -1,5 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { B as CostCalculatorEmployment, D as MinimalCountry, M as MinimalRegion } from '../../../types.gen-C9Y1S1pc.js';
2
+ import { A as MinimalCountry, M as MinimalRegion } from '../../../types.gen-CaXCWhlP.js';
3
+ import { CostCalculatorEstimation } from '../types.js';
4
+ import '../constants.js';
5
+ import '../../types.js';
6
+ import '@remoteoss/json-schema-form';
3
7
 
4
8
  interface OnboardingTimelineStep {
5
9
  title: string;
@@ -31,7 +35,7 @@ type EstimationResultsComponents = {
31
35
  Footer?: React.ComponentType;
32
36
  };
33
37
  type EstimationResultsProps = {
34
- estimation: CostCalculatorEmployment;
38
+ estimation: CostCalculatorEstimation;
35
39
  title: string;
36
40
  components?: EstimationResultsComponents;
37
41
  onDelete: () => void;
@@ -1,2 +1,2 @@
1
- import{a}from"../../../chunk-HSIQ2OHT.js";import"../../../chunk-4RULC3AZ.js";import"../../../chunk-ZE3YT3Q6.js";import"../../../chunk-NBCZF2FO.js";import"../../../chunk-UHS3QRA3.js";import"../../../chunk-N5I33LIN.js";import"../../../chunk-ANXYPRBG.js";import"../../../chunk-EGQJ7UBR.js";import"../../../chunk-3ZWDIEEM.js";import"../../../chunk-7VUILYZ3.js";import"../../../chunk-3LOVCTCN.js";import"../../../chunk-P37U34EQ.js";export{a as EstimationResults};
1
+ import{a}from"../../../chunk-HVTGLVLT.js";import"../../../chunk-4RULC3AZ.js";import"../../../chunk-ZE3YT3Q6.js";import"../../../chunk-NBCZF2FO.js";import"../../../chunk-UHS3QRA3.js";import"../../../chunk-N5I33LIN.js";import"../../../chunk-ANXYPRBG.js";import"../../../chunk-EGQJ7UBR.js";import"../../../chunk-3ZWDIEEM.js";import"../../../chunk-7VUILYZ3.js";import"../../../chunk-3LOVCTCN.js";import"../../../chunk-P37U34EQ.js";export{a as EstimationResults};
2
2
  //# sourceMappingURL=EstimationResults.js.map