@tesouro/embedded-components-react 0.2.333 → 0.2.337

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 (113) hide show
  1. package/dist/index.css +22 -0
  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 +10 -6
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +2 -2
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +0 -1
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +43 -31
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +12 -46
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +46 -30
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +26 -149
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +159 -31
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +32 -98
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +102 -10
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +11 -212
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +226 -4
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +4 -29
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +27 -80
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +75 -125
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +133 -3
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +3 -4
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +2 -43
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +45 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +1 -8
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +6 -9
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +9 -92
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +94 -3
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +3 -110
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +7 -9
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +20 -38
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +57 -6
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +3 -91
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +105 -157
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +11 -5
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +40 -5
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +6 -113
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +100 -1
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +171 -16
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +5 -0
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +8 -0
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +115 -0
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +1 -0
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +25 -0
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +2 -2
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +34 -26
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +2 -16
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +18 -2
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +1 -41
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +38 -269
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +272 -1
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +2 -9
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +7 -47
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +49 -2
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +2 -22
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +20 -284
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +286 -2
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +2 -16
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +13 -117
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +120 -2
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +2 -10
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +8 -94
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +96 -2
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +1 -12
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +11 -56
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +57 -1
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +1 -53
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +51 -136
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +141 -1
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +2 -7
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +5 -42
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +44 -2
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +2 -4
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +2 -61
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +63 -2
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +2 -4
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +2 -14
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +16 -2
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index51.js +1 -73
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +72 -250
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +251 -12
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +9 -252
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +1 -10
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +6 -4
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +43 -87
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +2 -0
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +14 -2
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +278 -5
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +8 -28
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +8 -2
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +91 -5
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +1 -1
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +15 -9
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +101 -94
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index69.js +3 -14
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index70.js +28 -8
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index71.js +2 -170
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index72.js +7 -2
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +32 -12
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +2 -89
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +12 -2
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +106 -0
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +2 -0
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +18 -0
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +10 -0
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +170 -0
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +2 -0
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +14 -0
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +89 -0
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +2 -0
  109. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  110. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  111. package/dist/packages/shared-ui-shadcn/dist/index.js +1378 -1371
  112. package/package.json +1 -1
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +0 -34
package/dist/index.css CHANGED
@@ -15,12 +15,15 @@
15
15
  --ttw-color-red-950: oklch(25.8% 0.092 26.042);
16
16
  --ttw-color-orange-50: oklch(98% 0.016 73.684);
17
17
  --ttw-color-orange-100: oklch(95.4% 0.038 75.164);
18
+ --ttw-color-orange-200: oklch(90.1% 0.076 70.697);
19
+ --ttw-color-orange-300: oklch(83.7% 0.128 66.29);
18
20
  --ttw-color-orange-400: oklch(75% 0.183 55.934);
19
21
  --ttw-color-orange-700: oklch(55.3% 0.195 38.402);
20
22
  --ttw-color-orange-950: oklch(26.6% 0.079 36.259);
21
23
  --ttw-color-amber-50: oklch(98.7% 0.022 95.277);
22
24
  --ttw-color-amber-100: oklch(96.2% 0.059 95.617);
23
25
  --ttw-color-amber-200: oklch(92.4% 0.12 95.746);
26
+ --ttw-color-amber-300: oklch(87.9% 0.169 91.605);
24
27
  --ttw-color-amber-600: oklch(66.6% 0.179 58.318);
25
28
  --ttw-color-amber-700: oklch(55.5% 0.163 48.998);
26
29
  --ttw-color-amber-800: oklch(47.3% 0.137 46.201);
@@ -2165,6 +2168,9 @@
2165
2168
  .ttw\:border-amber-200 {
2166
2169
  border-color: var(--ttw-color-amber-200);
2167
2170
  }
2171
+ .ttw\:border-amber-300 {
2172
+ border-color: var(--ttw-color-amber-300);
2173
+ }
2168
2174
  .ttw\:border-background {
2169
2175
  border-color: var(--ttw-background);
2170
2176
  }
@@ -2231,6 +2237,9 @@
2231
2237
  .ttw\:border-orange-100 {
2232
2238
  border-color: var(--ttw-color-orange-100);
2233
2239
  }
2240
+ .ttw\:border-orange-300 {
2241
+ border-color: var(--ttw-color-orange-300);
2242
+ }
2234
2243
  .ttw\:border-orange-400 {
2235
2244
  border-color: var(--ttw-color-orange-400);
2236
2245
  }
@@ -2516,6 +2525,9 @@
2516
2525
  .ttw\:bg-orange-100 {
2517
2526
  background-color: var(--ttw-color-orange-100);
2518
2527
  }
2528
+ .ttw\:bg-orange-200 {
2529
+ background-color: var(--ttw-color-orange-200);
2530
+ }
2519
2531
  .ttw\:bg-orange-700 {
2520
2532
  background-color: var(--ttw-color-orange-700);
2521
2533
  }
@@ -5525,6 +5537,9 @@
5525
5537
  .ttw\:sm\:max-w-180 {
5526
5538
  max-width: calc(var(--ttw-spacing) * 180);
5527
5539
  }
5540
+ .ttw\:sm\:max-w-208\.75 {
5541
+ max-width: calc(var(--ttw-spacing) * 208.75);
5542
+ }
5528
5543
  .ttw\:sm\:max-w-\[423px\] {
5529
5544
  max-width: 423px;
5530
5545
  }
@@ -5569,6 +5584,9 @@
5569
5584
  border-left-style: var(--tw-border-style);
5570
5585
  border-left-width: 1px;
5571
5586
  }
5587
+ .ttw\:sm\:text-center {
5588
+ text-align: center;
5589
+ }
5572
5590
  .ttw\:sm\:text-left {
5573
5591
  text-align: left;
5574
5592
  }
@@ -6112,6 +6130,10 @@
6112
6130
  width: calc(var(--ttw-spacing) * 4);
6113
6131
  height: calc(var(--ttw-spacing) * 4);
6114
6132
  }
6133
+ .ttw\:\[\&\>svg\]\:size-6 > svg {
6134
+ width: calc(var(--ttw-spacing) * 6);
6135
+ height: calc(var(--ttw-spacing) * 6);
6136
+ }
6115
6137
  .ttw\:\[\&\>svg\]\:shrink-0 > svg {
6116
6138
  flex-shrink: 0;
6117
6139
  }
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/index60.js";
19
+ import { BillPayWidget as T } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.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/index60.js";
1
+ import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js";
2
2
  import "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js";
3
3
  export { e as BillPayWidget };
@@ -2,23 +2,27 @@ import "./index10.js";
2
2
  import "./index11.js";
3
3
  import "./index20.js";
4
4
  import "./index26.js";
5
- import "./index33.js";
6
- import "./index35.js";
7
- import "./index37.js";
5
+ import "./index34.js";
6
+ import "./index36.js";
8
7
  import "./index38.js";
9
8
  import "./index39.js";
10
9
  import "./index40.js";
11
10
  import "./index41.js";
12
11
  import "./index42.js";
13
- import "./index46.js";
12
+ import "./index43.js";
14
13
  import "./index47.js";
15
14
  import "./index48.js";
16
15
  import "./index49.js";
17
16
  import "./index50.js";
17
+ import "./index51.js";
18
18
  import "./index52.js";
19
19
  import "./index53.js";
20
20
  import "./index54.js";
21
21
  import "./index55.js";
22
- import "./index56.js";
23
- import { BillPayWidget as e } from "./index60.js";
22
+ import "./index57.js";
23
+ import "./index58.js";
24
+ import "./index59.js";
25
+ import "./index60.js";
26
+ import "./index61.js";
27
+ import { BillPayWidget as e } from "./index65.js";
24
28
  export { e as BillPayWidget };
@@ -5,8 +5,8 @@
5
5
  import { resolveAmountDueMinorUnits as e } from "./index2.js";
6
6
  import { resolveVendor as t } from "./index3.js";
7
7
  import { payBillFlowTestIds as n } from "./index4.js";
8
- import { ReviewTransactionDialog as r } from "../../ui/dist/index67.js";
9
- import { SchedulePaymentDialog as i } from "../../ui/dist/index71.js";
8
+ import { ReviewTransactionDialog as r } from "../../ui/dist/index76.js";
9
+ import { SchedulePaymentDialog as i } from "../../ui/dist/index80.js";
10
10
  import "../../ui/dist/index.js";
11
11
  import { usePayBillFlow as a } from "./index9.js";
12
12
  import { useImperativeHandle as o } from "react";
@@ -27,7 +27,6 @@ var s = {
27
27
  vendorDetailsFailed: "We could not load this vendor. Try again."
28
28
  }, l = {
29
29
  attachFailed: "We could not attach that file. Try again.",
30
- saveBeforeAttaching: "Save this bill before attaching a document.",
31
30
  noDocument: "No document attached to this bill.",
32
31
  preview: o
33
32
  }, u = {
@@ -2,58 +2,70 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { SourceDocumentPanel as e } from "../../ui/dist/index74.js";
5
+ import { SourceDocumentPanel as e } from "../../ui/dist/index83.js";
6
6
  import "../../ui/dist/index.js";
7
7
  import { useAttachPayableFileMutation as t, useDeletePayableFileMutation as n } from "../../data-access/dist/index10.js";
8
8
  import "../../data-access/dist/index.js";
9
9
  import { createSourceDocumentPreview as r } from "./index25.js";
10
10
  import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as i } from "./index26.js";
11
- import { jsx as a } from "react/jsx-runtime";
11
+ import { useEffect as a, useState as o } from "react";
12
+ import { jsx as s } from "react/jsx-runtime";
12
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js
13
- function o({ payableId: o, file: s, isDocumentPending: c, pendingFileName: l, readOnly: u, labels: d }) {
14
- let f = {
14
+ function c(e) {
15
+ let [t, n] = o();
16
+ return a(() => {
17
+ if (!e) {
18
+ n(void 0);
19
+ return;
20
+ }
21
+ let t = URL.createObjectURL(e);
22
+ return n(t), () => URL.revokeObjectURL(t);
23
+ }, [e]), t;
24
+ }
25
+ function l({ payableId: a, file: o, isDocumentPending: l, pendingFileName: u, readOnly: d, staging: f, labels: p }) {
26
+ let { stagedFile: m, onFileStaged: h, onClearStagedFile: g, isSaving: _ } = f ?? {}, v = {
15
27
  ...i,
16
- ...d,
28
+ ...p,
17
29
  preview: {
18
30
  ...i.preview,
19
- ...d?.preview
31
+ ...p?.preview
20
32
  }
21
- }, p = t(), m = n();
22
- if (!s && (c || p.isPending)) return /* @__PURE__ */ a(e, {
33
+ }, y = t(), b = n(), x = c(m), S = !!(o || m);
34
+ if (!S && (l || y.isPending)) return /* @__PURE__ */ s(e, {
23
35
  mode: "loading",
24
- fileName: l
25
- });
26
- if (!s && u) return /* @__PURE__ */ a("div", {
27
- className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
28
- children: f.noDocument
36
+ fileName: u
29
37
  });
30
- if (!s && !o) return /* @__PURE__ */ a("div", {
38
+ if (!S && d) return /* @__PURE__ */ s("div", {
31
39
  className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
32
- children: f.saveBeforeAttaching
40
+ children: v.noDocument
33
41
  });
34
- if (!s) return /* @__PURE__ */ a(e, {
42
+ if (!S) return /* @__PURE__ */ s(e, {
35
43
  mode: "upload",
36
- uploadStatus: p.isPending ? "uploading" : "idle",
37
- uploadErrorMessage: p.isError ? f.attachFailed : void 0,
44
+ uploadStatus: y.isPending ? "uploading" : "idle",
45
+ uploadErrorMessage: y.isError ? v.attachFailed : void 0,
38
46
  onFilesSelected: (e) => {
39
47
  let [t] = e;
40
- !t || !o || p.mutate({
41
- path: { payable_id: o },
48
+ t && (a ? y.mutate({
49
+ path: { payable_id: a },
42
50
  file: t
43
- });
51
+ }) : h?.(t));
44
52
  }
45
53
  });
46
- let h = r(s, f.preview);
47
- return /* @__PURE__ */ a(e, {
54
+ let C = o?.name ?? m?.name ?? "", w = r(o || {
55
+ name: C,
56
+ url: x ?? "",
57
+ mimetype: m?.type ?? ""
58
+ }, v.preview);
59
+ return /* @__PURE__ */ s(e, {
48
60
  mode: "document",
49
- fileName: s.name,
50
- preview: h,
51
- onDownload: () => window.open(s.url, "_blank", "noopener,noreferrer"),
52
- onDelete: o && !u ? () => m.mutate({
53
- path: { file_id: s.id },
54
- payableId: o
55
- }) : void 0
61
+ fileName: C,
62
+ preview: w,
63
+ onDownload: o ? () => window.open(o.url, "_blank", "noopener,noreferrer") : void 0,
64
+ onDelete: d ? void 0 : o && a ? () => b.mutate({
65
+ path: { file_id: o.id },
66
+ payableId: a
67
+ }) : _ ? void 0 : g
56
68
  });
57
69
  }
58
70
  //#endregion
59
- export { o as SourceDocumentContainer, o as default };
71
+ export { l as SourceDocumentContainer, l as default };
@@ -1,50 +1,16 @@
1
- import { parseDecimalAmountToMinorUnits as e } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
2
- import "../../data-access/dist/index.js";
3
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js
4
- var t = "USD";
5
- function n(n) {
6
- return e(n, t);
7
- }
8
- function r(e) {
9
- let t = e.trim();
10
- if (!t) return null;
11
- let n = Number(t);
12
- return Number.isFinite(n) && n > 0 ? n : null;
13
- }
14
- function i(e) {
15
- return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
16
- }
17
- function a(e) {
18
- return n(e) ?? 0;
19
- }
20
- function o(e) {
21
- let t = Number.parseFloat(e);
22
- return Number.isFinite(t) ? t : 0;
23
- }
24
- function s(e) {
25
- return (e / 100).toFixed(2);
26
- }
27
- function c({ values: e, counterpartId: r, clearCounterpart: i, editedTotals: a }) {
28
- let o = { currency: t };
29
- return r ? o.counterpart_id = r : i && (o.counterpart_id = null), e.invoiceNumber && (o.document_id = e.invoiceNumber), e.invoiceDate && (o.issued_at = e.invoiceDate), e.dueDate && (o.due_date = e.dueDate), a && (o.discount = n(a.discount) ?? 0, o.tax_amount = n(a.tax) ?? 0, a.total !== void 0 && (o.total_amount = n(a.total) ?? 0)), o;
30
- }
31
- function l(e) {
32
- return e.filter(i).map((e) => {
33
- let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a);
34
- return {
35
- name: e.description,
36
- quantity: i,
37
- unit_price: a,
38
- ...t !== null && t !== o ? { subtotal: t } : {},
39
- ...e.glCode ? { ledger_account_id: e.glCode } : {}
40
- };
2
+ function e(e) {
3
+ return new Promise((t, n) => {
4
+ let r = new FileReader();
5
+ r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Failed to read file")), r.onload = () => {
6
+ let e = r.result;
7
+ if (typeof e != "string") {
8
+ n(/* @__PURE__ */ Error("Failed to read file as a data URL"));
9
+ return;
10
+ }
11
+ t(e.slice(e.indexOf(",") + 1));
12
+ }, r.readAsDataURL(e);
41
13
  });
42
14
  }
43
- function u(e, t) {
44
- return s(Math.round(o(e) * a(t)));
45
- }
46
- function d(e, t, n) {
47
- return s(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
48
- }
49
15
  //#endregion
50
- export { d as calculateTotal, u as displayLineAmount, i as isPersistableLineItem, c as mapBillFormToPayload, l as mapLineItemsToPayload, n as parseMoneyToMinorUnits, r as parseQuantity };
16
+ export { e as encodeFileToBase64 };
@@ -1,34 +1,50 @@
1
- import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index26.js";
2
- import { isPersistableLineItem as t, parseMoneyToMinorUnits as n, parseQuantity as r } from "./index31.js";
1
+ import { parseDecimalAmountToMinorUnits as e } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
2
+ import "../../data-access/dist/index.js";
3
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js
4
- var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/;
5
- function a(e) {
4
+ var t = "USD";
5
+ function n(n) {
6
+ return e(n, t);
7
+ }
8
+ function r(e) {
6
9
  let t = e.trim();
7
- return !t || n(t) !== null ? !0 : i.test(t) ? Number(t.replaceAll(",", "")) === 0 : !1;
8
- }
9
- function o(t, i = e) {
10
- let a = {};
11
- for (let e of t) {
12
- let t = n(e.price), o = n(e.amount), s = {};
13
- e.price.trim() && t === null && (s.price = i.unreadableMoney), e.amount.trim() && o === null && (s.amount = i.unreadableMoney), (t !== null || o !== null) && r(e.quantity) === null && (s.quantity = i.unusableQuantity), Object.keys(s).length && (a[e.id] = s);
14
- }
15
- return Object.keys(a).length ? a : void 0;
16
- }
17
- function s(i, a, o, s = e) {
18
- let c = {};
19
- a || (c.vendor = s.requiredField), i.invoiceNumber.trim() || (c.invoiceNumber = s.requiredField), i.invoiceDate.trim() || (c.invoiceDate = s.requiredField), i.dueDate.trim() || (c.dueDate = s.requiredField);
20
- let l = {};
21
- return o.forEach((e, i) => {
22
- if (i > 0 && !t(e)) return;
23
- let a = {};
24
- e.description.trim() || (a.description = s.requiredField), r(e.quantity) === null && (a.quantity = s.requiredField), n(e.price) === null && n(e.amount) === null && (a.price = s.requiredField, a.amount = s.requiredField), Object.keys(a).length && (l[e.id] = a);
25
- }), {
26
- formErrors: Object.keys(c).length ? c : void 0,
27
- lineItemErrors: Object.keys(l).length ? l : void 0
28
- };
29
- }
30
- function c(t, r, i, o = e) {
31
- return !a(t) || !a(r) || i !== void 0 && n(i) === null ? { form: o.totalsNeedAttention } : void 0;
10
+ if (!t) return null;
11
+ let n = Number(t);
12
+ return Number.isFinite(n) && n > 0 ? n : null;
13
+ }
14
+ function i(e) {
15
+ return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
16
+ }
17
+ function a(e) {
18
+ return n(e) ?? 0;
19
+ }
20
+ function o(e) {
21
+ let t = Number.parseFloat(e);
22
+ return Number.isFinite(t) ? t : 0;
23
+ }
24
+ function s(e) {
25
+ return (e / 100).toFixed(2);
26
+ }
27
+ function c({ values: e, counterpartId: r, clearCounterpart: i, editedTotals: a, document: o }) {
28
+ let s = { currency: t };
29
+ return r ? s.counterpart_id = r : i && (s.counterpart_id = null), e.invoiceNumber && (s.document_id = e.invoiceNumber), e.invoiceDate && (s.issued_at = e.invoiceDate), e.dueDate && (s.due_date = e.dueDate), o && (s.base64_encoded_file = o.base64EncodedFile, s.file_name = o.fileName), a && (s.discount = n(a.discount) ?? 0, s.tax_amount = n(a.tax) ?? 0, a.total !== void 0 && (s.total_amount = n(a.total) ?? 0)), s;
30
+ }
31
+ function l(e) {
32
+ return e.filter(i).map((e) => {
33
+ let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a);
34
+ return {
35
+ name: e.description,
36
+ quantity: i,
37
+ unit_price: a,
38
+ ...t !== null && t !== o ? { subtotal: t } : {},
39
+ ...e.glCode ? { ledger_account_id: e.glCode } : {}
40
+ };
41
+ });
42
+ }
43
+ function u(e, t) {
44
+ return s(Math.round(o(e) * a(t)));
45
+ }
46
+ function d(e, t, n) {
47
+ return s(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
32
48
  }
33
49
  //#endregion
34
- export { s as validateBillCompleteness, c as validateBillTotals, o as validateLineItems };
50
+ export { d as calculateTotal, u as displayLineAmount, i as isPersistableLineItem, c as mapBillFormToPayload, l as mapLineItemsToPayload, n as parseMoneyToMinorUnits, r as parseQuantity };
@@ -1,157 +1,34 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import "../../../shared/ui/dist/index.js";
7
- import { useReplacePayableLineItemsMutation as t } from "../../data-access/dist/index7.js";
8
- import { useCreatePayableMutation as n, useSubmitPayableForApprovalMutation as r, useUpdatePayableMutation as i, useValidatePayableMutation as a } from "../../data-access/dist/index10.js";
9
- import "../../data-access/dist/index.js";
10
- import { BILL_CREATE_MESSAGE_LABELS_EN as o } from "./index26.js";
11
- import { mapBillFormToPayload as s, mapLineItemsToPayload as c } from "./index31.js";
12
- import { validateBillCompleteness as l, validateBillTotals as u, validateLineItems as d } from "./index32.js";
13
- import { useCallback as f, useRef as p, useState as m } from "react";
1
+ import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index26.js";
2
+ import { isPersistableLineItem as t, parseMoneyToMinorUnits as n, parseQuantity as r } from "./index32.js";
14
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js
15
- var h = {
16
- document_id: "invoiceNumber",
17
- issued_at: "invoiceDate",
18
- due_date: "dueDate",
19
- counterpart_id: "vendor"
20
- };
21
- function g(e) {
22
- return e.type === "type_error.none.not_allowed" || e.msg === "none is not an allowed value";
4
+ var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/;
5
+ function a(e) {
6
+ let t = e.trim();
7
+ return !t || n(t) !== null ? !0 : i.test(t) ? Number(t.replaceAll(",", "")) === 0 : !1;
23
8
  }
24
- function _(e, t = o) {
25
- let n = {}, r = [];
26
- for (let i of e) {
27
- let e = i.loc[0] ?? t.unknownValidationField, a = h[e], o = g(i) ? t.requiredField : i.msg;
28
- a ? n[a] = o : r.push(t.unmappedValidationError(e, o));
9
+ function o(t, i = e) {
10
+ let a = {};
11
+ for (let e of t) {
12
+ let t = n(e.price), o = n(e.amount), s = {};
13
+ e.price.trim() && t === null && (s.price = i.unreadableMoney), e.amount.trim() && o === null && (s.amount = i.unreadableMoney), (t !== null || o !== null) && r(e.quantity) === null && (s.quantity = i.unusableQuantity), Object.keys(s).length && (a[e.id] = s);
29
14
  }
30
- return r.length && (n.form = r.join(" ")), n;
15
+ return Object.keys(a).length ? a : void 0;
31
16
  }
32
- function v(e, t) {
33
- if (!e && !t) return;
34
- let n = {}, r = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
35
- for (let i of r) n[i] = {
36
- ...e?.[i],
37
- ...t?.[i]
17
+ function s(i, a, o, s = e) {
18
+ let c = {};
19
+ a || (c.vendor = s.requiredField), i.invoiceNumber.trim() || (c.invoiceNumber = s.requiredField), i.invoiceDate.trim() || (c.invoiceDate = s.requiredField), i.dueDate.trim() || (c.dueDate = s.requiredField);
20
+ let l = {};
21
+ return o.forEach((e, i) => {
22
+ if (i > 0 && !t(e)) return;
23
+ let a = {};
24
+ e.description.trim() || (a.description = s.requiredField), r(e.quantity) === null && (a.quantity = s.requiredField), n(e.price) === null && n(e.amount) === null && (a.price = s.requiredField, a.amount = s.requiredField), Object.keys(a).length && (l[e.id] = a);
25
+ }), {
26
+ formErrors: Object.keys(c).length ? c : void 0,
27
+ lineItemErrors: Object.keys(l).length ? l : void 0
38
28
  };
39
- return n;
40
29
  }
41
- function y({ payableId: h, form: g, counterpartId: y, clearCounterpart: b, prepareVendorForSave: x, onSaved: S, onPayableCreated: C, onDraftSaved: w, onFinalized: T, labels: E }) {
42
- let D = {
43
- ...o,
44
- ...E
45
- }, [O, k] = m(), A = h ?? O, [j, M] = m(), N = p(!1), P = n(), F = i(), I = t(), L = a(), R = r(), z = f(() => {
46
- let t = d(g.lineItems, D), n = u(g.discount, g.tax, g.totalOverride, D);
47
- return g.setLineItemErrors(t), !t && !n || (t ? (g.setErrors(void 0), e.error(D.lineItemsNeedAttention)) : g.setErrors(n), !1);
48
- }, [g, D]), B = f(async () => {
49
- let e = s({
50
- values: g.values,
51
- counterpartId: y,
52
- clearCounterpart: b,
53
- editedTotals: g.isTotalsDirty ? {
54
- discount: g.discount,
55
- tax: g.tax,
56
- total: g.totalOverride
57
- } : void 0
58
- }), t = A;
59
- if (t ? await F.mutateAsync({
60
- path: { payable_id: t },
61
- body: e
62
- }) : (t = (await P.mutateAsync({ body: e }))?.id, t && (k(t), C?.(t))), !t) throw Error("Payable was created without an id");
63
- return await I.mutateAsync({
64
- path: { payable_id: t },
65
- body: { data: c(g.lineItems) }
66
- }), t;
67
- }, [
68
- y,
69
- b,
70
- P,
71
- g.discount,
72
- g.isTotalsDirty,
73
- g.lineItems,
74
- g.tax,
75
- g.totalOverride,
76
- g.values,
77
- C,
78
- A,
79
- I,
80
- F
81
- ]);
82
- return {
83
- saveDraft: f(async () => {
84
- if (!N.current && z()) {
85
- N.current = !0, M("draft");
86
- try {
87
- if (await x?.() === !1) return;
88
- let t = await B();
89
- g.setErrors(void 0), S?.(t), w?.(t), e.success(D.draftSaved);
90
- } catch {
91
- g.setErrors({ form: D.saveFailed });
92
- } finally {
93
- M(void 0), N.current = !1;
94
- }
95
- }
96
- }, [
97
- g,
98
- z,
99
- D.draftSaved,
100
- D.saveFailed,
101
- w,
102
- S,
103
- x,
104
- B
105
- ]),
106
- finalize: f(async () => {
107
- if (N.current) return;
108
- let t = d(g.lineItems, D), n = u(g.discount, g.tax, g.totalOverride, D), { formErrors: r, lineItemErrors: i } = l(g.values, y, g.lineItems, D), a = v(i, t);
109
- g.setLineItemErrors(a);
110
- let o = {
111
- ...r,
112
- ...n
113
- };
114
- if (g.setErrors(Object.keys(o).length ? o : void 0), t && e.error(D.lineItemsNeedAttention), !(a || Object.keys(o).length)) {
115
- N.current = !0, M("finalize");
116
- try {
117
- let t;
118
- try {
119
- if (await x?.() === !1) return;
120
- t = await B();
121
- } catch {
122
- g.setErrors({ form: D.saveFailed });
123
- return;
124
- }
125
- S?.(t);
126
- try {
127
- let n = await L.mutateAsync({ path: { payable_id: t } });
128
- if (n.validation_errors.length) {
129
- g.setErrors(_(n.validation_errors, D));
130
- return;
131
- }
132
- await R.mutateAsync({ path: { payable_id: t } }), g.setErrors(void 0), T?.(t), e.success(D.billFinalized);
133
- } catch {
134
- g.setErrors({ form: D.finalizeFailed });
135
- }
136
- } finally {
137
- M(void 0), N.current = !1;
138
- }
139
- }
140
- }, [
141
- y,
142
- g,
143
- D,
144
- T,
145
- S,
146
- x,
147
- B,
148
- R,
149
- L
150
- ]),
151
- payableId: A,
152
- isSavingDraft: j === "draft",
153
- isFinalizing: j === "finalize"
154
- };
30
+ function c(t, r, i, o = e) {
31
+ return !a(t) || !a(r) || i !== void 0 && n(i) === null ? { form: o.totalsNeedAttention } : void 0;
155
32
  }
156
33
  //#endregion
157
- export { _ as mapValidationErrorsToForm, y as useBillCreateController };
34
+ export { s as validateBillCompleteness, c as validateBillTotals, o as validateLineItems };