@remoteoss/remote-flows 0.4.0-alpha.20 → 0.4.0-alpha.22

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 (87) hide show
  1. package/dist/{chunk-2NLOH7NZ.js → chunk-3BIRQAED.js} +2 -2
  2. package/dist/{chunk-MA4IML3T.js → chunk-3QGKRPQ6.js} +2 -2
  3. package/dist/{chunk-76CE6Z77.js → chunk-3R33SVSF.js} +2 -2
  4. package/dist/{chunk-DKJZB2TO.js → chunk-63BYEK44.js} +2 -2
  5. package/dist/chunk-7NBID3JL.js +2 -0
  6. package/dist/chunk-7NBID3JL.js.map +1 -0
  7. package/dist/{chunk-LZ3R4ZK2.js → chunk-ARYI3WUN.js} +2 -2
  8. package/dist/{chunk-T6LHPVKN.js → chunk-CEIK7DGY.js} +2 -2
  9. package/dist/{chunk-Y56L3QKM.js → chunk-DOLJU76M.js} +2 -2
  10. package/dist/{chunk-FJ2XPRKU.js → chunk-EPLIVM3Y.js} +2 -2
  11. package/dist/{chunk-MYGO6KUI.js → chunk-ETMTVNOU.js} +2 -2
  12. package/dist/{chunk-RDLTU3FE.js → chunk-FCHRSRS6.js} +2 -2
  13. package/dist/{chunk-U6PYTUGP.js → chunk-ISOKYXYN.js} +2 -2
  14. package/dist/{chunk-26PHG6H2.js → chunk-LFIQVLFK.js} +2 -2
  15. package/dist/{chunk-FF6SE4JF.js → chunk-LFLO2IJA.js} +2 -2
  16. package/dist/{chunk-EAORGT7Z.js → chunk-LPR2D3EY.js} +2 -2
  17. package/dist/{chunk-CU75S5F2.js → chunk-MNFM2TNK.js} +2 -2
  18. package/dist/{chunk-ZEUIOZB6.js → chunk-MO7KC4HE.js} +2 -2
  19. package/dist/{chunk-RLETCEUU.js → chunk-N6NYXAXH.js} +2 -2
  20. package/dist/chunk-N6NYXAXH.js.map +1 -0
  21. package/dist/{chunk-ZUNKCQBT.js → chunk-O53436KO.js} +2 -2
  22. package/dist/{chunk-6SWZH7KI.js → chunk-SIC7BRJ2.js} +2 -2
  23. package/dist/{chunk-X3YONWNH.js → chunk-TNF6DNGM.js} +2 -2
  24. package/dist/{chunk-G3OSPYB5.js → chunk-XMDNHTKE.js} +2 -2
  25. package/dist/{chunk-QXMSFJVB.js → chunk-YNQVZYFG.js} +2 -2
  26. package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
  27. package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
  28. package/dist/flows/ContractAmendment/index.js +1 -1
  29. package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
  30. package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
  31. package/dist/flows/CostCalculator/components/SalaryField.d.ts +1 -1
  32. package/dist/flows/CostCalculator/components/SalaryField.js +1 -1
  33. package/dist/flows/CostCalculator/context.d.ts +1 -1
  34. package/dist/flows/CostCalculator/hooks.js +1 -1
  35. package/dist/flows/CostCalculator/index.d.ts +1 -1
  36. package/dist/flows/CostCalculator/index.js +1 -1
  37. package/dist/flows/CostCalculator/utils.d.ts +1 -1
  38. package/dist/flows/CostCalculator/utils.js +1 -1
  39. package/dist/flows/Onboarding/OnboardingFlow.d.ts +1 -1
  40. package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
  41. package/dist/flows/Onboarding/components/AnnualGrossSalary.d.ts +1 -1
  42. package/dist/flows/Onboarding/components/AnnualGrossSalary.js +1 -1
  43. package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
  44. package/dist/flows/Onboarding/components/BenefitsStep.d.ts +1 -1
  45. package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
  46. package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
  47. package/dist/flows/Onboarding/components/OnboardingForm.d.ts +1 -1
  48. package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
  49. package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
  50. package/dist/flows/Onboarding/hooks.js +1 -1
  51. package/dist/flows/Onboarding/index.d.ts +1 -1
  52. package/dist/flows/Onboarding/index.js +1 -1
  53. package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
  54. package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
  55. package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
  56. package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
  57. package/dist/flows/Termination/TerminationFlow.js +1 -1
  58. package/dist/flows/Termination/TerminationForm.js +1 -1
  59. package/dist/flows/Termination/index.js +1 -1
  60. package/dist/index.d.ts +2 -2
  61. package/dist/index.js +1 -1
  62. package/dist/{remoteFlows--lO1UtNJ.d.ts → remoteFlows-DFkKjnDe.d.ts} +3 -1
  63. package/package.json +1 -1
  64. package/dist/chunk-IXINXLDO.js +0 -2
  65. package/dist/chunk-IXINXLDO.js.map +0 -1
  66. package/dist/chunk-RLETCEUU.js.map +0 -1
  67. /package/dist/{chunk-2NLOH7NZ.js.map → chunk-3BIRQAED.js.map} +0 -0
  68. /package/dist/{chunk-MA4IML3T.js.map → chunk-3QGKRPQ6.js.map} +0 -0
  69. /package/dist/{chunk-76CE6Z77.js.map → chunk-3R33SVSF.js.map} +0 -0
  70. /package/dist/{chunk-DKJZB2TO.js.map → chunk-63BYEK44.js.map} +0 -0
  71. /package/dist/{chunk-LZ3R4ZK2.js.map → chunk-ARYI3WUN.js.map} +0 -0
  72. /package/dist/{chunk-T6LHPVKN.js.map → chunk-CEIK7DGY.js.map} +0 -0
  73. /package/dist/{chunk-Y56L3QKM.js.map → chunk-DOLJU76M.js.map} +0 -0
  74. /package/dist/{chunk-FJ2XPRKU.js.map → chunk-EPLIVM3Y.js.map} +0 -0
  75. /package/dist/{chunk-MYGO6KUI.js.map → chunk-ETMTVNOU.js.map} +0 -0
  76. /package/dist/{chunk-RDLTU3FE.js.map → chunk-FCHRSRS6.js.map} +0 -0
  77. /package/dist/{chunk-U6PYTUGP.js.map → chunk-ISOKYXYN.js.map} +0 -0
  78. /package/dist/{chunk-26PHG6H2.js.map → chunk-LFIQVLFK.js.map} +0 -0
  79. /package/dist/{chunk-FF6SE4JF.js.map → chunk-LFLO2IJA.js.map} +0 -0
  80. /package/dist/{chunk-EAORGT7Z.js.map → chunk-LPR2D3EY.js.map} +0 -0
  81. /package/dist/{chunk-CU75S5F2.js.map → chunk-MNFM2TNK.js.map} +0 -0
  82. /package/dist/{chunk-ZEUIOZB6.js.map → chunk-MO7KC4HE.js.map} +0 -0
  83. /package/dist/{chunk-ZUNKCQBT.js.map → chunk-O53436KO.js.map} +0 -0
  84. /package/dist/{chunk-6SWZH7KI.js.map → chunk-SIC7BRJ2.js.map} +0 -0
  85. /package/dist/{chunk-X3YONWNH.js.map → chunk-TNF6DNGM.js.map} +0 -0
  86. /package/dist/{chunk-G3OSPYB5.js.map → chunk-XMDNHTKE.js.map} +0 -0
  87. /package/dist/{chunk-QXMSFJVB.js.map → chunk-YNQVZYFG.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as $e}from"./chunk-XO3JWN33.js";import{a as A}from"./chunk-RLETCEUU.js";import{a as ge,b as B}from"./chunk-GEYFQVQI.js";import{b as x}from"./chunk-3ZWDIEEM.js";import{a as Me,b as C,c as R,d as S,e as N,f as w,g as T}from"./chunk-VNSF5IOL.js";import{a as m}from"./chunk-KPHSEIR3.js";import{a as o}from"./chunk-P37U34EQ.js";import{Fragment as zo}from"react";import*as He from"react";import*as ee from"@radix-ui/react-checkbox";import{Check as Dt}from"lucide-react";import{jsx as ve}from"react/jsx-runtime";var te=He.forwardRef(({className:e,...t},r)=>ve(ee.Root,{ref:r,className:m("peer h-4 w-4 shrink-0 rounded-sm border border-input ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-checkbox data-[state=checked]:text-primary",e),...t,children:ve(ee.Indicator,{className:m("flex items-center justify-center text-current"),children:ve(Dt,{className:"h-4 w-4"})})}));te.displayName=ee.Root.displayName;import{useFormContext as Tt}from"react-hook-form";import{Fragment as It,jsx as z,jsxs as oe}from"react/jsx-runtime";function re({name:e,defaultValue:t,description:r,label:a,onChange:i,multiple:d,options:p,component:g,...v}){let{components:n}=x(),{control:c}=Tt(),u=o((s,l,h)=>{let f=h.value?[...h.value]:[];l?f.includes(s)||h.onChange([...f,s]):h.onChange(f.filter(_=>_!==s))},"handleCheckboxChange");return z(C,{control:c,name:e,defaultValue:t,render:({field:s,fieldState:l})=>{let h=g||n?.checkbox;if(h){let f={name:e,description:r,label:a,defaultValue:t,multiple:d,options:p,...v};return z(h,{field:{...s,onChange:o(_=>{if(d){let{checked:k,value:b}=_.target;u(b,k,s),i?.(k);return}s.onChange(_),i?.(_)},"onChange")},fieldState:l,fieldData:f})}return oe(R,{"data-field":e,className:m(`RemoteFlows__CheckBoxField__Item__${e}`),children:[z(N,{children:oe(It,{children:[p&&d?z(S,{children:a}):null,p&&d?p.map(f=>oe("div",{className:"flex space-x-2",children:[z(te,{id:f.value,onCheckedChange:_=>{u(f.value,_===!0,s),i?.(_,f.value)},checked:s.value?.includes(f.value),className:"RemoteFlows__CheckBox__Input"}),z(S,{htmlFor:f.value,className:"mb-0 RemoteFlows__CheckBox__Label",children:f.label})]},f.value)):oe("div",{className:"flex space-x-2",children:[z(te,{id:e,onCheckedChange:f=>{s.onChange(f),i?.(f)},checked:s.value,className:"RemoteFlows__CheckBox__Input"}),z(S,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label",children:a})]})]})}),r&&z(w,{children:r}),l.error&&z(T,{})]})}})}o(re,"CheckBoxField");import{CalendarIcon as $t}from"lucide-react";import{useFormContext as Ht}from"react-hook-form";import{ChevronLeft as Wt,ChevronRight as Lt}from"lucide-react";import{DayPicker as Mt}from"react-day-picker";import{jsx as Fe}from"react/jsx-runtime";function Ee({className:e,classNames:t,showOutsideDays:r=!0,...a}){return Fe(Mt,{showOutsideDays:r,className:m("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:m(ge({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:m("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",a.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:m(ge({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:o(({className:i,...d})=>Fe(Wt,{className:m("size-4",i),...d}),"IconLeft"),IconRight:o(({className:i,...d})=>Fe(Lt,{className:m("size-4",i),...d}),"IconRight")},...a})}o(Ee,"Calendar");import*as O from"@radix-ui/react-popover";import{jsx as ae}from"react/jsx-runtime";function ne({...e}){return ae(O.Root,{"data-slot":"popover",...e})}o(ne,"Popover");function ie({...e}){return ae(O.Trigger,{"data-slot":"popover-trigger",...e})}o(ie,"PopoverTrigger");function se({className:e,align:t="center",sideOffset:r=4,...a}){return ae(O.Portal,{children:ae(O.Content,{"data-slot":"popover-content",align:t,sideOffset:r,className:m("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...a})})}o(se,"PopoverContent");import{PopoverClose as Et}from"@radix-ui/react-popover";import{format as Be}from"date-fns";import{Fragment as Bt,jsx as W,jsxs as he}from"react/jsx-runtime";function Ae({description:e,label:t,name:r,minDate:a,onChange:i,component:d,...p}){let{components:g}=x(),{control:v}=Ht();return W(C,{control:v,name:r,render:({field:n,fieldState:c})=>{let u=d||g?.date;if(u){let s={description:e,label:t,name:r,minDate:a,onChange:i,...p};return W(u,{field:{...n,onChange:o(l=>{n.onChange(l),i?.(l)},"onChange")},fieldState:c,fieldData:s})}return he(R,{"data-field":r,className:`flex flex-col RemoteFlows__DatePickerField__Item__${r}`,children:[W(S,{className:"RemoteFlows__DatePickerField__Label",children:t}),he(ne,{children:[W(ie,{asChild:!0,children:W(N,{children:W("div",{children:he(B,{type:"button",variant:"outline",className:m("w-full pl-3 text-left font-normal",!n.value&&"text-muted-foreground"),"data-testid":`date-picker-button-${r}`,children:[n.value&&W(Bt,{children:Be(n.value,"yyyy-MM-dd")}),W($t,{className:"ml-auto h-4 w-4 opacity-50"})]})})})}),W(se,{className:"w-auto p-0 RemoteFlows__DatepickerField__PopoverContent",align:"start",children:W(Ee,{mode:"single",className:"RemoteFlows__DatepickerField__Calendar",selected:n.value?new Date(n.value):void 0,onSelect:s=>{n.onChange(s?Be(s,"yyyy-MM-dd"):null),i?.(s)},defaultMonth:a?new Date(a):void 0,components:{DayContent:o(s=>W(Et,{children:s.date.getDate()}),"DayContent")},...a&&{disabled:o(s=>s<new Date(a),"disabled")}})})]}),e?W(w,{children:e}):null,c.error&&W(T,{className:"RemoteFlows__DatePickerField__Error"})]})}})}o(Ae,"DatePickerField");import{cva as At}from"class-variance-authority";import{jsx as ye}from"react/jsx-runtime";var zt=At("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-card bg-warning border-warning-border [&>svg]:text-current"}},defaultVariants:{variant:"default"}});function ze({className:e,variant:t,...r}){return ye("div",{"data-slot":"alert",role:"alert",className:m(zt({variant:t}),e),...r})}o(ze,"Alert");function Oe({className:e,...t}){return ye("div",{"data-slot":"alert-title",className:m("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}o(Oe,"AlertTitle");function Ge({className:e,...t}){return ye("div",{"data-slot":"alert-description",className:m("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}o(Ge,"AlertDescription");import{AlertCircle as Ot}from"lucide-react";import{jsx as le,jsxs as Gt}from"react/jsx-runtime";function me({title:e,description:t,severity:r}){let{components:a}=x();if(a?.statement){let i=a?.statement;return le(i,{data:{title:e,description:t,severity:r}})}return Gt(ze,{variant:"warning",children:[le(Ot,{className:"h-4 w-4"}),e&&le(Oe,{children:e}),le(Ge,{children:t})]})}o(me,"Statement");import{jsx as _e,jsxs as Ve}from"react/jsx-runtime";import{createElement as Vt}from"react";function Ue({label:e,name:t,fields:r,description:a,components:i,statement:d}){return Ve("fieldset",{className:m("border-1 border-input p-4 rounded-xl",`RemoteFlows__FieldSetField__${t}`),children:[_e("legend",{className:"text-sm font-semibold px-2",children:e}),a?_e("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:a}}):null,Ve("div",{className:"grid gap-4",children:[r.map(p=>{let g=ce[p.type];return p.isVisible===!1||p.deprecated?null:Vt(g,{...p,key:p.name,name:`${t}.${p.name}`,component:i?.[p.type]})}),d?_e(me,{...d}):null]})]})}o(Ue,"FieldSetField");import{useFormContext as Yt}from"react-hook-form";import{useState as Ut,useRef as Jt}from"react";import{Upload as qt,X as Kt}from"lucide-react";import{jsx as V,jsxs as xe}from"react/jsx-runtime";function Je({onChange:e,className:t,multiple:r}){let[a,i]=Ut([]),d=Jt(null),p=o(n=>{n.preventDefault(),d.current?.click()},"handleClick"),g=o(n=>{if(n.target.files&&n.target.files.length>0){let c=Array.from(n.target.files);i(c),e(n)}},"handleChange"),v=o(n=>{i(c=>c.filter(u=>u!==n))},"onRemoveFile");return xe("div",{className:m("flex flex-col items-start gap-4",t),children:[V("input",{type:"file",ref:d,onChange:g,className:"hidden","aria-label":"File upload",multiple:r}),xe(B,{type:"button",onClick:p,className:"gap-2",children:[V(qt,{className:"h-4 w-4"}),"Choose File"]}),a.length===0&&V("div",{className:"text-sm",children:r?V("span",{className:"font-medium",children:"No files selected. You can select multiple files"}):V("span",{className:"font-medium",children:"No file selected."})}),a.length>0&&a.map((n,c)=>xe("div",{className:"text-sm flex items-center gap-2",children:["Selected file: ",V("span",{className:"font-medium",children:n.name})," (",Math.round(n.size/1024)," KB)",V(B,{variant:"ghost",onClick:()=>v(n),children:V(Kt,{})})]},c))]})}o(Je,"FileUploader");import{jsx as U,jsxs as Qt}from"react/jsx-runtime";var Xt=o(e=>new Promise((t,r)=>{let a=new FileReader;a.readAsDataURL(e),a.onload=()=>t(a.result),a.onerror=i=>r(i)}),"toBase64"),qe=o(async e=>{let t=e.target.files?Array.from(e.target.files):[];return await Promise.all(t.map(async a=>{let i=await Xt(a);return{name:a.name,content:i.split(",")[1]}}))},"convertFilesToBase64");function Ke({name:e,description:t,label:r,multiple:a,onChange:i,component:d,...p}){let{components:g}=x(),{control:v}=Yt();return U(C,{control:v,name:e,render:({field:n,fieldState:c})=>{let u=d||g?.file;if(u){let s={name:e,description:t,label:r,multiple:a,...p};return U(u,{field:{...n,value:null,onChange:o(async l=>{let h=await qe(l);n.onChange(h),i?.(h)},"onChange")},fieldState:c,fieldData:s})}return Qt(R,{"data-field":e,className:`RemoteFlows__FileUpload__Item__${e}`,children:[U(S,{className:"RemoteFlows__FileUpload__Label",children:r}),U(N,{children:U(Je,{onChange:async s=>{let l=await qe(s);n.onChange(l),i?.(l)},multiple:a,className:m("RemoteFlows__FileUpload__Input")})}),t&&U("div",{className:"flex items-center justify-between",children:U(w,{className:"RemoteFlows__FileUpload__Description",children:t})}),c.error&&U(T,{className:"RemoteFlows__FileUpload__Error"})]})}})}o(Ke,"FileUploadField");import{useFormContext as Zt}from"react-hook-form";import{jsx as Ce}from"react/jsx-runtime";function be(e){let{components:t}=x(),{control:r}=Zt(),a=e.component||t?.number;return a?Ce(C,{control:r,name:e.name,render:({field:i,fieldState:d})=>Ce(a,{field:{...i,onChange:o(p=>{i.onChange(p),e.onChange?.(p)},"onChange")},fieldState:d,fieldData:e})}):Ce(A,{...e,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$"})}o(be,"NumberField");import*as K from"@radix-ui/react-radio-group";import{CircleIcon as jt}from"lucide-react";import{jsx as de}from"react/jsx-runtime";function Ye({className:e,...t}){return de(K.Root,{"data-slot":"radio-group",className:m("grid gap-3",e),...t})}o(Ye,"RadioGroup");function Xe({className:e,...t}){return de(K.Item,{"data-slot":"radio-group-item",className:m("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:de(K.Indicator,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:de(jt,{className:"fill-radio absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}o(Xe,"RadioGroupItem");import{useFormContext as eo}from"react-hook-form";import{Fragment as to,jsx as $,jsxs as Se}from"react/jsx-runtime";function Qe({name:e,defaultValue:t,description:r,label:a,options:i,onChange:d,component:p,...g}){let{components:v}=x(),{control:n}=eo();return $(C,{control:n,name:e,defaultValue:t,render:({field:c,fieldState:u})=>{let s=p||v?.radio;if(s){let l={name:e,defaultValue:t,description:r,label:a,options:i,...g};return $(s,{field:{...c,onChange:o(h=>{c.onChange(h),d?.(h)},"onChange")},fieldState:u,fieldData:l})}return Se(R,{className:m("space-y-3",`RemoteFlows__RadioGroupField__Item__${e}`),"data-field":e,children:[$(S,{children:a}),$(N,{children:$(Ye,{"aria-label":a||e,onValueChange:l=>{c.onChange(l),d?.(l)},value:c.value,className:"flex flex-col space-y-3",children:i?.map(l=>$(to,{children:Se(R,{"data-field":e,className:"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item",children:[$(N,{children:$(Xe,{value:l.value,className:"RemoteFlows__RadioField__Input"})}),Se("div",{children:[$(S,{className:"font-normal mb-0 RemoteFlows__RadioField__Label",children:l.label}),l.description&&$(w,{className:"mt-2",children:l.description})]})]},l.value)}))})}),r&&$(w,{children:r}),u.error&&$(T,{})]})}})}o(Qe,"RadioGroupField");import*as y from"@radix-ui/react-select";import{CheckIcon as oo,ChevronDownIcon as Ze,ChevronUpIcon as ro}from"lucide-react";import{jsx as P,jsxs as Pe}from"react/jsx-runtime";function je({...e}){return P(y.Root,{"data-slot":"select",...e})}o(je,"Select");function et({...e}){return P(y.Group,{"data-slot":"select-group",...e})}o(et,"SelectGroup");function tt({...e}){return P(y.Value,{"data-slot":"select-value",...e})}o(tt,"SelectValue");function ot({className:e,children:t,...r}){return Pe(y.Trigger,{"data-slot":"select-trigger",className:m("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-full items-center justify-between rounded-xl border bg-transparent px-4 py-7 text-sm whitespace-nowrap transition-[color] outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","focus-visible:border-focused",e),...r,children:[t,P(y.Icon,{asChild:!0,className:"absolute right-4",children:P(Ze,{className:"size-4"})})]})}o(ot,"SelectTrigger");function rt({className:e,children:t,position:r="popper",...a}){return P(y.Portal,{children:Pe(y.Content,{"data-slot":"select-content",className:m("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...a,children:[P(ao,{}),P(y.Viewport,{className:m(r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),P(no,{})]})})}o(rt,"SelectContent");function at({className:e,children:t,...r}){return Pe(y.Item,{"data-slot":"select-item",className:m("focus:bg-accent focus:text-accent-foreground min-h-11 justify-between [&_svg:not([class*='text-'])]:text-muted-foreground flex w-full cursor-default items-center gap-2 py-2 px-4 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[P(y.ItemText,{children:t}),P("span",{className:"flex size-3.5 items-center justify-center",children:P(y.ItemIndicator,{children:P(oo,{className:"size-4"})})})]})}o(at,"SelectItem");function ao({className:e,...t}){return P(y.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:m("flex cursor-default items-center justify-center py-1",e),...t,children:P(ro,{className:"size-4"})})}o(ao,"SelectScrollUpButton");function no({className:e,...t}){return P(y.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:m("flex cursor-default items-center justify-center py-1",e),...t,children:P(Ze,{className:"size-4"})})}o(no,"SelectScrollDownButton");import{useFormContext as io}from"react-hook-form";import{jsx as L,jsxs as nt}from"react/jsx-runtime";function it({label:e,name:t,options:r,defaultValue:a,description:i,onChange:d,component:p,...g}){let{control:v}=io(),{components:n}=x();return L(C,{defaultValue:a,control:v,name:t,render:({field:c,fieldState:u})=>{let s=p||n?.select;if(s){let l={label:e,name:t,options:r,defaultValue:a,description:i,onChange:d,...g};return L(s,{field:{...c,onChange:o(h=>{c.onChange(h),d?.(h)},"onChange")},fieldState:u,fieldData:l})}return nt(R,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[L(S,{className:"RemoteFlows__SelectField__Label",children:e}),L(N,{children:L("div",{className:"relative",children:nt(je,{value:c.value||"",onValueChange:l=>{c.onChange(l),d?.(l)},children:[L(ot,{className:"RemoteFlows__SelectField__Trigger","aria-invalid":!!u.error,"aria-label":e,children:L("span",{className:"absolute",children:L(tt,{placeholder:e})})}),L(rt,{className:"RemoteFlows__SelectField__Content",children:L(et,{className:"RemoteFlows__SelectField__Group",children:r.map(l=>L(at,{value:l.value,className:"RemoteFlows__SelectField__SelectItem",children:l.label},l.value))})})]})})}),i&&L(w,{children:i}),u.error&&L(T,{})]})}})}o(it,"SelectField");import{useState as vo}from"react";import{useFormContext as Fo}from"react-hook-form";import{Fragment as co,useState as po}from"react";import{Check as uo,ChevronDownIcon as fo,X as go}from"lucide-react";import{Command as Y}from"cmdk";import{SearchIcon as Xa}from"lucide-react";import*as D from"@radix-ui/react-dialog";import{XIcon as so}from"lucide-react";import{jsx as G,jsxs as ke}from"react/jsx-runtime";function Re({...e}){return G(D.Root,{"data-slot":"dialog",...e})}o(Re,"Dialog");function st({...e}){return G(D.Trigger,{"data-slot":"dialog-trigger",...e})}o(st,"DialogTrigger");function lo({...e}){return G(D.Portal,{"data-slot":"dialog-portal",...e})}o(lo,"DialogPortal");function mo({className:e,...t}){return G(D.Overlay,{"data-slot":"dialog-overlay",className:m("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}o(mo,"DialogOverlay");function Ne({className:e,children:t,...r}){return ke(lo,{"data-slot":"dialog-portal",children:[G(mo,{}),ke(D.Content,{"data-slot":"dialog-content",className:m("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,ke(D.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 RemoteFlows__Dialog__Close",children:[G(so,{}),G("span",{className:"sr-only",children:"Close"})]})]})]})}o(Ne,"DialogContent");function we({className:e,...t}){return G("div",{"data-slot":"dialog-header",className:m("flex flex-col gap-2 text-center sm:text-left",e),...t})}o(we,"DialogHeader");function De({className:e,...t}){return G(D.Title,{"data-slot":"dialog-title",className:m("text-lg leading-none font-semibold",e),...t})}o(De,"DialogTitle");import{jsx as X,jsxs as en}from"react/jsx-runtime";function lt({className:e,...t}){return X(Y,{"data-slot":"command",className:m("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}o(lt,"Command");function mt({className:e,...t}){return X(Y.List,{"data-slot":"command-list",className:m("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}o(mt,"CommandList");function ct({...e}){return X(Y.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}o(ct,"CommandEmpty");function dt({className:e,...t}){return X(Y.Group,{"data-slot":"command-group",className:m("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}o(dt,"CommandGroup");function pt({className:e,...t}){return X(Y.Separator,{"data-slot":"command-separator",className:m("bg-border -mx-1 h-px",e),...t})}o(pt,"CommandSeparator");function ut({className:e,...t}){return X(Y.Item,{"data-slot":"command-item",className:m("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}o(ut,"CommandItem");import{jsx as H,jsxs as Q}from"react/jsx-runtime";function ft({options:e,selected:t,onChange:r,placeholder:a,...i}){let[d,p]=po(!1),g=o(n=>{r(t.filter(c=>c.value!==n.value))},"handleUnselect"),v=e.reduce((n,c)=>{let u=c.category||"Uncategorized";return n[u]||(n[u]=[]),n[u].push(c),n},{});return Q(ne,{open:d,onOpenChange:p,...i,children:[H(ie,{children:Q(B,{variant:"outline",role:"combobox","aria-expanded":d,className:"w-full justify-between font-normal",type:"button",children:[H("div",{className:"flex gap-1 flex-wrap overflow-x-auto max-h-[2.5rem] items-center",children:t.length>0?t.map(n=>Q($e,{variant:"secondary",className:"mr-1 mb-1",children:[n.label,H("div",{role:"button",tabIndex:0,"aria-label":`remove ${n.label}`,className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",onKeyDown:c=>{c.key==="Enter"&&g(n)},onMouseDown:c=>{c.preventDefault(),c.stopPropagation()},onClick:()=>g(n),children:H(go,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},n.label)):H("span",{className:"text-foreground",children:a})}),H(fo,{className:"size-4"})]})}),H(se,{align:"start",className:"w-full p-0",children:H(lt,{children:Q(mt,{children:[H(ct,{children:"No item found."}),Object.entries(v).map(([n,c],u)=>Q(co,{children:[u>0&&H(pt,{}),H(dt,{heading:n,children:c.map(s=>{let l=t.some(h=>h.value===s.value);return Q(ut,{onSelect:()=>{r(l?t.filter(h=>h.value!==s.value):[...t,s])},children:[H(uo,{className:m("mr-2 h-4 w-4",l?"opacity-100":"opacity-0")}),s.label]},s.label)})})]},n))]})})})]})}o(ft,"MultiSelect");import{jsx as J,jsxs as ho}from"react/jsx-runtime";function gt({label:e,name:t,options:r,defaultValue:a,description:i,onChange:d,$meta:p,component:g,...v}){let{control:n}=Fo(),{components:c}=x(),[u,s]=vo([]);return J(C,{defaultValue:a,control:n,name:t,render:({field:l,fieldState:h})=>{let f=g||c?.countries;if(f){let b={label:e,name:t,options:r,defaultValue:a,description:i,onChange:d,$meta:p,...v};return J(f,{field:{...l,onChange:o(M=>{l.onChange(M),d?.(M)},"onChange")},fieldState:h,fieldData:b})}let _=[...Object.entries(p?.regions||{}).map(([b,M])=>({value:M,label:b,category:"Regions"})),...Object.entries(p?.subregions||{}).map(([b,M])=>({value:M,label:b,category:"Subregions"})),...r.map(b=>({...b,value:b.value,label:b.label,category:"Countries"}))],k=o(b=>{let M=b.map(({value:wt})=>wt);l.onChange(M),d?.(M),s(b)},"handleChange");return ho(R,{"data-field":t,className:`RemoteFlows__CountryField__Item__${t}`,children:[J(S,{className:"RemoteFlows__CountryField__Label",children:e}),J(N,{children:J(ft,{options:_,selected:u,onChange:k,...v})}),i&&J(w,{children:i}),h.error&&J(T,{})]})}})}o(gt,"CountryField");import{useFormContext as _o}from"react-hook-form";import*as vt from"react";import{jsx as yo}from"react/jsx-runtime";var Te=vt.forwardRef(({className:e,...t},r)=>yo("textarea",{className:m("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...t}));Te.displayName="Textarea";import{jsx as q,jsxs as Ie}from"react/jsx-runtime";function Ft({name:e,description:t,label:r,onChange:a,maxLength:i,component:d,...p}){let{components:g}=x(),{control:v}=_o();return q(C,{control:v,name:e,render:({field:n,fieldState:c})=>{let u=d||g?.textarea;if(u){let l={name:e,description:t,label:r,maxLength:i,...p};return q(u,{field:{...n,onChange:o(h=>{n.onChange(h),a?.(h)},"onChange")},fieldState:c,fieldData:l})}let s=n.value?.length??0;return Ie(R,{"data-field":e,className:`RemoteFlows__TextArea__Item__${e}`,children:[q(S,{className:"RemoteFlows__TextArea__Label",children:r}),q(N,{children:q(Te,{...n,value:n.value??"",onChange:l=>{n.onChange(l),a?.(l)},className:m(c.error&&"border-red-500 focus-visible:ring-red-500","RemoteFlows__TextArea__Input"),placeholder:r})}),(t||i)&&Ie("div",{className:"flex items-center justify-between",children:[t&&q(w,{className:"RemoteFlows__TextArea__Description",children:t}),i&&Ie("span",{className:"text-sm ml-auto RemoteFlows__TextArea__MaxLength",children:[s,"/",i]})]}),c.error&&q(T,{className:"RemoteFlows__TextArea__Error"})]})}})}o(Ft,"TextAreaField");import{useFormContext as xo}from"react-hook-form";import{jsx as We}from"react/jsx-runtime";function ht(e){let{components:t}=x(),{control:r}=xo(),a=e.component||t?.email;return a?We(C,{control:r,name:e.name,render:({field:i,fieldState:d})=>We(a,{field:{...i,onChange:o(p=>{i.onChange(p),e.onChange?.(p)},"onChange")},fieldState:d,fieldData:e})}):We(A,{...e,type:"email"})}o(ht,"EmailField");import{useFormContext as Co}from"react-hook-form";import{jsx as yt}from"react/jsx-runtime";function _t(e){let{control:t}=Co();return yt(C,{control:t,name:e.name,render:({field:r})=>yt("input",{...r,type:"hidden"})})}o(_t,"HiddenField");import No,{useEffect as wo,useState as Pt}from"react";import{yupResolver as Do}from"@hookform/resolvers/yup";import{useForm as To,useFormContext as Io,useFieldArray as Wo}from"react-hook-form";import*as I from"yup";import xt from"lodash.groupby";import Z from"lodash.capitalize";var Ct=60,pe=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function bo(e){if(e<60)return`${e}m`;let t=Math.floor(e/Ct),r=e%Ct;return r>0?`${t}h${r}m`:`${t}h`}o(bo,"convertBreakDurationToHours");function bt(e){let t=e.reduce((r,a)=>a.hours+r,0);return Number(t.toFixed(2))}o(bt,"calculateTotalWorkHours");function So(e,t){let r=t.map(({day:d})=>d.toLowerCase()),a=r.indexOf(e),i=null;for(;a<r.length&&!i;){let d=r[a],p=r[a+1],g=pe.indexOf(d)+1;pe[g]===p||(i=d),a+=1}return i}o(So,"findLastConsecutiveDay");function Po(e){return e.start_time&&e.end_time&&(typeof e.hours=="number"?e.hours:Number.parseInt(e.hours))>0}o(Po,"shouldSummarizeSchedule");function ko(e){return Number.parseInt(e.break_duration_minutes)>0}o(ko,"shouldSummarizeBreaks");function St(e){let t=e.filter(Po),r=xt(t,g=>`${g.start_time}|${g.end_time}`),a=e.filter(ko),i=xt(a,"break_duration_minutes"),d=Object.keys(r).map(g=>{let v=r[g],n=v[0].day,[c,u]=g.split("|"),s=`from <span>${c.replace(":","h")}</span> to <span>${u.replace(":","h")}</span>`,l=So(n,v),f=(l?v.findIndex(_=>_.day===l):-1)===v.length-1;return v.length===1?`${Z(n)}, ${s}`:!f||!l?v.reduce((_,k,b)=>{let M=Z(k.day);return b===v.length-1?`${_}and ${M}, ${s}`:`${_}<span>${M}</span>, `},""):`<span>${Z(n)}</span> to <span>${Z(l)}</span>, ${s}`}),p=Object.keys(i).reverse().map((g,v)=>{let n=v===0,c=i[g],u=bo(parseInt(g,10));if(Object.keys(i).length===1)return`With ${u} daily breaks`;if(c.length===1){let s=`${u} break on ${Z(c[0].day)}.`;return n?`With ${s}`:s}return c.reduce((s,l,h)=>{let f=Z(l.day);return h===0?`${s} ${f}`:h===c.length-1?`${s}, and ${f}.`:`${s}, ${f}`},n?`With ${u} break on`:`${u} break on`)});return{workHoursSummary:d,breakSummary:p}}o(St,"buildWorkScheduleSummary");function Le(e){let{checked:t,start_time:r,end_time:a,break_duration_minutes:i}=e;if(!t)return 0;let[d,p]=r.split(":").map(Number),[g,v]=a.split(":").map(Number),n=d*60+p,s=(g*60+v-n-Number.parseInt(i||"0"))/60;return s===Math.floor(s)?s:Number(s.toFixed(2))}o(Le,"calculateHours");var Ro={monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat",sunday:"Sun"};function ue(e){return Ro[e]}o(ue,"getShortWeekday");import{jsx as F,jsxs as E}from"react/jsx-runtime";var Lo=I.object({day:I.string().required(),checked:I.boolean().required(),start_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:o(e=>e.required("Required"),"then"),otherwise:o(e=>e.optional().nullable(),"otherwise")}),end_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:o(e=>e.required("Required"),"then"),otherwise:o(e=>e.optional().nullable(),"otherwise")}),hours:I.number().default(0),break_duration_minutes:I.string().default("0")}),Mo=I.object({schedule:I.array(Lo)});function $o({defaultSchedule:e,onSubmit:t}){let[r,a]=Pt(!1),i=pe.map(f=>{let _=e.find(k=>k.day.toLowerCase()===ue(f).toLowerCase()||k.day.toLowerCase()===f.toLowerCase());return _?{..._,day:ue(f),checked:!0}:{...e[0],checked:!1,day:ue(f)}}),d=To({defaultValues:{schedule:i},resolver:Do(Mo)}),{handleSubmit:p,watch:g,reset:v,control:n,formState:c}=d,{fields:u}=Wo({name:"schedule",control:n}),s=g("schedule");function l(f){let _=f.schedule.filter(({checked:k})=>k).map(k=>({...k,hours:Le(k)}));t(_),a(!1)}o(l,"handleSubmitWorkingHours");function h(){v(),a(!1)}return o(h,"handleCancel"),F("div",{className:"flex items-center justify-between",children:E(Re,{open:r,onOpenChange:a,children:[F(st,{asChild:!0,children:F(B,{variant:"link",className:"flex items-center p-0 RemoteFlows__WorkScheduleSelectionForm__Trigger",children:"Edit Schedule"})}),E(Ne,{className:"max-w-5xl max-h-[90vh] overflow-y-auto px-8 py-4 RemoteFlows__WorkScheduleSelectionForm__Content",children:[F(we,{children:F(De,{className:"RemoteFlows__WorkScheduleSelectionForm__Title",children:"Edit employee working hours"})}),F(Me,{...d,children:E("form",{className:"space-y-4 RemoteFlows__WorkScheduleSelectionForm__Form",children:[E("div",{className:"rounded-lg",children:[F("p",{className:"text-gray-600 text-sm mb-4 RemoteFlows__WorkScheduleSelectionForm__Description",children:"The times displayed are in the employee's time zone in the 24-hour format."}),E("div",{className:"grid grid-cols-12 gap-4 text-sm font-medium text-gray-500 uppercase tracking-wide RemoteFlows__WorkScheduleSelectionForm__Header",children:[F("div",{className:"col-span-2"}),F("div",{className:"col-span-3 text-center",children:"START"}),F("div",{className:"col-span-1 text-center"}),F("div",{className:"col-span-3 text-center",children:"END"}),F("div",{className:"col-span-2 text-center",children:"HOURS"})]}),F("div",{className:"RemoteFlows__WorkScheduleSelectionForm__Rows",children:u.map((f,_)=>{let k=s[_],b=Le(k);return E(No.Fragment,{children:[E("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Hours",children:[F("div",{className:"col-span-2 flex items-center gap-3",children:F(re,{label:f.day,name:`schedule.${_}.checked`})}),F("div",{className:"col-span-3",children:F(A,{name:`schedule.${_}.start_time`,includeErrorMessage:!1})}),F("div",{className:"col-span-1 text-center text-gray-500",children:"to"}),F("div",{className:"col-span-3",children:F(A,{name:`schedule.${_}.end_time`,includeErrorMessage:!1})}),F("div",{className:"col-span-2 text-center text-gray-600",children:isNaN(b)?"-":`${b} hours`})]}),E("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Break",children:[F("div",{className:"col-span-2 text-gray-500",children:"Break"}),F("div",{className:"col-span-2",children:F(A,{name:`schedule.${_}.break_duration_minutes`,includeErrorMessage:!1})}),F("div",{className:"col-span-2 text-gray-500",children:"minutes"}),F("div",{className:"col-span-4"})]})]},f.id)})})]}),Object.keys(c.errors).length>0&&F("p",{className:"text-destructive text-sm mb-0",children:"Invalid time format (HH:mm)"}),E("div",{className:"flex gap-4 pt-4",children:[F(B,{type:"button",className:"reset-button",variant:"outline",onClick:h,children:"Cancel"}),F(B,{type:"button",className:"submit-button",onClick:p(l),children:"Save Schedule"})]})]})})]})]})})}o($o,"WorkScheduleSelectionForm");function kt(e){let{components:t}=x(),{setValue:r,control:a,watch:i}=Io(),d=i(e.name),[p,g]=Pt(d),{workHoursSummary:v,breakSummary:n}=St(p),c=bt(p);wo(()=>{r(e.name,p)},[p,e.name,r]);function u(l){g(l)}o(u,"onSubmit");let s=e.component||t?.["work-schedule"];return s?F(C,{control:a,name:e.name,render:({field:l,fieldState:h})=>F(s,{field:{...l,onChange:o(f=>{l.onChange(f),e.onChange?.(f)},"onChange")},fieldState:h,fieldData:{...e,defaultFormattedValue:{workHoursSummary:v,breakSummary:n,totalWorkHours:c}}})}):E("div",{className:"flex flex-col gap-3 RemoteFlows__WorkScheduleField",children:[F("p",{className:"text-sm RemoteFlows__WorkScheduleField__Title",children:"Work hours"}),E("div",{className:"flex flex-col gap-1 RemoteFlows__WorkScheduleField__Summary",children:[F("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__WorkHours",dangerouslySetInnerHTML:{__html:v.join(", ")}}),F("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Break",children:n.join()}),E("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Total",children:["Total of ",F("span",{children:c})," hours per week"]}),F($o,{defaultSchedule:p,onSubmit:u})]})]})}o(kt,"WorkScheduleField");var ce={checkbox:re,text:A,email:ht,money:be,select:it,radio:Qe,number:be,file:Ke,fieldset:Ue,date:Ae,textarea:Ft,countries:gt,hidden:_t,"work-schedule":kt};import{useEffect as Ho}from"react";import{useFormContext as Eo}from"react-hook-form";import{Fragment as Bo,jsx as fe,jsxs as Ao}from"react/jsx-runtime";function Rt({name:e,value:t,description:r,statement:a}){let{setValue:i}=Eo();return Ho(()=>{i(e,t)},[]),fe("div",{children:a?Ao(Bo,{children:[fe("p",{className:`text-sm RemoteFlows__ForcedValue__Title__${e}`,dangerouslySetInnerHTML:{__html:a?.title}}),fe("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:a?.description}})]}):fe("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:r}})})}o(Rt,"ForcedValueField");import{Fragment as Go,jsx as j,jsxs as Nt}from"react/jsx-runtime";function Oo(e){return e.const!==void 0&&e.const===e.default&&e.inputType!=="checkbox"&&e.inputType!=="hidden"}o(Oo,"checkFieldHasForcedValue");var Mi=o(({fields:e,components:t})=>!e||e.length===0?null:j(Go,{children:e.map(r=>{if(r.isVisible===!1||r.deprecated)return null;if(Oo(r))return j(Rt,{name:r.name,description:r.description,value:r.const,statement:r.statement},r.name);if(r.Component){let{Component:i}=r;return j(i,{...r},r.name)}let a=ce[r.inputType];return r.inputType==="fieldset"?j(a,{...r,components:t}):a?Nt(zo,{children:[j(a,{...r,component:t&&t[r.inputType]}),r.statement?j(me,{...r.statement}):null]},r.name):Nt("p",{className:"error",children:["Field type ",r.inputType," not supported"]})})}),"JSONSchemaFormFields");export{Mi as a};
2
- //# sourceMappingURL=chunk-2NLOH7NZ.js.map
1
+ import{a as $e}from"./chunk-XO3JWN33.js";import{a as A}from"./chunk-N6NYXAXH.js";import{a as ge,b as B}from"./chunk-GEYFQVQI.js";import{b as x}from"./chunk-3ZWDIEEM.js";import{a as Me,b as C,c as R,d as S,e as N,f as w,g as T}from"./chunk-VNSF5IOL.js";import{a as m}from"./chunk-KPHSEIR3.js";import{a as o}from"./chunk-P37U34EQ.js";import{Fragment as zo}from"react";import*as He from"react";import*as ee from"@radix-ui/react-checkbox";import{Check as Dt}from"lucide-react";import{jsx as ve}from"react/jsx-runtime";var te=He.forwardRef(({className:e,...t},r)=>ve(ee.Root,{ref:r,className:m("peer h-4 w-4 shrink-0 rounded-sm border border-input ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-checkbox data-[state=checked]:text-primary",e),...t,children:ve(ee.Indicator,{className:m("flex items-center justify-center text-current"),children:ve(Dt,{className:"h-4 w-4"})})}));te.displayName=ee.Root.displayName;import{useFormContext as Tt}from"react-hook-form";import{Fragment as It,jsx as z,jsxs as oe}from"react/jsx-runtime";function re({name:e,defaultValue:t,description:r,label:a,onChange:i,multiple:d,options:p,component:g,...v}){let{components:n}=x(),{control:c}=Tt(),u=o((s,l,h)=>{let f=h.value?[...h.value]:[];l?f.includes(s)||h.onChange([...f,s]):h.onChange(f.filter(_=>_!==s))},"handleCheckboxChange");return z(C,{control:c,name:e,defaultValue:t,render:({field:s,fieldState:l})=>{let h=g||n?.checkbox;if(h){let f={name:e,description:r,label:a,defaultValue:t,multiple:d,options:p,...v};return z(h,{field:{...s,onChange:o(_=>{if(d){let{checked:k,value:b}=_.target;u(b,k,s),i?.(k);return}s.onChange(_),i?.(_)},"onChange")},fieldState:l,fieldData:f})}return oe(R,{"data-field":e,className:m(`RemoteFlows__CheckBoxField__Item__${e}`),children:[z(N,{children:oe(It,{children:[p&&d?z(S,{children:a}):null,p&&d?p.map(f=>oe("div",{className:"flex space-x-2",children:[z(te,{id:f.value,onCheckedChange:_=>{u(f.value,_===!0,s),i?.(_,f.value)},checked:s.value?.includes(f.value),className:"RemoteFlows__CheckBox__Input"}),z(S,{htmlFor:f.value,className:"mb-0 RemoteFlows__CheckBox__Label",children:f.label})]},f.value)):oe("div",{className:"flex space-x-2",children:[z(te,{id:e,onCheckedChange:f=>{s.onChange(f),i?.(f)},checked:s.value,className:"RemoteFlows__CheckBox__Input"}),z(S,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label",children:a})]})]})}),r&&z(w,{children:r}),l.error&&z(T,{})]})}})}o(re,"CheckBoxField");import{CalendarIcon as $t}from"lucide-react";import{useFormContext as Ht}from"react-hook-form";import{ChevronLeft as Wt,ChevronRight as Lt}from"lucide-react";import{DayPicker as Mt}from"react-day-picker";import{jsx as Fe}from"react/jsx-runtime";function Ee({className:e,classNames:t,showOutsideDays:r=!0,...a}){return Fe(Mt,{showOutsideDays:r,className:m("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:m(ge({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:m("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",a.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:m(ge({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:o(({className:i,...d})=>Fe(Wt,{className:m("size-4",i),...d}),"IconLeft"),IconRight:o(({className:i,...d})=>Fe(Lt,{className:m("size-4",i),...d}),"IconRight")},...a})}o(Ee,"Calendar");import*as O from"@radix-ui/react-popover";import{jsx as ae}from"react/jsx-runtime";function ne({...e}){return ae(O.Root,{"data-slot":"popover",...e})}o(ne,"Popover");function ie({...e}){return ae(O.Trigger,{"data-slot":"popover-trigger",...e})}o(ie,"PopoverTrigger");function se({className:e,align:t="center",sideOffset:r=4,...a}){return ae(O.Portal,{children:ae(O.Content,{"data-slot":"popover-content",align:t,sideOffset:r,className:m("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...a})})}o(se,"PopoverContent");import{PopoverClose as Et}from"@radix-ui/react-popover";import{format as Be}from"date-fns";import{Fragment as Bt,jsx as W,jsxs as he}from"react/jsx-runtime";function Ae({description:e,label:t,name:r,minDate:a,onChange:i,component:d,...p}){let{components:g}=x(),{control:v}=Ht();return W(C,{control:v,name:r,render:({field:n,fieldState:c})=>{let u=d||g?.date;if(u){let s={description:e,label:t,name:r,minDate:a,onChange:i,...p};return W(u,{field:{...n,onChange:o(l=>{n.onChange(l),i?.(l)},"onChange")},fieldState:c,fieldData:s})}return he(R,{"data-field":r,className:`flex flex-col RemoteFlows__DatePickerField__Item__${r}`,children:[W(S,{className:"RemoteFlows__DatePickerField__Label",children:t}),he(ne,{children:[W(ie,{asChild:!0,children:W(N,{children:W("div",{children:he(B,{type:"button",variant:"outline",className:m("w-full pl-3 text-left font-normal",!n.value&&"text-muted-foreground"),"data-testid":`date-picker-button-${r}`,children:[n.value&&W(Bt,{children:Be(n.value,"yyyy-MM-dd")}),W($t,{className:"ml-auto h-4 w-4 opacity-50"})]})})})}),W(se,{className:"w-auto p-0 RemoteFlows__DatepickerField__PopoverContent",align:"start",children:W(Ee,{mode:"single",className:"RemoteFlows__DatepickerField__Calendar",selected:n.value?new Date(n.value):void 0,onSelect:s=>{n.onChange(s?Be(s,"yyyy-MM-dd"):null),i?.(s)},defaultMonth:a?new Date(a):void 0,components:{DayContent:o(s=>W(Et,{children:s.date.getDate()}),"DayContent")},...a&&{disabled:o(s=>s<new Date(a),"disabled")}})})]}),e?W(w,{children:e}):null,c.error&&W(T,{className:"RemoteFlows__DatePickerField__Error"})]})}})}o(Ae,"DatePickerField");import{cva as At}from"class-variance-authority";import{jsx as ye}from"react/jsx-runtime";var zt=At("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-card bg-warning border-warning-border [&>svg]:text-current"}},defaultVariants:{variant:"default"}});function ze({className:e,variant:t,...r}){return ye("div",{"data-slot":"alert",role:"alert",className:m(zt({variant:t}),e),...r})}o(ze,"Alert");function Oe({className:e,...t}){return ye("div",{"data-slot":"alert-title",className:m("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}o(Oe,"AlertTitle");function Ge({className:e,...t}){return ye("div",{"data-slot":"alert-description",className:m("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}o(Ge,"AlertDescription");import{AlertCircle as Ot}from"lucide-react";import{jsx as le,jsxs as Gt}from"react/jsx-runtime";function me({title:e,description:t,severity:r}){let{components:a}=x();if(a?.statement){let i=a?.statement;return le(i,{data:{title:e,description:t,severity:r}})}return Gt(ze,{variant:"warning",children:[le(Ot,{className:"h-4 w-4"}),e&&le(Oe,{children:e}),le(Ge,{children:t})]})}o(me,"Statement");import{jsx as _e,jsxs as Ve}from"react/jsx-runtime";import{createElement as Vt}from"react";function Ue({label:e,name:t,fields:r,description:a,components:i,statement:d}){return Ve("fieldset",{className:m("border-1 border-input p-4 rounded-xl",`RemoteFlows__FieldSetField__${t}`),children:[_e("legend",{className:"text-sm font-semibold px-2",children:e}),a?_e("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:a}}):null,Ve("div",{className:"grid gap-4",children:[r.map(p=>{let g=ce[p.type];return p.isVisible===!1||p.deprecated?null:Vt(g,{...p,key:p.name,name:`${t}.${p.name}`,component:i?.[p.type]})}),d?_e(me,{...d}):null]})]})}o(Ue,"FieldSetField");import{useFormContext as Yt}from"react-hook-form";import{useState as Ut,useRef as Jt}from"react";import{Upload as qt,X as Kt}from"lucide-react";import{jsx as V,jsxs as xe}from"react/jsx-runtime";function Je({onChange:e,className:t,multiple:r}){let[a,i]=Ut([]),d=Jt(null),p=o(n=>{n.preventDefault(),d.current?.click()},"handleClick"),g=o(n=>{if(n.target.files&&n.target.files.length>0){let c=Array.from(n.target.files);i(c),e(n)}},"handleChange"),v=o(n=>{i(c=>c.filter(u=>u!==n))},"onRemoveFile");return xe("div",{className:m("flex flex-col items-start gap-4",t),children:[V("input",{type:"file",ref:d,onChange:g,className:"hidden","aria-label":"File upload",multiple:r}),xe(B,{type:"button",onClick:p,className:"gap-2",children:[V(qt,{className:"h-4 w-4"}),"Choose File"]}),a.length===0&&V("div",{className:"text-sm",children:r?V("span",{className:"font-medium",children:"No files selected. You can select multiple files"}):V("span",{className:"font-medium",children:"No file selected."})}),a.length>0&&a.map((n,c)=>xe("div",{className:"text-sm flex items-center gap-2",children:["Selected file: ",V("span",{className:"font-medium",children:n.name})," (",Math.round(n.size/1024)," KB)",V(B,{variant:"ghost",onClick:()=>v(n),children:V(Kt,{})})]},c))]})}o(Je,"FileUploader");import{jsx as U,jsxs as Qt}from"react/jsx-runtime";var Xt=o(e=>new Promise((t,r)=>{let a=new FileReader;a.readAsDataURL(e),a.onload=()=>t(a.result),a.onerror=i=>r(i)}),"toBase64"),qe=o(async e=>{let t=e.target.files?Array.from(e.target.files):[];return await Promise.all(t.map(async a=>{let i=await Xt(a);return{name:a.name,content:i.split(",")[1]}}))},"convertFilesToBase64");function Ke({name:e,description:t,label:r,multiple:a,onChange:i,component:d,...p}){let{components:g}=x(),{control:v}=Yt();return U(C,{control:v,name:e,render:({field:n,fieldState:c})=>{let u=d||g?.file;if(u){let s={name:e,description:t,label:r,multiple:a,...p};return U(u,{field:{...n,value:null,onChange:o(async l=>{let h=await qe(l);n.onChange(h),i?.(h)},"onChange")},fieldState:c,fieldData:s})}return Qt(R,{"data-field":e,className:`RemoteFlows__FileUpload__Item__${e}`,children:[U(S,{className:"RemoteFlows__FileUpload__Label",children:r}),U(N,{children:U(Je,{onChange:async s=>{let l=await qe(s);n.onChange(l),i?.(l)},multiple:a,className:m("RemoteFlows__FileUpload__Input")})}),t&&U("div",{className:"flex items-center justify-between",children:U(w,{className:"RemoteFlows__FileUpload__Description",children:t})}),c.error&&U(T,{className:"RemoteFlows__FileUpload__Error"})]})}})}o(Ke,"FileUploadField");import{useFormContext as Zt}from"react-hook-form";import{jsx as Ce}from"react/jsx-runtime";function be(e){let{components:t}=x(),{control:r}=Zt(),a=e.component||t?.number;return a?Ce(C,{control:r,name:e.name,render:({field:i,fieldState:d})=>Ce(a,{field:{...i,onChange:o(p=>{i.onChange(p),e.onChange?.(p)},"onChange")},fieldState:d,fieldData:e})}):Ce(A,{...e,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$"})}o(be,"NumberField");import*as K from"@radix-ui/react-radio-group";import{CircleIcon as jt}from"lucide-react";import{jsx as de}from"react/jsx-runtime";function Ye({className:e,...t}){return de(K.Root,{"data-slot":"radio-group",className:m("grid gap-3",e),...t})}o(Ye,"RadioGroup");function Xe({className:e,...t}){return de(K.Item,{"data-slot":"radio-group-item",className:m("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:de(K.Indicator,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:de(jt,{className:"fill-radio absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}o(Xe,"RadioGroupItem");import{useFormContext as eo}from"react-hook-form";import{Fragment as to,jsx as $,jsxs as Se}from"react/jsx-runtime";function Qe({name:e,defaultValue:t,description:r,label:a,options:i,onChange:d,component:p,...g}){let{components:v}=x(),{control:n}=eo();return $(C,{control:n,name:e,defaultValue:t,render:({field:c,fieldState:u})=>{let s=p||v?.radio;if(s){let l={name:e,defaultValue:t,description:r,label:a,options:i,...g};return $(s,{field:{...c,onChange:o(h=>{c.onChange(h),d?.(h)},"onChange")},fieldState:u,fieldData:l})}return Se(R,{className:m("space-y-3",`RemoteFlows__RadioGroupField__Item__${e}`),"data-field":e,children:[$(S,{children:a}),$(N,{children:$(Ye,{"aria-label":a||e,onValueChange:l=>{c.onChange(l),d?.(l)},value:c.value,className:"flex flex-col space-y-3",children:i?.map(l=>$(to,{children:Se(R,{"data-field":e,className:"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item",children:[$(N,{children:$(Xe,{value:l.value,className:"RemoteFlows__RadioField__Input"})}),Se("div",{children:[$(S,{className:"font-normal mb-0 RemoteFlows__RadioField__Label",children:l.label}),l.description&&$(w,{className:"mt-2",children:l.description})]})]},l.value)}))})}),r&&$(w,{children:r}),u.error&&$(T,{})]})}})}o(Qe,"RadioGroupField");import*as y from"@radix-ui/react-select";import{CheckIcon as oo,ChevronDownIcon as Ze,ChevronUpIcon as ro}from"lucide-react";import{jsx as P,jsxs as Pe}from"react/jsx-runtime";function je({...e}){return P(y.Root,{"data-slot":"select",...e})}o(je,"Select");function et({...e}){return P(y.Group,{"data-slot":"select-group",...e})}o(et,"SelectGroup");function tt({...e}){return P(y.Value,{"data-slot":"select-value",...e})}o(tt,"SelectValue");function ot({className:e,children:t,...r}){return Pe(y.Trigger,{"data-slot":"select-trigger",className:m("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-full items-center justify-between rounded-xl border bg-transparent px-4 py-7 text-sm whitespace-nowrap transition-[color] outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","focus-visible:border-focused",e),...r,children:[t,P(y.Icon,{asChild:!0,className:"absolute right-4",children:P(Ze,{className:"size-4"})})]})}o(ot,"SelectTrigger");function rt({className:e,children:t,position:r="popper",...a}){return P(y.Portal,{children:Pe(y.Content,{"data-slot":"select-content",className:m("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...a,children:[P(ao,{}),P(y.Viewport,{className:m(r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),P(no,{})]})})}o(rt,"SelectContent");function at({className:e,children:t,...r}){return Pe(y.Item,{"data-slot":"select-item",className:m("focus:bg-accent focus:text-accent-foreground min-h-11 justify-between [&_svg:not([class*='text-'])]:text-muted-foreground flex w-full cursor-default items-center gap-2 py-2 px-4 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[P(y.ItemText,{children:t}),P("span",{className:"flex size-3.5 items-center justify-center",children:P(y.ItemIndicator,{children:P(oo,{className:"size-4"})})})]})}o(at,"SelectItem");function ao({className:e,...t}){return P(y.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:m("flex cursor-default items-center justify-center py-1",e),...t,children:P(ro,{className:"size-4"})})}o(ao,"SelectScrollUpButton");function no({className:e,...t}){return P(y.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:m("flex cursor-default items-center justify-center py-1",e),...t,children:P(Ze,{className:"size-4"})})}o(no,"SelectScrollDownButton");import{useFormContext as io}from"react-hook-form";import{jsx as L,jsxs as nt}from"react/jsx-runtime";function it({label:e,name:t,options:r,defaultValue:a,description:i,onChange:d,component:p,...g}){let{control:v}=io(),{components:n}=x();return L(C,{defaultValue:a,control:v,name:t,render:({field:c,fieldState:u})=>{let s=p||n?.select;if(s){let l={label:e,name:t,options:r,defaultValue:a,description:i,onChange:d,...g};return L(s,{field:{...c,onChange:o(h=>{c.onChange(h),d?.(h)},"onChange")},fieldState:u,fieldData:l})}return nt(R,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[L(S,{className:"RemoteFlows__SelectField__Label",children:e}),L(N,{children:L("div",{className:"relative",children:nt(je,{value:c.value||"",onValueChange:l=>{c.onChange(l),d?.(l)},children:[L(ot,{className:"RemoteFlows__SelectField__Trigger","aria-invalid":!!u.error,"aria-label":e,children:L("span",{className:"absolute",children:L(tt,{placeholder:e})})}),L(rt,{className:"RemoteFlows__SelectField__Content",children:L(et,{className:"RemoteFlows__SelectField__Group",children:r.map(l=>L(at,{value:l.value,className:"RemoteFlows__SelectField__SelectItem",children:l.label},l.value))})})]})})}),i&&L(w,{children:i}),u.error&&L(T,{})]})}})}o(it,"SelectField");import{useState as vo}from"react";import{useFormContext as Fo}from"react-hook-form";import{Fragment as co,useState as po}from"react";import{Check as uo,ChevronDownIcon as fo,X as go}from"lucide-react";import{Command as Y}from"cmdk";import{SearchIcon as Xa}from"lucide-react";import*as D from"@radix-ui/react-dialog";import{XIcon as so}from"lucide-react";import{jsx as G,jsxs as ke}from"react/jsx-runtime";function Re({...e}){return G(D.Root,{"data-slot":"dialog",...e})}o(Re,"Dialog");function st({...e}){return G(D.Trigger,{"data-slot":"dialog-trigger",...e})}o(st,"DialogTrigger");function lo({...e}){return G(D.Portal,{"data-slot":"dialog-portal",...e})}o(lo,"DialogPortal");function mo({className:e,...t}){return G(D.Overlay,{"data-slot":"dialog-overlay",className:m("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}o(mo,"DialogOverlay");function Ne({className:e,children:t,...r}){return ke(lo,{"data-slot":"dialog-portal",children:[G(mo,{}),ke(D.Content,{"data-slot":"dialog-content",className:m("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,ke(D.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 RemoteFlows__Dialog__Close",children:[G(so,{}),G("span",{className:"sr-only",children:"Close"})]})]})]})}o(Ne,"DialogContent");function we({className:e,...t}){return G("div",{"data-slot":"dialog-header",className:m("flex flex-col gap-2 text-center sm:text-left",e),...t})}o(we,"DialogHeader");function De({className:e,...t}){return G(D.Title,{"data-slot":"dialog-title",className:m("text-lg leading-none font-semibold",e),...t})}o(De,"DialogTitle");import{jsx as X,jsxs as en}from"react/jsx-runtime";function lt({className:e,...t}){return X(Y,{"data-slot":"command",className:m("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}o(lt,"Command");function mt({className:e,...t}){return X(Y.List,{"data-slot":"command-list",className:m("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}o(mt,"CommandList");function ct({...e}){return X(Y.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}o(ct,"CommandEmpty");function dt({className:e,...t}){return X(Y.Group,{"data-slot":"command-group",className:m("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}o(dt,"CommandGroup");function pt({className:e,...t}){return X(Y.Separator,{"data-slot":"command-separator",className:m("bg-border -mx-1 h-px",e),...t})}o(pt,"CommandSeparator");function ut({className:e,...t}){return X(Y.Item,{"data-slot":"command-item",className:m("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}o(ut,"CommandItem");import{jsx as H,jsxs as Q}from"react/jsx-runtime";function ft({options:e,selected:t,onChange:r,placeholder:a,...i}){let[d,p]=po(!1),g=o(n=>{r(t.filter(c=>c.value!==n.value))},"handleUnselect"),v=e.reduce((n,c)=>{let u=c.category||"Uncategorized";return n[u]||(n[u]=[]),n[u].push(c),n},{});return Q(ne,{open:d,onOpenChange:p,...i,children:[H(ie,{children:Q(B,{variant:"outline",role:"combobox","aria-expanded":d,className:"w-full justify-between font-normal",type:"button",children:[H("div",{className:"flex gap-1 flex-wrap overflow-x-auto max-h-[2.5rem] items-center",children:t.length>0?t.map(n=>Q($e,{variant:"secondary",className:"mr-1 mb-1",children:[n.label,H("div",{role:"button",tabIndex:0,"aria-label":`remove ${n.label}`,className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",onKeyDown:c=>{c.key==="Enter"&&g(n)},onMouseDown:c=>{c.preventDefault(),c.stopPropagation()},onClick:()=>g(n),children:H(go,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},n.label)):H("span",{className:"text-foreground",children:a})}),H(fo,{className:"size-4"})]})}),H(se,{align:"start",className:"w-full p-0",children:H(lt,{children:Q(mt,{children:[H(ct,{children:"No item found."}),Object.entries(v).map(([n,c],u)=>Q(co,{children:[u>0&&H(pt,{}),H(dt,{heading:n,children:c.map(s=>{let l=t.some(h=>h.value===s.value);return Q(ut,{onSelect:()=>{r(l?t.filter(h=>h.value!==s.value):[...t,s])},children:[H(uo,{className:m("mr-2 h-4 w-4",l?"opacity-100":"opacity-0")}),s.label]},s.label)})})]},n))]})})})]})}o(ft,"MultiSelect");import{jsx as J,jsxs as ho}from"react/jsx-runtime";function gt({label:e,name:t,options:r,defaultValue:a,description:i,onChange:d,$meta:p,component:g,...v}){let{control:n}=Fo(),{components:c}=x(),[u,s]=vo([]);return J(C,{defaultValue:a,control:n,name:t,render:({field:l,fieldState:h})=>{let f=g||c?.countries;if(f){let b={label:e,name:t,options:r,defaultValue:a,description:i,onChange:d,$meta:p,...v};return J(f,{field:{...l,onChange:o(M=>{l.onChange(M),d?.(M)},"onChange")},fieldState:h,fieldData:b})}let _=[...Object.entries(p?.regions||{}).map(([b,M])=>({value:M,label:b,category:"Regions"})),...Object.entries(p?.subregions||{}).map(([b,M])=>({value:M,label:b,category:"Subregions"})),...r.map(b=>({...b,value:b.value,label:b.label,category:"Countries"}))],k=o(b=>{let M=b.map(({value:wt})=>wt);l.onChange(M),d?.(M),s(b)},"handleChange");return ho(R,{"data-field":t,className:`RemoteFlows__CountryField__Item__${t}`,children:[J(S,{className:"RemoteFlows__CountryField__Label",children:e}),J(N,{children:J(ft,{options:_,selected:u,onChange:k,...v})}),i&&J(w,{children:i}),h.error&&J(T,{})]})}})}o(gt,"CountryField");import{useFormContext as _o}from"react-hook-form";import*as vt from"react";import{jsx as yo}from"react/jsx-runtime";var Te=vt.forwardRef(({className:e,...t},r)=>yo("textarea",{className:m("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...t}));Te.displayName="Textarea";import{jsx as q,jsxs as Ie}from"react/jsx-runtime";function Ft({name:e,description:t,label:r,onChange:a,maxLength:i,component:d,...p}){let{components:g}=x(),{control:v}=_o();return q(C,{control:v,name:e,render:({field:n,fieldState:c})=>{let u=d||g?.textarea;if(u){let l={name:e,description:t,label:r,maxLength:i,...p};return q(u,{field:{...n,onChange:o(h=>{n.onChange(h),a?.(h)},"onChange")},fieldState:c,fieldData:l})}let s=n.value?.length??0;return Ie(R,{"data-field":e,className:`RemoteFlows__TextArea__Item__${e}`,children:[q(S,{className:"RemoteFlows__TextArea__Label",children:r}),q(N,{children:q(Te,{...n,value:n.value??"",onChange:l=>{n.onChange(l),a?.(l)},className:m(c.error&&"border-red-500 focus-visible:ring-red-500","RemoteFlows__TextArea__Input"),placeholder:r})}),(t||i)&&Ie("div",{className:"flex items-center justify-between",children:[t&&q(w,{className:"RemoteFlows__TextArea__Description",children:t}),i&&Ie("span",{className:"text-sm ml-auto RemoteFlows__TextArea__MaxLength",children:[s,"/",i]})]}),c.error&&q(T,{className:"RemoteFlows__TextArea__Error"})]})}})}o(Ft,"TextAreaField");import{useFormContext as xo}from"react-hook-form";import{jsx as We}from"react/jsx-runtime";function ht(e){let{components:t}=x(),{control:r}=xo(),a=e.component||t?.email;return a?We(C,{control:r,name:e.name,render:({field:i,fieldState:d})=>We(a,{field:{...i,onChange:o(p=>{i.onChange(p),e.onChange?.(p)},"onChange")},fieldState:d,fieldData:e})}):We(A,{...e,type:"email"})}o(ht,"EmailField");import{useFormContext as Co}from"react-hook-form";import{jsx as yt}from"react/jsx-runtime";function _t(e){let{control:t}=Co();return yt(C,{control:t,name:e.name,render:({field:r})=>yt("input",{...r,type:"hidden"})})}o(_t,"HiddenField");import No,{useEffect as wo,useState as Pt}from"react";import{yupResolver as Do}from"@hookform/resolvers/yup";import{useForm as To,useFormContext as Io,useFieldArray as Wo}from"react-hook-form";import*as I from"yup";import xt from"lodash.groupby";import Z from"lodash.capitalize";var Ct=60,pe=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function bo(e){if(e<60)return`${e}m`;let t=Math.floor(e/Ct),r=e%Ct;return r>0?`${t}h${r}m`:`${t}h`}o(bo,"convertBreakDurationToHours");function bt(e){let t=e.reduce((r,a)=>a.hours+r,0);return Number(t.toFixed(2))}o(bt,"calculateTotalWorkHours");function So(e,t){let r=t.map(({day:d})=>d.toLowerCase()),a=r.indexOf(e),i=null;for(;a<r.length&&!i;){let d=r[a],p=r[a+1],g=pe.indexOf(d)+1;pe[g]===p||(i=d),a+=1}return i}o(So,"findLastConsecutiveDay");function Po(e){return e.start_time&&e.end_time&&(typeof e.hours=="number"?e.hours:Number.parseInt(e.hours))>0}o(Po,"shouldSummarizeSchedule");function ko(e){return Number.parseInt(e.break_duration_minutes)>0}o(ko,"shouldSummarizeBreaks");function St(e){let t=e.filter(Po),r=xt(t,g=>`${g.start_time}|${g.end_time}`),a=e.filter(ko),i=xt(a,"break_duration_minutes"),d=Object.keys(r).map(g=>{let v=r[g],n=v[0].day,[c,u]=g.split("|"),s=`from <span>${c.replace(":","h")}</span> to <span>${u.replace(":","h")}</span>`,l=So(n,v),f=(l?v.findIndex(_=>_.day===l):-1)===v.length-1;return v.length===1?`${Z(n)}, ${s}`:!f||!l?v.reduce((_,k,b)=>{let M=Z(k.day);return b===v.length-1?`${_}and ${M}, ${s}`:`${_}<span>${M}</span>, `},""):`<span>${Z(n)}</span> to <span>${Z(l)}</span>, ${s}`}),p=Object.keys(i).reverse().map((g,v)=>{let n=v===0,c=i[g],u=bo(parseInt(g,10));if(Object.keys(i).length===1)return`With ${u} daily breaks`;if(c.length===1){let s=`${u} break on ${Z(c[0].day)}.`;return n?`With ${s}`:s}return c.reduce((s,l,h)=>{let f=Z(l.day);return h===0?`${s} ${f}`:h===c.length-1?`${s}, and ${f}.`:`${s}, ${f}`},n?`With ${u} break on`:`${u} break on`)});return{workHoursSummary:d,breakSummary:p}}o(St,"buildWorkScheduleSummary");function Le(e){let{checked:t,start_time:r,end_time:a,break_duration_minutes:i}=e;if(!t)return 0;let[d,p]=r.split(":").map(Number),[g,v]=a.split(":").map(Number),n=d*60+p,s=(g*60+v-n-Number.parseInt(i||"0"))/60;return s===Math.floor(s)?s:Number(s.toFixed(2))}o(Le,"calculateHours");var Ro={monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat",sunday:"Sun"};function ue(e){return Ro[e]}o(ue,"getShortWeekday");import{jsx as F,jsxs as E}from"react/jsx-runtime";var Lo=I.object({day:I.string().required(),checked:I.boolean().required(),start_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:o(e=>e.required("Required"),"then"),otherwise:o(e=>e.optional().nullable(),"otherwise")}),end_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:o(e=>e.required("Required"),"then"),otherwise:o(e=>e.optional().nullable(),"otherwise")}),hours:I.number().default(0),break_duration_minutes:I.string().default("0")}),Mo=I.object({schedule:I.array(Lo)});function $o({defaultSchedule:e,onSubmit:t}){let[r,a]=Pt(!1),i=pe.map(f=>{let _=e.find(k=>k.day.toLowerCase()===ue(f).toLowerCase()||k.day.toLowerCase()===f.toLowerCase());return _?{..._,day:ue(f),checked:!0}:{...e[0],checked:!1,day:ue(f)}}),d=To({defaultValues:{schedule:i},resolver:Do(Mo)}),{handleSubmit:p,watch:g,reset:v,control:n,formState:c}=d,{fields:u}=Wo({name:"schedule",control:n}),s=g("schedule");function l(f){let _=f.schedule.filter(({checked:k})=>k).map(k=>({...k,hours:Le(k)}));t(_),a(!1)}o(l,"handleSubmitWorkingHours");function h(){v(),a(!1)}return o(h,"handleCancel"),F("div",{className:"flex items-center justify-between",children:E(Re,{open:r,onOpenChange:a,children:[F(st,{asChild:!0,children:F(B,{variant:"link",className:"flex items-center p-0 RemoteFlows__WorkScheduleSelectionForm__Trigger",children:"Edit Schedule"})}),E(Ne,{className:"max-w-5xl max-h-[90vh] overflow-y-auto px-8 py-4 RemoteFlows__WorkScheduleSelectionForm__Content",children:[F(we,{children:F(De,{className:"RemoteFlows__WorkScheduleSelectionForm__Title",children:"Edit employee working hours"})}),F(Me,{...d,children:E("form",{className:"space-y-4 RemoteFlows__WorkScheduleSelectionForm__Form",children:[E("div",{className:"rounded-lg",children:[F("p",{className:"text-gray-600 text-sm mb-4 RemoteFlows__WorkScheduleSelectionForm__Description",children:"The times displayed are in the employee's time zone in the 24-hour format."}),E("div",{className:"grid grid-cols-12 gap-4 text-sm font-medium text-gray-500 uppercase tracking-wide RemoteFlows__WorkScheduleSelectionForm__Header",children:[F("div",{className:"col-span-2"}),F("div",{className:"col-span-3 text-center",children:"START"}),F("div",{className:"col-span-1 text-center"}),F("div",{className:"col-span-3 text-center",children:"END"}),F("div",{className:"col-span-2 text-center",children:"HOURS"})]}),F("div",{className:"RemoteFlows__WorkScheduleSelectionForm__Rows",children:u.map((f,_)=>{let k=s[_],b=Le(k);return E(No.Fragment,{children:[E("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Hours",children:[F("div",{className:"col-span-2 flex items-center gap-3",children:F(re,{label:f.day,name:`schedule.${_}.checked`})}),F("div",{className:"col-span-3",children:F(A,{name:`schedule.${_}.start_time`,includeErrorMessage:!1})}),F("div",{className:"col-span-1 text-center text-gray-500",children:"to"}),F("div",{className:"col-span-3",children:F(A,{name:`schedule.${_}.end_time`,includeErrorMessage:!1})}),F("div",{className:"col-span-2 text-center text-gray-600",children:isNaN(b)?"-":`${b} hours`})]}),E("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Break",children:[F("div",{className:"col-span-2 text-gray-500",children:"Break"}),F("div",{className:"col-span-2",children:F(A,{name:`schedule.${_}.break_duration_minutes`,includeErrorMessage:!1})}),F("div",{className:"col-span-2 text-gray-500",children:"minutes"}),F("div",{className:"col-span-4"})]})]},f.id)})})]}),Object.keys(c.errors).length>0&&F("p",{className:"text-destructive text-sm mb-0",children:"Invalid time format (HH:mm)"}),E("div",{className:"flex gap-4 pt-4",children:[F(B,{type:"button",className:"reset-button",variant:"outline",onClick:h,children:"Cancel"}),F(B,{type:"button",className:"submit-button",onClick:p(l),children:"Save Schedule"})]})]})})]})]})})}o($o,"WorkScheduleSelectionForm");function kt(e){let{components:t}=x(),{setValue:r,control:a,watch:i}=Io(),d=i(e.name),[p,g]=Pt(d),{workHoursSummary:v,breakSummary:n}=St(p),c=bt(p);wo(()=>{r(e.name,p)},[p,e.name,r]);function u(l){g(l)}o(u,"onSubmit");let s=e.component||t?.["work-schedule"];return s?F(C,{control:a,name:e.name,render:({field:l,fieldState:h})=>F(s,{field:{...l,onChange:o(f=>{l.onChange(f),e.onChange?.(f)},"onChange")},fieldState:h,fieldData:{...e,defaultFormattedValue:{workHoursSummary:v,breakSummary:n,totalWorkHours:c}}})}):E("div",{className:"flex flex-col gap-3 RemoteFlows__WorkScheduleField",children:[F("p",{className:"text-sm RemoteFlows__WorkScheduleField__Title",children:"Work hours"}),E("div",{className:"flex flex-col gap-1 RemoteFlows__WorkScheduleField__Summary",children:[F("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__WorkHours",dangerouslySetInnerHTML:{__html:v.join(", ")}}),F("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Break",children:n.join()}),E("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Total",children:["Total of ",F("span",{children:c})," hours per week"]}),F($o,{defaultSchedule:p,onSubmit:u})]})]})}o(kt,"WorkScheduleField");var ce={checkbox:re,text:A,email:ht,money:be,select:it,radio:Qe,number:be,file:Ke,fieldset:Ue,date:Ae,textarea:Ft,countries:gt,hidden:_t,"work-schedule":kt};import{useEffect as Ho}from"react";import{useFormContext as Eo}from"react-hook-form";import{Fragment as Bo,jsx as fe,jsxs as Ao}from"react/jsx-runtime";function Rt({name:e,value:t,description:r,statement:a}){let{setValue:i}=Eo();return Ho(()=>{i(e,t)},[]),fe("div",{children:a?Ao(Bo,{children:[fe("p",{className:`text-sm RemoteFlows__ForcedValue__Title__${e}`,dangerouslySetInnerHTML:{__html:a?.title}}),fe("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:a?.description}})]}):fe("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:r}})})}o(Rt,"ForcedValueField");import{Fragment as Go,jsx as j,jsxs as Nt}from"react/jsx-runtime";function Oo(e){return e.const!==void 0&&e.const===e.default&&e.inputType!=="checkbox"&&e.inputType!=="hidden"}o(Oo,"checkFieldHasForcedValue");var Mi=o(({fields:e,components:t})=>!e||e.length===0?null:j(Go,{children:e.map(r=>{if(r.isVisible===!1||r.deprecated)return null;if(Oo(r))return j(Rt,{name:r.name,description:r.description,value:r.const,statement:r.statement},r.name);if(r.Component){let{Component:i}=r;return j(i,{...r},r.name)}let a=ce[r.inputType];return r.inputType==="fieldset"?j(a,{...r,components:t}):a?Nt(zo,{children:[j(a,{...r,component:t&&t[r.inputType]}),r.statement?j(me,{...r.statement}):null]},r.name):Nt("p",{className:"error",children:["Field type ",r.inputType," not supported"]})})}),"JSONSchemaFormFields");export{Mi as a};
2
+ //# sourceMappingURL=chunk-3BIRQAED.js.map
@@ -1,2 +1,2 @@
1
- import{a as p}from"./chunk-2NLOH7NZ.js";import{b as l}from"./chunk-CFIJKJXD.js";import{a as f}from"./chunk-VNSF5IOL.js";import{c as u}from"./chunk-MH6KKP6K.js";import{b as F}from"./chunk-TVZAFTPT.js";import{a as r}from"./chunk-P37U34EQ.js";import{useEffect as P}from"react";import{useForm as R}from"react-hook-form";import{jsx as a}from"react/jsx-runtime";var w=["effective_date","reason_for_change","reason_for_change_description","additional_comments","additional_comments_toggle"];function x({onSubmit:_,onError:m,onSuccess:b}){let{formId:A,contractAmendment:{checkFieldUpdates:C,fields:s,onSubmit:h,stepState:S,initialValues:i,handleValidation:g}}=F(),y=l(g),e=R({resolver:y,defaultValues:S.values?.form||i,shouldUnregister:!0,mode:"onBlur"});P(()=>{let t=e?.watch(o=>{(Object.keys(e.formState.dirtyFields).length>0||e.formState.isDirty)&&C(o)});return()=>t?.unsubscribe()},[]);let V=r(async t=>{let o=!1;for(let[c,v]of Object.entries(t))if(!w.includes(c)&&i[c]!==v){o=!0;break}if(!o)return m?.({message:"no_changes_detected_contract_details"});let d=u(t,s,{isPartialValidation:!1});await _?.(d);let n=await h(t);n.error?m?.(n.error):await b?.(n.data)},"handleSubmit");return a(f,{...e,children:a("form",{id:A,"data-testid":"contract-amendment-form",onSubmit:e.handleSubmit(V),className:"space-y-4 RemoteFlows__ContractAmendmentForm",children:a(p,{fields:s})})})}r(x,"ContractAmendmentForm");export{x as a};
2
- //# sourceMappingURL=chunk-MA4IML3T.js.map
1
+ import{a as p}from"./chunk-3BIRQAED.js";import{b as l}from"./chunk-CFIJKJXD.js";import{a as f}from"./chunk-VNSF5IOL.js";import{c as u}from"./chunk-MH6KKP6K.js";import{b as F}from"./chunk-TVZAFTPT.js";import{a as r}from"./chunk-P37U34EQ.js";import{useEffect as P}from"react";import{useForm as R}from"react-hook-form";import{jsx as a}from"react/jsx-runtime";var w=["effective_date","reason_for_change","reason_for_change_description","additional_comments","additional_comments_toggle"];function x({onSubmit:_,onError:m,onSuccess:b}){let{formId:A,contractAmendment:{checkFieldUpdates:C,fields:s,onSubmit:h,stepState:S,initialValues:i,handleValidation:g}}=F(),y=l(g),e=R({resolver:y,defaultValues:S.values?.form||i,shouldUnregister:!0,mode:"onBlur"});P(()=>{let t=e?.watch(o=>{(Object.keys(e.formState.dirtyFields).length>0||e.formState.isDirty)&&C(o)});return()=>t?.unsubscribe()},[]);let V=r(async t=>{let o=!1;for(let[c,v]of Object.entries(t))if(!w.includes(c)&&i[c]!==v){o=!0;break}if(!o)return m?.({message:"no_changes_detected_contract_details"});let d=u(t,s,{isPartialValidation:!1});await _?.(d);let n=await h(t);n.error?m?.(n.error):await b?.(n.data)},"handleSubmit");return a(f,{...e,children:a("form",{id:A,"data-testid":"contract-amendment-form",onSubmit:e.handleSubmit(V),className:"space-y-4 RemoteFlows__ContractAmendmentForm",children:a(p,{fields:s})})})}r(x,"ContractAmendmentForm");export{x as a};
2
+ //# sourceMappingURL=chunk-3QGKRPQ6.js.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-DKJZB2TO.js";import{b as t}from"./chunk-PGWKJ6FK.js";import{b as e}from"./chunk-QW4JPW6J.js";import{a as i}from"./chunk-P37U34EQ.js";import{jsx as c}from"react/jsx-runtime";function S({onSubmit:m,onSuccess:d,onError:a}){let{onboardingBag:o}=t(),l=i(async n=>{try{await m?.(o.parseFormValues(n));let r=await o.onSubmit(n);if(r?.data){await d?.(r?.data),o?.next();return}if(r?.error){let p=e(r?.fieldErrors||[],o.meta?.fields?.basic_information);a?.({error:r?.error,rawError:r?.rawError,fieldErrors:p})}}catch(r){a?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit"),f=o.stepState.values?.basic_information||o.initialValues.basic_information;return c(s,{defaultValues:f,onSubmit:l})}i(S,"BasicInformationStep");export{S as a};
2
- //# sourceMappingURL=chunk-76CE6Z77.js.map
1
+ import{a as s}from"./chunk-63BYEK44.js";import{b as t}from"./chunk-PGWKJ6FK.js";import{b as e}from"./chunk-QW4JPW6J.js";import{a as i}from"./chunk-P37U34EQ.js";import{jsx as c}from"react/jsx-runtime";function S({onSubmit:m,onSuccess:d,onError:a}){let{onboardingBag:o}=t(),l=i(async n=>{try{await m?.(o.parseFormValues(n));let r=await o.onSubmit(n);if(r?.data){await d?.(r?.data),o?.next();return}if(r?.error){let p=e(r?.fieldErrors||[],o.meta?.fields?.basic_information);a?.({error:r?.error,rawError:r?.rawError,fieldErrors:p})}}catch(r){a?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit"),f=o.stepState.values?.basic_information||o.initialValues.basic_information;return c(s,{defaultValues:f,onSubmit:l})}i(S,"BasicInformationStep");export{S as a};
2
+ //# sourceMappingURL=chunk-3R33SVSF.js.map
@@ -1,2 +1,2 @@
1
- import{b as y}from"./chunk-PGWKJ6FK.js";import{b as u}from"./chunk-QW4JPW6J.js";import{a as F}from"./chunk-2NLOH7NZ.js";import{b as f}from"./chunk-CFIJKJXD.js";import{a as p}from"./chunk-VNSF5IOL.js";import{a as m}from"./chunk-P37U34EQ.js";import{useEffect as b}from"react";import{useForm as O}from"react-hook-form";import{jsx as d}from"react/jsx-runtime";function N({defaultValues:c,onSubmit:S,components:g}){let{formId:E,onboardingBag:o}=y(),w=f(o.handleValidation),r=O({resolver:w,defaultValues:c,shouldUnregister:!1,mode:"onBlur"});b(()=>{o.employmentId&&o?.checkFieldUpdates(r.getValues())},[]),b(()=>{let t=r?.watch(e=>{Object.keys(e).some(i=>e[i]!==c[i])&&o?.checkFieldUpdates(e)});return()=>t?.unsubscribe()},[]);let h=m(async(t,e)=>{let s=e?.nativeEvent;if(s?.isDraftSubmission){let{onSuccess:i,onError:l}=s.draftCallbacks;try{if(!await r.trigger())return;let n=await o.onSubmit(t);if(n?.data)i?.();else if(n?.error){let k=o.stepState.currentStep.name,B=o.meta?.fields?.[k],P=u(n?.fieldErrors||[],B);l?.({error:n.error,rawError:n.rawError,fieldErrors:P})}}catch(a){l?.({error:a,rawError:a,fieldErrors:[]})}}else S(t)},"handleSubmit");return d(p,{...r,children:d("form",{id:E,onSubmit:r.handleSubmit(h),className:"space-y-4 RemoteFlows__OnboardingForm",children:d(F,{components:g,fields:o.fields})})})}m(N,"OnboardingForm");export{N as a};
2
- //# sourceMappingURL=chunk-DKJZB2TO.js.map
1
+ import{b as y}from"./chunk-PGWKJ6FK.js";import{b as u}from"./chunk-QW4JPW6J.js";import{a as F}from"./chunk-3BIRQAED.js";import{b as f}from"./chunk-CFIJKJXD.js";import{a as p}from"./chunk-VNSF5IOL.js";import{a as m}from"./chunk-P37U34EQ.js";import{useEffect as b}from"react";import{useForm as O}from"react-hook-form";import{jsx as d}from"react/jsx-runtime";function N({defaultValues:c,onSubmit:S,components:g}){let{formId:E,onboardingBag:o}=y(),w=f(o.handleValidation),r=O({resolver:w,defaultValues:c,shouldUnregister:!1,mode:"onBlur"});b(()=>{o.employmentId&&o?.checkFieldUpdates(r.getValues())},[]),b(()=>{let t=r?.watch(e=>{Object.keys(e).some(i=>e[i]!==c[i])&&o?.checkFieldUpdates(e)});return()=>t?.unsubscribe()},[]);let h=m(async(t,e)=>{let s=e?.nativeEvent;if(s?.isDraftSubmission){let{onSuccess:i,onError:l}=s.draftCallbacks;try{if(!await r.trigger())return;let n=await o.onSubmit(t);if(n?.data)i?.();else if(n?.error){let k=o.stepState.currentStep.name,B=o.meta?.fields?.[k],P=u(n?.fieldErrors||[],B);l?.({error:n.error,rawError:n.rawError,fieldErrors:P})}}catch(a){l?.({error:a,rawError:a,fieldErrors:[]})}}else S(t)},"handleSubmit");return d(p,{...r,children:d("form",{id:E,onSubmit:r.handleSubmit(h),className:"space-y-4 RemoteFlows__OnboardingForm",children:d(F,{components:g,fields:o.fields})})})}m(N,"OnboardingForm");export{N as a};
2
+ //# sourceMappingURL=chunk-63BYEK44.js.map
@@ -0,0 +1,2 @@
1
+ import{a as k}from"./chunk-ARYI3WUN.js";import{a as L}from"./chunk-UPRUP24B.js";import{a as x,b as A,c as v,e as T}from"./chunk-Q23DM4O3.js";import{a as J}from"./chunk-CFIJKJXD.js";import{c as g}from"./chunk-MH6KKP6K.js";import{a as o}from"./chunk-P37U34EQ.js";import{object as le}from"yup";import{createHeadlessForm as oe,modify as ie}from"@remoteoss/json-schema-form";import{useMemo as ne,useState as P}from"react";import{string as q,ValidationError as G}from"yup";import{jsx as ae}from"react/jsx-runtime";var j={title:"Estimation",includeBenefits:!1,includeCostBreakdowns:!1,includePremiumBenefits:!1,enableCurrencyConversion:!1},se=o(t=>{let{schema:i}=ie(L.data.schema,t?.jsfModify||{});return oe(i)},"useStaticSchema"),Se=o(({defaultRegion:t,estimationOptions:i,options:a}={estimationOptions:j})=>{let[l,c]=P(t),[f,p]=P(),[M,H]=P(),{data:C,isLoading:I}=x({includePremiumBenefits:i.includePremiumBenefits}),{data:E,isLoading:N}=A(),z=l||f?.value,{data:S,isLoading:D}=T(z,{includePremiumBenefits:i.includePremiumBenefits,options:a}),B=v(),w=f?.currency,u=a?.jsfModify?.fields?.salary,y=u&&typeof u=="object"&&"presentation"in u?u.presentation:void 0,K=ne(()=>({fields:{salary:{...u,presentation:{salary_conversion_properties:{label:y?.salary_conversion_properties?.label,description:y?.salary_conversion_properties?.description},currencies:{from:w,to:M},Component:o(e=>ae(k,{...e}),"Component")}}}}),[w,M,u,y?.salary_conversion_properties?.description,y?.salary_conversion_properties?.label]),d=se({jsfModify:{fields:{...a?.jsfModify?.fields,...K?.fields}}});async function Q(e){try{await b.validate(e,{abortEarly:!1})}catch(r){return{data:null,error:r}}return new Promise((r,n)=>{B.mutate($(e,i),{onSuccess:o(s=>{s.data?r({data:s.data,error:null}):r({data:null,error:new Error("Something went wrong. Please try again later.")})},"onSuccess"),onError:o(s=>{n({data:null,error:s})},"onError")})})}o(Q,"onSubmit");function W(e){let r=C?.find(({value:n})=>n===e);r&&r.childRegions.length===0&&r.hasAdditionalFields?c(r.regionSlug):c(void 0),p(r)}o(W,"onCountryChange");function X(e){c(e)}o(X,"onRegionChange");function Y(e){let r=E?.find(n=>n.value===e)?.label;H(r)}o(Y,"onChangeCurrency");let m=d.fields.find(e=>e.name==="region");if(m){let e=f?.childRegions.map(r=>({value:r.slug,label:r.name}))??[];m.options=e,m.isVisible=e.length>0,m.required=e.length>0,m.onChange=X,m.schema=e.length>0?q().transform(r=>typeof r=="string"?r:"").required("Region is required"):q()}if(E){let e=d.fields.find(r=>r.name==="currency");e&&(e.options=E,e.onChange=Y)}if(C){let e=d.fields.find(r=>r.name==="country");e&&(e.options=C,e.onChange=W)}let Z=o(()=>{p(void 0),c(t)},"resetForm"),O=[...d.fields,...S?.fields||[]],b=U(d.fields);async function ee(e){let r=null,n=g(e,O);try{await b.validate(n,{abortEarly:!1}),r={formErrors:{},yupError:new G([],e)}}catch(F){let V=J(F);r={formErrors:Object.entries(V).reduce((R,[re,te])=>({...R,[re]:te.message}),{}),yupError:F}}let s=S?.handleValidation(n),h=[...r?.yupError.inner||[],...s?.yupError?.inner||[]],_={...r?.yupError?.value||{},...s?.yupError?.value||{}};return{formErrors:{...r?.formErrors||{},...s?.formErrors||{}},yupError:new G(h,_)}}return o(ee,"handleValidation"),{stepState:{current:0,total:1,isLastStep:!0},fields:O,validationSchema:b,parseFormValues:o(e=>{let{country:r,region:n,salary:s,currency:h,..._}=e,V=g({country:r,region:n,salary:s,currency:h},d.fields),R=g(_,S?.fields||[]);return{...V,...R}},"parseFormValues"),handleValidation:ee,isSubmitting:B.isPending,isLoading:I&&N&&D,onSubmit:Q,resetForm:Z}},"useCostCalculator");function U(t){let i=t.reduce((a,l)=>(a[l.name]=l.schema,a),{});return le(i)}o(U,"buildValidationSchema");function ce(t){let i="benefit-";return Object.keys(t).reduce((a,l)=>{let c=t[l];if(c==="none")return a;let p={benefit_group_slug:l.replace(i,""),benefit_tier_slug:c};return[...a,p]},[])}o(ce,"formatBenefits");function $(t,i=j){return{employer_currency_slug:t.currency,include_benefits:i.includeBenefits,include_cost_breakdowns:i.includeCostBreakdowns,include_premium_benefits:i.includePremiumBenefits,employments:[{region_slug:t.region||t.country,annual_gross_salary:t.salary,annual_gross_salary_in_employer_currency:t.salary,employment_term:t.contract_duration_type??"fixed",title:i.title,age:t.age??void 0,...t.benefits&&{benefits:ce(t.benefits)}}]}}o($,"buildPayload");export{U as a,$ as b,j as c,Se as d};
2
+ //# sourceMappingURL=chunk-7NBID3JL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/CostCalculator/utils.ts","../src/flows/CostCalculator/hooks.tsx"],"sourcesContent":["import type { CostCalculatorEstimateParams } from '@/src/client';\n\nimport { $TSFixMe } from '@/src/types/remoteFlows';\nimport { AnyObjectSchema, object } from 'yup';\nimport { defaultEstimationOptions } from './hooks';\nimport type {\n CostCalculatorEstimationOptions,\n CostCalculatorEstimationSubmitValues,\n} from './types';\n\n/**\n * Build the validation schema for the form.\n * @returns\n */\nexport function buildValidationSchema(fields: $TSFixMe[]) {\n const fieldsSchema = fields.reduce<Record<string, AnyObjectSchema>>(\n (fieldsSchemaAcc, field) => {\n fieldsSchemaAcc[field.name] = field.schema as AnyObjectSchema;\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\n/**\n * Build the payload for the cost calculator estimation.\n * @param values\n * @param estimationOptions\n * @returns\n */\nexport function buildPayload(\n values: CostCalculatorEstimationSubmitValues,\n estimationOptions: CostCalculatorEstimationOptions = defaultEstimationOptions,\n): CostCalculatorEstimateParams {\n return {\n employer_currency_slug: values.currency,\n include_benefits: estimationOptions.includeBenefits,\n include_cost_breakdowns: estimationOptions.includeCostBreakdowns,\n include_premium_benefits: estimationOptions.includePremiumBenefits,\n employments: [\n {\n region_slug: values.region || values.country,\n annual_gross_salary: values.salary,\n annual_gross_salary_in_employer_currency: values.salary,\n employment_term: values.contract_duration_type ?? 'fixed',\n title: estimationOptions.title,\n age: values.age ?? undefined,\n ...(values.benefits && { benefits: formatBenefits(values.benefits) }),\n },\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} 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 { 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 { JSFField } from '@/src/types/remoteFlows';\nimport { SalaryField } from '@/src/flows/CostCalculator/components/SalaryField';\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};\n\ntype UseCostCalculatorParams = {\n /**\n * The default region slug to preselect a country and a region.\n */\n defaultRegion?: string;\n /**\n * The estimation options.\n */\n estimationOptions: CostCalculatorEstimationOptions;\n options?: {\n jsfModify?: JSFModify;\n };\n};\n\nexport type EstimationError = PostCreateEstimationError | ValidationError;\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\n/**\n * Hook to use the cost calculator.\n */\nexport const useCostCalculator = (\n { defaultRegion, estimationOptions, options }: 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 { 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 customFields = useMemo(() => {\n return {\n fields: {\n salary: {\n ...salaryField,\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: {\n from: employeeBillingCurrency,\n to: employerBillingCurrency,\n },\n Component: (\n props: JSFField & { currencies: { from: string; to: string } },\n ) => {\n return <SalaryField {...props} />;\n },\n },\n },\n },\n };\n }, [\n employeeBillingCurrency,\n employerBillingCurrency,\n salaryField,\n salaryFieldPresentation?.salary_conversion_properties?.description,\n salaryFieldPresentation?.salary_conversion_properties?.label,\n ]);\n\n const fieldsJSONSchema = useStaticSchema({\n jsfModify: {\n fields: {\n ...options?.jsfModify?.fields,\n ...customFields?.fields,\n },\n },\n });\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),\n {\n onSuccess: (response) => {\n if (response.data) {\n resolve({\n data: response.data,\n error: null,\n });\n } else {\n resolve({\n data: null,\n error: new Error(\n 'Something went wrong. Please try again later.',\n ),\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 onChangeCurrency(currency: string) {\n const selectedCurrency = currencies?.find(\n (c) => c.value === currency,\n )?.label;\n setEmployerBillingCurrency(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 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,\n ...(jsonSchemaRegionFields?.fields || []),\n ];\n\n const validationSchema = buildValidationSchema(fieldsJSONSchema.fields);\n\n async function handleValidation(values: CostCalculatorEstimationFormValues) {\n let errors: JSFValidationError | null = null;\n\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 stepState: {\n current: 0,\n total: 1,\n isLastStep: true,\n },\n fields: allFields,\n validationSchema,\n parseFormValues: (\n values: CostCalculatorEstimationFormValues,\n ): CostCalculatorEstimationSubmitValues => {\n const { country, region, salary, currency, ...rest } = values;\n const jsonSchemaStaticFieldValues = {\n country,\n region,\n salary,\n currency,\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 handleValidation,\n isSubmitting: costCalculatorEstimationMutation.isPending,\n isLoading:\n isLoadingCountries && isLoadingCurrencies && isLoadingRegionFields,\n onSubmit,\n resetForm,\n };\n};\n"],"mappings":"qQAGA,OAA0B,UAAAA,OAAc,MCYxC,OAAS,sBAAAC,GAAoB,UAAAC,OAAc,8BAC3C,OAAS,WAAAC,GAAS,YAAAC,MAAgB,QAClC,OAAS,UAAAC,EAAQ,mBAAAC,MAAuB,MAsInB,cAAAC,OAAA,oBAvGd,IAAMC,EAA4D,CACvE,MAAO,aACP,gBAAiB,GACjB,sBAAuB,GACvB,uBAAwB,GACxB,yBAA0B,EAC5B,EAkBMC,GAAkBC,EAACC,GAAwC,CAC/D,GAAM,CAAE,OAAQC,CAAmB,EAAIC,GACrCC,EAAW,KAAK,OAChBH,GAAS,WAAa,CAAC,CACzB,EAEA,OAAOI,GAAmBH,CAAkB,CAC9C,EAPwB,mBAYXI,GAAoBN,EAAA,CAC/B,CAAE,cAAAO,EAAe,kBAAAC,EAAmB,QAAAP,CAAQ,EAA6B,CACvE,kBAAmBH,CACrB,IACG,CACH,GAAM,CAACW,EAAgBC,CAAiB,EAAIC,EAC1CJ,CACF,EACM,CAACK,EAAiBC,CAAkB,EACxCF,EAAgC,EAC5B,CAACG,EAAyBC,CAA0B,EAAIJ,EAE5D,EACI,CAAE,KAAMK,EAAW,UAAWC,CAAmB,EACrDC,EAA2B,CACzB,uBAAwBV,EAAkB,sBAC5C,CAAC,EACG,CAAE,KAAMW,EAAY,UAAWC,CAAoB,EACvDC,EAAqB,EAEjBC,EAAuBb,GAAkBG,GAAiB,MAE1D,CAAE,KAAMW,EAAwB,UAAWC,CAAsB,EACrEC,EAAgBH,EAAsB,CACpC,uBAAwBd,EAAkB,uBAC1C,QAAAP,CACF,CAAC,EACGyB,EAAmCC,EAA4B,EAC/DC,EAA0BhB,GAAiB,SAE3CiB,EAAc5B,GAAS,WAAW,QAAQ,OAC1C6B,EACJD,GACA,OAAOA,GAAgB,UACvB,iBAAkBA,EAEZA,EAQA,aACF,OAEAE,EAAeC,GAAQ,KACpB,CACL,OAAQ,CACN,OAAQ,CACN,GAAGH,EACH,aAAc,CACZ,6BAA8B,CAC5B,MACEC,GAAyB,8BAA8B,MACzD,YACEA,GAAyB,8BACrB,WACR,EACA,WAAY,CACV,KAAMF,EACN,GAAId,CACN,EACA,UAAWd,EACTiC,GAEOpC,GAACqC,EAAA,CAAa,GAAGD,EAAO,EAHtB,YAKb,CACF,CACF,CACF,GACC,CACDL,EACAd,EACAe,EACAC,GAAyB,8BAA8B,YACvDA,GAAyB,8BAA8B,KACzD,CAAC,EAEKK,EAAmBpC,GAAgB,CACvC,UAAW,CACT,OAAQ,CACN,GAAGE,GAAS,WAAW,OACvB,GAAG8B,GAAc,MACnB,CACF,CACF,CAAC,EAMD,eAAeK,EACbC,EACkE,CAClE,GAAI,CACF,MAAMC,EAAiB,SAASD,EAAQ,CAAE,WAAY,EAAM,CAAC,CAC/D,OAASE,EAAK,CACZ,MAAO,CACL,KAAM,KACN,MAAOA,CACT,CACF,CAEA,OAAO,IAAI,QAAQ,CAACC,EAASC,IAAW,CACtCf,EAAiC,OAC/BgB,EAAaL,EAAQ7B,CAAiB,EACtC,CACE,UAAWR,EAAC2C,GAAa,CACnBA,EAAS,KACXH,EAAQ,CACN,KAAMG,EAAS,KACf,MAAO,IACT,CAAC,EAEDH,EAAQ,CACN,KAAM,KACN,MAAO,IAAI,MACT,+CACF,CACF,CAAC,CAEL,EAdW,aAeX,QAASxC,EAAC4C,GAAU,CAClBH,EAAO,CACL,KAAM,KACN,MAAOG,CACT,CAAC,CACH,EALS,UAMX,CACF,CACF,CAAC,CACH,CAxCe5C,EAAAoC,EAAA,YA+Cf,SAASS,EAAgBC,EAAiB,CACxC,IAAMC,EAAiB/B,GAAW,KAAK,CAAC,CAAE,MAAAgC,CAAM,IAAMA,IAAUF,CAAO,EAGrEC,GACAA,EAAe,aAAa,SAAW,GACvCA,EAAe,oBAEfrC,EAAkBqC,EAAe,UAAU,EAE3CrC,EAAkB,MAAS,EAE7BG,EAAmBkC,CAAc,CACnC,CAbS/C,EAAA6C,EAAA,mBAmBT,SAASI,EAAeC,EAAgB,CACtCxC,EAAkBwC,CAAM,CAC1B,CAFSlD,EAAAiD,EAAA,kBAIT,SAASE,EAAiBC,EAAkB,CAC1C,IAAMC,EAAmBlC,GAAY,KAClCmC,GAAMA,EAAE,QAAUF,CACrB,GAAG,MACHrC,EAA2BsC,CAAgB,CAC7C,CALSrD,EAAAmD,EAAA,oBAOT,IAAMI,EAAcpB,EAAiB,OAAO,KACzCqB,GAAUA,EAAM,OAAS,QAC5B,EAEA,GAAID,EAAa,CACf,IAAME,EACJ7C,GAAiB,aAAa,IAAKsC,IAAY,CAC7C,MAAOA,EAAO,KACd,MAAOA,EAAO,IAChB,EAAE,GAAK,CAAC,EACVK,EAAY,QAAUE,EACtBF,EAAY,UAAYE,EAAQ,OAAS,EACzCF,EAAY,SAAWE,EAAQ,OAAS,EACxCF,EAAY,SAAWN,EACvBM,EAAY,OACVE,EAAQ,OAAS,EACbC,EAAO,EACJ,UAAWV,GAAW,OAAOA,GAAU,SAAWA,EAAQ,EAAG,EAC7D,SAAS,oBAAoB,EAChCU,EAAO,CACf,CAEA,GAAIvC,EAAY,CACd,IAAMwC,EAAgBxB,EAAiB,OAAO,KAC3CqB,GAAUA,EAAM,OAAS,UAC5B,EACIG,IACFA,EAAc,QAAUxC,EACxBwC,EAAc,SAAWR,EAE7B,CAEA,GAAInC,EAAW,CACb,IAAM4C,EAAezB,EAAiB,OAAO,KAC1CqB,GAAUA,EAAM,OAAS,SAC5B,EACII,IACFA,EAAa,QAAU5C,EACvB4C,EAAa,SAAWf,EAE5B,CAEA,IAAMgB,EAAY7D,EAAA,IAAM,CACtBa,EAAmB,MAAS,EAC5BH,EAAkBH,CAAa,CACjC,EAHkB,aAKZuD,EAAY,CAChB,GAAG3B,EAAiB,OACpB,GAAIZ,GAAwB,QAAU,CAAC,CACzC,EAEMe,EAAmByB,EAAsB5B,EAAiB,MAAM,EAEtE,eAAe6B,GAAiB3B,EAA4C,CAC1E,IAAI4B,EAAoC,KAElCC,EAAeC,EAAmB9B,EAAQyB,CAAS,EAGzD,GAAI,CACF,MAAMxB,EAAiB,SAAS4B,EAAc,CAC5C,WAAY,EACd,CAAC,EACDD,EAAS,CACP,WAAY,CAAC,EACb,SAAU,IAAIG,EAAgB,CAAC,EAAG/B,CAAM,CAC1C,CACF,OAASO,EAAO,CACd,IAAMyB,EAAgBC,EAAc1B,CAAwB,EAE5DqB,EAAS,CAEP,WAAY,OAAO,QAAQI,CAAa,EAAE,OACxC,CAACE,EAAK,CAACC,GAAKxB,EAAK,KAAO,CAAE,GAAGuB,EAAK,CAACC,EAAG,EAAGxB,GAAM,OAAQ,GACvD,CAAC,CACH,EACA,SAAUJ,CACZ,CACF,CAGA,IAAM6B,EACJlD,GAAwB,iBAAiB2C,CAAY,EAGjDQ,EAAsB,CAC1B,GAAIT,GAAQ,SAAS,OAAS,CAAC,EAC/B,GAAIQ,GAAwB,UAAU,OAAS,CAAC,CAClD,EACME,EAAiB,CACrB,GAAIV,GAAQ,UAAU,OAAS,CAAC,EAChC,GAAIQ,GAAwB,UAAU,OAAS,CAAC,CAClD,EAEA,MAAO,CACL,WAAY,CACV,GAAIR,GAAQ,YAAc,CAAC,EAC3B,GAAIQ,GAAwB,YAAc,CAAC,CAC7C,EACA,SAAU,IAAIL,EAAgBM,EAAqBC,CAAc,CACnE,CACF,CAhDe,OAAA3E,EAAAgE,GAAA,oBAkDR,CACL,UAAW,CACT,QAAS,EACT,MAAO,EACP,WAAY,EACd,EACA,OAAQF,EACR,iBAAAxB,EACA,gBAAiBtC,EACfqC,GACyC,CACzC,GAAM,CAAE,QAAAS,EAAS,OAAAI,EAAQ,OAAA0B,EAAQ,SAAAxB,EAAU,GAAGyB,CAAK,EAAIxC,EAOjDyC,EAAqBX,EANS,CAClC,QAAArB,EACA,OAAAI,EACA,OAAA0B,EACA,SAAAxB,CACF,EAGEjB,EAAiB,MACnB,EAEM4C,EAAqBZ,EACzBU,EACAtD,GAAwB,QAAU,CAAC,CACrC,EAEA,MAAO,CACL,GAAGuD,EACH,GAAGC,CACL,CACF,EAxBiB,mBAyBjB,iBAAAf,GACA,aAActC,EAAiC,UAC/C,UACET,GAAsBG,GAAuBI,EAC/C,SAAAY,EACA,UAAAyB,CACF,CACF,EA3TiC,qBDtE1B,SAASmB,EAAsBC,EAAoB,CACxD,IAAMC,EAAeD,EAAO,OAC1B,CAACE,EAAiBC,KAChBD,EAAgBC,EAAM,IAAI,EAAIA,EAAM,OAC7BD,GAET,CAAC,CACH,EACA,OAAOE,GAAOH,CAAY,CAC5B,CATgBI,EAAAN,EAAA,yBAgBhB,SAASO,GAAeC,EAAkC,CACxD,IAAMC,EAAS,WACf,OAAO,OAAO,KAAKD,CAAQ,EAAE,OAE3B,CAACE,EAAKC,IAAQ,CACd,IAAMC,EAAkBJ,EAASG,CAAG,EACpC,GAAIC,IAAoB,OACtB,OAAOF,EAGT,IAAMG,EAAe,CACnB,mBAFuBF,EAAI,QAAQF,EAAQ,EAAE,EAG7C,kBAAmBG,CACrB,EACA,MAAO,CAAC,GAAGF,EAAKG,CAAY,CAC9B,EAAG,CAAC,CAAC,CACP,CAhBSP,EAAAC,GAAA,kBAwBF,SAASO,EACdC,EACAC,EAAqDC,EACvB,CAC9B,MAAO,CACL,uBAAwBF,EAAO,SAC/B,iBAAkBC,EAAkB,gBACpC,wBAAyBA,EAAkB,sBAC3C,yBAA0BA,EAAkB,uBAC5C,YAAa,CACX,CACE,YAAaD,EAAO,QAAUA,EAAO,QACrC,oBAAqBA,EAAO,OAC5B,yCAA0CA,EAAO,OACjD,gBAAiBA,EAAO,wBAA0B,QAClD,MAAOC,EAAkB,MACzB,IAAKD,EAAO,KAAO,OACnB,GAAIA,EAAO,UAAY,CAAE,SAAUR,GAAeQ,EAAO,QAAQ,CAAE,CACrE,CACF,CACF,CACF,CArBgBT,EAAAQ,EAAA","names":["object","createHeadlessForm","modify","useMemo","useState","string","ValidationError","jsx","defaultEstimationOptions","useStaticSchema","__name","options","jsonSchemaModified","modify","jsonSchema","createHeadlessForm","useCostCalculator","defaultRegion","estimationOptions","selectedRegion","setSelectedRegion","useState","selectedCountry","setSelectedCountry","employerBillingCurrency","setEmployerBillingCurrency","countries","isLoadingCountries","useCostCalculatorCountries","currencies","isLoadingCurrencies","useCompanyCurrencies","jsonSchemaRegionSlug","jsonSchemaRegionFields","isLoadingRegionFields","useRegionFields","costCalculatorEstimationMutation","useCostCalculatorEstimation","employeeBillingCurrency","salaryField","salaryFieldPresentation","customFields","useMemo","props","SalaryField","fieldsJSONSchema","onSubmit","values","validationSchema","err","resolve","reject","buildPayload","response","error","onCountryChange","country","currentCountry","value","onRegionChange","region","onChangeCurrency","currency","selectedCurrency","c","regionField","field","regions","string","currencyField","countryField","resetForm","allFields","buildValidationSchema","handleValidation","errors","parsedValues","parseJSFToValidate","ValidationError","iterateResult","iterateErrors","acc","key","handleValidationResult","combinedInnerErrors","combinedValues","salary","rest","parsedStaticFields","parsedRegionFields","buildValidationSchema","fields","fieldsSchema","fieldsSchemaAcc","field","object","__name","formatBenefits","benefits","needle","acc","key","benefitTierSlug","benefitEntry","buildPayload","values","estimationOptions","defaultEstimationOptions"]}
@@ -1,2 +1,2 @@
1
- import{a as e}from"./chunk-G3OSPYB5.js";import{a as r}from"./chunk-P37U34EQ.js";import{jsx as l}from"react/jsx-runtime";var t=r(({currencies:{from:o,to:i},salary_conversion_properties:s,...n})=>l(e,{...n,sourceCurrency:o,targetCurrency:i,conversionFieldName:"salary_conversion",conversionProperties:s,classNamePrefix:"RemoteFlows-Salary"}),"SalaryField");export{t as a};
2
- //# sourceMappingURL=chunk-LZ3R4ZK2.js.map
1
+ import{a as e}from"./chunk-XMDNHTKE.js";import{a as r}from"./chunk-P37U34EQ.js";import{jsx as l}from"react/jsx-runtime";var t=r(({currencies:{from:o,to:i},salary_conversion_properties:s,...n})=>l(e,{...n,sourceCurrency:o,targetCurrency:i,conversionFieldName:"salary_conversion",conversionProperties:s,classNamePrefix:"RemoteFlows-Salary"}),"SalaryField");export{t as a};
2
+ //# sourceMappingURL=chunk-ARYI3WUN.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-DKJZB2TO.js";import{b as i}from"./chunk-PGWKJ6FK.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as d}from"react/jsx-runtime";function y({onSubmit:s,onSuccess:c,onError:t}){let{onboardingBag:o}=i(),u=e(async n=>{try{await s?.({countryCode:n.country});let r=await o.onSubmit(n);if(r?.data){await c?.(r?.data),o?.next();return}r?.error&&t?.({error:r.error,rawError:r.rawError,fieldErrors:[]})}catch(r){t?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit"),l=o.stepState.values?.select_country||o.initialValues.select_country;return d(a,{defaultValues:l,onSubmit:u})}e(y,"SelectCountryStep");export{y as a};
2
- //# sourceMappingURL=chunk-T6LHPVKN.js.map
1
+ import{a}from"./chunk-63BYEK44.js";import{b as i}from"./chunk-PGWKJ6FK.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as d}from"react/jsx-runtime";function y({onSubmit:s,onSuccess:c,onError:t}){let{onboardingBag:o}=i(),u=e(async n=>{try{await s?.({countryCode:n.country});let r=await o.onSubmit(n);if(r?.data){await c?.(r?.data),o?.next();return}r?.error&&t?.({error:r.error,rawError:r.rawError,fieldErrors:[]})}catch(r){t?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit"),l=o.stepState.values?.select_country||o.initialValues.select_country;return d(a,{defaultValues:l,onSubmit:u})}e(y,"SelectCountryStep");export{y as a};
2
+ //# sourceMappingURL=chunk-CEIK7DGY.js.map
@@ -1,2 +1,2 @@
1
- import{b as i}from"./chunk-KSHK3ZPX.js";import{a as e}from"./chunk-2NLOH7NZ.js";import{a as l}from"./chunk-VNSF5IOL.js";import{a as r}from"./chunk-P37U34EQ.js";import{jsx as s}from"react/jsx-runtime";function b({onSubmit:u,onError:c,onSuccess:C,shouldResetForm:n}){let{form:a,formId:d,costCalculatorBag:o}=i(),f=r(async p=>{let m=o?.parseFormValues(p),t=await o?.onSubmit(m);await u?.(m),t?.error?c?.(t.error):t?.data&&(await C?.(t?.data),n&&(o?.resetForm(),a.reset()))},"handleSubmit");return s(l,{...a,children:s("form",{id:d,onSubmit:a.handleSubmit(f),className:"space-y-4 RemoteFlows__CostCalculatorForm",children:s(e,{fields:o?.fields??[]})})})}r(b,"CostCalculatorForm");export{b as a};
2
- //# sourceMappingURL=chunk-Y56L3QKM.js.map
1
+ import{b as i}from"./chunk-KSHK3ZPX.js";import{a as e}from"./chunk-3BIRQAED.js";import{a as l}from"./chunk-VNSF5IOL.js";import{a as r}from"./chunk-P37U34EQ.js";import{jsx as s}from"react/jsx-runtime";function b({onSubmit:u,onError:c,onSuccess:C,shouldResetForm:n}){let{form:a,formId:d,costCalculatorBag:o}=i(),f=r(async p=>{let m=o?.parseFormValues(p),t=await o?.onSubmit(m);await u?.(m),t?.error?c?.(t.error):t?.data&&(await C?.(t?.data),n&&(o?.resetForm(),a.reset()))},"handleSubmit");return s(l,{...a,children:s("form",{id:d,onSubmit:a.handleSubmit(f),className:"space-y-4 RemoteFlows__CostCalculatorForm",children:s(e,{fields:o?.fields??[]})})})}r(b,"CostCalculatorForm");export{b as a};
2
+ //# sourceMappingURL=chunk-DOLJU76M.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-RXK4RLF6.js";import{a as c}from"./chunk-AIEAUPO6.js";import{a as e}from"./chunk-CTTXXEWI.js";import{a as m}from"./chunk-CSU6IQX3.js";import{a as r}from"./chunk-MA4IML3T.js";import{a as o}from"./chunk-TVZAFTPT.js";import{a as n}from"./chunk-P37U34EQ.js";import{useId as f}from"react";import{jsx as s}from"react/jsx-runtime";function k({employmentId:d,countryCode:C,options:p,render:A}){let t=c({employmentId:d,countryCode:C,options:p}),i=f();return s(o.Provider,{value:{formId:i,contractAmendmentBag:t},children:A({contractAmendmentBag:t,components:{Form:r,SubmitButton:a,ConfirmationForm:m,BackButton:e}})})}n(k,"ContractAmendmentFlow");export{k as a};
2
- //# sourceMappingURL=chunk-FJ2XPRKU.js.map
1
+ import{a}from"./chunk-RXK4RLF6.js";import{a as c}from"./chunk-AIEAUPO6.js";import{a as e}from"./chunk-CTTXXEWI.js";import{a as m}from"./chunk-CSU6IQX3.js";import{a as r}from"./chunk-3QGKRPQ6.js";import{a as o}from"./chunk-TVZAFTPT.js";import{a as n}from"./chunk-P37U34EQ.js";import{useId as f}from"react";import{jsx as s}from"react/jsx-runtime";function k({employmentId:d,countryCode:C,options:p,render:A}){let t=c({employmentId:d,countryCode:C,options:p}),i=f();return s(o.Provider,{value:{formId:i,contractAmendmentBag:t},children:A({contractAmendmentBag:t,components:{Form:r,SubmitButton:a,ConfirmationForm:m,BackButton:e}})})}n(k,"ContractAmendmentFlow");export{k as a};
2
+ //# sourceMappingURL=chunk-EPLIVM3Y.js.map
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-LLIGZSYY.js";import{a as n}from"./chunk-JXCJLQRA.js";import{a as e}from"./chunk-WASEFJAE.js";import{a as T}from"./chunk-26PHG6H2.js";import{a}from"./chunk-X3YONWNH.js";import{a as f}from"./chunk-RDLTU3FE.js";import{a as r}from"./chunk-BF7QENCN.js";import{a as p}from"./chunk-ZUNKCQBT.js";import{a as t}from"./chunk-MRYRNB7Y.js";import{a as i}from"./chunk-P37U34EQ.js";import{useId as c}from"react";import{jsx as u}from"react/jsx-runtime";var A=i(({employmentId:d,render:s,options:l})=>{let y=c(),o=e({employmentId:d,options:l});return u(t.Provider,{value:{formId:y,terminationBag:o},children:s({terminationBag:o,components:{SubmitButton:m,TimeOff:n,Back:r,EmployeeComunicationStep:a,TerminationDetailsStep:p,PaidTimeOffStep:f,AdditionalDetailsStep:T}})})},"TerminationFlow");export{A as a};
2
- //# sourceMappingURL=chunk-MYGO6KUI.js.map
1
+ import{a as m}from"./chunk-LLIGZSYY.js";import{a as n}from"./chunk-JXCJLQRA.js";import{a as e}from"./chunk-WASEFJAE.js";import{a as T}from"./chunk-LFIQVLFK.js";import{a}from"./chunk-TNF6DNGM.js";import{a as f}from"./chunk-FCHRSRS6.js";import{a as r}from"./chunk-BF7QENCN.js";import{a as p}from"./chunk-O53436KO.js";import{a as t}from"./chunk-MRYRNB7Y.js";import{a as i}from"./chunk-P37U34EQ.js";import{useId as c}from"react";import{jsx as u}from"react/jsx-runtime";var A=i(({employmentId:d,render:s,options:l})=>{let y=c(),o=e({employmentId:d,options:l});return u(t.Provider,{value:{formId:y,terminationBag:o},children:s({terminationBag:o,components:{SubmitButton:m,TimeOff:n,Back:r,EmployeeComunicationStep:a,TerminationDetailsStep:p,PaidTimeOffStep:f,AdditionalDetailsStep:T}})})},"TerminationFlow");export{A as a};
2
+ //# sourceMappingURL=chunk-ETMTVNOU.js.map
@@ -1,2 +1,2 @@
1
- import{a as r}from"./chunk-6SWZH7KI.js";import{b as m}from"./chunk-MRYRNB7Y.js";import{a as o}from"./chunk-P37U34EQ.js";import{jsx as e}from"react/jsx-runtime";function f({onSubmit:n}){let{terminationBag:i}=m();return e(r,{onSubmit:o(async a=>{await n?.(i?.parseFormValues(a)),i?.next()},"handleSubmit")})}o(f,"PaidTimeOffForm");export{f as a};
2
- //# sourceMappingURL=chunk-RDLTU3FE.js.map
1
+ import{a as r}from"./chunk-SIC7BRJ2.js";import{b as m}from"./chunk-MRYRNB7Y.js";import{a as o}from"./chunk-P37U34EQ.js";import{jsx as e}from"react/jsx-runtime";function f({onSubmit:n}){let{terminationBag:i}=m();return e(r,{onSubmit:o(async a=>{await n?.(i?.parseFormValues(a)),i?.next()},"handleSubmit")})}o(f,"PaidTimeOffForm");export{f as a};
2
+ //# sourceMappingURL=chunk-FCHRSRS6.js.map
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-DKJZB2TO.js";import{b as a}from"./chunk-PGWKJ6FK.js";import{b as t}from"./chunk-QW4JPW6J.js";import{d as s}from"./chunk-MH6KKP6K.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as E}from"react/jsx-runtime";function P({components:d,onSubmit:l,onError:i,onSuccess:f}){let{onboardingBag:o}=a(),p=o.fields??[],c=s(p,o.initialValues.benefits);return E(m,{defaultValues:c,components:d,onSubmit:e(async n=>{try{await l?.(n);let r=await o.onSubmit(n);if(r?.data){await f?.(r.data),o?.next();return}if(r?.error){let u=t(r?.fieldErrors||[],o.meta?.fields?.benefits);i?.({error:r.error,rawError:r.rawError,fieldErrors:u})}}catch(r){i?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit")})}e(P,"BenefitsStep");export{P as a};
2
- //# sourceMappingURL=chunk-U6PYTUGP.js.map
1
+ import{a as m}from"./chunk-63BYEK44.js";import{b as a}from"./chunk-PGWKJ6FK.js";import{b as t}from"./chunk-QW4JPW6J.js";import{d as s}from"./chunk-MH6KKP6K.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as E}from"react/jsx-runtime";function P({components:d,onSubmit:l,onError:i,onSuccess:f}){let{onboardingBag:o}=a(),p=o.fields??[],c=s(p,o.initialValues.benefits);return E(m,{defaultValues:c,components:d,onSubmit:e(async n=>{try{await l?.(n);let r=await o.onSubmit(n);if(r?.data){await f?.(r.data),o?.next();return}if(r?.error){let u=t(r?.fieldErrors||[],o.meta?.fields?.benefits);i?.({error:r.error,rawError:r.rawError,fieldErrors:u})}}catch(r){i?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit")})}e(P,"BenefitsStep");export{P as a};
2
+ //# sourceMappingURL=chunk-ISOKYXYN.js.map
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-6SWZH7KI.js";import{b as a}from"./chunk-MRYRNB7Y.js";import{a as i}from"./chunk-P37U34EQ.js";import{jsx as p}from"react/jsx-runtime";function F({requesterName:n,onSubmit:s,onSuccess:m,onError:d}){let{terminationBag:e}=a(),l=i(async o=>{await s?.(e?.parseFormValues(o));let r=await e?.onSubmit(o);r?.error?d?.(r.error):r?.data&&await m?.(r.data)},"handleSubmit"),u=e?.fields.map(o=>o.name==="acknowledge_termination_procedure"?{...o,label:o.label.replace("{{requesterName}}",n)}:o);return p(t,{fields:u,onSubmit:l})}i(F,"AdditionalDetailsForm");export{F as a};
2
- //# sourceMappingURL=chunk-26PHG6H2.js.map
1
+ import{a as t}from"./chunk-SIC7BRJ2.js";import{b as a}from"./chunk-MRYRNB7Y.js";import{a as i}from"./chunk-P37U34EQ.js";import{jsx as p}from"react/jsx-runtime";function F({requesterName:n,onSubmit:s,onSuccess:m,onError:d}){let{terminationBag:e}=a(),l=i(async o=>{await s?.(e?.parseFormValues(o));let r=await e?.onSubmit(o);r?.error?d?.(r.error):r?.data&&await m?.(r.data)},"handleSubmit"),u=e?.fields.map(o=>o.name==="acknowledge_termination_procedure"?{...o,label:o.label.replace("{{requesterName}}",n)}:o);return p(t,{fields:u,onSubmit:l})}i(F,"AdditionalDetailsForm");export{F as a};
2
+ //# sourceMappingURL=chunk-LFIQVLFK.js.map
@@ -1,2 +1,2 @@
1
- import{a as l}from"./chunk-KSHK3ZPX.js";import{c as s,d as e}from"./chunk-IXINXLDO.js";import{b as a}from"./chunk-CFIJKJXD.js";import{a as r}from"./chunk-P37U34EQ.js";import{useId as g}from"react";import{useForm as p}from"react-hook-form";import{jsx as y}from"react/jsx-runtime";var P=r(({estimationOptions:n=s,defaultValues:o={countryRegionSlug:"",currencySlug:"",salary:""},options:i,render:u})=>{let c=g(),t=e({defaultRegion:o.countryRegionSlug,estimationOptions:n,options:i}),m=a(t.handleValidation),C=p({resolver:m,defaultValues:{country:o?.countryRegionSlug,currency:o?.currencySlug,region:"",salary:o?.salary},shouldUnregister:!1,mode:"onBlur"});return y(l.Provider,{value:{form:C,formId:c,costCalculatorBag:t},children:u(t)})},"CostCalculatorFlow");export{P as a};
2
- //# sourceMappingURL=chunk-FF6SE4JF.js.map
1
+ import{a as l}from"./chunk-KSHK3ZPX.js";import{c as s,d as e}from"./chunk-7NBID3JL.js";import{b as a}from"./chunk-CFIJKJXD.js";import{a as r}from"./chunk-P37U34EQ.js";import{useId as g}from"react";import{useForm as p}from"react-hook-form";import{jsx as y}from"react/jsx-runtime";var P=r(({estimationOptions:n=s,defaultValues:o={countryRegionSlug:"",currencySlug:"",salary:""},options:i,render:u})=>{let c=g(),t=e({defaultRegion:o.countryRegionSlug,estimationOptions:n,options:i}),m=a(t.handleValidation),C=p({resolver:m,defaultValues:{country:o?.countryRegionSlug,currency:o?.currencySlug,region:"",salary:o?.salary},shouldUnregister:!1,mode:"onBlur"});return y(l.Provider,{value:{form:C,formId:c,costCalculatorBag:t},children:u(t)})},"CostCalculatorFlow");export{P as a};
2
+ //# sourceMappingURL=chunk-LFLO2IJA.js.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-DKJZB2TO.js";import{b as n}from"./chunk-PGWKJ6FK.js";import{b as i}from"./chunk-QW4JPW6J.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as p}from"react/jsx-runtime";function F({onSubmit:l,onError:t,onSuccess:d}){let{onboardingBag:o}=n(),m=e(async a=>{try{await l?.(o.parseFormValues(a));let r=await o.onSubmit(a);if(r?.data){await d?.(r.data),o?.next();return}if(r?.error){let c=i(r?.fieldErrors||[],o.meta?.fields?.contract_details);t?.({error:r.error,rawError:r.rawError,fieldErrors:c})}}catch(r){t?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit");return p(s,{defaultValues:o.stepState.values?.contract_details||o.initialValues.contract_details,onSubmit:m})}e(F,"ContractDetailsStep");export{F as a};
2
- //# sourceMappingURL=chunk-EAORGT7Z.js.map
1
+ import{a as s}from"./chunk-63BYEK44.js";import{b as n}from"./chunk-PGWKJ6FK.js";import{b as i}from"./chunk-QW4JPW6J.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as p}from"react/jsx-runtime";function F({onSubmit:l,onError:t,onSuccess:d}){let{onboardingBag:o}=n(),m=e(async a=>{try{await l?.(o.parseFormValues(a));let r=await o.onSubmit(a);if(r?.data){await d?.(r.data),o?.next();return}if(r?.error){let c=i(r?.fieldErrors||[],o.meta?.fields?.contract_details);t?.({error:r.error,rawError:r.rawError,fieldErrors:c})}}catch(r){t?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit");return p(s,{defaultValues:o.stepState.values?.contract_details||o.initialValues.contract_details,onSubmit:m})}e(F,"ContractDetailsStep");export{F as a};
2
+ //# sourceMappingURL=chunk-LPR2D3EY.js.map
@@ -1,2 +1,2 @@
1
- import{a as Fe}from"./chunk-ZEUIOZB6.js";import{a as Se,b as be,c as b,d as ge}from"./chunk-XIPPSRO6.js";import{a as re,b as ce,c as le,f as me,g as de,h as fe,i as ue,j as ye,l as pe}from"./chunk-XKSOWDLS.js";import{a as w}from"./chunk-QW4JPW6J.js";import{a as _e}from"./chunk-PJBAQZ6G.js";import{c as S,d as T}from"./chunk-MH6KKP6K.js";import{a as r}from"./chunk-P37U34EQ.js";import{useEffect as xe,useMemo as l,useRef as Ge,useState as Ee}from"react";import We from"lodash.mergewith";import{jsx as Qe}from"react/jsx-runtime";var Ke={employment_basic_information:"basic_information",contract_details:"contract_details"},Ye={select_country:null,basic_information:"employment_basic_information",contract_details:"contract_details",benefits:null,review:null},ze=r(({isLoadingBasicInformationForm:m,isLoadingContractDetailsForm:R,isLoadingEmployment:N,isLoadingBenefitsOffersSchema:v,isLoadingBenefitOffers:a,isLoadingCompany:j,isLoadingCountries:u,employmentStatus:o,employmentId:J,currentStepName:i,basicInformationFields:P,contractDetailsFields:c})=>{let g=m||R||N||v||a||j||u,B=o&&ge.includes(o),F=!!(J&&B&&i!=="review"),I=g||F,y=!!(F&&!g&&P.length>0&&c.length>0);return{isLoading:I,isNavigatingToReview:y,isEmploymentReadOnly:B}},"getLoadingStates"),st=r(({employmentId:m,companyId:R,countryCode:N,type:v,options:a,skipSteps:j})=>{let u=Ge({select_country:{},basic_information:{},contract_details:{},benefits:{}}),[o,J]=Ee(m),[i,P]=Ee(N||null),{data:c,isLoading:g,refetch:B}=re(o);c?.country?.code&&i!==c.country.code&&P(c.country.code);let{data:F,isLoading:I}=le(o),{data:y,isLoading:A,refetch:he}=ce(R),Oe=j?.includes("select_country")?be:Se,{fieldValues:p,stepState:e,setFieldValues:Ve,previousStep:Ce,nextStep:Le,goToStep:D,setStepValues:U}=_e(Oe),{selectCountryForm:k,isLoading:H}=pe({jsfModify:a?.jsfModify?.select_country,jsonSchemaVersion:a?.jsonSchemaVersion,queryOptions:{enabled:e.currentStep.name==="select_country"}}),x=fe(a),G=ue(a),W=ye(a),{mutateAsync:Me}=w(x),{mutateAsync:K}=w(G),{mutateAsync:Te}=w(W),Pe=Ye[e.currentStep.name]||"employment_basic_information",Be=Ke[Pe],Ie=c?.[Be]||{},Y=r(({form:n,options:s={}})=>me({countryCode:i,form:n,fieldValues:Object.keys(p).length>0?{...e.values?.[e.currentStep.name],...p}:Ie,options:{...s,queryOptions:{enabled:s.queryOptions?.enabled??!0}}}),"useJSONSchema"),ke=!!(i&&(e.currentStep.name==="basic_information"||m)),we=!!(i&&(e.currentStep.name==="contract_details"||m)),{data:d,isLoading:z}=Y({form:"employment_basic_information",options:{jsfModify:a?.jsfModify?.basic_information,queryOptions:{enabled:ke}}}),_=a?.jsfModify?.contract_details?.fields?.annual_gross_salary,q=_&&typeof _=="object"&&"presentation"in _?_.presentation:void 0,Re=l(()=>({fields:{annual_gross_salary:{..._,presentation:{annual_gross_salary_conversion_properties:{label:q?.annual_gross_salary_conversion_properties?.label,description:q?.annual_gross_salary_conversion_properties?.description},desiredCurrency:y?.desired_currency,Component:r(n=>Qe(Fe,{desiredCurrency:y?.desired_currency||"",...n}),"Component")}}}}),[y?.desired_currency,q,_]),{data:f,isLoading:Q}=Y({form:"contract_details",options:{jsfModify:{...a?.jsfModify?.contract_details,fields:{...a?.jsfModify?.contract_details?.fields,...Re.fields}},queryOptions:{enabled:we}}}),{data:E,isLoading:X}=de(o,p,a),Z=l(()=>{if(e.currentStep.name==="benefits"){let n={...e.values?.[e.currentStep.name],...p};return We({},F,n)}return{}},[e.currentStep.name,F,e.values,p]),t=l(()=>({select_country:k?.fields||[],basic_information:d?.fields||[],contract_details:f?.fields||[],benefits:E?.fields||[],review:[]}),[k?.fields,d?.fields,f?.fields,E?.fields]),{country:{code:$}={},basic_information:ee={},contract_details:te={},status:ne}=c||{},oe=e.currentStep.name,h=l(()=>T(t.select_country,{country:i||$||""}),[t.select_country,i,$]),O=l(()=>T(t.basic_information,ee||{}),[t.basic_information,ee]),V=l(()=>T(t.contract_details,te||{}),[t.contract_details,te]),C=l(()=>T(t.benefits,Z),[t.benefits,Z]),Ne=l(()=>({select_country:h,basic_information:O,contract_details:V,benefits:C}),[h,O,V,C]),{isLoading:ve,isNavigatingToReview:ae,isEmploymentReadOnly:je}=l(()=>ze({isLoadingBasicInformationForm:z,isLoadingContractDetailsForm:Q,isLoadingEmployment:g,isLoadingBenefitsOffersSchema:X,isLoadingBenefitOffers:I,isLoadingCompany:A,isLoadingCountries:H,employmentId:m,employmentStatus:ne,basicInformationFields:t.basic_information,contractDetailsFields:t.contract_details,currentStepName:oe}),[z,Q,g,X,I,A,H,m,ne,t.basic_information,t.contract_details,oe]);xe(()=>{ae&&(u.current={select_country:b(h,t.select_country),basic_information:b(O,t.basic_information),contract_details:b(V,t.contract_details),benefits:b(C,t.benefits)},U({select_country:h,basic_information:O,contract_details:V,benefits:C,review:{}}),D("review"))},[O,C,V,D,ae,h,U,t.basic_information,t.benefits,t.contract_details,t.select_country]);let ie=r(n=>k&&e.currentStep.name==="select_country"?n:d&&e.currentStep.name==="basic_information"?S(n,d?.fields,{isPartialValidation:!0}):f&&e.currentStep.name==="contract_details"?S(n,f?.fields,{isPartialValidation:!0}):{},"parseFormValues");async function Je(n){let s=e.currentStep.name;s in u.current&&(u.current[s]=b(n,t[s]));let L=ie(n);switch(he(),e.currentStep.name){case"select_country":return P(L.country),Promise.resolve({data:{countryCode:L.country}});case"basic_information":{let se=!o&&i,Ue=o&&i&&c?.country&&c?.country.code!==i;if(se||Ue){let He={basic_information:L,type:v,country_code:i};try{let M=await Me(He);return J(M.data?.data?.employment?.id),M}catch(M){throw console.error("Error creating onboarding:",M),M}}else if(o)return K({employmentId:o,basic_information:L,pricing_plan_details:{frequency:"monthly"}});return}case"contract_details":return K({employmentId:o,...{contract_details:L,pricing_plan_details:{frequency:"monthly"}}});case"benefits":return Te({employmentId:o,...n})}}r(Je,"onSubmit");function De(){Ce()}r(De,"back");function qe(){Le()}r(qe,"next");function Ae(n){D(n)}return r(Ae,"goTo"),{employmentId:o,creditRiskStatus:y?.default_legal_entity_credit_risk_status,fieldValues:p,stepState:e,fields:t[e.currentStep.name],isLoading:ve,isSubmitting:x.isPending||G.isPending||W.isPending,initialValues:Ne,handleValidation:r(n=>{if(e.currentStep.name==="select_country")return k.handleValidation(n);if(e.currentStep.name==="benefits"&&E){let s=S(n,E?.fields);return E?.handleValidation(s)}if(d&&e.currentStep.name==="basic_information"){let s=S(n,d?.fields);return d?.handleValidation(s)}if(f&&e.currentStep.name==="contract_details"){let s=S(n,f?.fields);return f?.handleValidation(s)}return null},"handleValidation"),checkFieldUpdates:Ve,parseFormValues:ie,onSubmit:Je,back:De,next:qe,goTo:Ae,meta:{fields:u.current},refetchEmployment:B,employment:c,isEmploymentReadOnly:je}},"useOnboarding");export{st as a};
2
- //# sourceMappingURL=chunk-CU75S5F2.js.map
1
+ import{a as Fe}from"./chunk-MO7KC4HE.js";import{a as Se,b as be,c as b,d as ge}from"./chunk-XIPPSRO6.js";import{a as re,b as ce,c as le,f as me,g as de,h as fe,i as ue,j as ye,l as pe}from"./chunk-XKSOWDLS.js";import{a as w}from"./chunk-QW4JPW6J.js";import{a as _e}from"./chunk-PJBAQZ6G.js";import{c as S,d as T}from"./chunk-MH6KKP6K.js";import{a as r}from"./chunk-P37U34EQ.js";import{useEffect as xe,useMemo as l,useRef as Ge,useState as Ee}from"react";import We from"lodash.mergewith";import{jsx as Qe}from"react/jsx-runtime";var Ke={employment_basic_information:"basic_information",contract_details:"contract_details"},Ye={select_country:null,basic_information:"employment_basic_information",contract_details:"contract_details",benefits:null,review:null},ze=r(({isLoadingBasicInformationForm:m,isLoadingContractDetailsForm:R,isLoadingEmployment:N,isLoadingBenefitsOffersSchema:v,isLoadingBenefitOffers:a,isLoadingCompany:j,isLoadingCountries:u,employmentStatus:o,employmentId:J,currentStepName:i,basicInformationFields:P,contractDetailsFields:c})=>{let g=m||R||N||v||a||j||u,B=o&&ge.includes(o),F=!!(J&&B&&i!=="review"),I=g||F,y=!!(F&&!g&&P.length>0&&c.length>0);return{isLoading:I,isNavigatingToReview:y,isEmploymentReadOnly:B}},"getLoadingStates"),st=r(({employmentId:m,companyId:R,countryCode:N,type:v,options:a,skipSteps:j})=>{let u=Ge({select_country:{},basic_information:{},contract_details:{},benefits:{}}),[o,J]=Ee(m),[i,P]=Ee(N||null),{data:c,isLoading:g,refetch:B}=re(o);c?.country?.code&&i!==c.country.code&&P(c.country.code);let{data:F,isLoading:I}=le(o),{data:y,isLoading:A,refetch:he}=ce(R),Oe=j?.includes("select_country")?be:Se,{fieldValues:p,stepState:e,setFieldValues:Ve,previousStep:Ce,nextStep:Le,goToStep:D,setStepValues:U}=_e(Oe),{selectCountryForm:k,isLoading:H}=pe({jsfModify:a?.jsfModify?.select_country,jsonSchemaVersion:a?.jsonSchemaVersion,queryOptions:{enabled:e.currentStep.name==="select_country"}}),x=fe(a),G=ue(a),W=ye(a),{mutateAsync:Me}=w(x),{mutateAsync:K}=w(G),{mutateAsync:Te}=w(W),Pe=Ye[e.currentStep.name]||"employment_basic_information",Be=Ke[Pe],Ie=c?.[Be]||{},Y=r(({form:n,options:s={}})=>me({countryCode:i,form:n,fieldValues:Object.keys(p).length>0?{...e.values?.[e.currentStep.name],...p}:Ie,options:{...s,queryOptions:{enabled:s.queryOptions?.enabled??!0}}}),"useJSONSchema"),ke=!!(i&&(e.currentStep.name==="basic_information"||m)),we=!!(i&&(e.currentStep.name==="contract_details"||m)),{data:d,isLoading:z}=Y({form:"employment_basic_information",options:{jsfModify:a?.jsfModify?.basic_information,queryOptions:{enabled:ke}}}),_=a?.jsfModify?.contract_details?.fields?.annual_gross_salary,q=_&&typeof _=="object"&&"presentation"in _?_.presentation:void 0,Re=l(()=>({fields:{annual_gross_salary:{..._,presentation:{annual_gross_salary_conversion_properties:{label:q?.annual_gross_salary_conversion_properties?.label,description:q?.annual_gross_salary_conversion_properties?.description},desiredCurrency:y?.desired_currency,Component:r(n=>Qe(Fe,{desiredCurrency:y?.desired_currency||"",...n}),"Component")}}}}),[y?.desired_currency,q,_]),{data:f,isLoading:Q}=Y({form:"contract_details",options:{jsfModify:{...a?.jsfModify?.contract_details,fields:{...a?.jsfModify?.contract_details?.fields,...Re.fields}},queryOptions:{enabled:we}}}),{data:E,isLoading:X}=de(o,p,a),Z=l(()=>{if(e.currentStep.name==="benefits"){let n={...e.values?.[e.currentStep.name],...p};return We({},F,n)}return{}},[e.currentStep.name,F,e.values,p]),t=l(()=>({select_country:k?.fields||[],basic_information:d?.fields||[],contract_details:f?.fields||[],benefits:E?.fields||[],review:[]}),[k?.fields,d?.fields,f?.fields,E?.fields]),{country:{code:$}={},basic_information:ee={},contract_details:te={},status:ne}=c||{},oe=e.currentStep.name,h=l(()=>T(t.select_country,{country:i||$||""}),[t.select_country,i,$]),O=l(()=>T(t.basic_information,ee||{}),[t.basic_information,ee]),V=l(()=>T(t.contract_details,te||{}),[t.contract_details,te]),C=l(()=>T(t.benefits,Z),[t.benefits,Z]),Ne=l(()=>({select_country:h,basic_information:O,contract_details:V,benefits:C}),[h,O,V,C]),{isLoading:ve,isNavigatingToReview:ae,isEmploymentReadOnly:je}=l(()=>ze({isLoadingBasicInformationForm:z,isLoadingContractDetailsForm:Q,isLoadingEmployment:g,isLoadingBenefitsOffersSchema:X,isLoadingBenefitOffers:I,isLoadingCompany:A,isLoadingCountries:H,employmentId:m,employmentStatus:ne,basicInformationFields:t.basic_information,contractDetailsFields:t.contract_details,currentStepName:oe}),[z,Q,g,X,I,A,H,m,ne,t.basic_information,t.contract_details,oe]);xe(()=>{ae&&(u.current={select_country:b(h,t.select_country),basic_information:b(O,t.basic_information),contract_details:b(V,t.contract_details),benefits:b(C,t.benefits)},U({select_country:h,basic_information:O,contract_details:V,benefits:C,review:{}}),D("review"))},[O,C,V,D,ae,h,U,t.basic_information,t.benefits,t.contract_details,t.select_country]);let ie=r(n=>k&&e.currentStep.name==="select_country"?n:d&&e.currentStep.name==="basic_information"?S(n,d?.fields,{isPartialValidation:!0}):f&&e.currentStep.name==="contract_details"?S(n,f?.fields,{isPartialValidation:!0}):{},"parseFormValues");async function Je(n){let s=e.currentStep.name;s in u.current&&(u.current[s]=b(n,t[s]));let L=ie(n);switch(he(),e.currentStep.name){case"select_country":return P(L.country),Promise.resolve({data:{countryCode:L.country}});case"basic_information":{let se=!o&&i,Ue=o&&i&&c?.country&&c?.country.code!==i;if(se||Ue){let He={basic_information:L,type:v,country_code:i};try{let M=await Me(He);return J(M.data?.data?.employment?.id),M}catch(M){throw console.error("Error creating onboarding:",M),M}}else if(o)return K({employmentId:o,basic_information:L,pricing_plan_details:{frequency:"monthly"}});return}case"contract_details":return K({employmentId:o,...{contract_details:L,pricing_plan_details:{frequency:"monthly"}}});case"benefits":return Te({employmentId:o,...n})}}r(Je,"onSubmit");function De(){Ce()}r(De,"back");function qe(){Le()}r(qe,"next");function Ae(n){D(n)}return r(Ae,"goTo"),{employmentId:o,creditRiskStatus:y?.default_legal_entity_credit_risk_status,fieldValues:p,stepState:e,fields:t[e.currentStep.name],isLoading:ve,isSubmitting:x.isPending||G.isPending||W.isPending,initialValues:Ne,handleValidation:r(n=>{if(e.currentStep.name==="select_country")return k.handleValidation(n);if(e.currentStep.name==="benefits"&&E){let s=S(n,E?.fields);return E?.handleValidation(s)}if(d&&e.currentStep.name==="basic_information"){let s=S(n,d?.fields);return d?.handleValidation(s)}if(f&&e.currentStep.name==="contract_details"){let s=S(n,f?.fields);return f?.handleValidation(s)}return null},"handleValidation"),checkFieldUpdates:Ve,parseFormValues:ie,onSubmit:Je,back:De,next:qe,goTo:Ae,meta:{fields:u.current},refetchEmployment:B,employment:c,isEmploymentReadOnly:je}},"useOnboarding");export{st as a};
2
+ //# sourceMappingURL=chunk-MNFM2TNK.js.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-G3OSPYB5.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as i}from"react/jsx-runtime";var l=e(({currency:n,desiredCurrency:o,annual_gross_salary_conversion_properties:r,...a})=>i(s,{...a,sourceCurrency:n,targetCurrency:o,conversionFieldName:"annual_gross_salary_conversion",conversionProperties:{...r,description:r?.description||"Estimated amount. This is an estimation. We calculate conversions based on spot rates that are subject to fluctuation over time."},classNamePrefix:"RemoteFlows-AnnualGrossSalary"}),"AnnualGrossSalary");export{l as a};
2
- //# sourceMappingURL=chunk-ZEUIOZB6.js.map
1
+ import{a as s}from"./chunk-XMDNHTKE.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as i}from"react/jsx-runtime";var l=e(({currency:n,desiredCurrency:o,annual_gross_salary_conversion_properties:r,...a})=>i(s,{...a,sourceCurrency:n,targetCurrency:o,conversionFieldName:"annual_gross_salary_conversion",conversionProperties:{...r,description:r?.description||"Estimated amount. This is an estimation. We calculate conversions based on spot rates that are subject to fluctuation over time."},classNamePrefix:"RemoteFlows-AnnualGrossSalary"}),"AnnualGrossSalary");export{l as a};
2
+ //# sourceMappingURL=chunk-MO7KC4HE.js.map
@@ -1,2 +1,2 @@
1
- import{b as p}from"./chunk-3ZWDIEEM.js";import{b as c,c as F,d as f,e as x,f as _,g}from"./chunk-VNSF5IOL.js";import{a as u}from"./chunk-KPHSEIR3.js";import{a as i}from"./chunk-P37U34EQ.js";import{useFormContext as y}from"react-hook-form";import{jsx as P}from"react/jsx-runtime";function b({className:o,type:r,...t}){return P("input",{type:r,"data-slot":"input",className:u("shadow-xs border-input file:text-foreground placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-xl border bg-transparent px-4 py-7 text-sm transition-[color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-focused","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",o),...t})}i(b,"Input");import{jsx as e,jsxs as N}from"react/jsx-runtime";function $({name:o,description:r,label:t,type:C,onChange:l,component:v,includeErrorMessage:R=!0,additionalProps:T={},...w}){let{components:h}=p(),{control:I}=y();return e(c,{control:I,name:o,render:({field:n,fieldState:a})=>{let m=v||h?.text;if(m){let s={name:o,description:r,label:t,type:C,onChange:l,...T,...w};return e(m,{field:{...n,onChange:i(d=>{n.onChange(d),l?.(d)},"onChange")},fieldState:a,fieldData:s})}return N(F,{"data-field":o,className:`RemoteFlows__TextField__Item__${o}`,children:[t&&e(f,{className:"RemoteFlows__TextField__Label",children:t}),e(x,{children:e(b,{...n,value:n.value??"",onChange:s=>{n.onChange(s),l?.(s)},className:"RemoteFlows__TextField__Input",placeholder:t})}),r&&e(_,{className:"RemoteFlows__TextField__Description",children:r}),R&&a.error&&e(g,{className:"RemoteFlows__TextField__Error"})]})}})}i($,"TextField");export{$ as a};
2
- //# sourceMappingURL=chunk-RLETCEUU.js.map
1
+ import{b as p}from"./chunk-3ZWDIEEM.js";import{b as c,c as F,d as f,e as x,f as _,g}from"./chunk-VNSF5IOL.js";import{a as u}from"./chunk-KPHSEIR3.js";import{a as i}from"./chunk-P37U34EQ.js";import{useFormContext as y}from"react-hook-form";import{jsx as P}from"react/jsx-runtime";function b({className:o,type:r,...t}){return P("input",{type:r,"data-slot":"input",className:u("shadow-xs border-input file:text-foreground placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-xl border bg-transparent px-4 py-7 text-sm transition-[color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-focused","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",o),...t})}i(b,"Input");import{jsx as e,jsxs as N}from"react/jsx-runtime";function $({name:o,description:r,label:t,type:C,onChange:s,component:v,includeErrorMessage:R=!0,additionalProps:T={},...w}){let{components:h}=p(),{control:I}=y();return e(c,{control:I,name:o,render:({field:n,fieldState:l})=>{let m=v||h?.text;if(m){let a={name:o,description:r,label:t,type:C,onChange:s,metadata:T,...w};return e(m,{field:{...n,onChange:i(d=>{n.onChange(d),s?.(d)},"onChange")},fieldState:l,fieldData:a})}return N(F,{"data-field":o,className:`RemoteFlows__TextField__Item__${o}`,children:[t&&e(f,{className:"RemoteFlows__TextField__Label",children:t}),e(x,{children:e(b,{...n,value:n.value??"",onChange:a=>{n.onChange(a),s?.(a)},className:"RemoteFlows__TextField__Input",placeholder:t})}),r&&e(_,{className:"RemoteFlows__TextField__Description",children:r}),R&&l.error&&e(g,{className:"RemoteFlows__TextField__Error"})]})}})}i($,"TextField");export{$ as a};
2
+ //# sourceMappingURL=chunk-N6NYXAXH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/form/fields/TextField.tsx","../src/components/ui/input.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\n\nimport { useFormFields } from '@/src/context';\nimport { Components, JSFField } from '@/src/types/remoteFlows';\nimport { useFormContext } from 'react-hook-form';\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '../../ui/form';\nimport { Input } from '../../ui/input';\n\nexport type TextFieldProps = React.ComponentProps<'input'> & {\n name: string;\n} & Partial<\n JSFField & {\n onChange?: (value: any) => void;\n component?: Components['text'];\n includeErrorMessage?: boolean;\n additionalProps?: Record<string, unknown>;\n }\n >;\n\nexport function TextField({\n name,\n description,\n label,\n type,\n onChange,\n component,\n includeErrorMessage = true,\n additionalProps = {},\n ...rest\n}: TextFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n\n return (\n <FormField\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n const CustomTextField = component || components?.text;\n if (CustomTextField) {\n const customTextFieldProps = {\n name,\n description,\n label,\n type,\n onChange,\n metadata: additionalProps,\n ...rest,\n };\n return (\n <CustomTextField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={customTextFieldProps}\n />\n );\n }\n\n return (\n <FormItem\n data-field={name}\n className={`RemoteFlows__TextField__Item__${name}`}\n >\n {label && (\n <FormLabel className=\"RemoteFlows__TextField__Label\">\n {label}\n </FormLabel>\n )}\n <FormControl>\n <Input\n {...field}\n value={field.value ?? ''}\n onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n field.onChange(event);\n onChange?.(event);\n }}\n className=\"RemoteFlows__TextField__Input\"\n placeholder={label}\n />\n </FormControl>\n {description && (\n <FormDescription className=\"RemoteFlows__TextField__Description\">\n {description}\n </FormDescription>\n )}\n {includeErrorMessage && fieldState.error && (\n <FormMessage className=\"RemoteFlows__TextField__Error\" />\n )}\n </FormItem>\n );\n }}\n />\n );\n}\n","import * as React from 'react';\n\nimport { cn } from '@/src/lib/utils';\n\nfunction Input({ className, type, ...props }: React.ComponentProps<'input'>) {\n return (\n <input\n type={type}\n data-slot=\"input\"\n className={cn(\n 'shadow-xs border-input file:text-foreground placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-xl border bg-transparent px-4 py-7 text-sm transition-[color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n 'focus-visible:border-focused',\n 'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Input };\n"],"mappings":"8LAKA,OAAS,kBAAAA,MAAsB,kBCC3B,cAAAC,MAAA,oBAFJ,SAASC,EAAM,CAAE,UAAAC,EAAW,KAAAC,EAAM,GAAGC,CAAM,EAAkC,CAC3E,OACEJ,EAAC,SACC,KAAMG,EACN,YAAU,QACV,UAAWE,EACT,6WACA,+BACA,yGACAH,CACF,EACC,GAAGE,EACN,CAEJ,CAdSE,EAAAL,EAAA,SDsDG,cAAAM,EAeF,QAAAC,MAfE,oBA/BL,SAASC,EAAU,CACxB,KAAAC,EACA,YAAAC,EACA,MAAAC,EACA,KAAAC,EACA,SAAAC,EACA,UAAAC,EACA,oBAAAC,EAAsB,GACtB,gBAAAC,EAAkB,CAAC,EACnB,GAAGC,CACL,EAAmB,CACjB,GAAM,CAAE,WAAAC,CAAW,EAAIC,EAAc,EAC/B,CAAE,QAAAC,CAAQ,EAAIC,EAAe,EAEnC,OACEf,EAACgB,EAAA,CACC,QAASF,EACT,KAAMX,EACN,OAAQ,CAAC,CAAE,MAAAc,EAAO,WAAAC,CAAW,IAAM,CACjC,IAAMC,EAAkBX,GAAaI,GAAY,KACjD,GAAIO,EAAiB,CACnB,IAAMC,EAAuB,CAC3B,KAAAjB,EACA,YAAAC,EACA,MAAAC,EACA,KAAAC,EACA,SAAAC,EACA,SAAUG,EACV,GAAGC,CACL,EACA,OACEX,EAACmB,EAAA,CACC,MAAO,CACL,GAAGF,EACH,SAAUI,EAACC,GAAe,CACxBL,EAAM,SAASK,CAAK,EACpBf,IAAWe,CAAK,CAClB,EAHU,WAIZ,EACA,WAAYJ,EACZ,UAAWE,EACb,CAEJ,CAEA,OACEnB,EAACsB,EAAA,CACC,aAAYpB,EACZ,UAAW,iCAAiCA,CAAI,GAE/C,UAAAE,GACCL,EAACwB,EAAA,CAAU,UAAU,gCAClB,SAAAnB,EACH,EAEFL,EAACyB,EAAA,CACC,SAAAzB,EAAC0B,EAAA,CACE,GAAGT,EACJ,MAAOA,EAAM,OAAS,GACtB,SAAWU,GAA+C,CACxDV,EAAM,SAASU,CAAK,EACpBpB,IAAWoB,CAAK,CAClB,EACA,UAAU,gCACV,YAAatB,EACf,EACF,EACCD,GACCJ,EAAC4B,EAAA,CAAgB,UAAU,sCACxB,SAAAxB,EACH,EAEDK,GAAuBS,EAAW,OACjClB,EAAC6B,EAAA,CAAY,UAAU,gCAAgC,GAE3D,CAEJ,EACF,CAEJ,CAhFgBR,EAAAnB,EAAA","names":["useFormContext","jsx","Input","className","type","props","cn","__name","jsx","jsxs","TextField","name","description","label","type","onChange","component","includeErrorMessage","additionalProps","rest","components","useFormFields","control","useFormContext","FormField","field","fieldState","CustomTextField","customTextFieldProps","__name","value","FormItem","FormLabel","FormControl","Input","event","FormDescription","FormMessage"]}
@@ -1,2 +1,2 @@
1
- import{a as r}from"./chunk-6SWZH7KI.js";import{b as n}from"./chunk-MRYRNB7Y.js";import{a as o}from"./chunk-P37U34EQ.js";import{jsx as a}from"react/jsx-runtime";function u({onSubmit:m}){let{terminationBag:i}=n();return a(r,{onSubmit:o(async t=>{await m?.(i?.parseFormValues(t)),i?.next()},"handleSubmit")})}o(u,"TerminationDetailsForm");export{u as a};
2
- //# sourceMappingURL=chunk-ZUNKCQBT.js.map
1
+ import{a as r}from"./chunk-SIC7BRJ2.js";import{b as n}from"./chunk-MRYRNB7Y.js";import{a as o}from"./chunk-P37U34EQ.js";import{jsx as a}from"react/jsx-runtime";function u({onSubmit:m}){let{terminationBag:i}=n();return a(r,{onSubmit:o(async t=>{await m?.(i?.parseFormValues(t)),i?.next()},"handleSubmit")})}o(u,"TerminationDetailsForm");export{u as a};
2
+ //# sourceMappingURL=chunk-O53436KO.js.map
@@ -1,2 +1,2 @@
1
- import{b as f}from"./chunk-MRYRNB7Y.js";import{a as l}from"./chunk-2NLOH7NZ.js";import{b as s}from"./chunk-CFIJKJXD.js";import{a}from"./chunk-VNSF5IOL.js";import{a as n}from"./chunk-P37U34EQ.js";import{useEffect as y}from"react";import{useForm as T}from"react-hook-form";import{jsx as e}from"react/jsx-runtime";function A({fields:m,onSubmit:d}){let{formId:F,terminationBag:o}=f(),u=s(o.handleValidation),i=T({resolver:u,defaultValues:o?.initialValues,shouldUnregister:!1,mode:"onBlur"});y(()=>{let p=i?.watch(r=>{Object.keys(r).some(t=>r[t]!==o?.initialValues?.[t])&&o?.checkFieldUpdates(r)});return()=>p?.unsubscribe()},[]);let c=m||(o?.fields??[]);return e(a,{...i,children:e("form",{id:F,onSubmit:i.handleSubmit(d),className:"space-y-4 RemoteFlows__TerminationForm",children:e(l,{fields:c})})})}n(A,"TerminationForm");export{A as a};
2
- //# sourceMappingURL=chunk-6SWZH7KI.js.map
1
+ import{b as f}from"./chunk-MRYRNB7Y.js";import{a as l}from"./chunk-3BIRQAED.js";import{b as s}from"./chunk-CFIJKJXD.js";import{a}from"./chunk-VNSF5IOL.js";import{a as n}from"./chunk-P37U34EQ.js";import{useEffect as y}from"react";import{useForm as T}from"react-hook-form";import{jsx as e}from"react/jsx-runtime";function A({fields:m,onSubmit:d}){let{formId:F,terminationBag:o}=f(),u=s(o.handleValidation),i=T({resolver:u,defaultValues:o?.initialValues,shouldUnregister:!1,mode:"onBlur"});y(()=>{let p=i?.watch(r=>{Object.keys(r).some(t=>r[t]!==o?.initialValues?.[t])&&o?.checkFieldUpdates(r)});return()=>p?.unsubscribe()},[]);let c=m||(o?.fields??[]);return e(a,{...i,children:e("form",{id:F,onSubmit:i.handleSubmit(d),className:"space-y-4 RemoteFlows__TerminationForm",children:e(l,{fields:c})})})}n(A,"TerminationForm");export{A as a};
2
+ //# sourceMappingURL=chunk-SIC7BRJ2.js.map
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-6SWZH7KI.js";import{b as m}from"./chunk-MRYRNB7Y.js";import{a as o}from"./chunk-P37U34EQ.js";import{jsx as r}from"react/jsx-runtime";function p({onSubmit:e}){let{terminationBag:i}=m();return r(n,{onSubmit:o(async t=>{await e?.(i?.parseFormValues(t)),i?.next()},"handleSubmit")})}o(p,"EmployeeCommunicationForm");export{p as a};
2
- //# sourceMappingURL=chunk-X3YONWNH.js.map
1
+ import{a as n}from"./chunk-SIC7BRJ2.js";import{b as m}from"./chunk-MRYRNB7Y.js";import{a as o}from"./chunk-P37U34EQ.js";import{jsx as r}from"react/jsx-runtime";function p({onSubmit:e}){let{terminationBag:i}=m();return r(n,{onSubmit:o(async t=>{await e?.(i?.parseFormValues(t)),i?.next()},"handleSubmit")})}o(p,"EmployeeCommunicationForm");export{p as a};
2
+ //# sourceMappingURL=chunk-TNF6DNGM.js.map
@@ -1,2 +1,2 @@
1
- import{m as W}from"./chunk-XKSOWDLS.js";import{a as P}from"./chunk-RLETCEUU.js";import{b as $}from"./chunk-3ZWDIEEM.js";import{a as t,b as u,c as Te}from"./chunk-P37U34EQ.js";var R=u((bt,D)=>{"use strict";function xe(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}t(xe,"isObject");D.exports=xe});var B=u((yt,_)=>{"use strict";var he=typeof global=="object"&&global&&global.Object===Object&&global;_.exports=he});var k=u((Ct,H)=>{"use strict";var Se=B(),je=typeof self=="object"&&self&&self.Object===Object&&self,Oe=Se||je||Function("return this")();H.exports=Oe});var G=u((Tt,A)=>{"use strict";var Ee=k(),Fe=t(function(){return Ee.Date.now()},"now");A.exports=Fe});var U=u((ht,J)=>{"use strict";var qe=/\s/;function Ie(e){for(var n=e.length;n--&&qe.test(e.charAt(n)););return n}t(Ie,"trimmedEndIndex");J.exports=Ie});var X=u((jt,V)=>{"use strict";var Pe=U(),Re=/^\s+/;function ke(e){return e&&e.slice(0,Pe(e)+1).replace(Re,"")}t(ke,"baseTrim");V.exports=ke});var M=u((Et,z)=>{"use strict";var Me=k(),Ne=Me.Symbol;z.exports=Ne});var Z=u((Ft,Y)=>{"use strict";var K=M(),Q=Object.prototype,we=Q.hasOwnProperty,Le=Q.toString,x=K?K.toStringTag:void 0;function $e(e){var n=we.call(e,x),o=e[x];try{e[x]=void 0;var s=!0}catch{}var a=Le.call(e);return s&&(n?e[x]=o:delete e[x]),a}t($e,"getRawTag");Y.exports=$e});var te=u((It,ee)=>{"use strict";var We=Object.prototype,De=We.toString;function _e(e){return De.call(e)}t(_e,"objectToString");ee.exports=_e});var ie=u((Rt,oe)=>{"use strict";var ne=M(),Be=Z(),He=te(),Ae="[object Null]",Ge="[object Undefined]",re=ne?ne.toStringTag:void 0;function Je(e){return e==null?e===void 0?Ge:Ae:re&&re in Object(e)?Be(e):He(e)}t(Je,"baseGetTag");oe.exports=Je});var ae=u((Mt,se)=>{"use strict";function Ue(e){return e!=null&&typeof e=="object"}t(Ue,"isObjectLike");se.exports=Ue});var ue=u((wt,ce)=>{"use strict";var Ve=ie(),Xe=ae(),ze="[object Symbol]";function Ke(e){return typeof e=="symbol"||Xe(e)&&Ve(e)==ze}t(Ke,"isSymbol");ce.exports=Ke});var me=u(($t,de)=>{"use strict";var Qe=X(),fe=R(),Ye=ue(),le=NaN,Ze=/^[-+]0x[0-9a-f]+$/i,et=/^0b[01]+$/i,tt=/^0o[0-7]+$/i,nt=parseInt;function rt(e){if(typeof e=="number")return e;if(Ye(e))return le;if(fe(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=fe(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Qe(e);var o=et.test(e);return o||tt.test(e)?nt(e.slice(2),o?2:8):Ze.test(e)?le:+e}t(rt,"toNumber");de.exports=rt});var be=u((Dt,ge)=>{"use strict";var ot=R(),N=G(),pe=me(),it="Expected a function",st=Math.max,at=Math.min;function ct(e,n,o){var s,a,l,f,i,m,p=0,S=!1,g=!1,T=!0;if(typeof e!="function")throw new TypeError(it);n=pe(n)||0,ot(o)&&(S=!!o.leading,g="maxWait"in o,l=g?st(pe(o.maxWait)||0,n):l,T="trailing"in o?!!o.trailing:T);function y(r){var d=s,b=a;return s=a=void 0,p=r,f=e.apply(b,d),f}t(y,"invokeFunc");function j(r){return p=r,i=setTimeout(C,n),S?y(r):f}t(j,"leadingEdge");function O(r){var d=r-m,b=r-p,v=n-d;return g?at(v,l-b):v}t(O,"remainingWait");function E(r){var d=r-m,b=r-p;return m===void 0||d>=n||d<0||g&&b>=l}t(E,"shouldInvoke");function C(){var r=N();if(E(r))return F(r);i=setTimeout(C,O(r))}t(C,"timerExpired");function F(r){return i=void 0,T&&s?y(r):(s=a=void 0,f)}t(F,"trailingEdge");function q(){i!==void 0&&clearTimeout(i),p=0,s=m=a=i=void 0}t(q,"cancel");function I(){return i===void 0?f:F(N())}t(I,"flush");function c(){var r=N(),d=E(r);if(s=arguments,a=this,m=r,d){if(i===void 0)return j(m);if(g)return clearTimeout(i),i=setTimeout(C,n),y(m)}return i===void 0&&(i=setTimeout(C,n)),f}return t(c,"debounced"),c.cancel=q,c.flush=I,c}t(ct,"debounce");ge.exports=ct});import{useState as lt,useCallback as dt}from"react";import{useFormContext as mt}from"react-hook-form";var ye=Te(be(),1);import{useCallback as ut,useEffect as ft,useRef as ve}from"react";function w(e,n){let o=ve(e);ft(()=>{o.current=e},[e]);let s=ve((0,ye.default)(a=>{o.current(a)},n)).current;return ut(a=>{s(a)},[s])}t(w,"useDebounce");import{Fragment as gt,jsx as h,jsxs as Ce}from"react/jsx-runtime";var pt=t(({description:e,showConversion:n,targetCurrency:o,className:s,onClick:a})=>{let{components:l}=$(),f=n?`Hide ${o} conversion`:`Show ${o} conversion`,i=l?.button;return Ce("span",{className:s,children:[e," ",i?h(i,{className:`${s.replace("-description","-button")}`,"data-type":"inline",onClick:a,children:f}):h("button",{className:`${s.replace("-description","-button")}`,onClick:a,children:f})]})},"DescriptionWithConversion"),Qt=t(({sourceCurrency:e,targetCurrency:n,conversionFieldName:o,conversionProperties:s,classNamePrefix:a,description:l,...f})=>{let[i,m]=lt(!1),{setValue:p,watch:S}=mt(),g=S(f.name),T=e&&n&&e!==n,{mutateAsync:y}=W(),j=dt(async(c,r,d,b)=>{if(c)try{let v=await y({source_currency:r,target_currency:d,amount:Number(c)});if(v.data?.data?.conversion_data?.target_amount){let L=v.data.data.conversion_data.target_amount;L&&p(b,L?.toString())}}catch(v){console.error("Error converting currency:",v)}},[y,p]),O=w(c=>j(c,e,n,o),500),E=w(c=>j(c,n,e,f.name),500),C=t(c=>{i&&O(c.target.value)},"handleMainFieldChange"),F=t(c=>{E(c.target.value)},"handleConversionFieldChange"),q=t(c=>{c.preventDefault(),m(r=>!r),!i&&g&&O(g)},"toggleConversion"),I=T?h(pt,{targetCurrency:n,description:l,showConversion:i,className:`${a}-description`,onClick:q}):l;return Ce(gt,{children:[h(P,{...f,additionalProps:{currency:e},description:I,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$",onChange:C}),i&&h(P,{additionalProps:{currency:n},name:o,label:s?.label||"Conversion",description:s?.description,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$",onChange:F})]})},"CurrencyConversionField");export{Qt as a};
2
- //# sourceMappingURL=chunk-G3OSPYB5.js.map
1
+ import{m as W}from"./chunk-XKSOWDLS.js";import{a as P}from"./chunk-N6NYXAXH.js";import{b as $}from"./chunk-3ZWDIEEM.js";import{a as t,b as u,c as Te}from"./chunk-P37U34EQ.js";var R=u((bt,D)=>{"use strict";function xe(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}t(xe,"isObject");D.exports=xe});var B=u((yt,_)=>{"use strict";var he=typeof global=="object"&&global&&global.Object===Object&&global;_.exports=he});var k=u((Ct,H)=>{"use strict";var Se=B(),je=typeof self=="object"&&self&&self.Object===Object&&self,Oe=Se||je||Function("return this")();H.exports=Oe});var G=u((Tt,A)=>{"use strict";var Ee=k(),Fe=t(function(){return Ee.Date.now()},"now");A.exports=Fe});var U=u((ht,J)=>{"use strict";var qe=/\s/;function Ie(e){for(var n=e.length;n--&&qe.test(e.charAt(n)););return n}t(Ie,"trimmedEndIndex");J.exports=Ie});var X=u((jt,V)=>{"use strict";var Pe=U(),Re=/^\s+/;function ke(e){return e&&e.slice(0,Pe(e)+1).replace(Re,"")}t(ke,"baseTrim");V.exports=ke});var M=u((Et,z)=>{"use strict";var Me=k(),Ne=Me.Symbol;z.exports=Ne});var Z=u((Ft,Y)=>{"use strict";var K=M(),Q=Object.prototype,we=Q.hasOwnProperty,Le=Q.toString,x=K?K.toStringTag:void 0;function $e(e){var n=we.call(e,x),o=e[x];try{e[x]=void 0;var s=!0}catch{}var a=Le.call(e);return s&&(n?e[x]=o:delete e[x]),a}t($e,"getRawTag");Y.exports=$e});var te=u((It,ee)=>{"use strict";var We=Object.prototype,De=We.toString;function _e(e){return De.call(e)}t(_e,"objectToString");ee.exports=_e});var ie=u((Rt,oe)=>{"use strict";var ne=M(),Be=Z(),He=te(),Ae="[object Null]",Ge="[object Undefined]",re=ne?ne.toStringTag:void 0;function Je(e){return e==null?e===void 0?Ge:Ae:re&&re in Object(e)?Be(e):He(e)}t(Je,"baseGetTag");oe.exports=Je});var ae=u((Mt,se)=>{"use strict";function Ue(e){return e!=null&&typeof e=="object"}t(Ue,"isObjectLike");se.exports=Ue});var ue=u((wt,ce)=>{"use strict";var Ve=ie(),Xe=ae(),ze="[object Symbol]";function Ke(e){return typeof e=="symbol"||Xe(e)&&Ve(e)==ze}t(Ke,"isSymbol");ce.exports=Ke});var me=u(($t,de)=>{"use strict";var Qe=X(),fe=R(),Ye=ue(),le=NaN,Ze=/^[-+]0x[0-9a-f]+$/i,et=/^0b[01]+$/i,tt=/^0o[0-7]+$/i,nt=parseInt;function rt(e){if(typeof e=="number")return e;if(Ye(e))return le;if(fe(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=fe(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Qe(e);var o=et.test(e);return o||tt.test(e)?nt(e.slice(2),o?2:8):Ze.test(e)?le:+e}t(rt,"toNumber");de.exports=rt});var be=u((Dt,ge)=>{"use strict";var ot=R(),N=G(),pe=me(),it="Expected a function",st=Math.max,at=Math.min;function ct(e,n,o){var s,a,l,f,i,m,p=0,S=!1,g=!1,T=!0;if(typeof e!="function")throw new TypeError(it);n=pe(n)||0,ot(o)&&(S=!!o.leading,g="maxWait"in o,l=g?st(pe(o.maxWait)||0,n):l,T="trailing"in o?!!o.trailing:T);function y(r){var d=s,b=a;return s=a=void 0,p=r,f=e.apply(b,d),f}t(y,"invokeFunc");function j(r){return p=r,i=setTimeout(C,n),S?y(r):f}t(j,"leadingEdge");function O(r){var d=r-m,b=r-p,v=n-d;return g?at(v,l-b):v}t(O,"remainingWait");function E(r){var d=r-m,b=r-p;return m===void 0||d>=n||d<0||g&&b>=l}t(E,"shouldInvoke");function C(){var r=N();if(E(r))return F(r);i=setTimeout(C,O(r))}t(C,"timerExpired");function F(r){return i=void 0,T&&s?y(r):(s=a=void 0,f)}t(F,"trailingEdge");function q(){i!==void 0&&clearTimeout(i),p=0,s=m=a=i=void 0}t(q,"cancel");function I(){return i===void 0?f:F(N())}t(I,"flush");function c(){var r=N(),d=E(r);if(s=arguments,a=this,m=r,d){if(i===void 0)return j(m);if(g)return clearTimeout(i),i=setTimeout(C,n),y(m)}return i===void 0&&(i=setTimeout(C,n)),f}return t(c,"debounced"),c.cancel=q,c.flush=I,c}t(ct,"debounce");ge.exports=ct});import{useState as lt,useCallback as dt}from"react";import{useFormContext as mt}from"react-hook-form";var ye=Te(be(),1);import{useCallback as ut,useEffect as ft,useRef as ve}from"react";function w(e,n){let o=ve(e);ft(()=>{o.current=e},[e]);let s=ve((0,ye.default)(a=>{o.current(a)},n)).current;return ut(a=>{s(a)},[s])}t(w,"useDebounce");import{Fragment as gt,jsx as h,jsxs as Ce}from"react/jsx-runtime";var pt=t(({description:e,showConversion:n,targetCurrency:o,className:s,onClick:a})=>{let{components:l}=$(),f=n?`Hide ${o} conversion`:`Show ${o} conversion`,i=l?.button;return Ce("span",{className:s,children:[e," ",i?h(i,{className:`${s.replace("-description","-button")}`,"data-type":"inline",onClick:a,children:f}):h("button",{className:`${s.replace("-description","-button")}`,onClick:a,children:f})]})},"DescriptionWithConversion"),Qt=t(({sourceCurrency:e,targetCurrency:n,conversionFieldName:o,conversionProperties:s,classNamePrefix:a,description:l,...f})=>{let[i,m]=lt(!1),{setValue:p,watch:S}=mt(),g=S(f.name),T=e&&n&&e!==n,{mutateAsync:y}=W(),j=dt(async(c,r,d,b)=>{if(c)try{let v=await y({source_currency:r,target_currency:d,amount:Number(c)});if(v.data?.data?.conversion_data?.target_amount){let L=v.data.data.conversion_data.target_amount;L&&p(b,L?.toString())}}catch(v){console.error("Error converting currency:",v)}},[y,p]),O=w(c=>j(c,e,n,o),500),E=w(c=>j(c,n,e,f.name),500),C=t(c=>{i&&O(c.target.value)},"handleMainFieldChange"),F=t(c=>{E(c.target.value)},"handleConversionFieldChange"),q=t(c=>{c.preventDefault(),m(r=>!r),!i&&g&&O(g)},"toggleConversion"),I=T?h(pt,{targetCurrency:n,description:l,showConversion:i,className:`${a}-description`,onClick:q}):l;return Ce(gt,{children:[h(P,{...f,additionalProps:{currency:e},description:I,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$",onChange:C}),i&&h(P,{additionalProps:{currency:n},name:o,label:s?.label||"Conversion",description:s?.description,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$",onChange:F})]})},"CurrencyConversionField");export{Qt as a};
2
+ //# sourceMappingURL=chunk-XMDNHTKE.js.map
@@ -1,2 +1,2 @@
1
- import{a as c}from"./chunk-7TOZZQQJ.js";import{a as m}from"./chunk-T6LHPVKN.js";import{a as r}from"./chunk-76CE6Z77.js";import{a as f}from"./chunk-U6PYTUGP.js";import{a as s}from"./chunk-EAORGT7Z.js";import{a}from"./chunk-MSBG52WO.js";import{a as p}from"./chunk-7ZH23EMZ.js";import{a as i}from"./chunk-FUIQ7D6L.js";import{a as S}from"./chunk-KFVOK5X5.js";import{a as n}from"./chunk-PGWKJ6FK.js";import{a as e}from"./chunk-CU75S5F2.js";import{a as t}from"./chunk-P37U34EQ.js";import{useId as w,useState as C}from"react";import{jsx as R}from"react/jsx-runtime";var H=t(({employmentId:d,companyId:b,countryCode:u,type:g="employee",skipSteps:B,render:l,options:v})=>{let O=w(),o=e({companyId:b,countryCode:u,employmentId:d,type:g,options:v,skipSteps:B}),[y,I]=C({showReserveInvoice:!1,showInviteSuccessful:!1});return R(n.Provider,{value:{formId:O,onboardingBag:o,creditScore:y,setCreditScore:I},children:l({onboardingBag:o,components:{BasicInformationStep:r,ContractDetailsStep:s,BenefitsStep:f,SubmitButton:i,SaveDraftButton:c,BackButton:a,OnboardingInvite:p,SelectCountryStep:m,ReviewStep:S}})})},"OnboardingFlow");export{H as a};
2
- //# sourceMappingURL=chunk-QXMSFJVB.js.map
1
+ import{a as c}from"./chunk-7TOZZQQJ.js";import{a as m}from"./chunk-CEIK7DGY.js";import{a as r}from"./chunk-3R33SVSF.js";import{a as f}from"./chunk-ISOKYXYN.js";import{a as s}from"./chunk-LPR2D3EY.js";import{a}from"./chunk-MSBG52WO.js";import{a as p}from"./chunk-7ZH23EMZ.js";import{a as i}from"./chunk-FUIQ7D6L.js";import{a as S}from"./chunk-KFVOK5X5.js";import{a as n}from"./chunk-PGWKJ6FK.js";import{a as e}from"./chunk-MNFM2TNK.js";import{a as t}from"./chunk-P37U34EQ.js";import{useId as w,useState as C}from"react";import{jsx as R}from"react/jsx-runtime";var H=t(({employmentId:d,companyId:b,countryCode:u,type:g="employee",skipSteps:B,render:l,options:v})=>{let O=w(),o=e({companyId:b,countryCode:u,employmentId:d,type:g,options:v,skipSteps:B}),[y,I]=C({showReserveInvoice:!1,showInviteSuccessful:!1});return R(n.Provider,{value:{formId:O,onboardingBag:o,creditScore:y,setCreditScore:I},children:l({onboardingBag:o,components:{BasicInformationStep:r,ContractDetailsStep:s,BenefitsStep:f,SubmitButton:i,SaveDraftButton:c,BackButton:a,OnboardingInvite:p,SelectCountryStep:m,ReviewStep:S}})})},"OnboardingFlow");export{H as a};
2
+ //# sourceMappingURL=chunk-YNQVZYFG.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-FJ2XPRKU.js";import"../../chunk-RXK4RLF6.js";import"../../chunk-AIEAUPO6.js";import"../../chunk-LX7QBDSF.js";import"../../chunk-QW4JPW6J.js";import"../../chunk-5SMMQQXP.js";import"../../chunk-WKK63LAY.js";import"../../chunk-PJBAQZ6G.js";import"../../chunk-CTTXXEWI.js";import"../../chunk-CSU6IQX3.js";import"../../chunk-MA4IML3T.js";import"../../chunk-2NLOH7NZ.js";import"../../chunk-XO3JWN33.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-RLETCEUU.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-TVZAFTPT.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as ContractAmendmentFlow};
1
+ import{a}from"../../chunk-EPLIVM3Y.js";import"../../chunk-RXK4RLF6.js";import"../../chunk-AIEAUPO6.js";import"../../chunk-LX7QBDSF.js";import"../../chunk-QW4JPW6J.js";import"../../chunk-5SMMQQXP.js";import"../../chunk-WKK63LAY.js";import"../../chunk-PJBAQZ6G.js";import"../../chunk-CTTXXEWI.js";import"../../chunk-CSU6IQX3.js";import"../../chunk-3QGKRPQ6.js";import"../../chunk-3BIRQAED.js";import"../../chunk-XO3JWN33.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-N6NYXAXH.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-TVZAFTPT.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as ContractAmendmentFlow};
2
2
  //# sourceMappingURL=ContractAmendmentFlow.js.map