@tesouro/embedded-components-react 0.5.233 → 0.5.236

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 (87) hide show
  1. package/README.md +19 -14
  2. package/dist/index.d.ts +175 -16
  3. package/dist/index.js +1 -1
  4. package/dist/lib/BankAccountOnboardingWidget.d.ts +39 -1
  5. package/dist/lib/ReceivablesWidget.d.ts +110 -1
  6. package/dist/lib/ReceivablesWidget.js +1 -1
  7. package/dist/lib/WidgetSuite.d.ts +65 -15
  8. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +3 -2
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +2 -1
  10. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js +6 -0
  11. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index23.js +15 -11
  12. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index26.js +441 -409
  13. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index10.js +18 -14
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +1 -1
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +3 -3
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +1 -1
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +1 -1
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js +210 -208
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js +98 -40
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index33.js +159 -39
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index34.js +53 -77
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index35.js +99 -132
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index36.js +40 -341
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index37.js +43 -0
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index38.js +92 -0
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index39.js +146 -0
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index40.js +354 -0
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +1 -1
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +28 -24
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +2 -37
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +9 -214
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +27 -159
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +233 -14
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +34 -22
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +214 -2
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +153 -87
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +16 -3
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +22 -21
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +2 -51
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +30 -15
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +90 -14
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +3 -10
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +20 -69
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +51 -33
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +16 -17
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +8 -14
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +70 -30
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +33 -14
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +17 -25
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +12 -83
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +9 -121
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +28 -401
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +16 -2
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +22 -42
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +80 -65
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +383 -473
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +2 -106
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +48 -0
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +72 -2
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +498 -4
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +106 -1
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +141 -93
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +2 -28
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +4 -236
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +0 -2
  70. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +90 -239
  71. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +24 -89
  72. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +231 -54
  73. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +3 -353
  74. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +249 -0
  75. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +93 -0
  76. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +3 -40
  77. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +59 -0
  78. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +353 -0
  79. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +18 -2
  80. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +121 -9
  81. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +100 -27
  82. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +38 -233
  83. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  84. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index16.js +123 -92
  85. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +12 -5
  86. package/package.json +1 -1
  87. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +0 -100
@@ -10,7 +10,7 @@ import { getCounterpartEmail as r } from "../../../shared/counterpart-management
10
10
  import { useCounterpartAddressesQuery as i } from "../../../shared/counterpart-management/data-access/dist/index7.js";
11
11
  import { useCounterpartForm as a } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
12
12
  import "../../../shared/counterpart-management/feature/dist/index.js";
13
- import "../../ui/dist/index15.js";
13
+ import "../../ui/dist/index19.js";
14
14
  import "../../ui/dist/index.js";
15
15
  import { buildLineItemControls as o, commitLineItemField as s, commitTaxRateInput as c, convertPriceInput as l, createLineItem as u, getCurrencySymbol as ee, lineItemFromProduct as te, reconcileLineItemIds as ne, reconcileMeasureUnits as re, sanitizeLineItemPatch as ie, sanitizeTaxRateInput as ae, stepLineItemQuantity as oe, stripBlankLineItems as se, summarizeLineItemErrors as ce, toSheetLineItem as le, validateLineItems as ue } from "./index6.js";
16
16
  import { buildReceivableAttachmentsView as de } from "./index7.js";
@@ -38,32 +38,32 @@ import { useReceivablePreview as rt } from "./index30.js";
38
38
  import { useCallback as f, useEffect as p, useMemo as m, useRef as h, useState as g } from "react";
39
39
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js
40
40
  function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, onCreated: ot }) {
41
- let st = Ve(), ct = Ue(), lt = We(), ut = Ke(), dt = He(), v = h("draft"), ft = h(!1), y = h(!1), b = h(!1), pt = h(null), x = h(void 0), S = h([]), mt = h(""), [C, w] = g(!1), [T, ht] = g("create"), [gt, _t] = g(), [vt, yt] = g(), [E, D] = g(() => je()), [bt, O] = g({}), [xt, St] = g("none"), Ct = me(), k = pe(), A = k.data?.data, { unitNamesById: j } = Ct, [wt, Tt] = g(), [M, Et] = g(!1), Dt = h(!1), N = h(!1), P = h(!1), F = h({
41
+ let st = Ve(), ct = Ue(), lt = We(), ut = Ke(), dt = He(), v = h("draft"), ft = h(!1), [pt, mt] = g(), y = h(!1), b = h(!1), ht = h(null), x = h(void 0), S = h([]), gt = h(""), [C, w] = g(!1), [T, _t] = g("create"), [vt, yt] = g(), [bt, xt] = g(), [E, D] = g(() => je()), [St, O] = g({}), [Ct, wt] = g("none"), Tt = me(), k = pe(), A = k.data?.data, { unitNamesById: j } = Tt, [Et, Dt] = g(), [M, Ot] = g(!1), kt = h(!1), N = h(!1), P = h(!1), F = h({
42
42
  lines: !1,
43
43
  discount: !1
44
- }), [Ot, I] = g(!1), kt = m(() => t(), []), At = m(() => ({
44
+ }), [At, I] = g(!1), jt = m(() => t(), []), Mt = m(() => ({
45
45
  ...n,
46
46
  ...it
47
- }), [it]), L = i(E.customerId), jt = L.data?.data?.[0], R = L.data?.data?.[0]?.id, Mt = !!E.customerId && (L.isLoading || L.isFetching), z = qe({
47
+ }), [it]), Nt = i(E.customerId), Pt = Nt.data?.data?.[0], L = Nt.data?.data?.[0]?.id, Ft = !!E.customerId && Nt.isLoading, R = qe({
48
48
  counterpartId: E.customerId,
49
- billingAddressId: R,
50
- billingCountry: jt?.country
51
- }), Nt = z.isLoading || Mt, Pt = f((e) => {
49
+ billingAddressId: L,
50
+ billingCountry: Pt?.country
51
+ }), It = R.isLoading || Ft, Lt = f((e) => {
52
52
  D((t) => ({
53
53
  ...t,
54
54
  attachments: e(t.attachments)
55
55
  }));
56
- }, []), B = Qe({
56
+ }, []), z = Qe({
57
57
  attachments: E.attachments,
58
- setAttachments: Pt,
59
- receivableId: gt
60
- }), { reset: V, discardUploads: Ft, commitRemovals: It } = B, Lt = E.type === "invoice" ? de({
58
+ setAttachments: Lt,
59
+ receivableId: vt
60
+ }), { reset: B, discardUploads: Rt, commitRemovals: zt } = z, Bt = E.type === "invoice" ? de({
61
61
  attachments: E.attachments,
62
- pendingUploads: B.pendingUploads,
63
- isCountLimitReached: B.isCountLimitReached,
62
+ pendingUploads: z.pendingUploads,
63
+ isCountLimitReached: z.isCountLimitReached,
64
64
  isRecurring: d(E),
65
65
  messages: _
66
- }) : void 0, Rt = f((e) => {
66
+ }) : void 0, Vt = f((e) => {
67
67
  D((t) => {
68
68
  let n = e ?? "";
69
69
  return n === t.customerId ? t : ve({
@@ -71,16 +71,16 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
71
71
  customerId: n
72
72
  });
73
73
  });
74
- }, []), zt = a({
75
- view: xt,
76
- setView: St,
74
+ }, []), Ht = a({
75
+ view: Ct,
76
+ setView: wt,
77
77
  selectedId: E.customerId || void 0,
78
- setSelectedId: Rt,
79
- messages: At,
78
+ setSelectedId: Vt,
79
+ messages: Mt,
80
80
  counterpartType: "customer",
81
81
  counterpart: void 0,
82
- primaryAddress: jt
83
- }), Bt = f((e) => D((t) => {
82
+ primaryAddress: Pt
83
+ }), Ut = f((e) => D((t) => {
84
84
  let n = e({
85
85
  paymentTermsId: t.paymentTermsId,
86
86
  paymentTermsCustomDate: t.paymentTermsCustomDate
@@ -90,47 +90,47 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
90
90
  ...n,
91
91
  ...n.paymentTermsId === "receipt_due" ? { paymentReminderId: "" } : {}
92
92
  };
93
- }), []), Vt = $e({
93
+ }), []), Wt = $e({
94
94
  paymentTermsId: E.paymentTermsId,
95
95
  paymentTermsCustomDate: E.paymentTermsCustomDate,
96
96
  issueDate: E.issueDate,
97
97
  isRecurring: E.type === "invoice" && d(E),
98
98
  messages: _,
99
- onChange: Bt
100
- }), Ht = Vt.reset, Ut = f((e) => D((t) => ({
99
+ onChange: Ut
100
+ }), Gt = Wt.reset, Kt = f((e) => D((t) => ({
101
101
  ...t,
102
102
  ...e
103
- })), []), H = tt({
103
+ })), []), V = tt({
104
104
  open: C,
105
105
  bankAccountId: E.bankAccountId,
106
106
  embeddedBankName: at,
107
107
  messages: _,
108
- onSelect: Ut
109
- }), Wt = H.reset, Gt = Ge(vt), U = vt ? Gt.data : void 0, W = ye(U), Kt = W > 0, G = !!vt && Gt.isLoading, K = h(void 0);
108
+ onSelect: Kt
109
+ }), qt = V.reset, Jt = Ge(bt), H = bt ? Jt.data : void 0, U = ye(H), Yt = U > 0, W = !!bt && Jt.isLoading, G = h(void 0);
110
110
  p(() => {
111
- U && K.current !== U.id && (K.current = U.id, D((e) => ({
111
+ H && G.current !== H.id && (G.current = H.id, D((e) => ({
112
112
  ...e,
113
- ...be(U)
113
+ ...be(H)
114
114
  })));
115
- }, [U]);
116
- let qt = f((e) => D(e), []), Jt = f((e) => O((t) => {
115
+ }, [H]);
116
+ let Xt = f((e) => D(e), []), Zt = f((e) => O((t) => {
117
117
  if (!e.some((e) => e in t)) return t;
118
118
  let n = { ...t };
119
119
  return e.forEach((e) => delete n[e]), n;
120
- }), []), Yt = h([]), Xt = f((e) => {
120
+ }), []), Qt = h([]), $t = f((e) => {
121
121
  if (!M) {
122
- Jt(e);
122
+ Zt(e);
123
123
  return;
124
124
  }
125
- Yt.current.push(...e);
126
- }, [Jt, M]);
125
+ Qt.current.push(...e);
126
+ }, [Zt, M]);
127
127
  p(() => {
128
- let e = Yt.current;
128
+ let e = Qt.current;
129
129
  if (!e.length) return;
130
- Yt.current = [];
130
+ Qt.current = [];
131
131
  let t = xe({
132
132
  fields: E,
133
- issuedCount: W,
133
+ issuedCount: U,
134
134
  messages: _
135
135
  });
136
136
  O((n) => {
@@ -140,66 +140,66 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
140
140
  }), r;
141
141
  });
142
142
  }, [
143
- W,
143
+ U,
144
144
  _,
145
145
  E
146
146
  ]);
147
- let Zt = et({
147
+ let en = et({
148
148
  values: E,
149
- errors: bt,
150
- lockSchedule: Kt,
149
+ errors: St,
150
+ lockSchedule: Yt,
151
151
  messages: _,
152
- onChange: qt,
153
- onClearErrors: Jt,
154
- onRevalidateErrors: Xt
155
- }), q = Zt.reset, Qt = f((e) => D((t) => ({
152
+ onChange: Xt,
153
+ onClearErrors: Zt,
154
+ onRevalidateErrors: $t
155
+ }), K = en.reset, tn = f((e) => D((t) => ({
156
156
  ...t,
157
157
  ...e
158
- })), []), $t = st.isPending || ct.isPending || lt.isPending || ut.isPending || dt.isPending, en = nt({
158
+ })), []), q = st.isPending || ct.isPending || lt.isPending || ut.isPending || dt.isPending, nn = nt({
159
159
  open: C,
160
160
  isInvoice: E.type === "invoice",
161
- disabled: $t,
161
+ disabled: q,
162
162
  paymentTermsId: E.paymentTermsId,
163
163
  paymentTermsCustomDate: E.paymentTermsCustomDate,
164
164
  paymentReminderId: E.paymentReminderId,
165
165
  overdueReminderId: E.overdueReminderId,
166
166
  messages: _,
167
- onSelect: Qt
168
- }), tn = en.reset, nn = f(() => {
169
- S.current = [], Tt(void 0), ht("create"), _t(void 0), yt(void 0), K.current = void 0, x.current = void 0, v.current = "draft", y.current = !1, b.current = !1, D(je()), O({}), Et(!1), I(!1), F.current = {
167
+ onSelect: tn
168
+ }), rn = nn.reset, an = f(() => {
169
+ S.current = [], Dt(void 0), _t("create"), yt(void 0), xt(void 0), G.current = void 0, x.current = void 0, v.current = "draft", y.current = !1, b.current = !1, D(je()), O({}), Ot(!1), I(!1), F.current = {
170
170
  lines: !1,
171
171
  discount: !1
172
- }, V(), q();
173
- }, [V, q]), rn = f((e = "invoice") => {
174
- Ht(), Wt(), q();
172
+ }, B(), K();
173
+ }, [B, K]), on = f((e = "invoice") => {
174
+ Gt(), qt(), K();
175
175
  let t = {
176
176
  ...je(),
177
177
  type: e
178
178
  };
179
- tn(Be(t)), S.current = [], x.current = void 0, v.current = "draft", y.current = !1, b.current = !1, K.current = void 0, Tt(void 0), ht("create"), _t(void 0), yt(void 0), D(t), O({}), V(), Et(!1), I(!1), F.current = {
179
+ rn(Be(t)), S.current = [], x.current = void 0, v.current = "draft", y.current = !1, b.current = !1, G.current = void 0, Dt(void 0), _t("create"), yt(void 0), xt(void 0), D(t), O({}), B(), Ot(!1), I(!1), F.current = {
180
180
  lines: !1,
181
181
  discount: !1
182
182
  }, w(!0);
183
183
  }, [
184
- V,
185
- Ht,
186
- Wt,
187
- q,
188
- tn
189
- ]), an = f((e, { highlightForIssue: t = !1 } = {}) => {
184
+ B,
185
+ Gt,
186
+ qt,
187
+ K,
188
+ rn
189
+ ]), sn = f((e, { highlightForIssue: t = !1 } = {}) => {
190
190
  if (e.type === "credit_note") return;
191
- Ht(), Wt(), q();
191
+ Gt(), qt(), K();
192
192
  let n = Ie(e, A);
193
- tn(Be(n)), S.current = e.line_items, mt.current = e.currency, x.current = void 0, v.current = t ? "issue" : "draft", y.current = !1, b.current = t, K.current = void 0, Tt(void 0), ht("edit"), _t(e.id), yt(e.type === "invoice" ? e.recurrence_id ?? void 0 : void 0), D(n), O({}), Et(!1), I(!1), F.current = {
193
+ rn(Be(n)), S.current = e.line_items, gt.current = e.currency, x.current = void 0, v.current = t ? "issue" : "draft", y.current = !1, b.current = t, G.current = void 0, Dt(void 0), _t("edit"), yt(e.id), xt(e.type === "invoice" ? e.recurrence_id ?? void 0 : void 0), D(n), O({}), Ot(!1), I(!1), F.current = {
194
194
  lines: !1,
195
195
  discount: !1
196
- }, V(), w(!0);
196
+ }, B(), w(!0);
197
197
  }, [
198
- V,
199
- Ht,
200
- Wt,
201
- q,
202
- tn,
198
+ B,
199
+ Gt,
200
+ qt,
201
+ K,
202
+ rn,
203
203
  A
204
204
  ]);
205
205
  p(() => {
@@ -211,11 +211,11 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
211
211
  };
212
212
  });
213
213
  }, [A]);
214
- let on = B.isUploading, sn = f(() => {
215
- on || (Ft(), w(!1), O({}));
216
- }, [Ft, on]), cn = f((e) => {
214
+ let cn = z.isUploading, ln = f(() => {
215
+ cn || (Rt(), w(!1), O({}));
216
+ }, [Rt, cn]), un = f((e) => {
217
217
  let t = { ...e };
218
- t.taxRate !== void 0 && (t.taxRate = ae(t.taxRate), P.current = !0), t.type !== void 0 && t.type !== "invoice" && Ft(), t.type !== void 0 && (v.current = "draft"), t.discount !== void 0 && M && (N.current = !0), t.discountType !== void 0 && (N.current = !0), t.currency !== void 0 && (Dt.current = !0), D((e) => {
218
+ t.taxRate !== void 0 && (t.taxRate = ae(t.taxRate), P.current = !0), t.type !== void 0 && t.type !== "invoice" && Rt(), t.type !== void 0 && (v.current = "draft"), t.discount !== void 0 && M && (N.current = !0), t.discountType !== void 0 && (N.current = !0), t.currency !== void 0 && (kt.current = !0), D((e) => {
219
219
  let n = {
220
220
  ...e,
221
221
  ...t
@@ -229,7 +229,7 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
229
229
  currency: n.currency
230
230
  })), n;
231
231
  });
232
- }, [Ft, M]), ln = f(() => I(!0), []), un = f(() => {
232
+ }, [Rt, M]), dn = f(() => I(!0), []), fn = f(() => {
233
233
  I(!1), N.current = !0, D((e) => ({
234
234
  ...e,
235
235
  discount: Ce({
@@ -238,7 +238,7 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
238
238
  currency: e.currency
239
239
  })
240
240
  }));
241
- }, []), dn = f(() => {
241
+ }, []), pn = f(() => {
242
242
  P.current = !0, D((e) => {
243
243
  let t = c(e.taxRate);
244
244
  return t === e.taxRate ? e : {
@@ -247,16 +247,16 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
247
247
  };
248
248
  });
249
249
  }, []), J = f((e, { validate: t }) => {
250
- t && (Dt.current = !0), D((t) => ({
250
+ t && (kt.current = !0), D((t) => ({
251
251
  ...t,
252
252
  lineItems: e(t.lineItems)
253
253
  }));
254
254
  }, []);
255
255
  p(() => {
256
- let e = Dt.current, t = N.current;
256
+ let e = kt.current, t = N.current;
257
257
  if (!e && !t && !P.current) return;
258
- Dt.current = !1, N.current = !1, P.current = !1, e && (F.current.lines = !0), t && (F.current.discount = !0);
259
- let n = y.current || W > 0, r = e ? ue(E.lineItems, {
258
+ kt.current = !1, N.current = !1, P.current = !1, e && (F.current.lines = !0), t && (F.current.discount = !0);
259
+ let n = y.current || U > 0, r = e ? ue(E.lineItems, {
260
260
  currency: E.currency,
261
261
  messages: _,
262
262
  requireComplete: n
@@ -266,17 +266,17 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
266
266
  return F.current.lines && (i.lineItems = e ? r : t.lineItems, i.lineItemsSummary = ce(i.lineItems, Ae(E, _), n && E.lineItems.length === 0 ? _.lineItemsRequired : void 0)), F.current.discount && (i.discount = ke(E, _)), i;
267
267
  });
268
268
  }, [
269
- W,
269
+ U,
270
270
  _,
271
271
  E
272
272
  ]);
273
- let fn = f((e, t) => {
273
+ let mn = f((e, t) => {
274
274
  let { unit: n, ...r } = t, i = ie(r);
275
275
  i.name !== void 0 && (i.productId = ""), n !== void 0 && (i.measureUnitId = n, i.measureUnitName = ""), i.taxable !== void 0 && (P.current = !0), J((t) => t.map((t) => t.id === e ? {
276
276
  ...t,
277
277
  ...i
278
278
  } : t), { validate: M });
279
- }, [J, M]), pn = f((e, t) => {
279
+ }, [J, M]), hn = f((e, t) => {
280
280
  J((n) => n.map((n) => n.id === e ? {
281
281
  ...n,
282
282
  ...te({
@@ -289,58 +289,58 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
289
289
  J,
290
290
  j,
291
291
  E.currency
292
- ]), mn = f((e, t) => {
292
+ ]), gn = f((e, t) => {
293
293
  t && J((n) => t.kind === "remove" ? n.filter((t) => t.id !== e) : n.map((n) => n.id === e ? {
294
294
  ...n,
295
295
  ...t.patch
296
296
  } : n), { validate: !0 });
297
- }, [J]), hn = f((e, t) => {
297
+ }, [J]), _n = f((e, t) => {
298
298
  let n = E.lineItems.find((t) => t.id === e);
299
- n && mn(e, s({
299
+ n && gn(e, s({
300
300
  lineItem: n,
301
301
  field: t,
302
302
  rowCount: E.lineItems.length,
303
303
  currency: E.currency
304
304
  }));
305
305
  }, [
306
- mn,
306
+ gn,
307
307
  E.currency,
308
308
  E.lineItems
309
- ]), gn = f((e, t) => {
309
+ ]), vn = f((e, t) => {
310
310
  let n = E.lineItems.find((t) => t.id === e);
311
- n && mn(e, oe({
311
+ n && gn(e, oe({
312
312
  lineItem: n,
313
313
  step: t,
314
314
  rowCount: E.lineItems.length
315
315
  }));
316
- }, [mn, E.lineItems]), _n = f(() => {
316
+ }, [gn, E.lineItems]), yn = f(() => {
317
317
  let e = u(E.currency);
318
- Tt(e.id), D((t) => ({
318
+ Dt(e.id), D((t) => ({
319
319
  ...t,
320
320
  lineItems: [...t.lineItems, e]
321
321
  }));
322
- }, [E.currency]), vn = f((e) => {
322
+ }, [E.currency]), bn = f((e) => {
323
323
  J((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e), { validate: !0 });
324
- }, [J]), Y = f((e, t) => e.type === "invoice" && (t === "issue" || Se(e) && W === 0), [W]), yn = f((e, t) => ({
324
+ }, [J]), Y = f((e, t) => e.type === "invoice" && (t === "issue" || Se(e) && U === 0), [U]), xn = f((e, t) => ({
325
325
  ...Re({
326
326
  values: e,
327
- billingAddressId: R,
327
+ billingAddressId: L,
328
328
  messages: _,
329
329
  willIssue: t,
330
- hasStartedRecurrence: W > 0
330
+ hasStartedRecurrence: U > 0
331
331
  }),
332
332
  ...e.type === "invoice" && d(e) ? xe({
333
333
  fields: e,
334
- issuedCount: W,
334
+ issuedCount: U,
335
335
  messages: _
336
336
  }) : {}
337
337
  }), [
338
- R,
339
- W,
338
+ L,
339
+ U,
340
340
  _
341
- ]), bn = f(() => {
341
+ ]), Sn = f(() => {
342
342
  requestAnimationFrame(() => {
343
- let e = pt.current, t = e?.querySelector("[aria-invalid=\"true\"]");
343
+ let e = ht.current, t = e?.querySelector("[aria-invalid=\"true\"], [data-invalid=\"true\"]");
344
344
  if (!e || !t) return;
345
345
  let n = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop;
346
346
  e.scrollTo({
@@ -349,35 +349,35 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
349
349
  });
350
350
  });
351
351
  }, []), X = f((e, t) => {
352
- O(e), Et(!0), y.current = t, F.current = {
352
+ O(e), Ot(!0), y.current = t, F.current = {
353
353
  lines: !0,
354
354
  discount: !0
355
- }, bn();
356
- }, [bn]), xn = !vt || E.frequency !== "once" || Gt.isError;
355
+ }, Sn();
356
+ }, [Sn]), Cn = !bt || E.frequency !== "once" || Jt.isError;
357
357
  p(() => {
358
- if (!C || !b.current || Mt || G || !xn) return;
358
+ if (!C || !b.current || Ft || W || !Cn) return;
359
359
  b.current = !1;
360
360
  let e = Y(E, "issue");
361
- X(yn(E, e), e);
361
+ X(xn(E, e), e);
362
362
  }, [
363
- Mt,
363
+ Ft,
364
364
  C,
365
- xn,
366
- G,
365
+ Cn,
366
+ W,
367
367
  X,
368
- yn,
368
+ xn,
369
369
  E,
370
370
  Y
371
371
  ]);
372
- let Sn = h({
372
+ let wn = h({
373
373
  values: E,
374
- billingAddressId: R
374
+ billingAddressId: L
375
375
  });
376
376
  p(() => {
377
- let e = Sn.current;
378
- if (Sn.current = {
377
+ let e = wn.current;
378
+ if (wn.current = {
379
379
  values: E,
380
- billingAddressId: R
380
+ billingAddressId: L
381
381
  }, !M) return;
382
382
  let t = [
383
383
  "customerId",
@@ -386,11 +386,11 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
386
386
  "openingNote",
387
387
  "closingNote",
388
388
  "taxRate"
389
- ].filter((t) => e.values[t] !== E[t] || t === "customerId" && e.billingAddressId !== R || t === "paymentTermsId" && e.values.paymentTermsCustomDate !== E.paymentTermsCustomDate);
389
+ ].filter((t) => e.values[t] !== E[t] || t === "customerId" && e.billingAddressId !== L || t === "paymentTermsId" && e.values.paymentTermsCustomDate !== E.paymentTermsCustomDate);
390
390
  if (!t.length) return;
391
391
  let n = Re({
392
392
  values: E,
393
- billingAddressId: R,
393
+ billingAddressId: L,
394
394
  messages: _,
395
395
  willIssue: y.current
396
396
  });
@@ -401,14 +401,14 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
401
401
  }), r;
402
402
  });
403
403
  }, [
404
- R,
404
+ L,
405
405
  _,
406
406
  M,
407
407
  E
408
408
  ]);
409
- let Cn = f(async (t) => {
410
- if (v.current = t, G) return;
411
- if (on) {
409
+ let Tn = f(async (t) => {
410
+ if (v.current = t, W) return;
411
+ if (cn) {
412
412
  e.error(_.attachmentsUploading);
413
413
  return;
414
414
  }
@@ -422,37 +422,37 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
422
422
  };
423
423
  i !== E && D(i);
424
424
  let a = i.type === "invoice" && d(i), o = Y(i, t);
425
- if (o && (Nt || H.isLoading)) {
425
+ if (o && (It || V.isLoading)) {
426
426
  e.error(_.issueChecksLoading);
427
427
  return;
428
428
  }
429
- if (o && !H.canAddAccount && !i.bankAccountId && !H.hasAccounts) {
429
+ if (o && !V.canAddAccount && !i.bankAccountId && !V.hasAccounts) {
430
430
  e.error(_.issueBankAccountUnavailable);
431
431
  return;
432
432
  }
433
- let s = yn(i, o);
433
+ let s = xn(i, o);
434
434
  if (Me(s)) {
435
435
  X(s, o);
436
436
  return;
437
437
  }
438
- if (O({}), o && z.isTaxIdMissing) {
438
+ if (O({}), o && R.isTaxIdMissing) {
439
439
  e.error(_.issueTaxIdRequired);
440
440
  return;
441
441
  }
442
442
  if (o && (i.paymentReminderId || i.overdueReminderId)) {
443
- let t = ze(z.counterpart, _);
443
+ let t = ze(R.counterpart, _);
444
444
  if (t) {
445
445
  e.error(t);
446
446
  return;
447
447
  }
448
448
  }
449
- let c = T === "edit" ? gt : x.current, l, u, ee = {};
449
+ let c = T === "edit" ? vt : x.current, l, u, ee = {};
450
450
  try {
451
451
  if (c) {
452
452
  let e = Pe({
453
453
  values: i,
454
454
  originalLineItems: S.current,
455
- originalCurrency: mt.current,
455
+ originalCurrency: gt.current,
456
456
  unitNamesById: j,
457
457
  units: A
458
458
  });
@@ -465,11 +465,11 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
465
465
  path: { receivable_id: c },
466
466
  body: Fe({
467
467
  values: i,
468
- billingAddressId: R ?? "",
468
+ billingAddressId: L ?? "",
469
469
  lineItemChanges: e
470
470
  })
471
471
  });
472
- It(), l = c, u = t?.type ?? i.type, a && t && (S.current = t.line_items, mt.current = t.currency, i = {
472
+ zt(), l = c, u = t?.type ?? i.type, a && t && (S.current = t.line_items, gt.current = t.currency, i = {
473
473
  ...i,
474
474
  lineItems: ne(i.lineItems, t.line_items)
475
475
  }, D(i));
@@ -477,14 +477,14 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
477
477
  ee = Le({ values: i });
478
478
  let e = await st.mutateAsync({ body: Ne({
479
479
  values: i,
480
- billingAddressId: R ?? "",
480
+ billingAddressId: L ?? "",
481
481
  unitNamesById: j
482
482
  }) });
483
483
  if (!e?.id) {
484
- w(!1), nn();
484
+ w(!1), an();
485
485
  return;
486
486
  }
487
- l = e.id, u = e.type, a && (x.current = e.id, S.current = e.line_items, mt.current = e.currency, i = {
487
+ l = e.id, u = e.type, a && (x.current = e.id, S.current = e.line_items, gt.current = e.currency, i = {
488
488
  ...i,
489
489
  lineItems: ne(i.lineItems, e.line_items)
490
490
  }, D(i));
@@ -504,9 +504,9 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
504
504
  }
505
505
  let te = a ? "recurrence" : "draft";
506
506
  if (a) try {
507
- U ? await ut.mutateAsync({
508
- path: { recurrence_id: U.id },
509
- body: _e(i, { lockSchedule: Kt })
507
+ H ? await ut.mutateAsync({
508
+ path: { recurrence_id: H.id },
509
+ body: _e(i, { lockSchedule: Yt })
510
510
  }) : await lt.mutateAsync({ body: ge(i, l) });
511
511
  } catch (t) {
512
512
  e.error(Xe(t, { messages: _ }));
@@ -518,63 +518,63 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
518
518
  e.error(_.issueFailedAfterSave);
519
519
  }
520
520
  let re = T === "create";
521
- w(!1), nn(), re && ot?.(l, u, {
521
+ w(!1), an(), re && ot?.(l, u, {
522
522
  mode: te,
523
523
  counterpartId: i.customerId,
524
524
  inlineItems: he(i.lineItems, i.currency),
525
- hasCustomerEmail: !!(z.counterpart && r(z.counterpart).trim())
525
+ hasCustomerEmail: !!(R.counterpart && r(R.counterpart).trim())
526
526
  });
527
527
  }, [
528
- H.canAddAccount,
529
- H.hasAccounts,
530
- H.isLoading,
531
- R,
532
- It,
528
+ V.canAddAccount,
529
+ V.hasAccounts,
530
+ V.isLoading,
531
+ L,
532
+ zt,
533
533
  st,
534
534
  lt,
535
- gt,
536
- U,
537
- on,
538
- Nt,
535
+ vt,
536
+ H,
537
+ cn,
538
+ It,
539
539
  dt,
540
- Kt,
540
+ Yt,
541
541
  _,
542
542
  T,
543
543
  ot,
544
- z.counterpart,
545
- z.isTaxIdMissing,
546
- G,
547
- nn,
544
+ R.counterpart,
545
+ R.isTaxIdMissing,
546
+ W,
547
+ an,
548
548
  X,
549
549
  A,
550
550
  j,
551
551
  k.isLoading,
552
552
  ct,
553
553
  ut,
554
- yn,
554
+ xn,
555
555
  E,
556
556
  Y
557
557
  ]), Z = f(async (e = v.current) => {
558
558
  if (!ft.current) {
559
- ft.current = !0;
559
+ ft.current = !0, mt(e);
560
560
  try {
561
- await Cn(e);
561
+ await Tn(e);
562
562
  } finally {
563
- ft.current = !1;
563
+ ft.current = !1, mt(void 0);
564
564
  }
565
565
  }
566
- }, [Cn]), wn = m(() => ({
566
+ }, [Tn]), En = m(() => ({
567
567
  ...E,
568
- discount: Ot ? E.discount : we(Te(E.discount, E.discountType, E.currency), E.discountType, E.currency),
568
+ discount: At ? E.discount : we(Te(E.discount, E.discountType, E.currency), E.discountType, E.currency),
569
569
  lineItems: E.lineItems.map(le)
570
- }), [Ot, E]), Tn = m(() => o(E.lineItems), [E.lineItems]), En = m(() => Oe(E), [E]), Q = E.type === "invoice", Dn = Q && d(E), On = $t || k.isLoading || B.isUploading || G, kn = T === "edit" ? _.updateDraftButton : _.saveDraftButton, An = Dn ? U ? _.recurrenceUpdateButton : _.recurrenceActivateButton : Q ? _.issueButton : kn, $ = Q && !Dn ? "issue" : "draft", jn = f(() => Z("draft"), [Z]), Mn = f(() => Z($), [$, Z]), Nn = f(() => Z(), [Z]), Pn = f(() => {
570
+ }), [At, E]), Dn = m(() => o(E.lineItems), [E.lineItems]), On = m(() => Oe(E), [E]), Q = E.type === "invoice", kn = Q && d(E), An = q || k.isLoading || z.isUploading || W, jn = T === "edit" ? _.updateDraftButton : _.saveDraftButton, Mn = kn ? H ? _.recurrenceUpdateButton : _.recurrenceActivateButton : Q ? _.issueButton : jn, $ = Q && !kn ? "issue" : "draft", Nn = f(() => Z("draft"), [Z]), Pn = f(() => Z($), [$, Z]), Fn = f(() => Z(), [Z]), In = f(() => {
571
571
  v.current = "draft";
572
- }, []), Fn = f(() => {
572
+ }, []), Ln = f(() => {
573
573
  v.current = $;
574
- }, [$]), In = m(() => De(En, E.currency), [En, E.currency]), Ln = rt({
574
+ }, [$]), Rn = m(() => De(On, E.currency), [On, E.currency]), zn = rt({
575
575
  values: E,
576
- totals: En,
577
- billingAddress: jt,
576
+ totals: On,
577
+ billingAddress: Pt,
578
578
  unitNamesById: j,
579
579
  messages: _,
580
580
  enabled: C
@@ -584,60 +584,62 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
584
584
  setOpen: w,
585
585
  mode: T,
586
586
  values: E,
587
- sheetValues: wn,
588
- errors: bt,
587
+ sheetValues: En,
588
+ errors: St,
589
589
  setValues: D,
590
- updateValues: cn,
591
- commitTaxRate: dn,
592
- focusDiscount: ln,
593
- commitDiscount: un,
594
- updateLineItem: fn,
595
- selectProduct: pn,
596
- commitLineItem: hn,
597
- stepLineItem: gn,
598
- addLineItem: _n,
599
- removeLineItem: vn,
600
- attachmentsView: Lt,
601
- attachmentsUploading: B.isUploading,
602
- draftButtonLabel: Q && !Dn ? kn : void 0,
603
- draftDisabled: On,
604
- primaryButtonLabel: An,
605
- primaryDisabled: On || H.isLoading && Y(E, $) || Q && (Nt || !Dn && z.isCounterpartLoading),
606
- scrollContainerRef: pt,
607
- selectAttachmentFiles: B.selectFiles,
608
- setAttachmentIncludeInEmail: B.setIncludeInEmail,
609
- removeAttachment: B.remove,
610
- autoFocusLineItemId: wt,
611
- lineItemUnitOptions: Ct.unitOptions,
590
+ updateValues: un,
591
+ commitTaxRate: pn,
592
+ focusDiscount: dn,
593
+ commitDiscount: fn,
594
+ updateLineItem: mn,
595
+ selectProduct: hn,
596
+ commitLineItem: _n,
597
+ stepLineItem: vn,
598
+ addLineItem: yn,
599
+ removeLineItem: bn,
600
+ attachmentsView: Bt,
601
+ attachmentsUploading: z.isUploading,
602
+ draftButtonLabel: Q && !kn ? jn : void 0,
603
+ draftDisabled: An,
604
+ draftLoading: q && pt === "draft",
605
+ primaryButtonLabel: Mn,
606
+ primaryLoading: q && pt === $,
607
+ primaryDisabled: An || V.isLoading && Y(E, $) || Q && (It || !kn && R.isCounterpartLoading),
608
+ scrollContainerRef: ht,
609
+ selectAttachmentFiles: z.selectFiles,
610
+ setAttachmentIncludeInEmail: z.setIncludeInEmail,
611
+ removeAttachment: z.remove,
612
+ autoFocusLineItemId: Et,
613
+ lineItemUnitOptions: Tt.unitOptions,
612
614
  lineItemsLoading: k.isLoading,
613
- lineItemControls: Tn,
614
- totals: En,
615
- preview: Ln,
616
- totalsView: In,
615
+ lineItemControls: Dn,
616
+ totals: On,
617
+ preview: zn,
618
+ totalsView: Rn,
617
619
  currencySymbol: ee(E.currency),
618
- isSubmitting: $t,
620
+ isSubmitting: q,
619
621
  currencyOptions: fe(E.currency),
620
- paymentTerms: Vt,
622
+ paymentTerms: Wt,
621
623
  showBillingSection: E.type === "invoice" || T === "edit",
622
- recurrence: Zt,
624
+ recurrence: en,
623
625
  showRecurrenceSection: E.type === "invoice",
624
- recurrenceLoading: G,
626
+ recurrenceLoading: W,
625
627
  showDueDateField: E.type === "quote",
626
- openCreate: rn,
627
- openEdit: an,
628
- close: sn,
629
- submit: Nn,
630
- submitDraft: jn,
631
- submitPrimary: Mn,
632
- selectDraftMode: Pn,
633
- selectPrimaryMode: Fn,
634
- units: Ct,
635
- counterpartView: xt,
636
- counterpartForm: zt,
637
- stateOptions: kt,
638
- openCounterpartCreate: zt.openCreate,
639
- bankAccount: H,
640
- reminders: en
628
+ openCreate: on,
629
+ openEdit: sn,
630
+ close: ln,
631
+ submit: Fn,
632
+ submitDraft: Nn,
633
+ submitPrimary: Pn,
634
+ selectDraftMode: In,
635
+ selectPrimaryMode: Ln,
636
+ units: Tt,
637
+ counterpartView: Ct,
638
+ counterpartForm: Ht,
639
+ stateOptions: jt,
640
+ openCounterpartCreate: Ht.openCreate,
641
+ bankAccount: V,
642
+ reminders: nn
641
643
  };
642
644
  }
643
645
  //#endregion