@gusto/embedded-react-sdk 0.12.3 → 0.13.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 (182) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/assets/icons/spinner_small.svg.js +10 -0
  3. package/dist/assets/icons/spinner_small.svg.js.map +1 -0
  4. package/dist/components/Base/Base.js +27 -26
  5. package/dist/components/Base/Base.js.map +1 -1
  6. package/dist/components/Base/useBase.d.ts +2 -0
  7. package/dist/components/Base/useBase.js.map +1 -1
  8. package/dist/components/Common/DataView/DataView.d.ts +2 -1
  9. package/dist/components/Common/DataView/DataView.js +20 -19
  10. package/dist/components/Common/DataView/DataView.js.map +1 -1
  11. package/dist/components/Common/DataView/useDataView.d.ts +3 -1
  12. package/dist/components/Common/DataView/useDataView.js +13 -11
  13. package/dist/components/Common/DataView/useDataView.js.map +1 -1
  14. package/dist/components/Common/EmptyData/EmptyData.module.scss.js +1 -1
  15. package/dist/components/Common/InlineSpinner/InlineSpinner.d.ts +6 -0
  16. package/dist/components/Common/InlineSpinner/InlineSpinner.js +25 -0
  17. package/dist/components/Common/InlineSpinner/InlineSpinner.js.map +1 -0
  18. package/dist/components/Common/InlineSpinner/InlineSpinner.module.scss.js +10 -0
  19. package/dist/components/Common/InlineSpinner/InlineSpinner.module.scss.js.map +1 -0
  20. package/dist/components/Common/InlineSpinner/index.d.ts +2 -0
  21. package/dist/components/Common/PaginationControl/PaginationControl.js +31 -28
  22. package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
  23. package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +1 -0
  24. package/dist/components/Common/SignatureForm/SignatureForm.js +3 -2
  25. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  26. package/dist/components/Common/SignatureForm/SignatureFormActions.js +7 -6
  27. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  28. package/dist/components/Common/SignatureForm/SignatureFormFields.js +8 -7
  29. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  30. package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
  31. package/dist/components/Common/index.d.ts +1 -0
  32. package/dist/components/Company/AssignSignatory/AssignSignatory.js +7 -6
  33. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  34. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +3 -2
  35. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  36. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +3 -2
  37. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  38. package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.d.ts +2 -2
  39. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
  40. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  41. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +6 -5
  42. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  43. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +10 -9
  44. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  45. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
  46. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  47. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
  48. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  49. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
  50. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  51. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +9 -8
  52. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  53. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  54. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  55. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +7 -6
  56. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  57. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  58. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  59. package/dist/components/Company/FederalTaxes/FederalTaxes.js +13 -12
  60. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  61. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +12 -11
  62. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  63. package/dist/components/Company/Industry/Context.js +7 -6
  64. package/dist/components/Company/Industry/Context.js.map +1 -1
  65. package/dist/components/Company/Locations/LocationForm/Form.js +5 -4
  66. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  67. package/dist/components/Company/Locations/LocationForm/LocationForm.js +10 -9
  68. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  69. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
  70. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  71. package/dist/components/Company/Locations/LocationsList/LocationsList.js +7 -6
  72. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  73. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
  74. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  75. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +3 -2
  76. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  77. package/dist/components/Company/OnboardingOverview/context.js +4 -3
  78. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  79. package/dist/components/Company/PaySchedule/PaySchedule.js +33 -32
  80. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  81. package/dist/components/Company/PaySchedule/_parts/Edit.js +3 -2
  82. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  83. package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
  84. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  85. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
  86. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  87. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
  88. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  89. package/dist/components/Contractor/Address/Address.js +4 -3
  90. package/dist/components/Contractor/Address/Address.js.map +1 -1
  91. package/dist/components/Contractor/Address/Form.js +3 -2
  92. package/dist/components/Contractor/Address/Form.js.map +1 -1
  93. package/dist/components/Contractor/Address/useAddress.js +6 -5
  94. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  95. package/dist/components/Contractor/NewHireReport/NewHireReport.js +51 -49
  96. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  97. package/dist/components/Contractor/NewHireReport/types.d.ts +1 -0
  98. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js +19 -12
  99. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
  100. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js +6 -5
  101. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -1
  102. package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +4 -4
  103. package/dist/components/Contractor/Profile/useContractorProfile.d.ts +19 -19
  104. package/dist/components/Contractor/Profile/useContractorProfile.js +2 -2
  105. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  106. package/dist/components/Contractor/Submit/Submit.js +24 -24
  107. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  108. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +8 -7
  109. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  110. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  111. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  112. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +10 -9
  113. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  114. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  115. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  116. package/dist/components/Employee/EmployeeList/EmployeeList.js +75 -62
  117. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  118. package/dist/components/Employee/EmployeeList/List.js +27 -25
  119. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  120. package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +1 -0
  121. package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
  122. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  123. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -3
  124. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  125. package/dist/components/Employee/PaymentMethod/BankAccount.d.ts +2 -2
  126. package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +8 -8
  127. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
  128. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  129. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +2 -2
  130. package/dist/components/Employee/Profile/HomeAddress.js +5 -4
  131. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  132. package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +2 -2
  133. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +21 -20
  134. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  135. package/dist/components/Employee/Profile/Profile.js +2 -0
  136. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  137. package/dist/components/Employee/Profile/useProfile.js +4 -3
  138. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  139. package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -3
  140. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  141. package/dist/components/Employee/Taxes/useTaxes.js +4 -3
  142. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  143. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +4 -2
  144. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +75 -34
  145. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  146. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +10 -5
  147. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +116 -50
  148. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  149. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +6 -5
  150. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  151. package/dist/components/Payroll/PayrollList/PayrollList.d.ts +1 -1
  152. package/dist/components/Payroll/PayrollList/PayrollList.js +24 -11
  153. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  154. package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +8 -6
  155. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +34 -25
  156. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  157. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +3 -2
  158. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  159. package/dist/components/Payroll/RunPayrollFlow/RunPayroll.d.ts +2 -1
  160. package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js +4 -4
  161. package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js.map +1 -1
  162. package/dist/components/Payroll/helpers.d.ts +20 -0
  163. package/dist/components/Payroll/helpers.js +208 -0
  164. package/dist/components/Payroll/helpers.js.map +1 -0
  165. package/dist/components/Payroll/helpers.test.d.ts +1 -0
  166. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +3 -2
  167. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  168. package/dist/helpers/formattedStrings.d.ts +9 -0
  169. package/dist/helpers/formattedStrings.js +55 -16
  170. package/dist/helpers/formattedStrings.js.map +1 -1
  171. package/dist/i18n/I18n.js +11 -11
  172. package/dist/i18n/I18n.js.map +1 -1
  173. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +30 -0
  174. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js.map +1 -0
  175. package/dist/i18n/en/Payroll.PayrollList.json.js +14 -0
  176. package/dist/i18n/en/Payroll.PayrollList.json.js.map +1 -0
  177. package/dist/i18n/en/common.json.d.ts +8 -0
  178. package/dist/i18n/en/common.json.js +15 -13
  179. package/dist/i18n/en/common.json.js.map +1 -1
  180. package/dist/style.css +1 -1
  181. package/dist/types/i18next.d.ts +45 -1
  182. package/package.json +28 -28
@@ -1,51 +1,60 @@
1
- import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
- import { Flex as d } from "../../Common/Flex/Flex.js";
1
+ import { jsx as r, jsxs as a } from "react/jsx-runtime";
2
+ import { useTranslation as u } from "react-i18next";
3
+ import { Flex as c } from "../../Common/Flex/Flex.js";
3
4
  import "classnames";
4
5
  import "../../../shared/constants.js";
5
- import { useComponentContext as m } from "../../../contexts/ComponentAdapter/useComponentContext.js";
6
- import { DataView as u } from "../../Common/DataView/DataView.js";
7
- const f = ({
8
- onRunPayroll: t,
9
- payrolls: l
6
+ import { useComponentContext as p } from "../../../contexts/ComponentAdapter/useComponentContext.js";
7
+ import { useI18n as f } from "../../../i18n/I18n.js";
8
+ import { DataView as y } from "../../Common/DataView/DataView.js";
9
+ const T = ({
10
+ onRunPayroll: i,
11
+ payrolls: s,
12
+ paySchedules: n
10
13
  }) => {
11
- const { Badge: o, Button: n, Text: r } = m();
12
- return /* @__PURE__ */ e(
13
- u,
14
+ const { Badge: d, Button: m, Text: l } = p();
15
+ f("Payroll.PayrollList");
16
+ const { t } = u("Payroll.PayrollList");
17
+ return /* @__PURE__ */ r(
18
+ y,
14
19
  {
15
20
  columns: [
16
21
  {
17
- render: () => /* @__PURE__ */ a(d, { flexDirection: "column", children: [
18
- /* @__PURE__ */ e(r, { children: "Jul 5 - Jul 18, 2025" }),
19
- /* @__PURE__ */ e(r, { children: "Regular Payroll" })
22
+ render: ({ payPeriod: e }) => /* @__PURE__ */ a(c, { flexDirection: "column", children: [
23
+ /* @__PURE__ */ a(l, { children: [
24
+ e?.startDate,
25
+ " - ",
26
+ e?.endDate
27
+ ] }),
28
+ /* @__PURE__ */ r(l, { children: n.find((o) => o.uuid === e?.payScheduleUuid)?.name || n.find((o) => o.uuid === e?.payScheduleUuid)?.customName })
20
29
  ] }),
21
- title: "Pay period"
30
+ title: t("tableHeaders.0")
22
31
  },
23
32
  {
24
- title: "Run by",
25
- render: () => /* @__PURE__ */ e(r, { children: "Wed Jul 23, 2025" })
33
+ title: t("tableHeaders.1"),
34
+ render: ({ payrollDeadline: e }) => /* @__PURE__ */ r(l, { children: e?.toLocaleDateString() })
26
35
  },
27
36
  {
28
- title: "Status",
29
- render: () => /* @__PURE__ */ e(o, { children: "Ready to submit" })
37
+ title: t("tableHeaders.2"),
38
+ render: ({ processed: e }) => /* @__PURE__ */ r(d, { children: t(e ? "status.processed" : "status.unprocessed") })
30
39
  }
31
40
  ],
32
- data: l,
33
- label: "Payrolls",
34
- itemMenu: ({ payrollId: i }) => /* @__PURE__ */ e(
35
- n,
41
+ data: s,
42
+ label: t("payrollsListLabel"),
43
+ itemMenu: ({ payrollUuid: e }) => /* @__PURE__ */ r(
44
+ m,
36
45
  {
37
46
  onClick: () => {
38
- t({ payrollId: i });
47
+ i({ payrollId: e });
39
48
  },
40
49
  title: "Run payroll",
41
50
  variant: "secondary",
42
- children: "Run payroll"
51
+ children: t("runPayrollTitle")
43
52
  }
44
53
  )
45
54
  }
46
55
  );
47
56
  };
48
57
  export {
49
- f as PayrollListPresentation
58
+ T as PayrollListPresentation
50
59
  };
51
60
  //# sourceMappingURL=PayrollListPresentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayrollListPresentation.js","sources":["../../../../src/components/Payroll/PayrollList/PayrollListPresentation.tsx"],"sourcesContent":["import { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n//TODO: Use Speakeasy type\ninterface PayrollItem {\n payrollId: string\n}\ninterface PayrollListPresentationProps {\n onRunPayroll: ({ payrollId }: PayrollItem) => void\n payrolls: PayrollItem[]\n}\nexport const PayrollListPresentation = ({\n onRunPayroll,\n payrolls,\n}: PayrollListPresentationProps) => {\n const { Badge, Button, Text } = useComponentContext()\n return (\n <DataView\n columns={[\n {\n render: () => (\n <Flex flexDirection=\"column\">\n <Text>Jul 5 - Jul 18, 2025</Text>\n <Text>Regular Payroll</Text>\n </Flex>\n ),\n title: 'Pay period',\n },\n {\n title: 'Run by',\n render: () => <Text>Wed Jul 23, 2025</Text>,\n },\n {\n title: 'Status',\n render: () => <Badge>Ready to submit</Badge>,\n },\n ]}\n data={payrolls}\n label=\"Payrolls\"\n itemMenu={({ payrollId }) => (\n <Button\n onClick={() => {\n onRunPayroll({ payrollId })\n }}\n title=\"Run payroll\"\n variant=\"secondary\"\n >\n Run payroll\n </Button>\n )}\n />\n )\n}\n"],"names":["PayrollListPresentation","onRunPayroll","payrolls","Badge","Button","Text","useComponentContext","jsx","DataView","jsxs","Flex","payrollId"],"mappings":";;;;;;AAWO,MAAMA,IAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,UAAAC;AACF,MAAoC;AAClC,QAAM,EAAE,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,EAAA,IAASC,EAAA;AAChC,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAS;AAAA,QACP;AAAA,UACE,QAAQ,MACN,gBAAAC,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,YAAA,gBAAAH,EAACF,KAAK,UAAA,uBAAA,CAAoB;AAAA,YAC1B,gBAAAE,EAACF,KAAK,UAAA,kBAAA,CAAe;AAAA,UAAA,GACvB;AAAA,UAEF,OAAO;AAAA,QAAA;AAAA,QAET;AAAA,UACE,OAAO;AAAA,UACP,QAAQ,MAAM,gBAAAE,EAACF,GAAA,EAAK,UAAA,mBAAA,CAAgB;AAAA,QAAA;AAAA,QAEtC;AAAA,UACE,OAAO;AAAA,UACP,QAAQ,MAAM,gBAAAE,EAACJ,GAAA,EAAM,UAAA,kBAAA,CAAe;AAAA,QAAA;AAAA,MACtC;AAAA,MAEF,MAAMD;AAAA,MACN,OAAM;AAAA,MACN,UAAU,CAAC,EAAE,WAAAS,EAAA,MACX,gBAAAJ;AAAA,QAACH;AAAA,QAAA;AAAA,UACC,SAAS,MAAM;AACb,YAAAH,EAAa,EAAE,WAAAU,GAAW;AAAA,UAC5B;AAAA,UACA,OAAM;AAAA,UACN,SAAQ;AAAA,UACT,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED;AAAA,EAAA;AAIR;"}
1
+ {"version":3,"file":"PayrollListPresentation.js","sources":["../../../../src/components/Payroll/PayrollList/PayrollListPresentation.tsx"],"sourcesContent":["import type { Payroll } from '@gusto/embedded-api/models/components/payroll'\nimport type { PayScheduleList } from '@gusto/embedded-api/models/components/payschedulelist'\nimport { useTranslation } from 'react-i18next'\nimport { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\ninterface PayrollListPresentationProps {\n onRunPayroll: ({ payrollId }: { payrollId: NonNullable<Payroll['payrollUuid']> }) => void\n payrolls: Payroll[]\n paySchedules: PayScheduleList[]\n}\nexport const PayrollListPresentation = ({\n onRunPayroll,\n payrolls,\n paySchedules,\n}: PayrollListPresentationProps) => {\n const { Badge, Button, Text } = useComponentContext()\n useI18n('Payroll.PayrollList')\n const { t } = useTranslation('Payroll.PayrollList')\n\n return (\n <DataView\n columns={[\n {\n render: ({ payPeriod }) => (\n <Flex flexDirection=\"column\">\n <Text>\n {payPeriod?.startDate} - {payPeriod?.endDate}\n </Text>\n <Text>\n {paySchedules.find(schedule => schedule.uuid === payPeriod?.payScheduleUuid)\n ?.name ||\n paySchedules.find(schedule => schedule.uuid === payPeriod?.payScheduleUuid)\n ?.customName}\n </Text>\n </Flex>\n ),\n title: t('tableHeaders.0'),\n },\n {\n title: t('tableHeaders.1'),\n render: ({ payrollDeadline }) => <Text>{payrollDeadline?.toLocaleDateString()}</Text>,\n },\n {\n title: t('tableHeaders.2'),\n render: ({ processed }) => (\n <Badge>{processed ? t('status.processed') : t('status.unprocessed')}</Badge>\n ),\n },\n ]}\n data={payrolls}\n label={t('payrollsListLabel')}\n itemMenu={({ payrollUuid }) => (\n <Button\n onClick={() => {\n onRunPayroll({ payrollId: payrollUuid! })\n }}\n title=\"Run payroll\"\n variant=\"secondary\"\n >\n {t('runPayrollTitle')}\n </Button>\n )}\n />\n )\n}\n"],"names":["PayrollListPresentation","onRunPayroll","payrolls","paySchedules","Badge","Button","Text","useComponentContext","useI18n","useTranslation","jsx","DataView","payPeriod","jsxs","Flex","schedule","payrollDeadline","processed","payrollUuid"],"mappings":";;;;;;;;AAYO,MAAMA,IAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AACF,MAAoC;AAClC,QAAM,EAAE,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,EAAA,IAASC,EAAA;AAChC,EAAAC,EAAQ,qBAAqB;AAC7B,QAAM,EAAE,EAAA,IAAMC,EAAe,qBAAqB;AAElD,SACE,gBAAAC;AAAA,IAACC;A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
3
  import "classnames";
4
4
  import "../../../shared/constants.js";
5
+ import "react-i18next";
5
6
  import { useComponentContext as m } from "../../../contexts/ComponentAdapter/useComponentContext.js";
6
7
  import { DataView as s } from "../../Common/DataView/DataView.js";
7
- const f = ({ onEdit: a, onSubmit: d }) => {
8
+ const x = ({ onEdit: a, onSubmit: d }) => {
8
9
  const { Alert: i, Button: n, Heading: o, Text: t } = m();
9
10
  return /* @__PURE__ */ r(l, { flexDirection: "column", alignItems: "stretch", children: [
10
11
  /* @__PURE__ */ r(l, { justifyContent: "space-between", children: [
@@ -65,6 +66,6 @@ const f = ({ onEdit: a, onSubmit: d }) => {
65
66
  ] });
66
67
  };
67
68
  export {
68
- f as PayrollOverviewPresentation
69
+ x as PayrollOverviewPresentation
69
70
  };
70
71
  //# sourceMappingURL=PayrollOverviewPresentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayrollOverviewPresentation.js","sources":["../../../../src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.tsx"],"sourcesContent":["import { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ninterface PayrollOverviewProps {\n onEdit: () => void\n onSubmit: () => void\n}\n\nexport const PayrollOverviewPresentation = ({ onEdit, onSubmit }: PayrollOverviewProps) => {\n const { Alert, Button, Heading, Text } = useComponentContext()\n\n return (\n <Flex flexDirection=\"column\" alignItems=\"stretch\">\n <Flex justifyContent=\"space-between\">\n <Heading as=\"h1\">Review payroll for Jul 5 - Jul 18, 2025</Heading>\n <Flex justifyContent=\"flex-end\">\n <Button title=\"Edit\" onClick={onEdit} variant=\"secondary\">\n Edit\n </Button>\n <Button title=\"Submit\" onClick={onSubmit}>\n Submit\n </Button>\n </Flex>\n </Flex>\n <Alert label=\"Your progress has been saved\" status=\"success\"></Alert>\n <Alert\n label=\"To pay your employees with direct deposit on Fri, Jul 25, you'll need to run payroll by 7:00 PM EDT on Wed, Jul 23\"\n status=\"warning\"\n >\n {\"If you miss this deadline, your employees' direct deposit will be delayed.\"}\n </Alert>\n <Heading as=\"h3\">Payroll Summary</Heading>\n <DataView\n label=\"Summary\"\n columns={[\n {\n title: 'Total payroll',\n render: () => <Text>$32,161.22</Text>,\n },\n {\n title: 'Debit amount',\n render: () => <Text>$28,896.27</Text>,\n },\n ]}\n data={[{}]}\n />\n <DataView\n label=\"Configuration\"\n columns={[\n {\n title: 'Employees',\n render: () => <Text>John Smith</Text>,\n },\n {\n title: 'Gross Pay',\n render: () => <Text>$2,345.16</Text>,\n },\n {\n title: 'Reimbursements',\n render: () => <Text>$0.00</Text>,\n },\n ]}\n data={[{}]}\n />\n </Flex>\n )\n}\n"],"names":["PayrollOverviewPresentation","onEdit","onSubmit","Alert","Button","Heading","Text","useComponentContext","jsxs","Flex","jsx","DataView"],"mappings":";;;;;;AAQO,MAAMA,IAA8B,CAAC,EAAE,QAAAC,GAAQ,UAAAC,QAAqC;AACzF,QAAM,EAAE,OAAAC,GAAO,QAAAC,GAAQ,SAAAC,GAAS,MAAAC,EAAA,IAASC,EAAA;AAEzC,SACE,gBAAAC,EAACC,GAAA,EAAK,eAAc,UAAS,YAAW,WACtC,UAAA;AAAA,IAAA,gBAAAD,EAACC,GAAA,EAAK,gBAAe,iBACnB,UAAA;AAAA,MAAA,gBAAAC,EAACL,GAAA,EAAQ,IAAG,MAAK,UAAA,2CAAuC;AAAA,MACxD,gBAAAG,EAACC,GAAA,EAAK,gBAAe,YACnB,UAAA;AAAA,QAAA,gBAAAC,EAACN,KAAO,OAAM,QAAO,SAASH,GAAQ,SAAQ,aAAY,UAAA,OAAA,CAE1D;AAAA,0BACCG,GAAA,EAAO,OAAM,UAAS,SAASF,GAAU,UAAA,SAAA,CAE1C;AAAA,MAAA,EAAA,CACF;AAAA,IAAA,GACF;AAAA,IACA,gBAAAQ,EAACP,GAAA,EAAM,OAAM,gCAA+B,QAAO,WAAU;AAAA,IAC7D,gBAAAO;AAAA,MAACP;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,QAAO;AAAA,QAEN,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEH,gBAAAO,EAACL,GAAA,EAAQ,IAAG,MAAK,UAAA,mBAAe;AAAA,IAChC,gBAAAK;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,SAAS;AAAA,UACP;AAAA,YACE,OAAO;AAAA,YACP,QAAQ,MAAM,gBAAAD,EAACJ,GAAA,EAAK,UAAA,aAAA,CAAU;AAAA,UAAA;AAAA,UAEhC;AAAA,YACE,OAAO;AAAA,YACP,QAAQ,MAAM,gBAAAI,EAACJ,GAAA,EAAK,UAAA,aAAA,CAAU;AAAA,UAAA;AAAA,QAChC;AAAA,QAEF,MAAM,CAAC,CAAA,CAAE;AAAA,MAAA;AAAA,IAAA;AAAA,IAEX,gBAAAI;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,SAAS;AAAA,UACP;AAAA,YACE,OAAO;AAAA,YACP,QAAQ,MAAM,gBAAAD,EAACJ,GAAA,EAAK,UAAA,aAAA,CAAU;AAAA,UAAA;AAAA,UAEhC;AAAA,YACE,OAAO;AAAA,YACP,QAAQ,MAAM,gBAAAI,EAACJ,GAAA,EAAK,UAAA,YAAA,CAAS;AAAA,UAAA;AAAA,UAE/B;AAAA,YACE,OAAO;AAAA,YACP,QAAQ,MAAM,gBAAAI,EAACJ,GAAA,EAAK,UAAA,QAAA,CAAK;AAAA,UAAA;AAAA,QAC3B;AAAA,QAEF,MAAM,CAAC,CAAA,CAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EACX,GACF;AAEJ;"}
1
+ {"version":3,"file":"PayrollOverviewPresentation.js","sources":["../../../../src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.tsx"],"sourcesContent":["import { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ninterface PayrollOverviewProps {\n onEdit: () => void\n onSubmit: () => void\n}\n\nexport const PayrollOverviewPresentation = ({ onEdit, onSubmit }: PayrollOverviewProps) => {\n const { Alert, Button, Heading, Text } = useComponentContext()\n\n return (\n <Flex flexDirection=\"column\" alignItems=\"stretch\">\n <Flex justifyContent=\"space-between\">\n <Heading as=\"h1\">Review payroll for Jul 5 - Jul 18, 2025</Heading>\n <Flex justifyContent=\"flex-end\">\n <Button title=\"Edit\" onClick={onEdit} variant=\"secondary\">\n Edit\n </Button>\n <Button title=\"Submit\" onClick={onSubmit}>\n Submit\n </Button>\n </Flex>\n </Flex>\n <Alert label=\"Your progress has been saved\" status=\"success\"></Alert>\n <Alert\n label=\"To pay your employees with direct deposit on Fri, Jul 25, you'll need to run payroll by 7:00 PM EDT on Wed, Jul 23\"\n status=\"warning\"\n >\n {\"If you miss this deadline, your employees' direct deposit will be delayed.\"}\n </Alert>\n <Heading as=\"h3\">Payroll Summary</Heading>\n <DataView\n label=\"Summary\"\n columns={[\n {\n title: 'Total payroll',\n render: () => <Text>$32,161.22</Text>,\n },\n {\n title: 'Debit amount',\n render: () => <Text>$28,896.27</Text>,\n },\n ]}\n data={[{}]}\n />\n <DataView\n label=\"Configuration\"\n columns={[\n {\n title: 'Employees',\n render: () => <Text>John Smith</Text>,\n },\n {\n title: 'Gross Pay',\n render: () => <Text>$2,345.16</Text>,\n },\n {\n title: 'Reimbursements',\n render: () => <Text>$0.00</Text>,\n },\n ]}\n data={[{}]}\n />\n </Flex>\n )\n}\n"],"names":["PayrollOverviewPresentation","onEdit","onSubmit","Alert","Button","Heading","Text","useComponentContext","jsxs","Flex","jsx","DataView"],"mappings":";;;;;;;AAQO,MAAMA,IAA8B,CAAC,EAAE,QAAAC,GAAQ,UAAAC,QAAqC;AACzF,QAAM,EAAE,OAAAC,GAAO,QAAAC,GAAQ,SAAAC,GAAS,MAAAC,EAAA,IAASC,EAAA;AAEzC,SACE,gBAAAC,EAACC,GAAA,EAAK,eAAc,UAAS,YAAW,WACtC,UAAA;AAAA,IAAA,gBAAAD,EAACC,GAAA,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AA,EAAK,UAAA,YAAA,CAAS;AAAA,UAAA;AAAA,UAE/B;AAAA,YACE,OAAO;AAAA,YACP,QAAQ,MAAM,gBAAAI,EAACJ,GAAA,EAAK,UAAA,QAAA,CAAK;AAAA,UAAA;AAAA,QAC3B;AAAA,QAEF,MAAM,CAAC,CAAA,CAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EACX,GACF;AAEJ;"}
@@ -1,8 +1,9 @@
1
1
  import { BaseComponentInterface } from '../../Base/Base';
2
2
  interface RunPayrollProps extends Pick<BaseComponentInterface, 'onEvent'> {
3
3
  companyId: string;
4
- Configuration: ({ onEvent, payrollId, }: Pick<BaseComponentInterface, 'onEvent'> & {
4
+ Configuration: ({ onEvent, payrollId, companyId, }: Pick<BaseComponentInterface, 'onEvent'> & {
5
5
  payrollId: string;
6
+ companyId: string;
6
7
  }) => React.JSX.Element;
7
8
  List: ({ companyId, onEvent, }: Pick<BaseComponentInterface, 'onEvent'> & {
8
9
  companyId: string;
@@ -1,4 +1,4 @@
1
- import { jsx as o } from "react/jsx-runtime";
1
+ import { jsx as t } from "react/jsx-runtime";
2
2
  import { useReducer as i } from "react";
3
3
  const P = () => ({
4
4
  currentPayrollId: void 0,
@@ -44,10 +44,10 @@ const P = () => ({
44
44
  const [{ isCalculated: s, currentPayrollId: e }, y] = i(
45
45
  p,
46
46
  P()
47
- ), a = (t, u) => {
48
- y({ type: t, payload: u }), c(t, u);
47
+ ), a = (o, u) => {
48
+ y({ type: o, payload: u }), c(o, u);
49
49
  };
50
- return e ? s ? /* @__PURE__ */ o(d, { companyId: r, onEvent: a, payrollId: e }) : /* @__PURE__ */ o(l, { onEvent: a, payrollId: e }) : /* @__PURE__ */ o(n, { companyId: r, onEvent: a });
50
+ return e ? s ? /* @__PURE__ */ t(d, { companyId: r, onEvent: a, payrollId: e }) : /* @__PURE__ */ t(l, { onEvent: a, payrollId: e, companyId: r }) : /* @__PURE__ */ t(n, { companyId: r, onEvent: a });
51
51
  };
52
52
  export {
53
53
  v as RunPayroll
@@ -1 +1 @@
1
- {"version":3,"file":"RunPayroll.js","sources":["../../../../src/components/Payroll/RunPayrollFlow/RunPayroll.tsx"],"sourcesContent":["import { useReducer } from 'react'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType, runPayrollEvents } from '@/shared/constants'\n\ntype PayrollFlowEvent = (typeof runPayrollEvents)[keyof typeof runPayrollEvents]\ntype PayrollFlowAction =\n | {\n type: Extract<\n PayrollFlowEvent,\n 'runPayroll/back' | 'runPayroll/edited' | 'runPayroll/calculated' | 'runPayroll/submitted'\n >\n }\n | {\n type: Extract<PayrollFlowEvent, 'runPayroll/selected'>\n payload: { payrollId: string }\n }\n\ninterface PayrollFlowState {\n currentPayrollId?: string\n isCalculated: boolean\n}\nconst createInitialPayrollFlowState: () => PayrollFlowState = () => ({\n currentPayrollId: undefined,\n isCalculated: false,\n})\n\nconst runPayrollFlowReducer: (\n state: PayrollFlowState,\n action: PayrollFlowAction,\n) => PayrollFlowState = (state, action) => {\n switch (action.type) {\n case 'runPayroll/back':\n return {\n ...state,\n currentPayrollId: undefined,\n }\n case 'runPayroll/edited':\n return {\n ...state,\n isCalculated: false,\n }\n case 'runPayroll/calculated':\n return {\n ...state,\n isCalculated: true,\n }\n case 'runPayroll/selected': {\n return {\n ...state,\n currentPayrollId: action.payload.payrollId,\n }\n }\n case 'runPayroll/submitted': {\n return {\n ...state,\n isCalculated: false,\n currentPayrollId: undefined,\n }\n }\n default:\n return state\n }\n}\n\ninterface RunPayrollProps extends Pick<BaseComponentInterface, 'onEvent'> {\n companyId: string\n Configuration: ({\n onEvent,\n payrollId,\n }: Pick<BaseComponentInterface, 'onEvent'> & { payrollId: string }) => React.JSX.Element\n List: ({\n companyId,\n onEvent,\n }: Pick<BaseComponentInterface, 'onEvent'> & { companyId: string }) => React.JSX.Element\n Overview: ({\n companyId,\n onEvent,\n payrollId,\n }: Pick<BaseComponentInterface, 'onEvent'> & {\n companyId: string\n payrollId: string\n }) => React.JSX.Element\n}\n\nexport const RunPayroll = ({\n companyId,\n Configuration,\n List,\n onEvent,\n Overview,\n}: RunPayrollProps) => {\n const [{ isCalculated, currentPayrollId }, dispatch] = useReducer(\n runPayrollFlowReducer,\n createInitialPayrollFlowState(),\n )\n\n const wrappedOnEvent: OnEventType<string, unknown> = (event, payload) => {\n dispatch({ type: event, payload } as PayrollFlowAction)\n onEvent(event as EventType, payload)\n }\n\n return currentPayrollId ? (\n isCalculated ? (\n <Overview companyId={companyId} onEvent={wrappedOnEvent} payrollId={currentPayrollId} />\n ) : (\n <Configuration onEvent={wrappedOnEvent} payrollId={currentPayrollId} />\n )\n ) : (\n <List companyId={companyId} onEvent={wrappedOnEvent} />\n )\n}\n"],"names":["createInitialPayrollFlowState","runPayrollFlowReducer","state","action","RunPayroll","companyId","Configuration","List","onEvent","Overview","isCalculated","currentPayrollId","dispatch","useReducer","wrappedOnEvent","event","payload","jsx"],"mappings":";;AAsBA,MAAMA,IAAwD,OAAO;AAAA,EACnE,kBAAkB;AAAA,EAClB,cAAc;AAChB,IAEMC,IAGkB,CAACC,GAAOC,MAAW;AACzC,UAAQA,EAAO,MAAA;AAAA,IACb,KAAK;AACH,aAAO;AAAA,QACL,GAAGD;AAAA,QACH,kBAAkB;AAAA,MAAA;AAAA,IAEtB,KAAK;AACH,aAAO;AAAA,QACL,GAAGA;AAAA,QACH,cAAc;AAAA,MAAA;AAAA,IAElB,KAAK;AACH,aAAO;AAAA,QACL,GAAGA;AAAA,QACH,cAAc;AAAA,MAAA;AAAA,IAElB,KAAK;AACH,aAAO;AAAA,QACL,GAAGA;AAAA,QACH,kBAAkBC,EAAO,QAAQ;AAAA,MAAA;AAAA,IAGrC,KAAK;AACH,aAAO;AAAA,QACL,GAAGD;AAAA,QACH,cAAc;AAAA,QACd,kBAAkB;AAAA,MAAA;AAAA,IAGtB;AACE,aAAOA;AAAA,EAAA;AAEb,GAsBaE,IAAa,CAAC;AAAA,EACzB,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,MAAuB;AACrB,QAAM,CAAC,EAAE,cAAAC,GAAc,kBAAAC,EAAA,GAAoBC,CAAQ,IAAIC;AAAA,IACrDZ;AAAA,IACAD,EAAA;AAAA,EAA8B,GAG1Bc,IAA+C,CAACC,GAAOC,MAAY;AACvE,IAAAJ,EAAS,EAAE,MAAMG,GAAO,SAAAC,EAAA,CAA8B,GACtDR,EAAQO,GAAoBC,CAAO;AAAA,EACrC;AAEA,SAAOL,IACLD,IACE,gBAAAO,EAACR,GAAA,EAAS,WAAAJ,GAAsB,SAASS,GAAgB,WAAWH,EAAA,CAAkB,sBAErFL,GAAA,EAAc,SAASQ,GAAgB,WAAWH,EAAA,CAAkB,IAGvE,gBAAAM,EAACV,GAAA,EAAK,WAAAF,GAAsB,SAASS,EAAA,CAAgB;AAEzD;"}
1
+ {"version":3,"file":"RunPayroll.js","sources":["../../../../src/components/Payroll/RunPayrollFlow/RunPayroll.tsx"],"sourcesContent":["import { useReducer } from 'react'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType, runPayrollEvents } from '@/shared/constants'\n\ntype PayrollFlowEvent = (typeof runPayrollEvents)[keyof typeof runPayrollEvents]\ntype PayrollFlowAction =\n | {\n type: Extract<\n PayrollFlowEvent,\n 'runPayroll/back' | 'runPayroll/edited' | 'runPayroll/calculated' | 'runPayroll/submitted'\n >\n }\n | {\n type: Extract<PayrollFlowEvent, 'runPayroll/selected'>\n payload: { payrollId: string }\n }\n\ninterface PayrollFlowState {\n currentPayrollId?: string\n isCalculated: boolean\n}\nconst createInitialPayrollFlowState: () => PayrollFlowState = () => ({\n currentPayrollId: undefined,\n isCalculated: false,\n})\n\nconst runPayrollFlowReducer: (\n state: PayrollFlowState,\n action: PayrollFlowAction,\n) => PayrollFlowState = (state, action) => {\n switch (action.type) {\n case 'runPayroll/back':\n return {\n ...state,\n currentPayrollId: undefined,\n }\n case 'runPayroll/edited':\n return {\n ...state,\n isCalculated: false,\n }\n case 'runPayroll/calculated':\n return {\n ...state,\n isCalculated: true,\n }\n case 'runPayroll/selected': {\n return {\n ...state,\n currentPayrollId: action.payload.payrollId,\n }\n }\n case 'runPayroll/submitted': {\n return {\n ...state,\n isCalculated: false,\n currentPayrollId: undefined,\n }\n }\n default:\n return state\n }\n}\n\ninterface RunPayrollProps extends Pick<BaseComponentInterface, 'onEvent'> {\n companyId: string\n Configuration: ({\n onEvent,\n payrollId,\n companyId,\n }: Pick<BaseComponentInterface, 'onEvent'> & {\n payrollId: string\n companyId: string\n }) => React.JSX.Element\n List: ({\n companyId,\n onEvent,\n }: Pick<BaseComponentInterface, 'onEvent'> & { companyId: string }) => React.JSX.Element\n Overview: ({\n companyId,\n onEvent,\n payrollId,\n }: Pick<BaseComponentInterface, 'onEvent'> & {\n companyId: string\n payrollId: string\n }) => React.JSX.Element\n}\n\nexport const RunPayroll = ({\n companyId,\n Configuration,\n List,\n onEvent,\n Overview,\n}: RunPayrollProps) => {\n const [{ isCalculated, currentPayrollId }, dispatch] = useReducer(\n runPayrollFlowReducer,\n createInitialPayrollFlowState(),\n )\n\n const wrappedOnEvent: OnEventType<string, unknown> = (event, payload) => {\n dispatch({ type: event, payload } as PayrollFlowAction)\n onEvent(event as EventType, payload)\n }\n\n return currentPayrollId ? (\n isCalculated ? (\n <Overview companyId={companyId} onEvent={wrappedOnEvent} payrollId={currentPayrollId} />\n ) : (\n <Configuration onEvent={wrappedOnEvent} payrollId={currentPayrollId} companyId={companyId} />\n )\n ) : (\n <List companyId={companyId} onEvent={wrappedOnEvent} />\n )\n}\n"],"names":["createInitialPayrollFlowState","runPayrollFlowReducer","state","action","RunPayroll","companyId","Configuration","List","onEvent","Overview","isCalculated","currentPayrollId","dispatch","useReducer","wrappedOnEvent","event","payload","jsx"],"mappings":";;AAsBA,MAAMA,IAAwD,OAAO;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} from '@gusto/embedded-api/models/components/employee';
2
+ import { EmployeeCompensations } from '@gusto/embedded-api/models/components/payrollshow';
3
+ import { TFunction } from 'i18next';
4
+ import { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject';
5
+ export declare const formatEmployeePayRate: ({ employee, t, locale, }: {
6
+ employee?: Employee;
7
+ t: TFunction;
8
+ locale?: string;
9
+ }) => string | null;
10
+ export declare const useFormatEmployeePayRate: () => (employee?: Employee) => string | null;
11
+ export declare const getEmployeePayRateInfo: (employee: Employee | undefined) => {
12
+ rate: number;
13
+ paymentUnit: import('@gusto/embedded-api/models/components/compensation').PaymentUnit;
14
+ } | null;
15
+ export declare const getRegularHours: (compensation: EmployeeCompensations) => number;
16
+ export declare const getTotalPtoHours: (compensation: EmployeeCompensations) => number;
17
+ export declare const getAdditionalEarnings: (compensation: EmployeeCompensations) => number;
18
+ export declare const getReimbursements: (compensation: EmployeeCompensations) => number;
19
+ export declare const formatHoursDisplay: (hours: number) => string;
20
+ export declare const calculateGrossPay: (compensation: EmployeeCompensations, employee: Employee, compensationEffectiveDateString?: string, paySchedule?: PayScheduleObject, isOffCycle?: boolean) => number;
@@ -0,0 +1,208 @@
1
+ import { useCallback as b } from "react";
2
+ import { useTranslation as C } from "react-i18next";
3
+ import { formatPayRate as T } from "../../helpers/formattedStrings.js";
4
+ import { useLocale as v } from "../../contexts/LocaleProvider/useLocale.js";
5
+ const j = "regular hours", E = (t) => Math.round(t * 1e6) / 1e6, h = (t) => Math.round(t * 100) / 100, P = (t) => t.toLowerCase() === j, M = {
6
+ Daily: 8,
7
+ "Every week": 40,
8
+ "Every other week": 80,
9
+ "Twice per month": 86.666667,
10
+ Monthly: 173.333333,
11
+ Quarterly: 520,
12
+ Semiannually: 1040,
13
+ Annually: 2080
14
+ }, S = ({
15
+ employee: t,
16
+ t: e,
17
+ locale: r = "en-US"
18
+ }) => {
19
+ if (!t?.jobs)
20
+ return null;
21
+ const n = t.jobs.find((s) => s.primary) || t.jobs[0];
22
+ if (!n?.compensations)
23
+ return null;
24
+ const o = n.compensations[0];
25
+ if (!o || !o.rate || parseFloat(o.rate) === 0)
26
+ return null;
27
+ const a = parseFloat(o.rate), u = o.paymentUnit || "Hour";
28
+ return T({ rate: a, paymentUnit: u, t: e, locale: r });
29
+ }, z = () => {
30
+ const { t } = C("common"), { locale: e } = v();
31
+ return b(
32
+ (r) => S({ employee: r, t, locale: e }),
33
+ [t, e]
34
+ );
35
+ }, B = (t) => t.hourlyCompensations ? t.hourlyCompensations.filter((e) => e.name?.toLowerCase() === "regular hours").reduce((e, r) => e + parseFloat(r.hours || "0"), 0) : 0, x = (t) => t.paidTimeOff ? t.paidTimeOff.reduce((e, r) => e + parseFloat(r.hours || "0"), 0) : 0, U = (t) => t.fixedCompensations ? t.fixedCompensations.filter((e) => {
36
+ const r = e.name?.toLowerCase() || "", n = parseFloat(e.amount || "0");
37
+ return r !== "reimbursement" && r !== "minimum wage adjustment" && n > 0;
38
+ }).reduce((e, r) => e + parseFloat(r.amount || "0"), 0) : 0, K = (t) => {
39
+ if (!t.fixedCompensations)
40
+ return 0;
41
+ const e = t.fixedCompensations.find(
42
+ (r) => r.name?.toLowerCase() === "reimbursement"
43
+ );
44
+ return e ? parseFloat(e.amount || "0") : 0;
45
+ }, V = (t) => {
46
+ const e = h(t);
47
+ return e % 1 === 0 ? `${e}.0` : e.toString();
48
+ }, W = (t) => t.frequency && M[t.frequency] || 0, y = (t, e) => {
49
+ if (!t.length) return null;
50
+ const r = [...t].sort(
51
+ (n, o) => (n.effectiveDate ? new Date(n.effectiveDate).getTime() : 0) - (o.effectiveDate ? new Date(o.effectiveDate).getTime() : 0)
52
+ );
53
+ for (let n = r.length - 1; n >= 0; n--) {
54
+ const o = r[n]?.effectiveDate, a = o ? new Date(o) : null;
55
+ if (a && a <= e)
56
+ return r[n] || null;
57
+ }
58
+ return r[0] || null;
59
+ }, A = (t, e) => {
60
+ if (!t.length) return null;
61
+ const r = [...t].sort(
62
+ (n, o) => (n.effectiveDate ? new Date(n.effectiveDate).getTime() : 0) - (o.effectiveDate ? new Date(o.effectiveDate).getTime() : 0)
63
+ );
64
+ for (let n = r.length - 1; n >= 0; n--) {
65
+ const o = r[n]?.effectiveDate, a = o ? new Date(o) : null;
66
+ if (a && a <= e)
67
+ return r[n] || null;
68
+ }
69
+ return r[0] || null;
70
+ }, O = (t) => t.flsaStatus === "Exempt" || t.flsaStatus === "Salaried Nonexempt", L = (t) => t.length ? t.filter((e) => {
71
+ const r = e.name?.toLowerCase(), n = parseFloat(e.amount || "0");
72
+ return (r === "paycheck tips" || r === "cash tips") && n > 0;
73
+ }).reduce((e, r) => e + parseFloat(r.amount || "0"), 0) : 0, g = (t) => {
74
+ const e = parseFloat(t.rate || "0");
75
+ switch (t.paymentUnit || "Hour") {
76
+ case "Hour":
77
+ return e;
78
+ case "Year":
79
+ return e / 2080;
80
+ // 52 weeks * 40 hours
81
+ case "Month":
82
+ return e / 173.333333;
83
+ case "Week":
84
+ return e / 40;
85
+ case "Paycheck":
86
+ return 0;
87
+ // Paycheck rate is 0 for hourly calculation
88
+ default:
89
+ return e;
90
+ }
91
+ }, k = (t, e, r) => {
92
+ const n = t.jobs?.find((a) => a.uuid === e);
93
+ if (!n?.compensations)
94
+ return 0;
95
+ const o = y(n.compensations, r);
96
+ return o ? g(o) : 0;
97
+ }, H = (t, e) => {
98
+ const r = t.jobs?.find((o) => o.primary) || t.jobs?.[0];
99
+ if (!r?.compensations)
100
+ return 0;
101
+ const n = y(r.compensations, e);
102
+ return n ? g(n) : 0;
103
+ }, I = (t) => t.paidTimeOff ? t.paidTimeOff.reduce(
104
+ (e, r) => e + parseFloat(r.finalPayoutUnusedHoursInput || "0"),
105
+ 0
106
+ ) : 0, D = (t, e, r, n) => {
107
+ const o = x(t);
108
+ if (n) {
109
+ const a = I(t);
110
+ return o + a;
111
+ }
112
+ return e ? Math.min(r, o) : o;
113
+ }, _ = (t, e, r) => {
114
+ if (!t.adjustForMinimumWage) return 0;
115
+ const n = A(
116
+ t.minimumWages || [],
117
+ r
118
+ );
119
+ if (!n)
120
+ return 0;
121
+ const o = e.hourlyCompensations?.reduce(
122
+ (f, l) => f + parseFloat(l.hours || "0"),
123
+ 0
124
+ ) || 0, a = g(t), u = (parseFloat(n.wage || "0") - a) * o, s = L(e.fixedCompensations || []);
125
+ return Math.max(0, u - s);
126
+ }, J = (t, e, r, n, o, a, u) => {
127
+ if (!u && n)
128
+ return H(e, r) * (o - a);
129
+ if (!t.hourlyCompensations || !e.jobs)
130
+ return 0;
131
+ const s = t.hourlyCompensations.reduce((i, c) => {
132
+ const p = parseFloat(c.hours || "0"), d = k(e, c.jobUuid || "", r);
133
+ return i + p * d;
134
+ }, 0), f = t.hourlyCompensations.reduce((i, c) => i + parseFloat(c.hours || "0"), 0);
135
+ if (f === 0) return s;
136
+ const l = E(s / f), m = t.hourlyCompensations.filter((i) => !P(i.name || "")).reduce((i, c) => {
137
+ const p = parseFloat(c.hours || "0"), d = c.compensationMultiplier || 1;
138
+ return i + p * l * (d - 1);
139
+ }, 0);
140
+ return s + m;
141
+ }, G = (t, e, r, n, o, a) => {
142
+ const u = D(
143
+ t,
144
+ n,
145
+ o,
146
+ a
147
+ ), s = H(e, r);
148
+ return u * s;
149
+ }, N = (t, e, r) => {
150
+ if (!e) return !1;
151
+ const n = t.hourlyCompensations?.find(
152
+ (a) => P(a.name || "")
153
+ );
154
+ return n ? parseFloat(n.hours || "0") === r : !1;
155
+ }, X = (t, e, r, n, o = !1) => {
156
+ if (t.excluded)
157
+ return 0;
158
+ const a = r ? new Date(r) : /* @__PURE__ */ new Date(), u = e.jobs?.find((F) => F.primary) || e.jobs?.[0];
159
+ if (!u?.compensations)
160
+ return 0;
161
+ const s = y(
162
+ u.compensations,
163
+ a
164
+ );
165
+ if (!s)
166
+ return 0;
167
+ const f = O(s), l = n ? W(n) : 0, m = N(
168
+ t,
169
+ f,
170
+ l
171
+ ), i = D(
172
+ t,
173
+ m,
174
+ l,
175
+ o
176
+ ), c = J(
177
+ t,
178
+ e,
179
+ a,
180
+ m,
181
+ l,
182
+ i,
183
+ o
184
+ ), p = U(t), d = G(
185
+ t,
186
+ e,
187
+ a,
188
+ m,
189
+ l,
190
+ o
191
+ ), R = _(
192
+ s,
193
+ t,
194
+ a
195
+ ), w = c + p + d + R;
196
+ return h(w);
197
+ };
198
+ export {
199
+ X as calculateGrossPay,
200
+ S as formatEmployeePayRate,
201
+ V as formatHoursDisplay,
202
+ U as getAdditionalEarnings,
203
+ B as getRegularHours,
204
+ K as getReimbursements,
205
+ x as getTotalPtoHours,
206
+ z as useFormatEmployeePayRate
207
+ };
208
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sources":["../../../src/components/Payroll/helpers.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type {\n EmployeeCompensations,\n PayrollShowFixedCompensations,\n} from '@gusto/embedded-api/models/components/payrollshow'\nimport { useCallback } from 'react'\nimport type { TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { Compensation, MinimumWages } from '@gusto/embedded-api/models/components/compensation'\nimport { formatPayRate } from '@/helpers/formattedStrings'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\nconst REGULAR_HOURS_NAME = 'regular hours'\n\nconst roundToSixDecimals = (value: number): number => {\n return Math.round(value * 1_000_000) / 1_000_000\n}\n\nconst roundToTwoDecimals = (value: number): number => {\n return Math.round(value * 100) / 100\n}\n\nconst isRegularHours = (compensationName: string): boolean => {\n return compensationName.toLowerCase() === REGULAR_HOURS_NAME\n}\n\nconst PAY_PERIOD_HOURS_MAPPINGS: Record<string, number> = {\n Daily: 8.0,\n 'Every week': 40.0,\n 'Every other week': 80.0,\n 'Twice per month': 86.666667,\n Monthly: 173.333333,\n Quarterly: 520.0,\n Semiannually: 1040.0,\n Annually: 2080.0,\n}\n\nexport const formatEmployeePayRate = ({\n employee,\n t,\n locale = 'en-US',\n}: {\n employee?: Employee\n t: TFunction\n locale?: string\n}) => {\n if (!employee?.jobs) {\n return null\n }\n\n const primaryJob = employee.jobs.find(job => job.primary) || employee.jobs[0]\n if (!primaryJob?.compensations) {\n return null\n }\n\n const jobCompensation = primaryJob.compensations[0]\n if (!jobCompensation) {\n return null\n }\n if (!jobCompensation.rate || parseFloat(jobCompensation.rate) === 0) {\n return null\n }\n\n const rate = parseFloat(jobCompensation.rate)\n const paymentUnit = jobCompensation.paymentUnit || 'Hour'\n\n return formatPayRate({ rate, paymentUnit, t, locale })\n}\n\nexport const useFormatEmployeePayRate = () => {\n const { t } = useTranslation('common')\n const { locale } = useLocale()\n\n return useCallback(\n (employee?: Employee) => {\n return formatEmployeePayRate({ employee, t, locale })\n },\n [t, locale],\n )\n}\n\nexport const getEmployeePayRateInfo = (employee: Employee | undefined) => {\n if (!employee?.jobs) {\n return null\n }\n\n const primaryJob = employee.jobs.find(job => job.primary) || employee.jobs[0]\n if (!primaryJob?.compensations) {\n return null\n }\n\n const jobCompensation = primaryJob.compensations[0]\n if (!jobCompensation) {\n return null\n }\n if (!jobCompensation.rate || parseFloat(jobCompensation.rate) === 0) {\n return null\n }\n\n const rate = parseFloat(jobCompensation.rate)\n const paymentUnit = jobCompensation.paymentUnit || 'Hour'\n\n return { rate, paymentUnit }\n}\n\nexport const getRegularHours = (compensation: EmployeeCompensations) => {\n if (!compensation.hourlyCompensations) return 0\n\n return compensation.hourlyCompensations\n .filter(hourlyCompensation => hourlyCompensation.name?.toLowerCase() === 'regular hours')\n .reduce((sum, hourlyCompensation) => sum + parseFloat(hourlyCompensation.hours || '0'), 0)\n}\n\nexport const getTotalPtoHours = (compensation: EmployeeCompensations) => {\n if (!compensation.paidTimeOff) {\n return 0\n }\n return compensation.paidTimeOff.reduce((sum, pto) => sum + parseFloat(pto.hours || '0'), 0)\n}\n\nexport const getAdditionalEarnings = (compensation: EmployeeCompensations) => {\n if (!compensation.fixedCompensations) {\n return 0\n }\n\n return compensation.fixedCompensations\n .filter(fixedCompensation => {\n const name = fixedCompensation.name?.toLowerCase() || ''\n const amount = parseFloat(fixedCompensation.amount || '0')\n return name !== 'reimbursement' && name !== 'minimum wage adjustment' && amount > 0\n })\n .reduce((sum, fixedCompensation) => sum + parseFloat(fixedCompensation.amount || '0'), 0)\n}\n\nexport const getReimbursements = (compensation: EmployeeCompensations) => {\n if (!compensation.fixedCompensations) {\n return 0\n }\n\n const reimbursementComp = compensation.fixedCompensations.find(\n fixedCompensation => fixedCompensation.name?.toLowerCase() === 'reimbursement',\n )\n return reimbursementComp ? parseFloat(reimbursementComp.amount || '0') : 0\n}\n\nexport const formatHoursDisplay = (hours: number): string => {\n const rounded = roundToTwoDecimals(hours)\n\n if (rounded % 1 === 0) {\n return `${rounded}.0`\n }\n\n return rounded.toString()\n}\n\nconst getHoursInPayPeriod = (paySchedule: PayScheduleObject): number => {\n if (!paySchedule.frequency) {\n return 0\n }\n\n return PAY_PERIOD_HOURS_MAPPINGS[paySchedule.frequency] || 0\n}\n\nconst getEffectiveCompensation = (\n compensations: Compensation[],\n effectiveDate: Date,\n): Compensation | null => {\n if (!compensations.length) return null\n\n const sorted = [...compensations].sort(\n (a, b) =>\n (a.effectiveDate ? new Date(a.effectiveDate).getTime() : 0) -\n (b.effectiveDate ? new Date(b.effectiveDate).getTime() : 0),\n )\n\n for (let i = sorted.length - 1; i >= 0; i--) {\n const currentDateString = sorted[i]?.effectiveDate\n const currentDate = currentDateString ? new Date(currentDateString) : null\n if (currentDate && currentDate <= effectiveDate) {\n return sorted[i] || null\n }\n }\n\n return sorted[0] || null\n}\n\nconst getEffectiveMinimumWage = (\n minimumWages: MinimumWages[],\n effectiveDate: Date,\n): MinimumWages | null => {\n if (!minimumWages.length) return null\n\n const sorted = [...minimumWages].sort(\n (a, b) =>\n (a.effectiveDate ? new Date(a.effectiveDate).getTime() : 0) -\n (b.effectiveDate ? new Date(b.effectiveDate).getTime() : 0),\n )\n\n for (let i = sorted.length - 1; i >= 0; i--) {\n const currentDateString = sorted[i]?.effectiveDate\n const currentDate = currentDateString ? new Date(currentDateString) : null\n if (currentDate && currentDate <= effectiveDate) {\n return sorted[i] || null\n }\n }\n\n return sorted[0] || null\n}\n\nconst isSalaried = (compensation: Compensation): boolean => {\n return compensation.flsaStatus === 'Exempt' || compensation.flsaStatus === 'Salaried Nonexempt'\n}\n\nconst getTotalTipCompensations = (fixedCompensations: PayrollShowFixedCompensations[]): number => {\n if (!fixedCompensations.length) return 0\n\n return fixedCompensations\n .filter(fixedCompensation => {\n const name = fixedCompensation.name?.toLowerCase()\n const amount = parseFloat(fixedCompensation.amount || '0')\n return (name === 'paycheck tips' || name === 'cash tips') && amount > 0\n })\n .reduce((sum, fixedCompensation) => sum + parseFloat(fixedCompensation.amount || '0'), 0)\n}\n\nconst calculateHourlyRate = (compensation: Compensation): number => {\n const rate = parseFloat(compensation.rate || '0')\n const paymentUnit = compensation.paymentUnit || 'Hour'\n\n switch (paymentUnit) {\n case 'Hour':\n return rate\n case 'Year':\n return rate / 2080 // 52 weeks * 40 hours\n case 'Month':\n return rate / 173.333333\n case 'Week':\n return rate / 40\n case 'Paycheck':\n return 0 // Paycheck rate is 0 for hourly calculation\n default:\n return rate\n }\n}\n\nconst getHourlyRateForJob = (employee: Employee, jobUuid: string, effectiveDate: Date): number => {\n const job = employee.jobs?.find(j => j.uuid === jobUuid)\n if (!job?.compensations) {\n return 0\n }\n\n const compensation = getEffectiveCompensation(job.compensations, effectiveDate)\n return compensation ? calculateHourlyRate(compensation) : 0\n}\n\nconst getPrimaryHourlyRate = (employee: Employee, effectiveDate: Date): number => {\n const primaryJob = employee.jobs?.find(job => job.primary) || employee.jobs?.[0]\n if (!primaryJob?.compensations) {\n return 0\n }\n\n const compensation = getEffectiveCompensation(primaryJob.compensations, effectiveDate)\n return compensation ? calculateHourlyRate(compensation) : 0\n}\n\nconst getTotalOutstandingPtoHours = (compensation: EmployeeCompensations): number => {\n if (!compensation.paidTimeOff) {\n return 0\n }\n\n return compensation.paidTimeOff.reduce(\n (sum, paidTimeOff) => sum + parseFloat(paidTimeOff.finalPayoutUnusedHoursInput || '0'),\n 0,\n )\n}\n\nconst getPtoHours = (\n compensation: EmployeeCompensations,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n offCycle: boolean,\n): number => {\n const regularPtoHours = getTotalPtoHours(compensation)\n\n if (offCycle) {\n const outstandingPtoHours = getTotalOutstandingPtoHours(compensation)\n return regularPtoHours + outstandingPtoHours\n }\n\n if (isSalariedWithExpectedHours) {\n return Math.min(hoursInPayPeriod, regularPtoHours)\n }\n\n return regularPtoHours\n}\n\nconst calculateMinimumWageAdjustment = (\n primaryCompensation: Compensation,\n compensation: EmployeeCompensations,\n effectiveDate: Date,\n): number => {\n if (!primaryCompensation.adjustForMinimumWage) return 0\n\n const effectiveMinWage = getEffectiveMinimumWage(\n primaryCompensation.minimumWages || [],\n effectiveDate,\n )\n if (!effectiveMinWage) {\n return 0\n }\n\n const totalHours =\n compensation.hourlyCompensations?.reduce(\n (sum, hourlyCompensation) => sum + parseFloat(hourlyCompensation.hours || '0'),\n 0,\n ) || 0\n\n const hourlyRate = calculateHourlyRate(primaryCompensation)\n\n const totalTipCredit = (parseFloat(effectiveMinWage.wage || '0') - hourlyRate) * totalHours\n const totalTips = getTotalTipCompensations(compensation.fixedCompensations || [])\n\n return Math.max(0, totalTipCredit - totalTips)\n}\n\nconst calculateRegularPlusOvertimePay = (\n compensation: EmployeeCompensations,\n employee: Employee,\n effectiveDate: Date,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n ptoHours: number,\n isOffCycle: boolean,\n): number => {\n if (!isOffCycle && isSalariedWithExpectedHours) {\n const primaryHourlyRate = getPrimaryHourlyRate(employee, effectiveDate)\n return primaryHourlyRate * (hoursInPayPeriod - ptoHours)\n }\n\n if (!compensation.hourlyCompensations || !employee.jobs) {\n return 0\n }\n\n const regularRatePay = compensation.hourlyCompensations.reduce((sum, hc) => {\n const hours = parseFloat(hc.hours || '0')\n const hourlyRate = getHourlyRateForJob(employee, hc.jobUuid || '', effectiveDate)\n return sum + hours * hourlyRate\n }, 0)\n\n const totalHours = compensation.hourlyCompensations.reduce((sum, hc) => {\n return sum + parseFloat(hc.hours || '0')\n }, 0)\n\n if (totalHours === 0) return regularRatePay\n\n const overtimeWeightedRate = roundToSixDecimals(regularRatePay / totalHours)\n\n // Calculate overtime pay for non-regular hours\n const overtimePay = compensation.hourlyCompensations\n .filter(hc => !isRegularHours(hc.name || ''))\n .reduce((sum, hc) => {\n const hours = parseFloat(hc.hours || '0')\n const multiplier = hc.compensationMultiplier || 1\n return sum + hours * overtimeWeightedRate * (multiplier - 1)\n }, 0)\n\n return regularRatePay + overtimePay\n}\n\nconst calculatePtoPay = (\n compensation: EmployeeCompensations,\n employee: Employee,\n effectiveDate: Date,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n offCycle: boolean,\n): number => {\n const ptoHours = getPtoHours(\n compensation,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n offCycle,\n )\n const primaryHourlyRate = getPrimaryHourlyRate(employee, effectiveDate)\n return ptoHours * primaryHourlyRate\n}\n\nconst isSalariedWithPayPeriodExpectedHours = (\n compensation: EmployeeCompensations,\n isSalaried: boolean,\n hoursInPayPeriod: number,\n): boolean => {\n if (!isSalaried) return false\n\n const regularHourlyCompensation = compensation.hourlyCompensations?.find(hourlyCompensation =>\n isRegularHours(hourlyCompensation.name || ''),\n )\n\n if (!regularHourlyCompensation) return false\n\n const regularHours = parseFloat(regularHourlyCompensation.hours || '0')\n return regularHours === hoursInPayPeriod\n}\n\nexport const calculateGrossPay = (\n compensation: EmployeeCompensations,\n employee: Employee,\n compensationEffectiveDateString?: string,\n paySchedule?: PayScheduleObject,\n isOffCycle: boolean = false,\n): number => {\n if (compensation.excluded) {\n return 0\n }\n\n const compensationEffectiveDate = compensationEffectiveDateString\n ? new Date(compensationEffectiveDateString)\n : new Date()\n\n const primaryJob = employee.jobs?.find(job => job.primary) || employee.jobs?.[0]\n if (!primaryJob?.compensations) {\n return 0\n }\n\n const primaryCompensation = getEffectiveCompensation(\n primaryJob.compensations,\n compensationEffectiveDate,\n )\n\n if (!primaryCompensation) {\n return 0\n }\n\n const salaried = isSalaried(primaryCompensation)\n const hoursInPayPeriod = paySchedule ? getHoursInPayPeriod(paySchedule) : 0\n\n const isSalariedWithExpectedHours = isSalariedWithPayPeriodExpectedHours(\n compensation,\n salaried,\n hoursInPayPeriod,\n )\n\n const ptoHours = getPtoHours(\n compensation,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n isOffCycle,\n )\n\n const regularPlusOvertimePay = calculateRegularPlusOvertimePay(\n compensation,\n employee,\n compensationEffectiveDate,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n ptoHours,\n isOffCycle,\n )\n\n const fixedPay = getAdditionalEarnings(compensation)\n const ptoPay = calculatePtoPay(\n compensation,\n employee,\n compensationEffectiveDate,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n isOffCycle,\n )\n const minimumWageAdjustment = calculateMinimumWageAdjustment(\n primaryCompensation,\n compensation,\n compensationEffectiveDate,\n )\n\n const total = regularPlusOvertimePay + fixedPay + ptoPay + minimumWageAdjustment\n return roundToTwoDecimals(total)\n}\n"],"names":["REGULAR_HOURS_NAME","roundToSixDecimals","value","roundToTwoDecimals","isRegularHours","compensationName","PAY_PERIOD_HOURS_MAPPINGS","formatEmployeePayRate","employee","t","locale","primaryJob","job","jobCompensation","rate","paymentUnit","formatPayRate","useFormatEmployeePayRate","useTranslation","useLocale","useCallback","getRegularHours","compensation","hourlyCompensation","sum","getTotalPtoHours","pto","getAdditionalEarnings","fixedCompensation","name","amount","getReimbursements","reimbursementComp","formatHoursDisplay","hours","rounded","getHoursInPayPeriod","paySchedule","getEffectiveCompensation","compensations","effectiveDate","sorted","a","b","i","currentDateString","currentDate","getEffectiveMinimumWage","minimumWages","isSalaried","getTotalTipCompensations","fixedCompensations","calculateHourlyRate","getHourlyRateForJob","jobUuid","j","getPrimaryHourlyRate","getTotalOutstandingPtoHours","paidTimeOff","getPtoHours","isSalariedWithExpectedHours","hoursInPayPeriod","offCycle","regularPtoHours","outstandingPtoHours","calculateMinimumWageAdjustment","primaryCompensation","effectiveMinWage","totalHours","hourlyRate","totalTipCredit","totalTips","calculateRegularPlusOvertimePay","ptoHours","isOffCycle","regularRatePay","hc","overtimeWeightedRate","overtimePay","multiplier","calculatePtoPay","primaryHourlyRate","isSalariedWithPayPeriodExpectedHours","regularHourlyCompensation","calculateGrossPay","compensationEffectiveDateString","compensationEffectiveDate","salaried","regularPlusOvertimePay","fixedPay","ptoPay","minimumWageAdjustment","total"],"mappings":";;;;AAaA,MAAMA,IAAqB,iBAErBC,IAAqB,CAACC,MACnB,KAAK,MAAMA,IAAQ,GAAS,IAAI,KAGnCC,IAAqB,CAACD,MACnB,KAAK,MAAMA,IAAQ,GAAG,IAAI,KAG7BE,IAAiB,CAACC,MACfA,EAAiB,kBAAkBL,GAGtCM,IAAoD;AAAA,EACxD,OAAO;AAAA,EACP,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,cAAc;AAAA,EACd,UAAU;AACZ,GAEaC,IAAwB,CAAC;AAAA,EACpC,UAAAC;AAAA,EACA,GAAAC;AAAA,EACA,QAAAC,IAAS;AACX,MAIM;AACJ,MAAI,CAACF,GAAU;AACb,WAAO;AAGT,QAAMG,IAAaH,EAAS,KAAK,KAAK,CAAAI,MAAOA,EAAI,OAAO,KAAKJ,EAAS,KAAK,CAAC;AAC5E,MAAI,CAACG,GAAY;AACf,WAAO;AAGT,QAAME,IAAkBF,EAAW,cAAc,CAAC;AAIlD,MAHI,CAACE,KAGD,CAACA,EAAgB,QAAQ,WAAWA,EAAgB,IAAI,MAAM;AAChE,WAAO;AAGT,QAAMC,IAAO,WAA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,IAC9B,IAAI,KAAKA,CAA+B,wBACpC,KAAA,GAEF1E,IAAaH,EAAS,MAAM,KAAK,CAAAI,MAAOA,EAAI,OAAO,KAAKJ,EAAS,OAAO,CAAC;AAC/E,MAAI,CAACG,GAAY;AACf,WAAO;AAGT,QAAMuD,IAAsB5B;AAAA,IAC1B3B,EAAW;AAAA,IACX2E;AAAA,EAAA;AAGF,MAAI,CAACpB;AACH,WAAO;AAGT,QAAMqB,IAAWtC,EAAWiB,CAAmB,GACzCL,IAAmBxB,IAAcD,EAAoBC,CAAW,IAAI,GAEpEuB,IAA8BsB;AAAA,IAClC5D;AAAA,IACAiE;AAAA,IACA1B;AAAA,EAAA,GAGIY,IAAWd;AAAA,IACfrC;AAAA,IACAsC;AAAA,IACAC;AAAA,IACAa;AAAA,EAAA,GAGIc,IAAyBhB;AAAA,IAC7BlD;AAAA,IACAd;AAAA,IACA8E;AAAA,IACA1B;AAAA,IACAC;AAAA,IACAY;AAAA,IACAC;AAAA,EAAA,GAGIe,IAAW9D,EAAsBL,CAAY,GAC7CoE,IAASV;AAAA,IACb1D;AAAA,IACAd;AAAA,IACA8E;AAAA,IACA1B;AAAA,IACAC;AAAA,IACAa;AAAA,EAAA,GAEIiB,IAAwB1B;AAAA,IAC5BC;AAAA,IACA5C;AAAA,IACAgE;AAAA,EAAA,GAGIM,IAAQJ,IAAyBC,IAAWC,IAASC;AAC3D,SAAOxF,EAAmByF,CAAK;AACjC;"}
@@ -0,0 +1 @@
1
+ export {};
@@ -10,8 +10,9 @@ import "classnames";
10
10
  import "../../shared/constants.js";
11
11
  import { InternalError as y } from "../../components/Common/InternalError/InternalError.js";
12
12
  import { LocaleProvider as C } from "../LocaleProvider/LocaleProvider.js";
13
+ import "../LocaleProvider/useLocale.js";
13
14
  import { ThemeProvider as L } from "../ThemeProvider/ThemeProvider.js";
14
- const R = (a) => {
15
+ const T = (a) => {
15
16
  const {
16
17
  children: d,
17
18
  config: e,
@@ -40,6 +41,6 @@ const R = (a) => {
40
41
  }, [n]), /* @__PURE__ */ r(P, { value: s, children: /* @__PURE__ */ r(x, { value: f, children: /* @__PURE__ */ r(h, { FallbackComponent: y, children: /* @__PURE__ */ r(L, { theme: p, children: /* @__PURE__ */ r(C, { locale: c, currency: l, children: /* @__PURE__ */ r(v, { i18n: t, children: /* @__PURE__ */ r(I, { url: e.baseUrl, headers: e.headers, hooks: e.hooks, children: d }) }, n) }) }) }) }) });
41
42
  };
42
43
  export {
43
- R as GustoProviderCustomUIAdapter
44
+ T as GustoProviderCustomUIAdapter
44
45
  };
45
46
  //# sourceMappingURL=GustoProviderCustomUIAdapter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { LoadingIndicatorProvider } from '../LoadingIndicatorProvider/LoadingIndicatorProvider'\nimport type { LoadingIndicatorContextProps } from '../LoadingIndicatorProvider/useLoadingIndicator'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GustoSDKTheme } from '@/contexts/ThemeProvider/theme'\nimport type { ResourceDictionary, SupportedLanguages } from '@/types/Helpers'\nimport type { SDKHooks } from '@/types/hooks'\n\nexport interface APIConfig {\n baseUrl: string\n headers?: HeadersInit\n hooks?: SDKHooks\n}\n\nexport interface GustoProviderProps {\n config: APIConfig\n dictionary?: ResourceDictionary\n lng?: string\n locale?: string\n currency?: string\n theme?: GustoSDKTheme\n queryClient?: QueryClient\n components: ComponentsContextType\n LoaderComponent?: LoadingIndicatorContextProps['LoadingIndicator']\n}\n\nexport interface GustoProviderCustomUIAdapterProps extends GustoProviderProps {\n children?: React.ReactNode\n}\n\n/**\n * A provider that accepts UI component adapters through the components prop\n */\nconst GustoProviderCustomUIAdapter: React.FC<GustoProviderCustomUIAdapterProps> = props => {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n components,\n LoaderComponent,\n } = props\n\n // Handle dictionary resources\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n // Adding resources overrides to i18next instance - initial load will override common namespace and add component specific dictionaries provided by partners\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n // Handle language change\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n return (\n <ComponentsProvider value={components}>\n <LoadingIndicatorProvider value={LoaderComponent}>\n <ErrorBoundary FallbackComponent={InternalError}>\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={locale} currency={currency}>\n <I18nextProvider i18n={SDKI18next} key={lng}>\n <ApiProvider url={config.baseUrl} headers={config.headers} hooks={config.hooks}>\n {children}\n </ApiProvider>\n </I18nextProvider>\n </LocaleProvider>\n </ThemeProvider>\n </ErrorBoundary>\n </LoadingIndicatorProvider>\n </ComponentsProvider>\n )\n}\n\nexport { GustoProviderCustomUIAdapter }\n"],"names":["GustoProviderCustomUIAdapter","props","children","config","dictionary","lng","locale","currency","theme","components","LoaderComponent","language","lang","ns","SDKI18next","useEffect","ComponentsProvider","jsx","LoadingIndicatorProvider","ErrorBoundary","InternalError","ThemeProvider","LocaleProvider","I18nextProvider","ApiProvider"],"mappings":";;;;;;;;;;;;;AA2CA,MAAMA,IAA4E,CAAAC,MAAS;AACzF,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,QAAAC,IAAS;AAAA,IACT,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,EAAA,IACET;AAGJ,MAAIG;AACF,eAAWO,KAAYP,GAAY;AACjC,YAAMQ,IAAOD;AACb,iBAAWE,KAAMT,EAAWQ,CAAI;AAE9B,QAAAE,EAAW;AAAA,UACTF;AAAA,UACAC;AAAA,UACCT,EAAWQ,CAAI,EAA8BC,CAAE;AAAA,UAChD;AAAA,UACA;AAAA,QAAA;AAAA,IAGN;AAIF,SAAAE,EAAU,MAAM;AACd,KAAM,YACJ,MAAMD,EAAW,eAAeT,CAAG;AAAA,EAEvC,GAAG,CAACA,CAAG,CAAC,qBAGLW,GAAA,EAAmB,OAAOP,GACzB,UAAA,gBAAAQ,EAACC,GAAA,EAAyB,OAAOR,GAC/B,UAAA,gBAAAO,EAACE,GAAA,EAAc,mBAAmBC,GAChC,UAAA,gBAAAH,EAACI,GAAA,EAAc,OAAAb,GACb,UAAA,gBAAAS,EAACK,GAAA,EAAe,QAAAhB,GAAgB,UAAAC,GAC9B,UAAA,gBAAAU,EAACM,GAAA,EAAgB,MAAMT,GACrB,UAAA,gBAAAG,EAACO,GAAA,EAAY,KAAKrB,EAAO,SAAS,SAASA,EAAO,SAAS,OAAOA,EAAO,OACtE,UAAAD,GACH,EAAA,GAHsCG,CAIxC,GACF,EAAA,CACF,GACF,GACF,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { LoadingIndicatorProvider } from '../LoadingIndicatorProvider/LoadingIndicatorProvider'\nimport type { LoadingIndicatorContextProps } from '../LoadingIndicatorProvider/useLoadingIndicator'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GustoSDKTheme } from '@/contexts/ThemeProvider/theme'\nimport type { ResourceDictionary, SupportedLanguages } from '@/types/Helpers'\nimport type { SDKHooks } from '@/types/hooks'\n\nexport interface APIConfig {\n baseUrl: string\n headers?: HeadersInit\n hooks?: SDKHooks\n}\n\nexport interface GustoProviderProps {\n config: APIConfig\n dictionary?: ResourceDictionary\n lng?: string\n locale?: string\n currency?: string\n theme?: GustoSDKTheme\n queryClient?: QueryClient\n components: ComponentsContextType\n LoaderComponent?: LoadingIndicatorContextProps['LoadingIndicator']\n}\n\nexport interface GustoProviderCustomUIAdapterProps extends GustoProviderProps {\n children?: React.ReactNode\n}\n\n/**\n * A provider that accepts UI component adapters through the components prop\n */\nconst GustoProviderCustomUIAdapter: React.FC<GustoProviderCustomUIAdapterProps> = props => {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n components,\n LoaderComponent,\n } = props\n\n // Handle dictionary resources\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n // Adding resources overrides to i18next instance - initial load will override common namespace and add component specific dictionaries provided by partners\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n // Handle language change\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n return (\n <ComponentsProvider value={components}>\n <LoadingIndicatorProvider value={LoaderComponent}>\n <ErrorBoundary FallbackComponent={InternalError}>\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={locale} currency={currency}>\n <I18nextProvider i18n={SDKI18next} key={lng}>\n <ApiProvider url={config.baseUrl} headers={config.headers} hooks={config.hooks}>\n {children}\n </ApiProvider>\n </I18nextProvider>\n </LocaleProvider>\n </ThemeProvider>\n </ErrorBoundary>\n </LoadingIndicatorProvider>\n </ComponentsProvider>\n )\n}\n\nexport { GustoProviderCustomUIAdapter }\n"],"names":["GustoProviderCustomUIAdapter","props","children","config","dictionary","lng","locale","currency","theme","components","LoaderComponent","language","lang","ns","SDKI18next","useEffect","ComponentsProvider","jsx","LoadingIndicatorProvider","ErrorBoundary","InternalError","ThemeProvider","LocaleProvider","I18nextProvider","ApiProvider"],"mappings":";;;;;;;;;;;;;;AA2CA,MAAMA,IAA4E,CAAAC,MAAS;AACzF,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,QAAAC,IAAS;AAAA,IACT,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,EAAA,IACET;AAGJ,MAAIG;AACF,eAAWO,KAAYP,GAAY;AACjC,YAAMQ,IAAOD;AACb,iBAAWE,KAAMT,EAAWQ,CAAI;AAE9B,QAAAE,EAAW;AAAA,UACTF;AAAA,UACAC;AAAA,UACCT,EAAWQ,CAAI,EAA8BC,CAAE;AAAA,UAChD;AAAA,UACA;AAAA,QAAA;AAAA,IAGN;AAIF,SAAAE,EAAU,MAAM;AACd,KAAM,YACJ,MAAMD,EAAW,eAAeT,CAAG;AAAA,EAEvC,GAAG,CAACA,CAAG,CAAC,qBAGLW,GAAA,EAAmB,OAAOP,GACzB,UAAA,gBAAAQ,EAACC,GAAA,EAAyB,OAAOR,GAC/B,UAAA,gBAAAO,EAACE,GAAA,EAAc,mBAAmBC,GAChC,UAAA,gBAAAH,EAACI,GAAA,EAAc,OAAAb,GACb,UAAA,gBAAAS,EAACK,GAAA,EAAe,QAAAhB,GAAgB,UAAAC,GAC9B,UAAA,gBAAAU,EAACM,GAAA,EAAgB,MAAMT,GACrB,UAAA,gBAAAG,EAACO,GAAA,EAAY,KAAKrB,EAAO,SAAS,SAASA,EAAO,SAAS,OAAOA,EAAO,OACtE,UAAAD,GACH,EAAA,GAHsCG,CAIxC,GACF,EAAA,CACF,GACF,GACF,EAAA,CACF;AAEJ;"}
@@ -1,5 +1,6 @@
1
1
  import { Location } from '@gusto/embedded-api/models/components/location';
2
2
  import { EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress';
3
+ import { TFunction } from 'i18next';
3
4
  export declare const firstLastName: ({ first_name, last_name, }: {
4
5
  first_name?: string | null;
5
6
  last_name?: string | null;
@@ -11,6 +12,14 @@ export declare const currentDateString: () => string;
11
12
  export declare function isNumberKey({ which, keyCode }: KeyboardEvent): boolean;
12
13
  export declare const booleanToString: (value: boolean) => "true" | "false";
13
14
  export declare const amountStr: (amount: string, isPercentage: boolean) => string;
15
+ export declare const formatNumberAsCurrency: (amount: number, locale?: string) => string;
16
+ export declare const formatPayRate: ({ rate, paymentUnit, t, locale, }: {
17
+ rate: number;
18
+ paymentUnit: string;
19
+ t: TFunction;
20
+ locale?: string;
21
+ }) => string;
22
+ export declare const useFormatPayRate: () => (rate: number, paymentUnit: string) => string;
14
23
  export declare function createMarkup(dirty: string): {
15
24
  __html: string;
16
25
  };