@tesouro/embedded-components-react 0.5.228 → 0.5.230
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 +22 -21
- package/dist/index.d.ts +34 -1
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +34 -1
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index5.js +32 -33
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +34 -32
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +1 -1
- 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/index10.js +120 -52
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +44 -100
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +93 -337
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +356 -211
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +225 -157
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +152 -21
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +18 -221
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +224 -56
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +126 -231
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +53 -298
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +232 -43
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +295 -118
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +38 -145
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +126 -46
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +145 -117
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +38 -91
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +113 -107
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js +94 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index28.js +104 -619
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index29.js +34 -41
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index30.js +635 -34
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js +39 -77
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js +34 -117
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index33.js +75 -318
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index34.js +139 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index35.js +340 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +55 -468
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +443 -97
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +24 -21
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +32 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +205 -84
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +161 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +12 -20
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +23 -40
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +2 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +90 -68
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +3 -20
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +20 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +40 -30
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +14 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +15 -301
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +73 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +17 -45
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +12 -68
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +26 -490
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +294 -95
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +48 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +72 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +496 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +121 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +97 -91
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +2 -236
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +1 -249
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +89 -82
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +23 -54
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +223 -340
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +249 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +100 -216
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +59 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +353 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +35 -29
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +2 -216
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +9 -159
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +27 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +216 -23
- 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/product-catalog/feature/dist/index.js +12 -12
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +0 -28
|
@@ -1,473 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
import
|
|
1
|
+
import { priceInputToMinorUnits as e } from "./index6.js";
|
|
2
|
+
import { formatFileSize as t } from "./index7.js";
|
|
3
|
+
import { formatPrice as n } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
4
|
+
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
5
5
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
function g(e) {
|
|
56
|
-
return h(e) && e.recurrenceAutomationLevel !== "draft";
|
|
57
|
-
}
|
|
58
|
-
function _({ to: t = [], cc: n = [], bcc: r = [], subject: i, body: a }) {
|
|
59
|
-
return t.length > 0 && [
|
|
60
|
-
...t,
|
|
61
|
-
...n,
|
|
62
|
-
...r
|
|
63
|
-
].every((t) => e(t)) && !!(i?.trim() && a?.trim());
|
|
64
|
-
}
|
|
65
|
-
function v(e) {
|
|
66
|
-
return e ? i(e) : void 0;
|
|
67
|
-
}
|
|
68
|
-
function y(e) {
|
|
69
|
-
return e ? r(e, s) : "";
|
|
70
|
-
}
|
|
71
|
-
function b(e) {
|
|
72
|
-
return n(a(e), 1);
|
|
73
|
-
}
|
|
74
|
-
function x(e, t) {
|
|
75
|
-
let r = a(t), i = (f[e] - r.getDay() + 7) % 7 || 7;
|
|
76
|
-
return n(r, i);
|
|
77
|
-
}
|
|
78
|
-
var S = {
|
|
79
|
-
recurrenceStartDate: "",
|
|
80
|
-
recurrenceEndDate: "",
|
|
81
|
-
recurrenceIssueMode: "",
|
|
82
|
-
recurrenceDayOfWeek: "",
|
|
83
|
-
recurrenceEndMode: "",
|
|
84
|
-
recurrenceMaxOccurrences: ""
|
|
85
|
-
};
|
|
86
|
-
function C(e, n) {
|
|
87
|
-
let r = {
|
|
88
|
-
...e,
|
|
89
|
-
...S,
|
|
90
|
-
frequency: n
|
|
91
|
-
};
|
|
92
|
-
return u.includes(n) ? {
|
|
93
|
-
...r,
|
|
94
|
-
paymentTermsId: t,
|
|
95
|
-
paymentTermsCustomDate: "",
|
|
96
|
-
paymentReminderId: ""
|
|
97
|
-
} : n !== "once" && e.paymentTermsId === "custom" ? {
|
|
98
|
-
...r,
|
|
99
|
-
paymentTermsId: "",
|
|
100
|
-
paymentTermsCustomDate: ""
|
|
101
|
-
} : r;
|
|
102
|
-
}
|
|
103
|
-
function w(e, t, { lockSchedule: n }) {
|
|
104
|
-
return {
|
|
105
|
-
...e,
|
|
106
|
-
recurrenceIssueMode: t,
|
|
107
|
-
...n ? {} : { recurrenceStartDate: "" }
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function T(e, t, { lockSchedule: n, today: r = /* @__PURE__ */ new Date() }) {
|
|
111
|
-
return n || e.recurrenceDayOfWeek === t ? e : {
|
|
112
|
-
...e,
|
|
113
|
-
recurrenceDayOfWeek: t,
|
|
114
|
-
recurrenceStartDate: y(x(t, r))
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function E(e, t) {
|
|
118
|
-
return t === "after" ? {
|
|
119
|
-
...e,
|
|
120
|
-
recurrenceEndMode: t,
|
|
121
|
-
recurrenceEndDate: ""
|
|
122
|
-
} : {
|
|
123
|
-
...e,
|
|
124
|
-
recurrenceEndMode: t,
|
|
125
|
-
recurrenceMaxOccurrences: ""
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
function D(e, t, n) {
|
|
129
|
-
return {
|
|
130
|
-
...e,
|
|
131
|
-
[t]: y(n)
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function O(e) {
|
|
135
|
-
return {
|
|
136
|
-
...e,
|
|
137
|
-
recurrenceRecipientsTo: void 0,
|
|
138
|
-
recurrenceRecipientsCc: [],
|
|
139
|
-
recurrenceRecipientsBcc: []
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function k(e, t) {
|
|
143
|
-
return {
|
|
144
|
-
to: e.recurrenceRecipientsTo ?? (t ? [t] : []),
|
|
145
|
-
toInput: "",
|
|
146
|
-
cc: e.recurrenceRecipientsCc,
|
|
147
|
-
ccInput: "",
|
|
148
|
-
bcc: e.recurrenceRecipientsBcc,
|
|
149
|
-
bccInput: "",
|
|
150
|
-
subject: e.recurrenceSubject,
|
|
151
|
-
message: e.recurrenceBody
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
function A(e) {
|
|
155
|
-
let t = e.toInput.trim();
|
|
156
|
-
return t ? [...e.to, t] : e.to;
|
|
157
|
-
}
|
|
158
|
-
function j(e) {
|
|
159
|
-
return _({
|
|
160
|
-
to: A(e),
|
|
161
|
-
cc: e.cc,
|
|
162
|
-
bcc: e.bcc,
|
|
163
|
-
subject: e.subject,
|
|
164
|
-
body: e.message
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
function M(e, t) {
|
|
168
|
-
return {
|
|
169
|
-
...e,
|
|
170
|
-
recurrenceRecipientsTo: A(t),
|
|
171
|
-
recurrenceRecipientsCc: t.cc,
|
|
172
|
-
recurrenceRecipientsBcc: t.bcc,
|
|
173
|
-
recurrenceSubject: t.subject,
|
|
174
|
-
recurrenceBody: t.message
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
function N(e, t) {
|
|
178
|
-
return t === "issue_and_send" && !_({
|
|
179
|
-
to: e.recurrenceRecipientsTo,
|
|
180
|
-
cc: e.recurrenceRecipientsCc,
|
|
181
|
-
bcc: e.recurrenceRecipientsBcc,
|
|
182
|
-
subject: e.recurrenceSubject,
|
|
183
|
-
body: e.recurrenceBody
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
function P({ open: e, ready: t, draft: n, messages: r }) {
|
|
187
|
-
return {
|
|
188
|
-
open: e,
|
|
189
|
-
ready: t,
|
|
190
|
-
to: n.to,
|
|
191
|
-
toInput: n.toInput,
|
|
192
|
-
cc: n.cc,
|
|
193
|
-
ccInput: n.ccInput,
|
|
194
|
-
bcc: n.bcc,
|
|
195
|
-
bccInput: n.bccInput,
|
|
196
|
-
subject: n.subject,
|
|
197
|
-
message: n.message,
|
|
198
|
-
showToPlaceholder: n.to.length === 0,
|
|
199
|
-
saveDisabled: !j(n),
|
|
200
|
-
removeRecipientLabel: (e) => r.recurrenceRemoveRecipient.replace("{recipient}", e)
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
var F = [
|
|
204
|
-
"th",
|
|
205
|
-
"st",
|
|
206
|
-
"nd",
|
|
207
|
-
"rd"
|
|
208
|
-
];
|
|
209
|
-
function I(e) {
|
|
210
|
-
let t = e % 100;
|
|
211
|
-
return `${e}${F[(t - 20) % 10] ?? F[t] ?? F[0]}`;
|
|
212
|
-
}
|
|
213
|
-
function L(e, t) {
|
|
214
|
-
let [n, r] = {
|
|
215
|
-
day: [t.recurrenceUnitDay, t.recurrenceUnitDays],
|
|
216
|
-
week: [t.recurrenceUnitWeek, t.recurrenceUnitWeeks],
|
|
217
|
-
month: [t.recurrenceUnitMonth, t.recurrenceUnitMonths],
|
|
218
|
-
quarter: [t.recurrenceUnitQuarter, t.recurrenceUnitQuarters],
|
|
219
|
-
year: [t.recurrenceUnitYear, t.recurrenceUnitYears]
|
|
220
|
-
}[e];
|
|
221
|
-
return {
|
|
222
|
-
singular: n,
|
|
223
|
-
plural: r
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
function R(e, t, n = /* @__PURE__ */ new Date()) {
|
|
227
|
-
if (t < b(n)) return !0;
|
|
228
|
-
if (e.frequency === "week") return e.recurrenceDayOfWeek ? t.getDay() !== f[e.recurrenceDayOfWeek] : !1;
|
|
229
|
-
if (e.frequency !== "month" || !e.recurrenceIssueMode) return !1;
|
|
230
|
-
let r = t.getDate(), i = new Date(t.getFullYear(), t.getMonth() + 1, 0).getDate();
|
|
231
|
-
if (e.recurrenceIssueMode === "first_day") return r !== 1;
|
|
232
|
-
if (e.recurrenceIssueMode === "last_day") return r !== i;
|
|
233
|
-
let a = Number(e.recurrenceIssueMode);
|
|
234
|
-
return !Number.isNaN(a) && r !== Math.min(a, i);
|
|
235
|
-
}
|
|
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: {
|
|
238
|
-
value: a,
|
|
239
|
-
disabled: n,
|
|
240
|
-
options: [
|
|
241
|
-
{
|
|
242
|
-
value: "once",
|
|
243
|
-
label: r.recurrenceFrequencyOnce
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
value: "day",
|
|
247
|
-
label: r.recurrenceFrequencyDaily
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
value: "week",
|
|
251
|
-
label: r.recurrenceFrequencyWeekly
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
value: "month",
|
|
255
|
-
label: r.recurrenceFrequencyMonthly
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
value: "quarter",
|
|
259
|
-
label: r.recurrenceFrequencyQuarterly
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
value: "year",
|
|
263
|
-
label: r.recurrenceFrequencyAnnually
|
|
264
|
-
}
|
|
265
|
-
]
|
|
266
|
-
} };
|
|
267
|
-
if (a === "month" && (f.monthDay = {
|
|
268
|
-
value: e.recurrenceIssueMode,
|
|
269
|
-
disabled: n,
|
|
270
|
-
invalid: !!t?.recurrenceIssueMode,
|
|
271
|
-
edgeOptions: [{
|
|
272
|
-
value: "first_day",
|
|
273
|
-
label: r.recurrenceFirstDay
|
|
274
|
-
}, {
|
|
275
|
-
value: "last_day",
|
|
276
|
-
label: r.recurrenceLastDay
|
|
277
|
-
}],
|
|
278
|
-
dayOptions: Array.from({ length: 31 }, (e, t) => ({
|
|
279
|
-
value: String(t + 1),
|
|
280
|
-
label: I(t + 1)
|
|
281
|
-
}))
|
|
282
|
-
}), a === "week") {
|
|
283
|
-
let i = {
|
|
284
|
-
mo: r.recurrenceWeekdayMo,
|
|
285
|
-
tu: r.recurrenceWeekdayTu,
|
|
286
|
-
we: r.recurrenceWeekdayWe,
|
|
287
|
-
th: r.recurrenceWeekdayTh,
|
|
288
|
-
fr: r.recurrenceWeekdayFr,
|
|
289
|
-
sa: r.recurrenceWeekdaySa,
|
|
290
|
-
su: r.recurrenceWeekdaySu
|
|
291
|
-
};
|
|
292
|
-
f.weekday = {
|
|
293
|
-
disabled: n,
|
|
294
|
-
invalid: !!t?.recurrenceDayOfWeek,
|
|
295
|
-
options: d.map((t) => ({
|
|
296
|
-
value: t,
|
|
297
|
-
label: i[t],
|
|
298
|
-
pressed: e.recurrenceDayOfWeek === t
|
|
299
|
-
}))
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
if (a === "once") return f;
|
|
303
|
-
let p = {
|
|
304
|
-
value: o,
|
|
305
|
-
disabled: n || a === "week" && !e.recurrenceDayOfWeek,
|
|
306
|
-
invalid: !!t?.recurrenceStartDate,
|
|
307
|
-
minDate: c,
|
|
308
|
-
maxDate: s ?? l,
|
|
309
|
-
isDateDisabled: u
|
|
310
|
-
}, m = L(a, r), h = {
|
|
311
|
-
value: e.recurrenceMaxOccurrences,
|
|
312
|
-
unitLabel: Number(e.recurrenceMaxOccurrences) === 1 ? m.singular : m.plural,
|
|
313
|
-
invalid: !!t?.recurrenceMaxOccurrences
|
|
314
|
-
};
|
|
315
|
-
f.schedule = {
|
|
316
|
-
start: p,
|
|
317
|
-
end: a === "day" ? {
|
|
318
|
-
kind: "choice",
|
|
319
|
-
mode: {
|
|
320
|
-
value: e.recurrenceEndMode,
|
|
321
|
-
invalid: !!t?.recurrenceEndMode,
|
|
322
|
-
options: [{
|
|
323
|
-
value: "after",
|
|
324
|
-
label: r.recurrenceEndAfter
|
|
325
|
-
}, {
|
|
326
|
-
value: "on",
|
|
327
|
-
label: r.recurrenceEndOn
|
|
328
|
-
}]
|
|
329
|
-
},
|
|
330
|
-
...e.recurrenceEndMode === "on" ? { date: {
|
|
331
|
-
value: s,
|
|
332
|
-
disabled: !1,
|
|
333
|
-
invalid: !!t?.recurrenceEndDate,
|
|
334
|
-
minDate: o && o > c ? o : c,
|
|
335
|
-
maxDate: l,
|
|
336
|
-
isDateDisabled: u
|
|
337
|
-
} } : { occurrences: h }
|
|
338
|
-
} : {
|
|
339
|
-
kind: "count",
|
|
340
|
-
occurrences: h
|
|
6
|
+
function r(t, n) {
|
|
7
|
+
return t.filter((e) => !e.productId && e.name.trim()).map((t) => ({
|
|
8
|
+
key: t.id,
|
|
9
|
+
name: t.name,
|
|
10
|
+
price: e(t.price, n),
|
|
11
|
+
currency: n,
|
|
12
|
+
measureUnitId: t.measureUnitId
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
function i(e) {
|
|
16
|
+
let t = e.inlineItems.length > 0;
|
|
17
|
+
return e.mode === "issue" ? e.hasCustomerEmail ? {
|
|
18
|
+
openDetails: !1,
|
|
19
|
+
actionsModal: { showEmailStep: !0 }
|
|
20
|
+
} : t ? {
|
|
21
|
+
openDetails: !1,
|
|
22
|
+
actionsModal: { showEmailStep: !1 }
|
|
23
|
+
} : { openDetails: !1 } : t ? {
|
|
24
|
+
openDetails: !0,
|
|
25
|
+
actionsModal: { showEmailStep: !1 }
|
|
26
|
+
} : { openDetails: !0 };
|
|
27
|
+
}
|
|
28
|
+
function a(e, t, n) {
|
|
29
|
+
return t === "sent" ? n.actionsTitleSent : t === "issued" || e === "issue" ? n.actionsTitleIssued : e === "recurrence" ? n.actionsTitleRecurrence : n.actionsTitleDraft;
|
|
30
|
+
}
|
|
31
|
+
function o(e, t, n) {
|
|
32
|
+
return t ? e ? n.actionsSubjectWithNumber.replace("{documentId}", e).replace("{name}", t) : n.actionsSubject.replace("{name}", t) : "";
|
|
33
|
+
}
|
|
34
|
+
function s(e) {
|
|
35
|
+
return e?.type === "invoice" ? (e.attachments ?? []).map((e) => ({
|
|
36
|
+
id: e.id,
|
|
37
|
+
name: e.name,
|
|
38
|
+
sizeLabel: t(e.size)
|
|
39
|
+
})) : [];
|
|
40
|
+
}
|
|
41
|
+
function c(e, t) {
|
|
42
|
+
let r = n({
|
|
43
|
+
value: e.price,
|
|
44
|
+
currency: e.currency
|
|
45
|
+
}), i = e.measureUnitId ? t[e.measureUnitId] : void 0;
|
|
46
|
+
return i ? `${r} ${i}` : r;
|
|
47
|
+
}
|
|
48
|
+
function l(e) {
|
|
49
|
+
return {
|
|
50
|
+
name: e.name,
|
|
51
|
+
type: "product",
|
|
52
|
+
price: {
|
|
53
|
+
value: e.price,
|
|
54
|
+
currency: e.currency
|
|
341
55
|
},
|
|
342
|
-
|
|
343
|
-
}, (a === "month" || a === "quarter" || a === "year") && (f.lastDayCaption = r.recurrenceLastDayCaption);
|
|
344
|
-
let g = t?.recurrenceSubject ?? t?.recurrenceBody ?? t?.recurrenceRecipientsTo ?? t?.recurrenceRecipientsCc ?? t?.recurrenceRecipientsBcc;
|
|
345
|
-
return f.creationMode = {
|
|
346
|
-
value: e.recurrenceAutomationLevel,
|
|
347
|
-
options: [
|
|
348
|
-
{
|
|
349
|
-
value: "issue_and_send",
|
|
350
|
-
title: r.recurrenceModeIssueAndSendTitle,
|
|
351
|
-
description: r.recurrenceModeIssueAndSendDescription
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
value: "issue",
|
|
355
|
-
title: r.recurrenceModeIssueTitle,
|
|
356
|
-
description: r.recurrenceModeIssueDescription
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
value: "draft",
|
|
360
|
-
title: r.recurrenceModeDraftTitle,
|
|
361
|
-
description: r.recurrenceModeDraftDescription
|
|
362
|
-
}
|
|
363
|
-
],
|
|
364
|
-
...e.recurrenceAutomationLevel === "issue_and_send" ? { emailSummary: e.recurrenceRecipientsTo?.length ? e.recurrenceRecipientsTo.join(", ") : r.recurrenceNoRecipients } : {},
|
|
365
|
-
emailError: g
|
|
366
|
-
}, f;
|
|
367
|
-
}
|
|
368
|
-
function B(e, t, n) {
|
|
369
|
-
let { singular: r, plural: i } = L(t, n), a = (e) => e.replace("{unit}", r).replace("{units}", i);
|
|
370
|
-
if (!e) return a(n.recurrenceOccurrencesRequired);
|
|
371
|
-
let o = Number(e);
|
|
372
|
-
if (o < 1) return a(n.recurrenceOccurrencesTooFew);
|
|
373
|
-
if (o > c) return a(n.recurrenceOccurrencesTooMany);
|
|
374
|
-
if (!Number.isInteger(o)) return n.recurrenceOccurrencesWhole;
|
|
375
|
-
}
|
|
376
|
-
function V({ fields: t, issuedCount: n = 0, messages: r }) {
|
|
377
|
-
let { frequency: i } = t;
|
|
378
|
-
if (i === "once") return {};
|
|
379
|
-
let a = {};
|
|
380
|
-
t.recurrenceStartDate || (a.recurrenceStartDate = r.recurrenceStartDateRequired);
|
|
381
|
-
let o = i !== "day" || t.recurrenceEndMode === "after";
|
|
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) {
|
|
383
|
-
let e = B(t.recurrenceMaxOccurrences, i, r);
|
|
384
|
-
e && (a.recurrenceMaxOccurrences = e);
|
|
385
|
-
}
|
|
386
|
-
let s = i === "day" && t.recurrenceEndMode === "on";
|
|
387
|
-
if (!a.recurrenceMaxOccurrences && n > 0 && !s && t.recurrenceMaxOccurrences && Number(t.recurrenceMaxOccurrences) <= n && (a.recurrenceMaxOccurrences = r.recurrenceOccurrencesBelowIssued.replace("{count}", String(n))), t.recurrenceAutomationLevel === "issue_and_send") {
|
|
388
|
-
t.recurrenceSubject.trim() || (a.recurrenceSubject = r.recurrenceSubjectRequired), t.recurrenceBody.trim() || (a.recurrenceBody = r.recurrenceMessageRequired), t.recurrenceRecipientsTo?.length || (a.recurrenceRecipientsTo = r.recurrenceRecipientRequired);
|
|
389
|
-
let n = (t) => {
|
|
390
|
-
let n = t?.find((t) => !e(t));
|
|
391
|
-
return n ? r.recurrenceInvalidEmail.replace("{address}", n) : void 0;
|
|
392
|
-
}, i = n(t.recurrenceRecipientsTo);
|
|
393
|
-
i && !a.recurrenceRecipientsTo && (a.recurrenceRecipientsTo = i);
|
|
394
|
-
let o = n(t.recurrenceRecipientsCc);
|
|
395
|
-
o && (a.recurrenceRecipientsCc = o);
|
|
396
|
-
let s = n(t.recurrenceRecipientsBcc);
|
|
397
|
-
s && (a.recurrenceRecipientsBcc = s);
|
|
398
|
-
}
|
|
399
|
-
return a;
|
|
400
|
-
}
|
|
401
|
-
function H(e) {
|
|
402
|
-
let t = e.recurrenceAutomationLevel;
|
|
403
|
-
if (t !== "issue_and_send") return {
|
|
404
|
-
automation_level: t,
|
|
405
|
-
subject_text: null,
|
|
406
|
-
body_text: null,
|
|
407
|
-
recipients: null
|
|
408
|
-
};
|
|
409
|
-
let n = {
|
|
410
|
-
to: e.recurrenceRecipientsTo?.length ? e.recurrenceRecipientsTo : void 0,
|
|
411
|
-
cc: e.recurrenceRecipientsCc.length ? e.recurrenceRecipientsCc : void 0,
|
|
412
|
-
bcc: e.recurrenceRecipientsBcc.length ? e.recurrenceRecipientsBcc : void 0
|
|
413
|
-
};
|
|
414
|
-
return {
|
|
415
|
-
automation_level: t,
|
|
416
|
-
subject_text: e.recurrenceSubject || void 0,
|
|
417
|
-
body_text: e.recurrenceBody || void 0,
|
|
418
|
-
recipients: Object.values(n).some(Boolean) ? n : void 0
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
function U(e, { hasExistingRecurrence: t }) {
|
|
422
|
-
let n = e.frequency === "day" && e.recurrenceEndMode === "on" && !!e.recurrenceEndDate, r = t ? null : void 0;
|
|
423
|
-
return {
|
|
424
|
-
frequency: e.frequency,
|
|
425
|
-
start_date: e.recurrenceStartDate,
|
|
426
|
-
max_occurrences: n ? r : Number(e.recurrenceMaxOccurrences) || void 0,
|
|
427
|
-
end_date: n ? e.recurrenceEndDate : r
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
function W(e, t) {
|
|
431
|
-
return {
|
|
432
|
-
...U(e, { hasExistingRecurrence: !1 }),
|
|
433
|
-
...H(e),
|
|
434
|
-
invoice_id: t,
|
|
435
|
-
interval: 1
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
function G(e, { lockSchedule: t }) {
|
|
439
|
-
let n = U(e, { hasExistingRecurrence: !0 });
|
|
440
|
-
return t ? {
|
|
441
|
-
max_occurrences: n.max_occurrences,
|
|
442
|
-
end_date: n.end_date,
|
|
443
|
-
...H(e)
|
|
444
|
-
} : {
|
|
445
|
-
...n,
|
|
446
|
-
...H(e)
|
|
447
|
-
};
|
|
448
|
-
}
|
|
449
|
-
function K(e) {
|
|
450
|
-
return e?.iterations.filter((e) => e.issued_invoice_id).length ?? 0;
|
|
451
|
-
}
|
|
452
|
-
function q(e) {
|
|
453
|
-
let t = m();
|
|
454
|
-
if (!e) return t;
|
|
455
|
-
let n = v(e.start_date);
|
|
456
|
-
return {
|
|
457
|
-
frequency: e.frequency,
|
|
458
|
-
recurrenceStartDate: e.start_date.slice(0, 10),
|
|
459
|
-
recurrenceEndDate: e.end_date?.slice(0, 10) ?? "",
|
|
460
|
-
recurrenceEndMode: e.end_date ? "on" : "after",
|
|
461
|
-
recurrenceMaxOccurrences: e.max_occurrences == null ? "" : String(e.max_occurrences),
|
|
462
|
-
recurrenceIssueMode: n ? String(n.getDate()) : "first_day",
|
|
463
|
-
recurrenceDayOfWeek: n ? p[n.getDay()] : "",
|
|
464
|
-
recurrenceAutomationLevel: e.automation_level ?? "issue",
|
|
465
|
-
recurrenceSubject: e.subject_text ?? "",
|
|
466
|
-
recurrenceBody: e.body_text ?? "",
|
|
467
|
-
recurrenceRecipientsTo: e.recipients?.to ?? void 0,
|
|
468
|
-
recurrenceRecipientsCc: e.recipients?.cc ?? [],
|
|
469
|
-
recurrenceRecipientsBcc: e.recipients?.bcc ?? []
|
|
56
|
+
...e.measureUnitId ? { measure_unit_id: e.measureUnitId } : {}
|
|
470
57
|
};
|
|
471
58
|
}
|
|
472
59
|
//#endregion
|
|
473
|
-
export {
|
|
60
|
+
export { i as getCreateFollowUp, c as getInlineItemPriceLabel, r as getInlineItems, s as getIssueAttachments, o as getIssueSubject, a as getProductsStepTitle, l as inlineItemToProductRequest };
|