@tesouro/embedded-components-react 0.11.141 → 0.11.167

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 (148) hide show
  1. package/NOTICE +24 -0
  2. package/README.md +15 -37
  3. package/dist/experimental/BalanceHistoryWidget.d.ts +0 -11
  4. package/dist/experimental/QuickViewWidget.d.ts +0 -11
  5. package/dist/experimental/RemoteCheckCapture.d.ts +0 -11
  6. package/dist/experimental/index.d.ts +0 -11
  7. package/dist/fixtures/index.d.ts +27 -1
  8. package/dist/index.css +6976 -6246
  9. package/dist/index.d.ts +64 -173
  10. package/dist/index.js +9 -10
  11. package/dist/lib/AcceptDisclosuresWidget.d.ts +0 -11
  12. package/dist/lib/BalancesWidget.d.ts +0 -11
  13. package/dist/lib/BankAccountOnboardingWidget.d.ts +0 -11
  14. package/dist/lib/BankAccountsWidget.d.ts +2 -11
  15. package/dist/lib/BankingComplianceBannerWidget.d.ts +0 -11
  16. package/dist/lib/BillPayWidget.d.ts +0 -11
  17. package/dist/lib/CardDetailsWidget.d.ts +0 -11
  18. package/dist/lib/CounterpartsWidget.d.ts +1 -12
  19. package/dist/lib/CounterpartsWidgetPublic.d.ts +1 -12
  20. package/dist/lib/CreditCardsWidget.d.ts +0 -11
  21. package/dist/lib/DebitCardsWidget.d.ts +0 -11
  22. package/dist/lib/ExpenseManagementWidget.d.ts +1 -12
  23. package/dist/lib/InsightsWidget.d.ts +0 -11
  24. package/dist/lib/LinkedAccountsWidget.d.ts +0 -11
  25. package/dist/lib/OfferWidget.d.ts +0 -11
  26. package/dist/lib/ReceivablesWidget.d.ts +60 -17
  27. package/dist/lib/ReceivablesWidget.js +3 -2
  28. package/dist/lib/SettingsWidget.d.ts +0 -11
  29. package/dist/lib/TransfersWidget.d.ts +0 -11
  30. package/dist/lib/WidgetProvider.d.ts +0 -11
  31. package/dist/lib/WidgetProviderPublic.d.ts +0 -11
  32. package/dist/lib/WidgetSuite.d.ts +60 -15
  33. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js +1 -1
  34. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/BankAccountOnboardingWidget.js +20 -19
  35. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index10.js +8 -8
  36. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index4.js +2 -3
  37. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index10.js +83 -82
  38. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index4.js +84 -79
  39. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index9.js +2 -1
  40. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/formatters.js +2 -3
  41. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/useBankAccountsWidget.js +4 -4
  42. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/AccountCard.js +51 -46
  43. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/labels.js +2 -1
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +1 -1
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +1 -1
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +1 -1
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +1 -1
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index4.js +1 -1
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +1 -1
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-upload/feature/dist/index4.js +1 -1
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index16.js +1 -1
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +1 -1
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/feature/dist/index10.js +1 -1
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/feature/dist/index4.js +1 -1
  55. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/useActivateCard.js +1 -1
  56. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/useCardLock.js +1 -1
  57. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/useEditCardNickname.js +1 -1
  58. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/feature/dist/index8.js +1 -1
  59. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsActions.js +1 -1
  60. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index7.js +1 -1
  61. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/ExpenseManagementWidget.js +10 -9
  62. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/TransactionDetails/TransactionDetailsFeature.js +1 -1
  63. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/feature/dist/index2.js +1 -1
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +2 -2
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index16.js +66 -74
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +3 -2
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +351 -318
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +126 -133
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +63 -56
  70. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/invoicesFilter.js +78 -72
  71. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/invoicesFilterLabels.js +2 -1
  72. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +14 -1
  73. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +138 -129
  74. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurringSeries.js +119 -0
  75. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusCards.js +37 -28
  76. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/tabs.js +1 -2
  77. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useInvoicesFilter.js +131 -81
  78. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useLocalDayStart.js +15 -0
  79. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +46 -46
  80. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +1 -1
  81. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableAttachmentUploads.js +13 -13
  82. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableBankAccount.js +1 -1
  83. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +440 -438
  84. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +7 -7
  85. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentTerms.js +1 -1
  86. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableRecurrence.js +62 -56
  87. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableReminders.js +1 -1
  88. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +47 -16
  89. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +78 -86
  90. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +180 -158
  91. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useRecurringSeriesTable.js +132 -0
  92. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/mocks/invoicing.js +4 -0
  93. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/mocks/receivables.js +153 -137
  94. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +22 -19
  95. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +6 -4
  96. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +1 -1
  97. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +3 -3
  98. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index60.js +137 -129
  99. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index61.js +21 -46
  100. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index62.js +143 -0
  101. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index63.js +2 -0
  102. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index64.js +47 -0
  103. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +25 -25
  104. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +1 -1
  105. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductDelete.js +1 -1
  106. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/mocks/products.js +3 -11
  107. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/scenarios.js +1 -1
  108. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/data-access/dist/index2.js +36 -77
  109. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/feature/dist/lib/CardsQuickViewWidget/summarizeCardSpend.js +11 -13
  110. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/feature/dist/lib/CardsQuickViewWidget/useCardSpendSummary.js +20 -17
  111. package/dist/libs/tesouro-embedded-components-react/remote-check-capture/feature/dist/lib/RemoteCheckCaptureWidget/useRemoteCheckCaptureWidget.js +1 -1
  112. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/feature/dist/index7.js +1 -1
  113. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/mocks/settings.js +7 -0
  114. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index7.js +1 -1
  115. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index8.js +1 -1
  116. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index8.js +4 -9
  117. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index12.js +1 -1
  118. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index16.js +2 -3
  119. package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsWidgetUi.js +2 -2
  120. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +1 -1
  121. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index3.js +2 -2
  122. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/subEntityForms.js +1 -1
  123. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useDeleteController.js +1 -1
  124. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +43 -43
  125. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +233 -211
  126. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +66 -42
  127. package/dist/libs/tesouro-embedded-components-react/shared/document-status/util/dist/lib/receivableFilledTone.js +1 -1
  128. package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/feature/dist/lib/ExpenseRequirementsWidget.js +5 -4
  129. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  130. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +1 -1
  131. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/toasts.js +1 -1
  132. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +28 -28
  133. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/EmbeddedToaster.js +33 -32
  134. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js +9 -8
  135. package/dist/node_modules/sonner/dist/index.js +620 -0
  136. package/dist/packages/shared-ui-shadcn/dist/index.js +6072 -6062
  137. package/dist/scenarios/index.d.ts +1 -3
  138. package/dist/scenarios/index.js +17 -20
  139. package/package.json +17 -4
  140. package/dist/lib/CustomersWidget.d.ts +0 -993
  141. package/dist/lib/CustomersWidget.js +0 -2
  142. package/dist/lib/ProductsWidget.d.ts +0 -893
  143. package/dist/lib/ProductsWidget.js +0 -2
  144. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/index.js +0 -1
  145. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/lib/CustomersWidget/CustomersWidget.js +0 -41
  146. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/lib/analytics/events.js +0 -3
  147. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/scenarios.js +0 -2
  148. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useUtcDayStart.js +0 -15
@@ -5,13 +5,13 @@ import { AN_ENTITY_BANK_ACCOUNT as i, AN_OVERDUE_REMINDER as a, A_FILE as o, A_P
5
5
  import { RECEIVABLES_LABELS as f } from "./labels.js";
6
6
  import { SCENARIO_LABELS as p } from "../../../../shared/data-access-mocks/dist/mocks/scenarios/labels.js";
7
7
  import { EMBEDDED_PAGING as m, FINOPS as h, PROXY as g, bodyOf as _, endpoint as v, initRoute as y, json as b, noContent as x, problem as S } from "../../../../shared/data-access-mocks/dist/mocks/scenarios/scenario.js";
8
- import { MintKind as C, finopsOffsetPage as w, listOverride as ee, minter as T, notFound as E } from "../../../../shared/data-access-mocks/dist/mocks/scenarios/worlds.js";
9
- import { CUSTOMERS as D, CUSTOMER_ADDRESSES as te, CUSTOMER_INVOICES as O, billTo as ne, customerRoutes as re, customerWorld as ie, filterInvoices as ae, id as k, invoice as A, lineItem as j } from "../../../../counterparts-widget/feature/dist/mocks/counterparts.js";
8
+ import { MintKind as C, finopsOffsetPage as w, listOverride as ee, minter as te, notFound as T } from "../../../../shared/data-access-mocks/dist/mocks/scenarios/worlds.js";
9
+ import { CUSTOMERS as E, CUSTOMER_ADDRESSES as ne, CUSTOMER_INVOICES as D, billTo as re, customerRoutes as ie, customerWorld as ae, filterInvoices as oe, id as O, invoice as k, lineItem as A } from "../../../../counterparts-widget/feature/dist/mocks/counterparts.js";
10
10
  import "../../../../counterparts-widget/feature/dist/scenarios.js";
11
- import { productRoutes as oe, productWorld as se } from "../../../../products-widget/feature/dist/mocks/products.js";
11
+ import { productRoutes as se, productWorld as ce } from "../../../../products-widget/feature/dist/mocks/products.js";
12
12
  import "../../../../products-widget/feature/dist/scenarios.js";
13
13
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/mocks/receivables.js
14
- var M = [
14
+ var j = [
15
15
  e.InvoiceReadOrg,
16
16
  e.InvoiceWriteOrg,
17
17
  e.CounterpartReadOrg,
@@ -22,16 +22,16 @@ var M = [
22
22
  e.BankAccountWriteOrg,
23
23
  e.ExternalBankAccountReadOrg,
24
24
  e.PaymentRecordWriteOrg
25
- ], N = {
25
+ ], M = {
26
26
  ...l,
27
- id: k(350)
28
- }, P = [{
29
- ...N,
30
- id: k(351),
27
+ id: O(350)
28
+ }, N = [{
29
+ ...M,
30
+ id: O(351),
31
31
  name: "Net 15",
32
32
  description: "Payment due 15 days after the issue date.",
33
33
  term_final: { number_of_days: 15 }
34
- }, N], F = [
34
+ }, M], P = [
35
35
  "Copywriting",
36
36
  "Photo retouching",
37
37
  "Event staffing",
@@ -41,8 +41,8 @@ var M = [
41
41
  "Training video",
42
42
  "Signage install"
43
43
  ].map((e, t) => {
44
- let n = D[t % D.length];
45
- return A(352 + t, n, [j(352 + t, e, 4 + t, 8e3, "hour")], {
44
+ let n = E[t % E.length];
45
+ return k(352 + t, n, [A(352 + t, e, 4 + t, 8e3, "hour")], {
46
46
  document_id: `INV-10${String(10 + t)}`,
47
47
  status: "paid",
48
48
  amount_paid: (4 + t) * 8e3,
@@ -50,27 +50,39 @@ var M = [
50
50
  due_date: `2026-04-${String(2 + t * 3).padStart(2, "0")}`,
51
51
  created_at: `2026-03-${String(2 + t * 3).padStart(2, "0")}T09:00:00.000Z`
52
52
  });
53
- }), I = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), L = (e, t) => {
53
+ }), F = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), I = 864e5;
54
+ function L(e) {
55
+ let t = 0;
56
+ return e.map((e) => {
57
+ if (e.status !== "paid") return e;
58
+ let n = t % 3 == 2 ? 45 + t : 2 + t * 5;
59
+ return t += 1, {
60
+ ...e,
61
+ paid_at: (/* @__PURE__ */ new Date(Date.now() - n * I)).toISOString()
62
+ };
63
+ });
64
+ }
65
+ var R = (e, t) => {
54
66
  let n = /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`);
55
67
  return n.setUTCDate(n.getUTCDate() + t), n.toISOString().slice(0, 10);
56
- }, R = 12, z = {
68
+ }, z = 12, B = {
57
69
  month: 1,
58
70
  quarter: 3,
59
71
  year: 12
60
- }, B = {
72
+ }, V = {
61
73
  day: 1,
62
74
  week: 7
63
75
  };
64
- function V(e, t, n) {
65
- let r = /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`), i = z[t];
66
- if (!i) return r.setUTCDate(r.getUTCDate() + (B[t] ?? 1) * n), r.toISOString().slice(0, 10);
76
+ function H(e, t, n) {
77
+ let r = /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`), i = B[t];
78
+ if (!i) return r.setUTCDate(r.getUTCDate() + (V[t] ?? 1) * n), r.toISOString().slice(0, 10);
67
79
  let a = r.getUTCFullYear(), o = r.getUTCMonth() + i * n, s = new Date(Date.UTC(a, o + 1, 0)).getUTCDate();
68
80
  return new Date(Date.UTC(a, o, Math.min(r.getUTCDate(), s))).toISOString().slice(0, 10);
69
81
  }
70
- function H(e) {
71
- let { start_date: t, frequency: n, interval: r, max_occurrences: i, end_date: a } = e, o = i ?? (a ? Infinity : R), s = [];
82
+ function U(e) {
83
+ let { start_date: t, frequency: n, interval: r, max_occurrences: i, end_date: a } = e, o = i ?? (a ? Infinity : z), s = [];
72
84
  for (let e = 0; e < o; e += 1) {
73
- let i = V(t, n, e * r);
85
+ let i = H(t, n, e * r);
74
86
  if (a && i > a) break;
75
87
  s.push({
76
88
  iteration: e + 1,
@@ -81,7 +93,7 @@ function H(e) {
81
93
  }
82
94
  return s;
83
95
  }
84
- function ce(e, t) {
96
+ function le(e, t) {
85
97
  return e.flatMap((e) => {
86
98
  let n = {
87
99
  ...u,
@@ -111,7 +123,7 @@ function ce(e, t) {
111
123
  ];
112
124
  });
113
125
  }
114
- function le(e, t) {
126
+ function ue(e, t) {
115
127
  return e.filter((e) => e.amount_paid > 0).map((e) => {
116
128
  let n = e.paid_at ?? e.updated_at;
117
129
  return {
@@ -133,7 +145,7 @@ function le(e, t) {
133
145
  };
134
146
  });
135
147
  }
136
- function U(e) {
148
+ function W(e) {
137
149
  let t = e.line_items.filter((e) => e.tax_status === "taxable"), n = (e) => e.reduce((e, t) => e + t.total_before_tax, 0), r = n(e.line_items), i = n(t), a = e.discount, o = a ? Math.min(r, a.type === "amount" ? a.amount : Math.round(r * a.amount / 1e4)) : 0, s = i - (r > 0 ? Math.round(i / r * o) : 0), c = t.reduce((e, t) => e + t.total_before_tax * (t.product.tax_rate?.value ?? 0), 0), l = a ? i > 0 ? Math.round(c * s / i / 1e4) : 0 : e.line_items.reduce((e, t) => e + t.total_after_tax - t.total_before_tax, 0), u = r - o + l;
138
150
  return {
139
151
  ...e,
@@ -149,24 +161,24 @@ function U(e) {
149
161
  amount_due: Math.max(0, u - e.amount_paid)
150
162
  };
151
163
  }
152
- function W(e, t, n) {
164
+ function G(e, t, n) {
153
165
  return {
154
- ...j(n ?? e.mint(C.LineItem), t.product?.name ?? "", t.quantity ?? 1, t.product?.price?.value ?? 0, t.product?.measure_unit?.name, t.tax_rate_value ?? 0),
166
+ ...A(n ?? e.mint(C.LineItem), t.product?.name ?? "", t.quantity ?? 1, t.product?.price?.value ?? 0, t.product?.measure_unit?.name, t.tax_rate_value ?? 0),
155
167
  ...t.tax_status ? { tax_status: t.tax_status } : {},
156
168
  ...t.discount ? { discount: t.discount } : {}
157
169
  };
158
170
  }
159
- function G(e) {
160
- let t = P.find((t) => t.id === e.payment_terms_id);
171
+ function K(e) {
172
+ let t = N.find((t) => t.id === e.payment_terms_id);
161
173
  if (t) return t;
162
174
  if (e.payment_terms?.term_final) return { term_final: e.payment_terms.term_final };
163
175
  if (e.payment_terms_id === null || e.payment_terms === null) return null;
164
176
  }
165
- function K(e, t) {
166
- let n = G(e)?.term_final;
167
- return n?.end_date ? n.end_date : n?.number_of_days !== void 0 && n.number_of_days !== null ? L(t, n.number_of_days) : e.due_date ?? null;
168
- }
169
177
  function q(e, t) {
178
+ let n = K(e)?.term_final;
179
+ return n?.end_date ? n.end_date : n?.number_of_days !== void 0 && n.number_of_days !== null ? R(t, n.number_of_days) : e.due_date ?? null;
180
+ }
181
+ function J(e, t) {
170
182
  return (t ?? []).flatMap((t) => {
171
183
  let n = e.files.find((e) => e.id === t.id);
172
184
  return n ? [{
@@ -175,34 +187,38 @@ function q(e, t) {
175
187
  }] : [];
176
188
  });
177
189
  }
178
- var J = `${h}/receivables`, ue = `${h}/analytics/receivables`, Y = {
190
+ var Y = `${h}/receivables`, de = `${h}/analytics/receivables`, X = {
179
191
  issue: "The customer has no billing address on file.",
180
192
  send: "The mail server rejected the message.",
181
193
  payment: "The payment date falls in a closed accounting period.",
182
194
  cancel: "The invoice has a payment in progress."
183
195
  };
184
- function de() {
196
+ function fe() {
185
197
  let e = (e) => () => S(422, "Unprocessable Entity", e);
186
198
  return [
187
- v("POST", `${J}/:id/issue`, e(Y.issue)),
188
- v("POST", `${J}/:id/send`, e(Y.send)),
189
- v("POST", `${h}/payment-records`, e(Y.payment)),
190
- v("POST", `${J}/:id/cancel`, e(Y.cancel))
199
+ v("POST", `${Y}/:id/issue`, e(X.issue)),
200
+ v("POST", `${Y}/:id/send`, e(X.send)),
201
+ v("POST", `${h}/payment-records`, e(X.payment)),
202
+ v("POST", `${Y}/:id/cancel`, e(X.cancel))
191
203
  ];
192
204
  }
193
- function fe(e, t) {
205
+ function pe(e, t) {
194
206
  let n = t.get("type"), r = t.getAll("status__in"), i = t.get("aggregation_function") === "count", a = t.get("metric") === "amount_due" ? "amount_due" : "total_amount", o = /* @__PURE__ */ new Map();
195
- for (let t of e) {
196
- if (n && t.type !== n || r.length && !r.includes(t.status)) continue;
197
- let e = i ? 1 : t[a] ?? 0;
198
- o.set(t.status, (o.get(t.status) ?? 0) + e);
207
+ for (let s of e) {
208
+ if (n && s.type !== n || r.length && !r.includes(s.status)) continue;
209
+ let e = s.paid_at ?? "", c = t.get("paid_at__gte");
210
+ if (c && (!e || e < c)) continue;
211
+ let l = t.get("paid_at__lte");
212
+ if (l && (!e || e > l)) continue;
213
+ let u = i ? 1 : s[a] ?? 0;
214
+ o.set(s.status, (o.get(s.status) ?? 0) + u);
199
215
  }
200
216
  return { data: [...o].map(([e, t]) => ({
201
217
  dimension_value: e,
202
218
  metric_value: t
203
219
  })) };
204
220
  }
205
- function X(e) {
221
+ function Z(e) {
206
222
  let t = _(e);
207
223
  return {
208
224
  paid_at: t.paid_at ?? (/* @__PURE__ */ new Date()).toISOString(),
@@ -210,66 +226,66 @@ function X(e) {
210
226
  ...t.is_external == null ? {} : { is_external: t.is_external }
211
227
  };
212
228
  }
213
- function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
214
- let y = T(), k = {
229
+ function me({ invoices: e = L(D), customers: l = E, list: f, writes: p }) {
230
+ let y = te(), O = {
215
231
  invoices: [...e],
216
- history: ce(e, y),
232
+ history: le(e, y),
217
233
  mails: e.some((e) => e.id === n.id) ? [{
218
234
  receivable_id: n.id,
219
235
  mail: d
220
236
  }] : [],
221
237
  bankDetails: [i],
222
238
  files: [],
223
- paymentRecords: le(e, y),
239
+ paymentRecords: ue(e, y),
224
240
  recurrences: [],
225
241
  paymentReminders: [c],
226
242
  overdueReminders: [a],
227
243
  mint: y,
228
244
  nextNumber: 1050
229
- }, j = ie(l, te.filter((e) => l.some((t) => t.id === e.counterpart_id)), () => k.invoices, y), M = se(void 0, void 0, y), N = (e) => k.invoices.find((t) => t.id === e), F = (e) => (k.invoices = k.invoices.map((t) => t.id === e.id ? e : t), e), R = (e, t, n) => k.history.push({
245
+ }, A = ae(l, ne.filter((e) => l.some((t) => t.id === e.counterpart_id)), () => O.invoices, y), j = ce(void 0, void 0, y), M = (e) => O.invoices.find((t) => t.id === e), P = (e) => (O.invoices = O.invoices.map((t) => t.id === e.id ? e : t), e), I = (e, t, n) => O.history.push({
230
246
  ...u,
231
247
  id: y(C.HistoryEvent),
232
248
  receivable_id: e.id,
233
249
  event_type: t,
234
250
  event_data: n,
235
251
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
236
- }), z = (e, t) => (R(e, "status_changed", {
252
+ }), z = (e, t) => (I(e, "status_changed", {
237
253
  old_status: e.status,
238
254
  new_status: t
239
- }), F({
255
+ }), P({
240
256
  ...e,
241
257
  status: t,
242
258
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
243
259
  })), B = (e, t, n) => {
244
- let r = Math.min(e.total_amount ?? 0, e.amount_paid + t), i = U({
260
+ let r = Math.min(e.total_amount ?? 0, e.amount_paid + t), i = W({
245
261
  ...e,
246
262
  amount_paid: r
247
263
  });
248
- R(e, "payment_received", {
264
+ I(e, "payment_received", {
249
265
  amount_paid: t,
250
266
  amount_due: i.amount_due,
251
267
  ...n
252
268
  });
253
269
  let a = i.amount_due === 0;
254
- return F({
270
+ return P({
255
271
  ...z(e, a ? "paid" : "partially_paid"),
256
272
  amount_paid: i.amount_paid,
257
273
  amount_due: i.amount_due,
258
274
  ...a ? { paid_at: n.paid_at } : {}
259
275
  });
260
- }, V = (e) => (k.recurrences = k.recurrences.map((t) => t.id === e.id ? e : t), b(e)), Y = (e, t, n) => v(e, `${h}/recurrences/:id${t}`, (e, { id: t }) => {
261
- let r = k.recurrences.find((e) => e.id === t);
262
- return r ? n(r, e) : E();
263
- }), Z = (e, t, n) => v(e, `${J}/:id${t}`, (e, { id: t }) => {
264
- let r = N(t);
265
- return r ? n(r, e) : E();
276
+ }, V = (e) => (O.recurrences = O.recurrences.map((t) => t.id === e.id ? e : t), b(e)), H = (e, t, n) => v(e, `${h}/recurrences/:id${t}`, (e, { id: t }) => {
277
+ let r = O.recurrences.find((e) => e.id === t);
278
+ return r ? n(r, e) : T();
279
+ }), X = (e, t, n) => v(e, `${Y}/:id${t}`, (e, { id: t }) => {
280
+ let r = M(t);
281
+ return r ? n(r, e) : T();
266
282
  });
267
283
  return [
268
- ...f ? [ee(f, J, () => k.invoices)] : [],
269
- ...p === "failing" ? de() : [],
270
- v("GET", `${h}/payment-terms`, () => b({ data: P })),
284
+ ...f ? [ee(f, Y, () => O.invoices)] : [],
285
+ ...p === "failing" ? fe() : [],
286
+ v("GET", `${h}/payment-terms`, () => b({ data: N })),
271
287
  v("GET", `${h}/bank-details`, () => b({
272
- data: k.bankDetails,
288
+ data: O.bankDetails,
273
289
  next_pagination_token: null
274
290
  })),
275
291
  v("POST", `${h}/bank-details`, (e) => {
@@ -282,9 +298,9 @@ function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
282
298
  display_name: t.display_name ?? null,
283
299
  routing_number: t.routing_number ?? null
284
300
  };
285
- return k.bankDetails.push(n), b(n, 201);
301
+ return O.bankDetails.push(n), b(n, 201);
286
302
  }),
287
- v("GET", `${h}/payment-reminders`, () => b({ data: k.paymentReminders })),
303
+ v("GET", `${h}/payment-reminders`, () => b({ data: O.paymentReminders })),
288
304
  v("POST", `${h}/payment-reminders`, (e) => {
289
305
  let t = _(e), n = (/* @__PURE__ */ new Date()).toISOString(), r = {
290
306
  ...c,
@@ -297,9 +313,9 @@ function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
297
313
  term_2_reminder: t.term_2_reminder ?? null,
298
314
  term_final_reminder: t.term_final_reminder ?? null
299
315
  };
300
- return k.paymentReminders.push(r), b(r, 201);
316
+ return O.paymentReminders.push(r), b(r, 201);
301
317
  }),
302
- v("GET", `${h}/overdue-reminders`, () => b({ data: k.overdueReminders })),
318
+ v("GET", `${h}/overdue-reminders`, () => b({ data: O.overdueReminders })),
303
319
  v("POST", `${h}/overdue-reminders`, (e) => {
304
320
  let t = _(e), n = (/* @__PURE__ */ new Date()).toISOString(), r = {
305
321
  ...a,
@@ -310,7 +326,7 @@ function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
310
326
  recipients: t.recipients ?? null,
311
327
  terms: t.terms ?? null
312
328
  };
313
- return k.overdueReminders.push(r), b(r, 201);
329
+ return O.overdueReminders.push(r), b(r, 201);
314
330
  }),
315
331
  v("GET", `${g}/bank-accounts`, () => b({
316
332
  data: [r],
@@ -320,110 +336,110 @@ function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
320
336
  data: [t],
321
337
  [m.next]: null
322
338
  })),
323
- v("GET", J, ({ query: e }) => b(w(ae(k.invoices, e), e))),
324
- v("POST", J, (e) => {
325
- let t = _(e), n = j.customers.find((e) => e.id === t.counterpart_id);
339
+ v("GET", Y, ({ query: e }) => b(w(oe(O.invoices, e), e))),
340
+ v("POST", Y, (e) => {
341
+ let t = _(e), n = A.customers.find((e) => e.id === t.counterpart_id);
326
342
  if (!n) return S(422, "Unprocessable Entity", "Unknown customer.");
327
- let r = (/* @__PURE__ */ new Date()).toISOString(), i = U(A(y(C.Invoice), n, (t.line_items ?? []).map((e) => W(k, e)), {
343
+ let r = (/* @__PURE__ */ new Date()).toISOString(), i = W(k(y(C.Invoice), n, (t.line_items ?? []).map((e) => G(O, e)), {
328
344
  document_id: null,
329
345
  status: "draft",
330
346
  currency: t.currency ?? "USD",
331
347
  issue_date: null,
332
- due_date: K(t, I()),
348
+ due_date: q(t, F()),
333
349
  memo: t.memo || null,
334
350
  footer: t.footer || null,
335
- payment_terms: G(t) ?? null,
351
+ payment_terms: K(t) ?? null,
336
352
  discount: t.discount ?? null,
337
353
  bank_account_id: t.bank_account_id ?? null,
338
354
  bank_account_type: t.bank_account_type ?? null,
339
355
  payment_reminder_id: t.payment_reminder_id ?? null,
340
356
  overdue_reminder_id: t.overdue_reminder_id ?? null,
341
- attachments: q(k, t.attachments),
357
+ attachments: J(O, t.attachments),
342
358
  created_at: r,
343
359
  updated_at: r
344
360
  }));
345
- return k.invoices.unshift(i), R(i, "receivable_created", {
361
+ return O.invoices.unshift(i), I(i, "receivable_created", {
346
362
  source: "manual",
347
363
  status: "draft"
348
364
  }), b(i, 201);
349
365
  }),
350
- Z("GET", "", (e) => b(e)),
351
- Z("PATCH", "", (e, t) => {
352
- let { line_items: n, ...r } = _(t).invoice ?? {}, i = j.customers.find((t) => t.id === (r.counterpart_id ?? e.counterpart_id)), a = new Set(n?.remove ?? []), o = [...e.line_items.filter((e) => !a.has(e.id)).map((e) => {
366
+ X("GET", "", (e) => b(e)),
367
+ X("PATCH", "", (e, t) => {
368
+ let { line_items: n, ...r } = _(t).invoice ?? {}, i = A.customers.find((t) => t.id === (r.counterpart_id ?? e.counterpart_id)), a = new Set(n?.remove ?? []), o = [...e.line_items.filter((e) => !a.has(e.id)).map((e) => {
353
369
  let t = n?.replace?.find((t) => t.id === e.id);
354
- return t ? W(k, t.data, e.id) : e;
355
- }), ...(n?.add ?? []).map((e) => W(k, e))];
356
- R(e, "receivable_updated", {});
370
+ return t ? G(O, t.data, e.id) : e;
371
+ }), ...(n?.add ?? []).map((e) => G(O, e))];
372
+ I(e, "receivable_updated", {});
357
373
  let s = r.issue_date ?? e.issue_date;
358
- return b(F(U({
374
+ return b(P(W({
359
375
  ...e,
360
- ...i ? ne(i) : {},
376
+ ...i ? re(i) : {},
361
377
  currency: r.currency ?? e.currency,
362
378
  issue_date: s,
363
379
  memo: r.memo ?? e.memo,
364
380
  ..."discount" in r ? { discount: r.discount ?? null } : {},
365
381
  footer: r.footer ?? e.footer,
366
- due_date: K(r, s ?? I()) ?? e.due_date,
367
- payment_terms: G(r) === void 0 ? e.payment_terms : G(r),
382
+ due_date: q(r, s ?? F()) ?? e.due_date,
383
+ payment_terms: K(r) === void 0 ? e.payment_terms : K(r),
368
384
  ...r.bank_account_id === void 0 ? {} : {
369
385
  bank_account_id: r.bank_account_id,
370
386
  bank_account_type: r.bank_account_type ?? null
371
387
  },
372
388
  ...r.payment_reminder_id === void 0 ? {} : { payment_reminder_id: r.payment_reminder_id },
373
389
  ...r.overdue_reminder_id === void 0 ? {} : { overdue_reminder_id: r.overdue_reminder_id },
374
- ...r.attachments === void 0 ? {} : { attachments: q(k, r.attachments) },
390
+ ...r.attachments === void 0 ? {} : { attachments: J(O, r.attachments) },
375
391
  line_items: o,
376
392
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
377
393
  })));
378
394
  }),
379
- v("DELETE", `${J}/:id`, (e, { id: t }) => (k.invoices = k.invoices.filter((e) => e.id !== t), x())),
380
- v("GET", `${J}/:id/history`, ({ query: e }, { id: t }) => b(w(k.history.filter((e) => e.receivable_id === t).sort((e, t) => t.timestamp.localeCompare(e.timestamp)), e))),
381
- v("GET", `${J}/:id/mails`, ({ query: e }, { id: t }) => b(w(k.mails.filter((e) => e.receivable_id === t).map((e) => e.mail), e))),
382
- v("GET", `${J}/:id/pdf-link`, () => b({
395
+ v("DELETE", `${Y}/:id`, (e, { id: t }) => (O.invoices = O.invoices.filter((e) => e.id !== t), x())),
396
+ v("GET", `${Y}/:id/history`, ({ query: e }, { id: t }) => b(w(O.history.filter((e) => e.receivable_id === t).sort((e, t) => t.timestamp.localeCompare(e.timestamp)), e))),
397
+ v("GET", `${Y}/:id/mails`, ({ query: e }, { id: t }) => b(w(O.mails.filter((e) => e.receivable_id === t).map((e) => e.mail), e))),
398
+ v("GET", `${Y}/:id/pdf-link`, () => b({
383
399
  file_url: null,
384
400
  original_file_url: null
385
401
  })),
386
- Z("POST", "/issue", (e) => {
387
- let t = z(e, "issued"), n = e.issue_date ?? I();
388
- return b(F({
402
+ X("POST", "/issue", (e) => {
403
+ let t = z(e, "issued"), n = e.issue_date ?? F();
404
+ return b(P({
389
405
  ...t,
390
- document_id: `INV-${k.nextNumber++}`,
406
+ document_id: `INV-${O.nextNumber++}`,
391
407
  issue_date: n,
392
- due_date: e.due_date ?? L(n, 30)
408
+ due_date: e.due_date ?? R(n, 30)
393
409
  }));
394
410
  }),
395
- Z("POST", "/cancel", (e) => b(z(e, "canceled"))),
396
- Z("POST", "/mark-as-uncollectible", (e, t) => {
411
+ X("POST", "/cancel", (e) => b(z(e, "canceled"))),
412
+ X("POST", "/mark-as-uncollectible", (e, t) => {
397
413
  let { comment: n } = _(t);
398
414
  return b(z(n ? {
399
415
  ...e,
400
416
  comment: n
401
417
  } : e, "uncollectible"));
402
418
  }),
403
- Z("POST", "/mark-as-paid", (e, t) => {
404
- let n = X(t), r = e.total_amount ?? 0;
405
- R(e, "payment_received", {
419
+ X("POST", "/mark-as-paid", (e, t) => {
420
+ let n = Z(t), r = e.total_amount ?? 0;
421
+ I(e, "payment_received", {
406
422
  amount_paid: r - e.amount_paid,
407
423
  amount_due: 0,
408
424
  ...n
409
425
  });
410
426
  let i = z(e, "paid");
411
- return b(F({
427
+ return b(P({
412
428
  ...i,
413
429
  amount_paid: r,
414
430
  amount_due: 0,
415
431
  paid_at: n.paid_at
416
432
  }));
417
433
  }),
418
- Z("POST", "/mark-as-partially-paid", (e, t) => {
434
+ X("POST", "/mark-as-partially-paid", (e, t) => {
419
435
  let n = _(t).amount_paid ?? 0;
420
- return b(B(e, n, X(t)));
436
+ return b(B(e, n, Z(t)));
421
437
  }),
422
- v("GET", `${h}/payment-records`, ({ query: e }) => b(w(k.paymentRecords.filter((t) => t.object.id === e.get("object_id")), e))),
438
+ v("GET", `${h}/payment-records`, ({ query: e }) => b(w(O.paymentRecords.filter((t) => t.object.id === e.get("object_id")), e))),
423
439
  v("POST", `${h}/payment-records`, (e) => {
424
- let t = _(e), n = N(t.object?.id ?? "");
425
- if (!n) return E();
426
- let r = X(e), i = B(n, t.amount ?? 0, r), a = {
440
+ let t = _(e), n = M(t.object?.id ?? "");
441
+ if (!n) return T();
442
+ let r = Z(e), i = B(n, t.amount ?? 0, r), a = {
427
443
  ...s,
428
444
  id: y(C.PaymentRecord),
429
445
  amount: t.amount ?? 0,
@@ -441,9 +457,9 @@ function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
441
457
  new_status: i.status
442
458
  }
443
459
  };
444
- return k.paymentRecords.push(a), b(a, 201);
460
+ return O.paymentRecords.push(a), b(a, 201);
445
461
  }),
446
- Z("POST", "/clone", (e) => {
462
+ X("POST", "/clone", (e) => {
447
463
  let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
448
464
  ...e,
449
465
  id: y(C.Invoice),
@@ -456,12 +472,12 @@ function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
456
472
  created_at: t,
457
473
  updated_at: t
458
474
  };
459
- return k.invoices.unshift(n), R(n, "receivable_created", {
475
+ return O.invoices.unshift(n), I(n, "receivable_created", {
460
476
  source: "based_on",
461
477
  status: "draft"
462
478
  }), b(n, 201);
463
479
  }),
464
- Z("POST", "/send", (e, t) => {
480
+ X("POST", "/send", (e, t) => {
465
481
  let n = _(t), r = (/* @__PURE__ */ new Date()).toISOString(), i = {
466
482
  ...d,
467
483
  id: y(C.Mail),
@@ -472,20 +488,20 @@ function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
472
488
  is_success: !0
473
489
  })) }
474
490
  };
475
- return k.mails.push({
491
+ return O.mails.push({
476
492
  receivable_id: e.id,
477
493
  mail: i
478
- }), R(e, "mail_sent", {
494
+ }), I(e, "mail_sent", {
479
495
  mail_id: i.id,
480
496
  mail_status: "sent"
481
497
  }), b({ mail_id: i.id });
482
498
  }),
483
- v("GET", `${h}/recurrences`, () => b({ data: k.recurrences })),
499
+ v("GET", `${h}/recurrences`, () => b({ data: O.recurrences })),
484
500
  v("POST", `${h}/recurrences`, (e) => {
485
- let t = _(e), n = N(t.invoice_id ?? "");
486
- if (!n) return E();
501
+ let t = _(e), n = M(t.invoice_id ?? "");
502
+ if (!n) return T();
487
503
  let r = (/* @__PURE__ */ new Date()).toISOString(), i = {
488
- start_date: t.start_date ?? I(),
504
+ start_date: t.start_date ?? F(),
489
505
  frequency: t.frequency ?? "month",
490
506
  interval: t.interval ?? 1,
491
507
  max_occurrences: t.max_occurrences ?? null,
@@ -502,15 +518,15 @@ function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
502
518
  recipients: t.recipients ?? null,
503
519
  current_iteration: 0,
504
520
  status: "active",
505
- iterations: H(i)
521
+ iterations: U(i)
506
522
  };
507
- return k.recurrences.push(a), F({
523
+ return O.recurrences.push(a), P({
508
524
  ...z(n, "recurring"),
509
525
  recurrence_id: a.id
510
526
  }), b(a);
511
527
  }),
512
- Y("GET", "", (e) => b(e)),
513
- Y("PATCH", "", (e, t) => {
528
+ H("GET", "", (e) => b(e)),
529
+ H("PATCH", "", (e, t) => {
514
530
  let n = {
515
531
  ...e,
516
532
  ..._(t),
@@ -518,18 +534,18 @@ function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
518
534
  };
519
535
  return V({
520
536
  ...n,
521
- iterations: H(n)
537
+ iterations: U(n)
522
538
  });
523
539
  }),
524
- Y("POST", "/pause", (e) => V({
540
+ H("POST", "/pause", (e) => V({
525
541
  ...e,
526
542
  status: "paused"
527
543
  })),
528
- Y("POST", "/resume", (e) => V({
544
+ H("POST", "/resume", (e) => V({
529
545
  ...e,
530
546
  status: "active"
531
547
  })),
532
- Y("POST", "/cancel", (e) => V({
548
+ H("POST", "/cancel", (e) => V({
533
549
  ...e,
534
550
  status: "canceled",
535
551
  iterations: e.iterations.map((e) => e.status === "pending" ? {
@@ -545,7 +561,7 @@ function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
545
561
  mimetype: t?.type || "application/octet-stream",
546
562
  url: `https://example.com/attachments/${encodeURIComponent(t?.name ?? "attachment")}`
547
563
  };
548
- return k.files.push(n), b({
564
+ return O.files.push(n), b({
549
565
  ...o,
550
566
  ...n,
551
567
  file_type: "attachments"
@@ -553,37 +569,37 @@ function Z({ invoices: e = O, customers: l = D, list: f, writes: p }) {
553
569
  }),
554
570
  v("GET", `${h}/files`, ({ query: e }) => {
555
571
  let t = e.getAll("id__in");
556
- return b({ data: k.files.filter((e) => t.includes(e.id)).map((e) => ({
572
+ return b({ data: O.files.filter((e) => t.includes(e.id)).map((e) => ({
557
573
  ...o,
558
574
  ...e
559
575
  })) });
560
576
  }),
561
- v("DELETE", `${h}/files/:id`, (e, { id: t }) => (k.files = k.files.filter((e) => e.id !== t), x())),
562
- (e) => e.method === "GET" && e.path === ue && e.query.get("dimension") === "status" ? b(fe(k.invoices, e.query)) : void 0,
563
- ...re(j),
564
- ...oe(M)
577
+ v("DELETE", `${h}/files/:id`, (e, { id: t }) => (O.files = O.files.filter((e) => e.id !== t), x())),
578
+ (e) => e.method === "GET" && e.path === de && e.query.get("dimension") === "status" ? b(pe(O.invoices, e.query)) : void 0,
579
+ ...ie(A),
580
+ ...se(j)
565
581
  ];
566
582
  }
567
583
  function Q(e, t, n = {}) {
568
584
  return {
569
585
  key: e,
570
586
  ...t,
571
- routes: () => [y(M), ...Z(n)]
587
+ routes: () => [y(j), ...me(n)]
572
588
  };
573
589
  }
574
590
  var $ = (e, t = {}) => Q(e, {
575
591
  label: p[e].label,
576
592
  blurb: f.blurbs[e]
577
- }, t), pe = [
593
+ }, t), he = [
578
594
  $("populated"),
579
595
  $("empty", { invoices: [] }),
580
596
  $("loading", { list: "held" }),
581
597
  $("error", { list: "failing" }),
582
- $("paginated", { invoices: [...O, ...F] }),
598
+ $("paginated", { invoices: L([...D, ...P]) }),
583
599
  Q("no-customers", f.scenarios["no-customers"], {
584
600
  invoices: [],
585
601
  customers: []
586
602
  }),
587
603
  Q("writes-failing", f.scenarios["writes-failing"], { writes: "failing" })
588
604
  ];
589
- export { Y as REFUSED_WRITE_REASONS, pe as receivablesScenarios };
605
+ export { X as REFUSED_WRITE_REASONS, he as receivablesScenarios };