@remoteoss/remote-flows 0.3.0 → 0.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2PXGLWCY.js +2 -0
- package/dist/chunk-2PXGLWCY.js.map +1 -0
- package/dist/{chunk-G4R7TPQL.js → chunk-6TYJC6YS.js} +2 -2
- package/dist/{chunk-THCM2G6C.js → chunk-ABR3B66K.js} +2 -2
- package/dist/chunk-ALRU77S5.js +2 -0
- package/dist/chunk-ALRU77S5.js.map +1 -0
- package/dist/chunk-CFRYIKSR.js +2 -0
- package/dist/chunk-CFRYIKSR.js.map +1 -0
- package/dist/{chunk-KQEIZSUS.js → chunk-CKEVRQRG.js} +2 -2
- package/dist/{chunk-VZM3HYXN.js → chunk-D3SD6MMV.js} +2 -2
- package/dist/{chunk-4APN5ST6.js → chunk-DE5FSFYL.js} +2 -2
- package/dist/chunk-DHRIURRT.js +2 -0
- package/dist/{chunk-AG27JG4N.js.map → chunk-DHRIURRT.js.map} +1 -1
- package/dist/{chunk-WDV5ZDXL.js → chunk-DZSZOC2G.js} +2 -2
- package/dist/chunk-ED3CBUQL.js +2 -0
- package/dist/chunk-ED3CBUQL.js.map +1 -0
- package/dist/chunk-GFBF55NR.js +2 -0
- package/dist/chunk-GFBF55NR.js.map +1 -0
- package/dist/{chunk-4C45VY6F.js → chunk-GGAS4ZNQ.js} +2 -2
- package/dist/chunk-GOLOL2V6.js +2 -0
- package/dist/chunk-GOLOL2V6.js.map +1 -0
- package/dist/{chunk-P3N4X5KU.js → chunk-GRYAM4FZ.js} +2 -2
- package/dist/chunk-GULCZWSK.js +1 -0
- package/dist/chunk-GULCZWSK.js.map +1 -0
- package/dist/{chunk-U3TYUMTJ.js → chunk-HEPL5WDF.js} +2 -2
- package/dist/chunk-HSW5HMHH.js +2 -0
- package/dist/{chunk-LLA3Z2PK.js → chunk-JBG4RVXQ.js} +2 -2
- package/dist/{chunk-GGZV4QYL.js → chunk-KQH5HLN5.js} +2 -2
- package/dist/chunk-LNKYOAKF.js +2 -0
- package/dist/chunk-LNKYOAKF.js.map +1 -0
- package/dist/chunk-M7WCW7WD.js +2 -0
- package/dist/chunk-M7WCW7WD.js.map +1 -0
- package/dist/chunk-MHKNAQLP.js +2 -0
- package/dist/chunk-MHKNAQLP.js.map +1 -0
- package/dist/chunk-MIHU6CEZ.js +2 -0
- package/dist/chunk-MIHU6CEZ.js.map +1 -0
- package/dist/chunk-NE547PW4.js +2 -0
- package/dist/chunk-NE547PW4.js.map +1 -0
- package/dist/{chunk-BDCIVWHR.js → chunk-PNXZHV6W.js} +2 -2
- package/dist/chunk-PWKM2R6V.js +2 -0
- package/dist/chunk-PWKM2R6V.js.map +1 -0
- package/dist/{chunk-L3E32MJU.js → chunk-Q64URAIN.js} +2 -2
- package/dist/{chunk-WJPC4J3U.js → chunk-QOMUXX6W.js} +2 -2
- package/dist/chunk-QSHYMFMY.js +2 -0
- package/dist/chunk-QSHYMFMY.js.map +1 -0
- package/dist/chunk-S4FKLPBB.js +2 -0
- package/dist/chunk-S4FKLPBB.js.map +1 -0
- package/dist/{chunk-QJGFU4YO.js → chunk-SLD7DFLW.js} +2 -2
- package/dist/{chunk-RCX4JUI3.js → chunk-UECSVYQ5.js} +2 -2
- package/dist/chunk-VRQXHCFR.js +2 -0
- package/dist/chunk-VRQXHCFR.js.map +1 -0
- package/dist/chunk-WS3C3WIJ.js +2 -0
- package/dist/chunk-WS3C3WIJ.js.map +1 -0
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +3 -1
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
- package/dist/flows/ContractAmendment/context.d.ts +3 -1
- package/dist/flows/ContractAmendment/hooks.d.ts +3 -1
- package/dist/flows/ContractAmendment/hooks.js +1 -1
- package/dist/flows/ContractAmendment/index.d.ts +4 -2
- package/dist/flows/ContractAmendment/index.js +1 -1
- package/dist/flows/ContractAmendment/types.d.ts +6 -8
- package/dist/flows/ContractAmendment/utils.d.ts +1 -1
- package/dist/flows/ContractAmendment/utils.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +1 -1
- package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorResults.d.ts +1 -1
- package/dist/flows/CostCalculator/Results/CostCalculatorResults.js +1 -1
- package/dist/flows/CostCalculator/context.d.ts +1 -1
- package/dist/flows/CostCalculator/hooks.d.ts +1 -1
- package/dist/flows/CostCalculator/hooks.js +1 -1
- package/dist/flows/CostCalculator/index.d.ts +1 -1
- package/dist/flows/CostCalculator/index.js +1 -1
- package/dist/flows/CostCalculator/types.d.ts +1 -1
- package/dist/flows/CostCalculator/utils.d.ts +1 -1
- package/dist/flows/CostCalculator/utils.js +1 -1
- package/dist/flows/Onboarding/BasicInformationStep.d.ts +15 -0
- package/dist/flows/Onboarding/BasicInformationStep.js +2 -0
- package/dist/flows/Onboarding/BasicInformationStep.js.map +1 -0
- package/dist/flows/Onboarding/BenefitsStep.d.ts +37 -0
- package/dist/flows/Onboarding/BenefitsStep.js +2 -0
- package/dist/flows/Onboarding/BenefitsStep.js.map +1 -0
- package/dist/flows/Onboarding/ContractDetailsStep.d.ts +15 -0
- package/dist/flows/Onboarding/ContractDetailsStep.js +2 -0
- package/dist/flows/Onboarding/ContractDetailsStep.js.map +1 -0
- package/dist/flows/Onboarding/OnboardingBack.d.ts +5 -0
- package/dist/flows/Onboarding/OnboardingBack.js +2 -0
- package/dist/flows/Onboarding/OnboardingBack.js.map +1 -0
- package/dist/flows/Onboarding/OnboardingFlow.d.ts +52 -0
- package/dist/flows/Onboarding/OnboardingFlow.js +2 -0
- package/dist/flows/Onboarding/OnboardingFlow.js.map +1 -0
- package/dist/flows/Onboarding/OnboardingForm.d.ts +19 -0
- package/dist/flows/Onboarding/OnboardingForm.js +2 -0
- package/dist/flows/Onboarding/OnboardingForm.js.map +1 -0
- package/dist/flows/Onboarding/OnboardingInvite.d.ts +11 -0
- package/dist/flows/Onboarding/OnboardingInvite.js +2 -0
- package/dist/flows/Onboarding/OnboardingInvite.js.map +1 -0
- package/dist/flows/Onboarding/OnboardingSubmit.d.ts +5 -0
- package/dist/flows/Onboarding/OnboardingSubmit.js +2 -0
- package/dist/flows/Onboarding/OnboardingSubmit.js.map +1 -0
- package/dist/flows/Onboarding/context.d.ts +78 -0
- package/dist/flows/Onboarding/context.js +2 -0
- package/dist/flows/Onboarding/context.js.map +1 -0
- package/dist/flows/Onboarding/hooks.d.ts +133 -0
- package/dist/flows/Onboarding/hooks.js +2 -0
- package/dist/flows/Onboarding/hooks.js.map +1 -0
- package/dist/flows/Onboarding/index.d.ts +20 -0
- package/dist/flows/Onboarding/index.js +2 -0
- package/dist/flows/Onboarding/index.js.map +1 -0
- package/dist/flows/Onboarding/types.d.ts +36 -0
- package/dist/flows/Onboarding/types.js +1 -0
- package/dist/flows/Onboarding/types.js.map +1 -0
- package/dist/flows/Onboarding/utils.d.ts +8 -0
- package/dist/flows/Onboarding/utils.js +2 -0
- package/dist/flows/Onboarding/utils.js.map +1 -0
- package/dist/flows/Termination/AdditionalDetailsForm.d.ts +1 -1
- package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
- package/dist/flows/Termination/EmployeeComunicationForm.d.ts +1 -1
- package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
- package/dist/flows/Termination/PaidTimeOffForm.d.ts +1 -1
- package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
- package/dist/flows/Termination/TerminationDetailsForm.d.ts +1 -1
- package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
- package/dist/flows/Termination/TerminationFlow.d.ts +1 -1
- package/dist/flows/Termination/TerminationFlow.js +1 -1
- package/dist/flows/Termination/TerminationForm.d.ts +1 -1
- package/dist/flows/Termination/TerminationForm.js +1 -1
- package/dist/flows/Termination/TimeOff.d.ts +1 -1
- package/dist/flows/Termination/TimeOff.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/flows/Termination/json-schemas/schema.js +1 -1
- package/dist/flows/Termination/types.d.ts +1 -1
- package/dist/flows/types.d.ts +16 -1
- package/dist/flows/utils.d.ts +3 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +14 -115
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/remoteFlows-CswYencu.d.ts +116 -0
- package/dist/{types.gen-Dta9Iy5C.d.ts → types.gen-CsMdyQkb.d.ts} +169 -1
- package/package.json +3 -2
- package/dist/chunk-2Y22JKVE.js +0 -2
- package/dist/chunk-3MAYMGXF.js +0 -2
- package/dist/chunk-3MAYMGXF.js.map +0 -1
- package/dist/chunk-6YO6XWPH.js +0 -2
- package/dist/chunk-6YO6XWPH.js.map +0 -1
- package/dist/chunk-AG27JG4N.js +0 -2
- package/dist/chunk-VTPDBEHE.js +0 -2
- package/dist/chunk-VTPDBEHE.js.map +0 -1
- package/dist/chunk-YBACB5A6.js +0 -2
- package/dist/chunk-YBACB5A6.js.map +0 -1
- /package/dist/{chunk-G4R7TPQL.js.map → chunk-6TYJC6YS.js.map} +0 -0
- /package/dist/{chunk-THCM2G6C.js.map → chunk-ABR3B66K.js.map} +0 -0
- /package/dist/{chunk-KQEIZSUS.js.map → chunk-CKEVRQRG.js.map} +0 -0
- /package/dist/{chunk-VZM3HYXN.js.map → chunk-D3SD6MMV.js.map} +0 -0
- /package/dist/{chunk-4APN5ST6.js.map → chunk-DE5FSFYL.js.map} +0 -0
- /package/dist/{chunk-WDV5ZDXL.js.map → chunk-DZSZOC2G.js.map} +0 -0
- /package/dist/{chunk-4C45VY6F.js.map → chunk-GGAS4ZNQ.js.map} +0 -0
- /package/dist/{chunk-P3N4X5KU.js.map → chunk-GRYAM4FZ.js.map} +0 -0
- /package/dist/{chunk-U3TYUMTJ.js.map → chunk-HEPL5WDF.js.map} +0 -0
- /package/dist/{chunk-2Y22JKVE.js.map → chunk-HSW5HMHH.js.map} +0 -0
- /package/dist/{chunk-LLA3Z2PK.js.map → chunk-JBG4RVXQ.js.map} +0 -0
- /package/dist/{chunk-GGZV4QYL.js.map → chunk-KQH5HLN5.js.map} +0 -0
- /package/dist/{chunk-BDCIVWHR.js.map → chunk-PNXZHV6W.js.map} +0 -0
- /package/dist/{chunk-L3E32MJU.js.map → chunk-Q64URAIN.js.map} +0 -0
- /package/dist/{chunk-WJPC4J3U.js.map → chunk-QOMUXX6W.js.map} +0 -0
- /package/dist/{chunk-QJGFU4YO.js.map → chunk-SLD7DFLW.js.map} +0 -0
- /package/dist/{chunk-RCX4JUI3.js.map → chunk-UECSVYQ5.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -14,16 +14,19 @@ export { ContractAmendmentSubmit } from './flows/ContractAmendment/ContractAmend
|
|
|
14
14
|
export { useContractAmendment } from './flows/ContractAmendment/hooks.js';
|
|
15
15
|
export { TerminationFlow, TerminationRenderProps } from './flows/Termination/TerminationFlow.js';
|
|
16
16
|
export { TerminationFormValues } from './flows/Termination/types.js';
|
|
17
|
+
export { OnboardingFlow, OnboardingRenderProps } from './flows/Onboarding/OnboardingFlow.js';
|
|
18
|
+
export { BasicInformationFormPayload, BenefitsFormPayload, ContractDetailsFormPayload } from './flows/Onboarding/types.js';
|
|
17
19
|
export { CostCalculatorEstimationFormValues, CostCalculatorEstimationOptions, JSFModify } from './flows/CostCalculator/types.js';
|
|
18
20
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
19
|
-
import { E as EmploymentShowResponse,
|
|
20
|
-
export { C as ContractAmendmentAutomatableResponse,
|
|
21
|
+
import { E as EmploymentShowResponse, q as TimeoffStatus, L as ListTimeoffResponse } from './types.gen-CsMdyQkb.js';
|
|
22
|
+
export { C as ContractAmendmentAutomatableResponse, j as CostCalculatorEstimateResponse, c as EmploymentCreationResponse, e as EmploymentResponse, O as OffboardingResponse, S as SuccessResponse } from './types.gen-CsMdyQkb.js';
|
|
21
23
|
import { ContractAmendmentParams } from './flows/ContractAmendment/types.js';
|
|
22
|
-
import { ValidationError
|
|
24
|
+
import { ValidationError } from 'yup';
|
|
23
25
|
import React__default, { PropsWithChildren } from 'react';
|
|
24
|
-
import {
|
|
26
|
+
import { R as RemoteFlowsSDKProps } from './remoteFlows-CswYencu.js';
|
|
25
27
|
import './flows/types.js';
|
|
26
28
|
import '@remoteoss/json-schema-form';
|
|
29
|
+
import 'react-hook-form';
|
|
27
30
|
import './flows/ContractAmendment/ContractAmendmentBack.js';
|
|
28
31
|
import './mutations-v9H353tz.js';
|
|
29
32
|
import './flows/useStepState.js';
|
|
@@ -35,6 +38,13 @@ import './flows/Termination/EmployeeComunicationForm.js';
|
|
|
35
38
|
import './flows/Termination/TerminationDetailsForm.js';
|
|
36
39
|
import './flows/Termination/PaidTimeOffForm.js';
|
|
37
40
|
import './flows/Termination/AdditionalDetailsForm.js';
|
|
41
|
+
import './flows/Onboarding/hooks.js';
|
|
42
|
+
import './flows/Onboarding/BasicInformationStep.js';
|
|
43
|
+
import './flows/Onboarding/OnboardingSubmit.js';
|
|
44
|
+
import './flows/Onboarding/OnboardingBack.js';
|
|
45
|
+
import './flows/Onboarding/OnboardingInvite.js';
|
|
46
|
+
import './flows/Onboarding/ContractDetailsStep.js';
|
|
47
|
+
import './flows/Onboarding/BenefitsStep.js';
|
|
38
48
|
|
|
39
49
|
type UseEmployment = Pick<ContractAmendmentParams, 'employmentId'>;
|
|
40
50
|
/**
|
|
@@ -76,117 +86,6 @@ type YupError = Pick<ValidationError, 'type' | 'errors'> & {
|
|
|
76
86
|
*/
|
|
77
87
|
declare const transformYupErrorsIntoObject: (errors: ValidationError) => Record<string, YupError>;
|
|
78
88
|
|
|
79
|
-
type ThemeProviderProps = PropsWithChildren<{
|
|
80
|
-
theme?: Partial<{
|
|
81
|
-
colors: ThemeColors;
|
|
82
|
-
spacing: string;
|
|
83
|
-
borderRadius: string;
|
|
84
|
-
font: ThemeFont;
|
|
85
|
-
}>;
|
|
86
|
-
}>;
|
|
87
|
-
type ThemeColors = Partial<{
|
|
88
|
-
borderInput: string;
|
|
89
|
-
primaryBackground: string;
|
|
90
|
-
primaryForeground: string;
|
|
91
|
-
accentBackground: string;
|
|
92
|
-
accentForeground: string;
|
|
93
|
-
danger: string;
|
|
94
|
-
warningBackground: string;
|
|
95
|
-
warningBorder: string;
|
|
96
|
-
}>;
|
|
97
|
-
type ThemeFont = {
|
|
98
|
-
fontSizeBase: string;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
type SupportedTypes = 'text' | 'number' | 'email' | 'select' | 'radio' | 'fieldset' | 'date' | 'checkbox' | 'textarea' | 'money' | 'file';
|
|
102
|
-
|
|
103
|
-
type StatementProps = {
|
|
104
|
-
title?: string;
|
|
105
|
-
description: string;
|
|
106
|
-
severity: 'warning' | 'error' | 'success' | 'info' | 'neutral' | 'time';
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
type AuthResponse = {
|
|
110
|
-
accessToken: string;
|
|
111
|
-
expiresIn: number;
|
|
112
|
-
};
|
|
113
|
-
type JSFField = {
|
|
114
|
-
computedAttributes: Record<string, unknown>;
|
|
115
|
-
description: string;
|
|
116
|
-
errorMessage: Record<string, string>;
|
|
117
|
-
inputType: SupportedTypes;
|
|
118
|
-
isVisible: boolean;
|
|
119
|
-
jsonType: string;
|
|
120
|
-
label: string;
|
|
121
|
-
name: string;
|
|
122
|
-
required: boolean;
|
|
123
|
-
schema: AnySchema;
|
|
124
|
-
scopedJsonSchema: Record<string, unknown>;
|
|
125
|
-
type: string;
|
|
126
|
-
options?: Array<{
|
|
127
|
-
value: string;
|
|
128
|
-
label: string;
|
|
129
|
-
description?: string;
|
|
130
|
-
}>;
|
|
131
|
-
defaultValue?: string | number;
|
|
132
|
-
minDate?: string;
|
|
133
|
-
maxLength?: number;
|
|
134
|
-
multiple?: boolean;
|
|
135
|
-
};
|
|
136
|
-
type Components = {
|
|
137
|
-
[K in SupportedTypes]?: React.ComponentType<{
|
|
138
|
-
/**
|
|
139
|
-
* Field prop from React Hook Form's Controller component.
|
|
140
|
-
* Contains field state and methods for registration.
|
|
141
|
-
* @see https://react-hook-form.com/docs/usecontroller/controller
|
|
142
|
-
*/
|
|
143
|
-
field: ControllerRenderProps<FieldValues, string>;
|
|
144
|
-
/**
|
|
145
|
-
* Field state prop from React Hook Form's Controller component.
|
|
146
|
-
* Contains information about the field's state, such as errors, touched status, etc.
|
|
147
|
-
* @see https://react-hook-form.com/docs/usecontroller/controller
|
|
148
|
-
*/
|
|
149
|
-
fieldState: ControllerFieldState;
|
|
150
|
-
/**
|
|
151
|
-
* Metadata derived from JSON schema parsing that provides additional context and validation rules for the field.
|
|
152
|
-
* Contains properties defined in the original JSON schema such as type, format, constraints, etc.
|
|
153
|
-
*/
|
|
154
|
-
fieldData: JSFField;
|
|
155
|
-
}>;
|
|
156
|
-
} & {
|
|
157
|
-
statement?: React.ComponentType<{
|
|
158
|
-
data: StatementProps;
|
|
159
|
-
}>;
|
|
160
|
-
};
|
|
161
|
-
type RemoteFlowsSDKProps = Omit<ThemeProviderProps, 'children'> & {
|
|
162
|
-
/**
|
|
163
|
-
* Function to authenticate the user and obtain an access token.
|
|
164
|
-
* @returns A promise that resolves to an object containing the access token and its expiration time.
|
|
165
|
-
*/
|
|
166
|
-
auth: () => Promise<AuthResponse>;
|
|
167
|
-
/**
|
|
168
|
-
* Components to override the default field components used in the SDK.
|
|
169
|
-
*/
|
|
170
|
-
components?: Components;
|
|
171
|
-
/**
|
|
172
|
-
* Flag to indicate if the SDK is in testing mode and use the testing environment.
|
|
173
|
-
* If true, the SDK will use the testing environment for all API calls.
|
|
174
|
-
*/
|
|
175
|
-
isTestingMode?: boolean;
|
|
176
|
-
proxy?: {
|
|
177
|
-
/**
|
|
178
|
-
* URL of the proxy server to use for API calls.
|
|
179
|
-
*/
|
|
180
|
-
url: string;
|
|
181
|
-
/**
|
|
182
|
-
* Headers to include in the API requests.
|
|
183
|
-
*/
|
|
184
|
-
headers?: {
|
|
185
|
-
[key: string]: string;
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
|
|
190
89
|
declare function RemoteFlows({ auth, children, components, isTestingMode, theme, proxy, }: PropsWithChildren<RemoteFlowsSDKProps>): React__default.JSX.Element;
|
|
191
90
|
|
|
192
91
|
export { RemoteFlows, transformYupErrorsIntoObject, useEmploymentQuery, useTimeOffQuery };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-M22FKNEY.js";import{a as
|
|
1
|
+
import"./chunk-M22FKNEY.js";import{a as te}from"./chunk-DZSZOC2G.js";import"./chunk-GGAS4ZNQ.js";import"./chunk-HSW5HMHH.js";import"./chunk-VX2UC3HG.js";import"./chunk-XSHHMBMT.js";import"./chunk-XFD3ULUF.js";import"./chunk-JODJFARP.js";import"./chunk-WWANHPT7.js";import"./chunk-W5DG5WWJ.js";import"./chunk-FZ2HS6G7.js";import"./chunk-SLD7DFLW.js";import"./chunk-CKEVRQRG.js";import"./chunk-YOC3VDC7.js";import"./chunk-6TYJC6YS.js";import"./chunk-KSGPQCSG.js";import"./chunk-D3SD6MMV.js";import"./chunk-FGBEOUQK.js";import{a as E}from"./chunk-S4FKLPBB.js";import"./chunk-GMGKIQLI.js";import"./chunk-WQHKB5T7.js";import"./chunk-KH6QS5OU.js";import"./chunk-J55S4SEH.js";import"./chunk-3FVI5JIC.js";import"./chunk-6A3F6JG6.js";import"./chunk-MESREYTZ.js";import"./chunk-JBG4RVXQ.js";import"./chunk-Q64URAIN.js";import"./chunk-DZYFSFZ7.js";import"./chunk-GULCZWSK.js";import{a as S}from"./chunk-DGPRFQYK.js";import{a as _}from"./chunk-DYB3RWP7.js";import{a as z}from"./chunk-DE5FSFYL.js";import{b as y,c as k,e as C}from"./chunk-GRYAM4FZ.js";import"./chunk-UPRUP24B.js";import{a as P}from"./chunk-PNXZHV6W.js";import{a as R}from"./chunk-7CYG2RHP.js";import{a as F}from"./chunk-EAAIAMTY.js";import"./chunk-OLJ2S6A6.js";import{a as oe}from"./chunk-PWKM2R6V.js";import"./chunk-QSHYMFMY.js";import"./chunk-M7WCW7WD.js";import"./chunk-ALRU77S5.js";import"./chunk-MHKNAQLP.js";import"./chunk-NE547PW4.js";import"./chunk-2PXGLWCY.js";import"./chunk-A7ZJQCNU.js";import"./chunk-CFRYIKSR.js";import"./chunk-ED3CBUQL.js";import"./chunk-LNKYOAKF.js";import"./chunk-WS3C3WIJ.js";import"./chunk-36UPHOJS.js";import{a as ae}from"./chunk-KQH5HLN5.js";import{a as H}from"./chunk-XLFHHYVS.js";import{a as re}from"./chunk-GOLOL2V6.js";import{a as J,b as ee}from"./chunk-QOMUXX6W.js";import"./chunk-JRQSZHUU.js";import{a as p}from"./chunk-DHRIURRT.js";import"./chunk-UECSVYQ5.js";import"./chunk-S56EWAS4.js";import"./chunk-FMT2OTOL.js";import{a as Z}from"./chunk-ABR3B66K.js";import{a as $}from"./chunk-HEPL5WDF.js";import"./chunk-A4RX3KRZ.js";import"./chunk-MIHU6CEZ.js";import"./chunk-GFBF55NR.js";import{a as g,c as v}from"./chunk-WRDKLT4N.js";import"./chunk-56BNVYTD.js";import"./chunk-VRQXHCFR.js";import"./chunk-IDSJI7KQ.js";import"./chunk-6HGUGIYJ.js";import{c as T}from"./chunk-5ETXP2QF.js";import{a}from"./chunk-AYDF3IFZ.js";import{QueryClient as L,QueryClientProvider as q}from"@tanstack/react-query";import n from"react";function l(e){let r=document.documentElement;Object.keys(e).forEach(t=>{let o=e[t];o&&r.style.setProperty(t,o)})}a(l,"setCssProperties");function B(e){let r={};return Object.keys(e).forEach(t=>{r[`--${t}`]=e[t]}),r}a(B,"mapThemeColors");function j(e){return{"--spacing":e}}a(j,"mapThemeSpacing");function M(e){return{"--radius":e}}a(M,"mapThemeBorderRadius");function I(e){return{"--fontSizeBase":e.fontSizeBase}}a(I,"mapThemeFont");function u(e){e?.colors&&l(B(e.colors)),e?.spacing&&l(j(e.spacing)),e?.borderRadius&&l(M(e.borderRadius)),e?.font&&l(I(e.font))}a(u,"applyTheme");import A,{createContext as N,useEffect as O,useMemo as U}from"react";var D=N({theme:{}});function h(e){O(()=>{e.theme&&Object.keys(e.theme).length>0&&u(e.theme)},[e.theme]);let r=U(()=>({theme:e.theme}),[e.theme]);return A.createElement(D.Provider,{value:r},e.children)}a(h,"ThemeProvider");var m={staging:"https://gateway.niceremote.com",partners:"https://gateway.partners.remote-sandbox.com",production:"https://gateway.remote.com"};import{createClient as K}from"@hey-api/client-fetch";import{useQuery as V}from"@tanstack/react-query";import{useRef as f}from"react";function W(e){try{return new URL(e),!0}catch{return!1}}a(W,"isValidUrl");var w=a(({auth:e,options:r})=>{let t=f(null),{refetch:o}=V({queryKey:["auth"],queryFn:e,enabled:!1}),s=r.isTestingMode?m.partners:"https://gateway.remote.com",c=p.getConfig(),b="0.4.0-alpha.1",d=!!r.proxy&&W(r.proxy.url);return r.proxy&&!d&&console.error("Invalid proxy URL provided. Using default base URL."),f(K({...c,headers:{...c.headers,...d?r.proxy?.headers:{},"X-Client-Name":"remote-flows-sdk","X-Client-Version":b},baseUrl:d?r.proxy?.url:s,auth:a(async()=>{function x(i){return!i||Date.now()+6e4>i}if(a(x,"hasTokenExpired"),!t.current||x(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");var Q=new L;function X({children:e,auth:r,isTestingMode:t,proxy:o}){let s=w({auth:r,options:{isTestingMode:!!t,proxy:o}});return n.createElement(v.Provider,{value:{client:s.current}},e)}a(X,"RemoteFlowContextWrapper");function Y({children:e,components:r}){return n.createElement(g.Provider,{value:r?{components:r}:{components:{}}},e)}a(Y,"FormFieldsProvider");function G({auth:e,children:r,components:t,isTestingMode:o=!1,theme:s,proxy:c}){return n.createElement(q,{client:Q},n.createElement(Y,{components:t},n.createElement(X,{isTestingMode:o,auth:e,proxy:c},n.createElement(h,{theme:s},r))))}a(G,"RemoteFlows");export{Z as ContractAmendmentConfirmationForm,ae as ContractAmendmentFlow,$ as ContractAmendmentForm,H as ContractAmendmentSubmit,S as CostCalculatorDisclaimer,z as CostCalculatorFlow,P as CostCalculatorForm,R as CostCalculatorResetButton,E as CostCalculatorResults,F as CostCalculatorSubmitButton,oe as OnboardingFlow,G as RemoteFlows,te as TerminationFlow,y as buildCostCalculatorEstimationPayload,_ as disclaimerData,T as transformYupErrorsIntoObject,re as useContractAmendment,C as useCostCalculator,k as useCostCalculatorEstimationPdf,J as useEmploymentQuery,ee 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 React, { 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":"o5DAAA,OAAS,eAAAA,EAAa,uBAAAC,MAA2B,wBAEjD,OAAOC,MAAW,QCQlB,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,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AAAC,CACF,CACF,CAAC,EACD,OACEG,EAAA,cAACC,EAAkB,SAAlB,CAA2B,MAAO,CAAE,OAAQH,EAAgB,OAAQ,GAClEJ,CACH,CAEJ,CAlBSQ,EAAAT,EAAA,4BAoBF,SAASU,EAAmB,CACjC,SAAAT,EACA,WAAAU,CACF,EAEI,CACF,OACEJ,EAAA,cAACK,EAAkB,SAAlB,CACC,MAAOD,EAAa,CAAE,WAAAA,CAAW,EAAI,CAAE,WAAY,CAAC,CAAE,GAErDV,CACH,CAEJ,CAbgBQ,EAAAC,EAAA,sBAeT,SAASG,EAAY,CAC1B,KAAAX,EACA,SAAAD,EACA,WAAAU,EACA,cAAAR,EAAgB,GAChB,MAAAW,EACA,MAAAV,CACF,EAA2C,CACzC,OACEG,EAAA,cAACQ,EAAA,CAAoB,OAAQjB,GAC3BS,EAAA,cAACG,EAAA,CAAmB,WAAYC,GAC9BJ,EAAA,cAACP,EAAA,CACC,cAAeG,EACf,KAAMD,EACN,MAAOE,GAEPG,EAAA,cAACS,EAAA,CAAc,MAAOF,GAAQb,CAAS,CACzC,CACF,CACF,CAEJ,CArBgBQ,EAAAI,EAAA","names":["QueryClient","QueryClientProvider","React","setCssProperties","variables","root","v","propertyVal","__name","mapThemeColors","colors","result","key","mapThemeSpacing","spacing","mapThemeBorderRadius","borderRadius","mapThemeFont","font","applyTheme","theme","React","createContext","useEffect","useMemo","ThemeContext","createContext","ThemeProvider","props","useEffect","applyTheme","value","useMemo","React","__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","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","isTestingMode","proxy","remoteApiClient","useAuth","React","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 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 React, { 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":"wwEAAA,OAAS,eAAAA,EAAa,uBAAAC,MAA2B,wBAEjD,OAAOC,MAAW,QCQlB,SAASC,EAAiBC,EAAmC,CAC3D,IAAMC,EAAO,SAAS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K,EAAI,MAAMX,EAAQ,EAC3BW,IACFb,EAAQ,QAAU,CAChB,YAAaa,EAAK,YAClB,UAAW,KAAK,IAAI,EAAIA,EAAK,UAAY,GAC3C,EAEJ,CACA,OAAOb,EAAQ,SAAS,WAC1B,EAdM,OAeR,CAAC,CACH,CACF,EAvDuB,WJjBvB,IAAMc,EAAc,IAAIC,EASxB,SAASC,EAAyB,CAChC,SAAAC,EACA,KAAAC,EACA,cAAAC,EACA,MAAAC,CACF,EAAkC,CAChC,IAAMC,EAAkBC,EAAQ,CAC9B,KAAAJ,EACA,QAAS,CACP,cAAe,CAAC,CAACC,EACjB,MAAAC,CACF,CACF,CAAC,EACD,OACEG,EAAA,cAACC,EAAkB,SAAlB,CAA2B,MAAO,CAAE,OAAQH,EAAgB,OAAQ,GAClEJ,CACH,CAEJ,CAlBSQ,EAAAT,EAAA,4BAoBF,SAASU,EAAmB,CACjC,SAAAT,EACA,WAAAU,CACF,EAEI,CACF,OACEJ,EAAA,cAACK,EAAkB,SAAlB,CACC,MAAOD,EAAa,CAAE,WAAAA,CAAW,EAAI,CAAE,WAAY,CAAC,CAAE,GAErDV,CACH,CAEJ,CAbgBQ,EAAAC,EAAA,sBAeT,SAASG,EAAY,CAC1B,KAAAX,EACA,SAAAD,EACA,WAAAU,EACA,cAAAR,EAAgB,GAChB,MAAAW,EACA,MAAAV,CACF,EAA2C,CACzC,OACEG,EAAA,cAACQ,EAAA,CAAoB,OAAQjB,GAC3BS,EAAA,cAACG,EAAA,CAAmB,WAAYC,GAC9BJ,EAAA,cAACP,EAAA,CACC,cAAeG,EACf,KAAMD,EACN,MAAOE,GAEPG,EAAA,cAACS,EAAA,CAAc,MAAOF,GAAQb,CAAS,CACzC,CACF,CACF,CAEJ,CArBgBQ,EAAAI,EAAA","names":["QueryClient","QueryClientProvider","React","setCssProperties","variables","root","v","propertyVal","__name","mapThemeColors","colors","result","key","mapThemeSpacing","spacing","mapThemeBorderRadius","borderRadius","mapThemeFont","font","applyTheme","theme","React","createContext","useEffect","useMemo","ThemeContext","createContext","ThemeProvider","props","useEffect","applyTheme","value","useMemo","React","__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","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","isTestingMode","proxy","remoteApiClient","useAuth","React","RemoteFlowContext","__name","FormFieldsProvider","components","FormFieldsContext","RemoteFlows","theme","QueryClientProvider","ThemeProvider"]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ControllerRenderProps, FieldValues, ControllerFieldState } from 'react-hook-form';
|
|
3
|
+
import { AnySchema } from 'yup';
|
|
4
|
+
|
|
5
|
+
type ThemeProviderProps = PropsWithChildren<{
|
|
6
|
+
theme?: Partial<{
|
|
7
|
+
colors: ThemeColors;
|
|
8
|
+
spacing: string;
|
|
9
|
+
borderRadius: string;
|
|
10
|
+
font: ThemeFont;
|
|
11
|
+
}>;
|
|
12
|
+
}>;
|
|
13
|
+
type ThemeColors = Partial<{
|
|
14
|
+
borderInput: string;
|
|
15
|
+
primaryBackground: string;
|
|
16
|
+
primaryForeground: string;
|
|
17
|
+
accentBackground: string;
|
|
18
|
+
accentForeground: string;
|
|
19
|
+
danger: string;
|
|
20
|
+
warningBackground: string;
|
|
21
|
+
warningBorder: string;
|
|
22
|
+
}>;
|
|
23
|
+
type ThemeFont = {
|
|
24
|
+
fontSizeBase: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type SupportedTypes = 'text' | 'number' | 'email' | 'select' | 'radio' | 'fieldset' | 'date' | 'checkbox' | 'textarea' | 'money' | 'file' | 'countries';
|
|
28
|
+
|
|
29
|
+
type StatementProps = {
|
|
30
|
+
title?: string;
|
|
31
|
+
description: string;
|
|
32
|
+
severity: 'warning' | 'error' | 'success' | 'info' | 'neutral' | 'time';
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type AuthResponse = {
|
|
36
|
+
accessToken: string;
|
|
37
|
+
expiresIn: number;
|
|
38
|
+
};
|
|
39
|
+
type JSFField = {
|
|
40
|
+
computedAttributes: Record<string, unknown>;
|
|
41
|
+
description: string;
|
|
42
|
+
errorMessage: Record<string, string>;
|
|
43
|
+
inputType: SupportedTypes;
|
|
44
|
+
isVisible: boolean;
|
|
45
|
+
jsonType: string;
|
|
46
|
+
label: string;
|
|
47
|
+
name: string;
|
|
48
|
+
required: boolean;
|
|
49
|
+
schema: AnySchema;
|
|
50
|
+
scopedJsonSchema: Record<string, unknown>;
|
|
51
|
+
type: string;
|
|
52
|
+
options?: Array<{
|
|
53
|
+
value: string;
|
|
54
|
+
label: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
}>;
|
|
57
|
+
defaultValue?: string | number;
|
|
58
|
+
minDate?: string;
|
|
59
|
+
maxLength?: number;
|
|
60
|
+
multiple?: boolean;
|
|
61
|
+
};
|
|
62
|
+
type Components = {
|
|
63
|
+
[K in SupportedTypes]?: React.ComponentType<{
|
|
64
|
+
/**
|
|
65
|
+
* Field prop from React Hook Form's Controller component.
|
|
66
|
+
* Contains field state and methods for registration.
|
|
67
|
+
* @see https://react-hook-form.com/docs/usecontroller/controller
|
|
68
|
+
*/
|
|
69
|
+
field: ControllerRenderProps<FieldValues, string>;
|
|
70
|
+
/**
|
|
71
|
+
* Field state prop from React Hook Form's Controller component.
|
|
72
|
+
* Contains information about the field's state, such as errors, touched status, etc.
|
|
73
|
+
* @see https://react-hook-form.com/docs/usecontroller/controller
|
|
74
|
+
*/
|
|
75
|
+
fieldState: ControllerFieldState;
|
|
76
|
+
/**
|
|
77
|
+
* Metadata derived from JSON schema parsing that provides additional context and validation rules for the field.
|
|
78
|
+
* Contains properties defined in the original JSON schema such as type, format, constraints, etc.
|
|
79
|
+
*/
|
|
80
|
+
fieldData: JSFField;
|
|
81
|
+
}>;
|
|
82
|
+
} & {
|
|
83
|
+
statement?: React.ComponentType<{
|
|
84
|
+
data: StatementProps;
|
|
85
|
+
}>;
|
|
86
|
+
};
|
|
87
|
+
type RemoteFlowsSDKProps = Omit<ThemeProviderProps, 'children'> & {
|
|
88
|
+
/**
|
|
89
|
+
* Function to authenticate the user and obtain an access token.
|
|
90
|
+
* @returns A promise that resolves to an object containing the access token and its expiration time.
|
|
91
|
+
*/
|
|
92
|
+
auth: () => Promise<AuthResponse>;
|
|
93
|
+
/**
|
|
94
|
+
* Components to override the default field components used in the SDK.
|
|
95
|
+
*/
|
|
96
|
+
components?: Components;
|
|
97
|
+
/**
|
|
98
|
+
* Flag to indicate if the SDK is in testing mode and use the testing environment.
|
|
99
|
+
* If true, the SDK will use the testing environment for all API calls.
|
|
100
|
+
*/
|
|
101
|
+
isTestingMode?: boolean;
|
|
102
|
+
proxy?: {
|
|
103
|
+
/**
|
|
104
|
+
* URL of the proxy server to use for API calls.
|
|
105
|
+
*/
|
|
106
|
+
url: string;
|
|
107
|
+
/**
|
|
108
|
+
* Headers to include in the API requests.
|
|
109
|
+
*/
|
|
110
|
+
headers?: {
|
|
111
|
+
[key: string]: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export type { Components as C, RemoteFlowsSDKProps as R };
|
|
@@ -162,6 +162,33 @@ type EmploymentShowResponse = {
|
|
|
162
162
|
};
|
|
163
163
|
};
|
|
164
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Complete information of an employment
|
|
167
|
+
*/
|
|
168
|
+
type EmploymentBasicResponse = {
|
|
169
|
+
/**
|
|
170
|
+
* Employment basic information. As its properties may vary depending on the country,
|
|
171
|
+
* you must query the [Show form schema](#tag/Countries/operation/get_show_form_country) endpoint
|
|
172
|
+
* passing the country code and `basic_information` as path parameters.
|
|
173
|
+
*/
|
|
174
|
+
basic_information?: {
|
|
175
|
+
[key: string]: unknown;
|
|
176
|
+
};
|
|
177
|
+
company_id?: string;
|
|
178
|
+
country_code?: string;
|
|
179
|
+
created_at?: string;
|
|
180
|
+
employment_lifecycle_stage?: EmploymentLifecycleStage;
|
|
181
|
+
full_name?: string;
|
|
182
|
+
id?: UuidSlug;
|
|
183
|
+
job_title?: string;
|
|
184
|
+
personal_email?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Required for employees, optional for contractors
|
|
187
|
+
*/
|
|
188
|
+
provisional_start_date?: string;
|
|
189
|
+
type?: 'employee' | 'contractor';
|
|
190
|
+
updated_at?: string;
|
|
191
|
+
};
|
|
165
192
|
/**
|
|
166
193
|
* Optional UTC date time in YYYY-MM-DDTHH:mm:ss format
|
|
167
194
|
*/
|
|
@@ -491,6 +518,11 @@ type OnboardingTasks = {
|
|
|
491
518
|
personal_details: TaskDescription;
|
|
492
519
|
pricing_plan_details: TaskDescription;
|
|
493
520
|
};
|
|
521
|
+
type EmploymentCreationResponse = {
|
|
522
|
+
data?: {
|
|
523
|
+
employment?: EmploymentBasicResponse;
|
|
524
|
+
};
|
|
525
|
+
};
|
|
494
526
|
/**
|
|
495
527
|
* The status of employment
|
|
496
528
|
*/
|
|
@@ -502,6 +534,12 @@ type CostCalculatorEmployment = {
|
|
|
502
534
|
region: MinimalRegion;
|
|
503
535
|
regional_currency_costs: CostCalculatorCosts;
|
|
504
536
|
};
|
|
537
|
+
type UuidSlug = string;
|
|
538
|
+
type SuccessResponse = {
|
|
539
|
+
data: {
|
|
540
|
+
status?: string;
|
|
541
|
+
};
|
|
542
|
+
};
|
|
505
543
|
type LeavePolicy = {
|
|
506
544
|
leave_policy_variant_slug: string;
|
|
507
545
|
leave_type: TimeoffType;
|
|
@@ -510,6 +548,9 @@ type LeavePolicy = {
|
|
|
510
548
|
type TooManyRequestsResponse = {
|
|
511
549
|
message?: string;
|
|
512
550
|
};
|
|
551
|
+
type ConflictResponse = {
|
|
552
|
+
message?: string;
|
|
553
|
+
};
|
|
513
554
|
/**
|
|
514
555
|
* TimeoffDay schema
|
|
515
556
|
*/
|
|
@@ -687,7 +728,46 @@ type Timeoff = {
|
|
|
687
728
|
timeoff_type: TimeoffType;
|
|
688
729
|
timezone: Timezone;
|
|
689
730
|
};
|
|
731
|
+
/**
|
|
732
|
+
* Description of the basic required and onboarding tasks params to create an employment.
|
|
733
|
+
* You do not need to include all onboarding tasks when creating or updating an employment.
|
|
734
|
+
*
|
|
735
|
+
*/
|
|
736
|
+
type EmploymentCreateParams = {
|
|
737
|
+
/**
|
|
738
|
+
* Employment basic information. As its properties may vary depending on the country,
|
|
739
|
+
* you must query the [Show form schema](#tag/Countries/operation/get_show_form_country) endpoint
|
|
740
|
+
* passing the country code and `employment_basic_information` as path parameters.
|
|
741
|
+
*/
|
|
742
|
+
basic_information: {
|
|
743
|
+
[key: string]: unknown;
|
|
744
|
+
};
|
|
745
|
+
/**
|
|
746
|
+
* This optional field is deprecated.
|
|
747
|
+
*/
|
|
748
|
+
company_id?: string;
|
|
749
|
+
country_code: string;
|
|
750
|
+
/**
|
|
751
|
+
* A unique reference code for the employment record in a non-Remote system. This optional field links to external data sources. If not provided, it defaults to `null`. While uniqueness is recommended, it is not strictly enforced within Remote's system.
|
|
752
|
+
*/
|
|
753
|
+
external_id?: string;
|
|
754
|
+
/**
|
|
755
|
+
* If not provided, it will default to `employee`.
|
|
756
|
+
*/
|
|
757
|
+
type?: 'employee' | 'contractor';
|
|
758
|
+
};
|
|
690
759
|
type TimeoffStatus = 'approved' | 'cancelled' | 'declined' | 'requested' | 'taken' | 'cancel_requested';
|
|
760
|
+
type ForbiddenResponse = {
|
|
761
|
+
message: string;
|
|
762
|
+
};
|
|
763
|
+
/**
|
|
764
|
+
* Complete information of an employment
|
|
765
|
+
*/
|
|
766
|
+
type EmploymentResponse = {
|
|
767
|
+
data: {
|
|
768
|
+
employment?: Employment;
|
|
769
|
+
};
|
|
770
|
+
};
|
|
691
771
|
/**
|
|
692
772
|
* Contract Amendment response
|
|
693
773
|
*/
|
|
@@ -723,6 +803,29 @@ type PostCreateOffboardingErrors = {
|
|
|
723
803
|
500: RequestError;
|
|
724
804
|
};
|
|
725
805
|
type PostCreateOffboardingError = PostCreateOffboardingErrors[keyof PostCreateOffboardingErrors];
|
|
806
|
+
type PostCreateEmployment2Errors = {
|
|
807
|
+
/**
|
|
808
|
+
* Bad Request
|
|
809
|
+
*/
|
|
810
|
+
400: BadRequestResponse;
|
|
811
|
+
/**
|
|
812
|
+
* Unauthorized
|
|
813
|
+
*/
|
|
814
|
+
401: UnauthorizedResponse;
|
|
815
|
+
/**
|
|
816
|
+
* Not Found
|
|
817
|
+
*/
|
|
818
|
+
404: NotFoundResponse;
|
|
819
|
+
/**
|
|
820
|
+
* Unprocessable Entity
|
|
821
|
+
*/
|
|
822
|
+
422: UnprocessableEntityResponse;
|
|
823
|
+
/**
|
|
824
|
+
* Too many requests
|
|
825
|
+
*/
|
|
826
|
+
429: TooManyRequestsResponse;
|
|
827
|
+
};
|
|
828
|
+
type PostCreateEmployment2Error = PostCreateEmployment2Errors[keyof PostCreateEmployment2Errors];
|
|
726
829
|
type PostCreateEstimationErrors = {
|
|
727
830
|
/**
|
|
728
831
|
* Not Found
|
|
@@ -734,6 +837,25 @@ type PostCreateEstimationErrors = {
|
|
|
734
837
|
422: UnprocessableEntityResponse;
|
|
735
838
|
};
|
|
736
839
|
type PostCreateEstimationError = PostCreateEstimationErrors[keyof PostCreateEstimationErrors];
|
|
840
|
+
type PutUpdateBenefitOfferErrors = {
|
|
841
|
+
/**
|
|
842
|
+
* Unauthorized
|
|
843
|
+
*/
|
|
844
|
+
401: UnauthorizedResponse;
|
|
845
|
+
/**
|
|
846
|
+
* Forbidden
|
|
847
|
+
*/
|
|
848
|
+
403: ForbiddenResponse;
|
|
849
|
+
/**
|
|
850
|
+
* Not Found
|
|
851
|
+
*/
|
|
852
|
+
404: NotFoundResponse;
|
|
853
|
+
/**
|
|
854
|
+
* Unprocessable Entity
|
|
855
|
+
*/
|
|
856
|
+
422: UnprocessableEntityResponse;
|
|
857
|
+
};
|
|
858
|
+
type PutUpdateBenefitOfferError = PutUpdateBenefitOfferErrors[keyof PutUpdateBenefitOfferErrors];
|
|
737
859
|
type PostCreateEstimationPdfErrors = {
|
|
738
860
|
/**
|
|
739
861
|
* Not Found
|
|
@@ -760,6 +882,33 @@ type PostCreateContractAmendmentErrors = {
|
|
|
760
882
|
422: UnprocessableEntityResponse;
|
|
761
883
|
};
|
|
762
884
|
type PostCreateContractAmendmentError = PostCreateContractAmendmentErrors[keyof PostCreateContractAmendmentErrors];
|
|
885
|
+
type PatchUpdateEmployment2Errors = {
|
|
886
|
+
/**
|
|
887
|
+
* Bad Request
|
|
888
|
+
*/
|
|
889
|
+
400: BadRequestResponse;
|
|
890
|
+
/**
|
|
891
|
+
* Unauthorized
|
|
892
|
+
*/
|
|
893
|
+
401: UnauthorizedResponse;
|
|
894
|
+
/**
|
|
895
|
+
* Not Found
|
|
896
|
+
*/
|
|
897
|
+
404: NotFoundResponse;
|
|
898
|
+
/**
|
|
899
|
+
* Conflict
|
|
900
|
+
*/
|
|
901
|
+
409: ConflictResponse;
|
|
902
|
+
/**
|
|
903
|
+
* Unprocessable Entity
|
|
904
|
+
*/
|
|
905
|
+
422: UnprocessableEntityResponse;
|
|
906
|
+
/**
|
|
907
|
+
* Too many requests
|
|
908
|
+
*/
|
|
909
|
+
429: TooManyRequestsResponse;
|
|
910
|
+
};
|
|
911
|
+
type PatchUpdateEmployment2Error = PatchUpdateEmployment2Errors[keyof PatchUpdateEmployment2Errors];
|
|
763
912
|
type PostAutomatableContractAmendmentErrors = {
|
|
764
913
|
/**
|
|
765
914
|
* Unauthorized
|
|
@@ -775,5 +924,24 @@ type PostAutomatableContractAmendmentErrors = {
|
|
|
775
924
|
422: UnprocessableEntityResponse;
|
|
776
925
|
};
|
|
777
926
|
type PostAutomatableContractAmendmentError = PostAutomatableContractAmendmentErrors[keyof PostAutomatableContractAmendmentErrors];
|
|
927
|
+
type PostInviteEmploymentInvitationErrors = {
|
|
928
|
+
/**
|
|
929
|
+
* Bad Request
|
|
930
|
+
*/
|
|
931
|
+
400: BadRequestResponse;
|
|
932
|
+
/**
|
|
933
|
+
* Conflict
|
|
934
|
+
*/
|
|
935
|
+
409: ConflictResponse;
|
|
936
|
+
/**
|
|
937
|
+
* Unprocessable Entity
|
|
938
|
+
*/
|
|
939
|
+
422: UnprocessableEntityResponse;
|
|
940
|
+
/**
|
|
941
|
+
* Unprocessable Entity
|
|
942
|
+
*/
|
|
943
|
+
429: TooManyRequestsResponse;
|
|
944
|
+
};
|
|
945
|
+
type PostInviteEmploymentInvitationError = PostInviteEmploymentInvitationErrors[keyof PostInviteEmploymentInvitationErrors];
|
|
778
946
|
|
|
779
|
-
export type { ContractAmendmentAutomatableResponse as C, EmploymentShowResponse as E, ListTimeoffResponse as L, OffboardingResponse as O, PostAutomatableContractAmendmentError as P, TerminationDetailsParams as T, ContractAmendmentResponse as a, PostCreateContractAmendmentError as b,
|
|
947
|
+
export type { ContractAmendmentAutomatableResponse as C, EmploymentShowResponse as E, ListTimeoffResponse as L, OffboardingResponse as O, PostAutomatableContractAmendmentError as P, SuccessResponse as S, TerminationDetailsParams as T, ContractAmendmentResponse as a, PostCreateContractAmendmentError as b, EmploymentCreationResponse as c, PostCreateEmployment2Error as d, EmploymentResponse as e, PatchUpdateEmployment2Error as f, PutUpdateBenefitOfferError as g, PostInviteEmploymentInvitationError as h, EmploymentCreateParams as i, CostCalculatorEstimateResponse as j, PostCreateEstimationError as k, CostCalculatorEstimatePdfResponse as l, PostCreateEstimationPdfError as m, CostCalculatorEstimateParams as n, EmploymentTermType as o, PostCreateOffboardingError as p, TimeoffStatus as q };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remoteoss/remote-flows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-alpha.1",
|
|
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 test",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@hey-api/client-fetch": "^0.8.1",
|
|
54
54
|
"@hookform/resolvers": "^4.1.3",
|
|
55
55
|
"@radix-ui/react-checkbox": "^1.1.4",
|
|
56
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
56
|
+
"@radix-ui/react-dialog": "^1.1.13",
|
|
57
57
|
"@radix-ui/react-label": "^2.1.2",
|
|
58
58
|
"@radix-ui/react-popover": "^1.1.6",
|
|
59
59
|
"@radix-ui/react-radio-group": "^1.2.3",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"@tanstack/react-query": "^5.67.2",
|
|
70
70
|
"class-variance-authority": "^0.7.1",
|
|
71
71
|
"clsx": "^2.1.1",
|
|
72
|
+
"cmdk": "^1.1.1",
|
|
72
73
|
"date-fns": "^3.6.0",
|
|
73
74
|
"dompurify": "^3.2.5",
|
|
74
75
|
"lodash": "^4.17.21",
|
package/dist/chunk-2Y22JKVE.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as o}from"./chunk-JODJFARP.js";import{a as m}from"./chunk-W5DG5WWJ.js";import{a as e}from"./chunk-VX2UC3HG.js";import{a as i}from"./chunk-XSHHMBMT.js";var p={employee_communication:o,termination_details:e,paid_time_off:m,additional_information:i};export{p as a};
|
|
2
|
-
//# sourceMappingURL=chunk-2Y22JKVE.js.map
|
package/dist/chunk-3MAYMGXF.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as v}from"./chunk-WJPC4J3U.js";import{a as S}from"./chunk-JRQSZHUU.js";import{a as l,b as g}from"./chunk-RCX4JUI3.js";import{c as P,f as b,j}from"./chunk-AG27JG4N.js";import{a as k}from"./chunk-S56EWAS4.js";import{d}from"./chunk-WRDKLT4N.js";import{a as w,c as A}from"./chunk-YBACB5A6.js";import{a as e}from"./chunk-AYDF3IFZ.js";import{createHeadlessForm as I,modify as R}from"@remoteoss/json-schema-form";import{useMutation as M,useQuery as J}from"@tanstack/react-query";var K=e(({countryCode:a,employment:t,fieldValues:i,options:n})=>{let{client:u}=d(),s=n?.jsonSchemaVersion?.contract_amendments?{json_schema_version:n.jsonSchemaVersion.contract_amendments}:{};return J({queryKey:["contract-amendment-schema"],retry:!1,queryFn:e(async()=>{let r=await P({client:u,headers:{Authorization:""},query:{employment_id:t?.data?.employment?.id,country_code:a,...s}});if(r.error||!r.data)throw new Error("Failed to fetch contract amendment schema");return r},"queryFn"),enabled:!!t,select:e(({data:r})=>{let c=r?.data||{};if(n&&n.jsfModify){let{schema:p}=R(c,n.jsfModify);c=p}let o={...i,annual_gross_salary:i?.annual_gross_salary?w(i?.annual_gross_salary):void 0},f=Object.keys(o).length>0;return I(c,{initialValues:f?o:g(t)})},"select")})},"useContractAmendmentSchemaQuery"),N=e(()=>{let{client:a}=d();return M({mutationFn:e(t=>b({client:a,headers:{Authorization:""},body:t}),"mutationFn")})},"useCreateContractAmendmentMutation"),U=e(()=>{let{client:a}=d();return M({mutationFn:e(t=>j({client:a,headers:{Authorization:""},body:t}),"mutationFn")})},"useAutomatableContractAmendmentMutation"),re=e(({employmentId:a,countryCode:t,options:i})=>{let{fieldValues:n,setFieldValues:u,stepState:s,nextStep:r,previousStep:c}=k(l),{data:o,isLoading:f,isError:V,error:p}=v({employmentId:a}),T=Object.keys(n).length===0&&Object.keys(s.values?.form||{}).length>0,{data:m,isLoading:L,isError:Q,error:q}=K({employment:o,countryCode:t,fieldValues:T?s.values?.form:n,options:i}),z=g(o,m?.fields),_=N(),F=U();async function O(y){let h=A(y,m?.fields||[],{isPartialValidation:!1}),E={employment_id:o?.data.employment?.id,amendment_contract_id:o?.data.employment?.active_contract_id,contract_amendment:{...h}};switch(s.currentStep.name){case l.form.name:{let{mutateAsync:C}=S(F),H=await C(E);return r(),H}case l.confirmation_form.name:{let{mutateAsync:C}=S(_);return C(E)}default:throw new Error("Invalid step state")}}e(O,"onSubmit");function x(y){if(m){let h=A(y,m?.fields);return m?.handleValidation(h)}return null}e(x,"handleValidation");function B(){c()}return e(B,"back"),{stepState:s,fields:m?.fields||[],isLoading:f||L,isError:V||Q,error:p||q,isSubmitting:F.isPending||_.isPending,initialValues:z,values:n,handleValidation:x,checkFieldUpdates:u,onSubmit:O,back:B}},"useContractAmendment");export{re as a};
|
|
2
|
-
//# sourceMappingURL=chunk-3MAYMGXF.js.map
|