@tesouro/embedded-components-react 0.5.224 → 0.5.226
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/README.md +335 -413
- package/dist/index.d.ts +23 -2
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +23 -2
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +45 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +51 -32
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +20 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +17 -202
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +220 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +32 -145
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +126 -44
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +145 -117
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +46 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +113 -87
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +58 -116
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +98 -225
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +111 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +225 -462
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +34 -41
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js +627 -34
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index28.js +39 -77
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index29.js +34 -112
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index30.js +75 -310
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js +124 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js +324 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +20 -15
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +56 -53
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +33 -29
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +184 -162
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +78 -69
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/CounterpartSelector.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +20 -19
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +39 -39
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +210 -199
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +60 -52
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -52,27 +52,30 @@ function m() {
|
|
|
52
52
|
function h(e) {
|
|
53
53
|
return e.frequency !== "once";
|
|
54
54
|
}
|
|
55
|
-
function g(
|
|
55
|
+
function g(e) {
|
|
56
|
+
return h(e) && e.recurrenceAutomationLevel !== "draft";
|
|
57
|
+
}
|
|
58
|
+
function _({ to: t = [], cc: n = [], bcc: r = [], subject: i, body: a }) {
|
|
56
59
|
return t.length > 0 && [
|
|
57
60
|
...t,
|
|
58
61
|
...n,
|
|
59
62
|
...r
|
|
60
63
|
].every((t) => e(t)) && !!(i?.trim() && a?.trim());
|
|
61
64
|
}
|
|
62
|
-
function
|
|
65
|
+
function v(e) {
|
|
63
66
|
return e ? i(e) : void 0;
|
|
64
67
|
}
|
|
65
|
-
function
|
|
68
|
+
function y(e) {
|
|
66
69
|
return e ? r(e, s) : "";
|
|
67
70
|
}
|
|
68
|
-
function
|
|
71
|
+
function b(e) {
|
|
69
72
|
return n(a(e), 1);
|
|
70
73
|
}
|
|
71
|
-
function
|
|
74
|
+
function x(e, t) {
|
|
72
75
|
let r = a(t), i = (f[e] - r.getDay() + 7) % 7 || 7;
|
|
73
76
|
return n(r, i);
|
|
74
77
|
}
|
|
75
|
-
var
|
|
78
|
+
var S = {
|
|
76
79
|
recurrenceStartDate: "",
|
|
77
80
|
recurrenceEndDate: "",
|
|
78
81
|
recurrenceIssueMode: "",
|
|
@@ -80,10 +83,10 @@ var x = {
|
|
|
80
83
|
recurrenceEndMode: "",
|
|
81
84
|
recurrenceMaxOccurrences: ""
|
|
82
85
|
};
|
|
83
|
-
function
|
|
86
|
+
function C(e, n) {
|
|
84
87
|
let r = {
|
|
85
88
|
...e,
|
|
86
|
-
...
|
|
89
|
+
...S,
|
|
87
90
|
frequency: n
|
|
88
91
|
};
|
|
89
92
|
return u.includes(n) ? {
|
|
@@ -97,21 +100,21 @@ function S(e, n) {
|
|
|
97
100
|
paymentTermsCustomDate: ""
|
|
98
101
|
} : r;
|
|
99
102
|
}
|
|
100
|
-
function
|
|
103
|
+
function w(e, t, { lockSchedule: n }) {
|
|
101
104
|
return {
|
|
102
105
|
...e,
|
|
103
106
|
recurrenceIssueMode: t,
|
|
104
107
|
...n ? {} : { recurrenceStartDate: "" }
|
|
105
108
|
};
|
|
106
109
|
}
|
|
107
|
-
function
|
|
110
|
+
function T(e, t, { lockSchedule: n, today: r = /* @__PURE__ */ new Date() }) {
|
|
108
111
|
return n || e.recurrenceDayOfWeek === t ? e : {
|
|
109
112
|
...e,
|
|
110
113
|
recurrenceDayOfWeek: t,
|
|
111
|
-
recurrenceStartDate:
|
|
114
|
+
recurrenceStartDate: y(x(t, r))
|
|
112
115
|
};
|
|
113
116
|
}
|
|
114
|
-
function
|
|
117
|
+
function E(e, t) {
|
|
115
118
|
return t === "after" ? {
|
|
116
119
|
...e,
|
|
117
120
|
recurrenceEndMode: t,
|
|
@@ -122,13 +125,13 @@ function T(e, t) {
|
|
|
122
125
|
recurrenceMaxOccurrences: ""
|
|
123
126
|
};
|
|
124
127
|
}
|
|
125
|
-
function
|
|
128
|
+
function D(e, t, n) {
|
|
126
129
|
return {
|
|
127
130
|
...e,
|
|
128
|
-
[t]:
|
|
131
|
+
[t]: y(n)
|
|
129
132
|
};
|
|
130
133
|
}
|
|
131
|
-
function
|
|
134
|
+
function O(e) {
|
|
132
135
|
return {
|
|
133
136
|
...e,
|
|
134
137
|
recurrenceRecipientsTo: void 0,
|
|
@@ -136,7 +139,7 @@ function D(e) {
|
|
|
136
139
|
recurrenceRecipientsBcc: []
|
|
137
140
|
};
|
|
138
141
|
}
|
|
139
|
-
function
|
|
142
|
+
function k(e, t) {
|
|
140
143
|
return {
|
|
141
144
|
to: e.recurrenceRecipientsTo ?? (t ? [t] : []),
|
|
142
145
|
toInput: "",
|
|
@@ -148,31 +151,31 @@ function O(e, t) {
|
|
|
148
151
|
message: e.recurrenceBody
|
|
149
152
|
};
|
|
150
153
|
}
|
|
151
|
-
function
|
|
154
|
+
function A(e) {
|
|
152
155
|
let t = e.toInput.trim();
|
|
153
156
|
return t ? [...e.to, t] : e.to;
|
|
154
157
|
}
|
|
155
|
-
function
|
|
156
|
-
return
|
|
157
|
-
to:
|
|
158
|
+
function j(e) {
|
|
159
|
+
return _({
|
|
160
|
+
to: A(e),
|
|
158
161
|
cc: e.cc,
|
|
159
162
|
bcc: e.bcc,
|
|
160
163
|
subject: e.subject,
|
|
161
164
|
body: e.message
|
|
162
165
|
});
|
|
163
166
|
}
|
|
164
|
-
function
|
|
167
|
+
function M(e, t) {
|
|
165
168
|
return {
|
|
166
169
|
...e,
|
|
167
|
-
recurrenceRecipientsTo:
|
|
170
|
+
recurrenceRecipientsTo: A(t),
|
|
168
171
|
recurrenceRecipientsCc: t.cc,
|
|
169
172
|
recurrenceRecipientsBcc: t.bcc,
|
|
170
173
|
recurrenceSubject: t.subject,
|
|
171
174
|
recurrenceBody: t.message
|
|
172
175
|
};
|
|
173
176
|
}
|
|
174
|
-
function
|
|
175
|
-
return t === "issue_and_send" && !
|
|
177
|
+
function N(e, t) {
|
|
178
|
+
return t === "issue_and_send" && !_({
|
|
176
179
|
to: e.recurrenceRecipientsTo,
|
|
177
180
|
cc: e.recurrenceRecipientsCc,
|
|
178
181
|
bcc: e.recurrenceRecipientsBcc,
|
|
@@ -180,7 +183,7 @@ function M(e, t) {
|
|
|
180
183
|
body: e.recurrenceBody
|
|
181
184
|
});
|
|
182
185
|
}
|
|
183
|
-
function
|
|
186
|
+
function P({ open: e, ready: t, draft: n, messages: r }) {
|
|
184
187
|
return {
|
|
185
188
|
open: e,
|
|
186
189
|
ready: t,
|
|
@@ -193,21 +196,21 @@ function N({ open: e, ready: t, draft: n, messages: r }) {
|
|
|
193
196
|
subject: n.subject,
|
|
194
197
|
message: n.message,
|
|
195
198
|
showToPlaceholder: n.to.length === 0,
|
|
196
|
-
saveDisabled: !
|
|
199
|
+
saveDisabled: !j(n),
|
|
197
200
|
removeRecipientLabel: (e) => r.recurrenceRemoveRecipient.replace("{recipient}", e)
|
|
198
201
|
};
|
|
199
202
|
}
|
|
200
|
-
var
|
|
203
|
+
var F = [
|
|
201
204
|
"th",
|
|
202
205
|
"st",
|
|
203
206
|
"nd",
|
|
204
207
|
"rd"
|
|
205
208
|
];
|
|
206
|
-
function
|
|
209
|
+
function I(e) {
|
|
207
210
|
let t = e % 100;
|
|
208
|
-
return `${e}${
|
|
211
|
+
return `${e}${F[(t - 20) % 10] ?? F[t] ?? F[0]}`;
|
|
209
212
|
}
|
|
210
|
-
function
|
|
213
|
+
function L(e, t) {
|
|
211
214
|
let [n, r] = {
|
|
212
215
|
day: [t.recurrenceUnitDay, t.recurrenceUnitDays],
|
|
213
216
|
week: [t.recurrenceUnitWeek, t.recurrenceUnitWeeks],
|
|
@@ -220,8 +223,8 @@ function I(e, t) {
|
|
|
220
223
|
plural: r
|
|
221
224
|
};
|
|
222
225
|
}
|
|
223
|
-
function
|
|
224
|
-
if (t <
|
|
226
|
+
function R(e, t, n = /* @__PURE__ */ new Date()) {
|
|
227
|
+
if (t < b(n)) return !0;
|
|
225
228
|
if (e.frequency === "week") return e.recurrenceDayOfWeek ? t.getDay() !== f[e.recurrenceDayOfWeek] : !1;
|
|
226
229
|
if (e.frequency !== "month" || !e.recurrenceIssueMode) return !1;
|
|
227
230
|
let r = t.getDate(), i = new Date(t.getFullYear(), t.getMonth() + 1, 0).getDate();
|
|
@@ -230,8 +233,8 @@ function L(e, t, n = /* @__PURE__ */ new Date()) {
|
|
|
230
233
|
let a = Number(e.recurrenceIssueMode);
|
|
231
234
|
return !Number.isNaN(a) && r !== Math.min(a, i);
|
|
232
235
|
}
|
|
233
|
-
function
|
|
234
|
-
let { frequency: a } = e, o =
|
|
236
|
+
function z({ fields: e, errors: t, lockSchedule: n, messages: r, today: i = /* @__PURE__ */ new Date() }) {
|
|
237
|
+
let { frequency: a } = e, o = v(e.recurrenceStartDate), s = v(e.recurrenceEndDate), c = b(i), u = (t) => R(e, t, i), f = { frequency: {
|
|
235
238
|
value: a,
|
|
236
239
|
disabled: n,
|
|
237
240
|
options: [
|
|
@@ -274,7 +277,7 @@ function R({ fields: e, errors: t, lockSchedule: n, messages: r, today: i = /* @
|
|
|
274
277
|
}],
|
|
275
278
|
dayOptions: Array.from({ length: 31 }, (e, t) => ({
|
|
276
279
|
value: String(t + 1),
|
|
277
|
-
label:
|
|
280
|
+
label: I(t + 1)
|
|
278
281
|
}))
|
|
279
282
|
}), a === "week") {
|
|
280
283
|
let i = {
|
|
@@ -304,7 +307,7 @@ function R({ fields: e, errors: t, lockSchedule: n, messages: r, today: i = /* @
|
|
|
304
307
|
minDate: c,
|
|
305
308
|
maxDate: s ?? l,
|
|
306
309
|
isDateDisabled: u
|
|
307
|
-
}, m =
|
|
310
|
+
}, m = L(a, r), h = {
|
|
308
311
|
value: e.recurrenceMaxOccurrences,
|
|
309
312
|
unitLabel: Number(e.recurrenceMaxOccurrences) === 1 ? m.singular : m.plural,
|
|
310
313
|
invalid: !!t?.recurrenceMaxOccurrences
|
|
@@ -362,22 +365,22 @@ function R({ fields: e, errors: t, lockSchedule: n, messages: r, today: i = /* @
|
|
|
362
365
|
emailError: g
|
|
363
366
|
}, f;
|
|
364
367
|
}
|
|
365
|
-
function
|
|
366
|
-
let { singular: r, plural: i } =
|
|
368
|
+
function B(e, t, n) {
|
|
369
|
+
let { singular: r, plural: i } = L(t, n), a = (e) => e.replace("{unit}", r).replace("{units}", i);
|
|
367
370
|
if (!e) return a(n.recurrenceOccurrencesRequired);
|
|
368
371
|
let o = Number(e);
|
|
369
372
|
if (o < 1) return a(n.recurrenceOccurrencesTooFew);
|
|
370
373
|
if (o > c) return a(n.recurrenceOccurrencesTooMany);
|
|
371
374
|
if (!Number.isInteger(o)) return n.recurrenceOccurrencesWhole;
|
|
372
375
|
}
|
|
373
|
-
function
|
|
376
|
+
function V({ fields: t, issuedCount: n = 0, messages: r }) {
|
|
374
377
|
let { frequency: i } = t;
|
|
375
378
|
if (i === "once") return {};
|
|
376
379
|
let a = {};
|
|
377
380
|
t.recurrenceStartDate || (a.recurrenceStartDate = r.recurrenceStartDateRequired);
|
|
378
381
|
let o = i !== "day" || t.recurrenceEndMode === "after";
|
|
379
382
|
if (i === "month" && !t.recurrenceIssueMode && (a.recurrenceIssueMode = r.recurrenceDayOfMonthRequired), i === "week" && !t.recurrenceDayOfWeek && (a.recurrenceDayOfWeek = r.recurrenceDayOfWeekRequired), i === "day" && !t.recurrenceEndMode && (a.recurrenceEndMode = r.recurrenceEndConditionRequired), i === "day" && t.recurrenceEndMode === "on" && !t.recurrenceEndDate && (a.recurrenceEndDate = r.recurrenceEndDateRequired), o) {
|
|
380
|
-
let e =
|
|
383
|
+
let e = B(t.recurrenceMaxOccurrences, i, r);
|
|
381
384
|
e && (a.recurrenceMaxOccurrences = e);
|
|
382
385
|
}
|
|
383
386
|
let s = i === "day" && t.recurrenceEndMode === "on";
|
|
@@ -395,7 +398,7 @@ function B({ fields: t, issuedCount: n = 0, messages: r }) {
|
|
|
395
398
|
}
|
|
396
399
|
return a;
|
|
397
400
|
}
|
|
398
|
-
function
|
|
401
|
+
function H(e) {
|
|
399
402
|
let t = e.recurrenceAutomationLevel;
|
|
400
403
|
if (t !== "issue_and_send") return {
|
|
401
404
|
automation_level: t,
|
|
@@ -415,7 +418,7 @@ function V(e) {
|
|
|
415
418
|
recipients: Object.values(n).some(Boolean) ? n : void 0
|
|
416
419
|
};
|
|
417
420
|
}
|
|
418
|
-
function
|
|
421
|
+
function U(e, { hasExistingRecurrence: t }) {
|
|
419
422
|
let n = e.frequency === "day" && e.recurrenceEndMode === "on" && !!e.recurrenceEndDate, r = t ? null : void 0;
|
|
420
423
|
return {
|
|
421
424
|
frequency: e.frequency,
|
|
@@ -424,32 +427,32 @@ function H(e, { hasExistingRecurrence: t }) {
|
|
|
424
427
|
end_date: n ? e.recurrenceEndDate : r
|
|
425
428
|
};
|
|
426
429
|
}
|
|
427
|
-
function
|
|
430
|
+
function W(e, t) {
|
|
428
431
|
return {
|
|
429
|
-
...
|
|
430
|
-
...
|
|
432
|
+
...U(e, { hasExistingRecurrence: !1 }),
|
|
433
|
+
...H(e),
|
|
431
434
|
invoice_id: t,
|
|
432
435
|
interval: 1
|
|
433
436
|
};
|
|
434
437
|
}
|
|
435
|
-
function
|
|
436
|
-
let n =
|
|
438
|
+
function G(e, { lockSchedule: t }) {
|
|
439
|
+
let n = U(e, { hasExistingRecurrence: !0 });
|
|
437
440
|
return t ? {
|
|
438
441
|
max_occurrences: n.max_occurrences,
|
|
439
442
|
end_date: n.end_date,
|
|
440
|
-
...
|
|
443
|
+
...H(e)
|
|
441
444
|
} : {
|
|
442
445
|
...n,
|
|
443
|
-
...
|
|
446
|
+
...H(e)
|
|
444
447
|
};
|
|
445
448
|
}
|
|
446
|
-
function
|
|
449
|
+
function K(e) {
|
|
447
450
|
return e?.iterations.filter((e) => e.issued_invoice_id).length ?? 0;
|
|
448
451
|
}
|
|
449
|
-
function
|
|
452
|
+
function q(e) {
|
|
450
453
|
let t = m();
|
|
451
454
|
if (!e) return t;
|
|
452
|
-
let n =
|
|
455
|
+
let n = v(e.start_date);
|
|
453
456
|
return {
|
|
454
457
|
frequency: e.frequency,
|
|
455
458
|
recurrenceStartDate: e.start_date.slice(0, 10),
|
|
@@ -467,4 +470,4 @@ function K(e) {
|
|
|
467
470
|
};
|
|
468
471
|
}
|
|
469
472
|
//#endregion
|
|
470
|
-
export { o as DEFAULT_RECURRENCE_AUTOMATION_LEVEL,
|
|
473
|
+
export { o as DEFAULT_RECURRENCE_AUTOMATION_LEVEL, M as applyRecurrenceEmailDraft, W as buildCreateRecurrencePayload, H as buildRecurrenceDeliveryPayload, P as buildRecurrenceEmailView, z as buildRecurrenceView, G as buildUpdateRecurrencePayload, O as clearRecurrenceRecipients, K as countIssuedIterations, m as createEmptyRecurrenceFields, k as createRecurrenceEmailDraft, R as isRecurrenceDateDisabled, _ as isRecurrenceEmailComplete, j as isRecurrenceEmailDraftComplete, h as isRecurring, q as recurrenceToFormFields, D as selectRecurrenceDate, T as selectRecurrenceDayOfWeek, E as selectRecurrenceEndMode, C as selectRecurrenceFrequency, w as selectRecurrenceIssueMode, N as shouldOpenRecurrenceEmail, V as validateRecurrence, g as willRecurrenceIssue };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RECEIVABLE_PAYMENT_TERMS_CUSTOM_DATE as e, RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as t } from "../../ui/dist/index10.js";
|
|
2
2
|
import "../../ui/dist/index.js";
|
|
3
|
-
import { addDays as n, addYears as r, format as i,
|
|
3
|
+
import { addDays as n, addYears as r, format as i, isValid as a, max as o, min as s, parseISO as c, subYears as l } from "date-fns";
|
|
4
4
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js
|
|
5
|
-
var
|
|
6
|
-
function
|
|
5
|
+
var u = "MMM d, yyyy", d = "yyyy-MM-dd", f = 10, p = 5;
|
|
6
|
+
function m(e) {
|
|
7
7
|
let t = (e) => e ? {
|
|
8
8
|
number_of_days: e.number_of_days ?? null,
|
|
9
9
|
discount: e.discount ?? null
|
|
@@ -16,39 +16,43 @@ function p(e) {
|
|
|
16
16
|
term_2: t(e.term_2)
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function h(e) {
|
|
20
20
|
let t = /* @__PURE__ */ new Set();
|
|
21
21
|
return e.filter((e) => {
|
|
22
|
-
let n =
|
|
22
|
+
let n = m(e);
|
|
23
23
|
return !t.has(n) && (t.add(n), !0);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
return i(e,
|
|
26
|
+
function g(e) {
|
|
27
|
+
return i(e, u);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function _(e, t) {
|
|
30
30
|
let r = e.term_final?.number_of_days;
|
|
31
31
|
return r ? n(t, r) : void 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
let n =
|
|
33
|
+
function v(e, t = /* @__PURE__ */ new Date()) {
|
|
34
|
+
let n = c(e);
|
|
35
|
+
return a(n) ? n : t;
|
|
36
|
+
}
|
|
37
|
+
function y(e, t) {
|
|
38
|
+
let n = _(e, t);
|
|
35
39
|
return {
|
|
36
40
|
value: e.id,
|
|
37
41
|
label: e.name,
|
|
38
|
-
...n ? { dueDateLabel:
|
|
42
|
+
...n ? { dueDateLabel: g(n) } : {}
|
|
39
43
|
};
|
|
40
44
|
}
|
|
41
|
-
function
|
|
42
|
-
return e ?
|
|
45
|
+
function b(e) {
|
|
46
|
+
return e ? c(e) : void 0;
|
|
43
47
|
}
|
|
44
|
-
function
|
|
48
|
+
function x({ terms: e, isLoading: t, fields: n, customDatePickerOpen: r, isRecurring: i = !1, messages: a, issueDate: o = /* @__PURE__ */ new Date() }) {
|
|
45
49
|
if (t) return { kind: "loading" };
|
|
46
|
-
let s =
|
|
50
|
+
let s = h(e ?? []).map((e) => y(e, o)), c = b(n.paymentTermsCustomDate), l;
|
|
47
51
|
if (n.paymentTermsId === "receipt_due") l = { kind: "receiptDue" };
|
|
48
52
|
else if (n.paymentTermsId === "custom") l = {
|
|
49
53
|
kind: "customDate",
|
|
50
54
|
hasDate: !!c,
|
|
51
|
-
dateLabel: c ?
|
|
55
|
+
dateLabel: c ? g(c) : a.paymentTermsCustomDatePlaceholder
|
|
52
56
|
};
|
|
53
57
|
else {
|
|
54
58
|
let e = s.find((e) => e.value === n.paymentTermsId);
|
|
@@ -67,15 +71,15 @@ function y({ terms: e, isLoading: t, fields: n, customDatePickerOpen: r, isRecur
|
|
|
67
71
|
...i ? { description: a.recurrenceSeriesPaymentTerms } : {}
|
|
68
72
|
};
|
|
69
73
|
}
|
|
70
|
-
function
|
|
71
|
-
let n =
|
|
74
|
+
function S(e, t = /* @__PURE__ */ new Date()) {
|
|
75
|
+
let n = b(e), i = l(t, f), a = r(t, p);
|
|
72
76
|
return {
|
|
73
77
|
selected: n,
|
|
74
|
-
startMonth: n ?
|
|
75
|
-
endMonth: n ?
|
|
78
|
+
startMonth: n ? s([i, n]) : i,
|
|
79
|
+
endMonth: n ? o([a, n]) : a
|
|
76
80
|
};
|
|
77
81
|
}
|
|
78
|
-
function
|
|
82
|
+
function C(e, t) {
|
|
79
83
|
return t === "custom" ? {
|
|
80
84
|
paymentTermsId: t,
|
|
81
85
|
paymentTermsCustomDate: e.paymentTermsId === "custom" ? e.paymentTermsCustomDate : ""
|
|
@@ -84,25 +88,25 @@ function x(e, t) {
|
|
|
84
88
|
paymentTermsCustomDate: ""
|
|
85
89
|
};
|
|
86
90
|
}
|
|
87
|
-
function
|
|
91
|
+
function w(e) {
|
|
88
92
|
return e.paymentTermsId === "custom" && !e.paymentTermsCustomDate ? {
|
|
89
93
|
paymentTermsId: "",
|
|
90
94
|
paymentTermsCustomDate: ""
|
|
91
95
|
} : e;
|
|
92
96
|
}
|
|
93
|
-
function
|
|
94
|
-
return e ? i(e,
|
|
97
|
+
function T(e) {
|
|
98
|
+
return e ? i(e, d) : "";
|
|
95
99
|
}
|
|
96
|
-
function
|
|
100
|
+
function E(e) {
|
|
97
101
|
return e.paymentTermsId === "custom" ? e.paymentTermsCustomDate ? { payment_terms: { term_final: { end_date: e.paymentTermsCustomDate } } } : { payment_terms: { term_final: { number_of_days: 0 } } } : e.paymentTermsId === "receipt_due" ? { payment_terms: { term_final: { number_of_days: 0 } } } : e.paymentTermsId ? { payment_terms_id: e.paymentTermsId } : {};
|
|
98
102
|
}
|
|
99
|
-
function
|
|
100
|
-
return e.paymentTermsId ?
|
|
103
|
+
function D(e) {
|
|
104
|
+
return e.paymentTermsId ? E(e) : {
|
|
101
105
|
payment_terms_id: null,
|
|
102
106
|
payment_terms: null
|
|
103
107
|
};
|
|
104
108
|
}
|
|
105
|
-
function
|
|
109
|
+
function O(n) {
|
|
106
110
|
if (n?.id) return {
|
|
107
111
|
paymentTermsId: n.id,
|
|
108
112
|
paymentTermsCustomDate: ""
|
|
@@ -120,4 +124,4 @@ function E(n) {
|
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
126
|
//#endregion
|
|
123
|
-
export {
|
|
127
|
+
export { S as buildCustomDateCalendar, E as buildPaymentTermsPayload, D as buildPaymentTermsUpdatePayload, x as buildPaymentTermsView, w as closeCustomDatePickerFields, h as dedupePaymentTerms, g as formatTermDate, O as paymentTermsToFormFields, v as resolveIssueDate, C as selectPaymentTermsFields, _ as termDueDate, T as toCustomDateValue };
|