@tesouro/embedded-components-react 0.2.280 → 0.2.282

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 (112) hide show
  1. package/README.md +17 -14
  2. package/dist/experimental/WidgetSuite.d.ts +9 -1
  3. package/dist/experimental/index.d.ts +9 -1
  4. package/dist/index.css +20 -6
  5. package/dist/index.d.ts +46 -23
  6. package/dist/index.js +54 -53
  7. package/dist/lib/AcceptDisclosuresWidget.d.ts +9 -1
  8. package/dist/lib/BalancesWidget.d.ts +8 -0
  9. package/dist/lib/BankAccountOnboardingWidget.d.ts +9 -1
  10. package/dist/lib/BankAccountsWidget.d.ts +9 -1
  11. package/dist/lib/BillPayWidget.d.ts +8 -0
  12. package/dist/lib/BillPayWidget.js +1 -1
  13. package/dist/lib/CardDetailsWidget.d.ts +9 -1
  14. package/dist/lib/CardsWidget.d.ts +9 -1
  15. package/dist/lib/ChartOfAccountsWidget.d.ts +9 -1
  16. package/dist/lib/CounterpartsWidget.d.ts +9 -1
  17. package/dist/lib/CreateCardWidget.d.ts +9 -1
  18. package/dist/lib/ExpenseApprovalPoliciesWidget.d.ts +9 -1
  19. package/dist/lib/ExpenseManagementWidget.d.ts +9 -1
  20. package/dist/lib/ExpenseRequirementsWidget.d.ts +9 -1
  21. package/dist/lib/HelpWidget.d.ts +9 -1
  22. package/dist/lib/InsightsWidget.d.ts +8 -0
  23. package/dist/lib/InvoicingWidget.d.ts +9 -1
  24. package/dist/lib/LinkedAccountsWidget.d.ts +9 -1
  25. package/dist/lib/ProductsWidget.d.ts +9 -1
  26. package/dist/lib/ProfileWidget.d.ts +9 -1
  27. package/dist/lib/ReceiptMatchWidget.d.ts +9 -1
  28. package/dist/lib/ReceivablesWidget.d.ts +9 -1
  29. package/dist/lib/SettingsWidget.d.ts +9 -1
  30. package/dist/lib/TagsWidget.d.ts +9 -1
  31. package/dist/lib/TeamWidget.d.ts +9 -1
  32. package/dist/lib/TransfersWidget.d.ts +8 -0
  33. package/dist/lib/WidgetProvider.d.ts +25 -2
  34. package/dist/lib/WidgetProvider.js +8 -7
  35. package/dist/lib/WidgetProviderPublic.d.ts +8 -0
  36. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +3 -2
  37. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +54 -53
  38. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js +3 -2
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +9 -5
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +42 -39
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +69 -54
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +21 -2
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +46 -40
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +81 -1
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +46 -47
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -11
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +2 -8
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +5 -3
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +43 -5
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +1 -102
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +11 -3
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +9 -6
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +4 -5
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +127 -76
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +6 -6
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +7 -111
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +85 -1
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +16 -12
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +2 -24
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +8 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +114 -0
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +1 -0
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +25 -0
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +50 -49
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +1 -1
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +25 -12
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +86 -69
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +2 -1
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +7 -7
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +17 -16
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +1 -0
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +1 -1
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +89 -124
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +2 -1
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +31 -26
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +1 -1
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +80 -77
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +20 -4
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +228 -6
  80. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js +3 -2
  81. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +3 -2
  82. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +3 -2
  83. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +30 -29
  84. package/dist/libs/tesouro-embedded-components-react/expense-approval-policies-widget/feature/dist/lib/ExpenseApprovalPoliciesWidgetFeature.js +2 -1
  85. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index3.js +3 -2
  86. package/dist/libs/tesouro-embedded-components-react/expense-receipt-match-widget/feature/dist/lib/ReceiptMatchWidget.js +7 -6
  87. package/dist/libs/tesouro-embedded-components-react/expense-requirements-widget/feature/dist/lib/ExpenseRequirementsWidget.js +2 -1
  88. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/feature/dist/index8.js +5 -4
  89. package/dist/libs/tesouro-embedded-components-react/help-widget/feature/dist/index3.js +3 -2
  90. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +3 -2
  91. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index3.js +5 -4
  92. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +3 -2
  93. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js +3 -2
  94. package/dist/libs/tesouro-embedded-components-react/profile-widget/feature/dist/index4.js +3 -2
  95. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +3 -2
  96. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +6 -6
  97. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +53 -11
  98. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +5 -5
  99. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +69 -67
  100. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +158 -132
  101. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/hooks.js +7 -4
  102. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/isDisclosuresAcceptanceRequired.js +20 -0
  103. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/labels.js +6 -1
  104. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  105. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +9 -9
  106. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/ErrorState/ErrorState.js +19 -18
  107. package/dist/libs/tesouro-embedded-components-react/tags-widget/feature/dist/index11.js +3 -2
  108. package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index17.js +3 -2
  109. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +1 -1
  110. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js +3 -2
  111. package/dist/packages/shared-ui-shadcn/dist/index.js +3445 -3413
  112. package/package.json +1 -1
@@ -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,44 +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, pageTitleComponent: _ = s, ...v }) {
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
- children: /* @__PURE__ */ o(c, {
38
- ...v,
39
- pageTitleComponent: _
40
- })
41
- });
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
+ }
42
48
  }
43
49
  //#endregion
44
- 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 };
@@ -1,50 +1,49 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useAllLedgerAccountsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
6
+ import "../../../shared/data-access/dist/index.js";
7
+ import { useAllPayableLineItemsQuery as t } from "../../data-access/dist/index6.js";
8
+ import { usePayableQuery as n } from "../../data-access/dist/index10.js";
9
+ import "../../data-access/dist/index.js";
10
+ import { BillDetailsSheet as r } from "../../ui/dist/index37.js";
11
+ import "../../ui/dist/index.js";
12
+ import { BILL_DETAILS_LABELS_EN as i } from "./index14.js";
13
+ import { mapPayableToBillDetails as a } from "./index16.js";
14
+ import { useMemo as o } from "react";
15
+ import { jsx as s } from "react/jsx-runtime";
1
16
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js
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;
11
- }
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
- }
17
+ function c({ open: c, onOpenChange: l, payableId: u, onClose: d, onExpand: f, testId: p, labels: m }) {
18
+ let h = o(() => ({
19
+ ...i,
20
+ ...m,
21
+ sheet: {
22
+ ...i.sheet,
23
+ ...m?.sheet
24
+ }
25
+ }), [m]), g = n(u), _ = t(u), v = e(), y = g.data, b = o(() => y ? a({
26
+ payable: y,
27
+ lineItems: _.lineItems,
28
+ ledgerAccounts: v.data?.data ?? [],
29
+ labels: h
30
+ }) : void 0, [
31
+ y,
32
+ _.lineItems,
33
+ v.data,
34
+ h
35
+ ]), x = g.isLoading || _.isResolving || v.isResolving, S = g.isError || _.isError || v.isError;
36
+ return /* @__PURE__ */ s(r, {
37
+ open: c,
38
+ onOpenChange: l,
39
+ details: b,
40
+ isLoading: x,
41
+ isError: S,
42
+ onClose: d,
43
+ onExpand: f,
44
+ testId: p,
45
+ labels: h.sheet
46
+ });
48
47
  }
49
48
  //#endregion
50
- export { n as derivePayableStatus };
49
+ export { c as BillDetailsContainer, c as default };
@@ -1,11 +1,3 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js
2
- async function e(e) {
3
- if (!e.trim()) return !1;
4
- try {
5
- return await navigator.clipboard.writeText(e), !0;
6
- } catch {
7
- return !1;
8
- }
9
- }
10
- //#endregion
11
- export { e as copyTextToClipboard };
1
+ import "./index14.js";
2
+ import "./index16.js";
3
+ import "./index17.js";
@@ -1,10 +1,4 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js
2
- var e = {
3
- emptyHeading: "Add your first bill",
4
- nonEmptyHeading: "Add a bill",
5
- createButton: "Add bill",
6
- emailCopiedToast: "Email address copied to clipboard",
7
- emailCopyFailedToast: "Could not copy the email address"
8
- };
2
+ var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
9
3
  //#endregion
10
- export { e as BILLS_TAB_LABELS_EN };
4
+ export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
@@ -7,10 +7,10 @@ var e = {
7
7
  finalizeFailed: "We could not submit this bill. Try again.",
8
8
  draftSaved: "Bill saved as a draft.",
9
9
  billFinalized: "Bill submitted for approval.",
10
- unreadableMoney: "Enter a number, like 285.00.",
10
+ unreadableMoney: "Enter a valid amount.",
11
11
  unusableQuantity: "Enter a quantity greater than 0.",
12
12
  lineItemsNeedAttention: "Check the highlighted line items before saving.",
13
- totalsNeedAttention: "Enter discount, tax, and total as numbers, like 285.00."
13
+ totalsNeedAttention: "Enter valid amounts for discount, tax, and total."
14
14
  }, t = {
15
15
  achMethod: "via ACH bank transfer",
16
16
  noMethod: "No payment method on file",
@@ -21,10 +21,12 @@ var e = {
21
21
  vendorDetailsFailed: "We could not load this vendor. Try again."
22
22
  }, n = {
23
23
  attachFailed: "We could not attach that file. Try again.",
24
- saveBeforeAttaching: "Save this bill before attaching a document."
24
+ saveBeforeAttaching: "Save this bill before attaching a document.",
25
+ noDocument: "No document attached to this bill."
25
26
  }, r = {
26
27
  newTitle: "New bill",
27
28
  extractedTitle: (e) => `Bill from ${e}`,
29
+ readOnlyTitle: "Bill details",
28
30
  discardConfirm: "Discard your changes to this bill?"
29
31
  }, i = {
30
32
  createTitle: "New vendor",