@gusto/embedded-react-sdk 0.28.0 → 0.30.0

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 (250) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/components/Common/Fields/PercentageField/PercentageField.d.ts +8 -0
  3. package/dist/components/Common/Fields/PercentageField/PercentageField.js +58 -0
  4. package/dist/components/Common/Fields/PercentageField/PercentageField.js.map +1 -0
  5. package/dist/components/Common/Fields/PercentageField/index.d.ts +2 -0
  6. package/dist/components/Common/SignatureForm/SignatureForm.js +11 -12
  7. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  8. package/dist/components/Common/SignatureForm/SignatureFormActions.js +1 -1
  9. package/dist/components/Common/SignatureForm/SignatureFormFields.js +2 -2
  10. package/dist/components/Common/TaxInputs/TaxInputs.js +125 -98
  11. package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
  12. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  13. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  14. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  15. package/dist/components/Common/UI/Tabs/Tabs.module.scss.js +5 -5
  16. package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
  17. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
  18. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
  19. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +17 -16
  20. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  21. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
  22. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  23. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
  24. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +6 -5
  25. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  26. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
  27. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  28. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
  29. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  30. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -6
  31. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  32. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
  33. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  34. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -6
  35. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  36. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
  37. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  38. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  39. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +2 -2
  40. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  41. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  42. package/dist/components/Company/FederalTaxes/FederalTaxes.js +2 -2
  43. package/dist/components/Company/FederalTaxes/Form.js +3 -4
  44. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  45. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
  46. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  47. package/dist/components/Company/Industry/Context.js +6 -7
  48. package/dist/components/Company/Industry/Context.js.map +1 -1
  49. package/dist/components/Company/Locations/LocationForm/Form.js +6 -5
  50. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  51. package/dist/components/Company/Locations/LocationForm/LocationForm.js +2 -2
  52. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
  53. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  54. package/dist/components/Company/Locations/LocationsList/LocationsList.js +39 -56
  55. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  56. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
  57. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  58. package/dist/components/Company/OnboardingOverview/Completed.js +2 -3
  59. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  60. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +2 -3
  61. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  62. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -2
  63. package/dist/components/Company/OnboardingOverview/context.js +3 -4
  64. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  65. package/dist/components/Company/PaySchedule/PaySchedule.js +2 -2
  66. package/dist/components/Company/PaySchedule/_parts/Edit.js +24 -23
  67. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  68. package/dist/components/Company/PaySchedule/_parts/Head.js +8 -9
  69. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  70. package/dist/components/Company/PaySchedule/_parts/List.js +11 -12
  71. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  72. package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
  73. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  74. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +60 -67
  75. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  76. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
  77. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  78. package/dist/components/Company/StateTaxes/StateTaxesForm/index.d.ts +2 -0
  79. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
  80. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  81. package/dist/components/Company/StateTaxes/StateTaxesList/index.d.ts +2 -0
  82. package/dist/components/Company/index.d.ts +2 -0
  83. package/dist/components/Company/index.js +21 -17
  84. package/dist/components/Company/index.js.map +1 -1
  85. package/dist/components/Contractor/Address/Address.js +2 -2
  86. package/dist/components/Contractor/Address/Form.js +8 -7
  87. package/dist/components/Contractor/Address/Form.js.map +1 -1
  88. package/dist/components/Contractor/Address/useAddress.js +5 -6
  89. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  90. package/dist/components/Contractor/ContractorList/index.js +17 -17
  91. package/dist/components/Contractor/ContractorList/useContractorList.d.ts +8 -8
  92. package/dist/components/Contractor/ContractorList/useContractorList.js +9 -25
  93. package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -1
  94. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -2
  95. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
  96. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +2 -3
  97. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  98. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +23 -22
  99. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
  100. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +7 -8
  101. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
  102. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +1 -1
  103. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +1 -0
  104. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +38 -24
  105. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
  106. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +1 -0
  107. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +95 -60
  108. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
  109. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +2 -3
  110. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  111. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +6 -7
  112. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  113. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +2 -3
  114. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  115. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +67 -42
  116. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
  117. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +3 -1
  118. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +40 -36
  119. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  120. package/dist/components/Contractor/Payments/types.d.ts +2 -0
  121. package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
  122. package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
  123. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  124. package/dist/components/Contractor/Submit/Submit.js +1 -1
  125. package/dist/components/Employee/Compensation/Edit.js +27 -23
  126. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  127. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +10 -11
  128. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  129. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +11 -12
  130. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  131. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +11 -12
  132. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  133. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +1 -1
  134. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +3 -2
  135. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
  136. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
  137. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -3
  138. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  139. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  140. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  141. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
  142. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  143. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  144. package/dist/components/Employee/EmployeeList/EmployeeList.js +77 -95
  145. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  146. package/dist/components/Employee/EmployeeList/Head.js +2 -3
  147. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  148. package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
  149. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  150. package/dist/components/Employee/FederalTaxes/FederalForm.js +7 -7
  151. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
  152. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  153. package/dist/components/Employee/Landing/Landing.js +8 -8
  154. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  155. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +2 -2
  156. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
  157. package/dist/components/Employee/PaymentMethod/Split.js +8 -8
  158. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
  159. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  160. package/dist/components/Employee/Profile/AdminPersonalDetails.js +1 -1
  161. package/dist/components/Employee/Profile/HomeAddress.js +10 -9
  162. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  163. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +11 -10
  164. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  165. package/dist/components/Employee/Profile/useProfile.js +3 -4
  166. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  167. package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
  168. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  169. package/dist/components/Employee/Taxes/FederalForm.js +7 -7
  170. package/dist/components/Employee/Taxes/useTaxes.js +3 -4
  171. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  172. package/dist/components/Flow/Flow.js +2 -3
  173. package/dist/components/Flow/Flow.js.map +1 -1
  174. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +16 -16
  175. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  176. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +4 -4
  177. package/dist/components/InformationRequests/InformationRequests.js +1 -1
  178. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -9
  179. package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js +1 -1
  180. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +2 -3
  181. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  182. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +12 -12
  183. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +4 -1
  184. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  185. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +3 -2
  186. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  187. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +50 -68
  188. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  189. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +39 -38
  190. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  191. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +17 -18
  192. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  193. package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +17 -0
  194. package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js +75 -0
  195. package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -0
  196. package/dist/components/Payroll/PayrollExecutionFlow/index.d.ts +3 -0
  197. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.d.ts +9 -0
  198. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +198 -0
  199. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -0
  200. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.test.d.ts +1 -0
  201. package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.d.ts +1 -0
  202. package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js +49 -0
  203. package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js.map +1 -0
  204. package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +17 -13
  205. package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
  206. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -0
  207. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
  208. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +3 -6
  209. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +115 -300
  210. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
  211. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.test.d.ts +1 -0
  212. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +2 -3
  213. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  214. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +2 -3
  215. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  216. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +15 -13
  217. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  218. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +3 -2
  219. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  220. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +2 -3
  221. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
  222. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +2 -3
  223. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  224. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +1 -1
  225. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +6 -6
  226. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +2 -3
  227. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
  228. package/dist/components/Payroll/index.d.ts +1 -0
  229. package/dist/components/Payroll/index.js +14 -12
  230. package/dist/components/Payroll/index.js.map +1 -1
  231. package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
  232. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  233. package/dist/helpers/percentageConversion.d.ts +3 -0
  234. package/dist/helpers/percentageConversion.js +27 -0
  235. package/dist/helpers/percentageConversion.js.map +1 -0
  236. package/dist/helpers/percentageConversion.test.d.ts +1 -0
  237. package/dist/hooks/usePagination/usePagination.d.ts +15 -0
  238. package/dist/hooks/usePagination/usePagination.js +37 -0
  239. package/dist/hooks/usePagination/usePagination.js.map +1 -0
  240. package/dist/hooks/usePagination/usePagination.test.d.ts +1 -0
  241. package/dist/i18n/en/Company.StateTaxes.json.js +1 -1
  242. package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +28 -28
  243. package/dist/i18n/en/common.json.d.ts +3 -1
  244. package/dist/i18n/en/common.json.js +1 -1
  245. package/dist/shared/constants.d.ts +2 -0
  246. package/dist/shared/constants.js +11 -10
  247. package/dist/shared/constants.js.map +1 -1
  248. package/dist/style.css +1 -1
  249. package/dist/types/i18next.d.ts +7 -0
  250. package/package.json +12 -10
@@ -6,22 +6,23 @@ import { usePaySchedule as T } from "../usePaySchedule.js";
6
6
  import l from "./Edit.module.scss.js";
7
7
  import { Flex as y } from "../../../Common/Flex/Flex.js";
8
8
  import { Grid as x } from "../../../Common/Grid/Grid.js";
9
- import { RadioGroupField as E } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
10
- import { TextInputField as N } from "../../../Common/Fields/TextInputField/TextInputField.js";
11
- import { DatePickerField as h } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
12
- import { NumberInputField as f } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
13
- import { useComponentContext as F } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
14
- import { useDateFormatter as R } from "../../../../hooks/useDateFormatter.js";
15
- import { SelectField as O } from "../../../Common/Fields/SelectField/SelectField.js";
16
- const J = () => {
17
- const n = F(), { t: e } = C("Company.PaySchedule"), P = R(), { payPeriodPreview: r, mode: u, payPreviewLoading: D } = T(), { setValue: d } = q(), [a, v] = g(0), i = p({ name: "frequency" }), o = p({ name: "customTwicePerMonth" }), b = i === "Twice per month" && o === "custom" || i === "Monthly", w = i === "Twice per month" && o === "custom";
9
+ import "classnames";
10
+ import { useComponentContext as E } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
+ import { useDateFormatter as N } from "../../../../hooks/useDateFormatter.js";
12
+ import { TextInputField as F } from "../../../Common/Fields/TextInputField/TextInputField.js";
13
+ import { SelectField as R } from "../../../Common/Fields/SelectField/SelectField.js";
14
+ import { RadioGroupField as O } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
+ import { NumberInputField as h } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
16
+ import { DatePickerField as f } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
17
+ const K = () => {
18
+ const o = E(), { t: e } = C("Company.PaySchedule"), P = N(), { payPeriodPreview: r, mode: u, payPreviewLoading: D } = T(), { setValue: d } = q(), [a, v] = g(0), i = p({ name: "frequency" }), n = p({ name: "customTwicePerMonth" }), b = i === "Twice per month" && n === "custom" || i === "Monthly", w = i === "Twice per month" && n === "custom";
18
19
  return S(() => {
19
- i === "Twice per month" && o === "1st15th" && (d("day1", 15), d("day2", 31));
20
- }, [i, o, d]), u !== "EDIT_PAY_SCHEDULE" && u !== "ADD_PAY_SCHEDULE" ? null : /* @__PURE__ */ t("div", { className: l.payScheduleContainer, children: /* @__PURE__ */ m(x, { gap: 32, gridTemplateColumns: { base: "1fr", small: "1fr 1fr" }, children: [
20
+ i === "Twice per month" && n === "1st15th" && (d("day1", 15), d("day2", 31));
21
+ }, [i, n, d]), u !== "EDIT_PAY_SCHEDULE" && u !== "ADD_PAY_SCHEDULE" ? null : /* @__PURE__ */ t("div", { className: l.payScheduleContainer, children: /* @__PURE__ */ m(x, { gap: 32, gridTemplateColumns: { base: "1fr", small: "1fr 1fr" }, children: [
21
22
  /* @__PURE__ */ t("div", { className: l.payScheduleForm, children: /* @__PURE__ */ m(y, { flexDirection: "column", children: [
22
- /* @__PURE__ */ t(N, { name: "customName", label: e("labels.name"), isRequired: !0 }),
23
+ /* @__PURE__ */ t(F, { name: "customName", label: e("labels.name"), isRequired: !0 }),
23
24
  /* @__PURE__ */ t(
24
- O,
25
+ R,
25
26
  {
26
27
  name: "frequency",
27
28
  label: e("labels.frequency"),
@@ -35,7 +36,7 @@ const J = () => {
35
36
  }
36
37
  ),
37
38
  i === "Twice per month" && /* @__PURE__ */ t(
38
- E,
39
+ O,
39
40
  {
40
41
  name: "customTwicePerMonth",
41
42
  label: e("labels.frequencyOptions"),
@@ -47,7 +48,7 @@ const J = () => {
47
48
  }
48
49
  ),
49
50
  /* @__PURE__ */ t(
50
- h,
51
+ f,
51
52
  {
52
53
  name: "anchorPayDate",
53
54
  label: e("labels.firstPayDate"),
@@ -56,7 +57,7 @@ const J = () => {
56
57
  }
57
58
  ),
58
59
  /* @__PURE__ */ t(
59
- h,
60
+ f,
60
61
  {
61
62
  name: "anchorEndOfPayPeriod",
62
63
  label: e("labels.firstPayPeriodEndDate"),
@@ -64,12 +65,12 @@ const J = () => {
64
65
  isRequired: !0
65
66
  }
66
67
  ),
67
- /* @__PURE__ */ t("div", { className: b ? "" : l.visuallyHidden, children: /* @__PURE__ */ t(f, { name: "day1", label: e("labels.firstPayDayOfTheMonth"), isRequired: !0 }) }),
68
- /* @__PURE__ */ t("div", { className: w ? "" : l.visuallyHidden, children: /* @__PURE__ */ t(f, { name: "day2", label: e("labels.lastPayDayOfTheMonth"), isRequired: !0 }) })
68
+ /* @__PURE__ */ t("div", { className: b ? "" : l.visuallyHidden, children: /* @__PURE__ */ t(h, { name: "day1", label: e("labels.firstPayDayOfTheMonth"), isRequired: !0 }) }),
69
+ /* @__PURE__ */ t("div", { className: w ? "" : l.visuallyHidden, children: /* @__PURE__ */ t(h, { name: "day2", label: e("labels.lastPayDayOfTheMonth"), isRequired: !0 }) })
69
70
  ] }) }),
70
71
  /* @__PURE__ */ t(y, { flexDirection: "column", gap: 4, justifyContent: "center", alignItems: "center", children: r && r[a] ? /* @__PURE__ */ m("div", { className: l.calendarContainer, children: [
71
72
  !D && /* @__PURE__ */ t(
72
- n.Select,
73
+ o.Select,
73
74
  {
74
75
  label: e("labels.preview"),
75
76
  isRequired: !0,
@@ -85,7 +86,7 @@ const J = () => {
85
86
  }
86
87
  ),
87
88
  /* @__PURE__ */ t(
88
- n.CalendarPreview,
89
+ o.CalendarPreview,
89
90
  {
90
91
  dateRange: {
91
92
  start: new Date(r[a].startDate),
@@ -108,11 +109,11 @@ const J = () => {
108
109
  a
109
110
  )
110
111
  ] }) : /* @__PURE__ */ t("div", { className: l.calendarContainer, children: /* @__PURE__ */ t(
111
- n.Alert,
112
+ o.Alert,
112
113
  {
113
114
  status: "info",
114
115
  label: e("previewAlert.title", "Pay Schedule Preview"),
115
- children: /* @__PURE__ */ t(n.Text, { children: e(
116
+ children: /* @__PURE__ */ t(o.Text, { children: e(
116
117
  "previewAlert.description",
117
118
  "Complete all the required fields on the left to see a preview of your pay schedule."
118
119
  ) })
@@ -121,6 +122,6 @@ const J = () => {
121
122
  ] }) });
122
123
  };
123
124
  export {
124
- J as Edit
125
+ K as Edit
125
126
  };
126
127
  //# sourceMappingURL=Edit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Edit.js","sources":["../../../../../src/components/Company/PaySchedule/_parts/Edit.tsx"],"sourcesContent":["import { useFormContext, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useEffect, useState } from 'react'\nimport type { PayScheduleInputs } from '../usePaySchedule'\nimport { usePaySchedule } from '../usePaySchedule'\nimport style from './Edit.module.scss'\nimport {\n Flex,\n SelectField,\n RadioGroupField,\n Grid,\n TextInputField,\n NumberInputField,\n DatePickerField,\n} from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\n\nexport const Edit = () => {\n const Components = useComponentContext()\n const { t } = useTranslation('Company.PaySchedule')\n const dateFormatter = useDateFormatter()\n const { payPeriodPreview, mode, payPreviewLoading } = usePaySchedule()\n const { setValue } = useFormContext<PayScheduleInputs>()\n const [selectedPayPeriodIndex, setSelectedPayPeriodIndex] = useState<number>(0)\n\n const frequency = useWatch({ name: 'frequency' })\n const customTwicePerMonth = useWatch({ name: 'customTwicePerMonth' })\n\n const shouldShowDay1 =\n (frequency === 'Twice per month' && customTwicePerMonth === 'custom') || frequency === 'Monthly'\n const shouldShowDay2 = frequency === 'Twice per month' && customTwicePerMonth === 'custom'\n\n useEffect(() => {\n if (frequency === 'Twice per month' && customTwicePerMonth === '1st15th') {\n setValue('day1', 15)\n setValue('day2', 31)\n }\n }, [frequency, customTwicePerMonth, setValue])\n\n if (mode !== 'EDIT_PAY_SCHEDULE' && mode !== 'ADD_PAY_SCHEDULE') {\n return null\n }\n\n return (\n <div className={style.payScheduleContainer}>\n <Grid gap={32} gridTemplateColumns={{ base: '1fr', small: '1fr 1fr' }}>\n <div className={style.payScheduleForm}>\n <Flex flexDirection={'column'}>\n <TextInputField name=\"customName\" label={t('labels.name')} isRequired />\n <SelectField\n name=\"frequency\"\n label={t('labels.frequency')}\n options={[\n { value: 'Every week', label: t('frequencies.everyWeek') },\n { value: 'Every other week', label: t('frequencies.everyOtherWeek') },\n { value: 'Twice per month', label: t('frequencies.twicePerMonth') },\n { value: 'Monthly', label: t('frequencies.monthly') },\n ]}\n isRequired\n />\n {frequency === 'Twice per month' && (\n <RadioGroupField\n name=\"customTwicePerMonth\"\n label={t('labels.frequencyOptions')}\n description={t('descriptions.frequencyOptionsDescription')}\n options={[\n { value: '1st15th', label: t('frequencyOptions.15thAndLast') },\n { value: 'custom', label: t('frequencyOptions.custom') },\n ]}\n />\n )}\n <DatePickerField\n name=\"anchorPayDate\"\n label={t('labels.firstPayDate')}\n description={t('descriptions.anchorPayDateDescription')}\n isRequired\n />\n <DatePickerField\n name=\"anchorEndOfPayPeriod\"\n label={t('labels.firstPayPeriodEndDate')}\n description={t('descriptions.anchorEndOfPayPeriodDescription')}\n isRequired\n />\n <div className={shouldShowDay1 ? '' : style.visuallyHidden}>\n <NumberInputField name=\"day1\" label={t('labels.firstPayDayOfTheMonth')} isRequired />\n </div>\n <div className={shouldShowDay2 ? '' : style.visuallyHidden}>\n <NumberInputField name=\"day2\" label={t('labels.lastPayDayOfTheMonth')} isRequired />\n </div>\n </Flex>\n </div>\n <Flex flexDirection=\"column\" gap={4} justifyContent=\"center\" alignItems=\"center\">\n {payPeriodPreview && payPeriodPreview[selectedPayPeriodIndex] ? (\n <div className={style.calendarContainer}>\n {!payPreviewLoading && (\n <Components.Select\n label={t('labels.preview')}\n isRequired\n options={payPeriodPreview.map((period, index) => {\n return {\n value: String(index),\n label: dateFormatter.formatPayPeriodRange(period.startDate, period.endDate),\n }\n })}\n value={String(selectedPayPeriodIndex)}\n onChange={(value: string) => {\n const numericValue = Number(value)\n if (!isNaN(numericValue)) {\n setSelectedPayPeriodIndex(numericValue)\n }\n }}\n />\n )}\n <Components.CalendarPreview\n key={selectedPayPeriodIndex}\n dateRange={{\n start: new Date(payPeriodPreview[selectedPayPeriodIndex].startDate as string),\n end: new Date(payPeriodPreview[selectedPayPeriodIndex].endDate as string),\n label: t('payPreview.payPeriod') || 'Pay Period',\n }}\n highlightDates={[\n {\n date: new Date(payPeriodPreview[selectedPayPeriodIndex].checkDate as string),\n highlightColor: 'primary',\n label: t('payPreview.payday') || 'Payday',\n },\n {\n date: new Date(payPeriodPreview[selectedPayPeriodIndex].runPayrollBy as string),\n highlightColor: 'secondary',\n label: t('payPreview.payrollDeadline') || 'Payroll Deadline',\n },\n ]}\n />\n </div>\n ) : (\n <div className={style.calendarContainer}>\n <Components.Alert\n status=\"info\"\n label={t('previewAlert.title', 'Pay Schedule Preview')}\n >\n <Components.Text>\n {t(\n 'previewAlert.description',\n 'Complete all the required fields on the left to see a preview of your pay schedule.',\n )}\n </Components.Text>\n </Components.Alert>\n </div>\n )}\n </Flex>\n </Grid>\n </div>\n )\n}\n"],"names":["Edit","Components","useComponentContext","t","useTranslation","dateFormatter","useDateFormatter","payPeriodPreview","mode","payPreviewLoading","usePaySchedule","setValue","useFormContext","selectedPayPeriodIndex","setSelectedPayPeriodIndex","useState","frequency","useWatch","customTwicePerMonth","shouldShowDay1","shouldShowDay2","useEffect","jsx","style","jsxs","Grid","Flex","TextInputField","SelectField","RadioGroupField","DatePickerField","NumberInputField","period","index","value","numericValue"],"mappings":";;;;;;;;;;;;;;;AAkBO,MAAMA,IAAO,MAAM;AACxB,QAAMC,IAAaC,EAAA,GACb,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAgBC,EAAA,GAChB,EAAE,kBAAAC,GAAkB,MAAAC,GAAM,mBAAAC,EAAA,IAAsBC,EAAA,GAChD,EAAE,UAAAC,EAAA,IAAaC,EAAA,GACf,CAACC,GAAwBC,CAAyB,IAAIC,EAAiB,CAAC,GAExEC,IAAYC,EAAS,EAAE,MAAM,aAAa,GAC1CC,IAAsBD,EAAS,EAAE,MAAM,uBAAuB,GAE9DE,IACHH,MAAc,qBAAqBE,MAAwB,YAAaF,MAAc,WACnFI,IAAiBJ,MAAc,qBAAqBE,MAAwB;AASlF,SAPAG,EAAU,MAAM;AACd,IAAIL,MAAc,qBAAqBE,MAAwB,cAC7DP,EAAS,QAAQ,EAAE,GACnBA,EAAS,QAAQ,EAAE;AAAA,EAEvB,GAAG,CAACK,GAAWE,GAAqBP,CAAQ,CAAC,GAEzCH,MAAS,uBAAuBA,MAAS,qBACpC,OAIP,gBAAAc,EAAC,OAAA,EAAI,WAAWC,EAAM,sBACpB,UAAA,gBAAAC,EAACC,GAAA,EAAK,KAAK,IAAI,qBAAqB,EAAE,MAAM,OAAO,OAAO,aACxD,UAAA;AAAA,IAAA,gBAAAH,EAAC,SAAI,WAAWC,EAAM,iBACpB,UAAA,gBAAAC,EAACE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AiBM,CAAsB,EAAE,SAAmB;AAAA,cAC3E,gBAAgB;AAAA,cAChB,OAAOV,EAAE,mBAAmB,KAAK;AAAA,YAAA;AAAA,YAEnC;AAAA,cACE,MAAM,IAAI,KAAKI,EAAiBM,CAAsB,EAAE,YAAsB;AAAA,cAC9E,gBAAgB;AAAA,cAChB,OAAOV,EAAE,4BAA4B,KAAK;AAAA,YAAA;AAAA,UAC5C;AAAA,QACF;AAAA,QAjBKU;AAAA,MAAA;AAAA,IAkBP,GACF,IAEA,gBAAAS,EAAC,OAAA,EAAI,WAAWC,EAAM,mBACpB,UAAA,gBAAAD;AAAA,MAACrB,EAAW;AAAA,MAAX;AAAA,QACC,QAAO;AAAA,QACP,OAAOE,EAAE,sBAAsB,sBAAsB;AAAA,QAErD,UAAA,gBAAAmB,EAACrB,EAAW,MAAX,EACE,UAAAE;AAAA,UACC;AAAA,UACA;AAAA,QAAA,EACF,CACF;AAAA,MAAA;AAAA,IAAA,GAEJ,EAAA,CAEJ;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"Edit.js","sources":["../../../../../src/components/Company/PaySchedule/_parts/Edit.tsx"],"sourcesContent":["import { useFormContext, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useEffect, useState } from 'react'\nimport type { PayScheduleInputs } from '../usePaySchedule'\nimport { usePaySchedule } from '../usePaySchedule'\nimport style from './Edit.module.scss'\nimport {\n Flex,\n SelectField,\n RadioGroupField,\n Grid,\n TextInputField,\n NumberInputField,\n DatePickerField,\n} from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\n\nexport const Edit = () => {\n const Components = useComponentContext()\n const { t } = useTranslation('Company.PaySchedule')\n const dateFormatter = useDateFormatter()\n const { payPeriodPreview, mode, payPreviewLoading } = usePaySchedule()\n const { setValue } = useFormContext<PayScheduleInputs>()\n const [selectedPayPeriodIndex, setSelectedPayPeriodIndex] = useState<number>(0)\n\n const frequency = useWatch({ name: 'frequency' })\n const customTwicePerMonth = useWatch({ name: 'customTwicePerMonth' })\n\n const shouldShowDay1 =\n (frequency === 'Twice per month' && customTwicePerMonth === 'custom') || frequency === 'Monthly'\n const shouldShowDay2 = frequency === 'Twice per month' && customTwicePerMonth === 'custom'\n\n useEffect(() => {\n if (frequency === 'Twice per month' && customTwicePerMonth === '1st15th') {\n setValue('day1', 15)\n setValue('day2', 31)\n }\n }, [frequency, customTwicePerMonth, setValue])\n\n if (mode !== 'EDIT_PAY_SCHEDULE' && mode !== 'ADD_PAY_SCHEDULE') {\n return null\n }\n\n return (\n <div className={style.payScheduleContainer}>\n <Grid gap={32} gridTemplateColumns={{ base: '1fr', small: '1fr 1fr' }}>\n <div className={style.payScheduleForm}>\n <Flex flexDirection={'column'}>\n <TextInputField name=\"customName\" label={t('labels.name')} isRequired />\n <SelectField\n name=\"frequency\"\n label={t('labels.frequency')}\n options={[\n { value: 'Every week', label: t('frequencies.everyWeek') },\n { value: 'Every other week', label: t('frequencies.everyOtherWeek') },\n { value: 'Twice per month', label: t('frequencies.twicePerMonth') },\n { value: 'Monthly', label: t('frequencies.monthly') },\n ]}\n isRequired\n />\n {frequency === 'Twice per month' && (\n <RadioGroupField\n name=\"customTwicePerMonth\"\n label={t('labels.frequencyOptions')}\n description={t('descriptions.frequencyOptionsDescription')}\n options={[\n { value: '1st15th', label: t('frequencyOptions.15thAndLast') },\n { value: 'custom', label: t('frequencyOptions.custom') },\n ]}\n />\n )}\n <DatePickerField\n name=\"anchorPayDate\"\n label={t('labels.firstPayDate')}\n description={t('descriptions.anchorPayDateDescription')}\n isRequired\n />\n <DatePickerField\n name=\"anchorEndOfPayPeriod\"\n label={t('labels.firstPayPeriodEndDate')}\n description={t('descriptions.anchorEndOfPayPeriodDescription')}\n isRequired\n />\n <div className={shouldShowDay1 ? '' : style.visuallyHidden}>\n <NumberInputField name=\"day1\" label={t('labels.firstPayDayOfTheMonth')} isRequired />\n </div>\n <div className={shouldShowDay2 ? '' : style.visuallyHidden}>\n <NumberInputField name=\"day2\" label={t('labels.lastPayDayOfTheMonth')} isRequired />\n </div>\n </Flex>\n </div>\n <Flex flexDirection=\"column\" gap={4} justifyContent=\"center\" alignItems=\"center\">\n {payPeriodPreview && payPeriodPreview[selectedPayPeriodIndex] ? (\n <div className={style.calendarContainer}>\n {!payPreviewLoading && (\n <Components.Select\n label={t('labels.preview')}\n isRequired\n options={payPeriodPreview.map((period, index) => {\n return {\n value: String(index),\n label: dateFormatter.formatPayPeriodRange(period.startDate, period.endDate),\n }\n })}\n value={String(selectedPayPeriodIndex)}\n onChange={(value: string) => {\n const numericValue = Number(value)\n if (!isNaN(numericValue)) {\n setSelectedPayPeriodIndex(numericValue)\n }\n }}\n />\n )}\n <Components.CalendarPreview\n key={selectedPayPeriodIndex}\n dateRange={{\n start: new Date(payPeriodPreview[selectedPayPeriodIndex].startDate as string),\n end: new Date(payPeriodPreview[selectedPayPeriodIndex].endDate as string),\n label: t('payPreview.payPeriod') || 'Pay Period',\n }}\n highlightDates={[\n {\n date: new Date(payPeriodPreview[selectedPayPeriodIndex].checkDate as string),\n highlightColor: 'primary',\n label: t('payPreview.payday') || 'Payday',\n },\n {\n date: new Date(payPeriodPreview[selectedPayPeriodIndex].runPayrollBy as string),\n highlightColor: 'secondary',\n label: t('payPreview.payrollDeadline') || 'Payroll Deadline',\n },\n ]}\n />\n </div>\n ) : (\n <div className={style.calendarContainer}>\n <Components.Alert\n status=\"info\"\n label={t('previewAlert.title', 'Pay Schedule Preview')}\n >\n <Components.Text>\n {t(\n 'previewAlert.description',\n 'Complete all the required fields on the left to see a preview of your pay schedule.',\n )}\n </Components.Text>\n </Components.Alert>\n </div>\n )}\n </Flex>\n </Grid>\n </div>\n )\n}\n"],"names":["Edit","Components","useComponentContext","t","useTranslation","dateFormatter","useDateFormatter","payPeriodPreview","mode","payPreviewLoading","usePaySchedule","setValue","useFormContext","selectedPayPeriodIndex","setSelectedPayPeriodIndex","useState","frequency","useWatch","customTwicePerMonth","shouldShowDay1","shouldShowDay2","useEffect","jsx","style","jsxs","Grid","Flex","TextInputField","SelectField","RadioGroupField","DatePickerField","NumberInputField","period","index","value","numericValue"],"mappings":";;;;;;;;;;;;;;;;AAkBO,MAAMA,IAAO,MAAM;AACxB,QAAMC,IAAaC,EAAA,GACb,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAgBC,EAAA,GAChB,EAAE,kBAAAC,GAAkB,MAAAC,GAAM,mBAAAC,EAAA,IAAsBC,EAAA,GAChD,EAAE,UAAAC,EAAA,IAAaC,EAAA,GACf,CAACC,GAAwBC,CAAyB,IAAIC,EAAiB,CAAC,GAExEC,IAAYC,EAAS,EAAE,MAAM,aAAa,GAC1CC,IAAsBD,EAAS,EAAE,MAAM,uBAAuB,GAE9DE,IACHH,MAAc,qBAAqBE,MAAwB,YAAaF,MAAc,WACnFI,IAAiBJ,MAAc,qBAAqBE,MAAwB;AASlF,SAPAG,EAAU,MAAM;AACd,IAAIL,MAAc,qBAAqBE,MAAwB,cAC7DP,EAAS,QAAQ,EAAE,GACnBA,EAAS,QAAQ,EAAE;AAAA,EAEvB,GAAG,CAACK,GAAWE,GAAqBP,CAAQ,CAAC,GAEzCH,MAAS,uBAAuBA,MAAS,qBACpC,OAIP,gBAAAc,EAAC,OAAA,EAAI,WAAWC,EAAM,sBACpB,UAAA,gBAAAC,EAACC,GAAA,EAAK,KAAK,IAAI,qBAAqB,EAAE,MAAM,OAAO,OAAO,aACxD,UAAA;AAAA,IAAA,gBAAAH,EAAC,SAAI,WAAWC,EAAM,iBACpB,UAAA,gBAAAC,EAACE,GAAA,EAAK,eAAe,UACnB,UAAA;AAAA,MAAA,gBAAAJ,EAACK,GAAA,EAAe,MAAK,cAAa,OAAOxB,EAAE,aAAa,GAAG,YAAU,IAAC;AAAA,MACtE,gBAAAmB;AAAA,QAACM;AAAA,QAAA;AAAA,UACC,MAAK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E,gBAAgB;AAAA,cAChB,OAAOV,EAAE,4BAA4B,KAAK;AAAA,YAAA;AAAA,UAC5C;AAAA,QACF;AAAA,QAjBKU;AAAA,MAAA;AAAA,IAkBP,GACF,IAEA,gBAAAS,EAAC,OAAA,EAAI,WAAWC,EAAM,mBACpB,UAAA,gBAAAD;AAAA,MAACrB,EAAW;AAAA,MAAX;AAAA,QACC,QAAO;AAAA,QACP,OAAOE,EAAE,sBAAsB,sBAAsB;AAAA,QAErD,UAAA,gBAAAmB,EAACrB,EAAW,MAAX,EACE,UAAAE;AAAA,UACC;AAAA,UACA;AAAA,QAAA,EACF,CACF;AAAA,MAAA;AAAA,IAAA,GAEJ,EAAA,CAEJ;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
@@ -1,20 +1,19 @@
1
1
  import { jsx as e, jsxs as s, Fragment as o } from "react/jsx-runtime";
2
- import { useTranslation as c, Trans as r } from "react-i18next";
2
+ import { useTranslation as c, Trans as a } from "react-i18next";
3
3
  import { usePaySchedule as d } from "../usePaySchedule.js";
4
4
  import { Flex as h } from "../../../Common/Flex/Flex.js";
5
5
  import "classnames";
6
- import "../../../../shared/constants.js";
7
- import { useComponentContext as m } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
6
+ import { useComponentContext as l } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
8
7
  import "react";
9
- const x = () => {
10
- const { t: i } = c("Company.PaySchedule"), n = m(), { mode: a } = d();
8
+ const L = () => {
9
+ const { t: i } = c("Company.PaySchedule"), n = l(), { mode: r } = d();
11
10
  let t = /* @__PURE__ */ e(o, {});
12
- switch (a) {
11
+ switch (r) {
13
12
  case "LIST_PAY_SCHEDULES":
14
13
  t = /* @__PURE__ */ s(o, { children: [
15
14
  /* @__PURE__ */ e(n.Heading, { as: "h2", children: i("headings.pageTitle") }),
16
15
  /* @__PURE__ */ e(n.Text, { children: /* @__PURE__ */ e(
17
- r,
16
+ a,
18
17
  {
19
18
  i18nKey: "listDescription",
20
19
  t: i,
@@ -24,7 +23,7 @@ const x = () => {
24
23
  }
25
24
  ) }),
26
25
  /* @__PURE__ */ e(n.Text, { children: /* @__PURE__ */ e(
27
- r,
26
+ a,
28
27
  {
29
28
  i18nKey: "listDescription2",
30
29
  t: i,
@@ -45,6 +44,6 @@ const x = () => {
45
44
  return /* @__PURE__ */ e(h, { justifyContent: "space-between", flexDirection: "column", gap: 4, children: /* @__PURE__ */ e("header", { children: t }) });
46
45
  };
47
46
  export {
48
- x as Head
47
+ L as Head
49
48
  };
50
49
  //# sourceMappingURL=Head.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Head.js","sources":["../../../../../src/components/Company/PaySchedule/_parts/Head.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { usePaySchedule } from '../usePaySchedule'\nimport { Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n// Head slot for PaySchedule component\nexport const Head = () => {\n const { t } = useTranslation('Company.PaySchedule')\n const Components = useComponentContext()\n\n const { mode } = usePaySchedule()\n let headingOutput: React.ReactElement = <></>\n\n switch (mode) {\n case 'LIST_PAY_SCHEDULES':\n headingOutput = (\n <>\n <Components.Heading as=\"h2\">{t('headings.pageTitle')}</Components.Heading>\n <Components.Text>\n <Trans\n i18nKey={'listDescription'}\n t={t}\n components={{\n ScheduleLink: <Components.Link />,\n }}\n />\n </Components.Text>\n <Components.Text>\n <Trans\n i18nKey={'listDescription2'}\n t={t}\n components={{\n PaymentLawLink: <Components.Link />,\n }}\n />\n </Components.Text>\n </>\n )\n break\n case 'ADD_PAY_SCHEDULE':\n headingOutput = (\n <Components.Heading as=\"h2\">{t('headings.addPaySchedule')}</Components.Heading>\n )\n break\n case 'EDIT_PAY_SCHEDULE':\n headingOutput = (\n <Components.Heading as=\"h2\">{t('headings.editPaySchedule')}</Components.Heading>\n )\n break\n default:\n }\n\n return (\n <Flex justifyContent=\"space-between\" flexDirection={'column'} gap={4}>\n <header>{headingOutput}</header>\n </Flex>\n )\n}\n"],"names":["Head","t","useTranslation","Components","useComponentContext","mode","usePaySchedule","headingOutput","jsx","Fragment","jsxs","Trans","Flex"],"mappings":";;;;;;;;AAMO,MAAMA,IAAO,MAAM;AACxB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEb,EAAE,MAAAC,EAAA,IAASC,EAAA;AACjB,MAAIC,IAAoC,gBAAAC,EAAAC,GAAA,EAAE;AAE1C,UAAQJ,GAAA;AAAA,IACN,KAAK;AACH,MAAAE,IACE,gBAAAG,EAAAD,GAAA,EACE,UAAA;AAAA,QAAA,gBAAAD,EAACL,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,oBAAoB,GAAE;AAAA,QACrD,gBAAAO,EAACL,EAAW,MAAX,EACC,UAAA,gBAAAK;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,SAAS;AAAA,YACT,GAAAV;AAAA,YACA,YAAY;AAAA,cACV,cAAc,gBAAAO,EAACL,EAAW,MAAX,CAAA,CAAgB;AAAA,YAAA;AAAA,UACjC;AAAA,QAAA,GAEJ;AAAA,QACA,gBAAAK,EAACL,EAAW,MAAX,EACC,UAAA,gBAAAK;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,SAAS;AAAA,YACT,GAAAV;AAAA,YACA,YAAY;AAAA,cACV,gBAAgB,gBAAAO,EAACL,EAAW,MAAX,CAAA,CAAgB;AAAA,YAAA;AAAA,UACnC;AAAA,QAAA,EACF,CACF;AAAA,MAAA,GACF;AAEF;AAAA,IACF,KAAK;AACH,MAAAI,IACE,gBAAAC,EAACL,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,yBAAyB,GAAE;AAE5D;AAAA,IACF,KAAK;AACH,MAAAM,IACE,gBAAAC,EAACL,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,0BAA0B,GAAE;AAE7D;AAAA,EACF;AAGF,SACE,gBAAAO,EAACI,GAAA,EAAK,gBAAe,iBAAgB,eAAe,UAAU,KAAK,GACjE,UAAA,gBAAAJ,EAAC,UAAA,EAAQ,UAAAD,EAAA,CAAc,GACzB;AAEJ;"}
1
+ {"version":3,"file":"Head.js","sources":["../../../../../src/components/Company/PaySchedule/_parts/Head.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { usePaySchedule } from '../usePaySchedule'\nimport { Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n// Head slot for PaySchedule component\nexport const Head = () => {\n const { t } = useTranslation('Company.PaySchedule')\n const Components = useComponentContext()\n\n const { mode } = usePaySchedule()\n let headingOutput: React.ReactElement = <></>\n\n switch (mode) {\n case 'LIST_PAY_SCHEDULES':\n headingOutput = (\n <>\n <Components.Heading as=\"h2\">{t('headings.pageTitle')}</Components.Heading>\n <Components.Text>\n <Trans\n i18nKey={'listDescription'}\n t={t}\n components={{\n ScheduleLink: <Components.Link />,\n }}\n />\n </Components.Text>\n <Components.Text>\n <Trans\n i18nKey={'listDescription2'}\n t={t}\n components={{\n PaymentLawLink: <Components.Link />,\n }}\n />\n </Components.Text>\n </>\n )\n break\n case 'ADD_PAY_SCHEDULE':\n headingOutput = (\n <Components.Heading as=\"h2\">{t('headings.addPaySchedule')}</Components.Heading>\n )\n break\n case 'EDIT_PAY_SCHEDULE':\n headingOutput = (\n <Components.Heading as=\"h2\">{t('headings.editPaySchedule')}</Components.Heading>\n )\n break\n default:\n }\n\n return (\n <Flex justifyContent=\"space-between\" flexDirection={'column'} gap={4}>\n <header>{headingOutput}</header>\n </Flex>\n )\n}\n"],"names":["Head","t","useTranslation","Components","useComponentContext","mode","usePaySchedule","headingOutput","jsx","Fragment","jsxs","Trans","Flex"],"mappings":";;;;;;;AAMO,MAAMA,IAAO,MAAM;AACxB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEb,EAAE,MAAAC,EAAA,IAASC,EAAA;AACjB,MAAIC,IAAoC,gBAAAC,EAAAC,GAAA,EAAE;AAE1C,UAAQJ,GAAA;AAAA,IACN,KAAK;AACH,MAAAE,IACE,gBAAAG,EAAAD,GAAA,EACE,UAAA;AAAA,QAAA,gBAAAD,EAACL,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,oBAAoB,GAAE;AAAA,QACrD,gBAAAO,EAACL,EAAW,MAAX,EACC,UAAA,gBAAAK;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,SAAS;AAAA,YACT,GAAAV;AAAA,YACA,YAAY;AAAA,cACV,cAAc,gBAAAO,EAACL,EAAW,MAAX,CAAA,CAAgB;AAAA,YAAA;AAAA,UACjC;AAAA,QAAA,GAEJ;AAAA,QACA,gBAAAK,EAACL,EAAW,MAAX,EACC,UAAA,gBAAAK;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,SAAS;AAAA,YACT,GAAAV;AAAA,YACA,YAAY;AAAA,cACV,gBAAgB,gBAAAO,EAACL,EAAW,MAAX,CAAA,CAAgB;AAAA,YAAA;AAAA,UACnC;AAAA,QAAA,EACF,CACF;AAAA,MAAA,GACF;AAEF;AAAA,IACF,KAAK;AACH,MAAAI,IACE,gBAAAC,EAACL,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,yBAAyB,GAAE;AAE5D;AAAA,IACF,KAAK;AACH,MAAAM,IACE,gBAAAC,EAACL,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,0BAA0B,GAAE;AAE7D;AAAA,EACF;AAGF,SACE,gBAAAO,EAACI,GAAA,EAAK,gBAAe,iBAAgB,eAAe,UAAU,KAAK,GACjE,UAAA,gBAAAJ,EAAC,UAAA,EAAQ,UAAAD,EAAA,CAAc,GACzB;AAEJ;"}
@@ -1,38 +1,37 @@
1
- import { jsx as e, jsxs as u } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as p } from "react/jsx-runtime";
2
2
  import { useTranslation as h } from "react-i18next";
3
3
  import { usePaySchedule as y } from "../usePaySchedule.js";
4
4
  import o from "./List.module.scss.js";
5
5
  import { Flex as s } from "../../../Common/Flex/Flex.js";
6
6
  import "classnames";
7
- import "../../../../shared/constants.js";
8
7
  import { HamburgerMenu as f } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
9
8
  import S from "../../../../assets/icons/pencil.svg.js";
10
9
  import { useComponentContext as v } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
10
  import { VisuallyHidden as g } from "../../../Common/VisuallyHidden/VisuallyHidden.js";
12
11
  import { useDataView as L } from "../../../Common/DataView/useDataView.js";
13
12
  import { DataView as C } from "../../../Common/DataView/DataView.js";
14
- const F = () => {
15
- const { t: r } = h("Company.PaySchedule"), n = v(), { paySchedules: m, mode: c, handleEdit: l } = y(), { ...d } = L({
13
+ const B = () => {
14
+ const { t: n } = h("Company.PaySchedule"), r = v(), { paySchedules: m, mode: c, handleEdit: l } = y(), { ...d } = L({
16
15
  data: m || [],
17
16
  columns: [
18
17
  {
19
- title: r("payScheduleList.name"),
18
+ title: n("payScheduleList.name"),
20
19
  key: "customName",
21
20
  render: (t) => {
22
21
  const a = !!t.name;
23
22
  let i = a ? t.name : t.customName;
24
23
  i && i.length > 1 ? i = i.charAt(0).toUpperCase() + i.slice(1) : i = t.customName;
25
- const p = t.customName;
26
- return /* @__PURE__ */ e(s, { flexDirection: "column", gap: 0, children: /* @__PURE__ */ u("div", { className: o.content, children: [
24
+ const u = t.customName;
25
+ return /* @__PURE__ */ e(s, { flexDirection: "column", gap: 0, children: /* @__PURE__ */ p("div", { className: o.content, children: [
27
26
  /* @__PURE__ */ e("div", { children: i }),
28
- a && /* @__PURE__ */ e("div", { children: p })
27
+ a && /* @__PURE__ */ e("div", { children: u })
29
28
  ] }) });
30
29
  }
31
30
  },
32
31
  {
33
- title: /* @__PURE__ */ e(g, { children: r("payScheduleList.active") }),
32
+ title: /* @__PURE__ */ e(g, { children: n("payScheduleList.active") }),
34
33
  key: "active",
35
- render: (t) => /* @__PURE__ */ e(s, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ e("div", { className: o.content, children: t.active ? /* @__PURE__ */ e(n.Badge, { status: "success", children: r("payScheduleList.active") }) : /* @__PURE__ */ e(n.Badge, { status: "info", children: r("payScheduleList.inactive") }) }) })
34
+ render: (t) => /* @__PURE__ */ e(s, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ e("div", { className: o.content, children: t.active ? /* @__PURE__ */ e(r.Badge, { status: "success", children: n("payScheduleList.active") }) : /* @__PURE__ */ e(r.Badge, { status: "info", children: n("payScheduleList.inactive") }) }) })
36
35
  }
37
36
  ],
38
37
  itemMenu: (t) => /* @__PURE__ */ e(
@@ -41,7 +40,7 @@ const F = () => {
41
40
  triggerLabel: "Actions",
42
41
  items: [
43
42
  {
44
- label: r("payScheduleList.edit"),
43
+ label: n("payScheduleList.edit"),
45
44
  onClick: () => {
46
45
  l(t);
47
46
  },
@@ -54,6 +53,6 @@ const F = () => {
54
53
  return c !== "LIST_PAY_SCHEDULES" ? null : /* @__PURE__ */ e(C, { label: "test", ...d });
55
54
  };
56
55
  export {
57
- F as List
56
+ B as List
58
57
  };
59
58
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../../src/components/Company/PaySchedule/_parts/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { usePaySchedule } from '../usePaySchedule'\nimport styles from './List.module.scss'\nimport { useDataView, DataView, Flex, VisuallyHidden } from '@/components/Common'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\n\nexport const List = () => {\n const { t } = useTranslation('Company.PaySchedule')\n const Components = useComponentContext()\n const { paySchedules, mode, handleEdit } = usePaySchedule()\n\n const { ...dataViewProps } = useDataView({\n data: paySchedules || [],\n columns: [\n {\n title: t('payScheduleList.name'),\n key: 'customName',\n render: schedule => {\n const hasName = !!schedule.name\n let displayName = hasName ? schedule.name : schedule.customName\n if (displayName && displayName.length > 1) {\n displayName = displayName.charAt(0).toUpperCase() + displayName.slice(1)\n } else {\n displayName = schedule.customName\n }\n const displayFrequency = schedule.customName\n return (\n <Flex flexDirection={'column'} gap={0}>\n <div className={styles.content}>\n <div>{displayName}</div>\n {hasName && <div>{displayFrequency}</div>}\n </div>\n </Flex>\n )\n },\n },\n {\n title: <VisuallyHidden>{t('payScheduleList.active')}</VisuallyHidden>,\n key: 'active',\n render: schedule => (\n <Flex alignItems={'center'} justifyContent={'center'}>\n <div className={styles.content}>\n {schedule.active ? (\n <Components.Badge status=\"success\">{t('payScheduleList.active')}</Components.Badge>\n ) : (\n <Components.Badge status=\"info\">{t('payScheduleList.inactive')}</Components.Badge>\n )}\n </div>\n </Flex>\n ),\n },\n ],\n itemMenu: schedule => {\n return (\n <HamburgerMenu\n triggerLabel=\"Actions\"\n items={[\n {\n label: t('payScheduleList.edit'),\n onClick: () => {\n handleEdit(schedule)\n },\n icon: <PencilSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n if (mode !== 'LIST_PAY_SCHEDULES') {\n return null\n }\n\n return <DataView label=\"test\" {...dataViewProps} />\n}\n"],"names":["List","t","useTranslation","Components","useComponentContext","paySchedules","mode","handleEdit","usePaySchedule","dataViewProps","useDataView","schedule","hasName","displayName","displayFrequency","jsx","Flex","jsxs","styles","VisuallyHidden","HamburgerMenu","PencilSvg","DataView"],"mappings":";;;;;;;;;;;;;AAQO,MAAMA,IAAO,MAAM;AACxB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GACb,EAAE,cAAAC,GAAc,MAAAC,GAAM,YAAAC,EAAA,IAAeC,EAAA,GAErC,EAAE,GAAGC,EAAA,IAAkBC,EAAY;AAAA,IACvC,MAAML,KAAgB,CAAA;AAAA,IACtB,SAAS;AAAA,MAC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/B,SAAS,MAAM;AACb,cAAAM,EAAWI,CAAQ;AAAA,YACrB;AAAA,YACA,MAAM,gBAAAI,EAACM,GAAA,EAAU,eAAW,GAAA,CAAC;AAAA,UAAA;AAAA,QAC/B;AAAA,MACF;AAAA,IAAA;AAAA,EAGN,CACD;AAED,SAAIf,MAAS,uBACJ,OAGF,gBAAAS,EAACO,GAAA,EAAS,OAAM,QAAQ,GAAGb,GAAe;AACnD;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../../src/components/Company/PaySchedule/_parts/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { usePaySchedule } from '../usePaySchedule'\nimport styles from './List.module.scss'\nimport { useDataView, DataView, Flex, VisuallyHidden } from '@/components/Common'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\n\nexport const List = () => {\n const { t } = useTranslation('Company.PaySchedule')\n const Components = useComponentContext()\n const { paySchedules, mode, handleEdit } = usePaySchedule()\n\n const { ...dataViewProps } = useDataView({\n data: paySchedules || [],\n columns: [\n {\n title: t('payScheduleList.name'),\n key: 'customName',\n render: schedule => {\n const hasName = !!schedule.name\n let displayName = hasName ? schedule.name : schedule.customName\n if (displayName && displayName.length > 1) {\n displayName = displayName.charAt(0).toUpperCase() + displayName.slice(1)\n } else {\n displayName = schedule.customName\n }\n const displayFrequency = schedule.customName\n return (\n <Flex flexDirection={'column'} gap={0}>\n <div className={styles.content}>\n <div>{displayName}</div>\n {hasName && <div>{displayFrequency}</div>}\n </div>\n </Flex>\n )\n },\n },\n {\n title: <VisuallyHidden>{t('payScheduleList.active')}</VisuallyHidden>,\n key: 'active',\n render: schedule => (\n <Flex alignItems={'center'} justifyContent={'center'}>\n <div className={styles.content}>\n {schedule.active ? (\n <Components.Badge status=\"success\">{t('payScheduleList.active')}</Components.Badge>\n ) : (\n <Components.Badge status=\"info\">{t('payScheduleList.inactive')}</Components.Badge>\n )}\n </div>\n </Flex>\n ),\n },\n ],\n itemMenu: schedule => {\n return (\n <HamburgerMenu\n triggerLabel=\"Actions\"\n items={[\n {\n label: t('payScheduleList.edit'),\n onClick: () => {\n handleEdit(schedule)\n },\n icon: <PencilSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n if (mode !== 'LIST_PAY_SCHEDULES') {\n return null\n }\n\n return <DataView label=\"test\" {...dataViewProps} />\n}\n"],"names":["List","t","useTranslation","Components","useComponentContext","paySchedules","mode","handleEdit","usePaySchedule","dataViewProps","useDataView","schedule","hasName","displayName","displayFrequency","jsx","Flex","jsxs","styles","VisuallyHidden","HamburgerMenu","PencilSvg","DataView"],"mappings":";;;;;;;;;;;;AAQO,MAAMA,IAAO,MAAM;AACxB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GACb,EAAE,cAAAC,GAAc,MAAAC,GAAM,YAAAC,EAAA,IAAeC,EAAA,GAErC,EAAE,GAAGC,EAAA,IAAkBC,EAAY;AAAA,IACvC,MAAML,KAAgB,CAAA;AAAA,IACtB,SAAS;AAAA,MACP;AAAA,QACE,OAAOJ,EAAE,sBAAsB;AAAA,QAC/B,KAAK;AAAA,QACL,QAAQ,CAAAU,MAAY;AAClB,gBAAMC,IAAU,CAAC,CAACD,EAAS;AAC3B,cAAIE,IAAcD,IAAUD,EAAS,OAAOA,EAAS;AACrD,UAAIE,KAAeA,EAAY,SAAS,IACtCA,IAAcA,EAAY,OAAO,CAAC,EAAE,gBAAgBA,EAAY,MAAM,CAAC,IAEvEA,IAAcF,EAAS;AAEzB,gBAAMG,IAAmBH,EAAS;AAClC,iBACE,gBAAAI,EAACC,GAAA,EAAK,eAAe,UAAU,KAAK,GAClC,UAAA,gBAAAC,EAAC,OAAA,EAAI,WAAWC,EAAO,SACrB,UAAA;AAAA,YAAA,gBAAAH,EAAC,SAAK,UAAAF,EAAA,CAAY;AAAA,YACjBD,KAAW,gBAAAG,EAAC,OAAA,EAAK,UAAAD,EAAA,CAAiB;AAAA,UAAA,EAAA,CACrC,EAAA,CACF;AAAA,QAEJ;AAAA,MAAA;AAAA,MAEF;AAAA,QACE,OAAO,gBAAAC,EAACI,GAAA,EAAgB,UAAAlB,EAAE,wBAAwB,GAAE;AAAA,QACpD,KAAK;AAAA,QACL,QAAQ,CAAAU,MACN,gBAAAI,EAACC,GAAA,EAAK,YAAY,UAAU,gBAAgB,UAC1C,UAAA,gBAAAD,EAAC,SAAI,WAAWG,EAAO,SACpB,UAAAP,EAAS,SACR,gBAAAI,EAACZ,EAAW,OAAX,EAAiB,QAAO,WAAW,UAAAF,EAAE,wBAAwB,EAAA,CAAE,IAEhE,gBAAAc,EAACZ,EAAW,OAAX,EAAiB,QAAO,QAAQ,UAAAF,EAAE,0BAA0B,GAAE,GAEnE,EAAA,CACF;AAAA,MAAA;AAAA,IAEJ;AAAA,IAEF,UAAU,CAAAU,MAEN,gBAAAI;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,cAAa;AAAA,QACb,OAAO;AAAA,UACL;AAAA,YACE,OAAOnB,EAAE,sBAAsB;AAAA,YAC/B,SAAS,MAAM;AACb,cAAAM,EAAWI,CAAQ;AAAA,YACrB;AAAA,YACA,MAAM,gBAAAI,EAACM,GAAA,EAAU,eAAW,GAAA,CAAC;AAAA,UAAA;AAAA,QAC/B;AAAA,MACF;AAAA,IAAA;AAAA,EAGN,CACD;AAED,SAAIf,MAAS,uBACJ,OAGF,gBAAAS,EAACO,GAAA,EAAS,OAAM,QAAQ,GAAGb,GAAe;AACnD;"}
@@ -10,11 +10,10 @@ import "../../Base/useBase.js";
10
10
  import "../../../shared/constants.js";
11
11
  import "classnames";
12
12
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
13
- import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
14
13
  import "dompurify";
15
14
  import "../../../contexts/LocaleProvider/useLocale.js";
16
15
  import { createCompoundContext as t } from "../../Base/createCompoundContext.js";
17
- const S = o.object({
16
+ const x = o.object({
18
17
  frequency: o.enum(["Every week", "Every other week", "Twice per month", "Monthly"]),
19
18
  anchorPayDate: o.date().optional(),
20
19
  anchorEndOfPayPeriod: o.date().optional(),
@@ -22,10 +21,10 @@ const S = o.object({
22
21
  day2: o.number().min(1).max(31).optional(),
23
22
  customName: o.string().optional(),
24
23
  customTwicePerMonth: o.string().optional()
25
- }), [f, w] = t("PayScheduleContext");
24
+ }), [S, f] = t("PayScheduleContext");
26
25
  export {
27
- w as PayScheduleProvider,
28
- S as PayScheduleSchema,
29
- f as usePaySchedule
26
+ f as PayScheduleProvider,
27
+ x as PayScheduleSchema,
28
+ S as usePaySchedule
30
29
  };
31
30
  //# sourceMappingURL=usePaySchedule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/usePaySchedule.ts"],"sourcesContent":["import type { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate'\nimport type { PayScheduleList } from '@gusto/embedded-api/models/components/payschedulelist'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayPeriods } from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayschedulespreview'\nimport { z } from 'zod'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE =\n | 'LIST_PAY_SCHEDULES'\n | 'ADD_PAY_SCHEDULE'\n | 'EDIT_PAY_SCHEDULE'\n | 'PREVIEW_PAY_SCHEDULE'\n\ntype PayScheduleContextType = {\n companyId: string\n handleAdd: () => void\n handleEdit: (schedule: PayScheduleType) => void\n handleCancel: () => void\n handleContinue: () => void\n mode: MODE\n paySchedules: PayScheduleList[] | undefined | null\n currentPaySchedule: PayScheduleType | undefined | null\n payPeriodPreview?: PayPeriods[]\n payPreviewLoading?: boolean\n}\n\nexport const PayScheduleSchema = z.object({\n frequency: z.enum(['Every week', 'Every other week', 'Twice per month', 'Monthly']),\n anchorPayDate: z.date().optional(),\n anchorEndOfPayPeriod: z.date().optional(),\n day1: z.number().min(1).max(31).optional(),\n day2: z.number().min(1).max(31).optional(),\n customName: z.string().optional(),\n customTwicePerMonth: z.string().optional(),\n})\n\nexport type PayScheduleInputs = z.input<typeof PayScheduleSchema>\nexport type PayScheduleOutputs = z.output<typeof PayScheduleSchema>\n\nexport type PayScheduleDefaultValues = RequireAtLeastOne<\n Partial<\n Pick<\n PayScheduleCreateUpdate,\n 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'\n >\n >\n>\n\nconst [usePaySchedule, PayScheduleProvider] =\n createCompoundContext<PayScheduleContextType>('PayScheduleContext')\nexport { usePaySchedule, PayScheduleProvider }\n"],"names":["PayScheduleSchema","z","usePaySchedule","PayScheduleProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AA2BO,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACxC,WAAWA,EAAE,KAAK,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,CAAC;AAAA,EAClF,eAAeA,EAAE,KAAA,EAAO,SAAA;AAAA,EACxB,sBAAsBA,EAAE,KAAA,EAAO,SAAA;AAAA,EAC/B,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAA;AAAA,EAChC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAA;AAAA,EAChC,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,qBAAqBA,EAAE,OAAA,EAAS,SAAA;AAClC,CAAC,GAcK,CAACC,GAAgBC,CAAmB,IACxCC,EAA8C,oBAAoB;"}
1
+ {"version":3,"file":"usePaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/usePaySchedule.ts"],"sourcesContent":["import type { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate'\nimport type { PayScheduleList } from '@gusto/embedded-api/models/components/payschedulelist'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayPeriods } from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayschedulespreview'\nimport { z } from 'zod'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE =\n | 'LIST_PAY_SCHEDULES'\n | 'ADD_PAY_SCHEDULE'\n | 'EDIT_PAY_SCHEDULE'\n | 'PREVIEW_PAY_SCHEDULE'\n\ntype PayScheduleContextType = {\n companyId: string\n handleAdd: () => void\n handleEdit: (schedule: PayScheduleType) => void\n handleCancel: () => void\n handleContinue: () => void\n mode: MODE\n paySchedules: PayScheduleList[] | undefined | null\n currentPaySchedule: PayScheduleType | undefined | null\n payPeriodPreview?: PayPeriods[]\n payPreviewLoading?: boolean\n}\n\nexport const PayScheduleSchema = z.object({\n frequency: z.enum(['Every week', 'Every other week', 'Twice per month', 'Monthly']),\n anchorPayDate: z.date().optional(),\n anchorEndOfPayPeriod: z.date().optional(),\n day1: z.number().min(1).max(31).optional(),\n day2: z.number().min(1).max(31).optional(),\n customName: z.string().optional(),\n customTwicePerMonth: z.string().optional(),\n})\n\nexport type PayScheduleInputs = z.input<typeof PayScheduleSchema>\nexport type PayScheduleOutputs = z.output<typeof PayScheduleSchema>\n\nexport type PayScheduleDefaultValues = RequireAtLeastOne<\n Partial<\n Pick<\n PayScheduleCreateUpdate,\n 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'\n >\n >\n>\n\nconst [usePaySchedule, PayScheduleProvider] =\n createCompoundContext<PayScheduleContextType>('PayScheduleContext')\nexport { usePaySchedule, PayScheduleProvider }\n"],"names":["PayScheduleSchema","z","usePaySchedule","PayScheduleProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AA2BO,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACxC,WAAWA,EAAE,KAAK,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,CAAC;AAAA,EAClF,eAAeA,EAAE,KAAA,EAAO,SAAA;AAAA,EACxB,sBAAsBA,EAAE,KAAA,EAAO,SAAA;AAAA,EAC/B,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAA;AAAA,EAChC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAA;AAAA,EAChC,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,qBAAqBA,EAAE,OAAA,EAAS,SAAA;AAClC,CAAC,GAcK,CAACC,GAAgBC,CAAmB,IACxCC,EAA8C,oBAAoB;"}
@@ -1,12 +1,12 @@
1
- import { jsx as a, jsxs as V, Fragment as O } from "react/jsx-runtime";
2
- import { useForm as U, FormProvider as B } from "react-hook-form";
3
- import { zodResolver as D } from "@hookform/resolvers/zod";
4
- import { useTaxRequirementsUpdateStateMutation as K } from "@gusto/embedded-api/react-query/taxRequirementsUpdateState";
5
- import { useTaxRequirementsGetSuspense as M } from "@gusto/embedded-api/react-query/taxRequirementsGet";
6
- import { z as r } from "zod";
7
- import { useMemo as w } from "react";
8
- import { useTranslation as z } from "react-i18next";
9
- import { Head as H } from "./Head.js";
1
+ import { jsx as o, jsxs as U, Fragment as V } from "react/jsx-runtime";
2
+ import { useForm as B, FormProvider as D } from "react-hook-form";
3
+ import { zodResolver as K } from "@hookform/resolvers/zod";
4
+ import { useTaxRequirementsUpdateStateMutation as M } from "@gusto/embedded-api/react-query/taxRequirementsUpdateState";
5
+ import { useTaxRequirementsGetSuspense as w } from "@gusto/embedded-api/react-query/taxRequirementsGet";
6
+ import { z as c } from "zod";
7
+ import { useMemo as z } from "react";
8
+ import { useTranslation as H } from "react-i18next";
9
+ import { Head as N } from "./Head.js";
10
10
  import { StateTaxesFormProvider as G } from "./context.js";
11
11
  import { Form as L } from "./Form.js";
12
12
  import { Actions as X } from "./Actions.js";
@@ -14,85 +14,78 @@ import { BaseComponent as Y } from "../../../Base/Base.js";
14
14
  import { useI18n as $ } from "../../../../i18n/I18n.js";
15
15
  import { Flex as I } from "../../../Common/Flex/Flex.js";
16
16
  import { Form as J } from "../../../Common/Form/Form.js";
17
- import { componentEvents as g } from "../../../../shared/constants.js";
17
+ import { componentEvents as F } from "../../../../shared/constants.js";
18
18
  import { useBase as Q } from "../../../Base/useBase.js";
19
- function Se(i) {
20
- return /* @__PURE__ */ a(Y, { ...i, children: /* @__PURE__ */ a(W, { ...i, children: i.children }) });
19
+ function Se(a) {
20
+ return /* @__PURE__ */ o(Y, { ...a, children: /* @__PURE__ */ o(W, { ...a, children: a.children }) });
21
21
  }
22
- function W({ companyId: i, state: y, className: q, children: h }) {
22
+ function W({ companyId: a, state: l, className: g, children: v }) {
23
23
  $("Company.StateTaxes");
24
- const { onEvent: x, baseSubmitHandler: k } = Q(), { t: o } = z("Company.StateTaxes", { keyPrefix: "form" }), { data: P } = M({ companyUuid: i, state: y }), l = P.taxRequirementsState, { mutateAsync: _, isPending: j } = K(), { dynamicSchema: A, defaultValues: C } = w(() => {
25
- const f = {}, s = {};
26
- return l.requirementSets?.forEach((t) => {
24
+ const { onEvent: S, baseSubmitHandler: k } = Q(), { t: r } = H("Company.StateTaxes", { keyPrefix: "form" }), { data: q } = w({ companyUuid: a, state: l }), d = q.taxRequirementsState, { mutateAsync: b, isPending: P } = M(), { dynamicSchema: _, defaultValues: j } = z(() => {
25
+ const u = {}, i = {};
26
+ return d.requirementSets?.forEach((t) => {
27
27
  if (!t.key) return;
28
- const m = t.key, c = {}, p = {};
28
+ const n = t.key, s = {}, m = {};
29
29
  t.requirements?.forEach((e) => {
30
30
  if (!e.key) return;
31
- const b = e.key;
32
- p[b] = e.metadata?.type === "radio" ? e.value ?? void 0 : e.value ? String(e.value) : "";
33
- let v = r.string({
34
- required_error: o("validations.required")
35
- }).min(1, o("validations.required"));
36
- const d = e.metadata?.validation;
37
- if (d && e.metadata?.type === "tax_rate")
38
- if (d.type === "min_max") {
39
- const n = parseFloat(d.min), u = parseFloat(d.max);
40
- !isNaN(n) && !isNaN(u) && (v = r.preprocess(
41
- (S) => Number(S),
42
- r.number().min(n, o("validations.minValue", { min: n })).max(u, o("validations.maxValue", { max: u })).transform((S) => String(S))
43
- ));
44
- } else {
45
- const n = d.rates;
46
- v = r.string({
47
- required_error: o("validations.required")
48
- }).min(1, o("validations.required")).refine((u) => n.includes(u), {
49
- message: o("validations.oneOf", { values: n.join(", ") })
50
- });
51
- }
52
- e.metadata?.type === "radio" && (v = r.boolean({
53
- required_error: o("validations.required")
54
- })), c[b] = v;
55
- }), Object.keys(c).length > 0 && (f[m] = r.object(c), s[m] = p);
31
+ const f = e.key, R = e.metadata?.type === "tax_rate" || e.metadata?.type === "percent";
32
+ e.metadata?.type === "radio" ? m[f] = e.value ?? void 0 : m[f] = e.value ? String(e.value) : "";
33
+ let p = c.string({
34
+ required_error: r("validations.required")
35
+ }).min(1, r("validations.required"));
36
+ const y = e.metadata?.validation;
37
+ if (y && R && y.type === "one_of") {
38
+ const T = y.rates;
39
+ p = c.string({
40
+ required_error: r("validations.required")
41
+ }).min(1, r("validations.required")).refine((O) => T.includes(O), {
42
+ message: r("validations.oneOf", { values: T.join(", ") })
43
+ });
44
+ }
45
+ e.metadata?.type === "radio" && (p = c.boolean({
46
+ required_error: r("validations.required")
47
+ })), s[f] = p;
48
+ }), Object.keys(s).length > 0 && (u[n] = c.object(s), i[n] = m);
56
49
  }), {
57
- dynamicSchema: r.object(f),
58
- defaultValues: s
50
+ dynamicSchema: c.object(u),
51
+ defaultValues: i
59
52
  };
60
- }, [l, o]), { control: E, ...F } = U({
61
- resolver: D(A),
62
- defaultValues: C
63
- }), N = async (f) => {
64
- await k(f, async (s) => {
65
- const T = l.requirementSets?.filter((t) => t.key && s[t.key]).map((t) => {
66
- const m = t.key, c = s[m];
53
+ }, [d, r]), { control: A, ...h } = B({
54
+ resolver: K(_),
55
+ defaultValues: j
56
+ }), C = async (u) => {
57
+ await k(u, async (i) => {
58
+ const x = d.requirementSets?.filter((t) => t.key && i[t.key]).map((t) => {
59
+ const n = t.key, s = i[n];
67
60
  return {
68
61
  state: t.state,
69
- key: m,
62
+ key: n,
70
63
  effectiveFrom: t.effectiveFrom,
71
- requirements: Object.entries(c).map(([p, e]) => ({
72
- key: p,
64
+ requirements: Object.entries(s).map(([m, e]) => ({
65
+ key: m,
73
66
  value: String(e)
74
67
  }))
75
68
  };
76
69
  });
77
- await _({
70
+ await b({
78
71
  request: {
79
- companyUuid: i,
80
- requestBody: { requirementSets: T },
81
- state: y
72
+ companyUuid: a,
73
+ requestBody: { requirementSets: x },
74
+ state: l
82
75
  }
83
- }), x(g.COMPANY_STATE_TAX_UPDATED);
76
+ }), S(F.COMPANY_STATE_TAX_UPDATED);
84
77
  });
85
- }, R = () => {
86
- x(g.CANCEL);
78
+ }, E = () => {
79
+ S(F.CANCEL);
87
80
  };
88
- return /* @__PURE__ */ a("section", { className: q, children: /* @__PURE__ */ a(B, { ...F, control: E, children: /* @__PURE__ */ a(J, { onSubmit: F.handleSubmit(N), children: /* @__PURE__ */ a(
81
+ return /* @__PURE__ */ o("section", { className: g, children: /* @__PURE__ */ o(D, { ...h, control: A, children: /* @__PURE__ */ o(J, { onSubmit: h.handleSubmit(C), children: /* @__PURE__ */ o(
89
82
  G,
90
83
  {
91
- value: { stateTaxRequirements: l, isPending: j, state: y, handleCancel: R },
92
- children: /* @__PURE__ */ a(I, { flexDirection: "column", gap: 32, children: h || /* @__PURE__ */ V(O, { children: [
93
- /* @__PURE__ */ a(H, {}),
94
- /* @__PURE__ */ a(L, {}),
95
- /* @__PURE__ */ a(X, {})
84
+ value: { stateTaxRequirements: d, isPending: P, state: l, handleCancel: E },
85
+ children: /* @__PURE__ */ o(I, { flexDirection: "column", gap: 32, children: v || /* @__PURE__ */ U(V, { children: [
86
+ /* @__PURE__ */ o(N, {}),
87
+ /* @__PURE__ */ o(L, {}),
88
+ /* @__PURE__ */ o(X, {})
96
89
  ] }) })
97
90
  }
98
91
  ) }) }) });
@@ -1 +1 @@
1
- {"version":3,"file":"StateTaxesForm.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTaxRequirementsUpdateStateMutation } from '@gusto/embedded-api/react-query/taxRequirementsUpdateState'\nimport { useTaxRequirementsGetSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGet'\nimport { z } from 'zod'\nimport { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Head } from './Head'\nimport { StateTaxesFormProvider } from './context'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\n\ninterface StateTaxesFormProps extends CommonComponentInterface {\n companyId: string\n state: string\n}\n\nexport function StateTaxesForm(props: StateTaxesFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, state, className, children }: StateTaxesFormProps) {\n useI18n('Company.StateTaxes')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { data } = useTaxRequirementsGetSuspense({ companyUuid: companyId, state })\n const stateTaxRequirements = data.taxRequirementsState!\n\n const { mutateAsync: updateStateTax, isPending: isPendingUpdate } =\n useTaxRequirementsUpdateStateMutation()\n\n // Schema and default value generation\n const { dynamicSchema, defaultValues } = useMemo(() => {\n const schemaShape: Record<string, z.ZodObject<Record<string, z.ZodTypeAny>>> = {}\n const values: Partial<Record<string, Record<string, string | boolean | number | undefined>>> =\n {}\n\n //Looping through each requirement set\n stateTaxRequirements.requirementSets?.forEach(requirementSet => {\n if (!requirementSet.key) return\n\n const requirementSetKey = requirementSet.key\n const requirementShape: Record<string, z.ZodTypeAny> = {}\n const requirementValues: Record<string, string | boolean | number | undefined> = {}\n\n requirementSet.requirements?.forEach(requirement => {\n if (!requirement.key) return\n\n const requirementKey = requirement.key\n\n // --- Default Value Logic ---\n requirementValues[requirementKey] =\n requirement.metadata?.type === 'radio'\n ? (requirement.value ?? undefined)\n : requirement.value\n ? String(requirement.value)\n : ''\n\n // --- Schema Logic ---\n // Start with a basic string schema\n let fieldSchema: z.ZodTypeAny = z\n .string({\n required_error: t('validations.required'),\n })\n .min(1, t('validations.required'))\n\n const validation = requirement.metadata?.validation\n // Not all requirements have validation\n if (validation) {\n if (requirement.metadata?.type === 'tax_rate') {\n if (validation.type === 'min_max') {\n const min = parseFloat(validation.min as string)\n const max = parseFloat(validation.max as string)\n\n if (!isNaN(min) && !isNaN(max)) {\n fieldSchema = z.preprocess(\n val => Number(val),\n z\n .number()\n .min(min, t('validations.minValue', { min }))\n .max(max, t('validations.maxValue', { max }))\n .transform(num => String(num)),\n )\n }\n } else {\n //Type is one_of\n const oneOfValues = validation.rates as string[]\n fieldSchema = z\n .string({\n required_error: t('validations.required'),\n })\n .min(1, t('validations.required'))\n .refine(val => oneOfValues.includes(val), {\n message: t('validations.oneOf', { values: oneOfValues.join(', ') }),\n })\n }\n }\n }\n if (requirement.metadata?.type === 'radio') {\n fieldSchema = z.boolean({\n required_error: t('validations.required'),\n })\n }\n requirementShape[requirementKey] = fieldSchema\n // --- End Schema Logic ---\n })\n\n if (Object.keys(requirementShape).length > 0) {\n schemaShape[requirementSetKey] = z.object(requirementShape)\n values[requirementSetKey] = requirementValues\n }\n })\n\n const finalSchema = z.object(schemaShape)\n\n // Return both the schema and the default values\n return {\n dynamicSchema: finalSchema,\n defaultValues: values as z.infer<typeof finalSchema>,\n }\n }, [stateTaxRequirements, t])\n\n // Infer the type from the schema\n type InferredFormInputs = z.infer<typeof dynamicSchema>\n\n const { control, ...methods } = useForm<InferredFormInputs>({\n resolver: zodResolver(dynamicSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InferredFormInputs) => {\n await baseSubmitHandler(formData, async payload => {\n const requirementSets = stateTaxRequirements.requirementSets\n ?.filter(rs => rs.key && payload[rs.key])\n .map(requirementSet => {\n const requirementSetKey = requirementSet.key as string\n const payloadSet = payload[requirementSetKey] as Record<string, unknown>\n return {\n state: requirementSet.state,\n key: requirementSetKey,\n effectiveFrom: requirementSet.effectiveFrom,\n requirements: Object.entries(payloadSet).map(([key, value]) => ({\n key,\n value: String(value),\n })),\n }\n })\n await updateStateTax({\n request: {\n companyUuid: companyId,\n requestBody: { requirementSets },\n state,\n },\n })\n onEvent(componentEvents.COMPANY_STATE_TAX_UPDATED)\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <StateTaxesFormProvider\n value={{ stateTaxRequirements, isPending: isPendingUpdate, state, handleCancel }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n"],"names":["StateTaxesForm","props","jsx","BaseComponent","Root","companyId","state","className","children","useI18n","onEvent","baseSubmitHandler","useBase","t","useTranslation","data","useTaxRequirementsGetSuspense","stateTaxRequirements","updateStateTax","isPendingUpdate","useTaxRequirementsUpdateStateMutation","dynamicSchema","defaultValues","useMemo","schemaShape","values","requirementSet","requirementSetKey","requirementShape","requirementValues","requirement","requirementKey","fieldSchema","z","validation","min","max","val","num","oneOfValues","control","methods","useForm","zodResolver","onSubmit","formData","payload","requirementSets","rs","payloadSet","key","value","componentEvents","handleCancel","FormProvider","HtmlForm","StateTaxesFormProvider","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,OAAAC,GAAO,WAAAC,GAAW,UAAAC,KAAiC;AAC5E,EAAAC,EAAQ,oBAAoB;AAC5B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,MAAAC,MAASC,EAA8B,EAAE,aAAaX,GAAW,OAAAC,GAAO,GAC1EW,IAAuBF,EAAK,sBAE5B,EAAE,aAAaG,GAAgB,WAAWC,EAAA,IAC9CC,EAAA,GAGI,EAAE,eAAAC,GAAe,eAAAC,EAAA,IAAkBC,EAAQ,MAAM;AACrD,UAAMC,IAAyE,CAAA,GACzEC,IACJ,CAAA;AAGF,WAAAR,EAAqB,iBAAiB,QAAQ,CAAAS,MAAkB;AAC9D,UAAI,CAACA,EAAe,IAAK;AAEzB,YAAMC,IAAoBD,EAAe,KACnCE,IAAiD,CAAA,GACjDC,IAA2E,CAAA;AAEjF,MAAAH,EAAe,cAAc,QAAQ,CAAAI,MAAe;AAClD,YAAI,CAACA,EAAY,IAAK;AAEtB,cAAMC,IAAiBD,EAAY;AAGnC,QAAAD,EAAkBE,CAAc,IAC9BD,EAAY,UAAU,SAAS,UAC1BA,EAAY,SAAS,SACtBA,EAAY,QACV,OAAOA,EAAY,KAAK,IACxB;AAIR,YAAIE,IAA4BC,EAC7B,OAAO;AAAA,UACN,gBAAgBpB,EAAE,sBAAsB;AAAA,QAAA,CACzC,EACA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,GAAsB,WAAWE,GAAiB,OAAAb,GAAO,cAAA+C,EAAA;AAAA,MAElE,UAAA,gBAAAnD,EAACuD,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAjD,KAGC,gBAAAkD,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAAzD,EAAC0D,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,EAAA,CAEJ;AAAA,IAAA;AAAA,EAAA,EACF,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"StateTaxesForm.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTaxRequirementsUpdateStateMutation } from '@gusto/embedded-api/react-query/taxRequirementsUpdateState'\nimport { useTaxRequirementsGetSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGet'\nimport { z } from 'zod'\nimport { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Head } from './Head'\nimport { StateTaxesFormProvider } from './context'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\n\ninterface StateTaxesFormProps extends CommonComponentInterface {\n companyId: string\n state: string\n}\n\nexport function StateTaxesForm(props: StateTaxesFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, state, className, children }: StateTaxesFormProps) {\n useI18n('Company.StateTaxes')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { data } = useTaxRequirementsGetSuspense({ companyUuid: companyId, state })\n const stateTaxRequirements = data.taxRequirementsState!\n\n const { mutateAsync: updateStateTax, isPending: isPendingUpdate } =\n useTaxRequirementsUpdateStateMutation()\n\n // Schema and default value generation\n const { dynamicSchema, defaultValues } = useMemo(() => {\n const schemaShape: Record<string, z.ZodObject<Record<string, z.ZodTypeAny>>> = {}\n const values: Partial<Record<string, Record<string, string | boolean | number | undefined>>> =\n {}\n\n //Looping through each requirement set\n stateTaxRequirements.requirementSets?.forEach(requirementSet => {\n if (!requirementSet.key) return\n\n const requirementSetKey = requirementSet.key\n const requirementShape: Record<string, z.ZodTypeAny> = {}\n const requirementValues: Record<string, string | boolean | number | undefined> = {}\n\n requirementSet.requirements?.forEach(requirement => {\n if (!requirement.key) return\n\n const requirementKey = requirement.key\n\n const isPercentField =\n requirement.metadata?.type === 'tax_rate' || requirement.metadata?.type === 'percent'\n\n if (requirement.metadata?.type === 'radio') {\n requirementValues[requirementKey] = requirement.value ?? undefined\n } else {\n requirementValues[requirementKey] = requirement.value ? String(requirement.value) : ''\n }\n\n let fieldSchema: z.ZodTypeAny = z\n .string({\n required_error: t('validations.required'),\n })\n .min(1, t('validations.required'))\n\n const validation = requirement.metadata?.validation\n\n if (validation) {\n if (isPercentField && validation.type === 'one_of') {\n const oneOfValues = validation.rates as string[]\n fieldSchema = z\n .string({\n required_error: t('validations.required'),\n })\n .min(1, t('validations.required'))\n .refine(val => oneOfValues.includes(val), {\n message: t('validations.oneOf', { values: oneOfValues.join(', ') }),\n })\n }\n }\n\n if (requirement.metadata?.type === 'radio') {\n fieldSchema = z.boolean({\n required_error: t('validations.required'),\n })\n }\n requirementShape[requirementKey] = fieldSchema\n // --- End Schema Logic ---\n })\n\n if (Object.keys(requirementShape).length > 0) {\n schemaShape[requirementSetKey] = z.object(requirementShape)\n values[requirementSetKey] = requirementValues\n }\n })\n\n const finalSchema = z.object(schemaShape)\n\n // Return both the schema and the default values\n return {\n dynamicSchema: finalSchema,\n defaultValues: values as z.infer<typeof finalSchema>,\n }\n }, [stateTaxRequirements, t])\n\n // Infer the type from the schema\n type InferredFormInputs = z.infer<typeof dynamicSchema>\n\n const { control, ...methods } = useForm<InferredFormInputs>({\n resolver: zodResolver(dynamicSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InferredFormInputs) => {\n await baseSubmitHandler(formData, async payload => {\n const requirementSets = stateTaxRequirements.requirementSets\n ?.filter(rs => rs.key && payload[rs.key])\n .map(requirementSet => {\n const requirementSetKey = requirementSet.key as string\n const payloadSet = payload[requirementSetKey] as Record<string, unknown>\n\n return {\n state: requirementSet.state,\n key: requirementSetKey,\n effectiveFrom: requirementSet.effectiveFrom,\n requirements: Object.entries(payloadSet).map(([reqKey, value]) => ({\n key: reqKey,\n value: String(value),\n })),\n }\n })\n await updateStateTax({\n request: {\n companyUuid: companyId,\n requestBody: { requirementSets },\n state,\n },\n })\n onEvent(componentEvents.COMPANY_STATE_TAX_UPDATED)\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <StateTaxesFormProvider\n value={{ stateTaxRequirements, isPending: isPendingUpdate, state, handleCancel }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n"],"names":["StateTaxesForm","props","jsx","BaseComponent","Root","companyId","state","className","children","useI18n","onEvent","baseSubmitHandler","useBase","t","useTranslation","data","useTaxRequirementsGetSuspense","stateTaxRequirements","updateStateTax","isPendingUpdate","useTaxRequirementsUpdateStateMutation","dynamicSchema","defaultValues","useMemo","schemaShape","values","requirementSet","requirementSetKey","requirementShape","requirementValues","requirement","requirementKey","isPercentField","fieldSchema","z","validation","oneOfValues","val","control","methods","useForm","zodResolver","onSubmit","formData","payload","requirementSets","rs","payloadSet","reqKey","value","componentEvents","handleCancel","FormProvider","HtmlForm","StateTaxesFormProvider","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,OAAAC,GAAO,WAAAC,GAAW,UAAAC,KAAiC;AAC5E,EAAAC,EAAQ,oBAAoB;AAC5B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,MAAAC,MAASC,EAA8B,EAAE,aAAaX,GAAW,OAAAC,GAAO,GAC1EW,IAAuBF,EAAK,sBAE5B,EAAE,aAAaG,GAAgB,WAAWC,EAAA,IAC9CC,EAAA,GAGI,EAAE,eAAAC,GAAe,eAAAC,EAAA,IAAkBC,EAAQ,MAAM;AACrD,UAAMC,IAAyE,CAAA,GACzEC,IACJ,CAAA;AAGF,WAAAR,EAAqB,iBAAiB,QAAQ,CAAAS,MAAkB;AAC9D,UAAI,CAACA,EAAe,IAAK;AAEzB,YAAMC,IAAoBD,EAAe,KACnCE,IAAiD,CAAA,GACjDC,IAA2E,CAAA;AAEjF,MAAAH,EAAe,cAAc,QAAQ,CAAAI,MAAe;AAClD,YAAI,CAACA,EAAY,IAAK;AAEtB,cAAMC,IAAiBD,EAAY,KAE7BE,IACJF,EAAY,UAAU,SAAS,cAAcA,EAAY,UAAU,SAAS;AAE9E,QAAIA,EAAY,UAAU,SAAS,UACjCD,EAAkBE,CAAc,IAAID,EAAY,SAAS,SAEz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