@gusto/embedded-react-sdk 0.18.0 → 0.19.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 (156) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/assets/icons/icon-error-outline.svg.js +10 -0
  3. package/dist/assets/icons/icon-error-outline.svg.js.map +1 -0
  4. package/dist/assets/icons/icon-info-outline.svg.js +10 -0
  5. package/dist/assets/icons/icon-info-outline.svg.js.map +1 -0
  6. package/dist/assets/icons/icon-zap-fast.svg.js +10 -0
  7. package/dist/assets/icons/icon-zap-fast.svg.js.map +1 -0
  8. package/dist/components/Common/Fieldset/Fieldset.module.scss.js +1 -1
  9. package/dist/components/Common/PaginationControl/PaginationControl.js +6 -6
  10. package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
  11. package/dist/components/Common/RequirementsList/RequirementsList.js +19 -13
  12. package/dist/components/Common/RequirementsList/RequirementsList.js.map +1 -1
  13. package/dist/components/Common/RequirementsList/RequirementsList.module.scss.js +1 -1
  14. package/dist/components/Common/UI/Badge/index.d.ts +2 -0
  15. package/dist/components/Common/UI/Banner/Banner.d.ts +3 -0
  16. package/dist/components/Common/UI/Banner/Banner.js +31 -0
  17. package/dist/components/Common/UI/Banner/Banner.js.map +1 -0
  18. package/dist/components/Common/UI/Banner/Banner.module.scss.js +14 -0
  19. package/dist/components/Common/UI/Banner/Banner.module.scss.js.map +1 -0
  20. package/dist/components/Common/UI/Banner/BannerTypes.d.ts +21 -0
  21. package/dist/components/Common/UI/Banner/BannerTypes.js +7 -0
  22. package/dist/components/Common/UI/Banner/BannerTypes.js.map +1 -0
  23. package/dist/components/Common/UI/Banner/index.d.ts +4 -0
  24. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  25. package/dist/components/Common/UI/List/List.module.scss.js +2 -2
  26. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  27. package/dist/components/Company/DocumentSigner/DocumentList/ManageSignatories.js +13 -13
  28. package/dist/components/Company/DocumentSigner/DocumentList/ManageSignatories.js.map +1 -1
  29. package/dist/components/Company/FederalTaxes/Form.js +29 -29
  30. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  31. package/dist/components/Company/FederalTaxes/Head.js +5 -5
  32. package/dist/components/Company/FederalTaxes/Head.js.map +1 -1
  33. package/dist/components/Contractor/ContractorList/index.js +32 -32
  34. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  35. package/dist/components/Contractor/Profile/ContractorProfileForm.js +11 -11
  36. package/dist/components/Contractor/Submit/Submit.js +6 -6
  37. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  38. package/dist/components/Contractor/Submit/SubmitDone.js +8 -8
  39. package/dist/components/Contractor/Submit/SubmitDone.js.map +1 -1
  40. package/dist/components/Employee/Compensation/Edit.js +16 -16
  41. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  42. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +3 -3
  43. package/dist/components/Employee/EmployeeList/List.js +23 -23
  44. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  45. package/dist/components/Employee/FederalTaxes/Head.js +1 -1
  46. package/dist/components/Employee/FederalTaxes/Head.js.map +1 -1
  47. package/dist/components/Employee/Landing/Landing.js +17 -16
  48. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  49. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +1 -1
  50. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  51. package/dist/components/Employee/Profile/HomeAddress.js +1 -1
  52. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  53. package/dist/components/Employee/Taxes/FederalHead.js +1 -1
  54. package/dist/components/Employee/Taxes/FederalHead.js.map +1 -1
  55. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.d.ts +6 -0
  56. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +57 -0
  57. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -0
  58. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.d.ts +8 -0
  59. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +79 -0
  60. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -0
  61. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/index.d.ts +2 -0
  62. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.d.ts +7 -0
  63. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.js +25 -0
  64. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.js.map +1 -0
  65. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.d.ts +10 -0
  66. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +30 -0
  67. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -0
  68. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/index.d.ts +2 -0
  69. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.d.ts +10 -0
  70. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js +30 -0
  71. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js.map +1 -0
  72. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/index.d.ts +2 -0
  73. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.d.ts +13 -0
  74. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js +63 -0
  75. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js.map +1 -0
  76. package/dist/components/Payroll/ConfirmWireDetails/index.d.ts +3 -0
  77. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +1 -1
  78. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  79. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +1 -1
  80. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
  81. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +60 -59
  82. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  83. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +30 -29
  84. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  85. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +75 -75
  86. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  87. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +41 -36
  88. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  89. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +25 -25
  90. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  91. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +109 -89
  92. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  93. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +6 -1
  94. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +179 -147
  95. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  96. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.d.ts +8 -0
  97. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.js +49 -0
  98. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.js.map +1 -0
  99. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.d.ts +6 -0
  100. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.js +18 -0
  101. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.js.map +1 -0
  102. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/index.d.ts +3 -0
  103. package/dist/components/Payroll/index.d.ts +1 -0
  104. package/dist/components/Payroll/index.js +8 -6
  105. package/dist/components/Payroll/index.js.map +1 -1
  106. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +54 -52
  107. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
  108. package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
  109. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.d.ts +5 -0
  110. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js +27 -25
  111. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js.map +1 -1
  112. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
  113. package/dist/contexts/ComponentAdapter/useComponentContext.js +3 -3
  114. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  115. package/dist/contexts/ThemeProvider/theme.d.ts +1 -0
  116. package/dist/contexts/ThemeProvider/theme.js +5 -4
  117. package/dist/contexts/ThemeProvider/theme.js.map +1 -1
  118. package/dist/i18n/I18n.js +1 -1
  119. package/dist/i18n/I18n.js.map +1 -1
  120. package/dist/i18n/en/Company.BankAccount.json.js +1 -1
  121. package/dist/i18n/en/Company.DocumentList.json.js +16 -16
  122. package/dist/i18n/en/Company.FederalTaxes.json.js +22 -22
  123. package/dist/i18n/en/Contractor.ContractorList.json.js +8 -8
  124. package/dist/i18n/en/Contractor.Submit.json.js +6 -6
  125. package/dist/i18n/en/Employee.Compensation.json.js +8 -8
  126. package/dist/i18n/en/Employee.Deductions.json.js +51 -51
  127. package/dist/i18n/en/Employee.EmployeeList.json.js +6 -6
  128. package/dist/i18n/en/Employee.FederalTaxes.json.js +3 -3
  129. package/dist/i18n/en/Employee.HomeAddress.json.js +2 -2
  130. package/dist/i18n/en/Employee.OnboardingSummary.json.js +1 -1
  131. package/dist/i18n/en/Employee.PaymentMethod.json.js +11 -11
  132. package/dist/i18n/en/Employee.Taxes.json.js +2 -2
  133. package/dist/i18n/en/Payroll.ConfirmWireDetailsBanner.json.js +14 -0
  134. package/dist/i18n/en/Payroll.ConfirmWireDetailsBanner.json.js.map +1 -0
  135. package/dist/i18n/en/Payroll.ConfirmWireDetailsForm.json.js +10 -0
  136. package/dist/i18n/en/Payroll.ConfirmWireDetailsForm.json.js.map +1 -0
  137. package/dist/i18n/en/Payroll.PayrollBlocker.json.js +3 -3
  138. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +4 -4
  139. package/dist/i18n/en/Payroll.PayrollList.json.js +7 -7
  140. package/dist/i18n/en/Payroll.PayrollOverview.json.js +35 -33
  141. package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
  142. package/dist/i18n/en/Payroll.PayrollReceipts.json.js +7 -7
  143. package/dist/i18n/en/Payroll.WireInstructions.json.js +10 -0
  144. package/dist/i18n/en/Payroll.WireInstructions.json.js.map +1 -0
  145. package/dist/i18n/en/common.json.d.ts +1 -1
  146. package/dist/i18n/en/common.json.js +1 -1
  147. package/dist/shared/constants.d.ts +13 -0
  148. package/dist/shared/constants.js +56 -47
  149. package/dist/shared/constants.js.map +1 -1
  150. package/dist/style.css +1 -1
  151. package/dist/types/i18next.d.ts +113 -98
  152. package/package.json +9 -10
  153. package/dist/i18n/en/Company.AddBank.json.js +0 -28
  154. package/dist/i18n/en/Company.AddBank.json.js.map +0 -1
  155. package/dist/i18n/en/Payroll.PayrollSchedule.json.js +0 -27
  156. package/dist/i18n/en/Payroll.PayrollSchedule.json.js.map +0 -1
@@ -1,61 +1,66 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { useState as y } from "react";
3
- import { useTranslation as c } from "react-i18next";
4
- import { PayrollHistory as u } from "../PayrollHistory/PayrollHistory.js";
5
- import { PayrollList as d } from "../PayrollList/PayrollList.js";
6
- import { PayrollOverview as f } from "../PayrollOverview/PayrollOverview.js";
7
- import { PayrollReceipts as b } from "../PayrollReceipts/PayrollReceipts.js";
1
+ import { jsx as t, jsxs as y } from "react/jsx-runtime";
2
+ import { useState as c } from "react";
3
+ import { useTranslation as u } from "react-i18next";
4
+ import { PayrollHistory as d } from "../PayrollHistory/PayrollHistory.js";
5
+ import { PayrollList as f } from "../PayrollList/PayrollList.js";
6
+ import { PayrollOverview as b } from "../PayrollOverview/PayrollOverview.js";
7
+ import { PayrollReceipts as P } from "../PayrollReceipts/PayrollReceipts.js";
8
+ import { ConfirmWireDetails as I } from "../ConfirmWireDetails/ConfirmWireDetails.js";
8
9
  import { useFlow as e } from "../../Flow/useFlow.js";
9
- import { useI18n as P } from "../../../i18n/I18n.js";
10
- import { useComponentContext as I } from "../../../contexts/ComponentAdapter/useComponentContext.js";
10
+ import { useI18n as x } from "../../../i18n/I18n.js";
11
+ import { useComponentContext as g } from "../../../contexts/ComponentAdapter/useComponentContext.js";
11
12
  import { ensureRequired as n } from "../../../helpers/ensureRequired.js";
12
- function O() {
13
+ import { Flex as v } from "../../Common/Flex/Flex.js";
14
+ function U() {
13
15
  const {
14
16
  companyId: o,
15
17
  onEvent: r,
16
- selectedTab: a = "run-payroll"
17
- } = e(), [i, s] = y(a), { Tabs: m } = I();
18
- P("Payroll.PayrollLanding");
19
- const { t: l } = c("Payroll.PayrollLanding"), p = [
18
+ selectedTab: l = "run-payroll"
19
+ } = e(), [i, m] = c(l), { Tabs: p } = g();
20
+ x("Payroll.PayrollLanding");
21
+ const { t: a } = u("Payroll.PayrollLanding"), s = [
20
22
  {
21
23
  id: "run-payroll",
22
- label: l("tabs.runPayroll"),
23
- content: /* @__PURE__ */ t(d, { companyId: n(o), onEvent: r })
24
+ label: a("tabs.runPayroll"),
25
+ content: /* @__PURE__ */ t(f, { companyId: n(o), onEvent: r })
24
26
  },
25
27
  {
26
28
  id: "payroll-history",
27
- label: l("tabs.payrollHistory"),
28
- content: /* @__PURE__ */ t(u, { companyId: n(o), onEvent: r })
29
+ label: a("tabs.payrollHistory"),
30
+ content: /* @__PURE__ */ t(d, { companyId: n(o), onEvent: r })
29
31
  }
30
32
  ];
31
- return /* @__PURE__ */ t(
32
- m,
33
- {
34
- tabs: p,
35
- selectedId: i,
36
- onSelectionChange: s,
37
- "aria-label": l("aria.tabNavigation")
38
- }
39
- );
33
+ return /* @__PURE__ */ y(v, { flexDirection: "column", gap: 32, children: [
34
+ /* @__PURE__ */ t(I, { companyId: n(o), onEvent: r }),
35
+ /* @__PURE__ */ t(
36
+ p,
37
+ {
38
+ tabs: s,
39
+ selectedId: i,
40
+ onSelectionChange: m,
41
+ "aria-label": a("aria.tabNavigation")
42
+ }
43
+ )
44
+ ] });
40
45
  }
41
- function S() {
46
+ function q() {
42
47
  const { payrollUuid: o, onEvent: r } = e();
43
- return /* @__PURE__ */ t(b, { onEvent: r, payrollId: n(o) });
48
+ return /* @__PURE__ */ t(P, { onEvent: r, payrollId: n(o) });
44
49
  }
45
- function U() {
46
- const { companyId: o, payrollUuid: r, onEvent: a } = e();
50
+ function N() {
51
+ const { companyId: o, payrollUuid: r, onEvent: l } = e();
47
52
  return /* @__PURE__ */ t(
48
- f,
53
+ b,
49
54
  {
50
- onEvent: a,
55
+ onEvent: l,
51
56
  companyId: n(o),
52
57
  payrollId: n(r)
53
58
  }
54
59
  );
55
60
  }
56
61
  export {
57
- U as PayrollLandingOverviewContextual,
58
- S as PayrollLandingReceiptsContextual,
59
- O as PayrollLandingTabsContextual
62
+ N as PayrollLandingOverviewContextual,
63
+ q as PayrollLandingReceiptsContextual,
64
+ U as PayrollLandingTabsContextual
60
65
  };
61
66
  //# sourceMappingURL=PayrollLandingFlowComponents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayrollLandingFlowComponents.js","sources":["../../../../src/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { PayrollHistory } from '../PayrollHistory/PayrollHistory'\nimport { PayrollList } from '../PayrollList/PayrollList'\nimport { PayrollOverview } from '../PayrollOverview/PayrollOverview'\nimport { PayrollReceipts } from '../PayrollReceipts/PayrollReceipts'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useI18n } from '@/i18n'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport type { FlowContextInterface } from '@/components/Flow/useFlow'\n\nexport interface PayrollLandingFlowProps extends BaseComponentInterface<'Payroll.PayrollLanding'> {\n companyId: string\n}\n\nexport interface PayrollLandingFlowContextInterface extends FlowContextInterface {\n component: (() => React.JSX.Element) | null\n companyId: string\n payrollUuid?: string\n previousState?: 'tabs' | 'overview'\n selectedTab?: string\n}\n\nexport function PayrollLandingTabsContextual() {\n const {\n companyId,\n onEvent,\n selectedTab = 'run-payroll',\n } = useFlow<PayrollLandingFlowContextInterface>()\n const [currentTab, setCurrentTab] = useState(selectedTab)\n const { Tabs } = useComponentContext()\n\n useI18n('Payroll.PayrollLanding')\n const { t } = useTranslation('Payroll.PayrollLanding')\n\n const tabs = [\n {\n id: 'run-payroll',\n label: t('tabs.runPayroll'),\n content: <PayrollList companyId={ensureRequired(companyId)} onEvent={onEvent} />,\n },\n {\n id: 'payroll-history',\n label: t('tabs.payrollHistory'),\n content: <PayrollHistory companyId={ensureRequired(companyId)} onEvent={onEvent} />,\n },\n ]\n\n return (\n <Tabs\n tabs={tabs}\n selectedId={currentTab}\n onSelectionChange={setCurrentTab}\n aria-label={t('aria.tabNavigation')}\n />\n )\n}\n\nexport function PayrollLandingReceiptsContextual() {\n const { payrollUuid, onEvent } = useFlow<PayrollLandingFlowContextInterface>()\n\n return <PayrollReceipts onEvent={onEvent} payrollId={ensureRequired(payrollUuid)} />\n}\n\nexport function PayrollLandingOverviewContextual() {\n const { companyId, payrollUuid, onEvent } = useFlow<PayrollLandingFlowContextInterface>()\n\n return (\n <PayrollOverview\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n payrollId={ensureRequired(payrollUuid)}\n />\n )\n}\n"],"names":["PayrollLandingTabsContextual","companyId","onEvent","selectedTab","useFlow","currentTab","setCurrentTab","useState","Tabs","useComponentContext","useI18n","t","useTranslation","tabs","jsx","PayrollList","ensureRequired","PayrollHistory","PayrollLandingReceiptsContextual","payrollUuid","PayrollReceipts","PayrollLandingOverviewContextual","PayrollOverview"],"mappings":";;;;;;;;;;;AAyBO,SAASA,IAA+B;AAC7C,QAAM;AAAA,IACJ,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,EAAA,IACZC,EAAA,GACE,CAACC,GAAYC,CAAa,IAAIC,EAASJ,CAAW,GAClD,EAAE,MAAAK,EAAA,IAASC,EAAA;AAEjB,EAAAC,EAAQ,wBAAwB;AAChC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAE/CC,IAAO;AAAA,IACX;AAAA,MACE,IAAI;AAAA,MACJ,OAAOF,EAAE,iBAAiB;AAAA,MAC1B,SAAS,gBAAAG,EAACC,GAAA,EAAY,WAAWC,EAAef,CAAS,GAAG,SAAAC,EAAA,CAAkB;AAAA,IAAA;AAAA,IAEhF;AAAA,MACE,IAAI;AAAA,MACJ,OAAOS,EAAE,qBAAqB;AAAA,MAC9B,SAAS,gBAAAG,EAACG,GAAA,EAAe,WAAWD,EAAef,CAAS,GAAG,SAAAC,EAAA,CAAkB;AAAA,IAAA;AAAA,EACnF;AAGF,SACE,gBAAAY;AAAA,IAACN;AAAA,IAAA;AAAA,MACC,MAAAK;AAAA,MACA,YAAYR;AAAA,MACZ,mBAAmBC;AAAA,MACnB,cAAYK,EAAE,oBAAoB;AAAA,IAAA;AAAA,EAAA;AAGxC;AAEO,SAASO,IAAmC;AACjD,QAAM,EAAE,aAAAC,GAAa,SAAAjB,EAAA,IAAYE,EAAA;AAEjC,2BAAQgB,GAAA,EAAgB,SAAAlB,GAAkB,WAAWc,EAAeG,CAAW,GAAG;AACpF;AAEO,SAASE,IAAmC;AACjD,QAAM,EAAE,WAAApB,GAAW,aAAAkB,GAAa,SAAAjB,EAAA,IAAYE,EAAA;AAE5C,SACE,gBAAAU;AAAA,IAACQ;AAAA,IAAA;AAAA,MACC,SAAApB;AAAA,MACA,WAAWc,EAAef,CAAS;AAAA,MACnC,WAAWe,EAAeG,CAAW;AAAA,IAAA;AAAA,EAAA;AAG3C;"}
1
+ {"version":3,"file":"PayrollLandingFlowComponents.js","sources":["../../../../src/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { PayrollHistory } from '../PayrollHistory/PayrollHistory'\nimport { PayrollList } from '../PayrollList/PayrollList'\nimport { PayrollOverview } from '../PayrollOverview/PayrollOverview'\nimport { PayrollReceipts } from '../PayrollReceipts/PayrollReceipts'\nimport { ConfirmWireDetails } from '../ConfirmWireDetails/ConfirmWireDetails'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useI18n } from '@/i18n'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport type { FlowContextInterface } from '@/components/Flow/useFlow'\nimport { Flex } from '@/components/Common/Flex/Flex'\n\nexport interface PayrollLandingFlowProps extends BaseComponentInterface<'Payroll.PayrollLanding'> {\n companyId: string\n}\n\nexport interface PayrollLandingFlowContextInterface extends FlowContextInterface {\n component: (() => React.JSX.Element) | null\n companyId: string\n payrollUuid?: string\n previousState?: 'tabs' | 'overview'\n selectedTab?: string\n}\n\nexport function PayrollLandingTabsContextual() {\n const {\n companyId,\n onEvent,\n selectedTab = 'run-payroll',\n } = useFlow<PayrollLandingFlowContextInterface>()\n const [currentTab, setCurrentTab] = useState(selectedTab)\n const { Tabs } = useComponentContext()\n\n useI18n('Payroll.PayrollLanding')\n const { t } = useTranslation('Payroll.PayrollLanding')\n\n const tabs = [\n {\n id: 'run-payroll',\n label: t('tabs.runPayroll'),\n content: <PayrollList companyId={ensureRequired(companyId)} onEvent={onEvent} />,\n },\n {\n id: 'payroll-history',\n label: t('tabs.payrollHistory'),\n content: <PayrollHistory companyId={ensureRequired(companyId)} onEvent={onEvent} />,\n },\n ]\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <ConfirmWireDetails companyId={ensureRequired(companyId)} onEvent={onEvent} />\n <Tabs\n tabs={tabs}\n selectedId={currentTab}\n onSelectionChange={setCurrentTab}\n aria-label={t('aria.tabNavigation')}\n />\n </Flex>\n )\n}\n\nexport function PayrollLandingReceiptsContextual() {\n const { payrollUuid, onEvent } = useFlow<PayrollLandingFlowContextInterface>()\n\n return <PayrollReceipts onEvent={onEvent} payrollId={ensureRequired(payrollUuid)} />\n}\n\nexport function PayrollLandingOverviewContextual() {\n const { companyId, payrollUuid, onEvent } = useFlow<PayrollLandingFlowContextInterface>()\n\n return (\n <PayrollOverview\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n payrollId={ensureRequired(payrollUuid)}\n />\n )\n}\n"],"names":["PayrollLandingTabsContextual","companyId","onEvent","selectedTab","useFlow","currentTab","setCurrentTab","useState","Tabs","useComponentContext","useI18n","t","useTranslation","tabs","jsx","PayrollList","ensureRequired","PayrollHistory","jsxs","Flex","ConfirmWireDetails","PayrollLandingReceiptsContextual","payrollUuid","PayrollReceipts","PayrollLandingOverviewContextual","PayrollOverview"],"mappings":";;;;;;;;;;;;;AA2BO,SAASA,IAA+B;AAC7C,QAAM;AAAA,IACJ,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,EAAA,IACZC,EAAA,GACE,CAACC,GAAYC,CAAa,IAAIC,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}
@@ -24,9 +24,9 @@ const ue = ({
24
24
  skippingPayrollId: f,
25
25
  blockers: y
26
26
  }) => {
27
- const { Badge: B, Button: h, Dialog: M, Heading: O, Text: o, Alert: T } = E();
27
+ const { Badge: M, Button: h, Dialog: O, Heading: T, Text: o, Alert: W } = E();
28
28
  $("Payroll.PayrollList");
29
- const { t } = Y("Payroll.PayrollList"), s = z(), D = N(null), W = J({ ref: D }).includes("small"), [d, g] = R({
29
+ const { t } = Y("Payroll.PayrollList"), s = z(), D = N(null), B = J({ ref: D }).includes("small"), [d, g] = R({
30
30
  isOpen: !1,
31
31
  payrollId: null,
32
32
  payPeriod: null
@@ -45,16 +45,16 @@ const ue = ({
45
45
  }, j = () => {
46
46
  d.payrollId && (A({ payrollUuid: d.payrollId }), P());
47
47
  }, k = (e, l) => {
48
- const n = s.formatShort(e), a = s.formatShortWithYear(l);
48
+ const a = s.formatShort(e), n = s.formatShortWithYear(l);
49
49
  return {
50
- startDate: n,
51
- endDate: a,
50
+ startDate: a,
51
+ endDate: n,
52
52
  fullPeriod: s.formatPayPeriodRange(e, l, { useShortMonth: !0 })
53
53
  };
54
54
  };
55
55
  return /* @__PURE__ */ r("div", { ref: D, className: C.container, children: /* @__PURE__ */ u(i, { flexDirection: "column", gap: 16, children: [
56
56
  w && /* @__PURE__ */ r("div", { className: C.alertContainer, children: /* @__PURE__ */ r(
57
- T,
57
+ W,
58
58
  {
59
59
  status: "info",
60
60
  label: t("skipSuccessAlert"),
@@ -69,7 +69,7 @@ const ue = ({
69
69
  justifyContent: "space-between",
70
70
  alignItems: "flex-start",
71
71
  gap: { base: 12, medium: 24 },
72
- children: /* @__PURE__ */ r(i, { children: /* @__PURE__ */ r(O, { as: "h2", children: t("title") }) })
72
+ children: /* @__PURE__ */ r(i, { children: /* @__PURE__ */ r(T, { as: "h2", children: t("title") }) })
73
73
  }
74
74
  ),
75
75
  /* @__PURE__ */ r(
@@ -82,7 +82,7 @@ const ue = ({
82
82
  columns: [
83
83
  {
84
84
  render: ({ payPeriod: e }) => {
85
- const { startDate: l, endDate: n } = k(
85
+ const { startDate: l, endDate: a } = k(
86
86
  e?.startDate,
87
87
  e?.endDate
88
88
  );
@@ -90,9 +90,9 @@ const ue = ({
90
90
  /* @__PURE__ */ u(o, { children: [
91
91
  l,
92
92
  " - ",
93
- n
93
+ a
94
94
  ] }),
95
- /* @__PURE__ */ r(o, { variant: "supporting", children: p.find((a) => a.uuid === e?.payScheduleUuid)?.name || p.find((a) => a.uuid === e?.payScheduleUuid)?.customName })
95
+ /* @__PURE__ */ r(o, { variant: "supporting", children: p.find((n) => n.uuid === e?.payScheduleUuid)?.name || p.find((n) => n.uuid === e?.payScheduleUuid)?.customName })
96
96
  ] });
97
97
  },
98
98
  title: t("tableHeaders.0")
@@ -111,19 +111,19 @@ const ue = ({
111
111
  },
112
112
  {
113
113
  title: t("tableHeaders.4"),
114
- render: ({ processed: e }) => /* @__PURE__ */ r(B, { children: t(e ? "status.processed" : "status.unprocessed") })
114
+ render: ({ processed: e }) => /* @__PURE__ */ r(M, { children: t(e ? "status.processed" : "status.unprocessed") })
115
115
  },
116
116
  {
117
117
  title: "",
118
- render: ({ payrollUuid: e, calculatedAt: l, processed: n, payPeriod: a }) => {
119
- if (n)
118
+ render: ({ payrollUuid: e, calculatedAt: l, processed: a, payPeriod: n }) => {
119
+ if (a)
120
120
  return null;
121
121
  const m = f === e, c = l ? /* @__PURE__ */ r(
122
122
  h,
123
123
  {
124
124
  isLoading: m,
125
125
  onClick: () => {
126
- L({ payrollUuid: e, payPeriod: a });
126
+ L({ payrollUuid: e, payPeriod: n });
127
127
  },
128
128
  title: t("submitPayrollCta"),
129
129
  variant: "secondary",
@@ -134,30 +134,30 @@ const ue = ({
134
134
  {
135
135
  isLoading: m,
136
136
  onClick: () => {
137
- x({ payrollUuid: e, payPeriod: a });
137
+ x({ payrollUuid: e, payPeriod: n });
138
138
  },
139
139
  title: t("runPayrollTitle"),
140
140
  variant: "secondary",
141
141
  children: t("runPayrollTitle")
142
142
  }
143
143
  );
144
- return W ? c : /* @__PURE__ */ r(i, { flexDirection: "column", alignItems: "stretch", gap: 12, children: c });
144
+ return B ? c : /* @__PURE__ */ r(i, { flexDirection: "column", alignItems: "stretch", gap: 12, children: c });
145
145
  }
146
146
  }
147
147
  ],
148
148
  data: v,
149
149
  label: t("payrollsListLabel"),
150
- itemMenu: ({ payrollUuid: e, processed: l, payPeriod: n }) => {
150
+ itemMenu: ({ payrollUuid: e, processed: l, payPeriod: a }) => {
151
151
  if (l)
152
152
  return null;
153
- const a = f === e, { fullPeriod: m } = k(
154
- n?.startDate,
155
- n?.endDate
156
- ), c = q(/* @__PURE__ */ new Date()), S = c ? new Date(c) : null, b = n?.startDate ? new Date(n.startDate) : null;
153
+ const n = f === e, { fullPeriod: m } = k(
154
+ a?.startDate,
155
+ a?.endDate
156
+ ), c = q(/* @__PURE__ */ new Date()), S = c ? new Date(c) : null, b = a?.startDate ? new Date(a.startDate) : null;
157
157
  return y.length === 0 && S && b && S >= b ? /* @__PURE__ */ r(
158
158
  K,
159
159
  {
160
- isLoading: a,
160
+ isLoading: n,
161
161
  menuLabel: t("payrollMenuLabel"),
162
162
  items: [
163
163
  {
@@ -173,15 +173,15 @@ const ue = ({
173
173
  }
174
174
  ),
175
175
  /* @__PURE__ */ r(
176
- M,
176
+ O,
177
177
  {
178
178
  isOpen: d.isOpen,
179
179
  onClose: P,
180
180
  onPrimaryActionClick: j,
181
181
  isDestructive: !0,
182
182
  title: t("skipPayrollDialog.title", { payPeriod: d.payPeriod }),
183
- primaryActionLabel: t("skipPayrollDialog.confirmButton"),
184
- closeActionLabel: t("skipPayrollDialog.cancelButton"),
183
+ primaryActionLabel: t("skipPayrollDialog.confirmCta"),
184
+ closeActionLabel: t("skipPayrollDialog.cancelCta"),
185
185
  children: t("skipPayrollDialog.body")
186
186
  }
187
187
  )
@@ -1 +1 @@
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 { useState, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollBlockerAlerts } from '../PayrollBlocker/components/PayrollBlockerAlerts'\nimport type { PayrollType } from './types'\nimport styles from './PayrollListPresentation.module.scss'\nimport { DataView, Flex, HamburgerMenu } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport FeatureIconCheck from '@/assets/icons/feature-icon-check.svg?react'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PresentationPayroll extends Payroll {\n payrollType: PayrollType\n}\n\ninterface PayrollListPresentationProps {\n onRunPayroll: ({ payrollUuid, payPeriod }: Pick<Payroll, 'payrollUuid' | 'payPeriod'>) => void\n onSubmitPayroll: ({ payrollUuid, payPeriod }: Pick<Payroll, 'payrollUuid' | 'payPeriod'>) => void\n onSkipPayroll: ({ payrollUuid }: Pick<Payroll, 'payrollUuid'>) => void\n onViewBlockers?: () => void\n payrolls: PresentationPayroll[]\n paySchedules: PayScheduleList[]\n showSkipSuccessAlert: boolean\n onDismissSkipSuccessAlert: () => void\n skippingPayrollId: string | null\n blockers: ApiPayrollBlocker[]\n}\n\nexport const PayrollListPresentation = ({\n onRunPayroll,\n onSubmitPayroll,\n onSkipPayroll,\n onViewBlockers,\n payrolls,\n paySchedules,\n showSkipSuccessAlert,\n onDismissSkipSuccessAlert,\n skippingPayrollId,\n blockers,\n}: PayrollListPresentationProps) => {\n const { Badge, Button, Dialog, Heading, Text, Alert } = useComponentContext()\n useI18n('Payroll.PayrollList')\n const { t } = useTranslation('Payroll.PayrollList')\n const dateFormatter = useDateFormatter()\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isDesktop = breakpoints.includes('small')\n const [skipPayrollDialogState, setSkipPayrollDialogState] = useState<{\n isOpen: boolean\n payrollId: string | null\n payPeriod: string | null\n }>({\n isOpen: false,\n payrollId: null,\n payPeriod: null,\n })\n\n const handleOpenSkipDialog = (payrollId: string, payPeriod: string) => {\n setSkipPayrollDialogState({\n isOpen: true,\n payrollId,\n payPeriod,\n })\n }\n\n const handleCloseSkipDialog = () => {\n setSkipPayrollDialogState({\n isOpen: false,\n payrollId: null,\n payPeriod: null,\n })\n }\n\n const handleConfirmSkipPayroll = () => {\n if (skipPayrollDialogState.payrollId) {\n onSkipPayroll({ payrollUuid: skipPayrollDialogState.payrollId })\n handleCloseSkipDialog()\n }\n }\n\n const formatPayPeriod = (startDate: string | undefined, endDate: string | undefined) => {\n const formattedStartDate = dateFormatter.formatShort(startDate)\n const formattedEndDate = dateFormatter.formatShortWithYear(endDate)\n\n return {\n startDate: formattedStartDate,\n endDate: formattedEndDate,\n fullPeriod: dateFormatter.formatPayPeriodRange(startDate, endDate, { useShortMonth: true }),\n }\n }\n\n return (\n <div ref={containerRef} className={styles.container}>\n <Flex flexDirection=\"column\" gap={16}>\n {showSkipSuccessAlert && (\n <div className={styles.alertContainer}>\n <Alert\n status=\"info\"\n label={t('skipSuccessAlert')}\n onDismiss={onDismissSkipSuccessAlert}\n />\n </div>\n )}\n <PayrollBlockerAlerts blockers={blockers} onMultipleViewClick={onViewBlockers} />\n <Flex\n flexDirection={{ base: 'column', medium: 'row' }}\n justifyContent=\"space-between\"\n alignItems=\"flex-start\"\n gap={{ base: 12, medium: 24 }}\n >\n <Flex>\n <Heading as=\"h2\">{t('title')}</Heading>\n </Flex>\n </Flex>\n\n <DataView\n emptyState={() => (\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={24}>\n <FeatureIconCheck />\n <Text>{t('emptyState')}</Text>\n </Flex>\n )}\n columns={[\n {\n render: ({ payPeriod }) => {\n const { startDate, endDate } = formatPayPeriod(\n payPeriod?.startDate,\n payPeriod?.endDate,\n )\n\n return (\n <Flex flexDirection=\"column\" gap={0}>\n <Text>\n {startDate} - {endDate}\n </Text>\n <Text variant=\"supporting\">\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 },\n title: t('tableHeaders.0'),\n },\n {\n render: ({ payrollType }) => <Text>{t(`type.${payrollType}`)}</Text>,\n title: t('tableHeaders.1'),\n },\n {\n render: ({ checkDate }) => (\n <Text>{dateFormatter.formatShortWithWeekdayAndYear(checkDate)}</Text>\n ),\n title: t('tableHeaders.2'),\n },\n {\n title: t('tableHeaders.3'),\n render: ({ payrollDeadline }) => (\n <Text>{dateFormatter.formatShortWithWeekdayAndYear(payrollDeadline)}</Text>\n ),\n },\n {\n title: t('tableHeaders.4'),\n render: ({ processed }) => (\n <Badge>{processed ? t('status.processed') : t('status.unprocessed')}</Badge>\n ),\n },\n {\n title: '',\n render: ({ payrollUuid, calculatedAt, processed, payPeriod }) => {\n if (processed) {\n return null\n }\n\n const isProcessingSkipPayroll = skippingPayrollId === payrollUuid\n\n const button = calculatedAt ? (\n <Button\n isLoading={isProcessingSkipPayroll}\n onClick={() => {\n onSubmitPayroll({ payrollUuid, payPeriod })\n }}\n title={t('submitPayrollCta')}\n variant=\"secondary\"\n >\n {t('submitPayrollCta')}\n </Button>\n ) : (\n <Button\n isLoading={isProcessingSkipPayroll}\n onClick={() => {\n onRunPayroll({ payrollUuid, payPeriod })\n }}\n title={t('runPayrollTitle')}\n variant=\"secondary\"\n >\n {t('runPayrollTitle')}\n </Button>\n )\n\n return isDesktop ? (\n button\n ) : (\n <Flex flexDirection=\"column\" alignItems=\"stretch\" gap={12}>\n {button}\n </Flex>\n )\n },\n },\n ]}\n data={payrolls}\n label={t('payrollsListLabel')}\n itemMenu={({ payrollUuid, processed, payPeriod }) => {\n if (processed) {\n return null\n }\n\n const isProcessingSkipPayroll = skippingPayrollId === payrollUuid\n\n const { fullPeriod: payPeriodString } = formatPayPeriod(\n payPeriod?.startDate,\n payPeriod?.endDate,\n )\n\n const todayDateString = formatDateToStringDate(new Date())\n const todayAtMidnight = todayDateString ? new Date(todayDateString) : null\n const payPeriodStartDate = payPeriod?.startDate ? new Date(payPeriod.startDate) : null\n\n const canSkipPayroll =\n blockers.length === 0 &&\n todayAtMidnight &&\n payPeriodStartDate &&\n todayAtMidnight >= payPeriodStartDate\n\n if (!canSkipPayroll) {\n return null\n }\n\n return (\n <HamburgerMenu\n isLoading={isProcessingSkipPayroll}\n menuLabel={t('payrollMenuLabel')}\n items={[\n {\n label: t('skipPayrollCta'),\n onClick: () => {\n handleOpenSkipDialog(payrollUuid!, payPeriodString)\n },\n },\n ]}\n />\n )\n }}\n />\n <Dialog\n isOpen={skipPayrollDialogState.isOpen}\n onClose={handleCloseSkipDialog}\n onPrimaryActionClick={handleConfirmSkipPayroll}\n isDestructive={true}\n title={t('skipPayrollDialog.title', { payPeriod: skipPayrollDialogState.payPeriod })}\n primaryActionLabel={t('skipPayrollDialog.confirmButton')}\n closeActionLabel={t('skipPayrollDialog.cancelButton')}\n >\n {t('skipPayrollDialog.body')}\n </Dialog>\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollListPresentation","onRunPayroll","onSubmitPayroll","onSkipPayroll","onViewBlockers","payrolls","paySchedules","showSkipSuccessAlert","onDismissSkipSuccessAlert","skippingPayrollId","blockers","Badge","Button","Dialog","Heading","Text","Alert","useComponentContext","useI18n","useTranslation","dateFormatter","useDateFormatter","containerRef","useRef","isDesktop","useContainerBreakpoints","skipPayrollDialogState","setSkipPayrollDialogState","useState","handleOpenSkipDialog","payrollId","payPeriod","handleCloseSkipDialog","handleConfirmSkipPayroll","formatPayPeriod","startDate","endDate","formattedStartDate","formattedEndDate","jsx","styles","jsxs","Flex","PayrollBlockerAlerts","DataView","FeatureIconCheck","schedule","payrollType","checkDate","payrollDeadline","processed","payrollUuid","calculatedAt","isProcessingSkipPayroll","button","payPeriodString","todayDateString","formatDateToStringDate","todayAtMidnight","payPeriodStartDate","HamburgerMenu"],"mappings":";;;;;;;;;;;;;;AAiCO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,UAAAC;AACF,MAAoC;AAClC,QAAM,EAAE,OAAAC,GAAO,QAAAC,GAAQ,QAAAC,GAAQ,SAAAC,GAAS,MAAAC,GAAM,OAAAC,EAAA,IAAUC,EAAA;AACxD,EAAAC,EAAQ,qBAAqB;AAC7B,QAAM,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAgBC,EAAA,GAChBC,IAAeC,EAAuB,IAAI,GAE1CC,IADcC,EAAwB,EAAE,KAAKH,GAAc,EACnC,SAAS,OAAO,GACxC,CAACI,GAAwBC,CAAyB,IAAIC,EAIzD;AAAA,IACD,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,WAAW;AAAA,EAAA,CACZ,GAEKC,IAAuB,CAACC,GAAmBC,MAAsB;AACrE,IAAAJ,EAA0B;AAAA,MACxB,QAAQ;AAAA,MACR,WAAAG;AAAA,MACA,WAAAC;AAAA,IAAA,CACD;AAAA,EACH,GAEMC,IAAwB,MAAM;AAClC,IAAAL,EAA0B;AAAA,MACxB,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,WAAW;AAAA,IAAA,CACZ;AAAA,EACH,GAEMM,IAA2B,MAAM;AACrC,IAAIP,EAAuB,cACzBvB,EAAc,EAAE,aAAauB,EAAuB,UAAA,CAAW,GAC/DM,EAAA;AAAA,EAEJ,GAEME,IAAkB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B,IAAkBC,EAAuB,oBAAI,MAAM,GACnDC,IAAkBF,IAAkB,IAAI,KAAKA,CAAe,IAAI,MAChEG,IAAqB5B,GAAW,YAAY,IAAI,KAAKA,EAAU,SAAS,IAAI;AAQlF,iBALErB,EAAS,WAAW,KACpBgD,KACAC,KACAD,KAAmBC,IAOnB,gBAAApB;AAAA,YAACqB;AAAA,YAAA;AAAA,cACC,WAAWP;AAAA,cACX,WAAW,EAAE,kBAAkB;AAAA,cAC/B,OAAO;AAAA,gBACL;AAAA,kBACE,OAAO,EAAE,gBAAgB;AAAA,kBACzB,SAAS,MAAM;AACb,oBAAAxB,EAAqBsB,GAAcI,CAAe;AAAA,kBACpD;AAAA,gBAAA;AAAA,cACF;AAAA,YACF;AAAA,UAAA,IAdK;AAAA,QAiBX;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,gBAAAhB;AAAA,MAAC1B;AAAA,MAAA;AAAA,QACC,QAAQa,EAAuB;AAAA,QAC/B,SAASM;AAAA,QACT,sBAAsBC;AAAA,QACtB,eAAe;AAAA,QACf,OAAO,EAAE,2BAA2B,EAAE,WAAWP,EAAuB,WAAW;AAAA,QACnF,oBAAoB,EAAE,iCAAiC;AAAA,QACvD,kBAAkB,EAAE,gCAAgC;AAAA,QAEnD,YAAE,wBAAwB;AAAA,MAAA;AAAA,IAAA;AAAA,EAC7B,EAAA,CACF,EAAA,CACF;AAEJ;"}
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 { useState, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollBlockerAlerts } from '../PayrollBlocker/components/PayrollBlockerAlerts'\nimport type { PayrollType } from './types'\nimport styles from './PayrollListPresentation.module.scss'\nimport { DataView, Flex, HamburgerMenu } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport FeatureIconCheck from '@/assets/icons/feature-icon-check.svg?react'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PresentationPayroll extends Payroll {\n payrollType: PayrollType\n}\n\ninterface PayrollListPresentationProps {\n onRunPayroll: ({ payrollUuid, payPeriod }: Pick<Payroll, 'payrollUuid' | 'payPeriod'>) => void\n onSubmitPayroll: ({ payrollUuid, payPeriod }: Pick<Payroll, 'payrollUuid' | 'payPeriod'>) => void\n onSkipPayroll: ({ payrollUuid }: Pick<Payroll, 'payrollUuid'>) => void\n onViewBlockers?: () => void\n payrolls: PresentationPayroll[]\n paySchedules: PayScheduleList[]\n showSkipSuccessAlert: boolean\n onDismissSkipSuccessAlert: () => void\n skippingPayrollId: string | null\n blockers: ApiPayrollBlocker[]\n}\n\nexport const PayrollListPresentation = ({\n onRunPayroll,\n onSubmitPayroll,\n onSkipPayroll,\n onViewBlockers,\n payrolls,\n paySchedules,\n showSkipSuccessAlert,\n onDismissSkipSuccessAlert,\n skippingPayrollId,\n blockers,\n}: PayrollListPresentationProps) => {\n const { Badge, Button, Dialog, Heading, Text, Alert } = useComponentContext()\n useI18n('Payroll.PayrollList')\n const { t } = useTranslation('Payroll.PayrollList')\n const dateFormatter = useDateFormatter()\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isDesktop = breakpoints.includes('small')\n const [skipPayrollDialogState, setSkipPayrollDialogState] = useState<{\n isOpen: boolean\n payrollId: string | null\n payPeriod: string | null\n }>({\n isOpen: false,\n payrollId: null,\n payPeriod: null,\n })\n\n const handleOpenSkipDialog = (payrollId: string, payPeriod: string) => {\n setSkipPayrollDialogState({\n isOpen: true,\n payrollId,\n payPeriod,\n })\n }\n\n const handleCloseSkipDialog = () => {\n setSkipPayrollDialogState({\n isOpen: false,\n payrollId: null,\n payPeriod: null,\n })\n }\n\n const handleConfirmSkipPayroll = () => {\n if (skipPayrollDialogState.payrollId) {\n onSkipPayroll({ payrollUuid: skipPayrollDialogState.payrollId })\n handleCloseSkipDialog()\n }\n }\n\n const formatPayPeriod = (startDate: string | undefined, endDate: string | undefined) => {\n const formattedStartDate = dateFormatter.formatShort(startDate)\n const formattedEndDate = dateFormatter.formatShortWithYear(endDate)\n\n return {\n startDate: formattedStartDate,\n endDate: formattedEndDate,\n fullPeriod: dateFormatter.formatPayPeriodRange(startDate, endDate, { useShortMonth: true }),\n }\n }\n\n return (\n <div ref={containerRef} className={styles.container}>\n <Flex flexDirection=\"column\" gap={16}>\n {showSkipSuccessAlert && (\n <div className={styles.alertContainer}>\n <Alert\n status=\"info\"\n label={t('skipSuccessAlert')}\n onDismiss={onDismissSkipSuccessAlert}\n />\n </div>\n )}\n <PayrollBlockerAlerts blockers={blockers} onMultipleViewClick={onViewBlockers} />\n <Flex\n flexDirection={{ base: 'column', medium: 'row' }}\n justifyContent=\"space-between\"\n alignItems=\"flex-start\"\n gap={{ base: 12, medium: 24 }}\n >\n <Flex>\n <Heading as=\"h2\">{t('title')}</Heading>\n </Flex>\n </Flex>\n\n <DataView\n emptyState={() => (\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={24}>\n <FeatureIconCheck />\n <Text>{t('emptyState')}</Text>\n </Flex>\n )}\n columns={[\n {\n render: ({ payPeriod }) => {\n const { startDate, endDate } = formatPayPeriod(\n payPeriod?.startDate,\n payPeriod?.endDate,\n )\n\n return (\n <Flex flexDirection=\"column\" gap={0}>\n <Text>\n {startDate} - {endDate}\n </Text>\n <Text variant=\"supporting\">\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 },\n title: t('tableHeaders.0'),\n },\n {\n render: ({ payrollType }) => <Text>{t(`type.${payrollType}`)}</Text>,\n title: t('tableHeaders.1'),\n },\n {\n render: ({ checkDate }) => (\n <Text>{dateFormatter.formatShortWithWeekdayAndYear(checkDate)}</Text>\n ),\n title: t('tableHeaders.2'),\n },\n {\n title: t('tableHeaders.3'),\n render: ({ payrollDeadline }) => (\n <Text>{dateFormatter.formatShortWithWeekdayAndYear(payrollDeadline)}</Text>\n ),\n },\n {\n title: t('tableHeaders.4'),\n render: ({ processed }) => (\n <Badge>{processed ? t('status.processed') : t('status.unprocessed')}</Badge>\n ),\n },\n {\n title: '',\n render: ({ payrollUuid, calculatedAt, processed, payPeriod }) => {\n if (processed) {\n return null\n }\n\n const isProcessingSkipPayroll = skippingPayrollId === payrollUuid\n\n const button = calculatedAt ? (\n <Button\n isLoading={isProcessingSkipPayroll}\n onClick={() => {\n onSubmitPayroll({ payrollUuid, payPeriod })\n }}\n title={t('submitPayrollCta')}\n variant=\"secondary\"\n >\n {t('submitPayrollCta')}\n </Button>\n ) : (\n <Button\n isLoading={isProcessingSkipPayroll}\n onClick={() => {\n onRunPayroll({ payrollUuid, payPeriod })\n }}\n title={t('runPayrollTitle')}\n variant=\"secondary\"\n >\n {t('runPayrollTitle')}\n </Button>\n )\n\n return isDesktop ? (\n button\n ) : (\n <Flex flexDirection=\"column\" alignItems=\"stretch\" gap={12}>\n {button}\n </Flex>\n )\n },\n },\n ]}\n data={payrolls}\n label={t('payrollsListLabel')}\n itemMenu={({ payrollUuid, processed, payPeriod }) => {\n if (processed) {\n return null\n }\n\n const isProcessingSkipPayroll = skippingPayrollId === payrollUuid\n\n const { fullPeriod: payPeriodString } = formatPayPeriod(\n payPeriod?.startDate,\n payPeriod?.endDate,\n )\n\n const todayDateString = formatDateToStringDate(new Date())\n const todayAtMidnight = todayDateString ? new Date(todayDateString) : null\n const payPeriodStartDate = payPeriod?.startDate ? new Date(payPeriod.startDate) : null\n\n const canSkipPayroll =\n blockers.length === 0 &&\n todayAtMidnight &&\n payPeriodStartDate &&\n todayAtMidnight >= payPeriodStartDate\n\n if (!canSkipPayroll) {\n return null\n }\n\n return (\n <HamburgerMenu\n isLoading={isProcessingSkipPayroll}\n menuLabel={t('payrollMenuLabel')}\n items={[\n {\n label: t('skipPayrollCta'),\n onClick: () => {\n handleOpenSkipDialog(payrollUuid!, payPeriodString)\n },\n },\n ]}\n />\n )\n }}\n />\n <Dialog\n isOpen={skipPayrollDialogState.isOpen}\n onClose={handleCloseSkipDialog}\n onPrimaryActionClick={handleConfirmSkipPayroll}\n isDestructive={true}\n title={t('skipPayrollDialog.title', { payPeriod: skipPayrollDialogState.payPeriod })}\n primaryActionLabel={t('skipPayrollDialog.confirmCta')}\n closeActionLabel={t('skipPayrollDialog.cancelCta')}\n >\n {t('skipPayrollDialog.body')}\n </Dialog>\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollListPresentation","onRunPayroll","onSubmitPayroll","onSkipPayroll","onViewBlockers","payrolls","paySchedules","showSkipSuccessAlert","onDismissSkipSuccessAlert","skippingPayrollId","blockers","Badge","Button","Dialog","Heading","Text","Alert","useComponentContext","useI18n","useTranslation","dateFormatter","useDateFormatter","containerRef","useRef","isDesktop","useContainerBreakpoints","skipPayrollDialogState","setSkipPayrollDialogState","useState","handleOpenSkipDialog","payrollId","payPeriod","handleCloseSkipDialog","handleConfirmSkipPayroll","formatPayPeriod","startDate","endDate","formattedStartDate","formattedEndDate","jsx","styles","jsxs","Flex","PayrollBlockerAlerts","DataView","FeatureIconCheck","schedule","payrollType","checkDate","payrollDeadline","processed","payrollUuid","calculatedAt","isProcessingSkipPayroll","button","payPeriodString","todayDateString","formatDateToStringDate","todayAtMidnight","payPeriodStartDate","HamburgerMenu"],"mappings":";;;;;;;;;;;;;;AAiCO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,eAAAC;AAAA,EACA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,OAAO;AAAA,gBACL;AAAA,kBACE,OAAO,EAAE,gBAAgB;AAAA,kBACzB,SAAS,MAAM;AACb,oBAAAxB,EAAqBsB,GAAcI,CAAe;AAAA,kBACpD;AAAA,gBAAA;AAAA,cACF;AAAA,YACF;AAAA,UAAA,IAdK;AAAA,QAiBX;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,gBAAAhB;AAAA,MAAC1B;AAAA,MAAA;AAAA,QACC,QAAQa,EAAuB;AAAA,QAC/B,SAASM;AAAA,QACT,sBAAsBC;AAAA,QACtB,eAAe;AAAA,QACf,OAAO,EAAE,2BAA2B,EAAE,WAAWP,EAAuB,WAAW;AAAA,QACnF,oBAAoB,EAAE,8BAA8B;AAAA,QACpD,kBAAkB,EAAE,6BAA6B;AAAA,QAEhD,YAAE,wBAAwB;AAAA,MAAA;AAAA,IAAA;AAAA,EAC7B,EAAA,CACF,EAAA,CACF;AAEJ;"}
@@ -1,151 +1,171 @@
1
- import { jsx as m, jsxs as k } from "react/jsx-runtime";
2
- import { usePayrollsSubmitMutation as F } from "@gusto/embedded-api/react-query/payrollsSubmit";
3
- import { usePayrollsCancelMutation as G } from "@gusto/embedded-api/react-query/payrollsCancel";
4
- import { usePayrollsGetSuspense as x } from "@gusto/embedded-api/react-query/payrollsGet";
5
- import { useTranslation as M } from "react-i18next";
6
- import { useBankAccountsGetSuspense as j } from "@gusto/embedded-api/react-query/bankAccountsGet";
7
- import { useEmployeesListSuspense as W } from "@gusto/embedded-api/react-query/employeesList";
8
- import { useState as S, useEffect as I } from "react";
9
- import { useGustoEmbeddedContext as H } from "@gusto/embedded-api/react-query/_context";
10
- import { payrollsGetPayStub as V } from "@gusto/embedded-api/funcs/payrollsGetPayStub";
11
- import { useErrorBoundary as z } from "react-error-boundary";
12
- import { PayrollOverviewPresentation as J } from "./PayrollOverviewPresentation.js";
13
- import { PAYROLL_PROCESSING_STATUS as p, componentEvents as n } from "../../../shared/constants.js";
14
- import { BaseComponent as K } from "../../Base/Base.js";
15
- import { useBase as Q } from "../../Base/useBase.js";
16
- import { useComponentDictionary as X, useI18n as Z } from "../../../i18n/I18n.js";
17
- import { readableStreamToBlob as $ } from "../../../helpers/readableStreamToBlob.js";
18
- import ee from "../../../hooks/useNumberFormatter.js";
19
- import { useDateFormatter as te } from "../../../hooks/useDateFormatter.js";
20
- import { useComponentContext as oe } from "../../../contexts/ComponentAdapter/useComponentContext.js";
21
- import { renderErrorList as se } from "../../../helpers/apiErrorToList.js";
22
- import { Flex as re } from "../../Common/Flex/Flex.js";
23
- function Be(s) {
24
- return /* @__PURE__ */ m(K, { ...s, children: /* @__PURE__ */ m(ae, { ...s, children: s.children }) });
1
+ import { jsx as u, jsxs as x } from "react/jsx-runtime";
2
+ import { usePayrollsSubmitMutation as W } from "@gusto/embedded-api/react-query/payrollsSubmit";
3
+ import { usePayrollsCancelMutation as j } from "@gusto/embedded-api/react-query/payrollsCancel";
4
+ import { usePayrollsGetSuspense as V } from "@gusto/embedded-api/react-query/payrollsGet";
5
+ import { useTranslation as H } from "react-i18next";
6
+ import { useBankAccountsGetSuspense as K } from "@gusto/embedded-api/react-query/bankAccountsGet";
7
+ import { useEmployeesListSuspense as z } from "@gusto/embedded-api/react-query/employeesList";
8
+ import { useState as y, useEffect as J } from "react";
9
+ import { useGustoEmbeddedContext as Q } from "@gusto/embedded-api/react-query/_context";
10
+ import { payrollsGetPayStub as X } from "@gusto/embedded-api/funcs/payrollsGetPayStub";
11
+ import { useErrorBoundary as Z } from "react-error-boundary";
12
+ import { ConfirmWireDetails as $ } from "../ConfirmWireDetails/ConfirmWireDetails.js";
13
+ import { PayrollOverviewPresentation as ee } from "./PayrollOverviewPresentation.js";
14
+ import { PAYROLL_PROCESSING_STATUS as p, componentEvents as l, PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES as te } from "../../../shared/constants.js";
15
+ import { BaseComponent as oe } from "../../Base/Base.js";
16
+ import { useBase as se } from "../../Base/useBase.js";
17
+ import { useComponentDictionary as re, useI18n as ne } from "../../../i18n/I18n.js";
18
+ import { readableStreamToBlob as ie } from "../../../helpers/readableStreamToBlob.js";
19
+ import ae from "../../../hooks/useNumberFormatter.js";
20
+ import { useDateFormatter as le } from "../../../hooks/useDateFormatter.js";
21
+ import { useComponentContext as ce } from "../../../contexts/ComponentAdapter/useComponentContext.js";
22
+ import { renderErrorList as ue } from "../../../helpers/apiErrorToList.js";
23
+ import { Flex as me } from "../../Common/Flex/Flex.js";
24
+ const pe = (o = []) => o.filter(
25
+ (n) => n.status === "unresolved" && n.unblockOptions && n.unblockOptions.length > 0
26
+ ), de = (o = []) => {
27
+ const n = o.find((s) => s.status === "unresolved");
28
+ return n?.unblockOptions ? n.unblockOptions.find(
29
+ (s) => s.unblockType === "submit_wire"
30
+ )?.metadata.wireInRequestUuid : void 0;
31
+ };
32
+ function xe(o) {
33
+ return /* @__PURE__ */ u(oe, { ...o, children: /* @__PURE__ */ u(fe, { ...o, children: o.children }) });
25
34
  }
26
- const ae = ({
27
- companyId: s,
28
- payrollId: c,
29
- dictionary: w,
30
- onEvent: r,
31
- alerts: _
35
+ const fe = ({
36
+ companyId: o,
37
+ payrollId: n,
38
+ dictionary: P,
39
+ onEvent: s,
40
+ alerts: C
32
41
  }) => {
33
- X("Payroll.PayrollOverview", w), Z("Payroll.PayrollOverview");
34
- const { baseSubmitHandler: P } = Q(), { t: a } = M("Payroll.PayrollOverview"), [l, u] = S(!1), [D, y] = S(_ || []), { showBoundary: A } = z(), d = ee("currency"), b = te(), { Button: C, UnorderedList: E } = oe(), { data: f } = x(
42
+ re("Payroll.PayrollOverview", P), ne("Payroll.PayrollOverview");
43
+ const { baseSubmitHandler: b } = se(), { t: a } = H("Payroll.PayrollOverview"), [c, m] = y(!1), [U, d] = y(C || []), [R, A] = y({}), { showBoundary: D } = Z(), O = ae("currency"), S = le(), { Button: E, UnorderedList: g } = ce(), { data: f } = V(
35
44
  {
36
- companyId: s,
37
- payrollId: c,
45
+ companyId: o,
46
+ payrollId: n,
38
47
  include: ["taxes", "benefits", "deductions"]
39
48
  },
40
- { refetchInterval: l ? 5e3 : !1 }
41
- ), e = f.payrollShow, R = () => {
42
- r(n.RUN_PAYROLL_EDIT);
43
- };
44
- I(() => {
45
- e.processingRequest?.status === p.submitting && !l && u(!0), l && e.processingRequest?.status === p.submit_success && (r(n.RUN_PAYROLL_PROCESSED), y([
49
+ { refetchInterval: c ? 5e3 : !1 }
50
+ ), e = f.payrollShow, k = pe(e.submissionBlockers), L = de(e.creditBlockers), w = () => {
51
+ s(l.RUN_PAYROLL_EDIT);
52
+ }, B = L && /* @__PURE__ */ u($, { companyId: o, wireInId: L, onEvent: s });
53
+ J(() => {
54
+ e.processingRequest?.status === p.submitting && !c && m(!0), c && e.processingRequest?.status === p.submit_success && (s(l.RUN_PAYROLL_PROCESSED), d([
46
55
  {
47
56
  type: "success",
48
57
  title: a("alerts.payrollProcessedTitle"),
49
58
  content: a("alerts.payrollProcessedMessage", {
50
- amount: d(Number(e.totals?.netPayDebit)),
51
- date: b.formatShortWithYear(
59
+ amount: O(Number(e.totals?.netPayDebit)),
60
+ date: S.formatShortWithYear(
52
61
  e.payrollStatusMeta?.expectedDebitTime ?? e.payrollDeadline
53
62
  )
54
63
  })
55
64
  }
56
- ]), u(!1)), l && e.processingRequest?.status === p.processing_failed && (r(n.RUN_PAYROLL_PROCESSING_FAILED), y([
65
+ ]), m(!1)), c && e.processingRequest?.status === p.processing_failed && (s(l.RUN_PAYROLL_PROCESSING_FAILED), d([
57
66
  {
58
67
  type: "error",
59
68
  title: a("alerts.payrollProcessingFailedTitle"),
60
- content: /* @__PURE__ */ k(re, { flexDirection: "column", gap: 16, children: [
61
- /* @__PURE__ */ m(E, { items: se(e.processingRequest.errors ?? []) }),
62
- /* @__PURE__ */ m(C, { variant: "secondary", onClick: R, children: a("alerts.payrollProcessingFailedCtaLabel") })
69
+ content: /* @__PURE__ */ x(me, { flexDirection: "column", gap: 16, children: [
70
+ /* @__PURE__ */ u(g, { items: ue(e.processingRequest.errors ?? []) }),
71
+ /* @__PURE__ */ u(E, { variant: "secondary", onClick: w, children: a("alerts.payrollProcessingFailedCtaLabel") })
63
72
  ] })
64
73
  }
65
- ]), u(!1));
74
+ ]), m(!1));
66
75
  }, [
67
76
  e.processingRequest?.status,
68
- l,
69
- r,
77
+ c,
78
+ s,
70
79
  a,
71
- b,
72
- d,
80
+ S,
81
+ O,
73
82
  e.totals?.netPayDebit,
74
83
  e.payrollStatusMeta?.expectedDebitTime,
75
84
  e.payrollDeadline
76
85
  ]);
77
- const { data: g } = j({
78
- companyId: s
79
- }), O = g.companyBankAccounts?.[0], { data: h } = W({
80
- companyId: s
81
- }), { mutateAsync: U, isPending: T } = F(), { mutateAsync: B, isPending: N } = G();
86
+ const { data: h } = K({
87
+ companyId: o
88
+ }), T = h.companyBankAccounts?.[0], { data: N } = z({
89
+ companyId: o
90
+ }), { mutateAsync: v, isPending: q } = W(), { mutateAsync: Y, isPending: F } = j();
82
91
  if (!e.calculatedAt)
83
92
  throw new Error(a("alerts.payrollNotCalculated"));
84
- const Y = H(), q = e.employeeCompensations?.reduce(
85
- (o, i) => (i.taxes?.forEach((t) => {
86
- o[t.name] = {
87
- employee: (o[t.name]?.employee ?? 0) + (t.employer ? 0 : t.amount),
88
- employer: (o[t.name]?.employer ?? 0) + (t.employer ? t.amount : 0)
93
+ const I = Q(), G = e.employeeCompensations?.reduce(
94
+ (r, i) => (i.taxes?.forEach((t) => {
95
+ r[t.name] = {
96
+ employee: (r[t.name]?.employee ?? 0) + (t.employer ? 0 : t.amount),
97
+ employer: (r[t.name]?.employer ?? 0) + (t.employer ? t.amount : 0)
89
98
  };
90
- }), o),
99
+ }), r),
91
100
  {}
92
101
  ) || {};
93
- return /* @__PURE__ */ m(
94
- J,
102
+ return /* @__PURE__ */ u(
103
+ ee,
95
104
  {
96
- onEdit: R,
105
+ onEdit: w,
97
106
  onSubmit: async () => {
98
- await P(f, async () => {
99
- const o = await U({
107
+ await b(f, async () => {
108
+ const r = await v({
100
109
  request: {
101
- companyId: s,
102
- payrollId: c,
110
+ companyId: o,
111
+ payrollId: n,
103
112
  requestBody: {
104
- submissionBlockers: []
113
+ submissionBlockers: Object.entries(R).filter(
114
+ ([i]) => te.includes(i)
115
+ ).map(([i, t]) => ({
116
+ blockerType: i,
117
+ selectedOption: t
118
+ }))
105
119
  }
106
120
  }
107
121
  });
108
- r(n.RUN_PAYROLL_SUBMITTED, o), u(!0);
122
+ s(l.RUN_PAYROLL_SUBMITTED, r), m(!0);
109
123
  });
110
124
  },
111
125
  onCancel: async () => {
112
- await P(f, async () => {
113
- const o = await B({
126
+ await b(f, async () => {
127
+ const r = await Y({
114
128
  request: {
115
- companyId: s,
116
- payrollId: c
129
+ companyId: o,
130
+ payrollId: n
117
131
  }
118
132
  });
119
- r(n.RUN_PAYROLL_CANCELLED, o), y([]);
133
+ s(l.RUN_PAYROLL_CANCELLED, r), d([]);
120
134
  });
121
135
  },
122
136
  onPayrollReceipt: () => {
123
- r(n.RUN_PAYROLL_RECEIPT_GET, { payrollId: c });
137
+ s(l.RUN_PAYROLL_RECEIPT_GET, { payrollId: n });
124
138
  },
125
- onPaystubDownload: async (o) => {
139
+ onPaystubDownload: async (r) => {
126
140
  const i = window.open("", "_blank");
127
141
  try {
128
- const t = await V(Y, { payrollId: c, employeeId: o });
142
+ const t = await X(I, { payrollId: n, employeeId: r });
129
143
  if (!t.value?.responseStream)
130
144
  throw new Error(a("alerts.paystubPdfError"));
131
- const v = await $(t.value.responseStream, "application/pdf"), L = URL.createObjectURL(v);
132
- i && (i.location.href = L), r(n.RUN_PAYROLL_PDF_PAYSTUB_VIEWED, { employeeId: o }), URL.revokeObjectURL(L);
145
+ const M = await ie(t.value.responseStream, "application/pdf"), _ = URL.createObjectURL(M);
146
+ i && (i.location.href = _), s(l.RUN_PAYROLL_PDF_PAYSTUB_VIEWED, { employeeId: r }), URL.revokeObjectURL(_);
133
147
  } catch (t) {
134
- i && i.close(), A(t);
148
+ i && i.close(), D(t);
135
149
  }
136
150
  },
137
- isSubmitting: T || l || N,
151
+ isSubmitting: q || c || F,
138
152
  isProcessed: e.processingRequest?.status === p.submit_success,
139
153
  payrollData: e,
140
- bankAccount: O,
141
- employeeDetails: h.showEmployees || [],
142
- taxes: q,
143
- alerts: D
154
+ bankAccount: T,
155
+ employeeDetails: N.showEmployees || [],
156
+ taxes: G,
157
+ alerts: U,
158
+ submissionBlockers: k,
159
+ selectedUnblockOptions: R,
160
+ onUnblockOptionChange: (r, i) => {
161
+ A((t) => ({ ...t, [r]: i }));
162
+ },
163
+ wireInConfirmationRequest: B
144
164
  }
145
165
  );
146
166
  };
147
167
  export {
148
- Be as PayrollOverview,
149
- ae as Root
168
+ xe as PayrollOverview,
169
+ fe as Root
150
170
  };
151
171
  //# sourceMappingURL=PayrollOverview.js.map