@tesouro/embedded-components-react 0.5.268 → 0.5.270

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/index.css +4 -10
  2. package/dist/index.d.ts +13 -9
  3. package/dist/lib/ReceivablesWidget.d.ts +13 -9
  4. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index.js +3 -1
  5. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +44 -0
  6. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +97 -0
  7. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +76 -150
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +63 -57
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/actionsModal.js +1 -1
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/auditHistory/labels.js +1 -1
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +161 -152
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +30 -34
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +12 -8
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusCards.js +18 -19
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +208 -158
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +91 -85
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +197 -196
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +147 -115
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +14 -14
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +3 -5
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +37 -34
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +22 -7
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +17 -15
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +17 -13
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +37 -31
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +29 -23
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +38 -11
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +26 -28
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +20 -14
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +8 -24
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +34 -83
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +14 -404
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +28 -2
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +79 -39
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +490 -68
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +2 -502
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +41 -216
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +70 -21
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +484 -5
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +224 -0
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +21 -263
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +8 -2
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +261 -24
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +2 -237
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +100 -3
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +21 -242
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +226 -82
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +3 -59
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +233 -178
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +85 -37
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +60 -0
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +194 -0
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +45 -0
  54. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  55. package/package.json +1 -1
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +0 -100
@@ -44,7 +44,7 @@ function w() {
44
44
  function T(e, n) {
45
45
  let r = t(e);
46
46
  return r ? new Intl.DateTimeFormat(void 0, {
47
- day: "numeric",
47
+ day: "2-digit",
48
48
  month: "short",
49
49
  year: "numeric"
50
50
  }).format(r) : n;
@@ -67,10 +67,7 @@ function O(e, t) {
67
67
  function k(e, t) {
68
68
  return e === "quote" ? t.quoteType : e === "credit_note" ? t.creditNoteType : t.invoiceType;
69
69
  }
70
- function A(e) {
71
- return e === "paid" || e === "accepted" || e === "issued" || e === "recurring" ? "success" : e === "draft" || e === "issuing" ? "neutral" : e === "overdue" || e === "partially_paid" ? "warning" : e === "failed" || e === "declined" || e === "expired" || e === "uncollectible" || e === "canceled" || e === "deleted" ? "danger" : "info";
72
- }
73
- function j(e, t, n) {
70
+ function A(e, t, n) {
74
71
  let r = e.counterpart_name || (e.counterpart_id ? t.names.get(e.counterpart_id) : void 0);
75
72
  return r ? {
76
73
  customerLabel: r,
@@ -83,18 +80,17 @@ function j(e, t, n) {
83
80
  customerState: "missing"
84
81
  };
85
82
  }
86
- var M = {
83
+ var j = {
87
84
  names: /* @__PURE__ */ new Map(),
88
85
  isResolving: !1
89
86
  };
90
- function N({ receivables: e, messages: t, customerNames: n = M }) {
87
+ function M({ receivables: e, messages: t, customerNames: n = j }) {
91
88
  return e.map((e) => ({
92
89
  id: e.id,
93
90
  type: e.type,
94
91
  documentLabel: e.document_id || t.pendingValue,
95
- ...j(e, n, t),
92
+ ...A(e, n, t),
96
93
  status: e.status,
97
- statusTone: A(e.status),
98
94
  issueDateLabel: T(e.issue_date, t.pendingValue),
99
95
  dueDateLabel: T(e.type === "invoice" ? e.due_date : void 0, t.pendingValue),
100
96
  totalLabel: E({
@@ -104,13 +100,13 @@ function N({ receivables: e, messages: t, customerNames: n = M }) {
104
100
  })
105
101
  }));
106
102
  }
107
- function P(e) {
103
+ function N(e) {
108
104
  if (e.memo || e.footer) return {
109
105
  opening: e.memo || void 0,
110
106
  closing: e.footer || void 0
111
107
  };
112
108
  }
113
- function F({ values: e, counterpart: t, addresses: n }) {
109
+ function P({ values: e, counterpart: t, addresses: n }) {
114
110
  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 || "";
115
111
  return {
116
112
  billingAddressId: i,
@@ -118,7 +114,7 @@ function F({ values: e, counterpart: t, addresses: n }) {
118
114
  shippingAddressId: a
119
115
  };
120
116
  }
121
- function I({ values: e, billingAddressId: t, messages: r, willIssue: i = !1, hasStartedRecurrence: a = !1 }) {
117
+ function F({ values: e, billingAddressId: t, messages: r, willIssue: i = !1, hasStartedRecurrence: a = !1 }) {
122
118
  let o = {};
123
119
  e.customerId ? t || (o.customerId = r.customerAddressRequired) : o.customerId = r.customerRequired;
124
120
  let s = e.customerEmail.trim();
@@ -132,24 +128,24 @@ function I({ values: e, billingAddressId: t, messages: r, willIssue: i = !1, has
132
128
  let f = x(e, r);
133
129
  return f && (o.discount = f), o;
134
130
  }
135
- function L(e) {
131
+ function I(e) {
136
132
  return Object.keys(e).length > 0;
137
133
  }
138
- function R(e, t) {
139
- return !L(I({
140
- values: V(e),
134
+ function L(e, t) {
135
+ return !I(F({
136
+ values: B(e),
141
137
  billingAddressId: e.type === "invoice" ? e.counterpart_billing_address?.id ?? void 0 : void 0,
142
138
  messages: t,
143
139
  willIssue: !0
144
140
  }));
145
141
  }
146
- function z({ bankAccountId: e, bankAccountType: t }) {
142
+ function R({ bankAccountId: e, bankAccountType: t }) {
147
143
  return {
148
144
  bank_account_id: e || void 0,
149
145
  bank_account_type: e && t || void 0
150
146
  };
151
147
  }
152
- function B({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById: r }) {
148
+ function z({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById: r }) {
153
149
  let a = e.lineItems.filter((e) => !i(e)).map((t) => o({
154
150
  lineItem: t,
155
151
  currency: e.currency,
@@ -164,7 +160,7 @@ function B({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById
164
160
  memo: e.openingNote,
165
161
  footer: e.closingNote,
166
162
  discount: y(e) ?? void 0,
167
- ...z(e)
163
+ ...R(e)
168
164
  };
169
165
  return e.type === "quote" ? {
170
166
  ...s,
@@ -180,7 +176,7 @@ function B({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById
180
176
  type: "invoice"
181
177
  };
182
178
  }
183
- function V(e, t) {
179
+ function B(e, t) {
184
180
  let n = e.type === "quote" ? "quote" : "invoice", i = u(e.line_items), a = e.type === "invoice" ? e : void 0, o = e.line_items.map((n) => c({
185
181
  lineItem: n,
186
182
  currency: e.currency,
@@ -191,8 +187,8 @@ function V(e, t) {
191
187
  type: n,
192
188
  customerId: e.counterpart_id,
193
189
  currency: e.currency,
194
- issueDate: K(e.issue_date),
195
- dueDate: e.type === "quote" ? K(e.expiry_date) : "",
190
+ issueDate: G(e.issue_date),
191
+ dueDate: e.type === "quote" ? G(e.expiry_date) : "",
196
192
  openingNote: e.memo ?? "",
197
193
  closingNote: e.footer ?? "",
198
194
  ...e.type === "invoice" ? _(e.payment_terms) : {},
@@ -201,7 +197,7 @@ function V(e, t) {
201
197
  ...b(e.discount, e.currency),
202
198
  lineItems: o.length > 0 ? o : [r(e.currency)],
203
199
  bankAccountId: e.bank_account_id ?? "",
204
- bankAccountType: H(e.bank_account_type),
200
+ bankAccountType: V(e.bank_account_type),
205
201
  billingAddressId: e.counterpart_billing_address?.id ?? "",
206
202
  shippingAddressId: e.counterpart_shipping_address?.id ?? "",
207
203
  paymentReminderId: a?.payment_reminder_id ?? "",
@@ -210,10 +206,10 @@ function V(e, t) {
210
206
  attachments: p(e)
211
207
  };
212
208
  }
213
- function H(e) {
209
+ function V(e) {
214
210
  return e === "BANK_DETAILS" || e === "INTERNAL" || e === "EXTERNAL" ? e : "";
215
211
  }
216
- function U({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChanges: r }) {
212
+ function H({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChanges: r }) {
217
213
  let i = {
218
214
  counterpart_billing_address_id: t,
219
215
  counterpart_shipping_address_id: n || null,
@@ -223,7 +219,7 @@ function U({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChang
223
219
  memo: e.openingNote,
224
220
  footer: e.closingNote,
225
221
  discount: y(e),
226
- ...z(e)
222
+ ...R(e)
227
223
  };
228
224
  return e.type === "quote" ? { quote: {
229
225
  ...i,
@@ -239,7 +235,7 @@ function U({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChang
239
235
  attachments: f(e.attachments) ?? null
240
236
  } };
241
237
  }
242
- function W({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: r, units: o }) {
238
+ function U({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: r, units: o }) {
243
239
  let l = u(t), d = a(e.taxRate, l), f = (e, t, n) => s({
244
240
  lineItem: e,
245
241
  currency: t,
@@ -265,7 +261,7 @@ function W({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById
265
261
  ...v.length ? { remove: v } : {}
266
262
  };
267
263
  }
268
- function G({ values: e, originalLineItems: t, changes: n }) {
264
+ function W({ values: e, originalLineItems: t, changes: n }) {
269
265
  let r = e.lineItems.filter((e) => !i(e)).map((e) => e.id);
270
266
  if (!t) return { created: r };
271
267
  let a = new Set(t.map((e) => e.id));
@@ -274,20 +270,20 @@ function G({ values: e, originalLineItems: t, changes: n }) {
274
270
  replaced: n?.replace?.map((e) => e.id) ?? []
275
271
  };
276
272
  }
277
- function K(e) {
273
+ function G(e) {
278
274
  return e?.slice(0, 10) ?? "";
279
275
  }
280
- function q(e, t) {
276
+ function K(e, t) {
281
277
  let n = {};
282
278
  return e.to.trim() || (n.to = t.sendToRequired), e.subject.trim() || (n.subject = t.sendSubjectRequired), e.body.trim() || (n.body = t.sendBodyRequired), n;
283
279
  }
284
- function J(e) {
280
+ function q(e) {
285
281
  return Object.keys(e).length > 0;
286
282
  }
287
- function Y(e) {
283
+ function J(e) {
288
284
  return e.split(",").map((e) => e.trim()).filter(Boolean);
289
285
  }
290
- function X(e, t) {
286
+ function Y(e, t) {
291
287
  return {
292
288
  ...C,
293
289
  to: e?.counterpart_contact?.email ?? "",
@@ -296,4 +292,4 @@ function X(e, t) {
296
292
  };
297
293
  }
298
294
  //#endregion
299
- export { C as EMPTY_RECEIVABLE_SEND_VALUES, P as buildReceivableNotesView, N as buildReceivableRows, w as createEmptyReceivableFormValues, r as createLineItem, X as defaultSendValues, T as formatDate, E as formatMoney, D as fromMajorUnits, O as getDocumentTitle, k as getDocumentTypeLabel, A as getStatusTone, L as hasReceivableFormErrors, J as hasSendErrors, R as isReceivableReadyToIssue, B as receivableFormValuesToCreatePayload, W as receivableFormValuesToLineItemChanges, U as receivableFormValuesToUpdatePayload, V as receivableToFormValues, F as resolveCounterpartAddresses, Y as splitEmailList, G as submittedLineItemRows, I as validateReceivableForm, q as validateSendValues };
295
+ export { C as EMPTY_RECEIVABLE_SEND_VALUES, N as buildReceivableNotesView, M as buildReceivableRows, w as createEmptyReceivableFormValues, r as createLineItem, Y as defaultSendValues, T as formatDate, E as formatMoney, D as fromMajorUnits, O as getDocumentTitle, k as getDocumentTypeLabel, I as hasReceivableFormErrors, q as hasSendErrors, L as isReceivableReadyToIssue, z as receivableFormValuesToCreatePayload, U as receivableFormValuesToLineItemChanges, H as receivableFormValuesToUpdatePayload, B as receivableToFormValues, P as resolveCounterpartAddresses, J as splitEmailList, W as submittedLineItemRows, F as validateReceivableForm, K as validateSendValues };
@@ -47,6 +47,8 @@ var e = {
47
47
  creditNoteType: "Credit note",
48
48
  detailsUnsupportedTitle: "Receivable type not supported",
49
49
  detailsUnsupportedDescription: "Receivable type {type} is not supported. Only invoice is supported.",
50
+ detailsNotFoundTitle: "Invoice not found",
51
+ detailsNotFoundDescription: "There is no invoice for the provided id: {invoiceId}",
50
52
  detailsInvoiceSubtitle: "Invoice: {number}",
51
53
  detailsDaysOverdue: "{days} days overdue",
52
54
  detailsInvoiceAmount: "Invoice amount",
@@ -99,21 +101,22 @@ var e = {
99
101
  detailsIterationStatusCompleted: "Complete",
100
102
  sendSubjectDefault: "Your receivable document",
101
103
  sendBodyDefault: "Please find the receivable document attached.",
102
- issueTitle: "Issue receivable?",
103
- issueDescription: "Issuing locks the document and makes it ready to send to the customer.",
104
- issueConfirm: "Issue",
104
+ issueSucceeded: "Invoice has been issued",
105
105
  acceptTitle: "Accept quote?",
106
106
  acceptDescription: "This marks the quote as accepted.",
107
107
  acceptConfirm: "Accept",
108
108
  declineTitle: "Decline quote?",
109
109
  declineDescription: "This marks the quote as declined.",
110
110
  declineConfirm: "Decline",
111
+ issueFailed: "Failed to issue invoice. Add any missing information to your draft invoice and try again.",
112
+ issueAndSendNoEmail: "This customer has no email address. Add one in the customer details to send the invoice.",
111
113
  cancelTitle: "Cancel receivable?",
112
- cancelDescription: "This cancels the document. You cannot undo this action.",
113
- cancelConfirm: "Cancel document",
114
- cloneTitle: "Clone receivable?",
115
- cloneDescription: "This creates a new draft based on the selected document.",
116
- cloneConfirm: "Clone",
114
+ cancelNumberedTitle: "Cancel receivable \"{number}\"?",
115
+ cancelDescription: "This action can't be undone.",
116
+ cancelConfirm: "Cancel",
117
+ cancelClose: "Close",
118
+ cloneSuccess: "Invoice duplicate has been created.",
119
+ cloneError: "Failed to duplicate invoice.",
117
120
  deleteTitle: "Delete draft?",
118
121
  deleteDescription: "This permanently deletes the draft document. You cannot undo this action.",
119
122
  deleteConfirm: "Delete",
@@ -246,6 +249,7 @@ var e = {
246
249
  actionsTitleIssued: "Invoice issued",
247
250
  actionsTitleRecurrence: "Recurring billing activated",
248
251
  actionsTitleDraft: "Draft saved",
252
+ actionsTitleUpdated: "Invoice updated",
249
253
  actionsSelectAll: "Select all",
250
254
  actionsDeselectAll: "Deselect all",
251
255
  actionsProductsSaved: "Products and services saved.",
@@ -1,6 +1,6 @@
1
- import { formatMoney as e, getStatusTone as t } from "./helpers.js";
1
+ import { formatMoney as e } from "./helpers.js";
2
2
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusCards.js
3
- var n = [
3
+ var t = [
4
4
  "draft",
5
5
  "issued",
6
6
  "overdue",
@@ -10,35 +10,34 @@ var n = [
10
10
  "canceled",
11
11
  "uncollectible"
12
12
  ];
13
- function r(e) {
14
- let t = n.indexOf(e);
15
- return t === -1 ? n.length : t;
13
+ function n(e) {
14
+ let n = t.indexOf(e);
15
+ return n === -1 ? t.length : n;
16
16
  }
17
- function i({ counts: n, amounts: i, statusFilter: a, statusLabels: o, fallback: s }) {
18
- let c = new Map(Object.entries(o)), l = new Map(i.map((e) => [e.dimension_value, e.metric_value])), u = n.flatMap((e) => e.dimension_value ? [{
17
+ function r({ counts: t, amounts: r, statusFilter: i, statusLabels: a, fallback: o }) {
18
+ let s = new Map(Object.entries(a)), c = new Map(r.map((e) => [e.dimension_value, e.metric_value])), l = t.flatMap((e) => e.dimension_value ? [{
19
19
  status: e.dimension_value,
20
20
  count: e.metric_value
21
- }] : []), d = u.filter(({ status: e }) => e !== "recurring").reduce((e, { count: t }) => e + t, 0);
21
+ }] : []), u = l.filter(({ status: e }) => e !== "recurring").reduce((e, { count: t }) => e + t, 0);
22
22
  return {
23
23
  kind: "ready",
24
24
  all: {
25
25
  value: "all",
26
- countLabel: String(d),
27
- selected: a === "all"
26
+ countLabel: String(u),
27
+ selected: i === "all"
28
28
  },
29
- statuses: [...u].sort((e, t) => r(e.status) - r(t.status)).map(({ status: n, count: r }) => ({
30
- value: n,
31
- statusLabel: c.get(n) ?? o.unknown,
32
- statusTone: t(n),
33
- countLabel: String(r),
29
+ statuses: [...l].sort((e, t) => n(e.status) - n(t.status)).map(({ status: t, count: n }) => ({
30
+ value: t,
31
+ statusLabel: s.get(t) ?? a.unknown,
32
+ countLabel: String(n),
34
33
  amountLabel: e({
35
- amount: l.get(n) ?? 0,
34
+ amount: c.get(t) ?? 0,
36
35
  currency: "USD",
37
- fallback: s
36
+ fallback: o
38
37
  }),
39
- selected: a === n
38
+ selected: i === t
40
39
  }))
41
40
  };
42
41
  }
43
42
  //#endregion
44
- export { i as buildReceivableStatusCardsView };
43
+ export { r as buildReceivableStatusCardsView };