@remoteoss/remote-flows 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/chunk-2VS6B3PC.js +2 -0
  2. package/dist/chunk-2VS6B3PC.js.map +1 -0
  3. package/dist/{chunk-AYJ63EZH.js → chunk-3AEKPMIN.js} +2 -2
  4. package/dist/{chunk-5GYCZAL7.js → chunk-3O2RD3RK.js} +2 -2
  5. package/dist/{chunk-HWNHP6LW.js → chunk-4B36XRKA.js} +2 -2
  6. package/dist/{chunk-CWTERQ45.js → chunk-53NFLDRX.js} +2 -2
  7. package/dist/{chunk-4ZOKJJZC.js → chunk-56DXHJNR.js} +2 -2
  8. package/dist/{chunk-AUZQY3AO.js → chunk-5BQOPJTQ.js} +2 -2
  9. package/dist/{chunk-O4F6PGGV.js → chunk-73H6SO2E.js} +2 -2
  10. package/dist/{chunk-C4RJTN2F.js → chunk-7C2Z2EE5.js} +2 -2
  11. package/dist/{chunk-O4OZANFQ.js → chunk-A522V6XF.js} +2 -2
  12. package/dist/{chunk-3JTDGPXD.js → chunk-A6EYY3FO.js} +2 -2
  13. package/dist/{chunk-JUGNVM2R.js → chunk-ALYKEN3E.js} +2 -2
  14. package/dist/{chunk-WQIPP2C3.js → chunk-BF2D5O5H.js} +2 -2
  15. package/dist/{chunk-DTGFQMCE.js → chunk-BFOGH4SF.js} +2 -2
  16. package/dist/{chunk-CNOIGOQQ.js → chunk-CEUBVUKV.js} +2 -2
  17. package/dist/{chunk-I52TUBVO.js → chunk-CYKK3LPJ.js} +2 -2
  18. package/dist/{chunk-HEKQK6TK.js → chunk-DBDVBJDV.js} +2 -2
  19. package/dist/{chunk-4YXQJD3M.js → chunk-JB55FFG6.js} +2 -2
  20. package/dist/{chunk-R6JC4SUO.js → chunk-MRMVBBVZ.js} +2 -2
  21. package/dist/{chunk-4WCT2ZCS.js → chunk-NGJXBBXW.js} +2 -2
  22. package/dist/chunk-NTEIOU72.js +2 -0
  23. package/dist/chunk-NTEIOU72.js.map +1 -0
  24. package/dist/{chunk-XCZYKOZU.js → chunk-OT2DXWYZ.js} +2 -2
  25. package/dist/chunk-PAQW5BFW.js +2 -0
  26. package/dist/chunk-PAQW5BFW.js.map +1 -0
  27. package/dist/{chunk-JQDP6SAT.js → chunk-PHN4XMPV.js} +2 -2
  28. package/dist/{chunk-LWAS3Y4S.js → chunk-QKKEFL4Z.js} +2 -2
  29. package/dist/{chunk-DHT7HDHC.js → chunk-QXPWESEW.js} +2 -2
  30. package/dist/{chunk-BPK3J436.js → chunk-RZTT3MEP.js} +2 -2
  31. package/dist/{chunk-Z7CHDOVN.js → chunk-TLC5WQY2.js} +2 -2
  32. package/dist/chunk-U4NWXPI5.js +2 -0
  33. package/dist/chunk-U4NWXPI5.js.map +1 -0
  34. package/dist/{chunk-N7DP4HY4.js → chunk-VFRHMNLJ.js} +2 -2
  35. package/dist/{chunk-N7DP4HY4.js.map → chunk-VFRHMNLJ.js.map} +1 -1
  36. package/dist/{chunk-DSTM5RRQ.js → chunk-ZOKSYPOP.js} +2 -2
  37. package/dist/chunk-ZSDJZMQW.js +2 -0
  38. package/dist/{chunk-KHNAQRGE.js.map → chunk-ZSDJZMQW.js.map} +1 -1
  39. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js +1 -1
  40. package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
  41. package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
  42. package/dist/flows/ContractAmendment/context.d.ts +1 -1
  43. package/dist/flows/ContractAmendment/hooks.js +1 -1
  44. package/dist/flows/ContractAmendment/index.js +1 -1
  45. package/dist/flows/ContractAmendment/utils.js +1 -1
  46. package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
  47. package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
  48. package/dist/flows/CostCalculator/components/SalaryField.d.ts +1 -1
  49. package/dist/flows/CostCalculator/components/SalaryField.js +1 -1
  50. package/dist/flows/CostCalculator/context.d.ts +1 -1
  51. package/dist/flows/CostCalculator/hooks.js +1 -1
  52. package/dist/flows/CostCalculator/index.d.ts +1 -1
  53. package/dist/flows/CostCalculator/index.js +1 -1
  54. package/dist/flows/CostCalculator/jsonSchema.d.ts +8 -0
  55. package/dist/flows/CostCalculator/jsonSchema.js +1 -1
  56. package/dist/flows/CostCalculator/utils.d.ts +1 -1
  57. package/dist/flows/CostCalculator/utils.js +1 -1
  58. package/dist/flows/Onboarding/OnboardingFlow.d.ts +1 -1
  59. package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
  60. package/dist/flows/Onboarding/api.d.ts +1 -1
  61. package/dist/flows/Onboarding/api.js +1 -1
  62. package/dist/flows/Onboarding/components/AnnualGrossSalary.d.ts +1 -1
  63. package/dist/flows/Onboarding/components/AnnualGrossSalary.js +1 -1
  64. package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
  65. package/dist/flows/Onboarding/components/BenefitsStep.d.ts +1 -1
  66. package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
  67. package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
  68. package/dist/flows/Onboarding/components/OnboardingForm.d.ts +1 -1
  69. package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
  70. package/dist/flows/Onboarding/components/OnboardingInvite.js +1 -1
  71. package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
  72. package/dist/flows/Onboarding/context.d.ts +1 -1
  73. package/dist/flows/Onboarding/hooks.d.ts +1 -1
  74. package/dist/flows/Onboarding/hooks.js +1 -1
  75. package/dist/flows/Onboarding/index.d.ts +1 -1
  76. package/dist/flows/Onboarding/index.js +1 -1
  77. package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
  78. package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
  79. package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
  80. package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
  81. package/dist/flows/Termination/TerminationFlow.js +1 -1
  82. package/dist/flows/Termination/TerminationForm.js +1 -1
  83. package/dist/flows/Termination/context.d.ts +1 -1
  84. package/dist/flows/Termination/hooks.js +1 -1
  85. package/dist/flows/Termination/index.js +1 -1
  86. package/dist/index.css +1 -1
  87. package/dist/index.css.map +1 -1
  88. package/dist/index.d.ts +2 -2
  89. package/dist/index.js +1 -1
  90. package/dist/index.js.map +1 -1
  91. package/dist/internals.js +1 -1
  92. package/dist/internals.js.map +1 -1
  93. package/dist/{remoteFlows-CBNrcwGZ.d.ts → remoteFlows-BLMhusyP.d.ts} +11 -1
  94. package/package.json +1 -1
  95. package/dist/chunk-4W2RKQYM.js +0 -2
  96. package/dist/chunk-4W2RKQYM.js.map +0 -1
  97. package/dist/chunk-KHNAQRGE.js +0 -2
  98. package/dist/chunk-MXFDOIUA.js +0 -2
  99. package/dist/chunk-MXFDOIUA.js.map +0 -1
  100. package/dist/chunk-O6SRXXVZ.js +0 -2
  101. package/dist/chunk-O6SRXXVZ.js.map +0 -1
  102. /package/dist/{chunk-AYJ63EZH.js.map → chunk-3AEKPMIN.js.map} +0 -0
  103. /package/dist/{chunk-5GYCZAL7.js.map → chunk-3O2RD3RK.js.map} +0 -0
  104. /package/dist/{chunk-HWNHP6LW.js.map → chunk-4B36XRKA.js.map} +0 -0
  105. /package/dist/{chunk-CWTERQ45.js.map → chunk-53NFLDRX.js.map} +0 -0
  106. /package/dist/{chunk-4ZOKJJZC.js.map → chunk-56DXHJNR.js.map} +0 -0
  107. /package/dist/{chunk-AUZQY3AO.js.map → chunk-5BQOPJTQ.js.map} +0 -0
  108. /package/dist/{chunk-O4F6PGGV.js.map → chunk-73H6SO2E.js.map} +0 -0
  109. /package/dist/{chunk-C4RJTN2F.js.map → chunk-7C2Z2EE5.js.map} +0 -0
  110. /package/dist/{chunk-O4OZANFQ.js.map → chunk-A522V6XF.js.map} +0 -0
  111. /package/dist/{chunk-3JTDGPXD.js.map → chunk-A6EYY3FO.js.map} +0 -0
  112. /package/dist/{chunk-JUGNVM2R.js.map → chunk-ALYKEN3E.js.map} +0 -0
  113. /package/dist/{chunk-WQIPP2C3.js.map → chunk-BF2D5O5H.js.map} +0 -0
  114. /package/dist/{chunk-DTGFQMCE.js.map → chunk-BFOGH4SF.js.map} +0 -0
  115. /package/dist/{chunk-CNOIGOQQ.js.map → chunk-CEUBVUKV.js.map} +0 -0
  116. /package/dist/{chunk-I52TUBVO.js.map → chunk-CYKK3LPJ.js.map} +0 -0
  117. /package/dist/{chunk-HEKQK6TK.js.map → chunk-DBDVBJDV.js.map} +0 -0
  118. /package/dist/{chunk-4YXQJD3M.js.map → chunk-JB55FFG6.js.map} +0 -0
  119. /package/dist/{chunk-R6JC4SUO.js.map → chunk-MRMVBBVZ.js.map} +0 -0
  120. /package/dist/{chunk-4WCT2ZCS.js.map → chunk-NGJXBBXW.js.map} +0 -0
  121. /package/dist/{chunk-XCZYKOZU.js.map → chunk-OT2DXWYZ.js.map} +0 -0
  122. /package/dist/{chunk-JQDP6SAT.js.map → chunk-PHN4XMPV.js.map} +0 -0
  123. /package/dist/{chunk-LWAS3Y4S.js.map → chunk-QKKEFL4Z.js.map} +0 -0
  124. /package/dist/{chunk-DHT7HDHC.js.map → chunk-QXPWESEW.js.map} +0 -0
  125. /package/dist/{chunk-BPK3J436.js.map → chunk-RZTT3MEP.js.map} +0 -0
  126. /package/dist/{chunk-Z7CHDOVN.js.map → chunk-TLC5WQY2.js.map} +0 -0
  127. /package/dist/{chunk-DSTM5RRQ.js.map → chunk-ZOKSYPOP.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as v}from"./chunk-GGBEM452.js";import{a as A}from"./chunk-QW4JPW6J.js";import{a as l,b as _}from"./chunk-AYJ63EZH.js";import{c as E,n as w,x as b}from"./chunk-EGQJ7UBR.js";import{a as M}from"./chunk-PJBAQZ6G.js";import{d}from"./chunk-3ZWDIEEM.js";import{a as j,c as S}from"./chunk-MXFDOIUA.js";import{a as t}from"./chunk-P37U34EQ.js";import{createHeadlessForm as I,modify as R}from"@remoteoss/json-schema-form";import{useMutation as Q,useQuery as B}from"@tanstack/react-query";var J=t(({countryCode:a,employment:r,fieldValues:n,options:e})=>{let{client:u}=d(),m=e?.jsonSchemaVersion?.contract_amendments?{json_schema_version:e.jsonSchemaVersion.contract_amendments}:{};return B({queryKey:["contract-amendment-schema"],retry:!1,queryFn:t(async()=>{let o=await E({client:u,headers:{Authorization:""},query:{employment_id:r?.data?.employment?.id,country_code:a,...m}});if(o.error||!o.data)throw new Error("Failed to fetch contract amendment schema");return o},"queryFn"),enabled:!!r,select:t(({data:o})=>{let c=o?.data||{};if(e&&e.jsfModify){let{schema:f}=R(c,e.jsfModify);c=f}let s={...n,annual_gross_salary:n?.annual_gross_salary?j(n?.annual_gross_salary):void 0},y=Object.keys(s).length>0;return I(c,{initialValues:y?s:_(r)})},"select")})},"useContractAmendmentSchemaQuery"),K=t(a=>{let{client:r}=d(),n=a?.jsonSchemaVersion?.contract_amendments?{json_schema_version:a.jsonSchemaVersion.contract_amendments}:{};return Q({mutationFn:t(e=>w({client:r,headers:{Authorization:""},body:e,query:{...n}}),"mutationFn")})},"useCreateContractAmendmentMutation"),U=t(a=>{let{client:r}=d(),n=a?.jsonSchemaVersion?.contract_amendments?{json_schema_version:a.jsonSchemaVersion.contract_amendments}:{};return Q({mutationFn:t(e=>b({client:r,headers:{Authorization:""},body:e,query:{...n}}),"mutationFn")})},"useAutomatableContractAmendmentMutation"),ae=t(({employmentId:a,countryCode:r,options:n})=>{let{fieldValues:e,setFieldValues:u,stepState:m,nextStep:o,previousStep:c}=M(l),{data:s,isLoading:y,isError:V,error:f}=v({employmentId:a}),{data:i,isLoading:q,isError:L,error:T}=J({employment:s,countryCode:r,fieldValues:{...m.values?.[m.currentStep.name],...e},options:n}),k=_(s,i?.fields),F=K(n),g=U(n);async function O(p){let h=S(p,i?.fields||[],{isPartialValidation:!1}),P={employment_id:s?.data.employment?.id,amendment_contract_id:s?.data.employment?.active_contract_id,contract_amendment:{...h}};switch(m.currentStep.name){case l.form.name:{let{mutateAsync:C}=A(g),H=await C(P);return o(),H}case l.confirmation_form.name:{let{mutateAsync:C}=A(F);return C(P)}default:throw new Error("Invalid step state")}}t(O,"onSubmit");function z(p){if(i){let h=S(p,i?.fields);return i?.handleValidation(h)}return null}t(z,"handleValidation");function x(){c()}return t(x,"back"),{stepState:m,fields:i?.fields||[],isLoading:y||q,isError:V||L,error:f||T,isSubmitting:g.isPending||F.isPending,initialValues:k,values:e,handleValidation:z,checkFieldUpdates:u,onSubmit:O,back:x}},"useContractAmendment");export{ae as a};
2
- //# sourceMappingURL=chunk-DHT7HDHC.js.map
1
+ import{a as v}from"./chunk-GGBEM452.js";import{a as A}from"./chunk-QW4JPW6J.js";import{a as l,b as _}from"./chunk-3AEKPMIN.js";import{c as E,n as w,x as b}from"./chunk-EGQJ7UBR.js";import{a as M}from"./chunk-PJBAQZ6G.js";import{d}from"./chunk-3ZWDIEEM.js";import{a as j,c as S}from"./chunk-PAQW5BFW.js";import{a as t}from"./chunk-P37U34EQ.js";import{createHeadlessForm as I,modify as R}from"@remoteoss/json-schema-form";import{useMutation as Q,useQuery as B}from"@tanstack/react-query";var J=t(({countryCode:a,employment:r,fieldValues:n,options:e})=>{let{client:u}=d(),m=e?.jsonSchemaVersion?.contract_amendments?{json_schema_version:e.jsonSchemaVersion.contract_amendments}:{};return B({queryKey:["contract-amendment-schema"],retry:!1,queryFn:t(async()=>{let o=await E({client:u,headers:{Authorization:""},query:{employment_id:r?.data?.employment?.id,country_code:a,...m}});if(o.error||!o.data)throw new Error("Failed to fetch contract amendment schema");return o},"queryFn"),enabled:!!r,select:t(({data:o})=>{let c=o?.data||{};if(e&&e.jsfModify){let{schema:f}=R(c,e.jsfModify);c=f}let s={...n,annual_gross_salary:n?.annual_gross_salary?j(n?.annual_gross_salary):void 0},y=Object.keys(s).length>0;return I(c,{initialValues:y?s:_(r)})},"select")})},"useContractAmendmentSchemaQuery"),K=t(a=>{let{client:r}=d(),n=a?.jsonSchemaVersion?.contract_amendments?{json_schema_version:a.jsonSchemaVersion.contract_amendments}:{};return Q({mutationFn:t(e=>w({client:r,headers:{Authorization:""},body:e,query:{...n}}),"mutationFn")})},"useCreateContractAmendmentMutation"),U=t(a=>{let{client:r}=d(),n=a?.jsonSchemaVersion?.contract_amendments?{json_schema_version:a.jsonSchemaVersion.contract_amendments}:{};return Q({mutationFn:t(e=>b({client:r,headers:{Authorization:""},body:e,query:{...n}}),"mutationFn")})},"useAutomatableContractAmendmentMutation"),ae=t(({employmentId:a,countryCode:r,options:n})=>{let{fieldValues:e,setFieldValues:u,stepState:m,nextStep:o,previousStep:c}=M(l),{data:s,isLoading:y,isError:V,error:f}=v({employmentId:a}),{data:i,isLoading:q,isError:L,error:T}=J({employment:s,countryCode:r,fieldValues:{...m.values?.[m.currentStep.name],...e},options:n}),k=_(s,i?.fields),F=K(n),g=U(n);async function O(p){let h=S(p,i?.fields||[],{isPartialValidation:!1}),P={employment_id:s?.data.employment?.id,amendment_contract_id:s?.data.employment?.active_contract_id,contract_amendment:{...h}};switch(m.currentStep.name){case l.form.name:{let{mutateAsync:C}=A(g),H=await C(P);return o(),H}case l.confirmation_form.name:{let{mutateAsync:C}=A(F);return C(P)}default:throw new Error("Invalid step state")}}t(O,"onSubmit");function z(p){if(i){let h=S(p,i?.fields);return i?.handleValidation(h)}return null}t(z,"handleValidation");function x(){c()}return t(x,"back"),{stepState:m,fields:i?.fields||[],isLoading:y||q,isError:V||L,error:f||T,isSubmitting:g.isPending||F.isPending,initialValues:k,values:e,handleValidation:z,checkFieldUpdates:u,onSubmit:O,back:x}},"useContractAmendment");export{ae as a};
2
+ //# sourceMappingURL=chunk-QXPWESEW.js.map
@@ -1,2 +1,2 @@
1
- import{a as r}from"./chunk-R6JC4SUO.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-BPK3J436.js.map
1
+ import{a as r}from"./chunk-MRMVBBVZ.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-RZTT3MEP.js.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-4ZOKJJZC.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-Z7CHDOVN.js.map
1
+ import{a as s}from"./chunk-56DXHJNR.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-TLC5WQY2.js.map
@@ -0,0 +1,2 @@
1
+ import{a as B}from"./chunk-ZTDKPUB5.js";import{a as ge,b as Ue,c as Ve,d as ze,e as Ge,f as Je,g as qe,h as Ke,i as Ye,j as ye,k as Xe,l as _e,m as ve,o as Ce,q as Qe,r as Ze,s as et}from"./chunk-ZSDJZMQW.js";import{b as je}from"./chunk-GP237GUO.js";import{b}from"./chunk-3ZWDIEEM.js";import{a as he,b as $}from"./chunk-7VUILYZ3.js";import{a as oe,b as re,c as x,d as We,e as Le,f as He,g as Ae,h as k,i as w,j as N,k as P,l as R,m as D}from"./chunk-3BREUYLG.js";import{g as Be}from"./chunk-PAQW5BFW.js";import{a as y,e as Oe}from"./chunk-3LOVCTCN.js";import{a as r}from"./chunk-P37U34EQ.js";import{Fragment as Ht,jsx as O,jsxs as ae}from"react/jsx-runtime";function ne({name:e,defaultValue:t,description:a,label:o,onChange:l,multiple:d,options:c,component:F,...f}){let{components:i}=b(),{control:n}=x(),u=r((m,s,g)=>{let p=g.value?[...g.value]:[];s?p.includes(m)||g.onChange([...p,m]):g.onChange(p.filter(h=>h!==m))},"handleCheckboxChange");return O(k,{control:n,name:e,defaultValue:t,render:({field:m,fieldState:s})=>{let g=F||i?.checkbox;if(g){let p={name:e,description:a,label:o,defaultValue:t,multiple:d,options:c,...f};return O(g,{field:{...m,onChange:r(h=>{if(d){let{checked:S,value:C}=h.target;u(C,S,m),l?.(S);return}m.onChange(h),l?.(h)},"onChange")},fieldState:s,fieldData:p})}return ae(w,{"data-field":e,className:y(`RemoteFlows__CheckBoxField__Item__${e}`),children:[O(P,{children:ae(Ht,{children:[c&&d?O(N,{children:o}):null,c&&d?c.map(p=>ae("div",{className:"flex space-x-2",children:[O(ge,{id:p.value,onCheckedChange:h=>{u(p.value,h===!0,m),l?.(h,p.value)},checked:m.value?.includes(p.value),className:"RemoteFlows__CheckBox__Input"}),O(N,{htmlFor:p.value,className:"mb-0 RemoteFlows__CheckBox__Label",children:p.label})]},p.value)):ae("div",{className:"flex space-x-2",children:[O(ge,{id:e,onCheckedChange:p=>{m.onChange(p),l?.(p)},checked:m.value,className:"RemoteFlows__CheckBox__Input"}),O(N,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label",children:o})]})]})}),a&&O(R,{children:a}),s.error&&O(D,{})]})}})}r(ne,"CheckBoxField");import{CalendarIcon as Ut}from"lucide-react";import{PopoverClose as Vt}from"@radix-ui/react-popover";import{ChevronLeft as Bt,ChevronRight as Ot}from"lucide-react";import{DayPicker as At}from"react-day-picker";import{jsx as xe}from"react/jsx-runtime";function tt({className:e,classNames:t,showOutsideDays:a=!0,...o}){return xe(At,{showOutsideDays:a,className:y("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:y(he({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:y("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",o.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:y(he({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:r(({className:l,...d})=>xe(Bt,{className:y("size-4",l),...d}),"IconLeft"),IconRight:r(({className:l,...d})=>xe(Ot,{className:y("size-4",l),...d}),"IconRight")},...o})}r(tt,"Calendar");import*as A from"@radix-ui/react-popover";import{jsx as se}from"react/jsx-runtime";function le({...e}){return se(A.Root,{"data-slot":"popover",...e})}r(le,"Popover");function ie({...e}){return se(A.Trigger,{"data-slot":"popover-trigger",...e})}r(ie,"PopoverTrigger");function me({className:e,align:t="center",sideOffset:a=4,...o}){return se(A.Portal,{children:se(A.Content,{"data-slot":"popover-content",align:t,sideOffset:a,className:y("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...o})})}r(me,"PopoverContent");import{format as ot}from"date-fns";import{Fragment as zt,jsx as E,jsxs as be}from"react/jsx-runtime";function rt({description:e,label:t,name:a,minDate:o,onChange:l,component:d,...c}){let{components:F}=b(),{control:f}=x(),i;return c.meta?.mot&&typeof c.meta.mot=="number"?i=Be(c.meta.mot):o&&(i=new Date(o)),E(k,{control:f,name:a,render:({field:n,fieldState:u})=>{let m=d||F?.date;if(m){let s={description:e,label:t,name:a,onChange:l,...i&&{minDate:i.toISOString()},...c};return E(m,{field:{...n,onChange:r(g=>{n.onChange(g),l?.(g)},"onChange")},fieldState:u,fieldData:s})}return be(w,{"data-field":a,className:`flex flex-col RemoteFlows__DatePickerField__Item__${a}`,children:[E(N,{className:"RemoteFlows__DatePickerField__Label",children:t}),be(le,{children:[E(ie,{asChild:!0,children:E(P,{children:E("div",{children:be($,{type:"button",variant:"outline",className:y("w-full pl-3 text-left font-normal",!n.value&&"text-muted-foreground"),"data-testid":`date-picker-button-${a}`,children:[n.value&&E(zt,{children:ot(n.value,"yyyy-MM-dd")}),E(Ut,{className:"ml-auto h-4 w-4 opacity-50"})]})})})}),E(me,{className:"w-auto p-0 RemoteFlows__DatepickerField__PopoverContent",align:"start",children:E(tt,{mode:"single",className:"RemoteFlows__DatepickerField__Calendar",selected:n.value?new Date(n.value):void 0,onSelect:s=>{n.onChange(s?ot(s,"yyyy-MM-dd"):null),l?.(s)},defaultMonth:i,components:{DayContent:r(s=>E(Vt,{children:s.date.getDate()}),"DayContent")},...i&&{disabled:r(s=>s<i,"disabled")}})})]}),e?E(R,{children:e}):null,u.error&&E(D,{className:"RemoteFlows__DatePickerField__Error"})]})}})}r(rt,"DatePickerField");import{useState as Gt,useRef as Jt}from"react";import{Upload as qt,X as Kt}from"lucide-react";import{jsx as U,jsxs as Se}from"react/jsx-runtime";function at({onChange:e,className:t,multiple:a}){let[o,l]=Gt([]),d=Jt(null),c=r(i=>{i.preventDefault(),d.current?.click()},"handleClick"),F=r(i=>{if(i.target.files&&i.target.files.length>0){let n=Array.from(i.target.files);l(n),e(i)}},"handleChange"),f=r(i=>{l(n=>n.filter(u=>u!==i))},"onRemoveFile");return Se("div",{className:y("flex flex-col items-start gap-4",t),children:[U("input",{type:"file",ref:d,onChange:F,className:"hidden","aria-label":"File upload",multiple:a}),Se($,{type:"button",onClick:c,className:"gap-2",children:[U(qt,{className:"h-4 w-4"}),"Choose File"]}),o.length===0&&U("div",{className:"text-sm",children:a?U("span",{className:"font-medium",children:"No files selected. You can select multiple files"}):U("span",{className:"font-medium",children:"No file selected."})}),o.length>0&&o.map((i,n)=>Se("div",{className:"text-sm flex items-center gap-2",children:["Selected file: ",U("span",{className:"font-medium",children:i.name})," (",Math.round(i.size/1024)," KB)",U($,{variant:"ghost",onClick:()=>f(i),children:U(Kt,{})})]},n))]})}r(at,"FileUploader");import{jsx as V,jsxs as jt}from"react/jsx-runtime";var Yt=r(e=>new Promise((t,a)=>{let o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result),o.onerror=l=>a(l)}),"toBase64"),nt=r(async e=>{let t=e.target.files?Array.from(e.target.files):[];return await Promise.all(t.map(async o=>{let l=await Yt(o);return{name:o.name,content:l.split(",")[1]}}))},"convertFilesToBase64");function st({name:e,description:t,label:a,multiple:o,onChange:l,component:d,...c}){let{components:F}=b(),{control:f}=x();return V(k,{control:f,name:e,render:({field:i,fieldState:n})=>{let u=d||F?.file;if(u){let m={name:e,description:t,label:a,multiple:o,...c};return V(u,{field:{...i,value:null,onChange:r(async s=>{let g=await nt(s);i.onChange(g),l?.(g)},"onChange")},fieldState:n,fieldData:m})}return jt(w,{"data-field":e,className:`RemoteFlows__FileUpload__Item__${e}`,children:[V(N,{className:"RemoteFlows__FileUpload__Label",children:a}),V(P,{children:V(at,{onChange:async m=>{let s=await nt(m);i.onChange(s),l?.(s)},multiple:o,className:y("RemoteFlows__FileUpload__Input")})}),t&&V("div",{className:"flex items-center justify-between",children:V(R,{className:"RemoteFlows__FileUpload__Description",children:t})}),n.error&&V(D,{className:"RemoteFlows__FileUpload__Error"})]})}})}r(st,"FileUploadField");import{jsx as ke}from"react/jsx-runtime";function de(e){let{components:t}=b(),{control:a}=x(),o=e.component||t?.number;return o?ke(k,{control:a,name:e.name,render:({field:l,fieldState:d})=>ke(o,{field:{...l,onChange:r(c=>{l.onChange(c),e.onChange?.(c)},"onChange")},fieldState:d,fieldData:e})}):ke(B,{...e,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$"})}r(de,"NumberField");import{Fragment as Xt}from"react";import{jsx as W,jsxs as Ne}from"react/jsx-runtime";function lt({name:e,defaultValue:t,description:a,label:o,options:l,onChange:d,component:c,...F}){let{components:f}=b(),{control:i}=x();return W(k,{control:i,name:e,defaultValue:t,render:({field:n,fieldState:u})=>{let m=c||f?.radio;if(m){let s={name:e,defaultValue:t,description:a,label:o,options:l,...F};return W(m,{field:{...n,onChange:r(g=>{n.onChange(g),d?.(g)},"onChange")},fieldState:u,fieldData:s})}return Ne(w,{className:y("space-y-3",`RemoteFlows__RadioGroupField__Item__${e}`),"data-field":e,children:[W(N,{children:o}),W(P,{children:W(Ue,{"aria-label":o||e,onValueChange:s=>{n.onChange(s),d?.(s)},value:n.value,className:"flex flex-col space-y-3",children:l?.map(s=>W(Xt,{children:Ne(w,{"data-field":e,className:"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item",children:[W(P,{children:W(Ve,{value:s.value,className:"RemoteFlows__RadioField__Input",disabled:s.disabled})}),Ne("div",{children:[W(N,{className:"font-normal mb-0 RemoteFlows__RadioField__Label",children:s.label}),s.description&&W(R,{className:"mt-2",children:s.description})]})]})},s.value))})}),a&&W(R,{children:a}),u.error&&W(D,{})]})}})}r(lt,"RadioGroupField");import{jsx as M,jsxs as it}from"react/jsx-runtime";function mt({label:e,name:t,options:a,defaultValue:o,description:l,onChange:d,component:c,...F}){let{control:f}=x(),{components:i}=b();return M(k,{defaultValue:o,control:f,name:t,render:({field:n,fieldState:u})=>{let m=c||i?.select;if(m){let s={label:e,name:t,options:a,defaultValue:o,description:l,onChange:d,...F};return M(m,{field:{...n,onChange:r(g=>{let p=F.jsonType==="number"?Number(g):g;n.onChange(p),d?.(p)},"onChange")},fieldState:u,fieldData:s})}return it(w,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[M(N,{className:"RemoteFlows__SelectField__Label",children:e}),M(P,{children:M("div",{className:"relative",children:it(ze,{value:n.value||"",onValueChange:s=>{let g=F.jsonType==="number"?Number(s):s;n.onChange(g),d?.(g)},children:[M(qe,{className:"RemoteFlows__SelectField__Trigger","aria-invalid":!!u.error,"aria-label":e,children:M("span",{className:"absolute",children:M(Je,{placeholder:e})})}),M(Ke,{className:"RemoteFlows__SelectField__Content",children:M(Ge,{className:"RemoteFlows__SelectField__Group",children:a.map(s=>M(Ye,{value:s.value,className:"RemoteFlows__SelectField__SelectItem",children:s.label},s.value))})})]})})}),l&&M(R,{children:l}),u.error&&M(D,{})]})}})}r(mt,"SelectField");import{useState as ro}from"react";import{Fragment as Qt,useState as Zt}from"react";import{Check as eo,ChevronDownIcon as to,X as oo}from"lucide-react";import{Command as Y}from"cmdk";import{SearchIcon as jr}from"lucide-react";import{jsx as j,jsxs as ea}from"react/jsx-runtime";function dt({className:e,...t}){return j(Y,{"data-slot":"command",className:y("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}r(dt,"Command");function ct({className:e,...t}){return j(Y.List,{"data-slot":"command-list",className:y("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}r(ct,"CommandList");function ut({...e}){return j(Y.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}r(ut,"CommandEmpty");function pt({className:e,...t}){return j(Y.Group,{"data-slot":"command-group",className:y("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}r(pt,"CommandGroup");function ft({className:e,...t}){return j(Y.Separator,{"data-slot":"command-separator",className:y("bg-border -mx-1 h-px",e),...t})}r(ft,"CommandSeparator");function Ft({className:e,...t}){return j(Y.Item,{"data-slot":"command-item",className:y("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}r(Ft,"CommandItem");import{jsx as L,jsxs as X}from"react/jsx-runtime";function ce({options:e,selected:t,onChange:a,placeholder:o,...l}){let[d,c]=Zt(!1),F=r(n=>{a(t.filter(u=>u.value!==n.value))},"handleUnselect"),f=e.some(n=>n.category),i=e.reduce((n,u)=>{let m=u.category||"Uncategorized";return n[m]||(n[m]=[]),n[m].push(u),n},{});return X(le,{open:d,onOpenChange:c,...l,children:[L(ie,{children:X($,{variant:"outline",role:"combobox","aria-expanded":d,className:"w-full justify-between font-normal",type:"button",children:[L("div",{className:"flex gap-1 flex-wrap overflow-x-auto max-h-[2.5rem] items-center",children:t.length>0?t.map(n=>X(je,{variant:"secondary",className:"mr-1 mb-1",children:[n.label,L("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:u=>{u.key==="Enter"&&F(n)},onMouseDown:u=>{u.preventDefault(),u.stopPropagation()},onClick:()=>F(n),children:L(oo,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},n.label)):L("span",{className:"text-foreground",children:o})}),L(to,{className:"size-4"})]})}),L(me,{align:"start",className:"w-full p-0",children:L(dt,{children:X(ct,{children:[L(ut,{children:"No item found."}),Object.entries(i).map(([n,u],m)=>X(Qt,{children:[m>0&&L(ft,{}),L(pt,{heading:f?n:void 0,children:u.map(s=>{let g=t.some(p=>p.value===s.value);return X(Ft,{onSelect:()=>{a(g?t.filter(p=>p.value!==s.value):[...t,s])},children:[L(eo,{className:y("mr-2 h-4 w-4",g?"opacity-100":"opacity-0")}),s.label]},s.label)})})]},n))]})})})]})}r(ce,"MultiSelect");import{jsx as J,jsxs as ao}from"react/jsx-runtime";function gt({label:e,name:t,options:a,defaultValue:o,description:l,onChange:d,$meta:c,component:F,...f}){let{control:i}=x(),{components:n}=b(),[u,m]=ro([]);return J(k,{defaultValue:o,control:i,name:t,render:({field:s,fieldState:g})=>{let p=F||n?.countries;if(p){let C={label:e,name:t,options:a,defaultValue:o,description:l,onChange:d,$meta:c,...f};return J(p,{field:{...s,onChange:r(T=>{s.onChange(T),d?.(T)},"onChange")},fieldState:g,fieldData:C})}let h=[...Object.entries(c?.regions||{}).map(([C,T])=>({value:T,label:C,category:"Regions"})),...Object.entries(c?.subregions||{}).map(([C,T])=>({value:T,label:C,category:"Subregions"})),...a.map(C=>({...C,value:C.value,label:C.label,category:"Countries"}))],S=r(C=>{let T=C.map(({value:G})=>G);s.onChange(T),d?.(T),m(C)},"handleChange");return ao(w,{"data-field":t,className:`RemoteFlows__CountryField__Item__${t}`,children:[J(N,{className:"RemoteFlows__CountryField__Label",children:e}),J(P,{children:J(ce,{options:h,selected:u,onChange:S,...f})}),l&&J(R,{children:l}),g.error&&J(D,{})]})}})}r(gt,"CountryField");import*as ht from"react";import{jsx as no}from"react/jsx-runtime";var we=ht.forwardRef(({className:e,...t},a)=>no("textarea",{className:y("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:a,...t}));we.displayName="Textarea";import{jsx as q,jsxs as Pe}from"react/jsx-runtime";function yt({name:e,description:t,label:a,onChange:o,maxLength:l,component:d,...c}){let{components:F}=b(),{control:f}=x();return q(k,{control:f,name:e,render:({field:i,fieldState:n})=>{let u=d||F?.textarea;if(u){let s={name:e,description:t,label:a,maxLength:l,...c};return q(u,{field:{...i,onChange:r(g=>{i.onChange(g),o?.(g)},"onChange")},fieldState:n,fieldData:s})}let m=i.value?.length??0;return Pe(w,{"data-field":e,className:`RemoteFlows__TextArea__Item__${e}`,children:[q(N,{className:"RemoteFlows__TextArea__Label",children:a}),q(P,{children:q(we,{...i,value:i.value??"",onChange:s=>{i.onChange(s),o?.(s)},className:y(n.error&&"border-red-500 focus-visible:ring-red-500","RemoteFlows__TextArea__Input"),placeholder:a})}),(t||l)&&Pe("div",{className:"flex items-center justify-between",children:[t&&q(R,{className:"RemoteFlows__TextArea__Description",children:t}),l&&Pe("span",{className:"text-sm ml-auto RemoteFlows__TextArea__MaxLength",children:[m,"/",l]})]}),n.error&&q(D,{className:"RemoteFlows__TextArea__Error"})]})}})}r(yt,"TextAreaField");import{jsx as Re}from"react/jsx-runtime";function _t(e){let{components:t}=b(),{control:a}=x(),o=e.component||t?.email;return o?Re(k,{control:a,name:e.name,render:({field:l,fieldState:d})=>Re(o,{field:{...l,onChange:r(c=>{l.onChange(c),e.onChange?.(c)},"onChange")},fieldState:d,fieldData:e})}):Re(B,{...e,type:"email"})}r(_t,"EmailField");import{jsx as vt}from"react/jsx-runtime";function Ct(e){let{control:t}=x();return vt(k,{control:t,name:e.name,render:({field:a})=>vt("input",{...a,type:"hidden"})})}r(Ct,"HiddenField");import po,{useEffect as fo,useState as Dt}from"react";var xt=r((e,t,a)=>{if(e&&"reportValidity"in e){let o=oe(a,t);e.setCustomValidity(o&&o.message||""),e.reportValidity()}},"r"),De=r((e,t)=>{for(let a in t.fields){let o=t.fields[a];o&&o.ref&&"reportValidity"in o.ref?xt(o.ref,a,e):o&&o.refs&&o.refs.forEach(l=>xt(l,a,e))}},"o"),St=r((e,t)=>{t.shouldUseNativeValidation&&De(e,t);let a={};for(let o in e){let l=oe(t.fields,o),d=Object.assign(e[o]||{},{ref:l&&l.ref});if(so(t.names||Object.keys(e),o)){let c=Object.assign({},oe(a,o));re(c,"root",d),re(a,o,c)}else re(a,o,d)}return a},"s"),so=r((e,t)=>{let a=bt(t);return e.some(o=>bt(o).match(`^${a}\\.\\d+`))},"i");function bt(e){return e.replace(/\]|\[/g,"")}r(bt,"n");function kt(e,t,a){return t===void 0&&(t={}),a===void 0&&(a={}),function(o,l,d){try{return Promise.resolve(function(c,F){try{var f=(t.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e[a.mode==="sync"?"validateSync":"validate"](o,Object.assign({abortEarly:!1},t,{context:l}))).then(function(i){return d.shouldUseNativeValidation&&De({},d),{values:a.raw?Object.assign({},o):i,errors:{}}}))}catch(i){return F(i)}return f&&f.then?f.then(void 0,F):f}(0,function(c){if(!c.inner)throw c;return{values:{},errors:St((F=c,f=!d.shouldUseNativeValidation&&d.criteriaMode==="all",(F.inner||[]).reduce(function(i,n){if(i[n.path]||(i[n.path]={message:n.message,type:n.type}),f){var u=i[n.path].types,m=u&&u[n.type];i[n.path]=We(n.path,f,i,n.type,m?[].concat(m,n.message):n.message)}return i},{})),d)};var F,f}))}catch(c){return Promise.reject(c)}}}r(kt,"o");import*as I from"yup";import Nt from"lodash.groupby";import Q from"lodash.capitalize";var wt=60,ue=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function lo(e){if(e<60)return`${e}m`;let t=Math.floor(e/wt),a=e%wt;return a>0?`${t}h${a}m`:`${t}h`}r(lo,"convertBreakDurationToHours");function Pt(e){let t=e.reduce((a,o)=>o.hours+a,0);return Number(t.toFixed(2))}r(Pt,"calculateTotalWorkHours");function io(e,t){let a=t.map(({day:d})=>d.toLowerCase()),o=a.indexOf(e),l=null;for(;o<a.length&&!l;){let d=a[o],c=a[o+1],F=ue.indexOf(d)+1;ue[F]===c||(l=d),o+=1}return l}r(io,"findLastConsecutiveDay");function mo(e){return e.start_time&&e.end_time&&(typeof e.hours=="number"?e.hours:Number.parseInt(e.hours))>0}r(mo,"shouldSummarizeSchedule");function co(e){return Number.parseInt(e.break_duration_minutes)>0}r(co,"shouldSummarizeBreaks");function Rt(e){let t=e.filter(mo),a=Nt(t,F=>`${F.start_time}|${F.end_time}`),o=e.filter(co),l=Nt(o,"break_duration_minutes"),d=Object.keys(a).map(F=>{let f=a[F],i=f[0].day,[n,u]=F.split("|"),m=`from <span>${n.replace(":","h")}</span> to <span>${u.replace(":","h")}</span>`,s=io(i,f),p=(s?f.findIndex(h=>h.day===s):-1)===f.length-1;return f.length===1?`${Q(i)}, ${m}`:!p||!s?f.reduce((h,S,C)=>{let T=Q(S.day);return C===f.length-1?`${h}and ${T}, ${m}`:`${h}<span>${T}</span>, `},""):`<span>${Q(i)}</span> to <span>${Q(s)}</span>, ${m}`}),c=Object.keys(l).reverse().map((F,f)=>{let i=f===0,n=l[F],u=lo(parseInt(F,10));if(Object.keys(l).length===1)return`With ${u} daily breaks`;if(n.length===1){let m=`${u} break on ${Q(n[0].day)}.`;return i?`With ${m}`:m}return n.reduce((m,s,g)=>{let p=Q(s.day);return g===0?`${m} ${p}`:g===n.length-1?`${m}, and ${p}.`:`${m}, ${p}`},i?`With ${u} break on`:`${u} break on`)});return{workHoursSummary:d,breakSummary:c}}r(Rt,"buildWorkScheduleSummary");function Te(e){let{checked:t,start_time:a,end_time:o,break_duration_minutes:l}=e;if(!t)return 0;let[d,c]=a.split(":").map(Number),[F,f]=o.split(":").map(Number),i=d*60+c,m=(F*60+f-i-Number.parseInt(l||"0"))/60;return m===Math.floor(m)?m:Number(m.toFixed(2))}r(Te,"calculateHours");var uo={monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat",sunday:"Sun"};function pe(e){return uo[e]}r(pe,"getShortWeekday");import{jsx as _,jsxs as H}from"react/jsx-runtime";var Fo=I.object({day:I.string().required(),checked:I.boolean().required(),start_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:r(e=>e.required("Required"),"then"),otherwise:r(e=>e.optional().nullable(),"otherwise")}),end_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:r(e=>e.required("Required"),"then"),otherwise:r(e=>e.optional().nullable(),"otherwise")}),hours:I.number().default(0),break_duration_minutes:I.string().default("0")}),go=I.object({schedule:I.array(Fo)});function ho({defaultSchedule:e,onSubmit:t}){let[a,o]=Dt(!1),l=ue.map(p=>{let h=e.find(S=>S.day.toLowerCase()===pe(p).toLowerCase()||S.day.toLowerCase()===p.toLowerCase());return h?{...h,day:pe(p),checked:!0}:{...e[0],checked:!1,day:pe(p)}}),d=He({defaultValues:{schedule:l},resolver:kt(go)}),{handleSubmit:c,watch:F,reset:f,control:i,formState:n}=d,{fields:u}=Le({name:"schedule",control:i}),m=F("schedule");function s(p){let h=p.schedule.filter(({checked:S})=>S).map(S=>({...S,hours:Te(S)}));t(h),o(!1)}r(s,"handleSubmitWorkingHours");function g(){f(),o(!1)}return r(g,"handleCancel"),_("div",{className:"flex items-center justify-between",children:H(ye,{open:a,onOpenChange:o,children:[_(Xe,{asChild:!0,children:_($,{variant:"link",className:"flex items-center p-0 RemoteFlows__WorkScheduleSelectionForm__Trigger",children:"Edit Schedule"})}),H(_e,{className:"max-w-5xl max-h-[90vh] overflow-y-auto px-8 py-4 RemoteFlows__WorkScheduleSelectionForm__Content",children:[_(ve,{children:_(Ce,{className:"RemoteFlows__WorkScheduleSelectionForm__Title",children:"Edit employee working hours"})}),_(Ae,{...d,children:H("form",{className:"space-y-4 RemoteFlows__WorkScheduleSelectionForm__Form",children:[H("div",{className:"rounded-lg",children:[_("p",{className:"text-gray-600 text-sm mb-4 RemoteFlows__WorkScheduleSelectionForm__Description",children:"The times displayed are in the employee's time zone in the 24-hour format."}),H("div",{className:"grid grid-cols-12 gap-4 text-sm font-medium text-gray-500 uppercase tracking-wide RemoteFlows__WorkScheduleSelectionForm__Header",children:[_("div",{className:"col-span-2"}),_("div",{className:"col-span-3 text-center",children:"START"}),_("div",{className:"col-span-1 text-center"}),_("div",{className:"col-span-3 text-center",children:"END"}),_("div",{className:"col-span-2 text-center",children:"HOURS"})]}),_("div",{className:"RemoteFlows__WorkScheduleSelectionForm__Rows",children:u.map((p,h)=>{let S=m[h],C=Te(S);return H(po.Fragment,{children:[H("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Hours",children:[_("div",{className:"col-span-2 flex items-center gap-3",children:_(ne,{label:p.day,name:`schedule.${h}.checked`})}),_("div",{className:"col-span-3",children:_(B,{name:`schedule.${h}.start_time`,includeErrorMessage:!1})}),_("div",{className:"col-span-1 text-center text-gray-500",children:"to"}),_("div",{className:"col-span-3",children:_(B,{name:`schedule.${h}.end_time`,includeErrorMessage:!1})}),_("div",{className:"col-span-2 text-center text-gray-600",children:isNaN(C)?"-":`${C} hours`})]}),H("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Break",children:[_("div",{className:"col-span-2 text-gray-500",children:"Break"}),_("div",{className:"col-span-2",children:_(B,{name:`schedule.${h}.break_duration_minutes`,includeErrorMessage:!1})}),_("div",{className:"col-span-2 text-gray-500",children:"minutes"}),_("div",{className:"col-span-4"})]})]},p.id)})})]}),Object.keys(n.errors).length>0&&_("p",{className:"text-destructive text-sm mb-0",children:"Invalid time format (HH:mm)"}),H("div",{className:"flex gap-4 pt-4",children:[_($,{type:"button",className:"reset-button",variant:"outline",onClick:g,children:"Cancel"}),_($,{type:"button",className:"submit-button",onClick:c(s),children:"Save Schedule"})]})]})})]})]})})}r(ho,"WorkScheduleSelectionForm");function Tt(e){let{components:t}=b(),{setValue:a,control:o,watch:l}=x(),d=l(e.name),[c,F]=Dt(d),{workHoursSummary:f,breakSummary:i}=Rt(c),n=Pt(c);fo(()=>{a(e.name,c)},[c,e.name,a]);function u(s){F(s)}r(u,"onSubmit");let m=e.component||t?.["work-schedule"];return m?_(k,{control:o,name:e.name,render:({field:s,fieldState:g})=>_(m,{field:{...s,onChange:r(p=>{s.onChange(p),e.onChange?.(p)},"onChange")},fieldState:g,fieldData:{...e,defaultFormattedValue:{workHoursSummary:f,breakSummary:i,totalWorkHours:n}}})}):H("div",{className:"flex flex-col gap-3 RemoteFlows__WorkScheduleField",children:[_("p",{className:"text-sm RemoteFlows__WorkScheduleField__Title",children:"Work hours"}),H("div",{className:"flex flex-col gap-1 RemoteFlows__WorkScheduleField__Summary",children:[_("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__WorkHours",dangerouslySetInnerHTML:{__html:f.join(", ")}}),_("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Break",children:i.join()}),H("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Total",children:["Total of ",_("span",{children:n})," hours per week"]}),_(ho,{defaultSchedule:c,onSubmit:u})]})]})}r(Tt,"WorkScheduleField");import{useState as yo}from"react";import{jsx as K,jsxs as _o}from"react/jsx-runtime";function It({label:e,name:t,options:a,defaultValue:o,description:l,onChange:d,component:c,...F}){let{control:f}=x(),{components:i}=b(),[n,u]=yo();return K(k,{defaultValue:o,control:f,name:t,render:({field:m,fieldState:s})=>{let g=c||i?.["multi-select"];if(g){let h={label:e,name:t,options:a,defaultValue:o,description:l,onChange:d,...F};return K(g,{field:{...m,onChange:r(S=>{m.onChange(S),d?.(S)},"onChange")},fieldState:s,fieldData:h})}let p=n||a.filter(h=>m.value.includes(h.value));return _o(w,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[K(N,{className:"RemoteFlows__SelectField__Label",children:e}),K(P,{children:K(ce,{options:a,selected:p,onChange:h=>{let S=h.map(({value:C})=>C);m.onChange(S),d?.(S),u(h)},...F})}),l&&K(R,{children:l}),s.error&&K(D,{})]})}})}r(It,"MultiSelectField");import{jsx as vo}from"react/jsx-runtime";var $t=r(e=>vo(de,{maxLength:15,...e}),"MoneyField");var Ie={checkbox:ne,text:B,email:_t,money:$t,select:mt,"multi-select":It,radio:lt,number:de,file:st,date:rt,textarea:yt,countries:gt,hidden:Ct,"work-schedule":Tt};import{AlertCircle as Co}from"lucide-react";import{jsx as fe,jsxs as xo}from"react/jsx-runtime";function Et({title:e,description:t,severity:a}){let{components:o}=b();if(o?.statement){let l=o?.statement;return fe(l,{data:{title:e,description:t,severity:a}})}return xo(Qe,{variant:"warning",children:[fe(Co,{className:"h-4 w-4"}),e&&fe(Ze,{children:e}),fe(et,{children:t})]})}r(Et,"Statement");import{Fragment as bo,useEffect as So,useRef as Mt}from"react";import{jsx as z,jsxs as ee}from"react/jsx-runtime";var ko=r(({isExpanded:e,onToggle:t,className:a,...o})=>z($,{type:"button",className:y("RemoteFlows__Button RemoteFlows__FieldSetField__ToggleButton",a),variant:"default",onClick:t,...o,children:e?"Remove":"Define"}),"DefaultToggleButton");function ns({label:e,name:t,fields:a,description:o,components:l,statement:d,isFlatFieldset:c,extra:F,variant:f="outset",features:i}){let{watch:n,setValue:u,trigger:m,formState:s}=x(),{components:g}=b(),p=i?.toggle?.stateField,h=p?n(p):i?.toggle?.defaultExpanded??!0,S=a.map(({name:v})=>`${t}.${v}`),C=n(S),T=Mt(C),G=Mt(null),Wt=r(()=>{p&&u(p,!h)},"toggleExpanded");So(()=>{let v=C,te=T.current,Fe=s.isSubmitted||s.submitCount>0,Me=!1;for(let Z=0;Z<v.length;Z++)if(v[Z]!==void 0&&te[Z]!==v[Z]){Me=!0;break}return Me&&Fe&&(G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{m()},50)),T.current=[...v],()=>{G.current&&clearTimeout(G.current)}},[C,m,s.isSubmitted,s.submitCount]);let Lt=g?.fieldsetToggle||ko,$e=`${t}-content`,Ee=`${t}-header`;return ee("fieldset",{className:y("border-1 border-input p-4 rounded-xl","RemoteFlows__FieldSetField",`RemoteFlows__FieldSetField__${t}`),children:[z("legend",{className:y("text-sm font-semibold px-2",f==="inset"&&"hidden"),children:e}),f==="inset"&&ee("div",{className:"RemoteFlows__FieldSetField__Header",id:Ee,"data-state":h?"expanded":"collapsed","aria-expanded":h,children:[z("h3",{className:y("RemoteFlows__FieldSetField__Title"),children:e}),i?.toggle?.enabled&&z(Lt,{isExpanded:h,onToggle:Wt,"aria-expanded":h,"aria-controls":$e,"aria-label":`${h?"Hide":"Show"} ${e}`,className:y("RemoteFlows__FieldSetField__Toggle",i.toggle?.className),children:h?i.toggle.labels?.collapse??"Remove":i.toggle.labels?.expand??"Define"})]}),h&&ee("div",{id:$e,"aria-labelledby":Ee,role:"region",children:[o?z("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:Oe(o)}}):null,ee("div",{className:"grid gap-4",children:[a.map(v=>{v.calculateDynamicProperties&&(v={...v,...v.calculateDynamicProperties(C,v)||{}});let te=Ie[v.type];if(v.isVisible===!1||v.deprecated)return null;if(v.Component){let{Component:Fe}=v;return z(Fe,{...v},v.name)}return v.type==="select"&&v.multiple&&(te=Ie["multi-select"]),ee(bo,{children:[z(te,{...v,name:`${c?v.name:`${t}.${v.name}`}`,component:l?.[v.type]}),v.extra?v.extra:null]},`${c?v.name:`${t}.${v.name}`}`)}),F||null,d?z(Et,{...d}):null]})]})]})}r(ns,"FieldSetField");export{Ie as a,Et as b,ns as c};
2
+ //# sourceMappingURL=chunk-U4NWXPI5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/form/fields/CheckBoxField.tsx","../src/components/form/fields/DatePickerField.tsx","../src/components/ui/calendar.tsx","../src/components/ui/popover.tsx","../src/components/ui/file-uploader.tsx","../src/components/form/fields/FileUploadField.tsx","../src/components/form/fields/NumberField.tsx","../src/components/form/fields/RadioGroupField.tsx","../src/components/form/fields/SelectField.tsx","../src/components/form/fields/CountryField.tsx","../src/components/ui/multi-select.tsx","../src/components/ui/command.tsx","../src/components/ui/textarea.tsx","../src/components/form/fields/TextAreaField.tsx","../src/components/form/fields/EmailField.tsx","../src/components/form/fields/HiddenField.tsx","../src/components/form/fields/WorkScheduleField.tsx","../node_modules/@hookform/resolvers/src/validateFieldsNatively.ts","../node_modules/@hookform/resolvers/src/toNestErrors.ts","../node_modules/@hookform/resolvers/yup/src/yup.ts","../src/components/form/fields/workScheduleUtils.ts","../src/components/form/fields/MultiSelectField.tsx","../src/components/form/fields/MoneyField.tsx","../src/components/form/fields/baseFields.tsx","../src/components/form/Statement.tsx","../src/components/form/fields/FieldSetField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Checkbox } from '@/src/components/ui/checkbox';\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@/src/components/ui/form';\nimport { useFormFields } from '@/src/context';\nimport { cn } from '@/src/lib/utils';\nimport { Components, JSFField } from '@/src/types/remoteFlows';\nimport { CheckedState } from '@radix-ui/react-checkbox';\nimport {\n ControllerRenderProps,\n FieldValues,\n useFormContext,\n} from 'react-hook-form';\n\nexport type CheckBoxFieldProps = {\n name: string;\n} & Partial<\n JSFField & {\n onChange?: (checked: any, optionId?: string) => void;\n component?: Components['checkbox'];\n }\n>;\n\nexport function CheckBoxField({\n name,\n defaultValue,\n description,\n label,\n onChange,\n multiple,\n options,\n component,\n ...rest\n}: CheckBoxFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n\n const handleCheckboxChange = (\n optionId: string,\n checked: boolean,\n field: ControllerRenderProps<FieldValues, string>,\n ) => {\n const currentValues = field.value ? [...field.value] : [];\n\n if (checked) {\n // Add the value if it's not already in the array\n if (!currentValues.includes(optionId)) {\n field.onChange([...currentValues, optionId]);\n }\n } else {\n // Remove the value from the array\n field.onChange(currentValues.filter((value) => value !== optionId));\n }\n };\n\n return (\n <FormField\n control={control}\n name={name}\n defaultValue={defaultValue}\n render={({ field, fieldState }) => {\n const CustomCheckboxField = component || components?.checkbox;\n if (CustomCheckboxField) {\n const customCheckboxFieldProps = {\n name,\n description,\n label,\n defaultValue,\n multiple,\n options,\n ...rest,\n };\n return (\n <CustomCheckboxField\n field={{\n ...field,\n onChange: (evt: any) => {\n if (multiple) {\n const { checked, value } = evt.target;\n handleCheckboxChange(value, checked, field);\n onChange?.(checked);\n return;\n }\n field.onChange(evt);\n onChange?.(evt);\n },\n }}\n fieldState={fieldState}\n fieldData={customCheckboxFieldProps}\n />\n );\n }\n return (\n <FormItem\n data-field={name}\n className={cn(`RemoteFlows__CheckBoxField__Item__${name}`)}\n >\n <FormControl>\n <>\n {options && multiple ? <FormLabel>{label}</FormLabel> : null}\n\n {options && multiple ? (\n options.map((option) => (\n <div key={option.value} className='flex space-x-2'>\n <Checkbox\n id={option.value}\n onCheckedChange={(checked: CheckedState) => {\n handleCheckboxChange(\n option.value,\n checked === true,\n field,\n );\n onChange?.(checked, option.value);\n }}\n checked={field.value?.includes(option.value)}\n className='RemoteFlows__CheckBox__Input'\n />\n <FormLabel\n htmlFor={option.value}\n className='mb-0 RemoteFlows__CheckBox__Label'\n >\n {option.label}\n </FormLabel>\n </div>\n ))\n ) : (\n <div className='flex space-x-2'>\n <Checkbox\n id={name}\n onCheckedChange={(event: CheckedState) => {\n field.onChange(event);\n onChange?.(event);\n }}\n checked={field.value}\n className='RemoteFlows__CheckBox__Input'\n />\n <FormLabel\n htmlFor={name}\n className='mb-0 RemoteFlows__CheckBox__Label'\n >\n {label}\n </FormLabel>\n </div>\n )}\n </>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {fieldState.error && <FormMessage />}\n </FormItem>\n );\n }}\n />\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { CalendarIcon } from 'lucide-react';\nimport { useFormContext } from 'react-hook-form';\nimport { PopoverClose } from '@radix-ui/react-popover';\n\nimport { Button } from '@/src/components/ui/button';\nimport { Calendar } from '@/src/components/ui/calendar';\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@/src/components/ui/form';\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from '@/src/components/ui/popover';\nimport { useFormFields } from '@/src/context';\nimport { cn } from '@/src/lib/utils';\nimport { Components, JSFField } from '@/src/types/remoteFlows';\nimport { getMinStartDate } from '@/src/components/form/utils';\nimport { format } from 'date-fns';\n\nexport type DatePickerFieldProps = JSFField & {\n onChange?: (value: any) => void;\n component?: Components['date'];\n};\n\nexport function DatePickerField({\n description,\n label,\n name,\n minDate,\n onChange,\n component,\n ...rest\n}: DatePickerFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n\n let minDateValue: Date;\n if (rest.meta?.mot && typeof rest.meta.mot === 'number') {\n minDateValue = getMinStartDate(rest.meta.mot);\n } else if (minDate) {\n minDateValue = new Date(minDate);\n }\n\n return (\n <FormField\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n const CustomDatePickerField = component || components?.date;\n\n if (CustomDatePickerField) {\n const customDatePickerFieldProps = {\n description,\n label,\n name,\n onChange,\n ...(minDateValue && { minDate: minDateValue.toISOString() }),\n ...rest,\n };\n return (\n <CustomDatePickerField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={customDatePickerFieldProps}\n />\n );\n }\n return (\n <FormItem\n data-field={name}\n className={`flex flex-col RemoteFlows__DatePickerField__Item__${name}`}\n >\n <FormLabel className='RemoteFlows__DatePickerField__Label'>\n {label}\n </FormLabel>\n <Popover>\n <PopoverTrigger asChild>\n <FormControl>\n <div>\n <Button\n type='button'\n variant={'outline'}\n className={cn(\n 'w-full pl-3 text-left font-normal',\n !field.value && 'text-muted-foreground',\n )}\n data-testid={`date-picker-button-${name}`}\n >\n {field.value && <>{format(field.value, 'yyyy-MM-dd')}</>}\n <CalendarIcon className='ml-auto h-4 w-4 opacity-50' />\n </Button>\n </div>\n </FormControl>\n </PopoverTrigger>\n <PopoverContent\n className={`w-auto p-0 RemoteFlows__DatepickerField__PopoverContent`}\n align='start'\n >\n <Calendar\n mode='single'\n className='RemoteFlows__DatepickerField__Calendar'\n selected={field.value ? new Date(field.value) : undefined}\n onSelect={(date) => {\n field.onChange(date ? format(date, 'yyyy-MM-dd') : null);\n onChange?.(date);\n }}\n defaultMonth={minDateValue}\n components={{\n DayContent: (props) => {\n return (\n <PopoverClose>{props.date.getDate()}</PopoverClose>\n );\n },\n }}\n {...(minDateValue && {\n disabled: (date: Date) => date < minDateValue,\n })}\n />\n </PopoverContent>\n </Popover>\n {description ? (\n <FormDescription>{description}</FormDescription>\n ) : null}\n {fieldState.error && (\n <FormMessage className='RemoteFlows__DatePickerField__Error' />\n )}\n </FormItem>\n );\n }}\n />\n );\n}\n","import * as React from 'react';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { DayPicker } from 'react-day-picker';\n\nimport { cn } from '@/src/lib/utils';\nimport { buttonVariants } from '@/src/components/ui/button';\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n ...props\n}: React.ComponentProps<typeof DayPicker>) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn('p-3', className)}\n classNames={{\n months: 'flex flex-col sm:flex-row gap-2',\n month: 'flex flex-col gap-4',\n caption: 'flex justify-center pt-1 relative items-center w-full',\n caption_label: 'text-sm font-medium',\n nav: 'flex items-center gap-1',\n nav_button: cn(\n buttonVariants({ variant: 'outline' }),\n 'size-7 bg-transparent p-0 opacity-50 hover:opacity-100',\n ),\n nav_button_previous: 'absolute left-1',\n nav_button_next: 'absolute right-1',\n table: 'w-full border-collapse space-x-1',\n head_row: 'flex',\n head_cell:\n 'text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]',\n row: 'flex w-full mt-2',\n cell: cn(\n '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',\n props.mode === 'range'\n ? '[&: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'\n : '[&:has([aria-selected])]:rounded-md',\n ),\n day: cn(\n buttonVariants({ variant: 'ghost' }),\n 'size-8 p-0 font-normal aria-selected:opacity-100',\n ),\n day_range_start:\n 'day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground',\n day_range_end:\n 'day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground',\n day_selected:\n 'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground',\n day_today: 'bg-accent text-accent-foreground',\n day_outside:\n 'day-outside text-muted-foreground aria-selected:text-muted-foreground',\n day_disabled: 'text-muted-foreground opacity-50',\n day_range_middle:\n 'aria-selected:bg-accent aria-selected:text-accent-foreground',\n day_hidden: 'invisible',\n ...classNames,\n }}\n components={{\n IconLeft: ({ className, ...props }) => (\n <ChevronLeft className={cn('size-4', className)} {...props} />\n ),\n IconRight: ({ className, ...props }) => (\n <ChevronRight className={cn('size-4', className)} {...props} />\n ),\n }}\n {...props}\n />\n );\n}\n\nexport { Calendar };\n","import * as React from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { cn } from '@/src/lib/utils';\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot='popover' {...props} />;\n}\n\nfunction PopoverTrigger({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot='popover-trigger' {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot='popover-content'\n align={align}\n sideOffset={sideOffset}\n className={cn(\n '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',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n}\n\nfunction PopoverAnchor({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot='popover-anchor' {...props} />;\n}\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };\n","import React, { useState, useRef } from 'react';\nimport { Button } from '@/src/components/ui/button';\nimport { Upload, X } from 'lucide-react';\nimport { cn } from '@/src/lib/utils';\n\ntype FileUploaderProps = {\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n className?: string;\n multiple?: boolean;\n};\n\nexport function FileUploader({\n onChange,\n className,\n multiple,\n}: FileUploaderProps) {\n const [files, setFiles] = useState<File[]>([]);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n inputRef.current?.click();\n };\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (e.target.files && e.target.files.length > 0) {\n const newFiles = Array.from(e.target.files);\n\n setFiles(newFiles);\n onChange(e);\n }\n };\n\n const onRemoveFile = (file: File) => {\n setFiles((prevFiles) => prevFiles.filter((f) => f !== file));\n };\n\n return (\n <div className={cn('flex flex-col items-start gap-4', className)}>\n <input\n type='file'\n ref={inputRef}\n onChange={handleChange}\n className='hidden'\n aria-label='File upload'\n multiple={multiple}\n />\n <Button type='button' onClick={handleClick} className='gap-2'>\n <Upload className='h-4 w-4' />\n Choose File\n </Button>\n {files.length === 0 && (\n <div className='text-sm'>\n {!multiple ? (\n <span className='font-medium'>No file selected.</span>\n ) : (\n <span className='font-medium'>\n No files selected. You can select multiple files\n </span>\n )}\n </div>\n )}\n {files.length > 0 &&\n files.map((file, index) => (\n <div key={index} className='text-sm flex items-center gap-2'>\n Selected file: <span className='font-medium'>{file.name}</span> (\n {Math.round(file.size / 1024)} KB)\n <Button variant='ghost' onClick={() => onRemoveFile(file)}>\n <X />\n </Button>\n </div>\n ))}\n </div>\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\n\nimport { useFormFields } from '@/src/context';\nimport { cn } from '@/src/lib/utils';\nimport { Components, JSFField } from '@/src/types/remoteFlows';\nimport { useFormContext } from 'react-hook-form';\nimport { FileUploader } from '../../ui/file-uploader';\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '../../ui/form';\n\nconst toBase64 = (file: File): Promise<string> => {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n });\n};\n\nconst convertFilesToBase64 = async (\n event: React.ChangeEvent<HTMLInputElement>,\n) => {\n const files = event.target.files ? Array.from(event.target.files) : [];\n\n const base64Files = await Promise.all(\n files.map(async (file) => {\n const base64 = await toBase64(file);\n return {\n name: file.name,\n content: base64.split(',')[1],\n };\n }),\n );\n return base64Files;\n};\n\nexport type FileUploadFieldProps = JSFField & {\n onChange?: (value: any) => void;\n multiple?: boolean;\n component?: Components['file'];\n};\n\nexport function FileUploadField({\n name,\n description,\n label,\n multiple,\n onChange,\n component,\n ...rest\n}: FileUploadFieldProps) {\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 CustomFileUploadField = component || components?.file;\n if (CustomFileUploadField) {\n const customFileUploadFieldProps = {\n name,\n description,\n label,\n multiple,\n ...rest,\n };\n return (\n <CustomFileUploadField\n field={{\n ...field,\n value: null,\n onChange: async (value: any) => {\n const files = await convertFilesToBase64(value);\n field.onChange(files);\n onChange?.(files);\n },\n }}\n fieldState={fieldState}\n fieldData={customFileUploadFieldProps}\n />\n );\n }\n return (\n <FormItem\n data-field={name}\n className={`RemoteFlows__FileUpload__Item__${name}`}\n >\n <FormLabel className='RemoteFlows__FileUpload__Label'>\n {label}\n </FormLabel>\n <FormControl>\n <FileUploader\n onChange={async (\n event: React.ChangeEvent<HTMLInputElement>,\n ) => {\n const files = await convertFilesToBase64(event);\n field.onChange(files);\n onChange?.(files);\n }}\n multiple={multiple}\n className={cn('RemoteFlows__FileUpload__Input')}\n />\n </FormControl>\n {description && (\n <div className='flex items-center justify-between'>\n <FormDescription className='RemoteFlows__FileUpload__Description'>\n {description}\n </FormDescription>\n </div>\n )}\n {fieldState.error && (\n <FormMessage className='RemoteFlows__FileUpload__Error' />\n )}\n </FormItem>\n );\n }}\n />\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useFormFields } from '@/src/context';\nimport { useFormContext } from 'react-hook-form';\nimport { FormField } from '../../ui/form';\nimport { TextField, TextFieldProps } from './TextField';\nimport { Components } from '@/src/types/remoteFlows';\n\nexport type NumberFieldProps = TextFieldProps & {\n component?: Components['number'];\n};\n\nexport function NumberField(props: NumberFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n\n const CustomNumberField = props.component || components?.number;\n\n if (CustomNumberField) {\n return (\n <FormField\n control={control}\n name={props.name}\n render={({ field, fieldState }) => {\n return (\n <CustomNumberField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n props.onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={props}\n />\n );\n }}\n />\n );\n }\n\n return (\n <TextField {...props} type='text' inputMode='decimal' pattern='^[0-9.]*$' />\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Fragment } from 'react';\nimport {\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@/src/components/ui/form';\nimport { RadioGroup, RadioGroupItem } from '@/src/components/ui/radio-group';\nimport { useFormFields } from '@/src/context';\nimport { cn } from '@/src/lib/utils';\nimport { Components, JSFField } from '@/src/types/remoteFlows';\nimport { useFormContext } from 'react-hook-form';\n\ntype RadioGroupFieldProps = JSFField & {\n onChange?: (value: any) => void;\n component?: Components['radio'];\n};\n\nexport function RadioGroupField({\n name,\n defaultValue,\n description,\n label,\n options,\n onChange,\n component,\n ...rest\n}: RadioGroupFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n return (\n <FormField\n control={control}\n name={name}\n defaultValue={defaultValue}\n render={({ field, fieldState }) => {\n const CustomRadioGroupField = component || components?.radio;\n if (CustomRadioGroupField) {\n const customRadioGroupFieldProps = {\n name,\n defaultValue,\n description,\n label,\n options,\n ...rest,\n };\n return (\n <CustomRadioGroupField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={customRadioGroupFieldProps}\n />\n );\n }\n\n return (\n <FormItem\n className={cn(\n 'space-y-3',\n `RemoteFlows__RadioGroupField__Item__${name}`,\n )}\n data-field={name}\n >\n <FormLabel>{label}</FormLabel>\n <FormControl>\n <RadioGroup\n aria-label={label || name}\n onValueChange={(value: string) => {\n field.onChange(value);\n onChange?.(value);\n }}\n value={field.value}\n className='flex flex-col space-y-3'\n >\n {options?.map((option) => (\n <Fragment key={option.value}>\n <FormItem\n data-field={name}\n className='flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item'\n >\n <FormControl>\n <RadioGroupItem\n value={option.value}\n className='RemoteFlows__RadioField__Input'\n disabled={option.disabled}\n />\n </FormControl>\n <div>\n <FormLabel className='font-normal mb-0 RemoteFlows__RadioField__Label'>\n {option.label}\n </FormLabel>\n {option.description && (\n <FormDescription className='mt-2'>\n {option.description}\n </FormDescription>\n )}\n </div>\n </FormItem>\n </Fragment>\n ))}\n </RadioGroup>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {fieldState.error && <FormMessage />}\n </FormItem>\n );\n }}\n />\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@/src/components/ui/select';\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';\n\ntype SelectFieldProps = JSFField & {\n placeholder?: string;\n options: Array<{ value: string | number; label: string }>;\n className?: string;\n onChange?: (value: any) => void;\n component?: Components['select'];\n};\n\nexport function SelectField({\n label,\n name,\n options,\n defaultValue,\n description,\n onChange,\n component,\n ...rest\n}: SelectFieldProps) {\n const { control } = useFormContext();\n const { components } = useFormFields();\n\n return (\n <FormField\n defaultValue={defaultValue}\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n const CustomSelectField = component || components?.select;\n if (CustomSelectField) {\n const customSelectFieldProps = {\n label,\n name,\n options,\n defaultValue,\n description,\n onChange,\n ...rest,\n };\n return (\n <CustomSelectField\n field={{\n ...field,\n onChange: (value: string | number) => {\n const maybeCastValue =\n rest.jsonType === 'number' ? Number(value) : value;\n field.onChange(maybeCastValue);\n onChange?.(maybeCastValue);\n },\n }}\n fieldState={fieldState}\n fieldData={customSelectFieldProps}\n />\n );\n }\n\n return (\n <FormItem\n data-field={name}\n className={`RemoteFlows__SelectField__Item__${name}`}\n >\n <FormLabel className='RemoteFlows__SelectField__Label'>\n {label}\n </FormLabel>\n <FormControl>\n <div className='relative'>\n <Select\n value={field.value || ''}\n onValueChange={(value: string) => {\n // For some reason react-hook-form converts option values from numbers to strings.\n // If a value can be cast to a number, the field in the form state should use the numeric type instead.\n const maybeCastValue =\n rest.jsonType === 'number' ? Number(value) : value;\n field.onChange(maybeCastValue);\n onChange?.(maybeCastValue);\n }}\n >\n <SelectTrigger\n className='RemoteFlows__SelectField__Trigger'\n aria-invalid={Boolean(fieldState.error)}\n aria-label={label}\n >\n <span className='absolute'>\n <SelectValue placeholder={label} />\n </span>\n </SelectTrigger>\n <SelectContent className='RemoteFlows__SelectField__Content'>\n <SelectGroup className='RemoteFlows__SelectField__Group'>\n {options.map((option) => (\n <SelectItem\n key={option.value}\n value={option.value}\n className='RemoteFlows__SelectField__SelectItem'\n >\n {option.label}\n </SelectItem>\n ))}\n </SelectGroup>\n </SelectContent>\n </Select>\n </div>\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {fieldState.error && <FormMessage />}\n </FormItem>\n );\n }}\n />\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useState } 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 { MultiSelect } from '../../ui/multi-select';\n\ntype CountryFieldProps = JSFField & {\n options: Array<{ value: string; label: string }>;\n onChange?: (value: any) => void;\n $meta: {\n regions: Record<string, string[]>;\n subregions: Record<string, string[]>;\n };\n component?: Components['countries'];\n};\n\nexport function CountryField({\n label,\n name,\n options,\n defaultValue,\n description,\n onChange,\n $meta,\n component,\n ...rest\n}: CountryFieldProps) {\n const { control } = useFormContext();\n const { components } = useFormFields();\n const [selected, setSelected] = useState<any[]>([]);\n\n return (\n <FormField\n defaultValue={defaultValue}\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n const CustomSelectField = component || components?.countries;\n\n if (CustomSelectField) {\n const customSelectFieldProps = {\n label,\n name,\n options,\n defaultValue,\n description,\n onChange,\n $meta,\n ...rest,\n };\n return (\n <CustomSelectField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={customSelectFieldProps}\n />\n );\n }\n\n const countryOptions = [\n ...Object.entries($meta?.regions || {}).map(([key, value]) => ({\n value,\n label: key,\n category: 'Regions',\n })),\n ...Object.entries($meta?.subregions || {}).map(([key, value]) => ({\n value,\n label: key,\n category: 'Subregions',\n })),\n ...options.map((option) => ({\n ...option,\n value: option.value,\n label: option.label,\n category: 'Countries',\n })),\n ];\n\n const handleChange = (rawValues: any[]) => {\n const values = rawValues.map(({ value }) => value);\n field.onChange(values);\n onChange?.(values);\n setSelected(rawValues);\n };\n\n return (\n <FormItem\n data-field={name}\n className={`RemoteFlows__CountryField__Item__${name}`}\n >\n <FormLabel className='RemoteFlows__CountryField__Label'>\n {label}\n </FormLabel>\n <FormControl>\n <MultiSelect\n options={countryOptions}\n selected={selected}\n onChange={handleChange}\n {...rest}\n />\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {fieldState.error && <FormMessage />}\n </FormItem>\n );\n }}\n />\n );\n}\n","import { Fragment, useState } from 'react';\nimport { Check, ChevronDownIcon, X } from 'lucide-react';\n\nimport { Button } from '@/src/components/ui/button';\nimport { Badge } from '@/src/components/ui/badge';\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from '@/src/components/ui/command';\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from '@/src/components/ui/popover';\nimport { cn } from '@/src/lib/utils';\n\nexport type Option = {\n label: string;\n value: string | string[];\n category?: string;\n};\n\ninterface MultiSelectProps {\n options: Option[];\n selected: Option[];\n onChange: (options: Option[]) => void;\n placeholder?: string;\n}\n\nexport function MultiSelect({\n options,\n selected,\n onChange,\n placeholder,\n ...props\n}: MultiSelectProps) {\n const [open, setOpen] = useState(false);\n const handleUnselect = (option: Option) => {\n onChange(selected.filter((item) => item.value !== option.value));\n };\n\n const hasCategories = options.some((option) => option.category);\n\n const groupedOptions = options.reduce(\n (groups, option) => {\n const category = option.category || 'Uncategorized';\n if (!groups[category]) {\n groups[category] = [];\n }\n groups[category].push(option);\n return groups;\n },\n {} as Record<string, Option[]>,\n );\n\n return (\n <Popover open={open} onOpenChange={setOpen} {...props}>\n <PopoverTrigger>\n <Button\n variant='outline'\n role='combobox'\n aria-expanded={open}\n className='w-full justify-between font-normal'\n type='button'\n >\n <div className='flex gap-1 flex-wrap overflow-x-auto max-h-[2.5rem] items-center'>\n {selected.length > 0 ? (\n selected.map((option) => {\n return (\n <Badge\n key={option.label}\n variant='secondary'\n className='mr-1 mb-1'\n >\n {option.label}\n <div\n role='button'\n tabIndex={0}\n aria-label={`remove ${option.label}`}\n className='ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer'\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n handleUnselect(option);\n }\n }}\n onMouseDown={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n onClick={() => handleUnselect(option)}\n >\n <X className='h-3 w-3 text-muted-foreground hover:text-foreground' />\n </div>\n </Badge>\n );\n })\n ) : (\n <span className='text-foreground'>{placeholder}</span>\n )}\n </div>\n <ChevronDownIcon className='size-4' />\n </Button>\n </PopoverTrigger>\n <PopoverContent align='start' className='w-full p-0'>\n <Command>\n <CommandList>\n <CommandEmpty>No item found.</CommandEmpty>\n {Object.entries(groupedOptions).map(\n ([category, categoryOptions], index) => (\n <Fragment key={category}>\n {index > 0 && <CommandSeparator />}\n <CommandGroup heading={hasCategories ? category : undefined}>\n {categoryOptions.map((option) => {\n const isSelected = selected.some(\n (item) => item.value === option.value,\n );\n return (\n <CommandItem\n key={option.label}\n onSelect={() => {\n onChange(\n isSelected\n ? selected.filter(\n (item) => item.value !== option.value,\n )\n : [...selected, option],\n );\n }}\n >\n <Check\n className={cn(\n 'mr-2 h-4 w-4',\n isSelected ? 'opacity-100' : 'opacity-0',\n )}\n />\n {option.label}\n </CommandItem>\n );\n })}\n </CommandGroup>\n </Fragment>\n ),\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n );\n}\n","import * as React from 'react';\nimport { Command as CommandPrimitive } from 'cmdk';\nimport { SearchIcon } from 'lucide-react';\n\nimport { cn } from '@/src/lib/utils';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '@/src/components/ui/dialog';\n\nfunction Command({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot='command'\n className={cn(\n 'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CommandDialog({\n title = 'Command Palette',\n description = 'Search for a command to run...',\n children,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string;\n description?: string;\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className='sr-only'>\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent className='overflow-hidden p-0'>\n <Command className='[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5'>\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div\n data-slot='command-input-wrapper'\n className='flex h-9 items-center gap-2 border-b px-3'\n >\n <SearchIcon className='size-4 shrink-0 opacity-50' />\n <CommandPrimitive.Input\n data-slot='command-input'\n className={cn(\n 'placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n {...props}\n />\n </div>\n );\n}\n\nfunction CommandList({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot='command-list'\n className={cn(\n 'max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CommandEmpty({\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot='command-empty'\n className='py-6 text-center text-sm'\n {...props}\n />\n );\n}\n\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot='command-group'\n className={cn(\n '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',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot='command-separator'\n className={cn('bg-border -mx-1 h-px', className)}\n {...props}\n />\n );\n}\n\nfunction CommandItem({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot='command-item'\n className={cn(\n \"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\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CommandShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot='command-shortcut'\n className={cn(\n 'text-muted-foreground ml-auto text-xs tracking-widest',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n","import * as React from 'react';\n\nimport { cn } from '@/src/lib/utils';\n\nconst Textarea = React.forwardRef<\n HTMLTextAreaElement,\n React.ComponentProps<'textarea'>\n>(({ className, ...props }, ref) => {\n return (\n <textarea\n className={cn(\n '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',\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n});\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\n\nimport { useFormFields } from '@/src/context';\nimport { cn } from '@/src/lib/utils';\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 { Textarea } from '../../ui/textarea';\n\nexport type TextAreaFieldProps = JSFField & {\n onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n maxLength?: number;\n component?: Components['textarea'];\n};\n\nexport function TextAreaField({\n name,\n description,\n label,\n onChange,\n maxLength,\n component,\n ...rest\n}: TextAreaFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n return (\n <FormField\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n const CustomTextAreaField = component || components?.textarea;\n if (CustomTextAreaField) {\n const customTextAreaFieldProps = {\n name,\n description,\n label,\n maxLength,\n ...rest,\n };\n return (\n <CustomTextAreaField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={customTextAreaFieldProps}\n />\n );\n }\n\n const valueLength = field.value?.length ?? 0;\n return (\n <FormItem\n data-field={name}\n className={`RemoteFlows__TextArea__Item__${name}`}\n >\n <FormLabel className='RemoteFlows__TextArea__Label'>\n {label}\n </FormLabel>\n <FormControl>\n <Textarea\n {...field}\n value={field.value ?? ''}\n onChange={(event: React.ChangeEvent<HTMLTextAreaElement>) => {\n field.onChange(event);\n onChange?.(event);\n }}\n className={cn(\n fieldState.error &&\n 'border-red-500 focus-visible:ring-red-500',\n 'RemoteFlows__TextArea__Input',\n )}\n placeholder={label}\n />\n </FormControl>\n {(description || maxLength) && (\n <div className='flex items-center justify-between'>\n {description && (\n <FormDescription className='RemoteFlows__TextArea__Description'>\n {description}\n </FormDescription>\n )}\n {maxLength && (\n <span className='text-sm ml-auto RemoteFlows__TextArea__MaxLength'>\n {valueLength}/{maxLength}\n </span>\n )}\n </div>\n )}\n {fieldState.error && (\n <FormMessage className='RemoteFlows__TextArea__Error' />\n )}\n </FormItem>\n );\n }}\n />\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useFormFields } from '@/src/context';\nimport { useFormContext } from 'react-hook-form';\nimport { FormField } from '../../ui/form';\nimport { TextField, TextFieldProps } from './TextField';\nimport { Components } from '@/src/types/remoteFlows';\n\ntype EmailFieldProps = TextFieldProps & {\n component?: Components['email'];\n};\n\nexport function EmailField(props: EmailFieldProps) {\n const { components } = useFormFields();\n const { control } = useFormContext();\n\n const CustomEmailField = props.component || components?.email;\n\n if (CustomEmailField) {\n return (\n <FormField\n control={control}\n name={props.name}\n render={({ field, fieldState }) => {\n return (\n <CustomEmailField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n props.onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={props}\n />\n );\n }}\n />\n );\n }\n\n return <TextField {...props} type='email' />;\n}\n","import { useFormContext } from 'react-hook-form';\nimport { FormField } from '../../ui/form';\nimport { Field } from '@/src/flows/types';\n\nexport function HiddenField(props: Field) {\n const { control } = useFormContext();\n\n return (\n <FormField\n control={control}\n name={props.name}\n render={({ field }) => {\n return <input {...field} type='hidden' />;\n }}\n />\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useEffect, useState } from 'react';\nimport { yupResolver } from '@hookform/resolvers/yup';\nimport { useForm, useFormContext, useFieldArray } from 'react-hook-form';\nimport * as yup from 'yup';\n\nimport { JSFField } from '@/src/types/remoteFlows';\nimport { useFormFields } from '@/src/context';\nimport { Form, FormField } from '@/src/components/ui/form';\nimport { Components } from '@/src/types/remoteFlows';\nimport { Button } from '@/src/components/ui/button';\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from '@/src/components/ui/dialog';\n\nimport {\n buildWorkScheduleSummary,\n calculateHours,\n calculateTotalWorkHours,\n DailySchedule,\n DAYS_OF_THE_WEEK,\n getShortWeekday,\n} from './workScheduleUtils';\nimport { CheckBoxField } from './CheckBoxField';\nimport { TextField } from './TextField';\n\ntype WorkScheduleFieldProps = JSFField & {\n name: string;\n default: DailySchedule[];\n onChange?: (value: any) => void;\n component?: Components['work-schedule'];\n};\n\ntype WorkScheduleFormData = {\n schedule: DailySchedule[];\n};\n\ntype WorkScheduleSelectionProps = {\n defaultSchedule: DailySchedule[];\n onSubmit: (data: WorkScheduleFormData['schedule']) => void;\n};\n\nconst fieldSchema = yup.object({\n day: yup.string().required(),\n checked: yup.boolean().required(),\n start_time: yup\n .string()\n .matches(/^([01]\\d|2[0-3]):([0-5]\\d)$/, 'Invalid time format (HH:mm)')\n .when('checked', {\n is: true,\n then: (schema) => schema.required('Required'),\n otherwise: (schema) => schema.optional().nullable(),\n }),\n end_time: yup\n .string()\n .matches(/^([01]\\d|2[0-3]):([0-5]\\d)$/, 'Invalid time format (HH:mm)')\n .when('checked', {\n is: true,\n then: (schema) => schema.required('Required'),\n otherwise: (schema) => schema.optional().nullable(),\n }),\n hours: yup.number().default(0),\n break_duration_minutes: yup.string().default('0'),\n});\n\nconst formSchema = yup.object({\n schedule: yup.array(fieldSchema),\n});\n\nfunction WorkScheduleSelectionForm({\n defaultSchedule,\n onSubmit,\n}: WorkScheduleSelectionProps) {\n const [openDialog, setOpenDialog] = useState(false);\n\n const transformedSchedule = DAYS_OF_THE_WEEK.map((day) => {\n const existingSchedule = defaultSchedule.find(\n (schedule) =>\n schedule.day.toLowerCase() === getShortWeekday(day).toLowerCase() ||\n schedule.day.toLowerCase() === day.toLowerCase(),\n );\n\n if (existingSchedule) {\n return {\n ...existingSchedule,\n day: getShortWeekday(day),\n checked: true,\n };\n }\n\n return {\n // We just need to override the day and checked. The rest of the fields are the same for every day.\n ...defaultSchedule[0],\n checked: false,\n day: getShortWeekday(day),\n };\n });\n\n const form = useForm<WorkScheduleFormData>({\n defaultValues: {\n schedule: transformedSchedule,\n },\n resolver: yupResolver(formSchema) as any,\n });\n\n const { handleSubmit, watch, reset, control, formState } = form;\n\n const { fields } = useFieldArray({\n name: 'schedule',\n control,\n });\n\n const watchedSchedule = watch('schedule');\n\n function handleSubmitWorkingHours(data: WorkScheduleFormData) {\n // We can only send the days that are checked.\n const schedule = data.schedule\n .filter(({ checked }) => checked)\n .map((day) => ({\n ...day,\n hours: calculateHours(day),\n }));\n\n onSubmit(schedule);\n setOpenDialog(false);\n }\n\n function handleCancel() {\n reset();\n setOpenDialog(false);\n }\n\n return (\n <div className='flex items-center justify-between'>\n <Dialog open={openDialog} onOpenChange={setOpenDialog}>\n <DialogTrigger asChild>\n <Button\n variant={'link'}\n className='flex items-center p-0 RemoteFlows__WorkScheduleSelectionForm__Trigger'\n >\n Edit Schedule\n </Button>\n </DialogTrigger>\n <DialogContent className='max-w-5xl max-h-[90vh] overflow-y-auto px-8 py-4 RemoteFlows__WorkScheduleSelectionForm__Content'>\n <DialogHeader>\n <DialogTitle className='RemoteFlows__WorkScheduleSelectionForm__Title'>\n Edit employee working hours\n </DialogTitle>\n </DialogHeader>\n\n <Form {...form}>\n <form className='space-y-4 RemoteFlows__WorkScheduleSelectionForm__Form'>\n <div className='rounded-lg'>\n <p className='text-gray-600 text-sm mb-4 RemoteFlows__WorkScheduleSelectionForm__Description'>\n The times displayed are in the employee's time zone in the\n 24-hour format.\n </p>\n\n <div className='grid grid-cols-12 gap-4 text-sm font-medium text-gray-500 uppercase tracking-wide RemoteFlows__WorkScheduleSelectionForm__Header'>\n <div className='col-span-2'></div>\n <div className='col-span-3 text-center'>START</div>\n <div className='col-span-1 text-center'></div>\n <div className='col-span-3 text-center'>END</div>\n <div className='col-span-2 text-center'>HOURS</div>\n {/* <div className=\"col-span-2 text-center\">ACTIONS</div> */}\n </div>\n\n <div className='RemoteFlows__WorkScheduleSelectionForm__Rows'>\n {fields.map((field, index) => {\n const currentDay = watchedSchedule[index];\n const calculatedHours = calculateHours(currentDay);\n\n return (\n <React.Fragment key={field.id}>\n <div className='grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Hours'>\n <div className='col-span-2 flex items-center gap-3'>\n <CheckBoxField\n label={field.day}\n name={`schedule.${index}.checked`}\n />\n </div>\n <div className='col-span-3'>\n <TextField\n name={`schedule.${index}.start_time`}\n includeErrorMessage={false}\n />\n </div>\n <div className='col-span-1 text-center text-gray-500'>\n to\n </div>\n <div className='col-span-3'>\n <TextField\n name={`schedule.${index}.end_time`}\n includeErrorMessage={false}\n />\n </div>\n <div className='col-span-2 text-center text-gray-600'>\n {isNaN(calculatedHours)\n ? '-'\n : `${calculatedHours} hours`}\n </div>\n </div>\n\n <div className='grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Break'>\n <div className='col-span-2 text-gray-500'>Break</div>\n <div className='col-span-2'>\n <TextField\n name={`schedule.${index}.break_duration_minutes`}\n includeErrorMessage={false}\n />\n </div>\n <div className='col-span-2 text-gray-500'>\n minutes\n </div>\n <div className='col-span-4'></div>\n </div>\n </React.Fragment>\n );\n })}\n </div>\n </div>\n\n {Object.keys(formState.errors).length > 0 && (\n <p className='text-destructive text-sm mb-0'>\n Invalid time format (HH:mm)\n </p>\n )}\n\n <div className='flex gap-4 pt-4'>\n <Button\n type='button'\n className='reset-button'\n variant='outline'\n onClick={handleCancel}\n >\n Cancel\n </Button>\n <Button\n type='button'\n className='submit-button'\n onClick={handleSubmit(handleSubmitWorkingHours)}\n >\n Save Schedule\n </Button>\n </div>\n </form>\n </Form>\n </DialogContent>\n </Dialog>\n </div>\n );\n}\n\nexport function WorkScheduleField(props: WorkScheduleFieldProps) {\n const { components } = useFormFields();\n const { setValue, control, watch } = useFormContext();\n const watchedSchedule = watch(props.name);\n const [currentSchedule, setCurrentSchedule] =\n useState<DailySchedule[]>(watchedSchedule);\n\n const { workHoursSummary, breakSummary } =\n buildWorkScheduleSummary(currentSchedule);\n const totalWorkHours = calculateTotalWorkHours(currentSchedule);\n\n useEffect(() => {\n setValue(props.name, currentSchedule);\n }, [currentSchedule, props.name, setValue]);\n\n function onSubmit(data: WorkScheduleFormData['schedule']) {\n setCurrentSchedule(data);\n }\n\n const CustomWorkScheduleField =\n props.component || components?.['work-schedule'];\n\n if (CustomWorkScheduleField) {\n return (\n <FormField\n control={control}\n name={props.name}\n render={({ field, fieldState }) => {\n return (\n <CustomWorkScheduleField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n props.onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={{\n ...props,\n // @ts-expect-error - defaultFormattedValue is not part of fieldData. It's generated in this component.\n defaultFormattedValue: {\n workHoursSummary,\n breakSummary,\n totalWorkHours,\n },\n }}\n />\n );\n }}\n />\n );\n }\n\n return (\n <div className={`flex flex-col gap-3 RemoteFlows__WorkScheduleField`}>\n <p className={`text-sm RemoteFlows__WorkScheduleField__Title`}>\n Work hours\n </p>\n <div className='flex flex-col gap-1 RemoteFlows__WorkScheduleField__Summary'>\n <p\n className='text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__WorkHours'\n dangerouslySetInnerHTML={{\n __html: workHoursSummary.join(', '),\n }}\n />\n\n <p className='text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Break'>\n {breakSummary.join()}\n </p>\n <p className='text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Total'>\n Total of <span>{totalWorkHours}</span> hours per week\n </p>\n <WorkScheduleSelectionForm\n defaultSchedule={currentSchedule}\n onSubmit={onSubmit}\n />\n </div>\n </div>\n );\n}\n","import {\n FieldError,\n FieldErrors,\n FieldValues,\n Ref,\n ResolverOptions,\n get,\n} from 'react-hook-form';\n\nconst setCustomValidity = (\n ref: Ref,\n fieldPath: string,\n errors: FieldErrors,\n) => {\n if (ref && 'reportValidity' in ref) {\n const error = get(errors, fieldPath) as FieldError | undefined;\n ref.setCustomValidity((error && error.message) || '');\n\n ref.reportValidity();\n }\n};\n\n// Native validation (web only)\nexport const validateFieldsNatively = <TFieldValues extends FieldValues>(\n errors: FieldErrors,\n options: ResolverOptions<TFieldValues>,\n): void => {\n for (const fieldPath in options.fields) {\n const field = options.fields[fieldPath];\n if (field && field.ref && 'reportValidity' in field.ref) {\n setCustomValidity(field.ref, fieldPath, errors);\n } else if (field && field.refs) {\n field.refs.forEach((ref: HTMLInputElement) =>\n setCustomValidity(ref, fieldPath, errors),\n );\n }\n }\n};\n","import {\n Field,\n FieldErrors,\n FieldValues,\n InternalFieldName,\n ResolverOptions,\n get,\n set,\n} from 'react-hook-form';\nimport { validateFieldsNatively } from './validateFieldsNatively';\n\nexport const toNestErrors = <TFieldValues extends FieldValues>(\n errors: FieldErrors,\n options: ResolverOptions<TFieldValues>,\n): FieldErrors<TFieldValues> => {\n options.shouldUseNativeValidation && validateFieldsNatively(errors, options);\n\n const fieldErrors = {} as FieldErrors<TFieldValues>;\n for (const path in errors) {\n const field = get(options.fields, path) as Field['_f'] | undefined;\n const error = Object.assign(errors[path] || {}, {\n ref: field && field.ref,\n });\n\n if (isNameInFieldArray(options.names || Object.keys(errors), path)) {\n const fieldArrayErrors = Object.assign({}, get(fieldErrors, path));\n\n set(fieldArrayErrors, 'root', error);\n set(fieldErrors, path, fieldArrayErrors);\n } else {\n set(fieldErrors, path, error);\n }\n }\n\n return fieldErrors;\n};\n\nconst isNameInFieldArray = (\n names: InternalFieldName[],\n name: InternalFieldName,\n) => {\n const path = escapeBrackets(name);\n return names.some((n) => escapeBrackets(n).match(`^${path}\\\\.\\\\d+`));\n};\n\n/**\n * Escapes special characters in a string to be used in a regex pattern.\n * it removes the brackets from the string to match the `set` method.\n *\n * @param input - The input string to escape.\n * @returns The escaped string.\n */\nfunction escapeBrackets(input: string): string {\n return input.replace(/\\]|\\[/g, '');\n}\n","import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';\nimport {\n FieldError,\n FieldValues,\n Resolver,\n appendErrors,\n} from 'react-hook-form';\nimport * as Yup from 'yup';\n\n/**\n * Why `path!` ? because it could be `undefined` in some case\n * https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string\n */\nfunction parseErrorSchema(\n error: Yup.ValidationError,\n validateAllFieldCriteria: boolean,\n) {\n return (error.inner || []).reduce<Record<string, FieldError>>(\n (previous, error) => {\n if (!previous[error.path!]) {\n previous[error.path!] = { message: error.message, type: error.type! };\n }\n\n if (validateAllFieldCriteria) {\n const types = previous[error.path!].types;\n const messages = types && types[error.type!];\n\n previous[error.path!] = appendErrors(\n error.path!,\n validateAllFieldCriteria,\n previous,\n error.type!,\n messages\n ? ([] as string[]).concat(messages as string[], error.message)\n : error.message,\n ) as FieldError;\n }\n\n return previous;\n },\n {},\n );\n}\n\n/**\n * Creates a resolver for react-hook-form using Yup schema validation\n * @param {Yup.ObjectSchema<TFieldValues> | ReturnType<typeof Yup.lazy<Yup.ObjectSchema<TFieldValues>>>} schema - Yup validation schema\n * @param {Parameters<(typeof schema)['validate']>[1]} schemaOptions - Options to pass to Yup's validate/validateSync\n * @param {Object} resolverOptions - Additional resolver configuration\n * @param {('async' | 'sync')} [resolverOptions.mode] - Validation mode\n * @param {boolean} [resolverOptions.raw] - If true, returns raw values instead of validated results\n * @returns {Resolver<Yup.InferType<typeof schema>>} A resolver function compatible with react-hook-form\n * @example\n * const schema = Yup.object({\n * name: Yup.string().required(),\n * age: Yup.number().required(),\n * });\n *\n * useForm({\n * resolver: yupResolver(schema)\n * });\n */\nexport function yupResolver<TFieldValues extends FieldValues>(\n schema:\n | Yup.ObjectSchema<TFieldValues>\n | ReturnType<typeof Yup.lazy<Yup.ObjectSchema<TFieldValues>>>,\n schemaOptions: Parameters<(typeof schema)['validate']>[1] = {},\n resolverOptions: {\n mode?: 'async' | 'sync';\n raw?: boolean;\n } = {},\n): Resolver<Yup.InferType<typeof schema>> {\n return async (values, context, options) => {\n try {\n if (schemaOptions.context && process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn(\n \"You should not used the yup options context. Please, use the 'useForm' context object instead\",\n );\n }\n\n const result = await schema[\n resolverOptions.mode === 'sync' ? 'validateSync' : 'validate'\n ](\n values,\n Object.assign({ abortEarly: false }, schemaOptions, { context }),\n );\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: resolverOptions.raw ? Object.assign({}, values) : result,\n errors: {},\n };\n } catch (e: any) {\n if (!e.inner) {\n throw e;\n }\n\n return {\n values: {},\n errors: toNestErrors(\n parseErrorSchema(\n e,\n !options.shouldUseNativeValidation &&\n options.criteriaMode === 'all',\n ),\n options,\n ),\n };\n }\n };\n}\n","import groupBy from 'lodash.groupby';\nimport capitalize from 'lodash.capitalize';\n\nconst MINUTES_IN_HOUR = 60;\n\nexport const DAYS_OF_THE_WEEK = [\n 'monday',\n 'tuesday',\n 'wednesday',\n 'thursday',\n 'friday',\n 'saturday',\n 'sunday',\n] as const;\n\nexport type DailySchedule = {\n day: string;\n start_time: string;\n end_time: string;\n hours: number;\n break_duration_minutes: string;\n checked: boolean;\n};\n\n/**\n * Convert break duration in minutes to hours and minutes\n * @param breakDuration - Break duration in minutes\n * @returns Break duration in hours and minutes\n */\nfunction convertBreakDurationToHours(breakDuration: number) {\n if (breakDuration < 60) {\n return `${breakDuration}m`;\n }\n\n const hours = Math.floor(breakDuration / MINUTES_IN_HOUR);\n const minutes = breakDuration % MINUTES_IN_HOUR;\n\n if (minutes > 0) {\n return `${hours}h${minutes}m`;\n }\n\n return `${hours}h`;\n}\n\n/**\n * Calculate total work hours from daily schedules\n * @param dailySchedules - Daily schedules\n * @returns Total work hours\n */\nexport function calculateTotalWorkHours(dailySchedules: DailySchedule[]) {\n const totalWorkHours = dailySchedules.reduce((total, daySchedule) => {\n const sum = daySchedule.hours + total;\n return sum;\n }, 0);\n\n return Number(totalWorkHours.toFixed(2));\n}\n\n/**\n * Find the last consecutive day in a schedule (used to summarize work hours)\n * @param startDay - The starting day\n * @param dailySchedule - The daily schedule\n * @returns The last consecutive day\n */\nfunction findLastConsecutiveDay(\n startDay: string,\n dailySchedule: DailySchedule[],\n): Weekday | null {\n const daysScheduled = dailySchedule.map(\n ({ day }: DailySchedule) => day.toLowerCase() as Weekday,\n );\n\n let idx = daysScheduled.indexOf(startDay as Weekday);\n let day: Weekday | null = null;\n\n while (idx < daysScheduled.length && !day) {\n const currentDay = daysScheduled[idx];\n const nextDay = daysScheduled[idx + 1];\n\n const nextDayIdx = DAYS_OF_THE_WEEK.indexOf(currentDay) + 1;\n const isNextDay = DAYS_OF_THE_WEEK[nextDayIdx] === nextDay;\n\n if (!isNextDay) {\n day = currentDay;\n }\n\n idx += 1;\n }\n\n return day;\n}\n\n/**\n * Check if a day schedule should be summarized\n * @param daySchedule - The day schedule\n * @returns True if the day schedule should be summarized\n */\nfunction shouldSummarizeSchedule(daySchedule: DailySchedule) {\n return (\n daySchedule.start_time &&\n daySchedule.end_time &&\n (typeof daySchedule.hours === 'number'\n ? daySchedule.hours\n : Number.parseInt(daySchedule.hours)) > 0\n );\n}\n\n/**\n * Check if break duration should be summarized\n * @param daySchedule - The day schedule\n * @returns True if the break duration should be summarized\n */\nfunction shouldSummarizeBreaks(daySchedule: DailySchedule) {\n return Number.parseInt(daySchedule.break_duration_minutes) > 0;\n}\n\n/**\n * Build the work schedule summary\n * @param dailySchedules - The daily schedules\n * @returns The work schedule summary\n */\nexport function buildWorkScheduleSummary(dailySchedules: DailySchedule[]) {\n const activeScheduleDays = dailySchedules.filter(shouldSummarizeSchedule);\n\n const groupedWorkHours = groupBy(activeScheduleDays, (dailySchedule) => {\n return `${dailySchedule.start_time}|${dailySchedule.end_time}`;\n });\n\n const activeBreakDays = dailySchedules.filter(shouldSummarizeBreaks);\n const groupedBreaks = groupBy(activeBreakDays, 'break_duration_minutes');\n\n const workHoursSummary = Object.keys(groupedWorkHours).map(\n (scheduleTimes) => {\n const sameDailySchedule = groupedWorkHours[scheduleTimes];\n const startDay = sameDailySchedule[0].day;\n const [start_time, end_time] = scheduleTimes.split('|');\n const timeSummary = `from <span>${start_time.replace(':', 'h')}</span> to <span>${end_time.replace(':', 'h')}</span>`;\n\n const lastConsecutiveDay = findLastConsecutiveDay(\n startDay,\n sameDailySchedule,\n );\n const lastConsecutiveDayIdx = lastConsecutiveDay\n ? sameDailySchedule.findIndex(\n (dailySchedule) => dailySchedule.day === lastConsecutiveDay,\n )\n : -1;\n const allDaysAreConsecutive =\n lastConsecutiveDayIdx === sameDailySchedule.length - 1;\n\n if (sameDailySchedule.length === 1) {\n return `${capitalize(startDay)}, ${timeSummary}`;\n }\n\n if (!allDaysAreConsecutive || !lastConsecutiveDay) {\n return sameDailySchedule.reduce((summary, dailySchedule, idx) => {\n const day = capitalize(dailySchedule.day);\n if (idx === sameDailySchedule.length - 1) {\n return `${summary}and ${day}, ${timeSummary}`;\n }\n\n return `${summary}<span>${day}</span>, `;\n }, '');\n }\n\n return `<span>${capitalize(startDay)}</span> to <span>${capitalize(lastConsecutiveDay)}</span>, ${timeSummary}`;\n },\n );\n\n const breakSummary = Object.keys(groupedBreaks)\n .reverse()\n .map((breakDuration, idx) => {\n const isFirstGroup = idx === 0;\n const sameDailyBreaks = groupedBreaks[breakDuration];\n const breakString = convertBreakDurationToHours(\n parseInt(breakDuration, 10),\n );\n\n if (Object.keys(groupedBreaks).length === 1) {\n return `With ${breakString} daily breaks`;\n }\n\n if (sameDailyBreaks.length === 1) {\n const breakText = `${breakString} break on ${capitalize(sameDailyBreaks[0].day)}.`;\n return isFirstGroup ? `With ${breakText}` : breakText;\n }\n\n return sameDailyBreaks.reduce(\n (summary, dailySchedule, breakIdx) => {\n const day = capitalize(dailySchedule.day);\n\n if (breakIdx === 0) {\n return `${summary} ${day}`;\n }\n\n if (breakIdx === sameDailyBreaks.length - 1) {\n return `${summary}, and ${day}.`;\n }\n\n return `${summary}, ${day}`;\n },\n isFirstGroup\n ? `With ${breakString} break on`\n : `${breakString} break on`,\n );\n });\n\n return { workHoursSummary, breakSummary };\n}\n\n// Calculate hours for each day\nexport function calculateHours(day: DailySchedule) {\n const { checked, start_time, end_time, break_duration_minutes } = day;\n if (!checked) return 0;\n\n const [startHour, startMin] = start_time.split(':').map(Number);\n const [endHour, endMin] = end_time.split(':').map(Number);\n\n const startTotalMin = startHour * 60 + startMin;\n const endTotalMin = endHour * 60 + endMin;\n const workMinutes =\n endTotalMin -\n startTotalMin -\n Number.parseInt(break_duration_minutes || '0');\n\n const hours = workMinutes / 60;\n return hours === Math.floor(hours) ? hours : Number(hours.toFixed(2));\n}\n\ntype Weekday = (typeof DAYS_OF_THE_WEEK)[number];\n\nconst dayMap: Record<Weekday, string> = {\n monday: 'Mon',\n tuesday: 'Tue',\n wednesday: 'Wed',\n thursday: 'Thu',\n friday: 'Fri',\n saturday: 'Sat',\n sunday: 'Sun',\n};\n\nexport function getShortWeekday(fullName: Weekday): string {\n return dayMap[fullName];\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\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 { MultiSelect } from '../../ui/multi-select';\nimport { useState } from 'react';\n\ntype MultiSelectFieldProps = JSFField & {\n placeholder?: string;\n options: Array<{ value: string; label: string }>;\n className?: string;\n onChange?: (value: any) => void;\n component?: Components['select'];\n};\n\nexport function MultiSelectField({\n label,\n name,\n options,\n defaultValue,\n description,\n onChange,\n component,\n ...rest\n}: MultiSelectFieldProps) {\n const { control } = useFormContext();\n const { components } = useFormFields();\n const [selected, setSelected] = useState<any[]>();\n\n return (\n <FormField\n defaultValue={defaultValue}\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n const CustomSelectField = component || components?.['multi-select'];\n if (CustomSelectField) {\n const customSelectFieldProps = {\n label,\n name,\n options,\n defaultValue,\n description,\n onChange,\n ...rest,\n };\n return (\n <CustomSelectField\n field={{\n ...field,\n onChange: (value: any) => {\n field.onChange(value);\n onChange?.(value);\n },\n }}\n fieldState={fieldState}\n fieldData={customSelectFieldProps}\n />\n );\n }\n\n const selectedOptions =\n selected ||\n options.filter((option) => field.value.includes(option.value));\n\n return (\n <FormItem\n data-field={name}\n className={`RemoteFlows__SelectField__Item__${name}`}\n >\n <FormLabel className='RemoteFlows__SelectField__Label'>\n {label}\n </FormLabel>\n <FormControl>\n <MultiSelect\n options={options}\n selected={selectedOptions}\n onChange={(rawValues: any[]) => {\n const values = rawValues.map(({ value }) => value);\n field.onChange(values);\n onChange?.(values);\n setSelected(rawValues);\n }}\n {...rest}\n />\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {fieldState.error && <FormMessage />}\n </FormItem>\n );\n }}\n />\n );\n}\n","import {\n NumberField,\n NumberFieldProps,\n} from '@/src/components/form/fields/NumberField';\n\n// TODO: We use the number field and the the number type is what the partner overrides\n// TODO: this needs to be changed in the future with the changes from https://github.com/remoteoss/remote-flows/pull/128\nexport const MoneyField = (props: NumberFieldProps) => {\n return <NumberField maxLength={15} {...props} />;\n};\n","import { CheckBoxField } from './CheckBoxField';\nimport { DatePickerField } from './DatePickerField';\nimport { FileUploadField } from './FileUploadField';\nimport { NumberField } from './NumberField';\nimport { RadioGroupField } from './RadioGroupField';\nimport { SelectField } from './SelectField';\nimport { CountryField } from './CountryField';\nimport { TextAreaField } from './TextAreaField';\nimport { TextField } from './TextField';\nimport { EmailField } from './EmailField';\nimport { HiddenField } from './HiddenField';\nimport { WorkScheduleField } from './WorkScheduleField';\nimport { MultiSelectField } from './MultiSelectField';\nimport { MoneyField } from './MoneyField';\nimport { SupportedTypes } from './types';\nimport { $TSFixMe } from '@/src/types/remoteFlows';\n\nexport const baseFields: Record<\n Exclude<SupportedTypes, 'fieldset' | 'fieldset-flat'>,\n React.ComponentType<$TSFixMe>\n> = {\n checkbox: CheckBoxField,\n text: TextField,\n email: EmailField,\n money: MoneyField,\n select: SelectField,\n 'multi-select': MultiSelectField,\n radio: RadioGroupField,\n number: NumberField,\n file: FileUploadField,\n date: DatePickerField,\n textarea: TextAreaField,\n countries: CountryField,\n hidden: HiddenField,\n 'work-schedule': WorkScheduleField,\n};\n","import { Alert, AlertDescription, AlertTitle } from '@/src/components/ui/alert';\nimport { useFormFields } from '@/src/context';\nimport { AlertCircle } from 'lucide-react';\n\nexport type StatementProps = {\n title?: string;\n description: string;\n severity: 'warning' | 'error' | 'success' | 'info' | 'neutral' | 'time';\n};\n\nexport function Statement({ title, description, severity }: StatementProps) {\n const { components } = useFormFields();\n\n if (components?.statement) {\n const CustomStatement = components?.statement;\n return (\n <CustomStatement\n data={{\n title,\n description,\n severity,\n }}\n />\n );\n }\n\n return (\n <Alert variant='warning'>\n <AlertCircle className='h-4 w-4' />\n {title && <AlertTitle>{title}</AlertTitle>}\n <AlertDescription>{description}</AlertDescription>\n </Alert>\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { baseFields } from '@/src/components/form/fields/baseFields';\nimport { cn, sanitizeHtml } from '@/src/lib/utils';\nimport { SupportedTypes } from './types';\nimport {\n $TSFixMe,\n Components,\n FieldSetToggleComponentProps,\n} from '@/src/types/remoteFlows';\nimport { Statement, StatementProps } from '@/src/components/form/Statement';\nimport { useFormContext } from 'react-hook-form';\nimport { Fragment, useEffect, useRef } from 'react';\nimport { useFormFields } from '@/src/context';\nimport { Button } from '@/src/components/ui/button';\n\ntype FieldBase = {\n label: string;\n name: string;\n description: string;\n Component?: React.ComponentType<any>;\n inputType: SupportedTypes;\n multiple?: boolean;\n};\n\ntype FieldWithOptions = FieldBase & {\n type: 'select' | 'radio';\n options: Array<{ value: string; label: string }>;\n};\n\ntype FieldWithoutOptions = FieldBase & {\n type: Exclude<SupportedTypes, 'select' | 'radio'>;\n options?: never;\n};\n\ntype Field = FieldWithOptions | FieldWithoutOptions;\n\ntype FieldSetFeatures = {\n toggle?: {\n enabled: boolean;\n defaultExpanded?: boolean;\n stateField?: string;\n labels?: {\n expand: string;\n collapse: string;\n };\n className?: string;\n };\n};\n\nexport type FieldSetProps = {\n label: string;\n name: string;\n description: string;\n fields: Field[];\n features?: FieldSetFeatures;\n components: Components;\n statement?: StatementProps;\n isFlatFieldset: boolean;\n extra?: React.ReactNode;\n variant: 'outset' | 'inset';\n};\n\nconst DefaultToggleButton = ({\n isExpanded,\n onToggle,\n className,\n ...props\n}: FieldSetToggleComponentProps) => (\n <Button\n type='button'\n className={cn(\n 'RemoteFlows__Button RemoteFlows__FieldSetField__ToggleButton',\n className,\n )}\n variant='default'\n onClick={onToggle}\n {...props}\n >\n {isExpanded ? 'Remove' : 'Define'}\n </Button>\n);\n\nexport function FieldSetField({\n label,\n name,\n fields,\n description,\n components,\n statement,\n isFlatFieldset,\n extra,\n variant = 'outset',\n features,\n}: FieldSetProps) {\n const { watch, setValue, trigger, formState } = useFormContext();\n const { components: formComponents } = useFormFields();\n\n // Get expanded state from form state if stateField is provided\n const stateField = features?.toggle?.stateField;\n const isExpanded = stateField\n ? watch(stateField)\n : (features?.toggle?.defaultExpanded ?? true);\n\n const fieldNames = fields.map(\n ({ name: fieldName }) => `${name}.${fieldName}`,\n );\n const watchedValues = watch(fieldNames);\n const prevValuesRef = useRef<string[]>(watchedValues);\n const triggerTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n const toggleExpanded = () => {\n if (stateField) {\n setValue(stateField, !isExpanded);\n }\n };\n\n useEffect(() => {\n const currentValues = watchedValues;\n const previousValues = prevValuesRef.current;\n const hasBeenSubmitted = formState.isSubmitted || formState.submitCount > 0;\n\n // Check if any value has changed\n let hasChanged = false;\n for (let i = 0; i < currentValues.length; i++) {\n if (\n currentValues[i] !== undefined &&\n previousValues[i] !== currentValues[i]\n ) {\n hasChanged = true;\n // This is to prevent the form from triggering validation too many times\n break;\n }\n }\n // If changes detected and we haven't triggered yet, run trigger\n if (hasChanged && hasBeenSubmitted) {\n // We need to debounce the validation trigger so that tests don't freeze\n if (triggerTimeoutRef.current) {\n clearTimeout(triggerTimeoutRef.current);\n }\n triggerTimeoutRef.current = setTimeout(() => {\n trigger();\n }, 50);\n }\n\n prevValuesRef.current = [...currentValues];\n\n return () => {\n if (triggerTimeoutRef.current) {\n clearTimeout(triggerTimeoutRef.current);\n }\n };\n }, [watchedValues, trigger, formState.isSubmitted, formState.submitCount]);\n\n const ToggleComponent = formComponents?.fieldsetToggle || DefaultToggleButton;\n const contentId = `${name}-content`;\n const headerId = `${name}-header`;\n\n return (\n <fieldset\n className={cn(\n 'border-1 border-input p-4 rounded-xl',\n `RemoteFlows__FieldSetField`,\n `RemoteFlows__FieldSetField__${name}`,\n )}\n >\n <legend\n className={cn(\n 'text-sm font-semibold px-2',\n variant === 'inset' && 'hidden',\n )}\n >\n {label}\n </legend>\n {variant === 'inset' && (\n <div\n className='RemoteFlows__FieldSetField__Header'\n id={headerId}\n data-state={isExpanded ? 'expanded' : 'collapsed'}\n aria-expanded={isExpanded}\n >\n <h3 className={cn('RemoteFlows__FieldSetField__Title')}>{label}</h3>\n {features?.toggle?.enabled && (\n <ToggleComponent\n isExpanded={isExpanded}\n onToggle={toggleExpanded}\n aria-expanded={isExpanded}\n aria-controls={contentId}\n aria-label={`${isExpanded ? 'Hide' : 'Show'} ${label}`}\n className={cn(\n 'RemoteFlows__FieldSetField__Toggle',\n features.toggle?.className,\n )}\n >\n {isExpanded\n ? (features.toggle.labels?.collapse ?? 'Remove')\n : (features.toggle.labels?.expand ?? 'Define')}\n </ToggleComponent>\n )}\n </div>\n )}\n {isExpanded && (\n <div id={contentId} aria-labelledby={headerId} role='region'>\n {description ? (\n <div\n className='mb-5 RemoteFlows__FieldSetField__Description'\n dangerouslySetInnerHTML={{ __html: sanitizeHtml(description) }}\n />\n ) : null}\n <div className='grid gap-4'>\n {fields.map((field: $TSFixMe) => {\n if (field.calculateDynamicProperties) {\n field = {\n ...field,\n ...(field.calculateDynamicProperties(watchedValues, field) ||\n {}),\n };\n }\n let FieldComponent =\n baseFields[\n field.type as Exclude<\n SupportedTypes,\n 'fieldset' | 'fieldset-flat'\n >\n ];\n\n if (field.isVisible === false || field.deprecated) {\n return null; // Skip hidden or deprecated fields\n }\n\n if (field.Component) {\n const { Component } = field as {\n Component: React.ComponentType<any>;\n };\n return <Component key={field.name} {...field} />;\n }\n\n if (field.type === 'select' && field.multiple) {\n FieldComponent = baseFields['multi-select'];\n }\n\n return (\n <Fragment\n key={`${isFlatFieldset ? field.name : `${name}.${field.name}`}`}\n >\n <FieldComponent\n {...field}\n name={`${isFlatFieldset ? field.name : `${name}.${field.name}`}`}\n component={components?.[field.type as SupportedTypes]}\n />\n {field.extra ? field.extra : null}\n </Fragment>\n );\n })}\n {extra ? extra : null}\n {statement ? <Statement {...statement} /> : null}\n </div>\n </div>\n )}\n </fieldset>\n );\n}\n"],"mappings":"glBA+EY,OAyBE,YAAAA,GAzBF,OAAAC,EA8BQ,QAAAC,OA9BR,oBAlDL,SAASC,GAAc,CAC5B,KAAAC,EACA,aAAAC,EACA,YAAAC,EACA,MAAAC,EACA,SAAAC,EACA,SAAAC,EACA,QAAAC,EACA,UAAAC,EACA,GAAGC,CACL,EAAuB,CACrB,GAAM,CAAE,WAAAC,CAAW,EAAIC,EAAc,EAC/B,CAAE,QAAAC,CAAQ,EAAIC,EAAe,EAE7BC,EAAuBC,EAAA,CAC3BC,EACAC,EACAC,IACG,CACH,IAAMC,EAAgBD,EAAM,MAAQ,CAAC,GAAGA,EAAM,KAAK,EAAI,CAAC,EAE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GAAM,CAAE,UAAAG,EAAU,EAAIH,EAGtB,OAAO9C,EAACiD,GAAA,CAA4B,GAAGH,GAAhBA,EAAM,IAAiB,CAChD,CAEA,OAAIA,EAAM,OAAS,UAAYA,EAAM,WACnCC,GAAiBC,GAAW,cAAc,GAI1C/C,GAACiD,GAAA,CAGC,UAAAlD,EAAC+C,GAAA,CACE,GAAGD,EACJ,KAAM,GAAG7B,EAAiB6B,EAAM,KAAO,GAAGlC,CAAI,IAAIkC,EAAM,IAAI,EAAE,GAC9D,UAAW/B,IAAa+B,EAAM,IAAsB,EACtD,EACCA,EAAM,MAAQA,EAAM,MAAQ,OAPxB,GAAG7B,EAAiB6B,EAAM,KAAO,GAAGlC,CAAI,IAAIkC,EAAM,IAAI,EAAE,EAQ/D,CAEJ,CAAC,EACA5B,GAAgB,KAChBF,EAAYhB,EAACmD,GAAA,CAAW,GAAGnC,EAAW,EAAK,MAC9C,GACF,GAEJ,CAEJ,CAlLgBb,EAAAO,GAAA","names":["Fragment","jsx","jsxs","CheckBoxField","name","defaultValue","description","label","onChange","multiple","options","component","rest","components","useFormFields","control","useFormContext","handleCheckboxChange","__name","optionId","checked","field","currentValues","value","FormField","fieldState","CustomCheckboxField","customCheckboxFieldProps","evt","FormItem","cn","FormControl","FormLabel","option","Checkbox","event","FormDescription","FormMessage","CalendarIcon","PopoverClose","ChevronLeft","ChevronRight","DayPicker","jsx","Calendar","className","classNames","showOutsideDays","props","DayPicker","cn","buttonVariants","__name","ChevronLeft","ChevronRight","PopoverPrimitive","jsx","Popover","props","__name","PopoverTrigger","PopoverContent","className","align","sideOffset","cn","format","Fragment","jsx","jsxs","DatePickerField","description","label","name","minDate","onChange","component","rest","components","useFormFields","control","useFormContext","minDateValue","getMinStartDate","FormField","field","fieldState","CustomDatePickerField","customDatePickerFieldProps","__name","value","FormItem","FormLabel","Popover","PopoverTrigger","FormControl","Button","cn","format","CalendarIcon","PopoverContent","Calendar","date","props","PopoverClose","FormDescription","FormMessage","useState","useRef","Upload","X","jsx","jsxs","FileUploader","onChange","className","multiple","files","setFiles","useState","inputRef","useRef","handleClick","__name","e","handleChange","newFiles","onRemoveFile","file","prevFiles","f","cn","Button","Upload","index","X","jsx","jsxs","toBase64","__name","file","resolve","reject","reader","error","convertFilesToBase64","event","files","base64","FileUploadField","name","description","label","multiple","onChange","component","rest","components","useFormFields","control","useFormContext","FormField","field","fieldState","CustomFileUploadField","customFileUploadFieldProps","value","FormItem","FormLabel","FormControl","FileUploader","cn","FormDescription","FormMessage","jsx","NumberField","props","components","useFormFields","control","useFormContext","CustomNumberField","FormField","field","fieldState","__name","value","TextField","Fragment","jsx","jsxs","RadioGroupField","name","defaultValue","description","label","options","onChange","component","rest","components","useFormFields","control","useFormContext","FormField","field","fieldState","CustomRadioGroupField","customRadioGroupFieldProps","__name","value","FormItem","cn","FormLabel","FormControl","RadioGroup","option","Fragment","RadioGroupItem","FormDescription","FormMessage","jsx","jsxs","SelectField","label","name","options","defaultValue","description","onChange","component","rest","control","useFormContext","components","useFormFields","FormField","field","fieldState","CustomSelectField","customSelectFieldProps","__name","value","maybeCastValue","FormItem","FormLabel","FormControl","Select","SelectTrigger","SelectValue","SelectContent","SelectGroup","option","SelectItem","FormDescription","FormMessage","useState","Fragment","useState","Check","ChevronDownIcon","X","CommandPrimitive","SearchIcon","jsx","jsxs","Command","className","props","CommandPrimitive","cn","__name","CommandList","className","props","jsx","CommandPrimitive","cn","__name","CommandEmpty","CommandGroup","CommandSeparator","CommandItem","jsx","jsxs","MultiSelect","options","selected","onChange","placeholder","props","open","setOpen","useState","handleUnselect","__name","option","item","hasCategories","groupedOptions","groups","category","Popover","PopoverTrigger","Button","Badge","e","X","ChevronDownIcon","PopoverContent","Command","CommandList","CommandEmpty","categoryOptions","index","Fragment","CommandSeparator","CommandGroup","isSelected","CommandItem","Check","cn","jsx","jsxs","CountryField","label","name","options","defaultValue","description","onChange","$meta","component","rest","control","useFormContext","components","useFormFields","selected","setSelected","useState","FormField","field","fieldState","CustomSelectField","customSelectFieldProps","__name","value","countryOptions","key","option","handleChange","rawValues","values","FormItem","FormLabel","FormControl","MultiSelect","FormDescription","FormMessage","React","jsx","Textarea","className","props","ref","cn","jsx","jsxs","TextAreaField","name","description","label","onChange","maxLength","component","rest","components","useFormFields","control","useFormContext","FormField","field","fieldState","CustomTextAreaField","customTextAreaFieldProps","__name","value","valueLength","FormItem","FormLabel","FormControl","Textarea","event","cn","FormDescription","FormMessage","jsx","EmailField","props","components","useFormFields","control","useFormContext","CustomEmailField","FormField","field","fieldState","__name","value","TextField","jsx","HiddenField","props","control","useFormContext","FormField","field","__name","React","useEffect","useState","setCustomValidity","ref","fieldPath","errors","error","get","message","reportValidity","validateFieldsNatively","options","fields","field","refs","forEach","toNestErrors","shouldUseNativeValidation","fieldErrors","path","Object","assign","isNameInFieldArray","names","keys","fieldArrayErrors","set","name","escapeBrackets","some","n","match","input","replace","yupResolver","schema","schemaOptions","resolverOptions","values","context","options","Promise","resolve","process","env","NODE_ENV","console","warn","mode","Object","assign","abortEarly","then","result","shouldUseNativeValidation","validateFieldsNatively","raw","errors","e","r","u","_catch","inner","toNestErrors","error","validateAllFieldCriteria","criteriaMode","reduce","previous","path","message","type","types","messages","appendErrors","concat","reject","yup","groupBy","capitalize","MINUTES_IN_HOUR","DAYS_OF_THE_WEEK","convertBreakDurationToHours","breakDuration","hours","minutes","__name","calculateTotalWorkHours","dailySchedules","totalWorkHours","total","daySchedule","findLastConsecutiveDay","startDay","dailySchedule","daysScheduled","day","idx","currentDay","nextDay","nextDayIdx","shouldSummarizeSchedule","shouldSummarizeBreaks","buildWorkScheduleSummary","activeScheduleDays","groupedWorkHours","groupBy","activeBreakDays","groupedBreaks","workHoursSummary","scheduleTimes","sameDailySchedule","start_time","end_time","timeSummary","lastConsecutiveDay","allDaysAreConsecutive","capitalize","summary","breakSummary","isFirstGroup","sameDailyBreaks","breakString","breakText","breakIdx","calculateHours","checked","break_duration_minutes","startHour","startMin","endHour","endMin","startTotalMin","dayMap","getShortWeekday","fullName","jsx","jsxs","fieldSchema","__name","schema","formSchema","WorkScheduleSelectionForm","defaultSchedule","onSubmit","openDialog","setOpenDialog","useState","transformedSchedule","DAYS_OF_THE_WEEK","day","existingSchedule","schedule","getShortWeekday","form","useForm","o","handleSubmit","watch","reset","control","formState","fields","useFieldArray","watchedSchedule","handleSubmitWorkingHours","data","checked","calculateHours","handleCancel","Dialog","DialogTrigger","Button","DialogContent","DialogHeader","DialogTitle","Form","field","index","currentDay","calculatedHours","React","CheckBoxField","TextField","WorkScheduleField","props","components","useFormFields","setValue","useFormContext","currentSchedule","setCurrentSchedule","workHoursSummary","breakSummary","buildWorkScheduleSummary","totalWorkHours","calculateTotalWorkHours","useEffect","CustomWorkScheduleField","FormField","fieldState","value","useState","jsx","jsxs","MultiSelectField","label","name","options","defaultValue","description","onChange","component","rest","control","useFormContext","components","useFormFields","selected","setSelected","useState","FormField","field","fieldState","CustomSelectField","customSelectFieldProps","__name","value","selectedOptions","option","FormItem","FormLabel","FormControl","MultiSelect","rawValues","values","FormDescription","FormMessage","jsx","MoneyField","__name","props","NumberField","baseFields","CheckBoxField","TextField","EmailField","MoneyField","SelectField","MultiSelectField","RadioGroupField","NumberField","FileUploadField","DatePickerField","TextAreaField","CountryField","HiddenField","WorkScheduleField","AlertCircle","jsx","jsxs","Statement","title","description","severity","components","useFormFields","CustomStatement","Alert","AlertCircle","AlertTitle","AlertDescription","__name","Fragment","useEffect","useRef","jsx","jsxs","DefaultToggleButton","__name","isExpanded","onToggle","className","props","Button","cn","FieldSetField","label","name","fields","description","components","statement","isFlatFieldset","extra","variant","features","watch","setValue","trigger","formState","useFormContext","formComponents","useFormFields","stateField","fieldNames","fieldName","watchedValues","prevValuesRef","useRef","triggerTimeoutRef","toggleExpanded","useEffect","currentValues","previousValues","hasBeenSubmitted","hasChanged","i","ToggleComponent","contentId","headerId","sanitizeHtml","field","FieldComponent","baseFields","Component","Fragment","Statement"]}
@@ -1,2 +1,2 @@
1
- var e={data:{version:7,schema:{additionalProperties:!1,properties:{country:{title:"Country",description:"",type:"string",oneOf:[],"x-jsf-presentation":{inputType:"select"}},region:{title:"Region",description:"",type:"string",oneOf:[],"x-jsf-presentation":{inputType:"select"}},currency:{title:"Currency",description:"",type:"string",oneOf:[],"x-jsf-presentation":{inputType:"select"}},currency_statement:{type:"null",title:"Company statement","x-jsf-presentation":{inputType:"hidden",hidden:!0,statement:{title:"<TITLE_PLACEHOLDER>",description:"<DESCRIPTION_PLACEHOLDER>",inputType:"statement",severity:"warning"},meta:{ignoreValue:!0}}},hiring_budget:{title:"How would you like to estimate the cost of hiring?",enum:["employee_annual_salary","my_hiring_budget"],type:"string",oneOf:[{title:"With the employee's annual salary",const:"employee_annual_salary"},{title:"With my hiring budget for this role",const:"my_hiring_budget"}],"x-jsf-presentation":{inputType:"radio"}},salary:{description:"",title:"Salary",type:"integer","x-jsf-presentation":{inputType:"money"}},estimation_title:{title:"Estimation title",description:'Employee title. e.g; "Software Engineer".',type:"string","x-jsf-presentation":{inputType:"text",hidden:!0}},salary_conversion:{description:"",title:"Salary",type:"integer","x-jsf-presentation":{inputType:"money",hidden:!0}},salary_converted:{description:"Whether the salary is expressed in regional or employer currency",title:"Salary in employer currency",type:"string","x-jsf-presentation":{inputType:"hidden",hidden:!0}},management:{title:"Management fee",type:"object",properties:{management_fee:{title:"Desired monthly management fee",type:"integer","x-jsf-presentation":{inputType:"money"}}},"x-jsf-presentation":{inputType:"fieldset",hidden:!0}}},required:["country","currency","salary","salary_conversion","salary_converted"],type:"object","x-jsf-order":["country","region","currency","currency_statement","salary","estimation_title","management"]}}};export{e as a};
2
- //# sourceMappingURL=chunk-N7DP4HY4.js.map
1
+ var e={data:{version:7,schema:{additionalProperties:!1,properties:{country:{title:"Country",description:"",type:"string",oneOf:[],"x-jsf-presentation":{inputType:"select"}},region:{title:"Region",description:"",type:"string",oneOf:[],"x-jsf-presentation":{inputType:"select"}},currency:{title:"Currency",description:"",type:"string",oneOf:[],"x-jsf-presentation":{inputType:"select"}},currency_statement:{type:"null",title:"Company statement","x-jsf-presentation":{inputType:"hidden",hidden:!0,statement:{title:"<TITLE_PLACEHOLDER>",description:"<DESCRIPTION_PLACEHOLDER>",inputType:"statement",severity:"warning"},meta:{ignoreValue:!0}}},hiring_budget:{title:"How would you like to estimate the cost of hiring?",enum:["employee_annual_salary","my_hiring_budget"],type:"string",oneOf:[{title:"With the employee's annual salary",const:"employee_annual_salary"},{title:"With my hiring budget for this role",const:"my_hiring_budget"}],"x-jsf-presentation":{inputType:"radio"}},salary:{description:"",title:"Salary",type:"integer","x-jsf-presentation":{inputType:"money"}},estimation_title:{title:"Estimation title",description:'Employee title. e.g; "Software Engineer".',type:"string","x-jsf-presentation":{inputType:"text",hidden:!0}},salary_conversion:{description:"",title:"Salary",type:"integer","x-jsf-presentation":{inputType:"money",hidden:!0}},salary_converted:{description:"Whether the salary is expressed in regional or employer currency",title:"Salary in employer currency",type:"string","x-jsf-presentation":{inputType:"hidden",hidden:!0}},management:{title:"Management fee",type:"object",properties:{management_fee:{title:"Desired monthly management fee",type:"integer","x-jsf-presentation":{inputType:"money"}},_expanded:{type:"boolean",default:!1,"x-jsf-presentation":{inputType:"hidden",hidden:!0}}},"x-jsf-presentation":{inputType:"fieldset",hidden:!0}}},required:["country","currency","salary","salary_conversion","salary_converted"],type:"object","x-jsf-order":["country","region","currency","currency_statement","salary","estimation_title","management"]}}};export{e as a};
2
+ //# sourceMappingURL=chunk-VFRHMNLJ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/flows/CostCalculator/jsonSchema.ts"],"sourcesContent":["export const jsonSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n properties: {\n country: {\n title: 'Country',\n description: '',\n type: 'string',\n oneOf: [],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n region: {\n title: 'Region',\n description: '',\n type: 'string',\n oneOf: [],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n currency: {\n title: 'Currency',\n description: '',\n type: 'string',\n oneOf: [],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n currency_statement: {\n type: 'null',\n title: 'Company statement',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n hidden: true,\n statement: {\n title: '<TITLE_PLACEHOLDER>',\n description: '<DESCRIPTION_PLACEHOLDER>',\n inputType: 'statement',\n severity: 'warning',\n },\n meta: {\n ignoreValue: true,\n },\n },\n },\n hiring_budget: {\n title: 'How would you like to estimate the cost of hiring?',\n enum: ['employee_annual_salary', 'my_hiring_budget'],\n type: 'string',\n oneOf: [\n {\n title: \"With the employee's annual salary\",\n const: 'employee_annual_salary',\n },\n {\n title: 'With my hiring budget for this role',\n const: 'my_hiring_budget',\n },\n ],\n 'x-jsf-presentation': {\n inputType: 'radio',\n },\n },\n salary: {\n description: '',\n title: 'Salary',\n type: 'integer',\n 'x-jsf-presentation': {\n inputType: 'money',\n },\n },\n estimation_title: {\n title: 'Estimation title',\n description: 'Employee title. e.g; \"Software Engineer\".',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'text',\n hidden: true,\n },\n },\n salary_conversion: {\n description: '',\n title: 'Salary',\n type: 'integer',\n 'x-jsf-presentation': {\n inputType: 'money',\n hidden: true,\n },\n },\n salary_converted: {\n description:\n 'Whether the salary is expressed in regional or employer currency',\n title: 'Salary in employer currency',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n hidden: true,\n },\n },\n management: {\n title: 'Management fee',\n type: 'object',\n properties: {\n management_fee: {\n title: 'Desired monthly management fee',\n type: 'integer',\n 'x-jsf-presentation': {\n inputType: 'money',\n },\n },\n },\n 'x-jsf-presentation': {\n inputType: 'fieldset',\n hidden: true,\n },\n },\n },\n required: [\n 'country',\n 'currency',\n 'salary',\n 'salary_conversion',\n 'salary_converted',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'country',\n 'region',\n 'currency',\n 'currency_statement',\n 'salary',\n 'estimation_title',\n 'management',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAAa,CACxB,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,WAAY,CACV,QAAS,CACP,MAAO,UACP,YAAa,GACb,KAAM,SACN,MAAO,CAAC,EACR,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,OAAQ,CACN,MAAO,SACP,YAAa,GACb,KAAM,SACN,MAAO,CAAC,EACR,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,SAAU,CACR,MAAO,WACP,YAAa,GACb,KAAM,SACN,MAAO,CAAC,EACR,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,mBAAoB,CAClB,KAAM,OACN,MAAO,oBACP,qBAAsB,CACpB,UAAW,SACX,OAAQ,GACR,UAAW,CACT,MAAO,sBACP,YAAa,4BACb,UAAW,YACX,SAAU,SACZ,EACA,KAAM,CACJ,YAAa,EACf,CACF,CACF,EACA,cAAe,CACb,MAAO,qDACP,KAAM,CAAC,yBAA0B,kBAAkB,EACnD,KAAM,SACN,MAAO,CACL,CACE,MAAO,oCACP,MAAO,wBACT,EACA,CACE,MAAO,sCACP,MAAO,kBACT,CACF,EACA,qBAAsB,CACpB,UAAW,OACb,CACF,EACA,OAAQ,CACN,YAAa,GACb,MAAO,SACP,KAAM,UACN,qBAAsB,CACpB,UAAW,OACb,CACF,EACA,iBAAkB,CAChB,MAAO,mBACP,YAAa,4CACb,KAAM,SACN,qBAAsB,CACpB,UAAW,OACX,OAAQ,EACV,CACF,EACA,kBAAmB,CACjB,YAAa,GACb,MAAO,SACP,KAAM,UACN,qBAAsB,CACpB,UAAW,QACX,OAAQ,EACV,CACF,EACA,iBAAkB,CAChB,YACE,mEACF,MAAO,8BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,OAAQ,EACV,CACF,EACA,WAAY,CACV,MAAO,iBACP,KAAM,SACN,WAAY,CACV,eAAgB,CACd,MAAO,iCACP,KAAM,UACN,qBAAsB,CACpB,UAAW,OACb,CACF,CACF,EACA,qBAAsB,CACpB,UAAW,WACX,OAAQ,EACV,CACF,CACF,EACA,SAAU,CACR,UACA,WACA,SACA,oBACA,kBACF,EACA,KAAM,SACN,cAAe,CACb,UACA,SACA,WACA,qBACA,SACA,mBACA,YACF,CACF,CACF,CACF","names":["jsonSchema"]}
1
+ {"version":3,"sources":["../src/flows/CostCalculator/jsonSchema.ts"],"sourcesContent":["export const jsonSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n properties: {\n country: {\n title: 'Country',\n description: '',\n type: 'string',\n oneOf: [],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n region: {\n title: 'Region',\n description: '',\n type: 'string',\n oneOf: [],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n currency: {\n title: 'Currency',\n description: '',\n type: 'string',\n oneOf: [],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n currency_statement: {\n type: 'null',\n title: 'Company statement',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n hidden: true,\n statement: {\n title: '<TITLE_PLACEHOLDER>',\n description: '<DESCRIPTION_PLACEHOLDER>',\n inputType: 'statement',\n severity: 'warning',\n },\n meta: {\n ignoreValue: true,\n },\n },\n },\n hiring_budget: {\n title: 'How would you like to estimate the cost of hiring?',\n enum: ['employee_annual_salary', 'my_hiring_budget'],\n type: 'string',\n oneOf: [\n {\n title: \"With the employee's annual salary\",\n const: 'employee_annual_salary',\n },\n {\n title: 'With my hiring budget for this role',\n const: 'my_hiring_budget',\n },\n ],\n 'x-jsf-presentation': {\n inputType: 'radio',\n },\n },\n salary: {\n description: '',\n title: 'Salary',\n type: 'integer',\n 'x-jsf-presentation': {\n inputType: 'money',\n },\n },\n estimation_title: {\n title: 'Estimation title',\n description: 'Employee title. e.g; \"Software Engineer\".',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'text',\n hidden: true,\n },\n },\n salary_conversion: {\n description: '',\n title: 'Salary',\n type: 'integer',\n 'x-jsf-presentation': {\n inputType: 'money',\n hidden: true,\n },\n },\n salary_converted: {\n description:\n 'Whether the salary is expressed in regional or employer currency',\n title: 'Salary in employer currency',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n hidden: true,\n },\n },\n management: {\n title: 'Management fee',\n type: 'object',\n properties: {\n management_fee: {\n title: 'Desired monthly management fee',\n type: 'integer',\n 'x-jsf-presentation': {\n inputType: 'money',\n },\n },\n _expanded: {\n type: 'boolean',\n default: false,\n 'x-jsf-presentation': {\n inputType: 'hidden',\n hidden: true,\n },\n },\n },\n 'x-jsf-presentation': {\n inputType: 'fieldset',\n hidden: true,\n },\n },\n },\n required: [\n 'country',\n 'currency',\n 'salary',\n 'salary_conversion',\n 'salary_converted',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'country',\n 'region',\n 'currency',\n 'currency_statement',\n 'salary',\n 'estimation_title',\n 'management',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAAa,CACxB,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,WAAY,CACV,QAAS,CACP,MAAO,UACP,YAAa,GACb,KAAM,SACN,MAAO,CAAC,EACR,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,OAAQ,CACN,MAAO,SACP,YAAa,GACb,KAAM,SACN,MAAO,CAAC,EACR,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,SAAU,CACR,MAAO,WACP,YAAa,GACb,KAAM,SACN,MAAO,CAAC,EACR,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,mBAAoB,CAClB,KAAM,OACN,MAAO,oBACP,qBAAsB,CACpB,UAAW,SACX,OAAQ,GACR,UAAW,CACT,MAAO,sBACP,YAAa,4BACb,UAAW,YACX,SAAU,SACZ,EACA,KAAM,CACJ,YAAa,EACf,CACF,CACF,EACA,cAAe,CACb,MAAO,qDACP,KAAM,CAAC,yBAA0B,kBAAkB,EACnD,KAAM,SACN,MAAO,CACL,CACE,MAAO,oCACP,MAAO,wBACT,EACA,CACE,MAAO,sCACP,MAAO,kBACT,CACF,EACA,qBAAsB,CACpB,UAAW,OACb,CACF,EACA,OAAQ,CACN,YAAa,GACb,MAAO,SACP,KAAM,UACN,qBAAsB,CACpB,UAAW,OACb,CACF,EACA,iBAAkB,CAChB,MAAO,mBACP,YAAa,4CACb,KAAM,SACN,qBAAsB,CACpB,UAAW,OACX,OAAQ,EACV,CACF,EACA,kBAAmB,CACjB,YAAa,GACb,MAAO,SACP,KAAM,UACN,qBAAsB,CACpB,UAAW,QACX,OAAQ,EACV,CACF,EACA,iBAAkB,CAChB,YACE,mEACF,MAAO,8BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,OAAQ,EACV,CACF,EACA,WAAY,CACV,MAAO,iBACP,KAAM,SACN,WAAY,CACV,eAAgB,CACd,MAAO,iCACP,KAAM,UACN,qBAAsB,CACpB,UAAW,OACb,CACF,EACA,UAAW,CACT,KAAM,UACN,QAAS,GACT,qBAAsB,CACpB,UAAW,SACX,OAAQ,EACV,CACF,CACF,EACA,qBAAsB,CACpB,UAAW,WACX,OAAQ,EACV,CACF,CACF,EACA,SAAU,CACR,UACA,WACA,SACA,oBACA,kBACF,EACA,KAAM,SACN,cAAe,CACb,UACA,SACA,WACA,qBACA,SACA,mBACA,YACF,CACF,CACF,CACF","names":["jsonSchema"]}
@@ -1,2 +1,2 @@
1
- import{a as Te}from"./chunk-VAIBLWOY.js";import{a as Me}from"./chunk-C4RJTN2F.js";import{a as Ce,b as Oe,c as O,d as Ve,e as Pe}from"./chunk-F66G33YT.js";import{a as fe,b as ue,c as ye,f as pe,g as _e,h as Se,i as be,j as ge,l as Fe,n as Ee}from"./chunk-DTGFQMCE.js";import{a as j}from"./chunk-QW4JPW6J.js";import{a as he}from"./chunk-PJBAQZ6G.js";import{c as C,d as L,f as H}from"./chunk-MXFDOIUA.js";import{a as l}from"./chunk-P37U34EQ.js";import{useEffect as nt,useMemo as d,useRef as ot,useState as Le}from"react";import it from"lodash.mergewith";import{jsx as ke}from"react/jsx-runtime";var at={employment_basic_information:"basic_information",contract_details:"contract_details"},st={select_country:null,basic_information:"employment_basic_information",contract_details:"contract_details",benefits:null,review:null},rt=l(({isLoadingBasicInformationForm:y,isLoadingContractDetailsForm:I,isLoadingEmployment:J,isLoadingBenefitsOffersSchema:N,isLoadingBenefitOffers:a,isLoadingCompany:D,isLoadingCountries:V,employmentStatus:s,employmentId:_,currentStepName:r,basicInformationFields:A,contractDetailsFields:c})=>{let P=y||I||J||N||a||D||V,o=s&&Ve.includes(s),k=s&&!Pe.includes(s),B=!!(_&&o&&r!=="review"),q=P||B,w=!!(B&&!P&&A.length>0&&c.length>0);return{isLoading:q,isNavigatingToReview:w,isEmploymentReadOnly:o,canInvite:k}},"getLoadingStates"),bt=l(({employmentId:y,companyId:I,countryCode:J,type:N,options:a,skipSteps:D,externalId:V,initialValues:s})=>{let _=ot({select_country:{},basic_information:{},contract_details:{},benefits:{}}),[r,A]=Le(y),[c,P]=Le(J||null),{data:o,isLoading:k,refetch:B}=fe(r);o?.country?.code&&c!==o.country.code&&P(o.country.code);let{data:q,isLoading:w}=ye(r),{data:v,isLoading:W,refetch:Be}=ue(I),qe=D?.includes("select_country")?Oe:Ce,{fieldValues:S,stepState:n,setFieldValues:we,previousStep:ve,nextStep:Re,goToStep:x,setStepValues:z}=he(qe),{selectCountryForm:R,isLoading:G}=Fe({jsfModify:a?.jsfModify?.select_country,jsonSchemaVersion:a?.jsonSchemaVersion,queryOptions:{enabled:n.currentStep.name==="select_country"}}),$=Se(a),K=be(a),Y=ge(a),je=Ee(),{mutateAsync:Ie}=j($),{mutateAsync:Q}=j(K),{mutateAsync:Je}=j(Y),Ne=st[n.currentStep.name]||"employment_basic_information",De=at[Ne],Ae=o?.[De]||{},X=l(({form:e,options:i={},query:m={}})=>{let h=Object.keys(S).length>0?{...s,...n.values?.[n.currentStep.name],...S}:{...s,...Ae};return pe({countryCode:c,form:e,fieldValues:h,query:m,options:{...i,queryOptions:{enabled:i.queryOptions?.enabled??!0}}})},"useJSONSchema"),xe=!!(c&&(n.currentStep.name==="basic_information"||y)),Ue=!!(c&&(n.currentStep.name==="contract_details"||y)),{data:f,isLoading:Z}=X({form:"employment_basic_information",options:{jsfModify:a?.jsfModify?.basic_information,queryOptions:{enabled:xe}}}),b=a?.jsfModify?.contract_details?.fields?.annual_gross_salary,U=b&&typeof b=="object"&&"presentation"in b?b.presentation:void 0,ee=a?.jsfModify?.contract_details?.fields?.equity_compensation,He=d(()=>({fields:{annual_gross_salary:{...b,presentation:{annual_gross_salary_conversion_properties:{label:U?.annual_gross_salary_conversion_properties?.label,description:U?.annual_gross_salary_conversion_properties?.description},desiredCurrency:v?.desired_currency,Component:l(e=>ke(Me,{desiredCurrency:v?.desired_currency||"",...e}),"Component")}},equity_compensation:{...ee,presentation:{calculateDynamicProperties:l((e,i)=>{let m=e.equity_compensation?.offer_equity_compensation,h=i?.meta?.cost;return{extra:ke(Te,{offerEquity:m,equityCost:h})}},"calculateDynamicProperties")}}}}),[b,U,v?.desired_currency,ee]),{data:u,isLoading:te}=X({form:"contract_details",query:{employment_id:r},options:{jsfModify:{...a?.jsfModify?.contract_details,fields:{...a?.jsfModify?.contract_details?.fields,...He.fields}},queryOptions:{enabled:Ue}}}),{data:M,isLoading:ne}=_e(r,S,a),oe=d(()=>{if(n.currentStep.name==="benefits"){let e={...n.values?.[n.currentStep.name],...S};return it({},q,e)}return{}},[n.currentStep.name,q,n.values,S]),t=d(()=>({select_country:R?.fields||[],basic_information:f?.fields||[],contract_details:u?.fields||[],benefits:M?.fields||[],review:[]}),[R?.fields,f?.fields,u?.fields,M?.fields]),We={select_country:null,basic_information:f?.meta["x-jsf-fieldsets"],contract_details:u?.meta["x-jsf-fieldsets"],benefits:null,review:null},{country:{code:ie}={},basic_information:ae={},contract_details:se={},status:re}=o||{},ce=n.currentStep.name,g=d(()=>L(t.select_country,{country:c||ie||""}),[t.select_country,c,ie]),F=d(()=>{let e={...s,...ae};return L(t.basic_information,e)},[t.basic_information,ae,s]),p=d(()=>{let e={...s,...se};return L(t.contract_details,e)},[t.contract_details,se,s]),E=d(()=>{let e={...s,...oe};return L(t.benefits,e)},[t.benefits,oe,s]),ze=d(()=>o?{select_country:g,basic_information:H(t.basic_information,F),contract_details:o?.contract_details!==null?H(t.contract_details,p):p,benefits:E}:{select_country:g,basic_information:F,contract_details:p,benefits:E},[g,F,p,E,o,t]),{isLoading:Ge,isNavigatingToReview:le,isEmploymentReadOnly:$e,canInvite:Ke}=d(()=>rt({isLoadingBasicInformationForm:Z,isLoadingContractDetailsForm:te,isLoadingEmployment:k,isLoadingBenefitsOffersSchema:ne,isLoadingBenefitOffers:w,isLoadingCompany:W,isLoadingCountries:G,employmentId:y,employmentStatus:re,basicInformationFields:t.basic_information,contractDetailsFields:t.contract_details,currentStepName:ce}),[Z,te,k,ne,w,W,G,y,re,t.basic_information,t.contract_details,ce]);nt(()=>{le&&(_.current={select_country:O(g,t.select_country),basic_information:O(F,t.basic_information),contract_details:O(p,t.contract_details),benefits:O(E,t.benefits)},z({select_country:g,basic_information:F,contract_details:p,benefits:E,review:{}}),x("review"))},[F,E,p,x,le,g,z,t.basic_information,t.benefits,t.contract_details,t.select_country]);let me=l(e=>R&&n.currentStep.name==="select_country"?e:f&&n.currentStep.name==="basic_information"?C(e,f?.fields,{isPartialValidation:!1}):u&&n.currentStep.name==="contract_details"?C(e,u?.fields,{isPartialValidation:!1}):{},"parseFormValues");async function Ye(e){let i=n.currentStep.name;i in _.current&&(_.current[i]=O(e,t[i]));let m=me(e);switch(Be(),n.currentStep.name){case"select_country":return P(m.country),Promise.resolve({data:{countryCode:m.country}});case"basic_information":{let h=!r&&c,et=r&&c&&o?.country&&o?.country.code!==c;if(h||et){let tt={basic_information:m,type:N,country_code:c,external_id:V};try{let T=await Ie(tt),de=T.data?.data?.employment?.id;return A(de),await je.mutateAsync({employmentId:de,eligible_to_work_in_residing_country:"citizen",employer_or_work_restrictions:!1}),T}catch(T){throw console.error("Error creating onboarding:",T),T}}else if(r)return Q({employmentId:r,basic_information:m,pricing_plan_details:{frequency:"monthly"},external_id:V});return}case"contract_details":return Q({employmentId:r,external_id:V,...{contract_details:m,pricing_plan_details:{frequency:"monthly"}}});case"benefits":return Je({employmentId:r,...e})}}l(Ye,"onSubmit");function Qe(){ve()}l(Qe,"back");function Xe(){Re()}l(Xe,"next");function Ze(e){x(e)}return l(Ze,"goTo"),{employmentId:r,creditRiskStatus:v?.default_legal_entity_credit_risk_status,fieldValues:S,stepState:n,fields:t[n.currentStep.name],isLoading:Ge,isSubmitting:$.isPending||K.isPending||Y.isPending,initialValues:ze,handleValidation:l(e=>{if(n.currentStep.name==="select_country")return R.handleValidation(e);if(n.currentStep.name==="benefits"&&M){let i=C(e,M?.fields,{isPartialValidation:!1});return M?.handleValidation(i)}if(f&&n.currentStep.name==="basic_information"){let i=C(e,f?.fields,{isPartialValidation:!1});return f?.handleValidation(i)}if(u&&n.currentStep.name==="contract_details"){let i=C(e,u?.fields,{isPartialValidation:!1});return u?.handleValidation(i)}return null},"handleValidation"),checkFieldUpdates:we,parseFormValues:me,onSubmit:Ye,back:Qe,next:Xe,goTo:Ze,meta:{fields:_.current,fieldsets:We[n.currentStep.name]},refetchEmployment:B,employment:o,isEmploymentReadOnly:$e,canInvite:Ke}},"useOnboarding");export{bt as a};
2
- //# sourceMappingURL=chunk-DSTM5RRQ.js.map
1
+ import{a as Te}from"./chunk-VAIBLWOY.js";import{a as Me}from"./chunk-7C2Z2EE5.js";import{a as Ce,b as Oe,c as O,d as Ve,e as Pe}from"./chunk-F66G33YT.js";import{a as fe,b as ue,c as ye,f as pe,g as _e,h as Se,i as be,j as ge,l as Fe,n as Ee}from"./chunk-BFOGH4SF.js";import{a as j}from"./chunk-QW4JPW6J.js";import{a as he}from"./chunk-PJBAQZ6G.js";import{c as C,d as L,f as H}from"./chunk-PAQW5BFW.js";import{a as l}from"./chunk-P37U34EQ.js";import{useEffect as nt,useMemo as d,useRef as ot,useState as Le}from"react";import it from"lodash.mergewith";import{jsx as ke}from"react/jsx-runtime";var at={employment_basic_information:"basic_information",contract_details:"contract_details"},st={select_country:null,basic_information:"employment_basic_information",contract_details:"contract_details",benefits:null,review:null},rt=l(({isLoadingBasicInformationForm:y,isLoadingContractDetailsForm:I,isLoadingEmployment:J,isLoadingBenefitsOffersSchema:N,isLoadingBenefitOffers:a,isLoadingCompany:D,isLoadingCountries:V,employmentStatus:s,employmentId:_,currentStepName:r,basicInformationFields:A,contractDetailsFields:c})=>{let P=y||I||J||N||a||D||V,o=s&&Ve.includes(s),k=s&&!Pe.includes(s),B=!!(_&&o&&r!=="review"),q=P||B,w=!!(B&&!P&&A.length>0&&c.length>0);return{isLoading:q,isNavigatingToReview:w,isEmploymentReadOnly:o,canInvite:k}},"getLoadingStates"),bt=l(({employmentId:y,companyId:I,countryCode:J,type:N,options:a,skipSteps:D,externalId:V,initialValues:s})=>{let _=ot({select_country:{},basic_information:{},contract_details:{},benefits:{}}),[r,A]=Le(y),[c,P]=Le(J||null),{data:o,isLoading:k,refetch:B}=fe(r);o?.country?.code&&c!==o.country.code&&P(o.country.code);let{data:q,isLoading:w}=ye(r),{data:v,isLoading:W,refetch:Be}=ue(I),qe=D?.includes("select_country")?Oe:Ce,{fieldValues:S,stepState:n,setFieldValues:we,previousStep:ve,nextStep:Re,goToStep:x,setStepValues:z}=he(qe),{selectCountryForm:R,isLoading:G}=Fe({jsfModify:a?.jsfModify?.select_country,jsonSchemaVersion:a?.jsonSchemaVersion,queryOptions:{enabled:n.currentStep.name==="select_country"}}),$=Se(a),K=be(a),Y=ge(a),je=Ee(),{mutateAsync:Ie}=j($),{mutateAsync:Q}=j(K),{mutateAsync:Je}=j(Y),Ne=st[n.currentStep.name]||"employment_basic_information",De=at[Ne],Ae=o?.[De]||{},X=l(({form:e,options:i={},query:m={}})=>{let h=Object.keys(S).length>0?{...s,...n.values?.[n.currentStep.name],...S}:{...s,...Ae};return pe({countryCode:c,form:e,fieldValues:h,query:m,options:{...i,queryOptions:{enabled:i.queryOptions?.enabled??!0}}})},"useJSONSchema"),xe=!!(c&&(n.currentStep.name==="basic_information"||y)),Ue=!!(c&&(n.currentStep.name==="contract_details"||y)),{data:f,isLoading:Z}=X({form:"employment_basic_information",options:{jsfModify:a?.jsfModify?.basic_information,queryOptions:{enabled:xe}}}),b=a?.jsfModify?.contract_details?.fields?.annual_gross_salary,U=b&&typeof b=="object"&&"presentation"in b?b.presentation:void 0,ee=a?.jsfModify?.contract_details?.fields?.equity_compensation,He=d(()=>({fields:{annual_gross_salary:{...b,presentation:{annual_gross_salary_conversion_properties:{label:U?.annual_gross_salary_conversion_properties?.label,description:U?.annual_gross_salary_conversion_properties?.description},desiredCurrency:v?.desired_currency,Component:l(e=>ke(Me,{desiredCurrency:v?.desired_currency||"",...e}),"Component")}},equity_compensation:{...ee,presentation:{calculateDynamicProperties:l((e,i)=>{let m=e.equity_compensation?.offer_equity_compensation,h=i?.meta?.cost;return{extra:ke(Te,{offerEquity:m,equityCost:h})}},"calculateDynamicProperties")}}}}),[b,U,v?.desired_currency,ee]),{data:u,isLoading:te}=X({form:"contract_details",query:{employment_id:r},options:{jsfModify:{...a?.jsfModify?.contract_details,fields:{...a?.jsfModify?.contract_details?.fields,...He.fields}},queryOptions:{enabled:Ue}}}),{data:M,isLoading:ne}=_e(r,S,a),oe=d(()=>{if(n.currentStep.name==="benefits"){let e={...n.values?.[n.currentStep.name],...S};return it({},q,e)}return{}},[n.currentStep.name,q,n.values,S]),t=d(()=>({select_country:R?.fields||[],basic_information:f?.fields||[],contract_details:u?.fields||[],benefits:M?.fields||[],review:[]}),[R?.fields,f?.fields,u?.fields,M?.fields]),We={select_country:null,basic_information:f?.meta["x-jsf-fieldsets"],contract_details:u?.meta["x-jsf-fieldsets"],benefits:null,review:null},{country:{code:ie}={},basic_information:ae={},contract_details:se={},status:re}=o||{},ce=n.currentStep.name,g=d(()=>L(t.select_country,{country:c||ie||""}),[t.select_country,c,ie]),F=d(()=>{let e={...s,...ae};return L(t.basic_information,e)},[t.basic_information,ae,s]),p=d(()=>{let e={...s,...se};return L(t.contract_details,e)},[t.contract_details,se,s]),E=d(()=>{let e={...s,...oe};return L(t.benefits,e)},[t.benefits,oe,s]),ze=d(()=>o?{select_country:g,basic_information:H(t.basic_information,F),contract_details:o?.contract_details!==null?H(t.contract_details,p):p,benefits:E}:{select_country:g,basic_information:F,contract_details:p,benefits:E},[g,F,p,E,o,t]),{isLoading:Ge,isNavigatingToReview:le,isEmploymentReadOnly:$e,canInvite:Ke}=d(()=>rt({isLoadingBasicInformationForm:Z,isLoadingContractDetailsForm:te,isLoadingEmployment:k,isLoadingBenefitsOffersSchema:ne,isLoadingBenefitOffers:w,isLoadingCompany:W,isLoadingCountries:G,employmentId:y,employmentStatus:re,basicInformationFields:t.basic_information,contractDetailsFields:t.contract_details,currentStepName:ce}),[Z,te,k,ne,w,W,G,y,re,t.basic_information,t.contract_details,ce]);nt(()=>{le&&(_.current={select_country:O(g,t.select_country),basic_information:O(F,t.basic_information),contract_details:O(p,t.contract_details),benefits:O(E,t.benefits)},z({select_country:g,basic_information:F,contract_details:p,benefits:E,review:{}}),x("review"))},[F,E,p,x,le,g,z,t.basic_information,t.benefits,t.contract_details,t.select_country]);let me=l(e=>R&&n.currentStep.name==="select_country"?e:f&&n.currentStep.name==="basic_information"?C(e,f?.fields,{isPartialValidation:!1}):u&&n.currentStep.name==="contract_details"?C(e,u?.fields,{isPartialValidation:!1}):{},"parseFormValues");async function Ye(e){let i=n.currentStep.name;i in _.current&&(_.current[i]=O(e,t[i]));let m=me(e);switch(Be(),n.currentStep.name){case"select_country":return P(m.country),Promise.resolve({data:{countryCode:m.country}});case"basic_information":{let h=!r&&c,et=r&&c&&o?.country&&o?.country.code!==c;if(h||et){let tt={basic_information:m,type:N,country_code:c,external_id:V};try{let T=await Ie(tt),de=T.data?.data?.employment?.id;return A(de),await je.mutateAsync({employmentId:de,eligible_to_work_in_residing_country:"citizen",employer_or_work_restrictions:!1}),T}catch(T){throw console.error("Error creating onboarding:",T),T}}else if(r)return Q({employmentId:r,basic_information:m,pricing_plan_details:{frequency:"monthly"},external_id:V});return}case"contract_details":return Q({employmentId:r,external_id:V,...{contract_details:m,pricing_plan_details:{frequency:"monthly"}}});case"benefits":return Je({employmentId:r,...e})}}l(Ye,"onSubmit");function Qe(){ve()}l(Qe,"back");function Xe(){Re()}l(Xe,"next");function Ze(e){x(e)}return l(Ze,"goTo"),{employmentId:r,creditRiskStatus:v?.default_legal_entity_credit_risk_status,fieldValues:S,stepState:n,fields:t[n.currentStep.name],isLoading:Ge,isSubmitting:$.isPending||K.isPending||Y.isPending,initialValues:ze,handleValidation:l(e=>{if(n.currentStep.name==="select_country")return R.handleValidation(e);if(n.currentStep.name==="benefits"&&M){let i=C(e,M?.fields,{isPartialValidation:!1});return M?.handleValidation(i)}if(f&&n.currentStep.name==="basic_information"){let i=C(e,f?.fields,{isPartialValidation:!1});return f?.handleValidation(i)}if(u&&n.currentStep.name==="contract_details"){let i=C(e,u?.fields,{isPartialValidation:!1});return u?.handleValidation(i)}return null},"handleValidation"),checkFieldUpdates:we,parseFormValues:me,onSubmit:Ye,back:Qe,next:Xe,goTo:Ze,meta:{fields:_.current,fieldsets:We[n.currentStep.name]},refetchEmployment:B,employment:o,isEmploymentReadOnly:$e,canInvite:Ke}},"useOnboarding");export{bt as a};
2
+ //# sourceMappingURL=chunk-ZOKSYPOP.js.map