@tesouro/embedded-components-react 0.3.20 → 0.3.22

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 (154) hide show
  1. package/dist/index.css +9 -0
  2. package/dist/lib/monite-sdk.js +18 -18
  3. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index3.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index.js +19 -19
  5. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index422.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index479.js +16 -20
  7. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index480.js +13 -12
  8. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index481.js +19 -97
  9. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index482.js +98 -42
  10. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index483.js +43 -27
  11. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index484.js +30 -1
  12. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index485.js +1 -17
  13. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index486.js +11 -10
  14. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index487.js +14 -4
  15. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index488.js +4 -13
  16. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index489.js +7 -7
  17. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index490.js +18 -9
  18. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index491.js +8 -105
  19. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index492.js +102 -35
  20. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index493.js +36 -45
  21. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index494.js +44 -71
  22. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index495.js +72 -100
  23. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index496.js +99 -43
  24. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index497.js +35 -178
  25. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index498.js +171 -125
  26. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index499.js +134 -123
  27. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index500.js +125 -73
  28. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index501.js +63 -232
  29. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index502.js +248 -8
  30. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index503.js +8 -6
  31. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index504.js +5 -456
  32. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index505.js +455 -21
  33. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index506.js +17 -12
  34. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index507.js +13 -49
  35. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index508.js +51 -43
  36. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index509.js +46 -14
  37. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index510.js +13 -41
  38. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index511.js +39 -144
  39. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index512.js +143 -112
  40. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index513.js +114 -39
  41. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index514.js +33 -25
  42. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index515.js +32 -19
  43. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index516.js +3 -3
  44. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index517.js +19 -21
  45. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index518.js +20 -72
  46. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index519.js +73 -17
  47. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index520.js +18 -172
  48. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index521.js +149 -116
  49. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index522.js +136 -30
  50. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index523.js +31 -115
  51. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index524.js +116 -19
  52. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index525.js +10 -36
  53. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index526.js +46 -14
  54. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index527.js +13 -23
  55. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index528.js +21 -25
  56. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index529.js +26 -36
  57. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index530.js +36 -77
  58. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index531.js +77 -50
  59. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index532.js +50 -33
  60. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index533.js +34 -89
  61. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index534.js +86 -48
  62. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index535.js +54 -1
  63. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index536.js +1 -40
  64. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index537.js +40 -1
  65. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index538.js +0 -135
  66. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index539.js +129 -102
  67. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index540.js +105 -50
  68. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index541.js +48 -779
  69. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index542.js +780 -87
  70. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index543.js +84 -97
  71. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index544.js +105 -6
  72. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index545.js +6 -27
  73. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index546.js +23 -11
  74. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index547.js +13 -2
  75. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index548.js +2 -25
  76. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index549.js +25 -14
  77. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index550.js +14 -171
  78. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index551.js +163 -200
  79. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index552.js +204 -78
  80. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index553.js +82 -17
  81. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index554.js +17 -158
  82. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index555.js +146 -85
  83. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index556.js +95 -42
  84. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index557.js +46 -4
  85. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index558.js +4 -16
  86. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index559.js +13 -24
  87. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index560.js +27 -1
  88. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index561.js +0 -186
  89. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index562.js +186 -0
  90. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index563.js +0 -42
  91. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index564.js +41 -3
  92. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index565.js +5 -24
  93. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index566.js +20 -73
  94. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index567.js +74 -16
  95. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index568.js +16 -19
  96. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index569.js +19 -5
  97. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index570.js +4 -8
  98. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index571.js +10 -11
  99. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index572.js +11 -131
  100. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index573.js +129 -4
  101. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index574.js +4 -4
  102. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index575.js +8 -5
  103. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index576.js +4 -221
  104. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index577.js +219 -11
  105. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index578.js +12 -34
  106. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index579.js +32 -181
  107. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index580.js +168 -189
  108. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index581.js +192 -88
  109. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index582.js +97 -61
  110. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index583.js +63 -54
  111. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index584.js +46 -83
  112. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index585.js +91 -40
  113. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index586.js +39 -75
  114. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index587.js +63 -71
  115. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index588.js +85 -12
  116. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index589.js +12 -24
  117. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index590.js +25 -16
  118. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index591.js +14 -2
  119. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index592.js +4 -23
  120. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index593.js +23 -0
  121. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index594.js +1 -24
  122. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index595.js +24 -4
  123. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index596.js +4 -13
  124. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index597.js +9 -13
  125. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index598.js +13 -4
  126. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index599.js +4 -8
  127. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index600.js +8 -4
  128. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index601.js +8 -6
  129. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index602.js +6 -22
  130. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index603.js +17 -68
  131. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index604.js +66 -113
  132. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index605.js +104 -64
  133. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index606.js +72 -138
  134. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index607.js +144 -28
  135. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index608.js +28 -16
  136. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index609.js +14 -87
  137. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index610.js +91 -3
  138. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index611.js +3 -26
  139. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index612.js +22 -67
  140. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index613.js +71 -1
  141. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index614.js +0 -65
  142. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index615.js +66 -29
  143. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index616.js +30 -2
  144. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index617.js +2 -34
  145. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index618.js +33 -15
  146. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index619.js +14 -29
  147. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index620.js +29 -26
  148. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index621.js +30 -2
  149. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index622.js +2 -97
  150. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index623.js +97 -0
  151. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +1 -1
  152. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  153. package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteWrapper.js +1 -1
  154. package/package.json +1 -1
@@ -1,81 +1,133 @@
1
- import { Textarea as e } from "./index106.js";
2
- import { Typography as t } from "./index62.js";
3
- import { Field as n, FieldContent as r, FieldDescription as i, FieldError as a, FieldLabel as o } from "./index88.js";
4
- import { jsx as s, jsxs as c } from "@emotion/react/jsx-runtime";
5
- import { useLingui as l } from "@lingui/react";
6
- import { Controller as u, useFormContext as d } from "react-hook-form";
1
+ import { Scope as e } from "../../shared/data-access/dist/lib/scopes.js";
2
+ import "../../shared/data-access/dist/index.js";
3
+ import { Skeleton as t } from "./index54.js";
4
+ import { Typography as n } from "./index62.js";
5
+ import { Field as r, FieldContent as i, FieldError as a } from "./index88.js";
6
+ import { Select as o, SelectContent as s, SelectItem as c, SelectSeparator as l, SelectTrigger as u, SelectValue as d } from "./index105.js";
7
+ import { useUserPermissions as f } from "./index116.js";
8
+ import { getLineLabel as p, getSourceLabel as m } from "./index124.js";
9
+ import { useSelectableBankAccounts as h } from "./index125.js";
10
+ import "./index222.js";
11
+ import { Badge as g } from "./index223.js";
12
+ import { Alert as _, AlertDescription as v, AlertTitle as y } from "./index257.js";
13
+ import { BankAccountSectionForm as b } from "./index499.js";
14
+ import { useEffect as x, useRef as S, useState as C } from "react";
15
+ import { Plus as w, TriangleAlert as T } from "lucide-react";
16
+ import { Fragment as E, jsx as D, jsxs as O } from "@emotion/react/jsx-runtime";
17
+ import { useLingui as k } from "@lingui/react";
18
+ import { Controller as A, useFormContext as j } from "react-hook-form";
7
19
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index500.js
8
- var f = ({ disabled: f }) => {
9
- let { i18n: p } = l(), { control: m } = d();
10
- return /* @__PURE__ */ c("div", {
20
+ var M = ({ disabled: M, embeddedBankName: N }) => {
21
+ let { i18n: P } = k(), F = S(!1), { control: I, setValue: L, getFieldState: R, clearErrors: z } = j(), [B, V] = C(!1), H = f().has(e.BankAccountWriteOrg), { bankAccounts: U, isLoading: W } = h(), G = R("bank_account_id");
22
+ return x(() => {
23
+ if (U.length === 1 && !W && !F.current) {
24
+ let e = U[0];
25
+ L("bank_account_id", e.id), L("bank_account_type", e.bank_account_type), F.current = !0;
26
+ }
27
+ }, [
28
+ L,
29
+ U,
30
+ W
31
+ ]), /* @__PURE__ */ O("div", {
11
32
  className: "ttw:flex ttw:flex-col ttw:p-6 ttw:gap-2.5 ttw:border ttw:border-border ttw:rounded-xl",
12
- children: [
13
- /* @__PURE__ */ c("div", {
14
- className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
15
- children: [/* @__PURE__ */ s(t, {
16
- variant: "h4",
17
- children: p._("Notes")
18
- }), /* @__PURE__ */ s(t, {
33
+ children: [/* @__PURE__ */ O("div", {
34
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
35
+ children: [/* @__PURE__ */ D(n, {
36
+ variant: "h4",
37
+ children: P._("Payment instructions")
38
+ }), /* @__PURE__ */ D(n, {
39
+ variant: "body2",
40
+ color: "muted",
41
+ className: "ttw:font-medium",
42
+ children: P._("Tells the customer how they can pay you. We'll include the selected info on the invoice")
43
+ })]
44
+ }), W || U.length > 0 && !B ? /* @__PURE__ */ O("div", {
45
+ className: "ttw:flex ttw:flex-col ttw:p-3 ttw:gap-4 ttw:border ttw:border-border ttw:rounded-xl",
46
+ children: [/* @__PURE__ */ O("div", {
47
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
48
+ children: [/* @__PURE__ */ D(n, {
19
49
  variant: "body2",
50
+ children: P._("Bank account")
51
+ }), /* @__PURE__ */ D(n, {
52
+ variant: "caption",
20
53
  color: "muted",
21
- className: "ttw:font-medium",
22
- children: p._("Provide additional information for your customer.")
54
+ children: P._("Display your bank account number and routing number")
23
55
  })]
24
- }),
25
- /* @__PURE__ */ s(u, {
26
- name: "memo",
27
- control: m,
28
- render: ({ field: l, fieldState: { error: u } }) => /* @__PURE__ */ s(n, { children: /* @__PURE__ */ c(r, { children: [
29
- /* @__PURE__ */ c(o, {
30
- htmlFor: l.name,
31
- className: "ttw:text-nowrap",
32
- children: [p._("Opening note to the customer"), /* @__PURE__ */ s(t, {
33
- variant: "body2",
34
- color: "muted",
35
- className: "ttw:leading-snug",
36
- children: p._("(optional)")
37
- })]
38
- }),
39
- /* @__PURE__ */ s(e, {
40
- ...l,
41
- id: l.name,
42
- disabled: f,
43
- placeholder: p._("e.g., As discussed on our call, please find the attached invoice."),
44
- className: "ttw:h-26 ttw:resize-none",
45
- "aria-invalid": !!u
46
- }),
47
- /* @__PURE__ */ s(i, { children: p._("Appears above your line items. Use it to reference a discussion, agreement, or project.") }),
48
- /* @__PURE__ */ s(a, { errors: u ? [u] : [] })
49
- ] }) })
50
- }),
51
- /* @__PURE__ */ s(u, {
52
- name: "footer",
53
- control: m,
54
- render: ({ field: l, fieldState: { error: u } }) => /* @__PURE__ */ s(n, { children: /* @__PURE__ */ c(r, { children: [
55
- /* @__PURE__ */ c(o, {
56
- htmlFor: l.name,
57
- className: "ttw:text-nowrap",
58
- children: [p._("Closing note to the customer"), /* @__PURE__ */ s(t, {
59
- variant: "body2",
60
- color: "muted",
61
- className: "ttw:leading-snug",
62
- children: p._("(optional)")
63
- })]
64
- }),
65
- /* @__PURE__ */ s(e, {
66
- ...l,
67
- id: l.name,
68
- disabled: f,
69
- placeholder: p._("e.g., Thank you for your business!"),
70
- className: "ttw:h-26 ttw:resize-none",
71
- "aria-invalid": !!u
72
- }),
73
- /* @__PURE__ */ s(i, { children: p._("Appears below your line items. Commonly used for thank you messages or payment instructions.") }),
74
- /* @__PURE__ */ s(a, { errors: u ? [u] : [] })
75
- ] }) })
76
- })
77
- ]
56
+ }), W ? /* @__PURE__ */ D(t, { className: "ttw:w-full ttw:h-9 ttw:rounded-md" }) : /* @__PURE__ */ D(A, {
57
+ name: "bank_account_id",
58
+ control: I,
59
+ render: ({ field: e, fieldState: { error: t } }) => {
60
+ let n = U.find((t) => t.id === e.value), f = n ? m(n.bank_account_type, N, P) : null;
61
+ return /* @__PURE__ */ D(r, { children: /* @__PURE__ */ O(i, { children: [/* @__PURE__ */ D("div", {
62
+ className: "ttw:relative",
63
+ children: /* @__PURE__ */ O(o, {
64
+ ...e,
65
+ disabled: M,
66
+ value: e.value,
67
+ onValueChange: (t) => {
68
+ if (t === "add_new") V(!0);
69
+ else {
70
+ e.onChange(t);
71
+ let n = U.find((e) => e.id === t);
72
+ n && L("bank_account_type", n.bank_account_type), G?.invalid && z("bank_account_id");
73
+ }
74
+ },
75
+ children: [/* @__PURE__ */ D(u, {
76
+ id: "bank_account_id",
77
+ className: "ttw:w-full",
78
+ "aria-label": P._("Bank account selector"),
79
+ "aria-invalid": !!t,
80
+ children: /* @__PURE__ */ D(d, {
81
+ placeholder: P._("Select bank account"),
82
+ children: n && /* @__PURE__ */ O("span", {
83
+ className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:items-center ttw:justify-between ttw:gap-2",
84
+ children: [/* @__PURE__ */ D("span", {
85
+ className: "ttw:truncate",
86
+ children: p(n, P)
87
+ }), f && /* @__PURE__ */ D(g, {
88
+ variant: "secondary",
89
+ className: "ttw:shrink-0",
90
+ children: f
91
+ })]
92
+ })
93
+ })
94
+ }), /* @__PURE__ */ O(s, { children: [U.map((e) => {
95
+ let t = m(e.bank_account_type, N, P);
96
+ return /* @__PURE__ */ D(c, {
97
+ value: e.id,
98
+ children: /* @__PURE__ */ O("span", {
99
+ className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:items-center ttw:justify-between ttw:gap-2",
100
+ children: [/* @__PURE__ */ D("span", {
101
+ className: "ttw:truncate",
102
+ children: p(e, P)
103
+ }), t && /* @__PURE__ */ D("span", {
104
+ className: "ttw:shrink-0 ttw:text-muted-foreground",
105
+ children: t
106
+ })]
107
+ })
108
+ }, e.id);
109
+ }), H && /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(l, {}), /* @__PURE__ */ O(c, {
110
+ value: "add_new",
111
+ className: "ttw:text-primary ttw:hover:text-primary ttw:font-semibold ttw:focus:text-primary",
112
+ children: [/* @__PURE__ */ D(w, { className: "ttw:text-primary ttw:hover:text-primary ttw:font-semibold ttw:focus:text-primary" }), P._("Add a new account")]
113
+ })] })] })]
114
+ })
115
+ }), /* @__PURE__ */ D(a, { errors: t ? [t] : [] })] }) });
116
+ }
117
+ })]
118
+ }) : /* @__PURE__ */ D(E, { children: H ? /* @__PURE__ */ D(b, {
119
+ bankAccountsLength: U.length,
120
+ onCreate: (e) => {
121
+ V(!1), L("bank_account_id", e), L("bank_account_type", "BANK_DETAILS"), G?.invalid && z("bank_account_id");
122
+ },
123
+ onCancel: () => V(!1)
124
+ }) : /* @__PURE__ */ O(_, {
125
+ enableClose: !1,
126
+ variant: "warning",
127
+ icon: /* @__PURE__ */ D(T, {}),
128
+ children: [/* @__PURE__ */ D(y, { children: P._("There are no bank accounts on file for this account") }), /* @__PURE__ */ D(v, { children: P._("A bank account is required in order to issue invoices. Contact your company admin to set one up.") })]
129
+ }) })]
78
130
  });
79
131
  };
80
132
  //#endregion
81
- export { f as NotesSection };
133
+ export { M as BankAccountSection };
@@ -1,250 +1,81 @@
1
- import { cn as e } from "./index49.js";
2
- import { Button as t } from "./index56.js";
3
- import { useFileInput as n } from "./index209.js";
4
- import "./index217.js";
5
- import { Typography as r } from "./index62.js";
6
- import { Separator as i } from "./index64.js";
7
- import { ATTACHMENT_ACCEPTED_EXTENSIONS as a, ATTACHMENT_ACCEPTED_FORMATS as o } from "./index93.js";
8
- import { Checkbox as s } from "./index103.js";
9
- import { validateAttachmentFile as c } from "./index192.js";
10
- import { formatFileSize as l } from "./index193.js";
11
- import { toFileArray as u } from "./index194.js";
12
- import { useUploadReceivableAttachment as d } from "./index220.js";
13
- import { useDeleteFile as f } from "./index221.js";
14
- import { useEffect as p, useRef as m, useState as h } from "react";
15
- import { FileText as g, ImageIcon as _, Loader2 as v, Trash2 as y, X as b } from "lucide-react";
16
- import { Fragment as x, jsx as S, jsxs as C } from "@emotion/react/jsx-runtime";
17
- import { useLingui as w } from "@lingui/react";
18
- import { useFormContext as T } from "react-hook-form";
1
+ import { Textarea as e } from "./index106.js";
2
+ import { Typography as t } from "./index62.js";
3
+ import { Field as n, FieldContent as r, FieldDescription as i, FieldError as a, FieldLabel as o } from "./index88.js";
4
+ import { jsx as s, jsxs as c } from "@emotion/react/jsx-runtime";
5
+ import { useLingui as l } from "@lingui/react";
6
+ import { Controller as u, useFormContext as d } from "react-hook-form";
19
7
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index501.js
20
- var E = ({ disabled: E, onUploadingChange: D }) => {
21
- let { i18n: O } = w(), { watch: k, setValue: A, getValues: j } = T(), { mutateAsync: M } = d(), { mutate: N } = f(), { FileInput: P, openFileInput: F, resetInput: I } = n({
22
- acceptedFormats: o,
23
- maxFileSizeInMB: 3
24
- }), L = k("attachments") ?? [], R = k("frequency"), z = !!R && R !== "once", [B, V] = h([]), [H, U] = h(!1), [W, G] = h(!1), K = m(0), q = m(!1);
25
- p(() => (q.current = !1, () => {
26
- q.current = !0;
27
- }), []);
28
- let J = m(/* @__PURE__ */ new Set()), Y = B.some((e) => e.status === "uploading");
29
- p(() => {
30
- D?.(Y);
31
- }, [Y, D]), p(() => () => D?.(!1), [D]);
32
- let X = () => (K.current += 1, `attachment-${K.current}`), Z = (e) => e === "too_large" ? O._("File too large (max 3 MB)") : O._("File type not supported. Use PDF, DOC, JPG or PNG"), Q = async (e, t) => {
33
- try {
34
- let n = await M({
35
- file: t,
36
- file_type: "attachments"
37
- });
38
- if (q.current || J.current.delete(e)) {
39
- N({ path: { file_id: n.id } });
40
- return;
41
- }
42
- V((t) => t.filter((t) => t.localId !== e)), A("attachments", [...j("attachments") ?? [], {
43
- id: n.id,
44
- include_in_email: !0,
45
- name: n.name,
46
- size: n.size
47
- }], { shouldDirty: !0 });
48
- } catch {
49
- let t = J.current.delete(e);
50
- if (q.current || t) return;
51
- V((t) => t.map((t) => t.localId === e ? {
52
- ...t,
53
- status: "error",
54
- errorMessage: O._("Upload failed. Please try again.")
55
- } : t));
56
- }
57
- }, $ = (e) => {
58
- if (e.length === 0) return;
59
- let t = j("attachments") ?? [], n = B.filter((e) => e.status === "uploading").length, r = 10 - t.length - n, i = [], s = !1;
60
- for (let t of e) {
61
- let e = c(t, {
62
- acceptedFormats: o,
63
- acceptedExtensions: a,
64
- maxFileSizeInMB: 3
65
- });
66
- if (e) {
67
- i.push({
68
- localId: X(),
69
- name: t.name,
70
- size: t.size,
71
- status: "error",
72
- errorMessage: Z(e)
73
- });
74
- continue;
75
- }
76
- if (r <= 0) {
77
- s = !0;
78
- continue;
79
- }
80
- --r;
81
- let n = X();
82
- i.push({
83
- localId: n,
84
- name: t.name,
85
- size: t.size,
86
- status: "uploading"
87
- }), Q(n, t);
88
- }
89
- i.length > 0 && V((e) => [...e, ...i]), U(s);
90
- }, ee = (e, t) => {
91
- A("attachments", (j("attachments") ?? []).map((n) => n.id === e ? {
92
- ...n,
93
- include_in_email: t
94
- } : n), { shouldDirty: !0 });
95
- }, te = (e) => {
96
- A("attachments", (j("attachments") ?? []).filter((t) => t.id !== e), { shouldDirty: !0 }), U(!1), N({ path: { file_id: e } });
97
- }, ne = (e) => {
98
- B.some((t) => t.localId === e && t.status === "uploading") && J.current.add(e), V((t) => t.filter((t) => t.localId !== e)), U(!1);
99
- }, re = (e) => {
100
- e.preventDefault(), G(!1), !E && $(u(e.dataTransfer.files));
101
- }, ie = L.length > 0 || B.length > 0;
102
- return /* @__PURE__ */ C("div", {
8
+ var f = ({ disabled: f }) => {
9
+ let { i18n: p } = l(), { control: m } = d();
10
+ return /* @__PURE__ */ c("div", {
103
11
  className: "ttw:flex ttw:flex-col ttw:p-6 ttw:gap-2.5 ttw:border ttw:border-border ttw:rounded-xl",
104
12
  children: [
105
- /* @__PURE__ */ C("div", {
13
+ /* @__PURE__ */ c("div", {
106
14
  className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
107
- children: [/* @__PURE__ */ S(r, {
15
+ children: [/* @__PURE__ */ s(t, {
108
16
  variant: "h4",
109
- children: O._("Attachments")
110
- }), /* @__PURE__ */ S(r, {
17
+ children: p._("Notes")
18
+ }), /* @__PURE__ */ s(t, {
111
19
  variant: "body2",
112
20
  color: "muted",
113
21
  className: "ttw:font-medium",
114
- children: O._("Associate additional documents with this invoice for your own reference or to share with the customer. e.g. contracts, photos, terms and conditions, etc.")
22
+ children: p._("Provide additional information for your customer.")
115
23
  })]
116
24
  }),
117
- ie && /* @__PURE__ */ C("div", {
118
- className: "ttw:flex ttw:flex-col ttw:gap-2",
119
- children: [L.length > 0 && /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(r, {
120
- variant: "caption",
121
- color: "muted",
122
- children: z ? O._("Selected files will be attached to every invoice email in the recurring series.") : O._("Selected files will be attached to the invoice email sent to the customer.")
123
- }), /* @__PURE__ */ S(i, {})] }), /* @__PURE__ */ C("ul", {
124
- className: "ttw:flex ttw:flex-col ttw:gap-2",
125
- children: [L.map((e) => {
126
- let n = `attachment-include-${e.id}`;
127
- return /* @__PURE__ */ C("li", {
128
- className: "ttw:flex ttw:items-center ttw:gap-2",
129
- children: [/* @__PURE__ */ S(s, {
130
- id: n,
131
- checked: e.include_in_email,
132
- disabled: E,
133
- "aria-label": `${O._("Include in email:")} ${e.name}`,
134
- onCheckedChange: (t) => ee(e.id, t === !0)
135
- }), /* @__PURE__ */ C("div", {
136
- className: "ttw:flex ttw:w-full ttw:items-center ttw:rounded-lg ttw:gap-3 ttw:bg-muted ttw:px-2 ttw:py-1",
137
- children: [/* @__PURE__ */ C("div", {
138
- className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:items-center ttw:gap-1",
139
- children: [/* @__PURE__ */ S(r, {
140
- variant: "body2",
141
- className: "ttw:truncate",
142
- children: e.name
143
- }), /* @__PURE__ */ C(r, {
144
- variant: "body2",
145
- color: "muted",
146
- className: "ttw:shrink-0",
147
- children: [
148
- "(",
149
- l(e.size),
150
- ")"
151
- ]
152
- })]
153
- }), /* @__PURE__ */ S(t, {
154
- type: "button",
155
- variant: "ghost",
156
- size: "icon",
157
- className: "ttw:size-4",
158
- disabled: E,
159
- "aria-label": `${O._("Remove")} ${e.name}`,
160
- onClick: () => te(e.id),
161
- children: /* @__PURE__ */ S(y, { className: "ttw:size-4" })
162
- })]
163
- })]
164
- }, e.id);
165
- }), B.map((e) => /* @__PURE__ */ C("li", {
166
- className: "ttw:flex ttw:w-full ttw:items-center ttw:rounded-lg ttw:gap-3 ttw:bg-muted ttw:px-2 ttw:py-1",
167
- children: [
168
- e.status === "uploading" ? /* @__PURE__ */ S(v, { className: "ttw:size-5 ttw:shrink-0 ttw:animate-spin ttw:text-muted-foreground" }) : /* @__PURE__ */ S(g, { className: "ttw:size-5 ttw:shrink-0 ttw:text-destructive" }),
169
- /* @__PURE__ */ C("div", {
170
- className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:flex-col",
171
- children: [/* @__PURE__ */ S(r, {
172
- variant: "body2",
173
- className: "ttw:truncate",
174
- children: e.name
175
- }), e.status === "uploading" ? /* @__PURE__ */ S(r, {
176
- variant: "caption",
177
- color: "muted",
178
- children: O._("Uploading…")
179
- }) : /* @__PURE__ */ S(r, {
180
- variant: "caption",
181
- role: "alert",
182
- className: "ttw:text-destructive",
183
- children: e.errorMessage
184
- })]
185
- }),
186
- /* @__PURE__ */ S(t, {
187
- type: "button",
188
- variant: "ghost",
189
- size: "icon",
190
- disabled: E,
191
- "aria-label": `${O._("Remove")} ${e.name}`,
192
- onClick: () => ne(e.localId),
193
- children: /* @__PURE__ */ S(b, { className: "ttw:size-4" })
194
- })
195
- ]
196
- }, e.localId))]
197
- })]
198
- }),
199
- /* @__PURE__ */ C("button", {
200
- type: "button",
201
- disabled: E,
202
- onClick: F,
203
- onDragOver: (e) => {
204
- e.preventDefault(), E || G(!0);
205
- },
206
- onDragLeave: (e) => {
207
- e.preventDefault(), G(!1);
208
- },
209
- onDrop: re,
210
- className: e("ttw:flex ttw:w-full ttw:flex-col ttw:items-center ttw:gap-2 ttw:rounded-xl ttw:border ttw:border-dashed ttw:p-6 ttw:text-center ttw:disabled:cursor-not-allowed ttw:disabled:opacity-50", W ? "ttw:border-primary ttw:bg-primary/5" : "ttw:border-border ttw:bg-muted"),
211
- children: [
212
- /* @__PURE__ */ S("span", {
213
- className: "ttw:flex ttw:size-10 ttw:items-center ttw:justify-center ttw:rounded-full ttw:border ttw:border-border",
214
- children: /* @__PURE__ */ S(_, { className: "ttw:size-5 ttw:text-muted-foreground" })
25
+ /* @__PURE__ */ s(u, {
26
+ name: "memo",
27
+ control: m,
28
+ render: ({ field: l, fieldState: { error: u } }) => /* @__PURE__ */ s(n, { children: /* @__PURE__ */ c(r, { children: [
29
+ /* @__PURE__ */ c(o, {
30
+ htmlFor: l.name,
31
+ className: "ttw:text-nowrap",
32
+ children: [p._("Opening note to the customer"), /* @__PURE__ */ s(t, {
33
+ variant: "body2",
34
+ color: "muted",
35
+ className: "ttw:leading-snug",
36
+ children: p._("(optional)")
37
+ })]
215
38
  }),
216
- /* @__PURE__ */ C(r, {
217
- variant: "body2",
218
- children: [
219
- O._("Drop your files here, or"),
220
- " ",
221
- /* @__PURE__ */ S("span", {
222
- className: "ttw:text-primary ttw:underline",
223
- children: O._("browse to upload")
224
- })
225
- ]
39
+ /* @__PURE__ */ s(e, {
40
+ ...l,
41
+ id: l.name,
42
+ disabled: f,
43
+ placeholder: p._("e.g., As discussed on our call, please find the attached invoice."),
44
+ className: "ttw:h-26 ttw:resize-none",
45
+ "aria-invalid": !!u
226
46
  }),
227
- /* @__PURE__ */ S(r, {
228
- variant: "caption",
229
- color: "muted",
230
- children: O._("PDF, DOC, JPG, PNG (max. 3MB)")
231
- })
232
- ]
47
+ /* @__PURE__ */ s(i, { children: p._("Appears above your line items. Use it to reference a discussion, agreement, or project.") }),
48
+ /* @__PURE__ */ s(a, { errors: u ? [u] : [] })
49
+ ] }) })
233
50
  }),
234
- H && /* @__PURE__ */ S(r, {
235
- variant: "body2",
236
- role: "alert",
237
- className: "ttw:text-destructive",
238
- children: O._("You can attach up to 10 files.")
239
- }),
240
- /* @__PURE__ */ S(P, {
241
- multiple: !0,
242
- onChange: (e) => {
243
- $(u(e.target.files)), I();
244
- }
51
+ /* @__PURE__ */ s(u, {
52
+ name: "footer",
53
+ control: m,
54
+ render: ({ field: l, fieldState: { error: u } }) => /* @__PURE__ */ s(n, { children: /* @__PURE__ */ c(r, { children: [
55
+ /* @__PURE__ */ c(o, {
56
+ htmlFor: l.name,
57
+ className: "ttw:text-nowrap",
58
+ children: [p._("Closing note to the customer"), /* @__PURE__ */ s(t, {
59
+ variant: "body2",
60
+ color: "muted",
61
+ className: "ttw:leading-snug",
62
+ children: p._("(optional)")
63
+ })]
64
+ }),
65
+ /* @__PURE__ */ s(e, {
66
+ ...l,
67
+ id: l.name,
68
+ disabled: f,
69
+ placeholder: p._("e.g., Thank you for your business!"),
70
+ className: "ttw:h-26 ttw:resize-none",
71
+ "aria-invalid": !!u
72
+ }),
73
+ /* @__PURE__ */ s(i, { children: p._("Appears below your line items. Commonly used for thank you messages or payment instructions.") }),
74
+ /* @__PURE__ */ s(a, { errors: u ? [u] : [] })
75
+ ] }) })
245
76
  })
246
77
  ]
247
78
  });
248
79
  };
249
80
  //#endregion
250
- export { E as AttachmentSection };
81
+ export { f as NotesSection };