@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,120 +1,73 @@
1
- import { Button as e } from "./index56.js";
2
- import { useMyEntity as t } from "./index137.js";
3
- import "./index142.js";
4
- import { LOGO_SUPPORTED_FORMATS as n, useFileInput as r } from "./index209.js";
5
- import "./index217.js";
6
- import { Skeleton as i } from "./index54.js";
7
- import { Typography as a } from "./index62.js";
8
- import { useUploadEntityLogo as o } from "./index596.js";
9
- import { useDeleteEntityLogo as s } from "./index597.js";
10
- import "./index601.js";
11
- import { DragAndDropBox as c } from "./index603.js";
12
- import { useState as l } from "react";
13
- import { SquarePen as u, Trash2 as d } from "lucide-react";
14
- import { Fragment as f, jsx as p, jsxs as m } from "@emotion/react/jsx-runtime";
15
- import { toast as h } from "react-hot-toast";
16
- import { useLingui as g } from "@lingui/react";
1
+ import { LoadingSpinner as e } from "./index51.js";
2
+ import "./index52.js";
3
+ import { Typography as t } from "./index62.js";
4
+ import { UploadBar as n } from "./index603.js";
5
+ import { useEffect as r } from "react";
6
+ import { AlertCircle as i, CheckCircle2 as a, CloudUpload as o, X as s } from "lucide-react";
7
+ import { Fragment as c, jsx as l, jsxs as u } from "@emotion/react/jsx-runtime";
8
+ import { useLingui as d } from "@lingui/react";
9
+ import { twMerge as f } from "tailwind-merge";
17
10
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index604.js
18
- var _ = () => {
19
- let { i18n: _ } = g(), { data: v, isLoading: y } = t(), b = v?.id ?? "", { FileInput: x, openFileInput: S, checkFileError: C, resetInput: w } = r({
20
- acceptedFormats: n,
21
- maxFileSizeInMB: 10
22
- }), [T, E] = l(!1), [D, O] = l(""), { mutateAsync: k, isSuccess: A, isError: j, isPending: M, reset: N } = o(), { mutate: P, isPending: F } = s(b);
23
- async function I(e) {
24
- if (e) {
25
- let t = C(e);
26
- if (t) {
27
- h.error(t);
28
- return;
29
- }
30
- O(e.name), await k({
31
- body: { file: e },
32
- path: { entity_id: b }
33
- }), w(), O("");
34
- }
11
+ var p = ({ isUploading: p, isSuccess: m, isError: h, isDraggingOver: g, resetUpload: _, fileName: v, onClick: y }) => {
12
+ let { i18n: b } = d(), x = p || m || h;
13
+ function S() {
14
+ return h ? /* @__PURE__ */ l(i, { className: "ttw:size-5 ttw:text-danger" }) : m ? /* @__PURE__ */ l(a, { className: "ttw:size-5 ttw:text-success" }) : /* @__PURE__ */ l(e, { className: "ttw:w-5 ttw:h-5" });
35
15
  }
36
- let L = M || j, R = !!v?.logo && !D && !L && !y;
37
- return /* @__PURE__ */ m("div", {
38
- className: "ttw:flex ttw:flex-col ttw:gap-2.5",
39
- children: [/* @__PURE__ */ m("div", {
40
- className: "ttw:pt-5 ttw:pb-2.5 ttw:flex ttw:flex-col ttw:gap-1.5",
41
- children: [/* @__PURE__ */ p(a, {
42
- variant: "h3",
43
- children: _._("Branding")
44
- }), /* @__PURE__ */ p(a, {
16
+ return r(() => {
17
+ let e;
18
+ return m && (e = setTimeout(() => _(), 2e3)), () => clearTimeout(e);
19
+ }, [m, _]), /* @__PURE__ */ l("div", {
20
+ className: f("ttw:w-full ttw:h-38 ttw:bg-white ttw:box-border ttw:transition-all ttw:flex ttw:flex-col ttw:items-center ttw:justify-center ttw:text-center ttw:gap-2 ttw:rounded-lg ttw:border ttw:px-4 ttw:py-6", g ? "ttw:border-solid ttw:border-primary" : "ttw:border-dashed ttw:border-border"),
21
+ onClick: () => {
22
+ x || y();
23
+ },
24
+ children: x ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ u("div", {
25
+ className: "ttw:flex ttw:gap-4 ttw:justify-center ttw:w-full",
26
+ children: [/* @__PURE__ */ u("div", {
27
+ className: "ttw:flex ttw:gap-2 ttw:w-1/2 ttw:items-center",
28
+ children: [S(), /* @__PURE__ */ l("span", {
29
+ className: "ttw:w-full ttw:text-sm ttw:leading-5 ttw:text-medium ttw:text-neutral ttw:truncate",
30
+ children: v
31
+ })]
32
+ }), /* @__PURE__ */ u("div", {
33
+ className: "ttw:flex ttw:gap-2 ttw:items-center",
34
+ children: [/* @__PURE__ */ l(n, {
35
+ shouldStartProgress: p,
36
+ isError: h,
37
+ isSuccess: m
38
+ }), h && /* @__PURE__ */ l("button", {
39
+ type: "button",
40
+ disabled: p,
41
+ onClick: _,
42
+ className: "ttw:border-none ttw:cursor-pointer",
43
+ children: /* @__PURE__ */ l(s, { className: "ttw:size-4" })
44
+ })]
45
+ })]
46
+ }), h && /* @__PURE__ */ l(t, {
47
+ variant: "body2",
48
+ color: "destructive",
49
+ className: "ttw:font-medium",
50
+ children: b._("Wrong file format. Please, upload the file in JPEG, PNG or GIF format.")
51
+ })] }) : /* @__PURE__ */ u(c, { children: [
52
+ /* @__PURE__ */ l("div", {
53
+ className: "ttw:p-3 ttw:bg-primary ttw:rounded-full",
54
+ children: /* @__PURE__ */ l(o, { className: "ttw:text-white ttw:size-5" })
55
+ }),
56
+ /* @__PURE__ */ u(t, {
45
57
  variant: "body2",
58
+ className: "ttw:font-medium",
59
+ children: [b._("Drop your files here, or "), /* @__PURE__ */ l("span", {
60
+ className: "ttw:text-primary ttw:underline ttw:hover:cursor-pointer",
61
+ children: b._("click to browse")
62
+ })]
63
+ }),
64
+ /* @__PURE__ */ l(t, {
65
+ variant: "caption",
46
66
  color: "muted",
47
- children: _._("Control how your invoices will appear to your customers by adding your company's logo. Changes apply to new invoices only.")
48
- })]
49
- }), /* @__PURE__ */ m("div", {
50
- className: "ttw:flex ttw:flex-col ttw:gap-4",
51
- onDragEnter: (e) => {
52
- e.preventDefault(), E(!0);
53
- },
54
- onDragLeave: (e) => {
55
- e.preventDefault(), E(!1);
56
- },
57
- onDragOver: (e) => e.preventDefault(),
58
- onDrop: (e) => {
59
- e.preventDefault(), E(!1), I(e.dataTransfer?.files ? e.dataTransfer?.files?.[0] : null);
60
- },
61
- children: [
62
- /* @__PURE__ */ m("div", {
63
- className: "ttw:flex ttw:flex-col ttw:gap-0.5",
64
- children: [/* @__PURE__ */ p(a, {
65
- variant: "body1",
66
- className: "ttw:font-medium",
67
- children: _._("Upload your company logo")
68
- }), /* @__PURE__ */ p(a, {
69
- variant: "body2",
70
- className: "ttw:leading-5",
71
- color: "muted",
72
- children: _._("Proudly display your logo on all your invoices.")
73
- })]
74
- }),
75
- /* @__PURE__ */ m("div", {
76
- className: "ttw:flex ttw:flex-col ttw:items-end ttw:gap-2",
77
- children: [y ? /* @__PURE__ */ p(i, { className: "ttw:w-full ttw:h-38 ttw:bg-zinc-200" }) : /* @__PURE__ */ p(f, { children: R ? /* @__PURE__ */ p("div", {
78
- className: "ttw:flex ttw:w-full ttw:h-38 ttw:box-border",
79
- children: /* @__PURE__ */ p("img", {
80
- src: v?.logo?.url,
81
- className: "ttw:w-auto ttw:max-w-full ttw:object-contain ttw:max-h-38",
82
- alt: _._("Organization logo")
83
- })
84
- }) : /* @__PURE__ */ p(c, {
85
- isUploading: M,
86
- isSuccess: A,
87
- isError: j,
88
- isDraggingOver: T,
89
- fileName: D,
90
- resetUpload: () => {
91
- w(), N(), O("");
92
- },
93
- onClick: S
94
- }) }), !T && R && /* @__PURE__ */ m("div", {
95
- className: "ttw:flex ttw:gap-4",
96
- children: [/* @__PURE__ */ p(e, {
97
- variant: "ghost",
98
- size: "sm",
99
- onClick: S,
100
- "aria-label": _._("Edit logo"),
101
- children: /* @__PURE__ */ p(u, { className: "ttw:size-4 ttw:w-fit" })
102
- }), v?.logo && /* @__PURE__ */ p(e, {
103
- variant: "ghost",
104
- size: "sm",
105
- disabled: F,
106
- "aria-label": _._("Delete logo"),
107
- onClick: () => P(),
108
- children: /* @__PURE__ */ p(d, { className: "ttw:size-4" })
109
- })]
110
- })]
111
- }),
112
- /* @__PURE__ */ p(x, { onChange: (e) => {
113
- I(e.target.files ? e.target.files[0] : null);
114
- } })
115
- ]
116
- })]
67
+ children: b._("PNG, JPG or GIF (max. 10MB)")
68
+ })
69
+ ] })
117
70
  });
118
71
  };
119
72
  //#endregion
120
- export { _ as LogoSection };
73
+ export { p as DragAndDropBox };
@@ -1,80 +1,120 @@
1
- import { Typography as e } from "./index62.js";
2
- import { Switch as t } from "./index469.js";
3
- import { jsx as n, jsxs as r } from "@emotion/react/jsx-runtime";
4
- import { useLingui as i } from "@lingui/react";
5
- import { twMerge as a } from "tailwind-merge";
6
- import { Controller as o, useFormContext as s } from "react-hook-form";
1
+ import { Button as e } from "./index56.js";
2
+ import { useMyEntity as t } from "./index137.js";
3
+ import "./index142.js";
4
+ import { LOGO_SUPPORTED_FORMATS as n, useFileInput as r } from "./index209.js";
5
+ import "./index217.js";
6
+ import { Skeleton as i } from "./index54.js";
7
+ import { Typography as a } from "./index62.js";
8
+ import { useUploadEntityLogo as o } from "./index597.js";
9
+ import { useDeleteEntityLogo as s } from "./index598.js";
10
+ import "./index602.js";
11
+ import { DragAndDropBox as c } from "./index604.js";
12
+ import { useState as l } from "react";
13
+ import { SquarePen as u, Trash2 as d } from "lucide-react";
14
+ import { Fragment as f, jsx as p, jsxs as m } from "@emotion/react/jsx-runtime";
15
+ import { toast as h } from "react-hot-toast";
16
+ import { useLingui as g } from "@lingui/react";
7
17
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index605.js
8
- var c = ({ control: c, isDialog: l }) => {
9
- let { i18n: u } = i(), { watch: d, setValue: f } = s(), p = d("invoice_bank_display");
10
- return /* @__PURE__ */ r("div", {
18
+ var _ = () => {
19
+ let { i18n: _ } = g(), { data: v, isLoading: y } = t(), b = v?.id ?? "", { FileInput: x, openFileInput: S, checkFileError: C, resetInput: w } = r({
20
+ acceptedFormats: n,
21
+ maxFileSizeInMB: 10
22
+ }), [T, E] = l(!1), [D, O] = l(""), { mutateAsync: k, isSuccess: A, isError: j, isPending: M, reset: N } = o(), { mutate: P, isPending: F } = s(b);
23
+ async function I(e) {
24
+ if (e) {
25
+ let t = C(e);
26
+ if (t) {
27
+ h.error(t);
28
+ return;
29
+ }
30
+ O(e.name), await k({
31
+ body: { file: e },
32
+ path: { entity_id: b }
33
+ }), w(), O("");
34
+ }
35
+ }
36
+ let L = M || j, R = !!v?.logo && !D && !L && !y;
37
+ return /* @__PURE__ */ m("div", {
11
38
  className: "ttw:flex ttw:flex-col ttw:gap-2.5",
12
- children: [/* @__PURE__ */ r("div", {
13
- className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:pt-5 ttw:pb-2.5",
14
- children: [/* @__PURE__ */ n(e, {
39
+ children: [/* @__PURE__ */ m("div", {
40
+ className: "ttw:pt-5 ttw:pb-2.5 ttw:flex ttw:flex-col ttw:gap-1.5",
41
+ children: [/* @__PURE__ */ p(a, {
15
42
  variant: "h3",
16
- children: u._("PDF settings")
17
- }), /* @__PURE__ */ n(e, {
43
+ children: _._("Branding")
44
+ }), /* @__PURE__ */ p(a, {
18
45
  variant: "body2",
19
46
  color: "muted",
20
- children: u._("Invoices are generated as PDFs")
47
+ children: _._("Control how your invoices will appear to your customers by adding your company's logo. Changes apply to new invoices only.")
21
48
  })]
22
- }), /* @__PURE__ */ r("div", {
23
- className: a("ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-lg", l ? "ttw:bg-zinc-100 ttw:p-4" : ""),
24
- children: [/* @__PURE__ */ r("section", {
25
- className: "ttw:flex ttw:justify-between ttw:gap-4",
26
- children: [/* @__PURE__ */ r("div", {
27
- className: "ttw:flex ttw:flex-col ttw:gap-1",
28
- children: [/* @__PURE__ */ n(e, {
49
+ }), /* @__PURE__ */ m("div", {
50
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
51
+ onDragEnter: (e) => {
52
+ e.preventDefault(), E(!0);
53
+ },
54
+ onDragLeave: (e) => {
55
+ e.preventDefault(), E(!1);
56
+ },
57
+ onDragOver: (e) => e.preventDefault(),
58
+ onDrop: (e) => {
59
+ e.preventDefault(), E(!1), I(e.dataTransfer?.files ? e.dataTransfer?.files?.[0] : null);
60
+ },
61
+ children: [
62
+ /* @__PURE__ */ m("div", {
63
+ className: "ttw:flex ttw:flex-col ttw:gap-0.5",
64
+ children: [/* @__PURE__ */ p(a, {
29
65
  variant: "body1",
30
66
  className: "ttw:font-medium",
31
- children: u._("Display your bank account details on the PDF")
32
- }), /* @__PURE__ */ n(e, {
67
+ children: _._("Upload your company logo")
68
+ }), /* @__PURE__ */ p(a, {
33
69
  variant: "body2",
70
+ className: "ttw:leading-5",
34
71
  color: "muted",
35
- children: u._("Shows your bank account number, routing number, and account holder name so that customers can pay using an ACH bank transfer. Should only be used with accounts that have a debit block.")
72
+ children: _._("Proudly display your logo on all your invoices.")
36
73
  })]
37
- }), /* @__PURE__ */ n(t, {
38
- checked: p,
39
- onCheckedChange: (e) => {
40
- f("invoice_bank_display", e, { shouldDirty: !0 });
41
- },
42
- "aria-label": u._("Display bank display options")
43
- })]
44
- }), /* @__PURE__ */ r("section", {
45
- className: "ttw:flex ttw:justify-between ttw:gap-4",
46
- children: [/* @__PURE__ */ r("div", {
47
- className: "ttw:flex ttw:flex-col ttw:gap-1",
48
- children: [
49
- /* @__PURE__ */ n(e, {
50
- variant: "body1",
51
- className: "ttw:font-medium",
52
- children: u._("Update PDF files for paid invoices")
53
- }),
54
- /* @__PURE__ */ n(e, {
55
- variant: "body2",
56
- color: "muted",
57
- children: u._("PDF invoice files will be regenerated to reflect payments made and any remaining amount due. Once a PDF has been updated, you won't be able to revert it.")
58
- }),
59
- /* @__PURE__ */ n(e, {
60
- variant: "body2",
61
- color: "muted",
62
- className: "ttw:font-medium",
63
- children: u._("Once updated, you won't be able to revert the PDFs.")
74
+ }),
75
+ /* @__PURE__ */ m("div", {
76
+ className: "ttw:flex ttw:flex-col ttw:items-end ttw:gap-2",
77
+ children: [y ? /* @__PURE__ */ p(i, { className: "ttw:w-full ttw:h-38 ttw:bg-zinc-200" }) : /* @__PURE__ */ p(f, { children: R ? /* @__PURE__ */ p("div", {
78
+ className: "ttw:flex ttw:w-full ttw:h-38 ttw:box-border",
79
+ children: /* @__PURE__ */ p("img", {
80
+ src: v?.logo?.url,
81
+ className: "ttw:w-auto ttw:max-w-full ttw:object-contain ttw:max-h-38",
82
+ alt: _._("Organization logo")
64
83
  })
65
- ]
66
- }), /* @__PURE__ */ n(o, {
67
- name: "update_paid_invoices",
68
- control: c,
69
- render: ({ field: e }) => /* @__PURE__ */ n(t, {
70
- checked: e.value,
71
- onCheckedChange: e.onChange,
72
- "aria-label": u._("Enable update paid invoices pdf")
73
- })
74
- })]
75
- })]
84
+ }) : /* @__PURE__ */ p(c, {
85
+ isUploading: M,
86
+ isSuccess: A,
87
+ isError: j,
88
+ isDraggingOver: T,
89
+ fileName: D,
90
+ resetUpload: () => {
91
+ w(), N(), O("");
92
+ },
93
+ onClick: S
94
+ }) }), !T && R && /* @__PURE__ */ m("div", {
95
+ className: "ttw:flex ttw:gap-4",
96
+ children: [/* @__PURE__ */ p(e, {
97
+ variant: "ghost",
98
+ size: "sm",
99
+ onClick: S,
100
+ "aria-label": _._("Edit logo"),
101
+ children: /* @__PURE__ */ p(u, { className: "ttw:size-4 ttw:w-fit" })
102
+ }), v?.logo && /* @__PURE__ */ p(e, {
103
+ variant: "ghost",
104
+ size: "sm",
105
+ disabled: F,
106
+ "aria-label": _._("Delete logo"),
107
+ onClick: () => P(),
108
+ children: /* @__PURE__ */ p(d, { className: "ttw:size-4" })
109
+ })]
110
+ })]
111
+ }),
112
+ /* @__PURE__ */ p(x, { onChange: (e) => {
113
+ I(e.target.files ? e.target.files[0] : null);
114
+ } })
115
+ ]
76
116
  })]
77
117
  });
78
118
  };
79
119
  //#endregion
80
- export { c as PDFSettings };
120
+ export { _ as LogoSection };
@@ -1,146 +1,80 @@
1
- import { Input as e } from "./index89.js";
2
- import { Typography as t } from "./index62.js";
3
- import { Field as n, FieldContent as r, FieldError as i, FieldLabel as a } from "./index88.js";
4
- import { Checkbox as o } from "./index103.js";
5
- import { jsx as s, jsxs as c } from "@emotion/react/jsx-runtime";
6
- import { useLingui as l } from "@lingui/react";
7
- import { Controller as u, useFormContext as d } from "react-hook-form";
1
+ import { Typography as e } from "./index62.js";
2
+ import { Switch as t } from "./index469.js";
3
+ import { jsx as n, jsxs as r } from "@emotion/react/jsx-runtime";
4
+ import { useLingui as i } from "@lingui/react";
5
+ import { twMerge as a } from "tailwind-merge";
6
+ import { Controller as o, useFormContext as s } from "react-hook-form";
8
7
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index606.js
9
- var f = ({ control: f }) => {
10
- let { i18n: p } = l(), { setValue: m, watch: h } = d(), g = h("min_digits"), _ = h("prefix"), v = h("separator"), y = h("include_date"), b = h("invoice"), x = h("invoice_number");
11
- function S() {
12
- return `${b}${v}${_ ? `${_}${v}` : ""}${y ? `${(/* @__PURE__ */ new Date()).getFullYear()}${v}` : ""}${x.toString().padStart(g, "0")}`;
13
- }
14
- let C = S();
15
- return /* @__PURE__ */ c("div", {
8
+ var c = ({ control: c, isDialog: l }) => {
9
+ let { i18n: u } = i(), { watch: d, setValue: f } = s(), p = d("invoice_bank_display");
10
+ return /* @__PURE__ */ r("div", {
16
11
  className: "ttw:flex ttw:flex-col ttw:gap-2.5",
17
- children: [
18
- /* @__PURE__ */ c("div", {
19
- className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:pt-5 ttw:pb-2.5",
20
- children: [/* @__PURE__ */ s(t, {
21
- variant: "h3",
22
- children: p._("Invoice numbering")
23
- }), /* @__PURE__ */ s(t, {
24
- variant: "body2",
25
- color: "muted",
26
- children: p._("Specify how you want your invoices to be numbered. Changes apply to new invoices only. Existing invoice numbers won't be updated.")
12
+ children: [/* @__PURE__ */ r("div", {
13
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:pt-5 ttw:pb-2.5",
14
+ children: [/* @__PURE__ */ n(e, {
15
+ variant: "h3",
16
+ children: u._("PDF settings")
17
+ }), /* @__PURE__ */ n(e, {
18
+ variant: "body2",
19
+ color: "muted",
20
+ children: u._("Invoices are generated as PDFs")
21
+ })]
22
+ }), /* @__PURE__ */ r("div", {
23
+ className: a("ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-lg", l ? "ttw:bg-zinc-100 ttw:p-4" : ""),
24
+ children: [/* @__PURE__ */ r("section", {
25
+ className: "ttw:flex ttw:justify-between ttw:gap-4",
26
+ children: [/* @__PURE__ */ r("div", {
27
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
28
+ children: [/* @__PURE__ */ n(e, {
29
+ variant: "body1",
30
+ className: "ttw:font-medium",
31
+ children: u._("Display your bank account details on the PDF")
32
+ }), /* @__PURE__ */ n(e, {
33
+ variant: "body2",
34
+ color: "muted",
35
+ children: u._("Shows your bank account number, routing number, and account holder name so that customers can pay using an ACH bank transfer. Should only be used with accounts that have a debit block.")
36
+ })]
37
+ }), /* @__PURE__ */ n(t, {
38
+ checked: p,
39
+ onCheckedChange: (e) => {
40
+ f("invoice_bank_display", e, { shouldDirty: !0 });
41
+ },
42
+ "aria-label": u._("Display bank display options")
27
43
  })]
28
- }),
29
- /* @__PURE__ */ c("div", {
30
- className: "ttw:flex ttw:flex-col ttw:w-94 ttw:gap-0.5 ttw:p-4 ttw:bg-neutral-200 ttw:rounded-xl",
31
- children: [/* @__PURE__ */ s(t, {
32
- variant: "body2",
33
- color: "muted",
34
- children: p._("Preview")
35
- }), /* @__PURE__ */ s(t, {
36
- variant: "h4",
37
- className: "ttw:font-medium",
38
- children: C
39
- })]
40
- }),
41
- /* @__PURE__ */ c("div", {
42
- className: "ttw:flex ttw:w-min ttw:gap-2 ttw:p-2",
43
- children: [
44
- /* @__PURE__ */ s(u, {
45
- name: "invoice",
46
- control: f,
47
- render: ({ field: t, fieldState: { error: o } }) => /* @__PURE__ */ s(n, { children: /* @__PURE__ */ c(r, {
48
- className: "ttw:grow-0",
49
- children: [
50
- /* @__PURE__ */ s(a, {
51
- htmlFor: t.name,
52
- children: p._("Invoice prefix")
53
- }),
54
- /* @__PURE__ */ s(e, {
55
- ...t,
56
- id: t.name,
57
- maxLength: 25,
58
- "aria-invalid": !!o || void 0,
59
- className: "ttw:w-29 ttw:min-w-29 ttw:bg-white"
60
- }),
61
- /* @__PURE__ */ s(i, { errors: [o] })
62
- ]
63
- }) })
64
- }),
65
- /* @__PURE__ */ s(u, {
66
- name: "invoice_number",
67
- control: f,
68
- render: ({ field: t, fieldState: { error: o } }) => /* @__PURE__ */ s(n, { children: /* @__PURE__ */ c(r, {
69
- className: "ttw:grow-0",
70
- children: [
71
- /* @__PURE__ */ s(a, {
72
- htmlFor: t.name,
73
- children: p._("Starting number")
74
- }),
75
- /* @__PURE__ */ s(e, {
76
- ...t,
77
- id: t.name,
78
- type: "number",
79
- "aria-invalid": !!o || void 0,
80
- onChange: (e) => {
81
- let n = e.target.value.replace(/^0+(?=\d)/, "");
82
- t.onChange(Number(n));
83
- },
84
- value: t.value.toString().padStart(g, "0"),
85
- className: "ttw:w-29 ttw:min-w-29 ttw:bg-white"
86
- }),
87
- /* @__PURE__ */ s(i, { errors: [o] })
88
- ]
89
- }) })
90
- }),
91
- /* @__PURE__ */ s(u, {
92
- name: "min_digits",
93
- control: f,
94
- render: ({ field: t, fieldState: { error: o } }) => /* @__PURE__ */ s(n, { children: /* @__PURE__ */ c(r, {
95
- className: "ttw:grow-0",
96
- children: [
97
- /* @__PURE__ */ s(a, {
98
- htmlFor: t.name,
99
- children: p._("Digit count")
100
- }),
101
- /* @__PURE__ */ s(e, {
102
- ...t,
103
- id: t.name,
104
- type: "number",
105
- className: "ttw:bg-white ttw:w-29 ttw:max-w-29",
106
- onChange: (e) => {
107
- +e.target.value > 20 ? m("min_digits", 20, { shouldDirty: !0 }) : t.onChange(e);
108
- },
109
- "aria-invalid": !!o || void 0
110
- }),
111
- /* @__PURE__ */ s(i, { errors: [o] })
112
- ]
113
- }) })
114
- })
115
- ]
116
- }),
117
- /* @__PURE__ */ s("div", {
118
- className: "ttw:bg-transparent ttw:w-full ttw:p-2",
119
- children: /* @__PURE__ */ s(u, {
120
- name: "include_date",
121
- control: f,
122
- render: ({ field: e }) => /* @__PURE__ */ s(n, {
123
- orientation: "horizontal",
124
- children: /* @__PURE__ */ c(r, {
125
- className: "ttw:flex-row ttw:items-center",
126
- children: [/* @__PURE__ */ s(o, {
127
- id: e.name,
128
- ref: e.ref,
129
- checked: e.value ?? !1,
130
- onCheckedChange: e.onChange,
131
- onBlur: e.onBlur,
132
- className: "ttw:bg-white"
133
- }), /* @__PURE__ */ s(a, {
134
- htmlFor: e.name,
135
- className: "ttw:font-normal",
136
- children: p._("Include the current year in the invoice number prefix")
137
- })]
44
+ }), /* @__PURE__ */ r("section", {
45
+ className: "ttw:flex ttw:justify-between ttw:gap-4",
46
+ children: [/* @__PURE__ */ r("div", {
47
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
48
+ children: [
49
+ /* @__PURE__ */ n(e, {
50
+ variant: "body1",
51
+ className: "ttw:font-medium",
52
+ children: u._("Update PDF files for paid invoices")
53
+ }),
54
+ /* @__PURE__ */ n(e, {
55
+ variant: "body2",
56
+ color: "muted",
57
+ children: u._("PDF invoice files will be regenerated to reflect payments made and any remaining amount due. Once a PDF has been updated, you won't be able to revert it.")
58
+ }),
59
+ /* @__PURE__ */ n(e, {
60
+ variant: "body2",
61
+ color: "muted",
62
+ className: "ttw:font-medium",
63
+ children: u._("Once updated, you won't be able to revert the PDFs.")
138
64
  })
65
+ ]
66
+ }), /* @__PURE__ */ n(o, {
67
+ name: "update_paid_invoices",
68
+ control: c,
69
+ render: ({ field: e }) => /* @__PURE__ */ n(t, {
70
+ checked: e.value,
71
+ onCheckedChange: e.onChange,
72
+ "aria-label": u._("Enable update paid invoices pdf")
139
73
  })
140
- })
141
- })
142
- ]
74
+ })]
75
+ })]
76
+ })]
143
77
  });
144
78
  };
145
79
  //#endregion
146
- export { f as InvoiceNumbering };
80
+ export { c as PDFSettings };