@gusto/embedded-react-sdk 0.55.2 → 0.55.4

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 (159) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/components/Common/DataView/DataCards/DataCards.d.ts +2 -1
  3. package/dist/components/Common/DataView/DataCards/DataCards.js +63 -54
  4. package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
  5. package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js +14 -12
  6. package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js.map +1 -1
  7. package/dist/components/Common/DataView/DataTable/DataTable.d.ts +2 -1
  8. package/dist/components/Common/DataView/DataTable/DataTable.js +75 -66
  9. package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
  10. package/dist/components/Common/DataView/DataTable/DataTable.module.scss.js +8 -4
  11. package/dist/components/Common/DataView/DataTable/DataTable.module.scss.js.map +1 -1
  12. package/dist/components/Common/DataView/DataView.js +18 -17
  13. package/dist/components/Common/DataView/DataView.js.map +1 -1
  14. package/dist/components/Common/FieldLayout/FieldLayout.js +6 -6
  15. package/dist/components/Common/Fieldset/Fieldset.js +6 -6
  16. package/dist/components/Common/HorizontalFieldLayout/HorizontalFieldLayout.js +6 -6
  17. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +58 -49
  18. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -1
  19. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js +14 -10
  20. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js.map +1 -1
  21. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +4 -0
  22. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
  23. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  24. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
  25. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  26. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
  27. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  28. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
  29. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  30. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.d.ts +4 -0
  31. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  32. package/dist/components/Company/DocumentSigner/DocumentList/List.js +11 -8
  33. package/dist/components/Company/DocumentSigner/DocumentList/List.js.map +1 -1
  34. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  35. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  36. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
  37. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  38. package/dist/components/Company/Industry/Context.js +6 -7
  39. package/dist/components/Company/Industry/Context.js.map +1 -1
  40. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
  41. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  42. package/dist/components/Company/Locations/LocationsList/List.js +27 -25
  43. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  44. package/dist/components/Company/Locations/LocationsList/LocationsList.js +41 -36
  45. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  46. package/dist/components/Company/Locations/LocationsList/useLocationsList.d.ts +1 -0
  47. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
  48. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  49. package/dist/components/Company/OnboardingOverview/context.js +3 -4
  50. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  51. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.d.ts +9 -2
  52. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +19 -18
  53. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
  54. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +63 -62
  55. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  56. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
  57. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  58. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
  59. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  60. package/dist/components/Company/StateTaxes/TaxRateManagement/AddTaxRateDialog.js +69 -65
  61. package/dist/components/Company/StateTaxes/TaxRateManagement/AddTaxRateDialog.js.map +1 -1
  62. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +3 -4
  63. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
  64. package/dist/components/Company/StateTaxes/TaxRateManagement/toHistoryRows.js +30 -23
  65. package/dist/components/Company/StateTaxes/TaxRateManagement/toHistoryRows.js.map +1 -1
  66. package/dist/components/Company/StateTaxes/shared/RequirementFields.d.ts +8 -4
  67. package/dist/components/Company/StateTaxes/shared/RequirementFields.js +13 -12
  68. package/dist/components/Company/StateTaxes/shared/RequirementFields.js.map +1 -1
  69. package/dist/components/Company/StateTaxes/shared/prepareRequirements.d.ts +29 -0
  70. package/dist/components/Company/StateTaxes/shared/prepareRequirements.js +24 -0
  71. package/dist/components/Company/StateTaxes/shared/prepareRequirements.js.map +1 -0
  72. package/dist/components/Company/StateTaxes/shared/prepareRequirements.test.d.ts +1 -0
  73. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +68 -55
  74. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
  75. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +36 -35
  76. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  77. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +116 -116
  78. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
  79. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.d.ts +4 -0
  80. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js +19 -19
  81. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  82. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.js +16 -13
  83. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.js.map +1 -1
  84. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  85. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  86. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.d.ts +4 -0
  87. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js.map +1 -1
  88. package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js +84 -96
  89. package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js.map +1 -1
  90. package/dist/components/Flow/Flow.js +22 -22
  91. package/dist/components/Flow/Flow.js.map +1 -1
  92. package/dist/components/Flow/useFlow.js +3 -3
  93. package/dist/components/InformationRequests/InformationRequests.d.ts +1 -1
  94. package/dist/components/InformationRequests/InformationRequests.js +68 -53
  95. package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
  96. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +2 -3
  97. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  98. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +87 -81
  99. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
  100. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
  101. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +86 -67
  102. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
  103. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +4 -0
  104. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.d.ts +1 -1
  105. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js +26 -21
  106. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js.map +1 -1
  107. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.d.ts +8 -1
  108. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +29 -17
  109. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
  110. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js +21 -18
  111. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js.map +1 -1
  112. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js +9 -7
  113. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js.map +1 -1
  114. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +2 -0
  115. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js.map +1 -1
  116. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +200 -199
  117. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  118. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +3 -2
  119. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +32 -32
  120. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  121. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +254 -243
  122. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  123. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +83 -76
  124. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
  125. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +23 -22
  126. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  127. package/dist/components/Payroll/PayrollList/PayrollList.js +108 -97
  128. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  129. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +38 -37
  130. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  131. package/dist/components/Payroll/PayrollOverview/PayrollOverview.d.ts +8 -1
  132. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +196 -174
  133. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  134. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +3 -1
  135. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +173 -163
  136. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  137. package/dist/components/Payroll/helpers.d.ts +0 -15
  138. package/dist/components/Payroll/helpers.js +13 -18
  139. package/dist/components/Payroll/helpers.js.map +1 -1
  140. package/dist/components/Payroll/usePreparedPayrollData.js +8 -9
  141. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  142. package/dist/helpers/openPdfInNewTab.d.ts +15 -0
  143. package/dist/helpers/openPdfInNewTab.js +28 -0
  144. package/dist/helpers/openPdfInNewTab.js.map +1 -0
  145. package/dist/i18n/en/Company.DocumentList.json.js +34 -32
  146. package/dist/i18n/en/Company.DocumentList.json.js.map +1 -1
  147. package/dist/i18n/en/Company.StateTaxes.json.js +1 -1
  148. package/dist/i18n/en/Employee.DocumentSigner.json.js +24 -22
  149. package/dist/i18n/en/Employee.DocumentSigner.json.js.map +1 -1
  150. package/dist/i18n/en/Payroll.OffCycleCreation.json.js +11 -9
  151. package/dist/i18n/en/Payroll.OffCycleCreation.json.js.map +1 -1
  152. package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js +7 -7
  153. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +29 -27
  154. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -1
  155. package/dist/i18n/en/Payroll.PayrollOverview.json.js +41 -39
  156. package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
  157. package/dist/i18n/types.d.ts +331 -1
  158. package/dist/style.css +1 -1
  159. package/package.json +21 -21
@@ -1,34 +1,41 @@
1
- import { formatDateToStringDate as a } from "../../../../helpers/dateFormatting.js";
2
- function u(o) {
3
- return typeof o.effectiveFrom == "string" && o.effectiveFrom.length > 0;
1
+ import { getUniqueRhfKey as i } from "../shared/rhfKey.js";
2
+ import { formatDateToStringDate as m } from "../../../../helpers/dateFormatting.js";
3
+ function v(r) {
4
+ return typeof r.effectiveFrom == "string" && r.effectiveFrom.length > 0;
4
5
  }
5
- function m(o) {
6
- const f = a(/* @__PURE__ */ new Date()) ?? "", i = o.filter(u).sort((t, r) => t.effectiveFrom.localeCompare(r.effectiveFrom)), e = i.reduce(
7
- (t, r, c) => r.effectiveFrom <= f ? c : t,
6
+ function F(r) {
7
+ const n = m(/* @__PURE__ */ new Date()) ?? "", s = r.filter(v).sort((e, t) => e.effectiveFrom.localeCompare(t.effectiveFrom)), c = s.reduce(
8
+ (e, t, o) => t.effectiveFrom <= n ? o : e,
8
9
  -1
9
10
  );
10
- return i.map((t, r) => {
11
- const c = {};
12
- for (const n of t.requirements ?? [])
13
- !n.key || n.editable === !1 || (c[n.key] = n.value === null || n.value === void 0 ? "" : String(n.value));
14
- const s = r === e ? "current" : r > e ? "scheduled" : "historical";
11
+ return s.map((e, t) => {
12
+ const o = {}, a = e.requirements ?? [];
13
+ a.forEach((f, u) => {
14
+ !f.key || f.editable === !1 || (o[i(f, u, a)] = f.value === null || f.value === void 0 ? "" : String(f.value));
15
+ });
16
+ const l = t === c ? "current" : t > c ? "scheduled" : "historical";
15
17
  return {
16
- id: `${t.key ?? "set"}-${t.effectiveFrom}-${r}`,
17
- effectiveFrom: t.effectiveFrom,
18
- status: s,
19
- values: c
18
+ id: `${e.key ?? "set"}-${e.effectiveFrom}-${t}`,
19
+ effectiveFrom: e.effectiveFrom,
20
+ status: l,
21
+ values: o
20
22
  };
21
23
  });
22
24
  }
23
- function v(o) {
24
- const f = /* @__PURE__ */ new Map();
25
- for (const i of o)
26
- for (const e of i.requirements ?? [])
27
- e.key && e.editable !== !1 && !f.has(e.key) && f.set(e.key, { key: e.key, label: e.label });
28
- return Array.from(f.values());
25
+ function h(r) {
26
+ const n = /* @__PURE__ */ new Map();
27
+ for (const s of r) {
28
+ const c = s.requirements ?? [];
29
+ c.forEach((e, t) => {
30
+ if (!e.key || e.editable === !1) return;
31
+ const o = i(e, t, c);
32
+ n.has(o) || n.set(o, { key: o, label: e.label });
33
+ });
34
+ }
35
+ return Array.from(n.values());
29
36
  }
30
37
  export {
31
- v as extractRequirementColumns,
32
- m as toHistoryRows
38
+ h as extractRequirementColumns,
39
+ F as toHistoryRows
33
40
  };
34
41
  //# sourceMappingURL=toHistoryRows.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"toHistoryRows.js","sources":["../../../../../src/components/Company/StateTaxes/TaxRateManagement/toHistoryRows.ts"],"sourcesContent":["import type { TaxRequirementSet } from '@gusto/embedded-api/models/components/taxrequirementset'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\n\n/** @internal */\nexport type HistoryRowStatus = 'current' | 'scheduled' | 'historical'\n\n/** @internal */\nexport interface HistoryRow {\n id: string\n effectiveFrom: string\n status: HistoryRowStatus\n values: Record<string, string>\n}\n\n/** @internal */\nexport interface RequirementColumn {\n key: string\n label?: string\n}\n\nfunction isEffectiveDated(\n set: TaxRequirementSet,\n): set is TaxRequirementSet & { effectiveFrom: string } {\n return typeof set.effectiveFrom === 'string' && set.effectiveFrom.length > 0\n}\n\n/**\n * Tags each effective-dated requirement set for a key as current, scheduled (future), or\n * historical (past), relative to today.\n *\n * @internal\n */\nexport function toHistoryRows(sets: TaxRequirementSet[]): HistoryRow[] {\n const today = formatDateToStringDate(new Date()) ?? ''\n const sorted = sets\n .filter(isEffectiveDated)\n .sort((a, b) => a.effectiveFrom.localeCompare(b.effectiveFrom))\n\n const currentIndex = sorted.reduce(\n (acc, set, idx) => (set.effectiveFrom <= today ? idx : acc),\n -1,\n )\n\n return sorted.map((set, idx) => {\n const values: Record<string, string> = {}\n for (const requirement of set.requirements ?? []) {\n if (!requirement.key || requirement.editable === false) continue\n values[requirement.key] =\n requirement.value === null || requirement.value === undefined\n ? ''\n : String(requirement.value)\n }\n const status: HistoryRowStatus =\n idx === currentIndex ? 'current' : idx > currentIndex ? 'scheduled' : 'historical'\n return {\n id: `${set.key ?? 'set'}-${set.effectiveFrom}-${idx}`,\n effectiveFrom: set.effectiveFrom,\n status,\n values,\n }\n })\n}\n\n/**\n * Builds the union of editable requirement keys/labels across a set of requirement sets,\n * in first-seen order, for use as dynamic table columns.\n *\n * @internal\n */\nexport function extractRequirementColumns(sets: TaxRequirementSet[]): RequirementColumn[] {\n const seen = new Map<string, RequirementColumn>()\n for (const set of sets) {\n for (const requirement of set.requirements ?? []) {\n if (requirement.key && requirement.editable !== false && !seen.has(requirement.key)) {\n seen.set(requirement.key, { key: requirement.key, label: requirement.label })\n }\n }\n }\n return Array.from(seen.values())\n}\n"],"names":["isEffectiveDated","set","toHistoryRows","sets","today","formatDateToStringDate","sorted","a","b","currentIndex","acc","idx","values","requirement","status","extractRequirementColumns","seen"],"mappings":";AAoBA,SAASA,EACPC,GACsD;AACtD,SAAO,OAAOA,EAAI,iBAAkB,YAAYA,EAAI,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ts"],"sourcesContent":["import type { TaxRequirementSet } from '@gusto/embedded-api/models/components/taxrequirementset'\nimport { getUniqueRhfKey } from '../shared/rhfKey'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\n\n/** @internal */\nexport type HistoryRowStatus = 'current' | 'scheduled' | 'historical'\n\n/** @internal */\nexport interface HistoryRow {\n id: string\n effectiveFrom: string\n status: HistoryRowStatus\n values: Record<string, string>\n}\n\n/** @internal */\nexport interface RequirementColumn {\n key: string\n label?: string\n}\n\nfunction isEffectiveDated(\n set: TaxRequirementSet,\n): set is TaxRequirementSet & { effectiveFrom: string } {\n return typeof set.effectiveFrom === 'string' && set.effectiveFrom.length > 0\n}\n\n/**\n * Tags each effective-dated requirement set for a key as current, scheduled (future), or\n * historical (past), relative to today.\n *\n * @internal\n */\nexport function toHistoryRows(sets: TaxRequirementSet[]): HistoryRow[] {\n const today = formatDateToStringDate(new Date()) ?? ''\n const sorted = sets\n .filter(isEffectiveDated)\n .sort((a, b) => a.effectiveFrom.localeCompare(b.effectiveFrom))\n\n const currentIndex = sorted.reduce(\n (acc, set, idx) => (set.effectiveFrom <= today ? idx : acc),\n -1,\n )\n\n return sorted.map((set, idx) => {\n const values: Record<string, string> = {}\n const requirements = set.requirements ?? []\n requirements.forEach((requirement, reqIndex) => {\n if (!requirement.key || requirement.editable === false) return\n values[getUniqueRhfKey(requirement, reqIndex, requirements)] =\n requirement.value === null || requirement.value === undefined\n ? ''\n : String(requirement.value)\n })\n const status: HistoryRowStatus =\n idx === currentIndex ? 'current' : idx > currentIndex ? 'scheduled' : 'historical'\n return {\n id: `${set.key ?? 'set'}-${set.effectiveFrom}-${idx}`,\n effectiveFrom: set.effectiveFrom,\n status,\n values,\n }\n })\n}\n\n/**\n * Builds the union of editable requirement keys/labels across a set of requirement sets,\n * in first-seen order, for use as dynamic table columns.\n *\n * @internal\n */\nexport function extractRequirementColumns(sets: TaxRequirementSet[]): RequirementColumn[] {\n const seen = new Map<string, RequirementColumn>()\n for (const set of sets) {\n const requirements = set.requirements ?? []\n requirements.forEach((requirement, index) => {\n if (!requirement.key || requirement.editable === false) return\n const columnKey = getUniqueRhfKey(requirement, index, requirements)\n if (!seen.has(columnKey)) {\n seen.set(columnKey, { key: columnKey, label: requirement.label })\n }\n })\n }\n return Array.from(seen.values())\n}\n"],"names":["isEffectiveDated","set","toHistoryRows","sets","today","formatDateToStringDate","sorted","a","b","currentIndex","acc","idx","values","requirements","requirement","reqIndex","getUniqueRhfKey","status","extractRequirementColumns","seen","index","columnKey"],"mappings":";;AAqBA,SAASA,EACPC,GACsD;AACtD,SAAO,OAAOA,EAAI,iBAAkB,YAAYA,EAAI,cAAc,SAAS;AAC7E;AAQO,SAASC,EAAcC,GAAyC;AACrE,QAAMC,IAAQC,EAAuB,oBAAI,KAAA,CAAM,KAAK,IAC9CC,IAASH,EACZ,OAAOH,CAAgB,EACvB,KAAK,CAACO,GAAGC,MAAMD,EAAE,cAAc,cAAcC,EAAE,aAAa,CAAC,GAE1DC,IAAeH,EAAO;AAAA,IAC1B,CAACI,GAAKT,GAAKU,MAASV,EAAI,iBAAiBG,IAAQO,IAAMD;AAAA,IACvD;AAAA,EAAA;AAGF,SAAOJ,EAAO,IAAI,CAACL,GAAKU,MAAQ;AAC9B,UAAMC,IAAiC,CAAA,GACjCC,IAAeZ,EAAI,gBAAgB,CAAA;AACzC,IAAAY,EAAa,QAAQ,CAACC,GAAaC,MAAa;AAC9C,MAAI,CAACD,EAAY,OAAOA,EAAY,aAAa,OACjDF,EAAOI,EAAgBF,GAAaC,GAAUF,CAAY,CAAC,IACzDC,EAAY,UAAU,QAAQA,EAAY,UAAU,SAChD,KACA,OAAOA,EAAY,KAAK;AAAA,IAChC,CAAC;AACD,UAAMG,IACJN,MAAQF,IAAe,YAAYE,IAAMF,IAAe,cAAc;AACxE,WAAO;AAAA,MACL,IAAI,GAAGR,EAAI,OAAO,KAAK,IAAIA,EAAI,aAAa,IAAIU,CAAG;AAAA,MACnD,eAAeV,EAAI;AAAA,MACnB,QAAAgB;AAAA,MACA,QAAAL;AAAA,IAAA;AAAA,EAEJ,CAAC;AACH;AAQO,SAASM,EAA0Bf,GAAgD;AACxF,QAAMgB,wBAAW,IAAA;AACjB,aAAWlB,KAAOE,GAAM;AACtB,UAAMU,IAAeZ,EAAI,gBAAgB,CAAA;AACzC,IAAAY,EAAa,QAAQ,CAACC,GAAaM,MAAU;AAC3C,UAAI,CAACN,EAAY,OAAOA,EAAY,aAAa,GAAO;AACxD,YAAMO,IAAYL,EAAgBF,GAAaM,GAAOP,CAAY;AAClE,MAAKM,EAAK,IAAIE,CAAS,KACrBF,EAAK,IAAIE,GAAW,EAAE,KAAKA,GAAW,OAAOP,EAAY,OAAO;AAAA,IAEpE,CAAC;AAAA,EACH;AACA,SAAO,MAAM,KAAKK,EAAK,OAAA,CAAQ;AACjC;"}
@@ -1,15 +1,19 @@
1
1
  import { TaxRequirement } from '@gusto/embedded-api/models/components/taxrequirement';
2
2
  interface RequirementFieldsProps {
3
- /** Requirements to render as inputs, nested under `requirementSetKey` in the form's RHF path. */
3
+ /**
4
+ * Requirements to render as inputs, nested under `requirementSetKey` in the form's RHF path.
5
+ * Non-editable requirements, and requirements resolved as never-applicable against a
6
+ * non-editable sibling, are dropped via {@link prepareRequirements} before rendering.
7
+ */
4
8
  requirements: TaxRequirement[] | undefined;
5
9
  /** RHF path segment the requirements are nested under, e.g. `taxrates` or `fields`. */
6
10
  requirementSetKey: string;
7
11
  }
8
12
  /**
9
13
  * Renders one form field per editable, currently-applicable requirement, filtering
10
- * out non-editable requirements, requirements with no `key` (the API doesn't guarantee one, and
11
- * without it there's no stable form path to register), and requirements whose `applicableIf`
12
- * constraints aren't satisfied by the form's current values.
14
+ * out requirements with no `key` (the API doesn't guarantee one, and without it there's no stable
15
+ * form path to register) and requirements whose `applicableIf` constraints aren't satisfied by
16
+ * the form's current values.
13
17
  *
14
18
  * @internal
15
19
  */
@@ -1,24 +1,25 @@
1
- import { jsx as o, Fragment as f } from "react/jsx-runtime";
2
- import { useFormContext as p, useWatch as l } from "react-hook-form";
3
- import { getUniqueRhfKey as s } from "./rhfKey.js";
1
+ import { jsx as e, Fragment as n } from "react/jsx-runtime";
2
+ import { useFormContext as a, useWatch as f } from "react-hook-form";
3
+ import { getUniqueRhfKey as u } from "./rhfKey.js";
4
4
  import { isRequirementApplicable as c } from "./applicableIf.js";
5
- import { QuestionInput as m } from "../../../Common/TaxInputs/TaxInputs.js";
6
- function k({ requirements: r, requirementSetKey: e }) {
7
- const { control: i } = p(), n = l({ control: i });
8
- return /* @__PURE__ */ o(f, { children: r?.flatMap((t, a) => t.key ? t.editable === !1 ? [] : c(t, e, n) ? [
9
- /* @__PURE__ */ o(f, { children: /* @__PURE__ */ o(
10
- m,
5
+ import { prepareRequirements as l } from "./prepareRequirements.js";
6
+ import { QuestionInput as d } from "../../../Common/TaxInputs/TaxInputs.js";
7
+ function F({ requirements: i, requirementSetKey: r }) {
8
+ const { control: m } = a(), s = f({ control: m }), o = l(i ?? []);
9
+ return /* @__PURE__ */ e(n, { children: o.flatMap((t, p) => t.key ? c(t, r, s) ? [
10
+ /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(
11
+ d,
11
12
  {
12
13
  requirement: {
13
14
  ...t,
14
- key: `${e}.${s(t, a, r)}`
15
+ key: `${r}.${u(t, p, o)}`
15
16
  },
16
17
  questionType: t.metadata?.type ?? "Text"
17
18
  }
18
- ) }, `${t.key}-${a}`)
19
+ ) }, `${t.key}-${p}`)
19
20
  ] : [] : []) });
20
21
  }
21
22
  export {
22
- k as RequirementFields
23
+ F as RequirementFields
23
24
  };
24
25
  //# sourceMappingURL=RequirementFields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequirementFields.js","sources":["../../../../../src/components/Company/StateTaxes/shared/RequirementFields.tsx"],"sourcesContent":["import { Fragment } from 'react/jsx-runtime'\nimport { useFormContext, useWatch } from 'react-hook-form'\nimport type { TaxRequirement } from '@gusto/embedded-api/models/components/taxrequirement'\nimport { getUniqueRhfKey } from './rhfKey'\nimport { isRequirementApplicable, type StateTaxesFormValues } from './applicableIf'\nimport { QuestionInput } from '@/components/Common/TaxInputs/TaxInputs'\n\ninterface RequirementFieldsProps {\n /** Requirements to render as inputs, nested under `requirementSetKey` in the form's RHF path. */\n requirements: TaxRequirement[] | undefined\n /** RHF path segment the requirements are nested under, e.g. `taxrates` or `fields`. */\n requirementSetKey: string\n}\n\n/**\n * Renders one form field per editable, currently-applicable requirement, filtering\n * out non-editable requirements, requirements with no `key` (the API doesn't guarantee one, and\n * without it there's no stable form path to register), and requirements whose `applicableIf`\n * constraints aren't satisfied by the form's current values.\n *\n * @internal\n */\nexport function RequirementFields({ requirements, requirementSetKey }: RequirementFieldsProps) {\n const { control } = useFormContext()\n const watchedValues = useWatch({ control }) as StateTaxesFormValues\n\n return (\n <>\n {requirements?.flatMap((requirement, index) => {\n if (!requirement.key) return []\n if (requirement.editable === false) return []\n if (!isRequirementApplicable(requirement, requirementSetKey, watchedValues)) return []\n return [\n <Fragment key={`${requirement.key}-${index}`}>\n <QuestionInput\n requirement={{\n ...requirement,\n key: `${requirementSetKey}.${getUniqueRhfKey(requirement, index, requirements)}`,\n }}\n questionType={requirement.metadata?.type ?? 'Text'}\n />\n </Fragment>,\n ]\n })}\n </>\n )\n}\n"],"names":["RequirementFields","requirements","requirementSetKey","control","useFormContext","watchedValues","useWatch","jsx","Fragment","requirement","index","isRequirementApplicable","QuestionInput","getUniqueRhfKey"],"mappings":";;;;;AAsBO,SAASA,EAAkB,EAAE,cAAAC,GAAc,mBAAAC,KAA6C;AAC7F,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACdC,IAAgBC,EAAS,EAAE,SAAAH,GAAS;AAE1C,SACE,gBAAAI,EAAAC,GAAA,EACG,UAAAP,GAAc,QAAQ,CAACQ,GAAaC,MAC9BD,EAAY,MACbA,EAAY,aAAa,KAAc,CAAA,IACtCE,EAAwBF,GAAaP,GAAmBG,CAAa,IACnE;AAAA,IACL,gBAAAE,EAACC,GAAA,EACC,UAAA,gBAAAD;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,aAAa;AAAA,UACX,GAAGH;AAAA,UACH,KAAK,GAAGP,CAAiB,IAAIW,EAAgBJ,GAAaC,GAAOT,CAAY,CAAC;AAAA,QAAA;AAAA,QAEhF,cAAcQ,EAAY,UAAU,QAAQ;AAAA,MAAA;AAAA,IAAA,KANjC,GAAGA,EAAY,GAAG,IAAIC,CAAK,EAQ1C;AAAA,EAAA,IAVkF,CAAA,IAFvD,CAAA,CAc9B,EAAA,CACH;AAEJ;"}
1
+ {"version":3,"file":"RequirementFields.js","sources":["../../../../../src/components/Company/StateTaxes/shared/RequirementFields.tsx"],"sourcesContent":["import { Fragment } from 'react/jsx-runtime'\nimport { useFormContext, useWatch } from 'react-hook-form'\nimport type { TaxRequirement } from '@gusto/embedded-api/models/components/taxrequirement'\nimport { getUniqueRhfKey } from './rhfKey'\nimport { isRequirementApplicable, type StateTaxesFormValues } from './applicableIf'\nimport { prepareRequirements } from './prepareRequirements'\nimport { QuestionInput } from '@/components/Common/TaxInputs/TaxInputs'\n\ninterface RequirementFieldsProps {\n /**\n * Requirements to render as inputs, nested under `requirementSetKey` in the form's RHF path.\n * Non-editable requirements, and requirements resolved as never-applicable against a\n * non-editable sibling, are dropped via {@link prepareRequirements} before rendering.\n */\n requirements: TaxRequirement[] | undefined\n /** RHF path segment the requirements are nested under, e.g. `taxrates` or `fields`. */\n requirementSetKey: string\n}\n\n/**\n * Renders one form field per editable, currently-applicable requirement, filtering\n * out requirements with no `key` (the API doesn't guarantee one, and without it there's no stable\n * form path to register) and requirements whose `applicableIf` constraints aren't satisfied by\n * the form's current values.\n *\n * @internal\n */\nexport function RequirementFields({ requirements, requirementSetKey }: RequirementFieldsProps) {\n const { control } = useFormContext()\n const watchedValues = useWatch({ control }) as StateTaxesFormValues\n const preparedRequirements = prepareRequirements(requirements ?? [])\n\n return (\n <>\n {preparedRequirements.flatMap((requirement, index) => {\n if (!requirement.key) return []\n if (!isRequirementApplicable(requirement, requirementSetKey, watchedValues)) return []\n return [\n <Fragment key={`${requirement.key}-${index}`}>\n <QuestionInput\n requirement={{\n ...requirement,\n key: `${requirementSetKey}.${getUniqueRhfKey(requirement, index, preparedRequirements)}`,\n }}\n questionType={requirement.metadata?.type ?? 'Text'}\n />\n </Fragment>,\n ]\n })}\n </>\n )\n}\n"],"names":["RequirementFields","requirements","requirementSetKey","control","useFormContext","watchedValues","useWatch","preparedRequirements","prepareRequirements","jsx","Fragment","requirement","index","isRequirementApplicable","QuestionInput","getUniqueRhfKey"],"mappings":";;;;;;AA2BO,SAASA,EAAkB,EAAE,cAAAC,GAAc,mBAAAC,KAA6C;AAC7F,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACdC,IAAgBC,EAAS,EAAE,SAAAH,GAAS,GACpCI,IAAuBC,EAAoBP,KAAgB,EAAE;AAEnE,SACE,gBAAAQ,EAAAC,GAAA,EACG,UAAAH,EAAqB,QAAQ,CAACI,GAAaC,MACrCD,EAAY,MACZE,EAAwBF,GAAaT,GAAmBG,CAAa,IACnE;AAAA,IACL,gBAAAI,EAACC,GAAA,EACC,UAAA,gBAAAD;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,aAAa;AAAA,UACX,GAAGH;AAAA,UACH,KAAK,GAAGT,CAAiB,IAAIa,EAAgBJ,GAAaC,GAAOL,CAAoB,CAAC;AAAA,QAAA;AAAA,QAExF,cAAcI,EAAY,UAAU,QAAQ;AAAA,MAAA;AAAA,IAAA,KANjC,GAAGA,EAAY,GAAG,IAAIC,CAAK,EAQ1C;AAAA,EAAA,IAVkF,CAAA,IADvD,CAAA,CAa9B,EAAA,CACH;AAEJ;"}
@@ -0,0 +1,29 @@
1
+ import { TaxRequirement } from '@gusto/embedded-api/models/components/taxrequirement';
2
+ /**
3
+ * Resolves each requirement's `applicableIf` constraints against non-editable (system/agency-set)
4
+ * siblings, and drops requirements that can never become applicable — mirroring gws-flows'
5
+ * `TaxRequirements::Edit.prepare_requirements`, which performs this same resolution server-side
6
+ * before Rails renders its own edit view.
7
+ *
8
+ * @remarks
9
+ * A constraint referencing an editable sibling is left untouched, since it can only be resolved
10
+ * dynamically against the user's current form input (see {@link isRequirementApplicable}). A
11
+ * constraint referencing a non-editable sibling is resolved once here, against that sibling's
12
+ * fetched `value`, since a non-editable value can never change over the lifetime of the form:
13
+ * - If the sibling's value satisfies the constraint, the constraint is dropped (the requirement
14
+ * is always applicable).
15
+ * - If it doesn't, the whole requirement is dropped — it can never become applicable.
16
+ *
17
+ * Non-editable requirements are dropped unconditionally, since they never become form fields.
18
+ *
19
+ * @internal
20
+ */
21
+ export declare function prepareRequirements(requirements: TaxRequirement[]): TaxRequirement[];
22
+ /**
23
+ * Whether a requirement set has anything left to edit once {@link prepareRequirements} resolves
24
+ * non-editable-sibling constraints and drops non-editable/unsatisfiable requirements — mirroring
25
+ * gws-flows' `TaxRequirements::Edit.set_editable?`.
26
+ *
27
+ * @internal
28
+ */
29
+ export declare function isRequirementSetEditable(requirements: TaxRequirement[]): boolean;
@@ -0,0 +1,24 @@
1
+ function s(n) {
2
+ return n.flatMap((t) => {
3
+ if (t.editable === !1) return [];
4
+ const l = t.applicableIf ?? [], a = [];
5
+ for (const e of l) {
6
+ const i = n.find((o) => o.key === e.key);
7
+ if (!i || i.editable !== !1) {
8
+ a.push(e);
9
+ continue;
10
+ }
11
+ if (i.value !== e.value)
12
+ return [];
13
+ }
14
+ return [{ ...t, applicableIf: a }];
15
+ });
16
+ }
17
+ function r(n) {
18
+ return s(n).length > 0;
19
+ }
20
+ export {
21
+ r as isRequirementSetEditable,
22
+ s as prepareRequirements
23
+ };
24
+ //# sourceMappingURL=prepareRequirements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareRequirements.js","sources":["../../../../../src/components/Company/StateTaxes/shared/prepareRequirements.ts"],"sourcesContent":["import type { TaxRequirement } from '@gusto/embedded-api/models/components/taxrequirement'\n\n/**\n * Resolves each requirement's `applicableIf` constraints against non-editable (system/agency-set)\n * siblings, and drops requirements that can never become applicable — mirroring gws-flows'\n * `TaxRequirements::Edit.prepare_requirements`, which performs this same resolution server-side\n * before Rails renders its own edit view.\n *\n * @remarks\n * A constraint referencing an editable sibling is left untouched, since it can only be resolved\n * dynamically against the user's current form input (see {@link isRequirementApplicable}). A\n * constraint referencing a non-editable sibling is resolved once here, against that sibling's\n * fetched `value`, since a non-editable value can never change over the lifetime of the form:\n * - If the sibling's value satisfies the constraint, the constraint is dropped (the requirement\n * is always applicable).\n * - If it doesn't, the whole requirement is dropped — it can never become applicable.\n *\n * Non-editable requirements are dropped unconditionally, since they never become form fields.\n *\n * @internal\n */\nexport function prepareRequirements(requirements: TaxRequirement[]): TaxRequirement[] {\n return requirements.flatMap(requirement => {\n if (requirement.editable === false) return []\n\n const constraints = requirement.applicableIf ?? []\n const resolvedConstraints: typeof constraints = []\n\n for (const constraint of constraints) {\n const sibling = requirements.find(candidate => candidate.key === constraint.key)\n\n if (!sibling || sibling.editable !== false) {\n resolvedConstraints.push(constraint)\n continue\n }\n\n if (sibling.value === constraint.value) continue\n\n return []\n }\n\n return [{ ...requirement, applicableIf: resolvedConstraints }]\n })\n}\n\n/**\n * Whether a requirement set has anything left to edit once {@link prepareRequirements} resolves\n * non-editable-sibling constraints and drops non-editable/unsatisfiable requirements — mirroring\n * gws-flows' `TaxRequirements::Edit.set_editable?`.\n *\n * @internal\n */\nexport function isRequirementSetEditable(requirements: TaxRequirement[]): boolean {\n return prepareRequirements(requirements).length > 0\n}\n"],"names":["prepareRequirements","requirements","requirement","constraints","resolvedConstraints","constraint","sibling","candidate","isRequirementSetEditable"],"mappings":"AAqBO,SAASA,EAAoBC,GAAkD;AACpF,SAAOA,EAAa,QAAQ,CAAAC,MAAe;AACzC,QAAIA,EAAY,aAAa,GAAO,QAAO,CAAA;AAE3C,UAAMC,IAAcD,EAAY,gBAAgB,CAAA,GAC1CE,IAA0C,CAAA;AAEhD,eAAWC,KAAcF,GAAa;AACpC,YAAMG,IAAUL,EAAa,KAAK,OAAaM,EAAU,QAAQF,EAAW,GAAG;AAE/E,UAAI,CAACC,KAAWA,EAAQ,aAAa,IAAO;AAC1C,QAAAF,EAAoB,KAAKC,CAAU;AACnC;AAAA,MACF;AAEA,UAAIC,EAAQ,UAAUD,EAAW;AAEjC,eAAO,CAAA;AAAA,IACT;AAEA,WAAO,CAAC,EAAE,GAAGH,GAAa,cAAcE,GAAqB;AAAA,EAC/D,CAAC;AACH;AASO,SAASI,EAAyBP,GAAyC;AAChF,SAAOD,EAAoBC,CAAY,EAAE,SAAS;AACpD;"}
@@ -1,49 +1,59 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { useState as b, useMemo as i, useCallback as k } from "react";
3
- import { useContractorPaymentGroupsGetListSuspense as E } from "@gusto/embedded-api/react-query/contractorPaymentGroupsGetList";
4
- import { useInformationRequestsGetInformationRequestsSuspense as B } from "@gusto/embedded-api/react-query/informationRequestsGetInformationRequests";
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useState as b, useMemo as a, useCallback as B } from "react";
3
+ import { keepPreviousData as G } from "@tanstack/react-query";
4
+ import { useContractorPaymentGroupsGetList as Y } from "@gusto/embedded-api/react-query/contractorPaymentGroupsGetList";
5
+ import { useInformationRequestsGetInformationRequestsSuspense as v } from "@gusto/embedded-api/react-query/informationRequestsGetInformationRequests";
5
6
  import { InformationRequestStatus as g } from "@gusto/embedded-api/models/components/informationrequest";
6
- import { PaymentsListPresentation as G } from "./PaymentsListPresentation.js";
7
- import { useComponentDictionary as Y } from "../../../../i18n/I18n.js";
8
- import { BaseComponent as U } from "../../../Base/Base.js";
7
+ import { PaymentsListPresentation as U } from "./PaymentsListPresentation.js";
8
+ import { useComponentDictionary as W } from "../../../../i18n/I18n.js";
9
+ import { BaseComponent as x, BaseLayout as F } from "../../../Base/Base.js";
9
10
  import "../../../Base/useBase.js";
10
- import { componentEvents as a } from "../../../../shared/constants.js";
11
- import { usePagination as W } from "../../../../hooks/usePagination/usePagination.js";
12
- function et(t) {
13
- return /* @__PURE__ */ c(v, { ...t });
11
+ import { componentEvents as c } from "../../../../shared/constants.js";
12
+ import { usePagination as H } from "../../../../hooks/usePagination/usePagination.js";
13
+ function it(t) {
14
+ return /* @__PURE__ */ r(V, { ...t });
14
15
  }
15
- function v(t) {
16
- return /* @__PURE__ */ c(U, { ...t, children: /* @__PURE__ */ c(H, { ...t, children: t.children }) });
16
+ function V(t) {
17
+ return /* @__PURE__ */ r(x, { ...t, children: /* @__PURE__ */ r(z, { ...t, children: t.children }) });
17
18
  }
18
- const x = (t = 3) => {
19
- const o = /* @__PURE__ */ new Date(), e = /* @__PURE__ */ new Date();
20
- return e.setMonth(e.getMonth() - t), o.setMonth(o.getMonth() + (12 - t)), {
19
+ const j = (t = 3) => {
20
+ const s = /* @__PURE__ */ new Date(), e = /* @__PURE__ */ new Date();
21
+ return e.setMonth(e.getMonth() - t), s.setMonth(s.getMonth() + (12 - t)), {
21
22
  startDate: e.toISOString().split("T")[0] || "",
22
- endDate: o.toISOString().split("T")[0] || ""
23
+ endDate: s.toISOString().split("T")[0] || ""
23
24
  };
24
- }, H = ({ companyId: t, dictionary: o, onEvent: e, alerts: R }) => {
25
- Y("Contractor.Payments.PaymentsList", o);
26
- const [m, C] = b(3), { currentPage: T, itemsPerPage: h, getPaginationProps: A } = W(), { startDate: D, endDate: O } = i(() => x(m), [m]), { data: f } = E({
27
- companyId: t,
28
- startDate: D,
29
- endDate: O,
30
- page: T,
31
- per: h
32
- }), u = f.contractorPaymentGroupWithBlockers || [], y = A(f.httpMeta.response.headers), { data: M } = B({
25
+ }, z = ({
26
+ companyId: t,
27
+ dictionary: s,
28
+ onEvent: e,
29
+ alerts: R,
30
+ LoaderComponent: h
31
+ }) => {
32
+ W("Contractor.Payments.PaymentsList", s);
33
+ const [m, C] = b(3), { currentPage: T, itemsPerPage: D, getPaginationProps: O } = H(), { startDate: y, endDate: A } = a(() => j(m), [m]), { data: u, isFetching: M } = Y(
34
+ {
35
+ companyId: t,
36
+ startDate: y,
37
+ endDate: A,
38
+ page: T,
39
+ per: D
40
+ },
41
+ { placeholderData: G, throwOnError: !0 }
42
+ ), p = u?.contractorPaymentGroupWithBlockers || [], { data: w } = v({
33
43
  companyUuid: t
34
- }), p = M.informationRequests ?? [], _ = i(() => u.some((n) => (n.creditBlockers || []).some((r) => {
35
- if (r.status !== "unresolved") return !1;
36
- const s = r.unblockOptions?.find(
37
- (L) => L.unblockType === "submit_wire"
44
+ }), f = w.informationRequests ?? [], _ = a(() => p.some((n) => (n.creditBlockers || []).some((i) => {
45
+ if (i.status !== "unresolved") return !1;
46
+ const o = i.unblockOptions?.find(
47
+ (E) => E.unblockType === "submit_wire"
38
48
  );
39
- return s && "metadata" in s && s.metadata.wireInRequestUuid;
40
- })), [u]), l = k(() => {
41
- e(a.CONTRACTOR_PAYMENT_RFI_RESPOND);
42
- }, [e]), P = i(() => {
43
- const n = [], d = p.some(
44
- (s) => s.status === g.PendingResponse
45
- ), r = p.some(
46
- (s) => s.status === g.PendingReview
49
+ return o && "metadata" in o && o.metadata.wireInRequestUuid;
50
+ })), [p]), l = B(() => {
51
+ e(c.CONTRACTOR_PAYMENT_RFI_RESPOND);
52
+ }, [e]), P = a(() => {
53
+ const n = [], d = f.some(
54
+ (o) => o.status === g.PendingResponse
55
+ ), i = f.some(
56
+ (o) => o.status === g.PendingReview
47
57
  );
48
58
  return d ? n.push({
49
59
  type: "error",
@@ -51,39 +61,42 @@ const x = (t = 3) => {
51
61
  content: "rfiPendingResponseDescription",
52
62
  onAction: l,
53
63
  actionLabel: "rfiRespondCta"
54
- }) : r && n.push({
64
+ }) : i && n.push({
55
65
  type: "info",
56
66
  title: "rfiPendingReviewTitle",
57
67
  content: "rfiPendingReviewDescription"
58
68
  }), n;
59
- }, [p, l]), w = () => {
60
- e(a.CONTRACTOR_PAYMENT_CREATE);
61
- }, I = () => {
62
- e(a.CONTRACTOR_HISTORICAL_PAYMENT_CREATE);
63
- }, N = (n) => {
69
+ }, [f, l]), I = () => {
70
+ e(c.CONTRACTOR_PAYMENT_CREATE);
71
+ }, N = () => {
72
+ e(c.CONTRACTOR_HISTORICAL_PAYMENT_CREATE);
73
+ }, L = (n) => {
64
74
  C(n);
65
75
  }, S = (n) => {
66
- e(a.CONTRACTOR_PAYMENT_VIEW, { paymentId: n });
67
- }, q = i(() => [...P, ...R || []], [P, R]);
68
- return /* @__PURE__ */ c(
69
- G,
76
+ e(c.CONTRACTOR_PAYMENT_VIEW, { paymentId: n });
77
+ }, q = a(() => [...P, ...R || []], [P, R]);
78
+ if (!u)
79
+ return /* @__PURE__ */ r(F, { isLoading: !0, LoaderComponent: h });
80
+ const k = O(u.httpMeta.response.headers, M);
81
+ return /* @__PURE__ */ r(
82
+ U,
70
83
  {
71
- contractorPayments: u,
84
+ contractorPayments: p,
72
85
  numberOfMonths: m,
73
- onCreatePayment: w,
74
- onCreateHistoricalPayment: I,
75
- onDateRangeChange: N,
86
+ onCreatePayment: I,
87
+ onCreateHistoricalPayment: N,
88
+ onDateRangeChange: L,
76
89
  onViewPayment: S,
77
90
  alerts: q,
78
91
  companyId: t,
79
92
  hasUnresolvedWireInRequests: _,
80
93
  onEvent: e,
81
- paginationProps: y
94
+ paginationProps: k
82
95
  }
83
96
  );
84
97
  };
85
98
  export {
86
- et as PaymentsList,
87
- v as PaymentsListInternal
99
+ it as PaymentsList,
100
+ V as PaymentsListInternal
88
101
  };
89
102
  //# sourceMappingURL=PaymentsList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentsList.js","sources":["../../../../../src/components/Contractor/Payments/PaymentsList/PaymentsList.tsx"],"sourcesContent":["import { useState, useMemo, useCallback } from 'react'\nimport { useContractorPaymentGroupsGetListSuspense } from '@gusto/embedded-api/react-query/contractorPaymentGroupsGetList'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport { InformationRequestStatus } from '@gusto/embedded-api/models/components/informationrequest'\nimport type { InternalAlert } from '../types'\nimport { PaymentsListPresentation } from './PaymentsListPresentation'\nimport { useComponentDictionary } from '@/i18n'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\n\n/**\n * Props for {@link PaymentsList}.\n *\n * @public\n */\nexport interface PaymentsListProps extends BaseComponentInterface<'Contractor.Payments.PaymentsList'> {\n /** UUID of the company whose contractor payment groups should be listed. */\n companyId: string\n}\n\n/**\n * Props for the flow-internal {@link PaymentsListInternal}, which layers\n * flow-injected alerts on top of the public {@link PaymentsListProps}.\n *\n * @internal\n */\nexport interface PaymentsListInternalProps extends PaymentsListProps {\n /** Flow-injected alerts (e.g. wire-transfer confirmation, payment cancellation). */\n alerts?: InternalAlert[]\n}\n\n/**\n * Displays a list of contractor payment groups for a company.\n *\n * Supports viewing payment history, creating new payments, and filtering by date range.\n * Surfaces alerts for pending information requests and wire transfer requirements.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/payments/create` | User chooses to create a new payment | — |\n * | `contractor/payments/view` | User selects a payment group to view | `{ paymentId: string }` |\n * | `contractor/payments/rfi/respond` | User clicks to respond to an information request alert | — |\n *\n * @param props - Component props.\n * @returns The rendered payments list.\n * @public\n */\nexport function PaymentsList(props: PaymentsListProps) {\n return <PaymentsListInternal {...props} />\n}\n\n/**\n * Flow-internal entry point for {@link PaymentsList} that accepts flow-injected\n * alerts. Partners use {@link PaymentsList}; flows render this directly.\n *\n * @internal\n */\nexport function PaymentsListInternal(props: PaymentsListInternalProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst calculateDateRange = (months: number = 3) => {\n const endDate = new Date()\n const startDate = new Date()\n\n startDate.setMonth(startDate.getMonth() - months)\n //Max range allowed by the API is 12 months\n endDate.setMonth(endDate.getMonth() + (12 - months))\n\n return {\n startDate: startDate.toISOString().split('T')[0] || '',\n endDate: endDate.toISOString().split('T')[0] || '',\n }\n}\n\nconst Root = ({ companyId, dictionary, onEvent, alerts }: PaymentsListInternalProps) => {\n useComponentDictionary('Contractor.Payments.PaymentsList', dictionary)\n\n const [numberOfMonths, setNumberOfMonths] = useState(3)\n const { currentPage, itemsPerPage, getPaginationProps } = usePagination()\n\n const { startDate, endDate } = useMemo(() => calculateDateRange(numberOfMonths), [numberOfMonths])\n\n const { data } = useContractorPaymentGroupsGetListSuspense({\n companyId,\n startDate,\n endDate,\n page: currentPage,\n per: itemsPerPage,\n })\n const contractorPayments = data.contractorPaymentGroupWithBlockers || []\n const paginationProps = getPaginationProps(data.httpMeta.response.headers)\n\n const { data: informationRequestsData } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n const informationRequests = informationRequestsData.informationRequests ?? []\n\n const hasUnresolvedWireInRequests = useMemo(() => {\n return contractorPayments.some(payment => {\n const creditBlockers = payment.creditBlockers || []\n return creditBlockers.some(blocker => {\n if (blocker.status !== 'unresolved') return false\n const wireOption = blocker.unblockOptions?.find(\n option => option.unblockType === 'submit_wire',\n )\n return wireOption && 'metadata' in wireOption && wireOption.metadata.wireInRequestUuid\n })\n })\n }, [contractorPayments])\n\n const handleRespondToRfi = useCallback(() => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_RFI_RESPOND)\n }, [onEvent])\n\n const rfiAlerts = useMemo(() => {\n const rfiAlertsArray: InternalAlert[] = []\n\n const hasPendingResponseRfis = informationRequests.some(\n request => request.status === InformationRequestStatus.PendingResponse,\n )\n const hasPendingReviewRfis = informationRequests.some(\n request => request.status === InformationRequestStatus.PendingReview,\n )\n\n if (hasPendingResponseRfis) {\n rfiAlertsArray.push({\n type: 'error',\n title: 'rfiPendingResponseTitle',\n content: 'rfiPendingResponseDescription',\n onAction: handleRespondToRfi,\n actionLabel: 'rfiRespondCta',\n })\n } else if (hasPendingReviewRfis) {\n rfiAlertsArray.push({\n type: 'info',\n title: 'rfiPendingReviewTitle',\n content: 'rfiPendingReviewDescription',\n })\n }\n\n return rfiAlertsArray\n }, [informationRequests, handleRespondToRfi])\n\n const onCreatePayment = () => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_CREATE)\n }\n\n const onCreateHistoricalPayment = () => {\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_CREATE)\n }\n\n const handleDateRangeChange = (numberOfMonths: number) => {\n setNumberOfMonths(numberOfMonths)\n }\n\n const onViewPayment = (paymentId: string) => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_VIEW, { paymentId })\n }\n\n const allAlerts = useMemo(() => {\n return [...rfiAlerts, ...(alerts || [])]\n }, [rfiAlerts, alerts])\n\n return (\n <PaymentsListPresentation\n contractorPayments={contractorPayments}\n numberOfMonths={numberOfMonths}\n onCreatePayment={onCreatePayment}\n onCreateHistoricalPayment={onCreateHistoricalPayment}\n onDateRangeChange={handleDateRangeChange}\n onViewPayment={onViewPayment}\n alerts={allAlerts}\n companyId={companyId}\n hasUnresolvedWireInRequests={hasUnresolvedWireInRequests}\n onEvent={onEvent}\n paginationProps={paginationProps}\n />\n )\n}\n"],"names":["PaymentsList","props","jsx","PaymentsListInternal","BaseComponent","Root","calculateDateRange","months","endDate","startDate","companyId","dictionary","onEvent","alerts","useComponentDictionary","numberOfMonths","setNumberOfMonths","useState","currentPage","itemsPerPage","getPaginationProps","usePagination","useMemo","data","useContractorPaymentGroupsGetListSuspense","contractorPayments","paginationProps","informationRequestsData","useInformationRequestsGetInformationRequestsSuspense","informationRequests","hasUnresolvedWireInRequests","payment","blocker","wireOption","option","handleRespondToRfi","useCallback","componentEvents","rfiAlerts","rfiAlertsArray","hasPendingResponseRfis","request","InformationRequestStatus","hasPendingReviewRfis","onCreatePayment","onCreateHistoricalPayment","handleDateRangeChange","onViewPayment","paymentId","allAlerts","PaymentsListPresentation"],"mappings":";;;;;;;;;;;AAiDO,SAASA,GAAaC,GAA0B;AACr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IAAApC,EAAQyB,EAAgB,yBAAyB,EAAE,WAAAW,EAAA,CAAW;AAAA,EAChE,GAEMC,IAAY3B,EAAQ,MACjB,CAAC,GAAGgB,GAAW,GAAIzB,KAAU,CAAA,CAAG,GACtC,CAACyB,GAAWzB,CAAM,CAAC;AAEtB,SACE,gBAAAX;AAAA,IAACgD;AAAA,IAAA;AAAA,MACC,oBAAAzB;AAAA,MACA,gBAAAV;AAAA,MACA,iBAAA6B;AAAA,MACA,2BAAAC;AAAA,MACA,mBAAmBC;AAAA,MACnB,eAAAC;AAAA,MACA,QAAQE;AAAA,MACR,WAAAvC;AAAA,MACA,6BAAAoB;AAAA,MACA,SAAAlB;AAAA,MACA,iBAAAc;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"PaymentsList.js","sources":["../../../../../src/components/Contractor/Payments/PaymentsList/PaymentsList.tsx"],"sourcesContent":["import { useState, useMemo, useCallback } from 'react'\nimport { keepPreviousData } from '@tanstack/react-query'\nimport { useContractorPaymentGroupsGetList } from '@gusto/embedded-api/react-query/contractorPaymentGroupsGetList'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport { InformationRequestStatus } from '@gusto/embedded-api/models/components/informationrequest'\nimport type { InternalAlert } from '../types'\nimport { PaymentsListPresentation } from './PaymentsListPresentation'\nimport { useComponentDictionary } from '@/i18n'\nimport { BaseComponent, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\n\n/**\n * Props for {@link PaymentsList}.\n *\n * @public\n */\nexport interface PaymentsListProps extends BaseComponentInterface<'Contractor.Payments.PaymentsList'> {\n /** UUID of the company whose contractor payment groups should be listed. */\n companyId: string\n}\n\n/**\n * Props for the flow-internal {@link PaymentsListInternal}, which layers\n * flow-injected alerts on top of the public {@link PaymentsListProps}.\n *\n * @internal\n */\nexport interface PaymentsListInternalProps extends PaymentsListProps {\n /** Flow-injected alerts (e.g. wire-transfer confirmation, payment cancellation). */\n alerts?: InternalAlert[]\n}\n\n/**\n * Displays a list of contractor payment groups for a company.\n *\n * Supports viewing payment history, creating new payments, and filtering by date range.\n * Surfaces alerts for pending information requests and wire transfer requirements.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/payments/create` | User chooses to create a new payment | — |\n * | `contractor/payments/view` | User selects a payment group to view | `{ paymentId: string }` |\n * | `contractor/payments/rfi/respond` | User clicks to respond to an information request alert | — |\n *\n * @param props - Component props.\n * @returns The rendered payments list.\n * @public\n */\nexport function PaymentsList(props: PaymentsListProps) {\n return <PaymentsListInternal {...props} />\n}\n\n/**\n * Flow-internal entry point for {@link PaymentsList} that accepts flow-injected\n * alerts. Partners use {@link PaymentsList}; flows render this directly.\n *\n * @internal\n */\nexport function PaymentsListInternal(props: PaymentsListInternalProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst calculateDateRange = (months: number = 3) => {\n const endDate = new Date()\n const startDate = new Date()\n\n startDate.setMonth(startDate.getMonth() - months)\n //Max range allowed by the API is 12 months\n endDate.setMonth(endDate.getMonth() + (12 - months))\n\n return {\n startDate: startDate.toISOString().split('T')[0] || '',\n endDate: endDate.toISOString().split('T')[0] || '',\n }\n}\n\nconst Root = ({\n companyId,\n dictionary,\n onEvent,\n alerts,\n LoaderComponent,\n}: PaymentsListInternalProps) => {\n useComponentDictionary('Contractor.Payments.PaymentsList', dictionary)\n\n const [numberOfMonths, setNumberOfMonths] = useState(3)\n const { currentPage, itemsPerPage, getPaginationProps } = usePagination()\n\n const { startDate, endDate } = useMemo(() => calculateDateRange(numberOfMonths), [numberOfMonths])\n\n const { data, isFetching } = useContractorPaymentGroupsGetList(\n {\n companyId,\n startDate,\n endDate,\n page: currentPage,\n per: itemsPerPage,\n },\n { placeholderData: keepPreviousData, throwOnError: true },\n )\n const contractorPayments = data?.contractorPaymentGroupWithBlockers || []\n\n const { data: informationRequestsData } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n const informationRequests = informationRequestsData.informationRequests ?? []\n\n const hasUnresolvedWireInRequests = useMemo(() => {\n return contractorPayments.some(payment => {\n const creditBlockers = payment.creditBlockers || []\n return creditBlockers.some(blocker => {\n if (blocker.status !== 'unresolved') return false\n const wireOption = blocker.unblockOptions?.find(\n option => option.unblockType === 'submit_wire',\n )\n return wireOption && 'metadata' in wireOption && wireOption.metadata.wireInRequestUuid\n })\n })\n }, [contractorPayments])\n\n const handleRespondToRfi = useCallback(() => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_RFI_RESPOND)\n }, [onEvent])\n\n const rfiAlerts = useMemo(() => {\n const rfiAlertsArray: InternalAlert[] = []\n\n const hasPendingResponseRfis = informationRequests.some(\n request => request.status === InformationRequestStatus.PendingResponse,\n )\n const hasPendingReviewRfis = informationRequests.some(\n request => request.status === InformationRequestStatus.PendingReview,\n )\n\n if (hasPendingResponseRfis) {\n rfiAlertsArray.push({\n type: 'error',\n title: 'rfiPendingResponseTitle',\n content: 'rfiPendingResponseDescription',\n onAction: handleRespondToRfi,\n actionLabel: 'rfiRespondCta',\n })\n } else if (hasPendingReviewRfis) {\n rfiAlertsArray.push({\n type: 'info',\n title: 'rfiPendingReviewTitle',\n content: 'rfiPendingReviewDescription',\n })\n }\n\n return rfiAlertsArray\n }, [informationRequests, handleRespondToRfi])\n\n const onCreatePayment = () => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_CREATE)\n }\n\n const onCreateHistoricalPayment = () => {\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_CREATE)\n }\n\n const handleDateRangeChange = (numberOfMonths: number) => {\n setNumberOfMonths(numberOfMonths)\n }\n\n const onViewPayment = (paymentId: string) => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_VIEW, { paymentId })\n }\n\n const allAlerts = useMemo(() => {\n return [...rfiAlerts, ...(alerts || [])]\n }, [rfiAlerts, alerts])\n\n if (!data) {\n return <BaseLayout isLoading LoaderComponent={LoaderComponent} />\n }\n\n const paginationProps = getPaginationProps(data.httpMeta.response.headers, isFetching)\n\n return (\n <PaymentsListPresentation\n contractorPayments={contractorPayments}\n numberOfMonths={numberOfMonths}\n onCreatePayment={onCreatePayment}\n onCreateHistoricalPayment={onCreateHistoricalPayment}\n onDateRangeChange={handleDateRangeChange}\n onViewPayment={onViewPayment}\n alerts={allAlerts}\n companyId={companyId}\n hasUnresolvedWireInRequests={hasUnresolvedWireInRequests}\n onEvent={onEvent}\n paginationProps={paginationProps}\n />\n )\n}\n"],"names":["PaymentsList","props","jsx","PaymentsListInternal","BaseComponent","Root","calculateDateRange","months","endDate","startDate","companyId","dictionary","onEvent","alerts","LoaderComponent","useComponentDictionary","numberOfMonths","setNumberOfMonths","useState","currentPage","itemsPerPage","getPaginationProps","usePagination","useMemo","data","isFetching","useContractorPaymentGroupsGetList","keepPreviousData","contractorPayments","informationRequestsData","useInformationRequestsGetInformationRequestsSuspense","informationRequests","hasUnresolvedWireInRequests","payment","blocker","wireOption","option","handleRespondToRfi","useCallback","componentEvents","rfiAlerts","rfiAlertsArray","hasPendingResponseRfis","request","InformationRequestStatus","hasPendingReviewRfis","onCreatePayment","onCreateHistoricalPayment","handleDateRangeChange","onViewPayment","paymentId","allAlerts","BaseLayout","paginationProps","PaymentsListPresentation"],"mappings":";;;;;;;;;;;;AAkDO,SAASA,GAAaC,GAA0B;AACrD,SAAO,gBAAAC,EAACC,GAAA,EAAsB,GAAGF,EAAA,CAAO;AAC1C;AAQO,SAASE,EAAqBF,GAAkC;AACrE,SACE,gBAAAC,EAACE,GAAA,EAAe,GAAGH,GACjB,UAAA,gBAAAC,EAACG,KAAM,GAAGJ,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMK,IAAqB,CAACC,IAAiB,MAAM;AACjD,QAAMC,wBAAc,KAAA,G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AAtB,EAACkD,GAAA,EAAW,WAAS,IAAC,iBAAAtC,EAAA,CAAkC;AAGjE,QAAMuC,IAAkBhC,EAAmBG,EAAK,SAAS,SAAS,SAASC,CAAU;AAErF,SACE,gBAAAvB;AAAA,IAACoD;AAAA,IAAA;AAAA,MACC,oBAAA1B;AAAA,MACA,gBAAAZ;AAAA,MACA,iBAAA8B;AAAA,MACA,2BAAAC;AAAA,MACA,mBAAmBC;AAAA,MACnB,eAAAC;AAAA,MACA,QAAQE;AAAA,MACR,WAAAzC;AAAA,MACA,6BAAAsB;AAAA,MACA,SAAApB;AAAA,MACA,iBAAAyC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -8,32 +8,32 @@ import { useComponentContext as R } from "../../../../contexts/ComponentAdapter/
8
8
  import { useI18n as T } from "../../../../i18n/I18n.js";
9
9
  import V from "../../../../hooks/useNumberFormatter.js";
10
10
  import B from "../../../../assets/icons/eye.svg.js";
11
- import h from "../../../../assets/icons/plus-circle.svg.js";
11
+ import p from "../../../../assets/icons/plus-circle.svg.js";
12
12
  import { useDateFormatter as I } from "../../../../hooks/useDateFormatter.js";
13
13
  import { ConfirmWireDetails as M } from "../../../Payroll/ConfirmWireDetails/ConfirmWireDetails.js";
14
14
  import { WithUnstableFeature as W } from "../../../../contexts/UnstableFeaturesProvider/WithUnstableFeature.js";
15
15
  import { useDataView as E } from "../../../Common/DataView/useDataView.js";
16
16
  import { DataView as H } from "../../../Common/DataView/DataView.js";
17
17
  const at = ({
18
- contractorPayments: l,
19
- numberOfMonths: p,
20
- onCreatePayment: s,
21
- onCreateHistoricalPayment: y,
22
- onDateRangeChange: f,
23
- onViewPayment: b,
18
+ contractorPayments: s,
19
+ numberOfMonths: y,
20
+ onCreatePayment: l,
21
+ onCreateHistoricalPayment: f,
22
+ onDateRangeChange: b,
23
+ onViewPayment: g,
24
24
  alerts: c = [],
25
- companyId: g,
26
- hasUnresolvedWireInRequests: C,
25
+ companyId: C,
26
+ hasUnresolvedWireInRequests: D,
27
27
  onEvent: P,
28
- paginationProps: D
28
+ paginationProps: m
29
29
  }) => {
30
- const { Box: v, Button: r, Heading: m, Text: d, Select: x, ButtonIcon: L, Alert: w } = R();
30
+ const { Box: v, Button: r, Heading: d, Text: u, Select: x, ButtonIcon: L, Alert: w } = R();
31
31
  T("Contractor.Payments.PaymentsList");
32
- const { t: n } = $("Contractor.Payments.PaymentsList"), u = V("currency"), { formatLongWithYear: A } = I(), N = [
32
+ const { t: n } = $("Contractor.Payments.PaymentsList"), h = V("currency"), { formatLongWithYear: A } = I(), F = [
33
33
  { value: "3", label: n("dateRanges.last3Months") },
34
34
  { value: "6", label: n("dateRanges.last6Months") }
35
- ], { ...j } = E({
36
- data: l,
35
+ ], { ...N } = E({
36
+ data: s,
37
37
  columns: [
38
38
  {
39
39
  title: n("paymentDateColumnLabel"),
@@ -42,12 +42,12 @@ const at = ({
42
42
  {
43
43
  title: n("wageTotalColumnLabel"),
44
44
  justify: "end",
45
- render: ({ totals: e }) => u(Number(e?.wageAmount || 0))
45
+ render: ({ totals: e }) => h(Number(e?.wageAmount || 0))
46
46
  },
47
47
  {
48
48
  title: n("reimbursementTotalColumnLabel"),
49
49
  justify: "end",
50
- render: ({ totals: e }) => u(Number(e?.reimbursementAmount) || 0)
50
+ render: ({ totals: e }) => h(Number(e?.reimbursementAmount) || 0)
51
51
  }
52
52
  ],
53
53
  itemMenu: ({ uuid: e }) => /* @__PURE__ */ t(
@@ -56,7 +56,7 @@ const at = ({
56
56
  "aria-label": n("viewPaymentCta"),
57
57
  variant: "tertiary",
58
58
  onClick: () => {
59
- b(e || "");
59
+ g(e || "");
60
60
  },
61
61
  children: /* @__PURE__ */ t(B, { "aria-hidden": !0 })
62
62
  }
@@ -65,17 +65,18 @@ const at = ({
65
65
  r,
66
66
  {
67
67
  variant: "secondary",
68
- icon: /* @__PURE__ */ t(h, { "aria-hidden": !0 }),
69
- onClick: s,
68
+ icon: /* @__PURE__ */ t(p, { "aria-hidden": !0 }),
69
+ onClick: l,
70
70
  children: n("createPaymentCta")
71
71
  }
72
72
  ) }) }),
73
- pagination: D
73
+ pagination: m,
74
+ isFetching: m?.isFetching
74
75
  });
75
76
  return /* @__PURE__ */ a(i, { flexDirection: "column", gap: 24, children: [
76
- /* @__PURE__ */ t(i, { flexDirection: "column", gap: 16, children: /* @__PURE__ */ t(m, { as: "h1", styledAs: "h2", children: n("title") }) }),
77
- C && /* @__PURE__ */ t(M, { companyId: g, onEvent: P }),
78
- c.length > 0 && /* @__PURE__ */ t(i, { flexDirection: "column", gap: 16, children: c.map((e, F) => /* @__PURE__ */ t(
77
+ /* @__PURE__ */ t(i, { flexDirection: "column", gap: 16, children: /* @__PURE__ */ t(d, { as: "h1", styledAs: "h2", children: n("title") }) }),
78
+ D && /* @__PURE__ */ t(M, { companyId: C, onEvent: P }),
79
+ c.length > 0 && /* @__PURE__ */ t(i, { flexDirection: "column", gap: 16, children: c.map((e, j) => /* @__PURE__ */ t(
79
80
  w,
80
81
  {
81
82
  label: n(`alerts.${e.title}`, e.translationParams),
@@ -86,7 +87,7 @@ const at = ({
86
87
  e.onAction && e.actionLabel && /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(r, { variant: "secondary", onClick: e.onAction, children: n(`alerts.${e.actionLabel}`) }) })
87
88
  ] })
88
89
  },
89
- `${e.type}-${e.title}-${F}`
90
+ `${e.type}-${e.title}-${j}`
90
91
  )) }),
91
92
  /* @__PURE__ */ a(
92
93
  i,
@@ -102,29 +103,29 @@ const at = ({
102
103
  },
103
104
  justifyContent: "space-between",
104
105
  children: [
105
- /* @__PURE__ */ t(m, { as: "h2", styledAs: "h4", children: n("subtitle") }),
106
+ /* @__PURE__ */ t(d, { as: "h2", styledAs: "h4", children: n("subtitle") }),
106
107
  /* @__PURE__ */ a("div", { className: o.actionsContainer, children: [
107
108
  /* @__PURE__ */ t(
108
109
  x,
109
110
  {
110
111
  id: "date-range-select",
111
- value: p.toString(),
112
+ value: y.toString(),
112
113
  onChange: (e) => {
113
- f(Number(e));
114
+ b(Number(e));
114
115
  },
115
- options: N,
116
+ options: F,
116
117
  isRequired: !0,
117
118
  label: n("startDate"),
118
119
  placeholder: "",
119
120
  shouldVisuallyHideLabel: !0
120
121
  }
121
122
  ),
122
- l.length > 0 && /* @__PURE__ */ t(
123
+ s.length > 0 && /* @__PURE__ */ t(
123
124
  r,
124
125
  {
125
- onClick: s,
126
+ onClick: l,
126
127
  variant: "secondary",
127
- icon: /* @__PURE__ */ t(h, { "aria-hidden": !0 }),
128
+ icon: /* @__PURE__ */ t(p, { "aria-hidden": !0 }),
128
129
  className: o.nowrap,
129
130
  children: n("createPaymentCta")
130
131
  }
@@ -133,15 +134,15 @@ const at = ({
133
134
  ]
134
135
  }
135
136
  ),
136
- /* @__PURE__ */ t(H, { label: n("subtitle"), ...j }),
137
+ /* @__PURE__ */ t(H, { label: n("subtitle"), ...N }),
137
138
  /* @__PURE__ */ t(W, { feature: "historicalPayments", children: /* @__PURE__ */ t("div", { className: o.historicalPaymentCta, children: /* @__PURE__ */ t(
138
139
  v,
139
140
  {
140
141
  header: /* @__PURE__ */ a(i, { flexDirection: "column", gap: 4, children: [
141
- /* @__PURE__ */ t(d, { weight: "semibold", children: n("historicalPaymentCta.title") }),
142
- /* @__PURE__ */ t(d, { variant: "supporting", children: n("historicalPaymentCta.description") })
142
+ /* @__PURE__ */ t(u, { weight: "semibold", children: n("historicalPaymentCta.title") }),
143
+ /* @__PURE__ */ t(u, { variant: "supporting", children: n("historicalPaymentCta.description") })
143
144
  ] }),
144
- footer: /* @__PURE__ */ t(r, { variant: "secondary", onClick: y, children: n("historicalPaymentCta.button") })
145
+ footer: /* @__PURE__ */ t(r, { variant: "secondary", onClick: f, children: n("historicalPaymentCta.button") })
145
146
  }
146
147
  ) }) })
147
148
  ] });