@remoteoss/remote-flows 0.0.3 → 0.0.4

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 (71) hide show
  1. package/README.md +4 -460
  2. package/dist/chunk-6RRSUL7Q.js +2 -0
  3. package/dist/{chunk-K44YP7ZG.js.map → chunk-6RRSUL7Q.js.map} +1 -1
  4. package/dist/chunk-DARQDP44.js +2 -0
  5. package/dist/chunk-DARQDP44.js.map +1 -0
  6. package/dist/chunk-DYB3RWP7.js +20 -0
  7. package/dist/chunk-DYB3RWP7.js.map +1 -0
  8. package/dist/chunk-EEWCEZ3D.js +2 -0
  9. package/dist/chunk-EEWCEZ3D.js.map +1 -0
  10. package/dist/chunk-FGBEOUQK.js +1 -0
  11. package/dist/chunk-KEV7VRZ5.js +2 -0
  12. package/dist/chunk-KEV7VRZ5.js.map +1 -0
  13. package/dist/{chunk-DHJSRW7Y.js → chunk-LT4TLUWZ.js} +2 -2
  14. package/dist/chunk-OLJ2S6A6.js +2 -0
  15. package/dist/chunk-OLJ2S6A6.js.map +1 -0
  16. package/dist/chunk-P5PQMJ4T.js +2 -0
  17. package/dist/chunk-P5PQMJ4T.js.map +1 -0
  18. package/dist/chunk-ZEGD25G2.js +2 -0
  19. package/dist/chunk-ZEGD25G2.js.map +1 -0
  20. package/dist/flows/CostCalculator/CostCalculatorDisclaimer.d.ts +8 -0
  21. package/dist/flows/CostCalculator/CostCalculatorDisclaimer.js +2 -0
  22. package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +36 -0
  23. package/dist/flows/CostCalculator/CostCalculatorFlow.js +2 -0
  24. package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +29 -0
  25. package/dist/flows/CostCalculator/CostCalculatorForm.js +2 -0
  26. package/dist/flows/CostCalculator/CostCalculatorResetButton.d.ts +5 -0
  27. package/dist/flows/CostCalculator/CostCalculatorResetButton.js +2 -0
  28. package/dist/flows/CostCalculator/CostCalculatorSubmitButton.d.ts +5 -0
  29. package/dist/flows/CostCalculator/CostCalculatorSubmitButton.js +2 -0
  30. package/dist/flows/CostCalculator/CostCalculatorSubmitButton.js.map +1 -0
  31. package/dist/flows/CostCalculator/Results/CostCalculatorBenefitsBreakdown.d.ts +2 -2
  32. package/dist/flows/CostCalculator/Results/CostCalculatorContributionsBreakdown.d.ts +2 -2
  33. package/dist/flows/CostCalculator/Results/CostCalculatorGrossSalary.d.ts +2 -2
  34. package/dist/flows/CostCalculator/Results/CostCalculatorResults.d.ts +2 -2
  35. package/dist/flows/CostCalculator/Results/CostCalculatorResults.js +1 -1
  36. package/dist/flows/CostCalculator/Results/CostCalculatorResultsChart.d.ts +2 -2
  37. package/dist/flows/CostCalculator/Results/CostCalculatorTotalCost.d.ts +2 -2
  38. package/dist/flows/CostCalculator/context.d.ts +38 -0
  39. package/dist/flows/CostCalculator/context.js +2 -0
  40. package/dist/flows/CostCalculator/context.js.map +1 -0
  41. package/dist/flows/CostCalculator/disclaimerUtils.d.ts +10 -0
  42. package/dist/flows/CostCalculator/disclaimerUtils.js +2 -0
  43. package/dist/flows/CostCalculator/disclaimerUtils.js.map +1 -0
  44. package/dist/flows/CostCalculator/hooks.d.ts +2 -17
  45. package/dist/flows/CostCalculator/hooks.js +1 -1
  46. package/dist/flows/CostCalculator/index.d.ts +9 -4
  47. package/dist/flows/CostCalculator/index.js +1 -1
  48. package/dist/flows/CostCalculator/types.d.ts +1 -1
  49. package/dist/flows/CostCalculator/utils.js +1 -1
  50. package/dist/index.d.ts +9 -4
  51. package/dist/index.js +1 -1
  52. package/package.json +1 -1
  53. package/dist/chunk-32G7XF2D.js +0 -2
  54. package/dist/chunk-32G7XF2D.js.map +0 -1
  55. package/dist/chunk-56PULCHS.js +0 -2
  56. package/dist/chunk-56PULCHS.js.map +0 -1
  57. package/dist/chunk-FX6BYIQS.js +0 -1
  58. package/dist/chunk-HMDVBCX2.js +0 -1
  59. package/dist/chunk-K44YP7ZG.js +0 -20
  60. package/dist/flows/CostCalculator/CostCalculator.d.ts +0 -65
  61. package/dist/flows/CostCalculator/CostCalculator.js +0 -2
  62. package/dist/flows/CostCalculator/Disclaimer/Disclaimer.d.ts +0 -8
  63. package/dist/flows/CostCalculator/Disclaimer/Disclaimer.js +0 -2
  64. package/dist/flows/CostCalculator/Disclaimer/index.d.ts +0 -2
  65. package/dist/flows/CostCalculator/Disclaimer/index.js +0 -2
  66. /package/dist/{chunk-FX6BYIQS.js.map → chunk-FGBEOUQK.js.map} +0 -0
  67. /package/dist/{chunk-DHJSRW7Y.js.map → chunk-LT4TLUWZ.js.map} +0 -0
  68. /package/dist/{chunk-HMDVBCX2.js.map → flows/CostCalculator/CostCalculatorDisclaimer.js.map} +0 -0
  69. /package/dist/flows/CostCalculator/{CostCalculator.js.map → CostCalculatorFlow.js.map} +0 -0
  70. /package/dist/flows/CostCalculator/{Disclaimer/Disclaimer.js.map → CostCalculatorForm.js.map} +0 -0
  71. /package/dist/flows/CostCalculator/{Disclaimer/index.js.map → CostCalculatorResetButton.js.map} +0 -0
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-HMDVBCX2.js.map
@@ -1,20 +0,0 @@
1
- import{c as O}from"./chunk-ATKR5HCM.js";import{a as u}from"./chunk-2AGPO366.js";import{a as t}from"./chunk-AYDF3IFZ.js";import{object as we}from"yup";import{formDataBodySerializer as Pe}from"@hey-api/client-fetch";import{createClient as Q,createConfig as Y}from"@hey-api/client-fetch";var l=Q(Y({baseUrl:"https://gateway.remote.com/"}));var D=t(e=>(e.client??l).post({security:[{scheme:"bearer",type:"http"}],url:"/v1/cost-calculator/estimation",...e,headers:{"Content-Type":"application/json",...e?.headers}}),"postCreateEstimation");var G=t(e=>(e?.client??l).post({security:[{scheme:"bearer",type:"http"}],url:"/v1/cost-calculator/estimation-pdf",...e,headers:{"Content-Type":"application/json",...e?.headers}}),"postCreateEstimationPdf");var I=t(e=>(e.client??l).get({security:[{scheme:"bearer",type:"http"}],url:"/v1/cost-calculator/countries",...e}),"getIndexCountry");var v=t(e=>(e.client??l).get({security:[{scheme:"bearer",type:"http"}],url:"/v1/cost-calculator/regions/{slug}/fields",...e}),"getShowRegionField");var S=t(e=>(e?.client??l).get({security:[{scheme:"bearer",type:"http"}],url:"/v1/company-currencies",...e}),"getIndexCompanyCurrency");import{createClient as se}from"@hey-api/client-fetch";import{QueryClient as ie,QueryClientProvider as le,useQuery as pe}from"@tanstack/react-query";import C,{createContext as ce,useContext as he,useRef as q}from"react";var U={staging:"https://gateway.niceremote.com",partners:"https://gateway.partners.remote-sandbox.com",production:"https://gateway.remote.com"};function y(e){let r=document.documentElement;Object.keys(e).forEach(n=>{let o=e[n];o&&r.style.setProperty(n,o)})}t(y,"setCssProperties");function Z(e){let r={};return Object.keys(e).forEach(n=>{r[`--${n}`]=e[n]}),r}t(Z,"mapThemeColors");function X(e){return{"--spacing":e}}t(X,"mapThemeSpacing");function $(e){return{"--radius":e}}t($,"mapThemeBorderRadius");function ee(e){return{"--fontSizeBase":e.fontSizeBase}}t(ee,"mapThemeFont");function k(e){e?.colors&&y(Z(e.colors)),e?.spacing&&y(X(e.spacing)),e?.borderRadius&&y($(e.borderRadius)),e?.font&&y(ee(e.font))}t(k,"applyTheme");import te,{createContext as re,useEffect as oe,useMemo as ne}from"react";var ae=re({theme:{}});function B(e){oe(()=>{e.theme&&Object.keys(e.theme).length>0&&k(e.theme)},[e.theme]);let r=ne(()=>({theme:e.theme}),[e.theme]);return te.createElement(ae.Provider,{value:r},e.children)}t(B,"ThemeProvider");var de=new ie,A=ce({client:null}),h=t(()=>he(A),"useClient");function me({children:e,auth:r,isTestingMode:n}){let o=q(null),{refetch:d}=pe({queryKey:["auth"],queryFn:r,enabled:!1}),p=n?U.partners:"https://gateway.remote.com",m=q(se({...l.getConfig(),baseUrl:p,auth:t(async()=>{function w(i){return!i||Date.now()+6e4>i}if(t(w,"hasTokenExpired"),!o.current||w(o.current.expiresAt)){let{data:i}=await d();i&&(o.current={accessToken:i.accessToken,expiresAt:Date.now()+i.expiresIn*1e3})}return o.current?.accessToken},"auth")}));return C.createElement(A.Provider,{value:{client:m.current}},e)}t(me,"RemoteFlowContextWrapper");function He({auth:e,children:r,isTestingMode:n=!1,theme:o}){return C.createElement(le,{client:de},C.createElement(me,{isTestingMode:n,auth:e},C.createElement(B,{theme:o},r)))}t(He,"RemoteFlows");import{createHeadlessForm as ue}from"@remoteoss/json-schema-form";import{useMutation as L,useQuery as f}from"@tanstack/react-query";import{useState as F}from"react";import{string as _}from"yup";var Ee=t(({includePremiumBenefits:e})=>{let{client:r}=h();return f({queryKey:["cost-calculator-countries",e],queryFn:t(()=>I({client:r,headers:{Authorization:""},query:{include_premium_benefits:e}}),"queryFn"),select:t(n=>n.data?.data.map(o=>({value:o.region_slug,label:o.name,childRegions:o.child_regions,hasAdditionalFields:o.has_additional_fields,regionSlug:o.region_slug})),"select")})},"useCostCalculatorCountries"),ye=t(()=>{let{client:e}=h();return f({queryKey:["company-currencies"],queryFn:t(()=>S({client:e,headers:{Authorization:""}}),"queryFn"),select:t(r=>r.data?.data?.company_currencies.map(n=>({value:n.slug,label:n.code})),"select")})},"useCompanyCurrencies"),Ce=t(()=>{let{client:e}=h();return L({mutationFn:t(r=>D({client:e,headers:{Authorization:""},body:r}),"mutationFn")})},"useCostCalculatorEstimation"),it=t(()=>{let{client:e}=h();return L({mutationFn:t(r=>G({client:e,headers:{Authorization:""},body:r}),"mutationFn")})},"useCostCalculatorEstimationPdf"),fe=t((e,{includePremiumBenefits:r})=>{let{client:n}=h();return f({queryKey:["cost-calculator-region-fields",e,r],queryFn:t(()=>v({client:n,headers:{Authorization:""},path:{slug:e},query:{include_premium_benefits:r}}),"queryFn"),enabled:!!e,select:t(({data:o})=>ue(o?.data?.schema||{},{strictInputType:!1}),"select")})},"useRegionFields"),x={title:"Estimation",includeBenefits:!1,includeCostBreakdowns:!1,includePremiumBenefits:!1},lt=t(({defaultRegion:e,estimationOptions:r}={estimationOptions:x})=>{let[n,o]=F(e),[d,p]=F(),{data:m,isLoading:w}=Ee({includePremiumBenefits:r.includePremiumBenefits}),{data:i,isLoading:j}=ye(),M=n||d?.value,{data:b,isLoading:z}=fe(M,{includePremiumBenefits:r.includePremiumBenefits}),P=Ce();async function H(a){try{await g.validate(a,{abortEarly:!1})}catch(s){return{data:null,error:s}}return new Promise((s,T)=>{P.mutate(W(a,r),{onSuccess:t(E=>{E.data?s({data:E.data,error:null}):s({data:null,error:new Error("Something went wrong. Please try again later.")})},"onSuccess"),onError:t(E=>{T({data:null,error:E})},"onError")})})}t(H,"onSubmit");function J(a){let s=m?.find(({value:T})=>T===a);s&&s.childRegions.length===0&&s.hasAdditionalFields?o(s.regionSlug):o(void 0),p(s)}t(J,"onCountryChange");function N(a){o(a)}t(N,"onRegionChange");let c=u.find(a=>a.name==="region");if(c){let a=d?.childRegions.map(s=>({value:s.slug,label:s.name}))??[];c.options=a,c.isVisible=a.length>0,c.required=a.length>0,c.onChange=N,c.schema=a.length>0?_().required("Currency is required"):_()}if(i){let a=u.find(s=>s.name==="currency");a&&(a.options=i)}if(m){let a=u.find(s=>s.name==="country");a&&(a.options=m,a.onChange=J)}let K=t(()=>{p(void 0),o(e)},"resetForm"),R=[...u,...b?.fields||[]],g=V(R);return{stepState:{current:0,total:1,isLastStep:!0},fields:R,validationSchema:g,handleValidation:b?.handleValidation,isSubmitting:P.isPending,isLoading:w&&j&&z,onSubmit:H,resetForm:K}},"useCostCalculator"),pt=t(()=>{let e={data:{id:4668194326797,title:"Disclaimer information on Cost of Employment calculations",body:`<h3 id="h_01HHJFVR5Q4F8A52F06EVG289R">Remote disclaimer</h3>
2
- <p>The estimate provides a transparent detailed breakdown for in-country statutory social contributions, statutory benefits, and other benefits that may be required. Estimates do not take into account additional costs that may be incurred for relocation, visa, right-to-work requirements, or other activities.\xA0</p>
3
- <p><strong>See also:</strong> <a href="https://support.remote.com/hc/en-us/articles/22329255813133">What other type of costs does the Cost Calculator not include?</a></p>
4
- <h3 id="h_01HHJFVYRAAGDKJ36EZS8W6P5N">EOR services</h3>
5
- <p>Our EOR services allow you to retain ownership of your employees' IP and inventions. Compliance, taxes, and payroll are handled by our local teams for a seamless end-to-end experience.</p>
6
- <h3 id="h_01HHJFW4FQPGPK14FSM4XCY5MR">Pricing and payroll</h3>
7
- <p>When it comes to payroll, legal and operational complexities are reduced to a single invoice for all of your Remote employees across every country you hire in \u2013 no hidden costs and no long-term commitments needed. Just a simple pricing structure that includes a fixed hiring fee for each EOR employee.</p>
8
- <h3 id="01JMCR2YZ0GVTCXNPY88TADWQ1">Currency conversions</h3>
9
- <p>When the employee currency differs from the billing currency, we use market rates to convert. The rate figures on this quote are a rough estimate. When the employee currency differs from the billing currency, we use market rates to convert. The rate figures on this quote are a rough estimated.</p>
10
- <h3 id="h_01HHJFWD1TFB5DQ6B4WD5F1GY6">Employee off-boarding related costs</h3>
11
- <p>The estimate here does not include any costs related to off-boarding of employees. Whilst we do not charge any processing fees when you want to off-board an employee, any other costs such as severance pay, covering remaining vacation days and etc will be charged back to you.<br><strong>See also:\xA0</strong><a href="https://support.remote.com/hc/en-us/articles/22329371247885">Are the costs of employee off-boarding included in the Cost Calculator?</a></p>
12
- <p>Please note the \u2018employee net income estimate\u2019 section (if available for the country) is intended for informational purposes only and should not be used as a substitute for professional financial advice.</p>
13
- <p>Additionally, tax laws and rates can vary by location and are subject to change, which may not be immediately reflected in the calculator.</p>
14
- <p>For a detailed and accurate assessment of your take-home pay, please consult with a qualified tax professional or financial advisor.</p>
15
- <p><strong>See also</strong>: <a href="https://support.remote.com/hc/en-us/articles/25196498469773">How to use the \u2018employee net income estimate\u2019 section in the Cost Calculator?</a></p>
16
- <p><!-- notionvc: 04d0e276-e0d7-4793-93ee-d4ad14600217 --></p>
17
- <h3 id="h_01HHJFWTHJ58YAZ87M3E090H4J">Note</h3>
18
- <p>This estimate is for guidance only and may not constitute accurate financial advice. Information contained in this document is subject to changes in laws in different jurisdictions, which can change without notice. This document is the property of Remote, is confidential, cannot be reproduced without permission, and cannot be disclosed to any third parties.</p>
19
- <p><!-- notionvc: 09e777b4-c10c-438e-bb95-ce1f3fb86c9a --></p>`,html_url:"https://support.remote.com/hc/en-us/articles/4668194326797-Disclaimer-information-on-Cost-of-Employment-calculations"}};return f({queryKey:["cost-calculator-disclaimer"],queryFn:t(()=>Promise.resolve(e),"queryFn")})},"useCostCalculatorDisclaimer");function V(e){let r=e.reduce((n,o)=>(n[o.name]=o.schema,n),{});return we(r)}t(V,"buildValidationSchema");function Te(e){let r="benefit-";return Object.keys(e).reduce((n,o)=>{let p={benefit_group_slug:o.replace(r,""),benefit_tier_slug:e[o]};return[...n,p]},[])}t(Te,"formatBenefits");function W(e,r=x){return{employer_currency_slug:e.currency,include_benefits:r.includeBenefits,include_cost_breakdowns:r.includeCostBreakdowns,include_premium_benefits:r.includePremiumBenefits,employments:[{region_slug:e.region||e.country,annual_gross_salary:O(e.salary),annual_gross_salary_in_employer_currency:O(e.salary),employment_term:e.contract_duration_type??"fixed",title:r.title,regional_to_employer_exchange_rate:"1",age:e.age??void 0,...e.benefits&&{benefits:Te(e.benefits)}}]}}t(W,"buildPayload");export{He as a,V as b,W as c,it as d,x as e,lt as f,pt as g};
20
- //# sourceMappingURL=chunk-K44YP7ZG.js.map
@@ -1,65 +0,0 @@
1
- import React from 'react';
2
- import { C as CostCalculatorEstimateResponse } from '../../types.gen-dIMXHE0Y.js';
3
- import { EstimationError } from './hooks.js';
4
- import { CostCalculatorEstimationOptions, CostCalculatorEstimationFormValues } from './types.js';
5
- import '@remoteoss/json-schema-form';
6
- import 'yup';
7
- import '@tanstack/react-query';
8
- import '../types.js';
9
-
10
- type CostCalculatorProps = Partial<{
11
- /**
12
- * Estimation params allows you to customize the parameters sent to the /cost-calculator/estimation endpoint.
13
- */
14
- estimationOptions?: CostCalculatorEstimationOptions;
15
- /**
16
- * Default values for the form fields.
17
- */
18
- defaultValues: Partial<{
19
- /**
20
- * Default value for the country field.
21
- */
22
- countryRegionSlug: string;
23
- /**
24
- * Default value for the currency field.
25
- */
26
- currencySlug: string;
27
- /**
28
- * Default value for the salary field.
29
- */
30
- salary: string;
31
- }>;
32
- /**
33
- * Options for the CostCalculator component.
34
- */
35
- options: Partial<{
36
- /**
37
- * Disclaimer options.
38
- */
39
- disclaimer: {
40
- /**
41
- * Label for the disclaimer
42
- * @default 'Disclaimer'
43
- * */
44
- label: string;
45
- };
46
- }>;
47
- /**
48
- * Callback function that handles form submission. When form is submit, the form values are sent to the consumer app before behind submitted to Remote.
49
- * @param data - The payload sent to the /cost-calculator/estimation endpoint.
50
- */
51
- onSubmit: (data: CostCalculatorEstimationFormValues) => Promise<void> | void;
52
- /**
53
- * Callback function to handle the success when the estimation succeeds. The CostCalculatorEstimateResponse is sent back to you.
54
- * @param data - The response data from the /cost-calculator/estimation endpoint.
55
- */
56
- onSuccess: (data: CostCalculatorEstimateResponse) => Promise<void> | void;
57
- /**
58
- * Callback function to handle the error when the estimation fails.
59
- * @param error - The error object.
60
- */
61
- onError: (error: EstimationError) => void;
62
- }>;
63
- declare function CostCalculator({ estimationOptions, defaultValues, options, onSubmit, onError, onSuccess, }: CostCalculatorProps): React.JSX.Element;
64
-
65
- export { CostCalculator };
@@ -1,2 +0,0 @@
1
- import{a}from"../../chunk-32G7XF2D.js";import"../../chunk-FX6BYIQS.js";import"../../chunk-56PULCHS.js";import"../../chunk-HHNKZK2V.js";import"../../chunk-K44YP7ZG.js";import"../../chunk-ATKR5HCM.js";import"../../chunk-2AGPO366.js";import"../../chunk-AYDF3IFZ.js";export{a as CostCalculator};
2
- //# sourceMappingURL=CostCalculator.js.map
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
-
3
- type DisclaimerProps = {
4
- label?: string;
5
- };
6
- declare const Disclaimer: ({ label }: DisclaimerProps) => React.JSX.Element;
7
-
8
- export { Disclaimer };
@@ -1,2 +0,0 @@
1
- import{a}from"../../../chunk-56PULCHS.js";import"../../../chunk-HHNKZK2V.js";import"../../../chunk-K44YP7ZG.js";import"../../../chunk-ATKR5HCM.js";import"../../../chunk-2AGPO366.js";import"../../../chunk-AYDF3IFZ.js";export{a as Disclaimer};
2
- //# sourceMappingURL=Disclaimer.js.map
@@ -1,2 +0,0 @@
1
- export { Disclaimer } from './Disclaimer.js';
2
- import 'react';
@@ -1,2 +0,0 @@
1
- import"../../../chunk-FX6BYIQS.js";import{a}from"../../../chunk-56PULCHS.js";import"../../../chunk-HHNKZK2V.js";import"../../../chunk-K44YP7ZG.js";import"../../../chunk-ATKR5HCM.js";import"../../../chunk-2AGPO366.js";import"../../../chunk-AYDF3IFZ.js";export{a as Disclaimer};
2
- //# sourceMappingURL=index.js.map