@tesouro/embedded-components-react 0.2.264 → 0.2.267

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 (60) hide show
  1. package/README.md +8 -6
  2. package/dist/experimental/WidgetSuite.d.ts +93 -2
  3. package/dist/experimental/WidgetSuite.js +5 -5
  4. package/dist/experimental/index.d.ts +93 -2
  5. package/dist/experimental/index.js +5 -5
  6. package/dist/index.css +45 -9
  7. package/dist/index.d.ts +29 -9
  8. package/dist/index.js +2 -2
  9. package/dist/lib/AcceptDisclosuresWidget.d.ts +17 -5
  10. package/dist/lib/AcceptDisclosuresWidget.js +1 -1
  11. package/dist/lib/BillPayWidget.js +1 -1
  12. package/dist/lib/WidgetProvider.d.ts +12 -4
  13. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/data-access/dist/index2.js +3 -3
  14. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index3.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +36 -34
  16. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/index.js +2 -2
  17. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/{index3.js → lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js} +3 -3
  18. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/{index2.js → lib/AcceptDisclosuresWidget/labels.js} +1 -1
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +6 -6
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +99 -7
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +7 -97
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +99 -4
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +4 -4
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +2 -41
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +43 -1
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +1 -50
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +48 -6
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +9 -5
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +8 -91
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +6 -2
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +7 -3
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +100 -6
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +3 -9
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +6 -83
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +9 -3
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +83 -6
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +2 -111
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +8 -1
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +103 -16
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +1 -0
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +25 -0
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +37 -27
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +15 -116
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +126 -31
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +32 -69
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +0 -3
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +34 -69
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +4 -0
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +261 -181
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +32 -33
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index7.js +2 -2
  52. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  53. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index.js +5 -5
  54. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index3.js +4 -15
  55. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +26 -91
  56. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +87 -74
  57. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js +142 -0
  58. package/dist/libs/tesouro-embedded-components-react/widget-suite/ui/dist/index2.js +1 -0
  59. package/dist/libs/tesouro-embedded-components-react/widget-suite/ui/dist/index3.js +49 -33
  60. package/package.json +1 -1
@@ -9,15 +9,15 @@ import { useMutation as r } from "@tanstack/react-query";
9
9
  //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/data-access/dist/index2.js
10
10
  function i() {
11
11
  let { client: i, widgetToken: a } = e();
12
- return r({ mutationFn: async ({ invitationToken: e, userId: r }) => {
12
+ return r({ mutationFn: async ({ invitationToken: e, userId: r } = {}) => {
13
13
  if (!a) throw Error("Widget token is required to accept disclosures");
14
14
  let { data: o } = await t({
15
15
  client: i,
16
16
  headers: { "X-Widget-Token": a },
17
- query: {
17
+ ...e && r ? { query: {
18
18
  invitationToken: e,
19
19
  userId: r
20
- },
20
+ } } : {},
21
21
  throwOnError: !0
22
22
  });
23
23
  if (!o) throw Error("Unexpected disclosures response from widget gateway");
@@ -1,4 +1,4 @@
1
- import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as e } from "../../ui/dist/index2.js";
1
+ import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as e } from "../../ui/dist/lib/AcceptDisclosuresWidget/labels.js";
2
2
  import "../../ui/dist/index.js";
3
3
  //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index3.js
4
4
  function t(t) {
@@ -3,8 +3,8 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { AcceptDisclosuresWidgetAnalyticsEvent as e, WIDGET_NAME as t } from "./index2.js";
6
- import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as n } from "../../ui/dist/index2.js";
7
- import { AcceptDisclosuresWidget as r } from "../../ui/dist/index3.js";
6
+ import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as n } from "../../ui/dist/lib/AcceptDisclosuresWidget/labels.js";
7
+ import { AcceptDisclosuresWidget as r } from "../../ui/dist/lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js";
8
8
  import "../../ui/dist/index.js";
9
9
  import { resolveAcceptDisclosuresContent as i } from "./index3.js";
10
10
  import { useAcceptWidgetDisclosures as a } from "../../data-access/dist/index2.js";
@@ -12,12 +12,12 @@ import "../../data-access/dist/index.js";
12
12
  import { useAnalyticsTrack as o } from "../../../shared/feature/dist/lib/analytics/hooks.js";
13
13
  import { WidgetProvider as s } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
14
14
  import { extractApiErrorMessage as c } from "../../../shared/util/dist/lib/apiErrors.js";
15
- import { useRefetchWidget as l, useWidgetConfig as u } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
15
+ import { useRefetchWidget as l, useWidgetConfig as u, useWidgetInitStaleForToken as d } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
16
16
  import "../../../shared/feature/dist/index.js";
17
- import { useCallback as d, useEffect as f, useRef as p, useState as m } from "react";
18
- import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
17
+ import { useCallback as f, useEffect as p, useRef as m, useState as h } from "react";
18
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
19
19
  //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js
20
- function v(e) {
20
+ function y(e) {
21
21
  return {
22
22
  ...n,
23
23
  ...e,
@@ -27,43 +27,45 @@ function v(e) {
27
27
  }
28
28
  };
29
29
  }
30
- function y(e, t, n) {
31
- return /* @__PURE__ */ _(h, { children: [
30
+ function b(e, t, n) {
31
+ return /* @__PURE__ */ v(g, { children: [
32
32
  n.providerAttributionPrefix,
33
- /* @__PURE__ */ g("strong", { children: e }),
33
+ /* @__PURE__ */ _("strong", { children: e }),
34
34
  n.providerAttributionMiddle,
35
35
  t,
36
36
  n.providerAttributionSuffix
37
37
  ] });
38
38
  }
39
- function b({ invitationToken: t, userId: n, disclosureLinks: r, labels: a, onAccepted: s }) {
40
- let c = o(), { initResponse: l } = u(), d = v(a);
41
- f(() => {
39
+ function x({ invitationToken: t, userId: n, disclosureLinks: r, labels: a, onAccepted: s }) {
40
+ let c = o(), { initResponse: l } = u(), f = d(), m = y(a);
41
+ p(() => {
42
42
  c(e.Mounted);
43
43
  }, [c]);
44
- let p = i({
44
+ let h = i({
45
45
  disclosureLinks: r,
46
46
  vspName: l?.vspName,
47
47
  bankName: l?.bankName,
48
48
  labels: a
49
49
  });
50
- if (!p) return null;
51
- let m = `${t}:${n}:${p.vspName}:${p.bankName}:${p.agreementText}:${p.disclosureLinks.map((e) => e.href).join("|")}`;
52
- return /* @__PURE__ */ g(x, {
50
+ if (!h) return null;
51
+ let g = !!(t && n);
52
+ if (!g && f) return null;
53
+ let v = `${g ? `invite:${t}:${n}` : `user:${l?.userId ?? ""}`}:${h.vspName}:${h.bankName}:${h.agreementText}:${h.disclosureLinks.map((e) => e.href).join("|")}`;
54
+ return /* @__PURE__ */ _(S, {
53
55
  invitationToken: t,
54
56
  userId: n,
55
57
  labelOverrides: a,
56
- content: p,
57
- labels: d,
58
+ content: h,
59
+ labels: m,
58
60
  onAccepted: s
59
- }, m);
61
+ }, v);
60
62
  }
61
- function x({ invitationToken: e, userId: t, labelOverrides: n, content: i, labels: o, onAccepted: s }) {
62
- let [u, f] = m(!1), [h, _] = m(), [v, b] = m(!1), [x, S] = m(!1), C = p(!1), { mutateAsync: w } = a(), T = l(), E = d((e) => {
63
- _(void 0), f(e);
64
- }, []), D = d(async () => {
63
+ function S({ invitationToken: e, userId: t, labelOverrides: n, content: i, labels: o, onAccepted: s }) {
64
+ let [u, d] = h(!1), [p, g] = h(), [v, y] = h(!1), [x, S] = h(!1), C = m(!1), { mutateAsync: w } = a(), T = l(), E = f((e) => {
65
+ g(void 0), d(e);
66
+ }, []), D = f(async () => {
65
67
  if (!(!u || v || x)) {
66
- _(void 0), b(!0);
68
+ g(void 0), y(!0);
67
69
  try {
68
70
  if (!C.current) try {
69
71
  await w({
@@ -71,18 +73,18 @@ function x({ invitationToken: e, userId: t, labelOverrides: n, content: i, label
71
73
  userId: t
72
74
  }), C.current = !0;
73
75
  } catch (e) {
74
- _(c(e) ?? o.acceptErrorFallback);
76
+ g(c(e) ?? o.acceptErrorFallback);
75
77
  return;
76
78
  }
77
79
  try {
78
80
  await s?.();
79
81
  } catch (e) {
80
- _(c(e) ?? o.acceptErrorFallback);
82
+ g(c(e) ?? o.acceptErrorFallback);
81
83
  return;
82
84
  }
83
85
  T(), S(!0);
84
86
  } finally {
85
- b(!1);
87
+ y(!1);
86
88
  }
87
89
  }
88
90
  }, [
@@ -96,9 +98,9 @@ function x({ invitationToken: e, userId: t, labelOverrides: n, content: i, label
96
98
  T,
97
99
  t
98
100
  ]);
99
- return /* @__PURE__ */ g(r, {
101
+ return /* @__PURE__ */ _(r, {
100
102
  labels: n,
101
- providerAttribution: y(i.vspName, i.bankName, o),
103
+ providerAttribution: b(i.vspName, i.bankName, o),
102
104
  agreementText: i.agreementText,
103
105
  disclosureLinks: i.disclosureLinks,
104
106
  isAgreed: u,
@@ -108,11 +110,11 @@ function x({ invitationToken: e, userId: t, labelOverrides: n, content: i, label
108
110
  },
109
111
  isSubmitting: v,
110
112
  isAccepted: x,
111
- errorMessage: h
113
+ errorMessage: p
112
114
  });
113
115
  }
114
- function S({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, linkComponent: a, implementation: o, uiFramework: c, errorFallback: l, onError: u, analytics: d, ...f }) {
115
- return /* @__PURE__ */ g(s, {
116
+ function C({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, linkComponent: a, implementation: o, uiFramework: c, errorFallback: l, onError: u, analytics: d, ...f }) {
117
+ return /* @__PURE__ */ _(s, {
116
118
  widgetName: t,
117
119
  baseUrl: e,
118
120
  widgetToken: n,
@@ -124,8 +126,8 @@ function S({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, lin
124
126
  errorFallback: l,
125
127
  onError: u,
126
128
  analytics: d,
127
- children: /* @__PURE__ */ g(b, { ...f })
129
+ children: /* @__PURE__ */ _(x, { ...f })
128
130
  });
129
131
  }
130
132
  //#endregion
131
- export { S as AcceptDisclosuresWidget };
133
+ export { C as AcceptDisclosuresWidget };
@@ -1,3 +1,3 @@
1
- import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as e } from "./index2.js";
2
- import { AcceptDisclosuresWidget as t } from "./index3.js";
1
+ import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as e } from "./lib/AcceptDisclosuresWidget/labels.js";
2
+ import { AcceptDisclosuresWidget as t } from "./lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js";
3
3
  export { e as ACCEPT_DISCLOSURES_WIDGET_LABELS_EN, t as AcceptDisclosuresWidget };
@@ -1,8 +1,8 @@
1
- import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as e } from "./index2.js";
2
- import { Button as t, Checkbox as n } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
1
+ import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as e } from "./labels.js";
2
+ import { Button as t, Checkbox as n } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
3
3
  import { useId as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
- //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/index3.js
5
+ //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js
6
6
  function o({ providerAttribution: o, agreementText: s, disclosureLinks: c, isAgreed: l, onAgreedChange: u, onAccept: d, isSubmitting: f = !1, isAccepted: p = !1, errorMessage: m, labels: h }) {
7
7
  let g = f || p, _ = {
8
8
  ...e,
@@ -1,4 +1,4 @@
1
- //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/index2.js
1
+ //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/lib/AcceptDisclosuresWidget/labels.js
2
2
  var e = {
3
3
  title: "Review and accept these banking disclosures",
4
4
  acceptButton: "Accept",
@@ -1,16 +1,16 @@
1
1
  import "./index2.js";
2
- import "./index7.js";
3
- import "./index9.js";
4
- import "./index11.js";
2
+ import "./index8.js";
3
+ import "./index10.js";
5
4
  import "./index12.js";
6
- import "./index16.js";
5
+ import "./index13.js";
7
6
  import "./index17.js";
8
- import "./index18.js";
9
7
  import "./index19.js";
10
8
  import "./index20.js";
11
9
  import "./index21.js";
12
10
  import "./index22.js";
13
11
  import "./index23.js";
14
12
  import "./index24.js";
15
- import { BillPayWidget as e } from "./index28.js";
13
+ import "./index25.js";
14
+ import "./index26.js";
15
+ import { BillPayWidget as e } from "./index30.js";
16
16
  export { e as BillPayWidget };
@@ -1,9 +1,101 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
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";
1
8
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js
2
- var e = {
3
- dialog: "bill-pay-bill-create-dialog",
4
- vendorSection: "bill-pay-bill-create-vendor",
5
- lineItems: "bill-pay-bill-create-line-items",
6
- documentPanel: "bill-pay-bill-create-document"
7
- };
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(() => {
15
+ T || f(u.values);
16
+ }, [u]), a(() => {
17
+ D || m(u.lineItems);
18
+ }, [u]), a(() => {
19
+ k || (g(u.discount), v(u.tax));
20
+ }, [u]);
21
+ let j = i((e) => {
22
+ f((t) => ({
23
+ ...t,
24
+ ...e
25
+ })), E(!0);
26
+ }, []), M = i((e) => {
27
+ w((t) => {
28
+ if (!t?.[e]) return t;
29
+ let n = { ...t };
30
+ return delete n[e], Object.keys(n).length ? n : void 0;
31
+ });
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
38
+ };
39
+ return "amount" in n ? i : {
40
+ ...i,
41
+ amount: t(i.quantity, i.price)
42
+ };
43
+ })), 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));
48
+ return {
49
+ ...r,
50
+ quantity: a,
51
+ amount: t(a, r.price)
52
+ };
53
+ })), O(!0), b(void 0);
54
+ }, [M]), F = i((e) => {
55
+ 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
+ g(e), A(!0), b(void 0);
60
+ }, []), R = i((e) => {
61
+ v(e), A(!0), b(void 0);
62
+ }, []), z = i((e) => {
63
+ b(e), A(!0);
64
+ }, []), B = o(() => p.map((e) => ({
65
+ ...e,
66
+ onChange: (t) => N(e.id, t),
67
+ onQuantityStep: (t) => P(e.id, t),
68
+ onRemove: () => F(e.id)
69
+ })), [
70
+ p,
71
+ N,
72
+ F,
73
+ P
74
+ ]), V = o(() => e(p, _, h), [
75
+ p,
76
+ _,
77
+ h
78
+ ]);
79
+ return {
80
+ values: d,
81
+ errors: x,
82
+ setErrors: S,
83
+ lineItemErrors: C,
84
+ setLineItemErrors: w,
85
+ onChange: j,
86
+ lineItems: p,
87
+ lineItemRows: B,
88
+ discount: h,
89
+ onDiscountChange: L,
90
+ tax: _,
91
+ onTaxChange: R,
92
+ total: y ?? V,
93
+ totalOverride: y,
94
+ onTotalChange: z,
95
+ onAddLineItem: I,
96
+ isTotalsDirty: k,
97
+ isDirty: T || D || k
98
+ };
99
+ }
8
100
  //#endregion
9
- export { e as billCreateTestIds };
101
+ export { c as useBillForm };
@@ -1,99 +1,9 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useLedgerAccountsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
6
- import { usePaymentTermsQuery as t } from "../../../shared/data-access/dist/lib/reference-data/usePaymentTermsQuery.js";
7
- import "../../../shared/data-access/dist/index.js";
8
- import { BILL_CREATE_SCREEN_LABELS_EN as n } from "./index2.js";
9
- import { useAllPayableLineItemsQuery as r } from "../../data-access/dist/index6.js";
10
- import { usePayableQuery as i } from "../../data-access/dist/index10.js";
11
- import "../../data-access/dist/index.js";
12
- import { useBillCreateController as a } from "./index7.js";
13
- import { useBillForm as o } from "./index9.js";
14
- import { BillCreateScreen as s } from "../../ui/dist/index28.js";
15
- import { ExtractionNotice as c } from "../../ui/dist/index45.js";
16
- import "../../ui/dist/index.js";
17
- import { SourceDocumentContainer as l } from "./index3.js";
18
- import { useVendorSectionProps as u } from "./index5.js";
19
- import { billCreateTestIds as d } from "./index10.js";
20
- import { useCallback as f, useEffect as p, useMemo as m, useState as h } from "react";
21
- import { jsx as g } from "react/jsx-runtime";
22
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js
23
- function _({ open: _, onOpenChange: v, payableId: y, copy: b }) {
24
- let x = {
25
- ...n,
26
- ...b
27
- }, [S, C] = h(), [w, T] = h(!1), [E, D] = h(!1), [O, k] = h(), A = y ?? O, j = i(A, { pollWhileOcrProcessing: !0 }), M = r(A), N = e(), P = t(), F = j.data, I = o({
28
- payable: F,
29
- lineItems: M.lineItems
30
- }), L = F?.counterpart_id;
31
- p(() => {
32
- w || L && (C(L), T(!0));
33
- }, [w, L]);
34
- let R = f((e) => {
35
- T(!0), C(e);
36
- }, []), z = P.data?.data?.find((e) => e.id === I.values.paymentTerms), B = m(() => (P.data?.data ?? []).filter((e) => !!(e.id && e.name)).map((e) => ({
37
- value: e.id,
38
- label: e.name
39
- })), [P.data]), V = a({
40
- payableId: y,
41
- form: I,
42
- paymentTerm: z,
43
- counterpartId: S,
44
- onPayableCreated: k,
45
- onSaved: k,
46
- onDraftSaved: () => v(!1),
47
- onFinalized: () => v(!1)
48
- }), H = m(() => (N.data?.data ?? []).map((e) => ({
49
- value: e.id,
50
- label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
51
- })), [N.data]), U = F?.source_of_payable_data === "ocr", W = F?.counterpart_raw_data?.name, G = () => {
52
- I.isDirty && !window.confirm(x.discardConfirm) || v(!1);
53
- }, K = u({
54
- payableId: A,
55
- counterpartId: S,
56
- payableCounterpartId: L,
57
- onCounterpartChange: R
58
- });
59
- return /* @__PURE__ */ g(s, {
60
- open: _,
61
- onOpenChange: (e) => e ? v(!0) : G(),
62
- title: U && W ? x.extractedTitle(W) : x.newTitle,
63
- notice: U && !E ? /* @__PURE__ */ g(c, { onDismiss: () => D(!0) }) : void 0,
64
- vendor: {
65
- ...K,
66
- testId: d.vendorSection
67
- },
68
- values: I.values,
69
- errors: I.errors,
70
- onChange: I.onChange,
71
- paymentTermOptions: B,
72
- lineItems: {
73
- items: I.lineItemRows,
74
- glCodeOptions: H,
75
- totalAmountLabel: I.totalAmountLabel,
76
- onAddLineItem: I.onAddLineItem,
77
- testId: d.lineItems
78
- },
79
- documentPanel: /* @__PURE__ */ g(l, {
80
- payableId: A,
81
- isDocumentPending: !!A && !F?.file && (j.isLoading || F?.ocr_status === "processing"),
82
- file: F?.file ? {
83
- id: F.file.id,
84
- name: F.file.name,
85
- url: F.file.url,
86
- mimetype: F.file.mimetype
87
- } : void 0
88
- }),
89
- isLineItemsLoading: M.isResolving,
90
- isSavingDraft: V.isSavingDraft,
91
- isFinalizing: V.isFinalizing,
92
- onCancel: G,
93
- onSaveDraft: V.saveDraft,
94
- onFinalize: V.finalize,
95
- testId: d.dialog
96
- });
97
- }
2
+ var e = {
3
+ dialog: "bill-pay-bill-create-dialog",
4
+ vendorSection: "bill-pay-bill-create-vendor",
5
+ lineItems: "bill-pay-bill-create-line-items",
6
+ documentPanel: "bill-pay-bill-create-document"
7
+ };
98
8
  //#endregion
99
- export { _ as BillCreateDialog, _ as default };
9
+ export { e as billCreateTestIds };
@@ -1,4 +1,99 @@
1
- import "./index2.js";
2
- import "./index7.js";
3
- import "./index9.js";
4
- import "./index11.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useLedgerAccountsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
6
+ import "../../../shared/data-access/dist/index.js";
7
+ import { BILL_CREATE_SCREEN_LABELS_EN as t } from "./index2.js";
8
+ import { useAllPayableLineItemsQuery as n } from "../../data-access/dist/index6.js";
9
+ import { usePayableQuery as r } from "../../data-access/dist/index10.js";
10
+ import "../../data-access/dist/index.js";
11
+ import { useBillCreateController as i } from "./index8.js";
12
+ import { useBillForm as a } from "./index10.js";
13
+ import { BillCreateScreen as o } from "../../ui/dist/index28.js";
14
+ import { ExtractionNotice as s } from "../../ui/dist/index45.js";
15
+ import "../../ui/dist/index.js";
16
+ import { SourceDocumentContainer as c } from "./index3.js";
17
+ import { useVendorSectionProps as l } from "./index5.js";
18
+ import { billCreateTestIds as u } from "./index11.js";
19
+ import { useCallback as d, useEffect as f, useMemo as p, useState as m } from "react";
20
+ import { jsx as h } from "react/jsx-runtime";
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 = {
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;
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({
36
+ payableId: v,
37
+ form: P,
38
+ counterpartId: x,
39
+ onPayableCreated: O,
40
+ onSaved: O,
41
+ onDraftSaved: () => _(!1),
42
+ onFinalized: () => _(!1)
43
+ }), R = p(() => (M.data?.data ?? []).map((e) => ({
44
+ value: e.id,
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
53
+ });
54
+ return /* @__PURE__ */ h(o, {
55
+ 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,
59
+ vendor: {
60
+ ...H,
61
+ testId: u.vendorSection
62
+ },
63
+ values: P.values,
64
+ errors: P.errors,
65
+ onChange: P.onChange,
66
+ 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,
77
+ testId: u.lineItems
78
+ },
79
+ 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
87
+ } : void 0
88
+ }),
89
+ isLineItemsLoading: j.isResolving,
90
+ isSavingDraft: L.isSavingDraft,
91
+ isFinalizing: L.isFinalizing,
92
+ onCancel: V,
93
+ onSaveDraft: L.saveDraft,
94
+ onFinalize: L.finalize,
95
+ testId: u.dialog
96
+ });
97
+ }
98
+ //#endregion
99
+ export { g as BillCreateDialog, g as default };
@@ -1,4 +1,4 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js
2
- var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
3
- //#endregion
4
- export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
1
+ import "./index2.js";
2
+ import "./index8.js";
3
+ import "./index10.js";
4
+ import "./index12.js";
@@ -1,43 +1,4 @@
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 "./index13.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/index14.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 });
21
- }
22
- function l({ baseUrl: e, widgetToken: t, organizationId: r, configClient: a, linkComponent: l, implementation: u, uiFramework: d, errorFallback: f, onError: p, finopsThemeColors: m, analytics: h, pageTitleComponent: g = s, ..._ }) {
23
- return /* @__PURE__ */ o(i, {
24
- widgetName: n,
25
- baseUrl: e,
26
- widgetToken: t,
27
- organizationId: r,
28
- configClient: a,
29
- linkComponent: l,
30
- implementation: u,
31
- uiFramework: d,
32
- errorFallback: f,
33
- onError: p,
34
- finopsThemeColors: m,
35
- analytics: h,
36
- children: /* @__PURE__ */ o(c, {
37
- ..._,
38
- pageTitleComponent: g
39
- })
40
- });
41
- }
2
+ var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
42
3
  //#endregion
43
- export { l as BillPayWidgetMonite, l as default };
4
+ export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
@@ -1 +1,43 @@
1
- import "./index14.js";
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
+ //#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 });
21
+ }
22
+ function l({ baseUrl: e, widgetToken: t, organizationId: r, configClient: a, linkComponent: l, implementation: u, uiFramework: d, errorFallback: f, onError: p, finopsThemeColors: m, analytics: h, pageTitleComponent: g = s, ..._ }) {
23
+ return /* @__PURE__ */ o(i, {
24
+ widgetName: n,
25
+ baseUrl: e,
26
+ widgetToken: t,
27
+ organizationId: r,
28
+ configClient: a,
29
+ linkComponent: l,
30
+ implementation: u,
31
+ uiFramework: d,
32
+ errorFallback: f,
33
+ onError: p,
34
+ finopsThemeColors: m,
35
+ analytics: h,
36
+ children: /* @__PURE__ */ o(c, {
37
+ ..._,
38
+ pageTitleComponent: g
39
+ })
40
+ });
41
+ }
42
+ //#endregion
43
+ export { l as BillPayWidgetMonite, l as default };