@tesouro/embedded-components-react 0.11.234 → 0.11.236

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 (77) hide show
  1. package/README.md +53 -2
  2. package/dist/index.css +30 -0
  3. package/dist/index.d.ts +24 -0
  4. package/dist/lib/ReceivablesWidget.d.ts +24 -0
  5. package/dist/lib/WidgetSuite.d.ts +24 -0
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +6 -6
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +198 -118
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +76 -194
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +67 -75
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +111 -69
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +459 -108
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +101 -449
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +9 -117
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +85 -8
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +67 -73
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +246 -71
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +40 -251
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +237 -38
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +21 -244
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +529 -21
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +4 -530
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +44 -4
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +242 -41
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +3 -245
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index49.js +5 -3
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index50.js +63 -4
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index51.js +1 -64
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +1 -1
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +386 -354
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +1 -0
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +1 -1
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +1 -1
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +260 -258
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +219 -179
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +26 -25
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +15 -0
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +31 -40
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +18 -17
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +40 -8
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +30 -63
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +463 -27
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +15 -29
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +8 -18
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +18 -18
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +19 -30
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +15 -66
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +66 -391
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +148 -2
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +173 -43
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +3 -71
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +37 -432
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +66 -188
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +455 -22
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +191 -5
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +23 -0
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +5 -265
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +261 -125
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +2 -27
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +122 -230
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +27 -3
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +216 -224
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index58.js +3 -30
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +228 -168
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index60.js +29 -21
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index61.js +152 -109
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index62.js +22 -2
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index63.js +140 -43
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index64.js +2 -0
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index65.js +47 -0
  70. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/document-preview.js +1 -0
  71. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  72. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/document/documentPreview.js +122 -0
  73. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/WidgetFrame/WidgetFrame.js +1 -1
  74. package/dist/packages/shared-ui-shadcn/dist/index.js +4584 -4551
  75. package/package.json +1 -1
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index52.js +0 -1
  77. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +0 -2
@@ -0,0 +1,122 @@
1
+ import { resolvePdfWorkerSrc as e } from "../../../../util/dist/lib/pdfWorkerSrc.js";
2
+ import "../../../../util/dist/index.js";
3
+ import { useEffect as t, useRef as n, useState as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ import "react-pdf/dist/Page/TextLayer.css";
6
+ // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/document/documentPreview.js
7
+ var o = {
8
+ previewUnavailable: "Preview not available for this file type.",
9
+ openFile: "Open file",
10
+ previewRegion: "Attachment preview"
11
+ }, s = 720, c = 280, l = 1.3;
12
+ function u(e) {
13
+ return (e.trim().split(/\s+/)[0] ?? "").split("#")[0] ?? e;
14
+ }
15
+ function d({ url: e, labels: t }) {
16
+ return /* @__PURE__ */ a("div", {
17
+ className: "ttw:flex ttw:h-full ttw:w-full ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-2 ttw:p-4 ttw:text-center",
18
+ children: [/* @__PURE__ */ i("p", {
19
+ className: "ttw:text-sm ttw:text-muted-foreground",
20
+ children: t.previewUnavailable
21
+ }), /* @__PURE__ */ i("a", {
22
+ href: e,
23
+ target: "_blank",
24
+ rel: "noreferrer",
25
+ className: "ttw:text-sm ttw:font-medium ttw:text-primary ttw:underline ttw:underline-offset-2",
26
+ children: t.openFile
27
+ })]
28
+ });
29
+ }
30
+ function f({ url: a, labels: o }) {
31
+ let f = n(null), p = n(/* @__PURE__ */ new Map()), [m, h] = r(0), [g, _] = r(s), [v, y] = r(null), [b, x] = r(!1), [S, C] = r(() => /* @__PURE__ */ new Set([1]));
32
+ if (t(() => {
33
+ let t = !0;
34
+ return import("react-pdf").then(({ Document: n, Page: r, pdfjs: i }) => {
35
+ t && (i.GlobalWorkerOptions.workerSrc = e(i.version), y({
36
+ Document: n,
37
+ Page: r
38
+ }));
39
+ }).catch(() => {
40
+ t && x(!0);
41
+ }), () => {
42
+ t = !1;
43
+ };
44
+ }, []), t(() => {
45
+ if (!v) return;
46
+ let e = f.current;
47
+ if (!e) return;
48
+ let t = () => {
49
+ let t = e.clientWidth;
50
+ t && _(Math.max(c, Math.min(t, s)));
51
+ };
52
+ if (t(), typeof ResizeObserver > "u") return;
53
+ let n = new ResizeObserver(t);
54
+ return n.observe(e), () => n.disconnect();
55
+ }, [v]), t(() => {
56
+ C(/* @__PURE__ */ new Set([1]));
57
+ }, [a]), t(() => {
58
+ let e = f.current;
59
+ if (!e || !m || typeof IntersectionObserver > "u") return;
60
+ let t = new IntersectionObserver((e) => {
61
+ let t = e.filter((e) => e.isIntersecting).map((e) => Number(e.target.getAttribute("data-page-number"))).filter((e) => e >= 1);
62
+ t.length && C((e) => {
63
+ let n = new Set(e);
64
+ return t.forEach((e) => n.add(e)), n.size === e.size ? e : n;
65
+ });
66
+ }, {
67
+ root: e,
68
+ rootMargin: "600px 0px"
69
+ });
70
+ return p.current.forEach((e) => t.observe(e)), () => t.disconnect();
71
+ }, [m, g]), b) return /* @__PURE__ */ i(d, {
72
+ url: a,
73
+ labels: o
74
+ });
75
+ if (!v) return null;
76
+ let { Document: w, Page: T } = v;
77
+ return /* @__PURE__ */ i("div", {
78
+ ref: f,
79
+ role: "region",
80
+ "aria-label": o.previewRegion,
81
+ tabIndex: 0,
82
+ className: "ttw:flex ttw:h-full ttw:w-full ttw:justify-center ttw:overflow-auto ttw:bg-white",
83
+ children: /* @__PURE__ */ i(w, {
84
+ suspense: !1,
85
+ file: u(a),
86
+ onLoadSuccess: ({ numPages: e }) => h(e),
87
+ children: Array.from({ length: m }, (e, t) => {
88
+ let n = t + 1;
89
+ return /* @__PURE__ */ i("div", {
90
+ ref: (e) => {
91
+ e ? p.current.set(n, e) : p.current.delete(n);
92
+ },
93
+ "data-page-number": n,
94
+ style: { minHeight: S.has(n) ? void 0 : Math.round(g * l) },
95
+ children: S.has(n) ? /* @__PURE__ */ i(T, {
96
+ pageNumber: n,
97
+ width: g,
98
+ renderAnnotationLayer: !1
99
+ }) : null
100
+ }, n);
101
+ })
102
+ })
103
+ });
104
+ }
105
+ function p(e, t = {}) {
106
+ let n = {
107
+ ...o,
108
+ ...t
109
+ };
110
+ return e.mimetype === "application/pdf" ? /* @__PURE__ */ i(f, {
111
+ url: e.url,
112
+ labels: n
113
+ }) : e.mimetype.startsWith("image/") ? /* @__PURE__ */ i("img", {
114
+ src: e.url,
115
+ alt: e.name,
116
+ className: "ttw:max-h-full ttw:max-w-full ttw:object-contain"
117
+ }) : /* @__PURE__ */ i(d, {
118
+ url: e.url,
119
+ labels: n
120
+ });
121
+ }
122
+ export { o as DOCUMENT_PREVIEW_LABELS_EN, p as createDocumentPreview };
@@ -5,7 +5,7 @@ function i({ title: i, action: a, bodyClassName: o, className: s, children: c, .
5
5
  let u = i !== void 0 || a != null;
6
6
  return /* @__PURE__ */ r("div", {
7
7
  "data-slot": "widget-frame",
8
- className: t("ttw:@container/widget ttw:flex ttw:w-full ttw:flex-col ttw:overflow-hidden ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:text-card-foreground", s),
8
+ className: t("ttw:@container/widget ttw:isolate ttw:flex ttw:w-full ttw:flex-col ttw:overflow-hidden ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:text-card-foreground", s),
9
9
  ...l,
10
10
  children: [u ? /* @__PURE__ */ r("div", {
11
11
  className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:justify-between ttw:gap-3 ttw:px-4 ttw:py-3",