@remoteoss/remote-flows 0.4.2-alpha.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-PRFH5KY7.js → chunk-3HC236JT.js} +2 -2
- package/dist/{chunk-5I2GCSAL.js → chunk-3XKGVAM4.js} +2 -2
- package/dist/{chunk-PWWX66GV.js → chunk-BFFD47LY.js} +2 -2
- package/dist/{chunk-EGJR5MXK.js → chunk-BGPNJUZ6.js} +2 -2
- package/dist/{chunk-XTC73RFN.js → chunk-BHTXYDFD.js} +2 -2
- package/dist/{chunk-L6CLZL2D.js → chunk-DIL47M74.js} +2 -2
- package/dist/{chunk-XIPPSRO6.js → chunk-F66G33YT.js} +2 -2
- package/dist/{chunk-XIPPSRO6.js.map → chunk-F66G33YT.js.map} +1 -1
- package/dist/{chunk-BFZQYTQN.js → chunk-FKWJNWTH.js} +2 -2
- package/dist/chunk-FS4S4F6X.js +2 -0
- package/dist/chunk-FS4S4F6X.js.map +1 -0
- package/dist/{chunk-LOBYJTDX.js → chunk-GPPJCUV6.js} +2 -2
- package/dist/{chunk-RBC6WNYP.js → chunk-HNVJZJG2.js} +2 -2
- package/dist/{chunk-7522S3KZ.js → chunk-IYVHRHIF.js} +2 -2
- package/dist/chunk-KDWPT7ZP.js +2 -0
- package/dist/chunk-KDWPT7ZP.js.map +1 -0
- package/dist/{chunk-YD3IHRVA.js → chunk-N23LQHZ3.js} +2 -2
- package/dist/{chunk-5RPT35EL.js → chunk-OCVTKPKM.js} +2 -2
- package/dist/{chunk-CIIUTHY7.js → chunk-PRKYQ5O6.js} +2 -2
- package/dist/{chunk-YDW7CPPR.js → chunk-QUCO6E4Q.js} +2 -2
- package/dist/{chunk-GTXQK2J6.js → chunk-RYJWEK4S.js} +2 -2
- package/dist/{chunk-6WFPF53B.js → chunk-T33QM3L4.js} +2 -2
- package/dist/{chunk-SX5W3CBP.js → chunk-T3HJ2JSB.js} +2 -2
- package/dist/{chunk-VCYSWPLV.js → chunk-UP5Y6GXN.js} +2 -2
- package/dist/{chunk-VFR5R7GS.js → chunk-VNH5IASS.js} +2 -2
- package/dist/chunk-Z7WBY27D.js +2 -0
- package/dist/chunk-Z7WBY27D.js.map +1 -0
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
- package/dist/flows/ContractAmendment/context.d.ts +1 -1
- package/dist/flows/ContractAmendment/hooks.d.ts +1 -1
- package/dist/flows/ContractAmendment/hooks.js +1 -1
- package/dist/flows/ContractAmendment/index.d.ts +1 -1
- package/dist/flows/ContractAmendment/index.js +1 -1
- package/dist/flows/ContractAmendment/utils.d.ts +1 -1
- package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +1 -1
- package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorResults.d.ts +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorResults.js +1 -1
- package/dist/flows/CostCalculator/api.d.ts +1 -1
- package/dist/flows/CostCalculator/context.d.ts +1 -1
- package/dist/flows/CostCalculator/hooks.d.ts +1 -1
- package/dist/flows/CostCalculator/hooks.js +1 -1
- package/dist/flows/CostCalculator/index.d.ts +1 -1
- package/dist/flows/CostCalculator/index.js +1 -1
- package/dist/flows/CostCalculator/types.d.ts +1 -1
- package/dist/flows/CostCalculator/utils.d.ts +1 -1
- package/dist/flows/CostCalculator/utils.js +1 -1
- package/dist/flows/Onboarding/OnboardingFlow.d.ts +1 -1
- package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
- package/dist/flows/Onboarding/api.d.ts +1 -1
- package/dist/flows/Onboarding/components/BasicInformationStep.d.ts +1 -1
- package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
- package/dist/flows/Onboarding/components/BenefitsStep.d.ts +1 -1
- package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
- package/dist/flows/Onboarding/components/ContractDetailsStep.d.ts +1 -1
- package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
- package/dist/flows/Onboarding/components/OnboardingForm.d.ts +1 -1
- package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
- package/dist/flows/Onboarding/components/OnboardingInvite.d.ts +1 -1
- package/dist/flows/Onboarding/components/ReviewStep.d.ts +2 -1
- package/dist/flows/Onboarding/components/ReviewStep.js +1 -1
- package/dist/flows/Onboarding/components/SelectCountryStep.d.ts +1 -1
- package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
- package/dist/flows/Onboarding/context.d.ts +2 -1
- package/dist/flows/Onboarding/hooks.d.ts +6 -1
- package/dist/flows/Onboarding/hooks.js +1 -1
- package/dist/flows/Onboarding/index.d.ts +1 -1
- package/dist/flows/Onboarding/index.js +1 -1
- package/dist/flows/Onboarding/types.d.ts +2 -2
- package/dist/flows/Onboarding/utils.d.ts +3 -2
- package/dist/flows/Onboarding/utils.js +1 -1
- package/dist/flows/Termination/AdditionalDetailsForm.d.ts +1 -1
- package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
- package/dist/flows/Termination/EmployeeComunicationForm.d.ts +1 -1
- package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
- package/dist/flows/Termination/PaidTimeOffForm.d.ts +1 -1
- package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
- package/dist/flows/Termination/TerminationDetailsForm.d.ts +1 -1
- package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
- package/dist/flows/Termination/TerminationFlow.d.ts +1 -1
- package/dist/flows/Termination/TerminationFlow.js +1 -1
- package/dist/flows/Termination/TerminationForm.d.ts +1 -1
- package/dist/flows/Termination/TerminationForm.js +1 -1
- package/dist/flows/Termination/TimeOff.d.ts +1 -1
- package/dist/flows/Termination/context.d.ts +1 -1
- package/dist/flows/Termination/hooks.d.ts +1 -1
- package/dist/flows/Termination/index.d.ts +1 -1
- package/dist/flows/Termination/index.js +1 -1
- package/dist/flows/Termination/types.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{types.gen-DSJsKiNm.d.ts → types.gen-uIYQx7Be.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-DIF7GZA2.js +0 -2
- package/dist/chunk-DIF7GZA2.js.map +0 -1
- package/dist/chunk-KFVOK5X5.js +0 -2
- package/dist/chunk-KFVOK5X5.js.map +0 -1
- package/dist/chunk-SYYKU72Z.js +0 -2
- package/dist/chunk-SYYKU72Z.js.map +0 -1
- /package/dist/{chunk-PRFH5KY7.js.map → chunk-3HC236JT.js.map} +0 -0
- /package/dist/{chunk-5I2GCSAL.js.map → chunk-3XKGVAM4.js.map} +0 -0
- /package/dist/{chunk-PWWX66GV.js.map → chunk-BFFD47LY.js.map} +0 -0
- /package/dist/{chunk-EGJR5MXK.js.map → chunk-BGPNJUZ6.js.map} +0 -0
- /package/dist/{chunk-XTC73RFN.js.map → chunk-BHTXYDFD.js.map} +0 -0
- /package/dist/{chunk-L6CLZL2D.js.map → chunk-DIL47M74.js.map} +0 -0
- /package/dist/{chunk-BFZQYTQN.js.map → chunk-FKWJNWTH.js.map} +0 -0
- /package/dist/{chunk-LOBYJTDX.js.map → chunk-GPPJCUV6.js.map} +0 -0
- /package/dist/{chunk-RBC6WNYP.js.map → chunk-HNVJZJG2.js.map} +0 -0
- /package/dist/{chunk-7522S3KZ.js.map → chunk-IYVHRHIF.js.map} +0 -0
- /package/dist/{chunk-YD3IHRVA.js.map → chunk-N23LQHZ3.js.map} +0 -0
- /package/dist/{chunk-5RPT35EL.js.map → chunk-OCVTKPKM.js.map} +0 -0
- /package/dist/{chunk-CIIUTHY7.js.map → chunk-PRKYQ5O6.js.map} +0 -0
- /package/dist/{chunk-YDW7CPPR.js.map → chunk-QUCO6E4Q.js.map} +0 -0
- /package/dist/{chunk-GTXQK2J6.js.map → chunk-RYJWEK4S.js.map} +0 -0
- /package/dist/{chunk-6WFPF53B.js.map → chunk-T33QM3L4.js.map} +0 -0
- /package/dist/{chunk-SX5W3CBP.js.map → chunk-T3HJ2JSB.js.map} +0 -0
- /package/dist/{chunk-VCYSWPLV.js.map → chunk-UP5Y6GXN.js.map} +0 -0
- /package/dist/{chunk-VFR5R7GS.js.map → chunk-VNH5IASS.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-JW2HLB6X.js";import{a as n}from"./chunk-SYEPIESJ.js";import{a as e}from"./chunk-6O3WKNSB.js";import{a as T}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-JW2HLB6X.js";import{a as n}from"./chunk-SYEPIESJ.js";import{a as e}from"./chunk-6O3WKNSB.js";import{a as T}from"./chunk-HNVJZJG2.js";import{a}from"./chunk-BGPNJUZ6.js";import{a as f}from"./chunk-PRKYQ5O6.js";import{a as r}from"./chunk-ABFF6YSW.js";import{a as p}from"./chunk-BHTXYDFD.js";import{a as t}from"./chunk-MRYRNB7Y.js";import{a as i}from"./chunk-P37U34EQ.js";import{useId as c}from"react";import{jsx as u}from"react/jsx-runtime";var A=i(({employmentId:d,render:s,options:l})=>{let y=c(),o=e({employmentId:d,options:l});return u(t.Provider,{value:{formId:y,terminationBag:o},children:s({terminationBag:o,components:{SubmitButton:m,TimeOff:n,Back:r,EmployeeComunicationStep:a,TerminationDetailsStep:p,PaidTimeOffStep:f,AdditionalDetailsStep:T}})})},"TerminationFlow");export{A as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3HC236JT.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as l}from"./chunk-CFIJKJXD.js";import{a as F}from"./chunk-FS4S4F6X.js";import{f,g as p}from"./chunk-STEO7MS2.js";import{c as u}from"./chunk-CNYSTJVL.js";import{b as _}from"./chunk-TVZAFTPT.js";import{a as r}from"./chunk-P37U34EQ.js";import{useEffect as R}from"react";import{jsx as a}from"react/jsx-runtime";var w=["effective_date","reason_for_change","reason_for_change_description","additional_comments","additional_comments_toggle"];function x({onSubmit:b,onError:m,onSuccess:A}){let{formId:C,contractAmendment:{checkFieldUpdates:h,fields:s,onSubmit:S,stepState:g,initialValues:i,handleValidation:y}}=_(),V=l(y),e=f({resolver:V,defaultValues:g.values?.form||i,shouldUnregister:!0,mode:"onBlur"});R(()=>{let t=e?.watch(o=>{(Object.keys(e.formState.dirtyFields).length>0||e.formState.isDirty)&&h(o)});return()=>t?.unsubscribe()},[]);let v=r(async t=>{let o=!1;for(let[c,P]of Object.entries(t))if(!w.includes(c)&&i[c]!==P){o=!0;break}if(!o)return m?.({message:"no_changes_detected_contract_details"});let d=u(t,s,{isPartialValidation:!1});await b?.(d);let n=await S(t);n.error?m?.(n.error):await A?.(n.data)},"handleSubmit");return a(p,{...e,children:a("form",{id:C,"data-testid":"contract-amendment-form",onSubmit:e.handleSubmit(v),className:"space-y-4 RemoteFlows__ContractAmendmentForm",children:a(F,{fields:s})})})}r(x,"ContractAmendmentForm");export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3XKGVAM4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-OCVTKPKM.js";import{b as n}from"./chunk-PGWKJ6FK.js";import{b as i}from"./chunk-QW4JPW6J.js";import{a as e}from"./chunk-P37U34EQ.js";import{jsx as p}from"react/jsx-runtime";function F({onSubmit:l,onError:t,onSuccess:d}){let{onboardingBag:o}=n(),m=e(async a=>{try{await l?.(o.parseFormValues(a));let r=await o.onSubmit(a);if(r?.data){await d?.(r.data),o?.next();return}if(r?.error){let c=i(r?.fieldErrors||[],o.meta?.fields?.contract_details);t?.({error:r.error,rawError:r.rawError,fieldErrors:c})}}catch(r){t?.({error:r,rawError:r,fieldErrors:[]})}},"handleSubmit");return p(s,{defaultValues:o.stepState.values?.contract_details||o.initialValues.contract_details,onSubmit:m})}e(F,"ContractDetailsStep");export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BFFD47LY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-IYVHRHIF.js";import{b as m}from"./chunk-MRYRNB7Y.js";import{a as o}from"./chunk-P37U34EQ.js";import{jsx as r}from"react/jsx-runtime";function p({onSubmit:e}){let{terminationBag:i}=m();return r(n,{onSubmit:o(async t=>{await e?.(i?.parseFormValues(t)),i?.next()},"handleSubmit")})}o(p,"EmployeeCommunicationForm");export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BGPNJUZ6.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as r}from"./chunk-IYVHRHIF.js";import{b as n}from"./chunk-MRYRNB7Y.js";import{a as o}from"./chunk-P37U34EQ.js";import{jsx as a}from"react/jsx-runtime";function u({onSubmit:m}){let{terminationBag:i}=n();return a(r,{onSubmit:o(async t=>{await m?.(i?.parseFormValues(t)),i?.next()},"handleSubmit")})}o(u,"TerminationDetailsForm");export{u as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BHTXYDFD.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as _,b as h,c as v,d as T,e as w}from"./chunk-2IOIRPXX.js";import{a as P}from"./chunk-BHXNRWYC.js";import{a as x}from"./chunk-CVXZNBHC.js";import{a as R}from"./chunk-3TAUIOLW.js";import{a as N}from"./chunk-MIALHORP.js";import{a as g}from"./chunk-OYI5OCMY.js";import{a as i}from"./chunk-TC3SWPEN.js";import{a as l}from"./chunk-P37U34EQ.js";import{lazy as z,useState as H}from"react";import*as n from"@radix-ui/react-tabs";import{jsx as b}from"react/jsx-runtime";function k({className:r,...o}){return b(n.Root,{"data-slot":"tabs",className:i("flex flex-col gap-2",r),...o})}l(k,"Tabs");function B({className:r,...o}){return b(n.List,{"data-slot":"tabs-list",className:i("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-1",r),...o})}l(B,"TabsList");function d({className:r,...o}){return b(n.Trigger,{"data-slot":"tabs-trigger",className:i("data-[state=active]:bg-background data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring inline-flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",r),...o})}l(d,"TabsTrigger");import{Fragment as G,jsx as t,jsxs as a}from"react/jsx-runtime";var E=z(()=>import("./flows/CostCalculator/Results/CostCalculatorResultsChart.js"));function X({employmentData:r,options:o}){let[s,S]=H("monthly"),c=r.employments?.[0];if(!c)return null;let e=c.employer_currency_costs,m=e.currency.symbol,f=s==="monthly"?e.monthly_gross_salary:e.annual_gross_salary,C=s==="monthly"?e.monthly_benefits_total:e.annual_benefits_total,p=s==="monthly"?e.monthly_contributions_total:e.annual_contributions_total,D=s==="monthly"?e.monthly_total:e.annual_total,u=s==="monthly"?e.monthly_benefits_breakdown:e.annual_benefits_breakdown,L=s==="monthly"?e.monthly_contributions_breakdown:e.annual_contributions_breakdown,y=[{name:"Gross Salary",value:f,color:o?.chartColors?.grossSalary??"#3b82f6"},{name:"Contributions",value:p,color:o?.chartColors?.contributions??"#f59e0b"}];return u&&y.push({name:"Benefits",value:C??0,color:o?.chartColors?.benefits??"#10b981"}),a(G,{children:[a("div",{className:"flex flex-col md:flex-row gap-4 md:items-center justify-between mb-6 RemoteFlows__CostCalculatorResults",children:[a("div",{className:"RemoteFlows__CostCalculatorResults__Header",children:[a("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[t("span",{className:"flex items-center gap-1",children:o?.title??"Cost Calculator"}),t(g,{className:"ml-2",children:c.country.name})]}),t("p",{className:"text-primary-foreground font-medium mt-1",children:o?.description??`Total cost of employment in ${c.country.name}`})]}),t(k,{value:s,onValueChange:F=>S(F),className:"w-full md:w-auto RemoteFlows__CostCalculatorResults__Tabs",children:a(B,{className:"grid w-full md:w-[200px] grid-cols-2",children:[t(d,{value:"monthly",children:"Monthly"}),t(d,{value:"annual",children:"Annual"})]})})]}),a("div",{className:i("grid grid-cols-1 gap-6",o?.showChart?"md:grid-cols-3":"","RemoteFlows__CostCalculatorResults_CostBreakdown"),children:[a(_,{className:"md:col-span-2 rounded-lg",children:[a(h,{className:"pb-2",children:[t(v,{children:"Cost Breakdown"}),t(T,{children:"Detailed breakdown of all employer costs"})]}),t(w,{children:a("div",{className:"space-y-6",children:[t(N,{grossSalary:f,currency:m}),u?t(x,{benefitsBreakdown:u,benefitsTotal:C,currency:m}):null,t(R,{contributionsBreakdown:L,contributionsTotal:p,currency:m}),t(P,{totalCost:D,currency:m})]})})]}),o?.showChart&&t(E,{chartData:y,currency:m})]})]})}l(X,"CostCalculatorResults");export{X as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DIL47M74.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-P37U34EQ.js";var p={select_country:{index:0,name:"select_country"},basic_information:{index:1,name:"basic_information"},contract_details:{index:2,name:"contract_details"},benefits:{index:3,name:"benefits"},review:{index:4,name:"review"}},c={basic_information:{index:0,name:"basic_information"},contract_details:{index:1,name:"contract_details"},benefits:{index:2,name:"benefits"},review:{index:3,name:"review"}};function l(s,a){return a?Object.fromEntries(Object.entries(s).map(([t,
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-P37U34EQ.js";var p={select_country:{index:0,name:"select_country"},basic_information:{index:1,name:"basic_information"},contract_details:{index:2,name:"contract_details"},benefits:{index:3,name:"benefits"},review:{index:4,name:"review"}},c={basic_information:{index:0,name:"basic_information"},contract_details:{index:1,name:"contract_details"},benefits:{index:2,name:"benefits"},review:{index:3,name:"review"}};function l(s,a){return a?Object.fromEntries(Object.entries(s).map(([t,i])=>{if(i===void 0)return[t,void 0];let e=a.find(n=>n.name===t);if(e?.isVisible===!1||e?.deprecated)return[t,void 0];if(e?.type==="radio"||e?.type==="select"){let n=e.options.find(r=>r.value===i);return n?[t,{prettyValue:n?.label,label:e?.label,inputType:e?.type}]:void 0}if(e?.type==="checkbox"&&e?.const)return[t,{prettyValue:!0,label:e.label,inputType:e?.type}];if(e?.type==="countries"&&Array.isArray(i))return[t,{prettyValue:i.join(),label:e.label,inputType:e?.type}];if(e?.type==="fieldset"){let n=l(i,e.fields);if(!n.label&&n.value){let r={...n.value,label:e.label,inputType:e?.type};return[t,r]}return[t,n]}if(e?.type==="money")return[t,{prettyValue:i,label:e.label,inputType:e?.type,currency:e?.currency}];if(e)return[t,{prettyValue:i,label:e.label,inputType:e?.type}]}).filter(Boolean)):{}}o(l,"prettifyFormValues");var d=["invited","created_awaiting_reserve","created_reserve_paid"],u=["created_awaiting_reserve","invited"];export{p as a,c as b,l as c,d,u as e};
|
|
2
|
+
//# sourceMappingURL=chunk-F66G33YT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flows/Onboarding/utils.ts"],"sourcesContent":["import { Employment } from '@/src/flows/Onboarding/types';\nimport { Step } from '@/src/flows/useStepState';\nimport { Fields } from '@remoteoss/json-schema-form';\n\ntype StepKeys =\n | 'select_country'\n | 'basic_information'\n | 'contract_details'\n | 'benefits'\n | 'review';\n\nexport const STEPS: Record<StepKeys, Step<StepKeys>> = {\n select_country: {\n index: 0,\n name: 'select_country',\n },\n basic_information: { index: 1, name: 'basic_information' },\n contract_details: { index: 2, name: 'contract_details' },\n benefits: { index: 3, name: 'benefits' },\n review: { index: 4, name: 'review' },\n} as const;\n\nexport const STEPS_WITHOUT_SELECT_COUNTRY: Record<\n Exclude<StepKeys, 'select_country'>,\n Step<Exclude<StepKeys, 'select_country'>>\n> = {\n basic_information: { index: 0, name: 'basic_information' },\n contract_details: { index: 1, name: 'contract_details' },\n benefits: { index: 2, name: 'benefits' },\n review: { index: 3, name: 'review' },\n} as const;\n\n/**\n * Function to prettify form values. Returns a pretty value and label for each field.\n * @param values - Form values to prettify\n * @param fields - Form fields\n * @returns Prettified form values\n */\n// @ts-expect-error need to check function return type\nexport function prettifyFormValues(\n values: Record<string, unknown>,\n fields: Fields | undefined,\n) {\n if (!fields) {\n return {};\n }\n return Object.fromEntries(\n Object.entries(values)\n // @ts-expect-error need to check function return type\n .map(([key, value]) => {\n if (value === undefined) {\n return [key, undefined];\n }\n\n const field = fields.find((field) => field.name === key);\n\n if (field?.isVisible === false || field?.deprecated) {\n return [key, undefined];\n }\n\n if (field?.type === 'radio' || field?.type === 'select') {\n const option = (\n field.options as Array<{ value: string; label: string }>\n ).find((option) => option.value === value);\n\n if (option) {\n return [\n key,\n {\n prettyValue: option?.label,\n label: field?.label,\n inputType: field?.type,\n },\n ];\n }\n return;\n }\n\n if (field?.type === 'checkbox' && field?.const) {\n return [\n key,\n { prettyValue: true, label: field.label, inputType: field?.type },\n ];\n }\n\n if (field?.type === 'countries' && Array.isArray(value)) {\n return [\n key,\n {\n prettyValue: value.join(),\n label: field.label,\n inputType: field?.type,\n },\n ];\n }\n\n if (field?.type === 'fieldset') {\n // @ts-expect-error need to check function return type\n const prettiedFieldset = prettifyFormValues(\n value as Record<string, unknown>,\n field.fields as Fields,\n );\n\n // Handles benefits fieldset in specific\n if (!prettiedFieldset.label && prettiedFieldset.value) {\n const prettyValue: Record<string, unknown> = {\n ...prettiedFieldset.value,\n label: field.label,\n inputType: field?.type,\n };\n return [key, prettyValue];\n }\n\n return [key, prettiedFieldset];\n }\n\n if (field?.type === 'money') {\n return [\n key,\n {\n prettyValue: value,\n label: field.label,\n inputType: field?.type,\n currency: field?.currency,\n },\n ];\n }\n\n if (field) {\n return [\n key,\n { prettyValue: value, label: field.label, inputType: field?.type },\n ];\n }\n })\n .filter(Boolean),\n );\n}\n\n/**\n * Array of employment statuses that are allowed to proceed to the review step.\n * These statuses indicate that the employment is in a final state and the employment cannot be modified further.\n * @type {Employment['status'][]}\n * @constant\n */\nexport const reviewStepAllowedEmploymentStatus: Employment['status'][] = [\n 'invited',\n 'created_awaiting_reserve',\n 'created_reserve_paid',\n];\n"],"mappings":"wCAWO,IAAMA,EAA0C,CACrD,eAAgB,CACd,MAAO,EACP,KAAM,gBACR,EACA,kBAAmB,CAAE,MAAO,EAAG,KAAM,mBAAoB,EACzD,iBAAkB,CAAE,MAAO,EAAG,KAAM,kBAAmB,EACvD,SAAU,CAAE,MAAO,EAAG,KAAM,UAAW,EACvC,OAAQ,CAAE,MAAO,EAAG,KAAM,QAAS,CACrC,EAEaC,EAGT,CACF,kBAAmB,CAAE,MAAO,EAAG,KAAM,mBAAoB,EACzD,iBAAkB,CAAE,MAAO,EAAG,KAAM,kBAAmB,EACvD,SAAU,CAAE,MAAO,EAAG,KAAM,UAAW,EACvC,OAAQ,CAAE,MAAO,EAAG,KAAM,QAAS,CACrC,EASO,SAASC,EACdC,EACAC,EACA,CACA,OAAKA,EAGE,OAAO,YACZ,OAAO,QAAQD,CAAM,EAElB,IAAI,CAAC,CAACE,EAAKC,CAAK,IAAM,CACrB,GAAIA,IAAU,OACZ,MAAO,CAACD,EAAK,MAAS,EAGxB,IAAME,EAAQH,EAAO,KAAMG,GAAUA,EAAM,OAASF,CAAG,EAEvD,GAAIE,GAAO,YAAc,IAASA,GAAO,WACvC,MAAO,CAACF,EAAK,MAAS,EAGxB,GAAIE,GAAO,OAAS,SAAWA,GAAO,OAAS,SAAU,CACvD,IAAMC,EACJD,EAAM,QACN,KAAMC,GAAWA,EAAO,QAAUF,CAAK,EAEzC,OAAIE,EACK,CACLH,EACA,CACE,YAAaG,GAAQ,MACrB,MAAOD,GAAO,MACd,UAAWA,GAAO,IACpB,CACF,EAEF,MACF,CAEA,GAAIA,GAAO,OAAS,YAAcA,GAAO,MACvC,MAAO,CACLF,EACA,CAAE,YAAa,GAAM,MAAOE,EAAM,MAAO,UAAWA,GAAO,IAAK,CAClE,EAGF,GAAIA,GAAO,OAAS,aAAe,MAAM,QAAQD,CAAK,EACpD,MAAO,CACLD,EACA,CACE,YAAaC,EAAM,KAAK,EACxB,MAAOC,EAAM,MACb,UAAWA,GAAO,IACpB,CACF,EAGF,GAAIA,GAAO,OAAS,WAAY,CAE9B,IAAME,EAAmBP,EACvBI,EACAC,EAAM,MACR,EAGA,GAAI,CAACE,EAAiB,OAASA,EAAiB,MAAO,CACrD,IAAMC,EAAuC,CAC3C,GAAGD,EAAiB,MACpB,MAAOF,EAAM,MACb,UAAWA,GAAO,IACpB,EACA,MAAO,CAACF,EAAKK,CAAW,CAC1B,CAEA,MAAO,CAACL,EAAKI,CAAgB,CAC/B,CAEA,GAAIF,GAAO,OAAS,QAClB,MAAO,CACLF,EACA,CACE,YAAaC,EACb,MAAOC,EAAM,MACb,UAAWA,GAAO,KAClB,SAAUA,GAAO,QACnB,CACF,EAGF,GAAIA,EACF,MAAO,CACLF,EACA,CAAE,YAAaC,EAAO,MAAOC,EAAM,MAAO,UAAWA,GAAO,IAAK,CACnE,CAEJ,CAAC,EACA,OAAO,OAAO,CACnB,EA5FS,CAAC,CA6FZ,CAlGgBI,EAAAT,EAAA,sBA0GT,IAAMU,EAA4D,CACvE,UACA,2BACA,sBACF","names":["STEPS","STEPS_WITHOUT_SELECT_COUNTRY","prettifyFormValues","values","fields","key","value","field","option","prettiedFieldset","prettyValue","__name","reviewStepAllowedEmploymentStatus"]}
|
|
1
|
+
{"version":3,"sources":["../src/flows/Onboarding/utils.ts"],"sourcesContent":["import { Employment } from '@/src/flows/Onboarding/types';\nimport { Step } from '@/src/flows/useStepState';\nimport { Fields } from '@remoteoss/json-schema-form';\n\ntype StepKeys =\n | 'select_country'\n | 'basic_information'\n | 'contract_details'\n | 'benefits'\n | 'review';\n\nexport const STEPS: Record<StepKeys, Step<StepKeys>> = {\n select_country: {\n index: 0,\n name: 'select_country',\n },\n basic_information: { index: 1, name: 'basic_information' },\n contract_details: { index: 2, name: 'contract_details' },\n benefits: { index: 3, name: 'benefits' },\n review: { index: 4, name: 'review' },\n} as const;\n\nexport const STEPS_WITHOUT_SELECT_COUNTRY: Record<\n Exclude<StepKeys, 'select_country'>,\n Step<Exclude<StepKeys, 'select_country'>>\n> = {\n basic_information: { index: 0, name: 'basic_information' },\n contract_details: { index: 1, name: 'contract_details' },\n benefits: { index: 2, name: 'benefits' },\n review: { index: 3, name: 'review' },\n} as const;\n\n/**\n * Function to prettify form values. Returns a pretty value and label for each field.\n * @param values - Form values to prettify\n * @param fields - Form fields\n * @returns Prettified form values\n */\n// @ts-expect-error need to check function return type\nexport function prettifyFormValues(\n values: Record<string, unknown>,\n fields: Fields | undefined,\n) {\n if (!fields) {\n return {};\n }\n return Object.fromEntries(\n Object.entries(values)\n // @ts-expect-error need to check function return type\n .map(([key, value]) => {\n if (value === undefined) {\n return [key, undefined];\n }\n\n const field = fields.find((field) => field.name === key);\n\n if (field?.isVisible === false || field?.deprecated) {\n return [key, undefined];\n }\n\n if (field?.type === 'radio' || field?.type === 'select') {\n const option = (\n field.options as Array<{ value: string; label: string }>\n ).find((option) => option.value === value);\n\n if (option) {\n return [\n key,\n {\n prettyValue: option?.label,\n label: field?.label,\n inputType: field?.type,\n },\n ];\n }\n return;\n }\n\n if (field?.type === 'checkbox' && field?.const) {\n return [\n key,\n { prettyValue: true, label: field.label, inputType: field?.type },\n ];\n }\n\n if (field?.type === 'countries' && Array.isArray(value)) {\n return [\n key,\n {\n prettyValue: value.join(),\n label: field.label,\n inputType: field?.type,\n },\n ];\n }\n\n if (field?.type === 'fieldset') {\n // @ts-expect-error need to check function return type\n const prettiedFieldset = prettifyFormValues(\n value as Record<string, unknown>,\n field.fields as Fields,\n );\n\n // Handles benefits fieldset in specific\n if (!prettiedFieldset.label && prettiedFieldset.value) {\n const prettyValue: Record<string, unknown> = {\n ...prettiedFieldset.value,\n label: field.label,\n inputType: field?.type,\n };\n return [key, prettyValue];\n }\n\n return [key, prettiedFieldset];\n }\n\n if (field?.type === 'money') {\n return [\n key,\n {\n prettyValue: value,\n label: field.label,\n inputType: field?.type,\n currency: field?.currency,\n },\n ];\n }\n\n if (field) {\n return [\n key,\n { prettyValue: value, label: field.label, inputType: field?.type },\n ];\n }\n })\n .filter(Boolean),\n );\n}\n\n/**\n * Array of employment statuses that are allowed to proceed to the review step.\n * These statuses indicate that the employment is in a final state and the employment cannot be modified further.\n * @type {Employment['status'][]}\n * @constant\n */\nexport const reviewStepAllowedEmploymentStatus: Employment['status'][] = [\n 'invited',\n 'created_awaiting_reserve',\n 'created_reserve_paid',\n];\n\nexport const disabledInviteButtonEmploymentStatus: Employment['status'][] = [\n 'created_awaiting_reserve',\n 'invited',\n];\n"],"mappings":"wCAWO,IAAMA,EAA0C,CACrD,eAAgB,CACd,MAAO,EACP,KAAM,gBACR,EACA,kBAAmB,CAAE,MAAO,EAAG,KAAM,mBAAoB,EACzD,iBAAkB,CAAE,MAAO,EAAG,KAAM,kBAAmB,EACvD,SAAU,CAAE,MAAO,EAAG,KAAM,UAAW,EACvC,OAAQ,CAAE,MAAO,EAAG,KAAM,QAAS,CACrC,EAEaC,EAGT,CACF,kBAAmB,CAAE,MAAO,EAAG,KAAM,mBAAoB,EACzD,iBAAkB,CAAE,MAAO,EAAG,KAAM,kBAAmB,EACvD,SAAU,CAAE,MAAO,EAAG,KAAM,UAAW,EACvC,OAAQ,CAAE,MAAO,EAAG,KAAM,QAAS,CACrC,EASO,SAASC,EACdC,EACAC,EACA,CACA,OAAKA,EAGE,OAAO,YACZ,OAAO,QAAQD,CAAM,EAElB,IAAI,CAAC,CAACE,EAAKC,CAAK,IAAM,CACrB,GAAIA,IAAU,OACZ,MAAO,CAACD,EAAK,MAAS,EAGxB,IAAME,EAAQH,EAAO,KAAMG,GAAUA,EAAM,OAASF,CAAG,EAEvD,GAAIE,GAAO,YAAc,IAASA,GAAO,WACvC,MAAO,CAACF,EAAK,MAAS,EAGxB,GAAIE,GAAO,OAAS,SAAWA,GAAO,OAAS,SAAU,CACvD,IAAMC,EACJD,EAAM,QACN,KAAMC,GAAWA,EAAO,QAAUF,CAAK,EAEzC,OAAIE,EACK,CACLH,EACA,CACE,YAAaG,GAAQ,MACrB,MAAOD,GAAO,MACd,UAAWA,GAAO,IACpB,CACF,EAEF,MACF,CAEA,GAAIA,GAAO,OAAS,YAAcA,GAAO,MACvC,MAAO,CACLF,EACA,CAAE,YAAa,GAAM,MAAOE,EAAM,MAAO,UAAWA,GAAO,IAAK,CAClE,EAGF,GAAIA,GAAO,OAAS,aAAe,MAAM,QAAQD,CAAK,EACpD,MAAO,CACLD,EACA,CACE,YAAaC,EAAM,KAAK,EACxB,MAAOC,EAAM,MACb,UAAWA,GAAO,IACpB,CACF,EAGF,GAAIA,GAAO,OAAS,WAAY,CAE9B,IAAME,EAAmBP,EACvBI,EACAC,EAAM,MACR,EAGA,GAAI,CAACE,EAAiB,OAASA,EAAiB,MAAO,CACrD,IAAMC,EAAuC,CAC3C,GAAGD,EAAiB,MACpB,MAAOF,EAAM,MACb,UAAWA,GAAO,IACpB,EACA,MAAO,CAACF,EAAKK,CAAW,CAC1B,CAEA,MAAO,CAACL,EAAKI,CAAgB,CAC/B,CAEA,GAAIF,GAAO,OAAS,QAClB,MAAO,CACLF,EACA,CACE,YAAaC,EACb,MAAOC,EAAM,MACb,UAAWA,GAAO,KAClB,SAAUA,GAAO,QACnB,CACF,EAGF,GAAIA,EACF,MAAO,CACLF,EACA,CAAE,YAAaC,EAAO,MAAOC,EAAM,MAAO,UAAWA,GAAO,IAAK,CACnE,CAEJ,CAAC,EACA,OAAO,OAAO,CACnB,EA5FS,CAAC,CA6FZ,CAlGgBI,EAAAT,EAAA,sBA0GT,IAAMU,EAA4D,CACvE,UACA,2BACA,sBACF,EAEaC,EAA+D,CAC1E,2BACA,SACF","names":["STEPS","STEPS_WITHOUT_SELECT_COUNTRY","prettifyFormValues","values","fields","key","value","field","option","prettiedFieldset","prettyValue","__name","reviewStepAllowedEmploymentStatus","disabledInviteButtonEmploymentStatus"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as S}from"./chunk-Z7WBY27D.js";import{a as c}from"./chunk-7TOZZQQJ.js";import{a as m}from"./chunk-UP5Y6GXN.js";import{a as r}from"./chunk-RYJWEK4S.js";import{a as f}from"./chunk-QUCO6E4Q.js";import{a as s}from"./chunk-BFFD47LY.js";import{a}from"./chunk-DBRBPYIF.js";import{a as p}from"./chunk-5NCRPBBP.js";import{a as i}from"./chunk-R4PWQPR6.js";import{a as n}from"./chunk-PGWKJ6FK.js";import{a as e}from"./chunk-KDWPT7ZP.js";import{a as t}from"./chunk-P37U34EQ.js";import{useId as w,useState as C}from"react";import{jsx as R}from"react/jsx-runtime";var H=t(({employmentId:d,companyId:b,countryCode:u,type:g="employee",skipSteps:B,render:l,options:v})=>{let O=w(),o=e({companyId:b,countryCode:u,employmentId:d,type:g,options:v,skipSteps:B}),[y,I]=C({showReserveInvoice:!1,showInviteSuccessful:!1});return R(n.Provider,{value:{formId:O,onboardingBag:o,creditScore:y,setCreditScore:I},children:l({onboardingBag:o,components:{BasicInformationStep:r,ContractDetailsStep:s,BenefitsStep:f,SubmitButton:i,SaveDraftButton:c,BackButton:a,OnboardingInvite:p,SelectCountryStep:m,ReviewStep:S}})})},"OnboardingFlow");export{H as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FKWJNWTH.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as je}from"./chunk-OYI5OCMY.js";import{a as V}from"./chunk-MPMOHDZP.js";import{a as xe,b as O}from"./chunk-WZSGDTVV.js";import{b as S}from"./chunk-3ZWDIEEM.js";import{a as ae,b as ne,c as _,d as Ge,e as Ue,f as Je,g as qe,h as P,i as k,j as N,k as R,l as w,m as T}from"./chunk-STEO7MS2.js";import{e as Ae,g as ze}from"./chunk-CNYSTJVL.js";import{a as f}from"./chunk-TC3SWPEN.js";import{a as o}from"./chunk-P37U34EQ.js";import{Fragment as jo}from"react";import*as Ke from"react";import*as re from"@radix-ui/react-checkbox";import{Check as qt}from"lucide-react";import{jsx as be}from"react/jsx-runtime";var ie=Ke.forwardRef(({className:e,...t},r)=>be(re.Root,{ref:r,className:f("peer h-4 w-4 shrink-0 rounded-sm border border-input ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-checkbox data-[state=checked]:text-primary",e),...t,children:be(re.Indicator,{className:f("flex items-center justify-center text-current"),children:be(qt,{className:"h-4 w-4"})})}));ie.displayName=re.Root.displayName;import{Fragment as jt,jsx as A,jsxs as se}from"react/jsx-runtime";function le({name:e,defaultValue:t,description:r,label:a,onChange:s,multiple:n,options:d,component:F,...v}){let{components:m}=S(),{control:i}=_(),u=o((c,l,p)=>{let g=p.value?[...p.value]:[];l?g.includes(c)||p.onChange([...g,c]):p.onChange(g.filter(y=>y!==c))},"handleCheckboxChange");return A(P,{control:i,name:e,defaultValue:t,render:({field:c,fieldState:l})=>{let p=F||m?.checkbox;if(p){let g={name:e,description:r,label:a,defaultValue:t,multiple:n,options:d,...v};return A(p,{field:{...c,onChange:o(y=>{if(n){let{checked:b,value:x}=y.target;u(x,b,c),s?.(b);return}c.onChange(y),s?.(y)},"onChange")},fieldState:l,fieldData:g})}return se(k,{"data-field":e,className:f(`RemoteFlows__CheckBoxField__Item__${e}`),children:[A(R,{children:se(jt,{children:[d&&n?A(N,{children:a}):null,d&&n?d.map(g=>se("div",{className:"flex space-x-2",children:[A(ie,{id:g.value,onCheckedChange:y=>{u(g.value,y===!0,c),s?.(y,g.value)},checked:c.value?.includes(g.value),className:"RemoteFlows__CheckBox__Input"}),A(N,{htmlFor:g.value,className:"mb-0 RemoteFlows__CheckBox__Label",children:g.label})]},g.value)):se("div",{className:"flex space-x-2",children:[A(ie,{id:e,onCheckedChange:g=>{c.onChange(g),s?.(g)},checked:c.value,className:"RemoteFlows__CheckBox__Input"}),A(N,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label",children:a})]})]})}),r&&A(w,{children:r}),l.error&&A(T,{})]})}})}o(le,"CheckBoxField");import{CalendarIcon as Qt}from"lucide-react";import{PopoverClose as Zt}from"@radix-ui/react-popover";import{ChevronLeft as Kt,ChevronRight as Yt}from"lucide-react";import{DayPicker as Xt}from"react-day-picker";import{jsx as Se}from"react/jsx-runtime";function Ye({className:e,classNames:t,showOutsideDays:r=!0,...a}){return Se(Xt,{showOutsideDays:r,className:f("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:f(xe({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:f("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",a.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:f(xe({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:o(({className:s,...n})=>Se(Kt,{className:f("size-4",s),...n}),"IconLeft"),IconRight:o(({className:s,...n})=>Se(Yt,{className:f("size-4",s),...n}),"IconRight")},...a})}o(Ye,"Calendar");import*as z from"@radix-ui/react-popover";import{jsx as me}from"react/jsx-runtime";function ce({...e}){return me(z.Root,{"data-slot":"popover",...e})}o(ce,"Popover");function de({...e}){return me(z.Trigger,{"data-slot":"popover-trigger",...e})}o(de,"PopoverTrigger");function pe({className:e,align:t="center",sideOffset:r=4,...a}){return me(z.Portal,{children:me(z.Content,{"data-slot":"popover-content",align:t,sideOffset:r,className:f("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...a})})}o(pe,"PopoverContent");import{format as Xe}from"date-fns";import{Fragment as eo,jsx as W,jsxs as Pe}from"react/jsx-runtime";function Qe({description:e,label:t,name:r,minDate:a,onChange:s,component:n,...d}){let{components:F}=S(),{control:v}=_(),m;return d.meta?.mot&&typeof d.meta.mot=="number"?m=ze(d.meta.mot):a&&(m=new Date(a)),W(P,{control:v,name:r,render:({field:i,fieldState:u})=>{let c=n||F?.date;if(c){let l={description:e,label:t,name:r,onChange:s,...m&&{minDate:m.toISOString()},...d};return W(c,{field:{...i,onChange:o(p=>{i.onChange(p),s?.(p)},"onChange")},fieldState:u,fieldData:l})}return Pe(k,{"data-field":r,className:`flex flex-col RemoteFlows__DatePickerField__Item__${r}`,children:[W(N,{className:"RemoteFlows__DatePickerField__Label",children:t}),Pe(ce,{children:[W(de,{asChild:!0,children:W(R,{children:W("div",{children:Pe(O,{type:"button",variant:"outline",className:f("w-full pl-3 text-left font-normal",!i.value&&"text-muted-foreground"),"data-testid":`date-picker-button-${r}`,children:[i.value&&W(eo,{children:Xe(i.value,"yyyy-MM-dd")}),W(Qt,{className:"ml-auto h-4 w-4 opacity-50"})]})})})}),W(pe,{className:"w-auto p-0 RemoteFlows__DatepickerField__PopoverContent",align:"start",children:W(Ye,{mode:"single",className:"RemoteFlows__DatepickerField__Calendar",selected:i.value?new Date(i.value):void 0,onSelect:l=>{i.onChange(l?Xe(l,"yyyy-MM-dd"):null),s?.(l)},defaultMonth:m,components:{DayContent:o(l=>W(Zt,{children:l.date.getDate()}),"DayContent")},...m&&{disabled:o(l=>l<m,"disabled")}})})]}),e?W(w,{children:e}):null,u.error&&W(T,{className:"RemoteFlows__DatePickerField__Error"})]})}})}o(Qe,"DatePickerField");import{cva as to}from"class-variance-authority";import{jsx as Ne}from"react/jsx-runtime";var oo=to("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-card bg-warning border-warning-border [&>svg]:text-current"}},defaultVariants:{variant:"default"}});function Ze({className:e,variant:t,...r}){return Ne("div",{"data-slot":"alert",role:"alert",className:f(oo({variant:t}),e),...r})}o(Ze,"Alert");function et({className:e,...t}){return Ne("div",{"data-slot":"alert-title",className:f("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}o(et,"AlertTitle");function tt({className:e,...t}){return Ne("div",{"data-slot":"alert-description",className:f("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}o(tt,"AlertDescription");import{AlertCircle as ro}from"lucide-react";import{jsx as ue,jsxs as ao}from"react/jsx-runtime";function fe({title:e,description:t,severity:r}){let{components:a}=S();if(a?.statement){let s=a?.statement;return ue(s,{data:{title:e,description:t,severity:r}})}return ao(Ze,{variant:"warning",children:[ue(ro,{className:"h-4 w-4"}),e&&ue(et,{children:e}),ue(tt,{children:t})]})}o(fe,"Statement");import{useEffect as no,useRef as ot}from"react";import{jsx as ge,jsxs as rt}from"react/jsx-runtime";import{createElement as io}from"react";function ke({label:e,name:t,fields:r,description:a,components:s,statement:n,isFlatFieldset:d}){let{watch:F,trigger:v,formState:m}=_(),i=r.map(({name:p})=>`${t}.${p}`),u=F(i),c=ot(u),l=ot(null);return no(()=>{let p=u,g=c.current,y=m.isSubmitted||m.submitCount>0,b=!1;for(let x=0;x<p.length;x++)if(p[x]!==void 0&&g[x]!==p[x]){b=!0;break}return b&&y&&(l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{v()},50)),c.current=[...p],()=>{l.current&&clearTimeout(l.current)}},[u,v,m.isSubmitted,m.submitCount]),rt("fieldset",{className:f("border-1 border-input p-4 rounded-xl",`RemoteFlows__FieldSetField__${t}`),children:[ge("legend",{className:"text-sm font-semibold px-2",children:e}),a?ge("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:a}}):null,rt("div",{className:"grid gap-4",children:[r.map(p=>{let g=X[p.type];if(p.isVisible===!1||p.deprecated)return null;if(p.Component){let{Component:y}=p;return ge(y,{...p},p.name)}return p.inputType==="select"&&p.multiple&&(g=X["multi-select"]),io(g,{...p,key:p.name,name:`${d?p.name:`${t}.${p.name}`}`,component:s?.[p.type]})}),n?ge(fe,{...n}):null]})]})}o(ke,"FieldSetField");import{useState as so,useRef as lo}from"react";import{Upload as mo,X as co}from"lucide-react";import{jsx as U,jsxs as Re}from"react/jsx-runtime";function at({onChange:e,className:t,multiple:r}){let[a,s]=so([]),n=lo(null),d=o(m=>{m.preventDefault(),n.current?.click()},"handleClick"),F=o(m=>{if(m.target.files&&m.target.files.length>0){let i=Array.from(m.target.files);s(i),e(m)}},"handleChange"),v=o(m=>{s(i=>i.filter(u=>u!==m))},"onRemoveFile");return Re("div",{className:f("flex flex-col items-start gap-4",t),children:[U("input",{type:"file",ref:n,onChange:F,className:"hidden","aria-label":"File upload",multiple:r}),Re(O,{type:"button",onClick:d,className:"gap-2",children:[U(mo,{className:"h-4 w-4"}),"Choose File"]}),a.length===0&&U("div",{className:"text-sm",children:r?U("span",{className:"font-medium",children:"No files selected. You can select multiple files"}):U("span",{className:"font-medium",children:"No file selected."})}),a.length>0&&a.map((m,i)=>Re("div",{className:"text-sm flex items-center gap-2",children:["Selected file: ",U("span",{className:"font-medium",children:m.name})," (",Math.round(m.size/1024)," KB)",U(O,{variant:"ghost",onClick:()=>v(m),children:U(co,{})})]},i))]})}o(at,"FileUploader");import{jsx as J,jsxs as uo}from"react/jsx-runtime";var po=o(e=>new Promise((t,r)=>{let a=new FileReader;a.readAsDataURL(e),a.onload=()=>t(a.result),a.onerror=s=>r(s)}),"toBase64"),nt=o(async e=>{let t=e.target.files?Array.from(e.target.files):[];return await Promise.all(t.map(async a=>{let s=await po(a);return{name:a.name,content:s.split(",")[1]}}))},"convertFilesToBase64");function it({name:e,description:t,label:r,multiple:a,onChange:s,component:n,...d}){let{components:F}=S(),{control:v}=_();return J(P,{control:v,name:e,render:({field:m,fieldState:i})=>{let u=n||F?.file;if(u){let c={name:e,description:t,label:r,multiple:a,...d};return J(u,{field:{...m,value:null,onChange:o(async l=>{let p=await nt(l);m.onChange(p),s?.(p)},"onChange")},fieldState:i,fieldData:c})}return uo(k,{"data-field":e,className:`RemoteFlows__FileUpload__Item__${e}`,children:[J(N,{className:"RemoteFlows__FileUpload__Label",children:r}),J(R,{children:J(at,{onChange:async c=>{let l=await nt(c);m.onChange(l),s?.(l)},multiple:a,className:f("RemoteFlows__FileUpload__Input")})}),t&&J("div",{className:"flex items-center justify-between",children:J(w,{className:"RemoteFlows__FileUpload__Description",children:t})}),i.error&&J(T,{className:"RemoteFlows__FileUpload__Error"})]})}})}o(it,"FileUploadField");import{jsx as we}from"react/jsx-runtime";function Fe(e){let{components:t}=S(),{control:r}=_(),a=e.component||t?.number;return a?we(P,{control:r,name:e.name,render:({field:s,fieldState:n})=>we(a,{field:{...s,onChange:o(d=>{s.onChange(d),e.onChange?.(d)},"onChange")},fieldState:n,fieldData:e})}):we(V,{...e,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$"})}o(Fe,"NumberField");import*as Q from"@radix-ui/react-radio-group";import{CircleIcon as fo}from"lucide-react";import{jsx as ve}from"react/jsx-runtime";function st({className:e,...t}){return ve(Q.Root,{"data-slot":"radio-group",className:f("grid gap-3",e),...t})}o(st,"RadioGroup");function lt({className:e,...t}){return ve(Q.Item,{"data-slot":"radio-group-item",className:f("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:ve(Q.Indicator,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:ve(fo,{className:"fill-radio absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}o(lt,"RadioGroupItem");import{Fragment as go,jsx as $,jsxs as De}from"react/jsx-runtime";function mt({name:e,defaultValue:t,description:r,label:a,options:s,onChange:n,component:d,...F}){let{components:v}=S(),{control:m}=_();return $(P,{control:m,name:e,defaultValue:t,render:({field:i,fieldState:u})=>{let c=d||v?.radio;if(c){let l={name:e,defaultValue:t,description:r,label:a,options:s,...F};return $(c,{field:{...i,onChange:o(p=>{i.onChange(p),n?.(p)},"onChange")},fieldState:u,fieldData:l})}return De(k,{className:f("space-y-3",`RemoteFlows__RadioGroupField__Item__${e}`),"data-field":e,children:[$(N,{children:a}),$(R,{children:$(st,{"aria-label":a||e,onValueChange:l=>{i.onChange(l),n?.(l)},value:i.value,className:"flex flex-col space-y-3",children:s?.map(l=>$(go,{children:De(k,{"data-field":e,className:"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item",children:[$(R,{children:$(lt,{value:l.value,className:"RemoteFlows__RadioField__Input",disabled:l.disabled})}),De("div",{children:[$(N,{className:"font-normal mb-0 RemoteFlows__RadioField__Label",children:l.label}),l.description&&$(w,{className:"mt-2",children:l.description})]})]},l.value)}))})}),r&&$(w,{children:r}),u.error&&$(T,{})]})}})}o(mt,"RadioGroupField");import*as C from"@radix-ui/react-select";import{CheckIcon as Fo,ChevronDownIcon as ct,ChevronUpIcon as vo}from"lucide-react";import{jsx as D,jsxs as Te}from"react/jsx-runtime";function dt({...e}){return D(C.Root,{"data-slot":"select",...e})}o(dt,"Select");function pt({...e}){return D(C.Group,{"data-slot":"select-group",...e})}o(pt,"SelectGroup");function ut({...e}){return D(C.Value,{"data-slot":"select-value",...e})}o(ut,"SelectValue");function ft({className:e,children:t,...r}){return Te(C.Trigger,{"data-slot":"select-trigger",className:f("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-full items-center justify-between rounded-xl border bg-transparent px-4 py-7 text-sm whitespace-nowrap transition-[color] outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","focus-visible:border-focused",e),...r,children:[t,D(C.Icon,{asChild:!0,className:"absolute right-4",children:D(ct,{className:"size-4"})})]})}o(ft,"SelectTrigger");function gt({className:e,children:t,position:r="popper",...a}){return D(C.Portal,{children:Te(C.Content,{"data-slot":"select-content",className:f("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...a,children:[D(yo,{}),D(C.Viewport,{className:f(r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),D(ho,{})]})})}o(gt,"SelectContent");function Ft({className:e,children:t,...r}){return Te(C.Item,{"data-slot":"select-item",className:f("focus:bg-accent focus:text-accent-foreground min-h-11 justify-between [&_svg:not([class*='text-'])]:text-muted-foreground flex w-full cursor-default items-center gap-2 py-2 px-4 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[D(C.ItemText,{children:t}),D("span",{className:"flex size-3.5 items-center justify-center",children:D(C.ItemIndicator,{children:D(Fo,{className:"size-4"})})})]})}o(Ft,"SelectItem");function yo({className:e,...t}){return D(C.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:f("flex cursor-default items-center justify-center py-1",e),...t,children:D(vo,{className:"size-4"})})}o(yo,"SelectScrollUpButton");function ho({className:e,...t}){return D(C.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:f("flex cursor-default items-center justify-center py-1",e),...t,children:D(ct,{className:"size-4"})})}o(ho,"SelectScrollDownButton");import{jsx as L,jsxs as vt}from"react/jsx-runtime";function yt({label:e,name:t,options:r,defaultValue:a,description:s,onChange:n,component:d,...F}){let{control:v}=_(),{components:m}=S();return L(P,{defaultValue:a,control:v,name:t,render:({field:i,fieldState:u})=>{let c=d||m?.select;if(c){let l={label:e,name:t,options:r,defaultValue:a,description:s,onChange:n,...F};return L(c,{field:{...i,onChange:o(p=>{let g=F.jsonType==="number"?Number(p):p;i.onChange(g),n?.(g)},"onChange")},fieldState:u,fieldData:l})}return vt(k,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[L(N,{className:"RemoteFlows__SelectField__Label",children:e}),L(R,{children:L("div",{className:"relative",children:vt(dt,{value:i.value||"",onValueChange:l=>{let p=F.jsonType==="number"?Number(l):l;i.onChange(p),n?.(p)},children:[L(ft,{className:"RemoteFlows__SelectField__Trigger","aria-invalid":!!u.error,"aria-label":e,children:L("span",{className:"absolute",children:L(ut,{placeholder:e})})}),L(gt,{className:"RemoteFlows__SelectField__Content",children:L(pt,{className:"RemoteFlows__SelectField__Group",children:r.map(l=>L(Ft,{value:l.value,className:"RemoteFlows__SelectField__SelectItem",children:l.label},l.value))})})]})})}),s&&L(w,{children:s}),u.error&&L(T,{})]})}})}o(yt,"SelectField");import{useState as Ro}from"react";import{Fragment as bo,useState as So}from"react";import{Check as Po,ChevronDownIcon as No,X as ko}from"lucide-react";import{Command as Z}from"cmdk";import{SearchIcon as sn}from"lucide-react";import*as I from"@radix-ui/react-dialog";import{XIcon as _o}from"lucide-react";import{jsx as G,jsxs as Ie}from"react/jsx-runtime";function Me({...e}){return G(I.Root,{"data-slot":"dialog",...e})}o(Me,"Dialog");function ht({...e}){return G(I.Trigger,{"data-slot":"dialog-trigger",...e})}o(ht,"DialogTrigger");function Co({...e}){return G(I.Portal,{"data-slot":"dialog-portal",...e})}o(Co,"DialogPortal");function xo({className:e,...t}){return G(I.Overlay,{"data-slot":"dialog-overlay",className:f("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}o(xo,"DialogOverlay");function We({className:e,children:t,...r}){return Ie(Co,{"data-slot":"dialog-portal",children:[G(xo,{}),Ie(I.Content,{"data-slot":"dialog-content",className:f("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,Ie(I.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 RemoteFlows__Dialog__Close",children:[G(_o,{}),G("span",{className:"sr-only",children:"Close"})]})]})]})}o(We,"DialogContent");function Le({className:e,...t}){return G("div",{"data-slot":"dialog-header",className:f("flex flex-col gap-2 text-center sm:text-left",e),...t})}o(Le,"DialogHeader");function Ee({className:e,...t}){return G(I.Title,{"data-slot":"dialog-title",className:f("text-lg leading-none font-semibold",e),...t})}o(Ee,"DialogTitle");import{jsx as ee,jsxs as dn}from"react/jsx-runtime";function _t({className:e,...t}){return ee(Z,{"data-slot":"command",className:f("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}o(_t,"Command");function Ct({className:e,...t}){return ee(Z.List,{"data-slot":"command-list",className:f("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}o(Ct,"CommandList");function xt({...e}){return ee(Z.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}o(xt,"CommandEmpty");function bt({className:e,...t}){return ee(Z.Group,{"data-slot":"command-group",className:f("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}o(bt,"CommandGroup");function St({className:e,...t}){return ee(Z.Separator,{"data-slot":"command-separator",className:f("bg-border -mx-1 h-px",e),...t})}o(St,"CommandSeparator");function Pt({className:e,...t}){return ee(Z.Item,{"data-slot":"command-item",className:f("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}o(Pt,"CommandItem");import{jsx as H,jsxs as te}from"react/jsx-runtime";function ye({options:e,selected:t,onChange:r,placeholder:a,...s}){let[n,d]=So(!1),F=o(i=>{r(t.filter(u=>u.value!==i.value))},"handleUnselect"),v=e.some(i=>i.category),m=e.reduce((i,u)=>{let c=u.category||"Uncategorized";return i[c]||(i[c]=[]),i[c].push(u),i},{});return te(ce,{open:n,onOpenChange:d,...s,children:[H(de,{children:te(O,{variant:"outline",role:"combobox","aria-expanded":n,className:"w-full justify-between font-normal",type:"button",children:[H("div",{className:"flex gap-1 flex-wrap overflow-x-auto max-h-[2.5rem] items-center",children:t.length>0?t.map(i=>te(je,{variant:"secondary",className:"mr-1 mb-1",children:[i.label,H("div",{role:"button",tabIndex:0,"aria-label":`remove ${i.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(i)},onMouseDown:u=>{u.preventDefault(),u.stopPropagation()},onClick:()=>F(i),children:H(ko,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},i.label)):H("span",{className:"text-foreground",children:a})}),H(No,{className:"size-4"})]})}),H(pe,{align:"start",className:"w-full p-0",children:H(_t,{children:te(Ct,{children:[H(xt,{children:"No item found."}),Object.entries(m).map(([i,u],c)=>te(bo,{children:[c>0&&H(St,{}),H(bt,{heading:v?i:void 0,children:u.map(l=>{let p=t.some(g=>g.value===l.value);return te(Pt,{onSelect:()=>{r(p?t.filter(g=>g.value!==l.value):[...t,l])},children:[H(Po,{className:f("mr-2 h-4 w-4",p?"opacity-100":"opacity-0")}),l.label]},l.label)})})]},i))]})})})]})}o(ye,"MultiSelect");import{jsx as q,jsxs as wo}from"react/jsx-runtime";function Nt({label:e,name:t,options:r,defaultValue:a,description:s,onChange:n,$meta:d,component:F,...v}){let{control:m}=_(),{components:i}=S(),[u,c]=Ro([]);return q(P,{defaultValue:a,control:m,name:t,render:({field:l,fieldState:p})=>{let g=F||i?.countries;if(g){let x={label:e,name:t,options:r,defaultValue:a,description:s,onChange:n,$meta:d,...v};return q(g,{field:{...l,onChange:o(E=>{l.onChange(E),n?.(E)},"onChange")},fieldState:p,fieldData:x})}let y=[...Object.entries(d?.regions||{}).map(([x,E])=>({value:E,label:x,category:"Regions"})),...Object.entries(d?.subregions||{}).map(([x,E])=>({value:E,label:x,category:"Subregions"})),...r.map(x=>({...x,value:x.value,label:x.label,category:"Countries"}))],b=o(x=>{let E=x.map(({value:Jt})=>Jt);l.onChange(E),n?.(E),c(x)},"handleChange");return wo(k,{"data-field":t,className:`RemoteFlows__CountryField__Item__${t}`,children:[q(N,{className:"RemoteFlows__CountryField__Label",children:e}),q(R,{children:q(ye,{options:y,selected:u,onChange:b,...v})}),s&&q(w,{children:s}),p.error&&q(T,{})]})}})}o(Nt,"CountryField");import*as kt from"react";import{jsx as Do}from"react/jsx-runtime";var $e=kt.forwardRef(({className:e,...t},r)=>Do("textarea",{className:f("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...t}));$e.displayName="Textarea";import{jsx as j,jsxs as He}from"react/jsx-runtime";function Rt({name:e,description:t,label:r,onChange:a,maxLength:s,component:n,...d}){let{components:F}=S(),{control:v}=_();return j(P,{control:v,name:e,render:({field:m,fieldState:i})=>{let u=n||F?.textarea;if(u){let l={name:e,description:t,label:r,maxLength:s,...d};return j(u,{field:{...m,onChange:o(p=>{m.onChange(p),a?.(p)},"onChange")},fieldState:i,fieldData:l})}let c=m.value?.length??0;return He(k,{"data-field":e,className:`RemoteFlows__TextArea__Item__${e}`,children:[j(N,{className:"RemoteFlows__TextArea__Label",children:r}),j(R,{children:j($e,{...m,value:m.value??"",onChange:l=>{m.onChange(l),a?.(l)},className:f(i.error&&"border-red-500 focus-visible:ring-red-500","RemoteFlows__TextArea__Input"),placeholder:r})}),(t||s)&&He("div",{className:"flex items-center justify-between",children:[t&&j(w,{className:"RemoteFlows__TextArea__Description",children:t}),s&&He("span",{className:"text-sm ml-auto RemoteFlows__TextArea__MaxLength",children:[c,"/",s]})]}),i.error&&j(T,{className:"RemoteFlows__TextArea__Error"})]})}})}o(Rt,"TextAreaField");import{jsx as Be}from"react/jsx-runtime";function wt(e){let{components:t}=S(),{control:r}=_(),a=e.component||t?.email;return a?Be(P,{control:r,name:e.name,render:({field:s,fieldState:n})=>Be(a,{field:{...s,onChange:o(d=>{s.onChange(d),e.onChange?.(d)},"onChange")},fieldState:n,fieldData:e})}):Be(V,{...e,type:"email"})}o(wt,"EmailField");import{jsx as Dt}from"react/jsx-runtime";function Tt(e){let{control:t}=_();return Dt(P,{control:t,name:e.name,render:({field:r})=>Dt("input",{...r,type:"hidden"})})}o(Tt,"HiddenField");import $o,{useEffect as Ho,useState as Ot}from"react";var It=o((e,t,r)=>{if(e&&"reportValidity"in e){let a=ae(r,t);e.setCustomValidity(a&&a.message||""),e.reportValidity()}},"r"),Oe=o((e,t)=>{for(let r in t.fields){let a=t.fields[r];a&&a.ref&&"reportValidity"in a.ref?It(a.ref,r,e):a&&a.refs&&a.refs.forEach(s=>It(s,r,e))}},"o"),Wt=o((e,t)=>{t.shouldUseNativeValidation&&Oe(e,t);let r={};for(let a in e){let s=ae(t.fields,a),n=Object.assign(e[a]||{},{ref:s&&s.ref});if(To(t.names||Object.keys(e),a)){let d=Object.assign({},ae(r,a));ne(d,"root",n),ne(r,a,d)}else ne(r,a,n)}return r},"s"),To=o((e,t)=>{let r=Mt(t);return e.some(a=>Mt(a).match(`^${r}\\.\\d+`))},"i");function Mt(e){return e.replace(/\]|\[/g,"")}o(Mt,"n");function Lt(e,t,r){return t===void 0&&(t={}),r===void 0&&(r={}),function(a,s,n){try{return Promise.resolve(function(d,F){try{var v=(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[r.mode==="sync"?"validateSync":"validate"](a,Object.assign({abortEarly:!1},t,{context:s}))).then(function(m){return n.shouldUseNativeValidation&&Oe({},n),{values:r.raw?Object.assign({},a):m,errors:{}}}))}catch(m){return F(m)}return v&&v.then?v.then(void 0,F):v}(0,function(d){if(!d.inner)throw d;return{values:{},errors:Wt((F=d,v=!n.shouldUseNativeValidation&&n.criteriaMode==="all",(F.inner||[]).reduce(function(m,i){if(m[i.path]||(m[i.path]={message:i.message,type:i.type}),v){var u=m[i.path].types,c=u&&u[i.type];m[i.path]=Ge(i.path,v,m,i.type,c?[].concat(c,i.message):i.message)}return m},{})),n)};var F,v}))}catch(d){return Promise.reject(d)}}}o(Lt,"o");import*as M from"yup";import Et from"lodash.groupby";import oe from"lodash.capitalize";var $t=60,he=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function Io(e){if(e<60)return`${e}m`;let t=Math.floor(e/$t),r=e%$t;return r>0?`${t}h${r}m`:`${t}h`}o(Io,"convertBreakDurationToHours");function Ht(e){let t=e.reduce((r,a)=>a.hours+r,0);return Number(t.toFixed(2))}o(Ht,"calculateTotalWorkHours");function Mo(e,t){let r=t.map(({day:n})=>n.toLowerCase()),a=r.indexOf(e),s=null;for(;a<r.length&&!s;){let n=r[a],d=r[a+1],F=he.indexOf(n)+1;he[F]===d||(s=n),a+=1}return s}o(Mo,"findLastConsecutiveDay");function Wo(e){return e.start_time&&e.end_time&&(typeof e.hours=="number"?e.hours:Number.parseInt(e.hours))>0}o(Wo,"shouldSummarizeSchedule");function Lo(e){return Number.parseInt(e.break_duration_minutes)>0}o(Lo,"shouldSummarizeBreaks");function Bt(e){let t=e.filter(Wo),r=Et(t,F=>`${F.start_time}|${F.end_time}`),a=e.filter(Lo),s=Et(a,"break_duration_minutes"),n=Object.keys(r).map(F=>{let v=r[F],m=v[0].day,[i,u]=F.split("|"),c=`from <span>${i.replace(":","h")}</span> to <span>${u.replace(":","h")}</span>`,l=Mo(m,v),g=(l?v.findIndex(y=>y.day===l):-1)===v.length-1;return v.length===1?`${oe(m)}, ${c}`:!g||!l?v.reduce((y,b,x)=>{let E=oe(b.day);return x===v.length-1?`${y}and ${E}, ${c}`:`${y}<span>${E}</span>, `},""):`<span>${oe(m)}</span> to <span>${oe(l)}</span>, ${c}`}),d=Object.keys(s).reverse().map((F,v)=>{let m=v===0,i=s[F],u=Io(parseInt(F,10));if(Object.keys(s).length===1)return`With ${u} daily breaks`;if(i.length===1){let c=`${u} break on ${oe(i[0].day)}.`;return m?`With ${c}`:c}return i.reduce((c,l,p)=>{let g=oe(l.day);return p===0?`${c} ${g}`:p===i.length-1?`${c}, and ${g}.`:`${c}, ${g}`},m?`With ${u} break on`:`${u} break on`)});return{workHoursSummary:n,breakSummary:d}}o(Bt,"buildWorkScheduleSummary");function Ve(e){let{checked:t,start_time:r,end_time:a,break_duration_minutes:s}=e;if(!t)return 0;let[n,d]=r.split(":").map(Number),[F,v]=a.split(":").map(Number),m=n*60+d,c=(F*60+v-m-Number.parseInt(s||"0"))/60;return c===Math.floor(c)?c:Number(c.toFixed(2))}o(Ve,"calculateHours");var Eo={monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat",sunday:"Sun"};function _e(e){return Eo[e]}o(_e,"getShortWeekday");import{jsx as h,jsxs as B}from"react/jsx-runtime";var Bo=M.object({day:M.string().required(),checked:M.boolean().required(),start_time:M.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:o(e=>e.required("Required"),"then"),otherwise:o(e=>e.optional().nullable(),"otherwise")}),end_time:M.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:o(e=>e.required("Required"),"then"),otherwise:o(e=>e.optional().nullable(),"otherwise")}),hours:M.number().default(0),break_duration_minutes:M.string().default("0")}),Oo=M.object({schedule:M.array(Bo)});function Vo({defaultSchedule:e,onSubmit:t}){let[r,a]=Ot(!1),s=he.map(g=>{let y=e.find(b=>b.day.toLowerCase()===_e(g).toLowerCase()||b.day.toLowerCase()===g.toLowerCase());return y?{...y,day:_e(g),checked:!0}:{...e[0],checked:!1,day:_e(g)}}),n=Je({defaultValues:{schedule:s},resolver:Lt(Oo)}),{handleSubmit:d,watch:F,reset:v,control:m,formState:i}=n,{fields:u}=Ue({name:"schedule",control:m}),c=F("schedule");function l(g){let y=g.schedule.filter(({checked:b})=>b).map(b=>({...b,hours:Ve(b)}));t(y),a(!1)}o(l,"handleSubmitWorkingHours");function p(){v(),a(!1)}return o(p,"handleCancel"),h("div",{className:"flex items-center justify-between",children:B(Me,{open:r,onOpenChange:a,children:[h(ht,{asChild:!0,children:h(O,{variant:"link",className:"flex items-center p-0 RemoteFlows__WorkScheduleSelectionForm__Trigger",children:"Edit Schedule"})}),B(We,{className:"max-w-5xl max-h-[90vh] overflow-y-auto px-8 py-4 RemoteFlows__WorkScheduleSelectionForm__Content",children:[h(Le,{children:h(Ee,{className:"RemoteFlows__WorkScheduleSelectionForm__Title",children:"Edit employee working hours"})}),h(qe,{...n,children:B("form",{className:"space-y-4 RemoteFlows__WorkScheduleSelectionForm__Form",children:[B("div",{className:"rounded-lg",children:[h("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."}),B("div",{className:"grid grid-cols-12 gap-4 text-sm font-medium text-gray-500 uppercase tracking-wide RemoteFlows__WorkScheduleSelectionForm__Header",children:[h("div",{className:"col-span-2"}),h("div",{className:"col-span-3 text-center",children:"START"}),h("div",{className:"col-span-1 text-center"}),h("div",{className:"col-span-3 text-center",children:"END"}),h("div",{className:"col-span-2 text-center",children:"HOURS"})]}),h("div",{className:"RemoteFlows__WorkScheduleSelectionForm__Rows",children:u.map((g,y)=>{let b=c[y],x=Ve(b);return B($o.Fragment,{children:[B("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Hours",children:[h("div",{className:"col-span-2 flex items-center gap-3",children:h(le,{label:g.day,name:`schedule.${y}.checked`})}),h("div",{className:"col-span-3",children:h(V,{name:`schedule.${y}.start_time`,includeErrorMessage:!1})}),h("div",{className:"col-span-1 text-center text-gray-500",children:"to"}),h("div",{className:"col-span-3",children:h(V,{name:`schedule.${y}.end_time`,includeErrorMessage:!1})}),h("div",{className:"col-span-2 text-center text-gray-600",children:isNaN(x)?"-":`${x} hours`})]}),B("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Break",children:[h("div",{className:"col-span-2 text-gray-500",children:"Break"}),h("div",{className:"col-span-2",children:h(V,{name:`schedule.${y}.break_duration_minutes`,includeErrorMessage:!1})}),h("div",{className:"col-span-2 text-gray-500",children:"minutes"}),h("div",{className:"col-span-4"})]})]},g.id)})})]}),Object.keys(i.errors).length>0&&h("p",{className:"text-destructive text-sm mb-0",children:"Invalid time format (HH:mm)"}),B("div",{className:"flex gap-4 pt-4",children:[h(O,{type:"button",className:"reset-button",variant:"outline",onClick:p,children:"Cancel"}),h(O,{type:"button",className:"submit-button",onClick:d(l),children:"Save Schedule"})]})]})})]})]})})}o(Vo,"WorkScheduleSelectionForm");function Vt(e){let{components:t}=S(),{setValue:r,control:a,watch:s}=_(),n=s(e.name),[d,F]=Ot(n),{workHoursSummary:v,breakSummary:m}=Bt(d),i=Ht(d);Ho(()=>{r(e.name,d)},[d,e.name,r]);function u(l){F(l)}o(u,"onSubmit");let c=e.component||t?.["work-schedule"];return c?h(P,{control:a,name:e.name,render:({field:l,fieldState:p})=>h(c,{field:{...l,onChange:o(g=>{l.onChange(g),e.onChange?.(g)},"onChange")},fieldState:p,fieldData:{...e,defaultFormattedValue:{workHoursSummary:v,breakSummary:m,totalWorkHours:i}}})}):B("div",{className:"flex flex-col gap-3 RemoteFlows__WorkScheduleField",children:[h("p",{className:"text-sm RemoteFlows__WorkScheduleField__Title",children:"Work hours"}),B("div",{className:"flex flex-col gap-1 RemoteFlows__WorkScheduleField__Summary",children:[h("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__WorkHours",dangerouslySetInnerHTML:{__html:v.join(", ")}}),h("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Break",children:m.join()}),B("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Total",children:["Total of ",h("span",{children:i})," hours per week"]}),h(Vo,{defaultSchedule:d,onSubmit:u})]})]})}o(Vt,"WorkScheduleField");import{useState as Ao}from"react";import{jsx as K,jsxs as zo}from"react/jsx-runtime";function At({label:e,name:t,options:r,defaultValue:a,description:s,onChange:n,component:d,...F}){let{control:v}=_(),{components:m}=S(),[i,u]=Ao();return K(P,{defaultValue:a,control:v,name:t,render:({field:c,fieldState:l})=>{let p=d||m?.["multi-select"];if(p){let y={label:e,name:t,options:r,defaultValue:a,description:s,onChange:n,...F};return K(p,{field:{...c,onChange:o(b=>{c.onChange(b),n?.(b)},"onChange")},fieldState:l,fieldData:y})}let g=i||r.filter(y=>c.value.includes(y.value));return zo(k,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[K(N,{className:"RemoteFlows__SelectField__Label",children:e}),K(R,{children:K(ye,{options:r,selected:g,onChange:y=>{let b=y.map(({value:x})=>x);c.onChange(b),n?.(b),u(y)},...F})}),s&&K(w,{children:s}),l.error&&K(T,{})]})}})}o(At,"MultiSelectField");import{jsx as Go}from"react/jsx-runtime";var zt=o(e=>Go(Fe,{maxLength:15,...e}),"MoneyField");var X={checkbox:le,text:V,email:wt,money:zt,select:yt,"multi-select":At,radio:mt,number:Fe,file:it,fieldset:ke,"fieldset-flat":ke,date:Qe,textarea:Rt,countries:Nt,hidden:Tt,"work-schedule":Vt};import{useEffect as Uo}from"react";import{Fragment as Jo,jsx as Ce,jsxs as qo}from"react/jsx-runtime";function Gt({name:e,value:t,description:r,statement:a}){let{setValue:s}=_();return Uo(()=>{s(e,t)},[]),Ce("div",{children:a?qo(Jo,{children:[Ce("p",{className:`text-sm RemoteFlows__ForcedValue__Title__${e}`,dangerouslySetInnerHTML:{__html:a?.title}}),Ce("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:a?.description}})]}):Ce("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:r}})})}o(Gt,"ForcedValueField");import{Fragment as Yo,jsx as Y,jsxs as Ut}from"react/jsx-runtime";function Ko(e){return e.const!==void 0&&e.const===e.default&&e.inputType!=="checkbox"&&e.inputType!=="hidden"}o(Ko,"checkFieldHasForcedValue");var fs=o(({fields:e,fieldsets:t,fieldValues:r,components:a})=>{if(!e||e.length===0)return null;let s=t&&r?Ae({fields:e,fieldsets:t,values:r}):e;return Y(Yo,{children:s.map(n=>{if(n.isVisible===!1||n.deprecated)return null;if(Ko(n))return Y(Gt,{name:n.name,description:n.description,value:n.const,statement:n.statement},n.name);if(n.Component){let{Component:F}=n;return Y(F,{...n},n.name)}let d=X[n.inputType];return n.inputType==="select"&&n.multiple&&(d=X["multi-select"]),n.inputType==="fieldset"?Y(d,{...n,components:a}):n.inputType==="fieldset-flat"?Y(d,{...n,components:a,isFlatFieldset:!0}):d?Ut(jo,{children:[Y(d,{...n,component:a&&a[n.inputType]}),n.statement?Y(fe,{...n.statement}):null]},n.name):Ut("p",{className:"error",children:["Field type ",n.inputType," not supported"]})})})},"JSONSchemaFormFields");export{fs as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FS4S4F6X.js.map
|