@remoteoss/remote-flows 0.4.0-alpha.11 → 0.4.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/dist/chunk-7N7ND6Z4.js +2 -0
- package/dist/chunk-7N7ND6Z4.js.map +1 -0
- package/dist/chunk-AN7L3GVL.js +2 -0
- package/dist/{chunk-RWYOUDM5.js.map → chunk-AN7L3GVL.js.map} +1 -1
- package/dist/chunk-AOJAZ4FT.js +2 -0
- package/dist/chunk-AOJAZ4FT.js.map +1 -0
- package/dist/chunk-ASFAGLQI.js +2 -0
- package/dist/chunk-ASFAGLQI.js.map +1 -0
- package/dist/chunk-BYFO5OB6.js +2 -0
- package/dist/chunk-BYFO5OB6.js.map +1 -0
- package/dist/chunk-D53FKWGJ.js +2 -0
- package/dist/chunk-D53FKWGJ.js.map +1 -0
- package/dist/{chunk-RIWPSA6V.js → chunk-IEZAM2XO.js} +2 -2
- package/dist/{chunk-RC2UQDK7.js → chunk-NIOH7TNP.js} +2 -2
- package/dist/{chunk-INW2EQZR.js → chunk-OS3QI7CV.js} +2 -2
- package/dist/{chunk-3QTURBOX.js → chunk-QUM7V5EP.js} +2 -2
- package/dist/{chunk-IG3FJLDR.js → chunk-RDAO365M.js} +2 -2
- package/dist/chunk-WRKHWEZA.js +2 -0
- package/dist/chunk-WRKHWEZA.js.map +1 -0
- package/dist/chunk-X6DRD2I4.js +2 -0
- package/dist/chunk-X6DRD2I4.js.map +1 -0
- package/dist/chunk-XQXFQ7LM.js +2 -0
- package/dist/{chunk-L6LGRALQ.js.map → chunk-XQXFQ7LM.js.map} +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
- package/dist/flows/ContractAmendment/context.d.ts +1 -1
- package/dist/flows/ContractAmendment/hooks.d.ts +1 -1
- package/dist/flows/ContractAmendment/hooks.js +1 -1
- package/dist/flows/ContractAmendment/index.d.ts +1 -1
- package/dist/flows/ContractAmendment/index.js +1 -1
- package/dist/flows/CostCalculator/context.d.ts +1 -1
- package/dist/flows/CostCalculator/index.d.ts +1 -1
- package/dist/flows/CostCalculator/utils.d.ts +1 -1
- package/dist/flows/Onboarding/AnnualGrossSalary.d.ts +1 -1
- package/dist/flows/Onboarding/AnnualGrossSalary.js +1 -1
- package/dist/flows/Onboarding/BasicInformationStep.d.ts +6 -1
- package/dist/flows/Onboarding/BasicInformationStep.js +1 -1
- package/dist/flows/Onboarding/BenefitsStep.d.ts +7 -2
- package/dist/flows/Onboarding/BenefitsStep.js +1 -1
- package/dist/flows/Onboarding/ContractDetailsStep.d.ts +6 -1
- package/dist/flows/Onboarding/ContractDetailsStep.js +1 -1
- package/dist/flows/Onboarding/OnboardingFlow.d.ts +3 -3
- package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
- package/dist/flows/Onboarding/OnboardingForm.d.ts +1 -1
- package/dist/flows/Onboarding/OnboardingInvite.d.ts +7 -2
- package/dist/flows/Onboarding/OnboardingInvite.js +1 -1
- package/dist/flows/Onboarding/SelectCountryStep.d.ts +6 -1
- package/dist/flows/Onboarding/SelectCountryStep.js +1 -1
- package/dist/flows/Onboarding/api.d.ts +5 -1
- package/dist/flows/Onboarding/api.js +1 -1
- package/dist/flows/Onboarding/context.d.ts +2 -3
- package/dist/flows/Onboarding/hooks.d.ts +3 -4
- package/dist/flows/Onboarding/hooks.js +1 -1
- package/dist/flows/Onboarding/index.d.ts +2 -2
- package/dist/flows/Onboarding/index.js +1 -1
- package/dist/flows/Onboarding/types.d.ts +19 -0
- package/dist/flows/Termination/TerminationFlow.d.ts +1 -1
- package/dist/flows/Termination/TerminationFlow.js +1 -1
- package/dist/flows/Termination/context.d.ts +1 -1
- package/dist/flows/Termination/hooks.d.ts +1 -1
- package/dist/flows/Termination/hooks.js +1 -1
- package/dist/flows/Termination/index.d.ts +1 -1
- package/dist/flows/Termination/index.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mutations-B6HWH-rZ.d.ts +22 -0
- package/dist/{remoteFlows-lYAFzyXi.d.ts → remoteFlows--lO1UtNJ.d.ts} +10 -3
- package/package.json +1 -1
- package/dist/chunk-GAXGAK4P.js +0 -2
- package/dist/chunk-GAXGAK4P.js.map +0 -1
- package/dist/chunk-HGHKZF7M.js +0 -2
- package/dist/chunk-HGHKZF7M.js.map +0 -1
- package/dist/chunk-JTP3LZ77.js +0 -2
- package/dist/chunk-JTP3LZ77.js.map +0 -1
- package/dist/chunk-KHZ2ITFO.js +0 -2
- package/dist/chunk-KHZ2ITFO.js.map +0 -1
- package/dist/chunk-L6LGRALQ.js +0 -2
- package/dist/chunk-RWYOUDM5.js +0 -2
- package/dist/chunk-VEOGRXYK.js +0 -2
- package/dist/chunk-VEOGRXYK.js.map +0 -1
- package/dist/chunk-VJEJUUY2.js +0 -2
- package/dist/chunk-VJEJUUY2.js.map +0 -1
- package/dist/chunk-VJEL5MZJ.js +0 -2
- package/dist/chunk-VJEL5MZJ.js.map +0 -1
- package/dist/mutations-v9H353tz.d.ts +0 -10
- /package/dist/{chunk-RIWPSA6V.js.map → chunk-IEZAM2XO.js.map} +0 -0
- /package/dist/{chunk-RC2UQDK7.js.map → chunk-NIOH7TNP.js.map} +0 -0
- /package/dist/{chunk-INW2EQZR.js.map → chunk-OS3QI7CV.js.map} +0 -0
- /package/dist/{chunk-3QTURBOX.js.map → chunk-QUM7V5EP.js.map} +0 -0
- /package/dist/{chunk-IG3FJLDR.js.map → chunk-RDAO365M.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../chunk-A7ZJQCNU.js";import{a as e}from"../../chunk-
|
|
1
|
+
import"../../chunk-A7ZJQCNU.js";import{a as e}from"../../chunk-IEZAM2XO.js";import{a as c}from"../../chunk-RXK4RLF6.js";import{a as d}from"../../chunk-NIOH7TNP.js";import"../../chunk-LX7QBDSF.js";import"../../chunk-WRKHWEZA.js";import"../../chunk-5SMMQQXP.js";import"../../chunk-WKK63LAY.js";import"../../chunk-PJBAQZ6G.js";import"../../chunk-CTTXXEWI.js";import{a}from"../../chunk-CSU6IQX3.js";import{a as b}from"../../chunk-RFYJGH2X.js";import"../../chunk-Z3HWTDRE.js";import"../../chunk-XO3JWN33.js";import"../../chunk-GFMFGU7A.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-TVZAFTPT.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as ContractAmendmentConfirmationForm,e as ContractAmendmentFlow,b as ContractAmendmentForm,c as ContractAmendmentSubmit,d as useContractAmendment};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,7 +3,7 @@ import { useCostCalculator, EstimationError } from './hooks.js';
|
|
|
3
3
|
import { CostCalculatorEstimationFormValues, CostCalculatorEstimationSubmitValues } from './types.js';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { c as CostCalculatorEstimateResponse } from '../../types.gen-D_v539E_.js';
|
|
6
|
-
import { $ as $TSFixMe } from '../../remoteFlows
|
|
6
|
+
import { $ as $TSFixMe } from '../../remoteFlows--lO1UtNJ.js';
|
|
7
7
|
import * as yup from 'yup';
|
|
8
8
|
import { UseFormReturn } from 'react-hook-form';
|
|
9
9
|
import '@remoteoss/json-schema-form';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as CostCalculatorEstimateParams } from '../../types.gen-D_v539E_.js';
|
|
2
|
-
import { $ as $TSFixMe } from '../../remoteFlows
|
|
2
|
+
import { $ as $TSFixMe } from '../../remoteFlows--lO1UtNJ.js';
|
|
3
3
|
import { AnyObjectSchema } from 'yup';
|
|
4
4
|
import { CostCalculatorEstimationSubmitValues, CostCalculatorEstimationOptions } from './types.js';
|
|
5
5
|
import 'react';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-RDAO365M.js";import"../../chunk-AN7L3GVL.js";import"../../chunk-WVJDCDGZ.js";import"../../chunk-PWUYHFON.js";import"../../chunk-WKK63LAY.js";import"../../chunk-GFMFGU7A.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as AnnualGrossSalary};
|
|
2
2
|
//# sourceMappingURL=AnnualGrossSalary.js.map
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { BasicInformationFormPayload } from './types.js';
|
|
3
3
|
import { l as EmploymentCreationResponse } from '../../types.gen-D_v539E_.js';
|
|
4
|
+
import { N as NormalizedFieldError } from '../../mutations-B6HWH-rZ.js';
|
|
4
5
|
import '../types.js';
|
|
5
6
|
import '@remoteoss/json-schema-form';
|
|
6
7
|
|
|
7
8
|
type BasicInformationStepProps = {
|
|
8
9
|
onSubmit?: (payload: BasicInformationFormPayload) => void | Promise<void>;
|
|
9
10
|
onSuccess?: (data: EmploymentCreationResponse) => void | Promise<void>;
|
|
10
|
-
onError?: (error
|
|
11
|
+
onError?: ({ error, rawError, fieldErrors, }: {
|
|
12
|
+
error: Error;
|
|
13
|
+
rawError: Record<string, unknown>;
|
|
14
|
+
fieldErrors: NormalizedFieldError[];
|
|
15
|
+
}) => void;
|
|
11
16
|
};
|
|
12
17
|
declare function BasicInformationStep({ onSubmit, onSuccess, onError, }: BasicInformationStepProps): react_jsx_runtime.JSX.Element;
|
|
13
18
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-D53FKWGJ.js";import"../../chunk-QKTDO33H.js";import"../../chunk-PGWKJ6FK.js";import"../../chunk-WRKHWEZA.js";import"../../chunk-Z3HWTDRE.js";import"../../chunk-XO3JWN33.js";import"../../chunk-GFMFGU7A.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as BasicInformationStep};
|
|
2
2
|
//# sourceMappingURL=BasicInformationStep.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { C as Components } from '../../remoteFlows
|
|
2
|
+
import { C as Components } from '../../remoteFlows--lO1UtNJ.js';
|
|
3
3
|
import { S as SuccessResponse } from '../../types.gen-D_v539E_.js';
|
|
4
4
|
import { BenefitsFormPayload } from './types.js';
|
|
5
|
+
import { N as NormalizedFieldError } from '../../mutations-B6HWH-rZ.js';
|
|
5
6
|
import 'react';
|
|
6
7
|
import 'react-hook-form';
|
|
7
8
|
import 'yup';
|
|
@@ -24,7 +25,11 @@ type BenefitsStepProps = {
|
|
|
24
25
|
* @param error
|
|
25
26
|
* @returns
|
|
26
27
|
*/
|
|
27
|
-
onError?: (error
|
|
28
|
+
onError?: ({ error, rawError, fieldErrors, }: {
|
|
29
|
+
error: Error;
|
|
30
|
+
rawError: Record<string, unknown>;
|
|
31
|
+
fieldErrors: NormalizedFieldError[];
|
|
32
|
+
}) => void;
|
|
28
33
|
/**
|
|
29
34
|
* Callback function to be called when benefits form is successfully submitted.
|
|
30
35
|
* This function is called after the submitting benefits form is submitted.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-X6DRD2I4.js";import"../../chunk-QKTDO33H.js";import"../../chunk-PGWKJ6FK.js";import"../../chunk-WRKHWEZA.js";import"../../chunk-Z3HWTDRE.js";import"../../chunk-XO3JWN33.js";import"../../chunk-GFMFGU7A.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as BenefitsStep};
|
|
2
2
|
//# sourceMappingURL=BenefitsStep.js.map
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { n as EmploymentResponse } from '../../types.gen-D_v539E_.js';
|
|
3
3
|
import { ContractDetailsFormPayload } from './types.js';
|
|
4
|
+
import { N as NormalizedFieldError } from '../../mutations-B6HWH-rZ.js';
|
|
4
5
|
import '../types.js';
|
|
5
6
|
import '@remoteoss/json-schema-form';
|
|
6
7
|
|
|
7
8
|
type ContractDetailsStepProps = {
|
|
8
9
|
onSubmit?: (payload: ContractDetailsFormPayload) => void | Promise<void>;
|
|
9
10
|
onSuccess?: (response: EmploymentResponse) => void | Promise<void>;
|
|
10
|
-
onError?: (error
|
|
11
|
+
onError?: ({ error, rawError, fieldErrors, }: {
|
|
12
|
+
error: Error;
|
|
13
|
+
rawError: Record<string, unknown>;
|
|
14
|
+
fieldErrors: NormalizedFieldError[];
|
|
15
|
+
}) => void;
|
|
11
16
|
};
|
|
12
17
|
declare function ContractDetailsStep({ onSubmit, onError, onSuccess, }: ContractDetailsStepProps): react_jsx_runtime.JSX.Element;
|
|
13
18
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-AOJAZ4FT.js";import"../../chunk-QKTDO33H.js";import"../../chunk-PGWKJ6FK.js";import"../../chunk-WRKHWEZA.js";import"../../chunk-Z3HWTDRE.js";import"../../chunk-XO3JWN33.js";import"../../chunk-GFMFGU7A.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as ContractDetailsStep};
|
|
2
2
|
//# sourceMappingURL=ContractDetailsStep.js.map
|
|
@@ -12,13 +12,13 @@ import { SelectCountryStep } from './SelectCountryStep.js';
|
|
|
12
12
|
import { ReviewStep } from './ReviewStep.js';
|
|
13
13
|
import '@tanstack/query-core';
|
|
14
14
|
import '../../types.gen-D_v539E_.js';
|
|
15
|
-
import '../../mutations-
|
|
15
|
+
import '../../mutations-B6HWH-rZ.js';
|
|
16
16
|
import '@remoteoss/json-schema-form';
|
|
17
17
|
import '../useStepState.js';
|
|
18
18
|
import 'react-hook-form';
|
|
19
19
|
import './utils.js';
|
|
20
20
|
import '../types.js';
|
|
21
|
-
import '../../remoteFlows
|
|
21
|
+
import '../../remoteFlows--lO1UtNJ.js';
|
|
22
22
|
import 'yup';
|
|
23
23
|
import '../../types-CxSFjQw5.js';
|
|
24
24
|
|
|
@@ -57,6 +57,6 @@ type OnboardingRenderProps = {
|
|
|
57
57
|
type OnboardingFlowProps = OnboardingFlowParams & {
|
|
58
58
|
render: ({ onboardingBag, components, }: OnboardingRenderProps) => react__default.ReactNode;
|
|
59
59
|
};
|
|
60
|
-
declare const OnboardingFlow: ({ employmentId, companyId, countryCode, type, render, options, }: OnboardingFlowProps) => react_jsx_runtime.JSX.Element;
|
|
60
|
+
declare const OnboardingFlow: ({ employmentId, companyId, countryCode, type, skipSteps, render, options, }: OnboardingFlowProps) => react_jsx_runtime.JSX.Element;
|
|
61
61
|
|
|
62
62
|
export { OnboardingFlow, type OnboardingRenderProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-XQXFQ7LM.js";import"../../chunk-BYFO5OB6.js";import"../../chunk-C3HJSV4T.js";import"../../chunk-GPAE53HO.js";import"../../chunk-ASFAGLQI.js";import"../../chunk-7N7ND6Z4.js";import"../../chunk-7JHIPWS7.js";import"../../chunk-RDAO365M.js";import"../../chunk-AN7L3GVL.js";import"../../chunk-WVJDCDGZ.js";import"../../chunk-D53FKWGJ.js";import"../../chunk-X6DRD2I4.js";import"../../chunk-AOJAZ4FT.js";import"../../chunk-QKTDO33H.js";import"../../chunk-VN4HDCRB.js";import"../../chunk-PGWKJ6FK.js";import"../../chunk-PWUYHFON.js";import"../../chunk-WRKHWEZA.js";import"../../chunk-WKK63LAY.js";import"../../chunk-PJBAQZ6G.js";import"../../chunk-Z3HWTDRE.js";import"../../chunk-XO3JWN33.js";import"../../chunk-GFMFGU7A.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as OnboardingFlow};
|
|
2
2
|
//# sourceMappingURL=OnboardingFlow.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Fields } from '@remoteoss/json-schema-form';
|
|
3
3
|
import { BasicInformationFormPayload, BenefitsFormPayload, ContractDetailsFormPayload } from './types.js';
|
|
4
|
-
import { C as Components } from '../../remoteFlows
|
|
4
|
+
import { C as Components } from '../../remoteFlows--lO1UtNJ.js';
|
|
5
5
|
import '../../types.gen-D_v539E_.js';
|
|
6
6
|
import '../types.js';
|
|
7
7
|
import 'react';
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
import { F as FieldError } from '../../mutations-B6HWH-rZ.js';
|
|
3
4
|
import { S as SuccessResponse } from '../../types.gen-D_v539E_.js';
|
|
4
5
|
|
|
5
|
-
type OnboardingInviteProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
6
|
+
type OnboardingInviteProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onError'> & {
|
|
6
7
|
onSuccess?: ({ data, employmentStatus, }: {
|
|
7
8
|
data: SuccessResponse;
|
|
8
9
|
employmentStatus: 'invited' | 'created_awaiting_reserve';
|
|
9
10
|
}) => void | Promise<void>;
|
|
10
|
-
onError?: (error
|
|
11
|
+
onError?: ({ error, rawError, fieldErrors, }: {
|
|
12
|
+
error: Error;
|
|
13
|
+
rawError: Record<string, unknown>;
|
|
14
|
+
fieldErrors: FieldError[];
|
|
15
|
+
}) => void;
|
|
11
16
|
onSubmit?: () => void | Promise<void>;
|
|
12
17
|
render: (props: {
|
|
13
18
|
employmentStatus: 'invited' | 'created_awaiting_reserve';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-BYFO5OB6.js";import"../../chunk-AN7L3GVL.js";import"../../chunk-WVJDCDGZ.js";import"../../chunk-PGWKJ6FK.js";import"../../chunk-PWUYHFON.js";import"../../chunk-WRKHWEZA.js";import"../../chunk-WKK63LAY.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as OnboardingInvite};
|
|
2
2
|
//# sourceMappingURL=OnboardingInvite.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { SelectCountryFormPayload, SelectCountrySuccess } from './types.js';
|
|
3
|
+
import { N as NormalizedFieldError } from '../../mutations-B6HWH-rZ.js';
|
|
3
4
|
import '../../types.gen-D_v539E_.js';
|
|
4
5
|
import '../types.js';
|
|
5
6
|
import '@remoteoss/json-schema-form';
|
|
@@ -7,7 +8,11 @@ import '@remoteoss/json-schema-form';
|
|
|
7
8
|
type SelectCountryStepProps = {
|
|
8
9
|
onSubmit?: (payload: SelectCountryFormPayload) => void | Promise<void>;
|
|
9
10
|
onSuccess?: (data: SelectCountrySuccess) => void | Promise<void>;
|
|
10
|
-
onError?: (error
|
|
11
|
+
onError?: ({ error, rawError, fieldErrors, }: {
|
|
12
|
+
error: Error;
|
|
13
|
+
rawError: Record<string, unknown>;
|
|
14
|
+
fieldErrors: NormalizedFieldError[];
|
|
15
|
+
}) => void;
|
|
11
16
|
};
|
|
12
17
|
declare function SelectCountryStep({ onSubmit, onSuccess, onError, }: SelectCountryStepProps): react_jsx_runtime.JSX.Element;
|
|
13
18
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-ASFAGLQI.js";import"../../chunk-QKTDO33H.js";import"../../chunk-PGWKJ6FK.js";import"../../chunk-Z3HWTDRE.js";import"../../chunk-XO3JWN33.js";import"../../chunk-GFMFGU7A.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as SelectCountryStep};
|
|
2
2
|
//# sourceMappingURL=SelectCountryStep.js.map
|
|
@@ -104,7 +104,11 @@ declare const useMagicLink: () => _tanstack_react_query.UseMutationResult<({
|
|
|
104
104
|
request: Request;
|
|
105
105
|
response: Response;
|
|
106
106
|
}, Error, MagicLinkParams, unknown>;
|
|
107
|
-
declare const useCountriesSchemaField: (options?: FlowOptions
|
|
107
|
+
declare const useCountriesSchemaField: (options?: FlowOptions & {
|
|
108
|
+
queryOptions?: {
|
|
109
|
+
enabled?: boolean;
|
|
110
|
+
};
|
|
111
|
+
}) => {
|
|
108
112
|
isLoading: boolean;
|
|
109
113
|
selectCountryForm: _remoteoss_json_schema_form.HeadlessFormOutput;
|
|
110
114
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"../../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"../../chunk-AN7L3GVL.js";import"../../chunk-WVJDCDGZ.js";import"../../chunk-PWUYHFON.js";import"../../chunk-WKK63LAY.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-P37U34EQ.js";export{c as useBenefitOffers,g as useBenefitOffersSchema,b as useCompany,m as useConvertCurrency,l as useCountriesSchemaField,h as useCreateEmployment,e as useCreateReserveInvoice,a as useEmployment,d as useEmploymentInvite,f as useJSONSchemaForm,k as useMagicLink,j as useUpdateBenefitsOffers,i as useUpdateEmployment};
|
|
2
2
|
//# sourceMappingURL=api.js.map
|
|
@@ -4,7 +4,7 @@ import { l as EmploymentCreationResponse, m as PostCreateEmployment2Error, n as
|
|
|
4
4
|
import * as _remoteoss_json_schema_form from '@remoteoss/json-schema-form';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import * as react_hook_form from 'react-hook-form';
|
|
7
|
-
import { E as ErrorResponse, S as SuccessResponse } from '../../mutations-
|
|
7
|
+
import { E as ErrorResponse, S as SuccessResponse } from '../../mutations-B6HWH-rZ.js';
|
|
8
8
|
import { Step } from '../useStepState.js';
|
|
9
9
|
import { useOnboarding } from './hooks.js';
|
|
10
10
|
import './types.js';
|
|
@@ -27,7 +27,6 @@ declare const useOnboardingContext: () => {
|
|
|
27
27
|
readonly onboardingBag: {
|
|
28
28
|
employmentId: string | undefined;
|
|
29
29
|
creditRiskStatus: "fail" | "not_started" | "ready" | "in_progress" | "referred" | "deposit_required" | "no_deposit_required" | undefined;
|
|
30
|
-
owner_id: string | undefined;
|
|
31
30
|
stepState: {
|
|
32
31
|
currentStep: Step<"benefits" | "review" | "basic_information" | "contract_details" | "select_country">;
|
|
33
32
|
totalSteps: number;
|
|
@@ -46,7 +45,7 @@ declare const useOnboardingContext: () => {
|
|
|
46
45
|
select_country: Record<string, unknown>;
|
|
47
46
|
basic_information: Record<string, unknown>;
|
|
48
47
|
contract_details: Record<string, unknown>;
|
|
49
|
-
benefits:
|
|
48
|
+
benefits: Record<string, unknown>;
|
|
50
49
|
};
|
|
51
50
|
handleValidation: (values: react_hook_form.FieldValues) => {
|
|
52
51
|
yupError: _remoteoss_json_schema_form.$TSFixMe;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
2
2
|
import { l as EmploymentCreationResponse, m as PostCreateEmployment2Error, n as EmploymentResponse, o as PatchUpdateEmployment2Error, S as SuccessResponse$1, p as PutUpdateBenefitOfferError, j as Employment } from '../../types.gen-D_v539E_.js';
|
|
3
|
-
import { E as ErrorResponse, S as SuccessResponse } from '../../mutations-
|
|
3
|
+
import { E as ErrorResponse, S as SuccessResponse } from '../../mutations-B6HWH-rZ.js';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import * as _remoteoss_json_schema_form from '@remoteoss/json-schema-form';
|
|
6
6
|
import { Fields } from '@remoteoss/json-schema-form';
|
|
@@ -11,7 +11,7 @@ import { OnboardingFlowParams } from './types.js';
|
|
|
11
11
|
import '../types.js';
|
|
12
12
|
|
|
13
13
|
type OnboardingHookProps = OnboardingFlowParams;
|
|
14
|
-
declare const useOnboarding: ({ employmentId, companyId, countryCode, type, options, }: OnboardingHookProps) => {
|
|
14
|
+
declare const useOnboarding: ({ employmentId, companyId, countryCode, type, options, skipSteps, }: OnboardingHookProps) => {
|
|
15
15
|
/**
|
|
16
16
|
* Employment id passed useful to be used between components
|
|
17
17
|
*/
|
|
@@ -28,7 +28,6 @@ declare const useOnboarding: ({ employmentId, companyId, countryCode, type, opti
|
|
|
28
28
|
* - no_deposit_required
|
|
29
29
|
*/
|
|
30
30
|
creditRiskStatus: "fail" | "not_started" | "ready" | "in_progress" | "referred" | "deposit_required" | "no_deposit_required" | undefined;
|
|
31
|
-
owner_id: string | undefined;
|
|
32
31
|
/**
|
|
33
32
|
* Current step state containing the current step and total number of steps
|
|
34
33
|
*/
|
|
@@ -62,7 +61,7 @@ declare const useOnboarding: ({ employmentId, companyId, countryCode, type, opti
|
|
|
62
61
|
select_country: Record<string, unknown>;
|
|
63
62
|
basic_information: Record<string, unknown>;
|
|
64
63
|
contract_details: Record<string, unknown>;
|
|
65
|
-
benefits:
|
|
64
|
+
benefits: Record<string, unknown>;
|
|
66
65
|
};
|
|
67
66
|
/**
|
|
68
67
|
* Function to validate form values against the onboarding schema
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-7N7ND6Z4.js";import"../../chunk-7JHIPWS7.js";import"../../chunk-RDAO365M.js";import"../../chunk-AN7L3GVL.js";import"../../chunk-WVJDCDGZ.js";import"../../chunk-PWUYHFON.js";import"../../chunk-WRKHWEZA.js";import"../../chunk-WKK63LAY.js";import"../../chunk-PJBAQZ6G.js";import"../../chunk-GFMFGU7A.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as useOnboarding};
|
|
2
2
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -6,7 +6,7 @@ import 'react';
|
|
|
6
6
|
import './hooks.js';
|
|
7
7
|
import '@tanstack/query-core';
|
|
8
8
|
import '../../types.gen-D_v539E_.js';
|
|
9
|
-
import '../../mutations-
|
|
9
|
+
import '../../mutations-B6HWH-rZ.js';
|
|
10
10
|
import '@remoteoss/json-schema-form';
|
|
11
11
|
import '../useStepState.js';
|
|
12
12
|
import 'react-hook-form';
|
|
@@ -17,7 +17,7 @@ import './OnboardingSubmit.js';
|
|
|
17
17
|
import './OnboardingBack.js';
|
|
18
18
|
import './ContractDetailsStep.js';
|
|
19
19
|
import './BenefitsStep.js';
|
|
20
|
-
import '../../remoteFlows
|
|
20
|
+
import '../../remoteFlows--lO1UtNJ.js';
|
|
21
21
|
import 'yup';
|
|
22
22
|
import '../../types-CxSFjQw5.js';
|
|
23
23
|
import './SelectCountryStep.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../chunk-GULCZWSK.js";import{a}from"../../chunk-
|
|
1
|
+
import"../../chunk-GULCZWSK.js";import{a}from"../../chunk-XQXFQ7LM.js";import"../../chunk-BYFO5OB6.js";import"../../chunk-C3HJSV4T.js";import"../../chunk-GPAE53HO.js";import"../../chunk-ASFAGLQI.js";import"../../chunk-7N7ND6Z4.js";import"../../chunk-7JHIPWS7.js";import"../../chunk-RDAO365M.js";import"../../chunk-AN7L3GVL.js";import"../../chunk-WVJDCDGZ.js";import"../../chunk-D53FKWGJ.js";import"../../chunk-X6DRD2I4.js";import"../../chunk-AOJAZ4FT.js";import"../../chunk-QKTDO33H.js";import"../../chunk-VN4HDCRB.js";import"../../chunk-PGWKJ6FK.js";import"../../chunk-PWUYHFON.js";import"../../chunk-WRKHWEZA.js";import"../../chunk-WKK63LAY.js";import"../../chunk-PJBAQZ6G.js";import"../../chunk-Z3HWTDRE.js";import"../../chunk-XO3JWN33.js";import"../../chunk-GFMFGU7A.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as OnboardingFlow};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,10 +3,29 @@ import { FlowOptions, JSFModify } from '../types.js';
|
|
|
3
3
|
import '@remoteoss/json-schema-form';
|
|
4
4
|
|
|
5
5
|
type OnboardingFlowParams = {
|
|
6
|
+
/**
|
|
7
|
+
* The country code to use for the onboarding.
|
|
8
|
+
*/
|
|
6
9
|
countryCode?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The employment id to use for the onboarding.
|
|
12
|
+
*/
|
|
7
13
|
employmentId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The company id to use for the onboarding.
|
|
16
|
+
*/
|
|
8
17
|
companyId: string;
|
|
18
|
+
/**
|
|
19
|
+
* The steps to skip for the onboarding. We only support skipping the select_country step for now.
|
|
20
|
+
*/
|
|
21
|
+
skipSteps?: ['select_country'];
|
|
22
|
+
/**
|
|
23
|
+
* The type of employment to use for the onboarding. Employee or contractor.
|
|
24
|
+
*/
|
|
9
25
|
type?: EmploymentCreateParams['type'];
|
|
26
|
+
/**
|
|
27
|
+
* The options to use for the onboarding.
|
|
28
|
+
*/
|
|
10
29
|
options?: Omit<FlowOptions, 'jsfModify'> & {
|
|
11
30
|
jsfModify?: {
|
|
12
31
|
select_country?: JSFModify;
|
|
@@ -11,7 +11,7 @@ import { AdditionalDetailsForm } from './AdditionalDetailsForm.js';
|
|
|
11
11
|
import { JSFModify } from '../types.js';
|
|
12
12
|
import './types.js';
|
|
13
13
|
import '../../types.gen-D_v539E_.js';
|
|
14
|
-
import '../../mutations-
|
|
14
|
+
import '../../mutations-B6HWH-rZ.js';
|
|
15
15
|
import '@remoteoss/json-schema-form';
|
|
16
16
|
import '../useStepState.js';
|
|
17
17
|
import 'react-hook-form';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-QUM7V5EP.js";import"../../chunk-LLIGZSYY.js";import"../../chunk-JXCJLQRA.js";import"../../chunk-OS3QI7CV.js";import"../../chunk-XFD3ULUF.js";import"../../chunk-WWANHPT7.js";import"../../chunk-DR7VGNO2.js";import"../../chunk-XSHHMBMT.js";import"../../chunk-JODJFARP.js";import"../../chunk-W5DG5WWJ.js";import"../../chunk-VX2UC3HG.js";import"../../chunk-S4XU4SE7.js";import"../../chunk-KGSIUWBI.js";import"../../chunk-4BOE6EEO.js";import"../../chunk-O4PJ6GWS.js";import"../../chunk-BF7QENCN.js";import"../../chunk-OP4QGFLS.js";import"../../chunk-U6OPL6WG.js";import"../../chunk-MRYRNB7Y.js";import"../../chunk-PWUYHFON.js";import"../../chunk-LX7QBDSF.js";import"../../chunk-WRKHWEZA.js";import"../../chunk-WKK63LAY.js";import"../../chunk-PJBAQZ6G.js";import"../../chunk-Z3HWTDRE.js";import"../../chunk-XO3JWN33.js";import"../../chunk-GFMFGU7A.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as TerminationFlow};
|
|
2
2
|
//# sourceMappingURL=TerminationFlow.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { O as OffboardingResponse, k as PostCreateOffboardingError } from '../../types.gen-D_v539E_.js';
|
|
2
2
|
import * as _remoteoss_json_schema_form from '@remoteoss/json-schema-form';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import { E as ErrorResponse, S as SuccessResponse } from '../../mutations-
|
|
4
|
+
import { E as ErrorResponse, S as SuccessResponse } from '../../mutations-B6HWH-rZ.js';
|
|
5
5
|
import { Step } from '../useStepState.js';
|
|
6
6
|
import { useTermination } from './hooks.js';
|
|
7
7
|
import { TerminationFormValues } from './types.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { O as OffboardingResponse, k as PostCreateOffboardingError } from '../../types.gen-D_v539E_.js';
|
|
2
|
-
import { E as ErrorResponse, S as SuccessResponse } from '../../mutations-
|
|
2
|
+
import { E as ErrorResponse, S as SuccessResponse } from '../../mutations-B6HWH-rZ.js';
|
|
3
3
|
import * as _remoteoss_json_schema_form from '@remoteoss/json-schema-form';
|
|
4
4
|
import { Step } from '../useStepState.js';
|
|
5
5
|
import { StepTerminationKeys } from './utils.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-OS3QI7CV.js";import"../../chunk-XFD3ULUF.js";import"../../chunk-WWANHPT7.js";import"../../chunk-DR7VGNO2.js";import"../../chunk-XSHHMBMT.js";import"../../chunk-JODJFARP.js";import"../../chunk-W5DG5WWJ.js";import"../../chunk-VX2UC3HG.js";import"../../chunk-S4XU4SE7.js";import"../../chunk-PWUYHFON.js";import"../../chunk-WRKHWEZA.js";import"../../chunk-WKK63LAY.js";import"../../chunk-PJBAQZ6G.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-P37U34EQ.js";export{a as useTermination};
|
|
2
2
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -4,7 +4,7 @@ import 'react/jsx-runtime';
|
|
|
4
4
|
import 'react';
|
|
5
5
|
import './hooks.js';
|
|
6
6
|
import '../../types.gen-D_v539E_.js';
|
|
7
|
-
import '../../mutations-
|
|
7
|
+
import '../../mutations-B6HWH-rZ.js';
|
|
8
8
|
import '@remoteoss/json-schema-form';
|
|
9
9
|
import '../useStepState.js';
|
|
10
10
|
import 'react-hook-form';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../chunk-M22FKNEY.js";import{a}from"../../chunk-
|
|
1
|
+
import"../../chunk-M22FKNEY.js";import{a}from"../../chunk-QUM7V5EP.js";import"../../chunk-LLIGZSYY.js";import"../../chunk-JXCJLQRA.js";import"../../chunk-OS3QI7CV.js";import"../../chunk-XFD3ULUF.js";import"../../chunk-WWANHPT7.js";import"../../chunk-DR7VGNO2.js";import"../../chunk-XSHHMBMT.js";import"../../chunk-JODJFARP.js";import"../../chunk-W5DG5WWJ.js";import"../../chunk-VX2UC3HG.js";import"../../chunk-S4XU4SE7.js";import"../../chunk-KGSIUWBI.js";import"../../chunk-4BOE6EEO.js";import"../../chunk-O4PJ6GWS.js";import"../../chunk-BF7QENCN.js";import"../../chunk-OP4QGFLS.js";import"../../chunk-U6OPL6WG.js";import"../../chunk-MRYRNB7Y.js";import"../../chunk-PWUYHFON.js";import"../../chunk-LX7QBDSF.js";import"../../chunk-WRKHWEZA.js";import"../../chunk-WKK63LAY.js";import"../../chunk-PJBAQZ6G.js";import"../../chunk-Z3HWTDRE.js";import"../../chunk-XO3JWN33.js";import"../../chunk-GFMFGU7A.js";import"../../chunk-CFIJKJXD.js";import"../../chunk-GEYFQVQI.js";import"../../chunk-3ZWDIEEM.js";import"../../chunk-VNSF5IOL.js";import"../../chunk-MH6KKP6K.js";import"../../chunk-KPHSEIR3.js";import"../../chunk-P37U34EQ.js";export{a as TerminationFlow};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -25,14 +25,14 @@ import { ContractAmendmentParams } from './flows/ContractAmendment/types.js';
|
|
|
25
25
|
import { ValidationError } from 'yup';
|
|
26
26
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
27
27
|
import { PropsWithChildren } from 'react';
|
|
28
|
-
import { R as RemoteFlowsSDKProps } from './remoteFlows
|
|
29
|
-
export { $ as $TSFixMe, B as ButtonComponentProps, C as Components, F as FieldComponentProps, S as StatementComponentProps } from './remoteFlows
|
|
28
|
+
import { R as RemoteFlowsSDKProps } from './remoteFlows--lO1UtNJ.js';
|
|
29
|
+
export { $ as $TSFixMe, B as ButtonComponentProps, C as Components, F as FieldComponentProps, S as StatementComponentProps } from './remoteFlows--lO1UtNJ.js';
|
|
30
|
+
export { F as FieldError, N as NormalizedFieldError } from './mutations-B6HWH-rZ.js';
|
|
30
31
|
import './flows/types.js';
|
|
31
32
|
import '@remoteoss/json-schema-form';
|
|
32
33
|
import 'react-hook-form';
|
|
33
34
|
import './types-CxSFjQw5.js';
|
|
34
35
|
import './flows/ContractAmendment/ContractAmendmentBack.js';
|
|
35
|
-
import './mutations-v9H353tz.js';
|
|
36
36
|
import './flows/useStepState.js';
|
|
37
37
|
import './flows/Termination/hooks.js';
|
|
38
38
|
import './flows/Termination/utils.js';
|
|
@@ -94,6 +94,6 @@ type YupError = Pick<ValidationError, 'type' | 'errors'> & {
|
|
|
94
94
|
*/
|
|
95
95
|
declare const transformYupErrorsIntoObject: (errors: ValidationError) => Record<string, YupError>;
|
|
96
96
|
|
|
97
|
-
declare function RemoteFlows({ auth, children, components,
|
|
97
|
+
declare function RemoteFlows({ auth, children, components, theme, proxy, environment, }: PropsWithChildren<RemoteFlowsSDKProps>): react_jsx_runtime.JSX.Element;
|
|
98
98
|
|
|
99
|
-
export { RemoteFlows, transformYupErrorsIntoObject, useEmploymentQuery, useTimeOffQuery };
|
|
99
|
+
export { RemoteFlows, RemoteFlowsSDKProps, transformYupErrorsIntoObject, useEmploymentQuery, useTimeOffQuery };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-M22FKNEY.js";import{a as tr}from"./chunk-
|
|
1
|
+
import"./chunk-M22FKNEY.js";import{a as tr}from"./chunk-QUM7V5EP.js";import"./chunk-LLIGZSYY.js";import"./chunk-JXCJLQRA.js";import"./chunk-OS3QI7CV.js";import"./chunk-XFD3ULUF.js";import"./chunk-WWANHPT7.js";import"./chunk-DR7VGNO2.js";import"./chunk-XSHHMBMT.js";import"./chunk-JODJFARP.js";import"./chunk-W5DG5WWJ.js";import"./chunk-VX2UC3HG.js";import"./chunk-S4XU4SE7.js";import"./chunk-GULCZWSK.js";import"./chunk-KGSIUWBI.js";import"./chunk-4BOE6EEO.js";import"./chunk-O4PJ6GWS.js";import"./chunk-BF7QENCN.js";import"./chunk-OP4QGFLS.js";import"./chunk-U6OPL6WG.js";import"./chunk-MRYRNB7Y.js";import{a as or}from"./chunk-XQXFQ7LM.js";import"./chunk-BYFO5OB6.js";import"./chunk-C3HJSV4T.js";import"./chunk-GPAE53HO.js";import"./chunk-ASFAGLQI.js";import"./chunk-7N7ND6Z4.js";import"./chunk-7JHIPWS7.js";import"./chunk-RDAO365M.js";import"./chunk-AN7L3GVL.js";import"./chunk-WVJDCDGZ.js";import"./chunk-D53FKWGJ.js";import"./chunk-X6DRD2I4.js";import"./chunk-AOJAZ4FT.js";import"./chunk-QKTDO33H.js";import"./chunk-VN4HDCRB.js";import"./chunk-PGWKJ6FK.js";import"./chunk-FGBEOUQK.js";import{a as E}from"./chunk-DKIWM2PT.js";import"./chunk-WIRFNWEU.js";import"./chunk-3NZ6PO4D.js";import"./chunk-YO4OQIFP.js";import"./chunk-32RYPLZK.js";import"./chunk-PJCUSCO4.js";import"./chunk-EEAMZPP6.js";import"./chunk-FB5J7SRP.js";import{a as R}from"./chunk-H4BI3LJD.js";import{a as z}from"./chunk-3HPG2L62.js";import{a as T}from"./chunk-KM4XVL2X.js";import"./chunk-A7ZJQCNU.js";import{a as B}from"./chunk-EV5YPN4F.js";import{a as _}from"./chunk-DYB3RWP7.js";import{a as P}from"./chunk-ZOG52VVG.js";import"./chunk-KSHK3ZPX.js";import{b as y,c as k,e as C}from"./chunk-SUS7UBI5.js";import"./chunk-UPRUP24B.js";import"./chunk-PWUYHFON.js";import{a as er}from"./chunk-IEZAM2XO.js";import{a as H}from"./chunk-RXK4RLF6.js";import{a as ar}from"./chunk-NIOH7TNP.js";import{a as J,b as rr}from"./chunk-LX7QBDSF.js";import"./chunk-WRKHWEZA.js";import"./chunk-5SMMQQXP.js";import{a as p}from"./chunk-WKK63LAY.js";import"./chunk-PJBAQZ6G.js";import"./chunk-CTTXXEWI.js";import{a as G}from"./chunk-CSU6IQX3.js";import{a as Z}from"./chunk-RFYJGH2X.js";import"./chunk-Z3HWTDRE.js";import"./chunk-XO3JWN33.js";import"./chunk-GFMFGU7A.js";import"./chunk-CFIJKJXD.js";import"./chunk-GEYFQVQI.js";import{a as g,c as v}from"./chunk-3ZWDIEEM.js";import"./chunk-VNSF5IOL.js";import"./chunk-MH6KKP6K.js";import"./chunk-TVZAFTPT.js";import{c as F}from"./chunk-KPHSEIR3.js";import{a as e}from"./chunk-P37U34EQ.js";import{QueryClient as L,QueryClientProvider as q}from"@tanstack/react-query";function l(r){let a=document.documentElement;Object.keys(r).forEach(t=>{let o=r[t];o&&a.style.setProperty(t,o)})}e(l,"setCssProperties");function S(r){let a={};return Object.keys(r).forEach(t=>{a[`--${t}`]=r[t]}),a}e(S,"mapThemeColors");function N(r){return{"--spacing":r}}e(N,"mapThemeSpacing");function O(r){return{"--radius":r}}e(O,"mapThemeBorderRadius");function j(r){return{"--fontSizeBase":r.fontSizeBase}}e(j,"mapThemeFont");function h(r){r?.colors&&l(S(r.colors)),r?.spacing&&l(N(r.spacing)),r?.borderRadius&&l(O(r.borderRadius)),r?.font&&l(j(r.font))}e(h,"applyTheme");import{createContext as D,useEffect as I,useMemo as A}from"react";import{jsx as V}from"react/jsx-runtime";var K=D({theme:{}});function u(r){I(()=>{r.theme&&Object.keys(r.theme).length>0&&h(r.theme)},[r.theme]);let a=A(()=>({theme:r.theme}),[r.theme]);return V(K.Provider,{value:a,children:r.children})}e(u,"ThemeProvider");var m={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 U}from"@hey-api/client-fetch";import{useQuery as W}from"@tanstack/react-query";import{useRef as w}from"react";function M(r){try{return new URL(r),!0}catch{return!1}}e(M,"isValidUrl");var f=e(({auth:r,options:a})=>{let t=w(null),{refetch:o}=W({queryKey:["auth"],queryFn:r,enabled:!1}),c=a?.environment?m[a?.environment]:"https://gateway.remote.com",s=p.getConfig(),x="0.4.0-alpha.13",d=!!a?.proxy&&M(a.proxy.url);return a?.proxy&&!d&&console.error("Invalid proxy URL provided. Using default base URL."),w(U({...s,headers:{...s.headers,...d?a?.proxy?.headers:{},"X-Client-Name":"remote-flows-sdk","X-Client-Version":x},baseUrl:d?a.proxy?.url:c,auth:e(async()=>{function b(i){return!i||Date.now()+6e4>i}if(e(b,"hasTokenExpired"),!t.current||b(t.current.expiresAt)){let{data:i}=await o();i&&(t.current={accessToken:i.accessToken,expiresAt:Date.now()+i.expiresIn*1e3})}return t.current?.accessToken},"auth")}))},"useAuth");import{jsx as n}from"react/jsx-runtime";var Q=new L;function X({children:r,auth:a,proxy:t,environment:o}){let c=f({auth:a,options:{proxy:t,environment:o}});return n(v.Provider,{value:{client:c.current},children:r})}e(X,"RemoteFlowContextWrapper");function Y({children:r,components:a}){return n(g.Provider,{value:a?{components:a}:{components:{}},children:r})}e(Y,"FormFieldsProvider");function $({auth:r,children:a,components:t,theme:o,proxy:c,environment:s}){return n(q,{client:Q,children:n(Y,{components:t,children:n(X,{auth:r,proxy:c,environment:s,children:n(u,{theme:o,children:a})})})})}e($,"RemoteFlows");export{G as ContractAmendmentConfirmationForm,er as ContractAmendmentFlow,Z as ContractAmendmentForm,H as ContractAmendmentSubmit,B as CostCalculatorDisclaimer,P as CostCalculatorFlow,R as CostCalculatorForm,z as CostCalculatorResetButton,E as CostCalculatorResults,T as CostCalculatorSubmitButton,or as OnboardingFlow,$ as RemoteFlows,tr as TerminationFlow,y as buildCostCalculatorEstimationPayload,_ as disclaimerData,F as transformYupErrorsIntoObject,ar as useContractAmendment,C as useCostCalculator,k as useCostCalculatorEstimationPdf,J as useEmploymentQuery,rr as useTimeOffQuery};
|
|
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 isTestingMode?: RemoteFlowsSDKProps['isTestingMode'];\n proxy?: RemoteFlowsSDKProps['proxy'];\n};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n isTestingMode,\n proxy,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\n options: {\n isTestingMode: !!isTestingMode,\n proxy,\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 children,\n components,\n isTestingMode = false,\n theme,\n proxy,\n}: PropsWithChildren<RemoteFlowsSDKProps>) {\n return (\n <QueryClientProvider client={queryClient}>\n <FormFieldsProvider components={components}>\n <RemoteFlowContextWrapper\n isTestingMode={isTestingMode}\n auth={auth}\n proxy={proxy}\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 staging: 'https://gateway.niceremote.com',\n partners: 'https://gateway.partners.remote-sandbox.com',\n production: 'https://gateway.remote.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';\n\ntype AuthResponse = {\n accessToken: string;\n expiresIn: number;\n};\n\ntype Options = {\n isTestingMode: boolean;\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}: {\n auth: () => Promise<AuthResponse>;\n options: Options;\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth'],\n queryFn: auth,\n enabled: false,\n });\n\n const baseUrl = options.isTestingMode\n ? ENVIRONMENTS.partners\n : process.env.REMOTE_GATEWAY_URL;\n\n const clientConfig = client.getConfig();\n const npmPackageVersion = process.env.VERSION;\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":"q7EAAA,OAAS,eAAAA,EAAa,uBAAAC,MAA2B,wBCUjD,SAASC,EAAiBC,EAAmC,CAC3D,IAAMC,EAAO,SAAS,gBACtB,OAAO,KAAKD,CAAS,EAAE,QAASE,GAAM,CACpC,IAAMC,EAAcH,EAAUE,CAAC,EAC3BC,GACFF,EAAK,MAAM,YAAYC,EAAGC,CAAW,CAEzC,CAAC,CACH,CARSC,EAAAL,EAAA,oBAUT,SAASM,EAAeC,EAAqC,CAC3D,IAAMC,EAAyB,CAAC,EAChC,cAAO,KAAKD,CAAM,EAAE,QAASE,GAAQ,CACnCD,EAAO,KAAKC,CAAG,EAA0B,EACvCF,EAAOE,CAAwB,CACnC,CAAC,EACMD,CACT,CAPSH,EAAAC,EAAA,kBAST,SAASI,EAAgBC,EAAkC,CACzD,MAAO,CACL,YAAaA,CACf,CACF,CAJSN,EAAAK,EAAA,mBAMT,SAASE,EAAqBC,EAAsC,CAClE,MAAO,CACL,WAAYA,CACd,CACF,CAJSR,EAAAO,EAAA,wBAMT,SAASE,EAAaC,EAA+B,CACnD,MAAO,CACL,iBAAkBA,EAAK,YACzB,CACF,CAJSV,EAAAS,EAAA,gBAMF,SAASE,EA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OACEb,EAACc,EAAkB,SAAlB,CACC,MAAOD,EAAa,CAAE,WAAAA,CAAW,EAAI,CAAE,WAAY,CAAC,CAAE,EAErD,SAAAT,EACH,CAEJ,CAbgBO,EAAAC,EAAA,sBAeT,SAASG,EAAY,CAC1B,KAAAV,EACA,SAAAD,EACA,WAAAS,EACA,cAAAP,EAAgB,GAChB,MAAAU,EACA,MAAAT,CACF,EAA2C,CACzC,OACEP,EAACiB,EAAA,CAAoB,OAAQhB,EAC3B,SAAAD,EAACY,EAAA,CAAmB,WAAYC,EAC9B,SAAAb,EAACG,EAAA,CACC,cAAeG,EACf,KAAMD,EACN,MAAOE,EAEP,SAAAP,EAACkB,EAAA,CAAc,MAAOF,EAAQ,SAAAZ,EAAS,EACzC,EACF,EACF,CAEJ,CArBgBO,EAAAI,EAAA","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","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","isTestingMode","proxy","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};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n proxy,\n environment,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\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 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 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 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';\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}: {\n auth: () => Promise<AuthResponse>;\n options?: Options;\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth'],\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;\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":"q7EAAA,OAAS,eAAAA,EAAa,uBAAAC,MAA2B,wBCUjD,SAASC,EAAiBC,EAAmC,CAC3D,IAAMC,EAAO,SAAS,gBACtB,OAAO,KAAKD,CAAS,EAAE,QAASE,GAAM,CACpC,IAAMC,EAAcH,EAAUE,CAAC,EAC3BC,GACFF,EAAK,MAAM,YAAYC,EAAGC,CAAW,CAEzC,CAAC,CACH,CARSC,EAAAL,EAAA,oBAUT,SAASM,EAAeC,EAAqC,CAC3D,IAAMC,EAAyB,CAAC,EAChC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F,EAvDuB,WJMnB,cAAAc,MAAA,oBAvBJ,IAAMC,EAAc,IAAIC,EASxB,SAASC,EAAyB,CAChC,SAAAC,EACA,KAAAC,EACA,MAAAC,EACA,YAAAC,CACF,EAAkC,CAChC,IAAMC,EAAkBC,EAAQ,CAC9B,KAAAJ,EACA,QAAS,CACP,MAAAC,EACA,YAAAC,CACF,CACF,CAAC,EACD,OACEP,EAACU,EAAkB,SAAlB,CAA2B,MAAO,CAAE,OAAQF,EAAgB,OAAQ,EAClE,SAAAJ,EACH,CAEJ,CAlBSO,EAAAR,EAAA,4BAoBF,SAASS,EAAmB,CACjC,SAAAR,EACA,WAAAS,CACF,EAEI,CACF,OACEb,EAACc,EAAkB,SAAlB,CACC,MAAOD,EAAa,CAAE,WAAAA,CAAW,EAAI,CAAE,WAAY,CAAC,CAAE,EAErD,SAAAT,EACH,CAEJ,CAbgBO,EAAAC,EAAA,sBAeT,SAASG,EAAY,CAC1B,KAAAV,EACA,SAAAD,EACA,WAAAS,EACA,MAAAG,EACA,MAAAV,EACA,YAAAC,CACF,EAA2C,CACzC,OACEP,EAACiB,EAAA,CAAoB,OAAQhB,EAC3B,SAAAD,EAACY,EAAA,CAAmB,WAAYC,EAC9B,SAAAb,EAACG,EAAA,CACC,KAAME,EACN,MAAOC,EACP,YAAaC,EAEb,SAAAP,EAACkB,EAAA,CAAc,MAAOF,EAAQ,SAAAZ,EAAS,EACzC,EACF,EACF,CAEJ,CArBgBO,EAAAI,EAAA","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","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","proxy","environment","remoteApiClient","useAuth","RemoteFlowContext","__name","FormFieldsProvider","components","FormFieldsContext","RemoteFlows","theme","QueryClientProvider","ThemeProvider"]}
|