@tesouro/embedded-components-react 0.11.170 → 0.11.175
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.
- package/dist/index.d.ts +6 -0
- package/dist/lib/ReceivablesWidget.d.ts +6 -0
- package/dist/lib/WidgetSuite.d.ts +6 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +75 -66
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +62 -53
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +44 -38
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +331 -326
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +10 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +190 -187
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index14.js +12 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +25 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index33.js +4 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index34.js +23 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index5.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index16.js +196 -187
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +6 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index8.js +20 -17
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index18.js +11 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index20.js +157 -161
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index6.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +4 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +5 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +32 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +2 -29
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/util/dist/index.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/util/dist/lib/resolveBillDueDate.js +22 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +116 -98
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +99 -92
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +7 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurringSeries.js +15 -24
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index60.js +59 -69
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +7 -5
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/DateDisclosure/DateDisclosure.js +28 -0
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/DueDateText/DueDateText.js +19 -0
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/index.js +28 -27
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/dueDateDisplay.js +23 -0
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +0 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +0 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +0 -33
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +0 -2
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { createCurrencyFormatter as e } from "../../../../../shared/util/dist/lib/createCurrencyFormatter.js";
|
|
2
2
|
import { minorExponentForCurrency as t } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
3
3
|
import { parseDateOrTimestamp as n } from "../../../../../shared/util/dist/lib/parseCalendarDate.js";
|
|
4
|
+
import { resolveDueDateDisplay as r } from "../../../../../shared/util/dist/lib/dueDateDisplay.js";
|
|
4
5
|
import "../../../../../shared/util/dist/index.js";
|
|
5
|
-
import { isEmail as
|
|
6
|
-
import { createLineItem as
|
|
7
|
-
import { attachmentFormValuesToPayload as
|
|
8
|
-
import { createEmptyRecurrenceFields as
|
|
9
|
-
import { buildPaymentTermsPayload as
|
|
10
|
-
import { createEmptyDiscount as b, discountFromDraft as x, discountToDraft as
|
|
11
|
-
import { validateDiscount as
|
|
12
|
-
import { differenceInCalendarDays as
|
|
6
|
+
import { isEmail as i } from "../../../../../../shared/util-validation/dist/index5.js";
|
|
7
|
+
import { createLineItem as a, isBlankLineItem as o, keepsSavedTaxRates as s, lineItemToCreatePayload as c, lineItemToUpdatePayload as l, responseLineItemToFormValues as u, summarizeLineItemErrors as d, taxRateFromLineItems as f, validateLineItems as p } from "./lineItems.js";
|
|
8
|
+
import { attachmentFormValuesToPayload as m, receivableToAttachmentFormValues as h } from "./attachments.js";
|
|
9
|
+
import { createEmptyRecurrenceFields as g, willRecurrenceIssue as _ } from "./recurrence.js";
|
|
10
|
+
import { buildPaymentTermsPayload as v, buildPaymentTermsUpdatePayload as y, paymentTermsToFormFields as ee } from "./paymentTerms.js";
|
|
11
|
+
import { createEmptyDiscount as b, discountFromDraft as x, discountToDraft as S } from "./discount.js";
|
|
12
|
+
import { validateDiscount as C, validateInvoiceTotals as w, validateIssuableTotal as T } from "./totals.js";
|
|
13
|
+
import { differenceInCalendarDays as E, format as D } from "date-fns";
|
|
13
14
|
// ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js
|
|
14
|
-
function
|
|
15
|
+
function O() {
|
|
15
16
|
return {
|
|
16
17
|
type: "invoice",
|
|
17
18
|
customerId: "",
|
|
18
19
|
customerName: "",
|
|
19
20
|
customerEmail: "",
|
|
20
21
|
currency: "USD",
|
|
21
|
-
issueDate:
|
|
22
|
+
issueDate: D(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
|
|
22
23
|
dueDate: "",
|
|
23
24
|
openingNote: "",
|
|
24
25
|
closingNote: "",
|
|
@@ -26,7 +27,7 @@ function D() {
|
|
|
26
27
|
paymentTermsCustomDate: "",
|
|
27
28
|
taxRate: "",
|
|
28
29
|
...b("USD"),
|
|
29
|
-
lineItems: [
|
|
30
|
+
lineItems: [a()],
|
|
30
31
|
bankAccountId: "",
|
|
31
32
|
bankAccountType: "",
|
|
32
33
|
billingAddressId: "",
|
|
@@ -35,10 +36,10 @@ function D() {
|
|
|
35
36
|
overdueReminderId: "",
|
|
36
37
|
purchaseOrder: "",
|
|
37
38
|
attachments: [],
|
|
38
|
-
...
|
|
39
|
+
...g()
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
+
function k(e, t) {
|
|
42
43
|
let r = n(e);
|
|
43
44
|
return r ? new Intl.DateTimeFormat(void 0, {
|
|
44
45
|
day: "2-digit",
|
|
@@ -46,22 +47,22 @@ function O(e, t) {
|
|
|
46
47
|
year: "numeric"
|
|
47
48
|
}).format(r) : t;
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function A({ amount: n, currency: r, fallback: i }) {
|
|
50
51
|
return n == null || !r ? i : e(r).format(n / 10 ** t(r));
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function j(e, n) {
|
|
53
54
|
let r = Number(e);
|
|
54
55
|
if (!Number.isFinite(r)) return;
|
|
55
56
|
let i = n ? t(n) : 2;
|
|
56
57
|
return Math.round(r * 10 ** i);
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function M(e, t) {
|
|
59
60
|
return e.document_id || t.untitledDocument;
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function N(e, t) {
|
|
62
63
|
return e === "quote" ? t.quoteType : e === "credit_note" ? t.creditNoteType : t.invoiceType;
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function P(e, t, n) {
|
|
65
66
|
let r = e.counterpart_name || (e.counterpart_id ? t.names.get(e.counterpart_id) : void 0);
|
|
66
67
|
return r ? {
|
|
67
68
|
customerLabel: r,
|
|
@@ -74,69 +75,75 @@ function N(e, t, n) {
|
|
|
74
75
|
customerState: "missing"
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function F(e, t) {
|
|
78
79
|
let r = n(e);
|
|
79
|
-
return r ?
|
|
80
|
+
return r ? E(r, t) : void 0;
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
-
let n =
|
|
82
|
+
function I(e, t = /* @__PURE__ */ new Date()) {
|
|
83
|
+
let n = F(e, t) ?? 0;
|
|
83
84
|
return n < 0 ? -n : 0;
|
|
84
85
|
}
|
|
85
|
-
var
|
|
86
|
+
var L = /* @__PURE__ */ new Set([
|
|
86
87
|
"issued",
|
|
87
88
|
"partially_paid",
|
|
88
89
|
"overdue"
|
|
89
90
|
]);
|
|
90
|
-
function
|
|
91
|
-
let
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
91
|
+
function R(e, t, n) {
|
|
92
|
+
let i = e.type === "invoice" ? e.due_date : null, { label: a, overdueLabel: o, accessibleLabel: s } = r({
|
|
93
|
+
dueDate: i,
|
|
94
|
+
dateLabel: k(i, t.pendingValue),
|
|
95
|
+
today: D(n, "yyyy-MM-dd"),
|
|
96
|
+
isUnpaid: L.has(e.status),
|
|
97
|
+
labels: {
|
|
98
|
+
today: t.listDueToday,
|
|
99
|
+
tomorrow: t.listDueTomorrow,
|
|
100
|
+
dayOverdue: t.listDayOverdue,
|
|
101
|
+
daysOverdue: t.listDaysOverdue,
|
|
102
|
+
overdueAccessibleName: t.listOverdueAccessibleName
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return o ? {
|
|
106
|
+
dueDateLabel: a,
|
|
100
107
|
dueDateOverdueLabel: o,
|
|
101
|
-
dueDateAccessibleLabel:
|
|
102
|
-
};
|
|
108
|
+
dueDateAccessibleLabel: s
|
|
109
|
+
} : { dueDateLabel: a };
|
|
103
110
|
}
|
|
104
|
-
var
|
|
111
|
+
var z = {
|
|
105
112
|
names: /* @__PURE__ */ new Map(),
|
|
106
113
|
isResolving: !1
|
|
107
114
|
};
|
|
108
|
-
function
|
|
115
|
+
function B(e, t) {
|
|
109
116
|
return e.type !== "invoice" || !e.recurrence_id ? {} : { recurringBadgeLabel: t.listRecurringBadge };
|
|
110
117
|
}
|
|
111
|
-
function
|
|
118
|
+
function V({ receivables: e, messages: t, customerNames: n = z, now: r = /* @__PURE__ */ new Date() }) {
|
|
112
119
|
return e.map((e) => ({
|
|
113
120
|
id: e.id,
|
|
114
121
|
type: e.type,
|
|
115
122
|
documentLabel: e.document_id || t.pendingValue,
|
|
116
|
-
...
|
|
123
|
+
...P(e, n, t),
|
|
117
124
|
status: e.status,
|
|
118
|
-
issueDateLabel:
|
|
119
|
-
...
|
|
120
|
-
balanceDueLabel:
|
|
125
|
+
issueDateLabel: k(e.issue_date, t.pendingValue),
|
|
126
|
+
...R(e, t, r),
|
|
127
|
+
balanceDueLabel: A({
|
|
121
128
|
amount: "amount_due" in e ? e.amount_due ?? 0 : 0,
|
|
122
129
|
currency: e.currency,
|
|
123
130
|
fallback: ""
|
|
124
131
|
}),
|
|
125
|
-
totalLabel:
|
|
132
|
+
totalLabel: A({
|
|
126
133
|
amount: e.total_amount ?? 0,
|
|
127
134
|
currency: e.currency,
|
|
128
135
|
fallback: ""
|
|
129
136
|
}),
|
|
130
|
-
...
|
|
137
|
+
...B(e, t)
|
|
131
138
|
}));
|
|
132
139
|
}
|
|
133
|
-
function
|
|
140
|
+
function H(e) {
|
|
134
141
|
if (e.memo || e.footer) return {
|
|
135
142
|
opening: e.memo || void 0,
|
|
136
143
|
closing: e.footer || void 0
|
|
137
144
|
};
|
|
138
145
|
}
|
|
139
|
-
function
|
|
146
|
+
function U({ values: e, counterpart: t, addresses: n }) {
|
|
140
147
|
let r = n?.length && t?.id === e.customerId ? t : void 0, i = e.billingAddressId || r?.default_billing_address_id || (n?.length === 1 ? n[0].id : ""), a = e.shippingAddressId || r?.default_shipping_address_id || "";
|
|
141
148
|
return {
|
|
142
149
|
billingAddressId: i,
|
|
@@ -144,43 +151,43 @@ function H({ values: e, counterpart: t, addresses: n }) {
|
|
|
144
151
|
shippingAddressId: a
|
|
145
152
|
};
|
|
146
153
|
}
|
|
147
|
-
function
|
|
154
|
+
function W({ values: e, messages: t, willIssue: n = !1, hasStartedRecurrence: r = !1, canCreateCustomer: a = !0 }) {
|
|
148
155
|
let o = {}, s = a && !!e.customerName.trim();
|
|
149
156
|
!e.customerId && !s && (o.customerId = t.customerRequired);
|
|
150
157
|
let c = e.customerEmail.trim();
|
|
151
|
-
!e.customerId && c && !
|
|
152
|
-
let l =
|
|
158
|
+
!e.customerId && c && !i(c) && (o.customerEmail = t.customerEmailInvalid), e.currency || (o.currency = t.currencyRequired), n && !e.paymentTermsId && (o.paymentTermsId = t.paymentTermsRequired), n && !e.bankAccountId && (o.bankAccountId = t.bankAccountRequired);
|
|
159
|
+
let l = p(e.lineItems, {
|
|
153
160
|
currency: e.currency,
|
|
154
161
|
messages: t,
|
|
155
|
-
requireComplete: n ||
|
|
156
|
-
}),
|
|
157
|
-
l && (o.lineItems = l),
|
|
158
|
-
let m =
|
|
162
|
+
requireComplete: n || r
|
|
163
|
+
}), u = (n || r && _(e)) && !l && e.lineItems.length > 0 ? T(e, t) : void 0, f = d(l, w(e, t) ?? u, (n || r) && e.lineItems.length === 0 ? t.lineItemsRequired : void 0);
|
|
164
|
+
l && (o.lineItems = l), f && (o.lineItemsSummary = f);
|
|
165
|
+
let m = C(e, t);
|
|
159
166
|
return m && (o.discount = m), o;
|
|
160
167
|
}
|
|
161
|
-
function
|
|
168
|
+
function G(e) {
|
|
162
169
|
return Object.keys(e).length > 0;
|
|
163
170
|
}
|
|
164
|
-
function
|
|
165
|
-
return !W(
|
|
166
|
-
values:
|
|
171
|
+
function K(e, t) {
|
|
172
|
+
return !G(W({
|
|
173
|
+
values: Y(e),
|
|
167
174
|
messages: t,
|
|
168
175
|
willIssue: !0
|
|
169
176
|
}));
|
|
170
177
|
}
|
|
171
|
-
function
|
|
178
|
+
function q({ bankAccountId: e, bankAccountType: t }) {
|
|
172
179
|
return {
|
|
173
180
|
bank_account_id: e || void 0,
|
|
174
181
|
bank_account_type: e && t || void 0
|
|
175
182
|
};
|
|
176
183
|
}
|
|
177
|
-
function
|
|
178
|
-
let i = e.lineItems.filter((e) => !
|
|
184
|
+
function J({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById: r }) {
|
|
185
|
+
let i = e.lineItems.filter((e) => !o(e)).map((t) => c({
|
|
179
186
|
lineItem: t,
|
|
180
187
|
currency: e.currency,
|
|
181
188
|
taxRate: e.taxRate,
|
|
182
189
|
unitNamesById: r
|
|
183
|
-
})),
|
|
190
|
+
})), a = {
|
|
184
191
|
counterpart_billing_address_id: t || void 0,
|
|
185
192
|
counterpart_shipping_address_id: n || void 0,
|
|
186
193
|
counterpart_id: e.customerId,
|
|
@@ -189,30 +196,30 @@ function q({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById
|
|
|
189
196
|
memo: e.openingNote,
|
|
190
197
|
footer: e.closingNote,
|
|
191
198
|
discount: x(e) ?? void 0,
|
|
192
|
-
...
|
|
199
|
+
...q(e)
|
|
193
200
|
};
|
|
194
201
|
return e.type === "quote" ? {
|
|
195
|
-
...
|
|
202
|
+
...a,
|
|
196
203
|
expiry_date: e.dueDate || void 0,
|
|
197
204
|
type: "quote"
|
|
198
205
|
} : {
|
|
199
|
-
...
|
|
200
|
-
...
|
|
206
|
+
...a,
|
|
207
|
+
...v(e),
|
|
201
208
|
payment_reminder_id: e.paymentReminderId || void 0,
|
|
202
209
|
overdue_reminder_id: e.overdueReminderId || void 0,
|
|
203
210
|
purchase_order: e.purchaseOrder || void 0,
|
|
204
|
-
attachments:
|
|
211
|
+
attachments: m(e.attachments),
|
|
205
212
|
type: "invoice"
|
|
206
213
|
};
|
|
207
214
|
}
|
|
208
|
-
function
|
|
209
|
-
let n = e.type === "quote" ? "quote" : "invoice", r =
|
|
215
|
+
function Y(e, t) {
|
|
216
|
+
let n = e.type === "quote" ? "quote" : "invoice", r = f(e.line_items), i = e.type === "invoice" ? e : void 0, o = e.line_items.map((n) => u({
|
|
210
217
|
lineItem: n,
|
|
211
218
|
currency: e.currency,
|
|
212
219
|
units: t
|
|
213
220
|
}));
|
|
214
221
|
return {
|
|
215
|
-
...
|
|
222
|
+
...O(),
|
|
216
223
|
type: n,
|
|
217
224
|
customerId: e.counterpart_id,
|
|
218
225
|
currency: e.currency,
|
|
@@ -220,25 +227,25 @@ function J(e, t) {
|
|
|
220
227
|
dueDate: e.type === "quote" ? $(e.expiry_date) : "",
|
|
221
228
|
openingNote: e.memo ?? "",
|
|
222
229
|
closingNote: e.footer ?? "",
|
|
223
|
-
...e.type === "invoice" ?
|
|
230
|
+
...e.type === "invoice" ? ee(e.payment_terms) : {},
|
|
224
231
|
taxRate: r,
|
|
225
232
|
savedTaxRate: r,
|
|
226
|
-
...
|
|
227
|
-
lineItems: o.length > 0 ? o : [
|
|
233
|
+
...S(e.discount, e.currency),
|
|
234
|
+
lineItems: o.length > 0 ? o : [a(e.currency)],
|
|
228
235
|
bankAccountId: e.bank_account_id ?? "",
|
|
229
|
-
bankAccountType:
|
|
236
|
+
bankAccountType: X(e.bank_account_type),
|
|
230
237
|
billingAddressId: e.counterpart_billing_address?.id ?? "",
|
|
231
238
|
shippingAddressId: e.counterpart_shipping_address?.id ?? "",
|
|
232
|
-
paymentReminderId:
|
|
233
|
-
overdueReminderId:
|
|
234
|
-
purchaseOrder:
|
|
235
|
-
attachments:
|
|
239
|
+
paymentReminderId: i?.payment_reminder_id ?? "",
|
|
240
|
+
overdueReminderId: i?.overdue_reminder_id ?? "",
|
|
241
|
+
purchaseOrder: i?.purchase_order ?? "",
|
|
242
|
+
attachments: h(e)
|
|
236
243
|
};
|
|
237
244
|
}
|
|
238
|
-
function
|
|
245
|
+
function X(e) {
|
|
239
246
|
return e === "BANK_DETAILS" || e === "INTERNAL" || e === "EXTERNAL" ? e : "";
|
|
240
247
|
}
|
|
241
|
-
function
|
|
248
|
+
function Z({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChanges: r }) {
|
|
242
249
|
let i = {
|
|
243
250
|
counterpart_billing_address_id: t || null,
|
|
244
251
|
counterpart_shipping_address_id: n || null,
|
|
@@ -248,37 +255,37 @@ function X({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChang
|
|
|
248
255
|
memo: e.openingNote,
|
|
249
256
|
footer: e.closingNote,
|
|
250
257
|
discount: x(e),
|
|
251
|
-
...
|
|
258
|
+
...q(e)
|
|
252
259
|
};
|
|
253
260
|
return e.type === "quote" ? { quote: {
|
|
254
261
|
...i,
|
|
255
262
|
...r ? { line_items: r } : {},
|
|
256
263
|
expiry_date: e.dueDate || void 0,
|
|
257
|
-
...
|
|
264
|
+
...y(e)
|
|
258
265
|
} } : { invoice: {
|
|
259
266
|
...i,
|
|
260
267
|
...r ? { line_items: r } : {},
|
|
261
|
-
...
|
|
268
|
+
...y(e),
|
|
262
269
|
payment_reminder_id: e.paymentReminderId || null,
|
|
263
270
|
overdue_reminder_id: e.overdueReminderId || null,
|
|
264
|
-
attachments:
|
|
271
|
+
attachments: m(e.attachments) ?? null
|
|
265
272
|
} };
|
|
266
273
|
}
|
|
267
|
-
function
|
|
268
|
-
let
|
|
274
|
+
function Q({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: r, units: i }) {
|
|
275
|
+
let a = f(t), c = s(e.taxRate, a), d = (e, t, n) => l({
|
|
269
276
|
lineItem: e,
|
|
270
277
|
currency: t,
|
|
271
278
|
taxRate: n,
|
|
272
|
-
keepSavedRate:
|
|
279
|
+
keepSavedRate: c,
|
|
273
280
|
unitNamesById: r
|
|
274
|
-
}), p = new Map(t.map((e) => [e.id, JSON.stringify(
|
|
281
|
+
}), p = new Map(t.map((e) => [e.id, JSON.stringify(d(u({
|
|
275
282
|
lineItem: e,
|
|
276
283
|
currency: n,
|
|
277
284
|
units: i
|
|
278
|
-
}), n,
|
|
285
|
+
}), n, a))])), m = e.lineItems.filter((e) => !o(e)), h = new Set(m.map((e) => e.id)), g = m.filter((e) => !p.has(e.id)).map((t) => d(t, e.currency, e.taxRate)), _ = m.flatMap((t) => {
|
|
279
286
|
let n = p.get(t.id);
|
|
280
287
|
if (n === void 0) return [];
|
|
281
|
-
let r =
|
|
288
|
+
let r = d(t, e.currency, e.taxRate);
|
|
282
289
|
return n === JSON.stringify(r) ? [] : [{
|
|
283
290
|
id: t.id,
|
|
284
291
|
data: r
|
|
@@ -290,8 +297,8 @@ function Z({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById
|
|
|
290
297
|
...v.length ? { remove: v } : {}
|
|
291
298
|
};
|
|
292
299
|
}
|
|
293
|
-
function
|
|
294
|
-
let r = e.lineItems.filter((e) => !
|
|
300
|
+
function te({ values: e, originalLineItems: t, changes: n }) {
|
|
301
|
+
let r = e.lineItems.filter((e) => !o(e)).map((e) => e.id);
|
|
295
302
|
if (!t) return { created: r };
|
|
296
303
|
let i = new Set(t.map((e) => e.id));
|
|
297
304
|
return {
|
|
@@ -302,4 +309,4 @@ function Q({ values: e, originalLineItems: t, changes: n }) {
|
|
|
302
309
|
function $(e) {
|
|
303
310
|
return e?.slice(0, 10) ?? "";
|
|
304
311
|
}
|
|
305
|
-
export {
|
|
312
|
+
export { H as buildReceivableNotesView, V as buildReceivableRows, O as createEmptyReceivableFormValues, a as createLineItem, k as formatDate, A as formatMoney, j as fromMajorUnits, I as getDaysOverdue, M as getDocumentTitle, N as getDocumentTypeLabel, G as hasReceivableFormErrors, K as isReceivableReadyToIssue, J as receivableFormValuesToCreatePayload, Q as receivableFormValuesToLineItemChanges, Z as receivableFormValuesToUpdatePayload, Y as receivableToFormValues, U as resolveCounterpartAddresses, P as resolveCustomer, te as submittedLineItemRows, W as validateReceivableForm };
|
|
@@ -116,9 +116,15 @@ var e = {
|
|
|
116
116
|
detailsPeriodMonth: "each month",
|
|
117
117
|
detailsPeriodQuarter: "each quarter",
|
|
118
118
|
detailsPeriodYear: "each year",
|
|
119
|
+
detailsPeriodEveryDays: "every {interval} days",
|
|
120
|
+
detailsPeriodEveryWeeks: "every {interval} weeks",
|
|
121
|
+
detailsPeriodEveryMonths: "every {interval} months",
|
|
122
|
+
detailsPeriodEveryQuarters: "every {interval} quarters",
|
|
123
|
+
detailsPeriodEveryYears: "every {interval} years",
|
|
119
124
|
detailsSeriesTitle: "{name} - {frequency}",
|
|
120
|
-
detailsSeriesSubtitle: "Recurring series",
|
|
125
|
+
detailsSeriesSubtitle: "Recurring series · {frequency}",
|
|
121
126
|
detailsScheduleTitle: "{frequency} schedule",
|
|
127
|
+
detailsScheduleTitleEvery: "Schedule, {period}",
|
|
122
128
|
detailsSeriesBack: "Back to {title} recurring series",
|
|
123
129
|
detailsScheduleOpenInvoice: "Open invoice {number}",
|
|
124
130
|
detailsSeriesStatusActive: "Active",
|
|
@@ -53,61 +53,52 @@ function m(e, t) {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function h(e
|
|
57
|
-
return e.interval <= 1 ? o(e.frequency, t) : ({
|
|
58
|
-
day: t.listSeriesEveryDays,
|
|
59
|
-
week: t.listSeriesEveryWeeks,
|
|
60
|
-
month: t.listSeriesEveryMonths,
|
|
61
|
-
quarter: t.listSeriesEveryQuarters,
|
|
62
|
-
year: t.listSeriesEveryYears
|
|
63
|
-
}[e.frequency] ?? "").replace("{interval}", String(e.interval));
|
|
64
|
-
}
|
|
65
|
-
function g(e) {
|
|
56
|
+
function h(e) {
|
|
66
57
|
let t = new Date(e.getFullYear(), e.getMonth() + 1, 0);
|
|
67
58
|
return e.getDate() === t.getDate();
|
|
68
59
|
}
|
|
69
|
-
function
|
|
60
|
+
function g(t, r) {
|
|
70
61
|
let i = e(t.start_date);
|
|
71
62
|
if (!i) return;
|
|
72
63
|
let a = i.getDate();
|
|
73
64
|
if (a === 1) return r.listSeriesFirstDay;
|
|
74
65
|
if (a === 31) return r.listSeriesLastDay;
|
|
75
66
|
let o = [i, ...(t.iterations ?? []).flatMap((t) => e(t.issue_at) ?? [])];
|
|
76
|
-
return o.every(
|
|
67
|
+
return o.every(h) && o.some((e) => e.getDate() > a) ? r.listSeriesLastDay : n(a);
|
|
77
68
|
}
|
|
78
|
-
function
|
|
79
|
-
let n =
|
|
69
|
+
function _(e, t) {
|
|
70
|
+
let n = o(e, t);
|
|
80
71
|
if (e.frequency !== "month") return n;
|
|
81
|
-
let r =
|
|
72
|
+
let r = g(e, t);
|
|
82
73
|
return r ? t.listSeriesMonthDay.replace("{cadence}", n).replace("{day}", r) : n;
|
|
83
74
|
}
|
|
84
|
-
function
|
|
75
|
+
function v(e) {
|
|
85
76
|
if (e.status === "active") return e.iterations?.find((e) => e.status === "pending")?.issue_at;
|
|
86
77
|
}
|
|
87
|
-
function
|
|
78
|
+
function y(e, t) {
|
|
88
79
|
if (!e) return { nextInvoiceLabel: t.listSeriesNoValue };
|
|
89
|
-
let n =
|
|
80
|
+
let n = v(e);
|
|
90
81
|
return n ? { nextInvoiceLabel: r(n, t.listSeriesNoValue) } : {
|
|
91
82
|
nextInvoiceLabel: t.listSeriesNoNextInvoice,
|
|
92
83
|
nextInvoiceMuted: !0
|
|
93
84
|
};
|
|
94
85
|
}
|
|
95
|
-
function
|
|
86
|
+
function b(e, t, n) {
|
|
96
87
|
return e ? {
|
|
97
88
|
kind: "badge",
|
|
98
89
|
label: s(e.status, n),
|
|
99
90
|
tone: d[e.status] ?? "neutral"
|
|
100
91
|
} : t ? { kind: "loading" } : { kind: "blank" };
|
|
101
92
|
}
|
|
102
|
-
function
|
|
93
|
+
function x({ receivables: e, recurrences: t, isRecurrencesLoading: n, messages: r, customerNames: o }) {
|
|
103
94
|
return e.map((e) => {
|
|
104
95
|
let s = e.type === "invoice" && e.recurrence_id ? t.get(e.recurrence_id) : void 0;
|
|
105
96
|
return {
|
|
106
97
|
id: e.id,
|
|
107
98
|
...a(e, o, r),
|
|
108
|
-
repeatsLabel: s ?
|
|
109
|
-
...
|
|
110
|
-
status:
|
|
99
|
+
repeatsLabel: s ? _(s, r) : r.listSeriesNoValue,
|
|
100
|
+
...y(s, r),
|
|
101
|
+
status: b(s, n, r),
|
|
111
102
|
amountLabel: i({
|
|
112
103
|
amount: e.total_amount ?? 0,
|
|
113
104
|
currency: e.currency,
|
|
@@ -116,4 +107,4 @@ function S({ receivables: e, recurrences: t, isRecurrencesLoading: n, messages:
|
|
|
116
107
|
};
|
|
117
108
|
});
|
|
118
109
|
}
|
|
119
|
-
export { l as SERIES_FILTER_FIELDS,
|
|
110
|
+
export { l as SERIES_FILTER_FIELDS, x as buildRecurringSeriesRows, m as buildSeriesFilterQuery, f as buildSeriesStatusLabels, p as buildSeriesStatusOptions };
|