@tesouro/embedded-components-react 0.2.281 → 0.2.283

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 (52) hide show
  1. package/dist/index.css +17 -6
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +9 -5
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +42 -39
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +69 -54
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +21 -2
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +46 -41
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +81 -1
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +46 -47
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -11
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +2 -8
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +5 -3
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +43 -5
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +1 -102
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +11 -3
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +9 -6
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +4 -5
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +127 -76
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +6 -6
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +7 -112
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +85 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +16 -12
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +2 -24
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +8 -0
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +114 -0
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +1 -0
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +25 -0
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +50 -49
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +1 -1
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +25 -12
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +86 -69
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +2 -1
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +7 -7
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +17 -16
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +1 -0
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +89 -124
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +2 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +31 -26
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +1 -1
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +80 -77
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +20 -4
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +228 -6
  45. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +4 -4
  46. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListRow.js +13 -15
  47. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +6 -6
  48. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +53 -11
  49. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  50. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +1 -1
  51. package/dist/packages/shared-ui-shadcn/dist/index.js +3445 -3413
  52. package/package.json +1 -1
package/dist/index.css CHANGED
@@ -743,6 +743,9 @@
743
743
  .ttw\:h-28 {
744
744
  height: calc(var(--ttw-spacing) * 28);
745
745
  }
746
+ .ttw\:h-32 {
747
+ height: calc(var(--ttw-spacing) * 32);
748
+ }
746
749
  .ttw\:h-36\.5 {
747
750
  height: calc(var(--ttw-spacing) * 36.5);
748
751
  }
@@ -1127,9 +1130,6 @@
1127
1130
  .ttw\:w-120 {
1128
1131
  width: calc(var(--ttw-spacing) * 120);
1129
1132
  }
1130
- .ttw\:w-140 {
1131
- width: calc(var(--ttw-spacing) * 140);
1132
- }
1133
1133
  .ttw\:w-150 {
1134
1134
  width: calc(var(--ttw-spacing) * 150);
1135
1135
  }
@@ -1834,6 +1834,9 @@
1834
1834
  .ttw\:gap-y-0\.5 {
1835
1835
  row-gap: calc(var(--ttw-spacing) * 0.5);
1836
1836
  }
1837
+ .ttw\:gap-y-1 {
1838
+ row-gap: var(--ttw-spacing);
1839
+ }
1837
1840
  .ttw\:gap-y-2 {
1838
1841
  row-gap: calc(var(--ttw-spacing) * 2);
1839
1842
  }
@@ -3855,6 +3858,9 @@
3855
3858
  width: calc(var(--ttw-spacing) * 3);
3856
3859
  height: calc(var(--ttw-spacing) * 3);
3857
3860
  }
3861
+ .ttw\:group-data-\[state\=closed\]\:-rotate-90:is(:where(.ttw\:group)[data-state="closed"] *) {
3862
+ rotate: calc(90deg * -1);
3863
+ }
3858
3864
  .ttw\:group-data-\[state\=open\]\:rotate-180:is(:where(.ttw\:group)[data-state="open"] *) {
3859
3865
  rotate: 180deg;
3860
3866
  }
@@ -4467,6 +4473,14 @@
4467
4473
  .ttw\:focus-visible\:ring-offset-background:focus-visible {
4468
4474
  --tw-ring-offset-color: var(--ttw-background);
4469
4475
  }
4476
+ .ttw\:focus-visible\:outline-hidden:focus-visible {
4477
+ --tw-outline-style: none;
4478
+ outline-style: none;
4479
+ @media (forced-colors: active) {
4480
+ outline: 2px solid transparent;
4481
+ outline-offset: 2px;
4482
+ }
4483
+ }
4470
4484
  .ttw\:focus-visible\:outline-1:focus-visible {
4471
4485
  outline-style: var(--tw-outline-style);
4472
4486
  outline-width: 1px;
@@ -5314,9 +5328,6 @@
5314
5328
  .ttw\:sm\:max-w-2xl {
5315
5329
  max-width: var(--ttw-container-2xl);
5316
5330
  }
5317
- .ttw\:sm\:max-w-140 {
5318
- max-width: calc(var(--ttw-spacing) * 140);
5319
- }
5320
5331
  .ttw\:sm\:max-w-150 {
5321
5332
  max-width: calc(var(--ttw-spacing) * 150);
5322
5333
  }
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import "./lib/AcceptDisclosuresWidget.js";
16
16
  import { BankAccountsWidget as C } from "./libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js";
17
17
  import "./lib/BankAccountsWidget.js";
18
18
  import { CounterpartsWidget as w } from "./libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js";
19
- import { BillPayWidget as T } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js";
19
+ import { BillPayWidget as T } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js";
20
20
  import "./lib/BillPayWidget.js";
21
21
  import { CardDetailsWidget as E } from "./libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js";
22
22
  import { CardFormatValue as D } from "./libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index3.js";
@@ -1,3 +1,3 @@
1
- import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js";
1
+ import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js";
2
2
  import "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js";
3
3
  export { e as BillPayWidget };
@@ -3,14 +3,18 @@ import "./index8.js";
3
3
  import "./index10.js";
4
4
  import "./index12.js";
5
5
  import "./index13.js";
6
+ import "./index14.js";
7
+ import "./index15.js";
8
+ import "./index16.js";
6
9
  import "./index17.js";
7
- import "./index19.js";
8
- import "./index20.js";
9
- import "./index21.js";
10
- import "./index22.js";
10
+ import "./index18.js";
11
11
  import "./index23.js";
12
12
  import "./index24.js";
13
13
  import "./index25.js";
14
14
  import "./index26.js";
15
- import { BillPayWidget as e } from "./index30.js";
15
+ import "./index27.js";
16
+ import "./index28.js";
17
+ import "./index29.js";
18
+ import "./index30.js";
19
+ import { BillPayWidget as e } from "./index34.js";
16
20
  export { e as BillPayWidget };
@@ -2,66 +2,69 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { calculateTotal as e, displayLineAmount as t } from "./index6.js";
6
- import { emptyLineItem as n, mapPayableToBillForm as r } from "./index9.js";
7
- import { useCallback as i, useEffect as a, useMemo as o, useState as s } from "react";
5
+ import { calculateTotal as e, displayLineAmount as t, parseMoneyToMinorUnits as n } from "./index6.js";
6
+ import { emptyLineItem as r, mapPayableToBillForm as i } from "./index9.js";
7
+ import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
8
8
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js
9
- function c({ payable: c, lineItems: l } = {}) {
10
- let u = o(() => r({
11
- payable: c ?? {},
12
- lineItems: l ?? []
13
- }), [c, l]), [d, f] = s(u.values), [p, m] = s(u.lineItems), [h, g] = s(u.discount), [_, v] = s(u.tax), [y, b] = s(), [x, S] = s(), [C, w] = s(), [T, E] = s(!1), [D, O] = s(!1), [k, A] = s(!1);
14
- a(() => {
9
+ function l(e, r, i) {
10
+ return n(r) === null ? i : t(e, r);
11
+ }
12
+ function u({ payable: t, lineItems: n } = {}) {
13
+ let u = s(() => i({
14
+ payable: t ?? {},
15
+ lineItems: n ?? []
16
+ }), [t, n]), [d, f] = c(u.values), [p, m] = c(u.lineItems), [h, g] = c(u.discount), [_, v] = c(u.tax), [y, b] = c(u.total || void 0), [x, S] = c(), [C, w] = c(), [T, E] = c(!1), [D, O] = c(!1), [k, A] = c(!1);
17
+ o(() => {
15
18
  T || f(u.values);
16
- }, [u]), a(() => {
19
+ }, [u]), o(() => {
17
20
  D || m(u.lineItems);
18
- }, [u]), a(() => {
19
- k || (g(u.discount), v(u.tax));
21
+ }, [u]), o(() => {
22
+ k || (g(u.discount), v(u.tax), b(u.total || void 0));
20
23
  }, [u]);
21
- let j = i((e) => {
24
+ let j = a((e) => {
22
25
  f((t) => ({
23
26
  ...t,
24
27
  ...e
25
28
  })), E(!0);
26
- }, []), M = i((e) => {
29
+ }, []), M = a((e) => {
27
30
  w((t) => {
28
31
  if (!t?.[e]) return t;
29
32
  let n = { ...t };
30
33
  return delete n[e], Object.keys(n).length ? n : void 0;
31
34
  });
32
- }, []), N = i((e, n) => {
33
- M(e), m((r) => r.map((r) => {
34
- if (r.id !== e) return r;
35
- let i = {
36
- ...r,
37
- ...n
35
+ }, []), N = a((e, t) => {
36
+ M(e), m((n) => n.map((n) => {
37
+ if (n.id !== e) return n;
38
+ let r = {
39
+ ...n,
40
+ ...t
38
41
  };
39
- return "amount" in n ? i : {
40
- ...i,
41
- amount: t(i.quantity, i.price)
42
+ return "amount" in t ? r : {
43
+ ...r,
44
+ amount: l(r.quantity, r.price, r.amount)
42
45
  };
43
46
  })), O(!0), b(void 0);
44
- }, [M]), P = i((e, n) => {
45
- M(e), m((r) => r.map((r) => {
46
- if (r.id !== e) return r;
47
- let i = Number.parseFloat(r.quantity), a = String(Math.max(1, (Number.isFinite(i) ? i : 1) + n));
47
+ }, [M]), P = a((e, t) => {
48
+ M(e), m((n) => n.map((n) => {
49
+ if (n.id !== e) return n;
50
+ let r = Number.parseFloat(n.quantity), i = String(Math.max(1, (Number.isFinite(r) ? r : 1) + t));
48
51
  return {
49
- ...r,
50
- quantity: a,
51
- amount: t(a, r.price)
52
+ ...n,
53
+ quantity: i,
54
+ amount: l(i, n.price, n.amount)
52
55
  };
53
56
  })), O(!0), b(void 0);
54
- }, [M]), F = i((e) => {
57
+ }, [M]), F = a((e) => {
55
58
  M(e), m((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e)), O(!0), b(void 0);
56
- }, [M]), I = i(() => {
57
- m((e) => [...e, n()]), O(!0), b(void 0);
58
- }, []), L = i((e) => {
59
+ }, [M]), I = a(() => {
60
+ m((e) => [...e, r()]), O(!0), b(void 0);
61
+ }, []), L = a((e) => {
59
62
  g(e), A(!0), b(void 0);
60
- }, []), R = i((e) => {
63
+ }, []), R = a((e) => {
61
64
  v(e), A(!0), b(void 0);
62
- }, []), z = i((e) => {
65
+ }, []), z = a((e) => {
63
66
  b(e), A(!0);
64
- }, []), B = o(() => p.map((e) => ({
67
+ }, []), B = s(() => p.map((e) => ({
65
68
  ...e,
66
69
  onChange: (t) => N(e.id, t),
67
70
  onQuantityStep: (t) => P(e.id, t),
@@ -71,7 +74,7 @@ function c({ payable: c, lineItems: l } = {}) {
71
74
  N,
72
75
  F,
73
76
  P
74
- ]), V = o(() => e(p, _, h), [
77
+ ]), V = s(() => e(p, _, h), [
75
78
  p,
76
79
  _,
77
80
  h
@@ -98,4 +101,4 @@ function c({ payable: c, lineItems: l } = {}) {
98
101
  };
99
102
  }
100
103
  //#endregion
101
- export { c as useBillForm };
104
+ export { u as useBillForm };
@@ -19,79 +19,94 @@ import { billCreateTestIds as u } from "./index11.js";
19
19
  import { useCallback as d, useEffect as f, useMemo as p, useState as m } from "react";
20
20
  import { jsx as h } from "react/jsx-runtime";
21
21
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js
22
- function g({ open: g, onOpenChange: _, payableId: v, copy: y }) {
23
- let b = {
22
+ function g({ open: g, onOpenChange: _, payableId: v, readOnly: y, copy: b }) {
23
+ let x = {
24
24
  ...t,
25
- ...y
26
- }, [x, S] = m(), [C, w] = m(!1), [T, E] = m(!1), [D, O] = m(), k = v ?? D, A = r(k, { pollWhileOcrProcessing: !0 }), j = n(k), M = e(), N = A.data, P = a({
27
- payable: N,
28
- lineItems: j.lineItems
29
- }), F = N?.counterpart_id;
25
+ ...b
26
+ }, [S, C] = m(), [w, T] = m(!1), [E, D] = m(!1), [O, k] = m(), A = v ?? O, j = r(A, { pollWhileOcrProcessing: !0 }), M = n(A), N = e(), P = j.data, F = a({
27
+ payable: P,
28
+ lineItems: M.lineItems
29
+ }), I = P?.counterpart_id;
30
30
  f(() => {
31
- C || F && (S(F), w(!0));
32
- }, [C, F]);
33
- let I = d((e) => {
34
- w(!0), S(e);
35
- }, []), L = i({
31
+ w || I && (C(I), T(!0));
32
+ }, [w, I]);
33
+ let L = d((e) => {
34
+ T(!0), C(e);
35
+ }, []), R = i({
36
36
  payableId: v,
37
- form: P,
38
- counterpartId: x,
39
- onPayableCreated: O,
40
- onSaved: O,
37
+ form: F,
38
+ counterpartId: S,
39
+ onPayableCreated: k,
40
+ onSaved: k,
41
41
  onDraftSaved: () => _(!1),
42
42
  onFinalized: () => _(!1)
43
- }), R = p(() => (M.data?.data ?? []).map((e) => ({
43
+ }), z = !!(R.isSavingDraft || R.isFinalizing), B = p(() => (N.data?.data ?? []).map((e) => ({
44
44
  value: e.id,
45
45
  label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
46
- })), [M.data]), z = N?.source_of_payable_data === "ocr", B = N?.counterpart_raw_data?.name, V = () => {
47
- P.isDirty && !window.confirm(b.discardConfirm) || _(!1);
48
- }, H = l({
49
- payableId: k,
50
- counterpartId: x,
51
- payableCounterpartId: F,
52
- onCounterpartChange: I
46
+ })), [N.data]), V = P?.source_of_payable_data === "ocr", H = P?.counterpart_raw_data?.name, U = d(() => {
47
+ !y && F.isDirty && !window.confirm(x.discardConfirm) || _(!1);
48
+ }, [
49
+ x.discardConfirm,
50
+ F.isDirty,
51
+ _,
52
+ y
53
+ ]), W = d((e) => {
54
+ if (!z) return e ? _(!0) : U();
55
+ }, [
56
+ U,
57
+ z,
58
+ _
59
+ ]), G = l({
60
+ payableId: A,
61
+ counterpartId: S,
62
+ payableCounterpartId: I,
63
+ onCounterpartChange: L,
64
+ requiredError: F.errors?.vendor
53
65
  });
54
66
  return /* @__PURE__ */ h(o, {
55
67
  open: g,
56
- onOpenChange: (e) => e ? _(!0) : V(),
57
- title: z && B ? b.extractedTitle(B) : b.newTitle,
58
- notice: z && !T ? /* @__PURE__ */ h(s, { onDismiss: () => E(!0) }) : void 0,
68
+ onOpenChange: W,
69
+ title: y ? x.readOnlyTitle : V && H ? x.extractedTitle(H) : x.newTitle,
70
+ notice: V && !E ? /* @__PURE__ */ h(s, { onDismiss: () => D(!0) }) : void 0,
59
71
  vendor: {
60
- ...H,
72
+ ...G,
61
73
  testId: u.vendorSection
62
74
  },
63
- values: P.values,
64
- errors: P.errors,
65
- onChange: P.onChange,
75
+ values: F.values,
76
+ errors: F.errors,
77
+ onChange: F.onChange,
66
78
  lineItems: {
67
- items: P.lineItemRows,
68
- glCodeOptions: R,
69
- discount: P.discount,
70
- onDiscountChange: P.onDiscountChange,
71
- tax: P.tax,
72
- onTaxChange: P.onTaxChange,
73
- total: P.total,
74
- onTotalChange: P.onTotalChange,
75
- onAddLineItem: P.onAddLineItem,
76
- errors: P.lineItemErrors,
79
+ items: F.lineItemRows,
80
+ glCodeOptions: B,
81
+ discount: F.discount,
82
+ onDiscountChange: F.onDiscountChange,
83
+ tax: F.tax,
84
+ onTaxChange: F.onTaxChange,
85
+ total: F.total,
86
+ onTotalChange: F.onTotalChange,
87
+ onAddLineItem: F.onAddLineItem,
88
+ errors: F.lineItemErrors,
77
89
  testId: u.lineItems
78
90
  },
79
91
  documentPanel: /* @__PURE__ */ h(c, {
80
- payableId: k,
81
- isDocumentPending: !!k && !N?.file && (A.isLoading || N?.ocr_status === "processing"),
82
- file: N?.file ? {
83
- id: N.file.id,
84
- name: N.file.name,
85
- url: N.file.url,
86
- mimetype: N.file.mimetype
92
+ payableId: A,
93
+ readOnly: y,
94
+ isDocumentPending: !!A && !P?.file && (j.isLoading || P?.ocr_status === "processing"),
95
+ file: P?.file ? {
96
+ id: P.file.id,
97
+ name: P.file.name,
98
+ url: P.file.url,
99
+ mimetype: P.file.mimetype
87
100
  } : void 0
88
101
  }),
89
- isLineItemsLoading: j.isResolving,
90
- isSavingDraft: L.isSavingDraft,
91
- isFinalizing: L.isFinalizing,
92
- onCancel: V,
93
- onSaveDraft: L.saveDraft,
94
- onFinalize: L.finalize,
102
+ readOnly: y,
103
+ isLineItemsLoading: M.isResolving,
104
+ isSaving: z,
105
+ isSavingDraft: R.isSavingDraft,
106
+ isFinalizing: R.isFinalizing,
107
+ onCancel: U,
108
+ onSaveDraft: R.saveDraft,
109
+ onFinalize: R.finalize,
95
110
  testId: u.dialog
96
111
  });
97
112
  }
@@ -1,4 +1,23 @@
1
+ import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/index36.js";
2
+ import "../../ui/dist/index.js";
1
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js
2
- var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
4
+ var t = {
5
+ subtitle: "Accounts payable",
6
+ vendorRow: "Vendor",
7
+ bankAccountRow: "ACH bank account",
8
+ bankAccountValue: (e) => `Account ending in ${e}`,
9
+ invoiceNumberRow: "Number",
10
+ issueDateRow: "Issue date",
11
+ dueDateRow: "Due date",
12
+ poNumberRow: "PO number",
13
+ notProvided: "Not provided",
14
+ glCodeMissing: "GL code not specified",
15
+ quantityValue: (e, t) => `${e} x ${t}`,
16
+ subtotalRow: "Subtotal",
17
+ discountsRow: "Discounts",
18
+ taxRow: "Tax",
19
+ totalRow: "Total",
20
+ sheet: e
21
+ };
3
22
  //#endregion
4
- export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
23
+ export { t as BILL_DETAILS_LABELS_EN };
@@ -1,45 +1,50 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
- import "../../../shared/feature/dist/index.js";
7
- import { BillPayWidgetAnalyticsEvent as t, WIDGET_NAME as n } from "./index14.js";
8
- import { Payables as r } from "../../../monite-sdk/dist/index431.js";
9
- import "../../../monite-sdk/dist/index.js";
10
- import { MoniteRegionProvider as i } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
11
- import "../../../shared/monite-wrapper/feature/dist/index.js";
12
- import { useEffect as a } from "react";
13
- import { jsx as o } from "react/jsx-runtime";
14
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js
15
- var s = (e) => e;
16
- function c(n) {
17
- let i = e();
18
- return a(() => {
19
- i(t.Mounted);
20
- }, [i]), /* @__PURE__ */ o(r, { ...n });
2
+ var e = /* @__PURE__ */ new Set([
3
+ "new",
4
+ "approve_in_progress",
5
+ "waiting_to_be_paid",
6
+ "partially_paid"
7
+ ]);
8
+ function t(e, t) {
9
+ let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
10
+ return n.getTime() < r;
21
11
  }
22
- function l({ baseUrl: e, widgetToken: t, organizationId: r, configClient: a, gatewayRouting: l, linkComponent: u, implementation: d, uiFramework: f, errorFallback: p, onError: m, finopsThemeColors: h, analytics: g, disclosuresAcceptance: _, pageTitleComponent: v = s, ...y }) {
23
- return /* @__PURE__ */ o(i, {
24
- widgetName: n,
25
- baseUrl: e,
26
- widgetToken: t,
27
- organizationId: r,
28
- configClient: a,
29
- gatewayRouting: l,
30
- linkComponent: u,
31
- implementation: d,
32
- uiFramework: f,
33
- errorFallback: p,
34
- onError: m,
35
- finopsThemeColors: h,
36
- analytics: g,
37
- disclosuresAcceptance: _,
38
- children: /* @__PURE__ */ o(c, {
39
- ...y,
40
- pageTitleComponent: v
41
- })
42
- });
12
+ function n(n, r, i = /* @__PURE__ */ new Date()) {
13
+ if (e.has(n) && r && t(r, i)) return {
14
+ status: "overdue",
15
+ tone: "danger"
16
+ };
17
+ switch (n) {
18
+ case "draft": return {
19
+ status: "draft",
20
+ tone: "neutral"
21
+ };
22
+ case "new":
23
+ case "approve_in_progress": return {
24
+ status: "pending_approval",
25
+ tone: "warning"
26
+ };
27
+ case "waiting_to_be_paid": return {
28
+ status: "ready_to_pay",
29
+ tone: "info"
30
+ };
31
+ case "partially_paid": return {
32
+ status: "partially_paid",
33
+ tone: "success"
34
+ };
35
+ case "paid": return {
36
+ status: "paid",
37
+ tone: "success"
38
+ };
39
+ case "canceled": return {
40
+ status: "canceled",
41
+ tone: "neutral"
42
+ };
43
+ case "rejected": return {
44
+ status: "rejected",
45
+ tone: "danger"
46
+ };
47
+ }
43
48
  }
44
49
  //#endregion
45
- export { l as BillPayWidgetMonite, l as default };
50
+ export { n as derivePayableStatus };
@@ -1 +1,81 @@
1
- import "./index15.js";
1
+ import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
+ import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
3
+ import "../../data-access/dist/index.js";
4
+ import { derivePayableStatus as n } from "./index15.js";
5
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js
6
+ function r(e, n) {
7
+ if (typeof e == "number") return t(e / 100, { currencyCode: n });
8
+ }
9
+ function i({ payable: t, lineItems: i, ledgerAccounts: a, labels: o }) {
10
+ let s = t.currency ?? "USD", c = n(t.status, t.due_date), l = t.counterpart ?? t.counterpart_raw_data, u = l?.name ?? "", d = e(t.issued_at) || o.notProvided, f = e(t.due_date) || o.notProvided, p = [{
11
+ label: o.vendorRow,
12
+ value: u || o.notProvided,
13
+ secondaryValue: l?.email ?? void 0
14
+ }], m = l?.bank_account?.account_number;
15
+ m && p.push({
16
+ label: o.bankAccountRow,
17
+ value: o.bankAccountValue(m.slice(-4))
18
+ });
19
+ let h = [
20
+ {
21
+ label: o.invoiceNumberRow,
22
+ value: t.document_id || o.notProvided
23
+ },
24
+ {
25
+ label: o.issueDateRow,
26
+ value: d
27
+ },
28
+ {
29
+ label: o.dueDateRow,
30
+ value: f
31
+ },
32
+ {
33
+ label: o.poNumberRow,
34
+ value: o.notProvided
35
+ }
36
+ ], g = new Map(a.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), _ = i.map((e) => {
37
+ let t = r(e.unit_price, s);
38
+ return {
39
+ id: e.id,
40
+ description: e.name ?? e.description ?? "",
41
+ glCodeLabel: (e.ledger_account_id ? g.get(e.ledger_account_id) : void 0) || o.glCodeMissing,
42
+ quantityLabel: e.quantity != null && t ? o.quantityValue(String(e.quantity), t) : "",
43
+ amountLabel: r(e.subtotal, s) ?? ""
44
+ };
45
+ }), v = [
46
+ {
47
+ label: o.subtotalRow,
48
+ value: t.subtotal
49
+ },
50
+ {
51
+ label: o.discountsRow,
52
+ value: t.discount
53
+ },
54
+ {
55
+ label: o.taxRow,
56
+ value: t.tax_amount
57
+ }
58
+ ].map(({ label: e, value: t }) => ({
59
+ label: e,
60
+ value: r(t, s)
61
+ })).filter((e) => !!e.value), y = r(t.total_amount, s);
62
+ return y && v.push({
63
+ label: o.totalRow,
64
+ value: y,
65
+ emphasis: !0
66
+ }), {
67
+ title: u,
68
+ subtitle: o.subtitle,
69
+ status: c.status,
70
+ statusTone: c.tone,
71
+ amountDueLabel: r(t.amount_due, s) ?? r(t.total_amount, s) ?? "",
72
+ invoiceDateLabel: d,
73
+ dueDateLabel: f,
74
+ payToItems: p,
75
+ invoiceItems: h,
76
+ lineItems: _,
77
+ totals: v
78
+ };
79
+ }
80
+ //#endregion
81
+ export { i as mapPayableToBillDetails };