@tesouro/embedded-components-react 0.5.247 → 0.5.249

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