@remoteoss/remote-flows 0.4.0-alpha.2 → 0.4.0-alpha.3
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-2URGWNSM.js +2 -0
- package/dist/chunk-2URGWNSM.js.map +1 -0
- package/dist/chunk-3KAYKVK5.js +2 -0
- package/dist/chunk-3KAYKVK5.js.map +1 -0
- package/dist/{chunk-UIAP5KT2.js → chunk-4N3CYS6F.js} +2 -2
- package/dist/chunk-76JJOA3E.js +2 -0
- package/dist/{chunk-I6NVZI7W.js.map → chunk-76JJOA3E.js.map} +1 -1
- package/dist/chunk-7B32RZXH.js +2 -0
- package/dist/chunk-7B32RZXH.js.map +1 -0
- package/dist/{chunk-SMHHCUP4.js → chunk-C4E24DUG.js} +2 -2
- package/dist/{chunk-PKX5K2UY.js → chunk-DQM4AWYT.js} +2 -2
- package/dist/{chunk-5CJPGBXJ.js → chunk-FNTHWOZU.js} +2 -2
- package/dist/{chunk-CRHTUOZT.js → chunk-JT5XHQEY.js} +2 -2
- package/dist/{chunk-U25ZZ3LM.js → chunk-KGUR7YMA.js} +2 -2
- package/dist/{chunk-5OXN2O6C.js → chunk-MI3HDT5D.js} +2 -2
- package/dist/{chunk-KQ6TGZJS.js → chunk-NVMRRBRE.js} +2 -2
- package/dist/chunk-NVMRRBRE.js.map +1 -0
- package/dist/{chunk-7OMSCFTM.js → chunk-OXOB35EA.js} +2 -2
- package/dist/{chunk-LMDX5IAX.js → chunk-QOXOAPGX.js} +2 -2
- package/dist/{chunk-FZ2HS6G7.js → chunk-S4XU4SE7.js} +1 -1
- package/dist/chunk-S4XU4SE7.js.map +1 -0
- package/dist/{chunk-2YWRQJ7P.js → chunk-SYWI4UB6.js} +2 -2
- package/dist/{chunk-JFOOILST.js → chunk-T3PTQ4QM.js} +2 -2
- package/dist/{chunk-EDNELJVE.js → chunk-TGB3TV3K.js} +2 -2
- package/dist/chunk-TGB3TV3K.js.map +1 -0
- package/dist/{chunk-GR6EY46K.js → chunk-TXLTMGOU.js} +2 -2
- package/dist/chunk-U3I3TJKB.js +2 -0
- package/dist/chunk-U3I3TJKB.js.map +1 -0
- package/dist/{chunk-Y477IGTZ.js → chunk-WZ5AXHQT.js} +2 -2
- package/dist/{chunk-TPPGI73P.js → chunk-XOUAD7MS.js} +2 -2
- package/dist/{chunk-LM5GAAUB.js → chunk-YIBRPAR3.js} +2 -2
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
- package/dist/flows/ContractAmendment/context.d.ts +1 -1
- package/dist/flows/ContractAmendment/hooks.d.ts +1 -1
- package/dist/flows/ContractAmendment/hooks.js +1 -1
- package/dist/flows/ContractAmendment/index.js +1 -1
- package/dist/flows/ContractAmendment/utils.d.ts +1 -1
- package/dist/flows/ContractAmendment/utils.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
- package/dist/flows/CostCalculator/index.js +1 -1
- package/dist/flows/Onboarding/BasicInformationStep.js +1 -1
- package/dist/flows/Onboarding/BenefitsStep.d.ts +1 -1
- package/dist/flows/Onboarding/BenefitsStep.js +1 -1
- package/dist/flows/Onboarding/ContractDetailsStep.js +1 -1
- package/dist/flows/Onboarding/OnboardingFlow.d.ts +2 -1
- package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
- package/dist/flows/Onboarding/OnboardingForm.d.ts +1 -1
- package/dist/flows/Onboarding/OnboardingForm.js +1 -1
- package/dist/flows/Onboarding/OnboardingInvite.js +1 -1
- package/dist/flows/Onboarding/context.d.ts +6 -1
- package/dist/flows/Onboarding/hooks.d.ts +14 -1
- package/dist/flows/Onboarding/hooks.js +1 -1
- package/dist/flows/Onboarding/index.d.ts +2 -1
- package/dist/flows/Onboarding/index.js +1 -1
- package/dist/flows/Onboarding/utils.d.ts +10 -2
- package/dist/flows/Onboarding/utils.js +1 -1
- package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
- package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
- package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
- package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
- package/dist/flows/Termination/TerminationFlow.d.ts +1 -0
- package/dist/flows/Termination/TerminationFlow.js +1 -1
- package/dist/flows/Termination/TerminationForm.js +1 -1
- package/dist/flows/Termination/context.d.ts +2 -1
- package/dist/flows/Termination/hooks.d.ts +2 -1
- package/dist/flows/Termination/hooks.js +1 -1
- package/dist/flows/Termination/index.d.ts +1 -0
- package/dist/flows/Termination/index.js +1 -1
- package/dist/flows/Termination/utils.d.ts +1 -1
- package/dist/flows/Termination/utils.js +1 -1
- package/dist/flows/useStepState.d.ts +10 -4
- package/dist/flows/useStepState.js +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/{remoteFlows-CswYencu.d.ts → remoteFlows-BqpqaWsU.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-2PXGLWCY.js +0 -2
- package/dist/chunk-2PXGLWCY.js.map +0 -1
- package/dist/chunk-EDNELJVE.js.map +0 -1
- package/dist/chunk-FZ2HS6G7.js.map +0 -1
- package/dist/chunk-HDQGO453.js +0 -2
- package/dist/chunk-HDQGO453.js.map +0 -1
- package/dist/chunk-I6NVZI7W.js +0 -2
- package/dist/chunk-KQ6TGZJS.js.map +0 -1
- package/dist/chunk-LCZQVL4U.js +0 -2
- package/dist/chunk-LCZQVL4U.js.map +0 -1
- package/dist/chunk-S56EWAS4.js +0 -2
- package/dist/chunk-S56EWAS4.js.map +0 -1
- /package/dist/{chunk-UIAP5KT2.js.map → chunk-4N3CYS6F.js.map} +0 -0
- /package/dist/{chunk-SMHHCUP4.js.map → chunk-C4E24DUG.js.map} +0 -0
- /package/dist/{chunk-PKX5K2UY.js.map → chunk-DQM4AWYT.js.map} +0 -0
- /package/dist/{chunk-5CJPGBXJ.js.map → chunk-FNTHWOZU.js.map} +0 -0
- /package/dist/{chunk-CRHTUOZT.js.map → chunk-JT5XHQEY.js.map} +0 -0
- /package/dist/{chunk-U25ZZ3LM.js.map → chunk-KGUR7YMA.js.map} +0 -0
- /package/dist/{chunk-5OXN2O6C.js.map → chunk-MI3HDT5D.js.map} +0 -0
- /package/dist/{chunk-7OMSCFTM.js.map → chunk-OXOB35EA.js.map} +0 -0
- /package/dist/{chunk-LMDX5IAX.js.map → chunk-QOXOAPGX.js.map} +0 -0
- /package/dist/{chunk-2YWRQJ7P.js.map → chunk-SYWI4UB6.js.map} +0 -0
- /package/dist/{chunk-JFOOILST.js.map → chunk-T3PTQ4QM.js.map} +0 -0
- /package/dist/{chunk-GR6EY46K.js.map → chunk-TXLTMGOU.js.map} +0 -0
- /package/dist/{chunk-Y477IGTZ.js.map → chunk-WZ5AXHQT.js.map} +0 -0
- /package/dist/{chunk-TPPGI73P.js.map → chunk-XOUAD7MS.js.map} +0 -0
- /package/dist/{chunk-LM5GAAUB.js.map → chunk-YIBRPAR3.js.map} +0 -0
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { Step } from '../useStepState.js';
|
|
2
|
+
import { Fields } from '@remoteoss/json-schema-form';
|
|
2
3
|
import 'react';
|
|
3
4
|
import 'react-hook-form';
|
|
4
5
|
|
|
5
6
|
type StepKeys = 'basic_information' | 'contract_details' | 'benefits' | 'review';
|
|
6
|
-
declare const STEPS: Record<StepKeys, Step
|
|
7
|
+
declare const STEPS: Record<StepKeys, Step<StepKeys>>;
|
|
8
|
+
/**
|
|
9
|
+
* Function to prettify form values. Returns a pretty value and label for each field.
|
|
10
|
+
* @param values - Form values to prettify
|
|
11
|
+
* @param fields - Form fields
|
|
12
|
+
* @returns Prettified form values
|
|
13
|
+
*/
|
|
14
|
+
declare function prettifyFormValues(values: Record<string, unknown>, fields: Fields | undefined): any;
|
|
7
15
|
|
|
8
|
-
export { STEPS };
|
|
16
|
+
export { STEPS, prettifyFormValues };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a,b}from"../../chunk-7B32RZXH.js";import"../../chunk-AYDF3IFZ.js";export{a as STEPS,b as prettifyFormValues};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-WZ5AXHQT.js";import"../../chunk-MI3HDT5D.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-U3I3TJKB.js";import"../../chunk-GFBF55NR.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as AdditionalDetailsForm};
|
|
2
2
|
//# sourceMappingURL=AdditionalDetailsForm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-T3PTQ4QM.js";import"../../chunk-MI3HDT5D.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-U3I3TJKB.js";import"../../chunk-GFBF55NR.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as EmployeeCommunicationForm};
|
|
2
2
|
//# sourceMappingURL=EmployeeComunicationForm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-KGUR7YMA.js";import"../../chunk-MI3HDT5D.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-U3I3TJKB.js";import"../../chunk-GFBF55NR.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as PaidTimeOffForm};
|
|
2
2
|
//# sourceMappingURL=PaidTimeOffForm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-QOXOAPGX.js";import"../../chunk-MI3HDT5D.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-U3I3TJKB.js";import"../../chunk-GFBF55NR.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as TerminationDetailsForm};
|
|
2
2
|
//# sourceMappingURL=TerminationDetailsForm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-TXLTMGOU.js";import"../../chunk-4N3CYS6F.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-S4XU4SE7.js";import"../../chunk-T3PTQ4QM.js";import"../../chunk-KGUR7YMA.js";import"../../chunk-YOC3VDC7.js";import"../../chunk-QOXOAPGX.js";import"../../chunk-KSGPQCSG.js";import"../../chunk-D3SD6MMV.js";import"../../chunk-WZ5AXHQT.js";import"../../chunk-MI3HDT5D.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-36UPHOJS.js";import"../../chunk-QOMUXX6W.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-DHRIURRT.js";import"../../chunk-2URGWNSM.js";import"../../chunk-U3I3TJKB.js";import"../../chunk-GFBF55NR.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-N25EBX6R.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as TerminationFlow};
|
|
2
2
|
//# sourceMappingURL=TerminationFlow.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-MI3HDT5D.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-U3I3TJKB.js";import"../../chunk-GFBF55NR.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as TerminationForm};
|
|
2
2
|
//# sourceMappingURL=TerminationForm.js.map
|
|
@@ -5,6 +5,7 @@ import { E as ErrorResponse, S as SuccessResponse } from '../../mutations-v9H353
|
|
|
5
5
|
import { Step } from '../useStepState.js';
|
|
6
6
|
import { useTermination } from './hooks.js';
|
|
7
7
|
import { TerminationFormValues } from './types.js';
|
|
8
|
+
import { StepTerminationKeys } from './utils.js';
|
|
8
9
|
import 'react-hook-form';
|
|
9
10
|
import '../CostCalculator/types.js';
|
|
10
11
|
|
|
@@ -17,7 +18,7 @@ declare const useTerminationContext: () => {
|
|
|
17
18
|
readonly terminationBag: {
|
|
18
19
|
employmentId: string;
|
|
19
20
|
stepState: {
|
|
20
|
-
currentStep: Step
|
|
21
|
+
currentStep: Step<StepTerminationKeys>;
|
|
21
22
|
totalSteps: number;
|
|
22
23
|
values: {
|
|
23
24
|
paid_time_off: TerminationFormValues;
|
|
@@ -2,6 +2,7 @@ import { O as OffboardingResponse, j as PostCreateOffboardingError } from '../..
|
|
|
2
2
|
import { E as ErrorResponse, S as SuccessResponse } from '../../mutations-v9H353tz.js';
|
|
3
3
|
import * as _remoteoss_json_schema_form from '@remoteoss/json-schema-form';
|
|
4
4
|
import { Step } from '../useStepState.js';
|
|
5
|
+
import { StepTerminationKeys } from './utils.js';
|
|
5
6
|
import { JSFModify } from '../CostCalculator/types.js';
|
|
6
7
|
import { TerminationFormValues } from './types.js';
|
|
7
8
|
import 'react';
|
|
@@ -22,7 +23,7 @@ declare const useTermination: ({ employmentId, options, }: TerminationHookProps)
|
|
|
22
23
|
* Current step state containing the current step and total number of steps
|
|
23
24
|
*/
|
|
24
25
|
stepState: {
|
|
25
|
-
currentStep: Step
|
|
26
|
+
currentStep: Step<StepTerminationKeys>;
|
|
26
27
|
totalSteps: number;
|
|
27
28
|
values: {
|
|
28
29
|
paid_time_off: TerminationFormValues;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-4N3CYS6F.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-S4XU4SE7.js";import"../../chunk-36UPHOJS.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-DHRIURRT.js";import"../../chunk-2URGWNSM.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-N25EBX6R.js";import"../../chunk-AYDF3IFZ.js";export{a as useTermination};
|
|
2
2
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../chunk-M22FKNEY.js";import{a}from"../../chunk-
|
|
1
|
+
import"../../chunk-M22FKNEY.js";import{a}from"../../chunk-TXLTMGOU.js";import"../../chunk-4N3CYS6F.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-S4XU4SE7.js";import"../../chunk-T3PTQ4QM.js";import"../../chunk-KGUR7YMA.js";import"../../chunk-YOC3VDC7.js";import"../../chunk-QOXOAPGX.js";import"../../chunk-KSGPQCSG.js";import"../../chunk-D3SD6MMV.js";import"../../chunk-WZ5AXHQT.js";import"../../chunk-MI3HDT5D.js";import"../../chunk-DZYFSFZ7.js";import"../../chunk-36UPHOJS.js";import"../../chunk-QOMUXX6W.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-DHRIURRT.js";import"../../chunk-2URGWNSM.js";import"../../chunk-U3I3TJKB.js";import"../../chunk-GFBF55NR.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-N25EBX6R.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as TerminationFlow};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,6 +3,6 @@ import 'react';
|
|
|
3
3
|
import 'react-hook-form';
|
|
4
4
|
|
|
5
5
|
type StepTerminationKeys = 'employee_communication' | 'termination_details' | 'paid_time_off' | 'additional_information';
|
|
6
|
-
declare const STEPS: Record<StepTerminationKeys, Step
|
|
6
|
+
declare const STEPS: Record<StepTerminationKeys, Step<StepTerminationKeys>>;
|
|
7
7
|
|
|
8
8
|
export { STEPS, type StepTerminationKeys };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-S4XU4SE7.js";import"../../chunk-AYDF3IFZ.js";export{a as STEPS};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
3
|
|
|
4
|
-
type Step = {
|
|
4
|
+
type Step<T extends string> = {
|
|
5
5
|
index: number;
|
|
6
|
-
name:
|
|
6
|
+
name: T;
|
|
7
7
|
};
|
|
8
8
|
type StepState<T extends string, Fields = FieldValues> = {
|
|
9
|
-
currentStep: Step
|
|
9
|
+
currentStep: Step<T>;
|
|
10
10
|
totalSteps: number;
|
|
11
11
|
values: {
|
|
12
12
|
[key in T]: Fields;
|
|
13
13
|
} | null;
|
|
14
14
|
};
|
|
15
|
-
declare const useStepState: <T extends string, Fields = FieldValues>(steps: Record<T, Step
|
|
15
|
+
declare const useStepState: <T extends string, Fields = FieldValues>(steps: Record<T, Step<T>>) => {
|
|
16
16
|
/**
|
|
17
17
|
* Moves to the next step in the step state.
|
|
18
18
|
* It updates the current step and resets the field values for the next step.
|
|
@@ -33,6 +33,12 @@ declare const useStepState: <T extends string, Fields = FieldValues>(steps: Reco
|
|
|
33
33
|
* @returns {StepState<T>} The current step state.
|
|
34
34
|
*/
|
|
35
35
|
stepState: StepState<T, Fields>;
|
|
36
|
+
/**
|
|
37
|
+
* Goes to a specific step in the step state.
|
|
38
|
+
* @param step The step to go to.
|
|
39
|
+
* @returns {void}
|
|
40
|
+
*/
|
|
41
|
+
goToStep: (step: T) => void;
|
|
36
42
|
/**
|
|
37
43
|
* The field values for the current step.
|
|
38
44
|
* @returns {FieldValues} The field values for the current step.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-2URGWNSM.js";import"../chunk-AYDF3IFZ.js";export{a as useStepState};
|
|
2
2
|
//# sourceMappingURL=useStepState.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -23,8 +23,8 @@ export { C as ContractAmendmentAutomatableResponse, r as CostCalculatorEmploymen
|
|
|
23
23
|
import { ContractAmendmentParams } from './flows/ContractAmendment/types.js';
|
|
24
24
|
import { ValidationError } from 'yup';
|
|
25
25
|
import React__default, { PropsWithChildren } from 'react';
|
|
26
|
-
import { R as RemoteFlowsSDKProps } from './remoteFlows-
|
|
27
|
-
export { C as Components } from './remoteFlows-
|
|
26
|
+
import { R as RemoteFlowsSDKProps } from './remoteFlows-BqpqaWsU.js';
|
|
27
|
+
export { C as Components } from './remoteFlows-BqpqaWsU.js';
|
|
28
28
|
import './flows/types.js';
|
|
29
29
|
import '@remoteoss/json-schema-form';
|
|
30
30
|
import 'react-hook-form';
|
|
@@ -32,6 +32,7 @@ import './flows/ContractAmendment/ContractAmendmentBack.js';
|
|
|
32
32
|
import './mutations-v9H353tz.js';
|
|
33
33
|
import './flows/useStepState.js';
|
|
34
34
|
import './flows/Termination/hooks.js';
|
|
35
|
+
import './flows/Termination/utils.js';
|
|
35
36
|
import './flows/Termination/TerminationSubmit.js';
|
|
36
37
|
import './flows/Termination/TimeOff.js';
|
|
37
38
|
import './flows/Termination/TerminationBack.js';
|
|
@@ -40,6 +41,7 @@ import './flows/Termination/TerminationDetailsForm.js';
|
|
|
40
41
|
import './flows/Termination/PaidTimeOffForm.js';
|
|
41
42
|
import './flows/Termination/AdditionalDetailsForm.js';
|
|
42
43
|
import './flows/Onboarding/hooks.js';
|
|
44
|
+
import './flows/Onboarding/utils.js';
|
|
43
45
|
import './flows/Onboarding/BasicInformationStep.js';
|
|
44
46
|
import './flows/Onboarding/OnboardingSubmit.js';
|
|
45
47
|
import './flows/Onboarding/OnboardingBack.js';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-M22FKNEY.js";import{a as te}from"./chunk-
|
|
1
|
+
import"./chunk-M22FKNEY.js";import{a as te}from"./chunk-TXLTMGOU.js";import"./chunk-4N3CYS6F.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-S4XU4SE7.js";import"./chunk-T3PTQ4QM.js";import"./chunk-KGUR7YMA.js";import"./chunk-YOC3VDC7.js";import"./chunk-QOXOAPGX.js";import"./chunk-KSGPQCSG.js";import"./chunk-D3SD6MMV.js";import"./chunk-GULCZWSK.js";import"./chunk-WZ5AXHQT.js";import"./chunk-MI3HDT5D.js";import"./chunk-DZYFSFZ7.js";import{a as oe}from"./chunk-DQM4AWYT.js";import"./chunk-SYWI4UB6.js";import"./chunk-MHKNAQLP.js";import"./chunk-3KAYKVK5.js";import"./chunk-7B32RZXH.js";import"./chunk-YIBRPAR3.js";import"./chunk-FNTHWOZU.js";import"./chunk-OXOB35EA.js";import"./chunk-M7WCW7WD.js";import"./chunk-76JJOA3E.js";import"./chunk-WS3C3WIJ.js";import"./chunk-FGBEOUQK.js";import{a as S}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{a as P}from"./chunk-XOUAD7MS.js";import{a as R}from"./chunk-7CYG2RHP.js";import{a as F}from"./chunk-EAAIAMTY.js";import"./chunk-A7ZJQCNU.js";import{a as E}from"./chunk-DGPRFQYK.js";import{a as _}from"./chunk-DYB3RWP7.js";import{a as z}from"./chunk-GQD6NNYO.js";import"./chunk-OLJ2S6A6.js";import{b as y,c as k,e as C}from"./chunk-P2COURSU.js";import"./chunk-UPRUP24B.js";import"./chunk-36UPHOJS.js";import{a as ae}from"./chunk-C4E24DUG.js";import{a as H}from"./chunk-XLFHHYVS.js";import{a as re}from"./chunk-TGB3TV3K.js";import{a as J,b as ee}from"./chunk-QOMUXX6W.js";import"./chunk-JRQSZHUU.js";import"./chunk-NVMRRBRE.js";import{a as p}from"./chunk-DHRIURRT.js";import"./chunk-2URGWNSM.js";import"./chunk-FMT2OTOL.js";import{a as Z}from"./chunk-BLPOQIGB.js";import{a as $}from"./chunk-JT5XHQEY.js";import"./chunk-U3I3TJKB.js";import"./chunk-GFBF55NR.js";import"./chunk-A4RX3KRZ.js";import{a as g,c as v}from"./chunk-WRDKLT4N.js";import"./chunk-56BNVYTD.js";import"./chunk-IDSJI7KQ.js";import"./chunk-N25EBX6R.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.3",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,E as CostCalculatorDisclaimer,z as CostCalculatorFlow,P as CostCalculatorForm,R as CostCalculatorResetButton,S 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
|
|
@@ -24,7 +24,7 @@ type ThemeFont = {
|
|
|
24
24
|
fontSizeBase: string;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
type SupportedTypes = 'text' | 'number' | 'email' | 'select' | 'radio' | 'fieldset' | 'date' | 'checkbox' | 'textarea' | 'money' | 'file' | 'countries';
|
|
27
|
+
type SupportedTypes = 'text' | 'number' | 'email' | 'select' | 'radio' | 'fieldset' | 'date' | 'checkbox' | 'textarea' | 'money' | 'file' | 'countries' | 'hidden';
|
|
28
28
|
|
|
29
29
|
type StatementProps = {
|
|
30
30
|
title?: string;
|
package/package.json
CHANGED
package/dist/chunk-2PXGLWCY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flows/Onboarding/utils.ts"],"sourcesContent":["import { Step } from '@/src/flows/useStepState';\n\ntype StepKeys =\n | 'basic_information'\n | 'contract_details'\n | 'benefits'\n | 'review';\n\nexport const STEPS: Record<StepKeys, Step> = {\n basic_information: { index: 0, name: 'basic_information' },\n contract_details: { index: 1, name: 'contract_details' },\n benefits: { index: 2, name: 'benefits' },\n review: { index: 3, name: 'review' },\n} as const;\n"],"mappings":"AAQO,IAAMA,EAAgC,CAC3C,kBAAmB,CAAE,MAAO,EAAG,KAAM,mBAAoB,EACzD,iBAAkB,CAAE,MAAO,EAAG,KAAM,kBAAmB,EACvD,SAAU,CAAE,MAAO,EAAG,KAAM,UAAW,EACvC,OAAQ,CAAE,MAAO,EAAG,KAAM,QAAS,CACrC","names":["STEPS"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flows/ContractAmendment/hooks.ts"],"sourcesContent":["import {\n CreateContractAmendmentParams,\n EmploymentShowResponse,\n getShowContractAmendmentSchema,\n postAutomatableContractAmendment,\n postCreateContractAmendment,\n} from '@/src/client';\n\nimport {\n convertToCents,\n parseJSFToValidate,\n} from '@/src/components/form/utils';\nimport { mutationToPromise } from '@/src/lib/mutations';\n\nimport { Client } from '@hey-api/client-fetch';\nimport { createHeadlessForm, modify } from '@remoteoss/json-schema-form';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { ContractAmendmentParams } from './types';\n\nimport { useEmploymentQuery } from '@/src/common/hooks';\nimport { useClient } from '@/src/context';\nimport { FieldValues } from 'react-hook-form';\nimport { useStepState } from '../useStepState';\nimport { buildInitialValues, STEPS } from './utils';\n\ntype ContractAmendmentSchemaParams = {\n countryCode: string;\n employment: EmploymentShowResponse | undefined;\n fieldValues: FieldValues | undefined;\n options?: ContractAmendmentParams['options'];\n};\n\nconst useContractAmendmentSchemaQuery = ({\n countryCode,\n employment,\n fieldValues,\n options,\n}: ContractAmendmentSchemaParams) => {\n const { client } = useClient();\n const jsonSchemaQueryParam = options?.jsonSchemaVersion?.contract_amendments\n ? {\n json_schema_version: options.jsonSchemaVersion.contract_amendments,\n }\n : {};\n return useQuery({\n queryKey: ['contract-amendment-schema'],\n retry: false,\n queryFn: async () => {\n const response = await getShowContractAmendmentSchema({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n query: {\n employment_id: employment?.data?.employment?.id as string,\n country_code: countryCode,\n ...jsonSchemaQueryParam,\n },\n });\n\n // If response status is 404 or other error, throw an error to trigger isError\n if (response.error || !response.data) {\n throw new Error('Failed to fetch contract amendment schema');\n }\n\n return response;\n },\n enabled: Boolean(employment),\n select: ({ data }) => {\n let jsfSchema = data?.data || {};\n\n if (options && options.jsfModify) {\n const { schema } = modify(jsfSchema, options.jsfModify);\n jsfSchema = schema;\n }\n\n const copyFieldValues = {\n ...fieldValues,\n annual_gross_salary: fieldValues?.annual_gross_salary\n ? convertToCents(fieldValues?.annual_gross_salary)\n : undefined,\n };\n\n const hasFieldValues = Object.keys(copyFieldValues).length > 0;\n\n const result = createHeadlessForm(jsfSchema, {\n initialValues: hasFieldValues\n ? copyFieldValues\n : buildInitialValues(employment),\n });\n return result;\n },\n });\n};\n\nconst useCreateContractAmendmentMutation = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateContractAmendmentParams) => {\n return postCreateContractAmendment({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nconst useAutomatableContractAmendmentMutation = () => {\n const { client } = useClient();\n return useMutation({\n mutationFn: (payload: CreateContractAmendmentParams) => {\n return postAutomatableContractAmendment({\n client: client as Client,\n headers: {\n Authorization: ``,\n },\n body: payload,\n });\n },\n });\n};\n\nexport const useContractAmendment = ({\n employmentId,\n countryCode,\n options,\n}: ContractAmendmentParams) => {\n const { fieldValues, setFieldValues, stepState, nextStep, previousStep } =\n useStepState<keyof typeof STEPS>(STEPS);\n\n const {\n data: employment,\n isLoading: isLoadingEmployment,\n isError: isErrorEmployment,\n error: errorEmployment,\n } = useEmploymentQuery({\n employmentId,\n });\n\n const {\n data: contractAmendmentHeadlessForm,\n isLoading: isLoadingContractAmendments,\n isError: isErrorContractAmendmentSchema,\n error: errorContractAmendmentSchema,\n } = useContractAmendmentSchemaQuery({\n employment,\n countryCode,\n // In case the user is navigating back to the form step, we need to\n // pass the previous field values, so that the schema can be\n // generated with the correct values.\n fieldValues: {\n ...stepState.values?.[stepState.currentStep.name as keyof typeof STEPS], // Restore values for the current step\n ...fieldValues,\n },\n options,\n });\n\n const initialValues = buildInitialValues(\n employment,\n contractAmendmentHeadlessForm?.fields,\n );\n\n const createContractAmendmentMutation = useCreateContractAmendmentMutation();\n const automatableContractAmendmentMutation =\n useAutomatableContractAmendmentMutation();\n\n async function onSubmit(values: FieldValues) {\n const parsedValues = parseJSFToValidate(\n values,\n contractAmendmentHeadlessForm?.fields || [],\n {\n isPartialValidation: false,\n },\n );\n\n const payload = {\n employment_id: employment?.data.employment?.id as string,\n amendment_contract_id: employment?.data.employment\n ?.active_contract_id as string,\n contract_amendment: {\n ...parsedValues,\n },\n };\n\n switch (stepState.currentStep.name) {\n case STEPS.form.name: {\n const { mutateAsync } = mutationToPromise(\n automatableContractAmendmentMutation,\n );\n\n const automatableContractAmendment = await mutateAsync(payload);\n\n nextStep();\n\n return automatableContractAmendment;\n }\n case STEPS.confirmation_form.name: {\n const { mutateAsync } = mutationToPromise(\n createContractAmendmentMutation,\n );\n\n return mutateAsync(payload);\n }\n\n default:\n throw new Error('Invalid step state');\n }\n }\n\n function handleValidation(values: FieldValues) {\n if (contractAmendmentHeadlessForm) {\n const parsedValues = parseJSFToValidate(\n values,\n contractAmendmentHeadlessForm?.fields,\n );\n\n return contractAmendmentHeadlessForm?.handleValidation(parsedValues);\n }\n return null;\n }\n\n function back() {\n previousStep();\n }\n\n return {\n /**\n * Current step state containing the current step and total number of steps\n */\n stepState,\n /**\n * Array of form fields from the contract amendment schema\n */\n fields: contractAmendmentHeadlessForm?.fields || [],\n /**\n * Loading state indicating if either employment or contract amendment data is being fetched\n */\n isLoading: isLoadingEmployment || isLoadingContractAmendments,\n /**\n * Error state indicating if there was an error fetching either employment or contract amendment data\n */\n isError: isErrorEmployment || isErrorContractAmendmentSchema,\n /**\n * Error object containing details about any errors that occurred during data fetching\n */\n error: errorEmployment || errorContractAmendmentSchema,\n /**\n * Loading state indicating if a contract amendment mutation is in progress\n */\n isSubmitting:\n automatableContractAmendmentMutation.isPending ||\n createContractAmendmentMutation.isPending,\n /**\n * Initial form values built from employment data and contract amendment fields\n */\n initialValues,\n /**\n * Current form field values\n */\n values: fieldValues,\n /**\n * Function to validate form values against the contract amendment schema\n * @param values - Form values to validate\n * @returns Validation result or null if no schema is available\n */\n handleValidation,\n /**\n * Function to update the current form field values\n * @param values - New form values to set\n */\n checkFieldUpdates: setFieldValues,\n /**\n * Function to handle form submission\n * @param values - Form values to submit\n * @returns Promise resolving to the mutation result\n */\n onSubmit,\n /**\n * Function to handle going back to the previous step\n * @returns {void}\n */\n back,\n };\n};\n"],"mappings":"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","names":["createHeadlessForm","modify","useMutation","useQuery","useContractAmendmentSchemaQuery","__name","countryCode","employment","fieldValues","options","client","useClient","jsonSchemaQueryParam","useQuery","response","getShowContractAmendmentSchema","data","jsfSchema","schema","modify","copyFieldValues","convertToCents","hasFieldValues","createHeadlessForm","buildInitialValues","useCreateContractAmendmentMutation","useMutation","payload","postCreateContractAmendment","useAutomatableContractAmendmentMutation","postAutomatableContractAmendment","useContractAmendment","employmentId","setFieldValues","stepState","nextStep","previousStep","useStepState","STEPS","isLoadingEmployment","isErrorEmployment","errorEmployment","useEmploymentQuery","contractAmendmentHeadlessForm","isLoadingContractAmendments","isErrorContractAmendmentSchema","errorContractAmendmentSchema","initialValues","createContractAmendmentMutation","automatableContractAmendmentMutation","onSubmit","values","parsedValues","parseJSFToValidate","mutateAsync","mutationToPromise","automatableContractAmendment","handleValidation","back"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flows/Termination/utils.ts"],"sourcesContent":["import { Step } from '@/src/flows/useStepState';\n\nexport type StepTerminationKeys =\n | 'employee_communication'\n | 'termination_details'\n | 'paid_time_off'\n | 'additional_information';\n\nexport const STEPS: Record<StepTerminationKeys, Step> = {\n employee_communication: { index: 0, name: 'employee_communication' },\n termination_details: { index: 1, name: 'termination_details' },\n paid_time_off: { index: 2, name: 'paid_time_off' },\n additional_information: { index: 3, name: 'additional_information' },\n} as const;\n"],"mappings":"AAQO,IAAMA,EAA2C,CACtD,uBAAwB,CAAE,MAAO,EAAG,KAAM,wBAAyB,EACnE,oBAAqB,CAAE,MAAO,EAAG,KAAM,qBAAsB,EAC7D,cAAe,CAAE,MAAO,EAAG,KAAM,eAAgB,EACjD,uBAAwB,CAAE,MAAO,EAAG,KAAM,wBAAyB,CACrE","names":["STEPS"]}
|
package/dist/chunk-HDQGO453.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as ge}from"./chunk-GFBF55NR.js";import{b as F}from"./chunk-WRDKLT4N.js";import{a as me,b as J}from"./chunk-56BNVYTD.js";import{b as y,c as N,d as h,e as w,f as R,g as k}from"./chunk-IDSJI7KQ.js";import{a as s}from"./chunk-5ETXP2QF.js";import{a as r}from"./chunk-AYDF3IFZ.js";import U,{Fragment as At}from"react";import*as j from"react";import*as q from"@radix-ui/react-checkbox";import{Check as Ze}from"lucide-react";var te=j.forwardRef(({className:e,...t},o)=>j.createElement(q.Root,{ref:o,className:s("peer h-4 w-4 shrink-0 rounded-sm border border-input ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-checkbox data-[state=checked]:text-primary",e),...t},j.createElement(q.Indicator,{className:s("flex items-center justify-center text-current")},j.createElement(Ze,{className:"h-4 w-4"}))));te.displayName=q.Root.displayName;import*as D from"react";import{useFormContext as et}from"react-hook-form";function Fe({name:e,defaultValue:t,description:o,label:a,onChange:i,multiple:d,options:p,component:x,...C}){let{components:n}=F(),{control:c}=et(),u=r((m,l,g)=>{let _=g.value?[...g.value]:[];l?_.includes(m)||g.onChange([..._,m]):g.onChange(_.filter(z=>z!==m))},"handleCheckboxChange");return D.createElement(y,{control:c,name:e,defaultValue:t,render:({field:m,fieldState:l})=>{let g=x||n?.checkbox;if(g){let _={name:e,description:o,label:a,defaultValue:t,multiple:d,options:p,...C};return D.createElement(g,{field:{...m,onChange:r(z=>{if(d){let{checked:ee,value:I}=z.target;u(I,ee,m),i?.(ee);return}m.onChange(z),i?.(z)},"onChange")},fieldState:l,fieldData:_})}return D.createElement(N,{"data-field":e,className:s(`RemoteFlows__CheckBoxField__Item__${e}`)},D.createElement(w,null,D.createElement(D.Fragment,null,p&&d?D.createElement(h,null,a):null,p&&d?p.map(_=>D.createElement("div",{key:_.value,className:"flex space-x-2"},D.createElement(te,{id:_.value,onCheckedChange:z=>{u(_.value,z===!0,m),i?.(z,_.value)},checked:m.value?.includes(_.value),className:"RemoteFlows__CheckBox__Input"}),D.createElement(h,{htmlFor:_.value,className:"mb-0 RemoteFlows__CheckBox__Label"},_.label))):D.createElement("div",{className:"flex space-x-2"},D.createElement(te,{id:e,onCheckedChange:_=>{m.onChange(_),i?.(_)},checked:m.value,className:"RemoteFlows__CheckBox__Input"}),D.createElement(h,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label"},a)))),o&&D.createElement(R,null,o),l.error&&D.createElement(k,null))}})}r(Fe,"CheckBoxField");import{CalendarIcon as at}from"lucide-react";import*as P from"react";import{useFormContext as nt}from"react-hook-form";import*as oe from"react";import{ChevronLeft as tt,ChevronRight as ot}from"lucide-react";import{DayPicker as rt}from"react-day-picker";function ve({className:e,classNames:t,showOutsideDays:o=!0,...a}){return oe.createElement(rt,{showOutsideDays:o,className:s("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:s(me({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:s("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",a.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:s(me({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:r(({className:i,...d})=>oe.createElement(tt,{className:s("size-4",i),...d}),"IconLeft"),IconRight:r(({className:i,...d})=>oe.createElement(ot,{className:s("size-4",i),...d}),"IconRight")},...a})}r(ve,"Calendar");import*as Y from"react";import*as B from"@radix-ui/react-popover";function re({...e}){return Y.createElement(B.Root,{"data-slot":"popover",...e})}r(re,"Popover");function ae({...e}){return Y.createElement(B.Trigger,{"data-slot":"popover-trigger",...e})}r(ae,"PopoverTrigger");function ne({className:e,align:t="center",sideOffset:o=4,...a}){return Y.createElement(B.Portal,null,Y.createElement(B.Content,{"data-slot":"popover-content",align:t,sideOffset:o,className:s("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...a}))}r(ne,"PopoverContent");import{PopoverClose as it}from"@radix-ui/react-popover";import{format as xe}from"date-fns";function Ce({description:e,label:t,name:o,minDate:a,onChange:i,component:d,...p}){let{components:x}=F(),{control:C}=nt();return P.createElement(y,{control:C,name:o,render:({field:n,fieldState:c})=>{let u=d||x?.date;if(u){let m={description:e,label:t,name:o,minDate:a,onChange:i,...p};return P.createElement(u,{field:{...n,onChange:r(l=>{n.onChange(l),i?.(l)},"onChange")},fieldState:c,fieldData:m})}return P.createElement(N,{"data-field":o,className:`flex flex-col RemoteFlows__DatePickerField__Item__${o}`},P.createElement(h,{className:"RemoteFlows__DatePickerField__Label"},t),P.createElement(re,null,P.createElement(ae,{asChild:!0},P.createElement(w,null,P.createElement("div",null,P.createElement(J,{type:"button",variant:"outline",className:s("w-full pl-3 text-left font-normal",!n.value&&"text-muted-foreground"),"data-testid":`date-picker-button-${o}`},n.value&&P.createElement(P.Fragment,null,xe(n.value,"yyyy-MM-dd")),P.createElement(at,{className:"ml-auto h-4 w-4 opacity-50"}))))),P.createElement(ne,{className:"w-auto p-0 RemoteFlows__DatepickerField__PopoverContent",align:"start"},P.createElement(ve,{mode:"single",className:"RemoteFlows__DatepickerField__Calendar",selected:n.value?new Date(n.value):void 0,onSelect:m=>{n.onChange(m?xe(m,"yyyy-MM-dd"):null),i?.(m)},defaultMonth:a?new Date(a):void 0,components:{DayContent:r(m=>P.createElement(it,null,m.date.getDate()),"DayContent")},...a&&{disabled:r(m=>m<new Date(a),"disabled")}}))),e?P.createElement(R,null,e):null,c.error&&P.createElement(k,{className:"RemoteFlows__DatePickerField__Error"}))}})}r(Ce,"DatePickerField");import*as $ from"react";function ye({label:e,name:t,fields:o,description:a,components:i}){return $.createElement("fieldset",{className:s("border-1 border-input p-4 rounded-xl",`RemoteFlows__FieldSetField__${t}`)},$.createElement("legend",{className:"text-sm font-semibold px-2"},e),a?$.createElement("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:a}}):null,$.createElement("div",{className:"grid gap-4"},o.map(d=>{let p=ie[d.type];return d.isVisible===!1||d.deprecated?null:$.createElement(p,{...d,key:d.name,name:`${t}.${d.name}`,component:i?.[d.type]})})))}r(ye,"FieldSetField");import*as E from"react";import{useFormContext as ct}from"react-hook-form";import L,{useState as st,useRef as lt}from"react";import{Upload as mt,X as dt}from"lucide-react";function _e({onChange:e,className:t,multiple:o}){let[a,i]=st([]),d=lt(null),p=r(n=>{n.preventDefault(),d.current?.click()},"handleClick"),x=r(n=>{if(n.target.files&&n.target.files.length>0){let c=Array.from(n.target.files);i(c),e(n)}},"handleChange"),C=r(n=>{i(c=>c.filter(u=>u!==n))},"onRemoveFile");return L.createElement("div",{className:s("flex flex-col items-start gap-4",t)},L.createElement("input",{type:"file",ref:d,onChange:x,className:"hidden","aria-label":"File upload",multiple:o}),L.createElement(J,{type:"button",onClick:p,className:"gap-2"},L.createElement(mt,{className:"h-4 w-4"}),"Choose File"),a.length===0&&L.createElement("div",{className:"text-sm"},o?L.createElement("span",{className:"font-medium"},"No files selected. You can select multiple files"):L.createElement("span",{className:"font-medium"},"No file selected.")),a.length>0&&a.map((n,c)=>L.createElement("div",{key:c,className:"text-sm flex items-center gap-2"},"Selected file: ",L.createElement("span",{className:"font-medium"},n.name)," (",Math.round(n.size/1024)," KB)",L.createElement(J,{variant:"ghost",onClick:()=>C(n)},L.createElement(dt,null)))))}r(_e,"FileUploader");var pt=r(e=>new Promise((t,o)=>{let a=new FileReader;a.readAsDataURL(e),a.onload=()=>t(a.result),a.onerror=i=>o(i)}),"toBase64"),he=r(async e=>{let t=e.target.files?Array.from(e.target.files):[];return await Promise.all(t.map(async a=>{let i=await pt(a);return{name:a.name,content:i.split(",")[1]}}))},"convertFilesToBase64");function Pe({name:e,description:t,label:o,multiple:a,onChange:i,component:d,...p}){let{components:x}=F(),{control:C}=ct();return E.createElement(y,{control:C,name:e,render:({field:n,fieldState:c})=>{let u=d||x?.file;if(u){let m={name:e,description:t,label:o,multiple:a,...p};return E.createElement(u,{field:{...n,value:null,onChange:r(async l=>{let g=await he(l);n.onChange(g),i?.(g)},"onChange")},fieldState:c,fieldData:m})}return E.createElement(N,{"data-field":e,className:`RemoteFlows__FileUpload__Item__${e}`},E.createElement(h,{className:"RemoteFlows__FileUpload__Label"},o),E.createElement(w,null,E.createElement(_e,{onChange:async m=>{let l=await he(m);n.onChange(l),i?.(l)},multiple:a,className:s("RemoteFlows__FileUpload__Input")})),t&&E.createElement("div",{className:"flex items-center justify-between"},E.createElement(R,{className:"RemoteFlows__FileUpload__Description"},t)),c.error&&E.createElement(k,{className:"RemoteFlows__FileUpload__Error"}))}})}r(Pe,"FileUploadField");import de from"react";import{useFormContext as ft}from"react-hook-form";import*as G from"react";import{useFormContext as ut}from"react-hook-form";import*as be from"react";function Se({className:e,type:t,...o}){return be.createElement("input",{type:t,"data-slot":"input",className:s("shadow-xs border-input file:text-foreground placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-xl border bg-transparent px-4 py-7 text-sm transition-[color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-focused","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...o})}r(Se,"Input");function W({name:e,description:t,label:o,type:a,onChange:i,component:d,...p}){let{components:x}=F(),{control:C}=ut();return G.createElement(y,{control:C,name:e,render:({field:n,fieldState:c})=>{let u=d||x?.text;if(u){let m={name:e,description:t,label:o,type:a,onChange:i,...p};return G.createElement(u,{field:{...n,onChange:r(l=>{n.onChange(l),i?.(l)},"onChange")},fieldState:c,fieldData:m})}return G.createElement(N,{"data-field":e,className:`RemoteFlows__TextField__Item__${e}`},G.createElement(h,{className:"RemoteFlows__TextField__Label"},o),G.createElement(w,null,G.createElement(Se,{...n,value:n.value??"",onChange:m=>{n.onChange(m),i?.(m)},className:"RemoteFlows__TextField__Input",placeholder:o})),t&&G.createElement(R,{className:"RemoteFlows__TextField__Description"},t),c.error&&G.createElement(k,{className:"RemoteFlows__TextField__Error"}))}})}r(W,"TextField");function ce(e){let{components:t}=F(),{control:o}=ft(),a=e.component||t?.number;return a?de.createElement(y,{control:o,name:e.name,render:({field:i,fieldState:d})=>de.createElement(a,{field:{...i,onChange:r(p=>{i.onChange(p),e.onChange?.(p)},"onChange")},fieldState:d,fieldData:e})}):de.createElement(W,{...e,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$"})}r(ce,"NumberField");import*as X from"@radix-ui/react-radio-group";import{CircleIcon as gt}from"lucide-react";import*as Q from"react";function Ne({className:e,...t}){return Q.createElement(X.Root,{"data-slot":"radio-group",className:s("grid gap-3",e),...t})}r(Ne,"RadioGroup");function we({className:e,...t}){return Q.createElement(X.Item,{"data-slot":"radio-group-item",className:s("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t},Q.createElement(X.Indicator,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center"},Q.createElement(gt,{className:"fill-radio absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})))}r(we,"RadioGroupItem");import*as b from"react";import{useFormContext as Ft}from"react-hook-form";function Re({name:e,defaultValue:t,description:o,label:a,options:i,onChange:d,component:p,...x}){let{components:C}=F(),{control:n}=Ft();return b.createElement(y,{control:n,name:e,defaultValue:t,render:({field:c,fieldState:u})=>{let m=p||C?.radio;if(m){let l={name:e,defaultValue:t,description:o,label:a,options:i,...x};return b.createElement(m,{field:{...c,onChange:r(g=>{c.onChange(g),d?.(g)},"onChange")},fieldState:u,fieldData:l})}return b.createElement(N,{className:s("space-y-3",`RemoteFlows__RadioGroupField__Item__${e}`),"data-field":e},b.createElement(h,null,a),b.createElement(w,null,b.createElement(Ne,{"aria-label":a||e,onValueChange:l=>{c.onChange(l),d?.(l)},value:c.value,className:"flex flex-col space-y-3"},i?.map(l=>b.createElement(b.Fragment,null,b.createElement(N,{key:l.value,"data-field":e,className:"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item"},b.createElement(w,null,b.createElement(we,{value:l.value,className:"RemoteFlows__RadioField__Input"})),b.createElement("div",null,b.createElement(h,{className:"font-normal mb-0 RemoteFlows__RadioField__Label"},l.label),l.description&&b.createElement(R,{className:"mt-2"},l.description))))))),o&&b.createElement(R,null,o),u.error&&b.createElement(k,null))}})}r(Re,"RadioGroupField");import*as T from"react";import*as v from"react";import*as f from"@radix-ui/react-select";import{CheckIcon as vt,ChevronDownIcon as De,ChevronUpIcon as xt}from"lucide-react";function ke({...e}){return v.createElement(f.Root,{"data-slot":"select",...e})}r(ke,"Select");function Te({...e}){return v.createElement(f.Group,{"data-slot":"select-group",...e})}r(Te,"SelectGroup");function Ie({...e}){return v.createElement(f.Value,{"data-slot":"select-value",...e})}r(Ie,"SelectValue");function Le({className:e,children:t,...o}){return v.createElement(f.Trigger,{"data-slot":"select-trigger",className:s("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-full items-center justify-between rounded-xl border bg-transparent px-4 py-7 text-sm whitespace-nowrap transition-[color] outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","focus-visible:border-focused",e),...o},t,v.createElement(f.Icon,{asChild:!0,className:"absolute right-4"},v.createElement(De,{className:"size-4"})))}r(Le,"SelectTrigger");function Me({className:e,children:t,position:o="popper",...a}){return v.createElement(f.Portal,null,v.createElement(f.Content,{"data-slot":"select-content",className:s("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:o,...a},v.createElement(Ct,null),v.createElement(f.Viewport,{className:s(o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1")},t),v.createElement(yt,null)))}r(Me,"SelectContent");function ze({className:e,children:t,...o}){return v.createElement(f.Item,{"data-slot":"select-item",className:s("focus:bg-accent focus:text-accent-foreground min-h-11 justify-between [&_svg:not([class*='text-'])]:text-muted-foreground flex w-full cursor-default items-center gap-2 py-2 px-4 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...o},v.createElement(f.ItemText,null,t),v.createElement("span",{className:"flex size-3.5 items-center justify-center"},v.createElement(f.ItemIndicator,null,v.createElement(vt,{className:"size-4"}))))}r(ze,"SelectItem");function Ct({className:e,...t}){return v.createElement(f.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:s("flex cursor-default items-center justify-center py-1",e),...t},v.createElement(xt,{className:"size-4"}))}r(Ct,"SelectScrollUpButton");function yt({className:e,...t}){return v.createElement(f.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:s("flex cursor-default items-center justify-center py-1",e),...t},v.createElement(De,{className:"size-4"}))}r(yt,"SelectScrollDownButton");import{useFormContext as _t}from"react-hook-form";function Ee({label:e,name:t,options:o,defaultValue:a,description:i,onChange:d,component:p,...x}){let{control:C}=_t(),{components:n}=F();return T.createElement(y,{defaultValue:a,control:C,name:t,render:({field:c,fieldState:u})=>{let m=p||n?.select;if(m){let l={label:e,name:t,options:o,defaultValue:a,description:i,onChange:d,...x};return T.createElement(m,{field:{...c,onChange:r(g=>{c.onChange(g),d?.(g)},"onChange")},fieldState:u,fieldData:l})}return T.createElement(N,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`},T.createElement(h,{className:"RemoteFlows__SelectField__Label"},e),T.createElement(w,null,T.createElement("div",{className:"relative"},T.createElement(ke,{value:c.value||"",onValueChange:l=>{c.onChange(l),d?.(l)}},T.createElement(Le,{className:"RemoteFlows__SelectField__Trigger","aria-invalid":!!u.error,"aria-label":e},T.createElement("span",{className:"absolute"},T.createElement(Ie,{placeholder:e}))),T.createElement(Me,{className:"RemoteFlows__SelectField__Content"},T.createElement(Te,{className:"RemoteFlows__SelectField__Group"},o.map(l=>T.createElement(ze,{key:l.value,value:l.value,className:"RemoteFlows__SelectField__SelectItem"},l.label))))))),i&&T.createElement(R,null,i),u.error&&T.createElement(k,null))}})}r(Ee,"SelectField");import O,{useState as Rt}from"react";import{useFormContext as Dt}from"react-hook-form";import S,{Fragment as Pt,useState as bt}from"react";import{Check as St,ChevronDownIcon as Nt,X as wt}from"lucide-react";import*as H from"react";import{Command as K}from"cmdk";import{SearchIcon as Ir}from"lucide-react";import*as ht from"react";import*as V from"@radix-ui/react-dialog";import{XIcon as _r}from"lucide-react";function Ae({className:e,...t}){return H.createElement(K,{"data-slot":"command",className:s("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}r(Ae,"Command");function Be({className:e,...t}){return H.createElement(K.List,{"data-slot":"command-list",className:s("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}r(Be,"CommandList");function Ge({...e}){return H.createElement(K.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}r(Ge,"CommandEmpty");function Ve({className:e,...t}){return H.createElement(K.Group,{"data-slot":"command-group",className:s("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}r(Ve,"CommandGroup");function Oe({className:e,...t}){return H.createElement(K.Separator,{"data-slot":"command-separator",className:s("bg-border -mx-1 h-px",e),...t})}r(Oe,"CommandSeparator");function Ue({className:e,...t}){return H.createElement(K.Item,{"data-slot":"command-item",className:s("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}r(Ue,"CommandItem");function Je({options:e,selected:t,onChange:o,placeholder:a,...i}){let[d,p]=bt(!1),x=r(n=>{o(t.filter(c=>c.value!==n.value))},"handleUnselect"),C=e.reduce((n,c)=>{let u=c.category||"Uncategorized";return n[u]||(n[u]=[]),n[u].push(c),n},{});return S.createElement(re,{open:d,onOpenChange:p,...i},S.createElement(ae,null,S.createElement(J,{variant:"outline",role:"combobox","aria-expanded":d,className:"w-full justify-between font-normal",type:"button"},S.createElement("div",{className:"flex gap-1 flex-wrap overflow-x-auto max-h-[2.5rem] items-center"},t.length>0?t.map(n=>S.createElement(ge,{key:n.label,variant:"secondary",className:"mr-1 mb-1"},n.label,S.createElement("div",{role:"button",tabIndex:0,"aria-label":`remove ${n.label}`,className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",onKeyDown:c=>{c.key==="Enter"&&x(n)},onMouseDown:c=>{c.preventDefault(),c.stopPropagation()},onClick:()=>x(n)},S.createElement(wt,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})))):S.createElement("span",{className:"text-foreground"},a)),S.createElement(Nt,{className:"size-4"}))),S.createElement(ne,{align:"start",className:"w-full p-0"},S.createElement(Ae,null,S.createElement(Be,null,S.createElement(Ge,null,"No item found."),Object.entries(C).map(([n,c],u)=>S.createElement(Pt,{key:n},u>0&&S.createElement(Oe,null),S.createElement(Ve,{heading:n},c.map(m=>{let l=t.some(g=>g.value===m.value);return S.createElement(Ue,{key:m.label,onSelect:()=>{o(l?t.filter(g=>g.value!==m.value):[...t,m])}},S.createElement(St,{className:s("mr-2 h-4 w-4",l?"opacity-100":"opacity-0")}),m.label)}))))))))}r(Je,"MultiSelect");function He({label:e,name:t,options:o,defaultValue:a,description:i,onChange:d,$meta:p,component:x,...C}){let{control:n}=Dt(),{components:c}=F(),[u,m]=Rt([]);return O.createElement(y,{defaultValue:a,control:n,name:t,render:({field:l,fieldState:g})=>{let _=x||c?.countries;if(_){let I={label:e,name:t,options:o,defaultValue:a,description:i,onChange:d,$meta:p,...C};return O.createElement(_,{field:{...l,onChange:r(A=>{l.onChange(A),d?.(A)},"onChange")},fieldState:g,fieldData:I})}let z=[...Object.entries(p?.regions||{}).map(([I,A])=>({value:A,label:I,category:"Regions"})),...Object.entries(p?.subregions||{}).map(([I,A])=>({value:A,label:I,category:"Subregions"})),...o.map(I=>({...I,value:I.value,label:I.label,category:"Countries"}))],ee=r(I=>{let A=I.map(({value:Qe})=>Qe);l.onChange(A),d?.(A),m(I)},"handleChange");return O.createElement(N,{"data-field":t,className:`RemoteFlows__CountryField__Item__${t}`},O.createElement(h,{className:"RemoteFlows__CountryField__Label"},e),O.createElement(w,null,O.createElement(Je,{options:z,selected:u,onChange:ee,...C})),i&&O.createElement(R,null,i),g.error&&O.createElement(k,null))}})}r(He,"CountryField");import*as M from"react";import{useFormContext as kt}from"react-hook-form";import*as se from"react";var pe=se.forwardRef(({className:e,...t},o)=>se.createElement("textarea",{className:s("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:o,...t}));pe.displayName="Textarea";function je({name:e,description:t,label:o,onChange:a,maxLength:i,component:d,...p}){let{components:x}=F(),{control:C}=kt();return M.createElement(y,{control:C,name:e,render:({field:n,fieldState:c})=>{let u=d||x?.textarea;if(u){let l={name:e,description:t,label:o,maxLength:i,...p};return M.createElement(u,{field:{...n,onChange:r(g=>{n.onChange(g),a?.(g)},"onChange")},fieldState:c,fieldData:l})}let m=n.value?.length??0;return M.createElement(N,{"data-field":e,className:`RemoteFlows__TextArea__Item__${e}`},M.createElement(h,{className:"RemoteFlows__TextArea__Label"},o),M.createElement(w,null,M.createElement(pe,{...n,value:n.value??"",onChange:l=>{n.onChange(l),a?.(l)},className:s(c.error&&"border-red-500 focus-visible:ring-red-500","RemoteFlows__TextArea__Input"),placeholder:o})),(t||i)&&M.createElement("div",{className:"flex items-center justify-between"},t&&M.createElement(R,{className:"RemoteFlows__TextArea__Description"},t),i&&M.createElement("span",{className:"text-sm ml-auto RemoteFlows__TextArea__MaxLength"},m,"/",i)),c.error&&M.createElement(k,{className:"RemoteFlows__TextArea__Error"}))}})}r(je,"TextAreaField");import ue from"react";import{useFormContext as Tt}from"react-hook-form";function $e(e){let{components:t}=F(),{control:o}=Tt(),a=e.component||t?.email;return a?ue.createElement(y,{control:o,name:e.name,render:({field:i,fieldState:d})=>ue.createElement(a,{field:{...i,onChange:r(p=>{i.onChange(p),e.onChange?.(p)},"onChange")},fieldState:d,fieldData:e})}):ue.createElement(W,{...e,type:"email"})}r($e,"EmailField");var ie={checkbox:Fe,text:W,email:$e,money:ce,select:Ee,radio:Re,number:ce,file:Pe,fieldset:ye,date:Ce,textarea:je,countries:He};import{cva as It}from"class-variance-authority";import*as le from"react";var Lt=It("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-card bg-warning border-warning-border [&>svg]:text-current"}},defaultVariants:{variant:"default"}});function We({className:e,variant:t,...o}){return le.createElement("div",{"data-slot":"alert",role:"alert",className:s(Lt({variant:t}),e),...o})}r(We,"Alert");function Xe({className:e,...t}){return le.createElement("div",{"data-slot":"alert-title",className:s("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}r(Xe,"AlertTitle");function Ke({className:e,...t}){return le.createElement("div",{"data-slot":"alert-description",className:s("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}r(Ke,"AlertDescription");import{AlertCircle as Mt}from"lucide-react";import Z from"react";function qe({title:e,description:t,severity:o}){let{components:a}=F();if(a?.statement){let i=a?.statement;return Z.createElement(i,{data:{title:e,description:t,severity:o}})}return Z.createElement(We,{variant:"warning"},Z.createElement(Mt,{className:"h-4 w-4"}),e&&Z.createElement(Xe,null,e),Z.createElement(Ke,null,t))}r(qe,"Statement");import fe,{useEffect as zt}from"react";import{useFormContext as Et}from"react-hook-form";function Ye({name:e,value:t,description:o,statement:a}){let{setValue:i}=Et();return zt(()=>{i(e,t)},[]),fe.createElement("div",null,fe.createElement("p",{className:`text-sm RemoteFlows__ForcedValue__Title__${e}`,dangerouslySetInnerHTML:{__html:a.title}}),fe.createElement("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:a.description||o}}))}r(Ye,"ForcedValueField");function Bt(e){return e.const!==void 0&&e.const===e.default&&e.inputType!=="checkbox"&&e.inputType!=="hidden"}r(Bt,"checkFieldHasForcedValue");var Wa=r(({fields:e,components:t})=>!e||e.length===0?null:U.createElement(U.Fragment,null,e.map(o=>{if(o.isVisible===!1||o.deprecated)return null;if(Bt(o))return U.createElement(Ye,{key:o.name,name:o.name,description:o.description,value:o.const,statement:o.statement});let a=ie[o.inputType];return o.inputType==="fieldset"?U.createElement(a,{...o,components:t}):a?U.createElement(At,{key:o.name},U.createElement(a,{...o,component:t&&t[o.inputType]}),o.statement?U.createElement(qe,{...o.statement}):null):U.createElement("p",{className:"error"},"Field type ",o.inputType," not supported")})),"JSONSchemaFormFields");export{Wa as a};
|
|
2
|
-
//# sourceMappingURL=chunk-HDQGO453.js.map
|