@gusto/embedded-react-sdk 0.46.0 → 0.46.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/components/Common/DataView/DataCards/DataCards.d.ts +2 -1
  3. package/dist/components/Common/DataView/DataCards/DataCards.js +14 -13
  4. package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
  5. package/dist/components/Common/DataView/DataTable/DataTable.d.ts +2 -1
  6. package/dist/components/Common/DataView/DataTable/DataTable.js +51 -50
  7. package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
  8. package/dist/components/Common/DataView/DataView.d.ts +1 -0
  9. package/dist/components/Common/DataView/DataView.js.map +1 -1
  10. package/dist/components/Common/DataView/useDataView.d.ts +8 -1
  11. package/dist/components/Common/DataView/useDataView.js +20 -17
  12. package/dist/components/Common/DataView/useDataView.js.map +1 -1
  13. package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.d.ts +9 -0
  14. package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.js +76 -0
  15. package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.js.map +1 -0
  16. package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.module.scss.js +8 -0
  17. package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.module.scss.js.map +1 -0
  18. package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js +57 -202
  19. package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js.map +1 -1
  20. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.d.ts +25 -0
  21. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js +81 -0
  22. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js.map +1 -0
  23. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.module.scss.js +8 -0
  24. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.module.scss.js.map +1 -0
  25. package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.d.ts +18 -0
  26. package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js +171 -0
  27. package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js.map +1 -0
  28. package/dist/components/Employee/Compensation/management/index.d.ts +3 -0
  29. package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.d.ts +6 -1
  30. package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js +67 -209
  31. package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js.map +1 -1
  32. package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.d.ts +18 -0
  33. package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js +169 -0
  34. package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js.map +1 -0
  35. package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.d.ts +16 -0
  36. package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.js +36 -30
  37. package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.js.map +1 -1
  38. package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.d.ts +1 -1
  39. package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js.map +1 -1
  40. package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +213 -191
  41. package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
  42. package/dist/components/Employee/Dashboard/Dashboard.js +65 -53
  43. package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
  44. package/dist/components/Employee/Dashboard/DashboardComponents.d.ts +3 -3
  45. package/dist/components/Employee/Dashboard/DashboardComponents.js +138 -101
  46. package/dist/components/Employee/Dashboard/DashboardComponents.js.map +1 -1
  47. package/dist/components/Employee/Dashboard/JobAndPayView.js +340 -320
  48. package/dist/components/Employee/Dashboard/JobAndPayView.js.map +1 -1
  49. package/dist/components/Employee/Dashboard/JobAndPayView.module.scss.js +5 -3
  50. package/dist/components/Employee/Dashboard/JobAndPayView.module.scss.js.map +1 -1
  51. package/dist/components/Employee/Dashboard/dashboardStateMachine.js +147 -148
  52. package/dist/components/Employee/Dashboard/dashboardStateMachine.js.map +1 -1
  53. package/dist/components/Employee/Dashboard/getPendingCompensationChanges.d.ts +6 -0
  54. package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js +13 -12
  55. package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js.map +1 -1
  56. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.d.ts +2 -2
  57. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js +34 -35
  58. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js.map +1 -1
  59. package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js +37 -40
  60. package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js.map +1 -1
  61. package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.d.ts +1 -2
  62. package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js +64 -71
  63. package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js.map +1 -1
  64. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.d.ts +2 -0
  65. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js +25 -0
  66. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js.map +1 -0
  67. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.d.ts +13 -0
  68. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js +37 -0
  69. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js.map +1 -0
  70. package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.d.ts +6 -0
  71. package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js +69 -0
  72. package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js.map +1 -0
  73. package/dist/components/Employee/EmployeeListFlow/index.d.ts +3 -0
  74. package/dist/components/Employee/HomeAddress/management/HomeAddress.js +15 -12
  75. package/dist/components/Employee/HomeAddress/management/HomeAddress.js.map +1 -1
  76. package/dist/components/Employee/HomeAddress/management/HomeAddressView.d.ts +2 -1
  77. package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +86 -83
  78. package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
  79. package/dist/components/Employee/WorkAddress/management/WorkAddress.js +14 -11
  80. package/dist/components/Employee/WorkAddress/management/WorkAddress.js.map +1 -1
  81. package/dist/components/Employee/WorkAddress/management/WorkAddressView.d.ts +2 -1
  82. package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +92 -89
  83. package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
  84. package/dist/components/Employee/exports/employeeManagement.d.ts +2 -0
  85. package/dist/components/Employee/exports/employeeManagement.js +18 -16
  86. package/dist/components/Employee/exports/employeeManagement.js.map +1 -1
  87. package/dist/components/Employee/index.d.ts +2 -0
  88. package/dist/components/Employee/index.js +32 -30
  89. package/dist/components/Employee/index.js.map +1 -1
  90. package/dist/components/Flow/FlowHeader.js +34 -31
  91. package/dist/components/Flow/FlowHeader.js.map +1 -1
  92. package/dist/components/Flow/useFlow.d.ts +12 -0
  93. package/dist/components/Flow/useFlow.js.map +1 -1
  94. package/dist/components/TimeOff/PolicyList/PolicyList.js +92 -69
  95. package/dist/components/TimeOff/PolicyList/PolicyList.js.map +1 -1
  96. package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js +23 -23
  97. package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js.map +1 -1
  98. package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.d.ts +1 -1
  99. package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.js.map +1 -1
  100. package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.js +73 -56
  101. package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.js.map +1 -1
  102. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js +58 -58
  103. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js.map +1 -1
  104. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.d.ts +1 -1
  105. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js +91 -87
  106. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js.map +1 -1
  107. package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormTypes.d.ts +2 -0
  108. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js +91 -124
  109. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
  110. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.d.ts +1 -1
  111. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js +72 -87
  112. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js.map +1 -1
  113. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +1 -6
  114. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +160 -220
  115. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
  116. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.d.ts +7 -3
  117. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js +77 -54
  118. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js.map +1 -1
  119. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.test.d.ts +1 -0
  120. package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.js +12 -11
  121. package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.js.map +1 -1
  122. package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js +177 -147
  123. package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js.map +1 -1
  124. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.d.ts +1 -1
  125. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +38 -36
  126. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
  127. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTableTypes.d.ts +2 -0
  128. package/dist/i18n/en/Company.TimeOff.SelectEmployees.json.js +10 -10
  129. package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js +17 -15
  130. package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js.map +1 -1
  131. package/dist/i18n/en/Company.TimeOff.TimeOffPolicyDetails.json.js +9 -9
  132. package/dist/i18n/en/Employee.Compensation.json.js +64 -56
  133. package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
  134. package/dist/i18n/en/Employee.Dashboard.json.js +26 -24
  135. package/dist/i18n/en/Employee.Dashboard.json.js.map +1 -1
  136. package/dist/i18n/en/Employee.HomeAddress.Management.json.js +12 -10
  137. package/dist/i18n/en/Employee.HomeAddress.Management.json.js.map +1 -1
  138. package/dist/i18n/en/Employee.ManagementEmployeeList.json.js +32 -30
  139. package/dist/i18n/en/Employee.ManagementEmployeeList.json.js.map +1 -1
  140. package/dist/i18n/en/Employee.WorkAddress.Management.json.js +16 -14
  141. package/dist/i18n/en/Employee.WorkAddress.Management.json.js.map +1 -1
  142. package/dist/i18n/en/common.json.d.ts +14 -0
  143. package/dist/partner-hook-utils/form/fields/DatePickerHookField.js +33 -32
  144. package/dist/partner-hook-utils/form/fields/DatePickerHookField.js.map +1 -1
  145. package/dist/partner-hook-utils/types.d.ts +4 -0
  146. package/dist/shared/constants.d.ts +2 -0
  147. package/dist/shared/constants.js +13 -12
  148. package/dist/shared/constants.js.map +1 -1
  149. package/dist/style.css +1 -1
  150. package/dist/types/i18next.d.ts +26 -12
  151. package/docs/reference/endpoint-inventory.json +24 -8
  152. package/package.json +1 -1
@@ -0,0 +1,18 @@
1
+ import { UseJobFormReady } from './useJobForm';
2
+ import { UseCompensationFormReady } from './useCompensationForm';
3
+ export interface AddCompensationFormBodyProps {
4
+ jobForm: UseJobFormReady;
5
+ compensationForm: UseCompensationFormReady;
6
+ title: string;
7
+ submitCtaLabel: string;
8
+ isPending: boolean;
9
+ onCancel?: () => void;
10
+ }
11
+ /**
12
+ * Renders the shared field layout used by both `EditCompensation` (onboarding) and
13
+ * `AddAnotherJob` (management). Field visibility is driven entirely by the hook
14
+ * configuration — `JobFields.HireDate` is only defined when `withHireDateField: true`,
15
+ * and `CompFields.EffectiveDate` is only defined when `withEffectiveDateField: true` —
16
+ * so this component renders the correct subset for each use case with no extra props.
17
+ */
18
+ export declare function AddCompensationFormBody({ jobForm, compensationForm, title, submitCtaLabel, isPending, onCancel, }: AddCompensationFormBodyProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,169 @@
1
+ import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
+ import { useTranslation as R, Trans as f } from "react-i18next";
3
+ import { Flex as v } from "../../../Common/Flex/Flex.js";
4
+ import "classnames";
5
+ import { FLSA_OVERTIME_SALARY_LIMIT as u } from "../../../../shared/constants.js";
6
+ import { ActionsLayout as C } from "../../../Common/ActionsLayout/ActionsLayout.js";
7
+ import { useComponentContext as D } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
8
+ import b from "../../../../hooks/useNumberFormatter.js";
9
+ function H({
10
+ jobForm: l,
11
+ compensationForm: s,
12
+ title: p,
13
+ submitCtaLabel: E,
14
+ isPending: d,
15
+ onCancel: c
16
+ }) {
17
+ const { t: e } = R("Employee.Compensation"), n = D(), r = b("currency"), i = l.form.Fields, a = s.form.Fields;
18
+ return /* @__PURE__ */ m(v, { flexDirection: "column", gap: 32, children: [
19
+ /* @__PURE__ */ t(n.Heading, { as: "h2", children: p }),
20
+ s.status.willDeleteSecondaryJobs && /* @__PURE__ */ t(
21
+ n.Alert,
22
+ {
23
+ label: e("validations.classificationChangeNotification"),
24
+ status: "warning"
25
+ }
26
+ ),
27
+ i.Title && /* @__PURE__ */ t(
28
+ i.Title,
29
+ {
30
+ label: e("jobTitle"),
31
+ validationMessages: { REQUIRED: e("validations.title") },
32
+ formHookResult: l
33
+ }
34
+ ),
35
+ i.HireDate && /* @__PURE__ */ t(
36
+ i.HireDate,
37
+ {
38
+ label: e("hireDate"),
39
+ validationMessages: { REQUIRED: e("validations.hireDate") },
40
+ formHookResult: l
41
+ }
42
+ ),
43
+ a.FlsaStatus && /* @__PURE__ */ t(
44
+ a.FlsaStatus,
45
+ {
46
+ label: e("employeeClassification"),
47
+ description: /* @__PURE__ */ t(
48
+ f,
49
+ {
50
+ t: e,
51
+ i18nKey: "classificationLink",
52
+ components: { ClassificationLink: /* @__PURE__ */ t(n.Link, {}) }
53
+ }
54
+ ),
55
+ validationMessages: {
56
+ REQUIRED: e("validations.exemptThreshold", {
57
+ limit: r(u)
58
+ })
59
+ },
60
+ getOptionLabel: (o) => e(`flsaStatusLabels.${o}`),
61
+ formHookResult: s
62
+ }
63
+ ),
64
+ /* @__PURE__ */ t(
65
+ a.Rate,
66
+ {
67
+ label: e("amount"),
68
+ validationMessages: {
69
+ REQUIRED: e("validations.rate"),
70
+ RATE_MINIMUM: e("validations.nonZeroRate"),
71
+ RATE_EXEMPT_THRESHOLD: e("validations.rateExemptThreshold", {
72
+ limit: r(u)
73
+ })
74
+ },
75
+ formHookResult: s
76
+ }
77
+ ),
78
+ /* @__PURE__ */ t(
79
+ a.PaymentUnit,
80
+ {
81
+ label: e("paymentUnitLabel"),
82
+ description: e("paymentUnitDescription"),
83
+ validationMessages: { REQUIRED: e("validations.paymentUnit") },
84
+ getOptionLabel: (o) => e(`paymentUnitOptions.${o}`),
85
+ formHookResult: s
86
+ }
87
+ ),
88
+ a.AdjustForMinimumWage && /* @__PURE__ */ t(
89
+ a.AdjustForMinimumWage,
90
+ {
91
+ label: e("adjustForMinimumWage"),
92
+ description: e("adjustForMinimumWageDescription"),
93
+ formHookResult: s
94
+ }
95
+ ),
96
+ a.MinimumWageId && /* @__PURE__ */ t(
97
+ a.MinimumWageId,
98
+ {
99
+ label: e("minimumWageLabel"),
100
+ description: e("minimumWageDescription"),
101
+ validationMessages: { REQUIRED: e("validations.minimumWage") },
102
+ getOptionLabel: (o) => `${r(Number(o.wage))} - ${o.authority}: ${o.notes ?? ""}`,
103
+ formHookResult: s
104
+ }
105
+ ),
106
+ a.EffectiveDate && /* @__PURE__ */ t(
107
+ a.EffectiveDate,
108
+ {
109
+ label: e("effectiveDate"),
110
+ validationMessages: {
111
+ REQUIRED: e("validations.effectiveDate"),
112
+ EFFECTIVE_DATE_BEFORE_HIRE: e("validations.effectiveDateBeforeHire"),
113
+ EFFECTIVE_DATE_BEFORE_MIN: e("validations.effectiveDateBeforeMin")
114
+ },
115
+ formHookResult: s
116
+ }
117
+ ),
118
+ i.TwoPercentShareholder && /* @__PURE__ */ t(
119
+ i.TwoPercentShareholder,
120
+ {
121
+ label: e("twoPercentStakeholderLabel"),
122
+ formHookResult: l
123
+ }
124
+ ),
125
+ i.StateWcCovered && /* @__PURE__ */ t(
126
+ i.StateWcCovered,
127
+ {
128
+ label: e("stateWcCoveredLabel"),
129
+ description: /* @__PURE__ */ t(
130
+ f,
131
+ {
132
+ t: e,
133
+ i18nKey: "stateWcCoveredDescription",
134
+ components: {
135
+ wcLink: /* @__PURE__ */ t(
136
+ n.Link,
137
+ {
138
+ href: "https://www.lni.wa.gov/insurance/rates-risk-classes/risk-classes-for-workers-compensation/risk-class-lookup#/",
139
+ target: "_blank",
140
+ rel: "noopener noreferrer"
141
+ }
142
+ )
143
+ }
144
+ }
145
+ ),
146
+ getOptionLabel: (o) => e(o ? "stateWcCoveredOptions.yes" : "stateWcCoveredOptions.no"),
147
+ formHookResult: l
148
+ }
149
+ ),
150
+ i.StateWcClassCode && /* @__PURE__ */ t(
151
+ i.StateWcClassCode,
152
+ {
153
+ label: e("stateWcClassCodeLabel"),
154
+ description: e("stateWcClassCodeDescription"),
155
+ placeholder: e("stateWcClassCodeLabel"),
156
+ validationMessages: { REQUIRED: e("validations.stateWcClassCode") },
157
+ formHookResult: l
158
+ }
159
+ ),
160
+ /* @__PURE__ */ m(C, { children: [
161
+ c && /* @__PURE__ */ t(n.Button, { variant: "secondary", onClick: c, isDisabled: d, children: e("cancelNewJobCta") }),
162
+ /* @__PURE__ */ t(n.Button, { type: "submit", isLoading: d, children: E })
163
+ ] })
164
+ ] });
165
+ }
166
+ export {
167
+ H as AddCompensationFormBody
168
+ };
169
+ //# sourceMappingURL=AddCompensationFormBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AddCompensationFormBody.js","sources":["../../../../../src/components/Employee/Compensation/shared/AddCompensationFormBody.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport type { PaymentUnit } from '@gusto/embedded-api/models/components/compensation'\nimport type { FlsaStatusType } from '@gusto/embedded-api/models/components/flsastatustype'\nimport type { MinimumWage } from '@gusto/embedded-api/models/components/minimumwage'\nimport type { UseJobFormReady } from './useJobForm'\nimport type { UseCompensationFormReady } from './useCompensationForm'\nimport { ActionsLayout, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { FLSA_OVERTIME_SALARY_LIMIT } from '@/shared/constants'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\n\nexport interface AddCompensationFormBodyProps {\n jobForm: UseJobFormReady\n compensationForm: UseCompensationFormReady\n title: string\n submitCtaLabel: string\n isPending: boolean\n onCancel?: () => void\n}\n\n/**\n * Renders the shared field layout used by both `EditCompensation` (onboarding) and\n * `AddAnotherJob` (management). Field visibility is driven entirely by the hook\n * configuration — `JobFields.HireDate` is only defined when `withHireDateField: true`,\n * and `CompFields.EffectiveDate` is only defined when `withEffectiveDateField: true` —\n * so this component renders the correct subset for each use case with no extra props.\n */\nexport function AddCompensationFormBody({\n jobForm,\n compensationForm,\n title,\n submitCtaLabel,\n isPending,\n onCancel,\n}: AddCompensationFormBodyProps) {\n const { t } = useTranslation('Employee.Compensation')\n const Components = useComponentContext()\n const format = useNumberFormatter('currency')\n\n const JobFields = jobForm.form.Fields\n const CompFields = compensationForm.form.Fields\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n\n {compensationForm.status.willDeleteSecondaryJobs && (\n <Components.Alert\n label={t('validations.classificationChangeNotification')}\n status=\"warning\"\n />\n )}\n\n {JobFields.Title && (\n <JobFields.Title\n label={t('jobTitle')}\n validationMessages={{ REQUIRED: t('validations.title') }}\n formHookResult={jobForm}\n />\n )}\n\n {JobFields.HireDate && (\n <JobFields.HireDate\n label={t('hireDate')}\n validationMessages={{ REQUIRED: t('validations.hireDate') }}\n formHookResult={jobForm}\n />\n )}\n\n {CompFields.FlsaStatus && (\n <CompFields.FlsaStatus\n label={t('employeeClassification')}\n description={\n <Trans\n t={t}\n i18nKey=\"classificationLink\"\n components={{ ClassificationLink: <Components.Link /> }}\n />\n }\n validationMessages={{\n REQUIRED: t('validations.exemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n }),\n }}\n getOptionLabel={(status: FlsaStatusType) => t(`flsaStatusLabels.${status}`)}\n formHookResult={compensationForm}\n />\n )}\n\n <CompFields.Rate\n label={t('amount')}\n validationMessages={{\n REQUIRED: t('validations.rate'),\n RATE_MINIMUM: t('validations.nonZeroRate'),\n RATE_EXEMPT_THRESHOLD: t('validations.rateExemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n }),\n }}\n formHookResult={compensationForm}\n />\n\n <CompFields.PaymentUnit\n label={t('paymentUnitLabel')}\n description={t('paymentUnitDescription')}\n validationMessages={{ REQUIRED: t('validations.paymentUnit') }}\n getOptionLabel={(unit: PaymentUnit) => t(`paymentUnitOptions.${unit}`)}\n formHookResult={compensationForm}\n />\n\n {CompFields.AdjustForMinimumWage && (\n <CompFields.AdjustForMinimumWage\n label={t('adjustForMinimumWage')}\n description={t('adjustForMinimumWageDescription')}\n formHookResult={compensationForm}\n />\n )}\n\n {CompFields.MinimumWageId && (\n <CompFields.MinimumWageId\n label={t('minimumWageLabel')}\n description={t('minimumWageDescription')}\n validationMessages={{ REQUIRED: t('validations.minimumWage') }}\n getOptionLabel={(wage: MinimumWage) =>\n `${format(Number(wage.wage))} - ${wage.authority}: ${wage.notes ?? ''}`\n }\n formHookResult={compensationForm}\n />\n )}\n\n {CompFields.EffectiveDate && (\n <CompFields.EffectiveDate\n label={t('effectiveDate')}\n validationMessages={{\n REQUIRED: t('validations.effectiveDate'),\n EFFECTIVE_DATE_BEFORE_HIRE: t('validations.effectiveDateBeforeHire'),\n EFFECTIVE_DATE_BEFORE_MIN: t('validations.effectiveDateBeforeMin'),\n }}\n formHookResult={compensationForm}\n />\n )}\n\n {JobFields.TwoPercentShareholder && (\n <JobFields.TwoPercentShareholder\n label={t('twoPercentStakeholderLabel')}\n formHookResult={jobForm}\n />\n )}\n\n {JobFields.StateWcCovered && (\n <JobFields.StateWcCovered\n label={t('stateWcCoveredLabel')}\n description={\n <Trans\n t={t}\n i18nKey=\"stateWcCoveredDescription\"\n components={{\n wcLink: (\n <Components.Link\n href=\"https://www.lni.wa.gov/insurance/rates-risk-classes/risk-classes-for-workers-compensation/risk-class-lookup#/\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n />\n ),\n }}\n />\n }\n getOptionLabel={(covered: boolean) =>\n covered ? t('stateWcCoveredOptions.yes') : t('stateWcCoveredOptions.no')\n }\n formHookResult={jobForm}\n />\n )}\n\n {JobFields.StateWcClassCode && (\n <JobFields.StateWcClassCode\n label={t('stateWcClassCodeLabel')}\n description={t('stateWcClassCodeDescription')}\n placeholder={t('stateWcClassCodeLabel')}\n validationMessages={{ REQUIRED: t('validations.stateWcClassCode') }}\n formHookResult={jobForm}\n />\n )}\n\n <ActionsLayout>\n {onCancel && (\n <Components.Button variant=\"secondary\" onClick={onCancel} isDisabled={isPending}>\n {t('cancelNewJobCta')}\n </Components.Button>\n )}\n <Components.Button type=\"submit\" isLoading={isPending}>\n {submitCtaLabel}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n )\n}\n"],"names":["AddCompensationFormBody","jobForm","compensationForm","title","submitCtaLabel","isPending","onCancel","t","useTranslation","Components","useComponentContext","format","useNumberFormatter","JobFields","CompFields","jsxs","Flex","jsx","Trans","FLSA_OVERTIME_SALARY_LIMIT","status","unit","wage","covered","ActionsLayout"],"mappings":";;;;;;;;AA2BO,SAASA,EAAwB;AAAA,EACtC,SAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AACF,GAAiC;AAC/B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,uBAAuB,GAC9CC,IAAaC,EAAA,GACbC,IAASC,EAAmB,UAAU,GAEtCC,IAAYZ,EAAQ,KAAK,QACzBa,IAAaZ,EAAiB,KAAK;AAEzC,SACE,gBAAAa,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAC,EAACR,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAN,GAAM;AAAA,IAElCD,EAAiB,OAAO,2BACvB,gBAAAe;AAAA,MAACR,EAAW;AAAA,MAAX;AAAA,QACC,OAAOF,EAAE,8CAA8C;AAAA,QACvD,QAAO;AAAA,MAAA;AAAA,IAAA;AAAA,IAIVM,EAAU,SACT,gBAAAI;AAAA,MAACJ,EAAU;AAAA,MAAV;AAAA,QACC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qB;AAAA,QAC9B,aACE,gBAAAU;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,GAAAX;AAAA,YACA,SAAQ;AAAA,YACR,YAAY;AAAA,cACV,QACE,gBAAAU;AAAA,gBAACR,EAAW;AAAA,gBAAX;AAAA,kBACC,MAAK;AAAA,kBACL,QAAO;AAAA,kBACP,KAAI;AAAA,gBAAA;AAAA,cAAA;AAAA,YACN;AAAA,UAEJ;AAAA,QAAA;AAAA,QAGJ,gBAAgB,CAACc,MACLhB,EAAVgB,IAAY,8BAAiC,0BAAN;AAAA,QAEzC,gBAAgBtB;AAAA,MAAA;AAAA,IAAA;AAAA,IAInBY,EAAU,oBACT,gBAAAI;AAAA,MAACJ,EAAU;AAAA,MAAV;AAAA,QACC,OAAON,EAAE,uBAAuB;AAAA,QAChC,aAAaA,EAAE,6BAA6B;AAAA,QAC5C,aAAaA,EAAE,uBAAuB;AAAA,QACtC,oBAAoB,EAAE,UAAUA,EAAE,8BAA8B,EAAA;AAAA,QAChE,gBAAgBN;AAAA,MAAA;AAAA,IAAA;AAAA,sBAInBuB,GAAA,EACE,UAAA;AAAA,MAAAlB,KACC,gBAAAW,EAACR,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASH,GAAU,YAAYD,GACnE,UAAAE,EAAE,iBAAiB,EAAA,CACtB;AAAA,MAEF,gBAAAU,EAACR,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWJ,GACzC,UAAAD,EAAA,CACH;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
@@ -8,6 +8,7 @@ export declare const CompensationErrorCodes: {
8
8
  readonly PAYMENT_UNIT_COMMISSION: "PAYMENT_UNIT_COMMISSION";
9
9
  readonly RATE_COMMISSION_ZERO: "RATE_COMMISSION_ZERO";
10
10
  readonly EFFECTIVE_DATE_BEFORE_HIRE: "EFFECTIVE_DATE_BEFORE_HIRE";
11
+ readonly EFFECTIVE_DATE_BEFORE_MIN: "EFFECTIVE_DATE_BEFORE_MIN";
11
12
  };
12
13
  export type CompensationErrorCode = (typeof CompensationErrorCodes)[keyof typeof CompensationErrorCodes];
13
14
  declare const fieldValidators: {
@@ -83,6 +84,21 @@ export interface CompensationSchemaOptions {
83
84
  * `EFFECTIVE_DATE_BEFORE_HIRE` issue when violated.
84
85
  */
85
86
  hireDate?: string | null;
87
+ /**
88
+ * Absolute lower bound for `effectiveDate`, enforced in both create and
89
+ * update modes whenever provided. Typically `addDays(today, 1)` (tomorrow)
90
+ * for management screens where effective dates must be in the future, or
91
+ * `max(tomorrow, hireDate)` for secondary new jobs. Surfaces an
92
+ * `EFFECTIVE_DATE_BEFORE_MIN` issue when violated.
93
+ *
94
+ * **Callers must only pass this when the carve-out cannot fire.** The
95
+ * carve-out (`willDeleteSecondaryJobs` in update mode) forces `effectiveDate`
96
+ * to today on a disabled field — passing `minEffectiveDate` for a primary
97
+ * job in update mode would cause a spurious validation failure on submit.
98
+ * Secondary jobs are safe because their FLSA field is hidden, preventing the
99
+ * carve-out from activating.
100
+ */
101
+ minEffectiveDate?: string | null;
86
102
  /**
87
103
  * When `false`, drops `effectiveDate` from the validated shape — the field
88
104
  * becomes hook-managed (e.g. seeded from the parent job's `hireDate` during
@@ -1,8 +1,8 @@
1
1
  import { z as e } from "zod";
2
- import { buildFormSchema as _ } from "../../../../../partner-hook-utils/form/buildFormSchema.js";
3
- import { coerceToISODate as N, coerceNaN as T } from "../../../../../partner-hook-utils/form/preprocessors.js";
4
- import { PAY_PERIODS as o, FlsaStatus as E, FLSA_OVERTIME_SALARY_LIMIT as O } from "../../../../../shared/constants.js";
5
- import { yearlyRate as m } from "../../../../../helpers/payRateCalculator.js";
2
+ import { buildFormSchema as d } from "../../../../../partner-hook-utils/form/buildFormSchema.js";
3
+ import { coerceToISODate as N, coerceNaN as O } from "../../../../../partner-hook-utils/form/preprocessors.js";
4
+ import { PAY_PERIODS as I, FlsaStatus as E, FLSA_OVERTIME_SALARY_LIMIT as m } from "../../../../../shared/constants.js";
5
+ import { yearlyRate as u } from "../../../../../helpers/payRateCalculator.js";
6
6
  const a = {
7
7
  REQUIRED: "REQUIRED",
8
8
  RATE_MINIMUM: "RATE_MINIMUM",
@@ -10,8 +10,9 @@ const a = {
10
10
  PAYMENT_UNIT_OWNER: "PAYMENT_UNIT_OWNER",
11
11
  PAYMENT_UNIT_COMMISSION: "PAYMENT_UNIT_COMMISSION",
12
12
  RATE_COMMISSION_ZERO: "RATE_COMMISSION_ZERO",
13
- EFFECTIVE_DATE_BEFORE_HIRE: "EFFECTIVE_DATE_BEFORE_HIRE"
14
- }, u = {
13
+ EFFECTIVE_DATE_BEFORE_HIRE: "EFFECTIVE_DATE_BEFORE_HIRE",
14
+ EFFECTIVE_DATE_BEFORE_MIN: "EFFECTIVE_DATE_BEFORE_MIN"
15
+ }, R = {
15
16
  /**
16
17
  * Optional in both modes. Setting title here scopes the change to this
17
18
  * compensation's `effectiveDate` — pair it with a future-dated comp to
@@ -33,13 +34,13 @@ const a = {
33
34
  E.COMMISSION_ONLY_NONEXEMPT
34
35
  ]).optional(),
35
36
  paymentUnit: e.enum([
36
- o.HOUR,
37
- o.WEEK,
38
- o.MONTH,
39
- o.YEAR,
40
- o.PAYCHECK
37
+ I.HOUR,
38
+ I.WEEK,
39
+ I.MONTH,
40
+ I.YEAR,
41
+ I.PAYCHECK
41
42
  ]),
42
- rate: e.preprocess(T(0), e.number()),
43
+ rate: e.preprocess(O(0), e.number()),
43
44
  /**
44
45
  * The effective date a new compensation should take effect on.
45
46
  *
@@ -55,7 +56,7 @@ const a = {
55
56
  effectiveDate: e.preprocess(N, e.iso.date().nullable()),
56
57
  adjustForMinimumWage: e.boolean(),
57
58
  minimumWageId: e.string()
58
- }, R = {
59
+ }, f = {
59
60
  title: "never",
60
61
  flsaStatus: "create",
61
62
  paymentUnit: "create",
@@ -63,58 +64,63 @@ const a = {
63
64
  effectiveDate: "create",
64
65
  minimumWageId: (M) => M.adjustForMinimumWage
65
66
  };
66
- function n(M, t) {
67
- const { flsaStatus: s, paymentUnit: I, rate: i } = M;
68
- s === E.EXEMPT || s === E.SALARIED_NONEXEMPT || s === E.NONEXEMPT ? s === E.EXEMPT && m(i, I) < O ? t.addIssue({
67
+ function c(M, t) {
68
+ const { flsaStatus: s, paymentUnit: i, rate: o } = M;
69
+ s === E.EXEMPT || s === E.SALARIED_NONEXEMPT || s === E.NONEXEMPT ? s === E.EXEMPT && u(o, i) < m ? t.addIssue({
69
70
  code: e.ZodIssueCode.custom,
70
71
  path: ["rate"],
71
72
  message: a.RATE_EXEMPT_THRESHOLD
72
- }) : i < 1 && t.addIssue({
73
+ }) : o < 1 && t.addIssue({
73
74
  code: e.ZodIssueCode.custom,
74
75
  path: ["rate"],
75
76
  message: a.RATE_MINIMUM
76
- }) : s === E.OWNER ? (I !== o.PAYCHECK && t.addIssue({
77
+ }) : s === E.OWNER ? (i !== I.PAYCHECK && t.addIssue({
77
78
  code: e.ZodIssueCode.custom,
78
79
  path: ["paymentUnit"],
79
80
  message: a.PAYMENT_UNIT_OWNER
80
- }), i < 1 && t.addIssue({
81
+ }), o < 1 && t.addIssue({
81
82
  code: e.ZodIssueCode.custom,
82
83
  path: ["rate"],
83
84
  message: a.RATE_MINIMUM
84
- })) : (s === E.COMMISSION_ONLY_EXEMPT || s === E.COMMISSION_ONLY_NONEXEMPT) && (I !== o.YEAR && t.addIssue({
85
+ })) : (s === E.COMMISSION_ONLY_EXEMPT || s === E.COMMISSION_ONLY_NONEXEMPT) && (i !== I.YEAR && t.addIssue({
85
86
  code: e.ZodIssueCode.custom,
86
87
  path: ["paymentUnit"],
87
88
  message: a.PAYMENT_UNIT_COMMISSION
88
- }), i !== 0 && t.addIssue({
89
+ }), o !== 0 && t.addIssue({
89
90
  code: e.ZodIssueCode.custom,
90
91
  path: ["rate"],
91
92
  message: a.RATE_COMMISSION_ZERO
92
93
  }));
93
94
  }
94
- function l(M = {}) {
95
+ function D(M = {}) {
95
96
  const {
96
97
  mode: t = "create",
97
98
  optionalFieldsToRequire: s,
98
- hireDate: I,
99
- withEffectiveDateField: i = !0
99
+ hireDate: i,
100
+ minEffectiveDate: o,
101
+ withEffectiveDateField: T = !0
100
102
  } = M;
101
- return _(u, {
102
- requiredFieldsConfig: R,
103
+ return d(R, {
104
+ requiredFieldsConfig: f,
103
105
  requiredErrorCode: a.REQUIRED,
104
106
  mode: t,
105
107
  optionalFieldsToRequire: s,
106
- excludeFields: i ? [] : ["effectiveDate"],
107
- superRefine: (r, d) => {
108
- n(r, d), t === "create" && I && r.effectiveDate && r.effectiveDate < I && d.addIssue({
108
+ excludeFields: T ? [] : ["effectiveDate"],
109
+ superRefine: (_, r) => {
110
+ c(_, r), i && _.effectiveDate && _.effectiveDate < i && (t === "create" || o) && r.addIssue({
109
111
  code: e.ZodIssueCode.custom,
110
112
  path: ["effectiveDate"],
111
113
  message: a.EFFECTIVE_DATE_BEFORE_HIRE
114
+ }), o && _.effectiveDate && _.effectiveDate < o && r.addIssue({
115
+ code: e.ZodIssueCode.custom,
116
+ path: ["effectiveDate"],
117
+ message: a.EFFECTIVE_DATE_BEFORE_MIN
112
118
  });
113
119
  }
114
120
  });
115
121
  }
116
122
  export {
117
123
  a as CompensationErrorCodes,
118
- l as createCompensationSchema
124
+ D as createCompensationSchema
119
125
  };
120
126
  //# sourceMappingURL=compensationSchema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compensationSchema.js","sources":["../../../../../../src/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n buildFormSchema,\n type RequiredFieldConfig,\n type OptionalFieldsToRequire,\n} from '@/partner-hook-utils/form/buildFormSchema'\nimport { coerceNaN, coerceToISODate } from '@/partner-hook-utils/form/preprocessors'\nimport { FLSA_OVERTIME_SALARY_LIMIT, FlsaStatus, PAY_PERIODS } from '@/shared/constants'\nimport { yearlyRate } from '@/helpers/payRateCalculator'\n\n// ── Error codes ────────────────────────────────────────────────────────\n\nexport const CompensationErrorCodes = {\n REQUIRED: 'REQUIRED',\n RATE_MINIMUM: 'RATE_MINIMUM',\n RATE_EXEMPT_THRESHOLD: 'RATE_EXEMPT_THRESHOLD',\n PAYMENT_UNIT_OWNER: 'PAYMENT_UNIT_OWNER',\n PAYMENT_UNIT_COMMISSION: 'PAYMENT_UNIT_COMMISSION',\n RATE_COMMISSION_ZERO: 'RATE_COMMISSION_ZERO',\n EFFECTIVE_DATE_BEFORE_HIRE: 'EFFECTIVE_DATE_BEFORE_HIRE',\n} as const\n\nexport type CompensationErrorCode =\n (typeof CompensationErrorCodes)[keyof typeof CompensationErrorCodes]\n\nconst fieldValidators = {\n /**\n * Optional in both modes. Setting title here scopes the change to this\n * compensation's `effectiveDate` — pair it with a future-dated comp to\n * schedule a promotion title alongside a rate change. Use\n * `useJobForm.Fields.Title` instead when creating a job (title is required\n * by the API on job creation) or when renaming the active role\n * immediately, and avoid rendering both fields on the same screen.\n */\n title: z.string(),\n // `flsaStatus` is `.optional()` so the field can render an empty placeholder\n // until the user (or partner default) picks one. Requiredness is still\n // enforced via `requiredFieldsConfig` on submit in `create` mode.\n flsaStatus: z\n .enum([\n FlsaStatus.EXEMPT,\n FlsaStatus.SALARIED_NONEXEMPT,\n FlsaStatus.NONEXEMPT,\n FlsaStatus.OWNER,\n FlsaStatus.COMMISSION_ONLY_EXEMPT,\n FlsaStatus.COMMISSION_ONLY_NONEXEMPT,\n ])\n .optional(),\n paymentUnit: z.enum([\n PAY_PERIODS.HOUR,\n PAY_PERIODS.WEEK,\n PAY_PERIODS.MONTH,\n PAY_PERIODS.YEAR,\n PAY_PERIODS.PAYCHECK,\n ]),\n rate: z.preprocess(coerceNaN(0), z.number()),\n /**\n * The effective date a new compensation should take effect on.\n *\n * - **create mode (`compensationId` absent)**: required; partners typically default\n * to the parent job's `hireDate` (onboarding stub-fill) or a future date\n * (rate change). Must be on or after `hireDate`. Server-side this maps to\n * POST /v1/jobs/:jobId/compensations.\n * - **update mode (`compensationId` present)**: optional; if omitted the API\n * keeps the existing effective date. The `hireDate` lower bound is **not**\n * enforced — loaded values may legitimately predate the hire date. Maps to\n * PUT /v1/compensations/:id.\n */\n effectiveDate: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n adjustForMinimumWage: z.boolean(),\n minimumWageId: z.string(),\n}\n\nexport type CompensationFormData = {\n [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>\n}\n\nconst requiredFieldsConfig = {\n title: 'never',\n flsaStatus: 'create',\n paymentUnit: 'create',\n rate: 'create',\n effectiveDate: 'create',\n minimumWageId: data => data.adjustForMinimumWage,\n} satisfies RequiredFieldConfig<typeof fieldValidators>\n\nfunction validateFlsaRules(data: CompensationFormData, ctx: z.RefinementCtx) {\n const { flsaStatus, paymentUnit, rate } = data\n\n if (\n flsaStatus === FlsaStatus.EXEMPT ||\n flsaStatus === FlsaStatus.SALARIED_NONEXEMPT ||\n flsaStatus === FlsaStatus.NONEXEMPT\n ) {\n // Surface the EXEMPT salary-threshold issue *before* the generic minimum,\n // so a partner setting rate=0 with EXEMPT sees the more actionable\n // \"must meet salary threshold\" message rather than the generic\n // \"amount must be at least $1.00\".\n if (\n flsaStatus === FlsaStatus.EXEMPT &&\n yearlyRate(rate, paymentUnit) < FLSA_OVERTIME_SALARY_LIMIT\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: CompensationErrorCodes.RATE_EXEMPT_THRESHOLD,\n })\n } else if (rate < 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: CompensationErrorCodes.RATE_MINIMUM,\n })\n }\n } else if (flsaStatus === FlsaStatus.OWNER) {\n if (paymentUnit !== PAY_PERIODS.PAYCHECK) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['paymentUnit'],\n message: CompensationErrorCodes.PAYMENT_UNIT_OWNER,\n })\n }\n if (rate < 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: CompensationErrorCodes.RATE_MINIMUM,\n })\n }\n } else if (\n flsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT ||\n flsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT\n ) {\n if (paymentUnit !== PAY_PERIODS.YEAR) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['paymentUnit'],\n message: CompensationErrorCodes.PAYMENT_UNIT_COMMISSION,\n })\n }\n if (rate !== 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: CompensationErrorCodes.RATE_COMMISSION_ZERO,\n })\n }\n }\n}\n\nexport type CompensationOptionalFieldsToRequire = OptionalFieldsToRequire<\n typeof requiredFieldsConfig\n>\nexport type CompensationFormOutputs = CompensationFormData\n\nexport interface CompensationSchemaOptions {\n mode?: 'create' | 'update'\n optionalFieldsToRequire?: CompensationOptionalFieldsToRequire\n /**\n * Lower bound for `effectiveDate` (typically the parent job's `hireDate`).\n * Only enforced in `create` mode — on `update` the loaded effective date\n * may legitimately predate the hire date and is left as-is. Surfaces an\n * `EFFECTIVE_DATE_BEFORE_HIRE` issue when violated.\n */\n hireDate?: string | null\n /**\n * When `false`, drops `effectiveDate` from the validated shape — the field\n * becomes hook-managed (e.g. seeded from the parent job's `hireDate` during\n * onboarding). Partners may still supply the value at submit time via\n * `CompensationSubmitOptions.effectiveDate`. Defaults to `true`.\n */\n withEffectiveDateField?: boolean\n}\n\nexport function createCompensationSchema(options: CompensationSchemaOptions = {}) {\n const {\n mode = 'create',\n optionalFieldsToRequire,\n hireDate,\n withEffectiveDateField = true,\n } = options\n\n return buildFormSchema(fieldValidators, {\n requiredFieldsConfig,\n requiredErrorCode: CompensationErrorCodes.REQUIRED,\n mode,\n optionalFieldsToRequire,\n excludeFields: withEffectiveDateField ? [] : ['effectiveDate'],\n superRefine: (data, ctx) => {\n validateFlsaRules(data, ctx)\n // Only enforce the hire-date lower bound when picking a brand-new\n // effective date (create mode). On update, the loaded effectiveDate\n // can legitimately predate the parent job's hireDate (e.g. carried\n // over from a stub or out-of-order data) and the API accepts the\n // unchanged value or omitting it entirely. Blocking the submit here\n // would trap partners whose flow doesn't render Fields.EffectiveDate.\n // When `withEffectiveDateField` is false the field is excluded from\n // the shape and `data.effectiveDate` is undefined — this check\n // naturally short-circuits.\n if (mode === 'create' && hireDate && data.effectiveDate && data.effectiveDate < hireDate) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['effectiveDate'],\n message: CompensationErrorCodes.EFFECTIVE_DATE_BEFORE_HIRE,\n })\n }\n },\n })\n}\n"],"names":["CompensationErrorCodes","fieldValidators","z","FlsaStatus","PAY_PERIODS","coerceNaN","coerceToISODate","requiredFieldsConfig","data","validateFlsaRules","ctx","flsaStatus","paymentUnit","rate","yearlyRate","FLSA_OVERTIME_SALARY_LIMIT","createCompensationSchema","options","mode","optionalFieldsToRequire","hireDate","withEffectiveDateField","buildFormSchema"],"mappings":";;;;;AAYO,MAAMA,IAAyB;AAAA,EACpC,UAAU;AAAA,EACV,cAAc;AAAA,EACd,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,sBAAsB;AAAA,EACtB,4BAA4B;AAC9B,GAKMC,IAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStB,OAAOC,EAAE,OAAA;AAAA;AAAA;AAAA;AAAA,EAIT,YAAYA,EACT,KAAK;AAAA,IACJC,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,EAAA,CACZ,EACA,SAAA;AAAA,EACH,aAAaD,EAAE,KAAK;AAAA,IAClBE,EAAY;AAAA,IACZA,EAAY;AAAA,IACZA,EAAY;AAAA,IACZA,EAAY;AAAA,IACZA,EAAY;AAAA,EAAA,CACb;AAAA,EACD,MAAMF,EAAE,WAAWG,EAAU,CAAC,GAAGH,EAAE,QAAQ;AAAA;AAAA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MR,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,aAAa;AAAA,IACpB,SAASF,EAAuB;AAAA,EAAA,CACjC,GAECa,MAAS,KACXH,EAAI,SAAS;AAAA,IACX,MAAMR,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,MAAM;AAAA,IACb,SAASF,EAAuB;AAAA,EAAA,CACjC;AAGP;AA0BO,SAASgB,EAAyBC,IAAqC,IAAI;AAChF,QAAM;AAAA,IACJ,MAAAC,IAAO;AAAA,IACP,yBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,wBAAAC,IAAyB;AAAA,EAAA,IACvBJ;AAEJ,SAAOK,EAAgBrB,GAAiB;AAAA,IACtC,sBAAAM;AAAA,IACA,mBAAmBP,EAAuB;AAAA,IAC1C,MAAAkB;AAAA,IACA,yBAAAC;AAAA,IACA,eAAeE,IAAyB,KAAK,CAAC,eAAe;AAAA,IAC7D,aAAa,CAACb,GAAME,MAAQ;AAC1B,MAAAD,EAAkBD,GAAME,CAAG,GAUvBQ,MAAS,YAAYE,KAAYZ,EAAK,iBAAiBA,EAAK,gBAAgBY,KAC9EV,EAAI,SAAS;AAAA,QACX,MAAMR,EAAE,aAAa;AAAA,QACrB,MAAM,CAAC,eAAe;AAAA,QACtB,SAASF,EAAuB;AAAA,MAAA,CACjC;AAAA,IAEL;AAAA,EAAA,CACD;AACH;"}
1
+ {"version":3,"file":"compensationSchema.js","sources":["../../../../../../src/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n buildFormSchema,\n type RequiredFieldConfig,\n type OptionalFieldsToRequire,\n} from '@/partner-hook-utils/form/buildFormSchema'\nimport { coerceNaN, coerceToISODate } from '@/partner-hook-utils/form/preprocessors'\nimport { FLSA_OVERTIME_SALARY_LIMIT, FlsaStatus, PAY_PERIODS } from '@/shared/constants'\nimport { yearlyRate } from '@/helpers/payRateCalculator'\n\n// ── Error codes ────────────────────────────────────────────────────────\n\nexport const CompensationErrorCodes = {\n REQUIRED: 'REQUIRED',\n RATE_MINIMUM: 'RATE_MINIMUM',\n RATE_EXEMPT_THRESHOLD: 'RATE_EXEMPT_THRESHOLD',\n PAYMENT_UNIT_OWNER: 'PAYMENT_UNIT_OWNER',\n PAYMENT_UNIT_COMMISSION: 'PAYMENT_UNIT_COMMISSION',\n RATE_COMMISSION_ZERO: 'RATE_COMMISSION_ZERO',\n EFFECTIVE_DATE_BEFORE_HIRE: 'EFFECTIVE_DATE_BEFORE_HIRE',\n EFFECTIVE_DATE_BEFORE_MIN: 'EFFECTIVE_DATE_BEFORE_MIN',\n} as const\n\nexport type CompensationErrorCode =\n (typeof CompensationErrorCodes)[keyof typeof CompensationErrorCodes]\n\nconst fieldValidators = {\n /**\n * Optional in both modes. Setting title here scopes the change to this\n * compensation's `effectiveDate` — pair it with a future-dated comp to\n * schedule a promotion title alongside a rate change. Use\n * `useJobForm.Fields.Title` instead when creating a job (title is required\n * by the API on job creation) or when renaming the active role\n * immediately, and avoid rendering both fields on the same screen.\n */\n title: z.string(),\n // `flsaStatus` is `.optional()` so the field can render an empty placeholder\n // until the user (or partner default) picks one. Requiredness is still\n // enforced via `requiredFieldsConfig` on submit in `create` mode.\n flsaStatus: z\n .enum([\n FlsaStatus.EXEMPT,\n FlsaStatus.SALARIED_NONEXEMPT,\n FlsaStatus.NONEXEMPT,\n FlsaStatus.OWNER,\n FlsaStatus.COMMISSION_ONLY_EXEMPT,\n FlsaStatus.COMMISSION_ONLY_NONEXEMPT,\n ])\n .optional(),\n paymentUnit: z.enum([\n PAY_PERIODS.HOUR,\n PAY_PERIODS.WEEK,\n PAY_PERIODS.MONTH,\n PAY_PERIODS.YEAR,\n PAY_PERIODS.PAYCHECK,\n ]),\n rate: z.preprocess(coerceNaN(0), z.number()),\n /**\n * The effective date a new compensation should take effect on.\n *\n * - **create mode (`compensationId` absent)**: required; partners typically default\n * to the parent job's `hireDate` (onboarding stub-fill) or a future date\n * (rate change). Must be on or after `hireDate`. Server-side this maps to\n * POST /v1/jobs/:jobId/compensations.\n * - **update mode (`compensationId` present)**: optional; if omitted the API\n * keeps the existing effective date. The `hireDate` lower bound is **not**\n * enforced — loaded values may legitimately predate the hire date. Maps to\n * PUT /v1/compensations/:id.\n */\n effectiveDate: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n adjustForMinimumWage: z.boolean(),\n minimumWageId: z.string(),\n}\n\nexport type CompensationFormData = {\n [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>\n}\n\nconst requiredFieldsConfig = {\n title: 'never',\n flsaStatus: 'create',\n paymentUnit: 'create',\n rate: 'create',\n effectiveDate: 'create',\n minimumWageId: data => data.adjustForMinimumWage,\n} satisfies RequiredFieldConfig<typeof fieldValidators>\n\nfunction validateFlsaRules(data: CompensationFormData, ctx: z.RefinementCtx) {\n const { flsaStatus, paymentUnit, rate } = data\n\n if (\n flsaStatus === FlsaStatus.EXEMPT ||\n flsaStatus === FlsaStatus.SALARIED_NONEXEMPT ||\n flsaStatus === FlsaStatus.NONEXEMPT\n ) {\n // Surface the EXEMPT salary-threshold issue *before* the generic minimum,\n // so a partner setting rate=0 with EXEMPT sees the more actionable\n // \"must meet salary threshold\" message rather than the generic\n // \"amount must be at least $1.00\".\n if (\n flsaStatus === FlsaStatus.EXEMPT &&\n yearlyRate(rate, paymentUnit) < FLSA_OVERTIME_SALARY_LIMIT\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: CompensationErrorCodes.RATE_EXEMPT_THRESHOLD,\n })\n } else if (rate < 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: CompensationErrorCodes.RATE_MINIMUM,\n })\n }\n } else if (flsaStatus === FlsaStatus.OWNER) {\n if (paymentUnit !== PAY_PERIODS.PAYCHECK) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['paymentUnit'],\n message: CompensationErrorCodes.PAYMENT_UNIT_OWNER,\n })\n }\n if (rate < 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: CompensationErrorCodes.RATE_MINIMUM,\n })\n }\n } else if (\n flsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT ||\n flsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT\n ) {\n if (paymentUnit !== PAY_PERIODS.YEAR) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['paymentUnit'],\n message: CompensationErrorCodes.PAYMENT_UNIT_COMMISSION,\n })\n }\n if (rate !== 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: CompensationErrorCodes.RATE_COMMISSION_ZERO,\n })\n }\n }\n}\n\nexport type CompensationOptionalFieldsToRequire = OptionalFieldsToRequire<\n typeof requiredFieldsConfig\n>\nexport type CompensationFormOutputs = CompensationFormData\n\nexport interface CompensationSchemaOptions {\n mode?: 'create' | 'update'\n optionalFieldsToRequire?: CompensationOptionalFieldsToRequire\n /**\n * Lower bound for `effectiveDate` (typically the parent job's `hireDate`).\n * Only enforced in `create` mode — on `update` the loaded effective date\n * may legitimately predate the hire date and is left as-is. Surfaces an\n * `EFFECTIVE_DATE_BEFORE_HIRE` issue when violated.\n */\n hireDate?: string | null\n /**\n * Absolute lower bound for `effectiveDate`, enforced in both create and\n * update modes whenever provided. Typically `addDays(today, 1)` (tomorrow)\n * for management screens where effective dates must be in the future, or\n * `max(tomorrow, hireDate)` for secondary new jobs. Surfaces an\n * `EFFECTIVE_DATE_BEFORE_MIN` issue when violated.\n *\n * **Callers must only pass this when the carve-out cannot fire.** The\n * carve-out (`willDeleteSecondaryJobs` in update mode) forces `effectiveDate`\n * to today on a disabled field — passing `minEffectiveDate` for a primary\n * job in update mode would cause a spurious validation failure on submit.\n * Secondary jobs are safe because their FLSA field is hidden, preventing the\n * carve-out from activating.\n */\n minEffectiveDate?: string | null\n /**\n * When `false`, drops `effectiveDate` from the validated shape — the field\n * becomes hook-managed (e.g. seeded from the parent job's `hireDate` during\n * onboarding). Partners may still supply the value at submit time via\n * `CompensationSubmitOptions.effectiveDate`. Defaults to `true`.\n */\n withEffectiveDateField?: boolean\n}\n\nexport function createCompensationSchema(options: CompensationSchemaOptions = {}) {\n const {\n mode = 'create',\n optionalFieldsToRequire,\n hireDate,\n minEffectiveDate,\n withEffectiveDateField = true,\n } = options\n\n return buildFormSchema(fieldValidators, {\n requiredFieldsConfig,\n requiredErrorCode: CompensationErrorCodes.REQUIRED,\n mode,\n optionalFieldsToRequire,\n excludeFields: withEffectiveDateField ? [] : ['effectiveDate'],\n superRefine: (data, ctx) => {\n validateFlsaRules(data, ctx)\n // Enforce the hire-date lower bound in create mode always, and in\n // update mode when `minEffectiveDate` is also set (management screens\n // where the user is actively picking a new date). On plain update\n // without `minEffectiveDate`, the loaded effectiveDate can legitimately\n // predate the hire date (stub or out-of-order data) and the API\n // accepts the unchanged value — blocking the submit would trap\n // partners whose flow doesn't render Fields.EffectiveDate.\n // When `withEffectiveDateField` is false the field is excluded from\n // the shape and `data.effectiveDate` is undefined — this check\n // naturally short-circuits.\n if (\n hireDate &&\n data.effectiveDate &&\n data.effectiveDate < hireDate &&\n (mode === 'create' || minEffectiveDate)\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['effectiveDate'],\n message: CompensationErrorCodes.EFFECTIVE_DATE_BEFORE_HIRE,\n })\n }\n // Enforce the caller-supplied minimum effective date in both modes.\n // Callers must only pass this when the carve-out cannot fire (see\n // CompensationSchemaOptions.minEffectiveDate for details).\n if (minEffectiveDate && data.effectiveDate && data.effectiveDate < minEffectiveDate) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['effectiveDate'],\n message: CompensationErrorCodes.EFFECTIVE_DATE_BEFORE_MIN,\n })\n }\n },\n })\n}\n"],"names":["CompensationErrorCodes","fieldValidators","z","FlsaStatus","PAY_PERIODS","coerceNaN","coerceToISODate","requiredFieldsConfig","data","validateFlsaRules","ctx","flsaStatus","paymentUnit","rate","yearlyRate","FLSA_OVERTIME_SALARY_LIMIT","createCompensationSchema","options","mode","optionalFieldsToRequire","hireDate","minEffectiveDate","withEffectiveDateField","buildFormSchema"],"mappings":";;;;;AAYO,MAAMA,IAAyB;AAAA,EACpC,UAAU;AAAA,EACV,cAAc;AAAA,EACd,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,sBAAsB;AAAA,EACtB,4BAA4B;AAAA,EAC5B,2BAA2B;AAC7B,GAKMC,IAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStB,OAAOC,EAAE,OAAA;AAAA;AAAA;AAAA;AAAA,EAIT,YAAYA,EACT,KAAK;AAAA,IACJC,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,EAAA,CACZ,EACA,SAAA;AAAA,EACH,aAAaD,EAAE,KAAK;AAAA,IAClBE,EAAY;AAAA,IACZA,EAAY;AAAA,IACZA,EAAY;AAAA,IACZA,EAAY;AAAA,IACZA,EAAY;AAAA,EAAA,CACb;AAAA,EACD,MAAMF,EAAE,WAAWG,EAAU,CAAC,GAAGH,EAAE,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa3C,eAAeA,EAAE,WAAWI,GAAiBJ,EAAE,IAAI,OAAO,UAAU;AAAA,EACpE,sBAAsBA,EAAE,QAAA;AAAA,EACxB,eAAeA,EAAE,OAAA;AACnB,GAMMK,IAAuB;AAAA,EAC3B,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,MAAM;AAAA,EACN,eAAe;AAAA,EACf,eAAe,OAAQC,EAAK;AAC9B;AAEA,SAASC,EAAkBD,GAA4BE,GAAsB;AAC3E,QAAM,EAAE,YAAAC,GAAY,aAAAC,GAAa,MAAA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,GAAiB;AAAA,IACtC,sBAAAM;AAAA,IACA,mBAAmBP,EAAuB;AAAA,IAC1C,MAAAkB;AAAA,IACA,yBAAAC;AAAA,IACA,eAAeG,IAAyB,KAAK,CAAC,eAAe;AAAA,IAC7D,aAAa,CAACd,GAAME,MAAQ;AAC1B,MAAAD,EAAkBD,GAAME,CAAG,GAYzBU,KACAZ,EAAK,iBACLA,EAAK,gBAAgBY,MACpBF,MAAS,YAAYG,MAEtBX,EAAI,SAAS;AAAA,QACX,MAAMR,EAAE,aAAa;AAAA,QACrB,MAAM,CAAC,eAAe;AAAA,QACtB,SAASF,EAAuB;AAAA,MAAA,CACjC,GAKCqB,KAAoBb,EAAK,iBAAiBA,EAAK,gBAAgBa,KACjEX,EAAI,SAAS;AAAA,QACX,MAAMR,EAAE,aAAa;AAAA,QACrB,MAAM,CAAC,eAAe;AAAA,QACtB,SAASF,EAAuB;AAAA,MAAA,CACjC;AAAA,IAEL;AAAA,EAAA,CACD;AACH;"}
@@ -10,7 +10,7 @@ import { DatePickerHookFieldProps } from '../../../../../partner-hook-utils/form
10
10
  import { HookFieldProps } from '../../../../../partner-hook-utils/types';
11
11
  export type RequiredValidation = typeof CompensationErrorCodes.REQUIRED;
12
12
  export type RateValidation = (typeof CompensationErrorCodes)['REQUIRED' | 'RATE_MINIMUM' | 'RATE_EXEMPT_THRESHOLD'];
13
- export type EffectiveDateValidation = (typeof CompensationErrorCodes)['REQUIRED' | 'EFFECTIVE_DATE_BEFORE_HIRE'];
13
+ export type EffectiveDateValidation = (typeof CompensationErrorCodes)['REQUIRED' | 'EFFECTIVE_DATE_BEFORE_HIRE' | 'EFFECTIVE_DATE_BEFORE_MIN'];
14
14
  export type TitleFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>;
15
15
  export declare function TitleField(props: TitleFieldProps): import("react/jsx-runtime").JSX.Element;
16
16
  export type FlsaStatusFieldProps = HookFieldProps<SelectHookFieldProps<RequiredValidation, FlsaStatusType>>;
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sources":["../../../../../../src/components/Employee/Compensation/shared/useCompensationForm/fields.tsx"],"sourcesContent":["import type { MinimumWage } from '@gusto/embedded-api/models/components/minimumwage'\nimport type { FlsaStatusType } from '@gusto/embedded-api/models/components/flsastatustype'\nimport type { PaymentUnit } from '@gusto/embedded-api/models/components/compensation'\nimport type { CompensationErrorCodes } from './compensationSchema'\nimport type { TextInputHookFieldProps } from '@/partner-hook-utils/form/fields/TextInputHookField'\nimport type { SelectHookFieldProps } from '@/partner-hook-utils/form/fields/SelectHookField'\nimport type { NumberInputHookFieldProps } from '@/partner-hook-utils/form/fields/NumberInputHookField'\nimport type { CheckboxHookFieldProps } from '@/partner-hook-utils/form/fields/CheckboxHookField'\nimport type { DatePickerHookFieldProps } from '@/partner-hook-utils/form/fields/DatePickerHookField'\nimport {\n TextInputHookField,\n SelectHookField,\n NumberInputHookField,\n CheckboxHookField,\n DatePickerHookField,\n} from '@/partner-hook-utils/form/fields'\nimport type { HookFieldProps } from '@/partner-hook-utils/types'\n\nexport type RequiredValidation = typeof CompensationErrorCodes.REQUIRED\nexport type RateValidation = (typeof CompensationErrorCodes)[\n | 'REQUIRED'\n | 'RATE_MINIMUM'\n | 'RATE_EXEMPT_THRESHOLD']\nexport type EffectiveDateValidation = (typeof CompensationErrorCodes)[\n | 'REQUIRED'\n | 'EFFECTIVE_DATE_BEFORE_HIRE']\n\nexport type TitleFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\nexport function TitleField(props: TitleFieldProps) {\n return <TextInputHookField {...props} name=\"title\" />\n}\n\nexport type FlsaStatusFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, FlsaStatusType>\n>\n\nexport function FlsaStatusField(props: FlsaStatusFieldProps) {\n return <SelectHookField {...props} name=\"flsaStatus\" />\n}\n\nexport type RateFieldProps = HookFieldProps<NumberInputHookFieldProps<RateValidation>>\n\nexport function RateField(props: RateFieldProps) {\n return <NumberInputHookField {...props} name=\"rate\" format=\"currency\" min={0} />\n}\n\nexport type PaymentUnitFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, PaymentUnit>\n>\n\nexport function PaymentUnitField(props: PaymentUnitFieldProps) {\n return <SelectHookField {...props} name=\"paymentUnit\" />\n}\n\nexport type AdjustForMinimumWageFieldProps = HookFieldProps<CheckboxHookFieldProps>\n\nexport function AdjustForMinimumWageField(props: AdjustForMinimumWageFieldProps) {\n return <CheckboxHookField {...props} name=\"adjustForMinimumWage\" />\n}\n\nexport type MinimumWageIdFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, MinimumWage>\n>\n\nexport function MinimumWageIdField(props: MinimumWageIdFieldProps) {\n return <SelectHookField {...props} name=\"minimumWageId\" />\n}\n\nexport type EffectiveDateFieldProps = HookFieldProps<\n DatePickerHookFieldProps<EffectiveDateValidation>\n>\n\nexport function EffectiveDateField(props: EffectiveDateFieldProps) {\n return <DatePickerHookField {...props} name=\"effectiveDate\" />\n}\n"],"names":["TitleField","props","jsx","TextInputHookField","FlsaStatusField","SelectHookField","RateField","NumberInputHookField","PaymentUnitField","AdjustForMinimumWageField","CheckboxHookField","MinimumWageIdField","EffectiveDateField","DatePickerHookField"],"mappings":";;;;;;AA6BO,SAASA,EAAWC,GAAwB;AACjD,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,SAAQ;AACrD;AAMO,SAASG,EAAgBH,GAA6B;AAC3D,SAAO,gBAAAC,EAACG,GAAA,EAAiB,GAAGJ,GAAO,MAAK,cAAa;AACvD;AAIO,SAASK,EAAUL,GAAuB;AAC/C,SAAO,gBAAAC,EAACK,KAAsB,GAAGN,GAAO,MAAK,QAAO,QAAO,YAAW,KAAK,EAAA,CAAG;AAChF;AAMO,SAASO,EAAiBP,GAA8B;AAC7D,SAAO,gBAAAC,EAACG,GAAA,EAAiB,GAAGJ,GAAO,MAAK,eAAc;AACxD;AAIO,SAASQ,EAA0BR,GAAuC;AAC/E,SAAO,gBAAAC,EAACQ,GAAA,EAAmB,GAAGT,GAAO,MAAK,wBAAuB;AACnE;AAMO,SAASU,EAAmBV,GAAgC;AACjE,SAAO,gBAAAC,EAACG,GAAA,EAAiB,GAAGJ,GAAO,MAAK,iBAAgB;AAC1D;AAMO,SAASW,EAAmBX,GAAgC;AACjE,SAAO,gBAAAC,EAACW,GAAA,EAAqB,GAAGZ,GAAO,MAAK,iBAAgB;AAC9D;"}
1
+ {"version":3,"file":"fields.js","sources":["../../../../../../src/components/Employee/Compensation/shared/useCompensationForm/fields.tsx"],"sourcesContent":["import type { MinimumWage } from '@gusto/embedded-api/models/components/minimumwage'\nimport type { FlsaStatusType } from '@gusto/embedded-api/models/components/flsastatustype'\nimport type { PaymentUnit } from '@gusto/embedded-api/models/components/compensation'\nimport type { CompensationErrorCodes } from './compensationSchema'\nimport type { TextInputHookFieldProps } from '@/partner-hook-utils/form/fields/TextInputHookField'\nimport type { SelectHookFieldProps } from '@/partner-hook-utils/form/fields/SelectHookField'\nimport type { NumberInputHookFieldProps } from '@/partner-hook-utils/form/fields/NumberInputHookField'\nimport type { CheckboxHookFieldProps } from '@/partner-hook-utils/form/fields/CheckboxHookField'\nimport type { DatePickerHookFieldProps } from '@/partner-hook-utils/form/fields/DatePickerHookField'\nimport {\n TextInputHookField,\n SelectHookField,\n NumberInputHookField,\n CheckboxHookField,\n DatePickerHookField,\n} from '@/partner-hook-utils/form/fields'\nimport type { HookFieldProps } from '@/partner-hook-utils/types'\n\nexport type RequiredValidation = typeof CompensationErrorCodes.REQUIRED\nexport type RateValidation = (typeof CompensationErrorCodes)[\n | 'REQUIRED'\n | 'RATE_MINIMUM'\n | 'RATE_EXEMPT_THRESHOLD']\nexport type EffectiveDateValidation = (typeof CompensationErrorCodes)[\n | 'REQUIRED'\n | 'EFFECTIVE_DATE_BEFORE_HIRE'\n | 'EFFECTIVE_DATE_BEFORE_MIN']\n\nexport type TitleFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\nexport function TitleField(props: TitleFieldProps) {\n return <TextInputHookField {...props} name=\"title\" />\n}\n\nexport type FlsaStatusFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, FlsaStatusType>\n>\n\nexport function FlsaStatusField(props: FlsaStatusFieldProps) {\n return <SelectHookField {...props} name=\"flsaStatus\" />\n}\n\nexport type RateFieldProps = HookFieldProps<NumberInputHookFieldProps<RateValidation>>\n\nexport function RateField(props: RateFieldProps) {\n return <NumberInputHookField {...props} name=\"rate\" format=\"currency\" min={0} />\n}\n\nexport type PaymentUnitFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, PaymentUnit>\n>\n\nexport function PaymentUnitField(props: PaymentUnitFieldProps) {\n return <SelectHookField {...props} name=\"paymentUnit\" />\n}\n\nexport type AdjustForMinimumWageFieldProps = HookFieldProps<CheckboxHookFieldProps>\n\nexport function AdjustForMinimumWageField(props: AdjustForMinimumWageFieldProps) {\n return <CheckboxHookField {...props} name=\"adjustForMinimumWage\" />\n}\n\nexport type MinimumWageIdFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, MinimumWage>\n>\n\nexport function MinimumWageIdField(props: MinimumWageIdFieldProps) {\n return <SelectHookField {...props} name=\"minimumWageId\" />\n}\n\nexport type EffectiveDateFieldProps = HookFieldProps<\n DatePickerHookFieldProps<EffectiveDateValidation>\n>\n\nexport function EffectiveDateField(props: EffectiveDateFieldProps) {\n return <DatePickerHookField {...props} name=\"effectiveDate\" />\n}\n"],"names":["TitleField","props","jsx","TextInputHookField","FlsaStatusField","SelectHookField","RateField","NumberInputHookField","PaymentUnitField","AdjustForMinimumWageField","CheckboxHookField","MinimumWageIdField","EffectiveDateField","DatePickerHookField"],"mappings":";;;;;;AA8BO,SAASA,EAAWC,GAAwB;AACjD,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,SAAQ;AACrD;AAMO,SAASG,EAAgBH,GAA6B;AAC3D,SAAO,gBAAAC,EAACG,GAAA,EAAiB,GAAGJ,GAAO,MAAK,cAAa;AACvD;AAIO,SAASK,EAAUL,GAAuB;AAC/C,SAAO,gBAAAC,EAACK,KAAsB,GAAGN,GAAO,MAAK,QAAO,QAAO,YAAW,KAAK,EAAA,CAAG;AAChF;AAMO,SAASO,EAAiBP,GAA8B;AAC7D,SAAO,gBAAAC,EAACG,GAAA,EAAiB,GAAGJ,GAAO,MAAK,eAAc;AACxD;AAIO,SAASQ,EAA0BR,GAAuC;AAC/E,SAAO,gBAAAC,EAACQ,GAAA,EAAmB,GAAGT,GAAO,MAAK,wBAAuB;AACnE;AAMO,SAASU,EAAmBV,GAAgC;AACjE,SAAO,gBAAAC,EAACG,GAAA,EAAiB,GAAGJ,GAAO,MAAK,iBAAgB;AAC1D;AAMO,SAASW,EAAmBX,GAAgC;AACjE,SAAO,gBAAAC,EAACW,GAAA,EAAqB,GAAGZ,GAAO,MAAK,iBAAgB;AAC9D;"}