@remoteoss/remote-flows 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/{chunk-ZIPHLBX4.js → chunk-2FKEF3OG.js} +2 -2
  2. package/dist/{chunk-N3EIN72T.js → chunk-53KVZ4BP.js} +2 -2
  3. package/dist/{chunk-XP7UEI56.js → chunk-5MYWJJBQ.js} +2 -2
  4. package/dist/{chunk-4ZGIL6OE.js → chunk-6KIQIVKA.js} +2 -2
  5. package/dist/{chunk-WZAWPSKS.js → chunk-6LJRRFK2.js} +2 -2
  6. package/dist/{chunk-746ELT2W.js → chunk-7AC3W7WD.js} +2 -2
  7. package/dist/{chunk-SB3IYODL.js → chunk-AODV6HT2.js} +2 -2
  8. package/dist/{chunk-LRNSFLHR.js → chunk-AUZWLETL.js} +2 -2
  9. package/dist/{chunk-R64X3EJF.js → chunk-AWDGLK2T.js} +2 -2
  10. package/dist/{chunk-E3JFQ7PH.js → chunk-BOTWQMOJ.js} +2 -2
  11. package/dist/chunk-DB7ITLRX.js +2 -0
  12. package/dist/chunk-DB7ITLRX.js.map +1 -0
  13. package/dist/{chunk-DZ67OJVF.js → chunk-DZ7FZ4L2.js} +2 -2
  14. package/dist/{chunk-GD5556B2.js → chunk-FFMKAMWP.js} +2 -2
  15. package/dist/{chunk-AYLYOLVG.js → chunk-GWLOE7WJ.js} +2 -2
  16. package/dist/{chunk-YXWBSRKS.js → chunk-HMNHKZGD.js} +2 -2
  17. package/dist/{chunk-FEHSJUZJ.js → chunk-IQKZWU7I.js} +2 -2
  18. package/dist/{chunk-QLNFHOLH.js → chunk-JO4722R7.js} +2 -2
  19. package/dist/{chunk-VLLLNIMN.js → chunk-MGVP76ZI.js} +2 -2
  20. package/dist/{chunk-7Y46DL2U.js → chunk-MRPXDND2.js} +2 -2
  21. package/dist/chunk-NP4G3N5P.js +2 -0
  22. package/dist/{chunk-LDJT7TII.js → chunk-OU4Y73FX.js} +2 -2
  23. package/dist/{chunk-SA74WAVS.js → chunk-PYKEYPGA.js} +2 -2
  24. package/dist/{chunk-TUFTB5UD.js → chunk-QDYWPG2R.js} +2 -2
  25. package/dist/{chunk-PFT7KJ65.js → chunk-QPTO4XXU.js} +2 -2
  26. package/dist/{chunk-L6FZRTSN.js → chunk-QTYDDIVO.js} +2 -2
  27. package/dist/chunk-R3DJNVHR.js +2 -0
  28. package/dist/chunk-R3DJNVHR.js.map +1 -0
  29. package/dist/{chunk-NRW33IP5.js → chunk-TM7Q7RHH.js} +2 -2
  30. package/dist/{chunk-R3LY6TV5.js → chunk-UQOWSJ2B.js} +2 -2
  31. package/dist/chunk-VDRNNOVA.js +2 -0
  32. package/dist/chunk-VDRNNOVA.js.map +1 -0
  33. package/dist/{chunk-A2SWQS2N.js → chunk-WCIJHQMP.js} +2 -2
  34. package/dist/chunk-XPKVRYIU.js +2 -0
  35. package/dist/chunk-XPKVRYIU.js.map +1 -0
  36. package/dist/{chunk-BO6OKTIG.js → chunk-Z42H2QEW.js} +2 -2
  37. package/dist/{chunk-WNTOQYRY.js → chunk-ZWZJ4XOY.js} +2 -2
  38. package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
  39. package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
  40. package/dist/flows/ContractAmendment/index.js +1 -1
  41. package/dist/flows/ContractorOnboarding/ContractorOnboarding.js +1 -1
  42. package/dist/flows/ContractorOnboarding/components/BasicInformationStep.js +1 -1
  43. package/dist/flows/ContractorOnboarding/components/ContractDetailsStep.js +1 -1
  44. package/dist/flows/ContractorOnboarding/components/ContractPreviewStep.js +1 -1
  45. package/dist/flows/ContractorOnboarding/components/ContractorOnboardingForm.js +1 -1
  46. package/dist/flows/ContractorOnboarding/components/PricingPlan.js +1 -1
  47. package/dist/flows/ContractorOnboarding/components/SelectCountryStep.js +1 -1
  48. package/dist/flows/ContractorOnboarding/index.js +1 -1
  49. package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
  50. package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
  51. package/dist/flows/CostCalculator/hooks.js +1 -1
  52. package/dist/flows/CostCalculator/index.js +1 -1
  53. package/dist/flows/CostCalculator/utils.js +1 -1
  54. package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
  55. package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
  56. package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
  57. package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
  58. package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
  59. package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
  60. package/dist/flows/Onboarding/index.js +1 -1
  61. package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
  62. package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
  63. package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
  64. package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
  65. package/dist/flows/Termination/TerminationFlow.js +1 -1
  66. package/dist/flows/Termination/TerminationForm.js +1 -1
  67. package/dist/flows/Termination/hooks.js +1 -1
  68. package/dist/flows/Termination/index.js +1 -1
  69. package/dist/flows/Termination/json-schemas/jsonSchema.d.ts +2 -0
  70. package/dist/flows/Termination/json-schemas/jsonSchema.js +1 -1
  71. package/dist/flows/Termination/json-schemas/paidTimeOff.d.ts +1 -0
  72. package/dist/flows/Termination/json-schemas/paidTimeOff.js +1 -1
  73. package/dist/flows/Termination/json-schemas/schema.js +1 -1
  74. package/dist/flows/Termination/json-schemas/terminationDetails.d.ts +1 -0
  75. package/dist/flows/Termination/json-schemas/terminationDetails.js +1 -1
  76. package/dist/flows/api.js +1 -1
  77. package/dist/index.js +1 -1
  78. package/dist/index.js.map +1 -1
  79. package/package.json +1 -1
  80. package/dist/chunk-4T6PRR6R.js +0 -2
  81. package/dist/chunk-4T6PRR6R.js.map +0 -1
  82. package/dist/chunk-GC23RRCI.js +0 -2
  83. package/dist/chunk-GC23RRCI.js.map +0 -1
  84. package/dist/chunk-KOIHMAAP.js +0 -2
  85. package/dist/chunk-OXCEJQFC.js +0 -2
  86. package/dist/chunk-OXCEJQFC.js.map +0 -1
  87. /package/dist/{chunk-ZIPHLBX4.js.map → chunk-2FKEF3OG.js.map} +0 -0
  88. /package/dist/{chunk-N3EIN72T.js.map → chunk-53KVZ4BP.js.map} +0 -0
  89. /package/dist/{chunk-XP7UEI56.js.map → chunk-5MYWJJBQ.js.map} +0 -0
  90. /package/dist/{chunk-4ZGIL6OE.js.map → chunk-6KIQIVKA.js.map} +0 -0
  91. /package/dist/{chunk-WZAWPSKS.js.map → chunk-6LJRRFK2.js.map} +0 -0
  92. /package/dist/{chunk-746ELT2W.js.map → chunk-7AC3W7WD.js.map} +0 -0
  93. /package/dist/{chunk-SB3IYODL.js.map → chunk-AODV6HT2.js.map} +0 -0
  94. /package/dist/{chunk-LRNSFLHR.js.map → chunk-AUZWLETL.js.map} +0 -0
  95. /package/dist/{chunk-R64X3EJF.js.map → chunk-AWDGLK2T.js.map} +0 -0
  96. /package/dist/{chunk-E3JFQ7PH.js.map → chunk-BOTWQMOJ.js.map} +0 -0
  97. /package/dist/{chunk-DZ67OJVF.js.map → chunk-DZ7FZ4L2.js.map} +0 -0
  98. /package/dist/{chunk-GD5556B2.js.map → chunk-FFMKAMWP.js.map} +0 -0
  99. /package/dist/{chunk-AYLYOLVG.js.map → chunk-GWLOE7WJ.js.map} +0 -0
  100. /package/dist/{chunk-YXWBSRKS.js.map → chunk-HMNHKZGD.js.map} +0 -0
  101. /package/dist/{chunk-FEHSJUZJ.js.map → chunk-IQKZWU7I.js.map} +0 -0
  102. /package/dist/{chunk-QLNFHOLH.js.map → chunk-JO4722R7.js.map} +0 -0
  103. /package/dist/{chunk-VLLLNIMN.js.map → chunk-MGVP76ZI.js.map} +0 -0
  104. /package/dist/{chunk-7Y46DL2U.js.map → chunk-MRPXDND2.js.map} +0 -0
  105. /package/dist/{chunk-KOIHMAAP.js.map → chunk-NP4G3N5P.js.map} +0 -0
  106. /package/dist/{chunk-LDJT7TII.js.map → chunk-OU4Y73FX.js.map} +0 -0
  107. /package/dist/{chunk-SA74WAVS.js.map → chunk-PYKEYPGA.js.map} +0 -0
  108. /package/dist/{chunk-TUFTB5UD.js.map → chunk-QDYWPG2R.js.map} +0 -0
  109. /package/dist/{chunk-PFT7KJ65.js.map → chunk-QPTO4XXU.js.map} +0 -0
  110. /package/dist/{chunk-L6FZRTSN.js.map → chunk-QTYDDIVO.js.map} +0 -0
  111. /package/dist/{chunk-NRW33IP5.js.map → chunk-TM7Q7RHH.js.map} +0 -0
  112. /package/dist/{chunk-R3LY6TV5.js.map → chunk-UQOWSJ2B.js.map} +0 -0
  113. /package/dist/{chunk-A2SWQS2N.js.map → chunk-WCIJHQMP.js.map} +0 -0
  114. /package/dist/{chunk-BO6OKTIG.js.map → chunk-Z42H2QEW.js.map} +0 -0
  115. /package/dist/{chunk-WNTOQYRY.js.map → chunk-ZWZJ4XOY.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-FZ7FWFJX.js";import{a as ft}from"./chunk-WLBRCGTG.js";import{a as mt}from"./chunk-QIQTM4HB.js";import{a as ht}from"./chunk-BO6OKTIG.js";import"./chunk-R3LY6TV5.js";import"./chunk-P5WUODPR.js";import"./chunk-746ELT2W.js";import"./chunk-6IL4TB7S.js";import"./chunk-IWA5B4U6.js";import"./chunk-7VOQAVM4.js";import"./chunk-VM2DQCZO.js";import"./chunk-EHAZWZ3O.js";import"./chunk-SLMJEZJ7.js";import"./chunk-E3JFQ7PH.js";import"./chunk-S4XU4SE7.js";import"./chunk-GULCZWSK.js";import"./chunk-WZAWPSKS.js";import"./chunk-N3EIN72T.js";import"./chunk-ZIPHLBX4.js";import"./chunk-7Y46DL2U.js";import"./chunk-6VRUYYUV.js";import"./chunk-MRYRNB7Y.js";import"./chunk-Z3BMF4BO.js";import{a as O}from"./chunk-RAHCZTQ3.js";import"./chunk-BCXRPHWY.js";import"./chunk-MQWVZSGH.js";import{a as I}from"./chunk-H425RKFI.js";import{a as D}from"./chunk-W55MUSAS.js";import"./chunk-DTHBG6BD.js";import"./chunk-CVIWZYO3.js";import"./chunk-E6OBNWMU.js";import"./chunk-5NPET4ZO.js";import"./chunk-R645TMO5.js";import"./chunk-ZSCKSEAA.js";import"./chunk-ZE3YT3Q6.js";import{a as wt}from"./chunk-GD5556B2.js";import"./chunk-5KHLOGTR.js";import"./chunk-TUFTB5UD.js";import"./chunk-AYLYOLVG.js";import"./chunk-A2SWQS2N.js";import"./chunk-ZQ6MG635.js";import"./chunk-RINDVT6U.js";import"./chunk-OIN3HGOQ.js";import"./chunk-Z7WBY27D.js";import"./chunk-SB3IYODL.js";import"./chunk-XP7UEI56.js";import"./chunk-L3C4AHZJ.js";import"./chunk-VAIBLWOY.js";import"./chunk-UTBVLDKY.js";import"./chunk-PGWKJ6FK.js";import{a as R}from"./chunk-PFT7KJ65.js";import{b as L,d as P}from"./chunk-WNTOQYRY.js";import"./chunk-UFBTCHEI.js";import"./chunk-VFRHMNLJ.js";import"./chunk-HFI2MD3H.js";import{a as W}from"./chunk-SA74WAVS.js";import{a as E}from"./chunk-ANGJCT4I.js";import{a as _}from"./chunk-UPXJJBXZ.js";import{d as A,e as z}from"./chunk-RC3XP5WU.js";import"./chunk-HN5HLFTB.js";import"./chunk-KSHK3ZPX.js";import"./chunk-DKFUZO5P.js";import{a as bt}from"./chunk-YXWBSRKS.js";import"./chunk-L6FZRTSN.js";import"./chunk-LDJT7TII.js";import"./chunk-LRNSFLHR.js";import"./chunk-FEHSJUZJ.js";import"./chunk-R64X3EJF.js";import"./chunk-NRW33IP5.js";import"./chunk-5ZR7EFPY.js";import"./chunk-BMDZJNJV.js";import"./chunk-DPY77ASH.js";import"./chunk-TOA3JILU.js";import"./chunk-ZY5U2UNT.js";import"./chunk-FB2QGVI2.js";import"./chunk-LRGEEPGK.js";import"./chunk-WVJDCDGZ.js";import"./chunk-BDPCUDJB.js";import"./chunk-R2MHAPWD.js";import"./chunk-U6RM2N4A.js";import{a as j}from"./chunk-Q4BKFSTW.js";import{a as S}from"./chunk-DYB3RWP7.js";import"./chunk-A7ZJQCNU.js";import{a as ut}from"./chunk-VLLLNIMN.js";import{a as nt}from"./chunk-4ZGIL6OE.js";import"./chunk-CFIJKJXD.js";import"./chunk-QLNFHOLH.js";import"./chunk-OXCEJQFC.js";import"./chunk-BV3PGYSH.js";import{a as it}from"./chunk-OW5QGJD4.js";import{a as vt}from"./chunk-CYPGWEOO.js";import{a as ct,b as st,c as lt,d as dt,e as pt,f as gt}from"./chunk-KDUM4EZJ.js";import"./chunk-SGE4DLC3.js";import"./chunk-2YTBWEC7.js";import"./chunk-JTOLQCOG.js";import"./chunk-JBUNDNKJ.js";import"./chunk-7R347KBY.js";import"./chunk-AFRA4BIW.js";import"./chunk-3A47R5RQ.js";import"./chunk-D6X2WCEG.js";import"./chunk-HPHWQU34.js";import{a as F,b as T}from"./chunk-ANQ4HVVK.js";import"./chunk-PD24XKD6.js";import"./chunk-TWIUL2P3.js";import"./chunk-ZX5OIIJX.js";import"./chunk-DZ67OJVF.js";import"./chunk-KOIHMAAP.js";import"./chunk-XFD3ULUF.js";import"./chunk-GC23RRCI.js";import"./chunk-LMYJ6V44.js";import"./chunk-N6G4VZXF.js";import"./chunk-4T6PRR6R.js";import{a as v}from"./chunk-3O3Q24JL.js";import"./chunk-PJBAQZ6G.js";import"./chunk-Z5WMKCRJ.js";import"./chunk-EKKRQI6B.js";import"./chunk-WVDTHFGS.js";import{a as u,c as h}from"./chunk-3ZWDIEEM.js";import{a as ot}from"./chunk-LWGVLLBH.js";import"./chunk-CNDSIADP.js";import{b as C}from"./chunk-PAQW5BFW.js";import"./chunk-MQ6F5LE4.js";import"./chunk-TVZAFTPT.js";import{c as B,d as m}from"./chunk-43WMZDDH.js";import{a as r}from"./chunk-P37U34EQ.js";import{QueryClient as $,QueryClientProvider as J}from"@tanstack/react-query";function d(t){let a=document.documentElement;Object.keys(t).forEach(e=>{let o=t[e];o&&a.style.setProperty(e,o)})}r(d,"setCssProperties");function N(t){let a={};return Object.keys(t).forEach(e=>{a[`--${e}`]=t[e]}),a}r(N,"mapThemeColors");function q(t){return{"--spacing":t}}r(q,"mapThemeSpacing");function K(t){return{"--radius":t}}r(K,"mapThemeBorderRadius");function U(t){return{"--fontSizeBase":t.fontSizeBase}}r(U,"mapThemeFont");function f(t){t?.colors&&d(N(t.colors)),t?.spacing&&d(q(t.spacing)),t?.borderRadius&&d(K(t.borderRadius)),t?.font&&d(U(t.font))}r(f,"applyTheme");import{createContext as V,useEffect as M,useMemo as Y}from"react";import{jsx as Q}from"react/jsx-runtime";var H=V({theme:{}});function w(t){M(()=>{t.theme&&Object.keys(t.theme).length>0&&f(t.theme)},[t.theme]);let a=Y(()=>({theme:t.theme}),[t.theme]);return Q(H.Provider,{value:a,children:t.children})}r(w,"ThemeProvider");var b={local:"http://localhost:4000/api/eor",partners:"https://gateway.partners.remote-sandbox.com",production:"https://gateway.remote.com",sandbox:"https://gateway.remote-sandbox.com",staging:"https://gateway.niceremote.com"};import{createClient as X}from"@hey-api/client-fetch";import{useQuery as Z}from"@tanstack/react-query";import{useRef as x}from"react";function G(t){try{return new URL(t),!0}catch{return!1}}r(G,"isValidUrl");var y=r(({auth:t,options:a,authId:e="default"})=>{let o=x(null),{refetch:c}=Z({queryKey:["auth",e],queryFn:t,enabled:!1}),s=a?.environment?b[a?.environment]:"https://gateway.remote.com",l=v.getConfig(),g="0.27.0";a?.environment&&a?.environment!=="production"&&m(g);let p=!!a?.proxy&&G(a.proxy.url);return a?.proxy&&!p&&console.error("Invalid proxy URL provided. Using default base URL."),x(X({...l,headers:{...l.headers,...p?a?.proxy?.headers:{},"X-Client-Name":"remote-flows-sdk","X-Client-Version":g},baseUrl:p?a.proxy?.url:s,auth:r(async()=>{function k(n){return!n||Date.now()+6e4>n}if(r(k,"hasTokenExpired"),!o.current||k(o.current.expiresAt)){let{data:n}=await c();n&&(o.current={accessToken:n.accessToken,expiresAt:Date.now()+n.expiresIn*1e3})}return o.current?.accessToken},"auth")}))},"useAuth");import{jsx as i}from"react/jsx-runtime";var tt=new $;function at({children:t,auth:a,authId:e,proxy:o,environment:c}){let s=y({auth:a,authId:e,options:{proxy:o,environment:c}});return i(h.Provider,{value:{client:s.current},children:t})}r(at,"RemoteFlowContextWrapper");function rt({children:t,components:a}){return i(u.Provider,{value:a?{components:a}:{components:{}},children:t})}r(rt,"FormFieldsProvider");function et({auth:t,authId:a,children:e,components:o,theme:c,proxy:s,environment:l}){return i(J,{client:tt,children:i(rt,{components:o,children:i(at,{auth:t,authId:a,proxy:s,environment:l,children:i(w,{theme:c,children:e})})})})}r(et,"RemoteFlows");export{ot as ContractAmendmentConfirmationForm,ut as ContractAmendmentFlow,nt as ContractAmendmentForm,it as ContractAmendmentSubmit,bt as ContractorOnboardingFlow,j as CostCalculatorDisclaimer,R as CostCalculatorFlow,W as CostCalculatorForm,E as CostCalculatorResetButton,O as CostCalculatorResults,_ as CostCalculatorSubmitButton,D as EstimationResults,wt as OnboardingFlow,et as RemoteFlows,I as SummaryResults,ft as TerminationDialogInfoContent,ht as TerminationFlow,mt as TerminationReasonsDetailContent,T as ZendeskTriggerButton,L as buildCostCalculatorEstimationPayload,C as convertFromCents,S as disclaimerData,B as transformYupErrorsIntoObject,dt as useBookedTimeoffBeforeAndAfterTerminationQuery,vt as useContractAmendment,P as useCostCalculator,z as useCostCalculatorEstimationCsv,A as useCostCalculatorEstimationPdf,ct as useEmploymentQuery,lt as usePaidTimeoffBreakdownQuery,pt as useSummaryTimeOffDataQuery,gt as useTimeOffLeavePoliciesSummaryQuery,st as useTimeOffQuery,F as zendeskArticles};
1
+ import"./chunk-FZ7FWFJX.js";import{a as ft}from"./chunk-WLBRCGTG.js";import{a as mt}from"./chunk-QIQTM4HB.js";import{a as ht}from"./chunk-Z42H2QEW.js";import"./chunk-UQOWSJ2B.js";import"./chunk-P5WUODPR.js";import"./chunk-7AC3W7WD.js";import"./chunk-6IL4TB7S.js";import"./chunk-IWA5B4U6.js";import"./chunk-7VOQAVM4.js";import"./chunk-VM2DQCZO.js";import"./chunk-EHAZWZ3O.js";import"./chunk-SLMJEZJ7.js";import"./chunk-BOTWQMOJ.js";import"./chunk-S4XU4SE7.js";import"./chunk-GULCZWSK.js";import"./chunk-6LJRRFK2.js";import"./chunk-53KVZ4BP.js";import"./chunk-2FKEF3OG.js";import"./chunk-MRPXDND2.js";import"./chunk-6VRUYYUV.js";import"./chunk-MRYRNB7Y.js";import"./chunk-Z3BMF4BO.js";import{a as O}from"./chunk-RAHCZTQ3.js";import"./chunk-BCXRPHWY.js";import"./chunk-MQWVZSGH.js";import{a as I}from"./chunk-H425RKFI.js";import{a as D}from"./chunk-W55MUSAS.js";import"./chunk-DTHBG6BD.js";import"./chunk-CVIWZYO3.js";import"./chunk-E6OBNWMU.js";import"./chunk-5NPET4ZO.js";import"./chunk-R645TMO5.js";import"./chunk-ZSCKSEAA.js";import"./chunk-ZE3YT3Q6.js";import{a as wt}from"./chunk-FFMKAMWP.js";import"./chunk-5KHLOGTR.js";import"./chunk-QDYWPG2R.js";import"./chunk-GWLOE7WJ.js";import"./chunk-WCIJHQMP.js";import"./chunk-ZQ6MG635.js";import"./chunk-RINDVT6U.js";import"./chunk-OIN3HGOQ.js";import"./chunk-Z7WBY27D.js";import"./chunk-AODV6HT2.js";import"./chunk-5MYWJJBQ.js";import"./chunk-L3C4AHZJ.js";import"./chunk-VAIBLWOY.js";import"./chunk-UTBVLDKY.js";import"./chunk-PGWKJ6FK.js";import{a as R}from"./chunk-QPTO4XXU.js";import{b as L,d as P}from"./chunk-ZWZJ4XOY.js";import"./chunk-UFBTCHEI.js";import"./chunk-VFRHMNLJ.js";import"./chunk-HFI2MD3H.js";import{a as W}from"./chunk-PYKEYPGA.js";import{a as E}from"./chunk-ANGJCT4I.js";import{a as _}from"./chunk-UPXJJBXZ.js";import{d as A,e as z}from"./chunk-RC3XP5WU.js";import"./chunk-HN5HLFTB.js";import"./chunk-KSHK3ZPX.js";import"./chunk-DKFUZO5P.js";import{a as bt}from"./chunk-HMNHKZGD.js";import"./chunk-QTYDDIVO.js";import"./chunk-OU4Y73FX.js";import"./chunk-AUZWLETL.js";import"./chunk-IQKZWU7I.js";import"./chunk-AWDGLK2T.js";import"./chunk-TM7Q7RHH.js";import"./chunk-5ZR7EFPY.js";import"./chunk-BMDZJNJV.js";import"./chunk-DPY77ASH.js";import"./chunk-TOA3JILU.js";import"./chunk-ZY5U2UNT.js";import"./chunk-FB2QGVI2.js";import"./chunk-LRGEEPGK.js";import"./chunk-WVJDCDGZ.js";import"./chunk-BDPCUDJB.js";import"./chunk-R2MHAPWD.js";import"./chunk-U6RM2N4A.js";import{a as j}from"./chunk-Q4BKFSTW.js";import{a as S}from"./chunk-DYB3RWP7.js";import"./chunk-A7ZJQCNU.js";import{a as ut}from"./chunk-MGVP76ZI.js";import{a as nt}from"./chunk-6KIQIVKA.js";import"./chunk-CFIJKJXD.js";import"./chunk-JO4722R7.js";import"./chunk-DB7ITLRX.js";import"./chunk-BV3PGYSH.js";import{a as it}from"./chunk-OW5QGJD4.js";import{a as vt}from"./chunk-CYPGWEOO.js";import{a as ct,b as st,c as lt,d as dt,e as pt,f as gt}from"./chunk-KDUM4EZJ.js";import"./chunk-SGE4DLC3.js";import"./chunk-2YTBWEC7.js";import"./chunk-JTOLQCOG.js";import"./chunk-JBUNDNKJ.js";import"./chunk-7R347KBY.js";import"./chunk-AFRA4BIW.js";import"./chunk-3A47R5RQ.js";import"./chunk-D6X2WCEG.js";import"./chunk-HPHWQU34.js";import{a as F,b as T}from"./chunk-ANQ4HVVK.js";import"./chunk-PD24XKD6.js";import"./chunk-TWIUL2P3.js";import"./chunk-ZX5OIIJX.js";import"./chunk-DZ7FZ4L2.js";import"./chunk-NP4G3N5P.js";import"./chunk-XFD3ULUF.js";import"./chunk-R3DJNVHR.js";import"./chunk-LMYJ6V44.js";import"./chunk-N6G4VZXF.js";import"./chunk-XPKVRYIU.js";import"./chunk-VDRNNOVA.js";import{a as v}from"./chunk-3O3Q24JL.js";import"./chunk-PJBAQZ6G.js";import"./chunk-Z5WMKCRJ.js";import"./chunk-EKKRQI6B.js";import"./chunk-WVDTHFGS.js";import{a as u,c as h}from"./chunk-3ZWDIEEM.js";import{a as ot}from"./chunk-LWGVLLBH.js";import"./chunk-CNDSIADP.js";import{b as C}from"./chunk-PAQW5BFW.js";import"./chunk-MQ6F5LE4.js";import"./chunk-TVZAFTPT.js";import{c as B,d as m}from"./chunk-43WMZDDH.js";import{a as r}from"./chunk-P37U34EQ.js";import{QueryClient as $,QueryClientProvider as J}from"@tanstack/react-query";function d(t){let a=document.documentElement;Object.keys(t).forEach(e=>{let o=t[e];o&&a.style.setProperty(e,o)})}r(d,"setCssProperties");function N(t){let a={};return Object.keys(t).forEach(e=>{a[`--${e}`]=t[e]}),a}r(N,"mapThemeColors");function q(t){return{"--spacing":t}}r(q,"mapThemeSpacing");function K(t){return{"--radius":t}}r(K,"mapThemeBorderRadius");function U(t){return{"--fontSizeBase":t.fontSizeBase}}r(U,"mapThemeFont");function f(t){t?.colors&&d(N(t.colors)),t?.spacing&&d(q(t.spacing)),t?.borderRadius&&d(K(t.borderRadius)),t?.font&&d(U(t.font))}r(f,"applyTheme");import{createContext as V,useEffect as M,useMemo as Y}from"react";import{jsx as Q}from"react/jsx-runtime";var H=V({theme:{}});function w(t){M(()=>{t.theme&&Object.keys(t.theme).length>0&&f(t.theme)},[t.theme]);let a=Y(()=>({theme:t.theme}),[t.theme]);return Q(H.Provider,{value:a,children:t.children})}r(w,"ThemeProvider");var b={local:"http://localhost:4000/api/eor",partners:"https://gateway.partners.remote-sandbox.com",production:"https://gateway.remote.com",sandbox:"https://gateway.remote-sandbox.com",staging:"https://gateway.niceremote.com"};import{createClient as X}from"@hey-api/client-fetch";import{useQuery as Z}from"@tanstack/react-query";import{useRef as x}from"react";function G(t){try{return new URL(t),!0}catch{return!1}}r(G,"isValidUrl");var y=r(({auth:t,options:a,authId:e="default"})=>{let o=x(null),{refetch:c}=Z({queryKey:["auth",e],queryFn:t,enabled:!1}),s=a?.environment?b[a?.environment]:"https://gateway.remote.com",l=v.getConfig(),g="0.28.0";a?.environment&&a?.environment!=="production"&&m(g);let p=!!a?.proxy&&G(a.proxy.url);return a?.proxy&&!p&&console.error("Invalid proxy URL provided. Using default base URL."),x(X({...l,headers:{...l.headers,...p?a?.proxy?.headers:{},"X-Client-Name":"remote-flows-sdk","X-Client-Version":g},baseUrl:p?a.proxy?.url:s,auth:r(async()=>{function k(n){return!n||Date.now()+6e4>n}if(r(k,"hasTokenExpired"),!o.current||k(o.current.expiresAt)){let{data:n}=await c();n&&(o.current={accessToken:n.accessToken,expiresAt:Date.now()+n.expiresIn*1e3})}return o.current?.accessToken},"auth")}))},"useAuth");import{jsx as i}from"react/jsx-runtime";var tt=new $;function at({children:t,auth:a,authId:e,proxy:o,environment:c}){let s=y({auth:a,authId:e,options:{proxy:o,environment:c}});return i(h.Provider,{value:{client:s.current},children:t})}r(at,"RemoteFlowContextWrapper");function rt({children:t,components:a}){return i(u.Provider,{value:a?{components:a}:{components:{}},children:t})}r(rt,"FormFieldsProvider");function et({auth:t,authId:a,children:e,components:o,theme:c,proxy:s,environment:l}){return i(J,{client:tt,children:i(rt,{components:o,children:i(at,{auth:t,authId:a,proxy:s,environment:l,children:i(w,{theme:c,children:e})})})})}r(et,"RemoteFlows");export{ot as ContractAmendmentConfirmationForm,ut as ContractAmendmentFlow,nt as ContractAmendmentForm,it as ContractAmendmentSubmit,bt as ContractorOnboardingFlow,j as CostCalculatorDisclaimer,R as CostCalculatorFlow,W as CostCalculatorForm,E as CostCalculatorResetButton,O as CostCalculatorResults,_ as CostCalculatorSubmitButton,D as EstimationResults,wt as OnboardingFlow,et as RemoteFlows,I as SummaryResults,ft as TerminationDialogInfoContent,ht as TerminationFlow,mt as TerminationReasonsDetailContent,T as ZendeskTriggerButton,L as buildCostCalculatorEstimationPayload,C as convertFromCents,S as disclaimerData,B as transformYupErrorsIntoObject,dt as useBookedTimeoffBeforeAndAfterTerminationQuery,vt as useContractAmendment,P as useCostCalculator,z as useCostCalculatorEstimationCsv,A as useCostCalculatorEstimationPdf,ct as useEmploymentQuery,lt as usePaidTimeoffBreakdownQuery,pt as useSummaryTimeOffDataQuery,gt as useTimeOffLeavePoliciesSummaryQuery,st as useTimeOffQuery,F as zendeskArticles};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/RemoteFlowsProvider.tsx","../src/lib/applyTheme.ts","../src/theme.tsx","../src/environments.ts","../src/useAuth.ts"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport { ThemeProvider } from '@/src/theme';\nimport { FormFieldsContext, RemoteFlowContext } from './context';\nimport { Components, RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { useAuth } from './useAuth';\n\nconst queryClient = new QueryClient();\n\ntype RemoteFlowContextWrapperProps = {\n auth: RemoteFlowsSDKProps['auth'];\n children: React.ReactNode;\n environment?: RemoteFlowsSDKProps['environment'];\n proxy?: RemoteFlowsSDKProps['proxy'];\n authId?: RemoteFlowsSDKProps['authId'];\n};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n authId,\n proxy,\n environment,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\n authId,\n options: {\n proxy,\n environment,\n },\n });\n return (\n <RemoteFlowContext.Provider value={{ client: remoteApiClient.current }}>\n {children}\n </RemoteFlowContext.Provider>\n );\n}\n\nexport function FormFieldsProvider({\n children,\n components,\n}: PropsWithChildren<{\n components?: Components;\n}>) {\n return (\n <FormFieldsContext.Provider\n value={components ? { components } : { components: {} }}\n >\n {children}\n </FormFieldsContext.Provider>\n );\n}\n\nexport function RemoteFlows({\n auth,\n authId,\n children,\n components,\n theme,\n proxy,\n environment,\n}: PropsWithChildren<RemoteFlowsSDKProps>) {\n return (\n <QueryClientProvider client={queryClient}>\n <FormFieldsProvider components={components}>\n <RemoteFlowContextWrapper\n auth={auth}\n authId={authId}\n proxy={proxy}\n environment={environment}\n >\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </RemoteFlowContextWrapper>\n </FormFieldsProvider>\n </QueryClientProvider>\n );\n}\n","import {\n CssThemeBorder,\n CssThemeColors,\n CssThemeFont,\n CssThemeSpacing,\n ThemeColors,\n ThemeFont,\n ThemeProviderProps,\n} from '@/src/types/theme';\n\nfunction setCssProperties(variables: Record<string, string>) {\n const root = document.documentElement;\n Object.keys(variables).forEach((v) => {\n const propertyVal = variables[v];\n if (propertyVal) {\n root.style.setProperty(v, propertyVal);\n }\n });\n}\n\nfunction mapThemeColors(colors: ThemeColors): CssThemeColors {\n const result: CssThemeColors = {};\n Object.keys(colors).forEach((key) => {\n result[`--${key}` as keyof CssThemeColors] =\n colors[key as keyof ThemeColors];\n });\n return result;\n}\n\nfunction mapThemeSpacing(spacing: string): CssThemeSpacing {\n return {\n '--spacing': spacing,\n };\n}\n\nfunction mapThemeBorderRadius(borderRadius: string): CssThemeBorder {\n return {\n '--radius': borderRadius,\n };\n}\n\nfunction mapThemeFont(font: ThemeFont): CssThemeFont {\n return {\n '--fontSizeBase': font.fontSizeBase,\n };\n}\n\nexport function applyTheme(theme: ThemeProviderProps['theme']) {\n if (theme?.colors) {\n setCssProperties(mapThemeColors(theme.colors));\n }\n\n if (theme?.spacing) {\n setCssProperties(mapThemeSpacing(theme.spacing));\n }\n\n if (theme?.borderRadius) {\n setCssProperties(mapThemeBorderRadius(theme.borderRadius));\n }\n\n if (theme?.font) {\n setCssProperties(mapThemeFont(theme.font));\n }\n}\n","import { applyTheme } from '@/src/lib/applyTheme';\nimport { createContext, useEffect, useMemo } from 'react';\nimport { ThemeProviderProps } from './types/theme';\n\nconst ThemeContext = createContext<Omit<ThemeProviderProps, 'children'>>({\n theme: {},\n});\n\nexport function ThemeProvider(props: ThemeProviderProps) {\n useEffect(() => {\n if (props.theme && Object.keys(props.theme).length > 0) {\n applyTheme(props.theme);\n }\n }, [props.theme]);\n\n const value = useMemo(() => {\n return { theme: props.theme };\n }, [props.theme]);\n\n return (\n <ThemeContext.Provider value={value}>\n {props.children}\n </ThemeContext.Provider>\n );\n}\n","export const ENVIRONMENTS = {\n local: 'http://localhost:4000/api/eor',\n partners: 'https://gateway.partners.remote-sandbox.com',\n production: 'https://gateway.remote.com',\n sandbox: 'https://gateway.remote-sandbox.com',\n staging: 'https://gateway.niceremote.com',\n};\n","import { client } from '@/src/client/client.gen';\nimport { ENVIRONMENTS } from '@/src/environments';\nimport { createClient } from '@hey-api/client-fetch';\nimport { useQuery } from '@tanstack/react-query';\nimport { useRef } from 'react';\nimport { RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { debug } from './lib/utils';\n\ntype AuthResponse = {\n accessToken: string;\n expiresIn: number;\n};\n\ntype Options = Partial<{\n environment: keyof typeof ENVIRONMENTS;\n proxy: RemoteFlowsSDKProps['proxy'];\n}>;\n\nfunction isValidUrl(url: string) {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const useAuth = ({\n auth,\n options,\n authId = 'default',\n}: {\n auth: () => Promise<AuthResponse>;\n options?: Options;\n authId?: 'default' | 'client';\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth', authId],\n queryFn: auth,\n enabled: false,\n });\n\n const baseUrl = options?.environment\n ? ENVIRONMENTS[options?.environment]\n : process.env.REMOTE_GATEWAY_URL;\n\n const clientConfig = client.getConfig();\n const npmPackageVersion = process.env.VERSION || 'unknown';\n\n if (options?.environment && options?.environment !== 'production') {\n debug(npmPackageVersion);\n }\n\n const isValidProxy = !!options?.proxy && isValidUrl(options.proxy.url);\n\n if (options?.proxy && !isValidProxy) {\n console.error('Invalid proxy URL provided. Using default base URL.');\n }\n\n return useRef(\n createClient({\n ...clientConfig,\n headers: {\n ...clientConfig.headers,\n ...(isValidProxy ? options?.proxy?.headers : {}),\n 'X-Client-Name': 'remote-flows-sdk',\n 'X-Client-Version': npmPackageVersion,\n },\n baseUrl: isValidProxy ? options.proxy?.url : baseUrl,\n auth: async () => {\n function hasTokenExpired(expiresAt: number | undefined) {\n return !expiresAt || Date.now() + 60000 > expiresAt;\n }\n if (!session.current || hasTokenExpired(session.current.expiresAt)) {\n const { data } = await refetch();\n if (data) {\n session.current = {\n accessToken: data.accessToken,\n expiresAt: Date.now() + data.expiresIn * 1000,\n };\n }\n }\n return session.current?.accessToken;\n },\n }),\n );\n};\n"],"mappings":"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","names":["QueryClient","QueryClientProvider","setCssProperties","variables","root","v","propertyVal","__name","mapThemeColors","colors","result","key","mapThemeSpacing","spacing","mapThemeBorderRadius","borderRadius","mapThemeFont","font","applyTheme","theme","createContext","useEffect","useMemo","jsx","ThemeContext","createContext","ThemeProvider","props","useEffect","applyTheme","value","useMemo","__name","ENVIRONMENTS","createClient","useQuery","useRef","isValidUrl","url","__name","useAuth","auth","options","authId","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","debug","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","authId","proxy","environment","remoteApiClient","useAuth","RemoteFlowContext","__name","FormFieldsProvider","components","FormFieldsContext","RemoteFlows","theme","QueryClientProvider","ThemeProvider"]}
1
+ {"version":3,"sources":["../src/RemoteFlowsProvider.tsx","../src/lib/applyTheme.ts","../src/theme.tsx","../src/environments.ts","../src/useAuth.ts"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport { ThemeProvider } from '@/src/theme';\nimport { FormFieldsContext, RemoteFlowContext } from './context';\nimport { Components, RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { useAuth } from './useAuth';\n\nconst queryClient = new QueryClient();\n\ntype RemoteFlowContextWrapperProps = {\n auth: RemoteFlowsSDKProps['auth'];\n children: React.ReactNode;\n environment?: RemoteFlowsSDKProps['environment'];\n proxy?: RemoteFlowsSDKProps['proxy'];\n authId?: RemoteFlowsSDKProps['authId'];\n};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n authId,\n proxy,\n environment,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\n authId,\n options: {\n proxy,\n environment,\n },\n });\n return (\n <RemoteFlowContext.Provider value={{ client: remoteApiClient.current }}>\n {children}\n </RemoteFlowContext.Provider>\n );\n}\n\nexport function FormFieldsProvider({\n children,\n components,\n}: PropsWithChildren<{\n components?: Components;\n}>) {\n return (\n <FormFieldsContext.Provider\n value={components ? { components } : { components: {} }}\n >\n {children}\n </FormFieldsContext.Provider>\n );\n}\n\nexport function RemoteFlows({\n auth,\n authId,\n children,\n components,\n theme,\n proxy,\n environment,\n}: PropsWithChildren<RemoteFlowsSDKProps>) {\n return (\n <QueryClientProvider client={queryClient}>\n <FormFieldsProvider components={components}>\n <RemoteFlowContextWrapper\n auth={auth}\n authId={authId}\n proxy={proxy}\n environment={environment}\n >\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </RemoteFlowContextWrapper>\n </FormFieldsProvider>\n </QueryClientProvider>\n );\n}\n","import {\n CssThemeBorder,\n CssThemeColors,\n CssThemeFont,\n CssThemeSpacing,\n ThemeColors,\n ThemeFont,\n ThemeProviderProps,\n} from '@/src/types/theme';\n\nfunction setCssProperties(variables: Record<string, string>) {\n const root = document.documentElement;\n Object.keys(variables).forEach((v) => {\n const propertyVal = variables[v];\n if (propertyVal) {\n root.style.setProperty(v, propertyVal);\n }\n });\n}\n\nfunction mapThemeColors(colors: ThemeColors): CssThemeColors {\n const result: CssThemeColors = {};\n Object.keys(colors).forEach((key) => {\n result[`--${key}` as keyof CssThemeColors] =\n colors[key as keyof ThemeColors];\n });\n return result;\n}\n\nfunction mapThemeSpacing(spacing: string): CssThemeSpacing {\n return {\n '--spacing': spacing,\n };\n}\n\nfunction mapThemeBorderRadius(borderRadius: string): CssThemeBorder {\n return {\n '--radius': borderRadius,\n };\n}\n\nfunction mapThemeFont(font: ThemeFont): CssThemeFont {\n return {\n '--fontSizeBase': font.fontSizeBase,\n };\n}\n\nexport function applyTheme(theme: ThemeProviderProps['theme']) {\n if (theme?.colors) {\n setCssProperties(mapThemeColors(theme.colors));\n }\n\n if (theme?.spacing) {\n setCssProperties(mapThemeSpacing(theme.spacing));\n }\n\n if (theme?.borderRadius) {\n setCssProperties(mapThemeBorderRadius(theme.borderRadius));\n }\n\n if (theme?.font) {\n setCssProperties(mapThemeFont(theme.font));\n }\n}\n","import { applyTheme } from '@/src/lib/applyTheme';\nimport { createContext, useEffect, useMemo } from 'react';\nimport { ThemeProviderProps } from './types/theme';\n\nconst ThemeContext = createContext<Omit<ThemeProviderProps, 'children'>>({\n theme: {},\n});\n\nexport function ThemeProvider(props: ThemeProviderProps) {\n useEffect(() => {\n if (props.theme && Object.keys(props.theme).length > 0) {\n applyTheme(props.theme);\n }\n }, [props.theme]);\n\n const value = useMemo(() => {\n return { theme: props.theme };\n }, [props.theme]);\n\n return (\n <ThemeContext.Provider value={value}>\n {props.children}\n </ThemeContext.Provider>\n );\n}\n","export const ENVIRONMENTS = {\n local: 'http://localhost:4000/api/eor',\n partners: 'https://gateway.partners.remote-sandbox.com',\n production: 'https://gateway.remote.com',\n sandbox: 'https://gateway.remote-sandbox.com',\n staging: 'https://gateway.niceremote.com',\n};\n","import { client } from '@/src/client/client.gen';\nimport { ENVIRONMENTS } from '@/src/environments';\nimport { createClient } from '@hey-api/client-fetch';\nimport { useQuery } from '@tanstack/react-query';\nimport { useRef } from 'react';\nimport { RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { debug } from './lib/utils';\n\ntype AuthResponse = {\n accessToken: string;\n expiresIn: number;\n};\n\ntype Options = Partial<{\n environment: keyof typeof ENVIRONMENTS;\n proxy: RemoteFlowsSDKProps['proxy'];\n}>;\n\nfunction isValidUrl(url: string) {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const useAuth = ({\n auth,\n options,\n authId = 'default',\n}: {\n auth: () => Promise<AuthResponse>;\n options?: Options;\n authId?: 'default' | 'client';\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth', authId],\n queryFn: auth,\n enabled: false,\n });\n\n const baseUrl = options?.environment\n ? ENVIRONMENTS[options?.environment]\n : process.env.REMOTE_GATEWAY_URL;\n\n const clientConfig = client.getConfig();\n const npmPackageVersion = process.env.VERSION || 'unknown';\n\n if (options?.environment && options?.environment !== 'production') {\n debug(npmPackageVersion);\n }\n\n const isValidProxy = !!options?.proxy && isValidUrl(options.proxy.url);\n\n if (options?.proxy && !isValidProxy) {\n console.error('Invalid proxy URL provided. Using default base URL.');\n }\n\n return useRef(\n createClient({\n ...clientConfig,\n headers: {\n ...clientConfig.headers,\n ...(isValidProxy ? options?.proxy?.headers : {}),\n 'X-Client-Name': 'remote-flows-sdk',\n 'X-Client-Version': npmPackageVersion,\n },\n baseUrl: isValidProxy ? options.proxy?.url : baseUrl,\n auth: async () => {\n function hasTokenExpired(expiresAt: number | undefined) {\n return !expiresAt || Date.now() + 60000 > expiresAt;\n }\n if (!session.current || hasTokenExpired(session.current.expiresAt)) {\n const { data } = await refetch();\n if (data) {\n session.current = {\n accessToken: data.accessToken,\n expiresAt: Date.now() + data.expiresIn * 1000,\n };\n }\n }\n return session.current?.accessToken;\n },\n }),\n );\n};\n"],"mappings":"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","names":["QueryClient","QueryClientProvider","setCssProperties","variables","root","v","propertyVal","__name","mapThemeColors","colors","result","key","mapThemeSpacing","spacing","mapThemeBorderRadius","borderRadius","mapThemeFont","font","applyTheme","theme","createContext","useEffect","useMemo","jsx","ThemeContext","createContext","ThemeProvider","props","useEffect","applyTheme","value","useMemo","__name","ENVIRONMENTS","createClient","useQuery","useRef","isValidUrl","url","__name","useAuth","auth","options","authId","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","debug","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","authId","proxy","environment","remoteApiClient","useAuth","RemoteFlowContext","__name","FormFieldsProvider","components","FormFieldsContext","RemoteFlows","theme","QueryClientProvider","ThemeProvider"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/remote-flows",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "scripts": {
5
5
  "build": "NODE_ENV=production tsup",
6
6
  "ci": "npm run build && npm run check-format && npm run check-exports && npm run lint && npm run type-check && npm run test",
@@ -1,2 +0,0 @@
1
- var e={data:{version:7,schema:{additionalProperties:!1,allOf:[{if:{properties:{agrees_to_pto_amount:{const:"no"}},required:["agrees_to_pto_amount"]},then:{properties:{agrees_to_pto_amount_notes:{type:"string"}},required:["agrees_to_pto_amount_notes"]},else:{properties:{agrees_to_pto_amount_notes:!1,timesheet_file:!1}}}],properties:{timeoff_statement:{type:"null",title:"Timeoff statement","x-jsf-presentation":{inputType:"hidden",statement:{title:"Make sure these paid time off records are correct",description:"You must pay the employee for any unused accrued paid time off, so please check these records carefully.",inputType:"statement",severity:"warning"},meta:{ignoreValue:!0}}},paid_time_off_info:{type:"null",title:"Paid time off info","x-jsf-presentation":{inputType:"hidden"},meta:{ignoreValue:!0}},agrees_to_pto_amount:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Are these paid time off records correct?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},agrees_to_pto_amount_notes:{description:"Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.",maxLength:1e3,title:"Provide time off details",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},timesheet_file:{description:"Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.",title:"Timesheet document",type:["string","null"],"x-jsf-presentation":{inputType:"file",accept:".pdf"}}},required:["agrees_to_pto_amount"],type:"object","x-jsf-order":["timeoff_statement","paid_time_off_info","agrees_to_pto_amount","agrees_to_pto_amount_notes","timesheet_file"]}}};export{e as a};
2
- //# sourceMappingURL=chunk-4T6PRR6R.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Termination/json-schemas/paidTimeOff.ts"],"sourcesContent":["export const paidTimeOffSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n agrees_to_pto_amount: {\n const: 'no',\n },\n },\n required: ['agrees_to_pto_amount'],\n },\n then: {\n properties: {\n agrees_to_pto_amount_notes: {\n type: 'string',\n },\n },\n required: ['agrees_to_pto_amount_notes'],\n },\n else: {\n properties: {\n agrees_to_pto_amount_notes: false,\n timesheet_file: false,\n },\n },\n },\n ],\n properties: {\n timeoff_statement: {\n type: 'null',\n title: 'Timeoff statement',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n statement: {\n title: 'Make sure these paid time off records are correct',\n description:\n 'You must pay the employee for any unused accrued paid time off, so please check these records carefully.',\n inputType: 'statement',\n severity: 'warning',\n },\n meta: {\n ignoreValue: true,\n },\n },\n },\n paid_time_off_info: {\n type: 'null',\n title: 'Paid time off info',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n },\n meta: {\n ignoreValue: true,\n },\n },\n agrees_to_pto_amount: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title: 'Are these paid time off records correct?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n agrees_to_pto_amount_notes: {\n description:\n 'Please provide details regarding any additional days taken, including specific dates, or any other inaccuracy in the time off data.',\n maxLength: 1000,\n title: 'Provide time off details',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n timesheet_file: {\n description:\n 'Upload a timesheet exported from your HR software. This way we can compare and confirm the total number of Paid time off.',\n title: 'Timesheet document',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n },\n },\n },\n required: ['agrees_to_pto_amount'],\n type: 'object',\n 'x-jsf-order': [\n 'timeoff_statement',\n 'paid_time_off_info',\n 'agrees_to_pto_amount',\n 'agrees_to_pto_amount_notes',\n 'timesheet_file',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAAoB,CAC/B,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CACL,CACE,GAAI,CACF,WAAY,CACV,qBAAsB,CACpB,MAAO,IACT,CACF,EACA,SAAU,CAAC,sBAAsB,CACnC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,CAC1B,KAAM,QACR,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,2BAA4B,GAC5B,eAAgB,EAClB,CACF,CACF,CACF,EACA,WAAY,CACV,kBAAmB,CACjB,KAAM,OACN,MAAO,oBACP,qBAAsB,CACpB,UAAW,SACX,UAAW,CACT,MAAO,oDACP,YACE,2GACF,UAAW,YACX,SAAU,SACZ,EACA,KAAM,CACJ,YAAa,EACf,CACF,CACF,EACA,mBAAoB,CAClB,KAAM,OACN,MAAO,qBACP,qBAAsB,CACpB,UAAW,QACb,EACA,KAAM,CACJ,YAAa,EACf,CACF,EACA,qBAAsB,CACpB,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MAAO,2CACP,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,2BAA4B,CAC1B,YACE,sIACF,UAAW,IACX,MAAO,2BACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,eAAgB,CACd,YACE,4HACF,MAAO,qBACP,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,OACX,OAAQ,MACV,CACF,CACF,EACA,SAAU,CAAC,sBAAsB,EACjC,KAAM,SACN,cAAe,CACb,oBACA,qBACA,uBACA,6BACA,gBACF,CACF,CACF,CACF","names":["paidTimeOffSchema"]}
@@ -1,2 +0,0 @@
1
- var e={data:{version:7,schema:{additionalProperties:!1,allOf:[{if:{properties:{will_challenge_termination:{const:"yes"}},required:["will_challenge_termination"]},then:{properties:{will_challenge_termination_description:{type:"string"}},required:["will_challenge_termination_description"]},else:{properties:{will_challenge_termination_description:!1}}}],properties:{termination_reason:{title:"Termination reason",description:"Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.",type:"string",oneOf:[{const:"gross_misconduct",title:"Gross misconduct"},{const:"performance",title:"Performance"},{const:"workforce_reduction",title:"Workforce Reduction"},{const:"values",title:"Values"},{const:"compliance_issue",title:"Compliance issue"},{const:"incapacity_to_perform_inherent_duties",title:"Incapacity To perform inherent duties"},{const:"mutual_agreement",title:"Mutual agreement"},{const:"cancellation_before_start_date",title:"Decision to cancel hiring before the employee starts"},{const:"job_abandonment",title:"Job abandonment"},{const:"dissatisfaction_with_remote_service",title:"Dissatisfaction with EOR service"},{const:"end_of_fixed_term_contract_compliance_issue",title:"End of fixed-term contract"},{const:"other",title:"Other"}],"x-jsf-presentation":{inputType:"select"}},reason_description:{description:"",maxLength:1e3,title:"Termination reason details",type:"string","x-jsf-presentation":{inputType:"textarea"}},additional_comments:{description:"",maxLength:1e3,title:"Additional details regarding this termination process.",type:"string","x-jsf-presentation":{inputType:"textarea"}},termination_reason_files:{description:"Please upload any supporting documents regarding the termination reason.",title:"Termination reason files",type:"string","x-jsf-presentation":{inputType:"file",accept:".pdf",multiple:!0}},risk_assesment_info:{description:"",title:"Risk assessment info",type:"null","x-jsf-presentation":{inputType:"hidden"}},risk_assessment_reasons:{description:"",title:"This employee is...",type:"array",items:{anyOf:[{const:"sick_leave",title:"Currently on or recently returned from sick leave"},{const:"family_leave",title:"Currently on or recently returned from maternity, paternity, or other family leave"},{const:"pregnant_or_breastfeeding",title:"Pregnant or breastfeeding"},{const:"requested_medical_or_family_leave",title:"Requested medical or family leave"},{const:"disabled_or_health_condition",title:"Disabled or has a health condition"},{const:"member_of_union_or_works_council",title:"A member of a union or works council"},{const:"caring_responsibilities",title:"Caring responsibilities"},{const:"reported_concerns_with_workplace",title:"Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions"},{const:"none_of_these",title:"To the best of my knowledge, I am not aware of any of these"}]},"x-jsf-presentation":{inputType:"checkbox",direction:"column"}},will_challenge_termination:{description:"",oneOf:[{const:"yes",description:"",title:"Yes"},{const:"no",description:"",title:"No"}],title:"Do you consider it is likely that the employee will challenge their termination?",type:"string","x-jsf-presentation":{direction:"column",inputType:"radio"}},will_challenge_termination_description:{description:"",maxLength:1e3,title:"Please explain how the employee will challenge their termination",type:["string","null"],"x-jsf-presentation":{inputType:"textarea"}},proposed_termination_date_info:{description:"",title:"Proposed termination date info",type:"null","x-jsf-presentation":{inputType:"hidden"}},proposed_termination_date:{description:"",format:"date",maxLength:255,title:"Proposed termination date",type:"string","x-jsf-presentation":{inputType:"date"}}},required:["termination_reason","reason_description","risk_assessment_reasons","will_challenge_termination","proposed_termination_date"],type:"object","x-jsf-order":["termination_reason","reason_description","additional_comments","termination_reason_files","risk_assesment_info","risk_assessment_reasons","will_challenge_termination","will_challenge_termination_description","proposed_termination_date_info","proposed_termination_date"]}}};export{e as a};
2
- //# sourceMappingURL=chunk-GC23RRCI.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/flows/Termination/json-schemas/terminationDetails.ts"],"sourcesContent":["export const terminationDetailsSchema = {\n data: {\n version: 7,\n schema: {\n additionalProperties: false,\n allOf: [\n {\n if: {\n properties: {\n will_challenge_termination: {\n const: 'yes',\n },\n },\n required: ['will_challenge_termination'],\n },\n then: {\n properties: {\n will_challenge_termination_description: {\n type: 'string',\n },\n },\n required: ['will_challenge_termination_description'],\n },\n else: {\n properties: {\n will_challenge_termination_description: false,\n },\n },\n },\n ],\n properties: {\n termination_reason: {\n title: 'Termination reason',\n description:\n 'Make sure you choose an accurate termination reason to avoid unfair or unlawful dismissal claims.',\n type: 'string',\n oneOf: [\n {\n const: 'gross_misconduct',\n title: 'Gross misconduct',\n },\n {\n const: 'performance',\n title: 'Performance',\n },\n {\n const: 'workforce_reduction',\n title: 'Workforce Reduction',\n },\n {\n const: 'values',\n title: 'Values',\n },\n {\n const: 'compliance_issue',\n title: 'Compliance issue',\n },\n {\n const: 'incapacity_to_perform_inherent_duties',\n title: 'Incapacity To perform inherent duties',\n },\n {\n const: 'mutual_agreement',\n title: 'Mutual agreement',\n },\n {\n const: 'cancellation_before_start_date',\n title: 'Decision to cancel hiring before the employee starts',\n },\n {\n const: 'job_abandonment',\n title: 'Job abandonment',\n },\n {\n const: 'dissatisfaction_with_remote_service',\n title: 'Dissatisfaction with EOR service',\n },\n {\n const: 'end_of_fixed_term_contract_compliance_issue',\n title: 'End of fixed-term contract',\n },\n {\n const: 'other',\n title: 'Other',\n },\n ],\n 'x-jsf-presentation': {\n inputType: 'select',\n },\n },\n reason_description: {\n description: '',\n maxLength: 1000,\n title: 'Termination reason details',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n additional_comments: {\n description: '',\n maxLength: 1000,\n title: 'Additional details regarding this termination process.',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n termination_reason_files: {\n description:\n 'Please upload any supporting documents regarding the termination reason.',\n title: 'Termination reason files',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'file',\n accept: '.pdf',\n multiple: true,\n },\n },\n risk_assesment_info: {\n description: '',\n title: 'Risk assessment info',\n type: 'null',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n },\n },\n risk_assessment_reasons: {\n description: '',\n title: 'This employee is...',\n type: 'array',\n items: {\n anyOf: [\n {\n const: 'sick_leave',\n title: 'Currently on or recently returned from sick leave',\n },\n {\n const: 'family_leave',\n title:\n 'Currently on or recently returned from maternity, paternity, or other family leave',\n },\n {\n const: 'pregnant_or_breastfeeding',\n title: 'Pregnant or breastfeeding',\n },\n {\n const: 'requested_medical_or_family_leave',\n title: 'Requested medical or family leave',\n },\n {\n const: 'disabled_or_health_condition',\n title: 'Disabled or has a health condition',\n },\n {\n const: 'member_of_union_or_works_council',\n title: 'A member of a union or works council',\n },\n {\n const: 'caring_responsibilities',\n title: 'Caring responsibilities',\n },\n {\n const: 'reported_concerns_with_workplace',\n title:\n 'Reported any wrongdoing; raised any allegations of discrimination, harassment, retaliation, etc.; or asserted their employment rights or raised complaints about their working conditions',\n },\n {\n const: 'none_of_these',\n title:\n 'To the best of my knowledge, I am not aware of any of these',\n },\n ],\n },\n 'x-jsf-presentation': {\n inputType: 'checkbox',\n direction: 'column',\n },\n },\n will_challenge_termination: {\n description: '',\n oneOf: [\n {\n const: 'yes',\n description: '',\n title: 'Yes',\n },\n {\n const: 'no',\n description: '',\n title: 'No',\n },\n ],\n title:\n 'Do you consider it is likely that the employee will challenge their termination?',\n type: 'string',\n 'x-jsf-presentation': {\n direction: 'column',\n inputType: 'radio',\n },\n },\n will_challenge_termination_description: {\n description: '',\n maxLength: 1000,\n title:\n 'Please explain how the employee will challenge their termination',\n type: ['string', 'null'],\n 'x-jsf-presentation': {\n inputType: 'textarea',\n },\n },\n proposed_termination_date_info: {\n description: '',\n title: 'Proposed termination date info',\n type: 'null',\n 'x-jsf-presentation': {\n inputType: 'hidden',\n },\n },\n proposed_termination_date: {\n description: '',\n format: 'date',\n maxLength: 255,\n title: 'Proposed termination date',\n type: 'string',\n 'x-jsf-presentation': {\n inputType: 'date',\n },\n },\n },\n required: [\n 'termination_reason',\n 'reason_description',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'proposed_termination_date',\n ],\n type: 'object',\n 'x-jsf-order': [\n 'termination_reason',\n 'reason_description',\n 'additional_comments',\n 'termination_reason_files',\n 'risk_assesment_info',\n 'risk_assessment_reasons',\n 'will_challenge_termination',\n 'will_challenge_termination_description',\n 'proposed_termination_date_info',\n 'proposed_termination_date',\n ],\n },\n },\n};\n"],"mappings":"AAAO,IAAMA,EAA2B,CACtC,KAAM,CACJ,QAAS,EACT,OAAQ,CACN,qBAAsB,GACtB,MAAO,CACL,CACE,GAAI,CACF,WAAY,CACV,2BAA4B,CAC1B,MAAO,KACT,CACF,EACA,SAAU,CAAC,4BAA4B,CACzC,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,CACtC,KAAM,QACR,CACF,EACA,SAAU,CAAC,wCAAwC,CACrD,EACA,KAAM,CACJ,WAAY,CACV,uCAAwC,EAC1C,CACF,CACF,CACF,EACA,WAAY,CACV,mBAAoB,CAClB,MAAO,qBACP,YACE,oGACF,KAAM,SACN,MAAO,CACL,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,cACP,MAAO,aACT,EACA,CACE,MAAO,sBACP,MAAO,qBACT,EACA,CACE,MAAO,SACP,MAAO,QACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,wCACP,MAAO,uCACT,EACA,CACE,MAAO,mBACP,MAAO,kBACT,EACA,CACE,MAAO,iCACP,MAAO,sDACT,EACA,CACE,MAAO,kBACP,MAAO,iBACT,EACA,CACE,MAAO,sCACP,MAAO,kCACT,EACA,CACE,MAAO,8CACP,MAAO,4BACT,EACA,CACE,MAAO,QACP,MAAO,OACT,CACF,EACA,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,mBAAoB,CAClB,YAAa,GACb,UAAW,IACX,MAAO,6BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,oBAAqB,CACnB,YAAa,GACb,UAAW,IACX,MAAO,yDACP,KAAM,SACN,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,yBAA0B,CACxB,YACE,2EACF,MAAO,2BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,OACX,OAAQ,OACR,SAAU,EACZ,CACF,EACA,oBAAqB,CACnB,YAAa,GACb,MAAO,uBACP,KAAM,OACN,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,wBAAyB,CACvB,YAAa,GACb,MAAO,sBACP,KAAM,QACN,MAAO,CACL,MAAO,CACL,CACE,MAAO,aACP,MAAO,mDACT,EACA,CACE,MAAO,eACP,MACE,oFACJ,EACA,CACE,MAAO,4BACP,MAAO,2BACT,EACA,CACE,MAAO,oCACP,MAAO,mCACT,EACA,CACE,MAAO,+BACP,MAAO,oCACT,EACA,CACE,MAAO,mCACP,MAAO,sCACT,EACA,CACE,MAAO,0BACP,MAAO,yBACT,EACA,CACE,MAAO,mCACP,MACE,2LACJ,EACA,CACE,MAAO,gBACP,MACE,6DACJ,CACF,CACF,EACA,qBAAsB,CACpB,UAAW,WACX,UAAW,QACb,CACF,EACA,2BAA4B,CAC1B,YAAa,GACb,MAAO,CACL,CACE,MAAO,MACP,YAAa,GACb,MAAO,KACT,EACA,CACE,MAAO,KACP,YAAa,GACb,MAAO,IACT,CACF,EACA,MACE,mFACF,KAAM,SACN,qBAAsB,CACpB,UAAW,SACX,UAAW,OACb,CACF,EACA,uCAAwC,CACtC,YAAa,GACb,UAAW,IACX,MACE,mEACF,KAAM,CAAC,SAAU,MAAM,EACvB,qBAAsB,CACpB,UAAW,UACb,CACF,EACA,+BAAgC,CAC9B,YAAa,GACb,MAAO,iCACP,KAAM,OACN,qBAAsB,CACpB,UAAW,QACb,CACF,EACA,0BAA2B,CACzB,YAAa,GACb,OAAQ,OACR,UAAW,IACX,MAAO,4BACP,KAAM,SACN,qBAAsB,CACpB,UAAW,MACb,CACF,CACF,EACA,SAAU,CACR,qBACA,qBACA,0BACA,6BACA,2BACF,EACA,KAAM,SACN,cAAe,CACb,qBACA,qBACA,sBACA,2BACA,sBACA,0BACA,6BACA,yCACA,iCACA,2BACF,CACF,CACF,CACF","names":["terminationDetailsSchema"]}
@@ -1,2 +0,0 @@
1
- import{a as e}from"./chunk-GC23RRCI.js";import{a as i}from"./chunk-LMYJ6V44.js";import{a as o}from"./chunk-N6G4VZXF.js";import{a as m}from"./chunk-4T6PRR6R.js";var p={employee_communication:o,termination_details:e,paid_time_off:m,additional_information:i};export{p as a};
2
- //# sourceMappingURL=chunk-KOIHMAAP.js.map
@@ -1,2 +0,0 @@
1
- import{a as B}from"./chunk-BV3PGYSH.js";import{a as ye,b as Ge,c as Je,d as qe,e as Ke,f as Ye,g as je,h as Ze,i as Xe,j as Ce,k as et,l as xe,m as be,o as Se,q as tt,r as ot,s as rt}from"./chunk-D6X2WCEG.js";import{b as Qe}from"./chunk-HPHWQU34.js";import{b as _e}from"./chunk-ANQ4HVVK.js";import{a as ve,b as $}from"./chunk-WVDTHFGS.js";import{b as S}from"./chunk-3ZWDIEEM.js";import{a as ne,b as ae,c as b,d as Ae,e as Oe,f as Ue,g as ze,h as k,i as w,j as N,k as R,l as P,m as D}from"./chunk-CNDSIADP.js";import{g as Ve}from"./chunk-PAQW5BFW.js";import{a as h,e as oe}from"./chunk-43WMZDDH.js";import{a as r}from"./chunk-P37U34EQ.js";import{Fragment as wo,useEffect as Ro,useRef as Ht}from"react";import{Fragment as Ot,jsx as A,jsxs as se}from"react/jsx-runtime";function le({name:e,defaultValue:t,description:n,label:o,onChange:s,multiple:d,options:c,component:F,...f}){let{components:l}=S(),{control:a}=b(),u=r((m,i,g)=>{let p=g.value?[...g.value]:[];i?p.includes(m)||g.onChange([...p,m]):g.onChange(p.filter(y=>y!==m))},"handleCheckboxChange");return A(k,{control:a,name:e,defaultValue:t,render:({field:m,fieldState:i})=>{let g=F||l?.checkbox;if(g){let p={name:e,description:n,label:o,defaultValue:t,multiple:d,options:c,...f};return A(g,{field:{...m,onChange:r(y=>{if(d){let{checked:x,value:v}=y.target;u(v,x,m),s?.(x);return}m.onChange(y),s?.(y)},"onChange")},fieldState:i,fieldData:p})}return se(w,{"data-field":e,className:h(`RemoteFlows__CheckBoxField__Item__${e}`),children:[A(R,{children:se(Ot,{children:[c&&d?A(N,{children:o}):null,c&&d?c.map(p=>se("div",{className:"flex space-x-2",children:[A(ye,{id:p.value,onCheckedChange:y=>{u(p.value,y===!0,m),s?.(y,p.value)},checked:m.value?.includes(p.value),className:"RemoteFlows__CheckBox__Input"}),A(N,{htmlFor:p.value,className:"mb-0 RemoteFlows__CheckBox__Label",children:p.label})]},p.value)):se("div",{className:"flex space-x-2",children:[A(ye,{id:e,onCheckedChange:p=>{m.onChange(p),s?.(p)},checked:m.value,className:"RemoteFlows__CheckBox__Input"}),A(N,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label",children:o})]})]})}),n&&A(P,{children:n}),i.error&&A(D,{})]})}})}r(le,"CheckBoxField");import{CalendarIcon as Gt}from"lucide-react";import{PopoverClose as Jt}from"@radix-ui/react-popover";import{ChevronLeft as Ut,ChevronRight as Vt}from"lucide-react";import{DayPicker as zt}from"react-day-picker";import{jsx as ke}from"react/jsx-runtime";function nt({className:e,classNames:t,showOutsideDays:n=!0,...o}){return ke(zt,{showOutsideDays:n,className:h("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:h(ve({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:h("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",o.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:h(ve({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:r(({className:s,...d})=>ke(Ut,{className:h("size-4",s),...d}),"IconLeft"),IconRight:r(({className:s,...d})=>ke(Vt,{className:h("size-4",s),...d}),"IconRight")},...o})}r(nt,"Calendar");import*as U from"@radix-ui/react-popover";import{jsx as ie}from"react/jsx-runtime";function me({...e}){return ie(U.Root,{"data-slot":"popover",...e})}r(me,"Popover");function de({...e}){return ie(U.Trigger,{"data-slot":"popover-trigger",...e})}r(de,"PopoverTrigger");function ce({className:e,align:t="center",sideOffset:n=4,...o}){return ie(U.Portal,{children:ie(U.Content,{"data-slot":"popover-content",align:t,sideOffset:n,className:h("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...o})})}r(ce,"PopoverContent");import{format as at,parse as qt}from"date-fns";import{Fragment as Kt,jsx as M,jsxs as Ne}from"react/jsx-runtime";function st({description:e,label:t,name:n,minDate:o,onChange:s,component:d,...c}){let{components:F}=S(),{control:f}=b(),l;return c.meta?.mot&&typeof c.meta.mot=="number"?l=Ve(c.meta.mot):o&&(l=qt(o,"yyyy-MM-dd",new Date)),M(k,{control:f,name:n,render:({field:a,fieldState:u})=>{let m=d||F?.date;if(m){let i={description:e,label:t,name:n,onChange:s,...l&&{minDate:l.toISOString()},...c};return M(m,{field:{...a,onChange:r(g=>{a.onChange(g),s?.(g)},"onChange")},fieldState:u,fieldData:i})}return Ne(w,{"data-field":n,className:`flex flex-col RemoteFlows__DatePickerField__Item__${n}`,children:[M(N,{className:"RemoteFlows__DatePickerField__Label",children:t}),Ne(me,{children:[M(de,{asChild:!0,children:M(R,{children:M("div",{children:Ne($,{type:"button",variant:"outline",className:h("w-full pl-3 text-left font-normal",!a.value&&"text-muted-foreground"),"data-testid":`date-picker-button-${n}`,children:[a.value&&M(Kt,{children:at(a.value,"yyyy-MM-dd")}),M(Gt,{className:"ml-auto h-4 w-4 opacity-50"})]})})})}),M(ce,{className:"w-auto p-0 RemoteFlows__DatepickerField__PopoverContent",align:"start",children:M(nt,{mode:"single",className:"RemoteFlows__DatepickerField__Calendar",selected:a.value?new Date(a.value):void 0,onSelect:i=>{a.onChange(i?at(i,"yyyy-MM-dd"):null),s?.(i)},defaultMonth:l,components:{DayContent:r(i=>M(Jt,{children:i.date.getDate()}),"DayContent")},...l&&{disabled:r(i=>i<l,"disabled")}})})]}),e?M(P,{children:e}):null,u.error&&M(D,{className:"RemoteFlows__DatePickerField__Error"})]})}})}r(st,"DatePickerField");import{useState as Yt,useRef as jt}from"react";import{Upload as Zt,X as Xt}from"lucide-react";import{jsx as V,jsxs as we}from"react/jsx-runtime";function lt({onChange:e,className:t,multiple:n}){let[o,s]=Yt([]),d=jt(null),c=r(l=>{l.preventDefault(),d.current?.click()},"handleClick"),F=r(l=>{if(l.target.files&&l.target.files.length>0){let a=Array.from(l.target.files);s(a),e(l)}},"handleChange"),f=r(l=>{s(a=>a.filter(u=>u!==l))},"onRemoveFile");return we("div",{className:h("flex flex-col items-start gap-4",t),children:[V("input",{type:"file",ref:d,onChange:F,className:"hidden","aria-label":"File upload",multiple:n}),we($,{type:"button",onClick:c,className:"gap-2",children:[V(Zt,{className:"h-4 w-4"}),"Choose File"]}),o.length===0&&V("div",{className:"text-sm",children:n?V("span",{className:"font-medium",children:"No files selected. You can select multiple files"}):V("span",{className:"font-medium",children:"No file selected."})}),o.length>0&&o.map((l,a)=>we("div",{className:"text-sm flex items-center gap-2",children:["Selected file: ",V("span",{className:"font-medium",children:l.name})," (",Math.round(l.size/1024)," KB)",V($,{variant:"ghost",onClick:()=>f(l),children:V(Xt,{})})]},a))]})}r(lt,"FileUploader");import{jsx as z,jsxs as eo}from"react/jsx-runtime";var Qt=r(e=>new Promise((t,n)=>{let o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result),o.onerror=s=>n(s)}),"toBase64"),it=r(async e=>{let t=e.target.files?Array.from(e.target.files):[];return await Promise.all(t.map(async o=>{let s=await Qt(o);return{name:o.name,content:s.split(",")[1]}}))},"convertFilesToBase64");function mt({name:e,description:t,label:n,multiple:o,onChange:s,component:d,...c}){let{components:F}=S(),{control:f}=b();return z(k,{control:f,name:e,render:({field:l,fieldState:a})=>{let u=d||F?.file;if(u){let m={name:e,description:t,label:n,multiple:o,...c};return z(u,{field:{...l,value:null,onChange:r(async i=>{let g=await it(i);l.onChange(g),s?.(g)},"onChange")},fieldState:a,fieldData:m})}return eo(w,{"data-field":e,className:`RemoteFlows__FileUpload__Item__${e}`,children:[z(N,{className:"RemoteFlows__FileUpload__Label",children:n}),z(R,{children:z(lt,{onChange:async m=>{let i=await it(m);l.onChange(i),s?.(i)},multiple:o,className:h("RemoteFlows__FileUpload__Input")})}),t&&z("div",{className:"flex items-center justify-between",children:z(P,{className:"RemoteFlows__FileUpload__Description",children:t})}),a.error&&z(D,{className:"RemoteFlows__FileUpload__Error"})]})}})}r(mt,"FileUploadField");import{jsx as Re}from"react/jsx-runtime";function ue(e){let{components:t}=S(),{control:n}=b(),o=e.component||t?.number;return o?Re(k,{control:n,name:e.name,render:({field:s,fieldState:d})=>Re(o,{field:{...s,onChange:r(c=>{s.onChange(c),e.onChange?.(c)},"onChange")},fieldState:d,fieldData:e})}):Re(B,{...e,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$"})}r(ue,"NumberField");import{Fragment as to}from"react";import{jsx as W,jsxs as Pe}from"react/jsx-runtime";function dt({name:e,defaultValue:t,description:n,label:o,options:s,onChange:d,component:c,...F}){let{components:f}=S(),{control:l}=b();return W(k,{control:l,name:e,defaultValue:t,render:({field:a,fieldState:u})=>{let m=c||f?.radio;if(m){let i={name:e,defaultValue:t,description:n,label:o,options:s,...F};return W(m,{field:{...a,onChange:r(g=>{a.onChange(g),d?.(g)},"onChange")},fieldState:u,fieldData:i})}return Pe(w,{className:h("space-y-3",`RemoteFlows__RadioGroupField__Item__${e}`),"data-field":e,children:[W(N,{children:o}),W(R,{children:W(Ge,{"aria-label":o||e,onValueChange:i=>{a.onChange(i),d?.(i)},value:a.value,className:"flex flex-col space-y-3",children:s?.map(i=>W(to,{children:Pe(w,{"data-field":e,className:"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item",children:[W(R,{children:W(Je,{value:i.value,className:"RemoteFlows__RadioField__Input",disabled:i.disabled})}),Pe("div",{children:[W(N,{className:"font-normal mb-0 RemoteFlows__RadioField__Label",children:i.label}),i.description&&W(P,{className:"mt-2",children:i.description})]})]})},i.value))})}),n&&W(P,{children:n}),u.error&&W(D,{})]})}})}r(dt,"RadioGroupField");import{jsx as E,jsxs as ct}from"react/jsx-runtime";function ut({label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,component:c,...F}){let{control:f}=b(),{components:l}=S();return E(k,{defaultValue:o,control:f,name:t,render:({field:a,fieldState:u})=>{let m=c||l?.select;if(m){let i={label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,...F};return E(m,{field:{...a,onChange:r(g=>{let p=F.jsonType==="number"?Number(g):g;a.onChange(p),d?.(p)},"onChange")},fieldState:u,fieldData:i})}return ct(w,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[E(N,{className:"RemoteFlows__SelectField__Label",children:e}),E(R,{children:E("div",{className:"relative",children:ct(qe,{value:a.value||"",onValueChange:i=>{let g=F.jsonType==="number"?Number(i):i;a.onChange(g),d?.(g)},children:[E(je,{className:"RemoteFlows__SelectField__Trigger","aria-invalid":!!u.error,"aria-label":e,children:E("span",{className:"absolute",children:E(Ye,{placeholder:e})})}),E(Ze,{className:"RemoteFlows__SelectField__Content",children:E(Ke,{className:"RemoteFlows__SelectField__Group",children:n.map(i=>E(Xe,{value:i.value,className:"RemoteFlows__SelectField__SelectItem",disabled:i.disabled,children:i.label},i.value))})})]})})}),s&&E(P,{children:s}),u.error&&E(D,{})]})}})}r(ut,"SelectField");import{useState as lo}from"react";import{Fragment as oo,useState as ro}from"react";import{Check as no,ChevronDownIcon as ao,X as so}from"lucide-react";import{Command as Y}from"cmdk";import{SearchIcon as tn}from"lucide-react";import{jsx as j,jsxs as an}from"react/jsx-runtime";function pt({className:e,...t}){return j(Y,{"data-slot":"command",className:h("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}r(pt,"Command");function ft({className:e,...t}){return j(Y.List,{"data-slot":"command-list",className:h("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}r(ft,"CommandList");function Ft({...e}){return j(Y.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}r(Ft,"CommandEmpty");function gt({className:e,...t}){return j(Y.Group,{"data-slot":"command-group",className:h("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}r(gt,"CommandGroup");function ht({className:e,...t}){return j(Y.Separator,{"data-slot":"command-separator",className:h("bg-border -mx-1 h-px",e),...t})}r(ht,"CommandSeparator");function _t({className:e,...t}){return j(Y.Item,{"data-slot":"command-item",className:h("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}r(_t,"CommandItem");import{jsx as L,jsxs as Z}from"react/jsx-runtime";function pe({options:e,selected:t,onChange:n,placeholder:o,...s}){let[d,c]=ro(!1),F=r(a=>{n(t.filter(u=>u.value!==a.value))},"handleUnselect"),f=e.some(a=>a.category),l=e.reduce((a,u)=>{let m=u.category||"Uncategorized";return a[m]||(a[m]=[]),a[m].push(u),a},{});return Z(me,{open:d,onOpenChange:c,...s,children:[L(de,{children:Z($,{variant:"outline",role:"combobox","aria-expanded":d,className:"w-full justify-between font-normal",type:"button",children:[L("div",{className:"flex gap-1 flex-wrap overflow-x-auto max-h-[2.5rem] items-center",children:t.length>0?t.map(a=>Z(Qe,{variant:"secondary",className:"mr-1 mb-1",children:[a.label,L("div",{role:"button",tabIndex:0,"aria-label":`remove ${a.label}`,className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",onKeyDown:u=>{u.key==="Enter"&&F(a)},onMouseDown:u=>{u.preventDefault(),u.stopPropagation()},onClick:()=>F(a),children:L(so,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},a.label)):L("span",{className:"text-foreground",children:o})}),L(ao,{className:"size-4"})]})}),L(ce,{align:"start",className:"w-full p-0",children:L(pt,{children:Z(ft,{children:[L(Ft,{children:"No item found."}),Object.entries(l).map(([a,u],m)=>Z(oo,{children:[m>0&&L(ht,{}),L(gt,{heading:f?a:void 0,children:u.map(i=>{let g=t.some(p=>p.value===i.value);return Z(_t,{onSelect:()=>{n(g?t.filter(p=>p.value!==i.value):[...t,i])},children:[L(no,{className:h("mr-2 h-4 w-4",g?"opacity-100":"opacity-0")}),i.label]},i.label)})})]},a))]})})})]})}r(pe,"MultiSelect");import{jsx as G,jsxs as io}from"react/jsx-runtime";function yt({label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,$meta:c,component:F,...f}){let{control:l}=b(),{components:a}=S(),[u,m]=lo([]);return G(k,{defaultValue:o,control:l,name:t,render:({field:i,fieldState:g})=>{let p=F||a?.countries;if(p){let v={label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,$meta:c,...f};return G(p,{field:{...i,onChange:r(T=>{i.onChange(T),d?.(T)},"onChange")},fieldState:g,fieldData:v})}let y=[...Object.entries(c?.regions||{}).map(([v,T])=>({value:T,label:v,category:"Regions"})),...Object.entries(c?.subregions||{}).map(([v,T])=>({value:T,label:v,category:"Subregions"})),...n.map(v=>({...v,value:v.value,label:v.label,category:"Countries"}))],x=r(v=>{let T=v.map(({value:K})=>K);i.onChange(T),d?.(T),m(v)},"handleChange");return io(w,{"data-field":t,className:`RemoteFlows__CountryField__Item__${t}`,children:[G(N,{className:"RemoteFlows__CountryField__Label",children:e}),G(R,{children:G(pe,{options:y,selected:u,onChange:x,...f})}),s&&G(P,{children:s}),g.error&&G(D,{})]})}})}r(yt,"CountryField");import*as vt from"react";import{jsx as mo}from"react/jsx-runtime";var De=vt.forwardRef(({className:e,...t},n)=>mo("textarea",{className:h("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));De.displayName="Textarea";import{jsx as J,jsxs as Te}from"react/jsx-runtime";function Ct({name:e,description:t,label:n,onChange:o,maxLength:s,component:d,...c}){let{components:F}=S(),{control:f}=b();return J(k,{control:f,name:e,render:({field:l,fieldState:a})=>{let u=d||F?.textarea;if(u){let i={name:e,description:t,label:n,maxLength:s,...c};return J(u,{field:{...l,onChange:r(g=>{l.onChange(g),o?.(g)},"onChange")},fieldState:a,fieldData:i})}let m=l.value?.length??0;return Te(w,{"data-field":e,className:`RemoteFlows__TextArea__Item__${e}`,children:[J(N,{className:"RemoteFlows__TextArea__Label",children:n}),J(R,{children:J(De,{...l,value:l.value??"",onChange:i=>{l.onChange(i),o?.(i)},className:h(a.error&&"border-red-500 focus-visible:ring-red-500","RemoteFlows__TextArea__Input"),placeholder:n})}),(t||s)&&Te("div",{className:"flex items-center justify-between",children:[t&&J(P,{className:"RemoteFlows__TextArea__Description",children:t}),s&&Te("span",{className:"text-sm ml-auto RemoteFlows__TextArea__MaxLength",children:[m,"/",s]})]}),a.error&&J(D,{className:"RemoteFlows__TextArea__Error"})]})}})}r(Ct,"TextAreaField");import{jsx as Ie}from"react/jsx-runtime";function xt(e){let{components:t}=S(),{control:n}=b(),o=e.component||t?.email;return o?Ie(k,{control:n,name:e.name,render:({field:s,fieldState:d})=>Ie(o,{field:{...s,onChange:r(c=>{s.onChange(c),e.onChange?.(c)},"onChange")},fieldState:d,fieldData:e})}):Ie(B,{...e,type:"email"})}r(xt,"EmailField");import{jsx as bt}from"react/jsx-runtime";function St(e){let{control:t}=b();return bt(k,{control:t,name:e.name,render:({field:n})=>bt("input",{...n,type:"hidden"})})}r(St,"HiddenField");import ho,{useEffect as _o,useState as $t}from"react";var kt=r((e,t,n)=>{if(e&&"reportValidity"in e){let o=ne(n,t);e.setCustomValidity(o&&o.message||""),e.reportValidity()}},"r"),$e=r((e,t)=>{for(let n in t.fields){let o=t.fields[n];o&&o.ref&&"reportValidity"in o.ref?kt(o.ref,n,e):o&&o.refs&&o.refs.forEach(s=>kt(s,n,e))}},"o"),wt=r((e,t)=>{t.shouldUseNativeValidation&&$e(e,t);let n={};for(let o in e){let s=ne(t.fields,o),d=Object.assign(e[o]||{},{ref:s&&s.ref});if(co(t.names||Object.keys(e),o)){let c=Object.assign({},ne(n,o));ae(c,"root",d),ae(n,o,c)}else ae(n,o,d)}return n},"s"),co=r((e,t)=>{let n=Nt(t);return e.some(o=>Nt(o).match(`^${n}\\.\\d+`))},"i");function Nt(e){return e.replace(/\]|\[/g,"")}r(Nt,"n");function Rt(e,t,n){return t===void 0&&(t={}),n===void 0&&(n={}),function(o,s,d){try{return Promise.resolve(function(c,F){try{var f=(t.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e[n.mode==="sync"?"validateSync":"validate"](o,Object.assign({abortEarly:!1},t,{context:s}))).then(function(l){return d.shouldUseNativeValidation&&$e({},d),{values:n.raw?Object.assign({},o):l,errors:{}}}))}catch(l){return F(l)}return f&&f.then?f.then(void 0,F):f}(0,function(c){if(!c.inner)throw c;return{values:{},errors:wt((F=c,f=!d.shouldUseNativeValidation&&d.criteriaMode==="all",(F.inner||[]).reduce(function(l,a){if(l[a.path]||(l[a.path]={message:a.message,type:a.type}),f){var u=l[a.path].types,m=u&&u[a.type];l[a.path]=Ae(a.path,f,l,a.type,m?[].concat(m,a.message):a.message)}return l},{})),d)};var F,f}))}catch(c){return Promise.reject(c)}}}r(Rt,"o");import*as I from"yup";import Pt from"lodash.groupby";import X from"lodash.capitalize";var Dt=60,fe=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function uo(e){if(e<60)return`${e}m`;let t=Math.floor(e/Dt),n=e%Dt;return n>0?`${t}h${n}m`:`${t}h`}r(uo,"convertBreakDurationToHours");function Tt(e){let t=e.reduce((n,o)=>o.hours+n,0);return Number(t.toFixed(2))}r(Tt,"calculateTotalWorkHours");function po(e,t){let n=t.map(({day:d})=>d.toLowerCase()),o=n.indexOf(e),s=null;for(;o<n.length&&!s;){let d=n[o],c=n[o+1],F=fe.indexOf(d)+1;fe[F]===c||(s=d),o+=1}return s}r(po,"findLastConsecutiveDay");function fo(e){return e.start_time&&e.end_time&&(typeof e.hours=="number"?e.hours:Number.parseInt(e.hours))>0}r(fo,"shouldSummarizeSchedule");function Fo(e){return Number.parseInt(e.break_duration_minutes)>0}r(Fo,"shouldSummarizeBreaks");function It(e){let t=e.filter(fo),n=Pt(t,F=>`${F.start_time}|${F.end_time}`),o=e.filter(Fo),s=Pt(o,"break_duration_minutes"),d=Object.keys(n).map(F=>{let f=n[F],l=f[0].day,[a,u]=F.split("|"),m=`from <span>${a.replace(":","h")}</span> to <span>${u.replace(":","h")}</span>`,i=po(l,f),p=(i?f.findIndex(y=>y.day===i):-1)===f.length-1;return f.length===1?`${X(l)}, ${m}`:!p||!i?f.reduce((y,x,v)=>{let T=X(x.day);return v===f.length-1?`${y}and ${T}, ${m}`:`${y}<span>${T}</span>, `},""):`<span>${X(l)}</span> to <span>${X(i)}</span>, ${m}`}),c=Object.keys(s).reverse().map((F,f)=>{let l=f===0,a=s[F],u=uo(parseInt(F,10));if(Object.keys(s).length===1)return`With ${u} daily breaks`;if(a.length===1){let m=`${u} break on ${X(a[0].day)}.`;return l?`With ${m}`:m}return a.reduce((m,i,g)=>{let p=X(i.day);return g===0?`${m} ${p}`:g===a.length-1?`${m}, and ${p}.`:`${m}, ${p}`},l?`With ${u} break on`:`${u} break on`)});return{workHoursSummary:d,breakSummary:c}}r(It,"buildWorkScheduleSummary");function Me(e){let{checked:t,start_time:n,end_time:o,break_duration_minutes:s}=e;if(!t)return 0;let[d,c]=n.split(":").map(Number),[F,f]=o.split(":").map(Number),l=d*60+c,m=(F*60+f-l-Number.parseInt(s||"0"))/60;return m===Math.floor(m)?m:Number(m.toFixed(2))}r(Me,"calculateHours");var go={monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat",sunday:"Sun"};function Fe(e){return go[e]}r(Fe,"getShortWeekday");import{jsx as _,jsxs as H}from"react/jsx-runtime";var yo=I.object({day:I.string().required(),checked:I.boolean().required(),start_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:r(e=>e.required("Required"),"then"),otherwise:r(e=>e.optional().nullable(),"otherwise")}),end_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:r(e=>e.required("Required"),"then"),otherwise:r(e=>e.optional().nullable(),"otherwise")}),hours:I.number().default(0),break_duration_minutes:I.string().default("0")}),vo=I.object({schedule:I.array(yo)});function Co({defaultSchedule:e,onSubmit:t}){let[n,o]=$t(!1),s=fe.map(p=>{let y=e.find(x=>x.day.toLowerCase()===Fe(p).toLowerCase()||x.day.toLowerCase()===p.toLowerCase());return y?{...y,day:Fe(p),checked:!0}:{...e[0],checked:!1,day:Fe(p)}}),d=Ue({defaultValues:{schedule:s},resolver:Rt(vo)}),{handleSubmit:c,watch:F,reset:f,control:l,formState:a}=d,{fields:u}=Oe({name:"schedule",control:l}),m=F("schedule");function i(p){let y=p.schedule.filter(({checked:x})=>x).map(x=>({...x,hours:Me(x)}));t(y),o(!1)}r(i,"handleSubmitWorkingHours");function g(){f(),o(!1)}return r(g,"handleCancel"),_("div",{className:"flex items-center justify-between",children:H(Ce,{open:n,onOpenChange:o,children:[_(et,{asChild:!0,children:_($,{variant:"link",className:"flex items-center p-0 RemoteFlows__WorkScheduleSelectionForm__Trigger",children:"Edit Schedule"})}),H(xe,{className:"max-w-5xl max-h-[90vh] overflow-y-auto px-8 py-4 RemoteFlows__WorkScheduleSelectionForm__Content",children:[_(be,{children:_(Se,{className:"RemoteFlows__WorkScheduleSelectionForm__Title",children:"Edit employee working hours"})}),_(ze,{...d,children:H("form",{className:"space-y-4 RemoteFlows__WorkScheduleSelectionForm__Form",children:[H("div",{className:"rounded-lg",children:[_("p",{className:"text-gray-600 text-sm mb-4 RemoteFlows__WorkScheduleSelectionForm__Description",children:"The times displayed are in the employee's time zone in the 24-hour format."}),H("div",{className:"grid grid-cols-12 gap-4 text-sm font-medium text-gray-500 uppercase tracking-wide RemoteFlows__WorkScheduleSelectionForm__Header",children:[_("div",{className:"col-span-2"}),_("div",{className:"col-span-3 text-center",children:"START"}),_("div",{className:"col-span-1 text-center"}),_("div",{className:"col-span-3 text-center",children:"END"}),_("div",{className:"col-span-2 text-center",children:"HOURS"})]}),_("div",{className:"RemoteFlows__WorkScheduleSelectionForm__Rows",children:u.map((p,y)=>{let x=m[y],v=Me(x);return H(ho.Fragment,{children:[H("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Hours",children:[_("div",{className:"col-span-2 flex items-center gap-3",children:_(le,{label:p.day,name:`schedule.${y}.checked`})}),_("div",{className:"col-span-3",children:_(B,{name:`schedule.${y}.start_time`,includeErrorMessage:!1})}),_("div",{className:"col-span-1 text-center text-gray-500",children:"to"}),_("div",{className:"col-span-3",children:_(B,{name:`schedule.${y}.end_time`,includeErrorMessage:!1})}),_("div",{className:"col-span-2 text-center text-gray-600",children:isNaN(v)?"-":`${v} hours`})]}),H("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Break",children:[_("div",{className:"col-span-2 text-gray-500",children:"Break"}),_("div",{className:"col-span-2",children:_(B,{name:`schedule.${y}.break_duration_minutes`,includeErrorMessage:!1})}),_("div",{className:"col-span-2 text-gray-500",children:"minutes"}),_("div",{className:"col-span-4"})]})]},p.id)})})]}),Object.keys(a.errors).length>0&&_("p",{className:"text-destructive text-sm mb-0",children:"Invalid time format (HH:mm)"}),H("div",{className:"flex gap-4 pt-4",children:[_($,{type:"button",className:"reset-button",variant:"outline",onClick:g,children:"Cancel"}),_($,{type:"button",className:"submit-button",onClick:c(i),children:"Save Schedule"})]})]})})]})]})})}r(Co,"WorkScheduleSelectionForm");function Mt(e){let{components:t}=S(),{setValue:n,control:o,watch:s}=b(),d=s(e.name),[c,F]=$t(d),{workHoursSummary:f,breakSummary:l}=It(c),a=Tt(c);_o(()=>{n(e.name,c)},[c,e.name,n]);function u(i){F(i)}r(u,"onSubmit");let m=e.component||t?.["work-schedule"];return m?_(k,{control:o,name:e.name,render:({field:i,fieldState:g})=>_(m,{field:{...i,onChange:r(p=>{i.onChange(p),e.onChange?.(p)},"onChange")},fieldState:g,fieldData:{...e,defaultFormattedValue:{workHoursSummary:f,breakSummary:l,totalWorkHours:a}}})}):H("div",{className:"flex flex-col gap-3 RemoteFlows__WorkScheduleField",children:[_("p",{className:"text-sm RemoteFlows__WorkScheduleField__Title",children:"Work hours"}),H("div",{className:"flex flex-col gap-1 RemoteFlows__WorkScheduleField__Summary",children:[_("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__WorkHours",dangerouslySetInnerHTML:{__html:f.join(", ")}}),_("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Break",children:l.join()}),H("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Total",children:["Total of ",_("span",{children:a})," hours per week"]}),_(Co,{defaultSchedule:c,onSubmit:u})]})]})}r(Mt,"WorkScheduleField");import{useState as xo}from"react";import{jsx as q,jsxs as bo}from"react/jsx-runtime";function Et({label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,component:c,...F}){let{control:f}=b(),{components:l}=S(),[a,u]=xo();return q(k,{defaultValue:o,control:f,name:t,render:({field:m,fieldState:i})=>{let g=c||l?.["multi-select"];if(g){let y={label:e,name:t,options:n,defaultValue:o,description:s,onChange:d,...F};return q(g,{field:{...m,onChange:r(x=>{m.onChange(x),d?.(x)},"onChange")},fieldState:i,fieldData:y})}let p=a||n.filter(y=>m.value.includes(y.value));return bo(w,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[q(N,{className:"RemoteFlows__SelectField__Label",children:e}),q(R,{children:q(pe,{options:n,selected:p,onChange:y=>{let x=y.map(({value:v})=>v);m.onChange(x),d?.(x),u(y)},...F})}),s&&q(P,{children:s}),i.error&&q(D,{})]})}})}r(Et,"MultiSelectField");import{jsx as So}from"react/jsx-runtime";var Wt=r(e=>So(ue,{maxLength:15,...e}),"MoneyField");var Ee={checkbox:le,text:B,email:xt,money:Wt,select:ut,"multi-select":Et,radio:dt,number:ue,file:mt,date:st,textarea:Ct,countries:yt,hidden:St,"work-schedule":Mt};import{AlertCircle as ko}from"lucide-react";import{jsx as ge,jsxs as No}from"react/jsx-runtime";function Lt({title:e,description:t,severity:n}){let{components:o}=S();if(o?.statement){let s=o?.statement;return ge(s,{data:{title:e,description:oe(t),severity:n}})}return No(tt,{variant:"warning",children:[ge(ko,{className:"h-4 w-4"}),e&&ge(ot,{children:e}),t&&ge(rt,{dangerouslySetInnerHTML:{__html:oe(t)}})]})}r(Lt,"Statement");import{Fragment as Do,jsx as O,jsxs as Q}from"react/jsx-runtime";var Po=r(({isExpanded:e,onToggle:t,className:n,...o})=>O($,{type:"button",className:h("RemoteFlows__Button RemoteFlows__FieldSetField__ToggleButton",n),variant:"default",onClick:t,...o,children:e?"Remove":"Define"}),"DefaultToggleButton");function us({label:e,name:t,fields:n,description:o,components:s,statement:d,isFlatFieldset:c,extra:F,variant:f="outset",features:l,meta:a}){let{helpCenter:u}=a||{},{watch:m,setValue:i,trigger:g,formState:p}=b(),{components:y}=S(),x=l?.toggle?.stateField,v=x?m(x):l?.toggle?.defaultExpanded??!0,T=n.map(({name:C})=>`${t}.${C}`),K=m(T),We=Ht(K),ee=Ht(null),Bt=r(()=>{x&&i(x,!v)},"toggleExpanded");Ro(()=>{let C=K,re=We.current,he=p.isSubmitted||p.submitCount>0,Be=!1;for(let te=0;te<C.length;te++)if(C[te]!==void 0&&re[te]!==C[te]){Be=!0;break}return Be&&he&&(ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{g()},50)),We.current=[...C],()=>{ee.current&&clearTimeout(ee.current)}},[K,g,p.isSubmitted,p.submitCount]);let At=y?.fieldsetToggle||Po,Le=`${t}-content`,He=`${t}-header`;return Q("fieldset",{className:h("border-1 border-input p-4 rounded-xl","RemoteFlows__FieldSetField",`RemoteFlows__FieldSetField__${t}`),children:[O("legend",{className:h("text-sm font-semibold px-2",f==="inset"&&"hidden"),children:e}),u?.callToAction&&u?.id&&f==="outset"&&O(_e,{className:"RemoteFlows__FieldSetField__HelpCenterLink mb-3",zendeskId:u.id,children:u.callToAction}),f==="inset"&&Q(Do,{children:[Q("div",{className:"RemoteFlows__FieldSetField__Header",id:He,"data-state":v?"expanded":"collapsed","aria-expanded":v,children:[O("h3",{className:h("RemoteFlows__FieldSetField__Title"),children:e}),l?.toggle?.enabled&&O(At,{isExpanded:v,onToggle:Bt,"aria-expanded":v,"aria-controls":Le,"aria-label":`${v?"Hide":"Show"} ${e}`,className:h("RemoteFlows__FieldSetField__Toggle",l.toggle?.className),children:v?l.toggle.labels?.collapse??"Remove":l.toggle.labels?.expand??"Define"})]}),u?.callToAction&&u?.id&&O(_e,{className:"RemoteFlows__FieldSetField__HelpCenterLink mb-3",zendeskId:u.id,children:u.callToAction})]}),v&&Q("div",{id:Le,"aria-labelledby":He,role:"region",children:[o?O("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:oe(o)}}):null,Q("div",{className:"grid gap-4",children:[n.map(C=>{C.calculateDynamicProperties&&(C={...C,...C.calculateDynamicProperties(K,C)||{}});let re=Ee[C.type];if(C.isVisible===!1||C.deprecated)return null;if(C.Component){let{Component:he}=C;return O(he,{...C},C.name)}return C.type==="select"&&C.multiple&&(re=Ee["multi-select"]),Q(wo,{children:[O(re,{...C,name:`${c?C.name:`${t}.${C.name}`}`,component:s?.[C.type]}),C.extra?C.extra:null]},`${c?C.name:`${t}.${C.name}`}`)}),F||null,d?O(Lt,{...d}):null]})]})]})}r(us,"FieldSetField");export{Ee as a,Lt as b,us as c};
2
- //# sourceMappingURL=chunk-OXCEJQFC.js.map