@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
@@ -1,74 +1,37 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { displayLineAmount as e, displayTotal as t } from "./index6.js";
6
- import { emptyLineItem as n, mapPayableToBillForm as r } from "./index8.js";
7
- import { useCallback as i, useEffect as a, useMemo as o, useState as s } from "react";
8
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.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(), [_, v] = s(!1), [y, b] = s(!1);
14
- a(() => {
15
- _ || f(u.values);
16
- }, [u]), a(() => {
17
- y || m(u.lineItems);
18
- }, [u]);
19
- let x = i((e) => {
20
- f((t) => ({
21
- ...t,
22
- ...e
23
- })), v(!0);
24
- }, []), S = i((t, n) => {
25
- m((r) => r.map((r) => {
26
- if (r.id !== t) return r;
27
- let i = {
28
- ...r,
29
- ...n
30
- };
31
- return {
32
- ...i,
33
- amount: e(i.quantity, i.price)
34
- };
35
- })), b(!0);
36
- }, []), C = i((t, n) => {
37
- m((r) => r.map((r) => {
38
- if (r.id !== t) return r;
39
- let i = Number.parseFloat(r.quantity), a = String(Math.max(1, (Number.isFinite(i) ? i : 1) + n));
40
- return {
41
- ...r,
42
- quantity: a,
43
- amount: e(a, r.price)
44
- };
45
- })), b(!0);
46
- }, []), w = i((e) => {
47
- m((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e)), b(!0);
48
- }, []), T = i(() => {
49
- m((e) => [...e, n()]), b(!0);
50
- }, []);
2
+ function e() {
51
3
  return {
52
- values: d,
53
- errors: h,
54
- setErrors: g,
55
- onChange: x,
56
- lineItems: p,
57
- lineItemRows: o(() => p.map((e) => ({
58
- ...e,
59
- onChange: (t) => S(e.id, t),
60
- onQuantityStep: (t) => C(e.id, t),
61
- onRemove: () => w(e.id)
62
- })), [
63
- p,
64
- S,
65
- w,
66
- C
67
- ]),
68
- totalAmountLabel: o(() => t(p), [p]),
69
- onAddLineItem: T,
70
- isDirty: _ || y
4
+ id: crypto.randomUUID(),
5
+ description: "",
6
+ glCode: "",
7
+ quantity: "1",
8
+ price: "",
9
+ amount: ""
10
+ };
11
+ }
12
+ function t(e) {
13
+ return typeof e == "number" ? (e / 100).toFixed(2) : "";
14
+ }
15
+ function n({ payable: n, lineItems: r }) {
16
+ let i = {
17
+ invoiceNumber: n.document_id ?? "",
18
+ invoiceDate: n.issued_at ?? "",
19
+ dueDate: n.due_date ?? "",
20
+ poNumber: ""
21
+ }, a = r.map((e) => ({
22
+ id: e.id,
23
+ description: e.name ?? "",
24
+ glCode: e.ledger_account_id ?? "",
25
+ quantity: e.quantity == null ? "" : String(e.quantity),
26
+ price: t(e.unit_price),
27
+ amount: t(e.subtotal)
28
+ }));
29
+ return {
30
+ values: i,
31
+ lineItems: a.length ? a : [e()],
32
+ discount: t(n.discount),
33
+ tax: t(n.tax_amount)
71
34
  };
72
35
  }
73
36
  //#endregion
74
- export { c as useBillForm };
37
+ export { e as emptyLineItem, n as mapPayableToBillForm };
@@ -3,9 +3,6 @@ var e = {
3
3
  invoiceNumber: "Invoice number",
4
4
  invoiceDate: "Invoice date",
5
5
  dueDate: "Due date",
6
- paymentTerms: "Payment terms (optional)",
7
- paymentTermsPlaceholder: "Select payment terms",
8
- paymentTermsNone: "No payment terms",
9
6
  poNumber: "PO number (optional)"
10
7
  };
11
8
  //#endregion
@@ -1,83 +1,48 @@
1
- import { Input as e, Label as t, Select as n, SelectContent as r, SelectItem as i, SelectTrigger as a, SelectValue as o } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { BILL_FORM_FIELDS_LABELS_EN as s } from "./index12.js";
3
- import { useId as c } from "react";
4
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
1
+ import { Input as e, Label as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { BILL_FORM_FIELDS_LABELS_EN as n } from "./index12.js";
3
+ import { useId as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js
6
- var d = "__tesouro_no_payment_terms__";
7
- function f({ values: f, errors: p, onChange: m, paymentTermOptions: h = [], testId: g, labels: _ }) {
8
- let v = {
9
- ...s,
10
- ..._
11
- }, y = c(), b = (n, r, i) => {
12
- let a = `${y}-${n}`, o = `${a}-error`, s = p?.[n];
13
- return /* @__PURE__ */ u("div", {
6
+ function o({ values: o, errors: s, onChange: c, testId: l, labels: u }) {
7
+ let d = {
8
+ ...n,
9
+ ...u
10
+ }, f = r(), p = (n, r, l) => {
11
+ let u = `${f}-${n}`, d = `${u}-error`, p = s?.[n];
12
+ return /* @__PURE__ */ a("div", {
14
13
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
15
14
  children: [
16
- /* @__PURE__ */ l(t, {
17
- htmlFor: a,
15
+ /* @__PURE__ */ i(t, {
16
+ htmlFor: u,
18
17
  children: r
19
18
  }),
20
- /* @__PURE__ */ l(e, {
21
- id: a,
22
- type: i,
23
- value: f[n],
24
- "aria-invalid": s ? !0 : void 0,
25
- "aria-describedby": s ? o : void 0,
26
- onChange: (e) => m({ [n]: e.target.value })
19
+ /* @__PURE__ */ i(e, {
20
+ id: u,
21
+ type: l,
22
+ value: o[n],
23
+ "aria-invalid": p ? !0 : void 0,
24
+ "aria-describedby": p ? d : void 0,
25
+ onChange: (e) => c({ [n]: e.target.value })
27
26
  }),
28
- s ? /* @__PURE__ */ l("p", {
29
- id: o,
27
+ p ? /* @__PURE__ */ i("p", {
28
+ id: d,
30
29
  className: "ttw:text-sm ttw:text-destructive",
31
- children: s
30
+ children: p
32
31
  }) : null
33
32
  ]
34
33
  });
35
- }, x = `${y}-paymentTerms`, S = `${x}-error`, C = p?.paymentTerms;
36
- return /* @__PURE__ */ u("div", {
34
+ };
35
+ return /* @__PURE__ */ a("div", {
37
36
  className: "ttw:flex ttw:flex-col ttw:gap-4",
38
- "data-testid": g,
39
- children: [
40
- b("invoiceNumber", v.invoiceNumber),
41
- /* @__PURE__ */ u("div", {
42
- className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
43
- children: [b("invoiceDate", v.invoiceDate, "date"), b("dueDate", v.dueDate, "date")]
44
- }),
45
- /* @__PURE__ */ u("div", {
46
- className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
47
- children: [/* @__PURE__ */ u("div", {
48
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
49
- children: [
50
- /* @__PURE__ */ l(t, {
51
- htmlFor: x,
52
- children: v.paymentTerms
53
- }),
54
- /* @__PURE__ */ u(n, {
55
- value: f.paymentTerms || d,
56
- onValueChange: (e) => m({ paymentTerms: e === d ? "" : e }),
57
- children: [/* @__PURE__ */ l(a, {
58
- id: x,
59
- className: "ttw:w-full",
60
- "aria-invalid": C ? !0 : void 0,
61
- "aria-describedby": C ? S : void 0,
62
- children: /* @__PURE__ */ l(o, { placeholder: v.paymentTermsPlaceholder })
63
- }), /* @__PURE__ */ u(r, { children: [/* @__PURE__ */ l(i, {
64
- value: d,
65
- children: v.paymentTermsNone
66
- }), h.map((e) => /* @__PURE__ */ l(i, {
67
- value: e.value,
68
- children: e.label
69
- }, e.value))] })]
70
- }),
71
- C ? /* @__PURE__ */ l("p", {
72
- id: S,
73
- className: "ttw:text-sm ttw:text-destructive",
74
- children: C
75
- }) : null
76
- ]
77
- }), b("poNumber", v.poNumber)]
78
- })
79
- ]
37
+ "data-testid": l,
38
+ children: [/* @__PURE__ */ a("div", {
39
+ className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
40
+ children: [p("invoiceDate", d.invoiceDate, "date"), p("dueDate", d.dueDate, "date")]
41
+ }), /* @__PURE__ */ a("div", {
42
+ className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
43
+ children: [p("invoiceNumber", d.invoiceNumber), p("poNumber", d.poNumber)]
44
+ })]
80
45
  });
81
46
  }
82
47
  //#endregion
83
- export { f as BillFormFields, f as default };
48
+ export { o as BillFormFields, o as default };
@@ -9,6 +9,10 @@ var e = {
9
9
  quantity: "Quantity",
10
10
  price: "Price",
11
11
  amount: "Amount",
12
+ currencySymbol: "$",
13
+ discount: "Discounts",
14
+ tax: "Tax",
15
+ totalAmount: "Total amount",
12
16
  addLineItem: "+ Add line item",
13
17
  increaseQuantity: (e) => `Increase quantity — line item ${e}`,
14
18
  decreaseQuantity: (e) => `Decrease quantity — line item ${e}`,